target
stringlengths
5
300
feat_repo_name
stringlengths
6
76
text
stringlengths
26
1.05M
testData/chitContext.js
paramadeep/chit
import React from 'react'; import {newChit} from './chit'; import {ChitsContext} from '../src/contexts/ChitsContext'; const chit1 = newChit(); const chit2 = newChit(); chit1.name = 'Chit1'; chit2.name = 'Chit2'; chit2.id = 'Chit2'; export const chits = [chit1, chit2]; const data = { chits, }; export const chitContext = ({children}) => { return <ChitsContext.Provider value={data}>{children}</ChitsContext.Provider>; };
src/svg-icons/action/settings-applications.js
mit-cml/iot-website-source
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ActionSettingsApplications = (props) => ( <SvgIcon {...props}> <path d="M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm7-7H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-1.75 9c0 .23-.02.46-.05.68l1.48 1.16c.13.11.17.3.08.45l-1.4 2.42c-.09.15-.27.21-.43.15l-1.74-.7c-.36.28-.76.51-1.18.69l-.26 1.85c-.03.17-.18.3-.35.3h-2.8c-.17 0-.32-.13-.35-.29l-.26-1.85c-.43-.18-.82-.41-1.18-.69l-1.74.7c-.16.06-.34 0-.43-.15l-1.4-2.42c-.09-.15-.05-.34.08-.45l1.48-1.16c-.03-.23-.05-.46-.05-.69 0-.23.02-.46.05-.68l-1.48-1.16c-.13-.11-.17-.3-.08-.45l1.4-2.42c.09-.15.27-.21.43-.15l1.74.7c.36-.28.76-.51 1.18-.69l.26-1.85c.03-.17.18-.3.35-.3h2.8c.17 0 .32.13.35.29l.26 1.85c.43.18.82.41 1.18.69l1.74-.7c.16-.06.34 0 .43.15l1.4 2.42c.09.15.05.34-.08.45l-1.48 1.16c.03.23.05.46.05.69z"/> </SvgIcon> ); ActionSettingsApplications = pure(ActionSettingsApplications); ActionSettingsApplications.displayName = 'ActionSettingsApplications'; ActionSettingsApplications.muiName = 'SvgIcon'; export default ActionSettingsApplications;
relay-demo/relay-treasurehunt/node_modules/react/lib/ReactTestRenderer.js
zhangjunhd/react-examples
/** * Copyright 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ReactTestRenderer */ 'use strict'; var _assign = require('object-assign'); function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } var ReactComponentEnvironment = require('./ReactComponentEnvironment'); var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy'); var ReactEmptyComponent = require('./ReactEmptyComponent'); var ReactMultiChild = require('./ReactMultiChild'); var ReactHostComponent = require('./ReactHostComponent'); var ReactTestMount = require('./ReactTestMount'); var ReactTestReconcileTransaction = require('./ReactTestReconcileTransaction'); var ReactUpdates = require('./ReactUpdates'); var renderSubtreeIntoContainer = require('./renderSubtreeIntoContainer'); /** * Drill down (through composites and empty components) until we get a native or * native text component. * * This is pretty polymorphic but unavoidable with the current structure we have * for `_renderedChildren`. */ function getRenderedHostOrTextFromComponent(component) { var rendered; while (rendered = component._renderedComponent) { component = rendered; } return component; } // ============================================================================= var ReactTestComponent = function (element) { this._currentElement = element; this._renderedChildren = null; this._topLevelWrapper = null; }; ReactTestComponent.prototype.mountComponent = function (transaction, nativeParent, nativeContainerInfo, context) { var element = this._currentElement; this.mountChildren(element.props.children, transaction, context); }; ReactTestComponent.prototype.receiveComponent = function (nextElement, transaction, context) { this._currentElement = nextElement; this.updateChildren(nextElement.props.children, transaction, context); }; ReactTestComponent.prototype.getHostNode = function () {}; ReactTestComponent.prototype.getPublicInstance = function () { // I can't say this makes a ton of sense but it seems better than throwing. // Maybe we'll revise later if someone has a good use case. return null; }; ReactTestComponent.prototype.unmountComponent = function () {}; ReactTestComponent.prototype.toJSON = function () { var _currentElement$props = this._currentElement.props; var children = _currentElement$props.children; var props = _objectWithoutProperties(_currentElement$props, ['children']); var childrenJSON = []; for (var key in this._renderedChildren) { var inst = this._renderedChildren[key]; inst = getRenderedHostOrTextFromComponent(inst); var json = inst.toJSON(); if (json !== undefined) { childrenJSON.push(json); } } var object = { type: this._currentElement.type, props: props, children: childrenJSON.length ? childrenJSON : null }; Object.defineProperty(object, '$$typeof', { value: Symbol['for']('react.test.json') }); return object; }; _assign(ReactTestComponent.prototype, ReactMultiChild.Mixin); // ============================================================================= var ReactTestTextComponent = function (element) { this._currentElement = element; }; ReactTestTextComponent.prototype.mountComponent = function () {}; ReactTestTextComponent.prototype.receiveComponent = function (nextElement) { this._currentElement = nextElement; }; ReactTestTextComponent.prototype.getHostNode = function () {}; ReactTestTextComponent.prototype.unmountComponent = function () {}; ReactTestTextComponent.prototype.toJSON = function () { return this._currentElement; }; // ============================================================================= var ReactTestEmptyComponent = function (element) { this._currentElement = null; }; ReactTestEmptyComponent.prototype.mountComponent = function () {}; ReactTestEmptyComponent.prototype.receiveComponent = function () {}; ReactTestEmptyComponent.prototype.getHostNode = function () {}; ReactTestEmptyComponent.prototype.unmountComponent = function () {}; ReactTestEmptyComponent.prototype.toJSON = function () {}; // ============================================================================= ReactUpdates.injection.injectReconcileTransaction(ReactTestReconcileTransaction); ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy); ReactHostComponent.injection.injectGenericComponentClass(ReactTestComponent); ReactHostComponent.injection.injectTextComponentClass(ReactTestTextComponent); ReactEmptyComponent.injection.injectEmptyComponentFactory(function () { return new ReactTestEmptyComponent(); }); ReactComponentEnvironment.injection.injectEnvironment({ processChildrenUpdates: function () {}, replaceNodeWithMarkup: function () {} }); var ReactTestRenderer = { create: ReactTestMount.render, /* eslint-disable camelcase */ unstable_batchedUpdates: ReactUpdates.batchedUpdates, unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer }; /* eslint-enable camelcase */ module.exports = ReactTestRenderer;
src/index.js
LonelyObserver/gallery-by-react
import 'core-js/fn/object/assign'; import React from 'react'; import ReactDOM from 'react-dom'; import App from './components/Main'; // Render the main component into the dom ReactDOM.render(<App />, document.getElementById('app'));
dashboard/app/components/Login/Login.js
tlisonbee/cerberus-management-service
import React from 'react' import { Component } from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' import * as messengerActions from '../../actions/messengerActions' import Messenger from '../Messenger/Messenger' import './Login.scss' import LoginUserForm from '../LoginUserForm/LoginUserForm' import LoginMfaForm from '../LoginMfaForm/LoginMfaForm' // connect to the store for the pieces we care about @connect((state) => { return { isSessionExpired: state.auth.isSessionExpired, isMfaRequired: state.auth.isMfaRequired, statusText: state.auth.statusText, initialValues: { redirectTo: state.routing.locationBeforeTransitions.query.next || '/' } } }) export default class LoginForm extends Component { static propTypes = { dispatch: PropTypes.func.isRequired, isMfaRequired: PropTypes.bool.isRequired, } componentDidMount() { this.props.dispatch(messengerActions.clearAllMessages()) } render() { const {isSessionExpired, isMfaRequired} = this.props return ( <div id='login-container' className=''> <div id='login-form-div'> <header> <div id='logo-container'> <div className='cerberus-logo'></div> </div> <h1 className='ncss-brand'>CERBERUS MANAGEMENT DASHBOARD</h1> </header> { isSessionExpired && <div id="session-expired-message"> Your session has expired and you are required to re-authenticate </div> } <Messenger /> { !isMfaRequired && <LoginUserForm /> } { isMfaRequired && <LoginMfaForm /> } </div> </div> ) } }
test/components/PriceBadge.spec.js
Byte-Code/lm-digitalstore
import React from 'react'; import { shallow } from 'enzyme'; import { fromJS } from 'immutable'; import PriceBadge, { Discount } from '../../app/components/PriceBadge'; describe('PriceBadge', () => { it('should only render the price if no discount is active', () => { const price = fromJS({ gross: 10 }); const pricingInfo = fromJS({ sellingCapacity: 'unit', sellingUnit: 'unit' }); const result = shallow( <PriceBadge price={price} pricingInfo={pricingInfo} /> ); const discount = result.find(Discount); expect(result).toMatchSnapshot(); expect(discount).toHaveLength(0); }); it('should also render the discount when it is active', () => { const price = fromJS({ list: 15, gross: 10, discount: 5 }); const pricingInfo = fromJS({ sellingCapacity: 'unit', sellingUnit: 'unit' }); const result = shallow( <PriceBadge price={price} pricingInfo={pricingInfo} /> ); const discount = result.find(Discount); expect(result).toMatchSnapshot(); expect(discount).toHaveLength(1); }); });
src/svg-icons/image/photo-album.js
hwo411/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImagePhotoAlbum = (props) => ( <SvgIcon {...props}> <path d="M18 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 4h5v8l-2.5-1.5L6 12V4zm0 15l3-3.86 2.14 2.58 3-3.86L18 19H6z"/> </SvgIcon> ); ImagePhotoAlbum = pure(ImagePhotoAlbum); ImagePhotoAlbum.displayName = 'ImagePhotoAlbum'; ImagePhotoAlbum.muiName = 'SvgIcon'; export default ImagePhotoAlbum;
docs/src/examples/elements/Input/Variations/InputExampleActions.js
Semantic-Org/Semantic-UI-React
import React from 'react' import { Button, Select, Input } from 'semantic-ui-react' const options = [ { key: 'all', text: 'All', value: 'all' }, { key: 'articles', text: 'Articles', value: 'articles' }, { key: 'products', text: 'Products', value: 'products' }, ] const InputExampleActions = () => ( <Input type='text' placeholder='Search...' action> <input /> <Select compact options={options} defaultValue='articles' /> <Button type='submit'>Search</Button> </Input> ) export default InputExampleActions
client/auth/Error.js
bryanph/Geist
import React from 'react' export const ValidationErrors = (props) => { const errors = props.errors if (!errors) { return <noscipt /> } const fields = Object.keys(errors) if (!fields.length) { return <noscript /> } const errorList = fields.map(field => ( <li>invalid field {field}: {errors[field]}</li> )) return ( <div className="panel error"> <h5>Errors were found!</h5> <ul> { errorList } </ul> </div> ) } export const RenderErrors = (props) => { const errors = props.errors if (!errors || !errors.length) { return <noscript /> } let errorList = errors.map(error => ( <li>{error}</li> )) return ( <ul> {errorList} </ul> ) }
draft-js-buttons/src/utils/createBlockAlignmentButton.js
dagopert/draft-js-plugins
/* eslint-disable react/no-children-prop */ import React, { Component } from 'react'; import unionClassNames from 'union-class-names'; export default ({ alignment, children }) => ( class BlockAlignmentButton extends Component { activate = (event) => { event.preventDefault(); this.props.setAlignment({ alignment }); } preventBubblingUp = (event) => { event.preventDefault(); } isActive = () => this.props.alignment === alignment; render() { const { theme } = this.props; const className = this.isActive() ? unionClassNames(theme.button, theme.active) : theme.button; return ( <div className={theme.buttonWrapper} onMouseDown={this.preventBubblingUp} > <button className={className} onClick={this.activate} type="button" children={children} /> </div> ); } } );
src/js/__tests__/NewsList.react-test.js
colw/cowpat
// NewsList.react-test.js import React from 'react'; import NewsItem from '../NewsItem'; import renderer from 'react-test-renderer'; import NewsList from '../NewsList'; const data = { "newsItems": [{ "author": "Associated Press", "guid": "https://www.washingtonpost.com/world/asia_pacific/afghan-official-7-killed-in-a-suicide-attack/2017/02/11/e3879406-f053-11e6-a100-fdaaf400369a_story.html", "link": "https://www.washingtonpost.com/world/asia_pacific/afghan-official-7-killed-in-a-suicide-attack/2017/02/11/e3879406-f053-11e6-a100-fdaaf400369a_story.html", "title": "Afghan official: 7 killed in a suicide attack", "sitehost": "www.washingtonpost.com", "itemID": "01c6f30bd8afd1d464662450eaa3e2e0", "metalink": "http://www.washingtonpost.com/pb/world/", "tags": "[\"afghan official\",\"killed\",\"suicide attack\"]", "metatitle": "World", "date": "Thu Jan 01 1970 00:00:00 GMT+0000 (UTC)", "sitelink": "http://www.washingtonpost.com", "description": "An Afghan official says at least seven people were killed when a suicide bomber attacked Afghan soldiers in southern Helmand province." }], "filterTags": "[\"afghan official\",\"killed\",\"suicide attack\"]" }; test('NewsList Stub', () => { const component = renderer.create( <NewsList key={1} loading={true} newsItems={data.newsItems} filterText={''} filterTags={data.filterTags}/> ); let tree = component.toJSON(); expect(tree).toMatchSnapshot(); });
src/components/box/box.js
growcss/docs
import React from 'react'; import PropTypes from 'prop-types'; import { Container } from './box.css'; const Box = ({ children }) => <Container>{children}</Container>; Box.propTypes = { children: PropTypes.node.isRequired, }; export default Box;
src/components/Contentful/Page/presenter.js
ndlib/usurper
// Presenter component for a Page content type from Contentful import React from 'react' import PropTypes from 'prop-types' import 'static/css/global.css' import LibMarkdown from 'components/LibMarkdown' import Related from '../Related' import PageTitle from 'components/Layout/PageTitle' import SearchProgramaticSet from 'components/SearchProgramaticSet' import PageAlert from '../Alert/Page' import ContactPoint from '../ContactPoint/' import OpenGraph from 'components/OpenGraph' import Link from 'components/Interactive/Link' const PagePresenter = ({ cfPageEntry }) => ( <article aria-describedby='main-page-title' className='container-fluid content-area'> {cfPageEntry.fields.parentPage && ( <Link to={cfPageEntry.fields.parentPage.fields.slug} className='breadcrumb'> Back to {cfPageEntry.fields.parentPage.fields.alternateTitle || cfPageEntry.fields.parentPage.fields.title} </Link> )} {cfPageEntry.fields.shortDescription && (<meta name='description' content={cfPageEntry.fields.shortDescription} />)} <PageTitle title={cfPageEntry.fields.title} /> <OpenGraph title={cfPageEntry.fields.title} description={cfPageEntry.fields.shortDescription} image={cfPageEntry.fields.image} /> <SearchProgramaticSet open={cfPageEntry.fields.searchPanelOpen} /> <div className='row'> <main className='col-md-8 col-sm-7'> <div className='pageAlertContainer'> <PageAlert alerts={cfPageEntry.fields.alerts} /> </div> <div className='mobile-only'> <ContactPoint cfPageEntry={cfPageEntry} mobile /> </div> <LibMarkdown>{cfPageEntry.fields.body}</LibMarkdown> <Related className='p-resources' title={cfPageEntry.fields.relatedResourcesTitleOverride ? cfPageEntry.fields.relatedResourcesTitleOverride : 'Featured Resources'} showImages={false} > {cfPageEntry.fields.relatedResources} </Related> <Related className='p-guides' title='Guides' showTitle={false} showImages={false}> {cfPageEntry.fields.libguides} </Related> <Related className='p-services' title='Featured Services'>{cfPageEntry.fields.relatedServices}</Related> { cfPageEntry.fields.relatedExtraSections && cfPageEntry.fields.relatedExtraSections.map((entry, index) => { const fields = entry.fields let className = 'p-resources' let showImages = false if (fields.extraData) { switch (fields.extraData.displayType) { case 'guides': className = 'p-guides' break case 'services': className = 'p-services' showImages = true break case 'resources': default: className = 'p-resources' } } return ( <Related className={className} title={fields.displayName} showImages={showImages} key={index + '_related'} > {fields.items} </Related> ) }) } </main> <ContactPoint cfPageEntry={cfPageEntry} mobile={false} /> </div> </article> ) PagePresenter.propTypes = { cfPageEntry: PropTypes.object.isRequired, } export default PagePresenter
client/src/components/home/HomePage.js
andela-pbirir/CP2-DMS
import React from 'react'; import LoginPage from '../Auth/Login/LoginPage'; class HomePage extends React.Component { render() { return ( <div> <LoginPage /> </div> ); } } export default HomePage;
app/javascript/src/AppRoutes.js
michelson/chaskiq
import React from 'react' import { connect } from 'react-redux' import AppContainer from './pages/AppContainer' import Apps from './pages/Apps' import Login from './pages/auth/login' import NewApp from './pages/NewApp' import NotFound from './pages/NotFound' import UnSubscribe from './pages/UnSubscribe' import AcceptInvitation from './pages/auth/acceptInvitation' import { Switch, Route, withRouter } from 'react-router-dom' import ZoomImage from './components/ImageZoomOverlay' import LoadingView from './components/loadingView' import Snackbar from './components/Alert' import { clearLocks } from './actions/upgradePages' function mapStateToProps (state) { const { auth, current_user, theme } = state const { loading, isAuthenticated } = auth return { current_user, loading, isAuthenticated, theme } } function AppRouter ({ isAuthenticated, current_user, location, dispatch, theme }) { const [reload, setReload] = React.useState(false) React.useEffect(() => { I18n.locale = current_user.lang || I18n.defaultLocale }, []) React.useEffect(() => { if (current_user.lang) { if (I18n.locale === current_user.lang) return I18n.locale = current_user.lang setReload(true) setTimeout(() => { setReload(false) }, 400) } }, [current_user.lang]) React.useEffect(() => { dispatch(clearLocks()) }, [location.key]) return ( <div className={`${theme}`}> <ZoomImage/> <Snackbar /> { reload && <LoadingView/> } { !reload && <Switch> <Route path="/agents/invitation/accept" render={(props) => ( <AcceptInvitation {...props} /> )} /> <Route path={'/campaigns/:id/subscribers/:subscriber/delete'} render={(props) => ( <UnSubscribe {...props} /> )}> </Route> { !isAuthenticated && <Route path="/"> <Login /> </Route> } <Route path="/" exact> <Apps /> </Route> <Route path="/apps" exact> <Apps /> </Route> <Route path="/apps/new" exact> <NewApp /> </Route> <Route path="/apps/:appId"> <AppContainer /> </Route> <Route path="/signup" exact> <Login /> </Route> <Route> <NotFound /> </Route> </Switch> } </div> ) } export default withRouter(connect(mapStateToProps)(AppRouter))
app/javascript/mastodon/features/compose/containers/emoji_picker_dropdown_container.js
yi0713/mastodon
import { connect } from 'react-redux'; import EmojiPickerDropdown from '../components/emoji_picker_dropdown'; import { changeSetting } from '../../../actions/settings'; import { createSelector } from 'reselect'; import { Map as ImmutableMap } from 'immutable'; import { useEmoji } from '../../../actions/emojis'; const perLine = 8; const lines = 2; const DEFAULTS = [ '+1', 'grinning', 'kissing_heart', 'heart_eyes', 'laughing', 'stuck_out_tongue_winking_eye', 'sweat_smile', 'joy', 'yum', 'disappointed', 'thinking_face', 'weary', 'sob', 'sunglasses', 'heart', 'ok_hand', ]; const getFrequentlyUsedEmojis = createSelector([ state => state.getIn(['settings', 'frequentlyUsedEmojis'], ImmutableMap()), ], emojiCounters => { let emojis = emojiCounters .keySeq() .sort((a, b) => emojiCounters.get(a) - emojiCounters.get(b)) .reverse() .slice(0, perLine * lines) .toArray(); if (emojis.length < DEFAULTS.length) { let uniqueDefaults = DEFAULTS.filter(emoji => !emojis.includes(emoji)); emojis = emojis.concat(uniqueDefaults.slice(0, DEFAULTS.length - emojis.length)); } return emojis; }); const getCustomEmojis = createSelector([ state => state.get('custom_emojis'), ], emojis => emojis.filter(e => e.get('visible_in_picker')).sort((a, b) => { const aShort = a.get('shortcode').toLowerCase(); const bShort = b.get('shortcode').toLowerCase(); if (aShort < bShort) { return -1; } else if (aShort > bShort ) { return 1; } else { return 0; } })); const mapStateToProps = state => ({ custom_emojis: getCustomEmojis(state), skinTone: state.getIn(['settings', 'skinTone']), frequentlyUsedEmojis: getFrequentlyUsedEmojis(state), }); const mapDispatchToProps = (dispatch, { onPickEmoji }) => ({ onSkinTone: skinTone => { dispatch(changeSetting(['skinTone'], skinTone)); }, onPickEmoji: emoji => { dispatch(useEmoji(emoji)); if (onPickEmoji) { onPickEmoji(emoji); } }, }); export default connect(mapStateToProps, mapDispatchToProps)(EmojiPickerDropdown);
src/index.js
fervorous/fervor
import clientCookies from 'cookies-js'; import compose from 'lodash.flowright'; import { Query, Mutation, Subscription, graphql } from 'react-apollo'; import { Helmet } from 'react-helmet'; import { Link, Switch, Redirect, Route } from 'react-router-dom'; import PropTypes from 'prop-types'; import React from 'react'; import { Provider, connect } from 'react-redux'; import { push, replace, go, goBack, goForward } from 'connected-react-router'; import gqltag from './shared/gqltag'; import Document from './client/components/Document'; import Form from './client/components/Form'; module.exports = { clientCookies, compose, connect, historyActions: { push, replace, go, goBack, goForward, }, // NOTE: I don't like this function living here. // If it happens again let's find it a new home. gql: gqltag, Query, Mutation, Subscription, Provider, Link, Redirect, Route, Switch, graphql, PropTypes, React, Document, Meta: Helmet, Form, };
src/assets/js/react/components/Template/TemplateListItem.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' import { updateTemplateParam } from '../../actions/templates' import TemplateScreenshot from './TemplateScreenshot' import ShowMessage from '../ShowMessage' import { TemplateDetails, Group } from './TemplateListItemComponents' import { Name } from './TemplateSingleComponents' import TemplateActivateButton from './TemplateActivateButton' /** * Display the individual template item for usage our template list * * @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 TemplateListItem extends React.Component { /** * @since 4.1 */ static propTypes = { history: PropTypes.object, template: PropTypes.object, activeTemplate: PropTypes.string, updateTemplateParam: PropTypes.func, activateText: PropTypes.string, templateDetailsText: PropTypes.string } /** * Check if the Enter key is pressed and not focused on a button * then display the template details page * * @param {Object} e Event * * @since 4.1 */ maybeShowDetailedTemplate = (e) => { /* Show detailed template when the Enter key is pressed and the active element doesn't include a 'button' class */ if (e.keyCode === 13 && (e.target.className.indexOf('button') === -1)) { this.showDetailedTemplate() } } /** * Update the URL to show the PDF template details page * * @since 4.1 */ showDetailedTemplate = () => { this.props.history.push('/template/' + this.props.template.id) } /** * Call Redux action to remove any stored messages for this template * * @since 4.1 */ removeMessage = () => { this.props.updateTemplateParam(this.props.template['id'], 'message', null) } /** * @since 4.1 */ render () { const item = this.props.template const isActiveTemplate = this.props.activeTemplate === item['id'] const isCompatible = item['compatible'] const activeTemplate = (isActiveTemplate) ? 'active theme' : 'theme' return ( <div onClick={this.showDetailedTemplate} onKeyDown={this.maybeShowDetailedTemplate} className={activeTemplate} data-slug={item['id']} tabIndex="150"> <TemplateScreenshot image={item['screenshot']} /> {item['error'] ? <ShowMessage text={item['error']} error={true} /> : null} {item['message'] ? <ShowMessage text={item['message']} dismissableCallback={this.removeMessage} dismissable={true} delay={12000} /> : null} <TemplateDetails label={this.props.templateDetailsText} /> <Group group={item['group']} /> <Name name={item['template']} /> <div className="theme-actions"> {!isActiveTemplate && isCompatible ? <TemplateActivateButton template={this.props.template} buttonText={this.props.activateText} /> : null} </div> </div> ) } } /** * Map state to props * * @param {Object} state The current Redux State * * @returns {{activeTemplate: string}} * * @since 4.1 */ const mapStateToProps = (state) => { return { activeTemplate: state.template.activeTemplate } } /** * Map actions to props * * @param {func} dispatch Redux dispatcher * * @returns {{updateTemplateParam: (function(id=string, name=string, value=string))}} * * @since 4.1 */ const mapDispatchToProps = (dispatch) => { return { updateTemplateParam: (id, name, value) => { dispatch(updateTemplateParam(id, name, value)) } } } /** * Maps our Redux store to our React component * * @since 4.1 */ export default withRouter(connect(mapStateToProps, mapDispatchToProps)(TemplateListItem))
src/app/component/button/button.story.js
all3dp/printing-engine-client
import React from 'react' import {storiesOf} from '@storybook/react' import {action} from '@storybook/addon-actions' import Button from '.' import placeholderIcon from '../../../asset/icon/placeholder.svg' storiesOf('Button', module) .add('default', () => <Button label="Default Button" onClick={action('onClick')} />) .add('disabled', () => <Button label="Disabled Button" disabled onClick={action('onClick')} />) .add('with icon', () => ( <Button label="Button with Icon" icon={placeholderIcon} onClick={action('onClick')} /> )) .add('text', () => <Button label="Text Button" text onClick={action('onClick')} />) .add('block', () => <Button label="Block Button" block onClick={action('onClick')} />) .add('tiny', () => <Button label="Tiny Button" tiny onClick={action('onClick')} />) .add('selected', () => <Button label="Selected Button" selected onClick={action('onClick')} />) .add('minor', () => <Button label="Minor Button" minor onClick={action('onClick')} />) .add('minor & disabled', () => ( <Button label="Disabled Minor Button" disabled minor onClick={action('onClick')} /> )) .add('minor & tiny', () => ( <Button label="Tiny Minor Button" minor tiny onClick={action('onClick')} /> )) .add('iconOnly', () => <Button icon={placeholderIcon} iconOnly onClick={action('onClick')} />) .add('iconOnly & inlineIcon', () => ( <Button icon={placeholderIcon} iconOnly inlineIcon onClick={action('onClick')} /> )) .add('iconOnly & tiny', () => ( <Button icon={placeholderIcon} iconOnly tiny onClick={action('onClick')} /> )) .add('iconOnly & disabled', () => ( <Button icon={placeholderIcon} disabled iconOnly onClick={action('onClick')} /> )) .add('iconOnly & warning', () => ( <Button icon={placeholderIcon} iconOnly warning onClick={action('onClick')} /> )) .add('iconOnly & error', () => ( <Button icon={placeholderIcon} iconOnly error onClick={action('onClick')} /> )) .add('href', () => ( <Button href="https://google.com" label="Default Button" onClick={action('onClick')} /> ))
docs/app/Examples/elements/Rail/Variations/RailExampleAttachedInternal.js
clemensw/stardust
import React from 'react' import { Image, Rail, Segment } from 'semantic-ui-react' const RailExampleAttachedInternal = () => ( <Segment> <Image src='http://semantic-ui.com/images/wireframe/paragraph.png' /> <Rail attached internal position='left'> <Segment>Left Rail Content</Segment> </Rail> <Rail attached internal position='right'> <Segment>Right Rail Content</Segment> </Rail> </Segment> ) export default RailExampleAttachedInternal
packages/dante2/src/editor/components/Dante/Dante.js
michelson/Dante
import React from 'react'; import DanteEditor from "../core/editor.js" //import '../../styles/dante.scss'; // import '../../styled/draft.css' //import styles from '../src/editor/styled/draft.module.css' import DraftBaseStyles from '../../styled/draft-styled' import { Map, fromJS, merge } from 'immutable' import {DanteImagePopoverConfig} from '../popovers/image.js' import {DanteAnchorPopoverConfig} from '../popovers/link.js' import {DanteInlineTooltipConfig} from '../popovers/addButton.js' //'Dante2/es/components/popovers/addButton.js' import {DanteTooltipConfig} from '../popovers/toolTip.js' //'Dante2/es/components/popovers/toolTip.js' import {ImageBlockConfig} from '../blocks/image.js' import {EmbedBlockConfig} from '../blocks/embed.js' import {VideoBlockConfig} from '../blocks/video.js' import {PlaceholderBlockConfig} from '../blocks/placeholder.js' import {CodeBlockConfig} from '../blocks/code.js' import Link from '../decorators/link' import {PrismDraftDecorator} from '../decorators/prism' import { CompositeDecorator } from 'draft-js' import findEntities from '../../utils/find_entities' import MultiDecorator from 'draft-js-multidecorators' import EditorContainer from '../../styled/base' import { ThemeProvider } from 'emotion-theming' // custom blocks import PropTypes from 'prop-types' import defaultTheme from './themes/default' // component implementation class Dante extends React.Component { constructor(props) { super(props) } // componentDidMount() { } toggleEditable = () => { this.setState({ read_only: !this.state.read_only }) } render(){ return( <ThemeProvider theme={this.props.theme || defaultTheme}> <EditorContainer style={this.props.style}> <DraftBaseStyles> <DanteEditor styles { ...this.props } toggleEditable={this.toggleEditable} /> </DraftBaseStyles> </EditorContainer> </ThemeProvider> ) } } Dante.propTypes = { /** Editor content, it expects a null or a draft's EditorContent. */ content: PropTypes.object, read_only: PropTypes.bool, spellcheck: PropTypes.bool, title_placeholder: PropTypes.string, body_placeholder: PropTypes.string, xhr: PropTypes.shape({ before_handler: PropTypes.func, success_handler: PropTypes.func, error_handler: PropTypes.func }), data_storage: PropTypes.shape({ url: PropTypes.string, method: PropTypes.string, success_handler: PropTypes.func, failure_handler: PropTypes.func, interval: PropTypes.integer }), default_wrappers: PropTypes.arrayOf(PropTypes.shape({ className: PropTypes.string.isRequired, block: PropTypes.string.isRequired }) ), continuousBlocks: PropTypes.arrayOf(PropTypes.string), key_commands: PropTypes.object /*character_convert_mapping: PropTypes.shape({ '> ': "blockquote" })*/ } Dante.defaultProps = { content: null, read_only: false, spellcheck: false, title_placeholder: "Title", body_placeholder: "Write your story", decorators: (context)=>{ return new MultiDecorator([ PrismDraftDecorator(), new CompositeDecorator( [{ strategy: findEntities.bind(null, 'LINK', context), component: Link } ] ) ]) }, xhr: { before_handler: null, success_handler: null, error_handler: null }, data_storage: { url: null, method: "POST", success_handler: null, failure_handler: null, interval: 1500 }, default_wrappers: [ { className: 'graf--p', block: 'unstyled' }, { className: 'graf--h2', block: 'header-one' }, { className: 'graf--h3', block: 'header-two' }, { className: 'graf--h4', block: 'header-three' }, { className: 'graf--blockquote', block: 'blockquote' }, { className: 'graf--insertunorderedlist', block: 'unordered-list-item' }, { className: 'graf--insertorderedlist', block: 'ordered-list-item' }, { className: 'graf--code', block: 'code-block' }, { className: 'graf--bold', block: 'BOLD' }, { className: 'graf--italic', block: 'ITALIC' }, { className: 'graf--divider', block: 'divider' } ], continuousBlocks: [ "unstyled", "blockquote", "ordered-list", "unordered-list", "unordered-list-item", "ordered-list-item", "code-block" ], key_commands: { "alt-shift": [{ key: 65, cmd: 'add-new-block' }], "alt-cmd": [{ key: 49, cmd: 'toggle_block:header-one' }, { key: 50, cmd: 'toggle_block:header-two' }, { key: 53, cmd: 'toggle_block:blockquote' }], "cmd": [{ key: 66, cmd: 'toggle_inline:BOLD' }, { key: 73, cmd: 'toggle_inline:ITALIC' }, { key: 75, cmd: 'insert:link' }, { key: 13, cmd: 'toggle_block:divider' } ] }, character_convert_mapping: { '> ': "blockquote", '*.': "unordered-list-item", '* ': "unordered-list-item", '- ': "unordered-list-item", '1.': "ordered-list-item", '# ': 'header-one', '##': 'header-two', '==': "unstyled", '` ': "code-block" }, tooltips: [ DanteImagePopoverConfig(), DanteAnchorPopoverConfig(), DanteInlineTooltipConfig(), DanteTooltipConfig(), ], widgets: [ ImageBlockConfig(), EmbedBlockConfig(), VideoBlockConfig(), PlaceholderBlockConfig(), CodeBlockConfig() ] } export default Dante
ajax/libs/draft-js/0.10.2/Draft.js
extend1994/cdnjs
/** * Draft v0.10.2 * * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("immutable"), require("react"), require("react-dom")); else if(typeof define === 'function' && define.amd) define(["immutable", "react", "react-dom"], factory); else if(typeof exports === 'object') exports["Draft"] = factory(require("immutable"), require("react"), require("react-dom")); else root["Draft"] = factory(root["Immutable"], root["React"], root["ReactDOM"]); })(this, function(__WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_12__, __WEBPACK_EXTERNAL_MODULE_17__) { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule Draft * */ 'use strict'; var AtomicBlockUtils = __webpack_require__(61); var BlockMapBuilder = __webpack_require__(13); var CharacterMetadata = __webpack_require__(6); var CompositeDraftDecorator = __webpack_require__(62); var ContentBlock = __webpack_require__(9); var ContentState = __webpack_require__(23); var DefaultDraftBlockRenderMap = __webpack_require__(24); var DefaultDraftInlineStyle = __webpack_require__(37); var DraftEditor = __webpack_require__(64); var DraftEditorBlock = __webpack_require__(38); var DraftEntity = __webpack_require__(18); var DraftModifier = __webpack_require__(4); var DraftEntityInstance = __webpack_require__(39); var EditorState = __webpack_require__(1); var KeyBindingUtil = __webpack_require__(25); var RichTextEditorUtil = __webpack_require__(43); var SelectionState = __webpack_require__(14); var convertFromDraftStateToRaw = __webpack_require__(81); var convertFromHTMLToContentBlocks = __webpack_require__(44); var convertFromRawToDraftState = __webpack_require__(82); var generateRandomKey = __webpack_require__(7); var getDefaultKeyBinding = __webpack_require__(45); var getVisibleSelectionRect = __webpack_require__(105); var DraftPublic = { Editor: DraftEditor, EditorBlock: DraftEditorBlock, EditorState: EditorState, CompositeDecorator: CompositeDraftDecorator, Entity: DraftEntity, EntityInstance: DraftEntityInstance, BlockMapBuilder: BlockMapBuilder, CharacterMetadata: CharacterMetadata, ContentBlock: ContentBlock, ContentState: ContentState, SelectionState: SelectionState, AtomicBlockUtils: AtomicBlockUtils, KeyBindingUtil: KeyBindingUtil, Modifier: DraftModifier, RichUtils: RichTextEditorUtil, DefaultDraftBlockRenderMap: DefaultDraftBlockRenderMap, DefaultDraftInlineStyle: DefaultDraftInlineStyle, convertFromHTML: convertFromHTMLToContentBlocks, convertFromRaw: convertFromRawToDraftState, convertToRaw: convertFromDraftStateToRaw, genKey: generateRandomKey, getDefaultKeyBinding: getDefaultKeyBinding, getVisibleSelectionRect: getVisibleSelectionRect }; module.exports = DraftPublic; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EditorState * */ 'use strict'; var _assign = __webpack_require__(11); var _extends = _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; }; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var BlockTree = __webpack_require__(36); var ContentState = __webpack_require__(23); var EditorBidiService = __webpack_require__(76); var Immutable = __webpack_require__(3); var SelectionState = __webpack_require__(14); var OrderedSet = Immutable.OrderedSet, Record = Immutable.Record, Stack = Immutable.Stack; var defaultRecord = { allowUndo: true, currentContent: null, decorator: null, directionMap: null, forceSelection: false, inCompositionMode: false, inlineStyleOverride: null, lastChangeType: null, nativelyRenderedContent: null, redoStack: Stack(), selection: null, treeMap: null, undoStack: Stack() }; var EditorStateRecord = Record(defaultRecord); var EditorState = function () { EditorState.createEmpty = function createEmpty(decorator) { return EditorState.createWithContent(ContentState.createFromText(''), decorator); }; EditorState.createWithContent = function createWithContent(contentState, decorator) { var firstKey = contentState.getBlockMap().first().getKey(); return EditorState.create({ currentContent: contentState, undoStack: Stack(), redoStack: Stack(), decorator: decorator || null, selection: SelectionState.createEmpty(firstKey) }); }; EditorState.create = function create(config) { var currentContent = config.currentContent, decorator = config.decorator; var recordConfig = _extends({}, config, { treeMap: generateNewTreeMap(currentContent, decorator), directionMap: EditorBidiService.getDirectionMap(currentContent) }); return new EditorState(new EditorStateRecord(recordConfig)); }; EditorState.set = function set(editorState, put) { var map = editorState.getImmutable().withMutations(function (state) { var existingDecorator = state.get('decorator'); var decorator = existingDecorator; if (put.decorator === null) { decorator = null; } else if (put.decorator) { decorator = put.decorator; } var newContent = put.currentContent || editorState.getCurrentContent(); if (decorator !== existingDecorator) { var treeMap = state.get('treeMap'); var newTreeMap; if (decorator && existingDecorator) { newTreeMap = regenerateTreeForNewDecorator(newContent, newContent.getBlockMap(), treeMap, decorator, existingDecorator); } else { newTreeMap = generateNewTreeMap(newContent, decorator); } state.merge({ decorator: decorator, treeMap: newTreeMap, nativelyRenderedContent: null }); return; } var existingContent = editorState.getCurrentContent(); if (newContent !== existingContent) { state.set('treeMap', regenerateTreeForNewBlocks(editorState, newContent.getBlockMap(), newContent.getEntityMap(), decorator)); } state.merge(put); }); return new EditorState(map); }; EditorState.prototype.toJS = function toJS() { return this.getImmutable().toJS(); }; EditorState.prototype.getAllowUndo = function getAllowUndo() { return this.getImmutable().get('allowUndo'); }; EditorState.prototype.getCurrentContent = function getCurrentContent() { return this.getImmutable().get('currentContent'); }; EditorState.prototype.getUndoStack = function getUndoStack() { return this.getImmutable().get('undoStack'); }; EditorState.prototype.getRedoStack = function getRedoStack() { return this.getImmutable().get('redoStack'); }; EditorState.prototype.getSelection = function getSelection() { return this.getImmutable().get('selection'); }; EditorState.prototype.getDecorator = function getDecorator() { return this.getImmutable().get('decorator'); }; EditorState.prototype.isInCompositionMode = function isInCompositionMode() { return this.getImmutable().get('inCompositionMode'); }; EditorState.prototype.mustForceSelection = function mustForceSelection() { return this.getImmutable().get('forceSelection'); }; EditorState.prototype.getNativelyRenderedContent = function getNativelyRenderedContent() { return this.getImmutable().get('nativelyRenderedContent'); }; EditorState.prototype.getLastChangeType = function getLastChangeType() { return this.getImmutable().get('lastChangeType'); }; /** * While editing, the user may apply inline style commands with a collapsed * cursor, intending to type text that adopts the specified style. In this * case, we track the specified style as an "override" that takes precedence * over the inline style of the text adjacent to the cursor. * * If null, there is no override in place. */ EditorState.prototype.getInlineStyleOverride = function getInlineStyleOverride() { return this.getImmutable().get('inlineStyleOverride'); }; EditorState.setInlineStyleOverride = function setInlineStyleOverride(editorState, inlineStyleOverride) { return EditorState.set(editorState, { inlineStyleOverride: inlineStyleOverride }); }; /** * Get the appropriate inline style for the editor state. If an * override is in place, use it. Otherwise, the current style is * based on the location of the selection state. */ EditorState.prototype.getCurrentInlineStyle = function getCurrentInlineStyle() { var override = this.getInlineStyleOverride(); if (override != null) { return override; } var content = this.getCurrentContent(); var selection = this.getSelection(); if (selection.isCollapsed()) { return getInlineStyleForCollapsedSelection(content, selection); } return getInlineStyleForNonCollapsedSelection(content, selection); }; EditorState.prototype.getBlockTree = function getBlockTree(blockKey) { return this.getImmutable().getIn(['treeMap', blockKey]); }; EditorState.prototype.isSelectionAtStartOfContent = function isSelectionAtStartOfContent() { var firstKey = this.getCurrentContent().getBlockMap().first().getKey(); return this.getSelection().hasEdgeWithin(firstKey, 0, 0); }; EditorState.prototype.isSelectionAtEndOfContent = function isSelectionAtEndOfContent() { var content = this.getCurrentContent(); var blockMap = content.getBlockMap(); var last = blockMap.last(); var end = last.getLength(); return this.getSelection().hasEdgeWithin(last.getKey(), end, end); }; EditorState.prototype.getDirectionMap = function getDirectionMap() { return this.getImmutable().get('directionMap'); }; /** * Incorporate native DOM selection changes into the EditorState. This * method can be used when we simply want to accept whatever the DOM * has given us to represent selection, and we do not need to re-render * the editor. * * To forcibly move the DOM selection, see `EditorState.forceSelection`. */ EditorState.acceptSelection = function acceptSelection(editorState, selection) { return updateSelection(editorState, selection, false); }; /** * At times, we need to force the DOM selection to be where we * need it to be. This can occur when the anchor or focus nodes * are non-text nodes, for instance. In this case, we want to trigger * a re-render of the editor, which in turn forces selection into * the correct place in the DOM. The `forceSelection` method * accomplishes this. * * This method should be used in cases where you need to explicitly * move the DOM selection from one place to another without a change * in ContentState. */ EditorState.forceSelection = function forceSelection(editorState, selection) { if (!selection.getHasFocus()) { selection = selection.set('hasFocus', true); } return updateSelection(editorState, selection, true); }; /** * Move selection to the end of the editor without forcing focus. */ EditorState.moveSelectionToEnd = function moveSelectionToEnd(editorState) { var content = editorState.getCurrentContent(); var lastBlock = content.getLastBlock(); var lastKey = lastBlock.getKey(); var length = lastBlock.getLength(); return EditorState.acceptSelection(editorState, new SelectionState({ anchorKey: lastKey, anchorOffset: length, focusKey: lastKey, focusOffset: length, isBackward: false })); }; /** * Force focus to the end of the editor. This is useful in scenarios * where we want to programmatically focus the input and it makes sense * to allow the user to continue working seamlessly. */ EditorState.moveFocusToEnd = function moveFocusToEnd(editorState) { var afterSelectionMove = EditorState.moveSelectionToEnd(editorState); return EditorState.forceSelection(afterSelectionMove, afterSelectionMove.getSelection()); }; /** * Push the current ContentState onto the undo stack if it should be * considered a boundary state, and set the provided ContentState as the * new current content. */ EditorState.push = function push(editorState, contentState, changeType) { if (editorState.getCurrentContent() === contentState) { return editorState; } var forceSelection = changeType !== 'insert-characters'; var directionMap = EditorBidiService.getDirectionMap(contentState, editorState.getDirectionMap()); if (!editorState.getAllowUndo()) { return EditorState.set(editorState, { currentContent: contentState, directionMap: directionMap, lastChangeType: changeType, selection: contentState.getSelectionAfter(), forceSelection: forceSelection, inlineStyleOverride: null }); } var selection = editorState.getSelection(); var currentContent = editorState.getCurrentContent(); var undoStack = editorState.getUndoStack(); var newContent = contentState; if (selection !== currentContent.getSelectionAfter() || mustBecomeBoundary(editorState, changeType)) { undoStack = undoStack.push(currentContent); newContent = newContent.set('selectionBefore', selection); } else if (changeType === 'insert-characters' || changeType === 'backspace-character' || changeType === 'delete-character') { // Preserve the previous selection. newContent = newContent.set('selectionBefore', currentContent.getSelectionBefore()); } var inlineStyleOverride = editorState.getInlineStyleOverride(); // Don't discard inline style overrides for the following change types: var overrideChangeTypes = ['adjust-depth', 'change-block-type', 'split-block']; if (overrideChangeTypes.indexOf(changeType) === -1) { inlineStyleOverride = null; } var editorStateChanges = { currentContent: newContent, directionMap: directionMap, undoStack: undoStack, redoStack: Stack(), lastChangeType: changeType, selection: contentState.getSelectionAfter(), forceSelection: forceSelection, inlineStyleOverride: inlineStyleOverride }; return EditorState.set(editorState, editorStateChanges); }; /** * Make the top ContentState in the undo stack the new current content and * push the current content onto the redo stack. */ EditorState.undo = function undo(editorState) { if (!editorState.getAllowUndo()) { return editorState; } var undoStack = editorState.getUndoStack(); var newCurrentContent = undoStack.peek(); if (!newCurrentContent) { return editorState; } var currentContent = editorState.getCurrentContent(); var directionMap = EditorBidiService.getDirectionMap(newCurrentContent, editorState.getDirectionMap()); return EditorState.set(editorState, { currentContent: newCurrentContent, directionMap: directionMap, undoStack: undoStack.shift(), redoStack: editorState.getRedoStack().push(currentContent), forceSelection: true, inlineStyleOverride: null, lastChangeType: 'undo', nativelyRenderedContent: null, selection: currentContent.getSelectionBefore() }); }; /** * Make the top ContentState in the redo stack the new current content and * push the current content onto the undo stack. */ EditorState.redo = function redo(editorState) { if (!editorState.getAllowUndo()) { return editorState; } var redoStack = editorState.getRedoStack(); var newCurrentContent = redoStack.peek(); if (!newCurrentContent) { return editorState; } var currentContent = editorState.getCurrentContent(); var directionMap = EditorBidiService.getDirectionMap(newCurrentContent, editorState.getDirectionMap()); return EditorState.set(editorState, { currentContent: newCurrentContent, directionMap: directionMap, undoStack: editorState.getUndoStack().push(currentContent), redoStack: redoStack.shift(), forceSelection: true, inlineStyleOverride: null, lastChangeType: 'redo', nativelyRenderedContent: null, selection: newCurrentContent.getSelectionAfter() }); }; /** * Not for public consumption. */ function EditorState(immutable) { _classCallCheck(this, EditorState); this._immutable = immutable; } /** * Not for public consumption. */ EditorState.prototype.getImmutable = function getImmutable() { return this._immutable; }; return EditorState; }(); /** * Set the supplied SelectionState as the new current selection, and set * the `force` flag to trigger manual selection placement by the view. */ function updateSelection(editorState, selection, forceSelection) { return EditorState.set(editorState, { selection: selection, forceSelection: forceSelection, nativelyRenderedContent: null, inlineStyleOverride: null }); } /** * Regenerate the entire tree map for a given ContentState and decorator. * Returns an OrderedMap that maps all available ContentBlock objects. */ function generateNewTreeMap(contentState, decorator) { return contentState.getBlockMap().map(function (block) { return BlockTree.generate(contentState, block, decorator); }).toOrderedMap(); } /** * Regenerate tree map objects for all ContentBlocks that have changed * between the current editorState and newContent. Returns an OrderedMap * with only changed regenerated tree map objects. */ function regenerateTreeForNewBlocks(editorState, newBlockMap, newEntityMap, decorator) { var contentState = editorState.getCurrentContent().set('entityMap', newEntityMap); var prevBlockMap = contentState.getBlockMap(); var prevTreeMap = editorState.getImmutable().get('treeMap'); return prevTreeMap.merge(newBlockMap.toSeq().filter(function (block, key) { return block !== prevBlockMap.get(key); }).map(function (block) { return BlockTree.generate(contentState, block, decorator); })); } /** * Generate tree map objects for a new decorator object, preserving any * decorations that are unchanged from the previous decorator. * * Note that in order for this to perform optimally, decoration Lists for * decorators should be preserved when possible to allow for direct immutable * List comparison. */ function regenerateTreeForNewDecorator(content, blockMap, previousTreeMap, decorator, existingDecorator) { return previousTreeMap.merge(blockMap.toSeq().filter(function (block) { return decorator.getDecorations(block, content) !== existingDecorator.getDecorations(block, content); }).map(function (block) { return BlockTree.generate(content, block, decorator); })); } /** * Return whether a change should be considered a boundary state, given * the previous change type. Allows us to discard potential boundary states * during standard typing or deletion behavior. */ function mustBecomeBoundary(editorState, changeType) { var lastChangeType = editorState.getLastChangeType(); return changeType !== lastChangeType || changeType !== 'insert-characters' && changeType !== 'backspace-character' && changeType !== 'delete-character'; } function getInlineStyleForCollapsedSelection(content, selection) { var startKey = selection.getStartKey(); var startOffset = selection.getStartOffset(); var startBlock = content.getBlockForKey(startKey); // If the cursor is not at the start of the block, look backward to // preserve the style of the preceding character. if (startOffset > 0) { return startBlock.getInlineStyleAt(startOffset - 1); } // The caret is at position zero in this block. If the block has any // text at all, use the style of the first character. if (startBlock.getLength()) { return startBlock.getInlineStyleAt(0); } // Otherwise, look upward in the document to find the closest character. return lookUpwardForInlineStyle(content, startKey); } function getInlineStyleForNonCollapsedSelection(content, selection) { var startKey = selection.getStartKey(); var startOffset = selection.getStartOffset(); var startBlock = content.getBlockForKey(startKey); // If there is a character just inside the selection, use its style. if (startOffset < startBlock.getLength()) { return startBlock.getInlineStyleAt(startOffset); } // Check if the selection at the end of a non-empty block. Use the last // style in the block. if (startOffset > 0) { return startBlock.getInlineStyleAt(startOffset - 1); } // Otherwise, look upward in the document to find the closest character. return lookUpwardForInlineStyle(content, startKey); } function lookUpwardForInlineStyle(content, fromKey) { var previousBlock = content.getBlockBefore(fromKey); var previousLength; while (previousBlock) { previousLength = previousBlock.getLength(); if (previousLength) { return previousBlock.getInlineStyleAt(previousLength - 1); } previousBlock = content.getBlockBefore(previousBlock.getKey()); } return OrderedSet(); } module.exports = EditorState; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ 'use strict'; /** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ var validateFormat = function validateFormat(format) {}; if (true) { validateFormat = function validateFormat(format) { if (format === undefined) { throw new Error('invariant requires an error message argument'); } }; } function invariant(condition, format, a, b, c, d, e, f) { validateFormat(format); if (!condition) { var error; if (format === undefined) { error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); } else { var args = [a, b, c, d, e, f]; var argIndex = 0; error = new Error(format.replace(/%s/g, function () { return args[argIndex++]; })); error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } } module.exports = invariant; /***/ }), /* 3 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_3__; /***/ }), /* 4 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftModifier * @typechecks * */ 'use strict'; var CharacterMetadata = __webpack_require__(6); var ContentStateInlineStyle = __webpack_require__(63); var DraftFeatureFlags = __webpack_require__(40); var Immutable = __webpack_require__(3); var applyEntityToContentState = __webpack_require__(80); var getCharacterRemovalRange = __webpack_require__(101); var getContentStateFragment = __webpack_require__(21); var insertFragmentIntoContentState = __webpack_require__(106); var insertTextIntoContentState = __webpack_require__(107); var invariant = __webpack_require__(2); var modifyBlockForContentState = __webpack_require__(118); var removeEntitiesAtEdges = __webpack_require__(56); var removeRangeFromContentState = __webpack_require__(120); var splitBlockInContentState = __webpack_require__(122); var OrderedSet = Immutable.OrderedSet; /** * `DraftModifier` provides a set of convenience methods that apply * modifications to a `ContentState` object based on a target `SelectionState`. * * Any change to a `ContentState` should be decomposable into a series of * transaction functions that apply the required changes and return output * `ContentState` objects. * * These functions encapsulate some of the most common transaction sequences. */ var DraftModifier = { replaceText: function replaceText(contentState, rangeToReplace, text, inlineStyle, entityKey) { var withoutEntities = removeEntitiesAtEdges(contentState, rangeToReplace); var withoutText = removeRangeFromContentState(withoutEntities, rangeToReplace); var character = CharacterMetadata.create({ style: inlineStyle || OrderedSet(), entity: entityKey || null }); return insertTextIntoContentState(withoutText, withoutText.getSelectionAfter(), text, character); }, insertText: function insertText(contentState, targetRange, text, inlineStyle, entityKey) { !targetRange.isCollapsed() ? true ? invariant(false, 'Target range must be collapsed for `insertText`.') : invariant(false) : void 0; return DraftModifier.replaceText(contentState, targetRange, text, inlineStyle, entityKey); }, moveText: function moveText(contentState, removalRange, targetRange) { var movedFragment = getContentStateFragment(contentState, removalRange); var afterRemoval = DraftModifier.removeRange(contentState, removalRange, 'backward'); return DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment); }, replaceWithFragment: function replaceWithFragment(contentState, targetRange, fragment) { var withoutEntities = removeEntitiesAtEdges(contentState, targetRange); var withoutText = removeRangeFromContentState(withoutEntities, targetRange); return insertFragmentIntoContentState(withoutText, withoutText.getSelectionAfter(), fragment); }, removeRange: function removeRange(contentState, rangeToRemove, removalDirection) { var startKey = void 0, endKey = void 0, startBlock = void 0, endBlock = void 0; if (rangeToRemove.getIsBackward()) { rangeToRemove = rangeToRemove.merge({ anchorKey: rangeToRemove.getFocusKey(), anchorOffset: rangeToRemove.getFocusOffset(), focusKey: rangeToRemove.getAnchorKey(), focusOffset: rangeToRemove.getAnchorOffset(), isBackward: false }); } startKey = rangeToRemove.getAnchorKey(); endKey = rangeToRemove.getFocusKey(); startBlock = contentState.getBlockForKey(startKey); endBlock = contentState.getBlockForKey(endKey); var startOffset = rangeToRemove.getStartOffset(); var endOffset = rangeToRemove.getEndOffset(); var startEntityKey = startBlock.getEntityAt(startOffset); var endEntityKey = endBlock.getEntityAt(endOffset - 1); // Check whether the selection state overlaps with a single entity. // If so, try to remove the appropriate substring of the entity text. if (startKey === endKey) { if (startEntityKey && startEntityKey === endEntityKey) { var _adjustedRemovalRange = getCharacterRemovalRange(contentState.getEntityMap(), startBlock, endBlock, rangeToRemove, removalDirection); return removeRangeFromContentState(contentState, _adjustedRemovalRange); } } var adjustedRemovalRange = rangeToRemove; if (DraftFeatureFlags.draft_segmented_entities_behavior) { // Adjust the selection to properly delete segemented and immutable // entities adjustedRemovalRange = getCharacterRemovalRange(contentState.getEntityMap(), startBlock, endBlock, rangeToRemove, removalDirection); } var withoutEntities = removeEntitiesAtEdges(contentState, adjustedRemovalRange); return removeRangeFromContentState(withoutEntities, adjustedRemovalRange); }, splitBlock: function splitBlock(contentState, selectionState) { var withoutEntities = removeEntitiesAtEdges(contentState, selectionState); var withoutText = removeRangeFromContentState(withoutEntities, selectionState); return splitBlockInContentState(withoutText, withoutText.getSelectionAfter()); }, applyInlineStyle: function applyInlineStyle(contentState, selectionState, inlineStyle) { return ContentStateInlineStyle.add(contentState, selectionState, inlineStyle); }, removeInlineStyle: function removeInlineStyle(contentState, selectionState, inlineStyle) { return ContentStateInlineStyle.remove(contentState, selectionState, inlineStyle); }, setBlockType: function setBlockType(contentState, selectionState, blockType) { return modifyBlockForContentState(contentState, selectionState, function (block) { return block.merge({ type: blockType, depth: 0 }); }); }, setBlockData: function setBlockData(contentState, selectionState, blockData) { return modifyBlockForContentState(contentState, selectionState, function (block) { return block.merge({ data: blockData }); }); }, mergeBlockData: function mergeBlockData(contentState, selectionState, blockData) { return modifyBlockForContentState(contentState, selectionState, function (block) { return block.merge({ data: block.getData().merge(blockData) }); }); }, applyEntity: function applyEntity(contentState, selectionState, entityKey) { var withoutEntities = removeEntitiesAtEdges(contentState, selectionState); return applyEntityToContentState(withoutEntities, selectionState, entityKey); } }; module.exports = DraftModifier; /***/ }), /* 5 */ /***/ (function(module, exports) { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * */ var nullthrows = function nullthrows(x) { if (x != null) { return x; } throw new Error("Got unexpected null or undefined"); }; module.exports = nullthrows; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule CharacterMetadata * @typechecks * */ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var _require = __webpack_require__(3), Map = _require.Map, OrderedSet = _require.OrderedSet, Record = _require.Record; // Immutable.map is typed such that the value for every key in the map // must be the same type var EMPTY_SET = OrderedSet(); var defaultRecord = { style: EMPTY_SET, entity: null }; var CharacterMetadataRecord = Record(defaultRecord); var CharacterMetadata = function (_CharacterMetadataRec) { _inherits(CharacterMetadata, _CharacterMetadataRec); function CharacterMetadata() { _classCallCheck(this, CharacterMetadata); return _possibleConstructorReturn(this, _CharacterMetadataRec.apply(this, arguments)); } CharacterMetadata.prototype.getStyle = function getStyle() { return this.get('style'); }; CharacterMetadata.prototype.getEntity = function getEntity() { return this.get('entity'); }; CharacterMetadata.prototype.hasStyle = function hasStyle(style) { return this.getStyle().includes(style); }; CharacterMetadata.applyStyle = function applyStyle(record, style) { var withStyle = record.set('style', record.getStyle().add(style)); return CharacterMetadata.create(withStyle); }; CharacterMetadata.removeStyle = function removeStyle(record, style) { var withoutStyle = record.set('style', record.getStyle().remove(style)); return CharacterMetadata.create(withoutStyle); }; CharacterMetadata.applyEntity = function applyEntity(record, entityKey) { var withEntity = record.getEntity() === entityKey ? record : record.set('entity', entityKey); return CharacterMetadata.create(withEntity); }; /** * Use this function instead of the `CharacterMetadata` constructor. * Since most content generally uses only a very small number of * style/entity permutations, we can reuse these objects as often as * possible. */ CharacterMetadata.create = function create(config) { if (!config) { return EMPTY; } var defaultConfig = { style: EMPTY_SET, entity: null }; // Fill in unspecified properties, if necessary. var configMap = Map(defaultConfig).merge(config); var existing = pool.get(configMap); if (existing) { return existing; } var newCharacter = new CharacterMetadata(configMap); pool = pool.set(configMap, newCharacter); return newCharacter; }; return CharacterMetadata; }(CharacterMetadataRecord); var EMPTY = new CharacterMetadata(); var pool = Map([[Map(defaultRecord), EMPTY]]); CharacterMetadata.EMPTY = EMPTY; module.exports = CharacterMetadata; /***/ }), /* 7 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule generateRandomKey * @typechecks * */ 'use strict'; var seenKeys = {}; var MULTIPLIER = Math.pow(2, 24); function generateRandomKey() { var key = void 0; while (key === undefined || seenKeys.hasOwnProperty(key) || !isNaN(+key)) { key = Math.floor(Math.random() * MULTIPLIER).toString(32); } seenKeys[key] = true; return key; } module.exports = generateRandomKey; /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ 'use strict'; var UserAgentData = __webpack_require__(128); var VersionRange = __webpack_require__(129); var mapObject = __webpack_require__(142); var memoizeStringOnly = __webpack_require__(143); /** * Checks to see whether `name` and `version` satisfy `query`. * * @param {string} name Name of the browser, device, engine or platform * @param {?string} version Version of the browser, engine or platform * @param {string} query Query of form "Name [range expression]" * @param {?function} normalizer Optional pre-processor for range expression * @return {boolean} */ function compare(name, version, query, normalizer) { // check for exact match with no version if (name === query) { return true; } // check for non-matching names if (!query.startsWith(name)) { return false; } // full comparison with version var range = query.slice(name.length); if (version) { range = normalizer ? normalizer(range) : range; return VersionRange.contains(range, version); } return false; } /** * Normalizes `version` by stripping any "NT" prefix, but only on the Windows * platform. * * Mimics the stripping performed by the `UserAgentWindowsPlatform` PHP class. * * @param {string} version * @return {string} */ function normalizePlatformVersion(version) { if (UserAgentData.platformName === 'Windows') { return version.replace(/^\s*NT/, ''); } return version; } /** * Provides client-side access to the authoritative PHP-generated User Agent * information supplied by the server. */ var UserAgent = { /** * Check if the User Agent browser matches `query`. * * `query` should be a string like "Chrome" or "Chrome > 33". * * Valid browser names include: * * - ACCESS NetFront * - AOL * - Amazon Silk * - Android * - BlackBerry * - BlackBerry PlayBook * - Chrome * - Chrome for iOS * - Chrome frame * - Facebook PHP SDK * - Facebook for iOS * - Firefox * - IE * - IE Mobile * - Mobile Safari * - Motorola Internet Browser * - Nokia * - Openwave Mobile Browser * - Opera * - Opera Mini * - Opera Mobile * - Safari * - UIWebView * - Unknown * - webOS * - etc... * * An authoritative list can be found in the PHP `BrowserDetector` class and * related classes in the same file (see calls to `new UserAgentBrowser` here: * https://fburl.com/50728104). * * @note Function results are memoized * * @param {string} query Query of the form "Name [range expression]" * @return {boolean} */ isBrowser: function isBrowser(query) { return compare(UserAgentData.browserName, UserAgentData.browserFullVersion, query); }, /** * Check if the User Agent browser uses a 32 or 64 bit architecture. * * @note Function results are memoized * * @param {string} query Query of the form "32" or "64". * @return {boolean} */ isBrowserArchitecture: function isBrowserArchitecture(query) { return compare(UserAgentData.browserArchitecture, null, query); }, /** * Check if the User Agent device matches `query`. * * `query` should be a string like "iPhone" or "iPad". * * Valid device names include: * * - Kindle * - Kindle Fire * - Unknown * - iPad * - iPhone * - iPod * - etc... * * An authoritative list can be found in the PHP `DeviceDetector` class and * related classes in the same file (see calls to `new UserAgentDevice` here: * https://fburl.com/50728332). * * @note Function results are memoized * * @param {string} query Query of the form "Name" * @return {boolean} */ isDevice: function isDevice(query) { return compare(UserAgentData.deviceName, null, query); }, /** * Check if the User Agent rendering engine matches `query`. * * `query` should be a string like "WebKit" or "WebKit >= 537". * * Valid engine names include: * * - Gecko * - Presto * - Trident * - WebKit * - etc... * * An authoritative list can be found in the PHP `RenderingEngineDetector` * class related classes in the same file (see calls to `new * UserAgentRenderingEngine` here: https://fburl.com/50728617). * * @note Function results are memoized * * @param {string} query Query of the form "Name [range expression]" * @return {boolean} */ isEngine: function isEngine(query) { return compare(UserAgentData.engineName, UserAgentData.engineVersion, query); }, /** * Check if the User Agent platform matches `query`. * * `query` should be a string like "Windows" or "iOS 5 - 6". * * Valid platform names include: * * - Android * - BlackBerry OS * - Java ME * - Linux * - Mac OS X * - Mac OS X Calendar * - Mac OS X Internet Account * - Symbian * - SymbianOS * - Windows * - Windows Mobile * - Windows Phone * - iOS * - iOS Facebook Integration Account * - iOS Facebook Social Sharing UI * - webOS * - Chrome OS * - etc... * * An authoritative list can be found in the PHP `PlatformDetector` class and * related classes in the same file (see calls to `new UserAgentPlatform` * here: https://fburl.com/50729226). * * @note Function results are memoized * * @param {string} query Query of the form "Name [range expression]" * @return {boolean} */ isPlatform: function isPlatform(query) { return compare(UserAgentData.platformName, UserAgentData.platformFullVersion, query, normalizePlatformVersion); }, /** * Check if the User Agent platform is a 32 or 64 bit architecture. * * @note Function results are memoized * * @param {string} query Query of the form "32" or "64". * @return {boolean} */ isPlatformArchitecture: function isPlatformArchitecture(query) { return compare(UserAgentData.platformArchitecture, null, query); } }; module.exports = mapObject(UserAgent, memoizeStringOnly); /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ContentBlock * */ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Immutable = __webpack_require__(3); var findRangesImmutable = __webpack_require__(20); var List = Immutable.List, Map = Immutable.Map, OrderedSet = Immutable.OrderedSet, Record = Immutable.Record; var EMPTY_SET = OrderedSet(); var defaultRecord = { key: '', type: 'unstyled', text: '', characterList: List(), depth: 0, data: Map() }; var ContentBlockRecord = Record(defaultRecord); var ContentBlock = function (_ContentBlockRecord) { _inherits(ContentBlock, _ContentBlockRecord); function ContentBlock() { _classCallCheck(this, ContentBlock); return _possibleConstructorReturn(this, _ContentBlockRecord.apply(this, arguments)); } ContentBlock.prototype.getKey = function getKey() { return this.get('key'); }; ContentBlock.prototype.getType = function getType() { return this.get('type'); }; ContentBlock.prototype.getText = function getText() { return this.get('text'); }; ContentBlock.prototype.getCharacterList = function getCharacterList() { return this.get('characterList'); }; ContentBlock.prototype.getLength = function getLength() { return this.getText().length; }; ContentBlock.prototype.getDepth = function getDepth() { return this.get('depth'); }; ContentBlock.prototype.getData = function getData() { return this.get('data'); }; ContentBlock.prototype.getInlineStyleAt = function getInlineStyleAt(offset) { var character = this.getCharacterList().get(offset); return character ? character.getStyle() : EMPTY_SET; }; ContentBlock.prototype.getEntityAt = function getEntityAt(offset) { var character = this.getCharacterList().get(offset); return character ? character.getEntity() : null; }; /** * Execute a callback for every contiguous range of styles within the block. */ ContentBlock.prototype.findStyleRanges = function findStyleRanges(filterFn, callback) { findRangesImmutable(this.getCharacterList(), haveEqualStyle, filterFn, callback); }; /** * Execute a callback for every contiguous range of entities within the block. */ ContentBlock.prototype.findEntityRanges = function findEntityRanges(filterFn, callback) { findRangesImmutable(this.getCharacterList(), haveEqualEntity, filterFn, callback); }; return ContentBlock; }(ContentBlockRecord); function haveEqualStyle(charA, charB) { return charA.getStyle() === charB.getStyle(); } function haveEqualEntity(charA, charB) { return charA.getEntity() === charB.getEntity(); } module.exports = ContentBlock; /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ /** * Unicode-enabled replacesments for basic String functions. * * All the functions in this module assume that the input string is a valid * UTF-16 encoding of a Unicode sequence. If it's not the case, the behavior * will be undefined. * * WARNING: Since this module is typechecks-enforced, you may find new bugs * when replacing normal String functions with ones provided here. */ 'use strict'; var invariant = __webpack_require__(2); // These two ranges are consecutive so anything in [HIGH_START, LOW_END] is a // surrogate code unit. var SURROGATE_HIGH_START = 0xD800; var SURROGATE_HIGH_END = 0xDBFF; var SURROGATE_LOW_START = 0xDC00; var SURROGATE_LOW_END = 0xDFFF; var SURROGATE_UNITS_REGEX = /[\uD800-\uDFFF]/; /** * @param {number} codeUnit A Unicode code-unit, in range [0, 0x10FFFF] * @return {boolean} Whether code-unit is in a surrogate (hi/low) range */ function isCodeUnitInSurrogateRange(codeUnit) { return SURROGATE_HIGH_START <= codeUnit && codeUnit <= SURROGATE_LOW_END; } /** * Returns whether the two characters starting at `index` form a surrogate pair. * For example, given the string s = "\uD83D\uDE0A", (s, 0) returns true and * (s, 1) returns false. * * @param {string} str * @param {number} index * @return {boolean} */ function isSurrogatePair(str, index) { !(0 <= index && index < str.length) ? true ? invariant(false, 'isSurrogatePair: Invalid index %s for string length %s.', index, str.length) : invariant(false) : void 0; if (index + 1 === str.length) { return false; } var first = str.charCodeAt(index); var second = str.charCodeAt(index + 1); return SURROGATE_HIGH_START <= first && first <= SURROGATE_HIGH_END && SURROGATE_LOW_START <= second && second <= SURROGATE_LOW_END; } /** * @param {string} str Non-empty string * @return {boolean} True if the input includes any surrogate code units */ function hasSurrogateUnit(str) { return SURROGATE_UNITS_REGEX.test(str); } /** * Return the length of the original Unicode character at given position in the * String by looking into the UTF-16 code unit; that is equal to 1 for any * non-surrogate characters in BMP ([U+0000..U+D7FF] and [U+E000, U+FFFF]); and * returns 2 for the hi/low surrogates ([U+D800..U+DFFF]), which are in fact * representing non-BMP characters ([U+10000..U+10FFFF]). * * Examples: * - '\u0020' => 1 * - '\u3020' => 1 * - '\uD835' => 2 * - '\uD835\uDDEF' => 2 * - '\uDDEF' => 2 * * @param {string} str Non-empty string * @param {number} pos Position in the string to look for one code unit * @return {number} Number 1 or 2 */ function getUTF16Length(str, pos) { return 1 + isCodeUnitInSurrogateRange(str.charCodeAt(pos)); } /** * Fully Unicode-enabled replacement for String#length * * @param {string} str Valid Unicode string * @return {number} The number of Unicode characters in the string */ function strlen(str) { // Call the native functions if there's no surrogate char if (!hasSurrogateUnit(str)) { return str.length; } var len = 0; for (var pos = 0; pos < str.length; pos += getUTF16Length(str, pos)) { len++; } return len; } /** * Fully Unicode-enabled replacement for String#substr() * * @param {string} str Valid Unicode string * @param {number} start Location in Unicode sequence to begin extracting * @param {?number} length The number of Unicode characters to extract * (default: to the end of the string) * @return {string} Extracted sub-string */ function substr(str, start, length) { start = start || 0; length = length === undefined ? Infinity : length || 0; // Call the native functions if there's no surrogate char if (!hasSurrogateUnit(str)) { return str.substr(start, length); } // Obvious cases var size = str.length; if (size <= 0 || start > size || length <= 0) { return ''; } // Find the actual starting position var posA = 0; if (start > 0) { for (; start > 0 && posA < size; start--) { posA += getUTF16Length(str, posA); } if (posA >= size) { return ''; } } else if (start < 0) { for (posA = size; start < 0 && 0 < posA; start++) { posA -= getUTF16Length(str, posA - 1); } if (posA < 0) { posA = 0; } } // Find the actual ending position var posB = size; if (length < size) { for (posB = posA; length > 0 && posB < size; length--) { posB += getUTF16Length(str, posB); } } return str.substring(posA, posB); } /** * Fully Unicode-enabled replacement for String#substring() * * @param {string} str Valid Unicode string * @param {number} start Location in Unicode sequence to begin extracting * @param {?number} end Location in Unicode sequence to end extracting * (default: end of the string) * @return {string} Extracted sub-string */ function substring(str, start, end) { start = start || 0; end = end === undefined ? Infinity : end || 0; if (start < 0) { start = 0; } if (end < 0) { end = 0; } var length = Math.abs(end - start); start = start < end ? start : end; return substr(str, start, length); } /** * Get a list of Unicode code-points from a String * * @param {string} str Valid Unicode string * @return {array<number>} A list of code-points in [0..0x10FFFF] */ function getCodePoints(str) { var codePoints = []; for (var pos = 0; pos < str.length; pos += getUTF16Length(str, pos)) { codePoints.push(str.codePointAt(pos)); } return codePoints; } var UnicodeUtils = { getCodePoints: getCodePoints, getUTF16Length: getUTF16Length, hasSurrogateUnit: hasSurrogateUnit, isCodeUnitInSurrogateRange: isCodeUnitInSurrogateRange, isSurrogatePair: isSurrogatePair, strlen: strlen, substring: substring, substr: substr }; module.exports = UnicodeUtils; /***/ }), /* 11 */ /***/ (function(module, exports) { /* object-assign (c) Sindre Sorhus @license MIT */ 'use strict'; /* eslint-disable no-unused-vars */ var getOwnPropertySymbols = Object.getOwnPropertySymbols; var hasOwnProperty = Object.prototype.hasOwnProperty; var propIsEnumerable = Object.prototype.propertyIsEnumerable; function toObject(val) { if (val === null || val === undefined) { throw new TypeError('Object.assign cannot be called with null or undefined'); } return Object(val); } function shouldUseNative() { try { if (!Object.assign) { return false; } // Detect buggy property enumeration order in older V8 versions. // https://bugs.chromium.org/p/v8/issues/detail?id=4118 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers test1[5] = 'de'; if (Object.getOwnPropertyNames(test1)[0] === '5') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test2 = {}; for (var i = 0; i < 10; i++) { test2['_' + String.fromCharCode(i)] = i; } var order2 = Object.getOwnPropertyNames(test2).map(function (n) { return test2[n]; }); if (order2.join('') !== '0123456789') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test3 = {}; 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { test3[letter] = letter; }); if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { return false; } return true; } catch (err) { // We don't expect any of the above to throw, but better to be safe. return false; } } module.exports = shouldUseNative() ? Object.assign : function (target, source) { var from; var to = toObject(target); var symbols; for (var s = 1; s < arguments.length; s++) { from = Object(arguments[s]); for (var key in from) { if (hasOwnProperty.call(from, key)) { to[key] = from[key]; } } if (getOwnPropertySymbols) { symbols = getOwnPropertySymbols(from); for (var i = 0; i < symbols.length; i++) { if (propIsEnumerable.call(from, symbols[i])) { to[symbols[i]] = from[symbols[i]]; } } } } return to; }; /***/ }), /* 12 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_12__; /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule BlockMapBuilder * */ 'use strict'; var Immutable = __webpack_require__(3); var OrderedMap = Immutable.OrderedMap; var BlockMapBuilder = { createFromArray: function createFromArray(blocks) { return OrderedMap(blocks.map(function (block) { return [block.getKey(), block]; })); } }; module.exports = BlockMapBuilder; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SelectionState * @typechecks * */ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Immutable = __webpack_require__(3); var Record = Immutable.Record; var defaultRecord = { anchorKey: '', anchorOffset: 0, focusKey: '', focusOffset: 0, isBackward: false, hasFocus: false }; var SelectionStateRecord = Record(defaultRecord); var SelectionState = function (_SelectionStateRecord) { _inherits(SelectionState, _SelectionStateRecord); function SelectionState() { _classCallCheck(this, SelectionState); return _possibleConstructorReturn(this, _SelectionStateRecord.apply(this, arguments)); } SelectionState.prototype.serialize = function serialize() { return 'Anchor: ' + this.getAnchorKey() + ':' + this.getAnchorOffset() + ', ' + 'Focus: ' + this.getFocusKey() + ':' + this.getFocusOffset() + ', ' + 'Is Backward: ' + String(this.getIsBackward()) + ', ' + 'Has Focus: ' + String(this.getHasFocus()); }; SelectionState.prototype.getAnchorKey = function getAnchorKey() { return this.get('anchorKey'); }; SelectionState.prototype.getAnchorOffset = function getAnchorOffset() { return this.get('anchorOffset'); }; SelectionState.prototype.getFocusKey = function getFocusKey() { return this.get('focusKey'); }; SelectionState.prototype.getFocusOffset = function getFocusOffset() { return this.get('focusOffset'); }; SelectionState.prototype.getIsBackward = function getIsBackward() { return this.get('isBackward'); }; SelectionState.prototype.getHasFocus = function getHasFocus() { return this.get('hasFocus'); }; /** * Return whether the specified range overlaps with an edge of the * SelectionState. */ SelectionState.prototype.hasEdgeWithin = function hasEdgeWithin(blockKey, start, end) { var anchorKey = this.getAnchorKey(); var focusKey = this.getFocusKey(); if (anchorKey === focusKey && anchorKey === blockKey) { var selectionStart = this.getStartOffset(); var selectionEnd = this.getEndOffset(); return start <= selectionEnd && selectionStart <= end; } if (blockKey !== anchorKey && blockKey !== focusKey) { return false; } var offsetToCheck = blockKey === anchorKey ? this.getAnchorOffset() : this.getFocusOffset(); return start <= offsetToCheck && end >= offsetToCheck; }; SelectionState.prototype.isCollapsed = function isCollapsed() { return this.getAnchorKey() === this.getFocusKey() && this.getAnchorOffset() === this.getFocusOffset(); }; SelectionState.prototype.getStartKey = function getStartKey() { return this.getIsBackward() ? this.getFocusKey() : this.getAnchorKey(); }; SelectionState.prototype.getStartOffset = function getStartOffset() { return this.getIsBackward() ? this.getFocusOffset() : this.getAnchorOffset(); }; SelectionState.prototype.getEndKey = function getEndKey() { return this.getIsBackward() ? this.getAnchorKey() : this.getFocusKey(); }; SelectionState.prototype.getEndOffset = function getEndOffset() { return this.getIsBackward() ? this.getAnchorOffset() : this.getFocusOffset(); }; SelectionState.createEmpty = function createEmpty(key) { return new SelectionState({ anchorKey: key, anchorOffset: 0, focusKey: key, focusOffset: 0, isBackward: false, hasFocus: false }); }; return SelectionState; }(SelectionStateRecord); module.exports = SelectionState; /***/ }), /* 15 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule removeTextWithStrategy * */ 'use strict'; var DraftModifier = __webpack_require__(4); /** * For a collapsed selection state, remove text based on the specified strategy. * If the selection state is not collapsed, remove the entire selected range. */ function removeTextWithStrategy(editorState, strategy, direction) { var selection = editorState.getSelection(); var content = editorState.getCurrentContent(); var target = selection; if (selection.isCollapsed()) { if (direction === 'forward') { if (editorState.isSelectionAtEndOfContent()) { return content; } } else if (editorState.isSelectionAtStartOfContent()) { return content; } target = strategy(editorState); if (target === selection) { return content; } } return DraftModifier.removeRange(content, target, direction); } module.exports = removeTextWithStrategy; /***/ }), /* 16 */ /***/ (function(module, exports) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ /** * This function is used to mark string literals representing CSS class names * so that they can be transformed statically. This allows for modularization * and minification of CSS class names. * * In static_upstream, this function is actually implemented, but it should * eventually be replaced with something more descriptive, and the transform * that is used in the main stack should be ported for use elsewhere. * * @param string|object className to modularize, or an object of key/values. * In the object case, the values are conditions that * determine if the className keys should be included. * @param [string ...] Variable list of classNames in the string case. * @return string Renderable space-separated CSS className. */ function cx(classNames) { if (typeof classNames == 'object') { return Object.keys(classNames).filter(function (className) { return classNames[className]; }).map(replace).join(' '); } return Array.prototype.map.call(arguments, replace).join(' '); } function replace(str) { return str.replace(/\//g, '-'); } module.exports = cx; /***/ }), /* 17 */ /***/ (function(module, exports) { module.exports = __WEBPACK_EXTERNAL_MODULE_17__; /***/ }), /* 18 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; var _assign = __webpack_require__(11); var _extends = _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; }; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftEntity * @typechecks * */ var DraftEntityInstance = __webpack_require__(39); var Immutable = __webpack_require__(3); var invariant = __webpack_require__(2); var Map = Immutable.Map; var instances = Map(); var instanceKey = 0; /** * Temporary utility for generating the warnings */ function logWarning(oldMethodCall, newMethodCall) { console.warn('WARNING: ' + oldMethodCall + ' will be deprecated soon!\nPlease use "' + newMethodCall + '" instead.'); } /** * A "document entity" is an object containing metadata associated with a * piece of text in a ContentBlock. * * For example, a `link` entity might include a `uri` property. When a * ContentBlock is rendered in the browser, text that refers to that link * entity may be rendered as an anchor, with the `uri` as the href value. * * In a ContentBlock, every position in the text may correspond to zero * or one entities. This correspondence is tracked using a key string, * generated via DraftEntity.create() and used to obtain entity metadata * via DraftEntity.get(). */ var DraftEntity = { /** * WARNING: This method will be deprecated soon! * Please use 'contentState.getLastCreatedEntityKey' instead. * --- * Get the random key string from whatever entity was last created. * We need this to support the new API, as part of transitioning to put Entity * storage in contentState. */ getLastCreatedEntityKey: function getLastCreatedEntityKey() { logWarning('DraftEntity.getLastCreatedEntityKey', 'contentState.getLastCreatedEntityKey'); return DraftEntity.__getLastCreatedEntityKey(); }, /** * WARNING: This method will be deprecated soon! * Please use 'contentState.createEntity' instead. * --- * Create a DraftEntityInstance and store it for later retrieval. * * A random key string will be generated and returned. This key may * be used to track the entity's usage in a ContentBlock, and for * retrieving data about the entity at render time. */ create: function create(type, mutability, data) { logWarning('DraftEntity.create', 'contentState.createEntity'); return DraftEntity.__create(type, mutability, data); }, /** * WARNING: This method will be deprecated soon! * Please use 'contentState.addEntity' instead. * --- * Add an existing DraftEntityInstance to the DraftEntity map. This is * useful when restoring instances from the server. */ add: function add(instance) { logWarning('DraftEntity.add', 'contentState.addEntity'); return DraftEntity.__add(instance); }, /** * WARNING: This method will be deprecated soon! * Please use 'contentState.getEntity' instead. * --- * Retrieve the entity corresponding to the supplied key string. */ get: function get(key) { logWarning('DraftEntity.get', 'contentState.getEntity'); return DraftEntity.__get(key); }, /** * WARNING: This method will be deprecated soon! * Please use 'contentState.mergeEntityData' instead. * --- * Entity instances are immutable. If you need to update the data for an * instance, this method will merge your data updates and return a new * instance. */ mergeData: function mergeData(key, toMerge) { logWarning('DraftEntity.mergeData', 'contentState.mergeEntityData'); return DraftEntity.__mergeData(key, toMerge); }, /** * WARNING: This method will be deprecated soon! * Please use 'contentState.replaceEntityData' instead. * --- * Completely replace the data for a given instance. */ replaceData: function replaceData(key, newData) { logWarning('DraftEntity.replaceData', 'contentState.replaceEntityData'); return DraftEntity.__replaceData(key, newData); }, // ***********************************WARNING****************************** // --- the above public API will be deprecated in the next version of Draft! // The methods below this line are private - don't call them directly. /** * Get the random key string from whatever entity was last created. * We need this to support the new API, as part of transitioning to put Entity * storage in contentState. */ __getLastCreatedEntityKey: function __getLastCreatedEntityKey() { return '' + instanceKey; }, /** * Create a DraftEntityInstance and store it for later retrieval. * * A random key string will be generated and returned. This key may * be used to track the entity's usage in a ContentBlock, and for * retrieving data about the entity at render time. */ __create: function __create(type, mutability, data) { return DraftEntity.__add(new DraftEntityInstance({ type: type, mutability: mutability, data: data || {} })); }, /** * Add an existing DraftEntityInstance to the DraftEntity map. This is * useful when restoring instances from the server. */ __add: function __add(instance) { var key = '' + ++instanceKey; instances = instances.set(key, instance); return key; }, /** * Retrieve the entity corresponding to the supplied key string. */ __get: function __get(key) { var instance = instances.get(key); !!!instance ? true ? invariant(false, 'Unknown DraftEntity key: %s.', key) : invariant(false) : void 0; return instance; }, /** * Entity instances are immutable. If you need to update the data for an * instance, this method will merge your data updates and return a new * instance. */ __mergeData: function __mergeData(key, toMerge) { var instance = DraftEntity.__get(key); var newData = _extends({}, instance.getData(), toMerge); var newInstance = instance.set('data', newData); instances = instances.set(key, newInstance); return newInstance; }, /** * Completely replace the data for a given instance. */ __replaceData: function __replaceData(key, newData) { var instance = DraftEntity.__get(key); var newInstance = instance.set('data', newData); instances = instances.set(key, newInstance); return newInstance; } }; module.exports = DraftEntity; /***/ }), /* 19 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftOffsetKey * */ 'use strict'; var KEY_DELIMITER = '-'; var DraftOffsetKey = { encode: function encode(blockKey, decoratorKey, leafKey) { return blockKey + KEY_DELIMITER + decoratorKey + KEY_DELIMITER + leafKey; }, decode: function decode(offsetKey) { var _offsetKey$split = offsetKey.split(KEY_DELIMITER), blockKey = _offsetKey$split[0], decoratorKey = _offsetKey$split[1], leafKey = _offsetKey$split[2]; return { blockKey: blockKey, decoratorKey: parseInt(decoratorKey, 10), leafKey: parseInt(leafKey, 10) }; } }; module.exports = DraftOffsetKey; /***/ }), /* 20 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule findRangesImmutable * */ 'use strict'; /** * Search through an array to find contiguous stretches of elements that * match a specified filter function. * * When ranges are found, execute a specified `found` function to supply * the values to the caller. */ function findRangesImmutable(haystack, areEqualFn, filterFn, foundFn) { if (!haystack.size) { return; } var cursor = 0; haystack.reduce(function (value, nextValue, nextIndex) { if (!areEqualFn(value, nextValue)) { if (filterFn(value)) { foundFn(cursor, nextIndex); } cursor = nextIndex; } return nextValue; }); filterFn(haystack.last()) && foundFn(cursor, haystack.count()); } module.exports = findRangesImmutable; /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getContentStateFragment * @typechecks * */ 'use strict'; var generateRandomKey = __webpack_require__(7); var removeEntitiesAtEdges = __webpack_require__(56); function getContentStateFragment(contentState, selectionState) { var startKey = selectionState.getStartKey(); var startOffset = selectionState.getStartOffset(); var endKey = selectionState.getEndKey(); var endOffset = selectionState.getEndOffset(); // Edge entities should be stripped to ensure that we don't preserve // invalid partial entities when the fragment is reused. We do, however, // preserve entities that are entirely within the selection range. var contentWithoutEdgeEntities = removeEntitiesAtEdges(contentState, selectionState); var blockMap = contentWithoutEdgeEntities.getBlockMap(); var blockKeys = blockMap.keySeq(); var startIndex = blockKeys.indexOf(startKey); var endIndex = blockKeys.indexOf(endKey) + 1; var slice = blockMap.slice(startIndex, endIndex).map(function (block, blockKey) { var newKey = generateRandomKey(); var text = block.getText(); var chars = block.getCharacterList(); if (startKey === endKey) { return block.merge({ key: newKey, text: text.slice(startOffset, endOffset), characterList: chars.slice(startOffset, endOffset) }); } if (blockKey === startKey) { return block.merge({ key: newKey, text: text.slice(startOffset), characterList: chars.slice(startOffset) }); } if (blockKey === endKey) { return block.merge({ key: newKey, text: text.slice(0, endOffset), characterList: chars.slice(0, endOffset) }); } return block.set('key', newKey); }); return slice.toOrderedMap(); } module.exports = getContentStateFragment; /***/ }), /* 22 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isEventHandled * @typechecks * */ 'use strict'; /** * Utility method for determining whether or not the value returned * from a handler indicates that it was handled. */ function isEventHandled(value) { return value === 'handled' || value === true; } module.exports = isEventHandled; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ContentState * @typechecks * */ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var BlockMapBuilder = __webpack_require__(13); var CharacterMetadata = __webpack_require__(6); var ContentBlock = __webpack_require__(9); var DraftEntity = __webpack_require__(18); var Immutable = __webpack_require__(3); var SelectionState = __webpack_require__(14); var generateRandomKey = __webpack_require__(7); var sanitizeDraftText = __webpack_require__(29); var List = Immutable.List, Record = Immutable.Record, Repeat = Immutable.Repeat; var defaultRecord = { entityMap: null, blockMap: null, selectionBefore: null, selectionAfter: null }; var ContentStateRecord = Record(defaultRecord); var ContentState = function (_ContentStateRecord) { _inherits(ContentState, _ContentStateRecord); function ContentState() { _classCallCheck(this, ContentState); return _possibleConstructorReturn(this, _ContentStateRecord.apply(this, arguments)); } ContentState.prototype.getEntityMap = function getEntityMap() { // TODO: update this when we fully remove DraftEntity return DraftEntity; }; ContentState.prototype.getBlockMap = function getBlockMap() { return this.get('blockMap'); }; ContentState.prototype.getSelectionBefore = function getSelectionBefore() { return this.get('selectionBefore'); }; ContentState.prototype.getSelectionAfter = function getSelectionAfter() { return this.get('selectionAfter'); }; ContentState.prototype.getBlockForKey = function getBlockForKey(key) { var block = this.getBlockMap().get(key); return block; }; ContentState.prototype.getKeyBefore = function getKeyBefore(key) { return this.getBlockMap().reverse().keySeq().skipUntil(function (v) { return v === key; }).skip(1).first(); }; ContentState.prototype.getKeyAfter = function getKeyAfter(key) { return this.getBlockMap().keySeq().skipUntil(function (v) { return v === key; }).skip(1).first(); }; ContentState.prototype.getBlockAfter = function getBlockAfter(key) { return this.getBlockMap().skipUntil(function (_, k) { return k === key; }).skip(1).first(); }; ContentState.prototype.getBlockBefore = function getBlockBefore(key) { return this.getBlockMap().reverse().skipUntil(function (_, k) { return k === key; }).skip(1).first(); }; ContentState.prototype.getBlocksAsArray = function getBlocksAsArray() { return this.getBlockMap().toArray(); }; ContentState.prototype.getFirstBlock = function getFirstBlock() { return this.getBlockMap().first(); }; ContentState.prototype.getLastBlock = function getLastBlock() { return this.getBlockMap().last(); }; ContentState.prototype.getPlainText = function getPlainText(delimiter) { return this.getBlockMap().map(function (block) { return block ? block.getText() : ''; }).join(delimiter || '\n'); }; ContentState.prototype.getLastCreatedEntityKey = function getLastCreatedEntityKey() { // TODO: update this when we fully remove DraftEntity return DraftEntity.__getLastCreatedEntityKey(); }; ContentState.prototype.hasText = function hasText() { var blockMap = this.getBlockMap(); return blockMap.size > 1 || blockMap.first().getLength() > 0; }; ContentState.prototype.createEntity = function createEntity(type, mutability, data) { // TODO: update this when we fully remove DraftEntity DraftEntity.__create(type, mutability, data); return this; }; ContentState.prototype.mergeEntityData = function mergeEntityData(key, toMerge) { // TODO: update this when we fully remove DraftEntity DraftEntity.__mergeData(key, toMerge); return this; }; ContentState.prototype.replaceEntityData = function replaceEntityData(key, newData) { // TODO: update this when we fully remove DraftEntity DraftEntity.__replaceData(key, newData); return this; }; ContentState.prototype.addEntity = function addEntity(instance) { // TODO: update this when we fully remove DraftEntity DraftEntity.__add(instance); return this; }; ContentState.prototype.getEntity = function getEntity(key) { // TODO: update this when we fully remove DraftEntity return DraftEntity.__get(key); }; ContentState.createFromBlockArray = function createFromBlockArray( // TODO: update flow type when we completely deprecate the old entity API blocks, entityMap) { // TODO: remove this when we completely deprecate the old entity API var theBlocks = Array.isArray(blocks) ? blocks : blocks.contentBlocks; var blockMap = BlockMapBuilder.createFromArray(theBlocks); var selectionState = blockMap.isEmpty() ? new SelectionState() : SelectionState.createEmpty(blockMap.first().getKey()); return new ContentState({ blockMap: blockMap, entityMap: entityMap || DraftEntity, selectionBefore: selectionState, selectionAfter: selectionState }); }; ContentState.createFromText = function createFromText(text) { var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : /\r\n?|\n/g; var strings = text.split(delimiter); var blocks = strings.map(function (block) { block = sanitizeDraftText(block); return new ContentBlock({ key: generateRandomKey(), text: block, type: 'unstyled', characterList: List(Repeat(CharacterMetadata.EMPTY, block.length)) }); }); return ContentState.createFromBlockArray(blocks); }; return ContentState; }(ContentStateRecord); module.exports = ContentState; /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DefaultDraftBlockRenderMap * */ 'use strict'; var _require = __webpack_require__(3), Map = _require.Map; var React = __webpack_require__(12); var cx = __webpack_require__(16); var UL_WRAP = React.createElement('ul', { className: cx('public/DraftStyleDefault/ul') }); var OL_WRAP = React.createElement('ol', { className: cx('public/DraftStyleDefault/ol') }); var PRE_WRAP = React.createElement('pre', { className: cx('public/DraftStyleDefault/pre') }); var DefaultDraftBlockRenderMap = Map({ 'header-one': { element: 'h1' }, 'header-two': { element: 'h2' }, 'header-three': { element: 'h3' }, 'header-four': { element: 'h4' }, 'header-five': { element: 'h5' }, 'header-six': { element: 'h6' }, 'unordered-list-item': { element: 'li', wrapper: UL_WRAP }, 'ordered-list-item': { element: 'li', wrapper: OL_WRAP }, 'blockquote': { element: 'blockquote' }, 'atomic': { element: 'figure' }, 'code-block': { element: 'pre', wrapper: PRE_WRAP }, 'unstyled': { element: 'div', aliasedElements: ['p'] } }); module.exports = DefaultDraftBlockRenderMap; /***/ }), /* 25 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule KeyBindingUtil * @typechecks * */ 'use strict'; var UserAgent = __webpack_require__(8); var isOSX = UserAgent.isPlatform('Mac OS X'); var KeyBindingUtil = { /** * Check whether the ctrlKey modifier is *not* being used in conjunction with * the altKey modifier. If they are combined, the result is an `altGraph` * key modifier, which should not be handled by this set of key bindings. */ isCtrlKeyCommand: function isCtrlKeyCommand(e) { return !!e.ctrlKey && !e.altKey; }, isOptionKeyCommand: function isOptionKeyCommand(e) { return isOSX && e.altKey; }, hasCommandModifier: function hasCommandModifier(e) { return isOSX ? !!e.metaKey && !e.altKey : KeyBindingUtil.isCtrlKeyCommand(e); } }; module.exports = KeyBindingUtil; /***/ }), /* 26 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule findAncestorOffsetKey * @typechecks * */ 'use strict'; var getSelectionOffsetKeyForNode = __webpack_require__(50); /** * Get the key from the node's nearest offset-aware ancestor. */ function findAncestorOffsetKey(node) { var searchNode = node; while (searchNode && searchNode !== document.documentElement) { var key = getSelectionOffsetKeyForNode(searchNode); if (key != null) { return key; } searchNode = searchNode.parentNode; } return null; } module.exports = findAncestorOffsetKey; /***/ }), /* 27 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getEntityKeyForSelection * @typechecks * */ 'use strict'; /** * Return the entity key that should be used when inserting text for the * specified target selection, only if the entity is `MUTABLE`. `IMMUTABLE` * and `SEGMENTED` entities should not be used for insertion behavior. */ function getEntityKeyForSelection(contentState, targetSelection) { var entityKey; if (targetSelection.isCollapsed()) { var key = targetSelection.getAnchorKey(); var offset = targetSelection.getAnchorOffset(); if (offset > 0) { entityKey = contentState.getBlockForKey(key).getEntityAt(offset - 1); return filterKey(contentState.getEntityMap(), entityKey); } return null; } var startKey = targetSelection.getStartKey(); var startOffset = targetSelection.getStartOffset(); var startBlock = contentState.getBlockForKey(startKey); entityKey = startOffset === startBlock.getLength() ? null : startBlock.getEntityAt(startOffset); return filterKey(contentState.getEntityMap(), entityKey); } /** * Determine whether an entity key corresponds to a `MUTABLE` entity. If so, * return it. If not, return null. */ function filterKey(entityMap, entityKey) { if (entityKey) { var entity = entityMap.__get(entityKey); return entity.getMutability() === 'MUTABLE' ? entityKey : null; } return null; } module.exports = getEntityKeyForSelection; /***/ }), /* 28 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule moveSelectionBackward * */ 'use strict'; /** * Given a collapsed selection, move the focus `maxDistance` backward within * the selected block. If the selection will go beyond the start of the block, * move focus to the end of the previous block, but no further. * * This function is not Unicode-aware, so surrogate pairs will be treated * as having length 2. */ function moveSelectionBackward(editorState, maxDistance) { var selection = editorState.getSelection(); var content = editorState.getCurrentContent(); var key = selection.getStartKey(); var offset = selection.getStartOffset(); var focusKey = key; var focusOffset = 0; if (maxDistance > offset) { var keyBefore = content.getKeyBefore(key); if (keyBefore == null) { focusKey = key; } else { focusKey = keyBefore; var blockBefore = content.getBlockForKey(keyBefore); focusOffset = blockBefore.getText().length; } } else { focusOffset = offset - maxDistance; } return selection.merge({ focusKey: focusKey, focusOffset: focusOffset, isBackward: true }); } module.exports = moveSelectionBackward; /***/ }), /* 29 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule sanitizeDraftText * */ 'use strict'; var REGEX_BLOCK_DELIMITER = new RegExp('\r', 'g'); function sanitizeDraftText(input) { return input.replace(REGEX_BLOCK_DELIMITER, ''); } module.exports = sanitizeDraftText; /***/ }), /* 30 */ /***/ (function(module, exports) { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ module.exports = { BACKSPACE: 8, TAB: 9, RETURN: 13, ALT: 18, ESC: 27, SPACE: 32, PAGE_UP: 33, PAGE_DOWN: 34, END: 35, HOME: 36, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40, DELETE: 46, COMMA: 188, PERIOD: 190, A: 65, Z: 90, ZERO: 48, NUMPAD_0: 96, NUMPAD_9: 105 }; /***/ }), /* 31 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ var getStyleProperty = __webpack_require__(135); /** * @param {DOMNode} element [description] * @param {string} name Overflow style property name. * @return {boolean} True if the supplied ndoe is scrollable. */ function _isNodeScrollable(element, name) { var overflow = Style.get(element, name); return overflow === 'auto' || overflow === 'scroll'; } /** * Utilities for querying and mutating style properties. */ var Style = { /** * Gets the style property for the supplied node. This will return either the * computed style, if available, or the declared style. * * @param {DOMNode} node * @param {string} name Style property name. * @return {?string} Style property value. */ get: getStyleProperty, /** * Determines the nearest ancestor of a node that is scrollable. * * NOTE: This can be expensive if used repeatedly or on a node nested deeply. * * @param {?DOMNode} node Node from which to start searching. * @return {?DOMWindow|DOMElement} Scroll parent of the supplied node. */ getScrollParent: function getScrollParent(node) { if (!node) { return null; } var ownerDocument = node.ownerDocument; while (node && node !== ownerDocument.body) { if (_isNodeScrollable(node, 'overflow') || _isNodeScrollable(node, 'overflowY') || _isNodeScrollable(node, 'overflowX')) { return node; } node = node.parentNode; } return ownerDocument.defaultView || ownerDocument.parentWindow; } }; module.exports = Style; /***/ }), /* 32 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks * */ /** * Constants to represent text directionality * * Also defines a *global* direciton, to be used in bidi algorithms as a * default fallback direciton, when no better direction is found or provided. * * NOTE: Use `setGlobalDir()`, or update `initGlobalDir()`, to set the initial * global direction value based on the application. * * Part of the implementation of Unicode Bidirectional Algorithm (UBA) * Unicode Standard Annex #9 (UAX9) * http://www.unicode.org/reports/tr9/ */ 'use strict'; var invariant = __webpack_require__(2); var NEUTRAL = 'NEUTRAL'; // No strong direction var LTR = 'LTR'; // Left-to-Right direction var RTL = 'RTL'; // Right-to-Left direction var globalDir = null; // == Helpers == /** * Check if a directionality value is a Strong one */ function isStrong(dir) { return dir === LTR || dir === RTL; } /** * Get string value to be used for `dir` HTML attribute or `direction` CSS * property. */ function getHTMLDir(dir) { !isStrong(dir) ? true ? invariant(false, '`dir` must be a strong direction to be converted to HTML Direction') : invariant(false) : void 0; return dir === LTR ? 'ltr' : 'rtl'; } /** * Get string value to be used for `dir` HTML attribute or `direction` CSS * property, but returns null if `dir` has same value as `otherDir`. * `null`. */ function getHTMLDirIfDifferent(dir, otherDir) { !isStrong(dir) ? true ? invariant(false, '`dir` must be a strong direction to be converted to HTML Direction') : invariant(false) : void 0; !isStrong(otherDir) ? true ? invariant(false, '`otherDir` must be a strong direction to be converted to HTML Direction') : invariant(false) : void 0; return dir === otherDir ? null : getHTMLDir(dir); } // == Global Direction == /** * Set the global direction. */ function setGlobalDir(dir) { globalDir = dir; } /** * Initialize the global direction */ function initGlobalDir() { setGlobalDir(LTR); } /** * Get the global direction */ function getGlobalDir() { if (!globalDir) { this.initGlobalDir(); } !globalDir ? true ? invariant(false, 'Global direction not set.') : invariant(false) : void 0; return globalDir; } var UnicodeBidiDirection = { // Values NEUTRAL: NEUTRAL, LTR: LTR, RTL: RTL, // Helpers isStrong: isStrong, getHTMLDir: getHTMLDir, getHTMLDirIfDifferent: getHTMLDirIfDifferent, // Global Direction setGlobalDir: setGlobalDir, initGlobalDir: initGlobalDir, getGlobalDir: getGlobalDir }; module.exports = UnicodeBidiDirection; /***/ }), /* 33 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * */ var isTextNode = __webpack_require__(140); /*eslint-disable no-bitwise */ /** * Checks if a given DOM node contains or is another DOM node. */ function containsNode(outerNode, innerNode) { if (!outerNode || !innerNode) { return false; } else if (outerNode === innerNode) { return true; } else if (isTextNode(outerNode)) { return false; } else if (isTextNode(innerNode)) { return containsNode(outerNode, innerNode.parentNode); } else if ('contains' in outerNode) { return outerNode.contains(innerNode); } else if (outerNode.compareDocumentPosition) { return !!(outerNode.compareDocumentPosition(innerNode) & 16); } else { return false; } } module.exports = containsNode; /***/ }), /* 34 */ /***/ (function(module, exports) { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * */ function makeEmptyFunction(arg) { return function () { return arg; }; } /** * This function accepts and discards inputs; it has no side effects. This is * primarily useful idiomatically for overridable function endpoints which * always need to be callable, since JS lacks a null-call idiom ala Cocoa. */ var emptyFunction = function emptyFunction() {}; emptyFunction.thatReturns = makeEmptyFunction; emptyFunction.thatReturnsFalse = makeEmptyFunction(false); emptyFunction.thatReturnsTrue = makeEmptyFunction(true); emptyFunction.thatReturnsNull = makeEmptyFunction(null); emptyFunction.thatReturnsThis = function () { return this; }; emptyFunction.thatReturnsArgument = function (arg) { return arg; }; module.exports = emptyFunction; /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ 'use strict'; var getDocumentScrollElement = __webpack_require__(132); var getUnboundedScrollPosition = __webpack_require__(136); /** * Gets the scroll position of the supplied element or window. * * The return values are bounded. This means that if the scroll position is * negative or exceeds the element boundaries (which is possible using inertial * scrolling), you will get zero or the maximum scroll position, respectively. * * If you need the unbound scroll position, use `getUnboundedScrollPosition`. * * @param {DOMWindow|DOMElement} scrollable * @return {object} Map with `x` and `y` keys. */ function getScrollPosition(scrollable) { var documentScrollElement = getDocumentScrollElement(scrollable.ownerDocument || scrollable.document); if (scrollable.Window && scrollable instanceof scrollable.Window) { scrollable = documentScrollElement; } var scrollPosition = getUnboundedScrollPosition(scrollable); var viewport = scrollable === documentScrollElement ? scrollable.ownerDocument.documentElement : scrollable; var xMax = scrollable.scrollWidth - viewport.clientWidth; var yMax = scrollable.scrollHeight - viewport.clientHeight; scrollPosition.x = Math.max(0, Math.min(scrollPosition.x, xMax)); scrollPosition.y = Math.max(0, Math.min(scrollPosition.y, yMax)); return scrollPosition; } module.exports = getScrollPosition; /***/ }), /* 36 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule BlockTree * */ 'use strict'; var Immutable = __webpack_require__(3); var emptyFunction = __webpack_require__(34); var findRangesImmutable = __webpack_require__(20); var List = Immutable.List, Repeat = Immutable.Repeat, Record = Immutable.Record; var returnTrue = emptyFunction.thatReturnsTrue; var FINGERPRINT_DELIMITER = '-'; var defaultLeafRange = { start: null, end: null }; var LeafRange = Record(defaultLeafRange); var defaultDecoratorRange = { start: null, end: null, decoratorKey: null, leaves: null }; var DecoratorRange = Record(defaultDecoratorRange); var BlockTree = { /** * Generate a block tree for a given ContentBlock/decorator pair. */ generate: function generate(contentState, block, decorator) { var textLength = block.getLength(); if (!textLength) { return List.of(new DecoratorRange({ start: 0, end: 0, decoratorKey: null, leaves: List.of(new LeafRange({ start: 0, end: 0 })) })); } var leafSets = []; var decorations = decorator ? decorator.getDecorations(block, contentState) : List(Repeat(null, textLength)); var chars = block.getCharacterList(); findRangesImmutable(decorations, areEqual, returnTrue, function (start, end) { leafSets.push(new DecoratorRange({ start: start, end: end, decoratorKey: decorations.get(start), leaves: generateLeaves(chars.slice(start, end).toList(), start) })); }); return List(leafSets); }, /** * Create a string representation of the given tree map. This allows us * to rapidly determine whether a tree has undergone a significant * structural change. */ getFingerprint: function getFingerprint(tree) { return tree.map(function (leafSet) { var decoratorKey = leafSet.get('decoratorKey'); var fingerprintString = decoratorKey !== null ? decoratorKey + '.' + (leafSet.get('end') - leafSet.get('start')) : ''; return '' + fingerprintString + '.' + leafSet.get('leaves').size; }).join(FINGERPRINT_DELIMITER); } }; /** * Generate LeafRange records for a given character list. */ function generateLeaves(characters, offset) { var leaves = []; var inlineStyles = characters.map(function (c) { return c.getStyle(); }).toList(); findRangesImmutable(inlineStyles, areEqual, returnTrue, function (start, end) { leaves.push(new LeafRange({ start: start + offset, end: end + offset })); }); return List(leaves); } function areEqual(a, b) { return a === b; } module.exports = BlockTree; /***/ }), /* 37 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DefaultDraftInlineStyle * */ 'use strict'; module.exports = { BOLD: { fontWeight: 'bold' }, CODE: { fontFamily: 'monospace', wordWrap: 'break-word' }, ITALIC: { fontStyle: 'italic' }, STRIKETHROUGH: { textDecoration: 'line-through' }, UNDERLINE: { textDecoration: 'underline' } }; /***/ }), /* 38 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftEditorBlock.react * @typechecks * */ 'use strict'; var _assign = __webpack_require__(11); var _extends = _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; }; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var DraftEditorLeaf = __webpack_require__(69); var DraftOffsetKey = __webpack_require__(19); var React = __webpack_require__(12); var ReactDOM = __webpack_require__(17); var Scroll = __webpack_require__(58); var Style = __webpack_require__(31); var UnicodeBidi = __webpack_require__(59); var UnicodeBidiDirection = __webpack_require__(32); var cx = __webpack_require__(16); var getElementPosition = __webpack_require__(133); var getScrollPosition = __webpack_require__(35); var getViewportDimensions = __webpack_require__(137); var invariant = __webpack_require__(2); var nullthrows = __webpack_require__(5); var SCROLL_BUFFER = 10; /** * The default block renderer for a `DraftEditor` component. * * A `DraftEditorBlock` is able to render a given `ContentBlock` to its * appropriate decorator and inline style components. */ var DraftEditorBlock = function (_React$Component) { _inherits(DraftEditorBlock, _React$Component); function DraftEditorBlock() { _classCallCheck(this, DraftEditorBlock); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } DraftEditorBlock.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { return this.props.block !== nextProps.block || this.props.tree !== nextProps.tree || this.props.direction !== nextProps.direction || isBlockOnSelectionEdge(nextProps.selection, nextProps.block.getKey()) && nextProps.forceSelection; }; /** * When a block is mounted and overlaps the selection state, we need to make * sure that the cursor is visible to match native behavior. This may not * be the case if the user has pressed `RETURN` or pasted some content, since * programatically creating these new blocks and setting the DOM selection * will miss out on the browser natively scrolling to that position. * * To replicate native behavior, if the block overlaps the selection state * on mount, force the scroll position. Check the scroll state of the scroll * parent, and adjust it to align the entire block to the bottom of the * scroll parent. */ DraftEditorBlock.prototype.componentDidMount = function componentDidMount() { var selection = this.props.selection; var endKey = selection.getEndKey(); if (!selection.getHasFocus() || endKey !== this.props.block.getKey()) { return; } var blockNode = ReactDOM.findDOMNode(this); var scrollParent = Style.getScrollParent(blockNode); var scrollPosition = getScrollPosition(scrollParent); var scrollDelta; if (scrollParent === window) { var nodePosition = getElementPosition(blockNode); var nodeBottom = nodePosition.y + nodePosition.height; var viewportHeight = getViewportDimensions().height; scrollDelta = nodeBottom - viewportHeight; if (scrollDelta > 0) { window.scrollTo(scrollPosition.x, scrollPosition.y + scrollDelta + SCROLL_BUFFER); } } else { !(blockNode instanceof HTMLElement) ? true ? invariant(false, 'blockNode is not an HTMLElement') : invariant(false) : void 0; var blockBottom = blockNode.offsetHeight + blockNode.offsetTop; var scrollBottom = scrollParent.offsetHeight + scrollPosition.y; scrollDelta = blockBottom - scrollBottom; if (scrollDelta > 0) { Scroll.setTop(scrollParent, Scroll.getTop(scrollParent) + scrollDelta + SCROLL_BUFFER); } } }; DraftEditorBlock.prototype._renderChildren = function _renderChildren() { var _this2 = this; var block = this.props.block; var blockKey = block.getKey(); var text = block.getText(); var lastLeafSet = this.props.tree.size - 1; var hasSelection = isBlockOnSelectionEdge(this.props.selection, blockKey); return this.props.tree.map(function (leafSet, ii) { var leavesForLeafSet = leafSet.get('leaves'); var lastLeaf = leavesForLeafSet.size - 1; var leaves = leavesForLeafSet.map(function (leaf, jj) { var offsetKey = DraftOffsetKey.encode(blockKey, ii, jj); var start = leaf.get('start'); var end = leaf.get('end'); return ( /* $FlowFixMe(>=0.53.0 site=www,mobile) This comment suppresses an * error when upgrading Flow's support for React. Common errors found * when upgrading Flow's React support are documented at * https://fburl.com/eq7bs81w */ React.createElement(DraftEditorLeaf, { key: offsetKey, offsetKey: offsetKey, block: block, start: start, selection: hasSelection ? _this2.props.selection : undefined, forceSelection: _this2.props.forceSelection, text: text.slice(start, end), styleSet: block.getInlineStyleAt(start), customStyleMap: _this2.props.customStyleMap, customStyleFn: _this2.props.customStyleFn, isLast: ii === lastLeafSet && jj === lastLeaf }) ); }).toArray(); var decoratorKey = leafSet.get('decoratorKey'); if (decoratorKey == null) { return leaves; } if (!_this2.props.decorator) { return leaves; } var decorator = nullthrows(_this2.props.decorator); var DecoratorComponent = decorator.getComponentForKey(decoratorKey); if (!DecoratorComponent) { return leaves; } var decoratorProps = decorator.getPropsForKey(decoratorKey); var decoratorOffsetKey = DraftOffsetKey.encode(blockKey, ii, 0); var decoratedText = text.slice(leavesForLeafSet.first().get('start'), leavesForLeafSet.last().get('end')); // Resetting dir to the same value on a child node makes Chrome/Firefox // confused on cursor movement. See http://jsfiddle.net/d157kLck/3/ var dir = UnicodeBidiDirection.getHTMLDirIfDifferent(UnicodeBidi.getDirection(decoratedText), _this2.props.direction); return React.createElement( DecoratorComponent, _extends({}, decoratorProps, { contentState: _this2.props.contentState, decoratedText: decoratedText, dir: dir, key: decoratorOffsetKey, entityKey: block.getEntityAt(leafSet.get('start')), offsetKey: decoratorOffsetKey }), leaves ); }).toArray(); }; DraftEditorBlock.prototype.render = function render() { /* $FlowFixMe(>=0.53.0 site=www,mobile) This comment suppresses an error * when upgrading Flow's support for React. Common errors found when * upgrading Flow's React support are documented at * https://fburl.com/eq7bs81w */ var _props = this.props, direction = _props.direction, offsetKey = _props.offsetKey; var className = cx({ 'public/DraftStyleDefault/block': true, 'public/DraftStyleDefault/ltr': direction === 'LTR', 'public/DraftStyleDefault/rtl': direction === 'RTL' }); return React.createElement( 'div', { 'data-offset-key': offsetKey, className: className }, this._renderChildren() ); }; return DraftEditorBlock; }(React.Component); /** * Return whether a block overlaps with either edge of the `SelectionState`. */ function isBlockOnSelectionEdge(selection, key) { return selection.getAnchorKey() === key || selection.getFocusKey() === key; } module.exports = DraftEditorBlock; /***/ }), /* 39 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftEntityInstance * */ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Immutable = __webpack_require__(3); var Record = Immutable.Record; var DraftEntityInstanceRecord = Record({ type: 'TOKEN', mutability: 'IMMUTABLE', data: Object }); /** * An instance of a document entity, consisting of a `type` and relevant * `data`, metadata about the entity. * * For instance, a "link" entity might provide a URI, and a "mention" * entity might provide the mentioned user's ID. These pieces of data * may be used when rendering the entity as part of a ContentBlock DOM * representation. For a link, the data would be used as an href for * the rendered anchor. For a mention, the ID could be used to retrieve * a hovercard. */ var DraftEntityInstance = function (_DraftEntityInstanceR) { _inherits(DraftEntityInstance, _DraftEntityInstanceR); function DraftEntityInstance() { _classCallCheck(this, DraftEntityInstance); return _possibleConstructorReturn(this, _DraftEntityInstanceR.apply(this, arguments)); } DraftEntityInstance.prototype.getType = function getType() { return this.get('type'); }; DraftEntityInstance.prototype.getMutability = function getMutability() { return this.get('mutability'); }; DraftEntityInstance.prototype.getData = function getData() { return this.get('data'); }; return DraftEntityInstance; }(DraftEntityInstanceRecord); module.exports = DraftEntityInstance; /***/ }), /* 40 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftFeatureFlags * */ 'use strict'; var DraftFeatureFlags = __webpack_require__(73); module.exports = DraftFeatureFlags; /***/ }), /* 41 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftRemovableWord * @typechecks * */ 'use strict'; var TokenizeUtil = __webpack_require__(125); var punctuation = TokenizeUtil.getPunctuation(); // The apostrophe and curly single quotes behave in a curious way: when // surrounded on both sides by word characters, they behave as word chars; when // either neighbor is punctuation or an end of the string, they behave as // punctuation. var CHAMELEON_CHARS = '[\'\u2018\u2019]'; // Remove the underscore, which should count as part of the removable word. The // "chameleon chars" also count as punctuation in this regex. var WHITESPACE_AND_PUNCTUATION = '\\s|(?![_])' + punctuation; var DELETE_STRING = '^' + '(?:' + WHITESPACE_AND_PUNCTUATION + ')*' + '(?:' + CHAMELEON_CHARS + '|(?!' + WHITESPACE_AND_PUNCTUATION + ').)*' + '(?:(?!' + WHITESPACE_AND_PUNCTUATION + ').)'; var DELETE_REGEX = new RegExp(DELETE_STRING); var BACKSPACE_STRING = '(?:(?!' + WHITESPACE_AND_PUNCTUATION + ').)' + '(?:' + CHAMELEON_CHARS + '|(?!' + WHITESPACE_AND_PUNCTUATION + ').)*' + '(?:' + WHITESPACE_AND_PUNCTUATION + ')*' + '$'; var BACKSPACE_REGEX = new RegExp(BACKSPACE_STRING); function getRemovableWord(text, isBackward) { var matches = isBackward ? BACKSPACE_REGEX.exec(text) : DELETE_REGEX.exec(text); return matches ? matches[0] : text; } var DraftRemovableWord = { getBackward: function getBackward(text) { return getRemovableWord(text, true); }, getForward: function getForward(text) { return getRemovableWord(text, false); } }; module.exports = DraftRemovableWord; /***/ }), /* 42 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftStringKey * @typechecks * */ 'use strict'; var DraftStringKey = { stringify: function stringify(key) { return '_' + String(key); }, unstringify: function unstringify(key) { return key.slice(1); } }; module.exports = DraftStringKey; /***/ }), /* 43 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule RichTextEditorUtil * @typechecks * */ 'use strict'; var DraftModifier = __webpack_require__(4); var EditorState = __webpack_require__(1); var SelectionState = __webpack_require__(14); var adjustBlockDepthForContentState = __webpack_require__(78); var nullthrows = __webpack_require__(5); var RichTextEditorUtil = { currentBlockContainsLink: function currentBlockContainsLink(editorState) { var selection = editorState.getSelection(); var contentState = editorState.getCurrentContent(); var entityMap = contentState.getEntityMap(); return contentState.getBlockForKey(selection.getAnchorKey()).getCharacterList().slice(selection.getStartOffset(), selection.getEndOffset()).some(function (v) { var entity = v.getEntity(); return !!entity && entityMap.__get(entity).getType() === 'LINK'; }); }, getCurrentBlockType: function getCurrentBlockType(editorState) { var selection = editorState.getSelection(); return editorState.getCurrentContent().getBlockForKey(selection.getStartKey()).getType(); }, getDataObjectForLinkURL: function getDataObjectForLinkURL(uri) { return { url: uri.toString() }; }, handleKeyCommand: function handleKeyCommand(editorState, command) { switch (command) { case 'bold': return RichTextEditorUtil.toggleInlineStyle(editorState, 'BOLD'); case 'italic': return RichTextEditorUtil.toggleInlineStyle(editorState, 'ITALIC'); case 'underline': return RichTextEditorUtil.toggleInlineStyle(editorState, 'UNDERLINE'); case 'code': return RichTextEditorUtil.toggleCode(editorState); case 'backspace': case 'backspace-word': case 'backspace-to-start-of-line': return RichTextEditorUtil.onBackspace(editorState); case 'delete': case 'delete-word': case 'delete-to-end-of-block': return RichTextEditorUtil.onDelete(editorState); default: // they may have custom editor commands; ignore those return null; } }, insertSoftNewline: function insertSoftNewline(editorState) { var contentState = DraftModifier.insertText(editorState.getCurrentContent(), editorState.getSelection(), '\n', editorState.getCurrentInlineStyle(), null); var newEditorState = EditorState.push(editorState, contentState, 'insert-characters'); return EditorState.forceSelection(newEditorState, contentState.getSelectionAfter()); }, /** * For collapsed selections at the start of styled blocks, backspace should * just remove the existing style. */ onBackspace: function onBackspace(editorState) { var selection = editorState.getSelection(); if (!selection.isCollapsed() || selection.getAnchorOffset() || selection.getFocusOffset()) { return null; } // First, try to remove a preceding atomic block. var content = editorState.getCurrentContent(); var startKey = selection.getStartKey(); var blockBefore = content.getBlockBefore(startKey); if (blockBefore && blockBefore.getType() === 'atomic') { var blockMap = content.getBlockMap()['delete'](blockBefore.getKey()); var withoutAtomicBlock = content.merge({ blockMap: blockMap, selectionAfter: selection }); if (withoutAtomicBlock !== content) { return EditorState.push(editorState, withoutAtomicBlock, 'remove-range'); } } // If that doesn't succeed, try to remove the current block style. var withoutBlockStyle = RichTextEditorUtil.tryToRemoveBlockStyle(editorState); if (withoutBlockStyle) { return EditorState.push(editorState, withoutBlockStyle, 'change-block-type'); } return null; }, onDelete: function onDelete(editorState) { var selection = editorState.getSelection(); if (!selection.isCollapsed()) { return null; } var content = editorState.getCurrentContent(); var startKey = selection.getStartKey(); var block = content.getBlockForKey(startKey); var length = block.getLength(); // The cursor is somewhere within the text. Behave normally. if (selection.getStartOffset() < length) { return null; } var blockAfter = content.getBlockAfter(startKey); if (!blockAfter || blockAfter.getType() !== 'atomic') { return null; } var atomicBlockTarget = selection.merge({ focusKey: blockAfter.getKey(), focusOffset: blockAfter.getLength() }); var withoutAtomicBlock = DraftModifier.removeRange(content, atomicBlockTarget, 'forward'); if (withoutAtomicBlock !== content) { return EditorState.push(editorState, withoutAtomicBlock, 'remove-range'); } return null; }, onTab: function onTab(event, editorState, maxDepth) { var selection = editorState.getSelection(); var key = selection.getAnchorKey(); if (key !== selection.getFocusKey()) { return editorState; } var content = editorState.getCurrentContent(); var block = content.getBlockForKey(key); var type = block.getType(); if (type !== 'unordered-list-item' && type !== 'ordered-list-item') { return editorState; } event.preventDefault(); // Only allow indenting one level beyond the block above, and only if // the block above is a list item as well. var blockAbove = content.getBlockBefore(key); if (!blockAbove) { return editorState; } var typeAbove = blockAbove.getType(); if (typeAbove !== 'unordered-list-item' && typeAbove !== 'ordered-list-item') { return editorState; } var depth = block.getDepth(); if (!event.shiftKey && depth === maxDepth) { return editorState; } maxDepth = Math.min(blockAbove.getDepth() + 1, maxDepth); var withAdjustment = adjustBlockDepthForContentState(content, selection, event.shiftKey ? -1 : 1, maxDepth); return EditorState.push(editorState, withAdjustment, 'adjust-depth'); }, toggleBlockType: function toggleBlockType(editorState, blockType) { var selection = editorState.getSelection(); var startKey = selection.getStartKey(); var endKey = selection.getEndKey(); var content = editorState.getCurrentContent(); var target = selection; // Triple-click can lead to a selection that includes offset 0 of the // following block. The `SelectionState` for this case is accurate, but // we should avoid toggling block type for the trailing block because it // is a confusing interaction. if (startKey !== endKey && selection.getEndOffset() === 0) { var blockBefore = nullthrows(content.getBlockBefore(endKey)); endKey = blockBefore.getKey(); target = target.merge({ anchorKey: startKey, anchorOffset: selection.getStartOffset(), focusKey: endKey, focusOffset: blockBefore.getLength(), isBackward: false }); } var hasAtomicBlock = content.getBlockMap().skipWhile(function (_, k) { return k !== startKey; }).reverse().skipWhile(function (_, k) { return k !== endKey; }).some(function (v) { return v.getType() === 'atomic'; }); if (hasAtomicBlock) { return editorState; } var typeToSet = content.getBlockForKey(startKey).getType() === blockType ? 'unstyled' : blockType; return EditorState.push(editorState, DraftModifier.setBlockType(content, target, typeToSet), 'change-block-type'); }, toggleCode: function toggleCode(editorState) { var selection = editorState.getSelection(); var anchorKey = selection.getAnchorKey(); var focusKey = selection.getFocusKey(); if (selection.isCollapsed() || anchorKey !== focusKey) { return RichTextEditorUtil.toggleBlockType(editorState, 'code-block'); } return RichTextEditorUtil.toggleInlineStyle(editorState, 'CODE'); }, /** * Toggle the specified inline style for the selection. If the * user's selection is collapsed, apply or remove the style for the * internal state. If it is not collapsed, apply the change directly * to the document state. */ toggleInlineStyle: function toggleInlineStyle(editorState, inlineStyle) { var selection = editorState.getSelection(); var currentStyle = editorState.getCurrentInlineStyle(); // If the selection is collapsed, toggle the specified style on or off and // set the result as the new inline style override. This will then be // used as the inline style for the next character to be inserted. if (selection.isCollapsed()) { return EditorState.setInlineStyleOverride(editorState, currentStyle.has(inlineStyle) ? currentStyle.remove(inlineStyle) : currentStyle.add(inlineStyle)); } // If characters are selected, immediately apply or remove the // inline style on the document state itself. var content = editorState.getCurrentContent(); var newContent; // If the style is already present for the selection range, remove it. // Otherwise, apply it. if (currentStyle.has(inlineStyle)) { newContent = DraftModifier.removeInlineStyle(content, selection, inlineStyle); } else { newContent = DraftModifier.applyInlineStyle(content, selection, inlineStyle); } return EditorState.push(editorState, newContent, 'change-inline-style'); }, toggleLink: function toggleLink(editorState, targetSelection, entityKey) { var withoutLink = DraftModifier.applyEntity(editorState.getCurrentContent(), targetSelection, entityKey); return EditorState.push(editorState, withoutLink, 'apply-entity'); }, /** * When a collapsed cursor is at the start of an empty styled block, * changes block to 'unstyled'. Returns null if block or selection does not * meet that criteria. */ tryToRemoveBlockStyle: function tryToRemoveBlockStyle(editorState) { var selection = editorState.getSelection(); var offset = selection.getAnchorOffset(); if (selection.isCollapsed() && offset === 0) { var key = selection.getAnchorKey(); var content = editorState.getCurrentContent(); var block = content.getBlockForKey(key); if (block.getLength() > 0) { return null; } var type = block.getType(); var blockBefore = content.getBlockBefore(key); if (type === 'code-block' && blockBefore && blockBefore.getType() === 'code-block') { return null; } if (type !== 'unstyled') { return DraftModifier.setBlockType(content, selection, 'unstyled'); } } return null; } }; module.exports = RichTextEditorUtil; /***/ }), /* 44 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule convertFromHTMLToContentBlocks * @typechecks * */ 'use strict'; var CharacterMetadata = __webpack_require__(6); var ContentBlock = __webpack_require__(9); var DefaultDraftBlockRenderMap = __webpack_require__(24); var DraftEntity = __webpack_require__(18); var Immutable = __webpack_require__(3); var _require = __webpack_require__(3), Set = _require.Set; var URI = __webpack_require__(126); var generateRandomKey = __webpack_require__(7); var getSafeBodyFromHTML = __webpack_require__(49); var invariant = __webpack_require__(2); var nullthrows = __webpack_require__(5); var sanitizeDraftText = __webpack_require__(29); var List = Immutable.List, OrderedSet = Immutable.OrderedSet; var NBSP = '&nbsp;'; var SPACE = ' '; // Arbitrary max indent var MAX_DEPTH = 4; // used for replacing characters in HTML var REGEX_CR = new RegExp('\r', 'g'); var REGEX_LF = new RegExp('\n', 'g'); var REGEX_NBSP = new RegExp(NBSP, 'g'); var REGEX_CARRIAGE = new RegExp('&#13;?', 'g'); var REGEX_ZWS = new RegExp('&#8203;?', 'g'); // https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight var boldValues = ['bold', 'bolder', '500', '600', '700', '800', '900']; var notBoldValues = ['light', 'lighter', '100', '200', '300', '400']; // Block tag flow is different because LIs do not have // a deterministic style ;_; var inlineTags = { b: 'BOLD', code: 'CODE', del: 'STRIKETHROUGH', em: 'ITALIC', i: 'ITALIC', s: 'STRIKETHROUGH', strike: 'STRIKETHROUGH', strong: 'BOLD', u: 'UNDERLINE' }; var anchorAttr = ['className', 'href', 'rel', 'target', 'title']; var imgAttr = ['alt', 'className', 'height', 'src', 'width']; var lastBlock; function getEmptyChunk() { return { text: '', inlines: [], entities: [], blocks: [] }; } function getWhitespaceChunk(inEntity) { var entities = new Array(1); if (inEntity) { entities[0] = inEntity; } return { text: SPACE, inlines: [OrderedSet()], entities: entities, blocks: [] }; } function getSoftNewlineChunk() { return { text: '\n', inlines: [OrderedSet()], entities: new Array(1), blocks: [] }; } function getBlockDividerChunk(block, depth) { return { text: '\r', inlines: [OrderedSet()], entities: new Array(1), blocks: [{ type: block, depth: Math.max(0, Math.min(MAX_DEPTH, depth)) }] }; } function getListBlockType(tag, lastList) { if (tag === 'li') { return lastList === 'ol' ? 'ordered-list-item' : 'unordered-list-item'; } return null; } function getBlockMapSupportedTags(blockRenderMap) { var unstyledElement = blockRenderMap.get('unstyled').element; var tags = Set([]); blockRenderMap.forEach(function (draftBlock) { if (draftBlock.aliasedElements) { draftBlock.aliasedElements.forEach(function (tag) { tags = tags.add(tag); }); } tags = tags.add(draftBlock.element); }); return tags.filter(function (tag) { return tag && tag !== unstyledElement; }).toArray().sort(); } // custom element conversions function getMultiMatchedType(tag, lastList, multiMatchExtractor) { for (var ii = 0; ii < multiMatchExtractor.length; ii++) { var matchType = multiMatchExtractor[ii](tag, lastList); if (matchType) { return matchType; } } return null; } function getBlockTypeForTag(tag, lastList, blockRenderMap) { var matchedTypes = blockRenderMap.filter(function (draftBlock) { return draftBlock.element === tag || draftBlock.wrapper === tag || draftBlock.aliasedElements && draftBlock.aliasedElements.some(function (alias) { return alias === tag; }); }).keySeq().toSet().toArray().sort(); // if we dont have any matched type, return unstyled // if we have one matched type return it // if we have multi matched types use the multi-match function to gather type switch (matchedTypes.length) { case 0: return 'unstyled'; case 1: return matchedTypes[0]; default: return getMultiMatchedType(tag, lastList, [getListBlockType]) || 'unstyled'; } } function processInlineTag(tag, node, currentStyle) { var styleToCheck = inlineTags[tag]; if (styleToCheck) { currentStyle = currentStyle.add(styleToCheck).toOrderedSet(); } else if (node instanceof HTMLElement) { var htmlElement = node; currentStyle = currentStyle.withMutations(function (style) { var fontWeight = htmlElement.style.fontWeight; var fontStyle = htmlElement.style.fontStyle; var textDecoration = htmlElement.style.textDecoration; if (boldValues.indexOf(fontWeight) >= 0) { style.add('BOLD'); } else if (notBoldValues.indexOf(fontWeight) >= 0) { style.remove('BOLD'); } if (fontStyle === 'italic') { style.add('ITALIC'); } else if (fontStyle === 'normal') { style.remove('ITALIC'); } if (textDecoration === 'underline') { style.add('UNDERLINE'); } if (textDecoration === 'line-through') { style.add('STRIKETHROUGH'); } if (textDecoration === 'none') { style.remove('UNDERLINE'); style.remove('STRIKETHROUGH'); } }).toOrderedSet(); } return currentStyle; } function joinChunks(A, B) { // Sometimes two blocks will touch in the DOM and we need to strip the // extra delimiter to preserve niceness. var lastInA = A.text.slice(-1); var firstInB = B.text.slice(0, 1); if (lastInA === '\r' && firstInB === '\r') { A.text = A.text.slice(0, -1); A.inlines.pop(); A.entities.pop(); A.blocks.pop(); } // Kill whitespace after blocks if (lastInA === '\r') { if (B.text === SPACE || B.text === '\n') { return A; } else if (firstInB === SPACE || firstInB === '\n') { B.text = B.text.slice(1); B.inlines.shift(); B.entities.shift(); } } return { text: A.text + B.text, inlines: A.inlines.concat(B.inlines), entities: A.entities.concat(B.entities), blocks: A.blocks.concat(B.blocks) }; } /** * Check to see if we have anything like <p> <blockquote> <h1>... to create * block tags from. If we do, we can use those and ignore <div> tags. If we * don't, we can treat <div> tags as meaningful (unstyled) blocks. */ function containsSemanticBlockMarkup(html, blockTags) { return blockTags.some(function (tag) { return html.indexOf('<' + tag) !== -1; }); } function hasValidLinkText(link) { !(link instanceof HTMLAnchorElement) ? true ? invariant(false, 'Link must be an HTMLAnchorElement.') : invariant(false) : void 0; var protocol = link.protocol; return protocol === 'http:' || protocol === 'https:' || protocol === 'mailto:'; } function genFragment(entityMap, node, inlineStyle, lastList, inBlock, blockTags, depth, blockRenderMap, inEntity) { var nodeName = node.nodeName.toLowerCase(); var newBlock = false; var nextBlockType = 'unstyled'; var lastLastBlock = lastBlock; var newEntityMap = entityMap; // Base Case if (nodeName === '#text') { var text = node.textContent; if (text.trim() === '' && inBlock !== 'pre') { return { chunk: getWhitespaceChunk(inEntity), entityMap: entityMap }; } if (inBlock !== 'pre') { // Can't use empty string because MSWord text = text.replace(REGEX_LF, SPACE); } // save the last block so we can use it later lastBlock = nodeName; return { chunk: { text: text, inlines: Array(text.length).fill(inlineStyle), entities: Array(text.length).fill(inEntity), blocks: [] }, entityMap: entityMap }; } // save the last block so we can use it later lastBlock = nodeName; // BR tags if (nodeName === 'br') { if (lastLastBlock === 'br' && (!inBlock || getBlockTypeForTag(inBlock, lastList, blockRenderMap) === 'unstyled')) { return { chunk: getBlockDividerChunk('unstyled', depth), entityMap: entityMap }; } return { chunk: getSoftNewlineChunk(), entityMap: entityMap }; } // IMG tags if (nodeName === 'img' && node instanceof HTMLImageElement && node.attributes.getNamedItem('src') && node.attributes.getNamedItem('src').value) { var image = node; var entityConfig = {}; imgAttr.forEach(function (attr) { var imageAttribute = image.getAttribute(attr); if (imageAttribute) { entityConfig[attr] = imageAttribute; } }); // Forcing this node to have children because otherwise no entity will be // created for this node. // The child text node cannot just have a space or return as content - // we strip those out. // See https://github.com/facebook/draft-js/issues/231 for some context. node.textContent = '\uD83D\uDCF7'; // TODO: update this when we remove DraftEntity entirely inEntity = DraftEntity.__create('IMAGE', 'MUTABLE', entityConfig || {}); } var chunk = getEmptyChunk(); var newChunk = null; // Inline tags inlineStyle = processInlineTag(nodeName, node, inlineStyle); // Handle lists if (nodeName === 'ul' || nodeName === 'ol') { if (lastList) { depth += 1; } lastList = nodeName; } // Block Tags if (!inBlock && blockTags.indexOf(nodeName) !== -1) { chunk = getBlockDividerChunk(getBlockTypeForTag(nodeName, lastList, blockRenderMap), depth); inBlock = nodeName; newBlock = true; } else if (lastList && inBlock === 'li' && nodeName === 'li') { chunk = getBlockDividerChunk(getBlockTypeForTag(nodeName, lastList, blockRenderMap), depth); inBlock = nodeName; newBlock = true; nextBlockType = lastList === 'ul' ? 'unordered-list-item' : 'ordered-list-item'; } // Recurse through children var child = node.firstChild; if (child != null) { nodeName = child.nodeName.toLowerCase(); } var entityId = null; while (child) { if (child instanceof HTMLAnchorElement && child.href && hasValidLinkText(child)) { (function () { var anchor = child; var entityConfig = {}; anchorAttr.forEach(function (attr) { var anchorAttribute = anchor.getAttribute(attr); if (anchorAttribute) { entityConfig[attr] = anchorAttribute; } }); entityConfig.url = new URI(anchor.href).toString(); // TODO: update this when we remove DraftEntity completely entityId = DraftEntity.__create('LINK', 'MUTABLE', entityConfig || {}); })(); } else { entityId = undefined; } var _genFragment = genFragment(newEntityMap, child, inlineStyle, lastList, inBlock, blockTags, depth, blockRenderMap, entityId || inEntity), generatedChunk = _genFragment.chunk, maybeUpdatedEntityMap = _genFragment.entityMap; newChunk = generatedChunk; newEntityMap = maybeUpdatedEntityMap; chunk = joinChunks(chunk, newChunk); var sibling = child.nextSibling; // Put in a newline to break up blocks inside blocks if (sibling && blockTags.indexOf(nodeName) >= 0 && inBlock) { chunk = joinChunks(chunk, getSoftNewlineChunk()); } if (sibling) { nodeName = sibling.nodeName.toLowerCase(); } child = sibling; } if (newBlock) { chunk = joinChunks(chunk, getBlockDividerChunk(nextBlockType, depth)); } return { chunk: chunk, entityMap: newEntityMap }; } function getChunkForHTML(html, DOMBuilder, blockRenderMap, entityMap) { html = html.trim().replace(REGEX_CR, '').replace(REGEX_NBSP, SPACE).replace(REGEX_CARRIAGE, '').replace(REGEX_ZWS, ''); var supportedBlockTags = getBlockMapSupportedTags(blockRenderMap); var safeBody = DOMBuilder(html); if (!safeBody) { return null; } lastBlock = null; // Sometimes we aren't dealing with content that contains nice semantic // tags. In this case, use divs to separate everything out into paragraphs // and hope for the best. var workingBlocks = containsSemanticBlockMarkup(html, supportedBlockTags) ? supportedBlockTags : ['div']; // Start with -1 block depth to offset the fact that we are passing in a fake // UL block to start with. var _genFragment2 = genFragment(entityMap, safeBody, OrderedSet(), 'ul', null, workingBlocks, -1, blockRenderMap), chunk = _genFragment2.chunk, newEntityMap = _genFragment2.entityMap; // join with previous block to prevent weirdness on paste if (chunk.text.indexOf('\r') === 0) { chunk = { text: chunk.text.slice(1), inlines: chunk.inlines.slice(1), entities: chunk.entities.slice(1), blocks: chunk.blocks }; } // Kill block delimiter at the end if (chunk.text.slice(-1) === '\r') { chunk.text = chunk.text.slice(0, -1); chunk.inlines = chunk.inlines.slice(0, -1); chunk.entities = chunk.entities.slice(0, -1); chunk.blocks.pop(); } // If we saw no block tags, put an unstyled one in if (chunk.blocks.length === 0) { chunk.blocks.push({ type: 'unstyled', depth: 0 }); } // Sometimes we start with text that isn't in a block, which is then // followed by blocks. Need to fix up the blocks to add in // an unstyled block for this content if (chunk.text.split('\r').length === chunk.blocks.length + 1) { chunk.blocks.unshift({ type: 'unstyled', depth: 0 }); } return { chunk: chunk, entityMap: newEntityMap }; } function convertFromHTMLtoContentBlocks(html) { var DOMBuilder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getSafeBodyFromHTML; var blockRenderMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DefaultDraftBlockRenderMap; // Be ABSOLUTELY SURE that the dom builder you pass here won't execute // arbitrary code in whatever environment you're running this in. For an // example of how we try to do this in-browser, see getSafeBodyFromHTML. // TODO: replace DraftEntity with an OrderedMap here var chunkData = getChunkForHTML(html, DOMBuilder, blockRenderMap, DraftEntity); if (chunkData == null) { return null; } var chunk = chunkData.chunk, newEntityMap = chunkData.entityMap; var start = 0; return { contentBlocks: chunk.text.split('\r').map(function (textBlock, ii) { // Make absolutely certain that our text is acceptable. textBlock = sanitizeDraftText(textBlock); var end = start + textBlock.length; var inlines = nullthrows(chunk).inlines.slice(start, end); var entities = nullthrows(chunk).entities.slice(start, end); var characterList = List(inlines.map(function (style, ii) { var data = { style: style, entity: null }; if (entities[ii]) { data.entity = entities[ii]; } return CharacterMetadata.create(data); })); start = end + 1; return new ContentBlock({ key: generateRandomKey(), type: nullthrows(chunk).blocks[ii].type, depth: nullthrows(chunk).blocks[ii].depth, text: textBlock, characterList: characterList }); }), entityMap: newEntityMap }; } module.exports = convertFromHTMLtoContentBlocks; /***/ }), /* 45 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getDefaultKeyBinding * @typechecks * */ 'use strict'; var KeyBindingUtil = __webpack_require__(25); var Keys = __webpack_require__(30); var UserAgent = __webpack_require__(8); var isOSX = UserAgent.isPlatform('Mac OS X'); var isWindows = UserAgent.isPlatform('Windows'); // Firefox on OSX had a bug resulting in navigation instead of cursor movement. // This bug was fixed in Firefox 29. Feature detection is virtually impossible // so we just check the version number. See #342765. var shouldFixFirefoxMovement = isOSX && UserAgent.isBrowser('Firefox < 29'); var hasCommandModifier = KeyBindingUtil.hasCommandModifier, isCtrlKeyCommand = KeyBindingUtil.isCtrlKeyCommand; function shouldRemoveWord(e) { return isOSX && e.altKey || isCtrlKeyCommand(e); } /** * Get the appropriate undo/redo command for a Z key command. */ function getZCommand(e) { if (!hasCommandModifier(e)) { return null; } return e.shiftKey ? 'redo' : 'undo'; } function getDeleteCommand(e) { // Allow default "cut" behavior for Windows on Shift + Delete. if (isWindows && e.shiftKey) { return null; } return shouldRemoveWord(e) ? 'delete-word' : 'delete'; } function getBackspaceCommand(e) { if (hasCommandModifier(e) && isOSX) { return 'backspace-to-start-of-line'; } return shouldRemoveWord(e) ? 'backspace-word' : 'backspace'; } /** * Retrieve a bound key command for the given event. */ function getDefaultKeyBinding(e) { switch (e.keyCode) { case 66: // B return hasCommandModifier(e) ? 'bold' : null; case 68: // D return isCtrlKeyCommand(e) ? 'delete' : null; case 72: // H return isCtrlKeyCommand(e) ? 'backspace' : null; case 73: // I return hasCommandModifier(e) ? 'italic' : null; case 74: // J return hasCommandModifier(e) ? 'code' : null; case 75: // K return !isWindows && isCtrlKeyCommand(e) ? 'secondary-cut' : null; case 77: // M return isCtrlKeyCommand(e) ? 'split-block' : null; case 79: // O return isCtrlKeyCommand(e) ? 'split-block' : null; case 84: // T return isOSX && isCtrlKeyCommand(e) ? 'transpose-characters' : null; case 85: // U return hasCommandModifier(e) ? 'underline' : null; case 87: // W return isOSX && isCtrlKeyCommand(e) ? 'backspace-word' : null; case 89: // Y if (isCtrlKeyCommand(e)) { return isWindows ? 'redo' : 'secondary-paste'; } return null; case 90: // Z return getZCommand(e) || null; case Keys.RETURN: return 'split-block'; case Keys.DELETE: return getDeleteCommand(e); case Keys.BACKSPACE: return getBackspaceCommand(e); // LEFT/RIGHT handlers serve as a workaround for a Firefox bug. case Keys.LEFT: return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-start-of-block' : null; case Keys.RIGHT: return shouldFixFirefoxMovement && hasCommandModifier(e) ? 'move-selection-to-end-of-block' : null; default: return null; } } module.exports = getDefaultKeyBinding; /***/ }), /* 46 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getDraftEditorSelectionWithNodes * @typechecks * */ 'use strict'; var findAncestorOffsetKey = __webpack_require__(26); var getSelectionOffsetKeyForNode = __webpack_require__(50); var getUpdatedSelectionState = __webpack_require__(52); var invariant = __webpack_require__(2); var nullthrows = __webpack_require__(5); /** * Convert the current selection range to an anchor/focus pair of offset keys * and values that can be interpreted by components. */ function getDraftEditorSelectionWithNodes(editorState, root, anchorNode, anchorOffset, focusNode, focusOffset) { var anchorIsTextNode = anchorNode.nodeType === Node.TEXT_NODE; var focusIsTextNode = focusNode.nodeType === Node.TEXT_NODE; // If the selection range lies only on text nodes, the task is simple. // Find the nearest offset-aware elements and use the // offset values supplied by the selection range. if (anchorIsTextNode && focusIsTextNode) { return { selectionState: getUpdatedSelectionState(editorState, nullthrows(findAncestorOffsetKey(anchorNode)), anchorOffset, nullthrows(findAncestorOffsetKey(focusNode)), focusOffset), needsRecovery: false }; } var anchorPoint = null; var focusPoint = null; var needsRecovery = true; // An element is selected. Convert this selection range into leaf offset // keys and offset values for consumption at the component level. This // is common in Firefox, where select-all and triple click behavior leads // to entire elements being selected. // // Note that we use the `needsRecovery` parameter in the callback here. This // is because when certain elements are selected, the behavior for subsequent // cursor movement (e.g. via arrow keys) is uncertain and may not match // expectations at the component level. For example, if an entire <div> is // selected and the user presses the right arrow, Firefox keeps the selection // on the <div>. If we allow subsequent keypresses to insert characters // natively, they will be inserted into a browser-created text node to the // right of that <div>. This is obviously undesirable. // // With the `needsRecovery` flag, we inform the caller that it is responsible // for manually setting the selection state on the rendered document to // ensure proper selection state maintenance. if (anchorIsTextNode) { anchorPoint = { key: nullthrows(findAncestorOffsetKey(anchorNode)), offset: anchorOffset }; focusPoint = getPointForNonTextNode(root, focusNode, focusOffset); } else if (focusIsTextNode) { focusPoint = { key: nullthrows(findAncestorOffsetKey(focusNode)), offset: focusOffset }; anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset); } else { anchorPoint = getPointForNonTextNode(root, anchorNode, anchorOffset); focusPoint = getPointForNonTextNode(root, focusNode, focusOffset); // If the selection is collapsed on an empty block, don't force recovery. // This way, on arrow key selection changes, the browser can move the // cursor from a non-zero offset on one block, through empty blocks, // to a matching non-zero offset on other text blocks. if (anchorNode === focusNode && anchorOffset === focusOffset) { needsRecovery = !!anchorNode.firstChild && anchorNode.firstChild.nodeName !== 'BR'; } } return { selectionState: getUpdatedSelectionState(editorState, anchorPoint.key, anchorPoint.offset, focusPoint.key, focusPoint.offset), needsRecovery: needsRecovery }; } /** * Identify the first leaf descendant for the given node. */ function getFirstLeaf(node) { while (node.firstChild && getSelectionOffsetKeyForNode(node.firstChild)) { node = node.firstChild; } return node; } /** * Identify the last leaf descendant for the given node. */ function getLastLeaf(node) { while (node.lastChild && getSelectionOffsetKeyForNode(node.lastChild)) { node = node.lastChild; } return node; } function getPointForNonTextNode(editorRoot, startNode, childOffset) { var node = startNode; var offsetKey = findAncestorOffsetKey(node); !(offsetKey != null || editorRoot && (editorRoot === node || editorRoot.firstChild === node)) ? true ? invariant(false, 'Unknown node in selection range.') : invariant(false) : void 0; // If the editorRoot is the selection, step downward into the content // wrapper. if (editorRoot === node) { node = node.firstChild; !(node instanceof Element && node.getAttribute('data-contents') === 'true') ? true ? invariant(false, 'Invalid DraftEditorContents structure.') : invariant(false) : void 0; if (childOffset > 0) { childOffset = node.childNodes.length; } } // If the child offset is zero and we have an offset key, we're done. // If there's no offset key because the entire editor is selected, // find the leftmost ("first") leaf in the tree and use that as the offset // key. if (childOffset === 0) { var key = null; if (offsetKey != null) { key = offsetKey; } else { var firstLeaf = getFirstLeaf(node); key = nullthrows(getSelectionOffsetKeyForNode(firstLeaf)); } return { key: key, offset: 0 }; } var nodeBeforeCursor = node.childNodes[childOffset - 1]; var leafKey = null; var textLength = null; if (!getSelectionOffsetKeyForNode(nodeBeforeCursor)) { // Our target node may be a leaf or a text node, in which case we're // already where we want to be and can just use the child's length as // our offset. leafKey = nullthrows(offsetKey); textLength = getTextContentLength(nodeBeforeCursor); } else { // Otherwise, we'll look at the child to the left of the cursor and find // the last leaf node in its subtree. var lastLeaf = getLastLeaf(nodeBeforeCursor); leafKey = nullthrows(getSelectionOffsetKeyForNode(lastLeaf)); textLength = getTextContentLength(lastLeaf); } return { key: leafKey, offset: textLength }; } /** * Return the length of a node's textContent, regarding single newline * characters as zero-length. This allows us to avoid problems with identifying * the correct selection offset for empty blocks in IE, in which we * render newlines instead of break tags. */ function getTextContentLength(node) { var textContent = node.textContent; return textContent === '\n' ? 0 : textContent.length; } module.exports = getDraftEditorSelectionWithNodes; /***/ }), /* 47 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getFragmentFromSelection * */ 'use strict'; var getContentStateFragment = __webpack_require__(21); function getFragmentFromSelection(editorState) { var selectionState = editorState.getSelection(); if (selectionState.isCollapsed()) { return null; } return getContentStateFragment(editorState.getCurrentContent(), selectionState); } module.exports = getFragmentFromSelection; /***/ }), /* 48 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getRangeClientRects * @typechecks * */ 'use strict'; var UserAgent = __webpack_require__(8); var invariant = __webpack_require__(2); var isChrome = UserAgent.isBrowser('Chrome'); // In Chrome, the client rects will include the entire bounds of all nodes that // begin (have a start tag) within the selection, even if the selection does // not overlap the entire node. To resolve this, we split the range at each // start tag and join the client rects together. // https://code.google.com/p/chromium/issues/detail?id=324437 /* eslint-disable consistent-return */ function getRangeClientRectsChrome(range) { var tempRange = range.cloneRange(); var clientRects = []; for (var ancestor = range.endContainer; ancestor != null; ancestor = ancestor.parentNode) { // If we've climbed up to the common ancestor, we can now use the // original start point and stop climbing the tree. var atCommonAncestor = ancestor === range.commonAncestorContainer; if (atCommonAncestor) { tempRange.setStart(range.startContainer, range.startOffset); } else { tempRange.setStart(tempRange.endContainer, 0); } var rects = Array.from(tempRange.getClientRects()); clientRects.push(rects); if (atCommonAncestor) { var _ref; clientRects.reverse(); return (_ref = []).concat.apply(_ref, clientRects); } tempRange.setEndBefore(ancestor); } true ? true ? invariant(false, 'Found an unexpected detached subtree when getting range client rects.') : invariant(false) : void 0; } /* eslint-enable consistent-return */ /** * Like range.getClientRects() but normalizes for browser bugs. */ var getRangeClientRects = isChrome ? getRangeClientRectsChrome : function (range) { return Array.from(range.getClientRects()); }; module.exports = getRangeClientRects; /***/ }), /* 49 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getSafeBodyFromHTML * */ 'use strict'; var UserAgent = __webpack_require__(8); var invariant = __webpack_require__(2); var isOldIE = UserAgent.isBrowser('IE <= 9'); // Provides a dom node that will not execute scripts // https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation.createHTMLDocument // https://developer.mozilla.org/en-US/Add-ons/Code_snippets/HTML_to_DOM function getSafeBodyFromHTML(html) { var doc; var root = null; // Provides a safe context if (!isOldIE && document.implementation && document.implementation.createHTMLDocument) { doc = document.implementation.createHTMLDocument('foo'); !doc.documentElement ? true ? invariant(false, 'Missing doc.documentElement') : invariant(false) : void 0; doc.documentElement.innerHTML = html; root = doc.getElementsByTagName('body')[0]; } return root; } module.exports = getSafeBodyFromHTML; /***/ }), /* 50 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getSelectionOffsetKeyForNode * @typechecks * */ 'use strict'; /** * Get offset key from a node or it's child nodes. Return the first offset key * found on the DOM tree of given node. */ function getSelectionOffsetKeyForNode(node) { if (node instanceof Element) { var offsetKey = node.getAttribute('data-offset-key'); if (offsetKey) { return offsetKey; } for (var ii = 0; ii < node.childNodes.length; ii++) { var childOffsetKey = getSelectionOffsetKeyForNode(node.childNodes[ii]); if (childOffsetKey) { return childOffsetKey; } } } return null; } module.exports = getSelectionOffsetKeyForNode; /***/ }), /* 51 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getTextContentFromFiles * */ 'use strict'; var invariant = __webpack_require__(2); var TEXT_CLIPPING_REGEX = /\.textClipping$/; var TEXT_TYPES = { 'text/plain': true, 'text/html': true, 'text/rtf': true }; // Somewhat arbitrary upper bound on text size. Let's not lock up the browser. var TEXT_SIZE_UPPER_BOUND = 5000; /** * Extract the text content from a file list. */ function getTextContentFromFiles(files, callback) { var readCount = 0; var results = []; files.forEach(function ( /*blob*/file) { readFile(file, function ( /*string*/text) { readCount++; text && results.push(text.slice(0, TEXT_SIZE_UPPER_BOUND)); if (readCount == files.length) { callback(results.join('\r')); } }); }); } /** * todo isaac: Do work to turn html/rtf into a content fragment. */ function readFile(file, callback) { if (!global.FileReader || file.type && !(file.type in TEXT_TYPES)) { callback(''); return; } if (file.type === '') { var contents = ''; // Special-case text clippings, which have an empty type but include // `.textClipping` in the file name. `readAsText` results in an empty // string for text clippings, so we force the file name to serve // as the text value for the file. if (TEXT_CLIPPING_REGEX.test(file.name)) { contents = file.name.replace(TEXT_CLIPPING_REGEX, ''); } callback(contents); return; } var reader = new FileReader(); reader.onload = function () { var result = reader.result; !(typeof result === 'string') ? true ? invariant(false, 'We should be calling "FileReader.readAsText" which returns a string') : invariant(false) : void 0; callback(result); }; reader.onerror = function () { callback(''); }; reader.readAsText(file); } module.exports = getTextContentFromFiles; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), /* 52 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getUpdatedSelectionState * */ 'use strict'; var DraftOffsetKey = __webpack_require__(19); var nullthrows = __webpack_require__(5); function getUpdatedSelectionState(editorState, anchorKey, anchorOffset, focusKey, focusOffset) { var selection = nullthrows(editorState.getSelection()); if (true) { if (!anchorKey || !focusKey) { /*eslint-disable no-console */ console.warn('Invalid selection state.', arguments, editorState.toJS()); /*eslint-enable no-console */ return selection; } } var anchorPath = DraftOffsetKey.decode(anchorKey); var anchorBlockKey = anchorPath.blockKey; var anchorLeaf = editorState.getBlockTree(anchorBlockKey).getIn([anchorPath.decoratorKey, 'leaves', anchorPath.leafKey]); var focusPath = DraftOffsetKey.decode(focusKey); var focusBlockKey = focusPath.blockKey; var focusLeaf = editorState.getBlockTree(focusBlockKey).getIn([focusPath.decoratorKey, 'leaves', focusPath.leafKey]); var anchorLeafStart = anchorLeaf.get('start'); var focusLeafStart = focusLeaf.get('start'); var anchorBlockOffset = anchorLeaf ? anchorLeafStart + anchorOffset : null; var focusBlockOffset = focusLeaf ? focusLeafStart + focusOffset : null; var areEqual = selection.getAnchorKey() === anchorBlockKey && selection.getAnchorOffset() === anchorBlockOffset && selection.getFocusKey() === focusBlockKey && selection.getFocusOffset() === focusBlockOffset; if (areEqual) { return selection; } var isBackward = false; if (anchorBlockKey === focusBlockKey) { var anchorLeafEnd = anchorLeaf.get('end'); var focusLeafEnd = focusLeaf.get('end'); if (focusLeafStart === anchorLeafStart && focusLeafEnd === anchorLeafEnd) { isBackward = focusOffset < anchorOffset; } else { isBackward = focusLeafStart < anchorLeafStart; } } else { var startKey = editorState.getCurrentContent().getBlockMap().keySeq().skipUntil(function (v) { return v === anchorBlockKey || v === focusBlockKey; }).first(); isBackward = startKey === focusBlockKey; } return selection.merge({ anchorKey: anchorBlockKey, anchorOffset: anchorBlockOffset, focusKey: focusBlockKey, focusOffset: focusBlockOffset, isBackward: isBackward }); } module.exports = getUpdatedSelectionState; /***/ }), /* 53 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule insertIntoList * */ 'use strict'; /** * Maintain persistence for target list when appending and prepending. */ function insertIntoList(targetList, toInsert, offset) { if (offset === targetList.count()) { toInsert.forEach(function (c) { targetList = targetList.push(c); }); } else if (offset === 0) { toInsert.reverse().forEach(function (c) { targetList = targetList.unshift(c); }); } else { var head = targetList.slice(0, offset); var tail = targetList.slice(offset); targetList = head.concat(toInsert, tail).toList(); } return targetList; } module.exports = insertIntoList; /***/ }), /* 54 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule isSelectionAtLeafStart * @typechecks * */ 'use strict'; function isSelectionAtLeafStart(editorState) { var selection = editorState.getSelection(); var anchorKey = selection.getAnchorKey(); var blockTree = editorState.getBlockTree(anchorKey); var offset = selection.getStartOffset(); var isAtStart = false; blockTree.some(function (leafSet) { if (offset === leafSet.get('start')) { isAtStart = true; return true; } if (offset < leafSet.get('end')) { return leafSet.get('leaves').some(function (leaf) { var leafStart = leaf.get('start'); if (offset === leafStart) { isAtStart = true; return true; } return false; }); } return false; }); return isAtStart; } module.exports = isSelectionAtLeafStart; /***/ }), /* 55 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule moveSelectionForward * */ 'use strict'; /** * Given a collapsed selection, move the focus `maxDistance` forward within * the selected block. If the selection will go beyond the end of the block, * move focus to the start of the next block, but no further. * * This function is not Unicode-aware, so surrogate pairs will be treated * as having length 2. */ function moveSelectionForward(editorState, maxDistance) { var selection = editorState.getSelection(); var key = selection.getStartKey(); var offset = selection.getStartOffset(); var content = editorState.getCurrentContent(); var focusKey = key; var focusOffset; var block = content.getBlockForKey(key); if (maxDistance > block.getText().length - offset) { focusKey = content.getKeyAfter(key); focusOffset = 0; } else { focusOffset = offset + maxDistance; } return selection.merge({ focusKey: focusKey, focusOffset: focusOffset }); } module.exports = moveSelectionForward; /***/ }), /* 56 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule removeEntitiesAtEdges * */ 'use strict'; var CharacterMetadata = __webpack_require__(6); var findRangesImmutable = __webpack_require__(20); var invariant = __webpack_require__(2); function removeEntitiesAtEdges(contentState, selectionState) { var blockMap = contentState.getBlockMap(); var entityMap = contentState.getEntityMap(); var updatedBlocks = {}; var startKey = selectionState.getStartKey(); var startOffset = selectionState.getStartOffset(); var startBlock = blockMap.get(startKey); var updatedStart = removeForBlock(entityMap, startBlock, startOffset); if (updatedStart !== startBlock) { updatedBlocks[startKey] = updatedStart; } var endKey = selectionState.getEndKey(); var endOffset = selectionState.getEndOffset(); var endBlock = blockMap.get(endKey); if (startKey === endKey) { endBlock = updatedStart; } var updatedEnd = removeForBlock(entityMap, endBlock, endOffset); if (updatedEnd !== endBlock) { updatedBlocks[endKey] = updatedEnd; } if (!Object.keys(updatedBlocks).length) { return contentState.set('selectionAfter', selectionState); } return contentState.merge({ blockMap: blockMap.merge(updatedBlocks), selectionAfter: selectionState }); } function getRemovalRange(characters, key, offset) { var removalRange; findRangesImmutable(characters, function (a, b) { return a.getEntity() === b.getEntity(); }, function (element) { return element.getEntity() === key; }, function (start, end) { if (start <= offset && end >= offset) { removalRange = { start: start, end: end }; } }); !(typeof removalRange === 'object') ? true ? invariant(false, 'Removal range must exist within character list.') : invariant(false) : void 0; return removalRange; } function removeForBlock(entityMap, block, offset) { var chars = block.getCharacterList(); var charBefore = offset > 0 ? chars.get(offset - 1) : undefined; var charAfter = offset < chars.count() ? chars.get(offset) : undefined; var entityBeforeCursor = charBefore ? charBefore.getEntity() : undefined; var entityAfterCursor = charAfter ? charAfter.getEntity() : undefined; if (entityAfterCursor && entityAfterCursor === entityBeforeCursor) { var entity = entityMap.__get(entityAfterCursor); if (entity.getMutability() !== 'MUTABLE') { var _getRemovalRange = getRemovalRange(chars, entityAfterCursor, offset), start = _getRemovalRange.start, end = _getRemovalRange.end; var current; while (start < end) { current = chars.get(start); chars = chars.set(start, CharacterMetadata.applyEntity(current, null)); start++; } return block.set('characterList', chars); } } return block; } module.exports = removeEntitiesAtEdges; /***/ }), /* 57 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ var PhotosMimeType = __webpack_require__(124); var createArrayFromMixed = __webpack_require__(131); var emptyFunction = __webpack_require__(34); var CR_LF_REGEX = new RegExp('\r\n', 'g'); var LF_ONLY = '\n'; var RICH_TEXT_TYPES = { 'text/rtf': 1, 'text/html': 1 }; /** * If DataTransferItem is a file then return the Blob of data. * * @param {object} item * @return {?blob} */ function getFileFromDataTransfer(item) { if (item.kind == 'file') { return item.getAsFile(); } } var DataTransfer = function () { /** * @param {object} data */ function DataTransfer(data) { _classCallCheck(this, DataTransfer); this.data = data; // Types could be DOMStringList or array this.types = data.types ? createArrayFromMixed(data.types) : []; } /** * Is this likely to be a rich text data transfer? * * @return {boolean} */ DataTransfer.prototype.isRichText = function isRichText() { // If HTML is available, treat this data as rich text. This way, we avoid // using a pasted image if it is packaged with HTML -- this may occur with // pastes from MS Word, for example. However this is only rich text if // there's accompanying text. if (this.getHTML() && this.getText()) { return true; } // When an image is copied from a preview window, you end up with two // DataTransferItems one of which is a file's metadata as text. Skip those. if (this.isImage()) { return false; } return this.types.some(function (type) { return RICH_TEXT_TYPES[type]; }); }; /** * Get raw text. * * @return {?string} */ DataTransfer.prototype.getText = function getText() { var text; if (this.data.getData) { if (!this.types.length) { text = this.data.getData('Text'); } else if (this.types.indexOf('text/plain') != -1) { text = this.data.getData('text/plain'); } } return text ? text.replace(CR_LF_REGEX, LF_ONLY) : null; }; /** * Get HTML paste data * * @return {?string} */ DataTransfer.prototype.getHTML = function getHTML() { if (this.data.getData) { if (!this.types.length) { return this.data.getData('Text'); } else if (this.types.indexOf('text/html') != -1) { return this.data.getData('text/html'); } } }; /** * Is this a link data transfer? * * @return {boolean} */ DataTransfer.prototype.isLink = function isLink() { return this.types.some(function (type) { return type.indexOf('Url') != -1 || type.indexOf('text/uri-list') != -1 || type.indexOf('text/x-moz-url'); }); }; /** * Get a link url. * * @return {?string} */ DataTransfer.prototype.getLink = function getLink() { if (this.data.getData) { if (this.types.indexOf('text/x-moz-url') != -1) { var url = this.data.getData('text/x-moz-url').split('\n'); return url[0]; } return this.types.indexOf('text/uri-list') != -1 ? this.data.getData('text/uri-list') : this.data.getData('url'); } return null; }; /** * Is this an image data transfer? * * @return {boolean} */ DataTransfer.prototype.isImage = function isImage() { var isImage = this.types.some(function (type) { // Firefox will have a type of application/x-moz-file for images during // dragging return type.indexOf('application/x-moz-file') != -1; }); if (isImage) { return true; } var items = this.getFiles(); for (var i = 0; i < items.length; i++) { var type = items[i].type; if (!PhotosMimeType.isImage(type)) { return false; } } return true; }; DataTransfer.prototype.getCount = function getCount() { if (this.data.hasOwnProperty('items')) { return this.data.items.length; } else if (this.data.hasOwnProperty('mozItemCount')) { return this.data.mozItemCount; } else if (this.data.files) { return this.data.files.length; } return null; }; /** * Get files. * * @return {array} */ DataTransfer.prototype.getFiles = function getFiles() { if (this.data.items) { // createArrayFromMixed doesn't properly handle DataTransferItemLists. return Array.prototype.slice.call(this.data.items).map(getFileFromDataTransfer).filter(emptyFunction.thatReturnsArgument); } else if (this.data.files) { return Array.prototype.slice.call(this.data.files); } else { return []; } }; /** * Are there any files to fetch? * * @return {boolean} */ DataTransfer.prototype.hasFiles = function hasFiles() { return this.getFiles().length > 0; }; return DataTransfer; }(); module.exports = DataTransfer; /***/ }), /* 58 */ /***/ (function(module, exports) { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ /** * @param {DOMElement} element * @param {DOMDocument} doc * @return {boolean} */ function _isViewportScrollElement(element, doc) { return !!doc && (element === doc.documentElement || element === doc.body); } /** * Scroll Module. This class contains 4 simple static functions * to be used to access Element.scrollTop/scrollLeft properties. * To solve the inconsistencies between browsers when either * document.body or document.documentElement is supplied, * below logic will be used to alleviate the issue: * * 1. If 'element' is either 'document.body' or 'document.documentElement, * get whichever element's 'scroll{Top,Left}' is larger. * 2. If 'element' is either 'document.body' or 'document.documentElement', * set the 'scroll{Top,Left}' on both elements. */ var Scroll = { /** * @param {DOMElement} element * @return {number} */ getTop: function getTop(element) { var doc = element.ownerDocument; return _isViewportScrollElement(element, doc) ? // In practice, they will either both have the same value, // or one will be zero and the other will be the scroll position // of the viewport. So we can use `X || Y` instead of `Math.max(X, Y)` doc.body.scrollTop || doc.documentElement.scrollTop : element.scrollTop; }, /** * @param {DOMElement} element * @param {number} newTop */ setTop: function setTop(element, newTop) { var doc = element.ownerDocument; if (_isViewportScrollElement(element, doc)) { doc.body.scrollTop = doc.documentElement.scrollTop = newTop; } else { element.scrollTop = newTop; } }, /** * @param {DOMElement} element * @return {number} */ getLeft: function getLeft(element) { var doc = element.ownerDocument; return _isViewportScrollElement(element, doc) ? doc.body.scrollLeft || doc.documentElement.scrollLeft : element.scrollLeft; }, /** * @param {DOMElement} element * @param {number} newLeft */ setLeft: function setLeft(element, newLeft) { var doc = element.ownerDocument; if (_isViewportScrollElement(element, doc)) { doc.body.scrollLeft = doc.documentElement.scrollLeft = newLeft; } else { element.scrollLeft = newLeft; } } }; module.exports = Scroll; /***/ }), /* 59 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks * */ /** * Basic (stateless) API for text direction detection * * Part of our implementation of Unicode Bidirectional Algorithm (UBA) * Unicode Standard Annex #9 (UAX9) * http://www.unicode.org/reports/tr9/ */ 'use strict'; var UnicodeBidiDirection = __webpack_require__(32); var invariant = __webpack_require__(2); /** * RegExp ranges of characters with a *Strong* Bidi_Class value. * * Data is based on DerivedBidiClass.txt in UCD version 7.0.0. * * NOTE: For performance reasons, we only support Unicode's * Basic Multilingual Plane (BMP) for now. */ var RANGE_BY_BIDI_TYPE = { L: 'A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u01BA\u01BB' + '\u01BC-\u01BF\u01C0-\u01C3\u01C4-\u0293\u0294\u0295-\u02AF\u02B0-\u02B8' + '\u02BB-\u02C1\u02D0-\u02D1\u02E0-\u02E4\u02EE\u0370-\u0373\u0376-\u0377' + '\u037A\u037B-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1' + '\u03A3-\u03F5\u03F7-\u0481\u0482\u048A-\u052F\u0531-\u0556\u0559' + '\u055A-\u055F\u0561-\u0587\u0589\u0903\u0904-\u0939\u093B\u093D' + '\u093E-\u0940\u0949-\u094C\u094E-\u094F\u0950\u0958-\u0961\u0964-\u0965' + '\u0966-\u096F\u0970\u0971\u0972-\u0980\u0982-\u0983\u0985-\u098C' + '\u098F-\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD' + '\u09BE-\u09C0\u09C7-\u09C8\u09CB-\u09CC\u09CE\u09D7\u09DC-\u09DD' + '\u09DF-\u09E1\u09E6-\u09EF\u09F0-\u09F1\u09F4-\u09F9\u09FA\u0A03' + '\u0A05-\u0A0A\u0A0F-\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32-\u0A33' + '\u0A35-\u0A36\u0A38-\u0A39\u0A3E-\u0A40\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F' + '\u0A72-\u0A74\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0' + '\u0AB2-\u0AB3\u0AB5-\u0AB9\u0ABD\u0ABE-\u0AC0\u0AC9\u0ACB-\u0ACC\u0AD0' + '\u0AE0-\u0AE1\u0AE6-\u0AEF\u0AF0\u0B02-\u0B03\u0B05-\u0B0C\u0B0F-\u0B10' + '\u0B13-\u0B28\u0B2A-\u0B30\u0B32-\u0B33\u0B35-\u0B39\u0B3D\u0B3E\u0B40' + '\u0B47-\u0B48\u0B4B-\u0B4C\u0B57\u0B5C-\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F' + '\u0B70\u0B71\u0B72-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95' + '\u0B99-\u0B9A\u0B9C\u0B9E-\u0B9F\u0BA3-\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9' + '\u0BBE-\u0BBF\u0BC1-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD0\u0BD7' + '\u0BE6-\u0BEF\u0BF0-\u0BF2\u0C01-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10' + '\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C41-\u0C44\u0C58-\u0C59\u0C60-\u0C61' + '\u0C66-\u0C6F\u0C7F\u0C82-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8' + '\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CBE\u0CBF\u0CC0-\u0CC4\u0CC6' + '\u0CC7-\u0CC8\u0CCA-\u0CCB\u0CD5-\u0CD6\u0CDE\u0CE0-\u0CE1\u0CE6-\u0CEF' + '\u0CF1-\u0CF2\u0D02-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D' + '\u0D3E-\u0D40\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D57\u0D60-\u0D61' + '\u0D66-\u0D6F\u0D70-\u0D75\u0D79\u0D7A-\u0D7F\u0D82-\u0D83\u0D85-\u0D96' + '\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD1\u0DD8-\u0DDF' + '\u0DE6-\u0DEF\u0DF2-\u0DF3\u0DF4\u0E01-\u0E30\u0E32-\u0E33\u0E40-\u0E45' + '\u0E46\u0E4F\u0E50-\u0E59\u0E5A-\u0E5B\u0E81-\u0E82\u0E84\u0E87-\u0E88' + '\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7' + '\u0EAA-\u0EAB\u0EAD-\u0EB0\u0EB2-\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6' + '\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F01-\u0F03\u0F04-\u0F12\u0F13\u0F14' + '\u0F15-\u0F17\u0F1A-\u0F1F\u0F20-\u0F29\u0F2A-\u0F33\u0F34\u0F36\u0F38' + '\u0F3E-\u0F3F\u0F40-\u0F47\u0F49-\u0F6C\u0F7F\u0F85\u0F88-\u0F8C' + '\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE-\u0FCF\u0FD0-\u0FD4\u0FD5-\u0FD8' + '\u0FD9-\u0FDA\u1000-\u102A\u102B-\u102C\u1031\u1038\u103B-\u103C\u103F' + '\u1040-\u1049\u104A-\u104F\u1050-\u1055\u1056-\u1057\u105A-\u105D\u1061' + '\u1062-\u1064\u1065-\u1066\u1067-\u106D\u106E-\u1070\u1075-\u1081' + '\u1083-\u1084\u1087-\u108C\u108E\u108F\u1090-\u1099\u109A-\u109C' + '\u109E-\u109F\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FB\u10FC' + '\u10FD-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288' + '\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5' + '\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1360-\u1368' + '\u1369-\u137C\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166D-\u166E' + '\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EB-\u16ED\u16EE-\u16F0' + '\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1735-\u1736' + '\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17B6\u17BE-\u17C5' + '\u17C7-\u17C8\u17D4-\u17D6\u17D7\u17D8-\u17DA\u17DC\u17E0-\u17E9' + '\u1810-\u1819\u1820-\u1842\u1843\u1844-\u1877\u1880-\u18A8\u18AA' + '\u18B0-\u18F5\u1900-\u191E\u1923-\u1926\u1929-\u192B\u1930-\u1931' + '\u1933-\u1938\u1946-\u194F\u1950-\u196D\u1970-\u1974\u1980-\u19AB' + '\u19B0-\u19C0\u19C1-\u19C7\u19C8-\u19C9\u19D0-\u19D9\u19DA\u1A00-\u1A16' + '\u1A19-\u1A1A\u1A1E-\u1A1F\u1A20-\u1A54\u1A55\u1A57\u1A61\u1A63-\u1A64' + '\u1A6D-\u1A72\u1A80-\u1A89\u1A90-\u1A99\u1AA0-\u1AA6\u1AA7\u1AA8-\u1AAD' + '\u1B04\u1B05-\u1B33\u1B35\u1B3B\u1B3D-\u1B41\u1B43-\u1B44\u1B45-\u1B4B' + '\u1B50-\u1B59\u1B5A-\u1B60\u1B61-\u1B6A\u1B74-\u1B7C\u1B82\u1B83-\u1BA0' + '\u1BA1\u1BA6-\u1BA7\u1BAA\u1BAE-\u1BAF\u1BB0-\u1BB9\u1BBA-\u1BE5\u1BE7' + '\u1BEA-\u1BEC\u1BEE\u1BF2-\u1BF3\u1BFC-\u1BFF\u1C00-\u1C23\u1C24-\u1C2B' + '\u1C34-\u1C35\u1C3B-\u1C3F\u1C40-\u1C49\u1C4D-\u1C4F\u1C50-\u1C59' + '\u1C5A-\u1C77\u1C78-\u1C7D\u1C7E-\u1C7F\u1CC0-\u1CC7\u1CD3\u1CE1' + '\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF2-\u1CF3\u1CF5-\u1CF6\u1D00-\u1D2B' + '\u1D2C-\u1D6A\u1D6B-\u1D77\u1D78\u1D79-\u1D9A\u1D9B-\u1DBF\u1E00-\u1F15' + '\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D' + '\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC' + '\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200E' + '\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D' + '\u2124\u2126\u2128\u212A-\u212D\u212F-\u2134\u2135-\u2138\u2139' + '\u213C-\u213F\u2145-\u2149\u214E\u214F\u2160-\u2182\u2183-\u2184' + '\u2185-\u2188\u2336-\u237A\u2395\u249C-\u24E9\u26AC\u2800-\u28FF' + '\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2C7B\u2C7C-\u2C7D\u2C7E-\u2CE4' + '\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F' + '\u2D70\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE' + '\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005\u3006\u3007' + '\u3021-\u3029\u302E-\u302F\u3031-\u3035\u3038-\u303A\u303B\u303C' + '\u3041-\u3096\u309D-\u309E\u309F\u30A1-\u30FA\u30FC-\u30FE\u30FF' + '\u3105-\u312D\u3131-\u318E\u3190-\u3191\u3192-\u3195\u3196-\u319F' + '\u31A0-\u31BA\u31F0-\u31FF\u3200-\u321C\u3220-\u3229\u322A-\u3247' + '\u3248-\u324F\u3260-\u327B\u327F\u3280-\u3289\u328A-\u32B0\u32C0-\u32CB' + '\u32D0-\u32FE\u3300-\u3376\u337B-\u33DD\u33E0-\u33FE\u3400-\u4DB5' + '\u4E00-\u9FCC\uA000-\uA014\uA015\uA016-\uA48C\uA4D0-\uA4F7\uA4F8-\uA4FD' + '\uA4FE-\uA4FF\uA500-\uA60B\uA60C\uA610-\uA61F\uA620-\uA629\uA62A-\uA62B' + '\uA640-\uA66D\uA66E\uA680-\uA69B\uA69C-\uA69D\uA6A0-\uA6E5\uA6E6-\uA6EF' + '\uA6F2-\uA6F7\uA722-\uA76F\uA770\uA771-\uA787\uA789-\uA78A\uA78B-\uA78E' + '\uA790-\uA7AD\uA7B0-\uA7B1\uA7F7\uA7F8-\uA7F9\uA7FA\uA7FB-\uA801' + '\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA823-\uA824\uA827\uA830-\uA835' + '\uA836-\uA837\uA840-\uA873\uA880-\uA881\uA882-\uA8B3\uA8B4-\uA8C3' + '\uA8CE-\uA8CF\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8F8-\uA8FA\uA8FB\uA900-\uA909' + '\uA90A-\uA925\uA92E-\uA92F\uA930-\uA946\uA952-\uA953\uA95F\uA960-\uA97C' + '\uA983\uA984-\uA9B2\uA9B4-\uA9B5\uA9BA-\uA9BB\uA9BD-\uA9C0\uA9C1-\uA9CD' + '\uA9CF\uA9D0-\uA9D9\uA9DE-\uA9DF\uA9E0-\uA9E4\uA9E6\uA9E7-\uA9EF' + '\uA9F0-\uA9F9\uA9FA-\uA9FE\uAA00-\uAA28\uAA2F-\uAA30\uAA33-\uAA34' + '\uAA40-\uAA42\uAA44-\uAA4B\uAA4D\uAA50-\uAA59\uAA5C-\uAA5F\uAA60-\uAA6F' + '\uAA70\uAA71-\uAA76\uAA77-\uAA79\uAA7A\uAA7B\uAA7D\uAA7E-\uAAAF\uAAB1' + '\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADC\uAADD\uAADE-\uAADF' + '\uAAE0-\uAAEA\uAAEB\uAAEE-\uAAEF\uAAF0-\uAAF1\uAAF2\uAAF3-\uAAF4\uAAF5' + '\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E' + '\uAB30-\uAB5A\uAB5B\uAB5C-\uAB5F\uAB64-\uAB65\uABC0-\uABE2\uABE3-\uABE4' + '\uABE6-\uABE7\uABE9-\uABEA\uABEB\uABEC\uABF0-\uABF9\uAC00-\uD7A3' + '\uD7B0-\uD7C6\uD7CB-\uD7FB\uE000-\uF8FF\uF900-\uFA6D\uFA70-\uFAD9' + '\uFB00-\uFB06\uFB13-\uFB17\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFF6F\uFF70' + '\uFF71-\uFF9D\uFF9E-\uFF9F\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF' + '\uFFD2-\uFFD7\uFFDA-\uFFDC', R: '\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05D0-\u05EA\u05EB-\u05EF' + '\u05F0-\u05F2\u05F3-\u05F4\u05F5-\u05FF\u07C0-\u07C9\u07CA-\u07EA' + '\u07F4-\u07F5\u07FA\u07FB-\u07FF\u0800-\u0815\u081A\u0824\u0828' + '\u082E-\u082F\u0830-\u083E\u083F\u0840-\u0858\u085C-\u085D\u085E' + '\u085F-\u089F\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB37\uFB38-\uFB3C' + '\uFB3D\uFB3E\uFB3F\uFB40-\uFB41\uFB42\uFB43-\uFB44\uFB45\uFB46-\uFB4F', AL: '\u0608\u060B\u060D\u061B\u061C\u061D\u061E-\u061F\u0620-\u063F\u0640' + '\u0641-\u064A\u066D\u066E-\u066F\u0671-\u06D3\u06D4\u06D5\u06E5-\u06E6' + '\u06EE-\u06EF\u06FA-\u06FC\u06FD-\u06FE\u06FF\u0700-\u070D\u070E\u070F' + '\u0710\u0712-\u072F\u074B-\u074C\u074D-\u07A5\u07B1\u07B2-\u07BF' + '\u08A0-\u08B2\u08B3-\u08E3\uFB50-\uFBB1\uFBB2-\uFBC1\uFBC2-\uFBD2' + '\uFBD3-\uFD3D\uFD40-\uFD4F\uFD50-\uFD8F\uFD90-\uFD91\uFD92-\uFDC7' + '\uFDC8-\uFDCF\uFDF0-\uFDFB\uFDFC\uFDFE-\uFDFF\uFE70-\uFE74\uFE75' + '\uFE76-\uFEFC\uFEFD-\uFEFE' }; var REGEX_STRONG = new RegExp('[' + RANGE_BY_BIDI_TYPE.L + RANGE_BY_BIDI_TYPE.R + RANGE_BY_BIDI_TYPE.AL + ']'); var REGEX_RTL = new RegExp('[' + RANGE_BY_BIDI_TYPE.R + RANGE_BY_BIDI_TYPE.AL + ']'); /** * Returns the first strong character (has Bidi_Class value of L, R, or AL). * * @param str A text block; e.g. paragraph, table cell, tag * @return A character with strong bidi direction, or null if not found */ function firstStrongChar(str) { var match = REGEX_STRONG.exec(str); return match == null ? null : match[0]; } /** * Returns the direction of a block of text, based on the direction of its * first strong character (has Bidi_Class value of L, R, or AL). * * @param str A text block; e.g. paragraph, table cell, tag * @return The resolved direction */ function firstStrongCharDir(str) { var strongChar = firstStrongChar(str); if (strongChar == null) { return UnicodeBidiDirection.NEUTRAL; } return REGEX_RTL.exec(strongChar) ? UnicodeBidiDirection.RTL : UnicodeBidiDirection.LTR; } /** * Returns the direction of a block of text, based on the direction of its * first strong character (has Bidi_Class value of L, R, or AL), or a fallback * direction, if no strong character is found. * * This function is supposed to be used in respect to Higher-Level Protocol * rule HL1. (http://www.unicode.org/reports/tr9/#HL1) * * @param str A text block; e.g. paragraph, table cell, tag * @param fallback Fallback direction, used if no strong direction detected * for the block (default = NEUTRAL) * @return The resolved direction */ function resolveBlockDir(str, fallback) { fallback = fallback || UnicodeBidiDirection.NEUTRAL; if (!str.length) { return fallback; } var blockDir = firstStrongCharDir(str); return blockDir === UnicodeBidiDirection.NEUTRAL ? fallback : blockDir; } /** * Returns the direction of a block of text, based on the direction of its * first strong character (has Bidi_Class value of L, R, or AL), or a fallback * direction, if no strong character is found. * * NOTE: This function is similar to resolveBlockDir(), but uses the global * direction as the fallback, so it *always* returns a Strong direction, * making it useful for integration in places that you need to make the final * decision, like setting some CSS class. * * This function is supposed to be used in respect to Higher-Level Protocol * rule HL1. (http://www.unicode.org/reports/tr9/#HL1) * * @param str A text block; e.g. paragraph, table cell * @param strongFallback Fallback direction, used if no strong direction * detected for the block (default = global direction) * @return The resolved Strong direction */ function getDirection(str, strongFallback) { if (!strongFallback) { strongFallback = UnicodeBidiDirection.getGlobalDir(); } !UnicodeBidiDirection.isStrong(strongFallback) ? true ? invariant(false, 'Fallback direction must be a strong direction') : invariant(false) : void 0; return resolveBlockDir(str, strongFallback); } /** * Returns true if getDirection(arguments...) returns LTR. * * @param str A text block; e.g. paragraph, table cell * @param strongFallback Fallback direction, used if no strong direction * detected for the block (default = global direction) * @return True if the resolved direction is LTR */ function isDirectionLTR(str, strongFallback) { return getDirection(str, strongFallback) === UnicodeBidiDirection.LTR; } /** * Returns true if getDirection(arguments...) returns RTL. * * @param str A text block; e.g. paragraph, table cell * @param strongFallback Fallback direction, used if no strong direction * detected for the block (default = global direction) * @return True if the resolved direction is RTL */ function isDirectionRTL(str, strongFallback) { return getDirection(str, strongFallback) === UnicodeBidiDirection.RTL; } var UnicodeBidi = { firstStrongChar: firstStrongChar, firstStrongCharDir: firstStrongCharDir, resolveBlockDir: resolveBlockDir, getDirection: getDirection, isDirectionLTR: isDirectionLTR, isDirectionRTL: isDirectionRTL }; module.exports = UnicodeBidi; /***/ }), /* 60 */ /***/ (function(module, exports) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ /* eslint-disable fb-www/typeof-undefined */ /** * Same as document.activeElement but wraps in a try-catch block. In IE it is * not safe to call document.activeElement if there is nothing focused. * * The activeElement will be null only if the document or document body is not * yet defined. * * @param {?DOMDocument} doc Defaults to current document. * @return {?DOMElement} */ function getActiveElement(doc) /*?DOMElement*/{ doc = doc || (typeof document !== 'undefined' ? document : undefined); if (typeof doc === 'undefined') { return null; } try { return doc.activeElement || doc.body; } catch (e) { return doc.body; } } module.exports = getActiveElement; /***/ }), /* 61 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule AtomicBlockUtils * @typechecks * */ 'use strict'; var BlockMapBuilder = __webpack_require__(13); var CharacterMetadata = __webpack_require__(6); var ContentBlock = __webpack_require__(9); var DraftModifier = __webpack_require__(4); var EditorState = __webpack_require__(1); var Immutable = __webpack_require__(3); var SelectionState = __webpack_require__(14); var generateRandomKey = __webpack_require__(7); var moveBlockInContentState = __webpack_require__(119); var List = Immutable.List, Repeat = Immutable.Repeat; var AtomicBlockUtils = { insertAtomicBlock: function insertAtomicBlock(editorState, entityKey, character) { var contentState = editorState.getCurrentContent(); var selectionState = editorState.getSelection(); var afterRemoval = DraftModifier.removeRange(contentState, selectionState, 'backward'); var targetSelection = afterRemoval.getSelectionAfter(); var afterSplit = DraftModifier.splitBlock(afterRemoval, targetSelection); var insertionTarget = afterSplit.getSelectionAfter(); var asAtomicBlock = DraftModifier.setBlockType(afterSplit, insertionTarget, 'atomic'); var charData = CharacterMetadata.create({ entity: entityKey }); var fragmentArray = [new ContentBlock({ key: generateRandomKey(), type: 'atomic', text: character, characterList: List(Repeat(charData, character.length)) }), new ContentBlock({ key: generateRandomKey(), type: 'unstyled', text: '', characterList: List() })]; var fragment = BlockMapBuilder.createFromArray(fragmentArray); var withAtomicBlock = DraftModifier.replaceWithFragment(asAtomicBlock, insertionTarget, fragment); var newContent = withAtomicBlock.merge({ selectionBefore: selectionState, selectionAfter: withAtomicBlock.getSelectionAfter().set('hasFocus', true) }); return EditorState.push(editorState, newContent, 'insert-fragment'); }, moveAtomicBlock: function moveAtomicBlock(editorState, atomicBlock, targetRange, insertionMode) { var contentState = editorState.getCurrentContent(); var selectionState = editorState.getSelection(); var withMovedAtomicBlock = void 0; if (insertionMode === 'before' || insertionMode === 'after') { var targetBlock = contentState.getBlockForKey(insertionMode === 'before' ? targetRange.getStartKey() : targetRange.getEndKey()); withMovedAtomicBlock = moveBlockInContentState(contentState, atomicBlock, targetBlock, insertionMode); } else { var afterRemoval = DraftModifier.removeRange(contentState, targetRange, 'backward'); var selectionAfterRemoval = afterRemoval.getSelectionAfter(); var _targetBlock = afterRemoval.getBlockForKey(selectionAfterRemoval.getFocusKey()); if (selectionAfterRemoval.getStartOffset() === 0) { withMovedAtomicBlock = moveBlockInContentState(afterRemoval, atomicBlock, _targetBlock, 'before'); } else if (selectionAfterRemoval.getEndOffset() === _targetBlock.getLength()) { withMovedAtomicBlock = moveBlockInContentState(afterRemoval, atomicBlock, _targetBlock, 'after'); } else { var afterSplit = DraftModifier.splitBlock(afterRemoval, selectionAfterRemoval); var selectionAfterSplit = afterSplit.getSelectionAfter(); var _targetBlock2 = afterSplit.getBlockForKey(selectionAfterSplit.getFocusKey()); withMovedAtomicBlock = moveBlockInContentState(afterSplit, atomicBlock, _targetBlock2, 'before'); } } var newContent = withMovedAtomicBlock.merge({ selectionBefore: selectionState, selectionAfter: withMovedAtomicBlock.getSelectionAfter().set('hasFocus', true) }); return EditorState.push(editorState, newContent, 'move-block'); } }; module.exports = AtomicBlockUtils; /***/ }), /* 62 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule CompositeDraftDecorator * @typechecks * */ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Immutable = __webpack_require__(3); var List = Immutable.List; var DELIMITER = '.'; /** * A CompositeDraftDecorator traverses through a list of DraftDecorator * instances to identify sections of a ContentBlock that should be rendered * in a "decorated" manner. For example, hashtags, mentions, and links may * be intended to stand out visually, be rendered as anchors, etc. * * The list of decorators supplied to the constructor will be used in the * order they are provided. This allows the caller to specify a priority for * string matching, in case of match collisions among decorators. * * For instance, I may have a link with a `#` in its text. Though this section * of text may match our hashtag decorator, it should not be treated as a * hashtag. I should therefore list my link DraftDecorator * before my hashtag DraftDecorator when constructing this composite * decorator instance. * * Thus, when a collision like this is encountered, the earlier match is * preserved and the new match is discarded. */ var CompositeDraftDecorator = function () { function CompositeDraftDecorator(decorators) { _classCallCheck(this, CompositeDraftDecorator); // Copy the decorator array, since we use this array order to determine // precedence of decoration matching. If the array is mutated externally, // we don't want to be affected here. this._decorators = decorators.slice(); } CompositeDraftDecorator.prototype.getDecorations = function getDecorations(block, contentState) { var decorations = Array(block.getText().length).fill(null); this._decorators.forEach(function ( /*object*/decorator, /*number*/ii) { var counter = 0; var strategy = decorator.strategy; var callback = function callback( /*number*/start, /*number*/end) { // Find out if any of our matching range is already occupied // by another decorator. If so, discard the match. Otherwise, store // the component key for rendering. if (canOccupySlice(decorations, start, end)) { occupySlice(decorations, start, end, ii + DELIMITER + counter); counter++; } }; strategy(block, callback, contentState); }); return List(decorations); }; CompositeDraftDecorator.prototype.getComponentForKey = function getComponentForKey(key) { var componentKey = parseInt(key.split(DELIMITER)[0], 10); return this._decorators[componentKey].component; }; CompositeDraftDecorator.prototype.getPropsForKey = function getPropsForKey(key) { var componentKey = parseInt(key.split(DELIMITER)[0], 10); return this._decorators[componentKey].props; }; return CompositeDraftDecorator; }(); /** * Determine whether we can occupy the specified slice of the decorations * array. */ function canOccupySlice(decorations, start, end) { for (var ii = start; ii < end; ii++) { if (decorations[ii] != null) { return false; } } return true; } /** * Splice the specified component into our decoration array at the desired * range. */ function occupySlice(targetArr, start, end, componentKey) { for (var ii = start; ii < end; ii++) { targetArr[ii] = componentKey; } } module.exports = CompositeDraftDecorator; /***/ }), /* 63 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule ContentStateInlineStyle * @typechecks * */ 'use strict'; var CharacterMetadata = __webpack_require__(6); var _require = __webpack_require__(3), Map = _require.Map; var ContentStateInlineStyle = { add: function add(contentState, selectionState, inlineStyle) { return modifyInlineStyle(contentState, selectionState, inlineStyle, true); }, remove: function remove(contentState, selectionState, inlineStyle) { return modifyInlineStyle(contentState, selectionState, inlineStyle, false); } }; function modifyInlineStyle(contentState, selectionState, inlineStyle, addOrRemove) { var blockMap = contentState.getBlockMap(); var startKey = selectionState.getStartKey(); var startOffset = selectionState.getStartOffset(); var endKey = selectionState.getEndKey(); var endOffset = selectionState.getEndOffset(); var newBlocks = blockMap.skipUntil(function (_, k) { return k === startKey; }).takeUntil(function (_, k) { return k === endKey; }).concat(Map([[endKey, blockMap.get(endKey)]])).map(function (block, blockKey) { var sliceStart; var sliceEnd; if (startKey === endKey) { sliceStart = startOffset; sliceEnd = endOffset; } else { sliceStart = blockKey === startKey ? startOffset : 0; sliceEnd = blockKey === endKey ? endOffset : block.getLength(); } var chars = block.getCharacterList(); var current; while (sliceStart < sliceEnd) { current = chars.get(sliceStart); chars = chars.set(sliceStart, addOrRemove ? CharacterMetadata.applyStyle(current, inlineStyle) : CharacterMetadata.removeStyle(current, inlineStyle)); sliceStart++; } return block.set('characterList', chars); }); return contentState.merge({ blockMap: blockMap.merge(newBlocks), selectionBefore: selectionState, selectionAfter: selectionState }); } module.exports = ContentStateInlineStyle; /***/ }), /* 64 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftEditor.react * @typechecks * * @preventMunge */ 'use strict'; var _assign = __webpack_require__(11); var _extends = _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; }; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var DefaultDraftBlockRenderMap = __webpack_require__(24); var DefaultDraftInlineStyle = __webpack_require__(37); var DraftEditorCompositionHandler = __webpack_require__(65); var DraftEditorContents = __webpack_require__(66); var DraftEditorDragHandler = __webpack_require__(67); var DraftEditorEditHandler = __webpack_require__(68); var DraftEditorPlaceholder = __webpack_require__(70); var EditorState = __webpack_require__(1); var React = __webpack_require__(12); var ReactDOM = __webpack_require__(17); var Scroll = __webpack_require__(58); var Style = __webpack_require__(31); var UserAgent = __webpack_require__(8); var cx = __webpack_require__(16); var emptyFunction = __webpack_require__(34); var generateRandomKey = __webpack_require__(7); var getDefaultKeyBinding = __webpack_require__(45); var getScrollPosition = __webpack_require__(35); var invariant = __webpack_require__(2); var nullthrows = __webpack_require__(5); var isIE = UserAgent.isBrowser('IE'); // IE does not support the `input` event on contentEditable, so we can't // observe spellcheck behavior. var allowSpellCheck = !isIE; // Define a set of handler objects to correspond to each possible `mode` // of editor behavior. var handlerMap = { 'edit': DraftEditorEditHandler, 'composite': DraftEditorCompositionHandler, 'drag': DraftEditorDragHandler, 'cut': null, 'render': null }; /** * `DraftEditor` is the root editor component. It composes a `contentEditable` * div, and provides a wide variety of useful function props for managing the * state of the editor. See `DraftEditorProps` for details. */ var DraftEditor = function (_React$Component) { _inherits(DraftEditor, _React$Component); function DraftEditor(props) { _classCallCheck(this, DraftEditor); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _this._blockSelectEvents = false; _this._clipboard = null; _this._handler = null; _this._dragCount = 0; _this._editorKey = props.editorKey || generateRandomKey(); _this._placeholderAccessibilityID = 'placeholder-' + _this._editorKey; _this._latestEditorState = props.editorState; _this._latestCommittedEditorState = props.editorState; _this._onBeforeInput = _this._buildHandler('onBeforeInput'); _this._onBlur = _this._buildHandler('onBlur'); _this._onCharacterData = _this._buildHandler('onCharacterData'); _this._onCompositionEnd = _this._buildHandler('onCompositionEnd'); _this._onCompositionStart = _this._buildHandler('onCompositionStart'); _this._onCopy = _this._buildHandler('onCopy'); _this._onCut = _this._buildHandler('onCut'); _this._onDragEnd = _this._buildHandler('onDragEnd'); _this._onDragOver = _this._buildHandler('onDragOver'); _this._onDragStart = _this._buildHandler('onDragStart'); _this._onDrop = _this._buildHandler('onDrop'); _this._onInput = _this._buildHandler('onInput'); _this._onFocus = _this._buildHandler('onFocus'); _this._onKeyDown = _this._buildHandler('onKeyDown'); _this._onKeyPress = _this._buildHandler('onKeyPress'); _this._onKeyUp = _this._buildHandler('onKeyUp'); _this._onMouseDown = _this._buildHandler('onMouseDown'); _this._onMouseUp = _this._buildHandler('onMouseUp'); _this._onPaste = _this._buildHandler('onPaste'); _this._onSelect = _this._buildHandler('onSelect'); // Manual binding for public and internal methods. _this.focus = _this._focus.bind(_this); _this.blur = _this._blur.bind(_this); _this.setMode = _this._setMode.bind(_this); _this.exitCurrentMode = _this._exitCurrentMode.bind(_this); _this.restoreEditorDOM = _this._restoreEditorDOM.bind(_this); _this.setClipboard = _this._setClipboard.bind(_this); _this.getClipboard = _this._getClipboard.bind(_this); _this.getEditorKey = function () { return _this._editorKey; }; _this.update = _this._update.bind(_this); _this.onDragEnter = _this._onDragEnter.bind(_this); _this.onDragLeave = _this._onDragLeave.bind(_this); // See `_restoreEditorDOM()`. _this.state = { contentsKey: 0 }; return _this; } /** * Build a method that will pass the event to the specified handler method. * This allows us to look up the correct handler function for the current * editor mode, if any has been specified. */ /** * Define proxies that can route events to the current handler. */ DraftEditor.prototype._buildHandler = function _buildHandler(eventName) { var _this2 = this; return function (e) { if (!_this2.props.readOnly) { var method = _this2._handler && _this2._handler[eventName]; method && method(_this2, e); } }; }; DraftEditor.prototype._showPlaceholder = function _showPlaceholder() { return !!this.props.placeholder && !this.props.editorState.isInCompositionMode() && !this.props.editorState.getCurrentContent().hasText(); }; DraftEditor.prototype._renderPlaceholder = function _renderPlaceholder() { if (this._showPlaceholder()) { return ( /* $FlowFixMe(>=0.53.0 site=www,mobile) This comment suppresses an * error when upgrading Flow's support for React. Common errors found * when upgrading Flow's React support are documented at * https://fburl.com/eq7bs81w */ React.createElement(DraftEditorPlaceholder, { text: nullthrows(this.props.placeholder), editorState: this.props.editorState, textAlignment: this.props.textAlignment, accessibilityID: this._placeholderAccessibilityID }) ); } return null; }; DraftEditor.prototype.render = function render() { var _props = this.props, readOnly = _props.readOnly, textAlignment = _props.textAlignment; var rootClass = cx({ 'DraftEditor/root': true, 'DraftEditor/alignLeft': textAlignment === 'left', 'DraftEditor/alignRight': textAlignment === 'right', 'DraftEditor/alignCenter': textAlignment === 'center' }); var contentStyle = { outline: 'none', whiteSpace: 'pre-wrap', wordWrap: 'break-word' }; // The aria-expanded and aria-haspopup properties should only be rendered // for a combobox. var ariaRole = this.props.role || 'textbox'; var ariaExpanded = ariaRole === 'combobox' ? !!this.props.ariaExpanded : null; return React.createElement( 'div', { className: rootClass }, this._renderPlaceholder(), React.createElement( 'div', { className: cx('DraftEditor/editorContainer'), ref: 'editorContainer' }, React.createElement( 'div', { 'aria-activedescendant': readOnly ? null : this.props.ariaActiveDescendantID, 'aria-autocomplete': readOnly ? null : this.props.ariaAutoComplete, 'aria-controls': readOnly ? null : this.props.ariaControls, 'aria-describedby': this._showPlaceholder() ? this._placeholderAccessibilityID : null, 'aria-expanded': readOnly ? null : ariaExpanded, 'aria-label': this.props.ariaLabel, 'aria-multiline': this.props.ariaMultiline, autoCapitalize: this.props.autoCapitalize, autoComplete: this.props.autoComplete, autoCorrect: this.props.autoCorrect, className: cx({ // Chrome's built-in translation feature mutates the DOM in ways // that Draft doesn't expect (ex: adding <font> tags inside // DraftEditorLeaf spans) and causes problems. We add notranslate // here which makes its autotranslation skip over this subtree. 'notranslate': !readOnly, 'public/DraftEditor/content': true }), contentEditable: !readOnly, 'data-testid': this.props.webDriverTestID, onBeforeInput: this._onBeforeInput, onBlur: this._onBlur, onCompositionEnd: this._onCompositionEnd, onCompositionStart: this._onCompositionStart, onCopy: this._onCopy, onCut: this._onCut, onDragEnd: this._onDragEnd, onDragEnter: this.onDragEnter, onDragLeave: this.onDragLeave, onDragOver: this._onDragOver, onDragStart: this._onDragStart, onDrop: this._onDrop, onFocus: this._onFocus, onInput: this._onInput, onKeyDown: this._onKeyDown, onKeyPress: this._onKeyPress, onKeyUp: this._onKeyUp, onMouseUp: this._onMouseUp, onPaste: this._onPaste, onSelect: this._onSelect, ref: 'editor', role: readOnly ? null : ariaRole, spellCheck: allowSpellCheck && this.props.spellCheck, style: contentStyle, suppressContentEditableWarning: true, tabIndex: this.props.tabIndex }, React.createElement(DraftEditorContents, { blockRenderMap: this.props.blockRenderMap, blockRendererFn: this.props.blockRendererFn, blockStyleFn: this.props.blockStyleFn, customStyleMap: _extends({}, DefaultDraftInlineStyle, this.props.customStyleMap), customStyleFn: this.props.customStyleFn, editorKey: this._editorKey, editorState: this.props.editorState, key: 'contents' + this.state.contentsKey, textDirectionality: this.props.textDirectionality }) ) ) ); }; DraftEditor.prototype.componentDidMount = function componentDidMount() { this.setMode('edit'); /** * IE has a hardcoded "feature" that attempts to convert link text into * anchors in contentEditable DOM. This breaks the editor's expectations of * the DOM, and control is lost. Disable it to make IE behave. * See: http://blogs.msdn.com/b/ieinternals/archive/2010/09/15/ * ie9-beta-minor-change-list.aspx */ if (isIE) { document.execCommand('AutoUrlDetect', false, false); } }; /** * Prevent selection events from affecting the current editor state. This * is mostly intended to defend against IE, which fires off `selectionchange` * events regardless of whether the selection is set via the browser or * programmatically. We only care about selection events that occur because * of browser interaction, not re-renders and forced selections. */ DraftEditor.prototype.componentWillUpdate = function componentWillUpdate(nextProps) { this._blockSelectEvents = true; this._latestEditorState = nextProps.editorState; }; DraftEditor.prototype.componentDidUpdate = function componentDidUpdate() { this._blockSelectEvents = false; this._latestCommittedEditorState = this.props.editorState; }; /** * Used via `this.focus()`. * * Force focus back onto the editor node. * * We attempt to preserve scroll position when focusing. You can also pass * a specified scroll position (for cases like `cut` behavior where it should * be restored to a known position). */ DraftEditor.prototype._focus = function _focus(scrollPosition) { var editorState = this.props.editorState; var alreadyHasFocus = editorState.getSelection().getHasFocus(); var editorNode = ReactDOM.findDOMNode(this.refs.editor); var scrollParent = Style.getScrollParent(editorNode); var _ref = scrollPosition || getScrollPosition(scrollParent), x = _ref.x, y = _ref.y; !(editorNode instanceof HTMLElement) ? true ? invariant(false, 'editorNode is not an HTMLElement') : invariant(false) : void 0; editorNode.focus(); // Restore scroll position if (scrollParent === window) { window.scrollTo(x, y); } else { Scroll.setTop(scrollParent, y); } // On Chrome and Safari, calling focus on contenteditable focuses the // cursor at the first character. This is something you don't expect when // you're clicking on an input element but not directly on a character. // Put the cursor back where it was before the blur. if (!alreadyHasFocus) { this.update(EditorState.forceSelection(editorState, editorState.getSelection())); } }; DraftEditor.prototype._blur = function _blur() { var editorNode = ReactDOM.findDOMNode(this.refs.editor); !(editorNode instanceof HTMLElement) ? true ? invariant(false, 'editorNode is not an HTMLElement') : invariant(false) : void 0; editorNode.blur(); }; /** * Used via `this.setMode(...)`. * * Set the behavior mode for the editor component. This switches the current * handler module to ensure that DOM events are managed appropriately for * the active mode. */ DraftEditor.prototype._setMode = function _setMode(mode) { this._handler = handlerMap[mode]; }; DraftEditor.prototype._exitCurrentMode = function _exitCurrentMode() { this.setMode('edit'); }; /** * Used via `this.restoreEditorDOM()`. * * Force a complete re-render of the DraftEditorContents based on the current * EditorState. This is useful when we know we are going to lose control of * the DOM state (cut command, IME) and we want to make sure that * reconciliation occurs on a version of the DOM that is synchronized with * our EditorState. */ DraftEditor.prototype._restoreEditorDOM = function _restoreEditorDOM(scrollPosition) { var _this3 = this; this.setState({ contentsKey: this.state.contentsKey + 1 }, function () { _this3._focus(scrollPosition); }); }; /** * Used via `this.setClipboard(...)`. * * Set the clipboard state for a cut/copy event. */ DraftEditor.prototype._setClipboard = function _setClipboard(clipboard) { this._clipboard = clipboard; }; /** * Used via `this.getClipboard()`. * * Retrieve the clipboard state for a cut/copy event. */ DraftEditor.prototype._getClipboard = function _getClipboard() { return this._clipboard; }; /** * Used via `this.update(...)`. * * Propagate a new `EditorState` object to higher-level components. This is * the method by which event handlers inform the `DraftEditor` component of * state changes. A component that composes a `DraftEditor` **must** provide * an `onChange` prop to receive state updates passed along from this * function. */ DraftEditor.prototype._update = function _update(editorState) { this._latestEditorState = editorState; this.props.onChange(editorState); }; /** * Used in conjunction with `_onDragLeave()`, by counting the number of times * a dragged element enters and leaves the editor (or any of its children), * to determine when the dragged element absolutely leaves the editor. */ DraftEditor.prototype._onDragEnter = function _onDragEnter() { this._dragCount++; }; /** * See `_onDragEnter()`. */ DraftEditor.prototype._onDragLeave = function _onDragLeave() { this._dragCount--; if (this._dragCount === 0) { this.exitCurrentMode(); } }; return DraftEditor; }(React.Component); DraftEditor.defaultProps = { blockRenderMap: DefaultDraftBlockRenderMap, blockRendererFn: emptyFunction.thatReturnsNull, blockStyleFn: emptyFunction.thatReturns(''), keyBindingFn: getDefaultKeyBinding, readOnly: false, spellCheck: false, stripPastedStyles: false }; module.exports = DraftEditor; /***/ }), /* 65 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftEditorCompositionHandler * */ 'use strict'; var DraftModifier = __webpack_require__(4); var EditorState = __webpack_require__(1); var Keys = __webpack_require__(30); var getEntityKeyForSelection = __webpack_require__(27); var isSelectionAtLeafStart = __webpack_require__(54); /** * Millisecond delay to allow `compositionstart` to fire again upon * `compositionend`. * * This is used for Korean input to ensure that typing can continue without * the editor trying to render too quickly. More specifically, Safari 7.1+ * triggers `compositionstart` a little slower than Chrome/FF, which * leads to composed characters being resolved and re-render occurring * sooner than we want. */ var RESOLVE_DELAY = 20; /** * A handful of variables used to track the current composition and its * resolution status. These exist at the module level because it is not * possible to have compositions occurring in multiple editors simultaneously, * and it simplifies state management with respect to the DraftEditor component. */ var resolved = false; var stillComposing = false; var textInputData = ''; var DraftEditorCompositionHandler = { onBeforeInput: function onBeforeInput(editor, e) { textInputData = (textInputData || '') + e.data; }, /** * A `compositionstart` event has fired while we're still in composition * mode. Continue the current composition session to prevent a re-render. */ onCompositionStart: function onCompositionStart(editor) { stillComposing = true; }, /** * Attempt to end the current composition session. * * Defer handling because browser will still insert the chars into active * element after `compositionend`. If a `compositionstart` event fires * before `resolveComposition` executes, our composition session will * continue. * * The `resolved` flag is useful because certain IME interfaces fire the * `compositionend` event multiple times, thus queueing up multiple attempts * at handling the composition. Since handling the same composition event * twice could break the DOM, we only use the first event. Example: Arabic * Google Input Tools on Windows 8.1 fires `compositionend` three times. */ onCompositionEnd: function onCompositionEnd(editor) { resolved = false; stillComposing = false; setTimeout(function () { if (!resolved) { DraftEditorCompositionHandler.resolveComposition(editor); } }, RESOLVE_DELAY); }, /** * In Safari, keydown events may fire when committing compositions. If * the arrow keys are used to commit, prevent default so that the cursor * doesn't move, otherwise it will jump back noticeably on re-render. */ onKeyDown: function onKeyDown(editor, e) { if (!stillComposing) { // If a keydown event is received after compositionend but before the // 20ms timer expires (ex: type option-E then backspace, or type A then // backspace in 2-Set Korean), we should immediately resolve the // composition and reinterpret the key press in edit mode. DraftEditorCompositionHandler.resolveComposition(editor); editor._onKeyDown(e); return; } if (e.which === Keys.RIGHT || e.which === Keys.LEFT) { e.preventDefault(); } }, /** * Keypress events may fire when committing compositions. In Firefox, * pressing RETURN commits the composition and inserts extra newline * characters that we do not want. `preventDefault` allows the composition * to be committed while preventing the extra characters. */ onKeyPress: function onKeyPress(editor, e) { if (e.which === Keys.RETURN) { e.preventDefault(); } }, /** * Attempt to insert composed characters into the document. * * If we are still in a composition session, do nothing. Otherwise, insert * the characters into the document and terminate the composition session. * * If no characters were composed -- for instance, the user * deleted all composed characters and committed nothing new -- * force a re-render. We also re-render when the composition occurs * at the beginning of a leaf, to ensure that if the browser has * created a new text node for the composition, we will discard it. * * Resetting innerHTML will move focus to the beginning of the editor, * so we update to force it back to the correct place. */ resolveComposition: function resolveComposition(editor) { if (stillComposing) { return; } resolved = true; var composedChars = textInputData; textInputData = ''; var editorState = EditorState.set(editor._latestEditorState, { inCompositionMode: false }); var currentStyle = editorState.getCurrentInlineStyle(); var entityKey = getEntityKeyForSelection(editorState.getCurrentContent(), editorState.getSelection()); var mustReset = !composedChars || isSelectionAtLeafStart(editorState) || currentStyle.size > 0 || entityKey !== null; if (mustReset) { editor.restoreEditorDOM(); } editor.exitCurrentMode(); if (composedChars) { // If characters have been composed, re-rendering with the update // is sufficient to reset the editor. var contentState = DraftModifier.replaceText(editorState.getCurrentContent(), editorState.getSelection(), composedChars, currentStyle, entityKey); editor.update(EditorState.push(editorState, contentState, 'insert-characters')); return; } if (mustReset) { editor.update(EditorState.set(editorState, { nativelyRenderedContent: null, forceSelection: true })); } } }; module.exports = DraftEditorCompositionHandler; /***/ }), /* 66 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftEditorContents.react * @typechecks * */ 'use strict'; var _assign = __webpack_require__(11); var _extends = _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; }; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var DraftEditorBlock = __webpack_require__(38); var DraftOffsetKey = __webpack_require__(19); var EditorState = __webpack_require__(1); var React = __webpack_require__(12); var cx = __webpack_require__(16); var joinClasses = __webpack_require__(141); var nullthrows = __webpack_require__(5); /** * `DraftEditorContents` is the container component for all block components * rendered for a `DraftEditor`. It is optimized to aggressively avoid * re-rendering blocks whenever possible. * * This component is separate from `DraftEditor` because certain props * (for instance, ARIA props) must be allowed to update without affecting * the contents of the editor. */ var DraftEditorContents = function (_React$Component) { _inherits(DraftEditorContents, _React$Component); function DraftEditorContents() { _classCallCheck(this, DraftEditorContents); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } DraftEditorContents.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { var prevEditorState = this.props.editorState; var nextEditorState = nextProps.editorState; var prevDirectionMap = prevEditorState.getDirectionMap(); var nextDirectionMap = nextEditorState.getDirectionMap(); // Text direction has changed for one or more blocks. We must re-render. if (prevDirectionMap !== nextDirectionMap) { return true; } var didHaveFocus = prevEditorState.getSelection().getHasFocus(); var nowHasFocus = nextEditorState.getSelection().getHasFocus(); if (didHaveFocus !== nowHasFocus) { return true; } var nextNativeContent = nextEditorState.getNativelyRenderedContent(); var wasComposing = prevEditorState.isInCompositionMode(); var nowComposing = nextEditorState.isInCompositionMode(); // If the state is unchanged or we're currently rendering a natively // rendered state, there's nothing new to be done. if (prevEditorState === nextEditorState || nextNativeContent !== null && nextEditorState.getCurrentContent() === nextNativeContent || wasComposing && nowComposing) { return false; } var prevContent = prevEditorState.getCurrentContent(); var nextContent = nextEditorState.getCurrentContent(); var prevDecorator = prevEditorState.getDecorator(); var nextDecorator = nextEditorState.getDecorator(); return wasComposing !== nowComposing || prevContent !== nextContent || prevDecorator !== nextDecorator || nextEditorState.mustForceSelection(); }; DraftEditorContents.prototype.render = function render() { var _props = this.props, blockRenderMap = _props.blockRenderMap, blockRendererFn = _props.blockRendererFn, customStyleMap = _props.customStyleMap, customStyleFn = _props.customStyleFn, editorState = _props.editorState; var content = editorState.getCurrentContent(); var selection = editorState.getSelection(); var forceSelection = editorState.mustForceSelection(); var decorator = editorState.getDecorator(); var directionMap = nullthrows(editorState.getDirectionMap()); var blocksAsArray = content.getBlocksAsArray(); var processedBlocks = []; var currentDepth = null; var lastWrapperTemplate = null; for (var ii = 0; ii < blocksAsArray.length; ii++) { var _block = blocksAsArray[ii]; var key = _block.getKey(); var blockType = _block.getType(); var customRenderer = blockRendererFn(_block); var CustomComponent = void 0, customProps = void 0, customEditable = void 0; if (customRenderer) { CustomComponent = customRenderer.component; customProps = customRenderer.props; customEditable = customRenderer.editable; } var _textDirectionality = this.props.textDirectionality; var direction = _textDirectionality ? _textDirectionality : directionMap.get(key); var offsetKey = DraftOffsetKey.encode(key, 0, 0); var componentProps = { contentState: content, block: _block, blockProps: customProps, customStyleMap: customStyleMap, customStyleFn: customStyleFn, decorator: decorator, direction: direction, forceSelection: forceSelection, key: key, offsetKey: offsetKey, selection: selection, tree: editorState.getBlockTree(key) }; var configForType = blockRenderMap.get(blockType); var wrapperTemplate = configForType.wrapper; var Element = configForType.element || blockRenderMap.get('unstyled').element; var depth = _block.getDepth(); var className = this.props.blockStyleFn(_block); // List items are special snowflakes, since we handle nesting and // counters manually. if (Element === 'li') { var shouldResetCount = lastWrapperTemplate !== wrapperTemplate || currentDepth === null || depth > currentDepth; className = joinClasses(className, getListItemClasses(blockType, depth, shouldResetCount, direction)); } var Component = CustomComponent || DraftEditorBlock; var childProps = { className: className, 'data-block': true, /* $FlowFixMe(>=0.53.0 site=www,mobile) This comment suppresses an * error when upgrading Flow's support for React. Common errors found * when upgrading Flow's React support are documented at * https://fburl.com/eq7bs81w */ 'data-editor': this.props.editorKey, 'data-offset-key': offsetKey, key: key }; if (customEditable !== undefined) { childProps = _extends({}, childProps, { contentEditable: customEditable, suppressContentEditableWarning: true }); } var child = React.createElement(Element, childProps, /* $FlowFixMe(>=0.53.0 site=www,mobile) This comment suppresses an * error when upgrading Flow's support for React. Common errors found * when upgrading Flow's React support are documented at * https://fburl.com/eq7bs81w */ React.createElement(Component, componentProps)); processedBlocks.push({ block: child, wrapperTemplate: wrapperTemplate, key: key, offsetKey: offsetKey }); if (wrapperTemplate) { currentDepth = _block.getDepth(); } else { currentDepth = null; } lastWrapperTemplate = wrapperTemplate; } // Group contiguous runs of blocks that have the same wrapperTemplate var outputBlocks = []; for (var _ii = 0; _ii < processedBlocks.length;) { var info = processedBlocks[_ii]; if (info.wrapperTemplate) { var blocks = []; do { blocks.push(processedBlocks[_ii].block); _ii++; } while (_ii < processedBlocks.length && processedBlocks[_ii].wrapperTemplate === info.wrapperTemplate); var wrapperElement = React.cloneElement(info.wrapperTemplate, { key: info.key + '-wrap', 'data-offset-key': info.offsetKey }, blocks); outputBlocks.push(wrapperElement); } else { outputBlocks.push(info.block); _ii++; } } return React.createElement( 'div', { 'data-contents': 'true' }, outputBlocks ); }; return DraftEditorContents; }(React.Component); /** * Provide default styling for list items. This way, lists will be styled with * proper counters and indentation even if the caller does not specify * their own styling at all. If more than five levels of nesting are needed, * the necessary CSS classes can be provided via `blockStyleFn` configuration. */ function getListItemClasses(type, depth, shouldResetCount, direction) { return cx({ 'public/DraftStyleDefault/unorderedListItem': type === 'unordered-list-item', 'public/DraftStyleDefault/orderedListItem': type === 'ordered-list-item', 'public/DraftStyleDefault/reset': shouldResetCount, 'public/DraftStyleDefault/depth0': depth === 0, 'public/DraftStyleDefault/depth1': depth === 1, 'public/DraftStyleDefault/depth2': depth === 2, 'public/DraftStyleDefault/depth3': depth === 3, 'public/DraftStyleDefault/depth4': depth === 4, 'public/DraftStyleDefault/listLTR': direction === 'LTR', 'public/DraftStyleDefault/listRTL': direction === 'RTL' }); } module.exports = DraftEditorContents; /***/ }), /* 67 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftEditorDragHandler * @typechecks * */ 'use strict'; var DataTransfer = __webpack_require__(57); var DraftModifier = __webpack_require__(4); var EditorState = __webpack_require__(1); var findAncestorOffsetKey = __webpack_require__(26); var getTextContentFromFiles = __webpack_require__(51); var getUpdatedSelectionState = __webpack_require__(52); var isEventHandled = __webpack_require__(22); var nullthrows = __webpack_require__(5); /** * Get a SelectionState for the supplied mouse event. */ function getSelectionForEvent(event, editorState) { var node = null; var offset = null; if (typeof document.caretRangeFromPoint === 'function') { var dropRange = document.caretRangeFromPoint(event.x, event.y); node = dropRange.startContainer; offset = dropRange.startOffset; } else if (event.rangeParent) { node = event.rangeParent; offset = event.rangeOffset; } else { return null; } node = nullthrows(node); offset = nullthrows(offset); var offsetKey = nullthrows(findAncestorOffsetKey(node)); return getUpdatedSelectionState(editorState, offsetKey, offset, offsetKey, offset); } var DraftEditorDragHandler = { /** * Drag originating from input terminated. */ onDragEnd: function onDragEnd(editor) { editor.exitCurrentMode(); }, /** * Handle data being dropped. */ onDrop: function onDrop(editor, e) { var data = new DataTransfer(e.nativeEvent.dataTransfer); var editorState = editor._latestEditorState; var dropSelection = getSelectionForEvent(e.nativeEvent, editorState); e.preventDefault(); editor.exitCurrentMode(); if (dropSelection == null) { return; } var files = data.getFiles(); if (files.length > 0) { if (editor.props.handleDroppedFiles && isEventHandled(editor.props.handleDroppedFiles(dropSelection, files))) { return; } getTextContentFromFiles(files, function (fileText) { fileText && editor.update(insertTextAtSelection(editorState, dropSelection, fileText)); }); return; } var dragType = editor._internalDrag ? 'internal' : 'external'; if (editor.props.handleDrop && isEventHandled(editor.props.handleDrop(dropSelection, data, dragType))) { return; } if (editor._internalDrag) { editor.update(moveText(editorState, dropSelection)); return; } editor.update(insertTextAtSelection(editorState, dropSelection, data.getText())); } }; function moveText(editorState, targetSelection) { var newContentState = DraftModifier.moveText(editorState.getCurrentContent(), editorState.getSelection(), targetSelection); return EditorState.push(editorState, newContentState, 'insert-fragment'); } /** * Insert text at a specified selection. */ function insertTextAtSelection(editorState, selection, text) { var newContentState = DraftModifier.insertText(editorState.getCurrentContent(), selection, text, editorState.getCurrentInlineStyle()); return EditorState.push(editorState, newContentState, 'insert-fragment'); } module.exports = DraftEditorDragHandler; /***/ }), /* 68 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftEditorEditHandler * */ 'use strict'; var onBeforeInput = __webpack_require__(86); var onBlur = __webpack_require__(87); var onCompositionStart = __webpack_require__(88); var onCopy = __webpack_require__(89); var onCut = __webpack_require__(90); var onDragOver = __webpack_require__(91); var onDragStart = __webpack_require__(92); var onFocus = __webpack_require__(93); var onInput = __webpack_require__(94); var onKeyDown = __webpack_require__(95); var onPaste = __webpack_require__(96); var onSelect = __webpack_require__(97); var DraftEditorEditHandler = { onBeforeInput: onBeforeInput, onBlur: onBlur, onCompositionStart: onCompositionStart, onCopy: onCopy, onCut: onCut, onDragOver: onDragOver, onDragStart: onDragStart, onFocus: onFocus, onInput: onInput, onKeyDown: onKeyDown, onPaste: onPaste, onSelect: onSelect }; module.exports = DraftEditorEditHandler; /***/ }), /* 69 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftEditorLeaf.react * @typechecks * */ 'use strict'; var _assign = __webpack_require__(11); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var ContentBlock = __webpack_require__(9); var DraftEditorTextNode = __webpack_require__(71); var React = __webpack_require__(12); var ReactDOM = __webpack_require__(17); var invariant = __webpack_require__(2); var setDraftEditorSelection = __webpack_require__(121); /** * All leaf nodes in the editor are spans with single text nodes. Leaf * elements are styled based on the merging of an optional custom style map * and a default style map. * * `DraftEditorLeaf` also provides a wrapper for calling into the imperative * DOM Selection API. In this way, top-level components can declaratively * maintain the selection state. */ var DraftEditorLeaf = function (_React$Component) { _inherits(DraftEditorLeaf, _React$Component); function DraftEditorLeaf() { _classCallCheck(this, DraftEditorLeaf); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } /** * By making individual leaf instances aware of their context within * the text of the editor, we can set our selection range more * easily than we could in the non-React world. * * Note that this depends on our maintaining tight control over the * DOM structure of the DraftEditor component. If leaves had multiple * text nodes, this would be harder. */ DraftEditorLeaf.prototype._setSelection = function _setSelection() { var selection = this.props.selection; // If selection state is irrelevant to the parent block, no-op. if (selection == null || !selection.getHasFocus()) { return; } var _props = this.props, block = _props.block, start = _props.start, text = _props.text; var blockKey = block.getKey(); var end = start + text.length; if (!selection.hasEdgeWithin(blockKey, start, end)) { return; } // Determine the appropriate target node for selection. If the child // is not a text node, it is a <br /> spacer. In this case, use the // <span> itself as the selection target. var node = ReactDOM.findDOMNode(this); !node ? true ? invariant(false, 'Missing node') : invariant(false) : void 0; var child = node.firstChild; !child ? true ? invariant(false, 'Missing child') : invariant(false) : void 0; var targetNode = void 0; if (child.nodeType === Node.TEXT_NODE) { targetNode = child; } else if (child.tagName === 'BR') { targetNode = node; } else { targetNode = child.firstChild; !targetNode ? true ? invariant(false, 'Missing targetNode') : invariant(false) : void 0; } setDraftEditorSelection(selection, targetNode, blockKey, start, end); }; DraftEditorLeaf.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { var leafNode = ReactDOM.findDOMNode(this.refs.leaf); !leafNode ? true ? invariant(false, 'Missing leafNode') : invariant(false) : void 0; return leafNode.textContent !== nextProps.text || nextProps.styleSet !== this.props.styleSet || nextProps.forceSelection; }; DraftEditorLeaf.prototype.componentDidUpdate = function componentDidUpdate() { this._setSelection(); }; DraftEditorLeaf.prototype.componentDidMount = function componentDidMount() { this._setSelection(); }; DraftEditorLeaf.prototype.render = function render() { var block = this.props.block; var text = this.props.text; // If the leaf is at the end of its block and ends in a soft newline, append // an extra line feed character. Browsers collapse trailing newline // characters, which leaves the cursor in the wrong place after a // shift+enter. The extra character repairs this. if (text.endsWith('\n') && this.props.isLast) { text += '\n'; } var _props2 = this.props, customStyleMap = _props2.customStyleMap, customStyleFn = _props2.customStyleFn, offsetKey = _props2.offsetKey, styleSet = _props2.styleSet; var styleObj = styleSet.reduce(function (map, styleName) { var mergedStyles = {}; var style = customStyleMap[styleName]; if (style !== undefined && map.textDecoration !== style.textDecoration) { // .trim() is necessary for IE9/10/11 and Edge mergedStyles.textDecoration = [map.textDecoration, style.textDecoration].join(' ').trim(); } return _assign(map, style, mergedStyles); }, {}); if (customStyleFn) { var newStyles = customStyleFn(styleSet, block); styleObj = _assign(styleObj, newStyles); } return React.createElement( 'span', { 'data-offset-key': offsetKey, ref: 'leaf', style: styleObj }, React.createElement( DraftEditorTextNode, null, text ) ); }; return DraftEditorLeaf; }(React.Component); module.exports = DraftEditorLeaf; /***/ }), /* 70 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftEditorPlaceholder.react * @typechecks * */ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var React = __webpack_require__(12); var cx = __webpack_require__(16); /** * This component is responsible for rendering placeholder text for the * `DraftEditor` component. * * Override placeholder style via CSS. */ var DraftEditorPlaceholder = function (_React$Component) { _inherits(DraftEditorPlaceholder, _React$Component); function DraftEditorPlaceholder() { _classCallCheck(this, DraftEditorPlaceholder); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } DraftEditorPlaceholder.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { return this.props.text !== nextProps.text || this.props.editorState.getSelection().getHasFocus() !== nextProps.editorState.getSelection().getHasFocus(); }; DraftEditorPlaceholder.prototype.render = function render() { var hasFocus = this.props.editorState.getSelection().getHasFocus(); var className = cx({ 'public/DraftEditorPlaceholder/root': true, 'public/DraftEditorPlaceholder/hasFocus': hasFocus }); return React.createElement( 'div', { className: className }, React.createElement( 'div', { className: cx('public/DraftEditorPlaceholder/inner'), id: this.props.accessibilityID }, this.props.text ) ); }; return DraftEditorPlaceholder; }(React.Component); module.exports = DraftEditorPlaceholder; /***/ }), /* 71 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftEditorTextNode.react * @typechecks * */ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var React = __webpack_require__(12); var ReactDOM = __webpack_require__(17); var UserAgent = __webpack_require__(8); var invariant = __webpack_require__(2); // In IE, spans with <br> tags render as two newlines. By rendering a span // with only a newline character, we can be sure to render a single line. var useNewlineChar = UserAgent.isBrowser('IE <= 11'); /** * Check whether the node should be considered a newline. */ function isNewline(node) { return useNewlineChar ? node.textContent === '\n' : node.tagName === 'BR'; } /** * Placeholder elements for empty text content. * * What is this `data-text` attribute, anyway? It turns out that we need to * put an attribute on the lowest-level text node in order to preserve correct * spellcheck handling. If the <span> is naked, Chrome and Safari may do * bizarre things to do the DOM -- split text nodes, create extra spans, etc. * If the <span> has an attribute, this appears not to happen. * See http://jsfiddle.net/9khdavod/ for the failure case, and * http://jsfiddle.net/7pg143f7/ for the fixed case. */ var NEWLINE_A = useNewlineChar ? React.createElement( 'span', { key: 'A', 'data-text': 'true' }, '\n' ) : React.createElement('br', { key: 'A', 'data-text': 'true' }); var NEWLINE_B = useNewlineChar ? React.createElement( 'span', { key: 'B', 'data-text': 'true' }, '\n' ) : React.createElement('br', { key: 'B', 'data-text': 'true' }); /** * The lowest-level component in a `DraftEditor`, the text node component * replaces the default React text node implementation. This allows us to * perform custom handling of newline behavior and avoid re-rendering text * nodes with DOM state that already matches the expectations of our immutable * editor state. */ var DraftEditorTextNode = function (_React$Component) { _inherits(DraftEditorTextNode, _React$Component); function DraftEditorTextNode(props) { _classCallCheck(this, DraftEditorTextNode); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props)); _this._forceFlag = false; return _this; } DraftEditorTextNode.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { var node = ReactDOM.findDOMNode(this); var shouldBeNewline = nextProps.children === ''; !(node instanceof Element) ? true ? invariant(false, 'node is not an Element') : invariant(false) : void 0; if (shouldBeNewline) { return !isNewline(node); } return node.textContent !== nextProps.children; }; DraftEditorTextNode.prototype.componentWillUpdate = function componentWillUpdate() { // By flipping this flag, we also keep flipping keys which forces // React to remount this node every time it rerenders. this._forceFlag = !this._forceFlag; }; DraftEditorTextNode.prototype.render = function render() { if (this.props.children === '') { return this._forceFlag ? NEWLINE_A : NEWLINE_B; } return React.createElement( 'span', { key: this._forceFlag ? 'A' : 'B', 'data-text': 'true' }, this.props.children ); }; return DraftEditorTextNode; }(React.Component); module.exports = DraftEditorTextNode; /***/ }), /* 72 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftEntitySegments * @typechecks * */ 'use strict'; /** * Identify the range to delete from a segmented entity. * * Rules: * * Example: 'John F. Kennedy' * * - Deletion from within any non-whitespace (i.e. ['John', 'F.', 'Kennedy']) * will return the range of that text. * * 'John F. Kennedy' -> 'John F.' * ^ * * - Forward deletion of whitespace will remove the following section: * * 'John F. Kennedy' -> 'John Kennedy' * ^ * * - Backward deletion of whitespace will remove the previous section: * * 'John F. Kennedy' -> 'F. Kennedy' * ^ */ var DraftEntitySegments = { getRemovalRange: function getRemovalRange(selectionStart, selectionEnd, text, entityStart, direction) { var segments = text.split(' '); segments = segments.map(function ( /*string*/segment, /*number*/ii) { if (direction === 'forward') { if (ii > 0) { return ' ' + segment; } } else if (ii < segments.length - 1) { return segment + ' '; } return segment; }); var segmentStart = entityStart; var segmentEnd; var segment; var removalStart = null; var removalEnd = null; for (var jj = 0; jj < segments.length; jj++) { segment = segments[jj]; segmentEnd = segmentStart + segment.length; // Our selection overlaps this segment. if (selectionStart < segmentEnd && segmentStart < selectionEnd) { if (removalStart !== null) { removalEnd = segmentEnd; } else { removalStart = segmentStart; removalEnd = segmentEnd; } } else if (removalStart !== null) { break; } segmentStart = segmentEnd; } var entityEnd = entityStart + text.length; var atStart = removalStart === entityStart; var atEnd = removalEnd === entityEnd; if (!atStart && atEnd || atStart && !atEnd) { if (direction === 'forward') { if (removalEnd !== entityEnd) { removalEnd++; } } else if (removalStart !== entityStart) { removalStart--; } } return { start: removalStart, end: removalEnd }; } }; module.exports = DraftEntitySegments; /***/ }), /* 73 */ /***/ (function(module, exports) { /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftFeatureFlags-core * */ 'use strict'; var DraftFeatureFlags = { draft_killswitch_allow_nontextnodes: false, draft_segmented_entities_behavior: false }; module.exports = DraftFeatureFlags; /***/ }), /* 74 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftJsDebugLogging */ 'use strict'; module.exports = { logSelectionStateFailure: function logSelectionStateFailure() { return null; } }; /***/ }), /* 75 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DraftPasteProcessor * @typechecks * */ 'use strict'; var CharacterMetadata = __webpack_require__(6); var ContentBlock = __webpack_require__(9); var Immutable = __webpack_require__(3); var convertFromHTMLtoContentBlocks = __webpack_require__(44); var generateRandomKey = __webpack_require__(7); var getSafeBodyFromHTML = __webpack_require__(49); var sanitizeDraftText = __webpack_require__(29); var List = Immutable.List, Repeat = Immutable.Repeat; var DraftPasteProcessor = { processHTML: function processHTML(html, blockRenderMap) { return convertFromHTMLtoContentBlocks(html, getSafeBodyFromHTML, blockRenderMap); }, processText: function processText(textBlocks, character, type) { return textBlocks.map(function (textLine) { textLine = sanitizeDraftText(textLine); return new ContentBlock({ key: generateRandomKey(), type: type, text: textLine, characterList: List(Repeat(character, textLine.length)) }); }); } }; module.exports = DraftPasteProcessor; /***/ }), /* 76 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule EditorBidiService * @typechecks * */ 'use strict'; var Immutable = __webpack_require__(3); var UnicodeBidiService = __webpack_require__(127); var nullthrows = __webpack_require__(5); var OrderedMap = Immutable.OrderedMap; var bidiService; var EditorBidiService = { getDirectionMap: function getDirectionMap(content, prevBidiMap) { if (!bidiService) { bidiService = new UnicodeBidiService(); } else { bidiService.reset(); } var blockMap = content.getBlockMap(); var nextBidi = blockMap.valueSeq().map(function (block) { return nullthrows(bidiService).getDirection(block.getText()); }); var bidiMap = OrderedMap(blockMap.keySeq().zip(nextBidi)); if (prevBidiMap != null && Immutable.is(prevBidiMap, bidiMap)) { return prevBidiMap; } return bidiMap; } }; module.exports = EditorBidiService; /***/ }), /* 77 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SecondaryClipboard * */ 'use strict'; var DraftModifier = __webpack_require__(4); var EditorState = __webpack_require__(1); var getContentStateFragment = __webpack_require__(21); var nullthrows = __webpack_require__(5); var clipboard = null; /** * Some systems offer a "secondary" clipboard to allow quick internal cut * and paste behavior. For instance, Ctrl+K (cut) and Ctrl+Y (paste). */ var SecondaryClipboard = { cut: function cut(editorState) { var content = editorState.getCurrentContent(); var selection = editorState.getSelection(); var targetRange = null; if (selection.isCollapsed()) { var anchorKey = selection.getAnchorKey(); var blockEnd = content.getBlockForKey(anchorKey).getLength(); if (blockEnd === selection.getAnchorOffset()) { return editorState; } targetRange = selection.set('focusOffset', blockEnd); } else { targetRange = selection; } targetRange = nullthrows(targetRange); clipboard = getContentStateFragment(content, targetRange); var afterRemoval = DraftModifier.removeRange(content, targetRange, 'forward'); if (afterRemoval === content) { return editorState; } return EditorState.push(editorState, afterRemoval, 'remove-range'); }, paste: function paste(editorState) { if (!clipboard) { return editorState; } var newContent = DraftModifier.replaceWithFragment(editorState.getCurrentContent(), editorState.getSelection(), clipboard); return EditorState.push(editorState, newContent, 'insert-fragment'); } }; module.exports = SecondaryClipboard; /***/ }), /* 78 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule adjustBlockDepthForContentState * @typechecks * */ 'use strict'; function adjustBlockDepthForContentState(contentState, selectionState, adjustment, maxDepth) { var startKey = selectionState.getStartKey(); var endKey = selectionState.getEndKey(); var blockMap = contentState.getBlockMap(); var blocks = blockMap.toSeq().skipUntil(function (_, k) { return k === startKey; }).takeUntil(function (_, k) { return k === endKey; }).concat([[endKey, blockMap.get(endKey)]]).map(function (block) { var depth = block.getDepth() + adjustment; depth = Math.max(0, Math.min(depth, maxDepth)); return block.set('depth', depth); }); blockMap = blockMap.merge(blocks); return contentState.merge({ blockMap: blockMap, selectionBefore: selectionState, selectionAfter: selectionState }); } module.exports = adjustBlockDepthForContentState; /***/ }), /* 79 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule applyEntityToContentBlock * @typechecks * */ 'use strict'; var CharacterMetadata = __webpack_require__(6); function applyEntityToContentBlock(contentBlock, start, end, entityKey) { var characterList = contentBlock.getCharacterList(); while (start < end) { characterList = characterList.set(start, CharacterMetadata.applyEntity(characterList.get(start), entityKey)); start++; } return contentBlock.set('characterList', characterList); } module.exports = applyEntityToContentBlock; /***/ }), /* 80 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule applyEntityToContentState * @typechecks * */ 'use strict'; var Immutable = __webpack_require__(3); var applyEntityToContentBlock = __webpack_require__(79); function applyEntityToContentState(contentState, selectionState, entityKey) { var blockMap = contentState.getBlockMap(); var startKey = selectionState.getStartKey(); var startOffset = selectionState.getStartOffset(); var endKey = selectionState.getEndKey(); var endOffset = selectionState.getEndOffset(); var newBlocks = blockMap.skipUntil(function (_, k) { return k === startKey; }).takeUntil(function (_, k) { return k === endKey; }).toOrderedMap().merge(Immutable.OrderedMap([[endKey, blockMap.get(endKey)]])).map(function (block, blockKey) { var sliceStart = blockKey === startKey ? startOffset : 0; var sliceEnd = blockKey === endKey ? endOffset : block.getLength(); return applyEntityToContentBlock(block, sliceStart, sliceEnd, entityKey); }); return contentState.merge({ blockMap: blockMap.merge(newBlocks), selectionBefore: selectionState, selectionAfter: selectionState }); } module.exports = applyEntityToContentState; /***/ }), /* 81 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule convertFromDraftStateToRaw * */ 'use strict'; var DraftStringKey = __webpack_require__(42); var encodeEntityRanges = __webpack_require__(98); var encodeInlineStyleRanges = __webpack_require__(99); function convertFromDraftStateToRaw(contentState) { var entityStorageKey = 0; var entityStorageMap = {}; var rawBlocks = []; contentState.getBlockMap().forEach(function (block, blockKey) { block.findEntityRanges(function (character) { return character.getEntity() !== null; }, function (start) { // Stringify to maintain order of otherwise numeric keys. var stringifiedEntityKey = DraftStringKey.stringify(block.getEntityAt(start)); if (!entityStorageMap.hasOwnProperty(stringifiedEntityKey)) { entityStorageMap[stringifiedEntityKey] = '' + entityStorageKey++; } }); rawBlocks.push({ key: blockKey, text: block.getText(), type: block.getType(), depth: block.getDepth(), inlineStyleRanges: encodeInlineStyleRanges(block), entityRanges: encodeEntityRanges(block, entityStorageMap), data: block.getData().toObject() }); }); // Flip storage map so that our storage keys map to global // DraftEntity keys. var entityKeys = Object.keys(entityStorageMap); var flippedStorageMap = {}; entityKeys.forEach(function (key, jj) { var entity = contentState.getEntity(DraftStringKey.unstringify(key)); flippedStorageMap[jj] = { type: entity.getType(), mutability: entity.getMutability(), data: entity.getData() }; }); return { entityMap: flippedStorageMap, blocks: rawBlocks }; } module.exports = convertFromDraftStateToRaw; /***/ }), /* 82 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule convertFromRawToDraftState * */ 'use strict'; var _assign = __webpack_require__(11); var _extends = _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 ContentBlock = __webpack_require__(9); var ContentState = __webpack_require__(23); var DraftEntity = __webpack_require__(18); var Immutable = __webpack_require__(3); var createCharacterList = __webpack_require__(83); var decodeEntityRanges = __webpack_require__(84); var decodeInlineStyleRanges = __webpack_require__(85); var generateRandomKey = __webpack_require__(7); var Map = Immutable.Map; function convertFromRawToDraftState(rawState) { var blocks = rawState.blocks, entityMap = rawState.entityMap; var fromStorageToLocal = {}; // TODO: Update this once we completely remove DraftEntity Object.keys(entityMap).forEach(function (storageKey) { var encodedEntity = entityMap[storageKey]; var type = encodedEntity.type, mutability = encodedEntity.mutability, data = encodedEntity.data; var newKey = DraftEntity.__create(type, mutability, data || {}); fromStorageToLocal[storageKey] = newKey; }); var contentBlocks = blocks.map(function (block) { var key = block.key, type = block.type, text = block.text, depth = block.depth, inlineStyleRanges = block.inlineStyleRanges, entityRanges = block.entityRanges, data = block.data; key = key || generateRandomKey(); type = type || 'unstyled'; depth = depth || 0; inlineStyleRanges = inlineStyleRanges || []; entityRanges = entityRanges || []; data = Map(data); var inlineStyles = decodeInlineStyleRanges(text, inlineStyleRanges); // Translate entity range keys to the DraftEntity map. var filteredEntityRanges = entityRanges.filter(function (range) { return fromStorageToLocal.hasOwnProperty(range.key); }).map(function (range) { return _extends({}, range, { key: fromStorageToLocal[range.key] }); }); var entities = decodeEntityRanges(text, filteredEntityRanges); var characterList = createCharacterList(inlineStyles, entities); return new ContentBlock({ key: key, type: type, text: text, depth: depth, characterList: characterList, data: data }); }); return ContentState.createFromBlockArray(contentBlocks); } module.exports = convertFromRawToDraftState; /***/ }), /* 83 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule createCharacterList * @typechecks * */ 'use strict'; var CharacterMetadata = __webpack_require__(6); var Immutable = __webpack_require__(3); var List = Immutable.List; function createCharacterList(inlineStyles, entities) { var characterArray = inlineStyles.map(function (style, ii) { var entity = entities[ii]; return CharacterMetadata.create({ style: style, entity: entity }); }); return List(characterArray); } module.exports = createCharacterList; /***/ }), /* 84 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule decodeEntityRanges * @typechecks * */ 'use strict'; var UnicodeUtils = __webpack_require__(10); var substr = UnicodeUtils.substr; /** * Convert to native JavaScript string lengths to determine ranges. */ function decodeEntityRanges(text, ranges) { var entities = Array(text.length).fill(null); if (ranges) { ranges.forEach(function (range) { // Using Unicode-enabled substrings converted to JavaScript lengths, // fill the output array with entity keys. var start = substr(text, 0, range.offset).length; var end = start + substr(text, range.offset, range.length).length; for (var ii = start; ii < end; ii++) { entities[ii] = range.key; } }); } return entities; } module.exports = decodeEntityRanges; /***/ }), /* 85 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule decodeInlineStyleRanges * @typechecks * */ 'use strict'; var _require = __webpack_require__(3), OrderedSet = _require.OrderedSet; var UnicodeUtils = __webpack_require__(10); var substr = UnicodeUtils.substr; var EMPTY_SET = OrderedSet(); /** * Convert to native JavaScript string lengths to determine ranges. */ function decodeInlineStyleRanges(text, ranges) { var styles = Array(text.length).fill(EMPTY_SET); if (ranges) { ranges.forEach(function ( /*object*/range) { var cursor = substr(text, 0, range.offset).length; var end = cursor + substr(text, range.offset, range.length).length; while (cursor < end) { styles[cursor] = styles[cursor].add(range.style); cursor++; } }); } return styles; } module.exports = decodeInlineStyleRanges; /***/ }), /* 86 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule editOnBeforeInput * */ 'use strict'; var BlockTree = __webpack_require__(36); var DraftModifier = __webpack_require__(4); var EditorState = __webpack_require__(1); var UserAgent = __webpack_require__(8); var getEntityKeyForSelection = __webpack_require__(27); var isEventHandled = __webpack_require__(22); var isSelectionAtLeafStart = __webpack_require__(54); var nullthrows = __webpack_require__(5); var setImmediate = __webpack_require__(144); // When nothing is focused, Firefox regards two characters, `'` and `/`, as // commands that should open and focus the "quickfind" search bar. This should // *never* happen while a contenteditable is focused, but as of v28, it // sometimes does, even when the keypress event target is the contenteditable. // This breaks the input. Special case these characters to ensure that when // they are typed, we prevent default on the event to make sure not to // trigger quickfind. var FF_QUICKFIND_CHAR = '\''; var FF_QUICKFIND_LINK_CHAR = '\/'; var isFirefox = UserAgent.isBrowser('Firefox'); function mustPreventDefaultForCharacter(character) { return isFirefox && (character == FF_QUICKFIND_CHAR || character == FF_QUICKFIND_LINK_CHAR); } /** * Replace the current selection with the specified text string, with the * inline style and entity key applied to the newly inserted text. */ function replaceText(editorState, text, inlineStyle, entityKey) { var contentState = DraftModifier.replaceText(editorState.getCurrentContent(), editorState.getSelection(), text, inlineStyle, entityKey); return EditorState.push(editorState, contentState, 'insert-characters'); } /** * When `onBeforeInput` executes, the browser is attempting to insert a * character into the editor. Apply this character data to the document, * allowing native insertion if possible. * * Native insertion is encouraged in order to limit re-rendering and to * preserve spellcheck highlighting, which disappears or flashes if re-render * occurs on the relevant text nodes. */ function editOnBeforeInput(editor, e) { if (editor._pendingStateFromBeforeInput !== undefined) { editor.update(editor._pendingStateFromBeforeInput); editor._pendingStateFromBeforeInput = undefined; } var editorState = editor._latestEditorState; var chars = e.data; // In some cases (ex: IE ideographic space insertion) no character data // is provided. There's nothing to do when this happens. if (!chars) { return; } // Allow the top-level component to handle the insertion manually. This is // useful when triggering interesting behaviors for a character insertion, // Simple examples: replacing a raw text ':)' with a smile emoji or image // decorator, or setting a block to be a list item after typing '- ' at the // start of the block. if (editor.props.handleBeforeInput && isEventHandled(editor.props.handleBeforeInput(chars, editorState))) { e.preventDefault(); return; } // If selection is collapsed, conditionally allow native behavior. This // reduces re-renders and preserves spellcheck highlighting. If the selection // is not collapsed, we will re-render. var selection = editorState.getSelection(); var anchorKey = selection.getAnchorKey(); if (!selection.isCollapsed()) { e.preventDefault(); editor.update(replaceText(editorState, chars, editorState.getCurrentInlineStyle(), getEntityKeyForSelection(editorState.getCurrentContent(), editorState.getSelection()))); return; } var newEditorState = replaceText(editorState, chars, editorState.getCurrentInlineStyle(), getEntityKeyForSelection(editorState.getCurrentContent(), editorState.getSelection())); // Bunch of different cases follow where we need to prevent native insertion. var mustPreventNative = false; if (!mustPreventNative) { // Browsers tend to insert text in weird places in the DOM when typing at // the start of a leaf, so we'll handle it ourselves. mustPreventNative = isSelectionAtLeafStart(editor._latestCommittedEditorState); } if (!mustPreventNative) { // Chrome will also split up a node into two pieces if it contains a Tab // char, for no explicable reason. Seemingly caused by this commit: // https://chromium.googlesource.com/chromium/src/+/013ac5eaf3%5E%21/ var nativeSelection = global.getSelection(); // Selection is necessarily collapsed at this point due to earlier check. if (nativeSelection.anchorNode !== null && nativeSelection.anchorNode.nodeType === Node.TEXT_NODE) { // See isTabHTMLSpanElement in chromium EditingUtilities.cpp. var parentNode = nativeSelection.anchorNode.parentNode; mustPreventNative = parentNode.nodeName === 'SPAN' && parentNode.firstChild.nodeType === Node.TEXT_NODE && parentNode.firstChild.nodeValue.indexOf('\t') !== -1; } } if (!mustPreventNative) { // Check the old and new "fingerprints" of the current block to determine // whether this insertion requires any addition or removal of text nodes, // in which case we would prevent the native character insertion. var originalFingerprint = BlockTree.getFingerprint(editorState.getBlockTree(anchorKey)); var newFingerprint = BlockTree.getFingerprint(newEditorState.getBlockTree(anchorKey)); mustPreventNative = originalFingerprint !== newFingerprint; } if (!mustPreventNative) { mustPreventNative = mustPreventDefaultForCharacter(chars); } if (!mustPreventNative) { mustPreventNative = nullthrows(newEditorState.getDirectionMap()).get(anchorKey) !== nullthrows(editorState.getDirectionMap()).get(anchorKey); } if (mustPreventNative) { e.preventDefault(); editor.update(newEditorState); return; } // We made it all the way! Let the browser do its thing and insert the char. newEditorState = EditorState.set(newEditorState, { nativelyRenderedContent: newEditorState.getCurrentContent() }); // The native event is allowed to occur. To allow user onChange handlers to // change the inserted text, we wait until the text is actually inserted // before we actually update our state. That way when we rerender, the text // we see in the DOM will already have been inserted properly. editor._pendingStateFromBeforeInput = newEditorState; setImmediate(function () { if (editor._pendingStateFromBeforeInput !== undefined) { editor.update(editor._pendingStateFromBeforeInput); editor._pendingStateFromBeforeInput = undefined; } }); } module.exports = editOnBeforeInput; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), /* 87 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule editOnBlur * */ 'use strict'; var EditorState = __webpack_require__(1); var containsNode = __webpack_require__(33); var getActiveElement = __webpack_require__(60); function editOnBlur(editor, e) { // In a contentEditable element, when you select a range and then click // another active element, this does trigger a `blur` event but will not // remove the DOM selection from the contenteditable. // This is consistent across all browsers, but we prefer that the editor // behave like a textarea, where a `blur` event clears the DOM selection. // We therefore force the issue to be certain, checking whether the active // element is `body` to force it when blurring occurs within the window (as // opposed to clicking to another tab or window). if (getActiveElement() === document.body) { var _selection = global.getSelection(); var editorNode = editor.refs.editor; if (_selection.rangeCount === 1 && containsNode(editorNode, _selection.anchorNode) && containsNode(editorNode, _selection.focusNode)) { _selection.removeAllRanges(); } } var editorState = editor._latestEditorState; var currentSelection = editorState.getSelection(); if (!currentSelection.getHasFocus()) { return; } var selection = currentSelection.set('hasFocus', false); editor.props.onBlur && editor.props.onBlur(e); editor.update(EditorState.acceptSelection(editorState, selection)); } module.exports = editOnBlur; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), /* 88 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule editOnCompositionStart * */ 'use strict'; var EditorState = __webpack_require__(1); /** * The user has begun using an IME input system. Switching to `composite` mode * allows handling composition input and disables other edit behavior. */ function editOnCompositionStart(editor, e) { editor.setMode('composite'); editor.update(EditorState.set(editor._latestEditorState, { inCompositionMode: true })); // Allow composition handler to interpret the compositionstart event editor._onCompositionStart(e); } module.exports = editOnCompositionStart; /***/ }), /* 89 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule editOnCopy * */ 'use strict'; var getFragmentFromSelection = __webpack_require__(47); /** * If we have a selection, create a ContentState fragment and store * it in our internal clipboard. Subsequent paste events will use this * fragment if no external clipboard data is supplied. */ function editOnCopy(editor, e) { var editorState = editor._latestEditorState; var selection = editorState.getSelection(); // No selection, so there's nothing to copy. if (selection.isCollapsed()) { e.preventDefault(); return; } editor.setClipboard(getFragmentFromSelection(editor._latestEditorState)); } module.exports = editOnCopy; /***/ }), /* 90 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule editOnCut * */ 'use strict'; var DraftModifier = __webpack_require__(4); var EditorState = __webpack_require__(1); var Style = __webpack_require__(31); var getFragmentFromSelection = __webpack_require__(47); var getScrollPosition = __webpack_require__(35); /** * On `cut` events, native behavior is allowed to occur so that the system * clipboard is set properly. This means that we need to take steps to recover * the editor DOM state after the `cut` has occurred in order to maintain * control of the component. * * In addition, we can keep a copy of the removed fragment, including all * styles and entities, for use as an internal paste. */ function editOnCut(editor, e) { var editorState = editor._latestEditorState; var selection = editorState.getSelection(); // No selection, so there's nothing to cut. if (selection.isCollapsed()) { e.preventDefault(); return; } // Track the current scroll position so that it can be forced back in place // after the editor regains control of the DOM. // $FlowFixMe e.target should be an instanceof Node var scrollParent = Style.getScrollParent(e.target); var _getScrollPosition = getScrollPosition(scrollParent), x = _getScrollPosition.x, y = _getScrollPosition.y; var fragment = getFragmentFromSelection(editorState); editor.setClipboard(fragment); // Set `cut` mode to disable all event handling temporarily. editor.setMode('cut'); // Let native `cut` behavior occur, then recover control. setTimeout(function () { editor.restoreEditorDOM({ x: x, y: y }); editor.exitCurrentMode(); editor.update(removeFragment(editorState)); }, 0); } function removeFragment(editorState) { var newContent = DraftModifier.removeRange(editorState.getCurrentContent(), editorState.getSelection(), 'forward'); return EditorState.push(editorState, newContent, 'remove-range'); } module.exports = editOnCut; /***/ }), /* 91 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule editOnDragOver * */ 'use strict'; /** * Drag behavior has begun from outside the editor element. */ function editOnDragOver(editor, e) { editor._internalDrag = false; editor.setMode('drag'); e.preventDefault(); } module.exports = editOnDragOver; /***/ }), /* 92 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule editOnDragStart * */ 'use strict'; /** * A `dragstart` event has begun within the text editor component. */ function editOnDragStart(editor) { editor._internalDrag = true; editor.setMode('drag'); } module.exports = editOnDragStart; /***/ }), /* 93 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule editOnFocus * */ 'use strict'; var EditorState = __webpack_require__(1); var UserAgent = __webpack_require__(8); function editOnFocus(editor, e) { var editorState = editor._latestEditorState; var currentSelection = editorState.getSelection(); if (currentSelection.getHasFocus()) { return; } var selection = currentSelection.set('hasFocus', true); editor.props.onFocus && editor.props.onFocus(e); // When the tab containing this text editor is hidden and the user does a // find-in-page in a _different_ tab, Chrome on Mac likes to forget what the // selection was right after sending this focus event and (if you let it) // moves the cursor back to the beginning of the editor, so we force the // selection here instead of simply accepting it in order to preserve the // old cursor position. See https://crbug.com/540004. // But it looks like this is fixed in Chrome 60.0.3081.0. // Other browsers also don't have this bug, so we prefer to acceptSelection // when possible, to ensure that unfocusing and refocusing a Draft editor // doesn't preserve the selection, matching how textareas work. if (UserAgent.isBrowser('Chrome < 60.0.3081.0')) { editor.update(EditorState.forceSelection(editorState, selection)); } else { editor.update(EditorState.acceptSelection(editorState, selection)); } } module.exports = editOnFocus; /***/ }), /* 94 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule editOnInput * */ 'use strict'; var DraftFeatureFlags = __webpack_require__(40); var DraftModifier = __webpack_require__(4); var DraftOffsetKey = __webpack_require__(19); var EditorState = __webpack_require__(1); var UserAgent = __webpack_require__(8); var findAncestorOffsetKey = __webpack_require__(26); var nullthrows = __webpack_require__(5); var isGecko = UserAgent.isEngine('Gecko'); var DOUBLE_NEWLINE = '\n\n'; /** * This function is intended to handle spellcheck and autocorrect changes, * which occur in the DOM natively without any opportunity to observe or * interpret the changes before they occur. * * The `input` event fires in contentEditable elements reliably for non-IE * browsers, immediately after changes occur to the editor DOM. Since our other * handlers override or otherwise handle cover other varieties of text input, * the DOM state should match the model in all controlled input cases. Thus, * when an `input` change leads to a DOM/model mismatch, the change should be * due to a spellcheck change, and we can incorporate it into our model. */ function editOnInput(editor) { if (editor._pendingStateFromBeforeInput !== undefined) { editor.update(editor._pendingStateFromBeforeInput); editor._pendingStateFromBeforeInput = undefined; } var domSelection = global.getSelection(); var anchorNode = domSelection.anchorNode, isCollapsed = domSelection.isCollapsed; var isNotTextNode = anchorNode.nodeType !== Node.TEXT_NODE; var isNotTextOrElementNode = anchorNode.nodeType !== Node.TEXT_NODE && anchorNode.nodeType !== Node.ELEMENT_NODE; if (DraftFeatureFlags.draft_killswitch_allow_nontextnodes) { if (isNotTextNode) { return; } } else { if (isNotTextOrElementNode) { // TODO: (t16149272) figure out context for this change return; } } if (anchorNode.nodeType === Node.TEXT_NODE && (anchorNode.previousSibling !== null || anchorNode.nextSibling !== null)) { // When typing at the beginning of a visual line, Chrome splits the text // nodes into two. Why? No one knows. This commit is suspicious: // https://chromium.googlesource.com/chromium/src/+/a3b600981286b135632371477f902214c55a1724 // To work around, we'll merge the sibling text nodes back into this one. var span = anchorNode.parentNode; anchorNode.nodeValue = span.textContent; for (var child = span.firstChild; child !== null; child = child.nextSibling) { if (child !== anchorNode) { span.removeChild(child); } } } var domText = anchorNode.textContent; var editorState = editor._latestEditorState; var offsetKey = nullthrows(findAncestorOffsetKey(anchorNode)); var _DraftOffsetKey$decod = DraftOffsetKey.decode(offsetKey), blockKey = _DraftOffsetKey$decod.blockKey, decoratorKey = _DraftOffsetKey$decod.decoratorKey, leafKey = _DraftOffsetKey$decod.leafKey; var _editorState$getBlock = editorState.getBlockTree(blockKey).getIn([decoratorKey, 'leaves', leafKey]), start = _editorState$getBlock.start, end = _editorState$getBlock.end; var content = editorState.getCurrentContent(); var block = content.getBlockForKey(blockKey); var modelText = block.getText().slice(start, end); // Special-case soft newlines here. If the DOM text ends in a soft newline, // we will have manually inserted an extra soft newline in DraftEditorLeaf. // We want to remove this extra newline for the purpose of our comparison // of DOM and model text. if (domText.endsWith(DOUBLE_NEWLINE)) { domText = domText.slice(0, -1); } // No change -- the DOM is up to date. Nothing to do here. if (domText === modelText) { // This can be buggy for some Android keyboards because they don't fire // standard onkeydown/pressed events and only fired editOnInput // so domText is already changed by the browser and ends up being equal // to modelText unexpectedly return; } var selection = editorState.getSelection(); // We'll replace the entire leaf with the text content of the target. var targetRange = selection.merge({ anchorOffset: start, focusOffset: end, isBackward: false }); var entityKey = block.getEntityAt(start); var entity = entityKey && content.getEntity(entityKey); var entityType = entity && entity.getMutability(); var preserveEntity = entityType === 'MUTABLE'; // Immutable or segmented entities cannot properly be handled by the // default browser undo, so we have to use a different change type to // force using our internal undo method instead of falling through to the // native browser undo. var changeType = preserveEntity ? 'spellcheck-change' : 'apply-entity'; var newContent = DraftModifier.replaceText(content, targetRange, domText, block.getInlineStyleAt(start), preserveEntity ? block.getEntityAt(start) : null); var anchorOffset, focusOffset, startOffset, endOffset; if (isGecko) { // Firefox selection does not change while the context menu is open, so // we preserve the anchor and focus values of the DOM selection. anchorOffset = domSelection.anchorOffset; focusOffset = domSelection.focusOffset; startOffset = start + Math.min(anchorOffset, focusOffset); endOffset = startOffset + Math.abs(anchorOffset - focusOffset); anchorOffset = startOffset; focusOffset = endOffset; } else { // Browsers other than Firefox may adjust DOM selection while the context // menu is open, and Safari autocorrect is prone to providing an inaccurate // DOM selection. Don't trust it. Instead, use our existing SelectionState // and adjust it based on the number of characters changed during the // mutation. var charDelta = domText.length - modelText.length; startOffset = selection.getStartOffset(); endOffset = selection.getEndOffset(); anchorOffset = isCollapsed ? endOffset + charDelta : startOffset; focusOffset = endOffset + charDelta; } // Segmented entities are completely or partially removed when their // text content changes. For this case we do not want any text to be selected // after the change, so we are not merging the selection. var contentWithAdjustedDOMSelection = newContent.merge({ selectionBefore: content.getSelectionAfter(), selectionAfter: selection.merge({ anchorOffset: anchorOffset, focusOffset: focusOffset }) }); editor.update(EditorState.push(editorState, contentWithAdjustedDOMSelection, changeType)); } module.exports = editOnInput; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), /* 95 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule editOnKeyDown * */ 'use strict'; var DraftModifier = __webpack_require__(4); var EditorState = __webpack_require__(1); var KeyBindingUtil = __webpack_require__(25); var Keys = __webpack_require__(30); var SecondaryClipboard = __webpack_require__(77); var UserAgent = __webpack_require__(8); var isEventHandled = __webpack_require__(22); var keyCommandBackspaceToStartOfLine = __webpack_require__(108); var keyCommandBackspaceWord = __webpack_require__(109); var keyCommandDeleteWord = __webpack_require__(110); var keyCommandInsertNewline = __webpack_require__(111); var keyCommandMoveSelectionToEndOfBlock = __webpack_require__(112); var keyCommandMoveSelectionToStartOfBlock = __webpack_require__(113); var keyCommandPlainBackspace = __webpack_require__(114); var keyCommandPlainDelete = __webpack_require__(115); var keyCommandTransposeCharacters = __webpack_require__(116); var keyCommandUndo = __webpack_require__(117); var isOptionKeyCommand = KeyBindingUtil.isOptionKeyCommand; var isChrome = UserAgent.isBrowser('Chrome'); /** * Map a `DraftEditorCommand` command value to a corresponding function. */ function onKeyCommand(command, editorState) { switch (command) { case 'redo': return EditorState.redo(editorState); case 'delete': return keyCommandPlainDelete(editorState); case 'delete-word': return keyCommandDeleteWord(editorState); case 'backspace': return keyCommandPlainBackspace(editorState); case 'backspace-word': return keyCommandBackspaceWord(editorState); case 'backspace-to-start-of-line': return keyCommandBackspaceToStartOfLine(editorState); case 'split-block': return keyCommandInsertNewline(editorState); case 'transpose-characters': return keyCommandTransposeCharacters(editorState); case 'move-selection-to-start-of-block': return keyCommandMoveSelectionToStartOfBlock(editorState); case 'move-selection-to-end-of-block': return keyCommandMoveSelectionToEndOfBlock(editorState); case 'secondary-cut': return SecondaryClipboard.cut(editorState); case 'secondary-paste': return SecondaryClipboard.paste(editorState); default: return editorState; } } /** * Intercept keydown behavior to handle keys and commands manually, if desired. * * Keydown combinations may be mapped to `DraftCommand` values, which may * correspond to command functions that modify the editor or its contents. * * See `getDefaultKeyBinding` for defaults. Alternatively, the top-level * component may provide a custom mapping via the `keyBindingFn` prop. */ function editOnKeyDown(editor, e) { var keyCode = e.which; var editorState = editor._latestEditorState; switch (keyCode) { case Keys.RETURN: e.preventDefault(); // The top-level component may manually handle newline insertion. If // no special handling is performed, fall through to command handling. if (editor.props.handleReturn && isEventHandled(editor.props.handleReturn(e, editorState))) { return; } break; case Keys.ESC: e.preventDefault(); editor.props.onEscape && editor.props.onEscape(e); return; case Keys.TAB: editor.props.onTab && editor.props.onTab(e); return; case Keys.UP: editor.props.onUpArrow && editor.props.onUpArrow(e); return; case Keys.DOWN: editor.props.onDownArrow && editor.props.onDownArrow(e); return; case Keys.SPACE: // Handling for OSX where option + space scrolls. if (isChrome && isOptionKeyCommand(e)) { e.preventDefault(); // Insert a nbsp into the editor. var contentState = DraftModifier.replaceText(editorState.getCurrentContent(), editorState.getSelection(), '\xA0'); editor.update(EditorState.push(editorState, contentState, 'insert-characters')); return; } } var command = editor.props.keyBindingFn(e); // If no command is specified, allow keydown event to continue. if (!command) { return; } if (command === 'undo') { // Since undo requires some special updating behavior to keep the editor // in sync, handle it separately. keyCommandUndo(e, editorState, editor.update); return; } // At this point, we know that we're handling a command of some kind, so // we don't want to insert a character following the keydown. e.preventDefault(); // Allow components higher up the tree to handle the command first. if (editor.props.handleKeyCommand && isEventHandled(editor.props.handleKeyCommand(command, editorState))) { return; } var newState = onKeyCommand(command, editorState); if (newState !== editorState) { editor.update(newState); } } module.exports = editOnKeyDown; /***/ }), /* 96 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule editOnPaste * */ 'use strict'; var BlockMapBuilder = __webpack_require__(13); var CharacterMetadata = __webpack_require__(6); var DataTransfer = __webpack_require__(57); var DraftModifier = __webpack_require__(4); var DraftPasteProcessor = __webpack_require__(75); var EditorState = __webpack_require__(1); var RichTextEditorUtil = __webpack_require__(43); var getEntityKeyForSelection = __webpack_require__(27); var getTextContentFromFiles = __webpack_require__(51); var isEventHandled = __webpack_require__(22); var splitTextIntoTextBlocks = __webpack_require__(123); /** * Paste content. */ function editOnPaste(editor, e) { e.preventDefault(); var data = new DataTransfer(e.clipboardData); // Get files, unless this is likely to be a string the user wants inline. if (!data.isRichText()) { var files = data.getFiles(); var defaultFileText = data.getText(); if (files.length > 0) { // Allow customized paste handling for images, etc. Otherwise, fall // through to insert text contents into the editor. if (editor.props.handlePastedFiles && isEventHandled(editor.props.handlePastedFiles(files))) { return; } getTextContentFromFiles(files, function ( /*string*/fileText) { fileText = fileText || defaultFileText; if (!fileText) { return; } var editorState = editor._latestEditorState; var blocks = splitTextIntoTextBlocks(fileText); var character = CharacterMetadata.create({ style: editorState.getCurrentInlineStyle(), entity: getEntityKeyForSelection(editorState.getCurrentContent(), editorState.getSelection()) }); var currentBlockType = RichTextEditorUtil.getCurrentBlockType(editorState); var text = DraftPasteProcessor.processText(blocks, character, currentBlockType); var fragment = BlockMapBuilder.createFromArray(text); var withInsertedText = DraftModifier.replaceWithFragment(editorState.getCurrentContent(), editorState.getSelection(), fragment); editor.update(EditorState.push(editorState, withInsertedText, 'insert-fragment')); }); return; } } var textBlocks = []; var text = data.getText(); var html = data.getHTML(); var editorState = editor._latestEditorState; if (editor.props.handlePastedText && isEventHandled(editor.props.handlePastedText(text, html, editorState))) { return; } if (text) { textBlocks = splitTextIntoTextBlocks(text); } if (!editor.props.stripPastedStyles) { // If the text from the paste event is rich content that matches what we // already have on the internal clipboard, assume that we should just use // the clipboard fragment for the paste. This will allow us to preserve // styling and entities, if any are present. Note that newlines are // stripped during comparison -- this is because copy/paste within the // editor in Firefox and IE will not include empty lines. The resulting // paste will preserve the newlines correctly. var internalClipboard = editor.getClipboard(); if (data.isRichText() && internalClipboard) { if ( // If the editorKey is present in the pasted HTML, it should be safe to // assume this is an internal paste. html.indexOf(editor.getEditorKey()) !== -1 || // The copy may have been made within a single block, in which case the // editor key won't be part of the paste. In this case, just check // whether the pasted text matches the internal clipboard. textBlocks.length === 1 && internalClipboard.size === 1 && internalClipboard.first().getText() === text) { editor.update(insertFragment(editor._latestEditorState, internalClipboard)); return; } } else if (internalClipboard && data.types.includes('com.apple.webarchive') && !data.types.includes('text/html') && areTextBlocksAndClipboardEqual(textBlocks, internalClipboard)) { // Safari does not properly store text/html in some cases. // Use the internalClipboard if present and equal to what is on // the clipboard. See https://bugs.webkit.org/show_bug.cgi?id=19893. editor.update(insertFragment(editor._latestEditorState, internalClipboard)); return; } // If there is html paste data, try to parse that. if (html) { var htmlFragment = DraftPasteProcessor.processHTML(html, editor.props.blockRenderMap); if (htmlFragment) { var contentBlocks = htmlFragment.contentBlocks, entityMap = htmlFragment.entityMap; if (contentBlocks) { var htmlMap = BlockMapBuilder.createFromArray(contentBlocks); editor.update(insertFragment(editor._latestEditorState, htmlMap, entityMap)); return; } } } // Otherwise, create a new fragment from our pasted text. Also // empty the internal clipboard, since it's no longer valid. editor.setClipboard(null); } if (textBlocks.length) { var character = CharacterMetadata.create({ style: editorState.getCurrentInlineStyle(), entity: getEntityKeyForSelection(editorState.getCurrentContent(), editorState.getSelection()) }); var currentBlockType = RichTextEditorUtil.getCurrentBlockType(editorState); var textFragment = DraftPasteProcessor.processText(textBlocks, character, currentBlockType); var textMap = BlockMapBuilder.createFromArray(textFragment); editor.update(insertFragment(editor._latestEditorState, textMap)); } } function insertFragment(editorState, fragment, entityMap) { var newContent = DraftModifier.replaceWithFragment(editorState.getCurrentContent(), editorState.getSelection(), fragment); // TODO: merge the entity map once we stop using DraftEntity // like this: // const mergedEntityMap = newContent.getEntityMap().merge(entityMap); return EditorState.push(editorState, newContent.set('entityMap', entityMap), 'insert-fragment'); } function areTextBlocksAndClipboardEqual(textBlocks, blockMap) { return textBlocks.length === blockMap.size && blockMap.valueSeq().every(function (block, ii) { return block.getText() === textBlocks[ii]; }); } module.exports = editOnPaste; /***/ }), /* 97 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule editOnSelect * */ 'use strict'; var EditorState = __webpack_require__(1); var ReactDOM = __webpack_require__(17); var getDraftEditorSelection = __webpack_require__(102); var invariant = __webpack_require__(2); function editOnSelect(editor) { if (editor._blockSelectEvents || editor._latestEditorState !== editor.props.editorState) { return; } var editorState = editor.props.editorState; var editorNode = ReactDOM.findDOMNode(editor.refs.editorContainer); !editorNode ? true ? invariant(false, 'Missing editorNode') : invariant(false) : void 0; !(editorNode.firstChild instanceof HTMLElement) ? true ? invariant(false, 'editorNode.firstChild is not an HTMLElement') : invariant(false) : void 0; var documentSelection = getDraftEditorSelection(editorState, editorNode.firstChild); var updatedSelectionState = documentSelection.selectionState; if (updatedSelectionState !== editorState.getSelection()) { if (documentSelection.needsRecovery) { editorState = EditorState.forceSelection(editorState, updatedSelectionState); } else { editorState = EditorState.acceptSelection(editorState, updatedSelectionState); } editor.update(editorState); } } module.exports = editOnSelect; /***/ }), /* 98 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule encodeEntityRanges * @typechecks * */ 'use strict'; var DraftStringKey = __webpack_require__(42); var UnicodeUtils = __webpack_require__(10); var strlen = UnicodeUtils.strlen; /** * Convert to UTF-8 character counts for storage. */ function encodeEntityRanges(block, storageMap) { var encoded = []; block.findEntityRanges(function (character) { return !!character.getEntity(); }, function ( /*number*/start, /*number*/end) { var text = block.getText(); var key = block.getEntityAt(start); encoded.push({ offset: strlen(text.slice(0, start)), length: strlen(text.slice(start, end)), // Encode the key as a number for range storage. key: Number(storageMap[DraftStringKey.stringify(key)]) }); }); return encoded; } module.exports = encodeEntityRanges; /***/ }), /* 99 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule encodeInlineStyleRanges * */ 'use strict'; var UnicodeUtils = __webpack_require__(10); var findRangesImmutable = __webpack_require__(20); var areEqual = function areEqual(a, b) { return a === b; }; var isTruthy = function isTruthy(a) { return !!a; }; var EMPTY_ARRAY = []; /** * Helper function for getting encoded styles for each inline style. Convert * to UTF-8 character counts for storage. */ function getEncodedInlinesForType(block, styleList, styleToEncode) { var ranges = []; // Obtain an array with ranges for only the specified style. var filteredInlines = styleList.map(function (style) { return style.has(styleToEncode); }).toList(); findRangesImmutable(filteredInlines, areEqual, // We only want to keep ranges with nonzero style values. isTruthy, function (start, end) { var text = block.getText(); ranges.push({ offset: UnicodeUtils.strlen(text.slice(0, start)), length: UnicodeUtils.strlen(text.slice(start, end)), style: styleToEncode }); }); return ranges; } /* * Retrieve the encoded arrays of inline styles, with each individual style * treated separately. */ function encodeInlineStyleRanges(block) { var styleList = block.getCharacterList().map(function (c) { return c.getStyle(); }).toList(); var ranges = styleList.flatten().toSet().map(function (style) { return getEncodedInlinesForType(block, styleList, style); }); return Array.prototype.concat.apply(EMPTY_ARRAY, ranges.toJS()); } module.exports = encodeInlineStyleRanges; /***/ }), /* 100 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule expandRangeToStartOfLine * @typechecks * */ var UnicodeUtils = __webpack_require__(10); var getRangeClientRects = __webpack_require__(48); var invariant = __webpack_require__(2); /** * Return the computed line height, in pixels, for the provided element. */ function getLineHeightPx(element) { var computed = getComputedStyle(element); var div = document.createElement('div'); div.style.fontFamily = computed.fontFamily; div.style.fontSize = computed.fontSize; div.style.fontStyle = computed.fontStyle; div.style.fontWeight = computed.fontWeight; div.style.lineHeight = computed.lineHeight; div.style.position = 'absolute'; div.textContent = 'M'; var documentBody = document.body; !documentBody ? true ? invariant(false, 'Missing document.body') : invariant(false) : void 0; // forced layout here documentBody.appendChild(div); var rect = div.getBoundingClientRect(); documentBody.removeChild(div); return rect.height; } /** * Return whether every ClientRect in the provided list lies on the same line. * * We assume that the rects on the same line all contain the baseline, so the * lowest top line needs to be above the highest bottom line (i.e., if you were * to project the rects onto the y-axis, their intersection would be nonempty). * * In addition, we require that no two boxes are lineHeight (or more) apart at * either top or bottom, which helps protect against false positives for fonts * with extremely large glyph heights (e.g., with a font size of 17px, Zapfino * produces rects of height 58px!). */ function areRectsOnOneLine(rects, lineHeight) { var minTop = Infinity; var minBottom = Infinity; var maxTop = -Infinity; var maxBottom = -Infinity; for (var ii = 0; ii < rects.length; ii++) { var rect = rects[ii]; if (rect.width === 0 || rect.width === 1) { // When a range starts or ends a soft wrap, many browsers (Chrome, IE, // Safari) include an empty rect on the previous or next line. When the // text lies in a container whose position is not integral (e.g., from // margin: auto), Safari makes these empty rects have width 1 (instead of // 0). Having one-pixel-wide characters seems unlikely (and most browsers // report widths in subpixel precision anyway) so it's relatively safe to // skip over them. continue; } minTop = Math.min(minTop, rect.top); minBottom = Math.min(minBottom, rect.bottom); maxTop = Math.max(maxTop, rect.top); maxBottom = Math.max(maxBottom, rect.bottom); } return maxTop <= minBottom && maxTop - minTop < lineHeight && maxBottom - minBottom < lineHeight; } /** * Return the length of a node, as used by Range offsets. */ function getNodeLength(node) { // http://www.w3.org/TR/dom/#concept-node-length switch (node.nodeType) { case Node.DOCUMENT_TYPE_NODE: return 0; case Node.TEXT_NODE: case Node.PROCESSING_INSTRUCTION_NODE: case Node.COMMENT_NODE: return node.length; default: return node.childNodes.length; } } /** * Given a collapsed range, move the start position backwards as far as * possible while the range still spans only a single line. */ function expandRangeToStartOfLine(range) { !range.collapsed ? true ? invariant(false, 'expandRangeToStartOfLine: Provided range is not collapsed.') : invariant(false) : void 0; range = range.cloneRange(); var containingElement = range.startContainer; if (containingElement.nodeType !== 1) { containingElement = containingElement.parentNode; } var lineHeight = getLineHeightPx(containingElement); // Imagine our text looks like: // <div><span>once upon a time, there was a <em>boy // who lived</em> </span><q><strong>under^ the // stairs</strong> in a small closet.</q></div> // where the caret represents the cursor. First, we crawl up the tree until // the range spans multiple lines (setting the start point to before // "<strong>", then before "<div>"), then at each level we do a search to // find the latest point which is still on a previous line. We'll find that // the break point is inside the span, then inside the <em>, then in its text // node child, the actual break point before "who". var bestContainer = range.endContainer; var bestOffset = range.endOffset; range.setStart(range.startContainer, 0); while (areRectsOnOneLine(getRangeClientRects(range), lineHeight)) { bestContainer = range.startContainer; bestOffset = range.startOffset; !bestContainer.parentNode ? true ? invariant(false, 'Found unexpected detached subtree when traversing.') : invariant(false) : void 0; range.setStartBefore(bestContainer); if (bestContainer.nodeType === 1 && getComputedStyle(bestContainer).display !== 'inline') { // The start of the line is never in a different block-level container. break; } } // In the above example, range now spans from "<div>" to "under", // bestContainer is <div>, and bestOffset is 1 (index of <q> inside <div>)]. // Picking out which child to recurse into here is a special case since we // don't want to check past <q> -- once we find that the final range starts // in <span>, we can look at all of its children (and all of their children) // to find the break point. // At all times, (bestContainer, bestOffset) is the latest single-line start // point that we know of. var currentContainer = bestContainer; var maxIndexToConsider = bestOffset - 1; do { var nodeValue = currentContainer.nodeValue; for (var ii = maxIndexToConsider; ii >= 0; ii--) { if (nodeValue != null && ii > 0 && UnicodeUtils.isSurrogatePair(nodeValue, ii - 1)) { // We're in the middle of a surrogate pair -- skip over so we never // return a range with an endpoint in the middle of a code point. continue; } range.setStart(currentContainer, ii); if (areRectsOnOneLine(getRangeClientRects(range), lineHeight)) { bestContainer = currentContainer; bestOffset = ii; } else { break; } } if (ii === -1 || currentContainer.childNodes.length === 0) { // If ii === -1, then (bestContainer, bestOffset), which is equal to // (currentContainer, 0), was a single-line start point but a start // point before currentContainer wasn't, so the line break seems to // have occurred immediately after currentContainer's start tag // // If currentContainer.childNodes.length === 0, we're already at a // terminal node (e.g., text node) and should return our current best. break; } currentContainer = currentContainer.childNodes[ii]; maxIndexToConsider = getNodeLength(currentContainer); } while (true); range.setStart(bestContainer, bestOffset); return range; } module.exports = expandRangeToStartOfLine; /***/ }), /* 101 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getCharacterRemovalRange * @typechecks * */ 'use strict'; var DraftEntitySegments = __webpack_require__(72); var getRangesForDraftEntity = __webpack_require__(104); var invariant = __webpack_require__(2); /** * Given a SelectionState and a removal direction, determine the entire range * that should be removed from a ContentState. This is based on any entities * within the target, with their `mutability` values taken into account. * * For instance, if we are attempting to remove part of an "immutable" entity * range, the entire entity must be removed. The returned `SelectionState` * will be adjusted accordingly. */ function getCharacterRemovalRange(entityMap, startBlock, endBlock, selectionState, direction) { var start = selectionState.getStartOffset(); var end = selectionState.getEndOffset(); var startEntityKey = startBlock.getEntityAt(start); var endEntityKey = endBlock.getEntityAt(end - 1); if (!startEntityKey && !endEntityKey) { return selectionState; } var newSelectionState = selectionState; if (startEntityKey && startEntityKey === endEntityKey) { newSelectionState = getEntityRemovalRange(entityMap, startBlock, newSelectionState, direction, startEntityKey, true, true); } else if (startEntityKey && endEntityKey) { var startSelectionState = getEntityRemovalRange(entityMap, startBlock, newSelectionState, direction, startEntityKey, false, true); var endSelectionState = getEntityRemovalRange(entityMap, endBlock, newSelectionState, direction, endEntityKey, false, false); newSelectionState = newSelectionState.merge({ anchorOffset: startSelectionState.getAnchorOffset(), focusOffset: endSelectionState.getFocusOffset(), isBackward: false }); } else if (startEntityKey) { var _startSelectionState = getEntityRemovalRange(entityMap, startBlock, newSelectionState, direction, startEntityKey, false, true); newSelectionState = newSelectionState.merge({ anchorOffset: _startSelectionState.getStartOffset(), isBackward: false }); } else if (endEntityKey) { var _endSelectionState = getEntityRemovalRange(entityMap, endBlock, newSelectionState, direction, endEntityKey, false, false); newSelectionState = newSelectionState.merge({ focusOffset: _endSelectionState.getEndOffset(), isBackward: false }); } return newSelectionState; } function getEntityRemovalRange(entityMap, block, selectionState, direction, entityKey, isEntireSelectionWithinEntity, isEntityAtStart) { var start = selectionState.getStartOffset(); var end = selectionState.getEndOffset(); var entity = entityMap.__get(entityKey); var mutability = entity.getMutability(); var sideToConsider = isEntityAtStart ? start : end; // `MUTABLE` entities can just have the specified range of text removed // directly. No adjustments are needed. if (mutability === 'MUTABLE') { return selectionState; } // Find the entity range that overlaps with our removal range. var entityRanges = getRangesForDraftEntity(block, entityKey).filter(function (range) { return sideToConsider <= range.end && sideToConsider >= range.start; }); !(entityRanges.length == 1) ? true ? invariant(false, 'There should only be one entity range within this removal range.') : invariant(false) : void 0; var entityRange = entityRanges[0]; // For `IMMUTABLE` entity types, we will remove the entire entity range. if (mutability === 'IMMUTABLE') { return selectionState.merge({ anchorOffset: entityRange.start, focusOffset: entityRange.end, isBackward: false }); } // For `SEGMENTED` entity types, determine the appropriate segment to // remove. if (!isEntireSelectionWithinEntity) { if (isEntityAtStart) { end = entityRange.end; } else { start = entityRange.start; } } var removalRange = DraftEntitySegments.getRemovalRange(start, end, block.getText().slice(entityRange.start, entityRange.end), entityRange.start, direction); return selectionState.merge({ anchorOffset: removalRange.start, focusOffset: removalRange.end, isBackward: false }); } module.exports = getCharacterRemovalRange; /***/ }), /* 102 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getDraftEditorSelection * @typechecks * */ 'use strict'; var getDraftEditorSelectionWithNodes = __webpack_require__(46); /** * Convert the current selection range to an anchor/focus pair of offset keys * and values that can be interpreted by components. */ function getDraftEditorSelection(editorState, root) { var selection = global.getSelection(); // No active selection. if (selection.rangeCount === 0) { return { selectionState: editorState.getSelection().set('hasFocus', false), needsRecovery: false }; } return getDraftEditorSelectionWithNodes(editorState, root, selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset); } module.exports = getDraftEditorSelection; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), /* 103 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getRangeBoundingClientRect * @typechecks * */ 'use strict'; var getRangeClientRects = __webpack_require__(48); /** * Like range.getBoundingClientRect() but normalizes for browser bugs. */ function getRangeBoundingClientRect(range) { // "Return a DOMRect object describing the smallest rectangle that includes // the first rectangle in list and all of the remaining rectangles of which // the height or width is not zero." // http://www.w3.org/TR/cssom-view/#dom-range-getboundingclientrect var rects = getRangeClientRects(range); var top = 0; var right = 0; var bottom = 0; var left = 0; if (rects.length) { // If the first rectangle has 0 width, we use the second, this is needed // because Chrome renders a 0 width rectangle when the selection contains // a line break. if (rects.length > 1 && rects[0].width === 0) { var _rects$ = rects[1]; top = _rects$.top; right = _rects$.right; bottom = _rects$.bottom; left = _rects$.left; } else { var _rects$2 = rects[0]; top = _rects$2.top; right = _rects$2.right; bottom = _rects$2.bottom; left = _rects$2.left; } for (var ii = 1; ii < rects.length; ii++) { var rect = rects[ii]; if (rect.height !== 0 && rect.width !== 0) { top = Math.min(top, rect.top); right = Math.max(right, rect.right); bottom = Math.max(bottom, rect.bottom); left = Math.min(left, rect.left); } } } return { top: top, right: right, bottom: bottom, left: left, width: right - left, height: bottom - top }; } module.exports = getRangeBoundingClientRect; /***/ }), /* 104 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getRangesForDraftEntity * @typechecks * */ 'use strict'; var invariant = __webpack_require__(2); /** * Obtain the start and end positions of the range that has the * specified entity applied to it. * * Entity keys are applied only to contiguous stretches of text, so this * method searches for the first instance of the entity key and returns * the subsequent range. */ function getRangesForDraftEntity(block, key) { var ranges = []; block.findEntityRanges(function (c) { return c.getEntity() === key; }, function (start, end) { ranges.push({ start: start, end: end }); }); !!!ranges.length ? true ? invariant(false, 'Entity key not found in this range.') : invariant(false) : void 0; return ranges; } module.exports = getRangesForDraftEntity; /***/ }), /* 105 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule getVisibleSelectionRect * @typechecks * */ 'use strict'; var getRangeBoundingClientRect = __webpack_require__(103); /** * Return the bounding ClientRect for the visible DOM selection, if any. * In cases where there are no selected ranges or the bounding rect is * temporarily invalid, return null. */ function getVisibleSelectionRect(global) { var selection = global.getSelection(); if (!selection.rangeCount) { return null; } var range = selection.getRangeAt(0); var boundingRect = getRangeBoundingClientRect(range); var top = boundingRect.top, right = boundingRect.right, bottom = boundingRect.bottom, left = boundingRect.left; // When a re-render leads to a node being removed, the DOM selection will // temporarily be placed on an ancestor node, which leads to an invalid // bounding rect. Discard this state. if (top === 0 && right === 0 && bottom === 0 && left === 0) { return null; } return boundingRect; } module.exports = getVisibleSelectionRect; /***/ }), /* 106 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule insertFragmentIntoContentState * @typechecks * */ 'use strict'; var BlockMapBuilder = __webpack_require__(13); var generateRandomKey = __webpack_require__(7); var insertIntoList = __webpack_require__(53); var invariant = __webpack_require__(2); function insertFragmentIntoContentState(contentState, selectionState, fragment) { !selectionState.isCollapsed() ? true ? invariant(false, '`insertFragment` should only be called with a collapsed selection state.') : invariant(false) : void 0; var targetKey = selectionState.getStartKey(); var targetOffset = selectionState.getStartOffset(); var blockMap = contentState.getBlockMap(); var fragmentSize = fragment.size; var finalKey; var finalOffset; if (fragmentSize === 1) { var targetBlock = blockMap.get(targetKey); var pastedBlock = fragment.first(); var text = targetBlock.getText(); var chars = targetBlock.getCharacterList(); var newBlock = targetBlock.merge({ text: text.slice(0, targetOffset) + pastedBlock.getText() + text.slice(targetOffset), characterList: insertIntoList(chars, pastedBlock.getCharacterList(), targetOffset), data: pastedBlock.getData() }); blockMap = blockMap.set(targetKey, newBlock); finalKey = targetKey; finalOffset = targetOffset + pastedBlock.getText().length; return contentState.merge({ blockMap: blockMap.set(targetKey, newBlock), selectionBefore: selectionState, selectionAfter: selectionState.merge({ anchorKey: finalKey, anchorOffset: finalOffset, focusKey: finalKey, focusOffset: finalOffset, isBackward: false }) }); } var newBlockArr = []; contentState.getBlockMap().forEach(function (block, blockKey) { if (blockKey !== targetKey) { newBlockArr.push(block); return; } var text = block.getText(); var chars = block.getCharacterList(); // Modify head portion of block. var blockSize = text.length; var headText = text.slice(0, targetOffset); var headCharacters = chars.slice(0, targetOffset); var appendToHead = fragment.first(); var modifiedHead = block.merge({ text: headText + appendToHead.getText(), characterList: headCharacters.concat(appendToHead.getCharacterList()), type: headText ? block.getType() : appendToHead.getType(), data: appendToHead.getData() }); newBlockArr.push(modifiedHead); // Insert fragment blocks after the head and before the tail. fragment.slice(1, fragmentSize - 1).forEach(function (fragmentBlock) { newBlockArr.push(fragmentBlock.set('key', generateRandomKey())); }); // Modify tail portion of block. var tailText = text.slice(targetOffset, blockSize); var tailCharacters = chars.slice(targetOffset, blockSize); var prependToTail = fragment.last(); finalKey = generateRandomKey(); var modifiedTail = prependToTail.merge({ key: finalKey, text: prependToTail.getText() + tailText, characterList: prependToTail.getCharacterList().concat(tailCharacters), data: prependToTail.getData() }); newBlockArr.push(modifiedTail); }); finalOffset = fragment.last().getLength(); return contentState.merge({ blockMap: BlockMapBuilder.createFromArray(newBlockArr), selectionBefore: selectionState, selectionAfter: selectionState.merge({ anchorKey: finalKey, anchorOffset: finalOffset, focusKey: finalKey, focusOffset: finalOffset, isBackward: false }) }); } module.exports = insertFragmentIntoContentState; /***/ }), /* 107 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule insertTextIntoContentState * @typechecks * */ 'use strict'; var Immutable = __webpack_require__(3); var insertIntoList = __webpack_require__(53); var invariant = __webpack_require__(2); var Repeat = Immutable.Repeat; function insertTextIntoContentState(contentState, selectionState, text, characterMetadata) { !selectionState.isCollapsed() ? true ? invariant(false, '`insertText` should only be called with a collapsed range.') : invariant(false) : void 0; var len = text.length; if (!len) { return contentState; } var blockMap = contentState.getBlockMap(); var key = selectionState.getStartKey(); var offset = selectionState.getStartOffset(); var block = blockMap.get(key); var blockText = block.getText(); var newBlock = block.merge({ text: blockText.slice(0, offset) + text + blockText.slice(offset, block.getLength()), characterList: insertIntoList(block.getCharacterList(), Repeat(characterMetadata, len).toList(), offset) }); var newOffset = offset + len; return contentState.merge({ blockMap: blockMap.set(key, newBlock), selectionAfter: selectionState.merge({ anchorOffset: newOffset, focusOffset: newOffset }) }); } module.exports = insertTextIntoContentState; /***/ }), /* 108 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyCommandBackspaceToStartOfLine * */ 'use strict'; var EditorState = __webpack_require__(1); var expandRangeToStartOfLine = __webpack_require__(100); var getDraftEditorSelectionWithNodes = __webpack_require__(46); var moveSelectionBackward = __webpack_require__(28); var removeTextWithStrategy = __webpack_require__(15); function keyCommandBackspaceToStartOfLine(editorState) { var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) { var selection = strategyState.getSelection(); if (selection.isCollapsed() && selection.getAnchorOffset() === 0) { return moveSelectionBackward(strategyState, 1); } var domSelection = global.getSelection(); var range = domSelection.getRangeAt(0); range = expandRangeToStartOfLine(range); return getDraftEditorSelectionWithNodes(strategyState, null, range.endContainer, range.endOffset, range.startContainer, range.startOffset).selectionState; }, 'backward'); if (afterRemoval === editorState.getCurrentContent()) { return editorState; } return EditorState.push(editorState, afterRemoval, 'remove-range'); } module.exports = keyCommandBackspaceToStartOfLine; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), /* 109 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyCommandBackspaceWord * */ 'use strict'; var DraftRemovableWord = __webpack_require__(41); var EditorState = __webpack_require__(1); var moveSelectionBackward = __webpack_require__(28); var removeTextWithStrategy = __webpack_require__(15); /** * Delete the word that is left of the cursor, as well as any spaces or * punctuation after the word. */ function keyCommandBackspaceWord(editorState) { var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) { var selection = strategyState.getSelection(); var offset = selection.getStartOffset(); // If there are no words before the cursor, remove the preceding newline. if (offset === 0) { return moveSelectionBackward(strategyState, 1); } var key = selection.getStartKey(); var content = strategyState.getCurrentContent(); var text = content.getBlockForKey(key).getText().slice(0, offset); var toRemove = DraftRemovableWord.getBackward(text); return moveSelectionBackward(strategyState, toRemove.length || 1); }, 'backward'); if (afterRemoval === editorState.getCurrentContent()) { return editorState; } return EditorState.push(editorState, afterRemoval, 'remove-range'); } module.exports = keyCommandBackspaceWord; /***/ }), /* 110 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyCommandDeleteWord * */ 'use strict'; var DraftRemovableWord = __webpack_require__(41); var EditorState = __webpack_require__(1); var moveSelectionForward = __webpack_require__(55); var removeTextWithStrategy = __webpack_require__(15); /** * Delete the word that is right of the cursor, as well as any spaces or * punctuation before the word. */ function keyCommandDeleteWord(editorState) { var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) { var selection = strategyState.getSelection(); var offset = selection.getStartOffset(); var key = selection.getStartKey(); var content = strategyState.getCurrentContent(); var text = content.getBlockForKey(key).getText().slice(offset); var toRemove = DraftRemovableWord.getForward(text); // If there are no words in front of the cursor, remove the newline. return moveSelectionForward(strategyState, toRemove.length || 1); }, 'forward'); if (afterRemoval === editorState.getCurrentContent()) { return editorState; } return EditorState.push(editorState, afterRemoval, 'remove-range'); } module.exports = keyCommandDeleteWord; /***/ }), /* 111 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyCommandInsertNewline * */ 'use strict'; var DraftModifier = __webpack_require__(4); var EditorState = __webpack_require__(1); function keyCommandInsertNewline(editorState) { var contentState = DraftModifier.splitBlock(editorState.getCurrentContent(), editorState.getSelection()); return EditorState.push(editorState, contentState, 'split-block'); } module.exports = keyCommandInsertNewline; /***/ }), /* 112 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyCommandMoveSelectionToEndOfBlock * */ 'use strict'; var EditorState = __webpack_require__(1); /** * See comment for `moveSelectionToStartOfBlock`. */ function keyCommandMoveSelectionToEndOfBlock(editorState) { var selection = editorState.getSelection(); var endKey = selection.getEndKey(); var content = editorState.getCurrentContent(); var textLength = content.getBlockForKey(endKey).getLength(); return EditorState.set(editorState, { selection: selection.merge({ anchorKey: endKey, anchorOffset: textLength, focusKey: endKey, focusOffset: textLength, isBackward: false }), forceSelection: true }); } module.exports = keyCommandMoveSelectionToEndOfBlock; /***/ }), /* 113 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyCommandMoveSelectionToStartOfBlock * */ 'use strict'; var EditorState = __webpack_require__(1); /** * Collapse selection at the start of the first selected block. This is used * for Firefox versions that attempt to navigate forward/backward instead of * moving the cursor. Other browsers are able to move the cursor natively. */ function keyCommandMoveSelectionToStartOfBlock(editorState) { var selection = editorState.getSelection(); var startKey = selection.getStartKey(); return EditorState.set(editorState, { selection: selection.merge({ anchorKey: startKey, anchorOffset: 0, focusKey: startKey, focusOffset: 0, isBackward: false }), forceSelection: true }); } module.exports = keyCommandMoveSelectionToStartOfBlock; /***/ }), /* 114 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyCommandPlainBackspace * */ 'use strict'; var EditorState = __webpack_require__(1); var UnicodeUtils = __webpack_require__(10); var moveSelectionBackward = __webpack_require__(28); var removeTextWithStrategy = __webpack_require__(15); /** * Remove the selected range. If the cursor is collapsed, remove the preceding * character. This operation is Unicode-aware, so removing a single character * will remove a surrogate pair properly as well. */ function keyCommandPlainBackspace(editorState) { var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) { var selection = strategyState.getSelection(); var content = strategyState.getCurrentContent(); var key = selection.getAnchorKey(); var offset = selection.getAnchorOffset(); var charBehind = content.getBlockForKey(key).getText()[offset - 1]; return moveSelectionBackward(strategyState, charBehind ? UnicodeUtils.getUTF16Length(charBehind, 0) : 1); }, 'backward'); if (afterRemoval === editorState.getCurrentContent()) { return editorState; } var selection = editorState.getSelection(); return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'backspace-character' : 'remove-range'); } module.exports = keyCommandPlainBackspace; /***/ }), /* 115 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyCommandPlainDelete * */ 'use strict'; var EditorState = __webpack_require__(1); var UnicodeUtils = __webpack_require__(10); var moveSelectionForward = __webpack_require__(55); var removeTextWithStrategy = __webpack_require__(15); /** * Remove the selected range. If the cursor is collapsed, remove the following * character. This operation is Unicode-aware, so removing a single character * will remove a surrogate pair properly as well. */ function keyCommandPlainDelete(editorState) { var afterRemoval = removeTextWithStrategy(editorState, function (strategyState) { var selection = strategyState.getSelection(); var content = strategyState.getCurrentContent(); var key = selection.getAnchorKey(); var offset = selection.getAnchorOffset(); var charAhead = content.getBlockForKey(key).getText()[offset]; return moveSelectionForward(strategyState, charAhead ? UnicodeUtils.getUTF16Length(charAhead, 0) : 1); }, 'forward'); if (afterRemoval === editorState.getCurrentContent()) { return editorState; } var selection = editorState.getSelection(); return EditorState.push(editorState, afterRemoval.set('selectionBefore', selection), selection.isCollapsed() ? 'delete-character' : 'remove-range'); } module.exports = keyCommandPlainDelete; /***/ }), /* 116 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyCommandTransposeCharacters * */ 'use strict'; var DraftModifier = __webpack_require__(4); var EditorState = __webpack_require__(1); var getContentStateFragment = __webpack_require__(21); /** * Transpose the characters on either side of a collapsed cursor, or * if the cursor is at the end of the block, transpose the last two * characters. */ function keyCommandTransposeCharacters(editorState) { var selection = editorState.getSelection(); if (!selection.isCollapsed()) { return editorState; } var offset = selection.getAnchorOffset(); if (offset === 0) { return editorState; } var blockKey = selection.getAnchorKey(); var content = editorState.getCurrentContent(); var block = content.getBlockForKey(blockKey); var length = block.getLength(); // Nothing to transpose if there aren't two characters. if (length <= 1) { return editorState; } var removalRange; var finalSelection; if (offset === length) { // The cursor is at the end of the block. Swap the last two characters. removalRange = selection.set('anchorOffset', offset - 1); finalSelection = selection; } else { removalRange = selection.set('focusOffset', offset + 1); finalSelection = removalRange.set('anchorOffset', offset + 1); } // Extract the character to move as a fragment. This preserves its // styling and entity, if any. var movedFragment = getContentStateFragment(content, removalRange); var afterRemoval = DraftModifier.removeRange(content, removalRange, 'backward'); // After the removal, the insertion target is one character back. var selectionAfter = afterRemoval.getSelectionAfter(); var targetOffset = selectionAfter.getAnchorOffset() - 1; var targetRange = selectionAfter.merge({ anchorOffset: targetOffset, focusOffset: targetOffset }); var afterInsert = DraftModifier.replaceWithFragment(afterRemoval, targetRange, movedFragment); var newEditorState = EditorState.push(editorState, afterInsert, 'insert-fragment'); return EditorState.acceptSelection(newEditorState, finalSelection); } module.exports = keyCommandTransposeCharacters; /***/ }), /* 117 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule keyCommandUndo * */ 'use strict'; var EditorState = __webpack_require__(1); function keyCommandUndo(e, editorState, updateFn) { var undoneState = EditorState.undo(editorState); // If the last change to occur was a spellcheck change, allow the undo // event to fall through to the browser. This allows the browser to record // the unwanted change, which should soon lead it to learn not to suggest // the correction again. if (editorState.getLastChangeType() === 'spellcheck-change') { var nativelyRenderedContent = undoneState.getCurrentContent(); updateFn(EditorState.set(undoneState, { nativelyRenderedContent: nativelyRenderedContent })); return; } // Otheriwse, manage the undo behavior manually. e.preventDefault(); if (!editorState.getNativelyRenderedContent()) { updateFn(undoneState); return; } // Trigger a re-render with the current content state to ensure that the // component tree has up-to-date props for comparison. updateFn(EditorState.set(editorState, { nativelyRenderedContent: null })); // Wait to ensure that the re-render has occurred before performing // the undo action. setTimeout(function () { updateFn(undoneState); }, 0); } module.exports = keyCommandUndo; /***/ }), /* 118 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule modifyBlockForContentState * @typechecks * */ 'use strict'; var Immutable = __webpack_require__(3); var Map = Immutable.Map; function modifyBlockForContentState(contentState, selectionState, operation) { var startKey = selectionState.getStartKey(); var endKey = selectionState.getEndKey(); var blockMap = contentState.getBlockMap(); var newBlocks = blockMap.toSeq().skipUntil(function (_, k) { return k === startKey; }).takeUntil(function (_, k) { return k === endKey; }).concat(Map([[endKey, blockMap.get(endKey)]])).map(operation); return contentState.merge({ blockMap: blockMap.merge(newBlocks), selectionBefore: selectionState, selectionAfter: selectionState }); } module.exports = modifyBlockForContentState; /***/ }), /* 119 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule moveBlockInContentState * @typechecks * */ 'use strict'; var invariant = __webpack_require__(2); function moveBlockInContentState(contentState, blockToBeMoved, targetBlock, insertionMode) { !(blockToBeMoved.getKey() !== targetBlock.getKey()) ? true ? invariant(false, 'Block cannot be moved next to itself.') : invariant(false) : void 0; !(insertionMode !== 'replace') ? true ? invariant(false, 'Replacing blocks is not supported.') : invariant(false) : void 0; var targetKey = targetBlock.getKey(); var blockBefore = contentState.getBlockBefore(targetKey); var blockAfter = contentState.getBlockAfter(targetKey); var blockMap = contentState.getBlockMap(); var blockMapWithoutBlockToBeMoved = blockMap['delete'](blockToBeMoved.getKey()); var blocksBefore = blockMapWithoutBlockToBeMoved.toSeq().takeUntil(function (v) { return v === targetBlock; }); var blocksAfter = blockMapWithoutBlockToBeMoved.toSeq().skipUntil(function (v) { return v === targetBlock; }).skip(1); var newBlocks = void 0; if (insertionMode === 'before') { !(!blockBefore || blockBefore.getKey() !== blockToBeMoved.getKey()) ? true ? invariant(false, 'Block cannot be moved next to itself.') : invariant(false) : void 0; newBlocks = blocksBefore.concat([[blockToBeMoved.getKey(), blockToBeMoved], [targetBlock.getKey(), targetBlock]], blocksAfter).toOrderedMap(); } else if (insertionMode === 'after') { !(!blockAfter || blockAfter.getKey() !== blockToBeMoved.getKey()) ? true ? invariant(false, 'Block cannot be moved next to itself.') : invariant(false) : void 0; newBlocks = blocksBefore.concat([[targetBlock.getKey(), targetBlock], [blockToBeMoved.getKey(), blockToBeMoved]], blocksAfter).toOrderedMap(); } return contentState.merge({ blockMap: newBlocks, selectionBefore: contentState.getSelectionAfter(), selectionAfter: contentState.getSelectionAfter().merge({ anchorKey: blockToBeMoved.getKey(), focusKey: blockToBeMoved.getKey() }) }); } module.exports = moveBlockInContentState; /***/ }), /* 120 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule removeRangeFromContentState * */ 'use strict'; var Immutable = __webpack_require__(3); function removeRangeFromContentState(contentState, selectionState) { if (selectionState.isCollapsed()) { return contentState; } var blockMap = contentState.getBlockMap(); var startKey = selectionState.getStartKey(); var startOffset = selectionState.getStartOffset(); var endKey = selectionState.getEndKey(); var endOffset = selectionState.getEndOffset(); var startBlock = blockMap.get(startKey); var endBlock = blockMap.get(endKey); var characterList; if (startBlock === endBlock) { characterList = removeFromList(startBlock.getCharacterList(), startOffset, endOffset); } else { characterList = startBlock.getCharacterList().slice(0, startOffset).concat(endBlock.getCharacterList().slice(endOffset)); } var modifiedStart = startBlock.merge({ text: startBlock.getText().slice(0, startOffset) + endBlock.getText().slice(endOffset), characterList: characterList }); var newBlocks = blockMap.toSeq().skipUntil(function (_, k) { return k === startKey; }).takeUntil(function (_, k) { return k === endKey; }).concat(Immutable.Map([[endKey, null]])).map(function (_, k) { return k === startKey ? modifiedStart : null; }); blockMap = blockMap.merge(newBlocks).filter(function (block) { return !!block; }); return contentState.merge({ blockMap: blockMap, selectionBefore: selectionState, selectionAfter: selectionState.merge({ anchorKey: startKey, anchorOffset: startOffset, focusKey: startKey, focusOffset: startOffset, isBackward: false }) }); } /** * Maintain persistence for target list when removing characters on the * head and tail of the character list. */ function removeFromList(targetList, startOffset, endOffset) { if (startOffset === 0) { while (startOffset < endOffset) { targetList = targetList.shift(); startOffset++; } } else if (endOffset === targetList.count()) { while (endOffset > startOffset) { targetList = targetList.pop(); endOffset--; } } else { var head = targetList.slice(0, startOffset); var tail = targetList.slice(endOffset); targetList = head.concat(tail).toList(); } return targetList; } module.exports = removeRangeFromContentState; /***/ }), /* 121 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule setDraftEditorSelection * @typechecks * @format * */ 'use strict'; var DraftJsDebugLogging = __webpack_require__(74); var containsNode = __webpack_require__(33); var getActiveElement = __webpack_require__(60); var invariant = __webpack_require__(2); function getAnonymizedDOM(node, getNodeLabels) { if (!node) { return '[empty]'; } var anonymized = anonymizeTextWithin(node, getNodeLabels); if (anonymized.nodeType === Node.TEXT_NODE) { return anonymized.textContent; } !(anonymized instanceof Element) ? true ? invariant(false, 'Node must be an Element if it is not a text node.') : invariant(false) : void 0; return anonymized.outerHTML; } function anonymizeTextWithin(node, getNodeLabels) { var labels = getNodeLabels !== undefined ? getNodeLabels(node) : []; if (node.nodeType === Node.TEXT_NODE) { var length = node.textContent.length; return document.createTextNode('[text ' + length + (labels.length ? ' | ' + labels.join(', ') : '') + ']'); } var clone = node.cloneNode(); if (clone.nodeType === 1 && labels.length) { clone.setAttribute('data-labels', labels.join(', ')); } var childNodes = node.childNodes; for (var ii = 0; ii < childNodes.length; ii++) { clone.appendChild(anonymizeTextWithin(childNodes[ii], getNodeLabels)); } return clone; } function getAnonymizedEditorDOM(node, getNodeLabels) { // grabbing the DOM content of the Draft editor var currentNode = node; while (currentNode) { if (currentNode instanceof Element && currentNode.hasAttribute('contenteditable')) { // found the Draft editor container return getAnonymizedDOM(currentNode, getNodeLabels); } else { currentNode = currentNode.parentNode; } } return 'Could not find contentEditable parent of node'; } function getNodeLength(node) { return node.nodeValue === null ? node.childNodes.length : node.nodeValue.length; } /** * In modern non-IE browsers, we can support both forward and backward * selections. * * Note: IE10+ supports the Selection object, but it does not support * the `extend` method, which means that even in modern IE, it's not possible * to programatically create a backward selection. Thus, for all IE * versions, we use the old IE API to create our selections. */ function setDraftEditorSelection(selectionState, node, blockKey, nodeStart, nodeEnd) { // It's possible that the editor has been removed from the DOM but // our selection code doesn't know it yet. Forcing selection in // this case may lead to errors, so just bail now. if (!containsNode(document.documentElement, node)) { return; } var selection = global.getSelection(); var anchorKey = selectionState.getAnchorKey(); var anchorOffset = selectionState.getAnchorOffset(); var focusKey = selectionState.getFocusKey(); var focusOffset = selectionState.getFocusOffset(); var isBackward = selectionState.getIsBackward(); // IE doesn't support backward selection. Swap key/offset pairs. if (!selection.extend && isBackward) { var tempKey = anchorKey; var tempOffset = anchorOffset; anchorKey = focusKey; anchorOffset = focusOffset; focusKey = tempKey; focusOffset = tempOffset; isBackward = false; } var hasAnchor = anchorKey === blockKey && nodeStart <= anchorOffset && nodeEnd >= anchorOffset; var hasFocus = focusKey === blockKey && nodeStart <= focusOffset && nodeEnd >= focusOffset; // If the selection is entirely bound within this node, set the selection // and be done. if (hasAnchor && hasFocus) { selection.removeAllRanges(); addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState); addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState); return; } if (!isBackward) { // If the anchor is within this node, set the range start. if (hasAnchor) { selection.removeAllRanges(); addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState); } // If the focus is within this node, we can assume that we have // already set the appropriate start range on the selection, and // can simply extend the selection. if (hasFocus) { addFocusToSelection(selection, node, focusOffset - nodeStart, selectionState); } } else { // If this node has the focus, set the selection range to be a // collapsed range beginning here. Later, when we encounter the anchor, // we'll use this information to extend the selection. if (hasFocus) { selection.removeAllRanges(); addPointToSelection(selection, node, focusOffset - nodeStart, selectionState); } // If this node has the anchor, we may assume that the correct // focus information is already stored on the selection object. // We keep track of it, reset the selection range, and extend it // back to the focus point. if (hasAnchor) { var storedFocusNode = selection.focusNode; var storedFocusOffset = selection.focusOffset; selection.removeAllRanges(); addPointToSelection(selection, node, anchorOffset - nodeStart, selectionState); addFocusToSelection(selection, storedFocusNode, storedFocusOffset, selectionState); } } } /** * Extend selection towards focus point. */ function addFocusToSelection(selection, node, offset, selectionState) { var activeElement = getActiveElement(); if (selection.extend && containsNode(activeElement, node)) { // If `extend` is called while another element has focus, an error is // thrown. We therefore disable `extend` if the active element is somewhere // other than the node we are selecting. This should only occur in Firefox, // since it is the only browser to support multiple selections. // See https://bugzilla.mozilla.org/show_bug.cgi?id=921444. // logging to catch bug that is being reported in t16250795 if (offset > getNodeLength(node)) { // the call to 'selection.extend' is about to throw DraftJsDebugLogging.logSelectionStateFailure({ anonymizedDom: getAnonymizedEditorDOM(node), extraParams: JSON.stringify({ offset: offset }), selectionState: JSON.stringify(selectionState.toJS()) }); } // logging to catch bug that is being reported in t18110632 var nodeWasFocus = node === selection.focusNode; try { selection.extend(node, offset); } catch (e) { DraftJsDebugLogging.logSelectionStateFailure({ anonymizedDom: getAnonymizedEditorDOM(node, function (n) { var labels = []; if (n === activeElement) { labels.push('active element'); } if (n === selection.anchorNode) { labels.push('selection anchor node'); } if (n === selection.focusNode) { labels.push('selection focus node'); } return labels; }), extraParams: JSON.stringify({ activeElementName: activeElement ? activeElement.nodeName : null, nodeIsFocus: node === selection.focusNode, nodeWasFocus: nodeWasFocus, selectionRangeCount: selection.rangeCount, selectionAnchorNodeName: selection.anchorNode ? selection.anchorNode.nodeName : null, selectionAnchorOffset: selection.anchorOffset, selectionFocusNodeName: selection.focusNode ? selection.focusNode.nodeName : null, selectionFocusOffset: selection.focusOffset, message: e ? '' + e : null, offset: offset }, null, 2), selectionState: JSON.stringify(selectionState.toJS(), null, 2) }); // allow the error to be thrown - // better than continuing in a broken state throw e; } } else { // IE doesn't support extend. This will mean no backward selection. // Extract the existing selection range and add focus to it. // Additionally, clone the selection range. IE11 throws an // InvalidStateError when attempting to access selection properties // after the range is detached. var range = selection.getRangeAt(0); range.setEnd(node, offset); selection.addRange(range.cloneRange()); } } function addPointToSelection(selection, node, offset, selectionState) { var range = document.createRange(); // logging to catch bug that is being reported in t16250795 if (offset > getNodeLength(node)) { // in this case we know that the call to 'range.setStart' is about to throw DraftJsDebugLogging.logSelectionStateFailure({ anonymizedDom: getAnonymizedEditorDOM(node), extraParams: JSON.stringify({ offset: offset }), selectionState: JSON.stringify(selectionState.toJS()) }); } range.setStart(node, offset); selection.addRange(range); } module.exports = setDraftEditorSelection; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), /* 122 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule splitBlockInContentState * @typechecks * */ 'use strict'; var Immutable = __webpack_require__(3); var generateRandomKey = __webpack_require__(7); var invariant = __webpack_require__(2); var Map = Immutable.Map; function splitBlockInContentState(contentState, selectionState) { !selectionState.isCollapsed() ? true ? invariant(false, 'Selection range must be collapsed.') : invariant(false) : void 0; var key = selectionState.getAnchorKey(); var offset = selectionState.getAnchorOffset(); var blockMap = contentState.getBlockMap(); var blockToSplit = blockMap.get(key); var text = blockToSplit.getText(); var chars = blockToSplit.getCharacterList(); var blockAbove = blockToSplit.merge({ text: text.slice(0, offset), characterList: chars.slice(0, offset) }); var keyBelow = generateRandomKey(); var blockBelow = blockAbove.merge({ key: keyBelow, text: text.slice(offset), characterList: chars.slice(offset), data: Map() }); var blocksBefore = blockMap.toSeq().takeUntil(function (v) { return v === blockToSplit; }); var blocksAfter = blockMap.toSeq().skipUntil(function (v) { return v === blockToSplit; }).rest(); var newBlocks = blocksBefore.concat([[blockAbove.getKey(), blockAbove], [blockBelow.getKey(), blockBelow]], blocksAfter).toOrderedMap(); return contentState.merge({ blockMap: newBlocks, selectionBefore: selectionState, selectionAfter: selectionState.merge({ anchorKey: keyBelow, anchorOffset: 0, focusKey: keyBelow, focusOffset: 0, isBackward: false }) }); } module.exports = splitBlockInContentState; /***/ }), /* 123 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule splitTextIntoTextBlocks * */ 'use strict'; var NEWLINE_REGEX = /\r\n?|\n/g; function splitTextIntoTextBlocks(text) { return text.split(NEWLINE_REGEX); } module.exports = splitTextIntoTextBlocks; /***/ }), /* 124 */ /***/ (function(module, exports) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ var PhotosMimeType = { isImage: function isImage(mimeString) { return getParts(mimeString)[0] === 'image'; }, isJpeg: function isJpeg(mimeString) { var parts = getParts(mimeString); return PhotosMimeType.isImage(mimeString) && ( // see http://fburl.com/10972194 parts[1] === 'jpeg' || parts[1] === 'pjpeg'); } }; function getParts(mimeString) { return mimeString.split('/'); } module.exports = PhotosMimeType; /***/ }), /* 125 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks * @stub * */ 'use strict'; // \u00a1-\u00b1\u00b4-\u00b8\u00ba\u00bb\u00bf // is latin supplement punctuation except fractions and superscript // numbers // \u2010-\u2027\u2030-\u205e // is punctuation from the general punctuation block: // weird quotes, commas, bullets, dashes, etc. // \u30fb\u3001\u3002\u3008-\u3011\u3014-\u301f // is CJK punctuation // \uff1a-\uff1f\uff01-\uff0f\uff3b-\uff40\uff5b-\uff65 // is some full-width/half-width punctuation // \u2E2E\u061f\u066a-\u066c\u061b\u060c\u060d\uFD3e\uFD3F // is some Arabic punctuation marks // \u1801\u0964\u104a\u104b // is misc. other language punctuation marks var PUNCTUATION = '[.,+*?$|#{}()\'\\^\\-\\[\\]\\\\\\/!@%"~=<>_:;' + '\u30FB\u3001\u3002\u3008-\u3011\u3014-\u301F\uFF1A-\uFF1F\uFF01-\uFF0F' + '\uFF3B-\uFF40\uFF5B-\uFF65\u2E2E\u061F\u066A-\u066C\u061B\u060C\u060D' + '\uFD3E\uFD3F\u1801\u0964\u104A\u104B\u2010-\u2027\u2030-\u205E' + '\xA1-\xB1\xB4-\xB8\xBA\xBB\xBF]'; module.exports = { getPunctuation: function getPunctuation() { return PUNCTUATION; } }; /***/ }), /* 126 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * */ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var URI = function () { function URI(uri) { _classCallCheck(this, URI); this._uri = uri; } URI.prototype.toString = function toString() { return this._uri; }; return URI; }(); module.exports = URI; /***/ }), /* 127 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks * */ /** * Stateful API for text direction detection * * This class can be used in applications where you need to detect the * direction of a sequence of text blocks, where each direction shall be used * as the fallback direction for the next one. * * NOTE: A default direction, if not provided, is set based on the global * direction, as defined by `UnicodeBidiDirection`. * * == Example == * ``` * var UnicodeBidiService = require('UnicodeBidiService'); * * var bidiService = new UnicodeBidiService(); * * ... * * bidiService.reset(); * for (var para in paragraphs) { * var dir = bidiService.getDirection(para); * ... * } * ``` * * Part of our implementation of Unicode Bidirectional Algorithm (UBA) * Unicode Standard Annex #9 (UAX9) * http://www.unicode.org/reports/tr9/ */ 'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var UnicodeBidi = __webpack_require__(59); var UnicodeBidiDirection = __webpack_require__(32); var invariant = __webpack_require__(2); var UnicodeBidiService = function () { /** * Stateful class for paragraph direction detection * * @param defaultDir Default direction of the service */ function UnicodeBidiService(defaultDir) { _classCallCheck(this, UnicodeBidiService); if (!defaultDir) { defaultDir = UnicodeBidiDirection.getGlobalDir(); } else { !UnicodeBidiDirection.isStrong(defaultDir) ? true ? invariant(false, 'Default direction must be a strong direction (LTR or RTL)') : invariant(false) : void 0; } this._defaultDir = defaultDir; this.reset(); } /** * Reset the internal state * * Instead of creating a new instance, you can just reset() your instance * everytime you start a new loop. */ UnicodeBidiService.prototype.reset = function reset() { this._lastDir = this._defaultDir; }; /** * Returns the direction of a block of text, and remembers it as the * fall-back direction for the next paragraph. * * @param str A text block, e.g. paragraph, table cell, tag * @return The resolved direction */ UnicodeBidiService.prototype.getDirection = function getDirection(str) { this._lastDir = UnicodeBidi.getDirection(str, this._lastDir); return this._lastDir; }; return UnicodeBidiService; }(); module.exports = UnicodeBidiService; /***/ }), /* 128 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ /** * Usage note: * This module makes a best effort to export the same data we would internally. * At Facebook we use a server-generated module that does the parsing and * exports the data for the client to use. We can't rely on a server-side * implementation in open source so instead we make use of an open source * library to do the heavy lifting and then make some adjustments as necessary. * It's likely there will be some differences. Some we can smooth over. * Others are going to be harder. */ 'use strict'; var UAParser = __webpack_require__(147); var UNKNOWN = 'Unknown'; var PLATFORM_MAP = { 'Mac OS': 'Mac OS X' }; /** * Convert from UAParser platform name to what we expect. */ function convertPlatformName(name) { return PLATFORM_MAP[name] || name; } /** * Get the version number in parts. This is very naive. We actually get major * version as a part of UAParser already, which is generally good enough, but * let's get the minor just in case. */ function getBrowserVersion(version) { if (!version) { return { major: '', minor: '' }; } var parts = version.split('.'); return { major: parts[0], minor: parts[1] }; } /** * Get the UA data fom UAParser and then convert it to the format we're * expecting for our APIS. */ var parser = new UAParser(); var results = parser.getResult(); // Do some conversion first. var browserVersionData = getBrowserVersion(results.browser.version); var uaData = { browserArchitecture: results.cpu.architecture || UNKNOWN, browserFullVersion: results.browser.version || UNKNOWN, browserMinorVersion: browserVersionData.minor || UNKNOWN, browserName: results.browser.name || UNKNOWN, browserVersion: results.browser.major || UNKNOWN, deviceName: results.device.model || UNKNOWN, engineName: results.engine.name || UNKNOWN, engineVersion: results.engine.version || UNKNOWN, platformArchitecture: results.cpu.architecture || UNKNOWN, platformName: convertPlatformName(results.os.name) || UNKNOWN, platformVersion: results.os.version || UNKNOWN, platformFullVersion: results.os.version || UNKNOWN }; module.exports = uaData; /***/ }), /* 129 */ /***/ (function(module, exports, __webpack_require__) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ 'use strict'; var invariant = __webpack_require__(2); var componentRegex = /\./; var orRegex = /\|\|/; var rangeRegex = /\s+\-\s+/; var modifierRegex = /^(<=|<|=|>=|~>|~|>|)?\s*(.+)/; var numericRegex = /^(\d*)(.*)/; /** * Splits input `range` on "||" and returns true if any subrange matches * `version`. * * @param {string} range * @param {string} version * @returns {boolean} */ function checkOrExpression(range, version) { var expressions = range.split(orRegex); if (expressions.length > 1) { return expressions.some(function (range) { return VersionRange.contains(range, version); }); } else { range = expressions[0].trim(); return checkRangeExpression(range, version); } } /** * Splits input `range` on " - " (the surrounding whitespace is required) and * returns true if version falls between the two operands. * * @param {string} range * @param {string} version * @returns {boolean} */ function checkRangeExpression(range, version) { var expressions = range.split(rangeRegex); !(expressions.length > 0 && expressions.length <= 2) ? true ? invariant(false, 'the "-" operator expects exactly 2 operands') : invariant(false) : void 0; if (expressions.length === 1) { return checkSimpleExpression(expressions[0], version); } else { var startVersion = expressions[0], endVersion = expressions[1]; !(isSimpleVersion(startVersion) && isSimpleVersion(endVersion)) ? true ? invariant(false, 'operands to the "-" operator must be simple (no modifiers)') : invariant(false) : void 0; return checkSimpleExpression('>=' + startVersion, version) && checkSimpleExpression('<=' + endVersion, version); } } /** * Checks if `range` matches `version`. `range` should be a "simple" range (ie. * not a compound range using the " - " or "||" operators). * * @param {string} range * @param {string} version * @returns {boolean} */ function checkSimpleExpression(range, version) { range = range.trim(); if (range === '') { return true; } var versionComponents = version.split(componentRegex); var _getModifierAndCompon = getModifierAndComponents(range), modifier = _getModifierAndCompon.modifier, rangeComponents = _getModifierAndCompon.rangeComponents; switch (modifier) { case '<': return checkLessThan(versionComponents, rangeComponents); case '<=': return checkLessThanOrEqual(versionComponents, rangeComponents); case '>=': return checkGreaterThanOrEqual(versionComponents, rangeComponents); case '>': return checkGreaterThan(versionComponents, rangeComponents); case '~': case '~>': return checkApproximateVersion(versionComponents, rangeComponents); default: return checkEqual(versionComponents, rangeComponents); } } /** * Checks whether `a` is less than `b`. * * @param {array<string>} a * @param {array<string>} b * @returns {boolean} */ function checkLessThan(a, b) { return compareComponents(a, b) === -1; } /** * Checks whether `a` is less than or equal to `b`. * * @param {array<string>} a * @param {array<string>} b * @returns {boolean} */ function checkLessThanOrEqual(a, b) { var result = compareComponents(a, b); return result === -1 || result === 0; } /** * Checks whether `a` is equal to `b`. * * @param {array<string>} a * @param {array<string>} b * @returns {boolean} */ function checkEqual(a, b) { return compareComponents(a, b) === 0; } /** * Checks whether `a` is greater than or equal to `b`. * * @param {array<string>} a * @param {array<string>} b * @returns {boolean} */ function checkGreaterThanOrEqual(a, b) { var result = compareComponents(a, b); return result === 1 || result === 0; } /** * Checks whether `a` is greater than `b`. * * @param {array<string>} a * @param {array<string>} b * @returns {boolean} */ function checkGreaterThan(a, b) { return compareComponents(a, b) === 1; } /** * Checks whether `a` is "reasonably close" to `b` (as described in * https://www.npmjs.org/doc/misc/semver.html). For example, if `b` is "1.3.1" * then "reasonably close" is defined as ">= 1.3.1 and < 1.4". * * @param {array<string>} a * @param {array<string>} b * @returns {boolean} */ function checkApproximateVersion(a, b) { var lowerBound = b.slice(); var upperBound = b.slice(); if (upperBound.length > 1) { upperBound.pop(); } var lastIndex = upperBound.length - 1; var numeric = parseInt(upperBound[lastIndex], 10); if (isNumber(numeric)) { upperBound[lastIndex] = numeric + 1 + ''; } return checkGreaterThanOrEqual(a, lowerBound) && checkLessThan(a, upperBound); } /** * Extracts the optional modifier (<, <=, =, >=, >, ~, ~>) and version * components from `range`. * * For example, given `range` ">= 1.2.3" returns an object with a `modifier` of * `">="` and `components` of `[1, 2, 3]`. * * @param {string} range * @returns {object} */ function getModifierAndComponents(range) { var rangeComponents = range.split(componentRegex); var matches = rangeComponents[0].match(modifierRegex); !matches ? true ? invariant(false, 'expected regex to match but it did not') : invariant(false) : void 0; return { modifier: matches[1], rangeComponents: [matches[2]].concat(rangeComponents.slice(1)) }; } /** * Determines if `number` is a number. * * @param {mixed} number * @returns {boolean} */ function isNumber(number) { return !isNaN(number) && isFinite(number); } /** * Tests whether `range` is a "simple" version number without any modifiers * (">", "~" etc). * * @param {string} range * @returns {boolean} */ function isSimpleVersion(range) { return !getModifierAndComponents(range).modifier; } /** * Zero-pads array `array` until it is at least `length` long. * * @param {array} array * @param {number} length */ function zeroPad(array, length) { for (var i = array.length; i < length; i++) { array[i] = '0'; } } /** * Normalizes `a` and `b` in preparation for comparison by doing the following: * * - zero-pads `a` and `b` * - marks any "x", "X" or "*" component in `b` as equivalent by zero-ing it out * in both `a` and `b` * - marks any final "*" component in `b` as a greedy wildcard by zero-ing it * and all of its successors in `a` * * @param {array<string>} a * @param {array<string>} b * @returns {array<array<string>>} */ function normalizeVersions(a, b) { a = a.slice(); b = b.slice(); zeroPad(a, b.length); // mark "x" and "*" components as equal for (var i = 0; i < b.length; i++) { var matches = b[i].match(/^[x*]$/i); if (matches) { b[i] = a[i] = '0'; // final "*" greedily zeros all remaining components if (matches[0] === '*' && i === b.length - 1) { for (var j = i; j < a.length; j++) { a[j] = '0'; } } } } zeroPad(b, a.length); return [a, b]; } /** * Returns the numerical -- not the lexicographical -- ordering of `a` and `b`. * * For example, `10-alpha` is greater than `2-beta`. * * @param {string} a * @param {string} b * @returns {number} -1, 0 or 1 to indicate whether `a` is less than, equal to, * or greater than `b`, respectively */ function compareNumeric(a, b) { var aPrefix = a.match(numericRegex)[1]; var bPrefix = b.match(numericRegex)[1]; var aNumeric = parseInt(aPrefix, 10); var bNumeric = parseInt(bPrefix, 10); if (isNumber(aNumeric) && isNumber(bNumeric) && aNumeric !== bNumeric) { return compare(aNumeric, bNumeric); } else { return compare(a, b); } } /** * Returns the ordering of `a` and `b`. * * @param {string|number} a * @param {string|number} b * @returns {number} -1, 0 or 1 to indicate whether `a` is less than, equal to, * or greater than `b`, respectively */ function compare(a, b) { !(typeof a === typeof b) ? true ? invariant(false, '"a" and "b" must be of the same type') : invariant(false) : void 0; if (a > b) { return 1; } else if (a < b) { return -1; } else { return 0; } } /** * Compares arrays of version components. * * @param {array<string>} a * @param {array<string>} b * @returns {number} -1, 0 or 1 to indicate whether `a` is less than, equal to, * or greater than `b`, respectively */ function compareComponents(a, b) { var _normalizeVersions = normalizeVersions(a, b), aNormalized = _normalizeVersions[0], bNormalized = _normalizeVersions[1]; for (var i = 0; i < bNormalized.length; i++) { var result = compareNumeric(aNormalized[i], bNormalized[i]); if (result) { return result; } } return 0; } var VersionRange = { /** * Checks whether `version` satisfies the `range` specification. * * We support a subset of the expressions defined in * https://www.npmjs.org/doc/misc/semver.html: * * version Must match version exactly * =version Same as just version * >version Must be greater than version * >=version Must be greater than or equal to version * <version Must be less than version * <=version Must be less than or equal to version * ~version Must be at least version, but less than the next significant * revision above version: * "~1.2.3" is equivalent to ">= 1.2.3 and < 1.3" * ~>version Equivalent to ~version * 1.2.x Must match "1.2.x", where "x" is a wildcard that matches * anything * 1.2.* Similar to "1.2.x", but "*" in the trailing position is a * "greedy" wildcard, so will match any number of additional * components: * "1.2.*" will match "1.2.1", "1.2.1.1", "1.2.1.1.1" etc * * Any version * "" (Empty string) Same as * * v1 - v2 Equivalent to ">= v1 and <= v2" * r1 || r2 Passes if either r1 or r2 are satisfied * * @param {string} range * @param {string} version * @returns {boolean} */ contains: function contains(range, version) { return checkOrExpression(range.trim(), version.trim()); } }; module.exports = VersionRange; /***/ }), /* 130 */ /***/ (function(module, exports) { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ var _hyphenPattern = /-(.)/g; /** * Camelcases a hyphenated string, for example: * * > camelize('background-color') * < "backgroundColor" * * @param {string} string * @return {string} */ function camelize(string) { return string.replace(_hyphenPattern, function (_, character) { return character.toUpperCase(); }); } module.exports = camelize; /***/ }), /* 131 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ var invariant = __webpack_require__(2); /** * Convert array-like objects to arrays. * * This API assumes the caller knows the contents of the data type. For less * well defined inputs use createArrayFromMixed. * * @param {object|function|filelist} obj * @return {array} */ function toArray(obj) { var length = obj.length; // Some browsers builtin objects can report typeof 'function' (e.g. NodeList // in old versions of Safari). !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? true ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : void 0; !(typeof length === 'number') ? true ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : void 0; !(length === 0 || length - 1 in obj) ? true ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : void 0; !(typeof obj.callee !== 'function') ? true ? invariant(false, 'toArray: Object can\'t be `arguments`. Use rest params ' + '(function(...args) {}) or Array.from() instead.') : invariant(false) : void 0; // Old IE doesn't give collections access to hasOwnProperty. Assume inputs // without method will throw during the slice call and skip straight to the // fallback. if (obj.hasOwnProperty) { try { return Array.prototype.slice.call(obj); } catch (e) { // IE < 9 does not support Array#slice on collections objects } } // Fall back to copying key by key. This assumes all keys have a value, // so will not preserve sparsely populated inputs. var ret = Array(length); for (var ii = 0; ii < length; ii++) { ret[ii] = obj[ii]; } return ret; } /** * Perform a heuristic test to determine if an object is "array-like". * * A monk asked Joshu, a Zen master, "Has a dog Buddha nature?" * Joshu replied: "Mu." * * This function determines if its argument has "array nature": it returns * true if the argument is an actual array, an `arguments' object, or an * HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()). * * It will return false for other array-like objects like Filelist. * * @param {*} obj * @return {boolean} */ function hasArrayNature(obj) { return ( // not null/false !!obj && ( // arrays are objects, NodeLists are functions in Safari typeof obj == 'object' || typeof obj == 'function') && // quacks like an array 'length' in obj && // not window !('setInterval' in obj) && // no DOM node should be considered an array-like // a 'select' element has 'length' and 'item' properties on IE8 typeof obj.nodeType != 'number' && ( // a real array Array.isArray(obj) || // arguments 'callee' in obj || // HTMLCollection/NodeList 'item' in obj) ); } /** * Ensure that the argument is an array by wrapping it in an array if it is not. * Creates a copy of the argument if it is already an array. * * This is mostly useful idiomatically: * * var createArrayFromMixed = require('createArrayFromMixed'); * * function takesOneOrMoreThings(things) { * things = createArrayFromMixed(things); * ... * } * * This allows you to treat `things' as an array, but accept scalars in the API. * * If you need to convert an array-like object, like `arguments`, into an array * use toArray instead. * * @param {*} obj * @return {array} */ function createArrayFromMixed(obj) { if (!hasArrayNature(obj)) { return [obj]; } else if (Array.isArray(obj)) { return obj.slice(); } else { return toArray(obj); } } module.exports = createArrayFromMixed; /***/ }), /* 132 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ 'use strict'; var isWebkit = typeof navigator !== 'undefined' && navigator.userAgent.indexOf('AppleWebKit') > -1; /** * Gets the element with the document scroll properties such as `scrollLeft` and * `scrollHeight`. This may differ across different browsers. * * NOTE: The return value can be null if the DOM is not yet ready. * * @param {?DOMDocument} doc Defaults to current document. * @return {?DOMElement} */ function getDocumentScrollElement(doc) { doc = doc || document; if (doc.scrollingElement) { return doc.scrollingElement; } return !isWebkit && doc.compatMode === 'CSS1Compat' ? doc.documentElement : doc.body; } module.exports = getDocumentScrollElement; /***/ }), /* 133 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ var getElementRect = __webpack_require__(134); /** * Gets an element's position in pixels relative to the viewport. The returned * object represents the position of the element's top left corner. * * @param {DOMElement} element * @return {object} */ function getElementPosition(element) { var rect = getElementRect(element); return { x: rect.left, y: rect.top, width: rect.right - rect.left, height: rect.bottom - rect.top }; } module.exports = getElementPosition; /***/ }), /* 134 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ var containsNode = __webpack_require__(33); /** * Gets an element's bounding rect in pixels relative to the viewport. * * @param {DOMElement} elem * @return {object} */ function getElementRect(elem) { var docElem = elem.ownerDocument.documentElement; // FF 2, Safari 3 and Opera 9.5- do not support getBoundingClientRect(). // IE9- will throw if the element is not in the document. if (!('getBoundingClientRect' in elem) || !containsNode(docElem, elem)) { return { left: 0, right: 0, top: 0, bottom: 0 }; } // Subtracts clientTop/Left because IE8- added a 2px border to the // <html> element (see http://fburl.com/1493213). IE 7 in // Quicksmode does not report clientLeft/clientTop so there // will be an unaccounted offset of 2px when in quirksmode var rect = elem.getBoundingClientRect(); return { left: Math.round(rect.left) - docElem.clientLeft, right: Math.round(rect.right) - docElem.clientLeft, top: Math.round(rect.top) - docElem.clientTop, bottom: Math.round(rect.bottom) - docElem.clientTop }; } module.exports = getElementRect; /***/ }), /* 135 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ var camelize = __webpack_require__(130); var hyphenate = __webpack_require__(138); function asString(value) /*?string*/{ return value == null ? value : String(value); } function getStyleProperty( /*DOMNode*/node, /*string*/name) /*?string*/{ var computedStyle = void 0; // W3C Standard if (window.getComputedStyle) { // In certain cases such as within an iframe in FF3, this returns null. computedStyle = window.getComputedStyle(node, null); if (computedStyle) { return asString(computedStyle.getPropertyValue(hyphenate(name))); } } // Safari if (document.defaultView && document.defaultView.getComputedStyle) { computedStyle = document.defaultView.getComputedStyle(node, null); // A Safari bug causes this to return null for `display: none` elements. if (computedStyle) { return asString(computedStyle.getPropertyValue(hyphenate(name))); } if (name === 'display') { return 'none'; } } // Internet Explorer if (node.currentStyle) { if (name === 'float') { return asString(node.currentStyle.cssFloat || node.currentStyle.styleFloat); } return asString(node.currentStyle[camelize(name)]); } return asString(node.style && node.style[camelize(name)]); } module.exports = getStyleProperty; /***/ }), /* 136 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ 'use strict'; /** * Gets the scroll position of the supplied element or window. * * The return values are unbounded, unlike `getScrollPosition`. This means they * may be negative or exceed the element boundaries (which is possible using * inertial scrolling). * * @param {DOMWindow|DOMElement} scrollable * @return {object} Map with `x` and `y` keys. */ function getUnboundedScrollPosition(scrollable) { if (scrollable.Window && scrollable instanceof scrollable.Window) { return { x: scrollable.pageXOffset || scrollable.document.documentElement.scrollLeft, y: scrollable.pageYOffset || scrollable.document.documentElement.scrollTop }; } return { x: scrollable.scrollLeft, y: scrollable.scrollTop }; } module.exports = getUnboundedScrollPosition; /***/ }), /* 137 */ /***/ (function(module, exports) { "use strict"; function getViewportWidth() { var width = void 0; if (document.documentElement) { width = document.documentElement.clientWidth; } if (!width && document.body) { width = document.body.clientWidth; } return width || 0; } /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * * @typechecks */ function getViewportHeight() { var height = void 0; if (document.documentElement) { height = document.documentElement.clientHeight; } if (!height && document.body) { height = document.body.clientHeight; } return height || 0; } /** * Gets the viewport dimensions including any scrollbars. */ function getViewportDimensions() { return { width: window.innerWidth || getViewportWidth(), height: window.innerHeight || getViewportHeight() }; } /** * Gets the viewport dimensions excluding any scrollbars. */ getViewportDimensions.withoutScrollbars = function () { return { width: getViewportWidth(), height: getViewportHeight() }; }; module.exports = getViewportDimensions; /***/ }), /* 138 */ /***/ (function(module, exports) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ var _uppercasePattern = /([A-Z])/g; /** * Hyphenates a camelcased string, for example: * * > hyphenate('backgroundColor') * < "background-color" * * For CSS style names, use `hyphenateStyleName` instead which works properly * with all vendor prefixes, including `ms`. * * @param {string} string * @return {string} */ function hyphenate(string) { return string.replace(_uppercasePattern, '-$1').toLowerCase(); } module.exports = hyphenate; /***/ }), /* 139 */ /***/ (function(module, exports) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ /** * @param {*} object The object to check. * @return {boolean} Whether or not the object is a DOM node. */ function isNode(object) { var doc = object ? object.ownerDocument || object : document; var defaultView = doc.defaultView || window; return !!(object && (typeof defaultView.Node === 'function' ? object instanceof defaultView.Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string')); } module.exports = isNode; /***/ }), /* 140 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks */ var isNode = __webpack_require__(139); /** * @param {*} object The object to check. * @return {boolean} Whether or not the object is a DOM text node. */ function isTextNode(object) { return isNode(object) && object.nodeType == 3; } module.exports = isTextNode; /***/ }), /* 141 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @typechecks static-only */ 'use strict'; /** * Combines multiple className strings into one. * http://jsperf.com/joinclasses-args-vs-array * * @param {...?string} className * @return {string} */ function joinClasses(className /*, ... */) { if (!className) { className = ''; } var nextClass = void 0; var argLength = arguments.length; if (argLength > 1) { for (var ii = 1; ii < argLength; ii++) { nextClass = arguments[ii]; if (nextClass) { className = (className ? className + ' ' : '') + nextClass; } } } return className; } module.exports = joinClasses; /***/ }), /* 142 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ 'use strict'; var hasOwnProperty = Object.prototype.hasOwnProperty; /** * Executes the provided `callback` once for each enumerable own property in the * object and constructs a new object from the results. The `callback` is * invoked with three arguments: * * - the property value * - the property name * - the object being traversed * * Properties that are added after the call to `mapObject` will not be visited * by `callback`. If the values of existing properties are changed, the value * passed to `callback` will be the value at the time `mapObject` visits them. * Properties that are deleted before being visited are not visited. * * @grep function objectMap() * @grep function objMap() * * @param {?object} object * @param {function} callback * @param {*} context * @return {?object} */ function mapObject(object, callback, context) { if (!object) { return null; } var result = {}; for (var name in object) { if (hasOwnProperty.call(object, name)) { result[name] = callback.call(context, object[name], name, object); } } return result; } module.exports = mapObject; /***/ }), /* 143 */ /***/ (function(module, exports) { /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * * @typechecks static-only */ 'use strict'; /** * Memoizes the return value of a function that accepts one string argument. */ function memoizeStringOnly(callback) { var cache = {}; return function (string) { if (!cache.hasOwnProperty(string)) { cache[string] = callback.call(this, string); } return cache[string]; }; } module.exports = memoizeStringOnly; /***/ }), /* 144 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ 'use strict'; // setimmediate adds setImmediate to the global. We want to make sure we export // the actual function. __webpack_require__(146); module.exports = global.setImmediate; /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }), /* 145 */ /***/ (function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } 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)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } 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; }; /***/ }), /* 146 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) { "use strict"; if (global.setImmediate) { return; } var nextHandle = 1; // Spec says greater than zero var tasksByHandle = {}; var currentlyRunningATask = false; var doc = global.document; var registerImmediate; function setImmediate(callback) { // Callback can either be a function or a string if (typeof callback !== "function") { callback = new Function("" + callback); } // Copy function arguments var args = new Array(arguments.length - 1); for (var i = 0; i < args.length; i++) { args[i] = arguments[i + 1]; } // Store and register the task var task = { callback: callback, args: args }; tasksByHandle[nextHandle] = task; registerImmediate(nextHandle); return nextHandle++; } function clearImmediate(handle) { delete tasksByHandle[handle]; } function run(task) { var callback = task.callback; var args = task.args; switch (args.length) { case 0: callback(); break; case 1: callback(args[0]); break; case 2: callback(args[0], args[1]); break; case 3: callback(args[0], args[1], args[2]); break; default: callback.apply(undefined, args); break; } } function runIfPresent(handle) { // From the spec: "Wait until any invocations of this algorithm started before this one have completed." // So if we're currently running a task, we'll need to delay this invocation. if (currentlyRunningATask) { // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a // "too much recursion" error. setTimeout(runIfPresent, 0, handle); } else { var task = tasksByHandle[handle]; if (task) { currentlyRunningATask = true; try { run(task); } finally { clearImmediate(handle); currentlyRunningATask = false; } } } } function installNextTickImplementation() { registerImmediate = function(handle) { process.nextTick(function () { runIfPresent(handle); }); }; } function canUsePostMessage() { // The test against `importScripts` prevents this implementation from being installed inside a web worker, // where `global.postMessage` means something completely different and can't be used for this purpose. if (global.postMessage && !global.importScripts) { var postMessageIsAsynchronous = true; var oldOnMessage = global.onmessage; global.onmessage = function() { postMessageIsAsynchronous = false; }; global.postMessage("", "*"); global.onmessage = oldOnMessage; return postMessageIsAsynchronous; } } function installPostMessageImplementation() { // Installs an event handler on `global` for the `message` event: see // * https://developer.mozilla.org/en/DOM/window.postMessage // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages var messagePrefix = "setImmediate$" + Math.random() + "$"; var onGlobalMessage = function(event) { if (event.source === global && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) { runIfPresent(+event.data.slice(messagePrefix.length)); } }; if (global.addEventListener) { global.addEventListener("message", onGlobalMessage, false); } else { global.attachEvent("onmessage", onGlobalMessage); } registerImmediate = function(handle) { global.postMessage(messagePrefix + handle, "*"); }; } function installMessageChannelImplementation() { var channel = new MessageChannel(); channel.port1.onmessage = function(event) { var handle = event.data; runIfPresent(handle); }; registerImmediate = function(handle) { channel.port2.postMessage(handle); }; } function installReadyStateChangeImplementation() { var html = doc.documentElement; registerImmediate = function(handle) { // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called. var script = doc.createElement("script"); script.onreadystatechange = function () { runIfPresent(handle); script.onreadystatechange = null; html.removeChild(script); script = null; }; html.appendChild(script); }; } function installSetTimeoutImplementation() { registerImmediate = function(handle) { setTimeout(runIfPresent, 0, handle); }; } // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global); attachTo = attachTo && attachTo.setTimeout ? attachTo : global; // Don't get fooled by e.g. browserify environments. if ({}.toString.call(global.process) === "[object process]") { // For Node.js before 0.9 installNextTickImplementation(); } else if (canUsePostMessage()) { // For non-IE10 modern browsers installPostMessageImplementation(); } else if (global.MessageChannel) { // For web workers, where supported installMessageChannelImplementation(); } else if (doc && "onreadystatechange" in doc.createElement("script")) { // For IE 6–8 installReadyStateChangeImplementation(); } else { // For older browsers installSetTimeoutImplementation(); } attachTo.setImmediate = setImmediate; attachTo.clearImmediate = clearImmediate; }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self)); /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(145))) /***/ }), /* 147 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/** * UAParser.js v0.7.14 * Lightweight JavaScript-based User-Agent string parser * https://github.com/faisalman/ua-parser-js * * Copyright © 2012-2016 Faisal Salman <[email protected]> * Dual licensed under GPLv2 & MIT */ (function (window, undefined) { 'use strict'; ////////////// // Constants ///////////// var LIBVERSION = '0.7.14', EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', UNDEF_TYPE = 'undefined', OBJ_TYPE = 'object', STR_TYPE = 'string', MAJOR = 'major', // deprecated MODEL = 'model', NAME = 'name', TYPE = 'type', VENDOR = 'vendor', VERSION = 'version', ARCHITECTURE= 'architecture', CONSOLE = 'console', MOBILE = 'mobile', TABLET = 'tablet', SMARTTV = 'smarttv', WEARABLE = 'wearable', EMBEDDED = 'embedded'; /////////// // Helper ////////// var util = { extend : function (regexes, extensions) { var margedRegexes = {}; for (var i in regexes) { if (extensions[i] && extensions[i].length % 2 === 0) { margedRegexes[i] = extensions[i].concat(regexes[i]); } else { margedRegexes[i] = regexes[i]; } } return margedRegexes; }, has : function (str1, str2) { if (typeof str1 === "string") { return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1; } else { return false; } }, lowerize : function (str) { return str.toLowerCase(); }, major : function (version) { return typeof(version) === STR_TYPE ? version.replace(/[^\d\.]/g,'').split(".")[0] : undefined; }, trim : function (str) { return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); } }; /////////////// // Map helper ////////////// var mapper = { rgx : function (ua, arrays) { //var result = {}, var i = 0, j, k, p, q, matches, match;//, args = arguments; /*// construct object barebones for (p = 0; p < args[1].length; p++) { q = args[1][p]; result[typeof q === OBJ_TYPE ? q[0] : q] = undefined; }*/ // loop through all regexes maps while (i < arrays.length && !matches) { var regex = arrays[i], // even sequence (0,2,4,..) props = arrays[i + 1]; // odd sequence (1,3,5,..) j = k = 0; // try matching uastring with regexes while (j < regex.length && !matches) { matches = regex[j++].exec(ua); if (!!matches) { for (p = 0; p < props.length; p++) { match = matches[++k]; q = props[p]; // check if given property is actually array if (typeof q === OBJ_TYPE && q.length > 0) { if (q.length == 2) { if (typeof q[1] == FUNC_TYPE) { // assign modified match this[q[0]] = q[1].call(this, match); } else { // assign given value, ignore regex match this[q[0]] = q[1]; } } else if (q.length == 3) { // check whether function or regex if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) { // call function (usually string mapper) this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined; } else { // sanitize match using given regex this[q[0]] = match ? match.replace(q[1], q[2]) : undefined; } } else if (q.length == 4) { this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined; } } else { this[q] = match ? match : undefined; } } } } i += 2; } //console.log(this); //return this; }, str : function (str, map) { for (var i in map) { // check if array if (typeof map[i] === OBJ_TYPE && map[i].length > 0) { for (var j = 0; j < map[i].length; j++) { if (util.has(map[i][j], str)) { return (i === UNKNOWN) ? undefined : i; } } } else if (util.has(map[i], str)) { return (i === UNKNOWN) ? undefined : i; } } return str; } }; /////////////// // String map ////////////// var maps = { browser : { oldsafari : { version : { '1.0' : '/8', '1.2' : '/1', '1.3' : '/3', '2.0' : '/412', '2.0.2' : '/416', '2.0.3' : '/417', '2.0.4' : '/419', '?' : '/' } } }, device : { amazon : { model : { 'Fire Phone' : ['SD', 'KF'] } }, sprint : { model : { 'Evo Shift 4G' : '7373KT' }, vendor : { 'HTC' : 'APA', 'Sprint' : 'Sprint' } } }, os : { windows : { version : { 'ME' : '4.90', 'NT 3.11' : 'NT3.51', 'NT 4.0' : 'NT4.0', '2000' : 'NT 5.0', 'XP' : ['NT 5.1', 'NT 5.2'], 'Vista' : 'NT 6.0', '7' : 'NT 6.1', '8' : 'NT 6.2', '8.1' : 'NT 6.3', '10' : ['NT 6.4', 'NT 10.0'], 'RT' : 'ARM' } } } }; ////////////// // Regex map ///////////// var regexes = { browser : [[ // Presto based /(opera\smini)\/([\w\.-]+)/i, // Opera Mini /(opera\s[mobiletab]+).+version\/([\w\.-]+)/i, // Opera Mobi/Tablet /(opera).+version\/([\w\.]+)/i, // Opera > 9.80 /(opera)[\/\s]+([\w\.]+)/i // Opera < 9.80 ], [NAME, VERSION], [ /(opios)[\/\s]+([\w\.]+)/i // Opera mini on iphone >= 8.0 ], [[NAME, 'Opera Mini'], VERSION], [ /\s(opr)\/([\w\.]+)/i // Opera Webkit ], [[NAME, 'Opera'], VERSION], [ // Mixed /(kindle)\/([\w\.]+)/i, // Kindle /(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer // Trident based /(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i, // Avant/IEMobile/SlimBrowser/Baidu /(?:ms|\()(ie)\s([\w\.]+)/i, // Internet Explorer // Webkit/KHTML based /(rekonq)\/([\w\.]+)*/i, // Rekonq /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser)\/([\w\.-]+)/i // Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser ], [NAME, VERSION], [ /(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11 ], [[NAME, 'IE'], VERSION], [ /(edge)\/((\d+)?[\w\.]+)/i // Microsoft Edge ], [NAME, VERSION], [ /(yabrowser)\/([\w\.]+)/i // Yandex ], [[NAME, 'Yandex'], VERSION], [ /(puffin)\/([\w\.]+)/i // Puffin ], [[NAME, 'Puffin'], VERSION], [ /((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i // UCBrowser ], [[NAME, 'UCBrowser'], VERSION], [ /(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon ], [[NAME, /_/g, ' '], VERSION], [ /(micromessenger)\/([\w\.]+)/i // WeChat ], [[NAME, 'WeChat'], VERSION], [ /(QQ)\/([\d\.]+)/i // QQ, aka ShouQ ], [NAME, VERSION], [ /m?(qqbrowser)[\/\s]?([\w\.]+)/i // QQBrowser ], [NAME, VERSION], [ /xiaomi\/miuibrowser\/([\w\.]+)/i // MIUI Browser ], [VERSION, [NAME, 'MIUI Browser']], [ /;fbav\/([\w\.]+);/i // Facebook App for iOS & Android ], [VERSION, [NAME, 'Facebook']], [ /(headlesschrome) ([\w\.]+)/i // Chrome Headless ], [VERSION, [NAME, 'Chrome Headless']], [ /\swv\).+(chrome)\/([\w\.]+)/i // Chrome WebView ], [[NAME, /(.+)/, '$1 WebView'], VERSION], [ /((?:oculus|samsung)browser)\/([\w\.]+)/i ], [[NAME, /(.+(?:g|us))(.+)/, '$1 $2'], VERSION], [ // Oculus / Samsung Browser /android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i // Android Browser ], [VERSION, [NAME, 'Android Browser']], [ /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia ], [NAME, VERSION], [ /(dolfin)\/([\w\.]+)/i // Dolphin ], [[NAME, 'Dolphin'], VERSION], [ /((?:android.+)crmo|crios)\/([\w\.]+)/i // Chrome for Android/iOS ], [[NAME, 'Chrome'], VERSION], [ /(coast)\/([\w\.]+)/i // Opera Coast ], [[NAME, 'Opera Coast'], VERSION], [ /fxios\/([\w\.-]+)/i // Firefox for iOS ], [VERSION, [NAME, 'Firefox']], [ /version\/([\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari ], [VERSION, [NAME, 'Mobile Safari']], [ /version\/([\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile ], [VERSION, NAME], [ /webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i // Safari < 3.0 ], [NAME, [VERSION, mapper.str, maps.browser.oldsafari.version]], [ /(konqueror)\/([\w\.]+)/i, // Konqueror /(webkit|khtml)\/([\w\.]+)/i ], [NAME, VERSION], [ // Gecko based /(navigator|netscape)\/([\w\.-]+)/i // Netscape ], [[NAME, 'Netscape'], VERSION], [ /(swiftfox)/i, // Swiftfox /(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i, // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror /(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i, // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix /(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla // Other /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i, // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir /(links)\s\(([\w\.]+)/i, // Links /(gobrowser)\/?([\w\.]+)*/i, // GoBrowser /(ice\s?browser)\/v?([\w\._]+)/i, // ICE Browser /(mosaic)[\/\s]([\w\.]+)/i // Mosaic ], [NAME, VERSION] /* ///////////////////// // Media players BEGIN //////////////////////// , [ /(apple(?:coremedia|))\/((\d+)[\w\._]+)/i, // Generic Apple CoreMedia /(coremedia) v((\d+)[\w\._]+)/i ], [NAME, VERSION], [ /(aqualung|lyssna|bsplayer)\/((\d+)?[\w\.-]+)/i // Aqualung/Lyssna/BSPlayer ], [NAME, VERSION], [ /(ares|ossproxy)\s((\d+)[\w\.-]+)/i // Ares/OSSProxy ], [NAME, VERSION], [ /(audacious|audimusicstream|amarok|bass|core|dalvik|gnomemplayer|music on console|nsplayer|psp-internetradioplayer|videos)\/((\d+)[\w\.-]+)/i, // Audacious/AudiMusicStream/Amarok/BASS/OpenCORE/Dalvik/GnomeMplayer/MoC // NSPlayer/PSP-InternetRadioPlayer/Videos /(clementine|music player daemon)\s((\d+)[\w\.-]+)/i, // Clementine/MPD /(lg player|nexplayer)\s((\d+)[\d\.]+)/i, /player\/(nexplayer|lg player)\s((\d+)[\w\.-]+)/i // NexPlayer/LG Player ], [NAME, VERSION], [ /(nexplayer)\s((\d+)[\w\.-]+)/i // Nexplayer ], [NAME, VERSION], [ /(flrp)\/((\d+)[\w\.-]+)/i // Flip Player ], [[NAME, 'Flip Player'], VERSION], [ /(fstream|nativehost|queryseekspider|ia-archiver|facebookexternalhit)/i // FStream/NativeHost/QuerySeekSpider/IA Archiver/facebookexternalhit ], [NAME], [ /(gstreamer) souphttpsrc (?:\([^\)]+\)){0,1} libsoup\/((\d+)[\w\.-]+)/i // Gstreamer ], [NAME, VERSION], [ /(htc streaming player)\s[\w_]+\s\/\s((\d+)[\d\.]+)/i, // HTC Streaming Player /(java|python-urllib|python-requests|wget|libcurl)\/((\d+)[\w\.-_]+)/i, // Java/urllib/requests/wget/cURL /(lavf)((\d+)[\d\.]+)/i // Lavf (FFMPEG) ], [NAME, VERSION], [ /(htc_one_s)\/((\d+)[\d\.]+)/i // HTC One S ], [[NAME, /_/g, ' '], VERSION], [ /(mplayer)(?:\s|\/)(?:(?:sherpya-){0,1}svn)(?:-|\s)(r\d+(?:-\d+[\w\.-]+){0,1})/i // MPlayer SVN ], [NAME, VERSION], [ /(mplayer)(?:\s|\/|[unkow-]+)((\d+)[\w\.-]+)/i // MPlayer ], [NAME, VERSION], [ /(mplayer)/i, // MPlayer (no other info) /(yourmuze)/i, // YourMuze /(media player classic|nero showtime)/i // Media Player Classic/Nero ShowTime ], [NAME], [ /(nero (?:home|scout))\/((\d+)[\w\.-]+)/i // Nero Home/Nero Scout ], [NAME, VERSION], [ /(nokia\d+)\/((\d+)[\w\.-]+)/i // Nokia ], [NAME, VERSION], [ /\s(songbird)\/((\d+)[\w\.-]+)/i // Songbird/Philips-Songbird ], [NAME, VERSION], [ /(winamp)3 version ((\d+)[\w\.-]+)/i, // Winamp /(winamp)\s((\d+)[\w\.-]+)/i, /(winamp)mpeg\/((\d+)[\w\.-]+)/i ], [NAME, VERSION], [ /(ocms-bot|tapinradio|tunein radio|unknown|winamp|inlight radio)/i // OCMS-bot/tap in radio/tunein/unknown/winamp (no other info) // inlight radio ], [NAME], [ /(quicktime|rma|radioapp|radioclientapplication|soundtap|totem|stagefright|streamium)\/((\d+)[\w\.-]+)/i // QuickTime/RealMedia/RadioApp/RadioClientApplication/ // SoundTap/Totem/Stagefright/Streamium ], [NAME, VERSION], [ /(smp)((\d+)[\d\.]+)/i // SMP ], [NAME, VERSION], [ /(vlc) media player - version ((\d+)[\w\.]+)/i, // VLC Videolan /(vlc)\/((\d+)[\w\.-]+)/i, /(xbmc|gvfs|xine|xmms|irapp)\/((\d+)[\w\.-]+)/i, // XBMC/gvfs/Xine/XMMS/irapp /(foobar2000)\/((\d+)[\d\.]+)/i, // Foobar2000 /(itunes)\/((\d+)[\d\.]+)/i // iTunes ], [NAME, VERSION], [ /(wmplayer)\/((\d+)[\w\.-]+)/i, // Windows Media Player /(windows-media-player)\/((\d+)[\w\.-]+)/i ], [[NAME, /-/g, ' '], VERSION], [ /windows\/((\d+)[\w\.-]+) upnp\/[\d\.]+ dlnadoc\/[\d\.]+ (home media server)/i // Windows Media Server ], [VERSION, [NAME, 'Windows']], [ /(com\.riseupradioalarm)\/((\d+)[\d\.]*)/i // RiseUP Radio Alarm ], [NAME, VERSION], [ /(rad.io)\s((\d+)[\d\.]+)/i, // Rad.io /(radio.(?:de|at|fr))\s((\d+)[\d\.]+)/i ], [[NAME, 'rad.io'], VERSION] ////////////////////// // Media players END ////////////////////*/ ], cpu : [[ /(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i // AMD64 ], [[ARCHITECTURE, 'amd64']], [ /(ia32(?=;))/i // IA32 (quicktime) ], [[ARCHITECTURE, util.lowerize]], [ /((?:i[346]|x)86)[;\)]/i // IA32 ], [[ARCHITECTURE, 'ia32']], [ // PocketPC mistakenly identified as PowerPC /windows\s(ce|mobile);\sppc;/i ], [[ARCHITECTURE, 'arm']], [ /((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i // PowerPC ], [[ARCHITECTURE, /ower/, '', util.lowerize]], [ /(sun4\w)[;\)]/i // SPARC ], [[ARCHITECTURE, 'sparc']], [ /((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC ], [[ARCHITECTURE, util.lowerize]] ], device : [[ /\((ipad|playbook);[\w\s\);-]+(rim|apple)/i // iPad/PlayBook ], [MODEL, VENDOR, [TYPE, TABLET]], [ /applecoremedia\/[\w\.]+ \((ipad)/ // iPad ], [MODEL, [VENDOR, 'Apple'], [TYPE, TABLET]], [ /(apple\s{0,1}tv)/i // Apple TV ], [[MODEL, 'Apple TV'], [VENDOR, 'Apple']], [ /(archos)\s(gamepad2?)/i, // Archos /(hp).+(touchpad)/i, // HP TouchPad /(hp).+(tablet)/i, // HP Tablet /(kindle)\/([\w\.]+)/i, // Kindle /\s(nook)[\w\s]+build\/(\w+)/i, // Nook /(dell)\s(strea[kpr\s\d]*[\dko])/i // Dell Streak ], [VENDOR, MODEL, [TYPE, TABLET]], [ /(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i // Kindle Fire HD ], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [ /(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i // Fire Phone ], [[MODEL, mapper.str, maps.device.amazon.model], [VENDOR, 'Amazon'], [TYPE, MOBILE]], [ /\((ip[honed|\s\w*]+);.+(apple)/i // iPod/iPhone ], [MODEL, VENDOR, [TYPE, MOBILE]], [ /\((ip[honed|\s\w*]+);/i // iPod/iPhone ], [MODEL, [VENDOR, 'Apple'], [TYPE, MOBILE]], [ /(blackberry)[\s-]?(\w+)/i, // BlackBerry /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]+)*/i, // BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron /(hp)\s([\w\s]+\w)/i, // HP iPAQ /(asus)-?(\w+)/i // Asus ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /\(bb10;\s(\w+)/i // BlackBerry 10 ], [MODEL, [VENDOR, 'BlackBerry'], [TYPE, MOBILE]], [ // Asus Tablets /android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone)/i ], [MODEL, [VENDOR, 'Asus'], [TYPE, TABLET]], [ /(sony)\s(tablet\s[ps])\sbuild\//i, // Sony /(sony)?(?:sgp.+)\sbuild\//i ], [[VENDOR, 'Sony'], [MODEL, 'Xperia Tablet'], [TYPE, TABLET]], [ /android.+\s([c-g]\d{4}|so[-l]\w+)\sbuild\//i ], [MODEL, [VENDOR, 'Sony'], [TYPE, MOBILE]], [ /\s(ouya)\s/i, // Ouya /(nintendo)\s([wids3u]+)/i // Nintendo ], [VENDOR, MODEL, [TYPE, CONSOLE]], [ /android.+;\s(shield)\sbuild/i // Nvidia ], [MODEL, [VENDOR, 'Nvidia'], [TYPE, CONSOLE]], [ /(playstation\s[34portablevi]+)/i // Playstation ], [MODEL, [VENDOR, 'Sony'], [TYPE, CONSOLE]], [ /(sprint\s(\w+))/i // Sprint Phones ], [[VENDOR, mapper.str, maps.device.sprint.vendor], [MODEL, mapper.str, maps.device.sprint.model], [TYPE, MOBILE]], [ /(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i // Lenovo tablets ], [VENDOR, MODEL, [TYPE, TABLET]], [ /(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, // HTC /(zte)-(\w+)*/i, // ZTE /(alcatel|geeksphone|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i // Alcatel/GeeksPhone/Lenovo/Nexian/Panasonic/Sony ], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [ /(nexus\s9)/i // HTC Nexus 9 ], [MODEL, [VENDOR, 'HTC'], [TYPE, TABLET]], [ /d\/huawei([\w\s-]+)[;\)]/i, /(nexus\s6p)/i // Huawei ], [MODEL, [VENDOR, 'Huawei'], [TYPE, MOBILE]], [ /(microsoft);\s(lumia[\s\w]+)/i // Microsoft Lumia ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /[\s\(;](xbox(?:\sone)?)[\s\);]/i // Microsoft Xbox ], [MODEL, [VENDOR, 'Microsoft'], [TYPE, CONSOLE]], [ /(kin\.[onetw]{3})/i // Microsoft Kin ], [[MODEL, /\./g, ' '], [VENDOR, 'Microsoft'], [TYPE, MOBILE]], [ // Motorola /\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?)[\w\s]+build\//i, /mot[\s-]?(\w+)*/i, /(XT\d{3,4}) build\//i, /(nexus\s6)/i ], [MODEL, [VENDOR, 'Motorola'], [TYPE, MOBILE]], [ /android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i ], [MODEL, [VENDOR, 'Motorola'], [TYPE, TABLET]], [ /hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i // HbbTV devices ], [[VENDOR, util.trim], [MODEL, util.trim], [TYPE, SMARTTV]], [ /hbbtv.+maple;(\d+)/i ], [[MODEL, /^/, 'SmartTV'], [VENDOR, 'Samsung'], [TYPE, SMARTTV]], [ /\(dtv[\);].+(aquos)/i // Sharp ], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [ /android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i, /((SM-T\w+))/i ], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [ // Samsung /smart-tv.+(samsung)/i ], [VENDOR, [TYPE, SMARTTV], MODEL], [ /((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i, /(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i, /sec-((sgh\w+))/i ], [[VENDOR, 'Samsung'], MODEL, [TYPE, MOBILE]], [ /sie-(\w+)*/i // Siemens ], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [ /(maemo|nokia).*(n900|lumia\s\d+)/i, // Nokia /(nokia)[\s_-]?([\w-]+)*/i ], [[VENDOR, 'Nokia'], MODEL, [TYPE, MOBILE]], [ /android\s3\.[\s\w;-]{10}(a\d{3})/i // Acer ], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [ /android.+([vl]k\-?\d{3})\s+build/i // LG Tablet ], [MODEL, [VENDOR, 'LG'], [TYPE, TABLET]], [ /android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i // LG Tablet ], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [ /(lg) netcast\.tv/i // LG SmartTV ], [VENDOR, MODEL, [TYPE, SMARTTV]], [ /(nexus\s[45])/i, // LG /lg[e;\s\/-]+(\w+)*/i, /android.+lg(\-?[\d\w]+)\s+build/i ], [MODEL, [VENDOR, 'LG'], [TYPE, MOBILE]], [ /android.+(ideatab[a-z0-9\-\s]+)/i // Lenovo ], [MODEL, [VENDOR, 'Lenovo'], [TYPE, TABLET]], [ /linux;.+((jolla));/i // Jolla ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /((pebble))app\/[\d\.]+\s/i // Pebble ], [VENDOR, MODEL, [TYPE, WEARABLE]], [ /android.+;\s(oppo)\s?([\w\s]+)\sbuild/i // OPPO ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /crkey/i // Google Chromecast ], [[MODEL, 'Chromecast'], [VENDOR, 'Google']], [ /android.+;\s(glass)\s\d/i // Google Glass ], [MODEL, [VENDOR, 'Google'], [TYPE, WEARABLE]], [ /android.+;\s(pixel c)\s/i // Google Pixel C ], [MODEL, [VENDOR, 'Google'], [TYPE, TABLET]], [ /android.+;\s(pixel xl|pixel)\s/i // Google Pixel ], [MODEL, [VENDOR, 'Google'], [TYPE, MOBILE]], [ /android.+(\w+)\s+build\/hm\1/i, // Xiaomi Hongmi 'numeric' models /android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i, // Xiaomi Hongmi /android.+(mi[\s\-_]*(?:one|one[\s_]plus|note lte)?[\s_]*(?:\d\w)?)\s+build/i // Xiaomi Mi ], [[MODEL, /_/g, ' '], [VENDOR, 'Xiaomi'], [TYPE, MOBILE]], [ /android.+;\s(m[1-5]\snote)\sbuild/i // Meizu Tablet ], [MODEL, [VENDOR, 'Meizu'], [TYPE, TABLET]], [ /android.+a000(1)\s+build/i // OnePlus ], [MODEL, [VENDOR, 'OnePlus'], [TYPE, MOBILE]], [ /android.+[;\/]\s*(RCT[\d\w]+)\s+build/i // RCA Tablets ], [MODEL, [VENDOR, 'RCA'], [TYPE, TABLET]], [ /android.+[;\/]\s*(Venue[\d\s]*)\s+build/i // Dell Venue Tablets ], [MODEL, [VENDOR, 'Dell'], [TYPE, TABLET]], [ /android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i // Verizon Tablet ], [MODEL, [VENDOR, 'Verizon'], [TYPE, TABLET]], [ /android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i // Barnes & Noble Tablet ], [[VENDOR, 'Barnes & Noble'], MODEL, [TYPE, TABLET]], [ /android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i // Barnes & Noble Tablet ], [MODEL, [VENDOR, 'NuVision'], [TYPE, TABLET]], [ /android.+[;\/]\s*(zte)?.+(k\d{2})\s+build/i // ZTE K Series Tablet ], [[VENDOR, 'ZTE'], MODEL, [TYPE, TABLET]], [ /android.+[;\/]\s*(gen\d{3})\s+build.*49h/i // Swiss GEN Mobile ], [MODEL, [VENDOR, 'Swiss'], [TYPE, MOBILE]], [ /android.+[;\/]\s*(zur\d{3})\s+build/i // Swiss ZUR Tablet ], [MODEL, [VENDOR, 'Swiss'], [TYPE, TABLET]], [ /android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i // Zeki Tablets ], [MODEL, [VENDOR, 'Zeki'], [TYPE, TABLET]], [ /(android).+[;\/]\s+([YR]\d{2}x?.*)\s+build/i, /android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(.+)\s+build/i // Dragon Touch Tablet ], [[VENDOR, 'Dragon Touch'], MODEL, [TYPE, TABLET]], [ /android.+[;\/]\s*(NS-?.+)\s+build/i // Insignia Tablets ], [MODEL, [VENDOR, 'Insignia'], [TYPE, TABLET]], [ /android.+[;\/]\s*((NX|Next)-?.+)\s+build/i // NextBook Tablets ], [MODEL, [VENDOR, 'NextBook'], [TYPE, TABLET]], [ /android.+[;\/]\s*(Xtreme\_?)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i ], [[VENDOR, 'Voice'], MODEL, [TYPE, MOBILE]], [ // Voice Xtreme Phones /android.+[;\/]\s*(LVTEL\-?)?(V1[12])\s+build/i // LvTel Phones ], [[VENDOR, 'LvTel'], MODEL, [TYPE, MOBILE]], [ /android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i // Envizen Tablets ], [MODEL, [VENDOR, 'Envizen'], [TYPE, TABLET]], [ /android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(.*\b)\s+build/i // Le Pan Tablets ], [VENDOR, MODEL, [TYPE, TABLET]], [ /android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i // MachSpeed Tablets ], [MODEL, [VENDOR, 'MachSpeed'], [TYPE, TABLET]], [ /android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i // Trinity Tablets ], [VENDOR, MODEL, [TYPE, TABLET]], [ /android.+[;\/]\s*TU_(1491)\s+build/i // Rotor Tablets ], [MODEL, [VENDOR, 'Rotor'], [TYPE, TABLET]], [ /android.+(KS(.+))\s+build/i // Amazon Kindle Tablets ], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [ /android.+(Gigaset)[\s\-]+(Q.+)\s+build/i // Gigaset Tablets ], [VENDOR, MODEL, [TYPE, TABLET]], [ /\s(tablet|tab)[;\/]/i, // Unidentifiable Tablet /\s(mobile)(?:[;\/]|\ssafari)/i // Unidentifiable Mobile ], [[TYPE, util.lowerize], VENDOR, MODEL], [ /(android.+)[;\/].+build/i // Generic Android Device ], [MODEL, [VENDOR, 'Generic']] /*////////////////////////// // TODO: move to string map //////////////////////////// /(C6603)/i // Sony Xperia Z C6603 ], [[MODEL, 'Xperia Z C6603'], [VENDOR, 'Sony'], [TYPE, MOBILE]], [ /(C6903)/i // Sony Xperia Z 1 ], [[MODEL, 'Xperia Z 1'], [VENDOR, 'Sony'], [TYPE, MOBILE]], [ /(SM-G900[F|H])/i // Samsung Galaxy S5 ], [[MODEL, 'Galaxy S5'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ /(SM-G7102)/i // Samsung Galaxy Grand 2 ], [[MODEL, 'Galaxy Grand 2'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ /(SM-G530H)/i // Samsung Galaxy Grand Prime ], [[MODEL, 'Galaxy Grand Prime'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ /(SM-G313HZ)/i // Samsung Galaxy V ], [[MODEL, 'Galaxy V'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ /(SM-T805)/i // Samsung Galaxy Tab S 10.5 ], [[MODEL, 'Galaxy Tab S 10.5'], [VENDOR, 'Samsung'], [TYPE, TABLET]], [ /(SM-G800F)/i // Samsung Galaxy S5 Mini ], [[MODEL, 'Galaxy S5 Mini'], [VENDOR, 'Samsung'], [TYPE, MOBILE]], [ /(SM-T311)/i // Samsung Galaxy Tab 3 8.0 ], [[MODEL, 'Galaxy Tab 3 8.0'], [VENDOR, 'Samsung'], [TYPE, TABLET]], [ /(T3C)/i // Advan Vandroid T3C ], [MODEL, [VENDOR, 'Advan'], [TYPE, TABLET]], [ /(ADVAN T1J\+)/i // Advan Vandroid T1J+ ], [[MODEL, 'Vandroid T1J+'], [VENDOR, 'Advan'], [TYPE, TABLET]], [ /(ADVAN S4A)/i // Advan Vandroid S4A ], [[MODEL, 'Vandroid S4A'], [VENDOR, 'Advan'], [TYPE, MOBILE]], [ /(V972M)/i // ZTE V972M ], [MODEL, [VENDOR, 'ZTE'], [TYPE, MOBILE]], [ /(i-mobile)\s(IQ\s[\d\.]+)/i // i-mobile IQ ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /(IQ6.3)/i // i-mobile IQ IQ 6.3 ], [[MODEL, 'IQ 6.3'], [VENDOR, 'i-mobile'], [TYPE, MOBILE]], [ /(i-mobile)\s(i-style\s[\d\.]+)/i // i-mobile i-STYLE ], [VENDOR, MODEL, [TYPE, MOBILE]], [ /(i-STYLE2.1)/i // i-mobile i-STYLE 2.1 ], [[MODEL, 'i-STYLE 2.1'], [VENDOR, 'i-mobile'], [TYPE, MOBILE]], [ /(mobiistar touch LAI 512)/i // mobiistar touch LAI 512 ], [[MODEL, 'Touch LAI 512'], [VENDOR, 'mobiistar'], [TYPE, MOBILE]], [ ///////////// // END TODO ///////////*/ ], engine : [[ /windows.+\sedge\/([\w\.]+)/i // EdgeHTML ], [VERSION, [NAME, 'EdgeHTML']], [ /(presto)\/([\w\.]+)/i, // Presto /(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m /(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links /(icab)[\/\s]([23]\.[\d\.]+)/i // iCab ], [NAME, VERSION], [ /rv\:([\w\.]+).*(gecko)/i // Gecko ], [VERSION, NAME] ], os : [[ // Windows based /microsoft\s(windows)\s(vista|xp)/i // Windows (iTunes) ], [NAME, VERSION], [ /(windows)\snt\s6\.2;\s(arm)/i, // Windows RT /(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s]+\w)*/i, // Windows Phone /(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i ], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [ /(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i ], [[NAME, 'Windows'], [VERSION, mapper.str, maps.os.windows.version]], [ // Mobile/Embedded OS /\((bb)(10);/i // BlackBerry 10 ], [[NAME, 'BlackBerry'], VERSION], [ /(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry /(tizen)[\/\s]([\w\.]+)/i, // Tizen /(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i, // Android/WebOS/Palm/QNX/Bada/RIM/MeeGo/Contiki /linux;.+(sailfish);/i // Sailfish OS ], [NAME, VERSION], [ /(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian ], [[NAME, 'Symbian'], VERSION], [ /\((series40);/i // Series 40 ], [NAME], [ /mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS ], [[NAME, 'Firefox OS'], VERSION], [ // Console /(nintendo|playstation)\s([wids34portablevu]+)/i, // Nintendo/Playstation // GNU/Linux based /(mint)[\/\s\(]?(\w+)*/i, // Mint /(mageia|vectorlinux)[;\s]/i, // Mageia/VectorLinux /(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]+)*/i, // Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware // Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus /(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux /(gnu)\s?([\w\.]+)*/i // GNU ], [NAME, VERSION], [ /(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS ], [[NAME, 'Chromium OS'], VERSION],[ // Solaris /(sunos)\s?([\w\.]+\d)*/i // Solaris ], [[NAME, 'Solaris'], VERSION], [ // BSD based /\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly ], [NAME, VERSION],[ /(haiku)\s(\w+)/i // Haiku ], [NAME, VERSION],[ /cfnetwork\/.+darwin/i, /ip[honead]+(?:.*os\s([\w]+)*\slike\smac|;\sopera)/i // iOS ], [[VERSION, /_/g, '.'], [NAME, 'iOS']], [ /(mac\sos\sx)\s?([\w\s\.]+\w)*/i, /(macintosh|mac(?=_powerpc)\s)/i // Mac OS ], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [ // Other /((?:open)?solaris)[\/\s-]?([\w\.]+)*/i, // Solaris /(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX /(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i, // Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS /(unix)\s?([\w\.]+)*/i // UNIX ], [NAME, VERSION] ] }; ///////////////// // Constructor //////////////// var Browser = function (name, version) { this[NAME] = name; this[VERSION] = version; }; var CPU = function (arch) { this[ARCHITECTURE] = arch; }; var Device = function (vendor, model, type) { this[VENDOR] = vendor; this[MODEL] = model; this[TYPE] = type; }; var Engine = Browser; var OS = Browser; var UAParser = function (uastring, extensions) { if (typeof uastring === 'object') { extensions = uastring; uastring = undefined; } if (!(this instanceof UAParser)) { return new UAParser(uastring, extensions).getResult(); } var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY); var rgxmap = extensions ? util.extend(regexes, extensions) : regexes; var browser = new Browser(); var cpu = new CPU(); var device = new Device(); var engine = new Engine(); var os = new OS(); this.getBrowser = function () { mapper.rgx.call(browser, ua, rgxmap.browser); browser.major = util.major(browser.version); // deprecated return browser; }; this.getCPU = function () { mapper.rgx.call(cpu, ua, rgxmap.cpu); return cpu; }; this.getDevice = function () { mapper.rgx.call(device, ua, rgxmap.device); return device; }; this.getEngine = function () { mapper.rgx.call(engine, ua, rgxmap.engine); return engine; }; this.getOS = function () { mapper.rgx.call(os, ua, rgxmap.os); return os; }; this.getResult = function () { return { ua : this.getUA(), browser : this.getBrowser(), engine : this.getEngine(), os : this.getOS(), device : this.getDevice(), cpu : this.getCPU() }; }; this.getUA = function () { return ua; }; this.setUA = function (uastring) { ua = uastring; browser = new Browser(); cpu = new CPU(); device = new Device(); engine = new Engine(); os = new OS(); return this; }; return this; }; UAParser.VERSION = LIBVERSION; UAParser.BROWSER = { NAME : NAME, MAJOR : MAJOR, // deprecated VERSION : VERSION }; UAParser.CPU = { ARCHITECTURE : ARCHITECTURE }; UAParser.DEVICE = { MODEL : MODEL, VENDOR : VENDOR, TYPE : TYPE, CONSOLE : CONSOLE, MOBILE : MOBILE, SMARTTV : SMARTTV, TABLET : TABLET, WEARABLE: WEARABLE, EMBEDDED: EMBEDDED }; UAParser.ENGINE = { NAME : NAME, VERSION : VERSION }; UAParser.OS = { NAME : NAME, VERSION : VERSION }; //UAParser.Utils = util; /////////// // Export ////////// // check js environment if (typeof(exports) !== UNDEF_TYPE) { // nodejs env if (typeof module !== UNDEF_TYPE && module.exports) { exports = module.exports = UAParser; } exports.UAParser = UAParser; } else { // requirejs env (optional) if ("function" === FUNC_TYPE && __webpack_require__(148)) { !(__WEBPACK_AMD_DEFINE_RESULT__ = function () { return UAParser; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (window) { // browser env window.UAParser = UAParser; } } // jQuery/Zepto specific (optional) // Note: // In AMD env the global scope should be kept clean, but jQuery is an exception. // jQuery always exports to global scope, unless jQuery.noConflict(true) is used, // and we should catch that. var $ = window && (window.jQuery || window.Zepto); if (typeof $ !== UNDEF_TYPE) { var parser = new UAParser(); $.ua = parser.getResult(); $.ua.get = function () { return parser.getUA(); }; $.ua.set = function (uastring) { parser.setUA(uastring); var result = parser.getResult(); for (var prop in result) { $.ua[prop] = result[prop]; } }; } })(typeof window === 'object' ? window : this); /***/ }), /* 148 */ /***/ (function(module, exports) { /* WEBPACK VAR INJECTION */(function(__webpack_amd_options__) {module.exports = __webpack_amd_options__; /* WEBPACK VAR INJECTION */}.call(exports, {})) /***/ }) /******/ ]) }); ;
packages/material-ui-icons/src/LaunchSharp.js
Kagami/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><path d="M19 19H5V5h7V3H3v18h18v-9h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z" /></React.Fragment> , 'LaunchSharp');
ajax/libs/yui/3.7.3/scrollview-base/scrollview-base-coverage.js
rivanvx/cdnjs
if (typeof _yuitest_coverage == "undefined"){ _yuitest_coverage = {}; _yuitest_coverline = function(src, line){ var coverage = _yuitest_coverage[src]; if (!coverage.lines[line]){ coverage.calledLines++; } coverage.lines[line]++; }; _yuitest_coverfunc = function(src, name, line){ var coverage = _yuitest_coverage[src], funcId = name + ":" + line; if (!coverage.functions[funcId]){ coverage.calledFunctions++; } coverage.functions[funcId]++; }; } _yuitest_coverage["build/scrollview-base/scrollview-base.js"] = { lines: {}, functions: {}, coveredLines: 0, calledLines: 0, coveredFunctions: 0, calledFunctions: 0, path: "build/scrollview-base/scrollview-base.js", code: [] }; _yuitest_coverage["build/scrollview-base/scrollview-base.js"].code=["YUI.add('scrollview-base', function (Y, NAME) {","","/**"," * The scrollview-base module provides a basic ScrollView Widget, without scrollbar indicators"," *"," * @module scrollview"," * @submodule scrollview-base"," */","var getClassName = Y.ClassNameManager.getClassName,"," DOCUMENT = Y.config.doc,"," WINDOW = Y.config.win,"," IE = Y.UA.ie,"," NATIVE_TRANSITIONS = Y.Transition.useNative,"," vendorPrefix = Y.Transition._VENDOR_PREFIX, // Todo: This is a private property, and alternative approaches should be investigated"," SCROLLVIEW = 'scrollview',"," CLASS_NAMES = {"," vertical: getClassName(SCROLLVIEW, 'vert'),"," horizontal: getClassName(SCROLLVIEW, 'horiz')"," },"," EV_SCROLL_END = 'scrollEnd',"," FLICK = 'flick',"," DRAG = 'drag',"," MOUSEWHEEL = 'mousewheel',"," UI = 'ui',"," TOP = 'top',"," RIGHT = 'right',"," BOTTOM = 'bottom',"," LEFT = 'left',"," PX = 'px',"," AXIS = 'axis',"," SCROLL_Y = 'scrollY',"," SCROLL_X = 'scrollX',"," BOUNCE = 'bounce',"," DISABLED = 'disabled',"," DECELERATION = 'deceleration',"," DIM_X = 'x',"," DIM_Y = 'y',"," BOUNDING_BOX = 'boundingBox',"," CONTENT_BOX = 'contentBox',"," GESTURE_MOVE = 'gesturemove',"," START = 'start',"," END = 'end',"," EMPTY = '',"," ZERO = '0s',"," SNAP_DURATION = 'snapDuration',"," SNAP_EASING = 'snapEasing', "," EASING = 'easing', "," FRAME_DURATION = 'frameDuration', "," BOUNCE_RANGE = 'bounceRange',"," "," _constrain = function (val, min, max) {"," return Math.min(Math.max(val, min), max);"," };","","/**"," * ScrollView provides a scrollable widget, supporting flick gestures,"," * across both touch and mouse based devices."," *"," * @class ScrollView"," * @param config {Object} Object literal with initial attribute values"," * @extends Widget"," * @constructor"," */","function ScrollView() {"," ScrollView.superclass.constructor.apply(this, arguments);","}","","Y.ScrollView = Y.extend(ScrollView, Y.Widget, {",""," // *** Y.ScrollView prototype",""," /**"," * Flag driving whether or not we should try and force H/W acceleration when transforming. Currently enabled by default for Webkit."," * Used by the _transform method."," *"," * @property _forceHWTransforms"," * @type boolean"," * @protected"," */"," _forceHWTransforms: Y.UA.webkit ? true : false,",""," /**"," * <p>Used to control whether or not ScrollView's internal"," * gesturemovestart, gesturemove and gesturemoveend"," * event listeners should preventDefault. The value is an"," * object, with \"start\", \"move\" and \"end\" properties used to"," * specify which events should preventDefault and which shouldn't:</p>"," *"," * <pre>"," * {"," * start: false,"," * move: true,"," * end: false"," * }"," * </pre>"," *"," * <p>The default values are set up in order to prevent panning,"," * on touch devices, while allowing click listeners on elements inside"," * the ScrollView to be notified as expected.</p>"," *"," * @property _prevent"," * @type Object"," * @protected"," */"," _prevent: {"," start: false,"," move: true,"," end: false"," },",""," /**"," * Contains the distance (postive or negative) in pixels by which "," * the scrollview was last scrolled. This is useful when setting up "," * click listeners on the scrollview content, which on mouse based "," * devices are always fired, even after a drag/flick. "," * "," * <p>Touch based devices don't currently fire a click event, "," * if the finger has been moved (beyond a threshold) so this "," * check isn't required, if working in a purely touch based environment</p>"," * "," * @property lastScrolledAmt"," * @type Number"," * @public"," * @default 0"," */"," lastScrolledAmt: 0,",""," /**"," * Designated initializer"," *"," * @method initializer"," * @param {config} Configuration object for the plugin"," */"," initializer: function (config) {"," var sv = this;",""," // Cache these values, since they aren't going to change."," sv._bb = sv.get(BOUNDING_BOX);"," sv._cb = sv.get(CONTENT_BOX);",""," // Cache some attributes"," sv._cAxis = sv.get(AXIS);"," sv._cBounce = sv.get(BOUNCE);"," sv._cBounceRange = sv.get(BOUNCE_RANGE);"," sv._cDeceleration = sv.get(DECELERATION);"," sv._cFrameDuration = sv.get(FRAME_DURATION);"," },",""," /**"," * bindUI implementation"," *"," * Hooks up events for the widget"," * @method bindUI"," */"," bindUI: function () {"," var sv = this;",""," // Bind interaction listers"," sv._bindFlick(sv.get(FLICK));"," sv._bindDrag(sv.get(DRAG));"," sv._bindMousewheel(true);"," "," // Bind change events"," sv._bindAttrs();",""," // IE SELECT HACK. See if we can do this non-natively and in the gesture for a future release."," if (IE) {"," sv._fixIESelect(sv._bb, sv._cb);"," }",""," // Set any deprecated static properties"," if (ScrollView.SNAP_DURATION) {"," sv.set(SNAP_DURATION, ScrollView.SNAP_DURATION);"," }",""," if (ScrollView.SNAP_EASING) {"," sv.set(SNAP_EASING, ScrollView.SNAP_EASING);"," }",""," if (ScrollView.EASING) {"," sv.set(EASING, ScrollView.EASING);"," }",""," if (ScrollView.FRAME_STEP) {"," sv.set(FRAME_DURATION, ScrollView.FRAME_STEP);"," }",""," if (ScrollView.BOUNCE_RANGE) {"," sv.set(BOUNCE_RANGE, ScrollView.BOUNCE_RANGE);"," }",""," // Recalculate dimension properties"," // TODO: This should be throttled."," // Y.one(WINDOW).after('resize', sv._afterDimChange, sv);"," },",""," /**"," * Bind event listeners"," *"," * @method _bindAttrs"," * @private"," */"," _bindAttrs: function () {"," var sv = this,"," scrollChangeHandler = sv._afterScrollChange,"," dimChangeHandler = sv._afterDimChange;",""," // Bind any change event listeners"," sv.after({"," 'scrollEnd': sv._afterScrollEnd,"," 'disabledChange': sv._afterDisabledChange,"," 'flickChange': sv._afterFlickChange,"," 'dragChange': sv._afterDragChange,"," 'axisChange': sv._afterAxisChange,"," 'scrollYChange': scrollChangeHandler,"," 'scrollXChange': scrollChangeHandler,"," 'heightChange': dimChangeHandler,"," 'widthChange': dimChangeHandler"," });"," },",""," /**"," * Bind (or unbind) gesture move listeners required for drag support"," *"," * @method _bindDrag"," * @param drag {boolean} If true, the method binds listener to enable drag (gesturemovestart). If false, the method unbinds gesturemove listeners for drag support."," * @private"," */"," _bindDrag: function (drag) {"," var sv = this,"," bb = sv._bb;",""," // Unbind any previous 'drag' listeners"," bb.detach(DRAG + '|*');",""," if (drag) {"," bb.on(DRAG + '|' + GESTURE_MOVE + START, Y.bind(sv._onGestureMoveStart, sv));"," }"," },",""," /**"," * Bind (or unbind) flick listeners."," *"," * @method _bindFlick"," * @param flick {Object|boolean} If truthy, the method binds listeners for flick support. If false, the method unbinds flick listeners."," * @private"," */"," _bindFlick: function (flick) {"," var sv = this,"," bb = sv._bb;",""," // Unbind any previous 'flick' listeners"," bb.detach(FLICK + '|*');",""," if (flick) {"," bb.on(FLICK + '|' + FLICK, Y.bind(sv._flick, sv), flick);",""," // Rebind Drag, becuase _onGestureMoveEnd always has to fire -after- _flick"," sv._bindDrag(sv.get(DRAG));"," }"," },",""," /**"," * Bind (or unbind) mousewheel listeners."," *"," * @method _bindMousewheel"," * @param mousewheel {Object|boolean} If truthy, the method binds listeners for mousewheel support. If false, the method unbinds mousewheel listeners."," * @private"," */"," _bindMousewheel: function (mousewheel) {"," var sv = this,"," bb = sv._bb;",""," // Unbind any previous 'mousewheel' listeners"," bb.detach(MOUSEWHEEL + '|*');",""," // Only enable for vertical scrollviews"," if (mousewheel) {"," // Bound to document, because that's where mousewheel events fire off of."," Y.one(DOCUMENT).on(MOUSEWHEEL, Y.bind(sv._mousewheel, sv));"," }"," },",""," /**"," * syncUI implementation."," *"," * Update the scroll position, based on the current value of scrollX/scrollY."," *"," * @method syncUI"," */"," syncUI: function () {"," var sv = this,"," scrollDims = sv._getScrollDims(),"," width = scrollDims.offsetWidth,"," height = scrollDims.offsetHeight,"," scrollWidth = scrollDims.scrollWidth,"," scrollHeight = scrollDims.scrollHeight;",""," // If the axis is undefined, auto-calculate it"," if (sv._cAxis === undefined) {"," // This should only ever be run once (for now)."," // In the future SV might post-load axis changes"," sv._cAxis = {"," x: (scrollWidth > width),"," y: (scrollHeight > height)"," };",""," sv._set(AXIS, sv._cAxis);"," }"," "," // get text direction on or inherited by scrollview node"," sv.rtl = (sv._cb.getComputedStyle('direction') === 'rtl');",""," // Cache the disabled value"," sv._cDisabled = sv.get(DISABLED);",""," // Run this to set initial values"," sv._uiDimensionsChange();",""," // If we're out-of-bounds, snap back."," if (sv._isOutOfBounds()) {"," sv._snapBack();"," }"," },",""," /**"," * Utility method to obtain widget dimensions"," * "," * @method _getScrollDims"," * @returns {Object} The offsetWidth, offsetHeight, scrollWidth and scrollHeight as an array: [offsetWidth, offsetHeight, scrollWidth, scrollHeight]"," * @private"," */"," _getScrollDims: function () {"," var sv = this,"," cb = sv._cb,"," bb = sv._bb,"," TRANS = ScrollView._TRANSITION,"," // Ideally using CSSMatrix - don't think we have it normalized yet though."," // origX = (new WebKitCSSMatrix(cb.getComputedStyle(\"transform\"))).e,"," // origY = (new WebKitCSSMatrix(cb.getComputedStyle(\"transform\"))).f,"," origX = sv.get(SCROLL_X),"," origY = sv.get(SCROLL_Y),"," origHWTransform,"," dims;",""," // TODO: Is this OK? Just in case it's called 'during' a transition."," if (NATIVE_TRANSITIONS) {"," cb.setStyle(TRANS.DURATION, ZERO);"," cb.setStyle(TRANS.PROPERTY, EMPTY);"," }",""," origHWTransform = sv._forceHWTransforms;"," sv._forceHWTransforms = false; // the z translation was causing issues with picking up accurate scrollWidths in Chrome/Mac.",""," sv._moveTo(cb, 0, 0);"," dims = {"," 'offsetWidth': bb.get('offsetWidth'),"," 'offsetHeight': bb.get('offsetHeight'),"," 'scrollWidth': bb.get('scrollWidth'),"," 'scrollHeight': bb.get('scrollHeight')"," };"," sv._moveTo(cb, -(origX), -(origY));",""," sv._forceHWTransforms = origHWTransform;",""," return dims;"," },",""," /**"," * This method gets invoked whenever the height or width attributes change,"," * allowing us to determine which scrolling axes need to be enabled."," *"," * @method _uiDimensionsChange"," * @protected"," */"," _uiDimensionsChange: function () {"," var sv = this,"," bb = sv._bb,"," scrollDims = sv._getScrollDims(),"," width = scrollDims.offsetWidth,"," height = scrollDims.offsetHeight,"," scrollWidth = scrollDims.scrollWidth,"," scrollHeight = scrollDims.scrollHeight,"," rtl = sv.rtl,"," svAxis = sv._cAxis;"," "," if (svAxis && svAxis.x) {"," bb.addClass(CLASS_NAMES.horizontal);"," }",""," if (svAxis && svAxis.y) {"," bb.addClass(CLASS_NAMES.vertical);"," }",""," /**"," * Internal state, defines the minimum amount that the scrollview can be scrolled along the X axis"," *"," * @property _minScrollX"," * @type number"," * @protected"," */"," sv._minScrollX = (rtl) ? Math.min(0, -(scrollWidth - width)) : 0;",""," /**"," * Internal state, defines the maximum amount that the scrollview can be scrolled along the X axis"," *"," * @property _maxScrollX"," * @type number"," * @protected"," */"," sv._maxScrollX = (rtl) ? 0 : Math.max(0, scrollWidth - width);",""," /**"," * Internal state, defines the minimum amount that the scrollview can be scrolled along the Y axis"," *"," * @property _minScrollY"," * @type number"," * @protected"," */"," sv._minScrollY = 0;",""," /**"," * Internal state, defines the maximum amount that the scrollview can be scrolled along the Y axis"," *"," * @property _maxScrollY"," * @type number"," * @protected"," */"," sv._maxScrollY = Math.max(0, scrollHeight - height);"," },",""," /**"," * Scroll the element to a given xy coordinate"," *"," * @method scrollTo"," * @param x {Number} The x-position to scroll to. (null for no movement)"," * @param y {Number} The y-position to scroll to. (null for no movement)"," * @param {Number} [duration] ms of the scroll animation. (default is 0)"," * @param {String} [easing] An easing equation if duration is set. (default is `easing` attribute)"," * @param {String} [node] The node to transform. Setting this can be useful in dual-axis paginated instances. (default is the instance's contentBox)"," */"," scrollTo: function (x, y, duration, easing, node) {"," // Check to see if widget is disabled"," if (this._cDisabled) {"," return;"," }",""," var sv = this,"," cb = sv._cb,"," TRANS = ScrollView._TRANSITION,"," callback = Y.bind(sv._onTransEnd, sv), // @Todo : cache this"," newX = 0,"," newY = 0,"," transition = {},"," transform;",""," // default the optional arguments"," duration = duration || 0;"," easing = easing || sv.get(EASING); // @TODO: Cache this"," node = node || cb;",""," if (x !== null) {"," sv.set(SCROLL_X, x, {src:UI});"," newX = -(x);"," }",""," if (y !== null) {"," sv.set(SCROLL_Y, y, {src:UI});"," newY = -(y);"," }",""," transform = sv._transform(newX, newY);",""," if (NATIVE_TRANSITIONS) {"," // ANDROID WORKAROUND - try and stop existing transition, before kicking off new one."," node.setStyle(TRANS.DURATION, ZERO).setStyle(TRANS.PROPERTY, EMPTY);"," }",""," // Move"," if (duration === 0) {"," if (NATIVE_TRANSITIONS) {"," node.setStyle('transform', transform);"," }"," else {"," // TODO: If both set, batch them in the same update"," // Update: Nope, setStyles() just loops through each property and applies it."," if (x !== null) {"," node.setStyle(LEFT, newX + PX);"," }"," if (y !== null) {"," node.setStyle(TOP, newY + PX);"," }"," }"," }",""," // Animate"," else {"," transition.easing = easing;"," transition.duration = duration / 1000;",""," if (NATIVE_TRANSITIONS) {"," transition.transform = transform;"," }"," else {"," transition.left = newX + PX;"," transition.top = newY + PX;"," }",""," node.transition(transition, callback);"," }"," },",""," /**"," * Utility method, to create the translate transform string with the"," * x, y translation amounts provided."," *"," * @method _transform"," * @param {Number} x Number of pixels to translate along the x axis"," * @param {Number} y Number of pixels to translate along the y axis"," * @private"," */"," _transform: function (x, y) {"," // TODO: Would we be better off using a Matrix for this?"," var prop = 'translate(' + x + 'px, ' + y + 'px)';",""," if (this._forceHWTransforms) {"," prop += ' translateZ(0)';"," }",""," return prop;"," },",""," /**"," * Utility method, to move the given element to the given xy position"," *"," * @method _moveTo"," * @param node {Node} The node to move"," * @param x {Number} The x-position to move to"," * @param y {Number} The y-position to move to"," * @private"," */"," _moveTo : function(node, x, y) {"," if (NATIVE_TRANSITIONS) {"," node.setStyle('transform', this._transform(x, y));"," } else {"," node.setStyle(LEFT, x + PX);"," node.setStyle(TOP, y + PX);"," }"," },","",""," /**"," * Content box transition callback"," *"," * @method _onTransEnd"," * @param {Event.Facade} e The event facade"," * @private"," */"," _onTransEnd: function (e) {"," var sv = this;",""," /**"," * Notification event fired at the end of a scroll transition"," *"," * @event scrollEnd"," * @param e {EventFacade} The default event facade."," */"," sv.fire(EV_SCROLL_END);"," },",""," /**"," * gesturemovestart event handler"," *"," * @method _onGestureMoveStart"," * @param e {Event.Facade} The gesturemovestart event facade"," * @private"," */"," _onGestureMoveStart: function (e) {",""," if (this._cDisabled) {"," return false;"," }",""," var sv = this,"," bb = sv._bb,"," currentX = sv.get(SCROLL_X),"," currentY = sv.get(SCROLL_Y),"," clientX = e.clientX,"," clientY = e.clientY;",""," if (sv._prevent.start) {"," e.preventDefault();"," }",""," // if a flick animation is in progress, cancel it"," if (sv._flickAnim) {"," // Cancel and delete sv._flickAnim"," sv._flickAnim.cancel();"," delete sv._flickAnim;"," sv._onTransEnd();"," }",""," // TODO: Review if neccesary (#2530129)"," e.stopPropagation();",""," // Reset lastScrolledAmt"," sv.lastScrolledAmt = 0;",""," // Stores data for this gesture cycle. Cleaned up later"," sv._gesture = {",""," // Will hold the axis value"," axis: null,",""," // The current attribute values"," startX: currentX,"," startY: currentY,",""," // The X/Y coordinates where the event began"," startClientX: clientX,"," startClientY: clientY,",""," // The X/Y coordinates where the event will end"," endClientX: null,"," endClientY: null,",""," // The current delta of the event"," deltaX: null,"," deltaY: null,",""," // Will be populated for flicks"," flick: null,",""," // Create some listeners for the rest of the gesture cycle"," onGestureMove: bb.on(DRAG + '|' + GESTURE_MOVE, Y.bind(sv._onGestureMove, sv)),"," "," // @TODO: Don't bind gestureMoveEnd if it's a Flick?"," onGestureMoveEnd: bb.on(DRAG + '|' + GESTURE_MOVE + END, Y.bind(sv._onGestureMoveEnd, sv))"," };"," },",""," /**"," * gesturemove event handler"," *"," * @method _onGestureMove"," * @param e {Event.Facade} The gesturemove event facade"," * @private"," */"," _onGestureMove: function (e) {"," var sv = this,"," gesture = sv._gesture,"," svAxis = sv._cAxis,"," svAxisX = svAxis.x,"," svAxisY = svAxis.y,"," startX = gesture.startX,"," startY = gesture.startY,"," startClientX = gesture.startClientX,"," startClientY = gesture.startClientY,"," clientX = e.clientX,"," clientY = e.clientY;",""," if (sv._prevent.move) {"," e.preventDefault();"," }",""," gesture.deltaX = startClientX - clientX;"," gesture.deltaY = startClientY - clientY;",""," // Determine if this is a vertical or horizontal movement"," // @TODO: This is crude, but it works. Investigate more intelligent ways to detect intent"," if (gesture.axis === null) {"," gesture.axis = (Math.abs(gesture.deltaX) > Math.abs(gesture.deltaY)) ? DIM_X : DIM_Y;"," }",""," // Move X or Y. @TODO: Move both if dualaxis. "," if (gesture.axis === DIM_X && svAxisX) {"," sv.set(SCROLL_X, startX + gesture.deltaX);"," }"," else if (gesture.axis === DIM_Y && svAxisY) {"," sv.set(SCROLL_Y, startY + gesture.deltaY);"," }"," },",""," /**"," * gesturemoveend event handler"," *"," * @method _onGestureMoveEnd"," * @param e {Event.Facade} The gesturemoveend event facade"," * @private"," */"," _onGestureMoveEnd: function (e) {"," var sv = this,"," gesture = sv._gesture,"," flick = gesture.flick,"," clientX = e.clientX,"," clientY = e.clientY;",""," if (sv._prevent.end) {"," e.preventDefault();"," }",""," // Store the end X/Y coordinates"," gesture.endClientX = clientX;"," gesture.endClientY = clientY;",""," // Cleanup the event handlers"," gesture.onGestureMove.detach();"," gesture.onGestureMoveEnd.detach();",""," // If this wasn't a flick, wrap up the gesture cycle"," if (!flick) {"," // @TODO: Be more intelligent about this. Look at the Flick attribute to see "," // if it is safe to assume _flick did or didn't fire. "," // Then, the order _flick and _onGestureMoveEnd fire doesn't matter?",""," // If there was movement (_onGestureMove fired)"," if (gesture.deltaX !== null && gesture.deltaY !== null) {",""," // If we're out-out-bounds, then snapback"," if (sv._isOutOfBounds()) {"," sv._snapBack();"," }",""," // Inbounds"," else {"," // Don't fire scrollEnd on the gesture axis is the same as paginator's"," // Not totally confident this is ideal to access a plugin's properties from a host, @TODO revisit"," if (sv.pages && !sv.pages.get(AXIS)[gesture.axis]) {"," sv._onTransEnd();"," }"," }"," }"," }"," },",""," /**"," * Execute a flick at the end of a scroll action"," *"," * @method _flick"," * @param e {Event.Facade} The Flick event facade"," * @private"," */"," _flick: function (e) {"," if (this._cDisabled) {"," return false;"," }",""," var sv = this,"," svAxis = sv._cAxis,"," flick = e.flick,"," flickAxis = flick.axis,"," flickVelocity = flick.velocity,"," axisAttr = flickAxis === DIM_X ? SCROLL_X : SCROLL_Y,"," startPosition = sv.get(axisAttr);",""," // Sometimes flick is enabled, but drag is disabled"," if (sv._gesture) {"," sv._gesture.flick = flick;"," }",""," // Prevent unneccesary firing of _flickFrame if we can't scroll on the flick axis"," if (svAxis[flickAxis]) {"," sv._flickFrame(flickVelocity, flickAxis, startPosition);"," }"," },",""," /**"," * Execute a single frame in the flick animation"," *"," * @method _flickFrame"," * @param velocity {Number} The velocity of this animated frame"," * @param flickAxis {String} The axis on which to animate"," * @param startPosition {Number} The starting X/Y point to flick from"," * @protected"," */"," _flickFrame: function (velocity, flickAxis, startPosition) {",""," var sv = this,"," axisAttr = flickAxis === DIM_X ? SCROLL_X : SCROLL_Y,",""," // Localize cached values"," bounce = sv._cBounce,"," bounceRange = sv._cBounceRange,"," deceleration = sv._cDeceleration,"," frameDuration = sv._cFrameDuration,",""," // Calculate"," newVelocity = velocity * deceleration,"," newPosition = startPosition - (frameDuration * newVelocity),",""," // Some convinience conditions"," min = flickAxis === DIM_X ? sv._minScrollX : sv._minScrollY,"," max = flickAxis === DIM_X ? sv._maxScrollX : sv._maxScrollY,"," belowMin = (newPosition < min),"," belowMax = (newPosition < max),"," aboveMin = (newPosition > min),"," aboveMax = (newPosition > max),"," belowMinRange = (newPosition < (min - bounceRange)),"," belowMaxRange = (newPosition < (max + bounceRange)),"," withinMinRange = (belowMin && (newPosition > (min - bounceRange))),"," withinMaxRange = (aboveMax && (newPosition < (max + bounceRange))),"," aboveMinRange = (newPosition > (min - bounceRange)),"," aboveMaxRange = (newPosition > (max + bounceRange)),"," tooSlow;",""," // If we're within the range but outside min/max, dampen the velocity"," if (withinMinRange || withinMaxRange) {"," newVelocity *= bounce;"," }",""," // Is the velocity too slow to bother?"," tooSlow = (Math.abs(newVelocity).toFixed(4) < 0.015);",""," // If the velocity is too slow or we're outside the range"," if (tooSlow || belowMinRange || aboveMaxRange) {"," // Cancel and delete sv._flickAnim"," if (sv._flickAnim) {"," sv._flickAnim.cancel();"," delete sv._flickAnim;"," }",""," // If we're inside the scroll area, just end"," if (aboveMin && belowMax) {"," sv._onTransEnd();"," }",""," // We're outside the scroll area, so we need to snap back"," else {"," sv._snapBack();"," }"," }",""," // Otherwise, animate to the next frame"," else {"," // @TODO: maybe use requestAnimationFrame instead"," sv._flickAnim = Y.later(frameDuration, sv, '_flickFrame', [newVelocity, flickAxis, newPosition]);"," sv.set(axisAttr, newPosition);"," }"," },",""," /**"," * Handle mousewheel events on the widget"," *"," * @method _mousewheel"," * @param e {Event.Facade} The mousewheel event facade"," * @private"," */"," _mousewheel: function (e) {"," var sv = this,"," scrollY = sv.get(SCROLL_Y),"," bb = sv._bb,"," scrollOffset = 10, // 10px"," isForward = (e.wheelDelta > 0),"," scrollToY = scrollY - ((isForward ? 1 : -1) * scrollOffset);",""," scrollToY = _constrain(scrollToY, sv._minScrollY, sv._maxScrollY);",""," // Because Mousewheel events fire off 'document', every ScrollView widget will react"," // to any mousewheel anywhere on the page. This check will ensure that the mouse is currently"," // over this specific ScrollView. Also, only allow mousewheel scrolling on Y-axis, "," // becuase otherwise the 'prevent' will block page scrolling."," if (bb.contains(e.target) && sv._cAxis[DIM_Y]) {",""," // Reset lastScrolledAmt"," sv.lastScrolledAmt = 0;",""," // Jump to the new offset"," sv.set(SCROLL_Y, scrollToY);",""," // if we have scrollbars plugin, update & set the flash timer on the scrollbar"," // @TODO: This probably shouldn't be in this module"," if (sv.scrollbars) {"," // @TODO: The scrollbars should handle this themselves"," sv.scrollbars._update();"," sv.scrollbars.flash();"," // or just this"," // sv.scrollbars._hostDimensionsChange();"," }",""," // Fire the 'scrollEnd' event"," sv._onTransEnd();",""," // prevent browser default behavior on mouse scroll"," e.preventDefault();"," }"," },",""," /**"," * Checks to see the current scrollX/scrollY position beyond the min/max boundary"," *"," * @method _isOutOfBounds"," * @param x {Number} [optional] The X position to check"," * @param y {Number} [optional] The Y position to check"," * @returns {boolen} Whether the current X/Y position is out of bounds (true) or not (false)"," * @private"," */"," _isOutOfBounds: function (x, y) {"," var sv = this,"," svAxis = sv._cAxis,"," svAxisX = svAxis.x,"," svAxisY = svAxis.y,"," currentX = x || sv.get(SCROLL_X),"," currentY = y || sv.get(SCROLL_Y),"," minX = sv._minScrollX,"," minY = sv._minScrollY,"," maxX = sv._maxScrollX,"," maxY = sv._maxScrollY;",""," return (svAxisX && (currentX < minX || currentX > maxX)) || (svAxisY && (currentY < minY || currentY > maxY));"," },",""," /**"," * Bounces back"," * @TODO: Should be more generalized and support both X and Y detection"," *"," * @method _snapBack"," * @private"," */"," _snapBack: function () {"," var sv = this,"," currentX = sv.get(SCROLL_X),"," currentY = sv.get(SCROLL_Y),"," minX = sv._minScrollX,"," minY = sv._minScrollY,"," maxX = sv._maxScrollX,"," maxY = sv._maxScrollY,"," newY = _constrain(currentY, minY, maxY),"," newX = _constrain(currentX, minX, maxX),"," duration = sv.get(SNAP_DURATION),"," easing = sv.get(SNAP_EASING);",""," if (newX !== currentX) {"," sv.set(SCROLL_X, newX, {duration:duration, easing:easing});"," }"," else if (newY !== currentY) {"," sv.set(SCROLL_Y, newY, {duration:duration, easing:easing});"," }"," else {"," // It shouldn't ever get here, but in case it does, fire scrollEnd"," sv._onTransEnd();"," }"," },",""," /**"," * After listener for changes to the scrollX or scrollY attribute"," *"," * @method _afterScrollChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterScrollChange: function (e) {",""," if (e.src === ScrollView.UI_SRC) {"," return false;"," }",""," var sv = this,"," duration = e.duration,"," easing = e.easing,"," val = e.newVal,"," scrollToArgs = [];",""," // Set the scrolled value"," sv.lastScrolledAmt = sv.lastScrolledAmt + (e.newVal - e.prevVal);",""," // Generate the array of args to pass to scrollTo()"," if (e.attrName === SCROLL_X) {"," scrollToArgs.push(val);"," scrollToArgs.push(sv.get(SCROLL_Y));"," }"," else {"," scrollToArgs.push(sv.get(SCROLL_X));"," scrollToArgs.push(val);"," }",""," scrollToArgs.push(duration);"," scrollToArgs.push(easing);",""," sv.scrollTo.apply(sv, scrollToArgs);"," },",""," /**"," * After listener for changes to the flick attribute"," *"," * @method _afterFlickChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterFlickChange: function (e) {"," this._bindFlick(e.newVal);"," },",""," /**"," * After listener for changes to the disabled attribute"," *"," * @method _afterDisabledChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterDisabledChange: function (e) {"," // Cache for performance - we check during move"," this._cDisabled = e.newVal;"," },",""," /**"," * After listener for the axis attribute"," *"," * @method _afterAxisChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterAxisChange: function (e) {"," this._cAxis = e.newVal;"," },",""," /**"," * After listener for changes to the drag attribute"," *"," * @method _afterDragChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterDragChange: function (e) {"," this._bindDrag(e.newVal);"," },",""," /**"," * After listener for the height or width attribute"," *"," * @method _afterDimChange"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterDimChange: function () {"," this._uiDimensionsChange();"," },",""," /**"," * After listener for scrollEnd, for cleanup"," *"," * @method _afterScrollEnd"," * @param e {Event.Facade} The event facade"," * @protected"," */"," _afterScrollEnd: function (e) {"," var sv = this;",""," // @TODO: Move to sv._cancelFlick()"," if (sv._flickAnim) {"," // Cancel the flick (if it exists)"," sv._flickAnim.cancel();",""," // Also delete it, otherwise _onGestureMoveStart will think we're still flicking"," delete sv._flickAnim;"," }",""," // If for some reason we're OOB, snapback"," if (sv._isOutOfBounds()) {"," sv._snapBack();"," }",""," // Ideally this should be removed, but doing so causing some JS errors with fast swiping "," // because _gesture is being deleted after the previous one has been overwritten"," // delete sv._gesture; // TODO: Move to sv.prevGesture?"," },",""," /**"," * Setter for 'axis' attribute"," *"," * @method _axisSetter"," * @param val {Mixed} A string ('x', 'y', 'xy') to specify which axis/axes to allow scrolling on"," * @param name {String} The attribute name"," * @return {Object} An object to specify scrollability on the x & y axes"," * "," * @protected"," */"," _axisSetter: function (val, name) {",""," // Turn a string into an axis object"," if (Y.Lang.isString(val)) {"," return {"," x: val.match(/x/i) ? true : false,"," y: val.match(/y/i) ? true : false"," };"," }"," },"," "," /**"," * The scrollX, scrollY setter implementation"," *"," * @method _setScroll"," * @private"," * @param {Number} val"," * @param {String} dim"," *"," * @return {Number} The value"," */"," _setScroll : function(val, dim) {",""," // Just ensure the widget is not disabled"," if (this._cDisabled) {"," val = Y.Attribute.INVALID_VALUE;"," } ",""," return val;"," },",""," /**"," * Setter for the scrollX attribute"," *"," * @method _setScrollX"," * @param val {Number} The new scrollX value"," * @return {Number} The normalized value"," * @protected"," */"," _setScrollX: function(val) {"," return this._setScroll(val, DIM_X);"," },",""," /**"," * Setter for the scrollY ATTR"," *"," * @method _setScrollY"," * @param val {Number} The new scrollY value"," * @return {Number} The normalized value"," * @protected"," */"," _setScrollY: function(val) {"," return this._setScroll(val, DIM_Y);"," }",""," // End prototype properties","","}, {",""," // Static properties",""," /**"," * The identity of the widget."," *"," * @property NAME"," * @type String"," * @default 'scrollview'"," * @readOnly"," * @protected"," * @static"," */"," NAME: 'scrollview',",""," /**"," * Static property used to define the default attribute configuration of"," * the Widget."," *"," * @property ATTRS"," * @type {Object}"," * @protected"," * @static"," */"," ATTRS: {",""," /**"," * Specifies ability to scroll on x, y, or x and y axis/axes."," *"," * @attribute axis"," * @type String"," */"," axis: {"," setter: '_axisSetter',"," writeOnce: 'initOnly'"," },",""," /**"," * The current scroll position in the x-axis"," *"," * @attribute scrollX"," * @type Number"," * @default 0"," */"," scrollX: {"," value: 0,"," setter: '_setScrollX'"," },",""," /**"," * The current scroll position in the y-axis"," *"," * @attribute scrollY"," * @type Number"," * @default 0"," */"," scrollY: {"," value: 0,"," setter: '_setScrollY'"," },",""," /**"," * Drag coefficent for inertial scrolling. The closer to 1 this"," * value is, the less friction during scrolling."," *"," * @attribute deceleration"," * @default 0.93"," */"," deceleration: {"," value: 0.93"," },",""," /**"," * Drag coefficient for intertial scrolling at the upper"," * and lower boundaries of the scrollview. Set to 0 to"," * disable \"rubber-banding\"."," *"," * @attribute bounce"," * @type Number"," * @default 0.1"," */"," bounce: {"," value: 0.1"," },",""," /**"," * The minimum distance and/or velocity which define a flick. Can be set to false,"," * to disable flick support (note: drag support is enabled/disabled separately)"," *"," * @attribute flick"," * @type Object"," * @default Object with properties minDistance = 10, minVelocity = 0.3."," */"," flick: {"," value: {"," minDistance: 10,"," minVelocity: 0.3"," }"," },",""," /**"," * Enable/Disable dragging the ScrollView content (note: flick support is enabled/disabled separately)"," * @attribute drag"," * @type boolean"," * @default true"," */"," drag: {"," value: true"," },",""," /**"," * The default duration to use when animating the bounce snap back."," *"," * @attribute snapDuration"," * @type Number"," * @default 400"," */"," snapDuration: {"," value: 400"," },",""," /**"," * The default easing to use when animating the bounce snap back."," *"," * @attribute snapEasing"," * @type String"," * @default 'ease-out'"," */"," snapEasing: {"," value: 'ease-out'"," },",""," /**"," * The default easing used when animating the flick"," *"," * @attribute easing"," * @type String"," * @default 'cubic-bezier(0, 0.1, 0, 1.0)'"," */"," easing: {"," value: 'cubic-bezier(0, 0.1, 0, 1.0)'"," },",""," /**"," * The interval (ms) used when animating the flick for JS-timer animations"," *"," * @attribute frameDuration"," * @type Number"," * @default 15"," */"," frameDuration: {"," value: 15"," },",""," /**"," * The default bounce distance in pixels"," *"," * @attribute bounceRange"," * @type Number"," * @default 150"," */"," bounceRange: {"," value: 150"," }"," },",""," /**"," * List of class names used in the scrollview's DOM"," *"," * @property CLASS_NAMES"," * @type Object"," * @static"," */"," CLASS_NAMES: CLASS_NAMES,",""," /**"," * Flag used to source property changes initiated from the DOM"," *"," * @property UI_SRC"," * @type String"," * @static"," * @default 'ui'"," */"," UI_SRC: UI,",""," /**"," * Object map of style property names used to set transition properties."," * Defaults to the vendor prefix established by the Transition module."," * The configured property names are `_TRANSITION.DURATION` (e.g. \"WebkitTransitionDuration\") and"," * `_TRANSITION.PROPERTY (e.g. \"WebkitTransitionProperty\")."," *"," * @property _TRANSITION"," * @private"," */"," _TRANSITION: {"," DURATION: (vendorPrefix ? vendorPrefix + 'TransitionDuration' : 'transitionDuration'),"," PROPERTY: (vendorPrefix ? vendorPrefix + 'TransitionProperty' : 'transitionProperty')"," },",""," /**"," * The default bounce distance in pixels"," *"," * @property BOUNCE_RANGE"," * @type Number"," * @static"," * @default false"," * @deprecated (in 3.7.0)"," */"," BOUNCE_RANGE: false,",""," /**"," * The interval (ms) used when animating the flick"," *"," * @property FRAME_STEP"," * @type Number"," * @static"," * @default false"," * @deprecated (in 3.7.0)"," */"," FRAME_STEP: false,",""," /**"," * The default easing used when animating the flick"," *"," * @property EASING"," * @type String"," * @static"," * @default false"," * @deprecated (in 3.7.0)"," */"," EASING: false,",""," /**"," * The default easing to use when animating the bounce snap back."," *"," * @property SNAP_EASING"," * @type String"," * @static"," * @default false"," * @deprecated (in 3.7.0)"," */"," SNAP_EASING: false,",""," /**"," * The default duration to use when animating the bounce snap back."," *"," * @property SNAP_DURATION"," * @type Number"," * @static"," * @default false"," * @deprecated (in 3.7.0)"," */"," SNAP_DURATION: false",""," // End static properties","","});","","}, '@VERSION@', {\"requires\": [\"widget\", \"event-gestures\", \"event-mousewheel\", \"transition\"], \"skinnable\": true});"]; _yuitest_coverage["build/scrollview-base/scrollview-base.js"].lines = {"1":0,"9":0,"52":0,"64":0,"65":0,"68":0,"135":0,"138":0,"139":0,"142":0,"143":0,"144":0,"145":0,"146":0,"156":0,"159":0,"160":0,"161":0,"164":0,"167":0,"168":0,"172":0,"173":0,"176":0,"177":0,"180":0,"181":0,"184":0,"185":0,"188":0,"189":0,"204":0,"209":0,"230":0,"234":0,"236":0,"237":0,"249":0,"253":0,"255":0,"256":0,"259":0,"271":0,"275":0,"278":0,"280":0,"292":0,"300":0,"303":0,"308":0,"312":0,"315":0,"318":0,"321":0,"322":0,"334":0,"347":0,"348":0,"349":0,"352":0,"353":0,"355":0,"356":0,"362":0,"364":0,"366":0,"377":0,"387":0,"388":0,"391":0,"392":0,"402":0,"411":0,"420":0,"429":0,"444":0,"445":0,"448":0,"458":0,"459":0,"460":0,"462":0,"463":0,"464":0,"467":0,"468":0,"469":0,"472":0,"474":0,"476":0,"480":0,"481":0,"482":0,"487":0,"488":0,"490":0,"491":0,"498":0,"499":0,"501":0,"502":0,"505":0,"506":0,"509":0,"524":0,"526":0,"527":0,"530":0,"543":0,"544":0,"546":0,"547":0,"560":0,"568":0,"580":0,"581":0,"584":0,"591":0,"592":0,"596":0,"598":0,"599":0,"600":0,"604":0,"607":0,"610":0,"650":0,"662":0,"663":0,"666":0,"667":0,"671":0,"672":0,"676":0,"677":0,"679":0,"680":0,"692":0,"698":0,"699":0,"703":0,"704":0,"707":0,"708":0,"711":0,"717":0,"720":0,"721":0,"728":0,"729":0,"744":0,"745":0,"748":0,"757":0,"758":0,"762":0,"763":0,"778":0,"807":0,"808":0,"812":0,"815":0,"817":0,"818":0,"819":0,"823":0,"824":0,"829":0,"836":0,"837":0,"849":0,"856":0,"862":0,"865":0,"868":0,"872":0,"874":0,"875":0,"881":0,"884":0,"898":0,"909":0,"920":0,"932":0,"933":0,"935":0,"936":0,"940":0,"953":0,"954":0,"957":0,"964":0,"967":0,"968":0,"969":0,"972":0,"973":0,"976":0,"977":0,"979":0,"990":0,"1002":0,"1013":0,"1024":0,"1035":0,"1046":0,"1049":0,"1051":0,"1054":0,"1058":0,"1059":0,"1080":0,"1081":0,"1101":0,"1102":0,"1105":0,"1117":0,"1129":0}; _yuitest_coverage["build/scrollview-base/scrollview-base.js"].functions = {"_constrain:51":0,"ScrollView:64":0,"initializer:134":0,"bindUI:155":0,"_bindAttrs:203":0,"_bindDrag:229":0,"_bindFlick:248":0,"_bindMousewheel:270":0,"syncUI:291":0,"_getScrollDims:333":0,"_uiDimensionsChange:376":0,"scrollTo:442":0,"_transform:522":0,"_moveTo:542":0,"_onTransEnd:559":0,"_onGestureMoveStart:578":0,"_onGestureMove:649":0,"_onGestureMoveEnd:691":0,"_flick:743":0,"_flickFrame:776":0,"_mousewheel:848":0,"_isOutOfBounds:897":0,"_snapBack:919":0,"_afterScrollChange:951":0,"_afterFlickChange:989":0,"_afterDisabledChange:1000":0,"_afterAxisChange:1012":0,"_afterDragChange:1023":0,"_afterDimChange:1034":0,"_afterScrollEnd:1045":0,"_axisSetter:1077":0,"_setScroll:1098":0,"_setScrollX:1116":0,"_setScrollY:1128":0,"(anonymous 1):1":0}; _yuitest_coverage["build/scrollview-base/scrollview-base.js"].coveredLines = 218; _yuitest_coverage["build/scrollview-base/scrollview-base.js"].coveredFunctions = 35; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1); YUI.add('scrollview-base', function (Y, NAME) { /** * The scrollview-base module provides a basic ScrollView Widget, without scrollbar indicators * * @module scrollview * @submodule scrollview-base */ _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "(anonymous 1)", 1); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 9); var getClassName = Y.ClassNameManager.getClassName, DOCUMENT = Y.config.doc, WINDOW = Y.config.win, IE = Y.UA.ie, NATIVE_TRANSITIONS = Y.Transition.useNative, vendorPrefix = Y.Transition._VENDOR_PREFIX, // Todo: This is a private property, and alternative approaches should be investigated SCROLLVIEW = 'scrollview', CLASS_NAMES = { vertical: getClassName(SCROLLVIEW, 'vert'), horizontal: getClassName(SCROLLVIEW, 'horiz') }, EV_SCROLL_END = 'scrollEnd', FLICK = 'flick', DRAG = 'drag', MOUSEWHEEL = 'mousewheel', UI = 'ui', TOP = 'top', RIGHT = 'right', BOTTOM = 'bottom', LEFT = 'left', PX = 'px', AXIS = 'axis', SCROLL_Y = 'scrollY', SCROLL_X = 'scrollX', BOUNCE = 'bounce', DISABLED = 'disabled', DECELERATION = 'deceleration', DIM_X = 'x', DIM_Y = 'y', BOUNDING_BOX = 'boundingBox', CONTENT_BOX = 'contentBox', GESTURE_MOVE = 'gesturemove', START = 'start', END = 'end', EMPTY = '', ZERO = '0s', SNAP_DURATION = 'snapDuration', SNAP_EASING = 'snapEasing', EASING = 'easing', FRAME_DURATION = 'frameDuration', BOUNCE_RANGE = 'bounceRange', _constrain = function (val, min, max) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_constrain", 51); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 52); return Math.min(Math.max(val, min), max); }; /** * ScrollView provides a scrollable widget, supporting flick gestures, * across both touch and mouse based devices. * * @class ScrollView * @param config {Object} Object literal with initial attribute values * @extends Widget * @constructor */ _yuitest_coverline("build/scrollview-base/scrollview-base.js", 64); function ScrollView() { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "ScrollView", 64); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 65); ScrollView.superclass.constructor.apply(this, arguments); } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 68); Y.ScrollView = Y.extend(ScrollView, Y.Widget, { // *** Y.ScrollView prototype /** * Flag driving whether or not we should try and force H/W acceleration when transforming. Currently enabled by default for Webkit. * Used by the _transform method. * * @property _forceHWTransforms * @type boolean * @protected */ _forceHWTransforms: Y.UA.webkit ? true : false, /** * <p>Used to control whether or not ScrollView's internal * gesturemovestart, gesturemove and gesturemoveend * event listeners should preventDefault. The value is an * object, with "start", "move" and "end" properties used to * specify which events should preventDefault and which shouldn't:</p> * * <pre> * { * start: false, * move: true, * end: false * } * </pre> * * <p>The default values are set up in order to prevent panning, * on touch devices, while allowing click listeners on elements inside * the ScrollView to be notified as expected.</p> * * @property _prevent * @type Object * @protected */ _prevent: { start: false, move: true, end: false }, /** * Contains the distance (postive or negative) in pixels by which * the scrollview was last scrolled. This is useful when setting up * click listeners on the scrollview content, which on mouse based * devices are always fired, even after a drag/flick. * * <p>Touch based devices don't currently fire a click event, * if the finger has been moved (beyond a threshold) so this * check isn't required, if working in a purely touch based environment</p> * * @property lastScrolledAmt * @type Number * @public * @default 0 */ lastScrolledAmt: 0, /** * Designated initializer * * @method initializer * @param {config} Configuration object for the plugin */ initializer: function (config) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "initializer", 134); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 135); var sv = this; // Cache these values, since they aren't going to change. _yuitest_coverline("build/scrollview-base/scrollview-base.js", 138); sv._bb = sv.get(BOUNDING_BOX); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 139); sv._cb = sv.get(CONTENT_BOX); // Cache some attributes _yuitest_coverline("build/scrollview-base/scrollview-base.js", 142); sv._cAxis = sv.get(AXIS); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 143); sv._cBounce = sv.get(BOUNCE); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 144); sv._cBounceRange = sv.get(BOUNCE_RANGE); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 145); sv._cDeceleration = sv.get(DECELERATION); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 146); sv._cFrameDuration = sv.get(FRAME_DURATION); }, /** * bindUI implementation * * Hooks up events for the widget * @method bindUI */ bindUI: function () { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "bindUI", 155); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 156); var sv = this; // Bind interaction listers _yuitest_coverline("build/scrollview-base/scrollview-base.js", 159); sv._bindFlick(sv.get(FLICK)); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 160); sv._bindDrag(sv.get(DRAG)); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 161); sv._bindMousewheel(true); // Bind change events _yuitest_coverline("build/scrollview-base/scrollview-base.js", 164); sv._bindAttrs(); // IE SELECT HACK. See if we can do this non-natively and in the gesture for a future release. _yuitest_coverline("build/scrollview-base/scrollview-base.js", 167); if (IE) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 168); sv._fixIESelect(sv._bb, sv._cb); } // Set any deprecated static properties _yuitest_coverline("build/scrollview-base/scrollview-base.js", 172); if (ScrollView.SNAP_DURATION) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 173); sv.set(SNAP_DURATION, ScrollView.SNAP_DURATION); } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 176); if (ScrollView.SNAP_EASING) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 177); sv.set(SNAP_EASING, ScrollView.SNAP_EASING); } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 180); if (ScrollView.EASING) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 181); sv.set(EASING, ScrollView.EASING); } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 184); if (ScrollView.FRAME_STEP) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 185); sv.set(FRAME_DURATION, ScrollView.FRAME_STEP); } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 188); if (ScrollView.BOUNCE_RANGE) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 189); sv.set(BOUNCE_RANGE, ScrollView.BOUNCE_RANGE); } // Recalculate dimension properties // TODO: This should be throttled. // Y.one(WINDOW).after('resize', sv._afterDimChange, sv); }, /** * Bind event listeners * * @method _bindAttrs * @private */ _bindAttrs: function () { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_bindAttrs", 203); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 204); var sv = this, scrollChangeHandler = sv._afterScrollChange, dimChangeHandler = sv._afterDimChange; // Bind any change event listeners _yuitest_coverline("build/scrollview-base/scrollview-base.js", 209); sv.after({ 'scrollEnd': sv._afterScrollEnd, 'disabledChange': sv._afterDisabledChange, 'flickChange': sv._afterFlickChange, 'dragChange': sv._afterDragChange, 'axisChange': sv._afterAxisChange, 'scrollYChange': scrollChangeHandler, 'scrollXChange': scrollChangeHandler, 'heightChange': dimChangeHandler, 'widthChange': dimChangeHandler }); }, /** * Bind (or unbind) gesture move listeners required for drag support * * @method _bindDrag * @param drag {boolean} If true, the method binds listener to enable drag (gesturemovestart). If false, the method unbinds gesturemove listeners for drag support. * @private */ _bindDrag: function (drag) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_bindDrag", 229); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 230); var sv = this, bb = sv._bb; // Unbind any previous 'drag' listeners _yuitest_coverline("build/scrollview-base/scrollview-base.js", 234); bb.detach(DRAG + '|*'); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 236); if (drag) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 237); bb.on(DRAG + '|' + GESTURE_MOVE + START, Y.bind(sv._onGestureMoveStart, sv)); } }, /** * Bind (or unbind) flick listeners. * * @method _bindFlick * @param flick {Object|boolean} If truthy, the method binds listeners for flick support. If false, the method unbinds flick listeners. * @private */ _bindFlick: function (flick) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_bindFlick", 248); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 249); var sv = this, bb = sv._bb; // Unbind any previous 'flick' listeners _yuitest_coverline("build/scrollview-base/scrollview-base.js", 253); bb.detach(FLICK + '|*'); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 255); if (flick) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 256); bb.on(FLICK + '|' + FLICK, Y.bind(sv._flick, sv), flick); // Rebind Drag, becuase _onGestureMoveEnd always has to fire -after- _flick _yuitest_coverline("build/scrollview-base/scrollview-base.js", 259); sv._bindDrag(sv.get(DRAG)); } }, /** * Bind (or unbind) mousewheel listeners. * * @method _bindMousewheel * @param mousewheel {Object|boolean} If truthy, the method binds listeners for mousewheel support. If false, the method unbinds mousewheel listeners. * @private */ _bindMousewheel: function (mousewheel) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_bindMousewheel", 270); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 271); var sv = this, bb = sv._bb; // Unbind any previous 'mousewheel' listeners _yuitest_coverline("build/scrollview-base/scrollview-base.js", 275); bb.detach(MOUSEWHEEL + '|*'); // Only enable for vertical scrollviews _yuitest_coverline("build/scrollview-base/scrollview-base.js", 278); if (mousewheel) { // Bound to document, because that's where mousewheel events fire off of. _yuitest_coverline("build/scrollview-base/scrollview-base.js", 280); Y.one(DOCUMENT).on(MOUSEWHEEL, Y.bind(sv._mousewheel, sv)); } }, /** * syncUI implementation. * * Update the scroll position, based on the current value of scrollX/scrollY. * * @method syncUI */ syncUI: function () { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "syncUI", 291); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 292); var sv = this, scrollDims = sv._getScrollDims(), width = scrollDims.offsetWidth, height = scrollDims.offsetHeight, scrollWidth = scrollDims.scrollWidth, scrollHeight = scrollDims.scrollHeight; // If the axis is undefined, auto-calculate it _yuitest_coverline("build/scrollview-base/scrollview-base.js", 300); if (sv._cAxis === undefined) { // This should only ever be run once (for now). // In the future SV might post-load axis changes _yuitest_coverline("build/scrollview-base/scrollview-base.js", 303); sv._cAxis = { x: (scrollWidth > width), y: (scrollHeight > height) }; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 308); sv._set(AXIS, sv._cAxis); } // get text direction on or inherited by scrollview node _yuitest_coverline("build/scrollview-base/scrollview-base.js", 312); sv.rtl = (sv._cb.getComputedStyle('direction') === 'rtl'); // Cache the disabled value _yuitest_coverline("build/scrollview-base/scrollview-base.js", 315); sv._cDisabled = sv.get(DISABLED); // Run this to set initial values _yuitest_coverline("build/scrollview-base/scrollview-base.js", 318); sv._uiDimensionsChange(); // If we're out-of-bounds, snap back. _yuitest_coverline("build/scrollview-base/scrollview-base.js", 321); if (sv._isOutOfBounds()) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 322); sv._snapBack(); } }, /** * Utility method to obtain widget dimensions * * @method _getScrollDims * @returns {Object} The offsetWidth, offsetHeight, scrollWidth and scrollHeight as an array: [offsetWidth, offsetHeight, scrollWidth, scrollHeight] * @private */ _getScrollDims: function () { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_getScrollDims", 333); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 334); var sv = this, cb = sv._cb, bb = sv._bb, TRANS = ScrollView._TRANSITION, // Ideally using CSSMatrix - don't think we have it normalized yet though. // origX = (new WebKitCSSMatrix(cb.getComputedStyle("transform"))).e, // origY = (new WebKitCSSMatrix(cb.getComputedStyle("transform"))).f, origX = sv.get(SCROLL_X), origY = sv.get(SCROLL_Y), origHWTransform, dims; // TODO: Is this OK? Just in case it's called 'during' a transition. _yuitest_coverline("build/scrollview-base/scrollview-base.js", 347); if (NATIVE_TRANSITIONS) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 348); cb.setStyle(TRANS.DURATION, ZERO); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 349); cb.setStyle(TRANS.PROPERTY, EMPTY); } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 352); origHWTransform = sv._forceHWTransforms; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 353); sv._forceHWTransforms = false; // the z translation was causing issues with picking up accurate scrollWidths in Chrome/Mac. _yuitest_coverline("build/scrollview-base/scrollview-base.js", 355); sv._moveTo(cb, 0, 0); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 356); dims = { 'offsetWidth': bb.get('offsetWidth'), 'offsetHeight': bb.get('offsetHeight'), 'scrollWidth': bb.get('scrollWidth'), 'scrollHeight': bb.get('scrollHeight') }; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 362); sv._moveTo(cb, -(origX), -(origY)); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 364); sv._forceHWTransforms = origHWTransform; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 366); return dims; }, /** * This method gets invoked whenever the height or width attributes change, * allowing us to determine which scrolling axes need to be enabled. * * @method _uiDimensionsChange * @protected */ _uiDimensionsChange: function () { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_uiDimensionsChange", 376); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 377); var sv = this, bb = sv._bb, scrollDims = sv._getScrollDims(), width = scrollDims.offsetWidth, height = scrollDims.offsetHeight, scrollWidth = scrollDims.scrollWidth, scrollHeight = scrollDims.scrollHeight, rtl = sv.rtl, svAxis = sv._cAxis; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 387); if (svAxis && svAxis.x) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 388); bb.addClass(CLASS_NAMES.horizontal); } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 391); if (svAxis && svAxis.y) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 392); bb.addClass(CLASS_NAMES.vertical); } /** * Internal state, defines the minimum amount that the scrollview can be scrolled along the X axis * * @property _minScrollX * @type number * @protected */ _yuitest_coverline("build/scrollview-base/scrollview-base.js", 402); sv._minScrollX = (rtl) ? Math.min(0, -(scrollWidth - width)) : 0; /** * Internal state, defines the maximum amount that the scrollview can be scrolled along the X axis * * @property _maxScrollX * @type number * @protected */ _yuitest_coverline("build/scrollview-base/scrollview-base.js", 411); sv._maxScrollX = (rtl) ? 0 : Math.max(0, scrollWidth - width); /** * Internal state, defines the minimum amount that the scrollview can be scrolled along the Y axis * * @property _minScrollY * @type number * @protected */ _yuitest_coverline("build/scrollview-base/scrollview-base.js", 420); sv._minScrollY = 0; /** * Internal state, defines the maximum amount that the scrollview can be scrolled along the Y axis * * @property _maxScrollY * @type number * @protected */ _yuitest_coverline("build/scrollview-base/scrollview-base.js", 429); sv._maxScrollY = Math.max(0, scrollHeight - height); }, /** * Scroll the element to a given xy coordinate * * @method scrollTo * @param x {Number} The x-position to scroll to. (null for no movement) * @param y {Number} The y-position to scroll to. (null for no movement) * @param {Number} [duration] ms of the scroll animation. (default is 0) * @param {String} [easing] An easing equation if duration is set. (default is `easing` attribute) * @param {String} [node] The node to transform. Setting this can be useful in dual-axis paginated instances. (default is the instance's contentBox) */ scrollTo: function (x, y, duration, easing, node) { // Check to see if widget is disabled _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "scrollTo", 442); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 444); if (this._cDisabled) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 445); return; } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 448); var sv = this, cb = sv._cb, TRANS = ScrollView._TRANSITION, callback = Y.bind(sv._onTransEnd, sv), // @Todo : cache this newX = 0, newY = 0, transition = {}, transform; // default the optional arguments _yuitest_coverline("build/scrollview-base/scrollview-base.js", 458); duration = duration || 0; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 459); easing = easing || sv.get(EASING); // @TODO: Cache this _yuitest_coverline("build/scrollview-base/scrollview-base.js", 460); node = node || cb; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 462); if (x !== null) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 463); sv.set(SCROLL_X, x, {src:UI}); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 464); newX = -(x); } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 467); if (y !== null) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 468); sv.set(SCROLL_Y, y, {src:UI}); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 469); newY = -(y); } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 472); transform = sv._transform(newX, newY); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 474); if (NATIVE_TRANSITIONS) { // ANDROID WORKAROUND - try and stop existing transition, before kicking off new one. _yuitest_coverline("build/scrollview-base/scrollview-base.js", 476); node.setStyle(TRANS.DURATION, ZERO).setStyle(TRANS.PROPERTY, EMPTY); } // Move _yuitest_coverline("build/scrollview-base/scrollview-base.js", 480); if (duration === 0) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 481); if (NATIVE_TRANSITIONS) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 482); node.setStyle('transform', transform); } else { // TODO: If both set, batch them in the same update // Update: Nope, setStyles() just loops through each property and applies it. _yuitest_coverline("build/scrollview-base/scrollview-base.js", 487); if (x !== null) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 488); node.setStyle(LEFT, newX + PX); } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 490); if (y !== null) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 491); node.setStyle(TOP, newY + PX); } } } // Animate else { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 498); transition.easing = easing; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 499); transition.duration = duration / 1000; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 501); if (NATIVE_TRANSITIONS) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 502); transition.transform = transform; } else { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 505); transition.left = newX + PX; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 506); transition.top = newY + PX; } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 509); node.transition(transition, callback); } }, /** * Utility method, to create the translate transform string with the * x, y translation amounts provided. * * @method _transform * @param {Number} x Number of pixels to translate along the x axis * @param {Number} y Number of pixels to translate along the y axis * @private */ _transform: function (x, y) { // TODO: Would we be better off using a Matrix for this? _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_transform", 522); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 524); var prop = 'translate(' + x + 'px, ' + y + 'px)'; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 526); if (this._forceHWTransforms) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 527); prop += ' translateZ(0)'; } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 530); return prop; }, /** * Utility method, to move the given element to the given xy position * * @method _moveTo * @param node {Node} The node to move * @param x {Number} The x-position to move to * @param y {Number} The y-position to move to * @private */ _moveTo : function(node, x, y) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_moveTo", 542); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 543); if (NATIVE_TRANSITIONS) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 544); node.setStyle('transform', this._transform(x, y)); } else { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 546); node.setStyle(LEFT, x + PX); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 547); node.setStyle(TOP, y + PX); } }, /** * Content box transition callback * * @method _onTransEnd * @param {Event.Facade} e The event facade * @private */ _onTransEnd: function (e) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_onTransEnd", 559); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 560); var sv = this; /** * Notification event fired at the end of a scroll transition * * @event scrollEnd * @param e {EventFacade} The default event facade. */ _yuitest_coverline("build/scrollview-base/scrollview-base.js", 568); sv.fire(EV_SCROLL_END); }, /** * gesturemovestart event handler * * @method _onGestureMoveStart * @param e {Event.Facade} The gesturemovestart event facade * @private */ _onGestureMoveStart: function (e) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_onGestureMoveStart", 578); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 580); if (this._cDisabled) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 581); return false; } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 584); var sv = this, bb = sv._bb, currentX = sv.get(SCROLL_X), currentY = sv.get(SCROLL_Y), clientX = e.clientX, clientY = e.clientY; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 591); if (sv._prevent.start) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 592); e.preventDefault(); } // if a flick animation is in progress, cancel it _yuitest_coverline("build/scrollview-base/scrollview-base.js", 596); if (sv._flickAnim) { // Cancel and delete sv._flickAnim _yuitest_coverline("build/scrollview-base/scrollview-base.js", 598); sv._flickAnim.cancel(); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 599); delete sv._flickAnim; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 600); sv._onTransEnd(); } // TODO: Review if neccesary (#2530129) _yuitest_coverline("build/scrollview-base/scrollview-base.js", 604); e.stopPropagation(); // Reset lastScrolledAmt _yuitest_coverline("build/scrollview-base/scrollview-base.js", 607); sv.lastScrolledAmt = 0; // Stores data for this gesture cycle. Cleaned up later _yuitest_coverline("build/scrollview-base/scrollview-base.js", 610); sv._gesture = { // Will hold the axis value axis: null, // The current attribute values startX: currentX, startY: currentY, // The X/Y coordinates where the event began startClientX: clientX, startClientY: clientY, // The X/Y coordinates where the event will end endClientX: null, endClientY: null, // The current delta of the event deltaX: null, deltaY: null, // Will be populated for flicks flick: null, // Create some listeners for the rest of the gesture cycle onGestureMove: bb.on(DRAG + '|' + GESTURE_MOVE, Y.bind(sv._onGestureMove, sv)), // @TODO: Don't bind gestureMoveEnd if it's a Flick? onGestureMoveEnd: bb.on(DRAG + '|' + GESTURE_MOVE + END, Y.bind(sv._onGestureMoveEnd, sv)) }; }, /** * gesturemove event handler * * @method _onGestureMove * @param e {Event.Facade} The gesturemove event facade * @private */ _onGestureMove: function (e) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_onGestureMove", 649); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 650); var sv = this, gesture = sv._gesture, svAxis = sv._cAxis, svAxisX = svAxis.x, svAxisY = svAxis.y, startX = gesture.startX, startY = gesture.startY, startClientX = gesture.startClientX, startClientY = gesture.startClientY, clientX = e.clientX, clientY = e.clientY; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 662); if (sv._prevent.move) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 663); e.preventDefault(); } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 666); gesture.deltaX = startClientX - clientX; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 667); gesture.deltaY = startClientY - clientY; // Determine if this is a vertical or horizontal movement // @TODO: This is crude, but it works. Investigate more intelligent ways to detect intent _yuitest_coverline("build/scrollview-base/scrollview-base.js", 671); if (gesture.axis === null) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 672); gesture.axis = (Math.abs(gesture.deltaX) > Math.abs(gesture.deltaY)) ? DIM_X : DIM_Y; } // Move X or Y. @TODO: Move both if dualaxis. _yuitest_coverline("build/scrollview-base/scrollview-base.js", 676); if (gesture.axis === DIM_X && svAxisX) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 677); sv.set(SCROLL_X, startX + gesture.deltaX); } else {_yuitest_coverline("build/scrollview-base/scrollview-base.js", 679); if (gesture.axis === DIM_Y && svAxisY) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 680); sv.set(SCROLL_Y, startY + gesture.deltaY); }} }, /** * gesturemoveend event handler * * @method _onGestureMoveEnd * @param e {Event.Facade} The gesturemoveend event facade * @private */ _onGestureMoveEnd: function (e) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_onGestureMoveEnd", 691); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 692); var sv = this, gesture = sv._gesture, flick = gesture.flick, clientX = e.clientX, clientY = e.clientY; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 698); if (sv._prevent.end) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 699); e.preventDefault(); } // Store the end X/Y coordinates _yuitest_coverline("build/scrollview-base/scrollview-base.js", 703); gesture.endClientX = clientX; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 704); gesture.endClientY = clientY; // Cleanup the event handlers _yuitest_coverline("build/scrollview-base/scrollview-base.js", 707); gesture.onGestureMove.detach(); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 708); gesture.onGestureMoveEnd.detach(); // If this wasn't a flick, wrap up the gesture cycle _yuitest_coverline("build/scrollview-base/scrollview-base.js", 711); if (!flick) { // @TODO: Be more intelligent about this. Look at the Flick attribute to see // if it is safe to assume _flick did or didn't fire. // Then, the order _flick and _onGestureMoveEnd fire doesn't matter? // If there was movement (_onGestureMove fired) _yuitest_coverline("build/scrollview-base/scrollview-base.js", 717); if (gesture.deltaX !== null && gesture.deltaY !== null) { // If we're out-out-bounds, then snapback _yuitest_coverline("build/scrollview-base/scrollview-base.js", 720); if (sv._isOutOfBounds()) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 721); sv._snapBack(); } // Inbounds else { // Don't fire scrollEnd on the gesture axis is the same as paginator's // Not totally confident this is ideal to access a plugin's properties from a host, @TODO revisit _yuitest_coverline("build/scrollview-base/scrollview-base.js", 728); if (sv.pages && !sv.pages.get(AXIS)[gesture.axis]) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 729); sv._onTransEnd(); } } } } }, /** * Execute a flick at the end of a scroll action * * @method _flick * @param e {Event.Facade} The Flick event facade * @private */ _flick: function (e) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_flick", 743); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 744); if (this._cDisabled) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 745); return false; } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 748); var sv = this, svAxis = sv._cAxis, flick = e.flick, flickAxis = flick.axis, flickVelocity = flick.velocity, axisAttr = flickAxis === DIM_X ? SCROLL_X : SCROLL_Y, startPosition = sv.get(axisAttr); // Sometimes flick is enabled, but drag is disabled _yuitest_coverline("build/scrollview-base/scrollview-base.js", 757); if (sv._gesture) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 758); sv._gesture.flick = flick; } // Prevent unneccesary firing of _flickFrame if we can't scroll on the flick axis _yuitest_coverline("build/scrollview-base/scrollview-base.js", 762); if (svAxis[flickAxis]) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 763); sv._flickFrame(flickVelocity, flickAxis, startPosition); } }, /** * Execute a single frame in the flick animation * * @method _flickFrame * @param velocity {Number} The velocity of this animated frame * @param flickAxis {String} The axis on which to animate * @param startPosition {Number} The starting X/Y point to flick from * @protected */ _flickFrame: function (velocity, flickAxis, startPosition) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_flickFrame", 776); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 778); var sv = this, axisAttr = flickAxis === DIM_X ? SCROLL_X : SCROLL_Y, // Localize cached values bounce = sv._cBounce, bounceRange = sv._cBounceRange, deceleration = sv._cDeceleration, frameDuration = sv._cFrameDuration, // Calculate newVelocity = velocity * deceleration, newPosition = startPosition - (frameDuration * newVelocity), // Some convinience conditions min = flickAxis === DIM_X ? sv._minScrollX : sv._minScrollY, max = flickAxis === DIM_X ? sv._maxScrollX : sv._maxScrollY, belowMin = (newPosition < min), belowMax = (newPosition < max), aboveMin = (newPosition > min), aboveMax = (newPosition > max), belowMinRange = (newPosition < (min - bounceRange)), belowMaxRange = (newPosition < (max + bounceRange)), withinMinRange = (belowMin && (newPosition > (min - bounceRange))), withinMaxRange = (aboveMax && (newPosition < (max + bounceRange))), aboveMinRange = (newPosition > (min - bounceRange)), aboveMaxRange = (newPosition > (max + bounceRange)), tooSlow; // If we're within the range but outside min/max, dampen the velocity _yuitest_coverline("build/scrollview-base/scrollview-base.js", 807); if (withinMinRange || withinMaxRange) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 808); newVelocity *= bounce; } // Is the velocity too slow to bother? _yuitest_coverline("build/scrollview-base/scrollview-base.js", 812); tooSlow = (Math.abs(newVelocity).toFixed(4) < 0.015); // If the velocity is too slow or we're outside the range _yuitest_coverline("build/scrollview-base/scrollview-base.js", 815); if (tooSlow || belowMinRange || aboveMaxRange) { // Cancel and delete sv._flickAnim _yuitest_coverline("build/scrollview-base/scrollview-base.js", 817); if (sv._flickAnim) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 818); sv._flickAnim.cancel(); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 819); delete sv._flickAnim; } // If we're inside the scroll area, just end _yuitest_coverline("build/scrollview-base/scrollview-base.js", 823); if (aboveMin && belowMax) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 824); sv._onTransEnd(); } // We're outside the scroll area, so we need to snap back else { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 829); sv._snapBack(); } } // Otherwise, animate to the next frame else { // @TODO: maybe use requestAnimationFrame instead _yuitest_coverline("build/scrollview-base/scrollview-base.js", 836); sv._flickAnim = Y.later(frameDuration, sv, '_flickFrame', [newVelocity, flickAxis, newPosition]); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 837); sv.set(axisAttr, newPosition); } }, /** * Handle mousewheel events on the widget * * @method _mousewheel * @param e {Event.Facade} The mousewheel event facade * @private */ _mousewheel: function (e) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_mousewheel", 848); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 849); var sv = this, scrollY = sv.get(SCROLL_Y), bb = sv._bb, scrollOffset = 10, // 10px isForward = (e.wheelDelta > 0), scrollToY = scrollY - ((isForward ? 1 : -1) * scrollOffset); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 856); scrollToY = _constrain(scrollToY, sv._minScrollY, sv._maxScrollY); // Because Mousewheel events fire off 'document', every ScrollView widget will react // to any mousewheel anywhere on the page. This check will ensure that the mouse is currently // over this specific ScrollView. Also, only allow mousewheel scrolling on Y-axis, // becuase otherwise the 'prevent' will block page scrolling. _yuitest_coverline("build/scrollview-base/scrollview-base.js", 862); if (bb.contains(e.target) && sv._cAxis[DIM_Y]) { // Reset lastScrolledAmt _yuitest_coverline("build/scrollview-base/scrollview-base.js", 865); sv.lastScrolledAmt = 0; // Jump to the new offset _yuitest_coverline("build/scrollview-base/scrollview-base.js", 868); sv.set(SCROLL_Y, scrollToY); // if we have scrollbars plugin, update & set the flash timer on the scrollbar // @TODO: This probably shouldn't be in this module _yuitest_coverline("build/scrollview-base/scrollview-base.js", 872); if (sv.scrollbars) { // @TODO: The scrollbars should handle this themselves _yuitest_coverline("build/scrollview-base/scrollview-base.js", 874); sv.scrollbars._update(); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 875); sv.scrollbars.flash(); // or just this // sv.scrollbars._hostDimensionsChange(); } // Fire the 'scrollEnd' event _yuitest_coverline("build/scrollview-base/scrollview-base.js", 881); sv._onTransEnd(); // prevent browser default behavior on mouse scroll _yuitest_coverline("build/scrollview-base/scrollview-base.js", 884); e.preventDefault(); } }, /** * Checks to see the current scrollX/scrollY position beyond the min/max boundary * * @method _isOutOfBounds * @param x {Number} [optional] The X position to check * @param y {Number} [optional] The Y position to check * @returns {boolen} Whether the current X/Y position is out of bounds (true) or not (false) * @private */ _isOutOfBounds: function (x, y) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_isOutOfBounds", 897); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 898); var sv = this, svAxis = sv._cAxis, svAxisX = svAxis.x, svAxisY = svAxis.y, currentX = x || sv.get(SCROLL_X), currentY = y || sv.get(SCROLL_Y), minX = sv._minScrollX, minY = sv._minScrollY, maxX = sv._maxScrollX, maxY = sv._maxScrollY; _yuitest_coverline("build/scrollview-base/scrollview-base.js", 909); return (svAxisX && (currentX < minX || currentX > maxX)) || (svAxisY && (currentY < minY || currentY > maxY)); }, /** * Bounces back * @TODO: Should be more generalized and support both X and Y detection * * @method _snapBack * @private */ _snapBack: function () { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_snapBack", 919); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 920); var sv = this, currentX = sv.get(SCROLL_X), currentY = sv.get(SCROLL_Y), minX = sv._minScrollX, minY = sv._minScrollY, maxX = sv._maxScrollX, maxY = sv._maxScrollY, newY = _constrain(currentY, minY, maxY), newX = _constrain(currentX, minX, maxX), duration = sv.get(SNAP_DURATION), easing = sv.get(SNAP_EASING); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 932); if (newX !== currentX) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 933); sv.set(SCROLL_X, newX, {duration:duration, easing:easing}); } else {_yuitest_coverline("build/scrollview-base/scrollview-base.js", 935); if (newY !== currentY) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 936); sv.set(SCROLL_Y, newY, {duration:duration, easing:easing}); } else { // It shouldn't ever get here, but in case it does, fire scrollEnd _yuitest_coverline("build/scrollview-base/scrollview-base.js", 940); sv._onTransEnd(); }} }, /** * After listener for changes to the scrollX or scrollY attribute * * @method _afterScrollChange * @param e {Event.Facade} The event facade * @protected */ _afterScrollChange: function (e) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterScrollChange", 951); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 953); if (e.src === ScrollView.UI_SRC) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 954); return false; } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 957); var sv = this, duration = e.duration, easing = e.easing, val = e.newVal, scrollToArgs = []; // Set the scrolled value _yuitest_coverline("build/scrollview-base/scrollview-base.js", 964); sv.lastScrolledAmt = sv.lastScrolledAmt + (e.newVal - e.prevVal); // Generate the array of args to pass to scrollTo() _yuitest_coverline("build/scrollview-base/scrollview-base.js", 967); if (e.attrName === SCROLL_X) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 968); scrollToArgs.push(val); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 969); scrollToArgs.push(sv.get(SCROLL_Y)); } else { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 972); scrollToArgs.push(sv.get(SCROLL_X)); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 973); scrollToArgs.push(val); } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 976); scrollToArgs.push(duration); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 977); scrollToArgs.push(easing); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 979); sv.scrollTo.apply(sv, scrollToArgs); }, /** * After listener for changes to the flick attribute * * @method _afterFlickChange * @param e {Event.Facade} The event facade * @protected */ _afterFlickChange: function (e) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterFlickChange", 989); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 990); this._bindFlick(e.newVal); }, /** * After listener for changes to the disabled attribute * * @method _afterDisabledChange * @param e {Event.Facade} The event facade * @protected */ _afterDisabledChange: function (e) { // Cache for performance - we check during move _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterDisabledChange", 1000); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1002); this._cDisabled = e.newVal; }, /** * After listener for the axis attribute * * @method _afterAxisChange * @param e {Event.Facade} The event facade * @protected */ _afterAxisChange: function (e) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterAxisChange", 1012); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1013); this._cAxis = e.newVal; }, /** * After listener for changes to the drag attribute * * @method _afterDragChange * @param e {Event.Facade} The event facade * @protected */ _afterDragChange: function (e) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterDragChange", 1023); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1024); this._bindDrag(e.newVal); }, /** * After listener for the height or width attribute * * @method _afterDimChange * @param e {Event.Facade} The event facade * @protected */ _afterDimChange: function () { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterDimChange", 1034); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1035); this._uiDimensionsChange(); }, /** * After listener for scrollEnd, for cleanup * * @method _afterScrollEnd * @param e {Event.Facade} The event facade * @protected */ _afterScrollEnd: function (e) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_afterScrollEnd", 1045); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1046); var sv = this; // @TODO: Move to sv._cancelFlick() _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1049); if (sv._flickAnim) { // Cancel the flick (if it exists) _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1051); sv._flickAnim.cancel(); // Also delete it, otherwise _onGestureMoveStart will think we're still flicking _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1054); delete sv._flickAnim; } // If for some reason we're OOB, snapback _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1058); if (sv._isOutOfBounds()) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1059); sv._snapBack(); } // Ideally this should be removed, but doing so causing some JS errors with fast swiping // because _gesture is being deleted after the previous one has been overwritten // delete sv._gesture; // TODO: Move to sv.prevGesture? }, /** * Setter for 'axis' attribute * * @method _axisSetter * @param val {Mixed} A string ('x', 'y', 'xy') to specify which axis/axes to allow scrolling on * @param name {String} The attribute name * @return {Object} An object to specify scrollability on the x & y axes * * @protected */ _axisSetter: function (val, name) { // Turn a string into an axis object _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_axisSetter", 1077); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1080); if (Y.Lang.isString(val)) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1081); return { x: val.match(/x/i) ? true : false, y: val.match(/y/i) ? true : false }; } }, /** * The scrollX, scrollY setter implementation * * @method _setScroll * @private * @param {Number} val * @param {String} dim * * @return {Number} The value */ _setScroll : function(val, dim) { // Just ensure the widget is not disabled _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_setScroll", 1098); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1101); if (this._cDisabled) { _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1102); val = Y.Attribute.INVALID_VALUE; } _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1105); return val; }, /** * Setter for the scrollX attribute * * @method _setScrollX * @param val {Number} The new scrollX value * @return {Number} The normalized value * @protected */ _setScrollX: function(val) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_setScrollX", 1116); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1117); return this._setScroll(val, DIM_X); }, /** * Setter for the scrollY ATTR * * @method _setScrollY * @param val {Number} The new scrollY value * @return {Number} The normalized value * @protected */ _setScrollY: function(val) { _yuitest_coverfunc("build/scrollview-base/scrollview-base.js", "_setScrollY", 1128); _yuitest_coverline("build/scrollview-base/scrollview-base.js", 1129); return this._setScroll(val, DIM_Y); } // End prototype properties }, { // Static properties /** * The identity of the widget. * * @property NAME * @type String * @default 'scrollview' * @readOnly * @protected * @static */ NAME: 'scrollview', /** * Static property used to define the default attribute configuration of * the Widget. * * @property ATTRS * @type {Object} * @protected * @static */ ATTRS: { /** * Specifies ability to scroll on x, y, or x and y axis/axes. * * @attribute axis * @type String */ axis: { setter: '_axisSetter', writeOnce: 'initOnly' }, /** * The current scroll position in the x-axis * * @attribute scrollX * @type Number * @default 0 */ scrollX: { value: 0, setter: '_setScrollX' }, /** * The current scroll position in the y-axis * * @attribute scrollY * @type Number * @default 0 */ scrollY: { value: 0, setter: '_setScrollY' }, /** * Drag coefficent for inertial scrolling. The closer to 1 this * value is, the less friction during scrolling. * * @attribute deceleration * @default 0.93 */ deceleration: { value: 0.93 }, /** * Drag coefficient for intertial scrolling at the upper * and lower boundaries of the scrollview. Set to 0 to * disable "rubber-banding". * * @attribute bounce * @type Number * @default 0.1 */ bounce: { value: 0.1 }, /** * The minimum distance and/or velocity which define a flick. Can be set to false, * to disable flick support (note: drag support is enabled/disabled separately) * * @attribute flick * @type Object * @default Object with properties minDistance = 10, minVelocity = 0.3. */ flick: { value: { minDistance: 10, minVelocity: 0.3 } }, /** * Enable/Disable dragging the ScrollView content (note: flick support is enabled/disabled separately) * @attribute drag * @type boolean * @default true */ drag: { value: true }, /** * The default duration to use when animating the bounce snap back. * * @attribute snapDuration * @type Number * @default 400 */ snapDuration: { value: 400 }, /** * The default easing to use when animating the bounce snap back. * * @attribute snapEasing * @type String * @default 'ease-out' */ snapEasing: { value: 'ease-out' }, /** * The default easing used when animating the flick * * @attribute easing * @type String * @default 'cubic-bezier(0, 0.1, 0, 1.0)' */ easing: { value: 'cubic-bezier(0, 0.1, 0, 1.0)' }, /** * The interval (ms) used when animating the flick for JS-timer animations * * @attribute frameDuration * @type Number * @default 15 */ frameDuration: { value: 15 }, /** * The default bounce distance in pixels * * @attribute bounceRange * @type Number * @default 150 */ bounceRange: { value: 150 } }, /** * List of class names used in the scrollview's DOM * * @property CLASS_NAMES * @type Object * @static */ CLASS_NAMES: CLASS_NAMES, /** * Flag used to source property changes initiated from the DOM * * @property UI_SRC * @type String * @static * @default 'ui' */ UI_SRC: UI, /** * Object map of style property names used to set transition properties. * Defaults to the vendor prefix established by the Transition module. * The configured property names are `_TRANSITION.DURATION` (e.g. "WebkitTransitionDuration") and * `_TRANSITION.PROPERTY (e.g. "WebkitTransitionProperty"). * * @property _TRANSITION * @private */ _TRANSITION: { DURATION: (vendorPrefix ? vendorPrefix + 'TransitionDuration' : 'transitionDuration'), PROPERTY: (vendorPrefix ? vendorPrefix + 'TransitionProperty' : 'transitionProperty') }, /** * The default bounce distance in pixels * * @property BOUNCE_RANGE * @type Number * @static * @default false * @deprecated (in 3.7.0) */ BOUNCE_RANGE: false, /** * The interval (ms) used when animating the flick * * @property FRAME_STEP * @type Number * @static * @default false * @deprecated (in 3.7.0) */ FRAME_STEP: false, /** * The default easing used when animating the flick * * @property EASING * @type String * @static * @default false * @deprecated (in 3.7.0) */ EASING: false, /** * The default easing to use when animating the bounce snap back. * * @property SNAP_EASING * @type String * @static * @default false * @deprecated (in 3.7.0) */ SNAP_EASING: false, /** * The default duration to use when animating the bounce snap back. * * @property SNAP_DURATION * @type Number * @static * @default false * @deprecated (in 3.7.0) */ SNAP_DURATION: false // End static properties }); }, '@VERSION@', {"requires": ["widget", "event-gestures", "event-mousewheel", "transition"], "skinnable": true});
lib/components/notification.js
martinvd/hyper
import React from 'react'; import Component from '../component'; export default class Notification extends Component { constructor() { super(); this.state = { dismissing: false }; this.handleDismiss = this.handleDismiss.bind(this); this.onElement = this.onElement.bind(this); } componentDidMount() { if (this.props.dismissAfter) { this.setDismissTimer(); } } componentWillReceiveProps(next) { // if we have a timer going and the notification text // changed we reset the timer if (next.text !== this.props.text) { if (this.props.dismissAfter) { this.resetDismissTimer(); } if (this.state.dismissing) { this.setState({dismissing: false}); } } } handleDismiss() { this.setState({dismissing: true}); } onElement(el) { if (el) { el.addEventListener('webkitTransitionEnd', () => { if (this.state.dismissing) { this.props.onDismiss(); } }); const {backgroundColor} = this.props; if (backgroundColor) { el.style.setProperty( 'background-color', backgroundColor, 'important' ); } } } setDismissTimer() { this.dismissTimer = setTimeout(() => { this.handleDismiss(); }, this.props.dismissAfter); } resetDismissTimer() { clearTimeout(this.dismissTimer); this.setDismissTimer(); } componentWillUnmount() { clearTimeout(this.dismissTimer); } template(css) { const {backgroundColor} = this.props; const opacity = this.state.dismissing ? 0 : 1; return (<div style={{opacity, backgroundColor}} ref={this.onElement} className={css('indicator')} > { this.props.customChildrenBefore } { this.props.children || this.props.text } { this.props.userDismissable ? <a className={css('dismissLink')} onClick={this.handleDismiss} style={{color: this.props.userDismissColor}} >[x]</a> : null } { this.props.customChildren } </div>); } styles() { return { indicator: { display: 'inline-block', cursor: 'default', WebkitUserSelect: 'none', background: 'rgba(255, 255, 255, .2)', borderRadius: '2px', padding: '8px 14px 9px', marginLeft: '10px', transition: '150ms opacity ease', color: '#fff', fontSize: '11px', fontFamily: `-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif` }, dismissLink: { position: 'relative', left: '4px', cursor: 'pointer', color: '#528D11', ':hover': { color: '#2A5100' } } }; } }
ajax/libs/angular.js/1.1.5/angular-scenario.js
bergie/cdnjs
/*! * jQuery JavaScript Library v1.8.2 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: Thu Sep 20 2012 21:13:05 GMT-0400 (Eastern Daylight Time) */ (function( window, undefined ) { 'use strict'; var // A central reference to the root jQuery(document) rootjQuery, // The deferred used on DOM ready readyList, // Use the correct document accordingly with window argument (sandbox) document = window.document, location = window.location, navigator = window.navigator, // Map over jQuery in case of overwrite _jQuery = window.jQuery, // Map over the $ in case of overwrite _$ = window.$, // Save a reference to some core methods core_push = Array.prototype.push, core_slice = Array.prototype.slice, core_indexOf = Array.prototype.indexOf, core_toString = Object.prototype.toString, core_hasOwn = Object.prototype.hasOwnProperty, core_trim = String.prototype.trim, // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context, rootjQuery ); }, // Used for matching numbers core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source, // Used for detecting and trimming whitespace core_rnotwhite = /\S/, core_rspace = /\s+/, // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // A simple way to check for HTML strings // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, // Match a standalone tag rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, // JSON RegExp rvalidchars = /^[\],:{}\s]*$/, rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, // Used by jQuery.camelCase as callback to replace() fcamelCase = function( all, letter ) { return ( letter + "" ).toUpperCase(); }, // The ready event handler and self cleanup method DOMContentLoaded = function() { if ( document.addEventListener ) { document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); jQuery.ready(); } else if ( document.readyState === "complete" ) { // we're here because readyState === "complete" in oldIE // which is good enough for us to call the dom ready! document.detachEvent( "onreadystatechange", DOMContentLoaded ); jQuery.ready(); } }, // [[Class]] -> type pairs class2type = {}; jQuery.fn = jQuery.prototype = { constructor: jQuery, init: function( selector, context, rootjQuery ) { var match, elem, ret, doc; // Handle $(""), $(null), $(undefined), $(false) if ( !selector ) { return this; } // Handle $(DOMElement) if ( selector.nodeType ) { this.context = this[0] = selector; this.length = 1; return this; } // Handle HTML strings if ( typeof selector === "string" ) { if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; } else { match = rquickExpr.exec( selector ); } // Match html or make sure no context is specified for #id if ( match && (match[1] || !context) ) { // HANDLE: $(html) -> $(array) if ( match[1] ) { context = context instanceof jQuery ? context[0] : context; doc = ( context && context.nodeType ? context.ownerDocument || context : document ); // scripts is true for back-compat selector = jQuery.parseHTML( match[1], doc, true ); if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { this.attr.call( selector, context, true ); } return jQuery.merge( this, selector ); // HANDLE: $(#id) } else { elem = document.getElementById( match[2] ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE and Opera return items // by name instead of ID if ( elem.id !== match[2] ) { return rootjQuery.find( selector ); } // Otherwise, we inject the element directly into the jQuery object this.length = 1; this[0] = elem; } this.context = document; this.selector = selector; return this; } // HANDLE: $(expr, $(...)) } else if ( !context || context.jquery ) { return ( context || rootjQuery ).find( selector ); // HANDLE: $(expr, context) // (which is just equivalent to: $(context).find(expr) } else { return this.constructor( context ).find( selector ); } // HANDLE: $(function) // Shortcut for document ready } else if ( jQuery.isFunction( selector ) ) { return rootjQuery.ready( selector ); } if ( selector.selector !== undefined ) { this.selector = selector.selector; this.context = selector.context; } return jQuery.makeArray( selector, this ); }, // Start with an empty selector selector: "", // The current version of jQuery being used jquery: "1.8.2", // The default length of a jQuery object is 0 length: 0, // The number of elements contained in the matched element set size: function() { return this.length; }, toArray: function() { return core_slice.call( this ); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function( num ) { return num == null ? // Return a 'clean' array this.toArray() : // Return just the object ( num < 0 ? this[ this.length + num ] : this[ num ] ); }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function( elems, name, selector ) { // Build a new jQuery matched element set var ret = jQuery.merge( this.constructor(), elems ); // Add the old object onto the stack (as a reference) ret.prevObject = this; ret.context = this.context; if ( name === "find" ) { ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; } else if ( name ) { ret.selector = this.selector + "." + name + "(" + selector + ")"; } // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. // (You can seed the arguments with an array of args, but this is // only used internally.) each: function( callback, args ) { return jQuery.each( this, callback, args ); }, ready: function( fn ) { // Add the callback jQuery.ready.promise().done( fn ); return this; }, eq: function( i ) { i = +i; return i === -1 ? this.slice( i ) : this.slice( i, i + 1 ); }, first: function() { return this.eq( 0 ); }, last: function() { return this.eq( -1 ); }, slice: function() { return this.pushStack( core_slice.apply( this, arguments ), "slice", core_slice.call(arguments).join(",") ); }, map: function( callback ) { return this.pushStack( jQuery.map(this, function( elem, i ) { return callback.call( elem, i, elem ); })); }, end: function() { return this.prevObject || this.constructor(null); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: core_push, sort: [].sort, splice: [].splice }; // Give the init function the jQuery prototype for later instantiation jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function() { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if ( typeof target === "boolean" ) { deep = target; target = arguments[1] || {}; // skip the boolean and the target i = 2; } // Handle case when target is a string or something (possible in deep copy) if ( typeof target !== "object" && !jQuery.isFunction(target) ) { target = {}; } // extend jQuery itself if only one argument is passed if ( length === i ) { target = this; --i; } for ( ; i < length; i++ ) { // Only deal with non-null/undefined values if ( (options = arguments[ i ]) != null ) { // Extend the base object for ( name in options ) { src = target[ name ]; copy = options[ name ]; // Prevent never-ending loop if ( target === copy ) { continue; } // Recurse if we're merging plain objects or arrays if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( copyIsArray ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); // Don't bring in undefined values } else if ( copy !== undefined ) { target[ name ] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ noConflict: function( deep ) { if ( window.$ === jQuery ) { window.$ = _$; } if ( deep && window.jQuery === jQuery ) { window.jQuery = _jQuery; } return jQuery; }, // Is the DOM ready to be used? Set to true once it occurs. isReady: false, // A counter to track how many items to wait for before // the ready event fires. See #6781 readyWait: 1, // Hold (or release) the ready event holdReady: function( hold ) { if ( hold ) { jQuery.readyWait++; } else { jQuery.ready( true ); } }, // Handle when the DOM is ready ready: function( wait ) { // Abort if there are pending holds or we're already ready if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { return; } // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). if ( !document.body ) { return setTimeout( jQuery.ready, 1 ); } // Remember that the DOM is ready jQuery.isReady = true; // If a normal DOM Ready event fired, decrement, and wait if need be if ( wait !== true && --jQuery.readyWait > 0 ) { return; } // If there are functions bound, to execute readyList.resolveWith( document, [ jQuery ] ); // Trigger any bound ready events if ( jQuery.fn.trigger ) { jQuery( document ).trigger("ready").off("ready"); } }, // See test/unit/core.js for details concerning isFunction. // Since version 1.3, DOM methods and functions like alert // aren't supported. They return false on IE (#2968). isFunction: function( obj ) { return jQuery.type(obj) === "function"; }, isArray: Array.isArray || function( obj ) { return jQuery.type(obj) === "array"; }, isWindow: function( obj ) { return obj != null && obj == obj.window; }, isNumeric: function( obj ) { return !isNaN( parseFloat(obj) ) && isFinite( obj ); }, type: function( obj ) { return obj == null ? String( obj ) : class2type[ core_toString.call(obj) ] || "object"; }, isPlainObject: function( obj ) { // Must be an Object. // Because of IE, we also have to check the presence of the constructor property. // Make sure that DOM nodes and window objects don't pass through, as well if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { return false; } try { // Not own constructor property must be Object if ( obj.constructor && !core_hasOwn.call(obj, "constructor") && !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { return false; } } catch ( e ) { // IE8,9 Will throw exceptions on certain host objects #9897 return false; } // Own properties are enumerated firstly, so to speed up, // if last one is own, then all properties are own. var key; for ( key in obj ) {} return key === undefined || core_hasOwn.call( obj, key ); }, isEmptyObject: function( obj ) { var name; for ( name in obj ) { return false; } return true; }, error: function( msg ) { throw new Error( msg ); }, // data: string of html // context (optional): If specified, the fragment will be created in this context, defaults to document // scripts (optional): If true, will include scripts passed in the html string parseHTML: function( data, context, scripts ) { var parsed; if ( !data || typeof data !== "string" ) { return null; } if ( typeof context === "boolean" ) { scripts = context; context = 0; } context = context || document; // Single tag if ( (parsed = rsingleTag.exec( data )) ) { return [ context.createElement( parsed[1] ) ]; } parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] ); return jQuery.merge( [], (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes ); }, parseJSON: function( data ) { if ( !data || typeof data !== "string") { return null; } // Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim( data ); // Attempt to parse using the native JSON parser first if ( window.JSON && window.JSON.parse ) { return window.JSON.parse( data ); } // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js if ( rvalidchars.test( data.replace( rvalidescape, "@" ) .replace( rvalidtokens, "]" ) .replace( rvalidbraces, "")) ) { return ( new Function( "return " + data ) )(); } jQuery.error( "Invalid JSON: " + data ); }, // Cross-browser xml parsing parseXML: function( data ) { var xml, tmp; if ( !data || typeof data !== "string" ) { return null; } try { if ( window.DOMParser ) { // Standard tmp = new DOMParser(); xml = tmp.parseFromString( data , "text/xml" ); } else { // IE xml = new ActiveXObject( "Microsoft.XMLDOM" ); xml.async = "false"; xml.loadXML( data ); } } catch( e ) { xml = undefined; } if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { jQuery.error( "Invalid XML: " + data ); } return xml; }, noop: function() {}, // Evaluates a script in a global context // Workarounds based on findings by Jim Driscoll // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context globalEval: function( data ) { if ( data && core_rnotwhite.test( data ) ) { // We use execScript on Internet Explorer // We use an anonymous function so that context is window // rather than jQuery in Firefox ( window.execScript || function( data ) { window[ "eval" ].call( window, data ); } )( data ); } }, // Convert dashed to camelCase; used by the css and data modules // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function( string ) { return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); }, nodeName: function( elem, name ) { return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); }, // args is for internal usage only each: function( obj, callback, args ) { var name, i = 0, length = obj.length, isObj = length === undefined || jQuery.isFunction( obj ); if ( args ) { if ( isObj ) { for ( name in obj ) { if ( callback.apply( obj[ name ], args ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.apply( obj[ i++ ], args ) === false ) { break; } } } // A special, fast, case for the most common use of each } else { if ( isObj ) { for ( name in obj ) { if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) { break; } } } else { for ( ; i < length; ) { if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) { break; } } } } return obj; }, // Use native String.trim function wherever possible trim: core_trim && !core_trim.call("\uFEFF\xA0") ? function( text ) { return text == null ? "" : core_trim.call( text ); } : // Otherwise use our own trimming functionality function( text ) { return text == null ? "" : ( text + "" ).replace( rtrim, "" ); }, // results is for internal usage only makeArray: function( arr, results ) { var type, ret = results || []; if ( arr != null ) { // The window, strings (and functions) also have 'length' // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 type = jQuery.type( arr ); if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) { core_push.call( ret, arr ); } else { jQuery.merge( ret, arr ); } } return ret; }, inArray: function( elem, arr, i ) { var len; if ( arr ) { if ( core_indexOf ) { return core_indexOf.call( arr, elem, i ); } len = arr.length; i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; for ( ; i < len; i++ ) { // Skip accessing in sparse arrays if ( i in arr && arr[ i ] === elem ) { return i; } } } return -1; }, merge: function( first, second ) { var l = second.length, i = first.length, j = 0; if ( typeof l === "number" ) { for ( ; j < l; j++ ) { first[ i++ ] = second[ j ]; } } else { while ( second[j] !== undefined ) { first[ i++ ] = second[ j++ ]; } } first.length = i; return first; }, grep: function( elems, callback, inv ) { var retVal, ret = [], i = 0, length = elems.length; inv = !!inv; // Go through the array, only saving the items // that pass the validator function for ( ; i < length; i++ ) { retVal = !!callback( elems[ i ], i ); if ( inv !== retVal ) { ret.push( elems[ i ] ); } } return ret; }, // arg is for internal usage only map: function( elems, callback, arg ) { var value, key, ret = [], i = 0, length = elems.length, // jquery objects are treated as arrays isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; // Go through the array, translating each of the items to their if ( isArray ) { for ( ; i < length; i++ ) { value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value; } } // Go through every key on the object, } else { for ( key in elems ) { value = callback( elems[ key ], key, arg ); if ( value != null ) { ret[ ret.length ] = value; } } } // Flatten any nested arrays return ret.concat.apply( [], ret ); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function( fn, context ) { var tmp, args, proxy; if ( typeof context === "string" ) { tmp = fn[ context ]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if ( !jQuery.isFunction( fn ) ) { return undefined; } // Simulated bind args = core_slice.call( arguments, 2 ); proxy = function() { return fn.apply( context, args.concat( core_slice.call( arguments ) ) ); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, // Multifunctional method to get and set values of a collection // The value/s can optionally be executed if it's a function access: function( elems, fn, key, value, chainable, emptyGet, pass ) { var exec, bulk = key == null, i = 0, length = elems.length; // Sets many values if ( key && typeof key === "object" ) { for ( i in key ) { jQuery.access( elems, fn, i, key[i], 1, emptyGet, value ); } chainable = 1; // Sets one value } else if ( value !== undefined ) { // Optionally, function values get executed if exec is true exec = pass === undefined && jQuery.isFunction( value ); if ( bulk ) { // Bulk operations only iterate when executing function values if ( exec ) { exec = fn; fn = function( elem, key, value ) { return exec.call( jQuery( elem ), value ); }; // Otherwise they run against the entire set } else { fn.call( elems, value ); fn = null; } } if ( fn ) { for (; i < length; i++ ) { fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); } } chainable = 1; } return chainable ? elems : // Gets bulk ? fn.call( elems ) : length ? fn( elems[0], key ) : emptyGet; }, now: function() { return ( new Date() ).getTime(); } }); jQuery.ready.promise = function( obj ) { if ( !readyList ) { readyList = jQuery.Deferred(); // Catch cases where $(document).ready() is called after the browser event has already occurred. // we once tried to use readyState "interactive" here, but it caused issues like the one // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 if ( document.readyState === "complete" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready setTimeout( jQuery.ready, 1 ); // Standards-based browsers support DOMContentLoaded } else if ( document.addEventListener ) { // Use the handy event callback document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); // A fallback to window.onload, that will always work window.addEventListener( "load", jQuery.ready, false ); // If IE event model is used } else { // Ensure firing before onload, maybe late but safe also for iframes document.attachEvent( "onreadystatechange", DOMContentLoaded ); // A fallback to window.onload, that will always work window.attachEvent( "onload", jQuery.ready ); // If IE and not a frame // continually check to see if the document is ready var top = false; try { top = window.frameElement == null && document.documentElement; } catch(e) {} if ( top && top.doScroll ) { (function doScrollCheck() { if ( !jQuery.isReady ) { try { // Use the trick by Diego Perini // http://javascript.nwbox.com/IEContentLoaded/ top.doScroll("left"); } catch(e) { return setTimeout( doScrollCheck, 50 ); } // and execute any waiting functions jQuery.ready(); } })(); } } } return readyList.promise( obj ); }; // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { class2type[ "[object " + name + "]" ] = name.toLowerCase(); }); // All jQuery objects should point back to these rootjQuery = jQuery(document); // String to Object options format cache var optionsCache = {}; // Convert String-formatted options into Object-formatted ones and store in cache function createOptions( options ) { var object = optionsCache[ options ] = {}; jQuery.each( options.split( core_rspace ), function( _, flag ) { object[ flag ] = true; }); return object; } /* * Create a callback list using the following parameters: * * options: an optional list of space-separated options that will change how * the callback list behaves or a more traditional option object * * By default a callback list will act like an event callback list and can be * "fired" multiple times. * * Possible options: * * once: will ensure the callback list can only be fired once (like a Deferred) * * memory: will keep track of previous values and will call any callback added * after the list has been fired right away with the latest "memorized" * values (like a Deferred) * * unique: will ensure a callback can only be added once (no duplicate in the list) * * stopOnFalse: interrupt callings when a callback returns false * */ jQuery.Callbacks = function( options ) { // Convert options from String-formatted to Object-formatted if needed // (we check in cache first) options = typeof options === "string" ? ( optionsCache[ options ] || createOptions( options ) ) : jQuery.extend( {}, options ); var // Last fire value (for non-forgettable lists) memory, // Flag to know if list was already fired fired, // Flag to know if list is currently firing firing, // First callback to fire (used internally by add and fireWith) firingStart, // End of the loop when firing firingLength, // Index of currently firing callback (modified by remove if needed) firingIndex, // Actual callback list list = [], // Stack of fire calls for repeatable lists stack = !options.once && [], // Fire callbacks fire = function( data ) { memory = options.memory && data; fired = true; firingIndex = firingStart || 0; firingStart = 0; firingLength = list.length; firing = true; for ( ; list && firingIndex < firingLength; firingIndex++ ) { if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { memory = false; // To prevent further calls using add break; } } firing = false; if ( list ) { if ( stack ) { if ( stack.length ) { fire( stack.shift() ); } } else if ( memory ) { list = []; } else { self.disable(); } } }, // Actual Callbacks object self = { // Add a callback or a collection of callbacks to the list add: function() { if ( list ) { // First, we save the current length var start = list.length; (function add( args ) { jQuery.each( args, function( _, arg ) { var type = jQuery.type( arg ); if ( type === "function" && ( !options.unique || !self.has( arg ) ) ) { list.push( arg ); } else if ( arg && arg.length && type !== "string" ) { // Inspect recursively add( arg ); } }); })( arguments ); // Do we need to add the callbacks to the // current firing batch? if ( firing ) { firingLength = list.length; // With memory, if we're not firing then // we should call right away } else if ( memory ) { firingStart = start; fire( memory ); } } return this; }, // Remove a callback from the list remove: function() { if ( list ) { jQuery.each( arguments, function( _, arg ) { var index; while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { list.splice( index, 1 ); // Handle firing indexes if ( firing ) { if ( index <= firingLength ) { firingLength--; } if ( index <= firingIndex ) { firingIndex--; } } } }); } return this; }, // Control if a given callback is in the list has: function( fn ) { return jQuery.inArray( fn, list ) > -1; }, // Remove all callbacks from the list empty: function() { list = []; return this; }, // Have the list do nothing anymore disable: function() { list = stack = memory = undefined; return this; }, // Is it disabled? disabled: function() { return !list; }, // Lock the list in its current state lock: function() { stack = undefined; if ( !memory ) { self.disable(); } return this; }, // Is it locked? locked: function() { return !stack; }, // Call all callbacks with the given context and arguments fireWith: function( context, args ) { args = args || []; args = [ context, args.slice ? args.slice() : args ]; if ( list && ( !fired || stack ) ) { if ( firing ) { stack.push( args ); } else { fire( args ); } } return this; }, // Call all the callbacks with the given arguments fire: function() { self.fireWith( this, arguments ); return this; }, // To know if the callbacks have already been called at least once fired: function() { return !!fired; } }; return self; }; jQuery.extend({ Deferred: function( func ) { var tuples = [ // action, add listener, listener list, final state [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], [ "notify", "progress", jQuery.Callbacks("memory") ] ], state = "pending", promise = { state: function() { return state; }, always: function() { deferred.done( arguments ).fail( arguments ); return this; }, then: function( /* fnDone, fnFail, fnProgress */ ) { var fns = arguments; return jQuery.Deferred(function( newDefer ) { jQuery.each( tuples, function( i, tuple ) { var action = tuple[ 0 ], fn = fns[ i ]; // deferred[ done | fail | progress ] for forwarding actions to newDefer deferred[ tuple[1] ]( jQuery.isFunction( fn ) ? function() { var returned = fn.apply( this, arguments ); if ( returned && jQuery.isFunction( returned.promise ) ) { returned.promise() .done( newDefer.resolve ) .fail( newDefer.reject ) .progress( newDefer.notify ); } else { newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); } } : newDefer[ action ] ); }); fns = null; }).promise(); }, // Get a promise for this deferred // If obj is provided, the promise aspect is added to the object promise: function( obj ) { return obj != null ? jQuery.extend( obj, promise ) : promise; } }, deferred = {}; // Keep pipe for back-compat promise.pipe = promise.then; // Add list-specific methods jQuery.each( tuples, function( i, tuple ) { var list = tuple[ 2 ], stateString = tuple[ 3 ]; // promise[ done | fail | progress ] = list.add promise[ tuple[1] ] = list.add; // Handle state if ( stateString ) { list.add(function() { // state = [ resolved | rejected ] state = stateString; // [ reject_list | resolve_list ].disable; progress_list.lock }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); } // deferred[ resolve | reject | notify ] = list.fire deferred[ tuple[0] ] = list.fire; deferred[ tuple[0] + "With" ] = list.fireWith; }); // Make the deferred a promise promise.promise( deferred ); // Call given func if any if ( func ) { func.call( deferred, deferred ); } // All done! return deferred; }, // Deferred helper when: function( subordinate /* , ..., subordinateN */ ) { var i = 0, resolveValues = core_slice.call( arguments ), length = resolveValues.length, // the count of uncompleted subordinates remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, // the master Deferred. If resolveValues consist of only a single Deferred, just use that. deferred = remaining === 1 ? subordinate : jQuery.Deferred(), // Update function for both resolve and progress values updateFunc = function( i, contexts, values ) { return function( value ) { contexts[ i ] = this; values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; if( values === progressValues ) { deferred.notifyWith( contexts, values ); } else if ( !( --remaining ) ) { deferred.resolveWith( contexts, values ); } }; }, progressValues, progressContexts, resolveContexts; // add listeners to Deferred subordinates; treat others as resolved if ( length > 1 ) { progressValues = new Array( length ); progressContexts = new Array( length ); resolveContexts = new Array( length ); for ( ; i < length; i++ ) { if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { resolveValues[ i ].promise() .done( updateFunc( i, resolveContexts, resolveValues ) ) .fail( deferred.reject ) .progress( updateFunc( i, progressContexts, progressValues ) ); } else { --remaining; } } } // if we're not waiting on anything, resolve the master if ( !remaining ) { deferred.resolveWith( resolveContexts, resolveValues ); } return deferred.promise(); } }); jQuery.support = (function() { var support, all, a, select, opt, input, fragment, eventName, i, isSupported, clickFn, div = document.createElement("div"); // Preliminary tests div.setAttribute( "className", "t" ); div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; all = div.getElementsByTagName("*"); a = div.getElementsByTagName("a")[ 0 ]; a.style.cssText = "top:1px;float:left;opacity:.5"; // Can't get basic test support if ( !all || !all.length ) { return {}; } // First batch of supports tests select = document.createElement("select"); opt = select.appendChild( document.createElement("option") ); input = div.getElementsByTagName("input")[ 0 ]; support = { // IE strips leading whitespace when .innerHTML is used leadingWhitespace: ( div.firstChild.nodeType === 3 ), // Make sure that tbody elements aren't automatically inserted // IE will insert them into empty tables tbody: !div.getElementsByTagName("tbody").length, // Make sure that link elements get serialized correctly by innerHTML // This requires a wrapper element in IE htmlSerialize: !!div.getElementsByTagName("link").length, // Get the style information from getAttribute // (IE uses .cssText instead) style: /top/.test( a.getAttribute("style") ), // Make sure that URLs aren't manipulated // (IE normalizes it by default) hrefNormalized: ( a.getAttribute("href") === "/a" ), // Make sure that element opacity exists // (IE uses filter instead) // Use a regex to work around a WebKit issue. See #5145 opacity: /^0.5/.test( a.style.opacity ), // Verify style float existence // (IE uses styleFloat instead of cssFloat) cssFloat: !!a.style.cssFloat, // Make sure that if no value is specified for a checkbox // that it defaults to "on". // (WebKit defaults to "" instead) checkOn: ( input.value === "on" ), // Make sure that a selected-by-default option has a working selected property. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) optSelected: opt.selected, // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) getSetAttribute: div.className !== "t", // Tests for enctype support on a form(#6743) enctype: !!document.createElement("form").enctype, // Makes sure cloning an html5 element does not cause problems // Where outerHTML is undefined, this still works html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode boxModel: ( document.compatMode === "CSS1Compat" ), // Will be defined later submitBubbles: true, changeBubbles: true, focusinBubbles: false, deleteExpando: true, noCloneEvent: true, inlineBlockNeedsLayout: false, shrinkWrapBlocks: false, reliableMarginRight: true, boxSizingReliable: true, pixelPosition: false }; // Make sure checked status is properly cloned input.checked = true; support.noCloneChecked = input.cloneNode( true ).checked; // Make sure that the options inside disabled selects aren't marked as disabled // (WebKit marks them as disabled) select.disabled = true; support.optDisabled = !opt.disabled; // Test to see if it's possible to delete an expando from an element // Fails in Internet Explorer try { delete div.test; } catch( e ) { support.deleteExpando = false; } if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { div.attachEvent( "onclick", clickFn = function() { // Cloning a node shouldn't copy over any // bound event handlers (IE does this) support.noCloneEvent = false; }); div.cloneNode( true ).fireEvent("onclick"); div.detachEvent( "onclick", clickFn ); } // Check if a radio maintains its value // after being appended to the DOM input = document.createElement("input"); input.value = "t"; input.setAttribute( "type", "radio" ); support.radioValue = input.value === "t"; input.setAttribute( "checked", "checked" ); // #11217 - WebKit loses check when the name is after the checked attribute input.setAttribute( "name", "t" ); div.appendChild( input ); fragment = document.createDocumentFragment(); fragment.appendChild( div.lastChild ); // WebKit doesn't clone checked state correctly in fragments support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; // Check if a disconnected checkbox will retain its checked // value of true after appended to the DOM (IE6/7) support.appendChecked = input.checked; fragment.removeChild( input ); fragment.appendChild( div ); // Technique from Juriy Zaytsev // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ // We only care about the case where non-standard event systems // are used, namely in IE. Short-circuiting here helps us to // avoid an eval call (in setAttribute) which can cause CSP // to go haywire. See: https://developer.mozilla.org/en/Security/CSP if ( div.attachEvent ) { for ( i in { submit: true, change: true, focusin: true }) { eventName = "on" + i; isSupported = ( eventName in div ); if ( !isSupported ) { div.setAttribute( eventName, "return;" ); isSupported = ( typeof div[ eventName ] === "function" ); } support[ i + "Bubbles" ] = isSupported; } } // Run tests that need a body at doc ready jQuery(function() { var container, div, tds, marginDiv, divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;", body = document.getElementsByTagName("body")[0]; if ( !body ) { // Return for frameset docs that don't have a body return; } container = document.createElement("div"); container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; body.insertBefore( container, body.firstChild ); // Construct the test element div = document.createElement("div"); container.appendChild( div ); // Check if table cells still have offsetWidth/Height when they are set // to display:none and there are still other visible table cells in a // table row; if so, offsetWidth/Height are not reliable for use when // determining if an element has been hidden directly using // display:none (it is still safe to use offsets if a parent element is // hidden; don safety goggles and see bug #4512 for more information). // (only IE 8 fails this test) div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; tds = div.getElementsByTagName("td"); tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; isSupported = ( tds[ 0 ].offsetHeight === 0 ); tds[ 0 ].style.display = ""; tds[ 1 ].style.display = "none"; // Check if empty table cells still have offsetWidth/Height // (IE <= 8 fail this test) support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); // Check box-sizing and margin behavior div.innerHTML = ""; div.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%;"; support.boxSizing = ( div.offsetWidth === 4 ); support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); // NOTE: To any future maintainer, we've window.getComputedStyle // because jsdom on node.js will break without it. if ( window.getComputedStyle ) { support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; // Check if div with explicit width and no margin-right incorrectly // gets computed margin-right based on width of container. For more // info see bug #3333 // Fails in WebKit before Feb 2011 nightlies // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right marginDiv = document.createElement("div"); marginDiv.style.cssText = div.style.cssText = divReset; marginDiv.style.marginRight = marginDiv.style.width = "0"; div.style.width = "1px"; div.appendChild( marginDiv ); support.reliableMarginRight = !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); } if ( typeof div.style.zoom !== "undefined" ) { // Check if natively block-level elements act like inline-block // elements when setting their display to 'inline' and giving // them layout // (IE < 8 does this) div.innerHTML = ""; div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); // Check if elements with layout shrink-wrap their children // (IE 6 does this) div.style.display = "block"; div.style.overflow = "visible"; div.innerHTML = "<div></div>"; div.firstChild.style.width = "5px"; support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); container.style.zoom = 1; } // Null elements to avoid leaks in IE body.removeChild( container ); container = div = tds = marginDiv = null; }); // Null elements to avoid leaks in IE fragment.removeChild( div ); all = a = select = opt = input = fragment = div = null; return support; })(); var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, rmultiDash = /([A-Z])/g; jQuery.extend({ cache: {}, deletedIds: [], // Remove at next major release (1.9/2.0) uuid: 0, // Unique for each copy of jQuery on the page // Non-digits removed to match rinlinejQuery expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), // The following elements throw uncatchable exceptions if you // attempt to add expando properties to them. noData: { "embed": true, // Ban all objects except for Flash (which handle expandos) "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", "applet": true }, hasData: function( elem ) { elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; return !!elem && !isEmptyDataObject( elem ); }, data: function( elem, name, data, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, ret, internalKey = jQuery.expando, getByName = typeof name === "string", // We have to handle DOM nodes and JS objects differently because IE6-7 // can't GC object references properly across the DOM-JS boundary isNode = elem.nodeType, // Only DOM nodes need the global jQuery cache; JS object data is // attached directly to the object so GC can occur automatically cache = isNode ? jQuery.cache : elem, // Only defining an ID for JS objects if its cache already exists allows // the code to shortcut on the same path as a DOM node with no cache id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; // Avoid doing any more work than we need to when trying to get data on an // object that has no data at all if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { return; } if ( !id ) { // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if ( isNode ) { elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++; } else { id = internalKey; } } if ( !cache[ id ] ) { cache[ id ] = {}; // Avoids exposing jQuery metadata on plain JS objects when the object // is serialized using JSON.stringify if ( !isNode ) { cache[ id ].toJSON = jQuery.noop; } } // An object can be passed to jQuery.data instead of a key/value pair; this gets // shallow copied over onto the existing cache if ( typeof name === "object" || typeof name === "function" ) { if ( pvt ) { cache[ id ] = jQuery.extend( cache[ id ], name ); } else { cache[ id ].data = jQuery.extend( cache[ id ].data, name ); } } thisCache = cache[ id ]; // jQuery data() is stored in a separate object inside the object's internal data // cache in order to avoid key collisions between internal data and user-defined // data. if ( !pvt ) { if ( !thisCache.data ) { thisCache.data = {}; } thisCache = thisCache.data; } if ( data !== undefined ) { thisCache[ jQuery.camelCase( name ) ] = data; } // Check for both converted-to-camel and non-converted data property names // If a data property was specified if ( getByName ) { // First Try to find as-is property data ret = thisCache[ name ]; // Test for null|undefined property data if ( ret == null ) { // Try to find the camelCased property ret = thisCache[ jQuery.camelCase( name ) ]; } } else { ret = thisCache; } return ret; }, removeData: function( elem, name, pvt /* Internal Use Only */ ) { if ( !jQuery.acceptData( elem ) ) { return; } var thisCache, i, l, isNode = elem.nodeType, // See jQuery.data for more information cache = isNode ? jQuery.cache : elem, id = isNode ? elem[ jQuery.expando ] : jQuery.expando; // If there is already no cache entry for this object, there is no // purpose in continuing if ( !cache[ id ] ) { return; } if ( name ) { thisCache = pvt ? cache[ id ] : cache[ id ].data; if ( thisCache ) { // Support array or space separated string names for data keys if ( !jQuery.isArray( name ) ) { // try the string as a key before any manipulation if ( name in thisCache ) { name = [ name ]; } else { // split the camel cased version by spaces unless a key with the spaces exists name = jQuery.camelCase( name ); if ( name in thisCache ) { name = [ name ]; } else { name = name.split(" "); } } } for ( i = 0, l = name.length; i < l; i++ ) { delete thisCache[ name[i] ]; } // If there is no data left in the cache, we want to continue // and let the cache object itself get destroyed if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { return; } } } // See jQuery.data for more information if ( !pvt ) { delete cache[ id ].data; // Don't destroy the parent cache unless the internal data object // had been the only thing left in it if ( !isEmptyDataObject( cache[ id ] ) ) { return; } } // Destroy the cache if ( isNode ) { jQuery.cleanData( [ elem ], true ); // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) } else if ( jQuery.support.deleteExpando || cache != cache.window ) { delete cache[ id ]; // When all else fails, null } else { cache[ id ] = null; } }, // For internal use only. _data: function( elem, name, data ) { return jQuery.data( elem, name, data, true ); }, // A method for determining if a DOM node can handle the data expando acceptData: function( elem ) { var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; // nodes accept data unless otherwise specified; rejection can be conditional return !noData || noData !== true && elem.getAttribute("classid") === noData; } }); jQuery.fn.extend({ data: function( key, value ) { var parts, part, attr, name, l, elem = this[0], i = 0, data = null; // Gets all values if ( key === undefined ) { if ( this.length ) { data = jQuery.data( elem ); if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { attr = elem.attributes; for ( l = attr.length; i < l; i++ ) { name = attr[i].name; if ( !name.indexOf( "data-" ) ) { name = jQuery.camelCase( name.substring(5) ); dataAttr( elem, name, data[ name ] ); } } jQuery._data( elem, "parsedAttrs", true ); } } return data; } // Sets multiple values if ( typeof key === "object" ) { return this.each(function() { jQuery.data( this, key ); }); } parts = key.split( ".", 2 ); parts[1] = parts[1] ? "." + parts[1] : ""; part = parts[1] + "!"; return jQuery.access( this, function( value ) { if ( value === undefined ) { data = this.triggerHandler( "getData" + part, [ parts[0] ] ); // Try to fetch any internally stored data first if ( data === undefined && elem ) { data = jQuery.data( elem, key ); data = dataAttr( elem, key, data ); } return data === undefined && parts[1] ? this.data( parts[0] ) : data; } parts[1] = value; this.each(function() { var self = jQuery( this ); self.triggerHandler( "setData" + part, parts ); jQuery.data( this, key, value ); self.triggerHandler( "changeData" + part, parts ); }); }, null, value, arguments.length > 1, null, false ); }, removeData: function( key ) { return this.each(function() { jQuery.removeData( this, key ); }); } }); function dataAttr( elem, key, data ) { // If nothing was found internally, try to fetch any // data from the HTML5 data-* attribute if ( data === undefined && elem.nodeType === 1 ) { var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); data = elem.getAttribute( name ); if ( typeof data === "string" ) { try { data = data === "true" ? true : data === "false" ? false : data === "null" ? null : // Only convert to a number if it doesn't change the string +data + "" === data ? +data : rbrace.test( data ) ? jQuery.parseJSON( data ) : data; } catch( e ) {} // Make sure we set the data so it isn't changed later jQuery.data( elem, key, data ); } else { data = undefined; } } return data; } // checks a cache object for emptiness function isEmptyDataObject( obj ) { var name; for ( name in obj ) { // if the public data object is empty, the private is still empty if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { continue; } if ( name !== "toJSON" ) { return false; } } return true; } jQuery.extend({ queue: function( elem, type, data ) { var queue; if ( elem ) { type = ( type || "fx" ) + "queue"; queue = jQuery._data( elem, type ); // Speed up dequeue by getting out quickly if this is just a lookup if ( data ) { if ( !queue || jQuery.isArray(data) ) { queue = jQuery._data( elem, type, jQuery.makeArray(data) ); } else { queue.push( data ); } } return queue || []; } }, dequeue: function( elem, type ) { type = type || "fx"; var queue = jQuery.queue( elem, type ), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks( elem, type ), next = function() { jQuery.dequeue( elem, type ); }; // If the fx queue is dequeued, always remove the progress sentinel if ( fn === "inprogress" ) { fn = queue.shift(); startLength--; } if ( fn ) { // Add a progress sentinel to prevent the fx queue from being // automatically dequeued if ( type === "fx" ) { queue.unshift( "inprogress" ); } // clear up the last queue stop function delete hooks.stop; fn.call( elem, next, hooks ); } if ( !startLength && hooks ) { hooks.empty.fire(); } }, // not intended for public consumption - generates a queueHooks object, or returns the current one _queueHooks: function( elem, type ) { var key = type + "queueHooks"; return jQuery._data( elem, key ) || jQuery._data( elem, key, { empty: jQuery.Callbacks("once memory").add(function() { jQuery.removeData( elem, type + "queue", true ); jQuery.removeData( elem, key, true ); }) }); } }); jQuery.fn.extend({ queue: function( type, data ) { var setter = 2; if ( typeof type !== "string" ) { data = type; type = "fx"; setter--; } if ( arguments.length < setter ) { return jQuery.queue( this[0], type ); } return data === undefined ? this : this.each(function() { var queue = jQuery.queue( this, type, data ); // ensure a hooks for this queue jQuery._queueHooks( this, type ); if ( type === "fx" && queue[0] !== "inprogress" ) { jQuery.dequeue( this, type ); } }); }, dequeue: function( type ) { return this.each(function() { jQuery.dequeue( this, type ); }); }, // Based off of the plugin by Clint Helfers, with permission. // http://blindsignals.com/index.php/2009/07/jquery-delay/ delay: function( time, type ) { time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; type = type || "fx"; return this.queue( type, function( next, hooks ) { var timeout = setTimeout( next, time ); hooks.stop = function() { clearTimeout( timeout ); }; }); }, clearQueue: function( type ) { return this.queue( type || "fx", [] ); }, // Get a promise resolved when queues of a certain type // are emptied (fx is the type by default) promise: function( type, obj ) { var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() { if ( !( --count ) ) { defer.resolveWith( elements, [ elements ] ); } }; if ( typeof type !== "string" ) { obj = type; type = undefined; } type = type || "fx"; while( i-- ) { tmp = jQuery._data( elements[ i ], type + "queueHooks" ); if ( tmp && tmp.empty ) { count++; tmp.empty.add( resolve ); } } resolve(); return defer.promise( obj ); } }); var nodeHook, boolHook, fixSpecified, rclass = /[\t\r\n]/g, rreturn = /\r/g, rtype = /^(?:button|input)$/i, rfocusable = /^(?:button|input|object|select|textarea)$/i, rclickable = /^a(?:rea|)$/i, rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, getSetAttribute = jQuery.support.getSetAttribute; jQuery.fn.extend({ attr: function( name, value ) { return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); }, removeAttr: function( name ) { return this.each(function() { jQuery.removeAttr( this, name ); }); }, prop: function( name, value ) { return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); }, removeProp: function( name ) { name = jQuery.propFix[ name ] || name; return this.each(function() { // try/catch handles cases where IE balks (such as removing a property on window) try { this[ name ] = undefined; delete this[ name ]; } catch( e ) {} }); }, addClass: function( value ) { var classNames, i, l, elem, setClass, c, cl; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).addClass( value.call(this, j, this.className) ); }); } if ( value && typeof value === "string" ) { classNames = value.split( core_rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodeType === 1 ) { if ( !elem.className && classNames.length === 1 ) { elem.className = value; } else { setClass = " " + elem.className + " "; for ( c = 0, cl = classNames.length; c < cl; c++ ) { if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) { setClass += classNames[ c ] + " "; } } elem.className = jQuery.trim( setClass ); } } } } return this; }, removeClass: function( value ) { var removes, className, elem, c, cl, i, l; if ( jQuery.isFunction( value ) ) { return this.each(function( j ) { jQuery( this ).removeClass( value.call(this, j, this.className) ); }); } if ( (value && typeof value === "string") || value === undefined ) { removes = ( value || "" ).split( core_rspace ); for ( i = 0, l = this.length; i < l; i++ ) { elem = this[ i ]; if ( elem.nodeType === 1 && elem.className ) { className = (" " + elem.className + " ").replace( rclass, " " ); // loop over each item in the removal list for ( c = 0, cl = removes.length; c < cl; c++ ) { // Remove until there is nothing to remove, while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) { className = className.replace( " " + removes[ c ] + " " , " " ); } } elem.className = value ? jQuery.trim( className ) : ""; } } } return this; }, toggleClass: function( value, stateVal ) { var type = typeof value, isBool = typeof stateVal === "boolean"; if ( jQuery.isFunction( value ) ) { return this.each(function( i ) { jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); }); } return this.each(function() { if ( type === "string" ) { // toggle individual class names var className, i = 0, self = jQuery( this ), state = stateVal, classNames = value.split( core_rspace ); while ( (className = classNames[ i++ ]) ) { // check each className given, space separated list state = isBool ? state : !self.hasClass( className ); self[ state ? "addClass" : "removeClass" ]( className ); } } else if ( type === "undefined" || type === "boolean" ) { if ( this.className ) { // store className if set jQuery._data( this, "__className__", this.className ); } // toggle whole className this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; } }); }, hasClass: function( selector ) { var className = " " + selector + " ", i = 0, l = this.length; for ( ; i < l; i++ ) { if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { return true; } } return false; }, val: function( value ) { var hooks, ret, isFunction, elem = this[0]; if ( !arguments.length ) { if ( elem ) { hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { return ret; } ret = elem.value; return typeof ret === "string" ? // handle most common string cases ret.replace(rreturn, "") : // handle cases where value is null/undef or number ret == null ? "" : ret; } return; } isFunction = jQuery.isFunction( value ); return this.each(function( i ) { var val, self = jQuery(this); if ( this.nodeType !== 1 ) { return; } if ( isFunction ) { val = value.call( this, i, self.val() ); } else { val = value; } // Treat null/undefined as ""; convert numbers to string if ( val == null ) { val = ""; } else if ( typeof val === "number" ) { val += ""; } else if ( jQuery.isArray( val ) ) { val = jQuery.map(val, function ( value ) { return value == null ? "" : value + ""; }); } hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; // If set returns undefined, fall back to normal setting if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { this.value = val; } }); } }); jQuery.extend({ valHooks: { option: { get: function( elem ) { // attributes.value is undefined in Blackberry 4.7 but // uses .value. See #6932 var val = elem.attributes.value; return !val || val.specified ? elem.value : elem.text; } }, select: { get: function( elem ) { var value, i, max, option, index = elem.selectedIndex, values = [], options = elem.options, one = elem.type === "select-one"; // Nothing was selected if ( index < 0 ) { return null; } // Loop through all the selected options i = one ? index : 0; max = one ? index + 1 : options.length; for ( ; i < max; i++ ) { option = options[ i ]; // Don't return options that are disabled or in a disabled optgroup if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { // Get the specific value for the option value = jQuery( option ).val(); // We don't need an array for one selects if ( one ) { return value; } // Multi-Selects return an array values.push( value ); } } // Fixes Bug #2551 -- select.val() broken in IE after form.reset() if ( one && !values.length && options.length ) { return jQuery( options[ index ] ).val(); } return values; }, set: function( elem, value ) { var values = jQuery.makeArray( value ); jQuery(elem).find("option").each(function() { this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; }); if ( !values.length ) { elem.selectedIndex = -1; } return values; } } }, // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9 attrFn: {}, attr: function( elem, name, value, pass ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set attributes on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) { return jQuery( elem )[ name ]( value ); } // Fallback to prop when attributes are not supported if ( typeof elem.getAttribute === "undefined" ) { return jQuery.prop( elem, name, value ); } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); // All attributes are lowercase // Grab necessary hook if one is defined if ( notxml ) { name = name.toLowerCase(); hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); } if ( value !== undefined ) { if ( value === null ) { jQuery.removeAttr( elem, name ); return; } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { elem.setAttribute( name, value + "" ); return value; } } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { ret = elem.getAttribute( name ); // Non-existent attributes return null, we normalize to undefined return ret === null ? undefined : ret; } }, removeAttr: function( elem, value ) { var propName, attrNames, name, isBool, i = 0; if ( value && elem.nodeType === 1 ) { attrNames = value.split( core_rspace ); for ( ; i < attrNames.length; i++ ) { name = attrNames[ i ]; if ( name ) { propName = jQuery.propFix[ name ] || name; isBool = rboolean.test( name ); // See #9699 for explanation of this approach (setting first, then removal) // Do not do this for boolean attributes (see #10870) if ( !isBool ) { jQuery.attr( elem, name, "" ); } elem.removeAttribute( getSetAttribute ? name : propName ); // Set corresponding property to false for boolean attributes if ( isBool && propName in elem ) { elem[ propName ] = false; } } } } }, attrHooks: { type: { set: function( elem, value ) { // We can't allow the type property to be changed (since it causes problems in IE) if ( rtype.test( elem.nodeName ) && elem.parentNode ) { jQuery.error( "type property can't be changed" ); } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { // Setting the type on a radio button after the value resets the value in IE6-9 // Reset value to it's default in case type is set after value // This is for element creation var val = elem.value; elem.setAttribute( "type", value ); if ( val ) { elem.value = val; } return value; } } }, // Use the value property for back compat // Use the nodeHook for button elements in IE6/7 (#1954) value: { get: function( elem, name ) { if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { return nodeHook.get( elem, name ); } return name in elem ? elem.value : null; }, set: function( elem, value, name ) { if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { return nodeHook.set( elem, value, name ); } // Does not return so that setAttribute is also used elem.value = value; } } }, 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( elem, name, value ) { var ret, hooks, notxml, nType = elem.nodeType; // don't get/set properties on text, comment and attribute nodes if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { return; } notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); if ( notxml ) { // Fix name and attach hooks name = jQuery.propFix[ name ] || name; hooks = jQuery.propHooks[ name ]; } if ( value !== undefined ) { if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { return ret; } else { return ( elem[ name ] = value ); } } else { if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { return ret; } else { return elem[ name ]; } } }, propHooks: { tabIndex: { get: function( elem ) { // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ var attributeNode = elem.getAttributeNode("tabindex"); return attributeNode && attributeNode.specified ? parseInt( attributeNode.value, 10 ) : rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 0 : undefined; } } } }); // Hook for boolean attributes boolHook = { get: function( elem, name ) { // Align boolean attributes with corresponding properties // Fall back to attribute presence where some booleans are not supported var attrNode, property = jQuery.prop( elem, name ); return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? name.toLowerCase() : undefined; }, set: function( elem, value, name ) { var propName; if ( value === false ) { // Remove boolean attributes when set to false jQuery.removeAttr( elem, name ); } else { // value is true since we know at this point it's type boolean and not false // Set boolean attributes to the same name and set the DOM property propName = jQuery.propFix[ name ] || name; if ( propName in elem ) { // Only set the IDL specifically if it already exists on the element elem[ propName ] = true; } elem.setAttribute( name, name.toLowerCase() ); } return name; } }; // IE6/7 do not support getting/setting some attributes with get/setAttribute if ( !getSetAttribute ) { fixSpecified = { name: true, id: true, coords: true }; // Use this for any attribute in IE6/7 // This fixes almost every IE6/7 issue nodeHook = jQuery.valHooks.button = { get: function( elem, name ) { var ret; ret = elem.getAttributeNode( name ); return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ? ret.value : undefined; }, set: function( elem, value, name ) { // Set the existing or create a new attribute node var ret = elem.getAttributeNode( name ); if ( !ret ) { ret = document.createAttribute( name ); elem.setAttributeNode( ret ); } return ( ret.value = value + "" ); } }; // Set width and height to auto instead of 0 on empty string( Bug #8150 ) // This is for removals jQuery.each([ "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { set: function( elem, value ) { if ( value === "" ) { elem.setAttribute( name, "auto" ); return value; } } }); }); // Set contenteditable to false on removals(#10429) // Setting to empty string throws an error as an invalid value jQuery.attrHooks.contenteditable = { get: nodeHook.get, set: function( elem, value, name ) { if ( value === "" ) { value = "false"; } nodeHook.set( elem, value, name ); } }; } // Some attributes require a special call on IE if ( !jQuery.support.hrefNormalized ) { jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { get: function( elem ) { var ret = elem.getAttribute( name, 2 ); return ret === null ? undefined : ret; } }); }); } if ( !jQuery.support.style ) { jQuery.attrHooks.style = { get: function( elem ) { // Return undefined in the case of empty string // Normalize to lowercase since IE uppercases css property names return elem.style.cssText.toLowerCase() || undefined; }, set: function( elem, value ) { return ( elem.style.cssText = value + "" ); } }; } // Safari mis-reports the default selected property of an option // Accessing the parent's selectedIndex property fixes it if ( !jQuery.support.optSelected ) { jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { get: function( elem ) { var parent = elem.parentNode; if ( parent ) { parent.selectedIndex; // Make sure that it also works with optgroups, see #5701 if ( parent.parentNode ) { parent.parentNode.selectedIndex; } } return null; } }); } // IE6/7 call enctype encoding if ( !jQuery.support.enctype ) { jQuery.propFix.enctype = "encoding"; } // Radios and checkboxes getter/setter if ( !jQuery.support.checkOn ) { jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = { get: function( elem ) { // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified return elem.getAttribute("value") === null ? "on" : elem.value; } }; }); } jQuery.each([ "radio", "checkbox" ], function() { jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { set: function( elem, value ) { if ( jQuery.isArray( value ) ) { return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); } } }); }); var rformElems = /^(?:textarea|input|select)$/i, rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/, rhoverHack = /(?:^|\s)hover(\.\S+|)\b/, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|contextmenu)|click/, rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, hoverHack = function( events ) { return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); }; /* * Helper functions for managing events -- not part of the public interface. * Props to Dean Edwards' addEvent library for many of the ideas. */ jQuery.event = { add: function( elem, types, handler, data, selector ) { var elemData, eventHandle, events, t, tns, type, namespaces, handleObj, handleObjIn, handlers, special; // Don't attach events to noData or text/comment nodes (allow plain objects tho) if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { return; } // Caller can pass in an object of custom data in lieu of the handler if ( handler.handler ) { handleObjIn = handler; handler = handleObjIn.handler; selector = handleObjIn.selector; } // Make sure that the handler has a unique ID, used to find/remove it later if ( !handler.guid ) { handler.guid = jQuery.guid++; } // Init the element's event structure and main handler, if this is the first events = elemData.events; if ( !events ) { elemData.events = events = {}; } eventHandle = elemData.handle; if ( !eventHandle ) { elemData.handle = eventHandle = function( e ) { // Discard the second event of a jQuery.event.trigger() and // when an event is called after a page has unloaded return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : undefined; }; // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events eventHandle.elem = elem; } // Handle multiple events separated by a space // jQuery(...).bind("mouseover mouseout", fn); types = jQuery.trim( hoverHack(types) ).split( " " ); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = tns[1]; namespaces = ( tns[2] || "" ).split( "." ).sort(); // If event changes its type, use the special event handlers for the changed type special = jQuery.event.special[ type ] || {}; // If selector defined, determine special event api type, otherwise given type type = ( selector ? special.delegateType : special.bindType ) || type; // Update special based on newly reset type special = jQuery.event.special[ type ] || {}; // handleObj is passed to all event handlers handleObj = jQuery.extend({ type: type, origType: tns[1], data: data, handler: handler, guid: handler.guid, selector: selector, needsContext: selector && jQuery.expr.match.needsContext.test( selector ), namespace: namespaces.join(".") }, handleObjIn ); // Init the event handler queue if we're the first handlers = events[ type ]; if ( !handlers ) { handlers = events[ type ] = []; handlers.delegateCount = 0; // Only use addEventListener/attachEvent if the special events handler returns false if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { // Bind the global event handler to the element if ( elem.addEventListener ) { elem.addEventListener( type, eventHandle, false ); } else if ( elem.attachEvent ) { elem.attachEvent( "on" + type, eventHandle ); } } } if ( special.add ) { special.add.call( elem, handleObj ); if ( !handleObj.handler.guid ) { handleObj.handler.guid = handler.guid; } } // Add to the element's handler list, delegates in front if ( selector ) { handlers.splice( handlers.delegateCount++, 0, handleObj ); } else { handlers.push( handleObj ); } // Keep track of which events have ever been used, for event optimization jQuery.event.global[ type ] = true; } // Nullify elem to prevent memory leaks in IE elem = null; }, global: {}, // Detach an event or set of events from an element remove: function( elem, types, handler, selector, mappedTypes ) { var t, tns, type, origType, namespaces, origCount, j, events, special, eventType, handleObj, elemData = jQuery.hasData( elem ) && jQuery._data( elem ); if ( !elemData || !(events = elemData.events) ) { return; } // Once for each type.namespace in types; type may be omitted types = jQuery.trim( hoverHack( types || "" ) ).split(" "); for ( t = 0; t < types.length; t++ ) { tns = rtypenamespace.exec( types[t] ) || []; type = origType = tns[1]; namespaces = tns[2]; // Unbind all events (on this namespace, if provided) for the element if ( !type ) { for ( type in events ) { jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); } continue; } special = jQuery.event.special[ type ] || {}; type = ( selector? special.delegateType : special.bindType ) || type; eventType = events[ type ] || []; origCount = eventType.length; namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; // Remove matching events for ( j = 0; j < eventType.length; j++ ) { handleObj = eventType[ j ]; if ( ( mappedTypes || origType === handleObj.origType ) && ( !handler || handler.guid === handleObj.guid ) && ( !namespaces || namespaces.test( handleObj.namespace ) ) && ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { eventType.splice( j--, 1 ); if ( handleObj.selector ) { eventType.delegateCount--; } if ( special.remove ) { special.remove.call( elem, handleObj ); } } } // Remove generic event handler if we removed something and no more handlers exist // (avoids potential for endless recursion during removal of special event handlers) if ( eventType.length === 0 && origCount !== eventType.length ) { if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { jQuery.removeEvent( elem, type, elemData.handle ); } delete events[ type ]; } } // Remove the expando if it's no longer used if ( jQuery.isEmptyObject( events ) ) { delete elemData.handle; // removeData also checks for emptiness and clears the expando if empty // so use it instead of delete jQuery.removeData( elem, "events", true ); } }, // Events that are safe to short-circuit if no handlers are attached. // Native DOM events should not be added, they may have inline handlers. customEvent: { "getData": true, "setData": true, "changeData": true }, trigger: function( event, data, elem, onlyHandlers ) { // Don't do events on text and comment nodes if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { return; } // Event object or event type var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType, type = event.type || event, namespaces = []; // focus/blur morphs to focusin/out; ensure we're not firing them right now if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { return; } if ( type.indexOf( "!" ) >= 0 ) { // Exclusive events trigger only for the exact event (no namespaces) type = type.slice(0, -1); exclusive = true; } if ( type.indexOf( "." ) >= 0 ) { // Namespaced trigger; create a regexp to match event type in handle() namespaces = type.split("."); type = namespaces.shift(); namespaces.sort(); } if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { // No jQuery handlers for this event type, and it can't have inline handlers return; } // Caller can pass in an Event, Object, or just an event type string event = typeof event === "object" ? // jQuery.Event object event[ jQuery.expando ] ? event : // Object literal new jQuery.Event( type, event ) : // Just the event type (string) new jQuery.Event( type ); event.type = type; event.isTrigger = true; event.exclusive = exclusive; event.namespace = namespaces.join( "." ); event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; // Handle a global trigger if ( !elem ) { // TODO: Stop taunting the data cache; remove global events and always attach to document cache = jQuery.cache; for ( i in cache ) { if ( cache[ i ].events && cache[ i ].events[ type ] ) { jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); } } return; } // Clean up the event in case it is being reused event.result = undefined; if ( !event.target ) { event.target = elem; } // Clone any incoming data and prepend the event, creating the handler arg list data = data != null ? jQuery.makeArray( data ) : []; data.unshift( event ); // Allow special events to draw outside the lines special = jQuery.event.special[ type ] || {}; if ( special.trigger && special.trigger.apply( elem, data ) === false ) { return; } // Determine event propagation path in advance, per W3C events spec (#9951) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) eventPath = [[ elem, special.bindType || type ]]; if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { bubbleType = special.delegateType || type; cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; for ( old = elem; cur; cur = cur.parentNode ) { eventPath.push([ cur, bubbleType ]); old = cur; } // Only add window if we got to document (e.g., not plain obj or detached DOM) if ( old === (elem.ownerDocument || document) ) { eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); } } // Fire handlers on the event path for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { cur = eventPath[i][0]; event.type = eventPath[i][1]; handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); if ( handle ) { handle.apply( cur, data ); } // Note that this is a bare JS function and not a jQuery handler handle = ontype && cur[ ontype ]; if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { event.preventDefault(); } } event.type = type; // If nobody prevented the default action, do it now if ( !onlyHandlers && !event.isDefaultPrevented() ) { if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { // Call a native DOM method on the target with the same name name as the event. // Can't use an .isFunction() check here because IE6/7 fails that test. // Don't do default actions on window, that's where global variables be (#6170) // IE<9 dies on focus/blur to hidden element (#1486) if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { // Don't re-trigger an onFOO event when we call its FOO() method old = elem[ ontype ]; if ( old ) { elem[ ontype ] = null; } // Prevent re-triggering of the same event, since we already bubbled it above jQuery.event.triggered = type; elem[ type ](); jQuery.event.triggered = undefined; if ( old ) { elem[ ontype ] = old; } } } } return event.result; }, dispatch: function( event ) { // Make a writable jQuery.Event from the native event object event = jQuery.event.fix( event || window.event ); var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related, handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), delegateCount = handlers.delegateCount, args = core_slice.call( arguments ), run_all = !event.exclusive && !event.namespace, special = jQuery.event.special[ event.type ] || {}, handlerQueue = []; // Use the fix-ed jQuery.Event rather than the (read-only) native event args[0] = event; event.delegateTarget = this; // Call the preDispatch hook for the mapped type, and let it bail if desired if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { return; } // Determine handlers that should run if there are delegated events // Avoid non-left-click bubbling in Firefox (#3861) if ( delegateCount && !(event.button && event.type === "click") ) { for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) if ( cur.disabled !== true || event.type !== "click" ) { selMatch = {}; matches = []; for ( i = 0; i < delegateCount; i++ ) { handleObj = handlers[ i ]; sel = handleObj.selector; if ( selMatch[ sel ] === undefined ) { selMatch[ sel ] = handleObj.needsContext ? jQuery( sel, this ).index( cur ) >= 0 : jQuery.find( sel, this, null, [ cur ] ).length; } if ( selMatch[ sel ] ) { matches.push( handleObj ); } } if ( matches.length ) { handlerQueue.push({ elem: cur, matches: matches }); } } } } // Add the remaining (directly-bound) handlers if ( handlers.length > delegateCount ) { handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); } // Run delegates first; they may want to stop propagation beneath us for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { matched = handlerQueue[ i ]; event.currentTarget = matched.elem; for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { handleObj = matched.matches[ j ]; // Triggered event must either 1) be non-exclusive and have no namespace, or // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { event.data = handleObj.data; event.handleObj = handleObj; ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) .apply( matched.elem, args ); if ( ret !== undefined ) { event.result = ret; if ( ret === false ) { event.preventDefault(); event.stopPropagation(); } } } } } // Call the postDispatch hook for the mapped type if ( special.postDispatch ) { special.postDispatch.call( this, event ); } return event.result; }, // Includes some event props shared by KeyEvent and MouseEvent // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function( event, original ) { // Add which for key events if ( event.which == null ) { event.which = original.charCode != null ? original.charCode : original.keyCode; } return event; } }, mouseHooks: { props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function( event, original ) { var eventDoc, doc, body, button = original.button, fromElement = original.fromElement; // Calculate pageX/Y if missing and clientX/Y available if ( event.pageX == null && original.clientX != null ) { eventDoc = event.target.ownerDocument || document; doc = eventDoc.documentElement; body = eventDoc.body; event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); } // Add relatedTarget, if necessary if ( !event.relatedTarget && fromElement ) { event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; } // Add which for click: 1 === left; 2 === middle; 3 === right // Note: button is not normalized, so don't use it if ( !event.which && button !== undefined ) { event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); } return event; } }, fix: function( event ) { if ( event[ jQuery.expando ] ) { return event; } // Create a writable copy of the event object and normalize some properties var i, prop, originalEvent = event, fixHook = jQuery.event.fixHooks[ event.type ] || {}, copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; event = jQuery.Event( originalEvent ); for ( i = copy.length; i; ) { prop = copy[ --i ]; event[ prop ] = originalEvent[ prop ]; } // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) if ( !event.target ) { event.target = originalEvent.srcElement || document; } // Target should not be a text node (#504, Safari) if ( event.target.nodeType === 3 ) { event.target = event.target.parentNode; } // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) event.metaKey = !!event.metaKey; return fixHook.filter? fixHook.filter( event, originalEvent ) : event; }, special: { load: { // Prevent triggered image.load events from bubbling to window.load noBubble: true }, focus: { delegateType: "focusin" }, blur: { delegateType: "focusout" }, beforeunload: { setup: function( data, namespaces, eventHandle ) { // We only want to do this special case on windows if ( jQuery.isWindow( this ) ) { this.onbeforeunload = eventHandle; } }, teardown: function( namespaces, eventHandle ) { if ( this.onbeforeunload === eventHandle ) { this.onbeforeunload = null; } } } }, simulate: function( type, elem, event, bubble ) { // Piggyback on a donor event to simulate a different one. // Fake originalEvent to avoid donor's stopPropagation, but if the // simulated event prevents default then we do the same on the donor. var e = jQuery.extend( new jQuery.Event(), event, { type: type, isSimulated: true, originalEvent: {} } ); if ( bubble ) { jQuery.event.trigger( e, null, elem ); } else { jQuery.event.dispatch.call( elem, e ); } if ( e.isDefaultPrevented() ) { event.preventDefault(); } } }; // Some plugins are using, but it's undocumented/deprecated and will be removed. // The 1.7 special event interface should provide all the hooks needed now. jQuery.event.handle = jQuery.event.dispatch; jQuery.removeEvent = document.removeEventListener ? function( elem, type, handle ) { if ( elem.removeEventListener ) { elem.removeEventListener( type, handle, false ); } } : function( elem, type, handle ) { var name = "on" + type; if ( elem.detachEvent ) { // #8545, #7054, preventing memory leaks for custom events in IE6-8 – // detachEvent needed property on element, by name of that event, to properly expose it to GC if ( typeof elem[ name ] === "undefined" ) { elem[ name ] = null; } elem.detachEvent( name, handle ); } }; jQuery.Event = function( src, props ) { // Allow instantiation without the 'new' keyword if ( !(this instanceof jQuery.Event) ) { return new jQuery.Event( src, props ); } // Event object if ( src && src.type ) { this.originalEvent = src; this.type = src.type; // Events bubbling up the document may have been marked as prevented // by a handler lower down the tree; reflect the correct value. this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; // Event type } else { this.type = src; } // Put explicitly provided properties onto the event object if ( props ) { jQuery.extend( this, props ); } // Create a timestamp if incoming event doesn't have one this.timeStamp = src && src.timeStamp || jQuery.now(); // Mark it as fixed this[ jQuery.expando ] = true; }; function returnFalse() { return false; } function returnTrue() { return true; } // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html jQuery.Event.prototype = { preventDefault: function() { this.isDefaultPrevented = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if preventDefault exists run it on the original event if ( e.preventDefault ) { e.preventDefault(); // otherwise set the returnValue property of the original event to false (IE) } else { e.returnValue = false; } }, stopPropagation: function() { this.isPropagationStopped = returnTrue; var e = this.originalEvent; if ( !e ) { return; } // if stopPropagation exists run it on the original event if ( e.stopPropagation ) { e.stopPropagation(); } // otherwise set the cancelBubble property of the original event to true (IE) e.cancelBubble = true; }, stopImmediatePropagation: function() { this.isImmediatePropagationStopped = returnTrue; this.stopPropagation(); }, isDefaultPrevented: returnFalse, isPropagationStopped: returnFalse, isImmediatePropagationStopped: returnFalse }; // Create mouseenter/leave events using mouseover/out and event-time checks jQuery.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function( orig, fix ) { jQuery.event.special[ orig ] = { delegateType: fix, bindType: fix, handle: function( event ) { var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj, selector = handleObj.selector; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || (related !== target && !jQuery.contains( target, related )) ) { event.type = handleObj.origType; ret = handleObj.handler.apply( this, arguments ); event.type = fix; } return ret; } }; }); // IE submit delegation if ( !jQuery.support.submitBubbles ) { jQuery.event.special.submit = { setup: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Lazy-add a submit handler when a descendant form may potentially be submitted jQuery.event.add( this, "click._submit keypress._submit", function( e ) { // Node name check avoids a VML-related crash in IE (#9807) var elem = e.target, form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; if ( form && !jQuery._data( form, "_submit_attached" ) ) { jQuery.event.add( form, "submit._submit", function( event ) { event._submit_bubble = true; }); jQuery._data( form, "_submit_attached", true ); } }); // return undefined since we don't need an event listener }, postDispatch: function( event ) { // If form was submitted by the user, bubble the event up the tree if ( event._submit_bubble ) { delete event._submit_bubble; if ( this.parentNode && !event.isTrigger ) { jQuery.event.simulate( "submit", this.parentNode, event, true ); } } }, teardown: function() { // Only need this for delegated form submit events if ( jQuery.nodeName( this, "form" ) ) { return false; } // Remove delegated handlers; cleanData eventually reaps submit handlers attached above jQuery.event.remove( this, "._submit" ); } }; } // IE change delegation and checkbox/radio fix if ( !jQuery.support.changeBubbles ) { jQuery.event.special.change = { setup: function() { if ( rformElems.test( this.nodeName ) ) { // IE doesn't fire change on a check/radio until blur; trigger it on click // after a propertychange. Eat the blur-change in special.change.handle. // This still fires onchange a second time for check/radio after blur. if ( this.type === "checkbox" || this.type === "radio" ) { jQuery.event.add( this, "propertychange._change", function( event ) { if ( event.originalEvent.propertyName === "checked" ) { this._just_changed = true; } }); jQuery.event.add( this, "click._change", function( event ) { if ( this._just_changed && !event.isTrigger ) { this._just_changed = false; } // Allow triggered, simulated change events (#11500) jQuery.event.simulate( "change", this, event, true ); }); } return false; } // Delegated event; lazy-add a change handler on descendant inputs jQuery.event.add( this, "beforeactivate._change", function( e ) { var elem = e.target; if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { jQuery.event.add( elem, "change._change", function( event ) { if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { jQuery.event.simulate( "change", this.parentNode, event, true ); } }); jQuery._data( elem, "_change_attached", true ); } }); }, handle: function( event ) { var elem = event.target; // Swallow native change events from checkbox/radio, we already triggered them above if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { return event.handleObj.handler.apply( this, arguments ); } }, teardown: function() { jQuery.event.remove( this, "._change" ); return !rformElems.test( this.nodeName ); } }; } // Create "bubbling" focus and blur events if ( !jQuery.support.focusinBubbles ) { jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { // Attach a single capturing handler while someone wants focusin/focusout var attaches = 0, handler = function( event ) { jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); }; jQuery.event.special[ fix ] = { setup: function() { if ( attaches++ === 0 ) { document.addEventListener( orig, handler, true ); } }, teardown: function() { if ( --attaches === 0 ) { document.removeEventListener( orig, handler, true ); } } }; }); } jQuery.fn.extend({ on: function( types, selector, data, fn, /*INTERNAL*/ one ) { var origFn, type; // Types can be a map of types/handlers if ( typeof types === "object" ) { // ( types-Object, selector, data ) if ( typeof selector !== "string" ) { // && selector != null // ( types-Object, data ) data = data || selector; selector = undefined; } for ( type in types ) { this.on( type, selector, data, types[ type ], one ); } return this; } if ( data == null && fn == null ) { // ( types, fn ) fn = selector; data = selector = undefined; } else if ( fn == null ) { if ( typeof selector === "string" ) { // ( types, selector, fn ) fn = data; data = undefined; } else { // ( types, data, fn ) fn = data; data = selector; selector = undefined; } } if ( fn === false ) { fn = returnFalse; } else if ( !fn ) { return this; } if ( one === 1 ) { origFn = fn; fn = function( event ) { // Can use an empty set, since event contains the info jQuery().off( event ); return origFn.apply( this, arguments ); }; // Use same guid so caller can remove using origFn fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); } return this.each( function() { jQuery.event.add( this, types, fn, data, selector ); }); }, one: function( types, selector, data, fn ) { return this.on( types, selector, data, fn, 1 ); }, off: function( types, selector, fn ) { var handleObj, type; if ( types && types.preventDefault && types.handleObj ) { // ( event ) dispatched jQuery.Event handleObj = types.handleObj; jQuery( types.delegateTarget ).off( handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler ); return this; } if ( typeof types === "object" ) { // ( types-object [, selector] ) for ( type in types ) { this.off( type, selector, types[ type ] ); } return this; } if ( selector === false || typeof selector === "function" ) { // ( types [, fn] ) fn = selector; selector = undefined; } if ( fn === false ) { fn = returnFalse; } return this.each(function() { jQuery.event.remove( this, types, fn, selector ); }); }, bind: function( types, data, fn ) { return this.on( types, null, data, fn ); }, unbind: function( types, fn ) { return this.off( types, null, fn ); }, live: function( types, data, fn ) { jQuery( this.context ).on( types, this.selector, data, fn ); return this; }, die: function( types, fn ) { jQuery( this.context ).off( types, this.selector || "**", fn ); return this; }, delegate: function( selector, types, data, fn ) { return this.on( types, selector, data, fn ); }, undelegate: function( selector, types, fn ) { // ( namespace ) or ( selector, types [, fn] ) return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); }, trigger: function( type, data ) { return this.each(function() { jQuery.event.trigger( type, data, this ); }); }, triggerHandler: function( type, data ) { if ( this[0] ) { return jQuery.event.trigger( type, data, this[0], true ); } }, toggle: function( fn ) { // Save reference to arguments for access in closure var args = arguments, guid = fn.guid || jQuery.guid++, i = 0, toggler = function( event ) { // Figure out which function to execute var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); // Make sure that clicks stop event.preventDefault(); // and execute the function return args[ lastToggle ].apply( this, arguments ) || false; }; // link all the functions, so any of them can unbind this click handler toggler.guid = guid; while ( i < args.length ) { args[ i++ ].guid = guid; } return this.click( toggler ); }, hover: function( fnOver, fnOut ) { return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); } }); jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { // Handle event binding jQuery.fn[ name ] = function( data, fn ) { if ( fn == null ) { fn = data; data = null; } return arguments.length > 0 ? this.on( name, null, data, fn ) : this.trigger( name ); }; if ( rkeyEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; } if ( rmouseEvent.test( name ) ) { jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; } }); /*! * Sizzle CSS Selector Engine * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://sizzlejs.com/ */ (function( window, undefined ) { var cachedruns, assertGetIdNotName, Expr, getText, isXML, contains, compile, sortOrder, hasDuplicate, outermostContext, baseHasDuplicate = true, strundefined = "undefined", expando = ( "sizcache" + Math.random() ).replace( ".", "" ), Token = String, document = window.document, docElem = document.documentElement, dirruns = 0, done = 0, pop = [].pop, push = [].push, slice = [].slice, // Use a stripped-down indexOf if a native one is unavailable indexOf = [].indexOf || function( elem ) { var i = 0, len = this.length; for ( ; i < len; i++ ) { if ( this[i] === elem ) { return i; } } return -1; }, // Augment a function for special use by Sizzle markFunction = function( fn, value ) { fn[ expando ] = value == null || value; return fn; }, createCache = function() { var cache = {}, keys = []; return markFunction(function( key, value ) { // Only keep the most recent entries if ( keys.push( key ) > Expr.cacheLength ) { delete cache[ keys.shift() ]; } return (cache[ key ] = value); }, cache ); }, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), // Regex // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/css3-syntax/#characters characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+", // Loosely modeled on CSS identifier characters // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = characterEncoding.replace( "w", "w#" ), // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors operators = "([*^$|!~]?=)", attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", // Prefer arguments not in parens/brackets, // then attribute selectors and non-pseudos (denoted by :), // then anything else // These preferences are here to reduce the number of selectors // needing tokenize in the PSEUDO preFilter pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)", // For matchExpr.POS and matchExpr.needsContext pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), rpseudo = new RegExp( pseudos ), // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/, rnot = /^:not/, rsibling = /[\x20\t\r\n\f]*[+~]/, rendsWithNot = /:not\($/, rheader = /h\d/i, rinputs = /input|select|textarea|button/i, rbackslash = /\\(?!\\)/g, matchExpr = { "ID": new RegExp( "^#(" + characterEncoding + ")" ), "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), "ATTR": new RegExp( "^" + attributes ), "PSEUDO": new RegExp( "^" + pseudos ), "POS": new RegExp( pos, "i" ), "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), // For use in libraries implementing .is() "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" ) }, // Support // Used for testing something on an element assert = function( fn ) { var div = document.createElement("div"); try { return fn( div ); } catch (e) { return false; } finally { // release memory in IE div = null; } }, // Check if getElementsByTagName("*") returns only elements assertTagNameNoComments = assert(function( div ) { div.appendChild( document.createComment("") ); return !div.getElementsByTagName("*").length; }), // Check if getAttribute returns normalized href attributes assertHrefNotNormalized = assert(function( div ) { div.innerHTML = "<a href='#'></a>"; return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && div.firstChild.getAttribute("href") === "#"; }), // Check if attributes should be retrieved by attribute nodes assertAttributes = assert(function( div ) { div.innerHTML = "<select></select>"; var type = typeof div.lastChild.getAttribute("multiple"); // IE8 returns a string for some attributes even when not present return type !== "boolean" && type !== "string"; }), // Check if getElementsByClassName can be trusted assertUsableClassName = assert(function( div ) { // Opera can't find a second classname (in 9.6) div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { return false; } // Safari 3.2 caches class attributes and doesn't catch changes div.lastChild.className = "e"; return div.getElementsByClassName("e").length === 2; }), // Check if getElementById returns elements by name // Check if getElementsByName privileges form controls or returns elements by ID assertUsableName = assert(function( div ) { // Inject content div.id = expando + 0; div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; docElem.insertBefore( div, docElem.firstChild ); // Test var pass = document.getElementsByName && // buggy browsers will return fewer than the correct 2 document.getElementsByName( expando ).length === 2 + // buggy browsers will return more than the correct 0 document.getElementsByName( expando + 0 ).length; assertGetIdNotName = !document.getElementById( expando ); // Cleanup docElem.removeChild( div ); return pass; }); // If slice is not available, provide a backup try { slice.call( docElem.childNodes, 0 )[0].nodeType; } catch ( e ) { slice = function( i ) { var elem, results = []; for ( ; (elem = this[i]); i++ ) { results.push( elem ); } return results; }; } function Sizzle( selector, context, results, seed ) { results = results || []; context = context || document; var match, elem, xml, m, nodeType = context.nodeType; if ( !selector || typeof selector !== "string" ) { return results; } if ( nodeType !== 1 && nodeType !== 9 ) { return []; } xml = isXML( context ); if ( !xml && !seed ) { if ( (match = rquickExpr.exec( selector )) ) { // Speed-up: Sizzle("#ID") if ( (m = match[1]) ) { if ( nodeType === 9 ) { elem = context.getElementById( m ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 if ( elem && elem.parentNode ) { // Handle the case where IE, Opera, and Webkit return items // by name instead of ID if ( elem.id === m ) { results.push( elem ); return results; } } else { return results; } } else { // Context is not a document if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && contains( context, elem ) && elem.id === m ) { results.push( elem ); return results; } } // Speed-up: Sizzle("TAG") } else if ( match[2] ) { push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); return results; // Speed-up: Sizzle(".CLASS") } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) { push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); return results; } } } // All others return select( selector.replace( rtrim, "$1" ), context, results, seed, xml ); } Sizzle.matches = function( expr, elements ) { return Sizzle( expr, null, null, elements ); }; Sizzle.matchesSelector = function( elem, expr ) { return Sizzle( expr, null, null, [ elem ] ).length > 0; }; // Returns a function to use in pseudos for input types function createInputPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === type; }; } // Returns a function to use in pseudos for buttons function createButtonPseudo( type ) { return function( elem ) { var name = elem.nodeName.toLowerCase(); return (name === "input" || name === "button") && elem.type === type; }; } // Returns a function to use in pseudos for positionals function createPositionalPseudo( fn ) { return markFunction(function( argument ) { argument = +argument; return markFunction(function( seed, matches ) { var j, matchIndexes = fn( [], seed.length, argument ), i = matchIndexes.length; // Match elements found at the specified indexes while ( i-- ) { if ( seed[ (j = matchIndexes[i]) ] ) { seed[j] = !(matches[j] = seed[j]); } } }); }); } /** * Utility function for retrieving the text value of an array of DOM nodes * @param {Array|Element} elem */ getText = Sizzle.getText = function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( nodeType ) { if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements // innerText usage removed for consistency of new lines (see #11153) if ( typeof elem.textContent === "string" ) { return elem.textContent; } else { // Traverse its children for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { ret += getText( elem ); } } } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes } else { // If no nodeType, this is expected to be an array for ( ; (node = elem[i]); i++ ) { // Do not traverse comment nodes ret += getText( node ); } } return ret; }; isXML = Sizzle.isXML = function( elem ) { // documentElement is verified for cases where it doesn't yet exist // (such as loading iframes in IE - #4833) var documentElement = elem && (elem.ownerDocument || elem).documentElement; return documentElement ? documentElement.nodeName !== "HTML" : false; }; // Element contains another contains = Sizzle.contains = docElem.contains ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) ); } : docElem.compareDocumentPosition ? function( a, b ) { return b && !!( a.compareDocumentPosition( b ) & 16 ); } : function( a, b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } return false; }; Sizzle.attr = function( elem, name ) { var val, xml = isXML( elem ); if ( !xml ) { name = name.toLowerCase(); } if ( (val = Expr.attrHandle[ name ]) ) { return val( elem ); } if ( xml || assertAttributes ) { return elem.getAttribute( name ); } val = elem.getAttributeNode( name ); return val ? typeof elem[ name ] === "boolean" ? elem[ name ] ? name : null : val.specified ? val.value : null : null; }; Expr = Sizzle.selectors = { // Can be adjusted by the user cacheLength: 50, createPseudo: markFunction, match: matchExpr, // IE6/7 return a modified href attrHandle: assertHrefNotNormalized ? {} : { "href": function( elem ) { return elem.getAttribute( "href", 2 ); }, "type": function( elem ) { return elem.getAttribute("type"); } }, find: { "ID": assertGetIdNotName ? function( id, context, xml ) { if ( typeof context.getElementById !== strundefined && !xml ) { var m = context.getElementById( id ); // Check parentNode to catch when Blackberry 4.6 returns // nodes that are no longer in the document #6963 return m && m.parentNode ? [m] : []; } } : function( id, context, xml ) { if ( typeof context.getElementById !== strundefined && !xml ) { var m = context.getElementById( id ); return m ? m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? [m] : undefined : []; } }, "TAG": assertTagNameNoComments ? function( tag, context ) { if ( typeof context.getElementsByTagName !== strundefined ) { return context.getElementsByTagName( tag ); } } : function( tag, context ) { var results = context.getElementsByTagName( tag ); // Filter out possible comments if ( tag === "*" ) { var elem, tmp = [], i = 0; for ( ; (elem = results[i]); i++ ) { if ( elem.nodeType === 1 ) { tmp.push( elem ); } } return tmp; } return results; }, "NAME": assertUsableName && function( tag, context ) { if ( typeof context.getElementsByName !== strundefined ) { return context.getElementsByName( name ); } }, "CLASS": assertUsableClassName && function( className, context, xml ) { if ( typeof context.getElementsByClassName !== strundefined && !xml ) { return context.getElementsByClassName( className ); } } }, relative: { ">": { dir: "parentNode", first: true }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: true }, "~": { dir: "previousSibling" } }, preFilter: { "ATTR": function( match ) { match[1] = match[1].replace( rbackslash, "" ); // Move the given value to match[3] whether quoted or unquoted match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); if ( match[2] === "~=" ) { match[3] = " " + match[3] + " "; } return match.slice( 0, 4 ); }, "CHILD": function( match ) { /* matches from matchExpr["CHILD"] 1 type (only|nth|...) 2 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 3 xn-component of xn+y argument ([+-]?\d*n|) 4 sign of xn-component 5 x of xn-component 6 sign of y-component 7 y of y-component */ match[1] = match[1].toLowerCase(); if ( match[1] === "nth" ) { // nth-child requires argument if ( !match[2] ) { Sizzle.error( match[0] ); } // numeric x and y parameters for Expr.filter.CHILD // remember that false/true cast respectively to 0/1 match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) ); match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" ); // other types prohibit arguments } else if ( match[2] ) { Sizzle.error( match[0] ); } return match; }, "PSEUDO": function( match ) { var unquoted, excess; if ( matchExpr["CHILD"].test( match[0] ) ) { return null; } if ( match[3] ) { match[2] = match[3]; } else if ( (unquoted = match[4]) ) { // Only check arguments that contain a pseudo if ( rpseudo.test(unquoted) && // Get excess from tokenize (recursively) (excess = tokenize( unquoted, true )) && // advance to the next closing parenthesis (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { // excess is a negative index unquoted = unquoted.slice( 0, excess ); match[0] = match[0].slice( 0, excess ); } match[2] = unquoted; } // Return only captures needed by the pseudo filter method (type and argument) return match.slice( 0, 3 ); } }, filter: { "ID": assertGetIdNotName ? function( id ) { id = id.replace( rbackslash, "" ); return function( elem ) { return elem.getAttribute("id") === id; }; } : function( id ) { id = id.replace( rbackslash, "" ); return function( elem ) { var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); return node && node.value === id; }; }, "TAG": function( nodeName ) { if ( nodeName === "*" ) { return function() { return true; }; } nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); return function( elem ) { return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; }; }, "CLASS": function( className ) { var pattern = classCache[ expando ][ className ]; if ( !pattern ) { pattern = classCache( className, new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)") ); } return function( elem ) { return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); }; }, "ATTR": function( name, operator, check ) { return function( elem, context ) { var result = Sizzle.attr( elem, name ); if ( result == null ) { return operator === "!="; } if ( !operator ) { return true; } result += ""; return operator === "=" ? result === check : operator === "!=" ? result !== check : operator === "^=" ? check && result.indexOf( check ) === 0 : operator === "*=" ? check && result.indexOf( check ) > -1 : operator === "$=" ? check && result.substr( result.length - check.length ) === check : operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : false; }; }, "CHILD": function( type, argument, first, last ) { if ( type === "nth" ) { return function( elem ) { var node, diff, parent = elem.parentNode; if ( first === 1 && last === 0 ) { return true; } if ( parent ) { diff = 0; for ( node = parent.firstChild; node; node = node.nextSibling ) { if ( node.nodeType === 1 ) { diff++; if ( elem === node ) { break; } } } } // Incorporate the offset (or cast to NaN), then check against cycle size diff -= last; return diff === first || ( diff % first === 0 && diff / first >= 0 ); }; } return function( elem ) { var node = elem; switch ( type ) { case "only": case "first": while ( (node = node.previousSibling) ) { if ( node.nodeType === 1 ) { return false; } } if ( type === "first" ) { return true; } node = elem; /* falls through */ case "last": while ( (node = node.nextSibling) ) { if ( node.nodeType === 1 ) { return false; } } return true; } }; }, "PSEUDO": function( pseudo, argument ) { // pseudo-class names are case-insensitive // http://www.w3.org/TR/selectors/#pseudo-classes // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters // Remember that setFilters inherits from pseudos var args, fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || Sizzle.error( "unsupported pseudo: " + pseudo ); // The user may use createPseudo to indicate that // arguments are needed to create the filter function // just as Sizzle does if ( fn[ expando ] ) { return fn( argument ); } // But maintain support for old signatures if ( fn.length > 1 ) { args = [ pseudo, pseudo, "", argument ]; return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? markFunction(function( seed, matches ) { var idx, matched = fn( seed, argument ), i = matched.length; while ( i-- ) { idx = indexOf.call( seed, matched[i] ); seed[ idx ] = !( matches[ idx ] = matched[i] ); } }) : function( elem ) { return fn( elem, 0, args ); }; } return fn; } }, pseudos: { "not": markFunction(function( selector ) { // Trim the selector passed to compile // to avoid treating leading and trailing // spaces as combinators var input = [], results = [], matcher = compile( selector.replace( rtrim, "$1" ) ); return matcher[ expando ] ? markFunction(function( seed, matches, context, xml ) { var elem, unmatched = matcher( seed, null, xml, [] ), i = seed.length; // Match elements unmatched by `matcher` while ( i-- ) { if ( (elem = unmatched[i]) ) { seed[i] = !(matches[i] = elem); } } }) : function( elem, context, xml ) { input[0] = elem; matcher( input, null, xml, results ); return !results.pop(); }; }), "has": markFunction(function( selector ) { return function( elem ) { return Sizzle( selector, elem ).length > 0; }; }), "contains": markFunction(function( text ) { return function( elem ) { return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; }; }), "enabled": function( elem ) { return elem.disabled === false; }, "disabled": function( elem ) { return elem.disabled === true; }, "checked": function( elem ) { // In CSS3, :checked should return both checked and selected elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked var nodeName = elem.nodeName.toLowerCase(); return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); }, "selected": function( elem ) { // Accessing this property makes selected-by-default // options in Safari work properly if ( elem.parentNode ) { elem.parentNode.selectedIndex; } return elem.selected === true; }, "parent": function( elem ) { return !Expr.pseudos["empty"]( elem ); }, "empty": function( elem ) { // http://www.w3.org/TR/selectors/#empty-pseudo // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), // not comment, processing instructions, or others // Thanks to Diego Perini for the nodeName shortcut // Greater than "@" means alpha characters (specifically not starting with "#" or "?") var nodeType; elem = elem.firstChild; while ( elem ) { if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) { return false; } elem = elem.nextSibling; } return true; }, "header": function( elem ) { return rheader.test( elem.nodeName ); }, "text": function( elem ) { var type, attr; // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) // use getAttribute instead to test this case return elem.nodeName.toLowerCase() === "input" && (type = elem.type) === "text" && ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type ); }, // Input types "radio": createInputPseudo("radio"), "checkbox": createInputPseudo("checkbox"), "file": createInputPseudo("file"), "password": createInputPseudo("password"), "image": createInputPseudo("image"), "submit": createButtonPseudo("submit"), "reset": createButtonPseudo("reset"), "button": function( elem ) { var name = elem.nodeName.toLowerCase(); return name === "input" && elem.type === "button" || name === "button"; }, "input": function( elem ) { return rinputs.test( elem.nodeName ); }, "focus": function( elem ) { var doc = elem.ownerDocument; return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href); }, "active": function( elem ) { return elem === elem.ownerDocument.activeElement; }, // Positional types "first": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ 0 ]; }), "last": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ length - 1 ]; }), "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { return [ argument < 0 ? argument + length : argument ]; }), "even": createPositionalPseudo(function( matchIndexes, length, argument ) { for ( var i = 0; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "odd": createPositionalPseudo(function( matchIndexes, length, argument ) { for ( var i = 1; i < length; i += 2 ) { matchIndexes.push( i ); } return matchIndexes; }), "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) { matchIndexes.push( i ); } return matchIndexes; }), "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) { matchIndexes.push( i ); } return matchIndexes; }) } }; function siblingCheck( a, b, ret ) { if ( a === b ) { return ret; } var cur = a.nextSibling; while ( cur ) { if ( cur === b ) { return -1; } cur = cur.nextSibling; } return 1; } sortOrder = docElem.compareDocumentPosition ? function( a, b ) { if ( a === b ) { hasDuplicate = true; return 0; } return ( !a.compareDocumentPosition || !b.compareDocumentPosition ? a.compareDocumentPosition : a.compareDocumentPosition(b) & 4 ) ? -1 : 1; } : function( a, b ) { // The nodes are identical, we can exit early if ( a === b ) { hasDuplicate = true; return 0; // Fallback to using sourceIndex (in IE) if it's available on both nodes } else if ( a.sourceIndex && b.sourceIndex ) { return a.sourceIndex - b.sourceIndex; } var al, bl, ap = [], bp = [], aup = a.parentNode, bup = b.parentNode, cur = aup; // If the nodes are siblings (or identical) we can do a quick check if ( aup === bup ) { return siblingCheck( a, b ); // If no parents were found then the nodes are disconnected } else if ( !aup ) { return -1; } else if ( !bup ) { return 1; } // Otherwise they're somewhere else in the tree so we need // to build up a full list of the parentNodes for comparison while ( cur ) { ap.unshift( cur ); cur = cur.parentNode; } cur = bup; while ( cur ) { bp.unshift( cur ); cur = cur.parentNode; } al = ap.length; bl = bp.length; // Start walking down the tree looking for a discrepancy for ( var i = 0; i < al && i < bl; i++ ) { if ( ap[i] !== bp[i] ) { return siblingCheck( ap[i], bp[i] ); } } // We ended someplace up the tree so do a sibling check return i === al ? siblingCheck( a, bp[i], -1 ) : siblingCheck( ap[i], b, 1 ); }; // Always assume the presence of duplicates if sort doesn't // pass them to our comparison function (as in Google Chrome). [0, 0].sort( sortOrder ); baseHasDuplicate = !hasDuplicate; // Document sorting and removing duplicates Sizzle.uniqueSort = function( results ) { var elem, i = 1; hasDuplicate = baseHasDuplicate; results.sort( sortOrder ); if ( hasDuplicate ) { for ( ; (elem = results[i]); i++ ) { if ( elem === results[ i - 1 ] ) { results.splice( i--, 1 ); } } } return results; }; Sizzle.error = function( msg ) { throw new Error( "Syntax error, unrecognized expression: " + msg ); }; function tokenize( selector, parseOnly ) { var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[ expando ][ selector ]; if ( cached ) { return parseOnly ? 0 : cached.slice( 0 ); } soFar = selector; groups = []; preFilters = Expr.preFilter; while ( soFar ) { // Comma and first run if ( !matched || (match = rcomma.exec( soFar )) ) { if ( match ) { soFar = soFar.slice( match[0].length ); } groups.push( tokens = [] ); } matched = false; // Combinators if ( (match = rcombinators.exec( soFar )) ) { tokens.push( matched = new Token( match.shift() ) ); soFar = soFar.slice( matched.length ); // Cast descendant combinators to space matched.type = match[0].replace( rtrim, " " ); } // Filters for ( type in Expr.filter ) { if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || // The last two arguments here are (context, xml) for backCompat (match = preFilters[ type ]( match, document, true ))) ) { tokens.push( matched = new Token( match.shift() ) ); soFar = soFar.slice( matched.length ); matched.type = type; matched.matches = match; } } if ( !matched ) { break; } } // Return the length of the invalid excess // if we're just parsing // Otherwise, throw an error or return tokens return parseOnly ? soFar.length : soFar ? Sizzle.error( selector ) : // Cache the tokens tokenCache( selector, groups ).slice( 0 ); } function addCombinator( matcher, combinator, base ) { var dir = combinator.dir, checkNonElements = base && combinator.dir === "parentNode", doneName = done++; return combinator.first ? // Check against closest ancestor/preceding element function( elem, context, xml ) { while ( (elem = elem[ dir ]) ) { if ( checkNonElements || elem.nodeType === 1 ) { return matcher( elem, context, xml ); } } } : // Check against all ancestor/preceding elements function( elem, context, xml ) { // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching if ( !xml ) { var cache, dirkey = dirruns + " " + doneName + " ", cachedkey = dirkey + cachedruns; while ( (elem = elem[ dir ]) ) { if ( checkNonElements || elem.nodeType === 1 ) { if ( (cache = elem[ expando ]) === cachedkey ) { return elem.sizset; } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) { if ( elem.sizset ) { return elem; } } else { elem[ expando ] = cachedkey; if ( matcher( elem, context, xml ) ) { elem.sizset = true; return elem; } elem.sizset = false; } } } } else { while ( (elem = elem[ dir ]) ) { if ( checkNonElements || elem.nodeType === 1 ) { if ( matcher( elem, context, xml ) ) { return elem; } } } } }; } function elementMatcher( matchers ) { return matchers.length > 1 ? function( elem, context, xml ) { var i = matchers.length; while ( i-- ) { if ( !matchers[i]( elem, context, xml ) ) { return false; } } return true; } : matchers[0]; } function condense( unmatched, map, filter, context, xml ) { var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null; for ( ; i < len; i++ ) { if ( (elem = unmatched[i]) ) { if ( !filter || filter( elem, context, xml ) ) { newUnmatched.push( elem ); if ( mapped ) { map.push( i ); } } } } return newUnmatched; } function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { if ( postFilter && !postFilter[ expando ] ) { postFilter = setMatcher( postFilter ); } if ( postFinder && !postFinder[ expando ] ) { postFinder = setMatcher( postFinder, postSelector ); } return markFunction(function( seed, results, context, xml ) { // Positional selectors apply to seed elements, so it is invalid to follow them with relative ones if ( seed && postFinder ) { return; } var i, elem, postFilterIn, preMap = [], postMap = [], preexisting = results.length, // Get initial elements from seed or context elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [], seed ), // Prefilter to get matcher input, preserving a map for seed-results synchronization matcherIn = preFilter && ( seed || !selector ) ? condense( elems, preMap, preFilter, context, xml ) : elems, matcherOut = matcher ? // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, postFinder || ( seed ? preFilter : preexisting || postFilter ) ? // ...intermediate processing is necessary [] : // ...otherwise use results directly results : matcherIn; // Find primary matches if ( matcher ) { matcher( matcherIn, matcherOut, context, xml ); } // Apply postFilter if ( postFilter ) { postFilterIn = condense( matcherOut, postMap ); postFilter( postFilterIn, [], context, xml ); // Un-match failing elements by moving them back to matcherIn i = postFilterIn.length; while ( i-- ) { if ( (elem = postFilterIn[i]) ) { matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); } } } // Keep seed and results synchronized if ( seed ) { // Ignore postFinder because it can't coexist with seed i = preFilter && matcherOut.length; while ( i-- ) { if ( (elem = matcherOut[i]) ) { seed[ preMap[i] ] = !(results[ preMap[i] ] = elem); } } } else { matcherOut = condense( matcherOut === results ? matcherOut.splice( preexisting, matcherOut.length ) : matcherOut ); if ( postFinder ) { postFinder( null, results, matcherOut, xml ); } else { push.apply( results, matcherOut ); } } }); } function matcherFromTokens( tokens ) { var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[ tokens[0].type ], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, // The foundational matcher ensures that elements are reachable from top-level context(s) matchContext = addCombinator( function( elem ) { return elem === checkContext; }, implicitRelative, true ), matchAnyContext = addCombinator( function( elem ) { return indexOf.call( checkContext, elem ) > -1; }, implicitRelative, true ), matchers = [ function( elem, context, xml ) { return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( (checkContext = context).nodeType ? matchContext( elem, context, xml ) : matchAnyContext( elem, context, xml ) ); } ]; for ( ; i < len; i++ ) { if ( (matcher = Expr.relative[ tokens[i].type ]) ) { matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; } else { // The concatenated values are (context, xml) for backCompat matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); // Return special upon seeing a positional matcher if ( matcher[ expando ] ) { // Find the next relative operator (if any) for proper handling j = ++i; for ( ; j < len; j++ ) { if ( Expr.relative[ tokens[j].type ] ) { break; } } return setMatcher( i > 1 && elementMatcher( matchers ), i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ), matcher, i < j && matcherFromTokens( tokens.slice( i, j ) ), j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), j < len && tokens.join("") ); } matchers.push( matcher ); } } return elementMatcher( matchers ); } function matcherFromGroupMatchers( elementMatchers, setMatchers ) { var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function( seed, context, xml, results, expandContext ) { var elem, j, matcher, setMatched = [], matchedCount = 0, i = "0", unmatched = seed && [], outermost = expandContext != null, contextBackup = outermostContext, // We must always have either seed elements or context elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), // Nested matchers should use non-integer dirruns dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); if ( outermost ) { outermostContext = context !== document && context; cachedruns = superMatcher.el; } // Add elements passing elementMatchers directly to results for ( ; (elem = elems[i]) != null; i++ ) { if ( byElement && elem ) { for ( j = 0; (matcher = elementMatchers[j]); j++ ) { if ( matcher( elem, context, xml ) ) { results.push( elem ); break; } } if ( outermost ) { dirruns = dirrunsUnique; cachedruns = ++superMatcher.el; } } // Track unmatched elements for set filters if ( bySet ) { // They will have gone through all possible matchers if ( (elem = !matcher && elem) ) { matchedCount--; } // Lengthen the array for every element, matched or not if ( seed ) { unmatched.push( elem ); } } } // Apply set filters to unmatched elements matchedCount += i; if ( bySet && i !== matchedCount ) { for ( j = 0; (matcher = setMatchers[j]); j++ ) { matcher( unmatched, setMatched, context, xml ); } if ( seed ) { // Reintegrate element matches to eliminate the need for sorting if ( matchedCount > 0 ) { while ( i-- ) { if ( !(unmatched[i] || setMatched[i]) ) { setMatched[i] = pop.call( results ); } } } // Discard index placeholder values to get only actual matches setMatched = condense( setMatched ); } // Add matches to results push.apply( results, setMatched ); // Seedless set matches succeeding multiple successful matchers stipulate sorting if ( outermost && !seed && setMatched.length > 0 && ( matchedCount + setMatchers.length ) > 1 ) { Sizzle.uniqueSort( results ); } } // Override manipulation of globals by nested matchers if ( outermost ) { dirruns = dirrunsUnique; outermostContext = contextBackup; } return unmatched; }; superMatcher.el = 0; return bySet ? markFunction( superMatcher ) : superMatcher; } compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { var i, setMatchers = [], elementMatchers = [], cached = compilerCache[ expando ][ selector ]; if ( !cached ) { // Generate a function of recursive functions that can be used to check each element if ( !group ) { group = tokenize( selector ); } i = group.length; while ( i-- ) { cached = matcherFromTokens( group[i] ); if ( cached[ expando ] ) { setMatchers.push( cached ); } else { elementMatchers.push( cached ); } } // Cache the compiled function cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); } return cached; }; function multipleContexts( selector, contexts, results, seed ) { var i = 0, len = contexts.length; for ( ; i < len; i++ ) { Sizzle( selector, contexts[i], results, seed ); } return results; } function select( selector, context, results, seed, xml ) { var i, tokens, token, type, find, match = tokenize( selector ), j = match.length; if ( !seed ) { // Try to minimize operations if there is only one group if ( match.length === 1 ) { // Take a shortcut and set the context if the root selector is an ID tokens = match[0] = match[0].slice( 0 ); if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && !xml && Expr.relative[ tokens[1].type ] ) { context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0]; if ( !context ) { return results; } selector = selector.slice( tokens.shift().length ); } // Fetch a seed set for right-to-left matching for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { token = tokens[i]; // Abort if we hit a combinator if ( Expr.relative[ (type = token.type) ] ) { break; } if ( (find = Expr.find[ type ]) ) { // Search, expanding context for leading sibling combinators if ( (seed = find( token.matches[0].replace( rbackslash, "" ), rsibling.test( tokens[0].type ) && context.parentNode || context, xml )) ) { // If seed is empty or no tokens remain, we can return early tokens.splice( i, 1 ); selector = seed.length && tokens.join(""); if ( !selector ) { push.apply( results, slice.call( seed, 0 ) ); return results; } break; } } } } } // Compile and execute a filtering function // Provide `match` to avoid retokenization if we modified the selector above compile( selector, match )( seed, context, xml, results, rsibling.test( selector ) ); return results; } if ( document.querySelectorAll ) { (function() { var disconnectedMatch, oldSelect = select, rescape = /'|\\/g, rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, // qSa(:focus) reports false when true (Chrome 21), // A support test would require too much code (would include document ready) rbuggyQSA = [":focus"], // matchesSelector(:focus) reports false when true (Chrome 21), // matchesSelector(:active) reports false when true (IE9/Opera 11.5) // A support test would require too much code (would include document ready) // just skip matchesSelector for :active rbuggyMatches = [ ":active", ":focus" ], matches = docElem.matchesSelector || docElem.mozMatchesSelector || docElem.webkitMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector; // Build QSA regex // Regex strategy adopted from Diego Perini assert(function( div ) { // Select is set to empty string on purpose // This is to test IE's treatment of not explictly // setting a boolean content attribute, // since its presence should be enough // http://bugs.jquery.com/ticket/12359 div.innerHTML = "<select><option selected=''></option></select>"; // IE8 - Some boolean attributes are not treated correctly if ( !div.querySelectorAll("[selected]").length ) { rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); } // Webkit/Opera - :checked should return selected option elements // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked // IE8 throws error here (do not put tests after this one) if ( !div.querySelectorAll(":checked").length ) { rbuggyQSA.push(":checked"); } }); assert(function( div ) { // Opera 10-12/IE9 - ^= $= *= and empty values // Should not select anything div.innerHTML = "<p test=''></p>"; if ( div.querySelectorAll("[test^='']").length ) { rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); } // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) // IE8 throws error here (do not put tests after this one) div.innerHTML = "<input type='hidden'/>"; if ( !div.querySelectorAll(":enabled").length ) { rbuggyQSA.push(":enabled", ":disabled"); } }); // rbuggyQSA always contains :focus, so no need for a length check rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") ); select = function( selector, context, results, seed, xml ) { // Only use querySelectorAll when not filtering, // when this is not xml, // and when no QSA bugs apply if ( !seed && !xml && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { var groups, i, old = true, nid = expando, newContext = context, newSelector = context.nodeType === 9 && selector; // qSA works strangely on Element-rooted queries // We can work around this by specifying an extra ID on the root // and working up from there (Thanks to Andrew Dupont for the technique) // IE 8 doesn't work on object elements if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { groups = tokenize( selector ); if ( (old = context.getAttribute("id")) ) { nid = old.replace( rescape, "\\$&" ); } else { context.setAttribute( "id", nid ); } nid = "[id='" + nid + "'] "; i = groups.length; while ( i-- ) { groups[i] = nid + groups[i].join(""); } newContext = rsibling.test( selector ) && context.parentNode || context; newSelector = groups.join(","); } if ( newSelector ) { try { push.apply( results, slice.call( newContext.querySelectorAll( newSelector ), 0 ) ); return results; } catch(qsaError) { } finally { if ( !old ) { context.removeAttribute("id"); } } } } return oldSelect( selector, context, results, seed, xml ); }; if ( matches ) { assert(function( div ) { // Check to see if it's possible to do matchesSelector // on a disconnected node (IE 9) disconnectedMatch = matches.call( div, "div" ); // This should fail with an exception // Gecko does not error, returns false instead try { matches.call( div, "[test!='']:sizzle" ); rbuggyMatches.push( "!=", pseudos ); } catch ( e ) {} }); // rbuggyMatches always contains :active and :focus, so no need for a length check rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") ); Sizzle.matchesSelector = function( elem, expr ) { // Make sure that attribute selectors are quoted expr = expr.replace( rattributeQuotes, "='$1']" ); // rbuggyMatches always contains :active, so no need for an existence check if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && (!rbuggyQSA || !rbuggyQSA.test( expr )) ) { try { var ret = matches.call( elem, expr ); // IE 9's matchesSelector returns false on disconnected nodes if ( ret || disconnectedMatch || // As well, disconnected nodes are said to be in a document // fragment in IE 9 elem.document && elem.document.nodeType !== 11 ) { return ret; } } catch(e) {} } return Sizzle( expr, null, null, [ elem ] ).length > 0; }; } })(); } // Deprecated Expr.pseudos["nth"] = Expr.pseudos["eq"]; // Back-compat function setFilters() {} Expr.filters = setFilters.prototype = Expr.pseudos; Expr.setFilters = new setFilters(); // Override sizzle attribute retrieval Sizzle.attr = jQuery.attr; jQuery.find = Sizzle; jQuery.expr = Sizzle.selectors; jQuery.expr[":"] = jQuery.expr.pseudos; jQuery.unique = Sizzle.uniqueSort; jQuery.text = Sizzle.getText; jQuery.isXMLDoc = Sizzle.isXML; jQuery.contains = Sizzle.contains; })( window ); var runtil = /Until$/, rparentsprev = /^(?:parents|prev(?:Until|All))/, isSimple = /^.[^:#\[\.,]*$/, rneedsContext = jQuery.expr.match.needsContext, // methods guaranteed to produce a unique set when starting from a unique set guaranteedUnique = { children: true, contents: true, next: true, prev: true }; jQuery.fn.extend({ find: function( selector ) { var i, l, length, n, r, ret, self = this; if ( typeof selector !== "string" ) { return jQuery( selector ).filter(function() { for ( i = 0, l = self.length; i < l; i++ ) { if ( jQuery.contains( self[ i ], this ) ) { return true; } } }); } ret = this.pushStack( "", "find", selector ); for ( i = 0, l = this.length; i < l; i++ ) { length = ret.length; jQuery.find( selector, this[i], ret ); if ( i > 0 ) { // Make sure that the results are unique for ( n = length; n < ret.length; n++ ) { for ( r = 0; r < length; r++ ) { if ( ret[r] === ret[n] ) { ret.splice(n--, 1); break; } } } } } return ret; }, has: function( target ) { var i, targets = jQuery( target, this ), len = targets.length; return this.filter(function() { for ( i = 0; i < len; i++ ) { if ( jQuery.contains( this, targets[i] ) ) { return true; } } }); }, not: function( selector ) { return this.pushStack( winnow(this, selector, false), "not", selector); }, filter: function( selector ) { return this.pushStack( winnow(this, selector, true), "filter", selector ); }, is: function( selector ) { return !!selector && ( typeof selector === "string" ? // If this is a positional/relative selector, check membership in the returned set // so $("p:first").is("p:last") won't return true for a doc with two "p". rneedsContext.test( selector ) ? jQuery( selector, this.context ).index( this[0] ) >= 0 : jQuery.filter( selector, this ).length > 0 : this.filter( selector ).length > 0 ); }, closest: function( selectors, context ) { var cur, i = 0, l = this.length, ret = [], pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? jQuery( selectors, context || this.context ) : 0; for ( ; i < l; i++ ) { cur = this[i]; while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { ret.push( cur ); break; } cur = cur.parentNode; } } ret = ret.length > 1 ? jQuery.unique( ret ) : ret; return this.pushStack( ret, "closest", selectors ); }, // Determine the position of an element within // the matched set of elements index: function( elem ) { // No argument, return index in parent if ( !elem ) { return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; } // index in selector if ( typeof elem === "string" ) { return jQuery.inArray( this[0], jQuery( elem ) ); } // Locate the position of the desired element return jQuery.inArray( // If it receives a jQuery object, the first element is used elem.jquery ? elem[0] : elem, this ); }, add: function( selector, context ) { var set = typeof selector === "string" ? jQuery( selector, context ) : jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), all = jQuery.merge( this.get(), set ); return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? all : jQuery.unique( all ) ); }, addBack: function( selector ) { return this.add( selector == null ? this.prevObject : this.prevObject.filter(selector) ); } }); jQuery.fn.andSelf = jQuery.fn.addBack; // A painfully simple check to see if an element is disconnected // from a document (should be improved, where feasible). function isDisconnected( node ) { return !node || !node.parentNode || node.parentNode.nodeType === 11; } function sibling( cur, dir ) { do { cur = cur[ dir ]; } while ( cur && cur.nodeType !== 1 ); return cur; } jQuery.each({ parent: function( elem ) { var parent = elem.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, parents: function( elem ) { return jQuery.dir( elem, "parentNode" ); }, parentsUntil: function( elem, i, until ) { return jQuery.dir( elem, "parentNode", until ); }, next: function( elem ) { return sibling( elem, "nextSibling" ); }, prev: function( elem ) { return sibling( elem, "previousSibling" ); }, nextAll: function( elem ) { return jQuery.dir( elem, "nextSibling" ); }, prevAll: function( elem ) { return jQuery.dir( elem, "previousSibling" ); }, nextUntil: function( elem, i, until ) { return jQuery.dir( elem, "nextSibling", until ); }, prevUntil: function( elem, i, until ) { return jQuery.dir( elem, "previousSibling", until ); }, siblings: function( elem ) { return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); }, children: function( elem ) { return jQuery.sibling( elem.firstChild ); }, contents: function( elem ) { return jQuery.nodeName( elem, "iframe" ) ? elem.contentDocument || elem.contentWindow.document : jQuery.merge( [], elem.childNodes ); } }, function( name, fn ) { jQuery.fn[ name ] = function( until, selector ) { var ret = jQuery.map( this, fn, until ); if ( !runtil.test( name ) ) { selector = until; } if ( selector && typeof selector === "string" ) { ret = jQuery.filter( selector, ret ); } ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; if ( this.length > 1 && rparentsprev.test( name ) ) { ret = ret.reverse(); } return this.pushStack( ret, name, core_slice.call( arguments ).join(",") ); }; }); jQuery.extend({ filter: function( expr, elems, not ) { if ( not ) { expr = ":not(" + expr + ")"; } return elems.length === 1 ? jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : jQuery.find.matches(expr, elems); }, dir: function( elem, dir, until ) { var matched = [], cur = elem[ dir ]; while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { if ( cur.nodeType === 1 ) { matched.push( cur ); } cur = cur[dir]; } return matched; }, sibling: function( n, elem ) { var r = []; for ( ; n; n = n.nextSibling ) { if ( n.nodeType === 1 && n !== elem ) { r.push( n ); } } return r; } }); // Implement the identical functionality for filter and not function winnow( elements, qualifier, keep ) { // Can't pass null or undefined to indexOf in Firefox 4 // Set to 0 to skip string check qualifier = qualifier || 0; if ( jQuery.isFunction( qualifier ) ) { return jQuery.grep(elements, function( elem, i ) { var retVal = !!qualifier.call( elem, i, elem ); return retVal === keep; }); } else if ( qualifier.nodeType ) { return jQuery.grep(elements, function( elem, i ) { return ( elem === qualifier ) === keep; }); } else if ( typeof qualifier === "string" ) { var filtered = jQuery.grep(elements, function( elem ) { return elem.nodeType === 1; }); if ( isSimple.test( qualifier ) ) { return jQuery.filter(qualifier, filtered, !keep); } else { qualifier = jQuery.filter( qualifier, filtered ); } } return jQuery.grep(elements, function( elem, i ) { return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; }); } function createSafeFragment( document ) { var list = nodeNames.split( "|" ), safeFrag = document.createDocumentFragment(); if ( safeFrag.createElement ) { while ( list.length ) { safeFrag.createElement( list.pop() ); } } return safeFrag; } var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rleadingWhitespace = /^\s+/, rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, rtagName = /<([\w:]+)/, rtbody = /<tbody/i, rhtml = /<|&#?\w+;/, rnoInnerhtml = /<(?:script|style|link)/i, rnocache = /<(?:script|object|embed|option|style)/i, rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), rcheckableType = /^(?:checkbox|radio)$/, // checked="checked" or checked rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptType = /\/(java|ecma)script/i, rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g, wrapMap = { option: [ 1, "<select multiple='multiple'>", "</select>" ], legend: [ 1, "<fieldset>", "</fieldset>" ], thead: [ 1, "<table>", "</table>" ], tr: [ 2, "<table><tbody>", "</tbody></table>" ], td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], area: [ 1, "<map>", "</map>" ], _default: [ 0, "", "" ] }, safeFragment = createSafeFragment( document ), fragmentDiv = safeFragment.appendChild( document.createElement("div") ); wrapMap.optgroup = wrapMap.option; wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; wrapMap.th = wrapMap.td; // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, // unless wrapped in a div with non-breaking characters in front of it. if ( !jQuery.support.htmlSerialize ) { wrapMap._default = [ 1, "X<div>", "</div>" ]; } jQuery.fn.extend({ text: function( value ) { return jQuery.access( this, function( value ) { return value === undefined ? jQuery.text( this ) : this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); }, null, value, arguments.length ); }, wrapAll: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapAll( html.call(this, i) ); }); } if ( this[0] ) { // The elements to wrap the target around var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); if ( this[0].parentNode ) { wrap.insertBefore( this[0] ); } wrap.map(function() { var elem = this; while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { elem = elem.firstChild; } return elem; }).append( this ); } return this; }, wrapInner: function( html ) { if ( jQuery.isFunction( html ) ) { return this.each(function(i) { jQuery(this).wrapInner( html.call(this, i) ); }); } return this.each(function() { var self = jQuery( this ), contents = self.contents(); if ( contents.length ) { contents.wrapAll( html ); } else { self.append( html ); } }); }, wrap: function( html ) { var isFunction = jQuery.isFunction( html ); return this.each(function(i) { jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); }); }, unwrap: function() { return this.parent().each(function() { if ( !jQuery.nodeName( this, "body" ) ) { jQuery( this ).replaceWith( this.childNodes ); } }).end(); }, append: function() { return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 ) { this.appendChild( elem ); } }); }, prepend: function() { return this.domManip(arguments, true, function( elem ) { if ( this.nodeType === 1 || this.nodeType === 11 ) { this.insertBefore( elem, this.firstChild ); } }); }, before: function() { if ( !isDisconnected( this[0] ) ) { return this.domManip(arguments, false, function( elem ) { this.parentNode.insertBefore( elem, this ); }); } if ( arguments.length ) { var set = jQuery.clean( arguments ); return this.pushStack( jQuery.merge( set, this ), "before", this.selector ); } }, after: function() { if ( !isDisconnected( this[0] ) ) { return this.domManip(arguments, false, function( elem ) { this.parentNode.insertBefore( elem, this.nextSibling ); }); } if ( arguments.length ) { var set = jQuery.clean( arguments ); return this.pushStack( jQuery.merge( this, set ), "after", this.selector ); } }, // keepData is for internal use only--do not document remove: function( selector, keepData ) { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { if ( !selector || jQuery.filter( selector, [ elem ] ).length ) { if ( !keepData && elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName("*") ); jQuery.cleanData( [ elem ] ); } if ( elem.parentNode ) { elem.parentNode.removeChild( elem ); } } } return this; }, empty: function() { var elem, i = 0; for ( ; (elem = this[i]) != null; i++ ) { // Remove element nodes and prevent memory leaks if ( elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName("*") ); } // Remove any remaining nodes while ( elem.firstChild ) { elem.removeChild( elem.firstChild ); } } return this; }, clone: function( dataAndEvents, deepDataAndEvents ) { dataAndEvents = dataAndEvents == null ? false : dataAndEvents; deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; return this.map( function () { return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); }); }, html: function( value ) { return jQuery.access( this, function( value ) { var elem = this[0] || {}, i = 0, l = this.length; if ( value === undefined ) { return elem.nodeType === 1 ? elem.innerHTML.replace( rinlinejQuery, "" ) : undefined; } // See if we can take a shortcut and just use innerHTML if ( typeof value === "string" && !rnoInnerhtml.test( value ) && ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { value = value.replace( rxhtmlTag, "<$1></$2>" ); try { for (; i < l; i++ ) { // Remove element nodes and prevent memory leaks elem = this[i] || {}; if ( elem.nodeType === 1 ) { jQuery.cleanData( elem.getElementsByTagName( "*" ) ); elem.innerHTML = value; } } elem = 0; // If using innerHTML throws an exception, use the fallback method } catch(e) {} } if ( elem ) { this.empty().append( value ); } }, null, value, arguments.length ); }, replaceWith: function( value ) { if ( !isDisconnected( this[0] ) ) { // Make sure that the elements are removed from the DOM before they are inserted // this can help fix replacing a parent with child elements if ( jQuery.isFunction( value ) ) { return this.each(function(i) { var self = jQuery(this), old = self.html(); self.replaceWith( value.call( this, i, old ) ); }); } if ( typeof value !== "string" ) { value = jQuery( value ).detach(); } return this.each(function() { var next = this.nextSibling, parent = this.parentNode; jQuery( this ).remove(); if ( next ) { jQuery(next).before( value ); } else { jQuery(parent).append( value ); } }); } return this.length ? this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : this; }, detach: function( selector ) { return this.remove( selector, true ); }, domManip: function( args, table, callback ) { // Flatten any nested arrays args = [].concat.apply( [], args ); var results, first, fragment, iNoClone, i = 0, value = args[0], scripts = [], l = this.length; // We can't cloneNode fragments that contain checked, in WebKit if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) { return this.each(function() { jQuery(this).domManip( args, table, callback ); }); } if ( jQuery.isFunction(value) ) { return this.each(function(i) { var self = jQuery(this); args[0] = value.call( this, i, table ? self.html() : undefined ); self.domManip( args, table, callback ); }); } if ( this[0] ) { results = jQuery.buildFragment( args, this, scripts ); fragment = results.fragment; first = fragment.firstChild; if ( fragment.childNodes.length === 1 ) { fragment = first; } if ( first ) { table = table && jQuery.nodeName( first, "tr" ); // Use the original fragment for the last item instead of the first because it can end up // being emptied incorrectly in certain situations (#8070). // Fragments from the fragment cache must always be cloned and never used in place. for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) { callback.call( table && jQuery.nodeName( this[i], "table" ) ? findOrAppend( this[i], "tbody" ) : this[i], i === iNoClone ? fragment : jQuery.clone( fragment, true, true ) ); } } // Fix #11809: Avoid leaking memory fragment = first = null; if ( scripts.length ) { jQuery.each( scripts, function( i, elem ) { if ( elem.src ) { if ( jQuery.ajax ) { jQuery.ajax({ url: elem.src, type: "GET", dataType: "script", async: false, global: false, "throws": true }); } else { jQuery.error("no ajax"); } } else { jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) ); } if ( elem.parentNode ) { elem.parentNode.removeChild( elem ); } }); } } return this; } }); function findOrAppend( elem, tag ) { return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); } function cloneCopyEvent( src, dest ) { if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { return; } var type, i, l, oldData = jQuery._data( src ), curData = jQuery._data( dest, oldData ), events = oldData.events; if ( events ) { delete curData.handle; curData.events = {}; for ( type in events ) { for ( i = 0, l = events[ type ].length; i < l; i++ ) { jQuery.event.add( dest, type, events[ type ][ i ] ); } } } // make the cloned public data object a copy from the original if ( curData.data ) { curData.data = jQuery.extend( {}, curData.data ); } } function cloneFixAttributes( src, dest ) { var nodeName; // We do not need to do anything for non-Elements if ( dest.nodeType !== 1 ) { return; } // clearAttributes removes the attributes, which we don't want, // but also removes the attachEvent events, which we *do* want if ( dest.clearAttributes ) { dest.clearAttributes(); } // mergeAttributes, in contrast, only merges back on the // original attributes, not the events if ( dest.mergeAttributes ) { dest.mergeAttributes( src ); } nodeName = dest.nodeName.toLowerCase(); if ( nodeName === "object" ) { // IE6-10 improperly clones children of object elements using classid. // IE10 throws NoModificationAllowedError if parent is null, #12132. if ( dest.parentNode ) { dest.outerHTML = src.outerHTML; } // This path appears unavoidable for IE9. When cloning an object // element in IE9, the outerHTML strategy above is not sufficient. // If the src has innerHTML and the destination does not, // copy the src.innerHTML into the dest.innerHTML. #10324 if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) { dest.innerHTML = src.innerHTML; } } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { // IE6-8 fails to persist the checked state of a cloned checkbox // or radio button. Worse, IE6-7 fail to give the cloned element // a checked appearance if the defaultChecked value isn't also set dest.defaultChecked = dest.checked = src.checked; // IE6-7 get confused and end up setting the value of a cloned // checkbox/radio button to an empty string instead of "on" if ( dest.value !== src.value ) { dest.value = src.value; } // IE6-8 fails to return the selected option to the default selected // state when cloning options } else if ( nodeName === "option" ) { dest.selected = src.defaultSelected; // IE6-8 fails to set the defaultValue to the correct value when // cloning other types of input fields } else if ( nodeName === "input" || nodeName === "textarea" ) { dest.defaultValue = src.defaultValue; // IE blanks contents when cloning scripts } else if ( nodeName === "script" && dest.text !== src.text ) { dest.text = src.text; } // Event data gets referenced instead of copied if the expando // gets copied too dest.removeAttribute( jQuery.expando ); } jQuery.buildFragment = function( args, context, scripts ) { var fragment, cacheable, cachehit, first = args[ 0 ]; // Set context from what may come in as undefined or a jQuery collection or a node // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 & // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception context = context || document; context = !context.nodeType && context[0] || context; context = context.ownerDocument || context; // Only cache "small" (1/2 KB) HTML strings that are associated with the main document // Cloning options loses the selected state, so don't cache them // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501 if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document && first.charAt(0) === "<" && !rnocache.test( first ) && (jQuery.support.checkClone || !rchecked.test( first )) && (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) { // Mark cacheable and look for a hit cacheable = true; fragment = jQuery.fragments[ first ]; cachehit = fragment !== undefined; } if ( !fragment ) { fragment = context.createDocumentFragment(); jQuery.clean( args, context, fragment, scripts ); // Update the cache, but only store false // unless this is a second parsing of the same content if ( cacheable ) { jQuery.fragments[ first ] = cachehit && fragment; } } return { fragment: fragment, cacheable: cacheable }; }; jQuery.fragments = {}; jQuery.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function( name, original ) { jQuery.fn[ name ] = function( selector ) { var elems, i = 0, ret = [], insert = jQuery( selector ), l = insert.length, parent = this.length === 1 && this[0].parentNode; if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) { insert[ original ]( this[0] ); return this; } else { for ( ; i < l; i++ ) { elems = ( i > 0 ? this.clone(true) : this ).get(); jQuery( insert[i] )[ original ]( elems ); ret = ret.concat( elems ); } return this.pushStack( ret, name, insert.selector ); } }; }); function getAll( elem ) { if ( typeof elem.getElementsByTagName !== "undefined" ) { return elem.getElementsByTagName( "*" ); } else if ( typeof elem.querySelectorAll !== "undefined" ) { return elem.querySelectorAll( "*" ); } else { return []; } } // Used in clean, fixes the defaultChecked property function fixDefaultChecked( elem ) { if ( rcheckableType.test( elem.type ) ) { elem.defaultChecked = elem.checked; } } jQuery.extend({ clone: function( elem, dataAndEvents, deepDataAndEvents ) { var srcElements, destElements, i, clone; if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { clone = elem.cloneNode( true ); // IE<=8 does not properly clone detached, unknown element nodes } else { fragmentDiv.innerHTML = elem.outerHTML; fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); } if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { // IE copies events bound via attachEvent when using cloneNode. // Calling detachEvent on the clone will also remove the events // from the original. In order to get around this, we use some // proprietary methods to clear the events. Thanks to MooTools // guys for this hotness. cloneFixAttributes( elem, clone ); // Using Sizzle here is crazy slow, so we use getElementsByTagName instead srcElements = getAll( elem ); destElements = getAll( clone ); // Weird iteration because IE will replace the length property // with an element if you are cloning the body and one of the // elements on the page has a name or id of "length" for ( i = 0; srcElements[i]; ++i ) { // Ensure that the destination node is not null; Fixes #9587 if ( destElements[i] ) { cloneFixAttributes( srcElements[i], destElements[i] ); } } } // Copy the events from the original to the clone if ( dataAndEvents ) { cloneCopyEvent( elem, clone ); if ( deepDataAndEvents ) { srcElements = getAll( elem ); destElements = getAll( clone ); for ( i = 0; srcElements[i]; ++i ) { cloneCopyEvent( srcElements[i], destElements[i] ); } } } srcElements = destElements = null; // Return the cloned set return clone; }, clean: function( elems, context, fragment, scripts ) { var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags, safe = context === document && safeFragment, ret = []; // Ensure that context is a document if ( !context || typeof context.createDocumentFragment === "undefined" ) { context = document; } // Use the already-created safe fragment if context permits for ( i = 0; (elem = elems[i]) != null; i++ ) { if ( typeof elem === "number" ) { elem += ""; } if ( !elem ) { continue; } // Convert html string into DOM nodes if ( typeof elem === "string" ) { if ( !rhtml.test( elem ) ) { elem = context.createTextNode( elem ); } else { // Ensure a safe container in which to render the html safe = safe || createSafeFragment( context ); div = context.createElement("div"); safe.appendChild( div ); // Fix "XHTML"-style tags in all browsers elem = elem.replace(rxhtmlTag, "<$1></$2>"); // Go to html and back, then peel off extra wrappers tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); wrap = wrapMap[ tag ] || wrapMap._default; depth = wrap[0]; div.innerHTML = wrap[1] + elem + wrap[2]; // Move to the right depth while ( depth-- ) { div = div.lastChild; } // Remove IE's autoinserted <tbody> from table fragments if ( !jQuery.support.tbody ) { // String was a <table>, *may* have spurious <tbody> hasBody = rtbody.test(elem); tbody = tag === "table" && !hasBody ? div.firstChild && div.firstChild.childNodes : // String was a bare <thead> or <tfoot> wrap[1] === "<table>" && !hasBody ? div.childNodes : []; for ( j = tbody.length - 1; j >= 0 ; --j ) { if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { tbody[ j ].parentNode.removeChild( tbody[ j ] ); } } } // IE completely kills leading whitespace when innerHTML is used if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); } elem = div.childNodes; // Take out of fragment container (we need a fresh div each time) div.parentNode.removeChild( div ); } } if ( elem.nodeType ) { ret.push( elem ); } else { jQuery.merge( ret, elem ); } } // Fix #11356: Clear elements from safeFragment if ( div ) { elem = div = safe = null; } // Reset defaultChecked for any radios and checkboxes // about to be appended to the DOM in IE 6/7 (#8060) if ( !jQuery.support.appendChecked ) { for ( i = 0; (elem = ret[i]) != null; i++ ) { if ( jQuery.nodeName( elem, "input" ) ) { fixDefaultChecked( elem ); } else if ( typeof elem.getElementsByTagName !== "undefined" ) { jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); } } } // Append elements to a provided document fragment if ( fragment ) { // Special handling of each script element handleScript = function( elem ) { // Check if we consider it executable if ( !elem.type || rscriptType.test( elem.type ) ) { // Detach the script and store it in the scripts array (if provided) or the fragment // Return truthy to indicate that it has been handled return scripts ? scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) : fragment.appendChild( elem ); } }; for ( i = 0; (elem = ret[i]) != null; i++ ) { // Check if we're done after handling an executable script if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) { // Append to fragment and handle embedded scripts fragment.appendChild( elem ); if ( typeof elem.getElementsByTagName !== "undefined" ) { // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript ); // Splice the scripts into ret after their former ancestor and advance our index beyond them ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); i += jsTags.length; } } } } return ret; }, cleanData: function( elems, /* internal */ acceptData ) { var data, id, elem, type, i = 0, internalKey = jQuery.expando, cache = jQuery.cache, deleteExpando = jQuery.support.deleteExpando, special = jQuery.event.special; for ( ; (elem = elems[i]) != null; i++ ) { if ( acceptData || jQuery.acceptData( elem ) ) { id = elem[ internalKey ]; data = id && cache[ id ]; if ( data ) { if ( data.events ) { for ( type in data.events ) { if ( special[ type ] ) { jQuery.event.remove( elem, type ); // This is a shortcut to avoid jQuery.event.remove's overhead } else { jQuery.removeEvent( elem, type, data.handle ); } } } // Remove cache only if it was not already removed by jQuery.event.remove if ( cache[ id ] ) { delete cache[ id ]; // IE does not allow us to delete expando properties from nodes, // nor does it have a removeAttribute function on Document nodes; // we must handle all of these cases if ( deleteExpando ) { delete elem[ internalKey ]; } else if ( elem.removeAttribute ) { elem.removeAttribute( internalKey ); } else { elem[ internalKey ] = null; } jQuery.deletedIds.push( id ); } } } } } }); // Limit scope pollution from any deprecated API (function() { var matched, browser; // Use of jQuery.browser is frowned upon. // More details: http://api.jquery.com/jQuery.browser // jQuery.uaMatch maintained for back-compat jQuery.uaMatch = function( ua ) { ua = ua.toLowerCase(); var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) || /(webkit)[ \/]([\w.]+)/.exec( ua ) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) || /(msie) ([\w.]+)/.exec( ua ) || ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) || []; return { browser: match[ 1 ] || "", version: match[ 2 ] || "0" }; }; matched = jQuery.uaMatch( navigator.userAgent ); browser = {}; if ( matched.browser ) { browser[ matched.browser ] = true; browser.version = matched.version; } // Chrome is Webkit, but Webkit is also Safari. if ( browser.chrome ) { browser.webkit = true; } else if ( browser.webkit ) { browser.safari = true; } jQuery.browser = browser; jQuery.sub = function() { function jQuerySub( selector, context ) { return new jQuerySub.fn.init( selector, context ); } jQuery.extend( true, jQuerySub, this ); jQuerySub.superclass = this; jQuerySub.fn = jQuerySub.prototype = this(); jQuerySub.fn.constructor = jQuerySub; jQuerySub.sub = this.sub; jQuerySub.fn.init = function init( selector, context ) { if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { context = jQuerySub( context ); } return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); }; jQuerySub.fn.init.prototype = jQuerySub.fn; var rootjQuerySub = jQuerySub(document); return jQuerySub; }; })(); var curCSS, iframe, iframeDoc, ralpha = /alpha\([^)]*\)/i, ropacity = /opacity=([^)]*)/, rposition = /^(top|right|bottom|left)$/, // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display rdisplayswap = /^(none|table(?!-c[ea]).+)/, rmargin = /^margin/, rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ), elemdisplay = {}, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = { letterSpacing: 0, fontWeight: 400 }, cssExpand = [ "Top", "Right", "Bottom", "Left" ], cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], eventsToggle = jQuery.fn.toggle; // return a css property mapped to a potentially vendor prefixed property function vendorPropName( style, name ) { // shortcut for names that are not vendor prefixed if ( name in style ) { return name; } // check for vendor prefixed names var capName = name.charAt(0).toUpperCase() + name.slice(1), origName = name, i = cssPrefixes.length; while ( i-- ) { name = cssPrefixes[ i ] + capName; if ( name in style ) { return name; } } return origName; } function isHidden( elem, el ) { elem = el || elem; return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); } function showHide( elements, show ) { var elem, display, values = [], index = 0, length = elements.length; for ( ; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } values[ index ] = jQuery._data( elem, "olddisplay" ); if ( show ) { // Reset the inline display of this element to learn if it is // being hidden by cascaded rules or not if ( !values[ index ] && elem.style.display === "none" ) { elem.style.display = ""; } // Set elements which have been overridden with display: none // in a stylesheet to whatever the default browser style is // for such an element if ( elem.style.display === "" && isHidden( elem ) ) { values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); } } else { display = curCSS( elem, "display" ); if ( !values[ index ] && display !== "none" ) { jQuery._data( elem, "olddisplay", display ); } } } // Set the display of most of the elements in a second loop // to avoid the constant reflow for ( index = 0; index < length; index++ ) { elem = elements[ index ]; if ( !elem.style ) { continue; } if ( !show || elem.style.display === "none" || elem.style.display === "" ) { elem.style.display = show ? values[ index ] || "" : "none"; } } return elements; } jQuery.fn.extend({ css: function( name, value ) { return jQuery.access( this, function( elem, name, value ) { return value !== undefined ? jQuery.style( elem, name, value ) : jQuery.css( elem, name ); }, name, value, arguments.length > 1 ); }, show: function() { return showHide( this, true ); }, hide: function() { return showHide( this ); }, toggle: function( state, fn2 ) { var bool = typeof state === "boolean"; if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) { return eventsToggle.apply( this, arguments ); } return this.each(function() { if ( bool ? state : isHidden( this ) ) { jQuery( this ).show(); } else { jQuery( this ).hide(); } }); } }); jQuery.extend({ // Add in style property hooks for overriding the default // behavior of getting and setting a style property cssHooks: { opacity: { get: function( elem, computed ) { if ( computed ) { // We should always get a number back from opacity var ret = curCSS( elem, "opacity" ); return ret === "" ? "1" : ret; } } } }, // Exclude the following css properties to add px cssNumber: { "fillOpacity": true, "fontWeight": true, "lineHeight": true, "opacity": true, "orphans": true, "widows": true, "zIndex": true, "zoom": true }, // Add in properties whose names you wish to fix before // setting or getting the value cssProps: { // normalize float css property "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" }, // Get and set the style property on a DOM Node style: function( elem, name, value, extra ) { // Don't set styles on text and comment nodes if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { return; } // Make sure that we're working with the right name var ret, type, hooks, origName = jQuery.camelCase( name ), style = elem.style; name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // Check if we're setting a value if ( value !== undefined ) { type = typeof value; // convert relative number strings (+= or -=) to relative numbers. #7345 if ( type === "string" && (ret = rrelNum.exec( value )) ) { value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); // Fixes bug #9237 type = "number"; } // Make sure that NaN and null values aren't set. See: #7116 if ( value == null || type === "number" && isNaN( value ) ) { return; } // If a number was passed in, add 'px' to the (except for certain CSS properties) if ( type === "number" && !jQuery.cssNumber[ origName ] ) { value += "px"; } // If a hook was provided, use that value, otherwise just set the specified value if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { // Wrapped to prevent IE from throwing errors when 'invalid' values are provided // Fixes bug #5509 try { style[ name ] = value; } catch(e) {} } } else { // If a hook was provided get the non-computed value from there if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { return ret; } // Otherwise just get the value from the style object return style[ name ]; } }, css: function( elem, name, numeric, extra ) { var val, num, hooks, origName = jQuery.camelCase( name ); // Make sure that we're working with the right name name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); // gets hook for the prefixed version // followed by the unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; // If a hook was provided get the computed value from there if ( hooks && "get" in hooks ) { val = hooks.get( elem, true, extra ); } // Otherwise, if a way to get the computed value exists, use that if ( val === undefined ) { val = curCSS( elem, name ); } //convert "normal" to computed value if ( val === "normal" && name in cssNormalTransform ) { val = cssNormalTransform[ name ]; } // Return, converting to number if forced or a qualifier was provided and val looks numeric if ( numeric || extra !== undefined ) { num = parseFloat( val ); return numeric || jQuery.isNumeric( num ) ? num || 0 : val; } return val; }, // A method for quickly swapping in/out CSS properties to get correct calculations swap: function( elem, options, callback ) { var ret, name, old = {}; // Remember the old values, and insert the new ones for ( name in options ) { old[ name ] = elem.style[ name ]; elem.style[ name ] = options[ name ]; } ret = callback.call( elem ); // Revert the old values for ( name in options ) { elem.style[ name ] = old[ name ]; } return ret; } }); // NOTE: To any future maintainer, we've window.getComputedStyle // because jsdom on node.js will break without it. if ( window.getComputedStyle ) { curCSS = function( elem, name ) { var ret, width, minWidth, maxWidth, computed = window.getComputedStyle( elem, null ), style = elem.style; if ( computed ) { ret = computed[ name ]; if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { ret = jQuery.style( elem, name ); } // A tribute to the "awesome hack by Dean Edwards" // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { width = style.width; minWidth = style.minWidth; maxWidth = style.maxWidth; style.minWidth = style.maxWidth = style.width = ret; ret = computed.width; style.width = width; style.minWidth = minWidth; style.maxWidth = maxWidth; } } return ret; }; } else if ( document.documentElement.currentStyle ) { curCSS = function( elem, name ) { var left, rsLeft, ret = elem.currentStyle && elem.currentStyle[ name ], style = elem.style; // Avoid setting ret to empty string here // so we don't default to auto if ( ret == null && style && style[ name ] ) { ret = style[ name ]; } // From the awesome hack by Dean Edwards // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 // If we're not dealing with a regular pixel number // but a number that has a weird ending, we need to convert it to pixels // but not position css attributes, as those are proportional to the parent element instead // and we can't measure the parent instead because it might trigger a "stacking dolls" problem if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { // Remember the original values left = style.left; rsLeft = elem.runtimeStyle && elem.runtimeStyle.left; // Put in the new values to get a computed value out if ( rsLeft ) { elem.runtimeStyle.left = elem.currentStyle.left; } style.left = name === "fontSize" ? "1em" : ret; ret = style.pixelLeft + "px"; // Revert the changed values style.left = left; if ( rsLeft ) { elem.runtimeStyle.left = rsLeft; } } return ret === "" ? "auto" : ret; }; } function setPositiveNumber( elem, value, subtract ) { var matches = rnumsplit.exec( value ); return matches ? Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : value; } function augmentWidthOrHeight( elem, name, extra, isBorderBox ) { var i = extra === ( isBorderBox ? "border" : "content" ) ? // If we already have the right measurement, avoid augmentation 4 : // Otherwise initialize for horizontal or vertical properties name === "width" ? 1 : 0, val = 0; for ( ; i < 4; i += 2 ) { // both box models exclude margin, so add it if we want it if ( extra === "margin" ) { // we use jQuery.css instead of curCSS here // because of the reliableMarginRight CSS hook! val += jQuery.css( elem, extra + cssExpand[ i ], true ); } // From this point on we use curCSS for maximum performance (relevant in animations) if ( isBorderBox ) { // border-box includes padding, so remove it if we want content if ( extra === "content" ) { val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; } // at this point, extra isn't border nor margin, so remove border if ( extra !== "margin" ) { val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; } } else { // at this point, extra isn't content, so add padding val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0; // at this point, extra isn't content nor padding, so add border if ( extra !== "padding" ) { val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0; } } } return val; } function getWidthOrHeight( elem, name, extra ) { // Start with offset property, which is equivalent to the border-box value var val = name === "width" ? elem.offsetWidth : elem.offsetHeight, valueIsBorderBox = true, isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"; // some non-html elements return undefined for offsetWidth, so check for null/undefined // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 if ( val <= 0 || val == null ) { // Fall back to computed then uncomputed css if necessary val = curCSS( elem, name ); if ( val < 0 || val == null ) { val = elem.style[ name ]; } // Computed unit is not pixels. Stop here and return. if ( rnumnonpx.test(val) ) { return val; } // we need the check for style in case a browser which returns unreliable values // for getComputedStyle silently falls back to the reliable elem.style valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); // Normalize "", auto, and prepare for extra val = parseFloat( val ) || 0; } // use the active box-sizing model to add/subtract irrelevant styles return ( val + augmentWidthOrHeight( elem, name, extra || ( isBorderBox ? "border" : "content" ), valueIsBorderBox ) ) + "px"; } // Try to determine the default display value of an element function css_defaultDisplay( nodeName ) { if ( elemdisplay[ nodeName ] ) { return elemdisplay[ nodeName ]; } var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ), display = elem.css("display"); elem.remove(); // If the simple way fails, // get element's real default display by attaching it to a temp iframe if ( display === "none" || display === "" ) { // Use the already-created iframe if possible iframe = document.body.appendChild( iframe || jQuery.extend( document.createElement("iframe"), { frameBorder: 0, width: 0, height: 0 }) ); // Create a cacheable copy of the iframe document on first call. // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML // document to it; WebKit & Firefox won't allow reusing the iframe document. if ( !iframeDoc || !iframe.createElement ) { iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; iframeDoc.write("<!doctype html><html><body>"); iframeDoc.close(); } elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) ); display = curCSS( elem, "display" ); document.body.removeChild( iframe ); } // Store the correct default display elemdisplay[ nodeName ] = display; return display; } jQuery.each([ "height", "width" ], function( i, name ) { jQuery.cssHooks[ name ] = { get: function( elem, computed, extra ) { if ( computed ) { // certain elements can have dimension info if we invisibly show them // however, it must have a current display style that would benefit from this if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) { return jQuery.swap( elem, cssShow, function() { return getWidthOrHeight( elem, name, extra ); }); } else { return getWidthOrHeight( elem, name, extra ); } } }, set: function( elem, value, extra ) { return setPositiveNumber( elem, value, extra ? augmentWidthOrHeight( elem, name, extra, jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box" ) : 0 ); } }; }); if ( !jQuery.support.opacity ) { jQuery.cssHooks.opacity = { get: function( elem, computed ) { // IE uses filters for opacity return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : computed ? "1" : ""; }, set: function( elem, value ) { var style = elem.style, currentStyle = elem.currentStyle, opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", filter = currentStyle && currentStyle.filter || style.filter || ""; // IE has trouble with opacity if it does not have layout // Force it by setting the zoom level style.zoom = 1; // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" && style.removeAttribute ) { // Setting style.filter to null, "" & " " still leave "filter:" in the cssText // if "filter:" is present at all, clearType is disabled, we want to avoid this // style.removeAttribute is IE Only, but so apparently is this code path... style.removeAttribute( "filter" ); // if there there is no filter style applied in a css rule, we are done if ( currentStyle && !currentStyle.filter ) { return; } } // otherwise, set new filter values style.filter = ralpha.test( filter ) ? filter.replace( ralpha, opacity ) : filter + " " + opacity; } }; } // These hooks cannot be added until DOM ready because the support test // for it is not run until after DOM ready jQuery(function() { if ( !jQuery.support.reliableMarginRight ) { jQuery.cssHooks.marginRight = { get: function( elem, computed ) { // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right // Work around by temporarily setting element display to inline-block return jQuery.swap( elem, { "display": "inline-block" }, function() { if ( computed ) { return curCSS( elem, "marginRight" ); } }); } }; } // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 // getComputedStyle returns percent when specified for top/left/bottom/right // rather than make the css module depend on the offset module, we just check for it here if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { jQuery.each( [ "top", "left" ], function( i, prop ) { jQuery.cssHooks[ prop ] = { get: function( elem, computed ) { if ( computed ) { var ret = curCSS( elem, prop ); // if curCSS returns percentage, fallback to offset return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret; } } }; }); } }); if ( jQuery.expr && jQuery.expr.filters ) { jQuery.expr.filters.hidden = function( elem ) { return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none"); }; jQuery.expr.filters.visible = function( elem ) { return !jQuery.expr.filters.hidden( elem ); }; } // These hooks are used by animate to expand properties jQuery.each({ margin: "", padding: "", border: "Width" }, function( prefix, suffix ) { jQuery.cssHooks[ prefix + suffix ] = { expand: function( value ) { var i, // assumes a single number if not a string parts = typeof value === "string" ? value.split(" ") : [ value ], expanded = {}; for ( i = 0; i < 4; i++ ) { expanded[ prefix + cssExpand[ i ] + suffix ] = parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; } return expanded; } }; if ( !rmargin.test( prefix ) ) { jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; } }); var r20 = /%20/g, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, rselectTextarea = /^(?:select|textarea)/i; jQuery.fn.extend({ serialize: function() { return jQuery.param( this.serializeArray() ); }, serializeArray: function() { return this.map(function(){ return this.elements ? jQuery.makeArray( this.elements ) : this; }) .filter(function(){ return this.name && !this.disabled && ( this.checked || rselectTextarea.test( this.nodeName ) || rinput.test( this.type ) ); }) .map(function( i, elem ){ var val = jQuery( this ).val(); return val == null ? null : jQuery.isArray( val ) ? jQuery.map( val, function( val, i ){ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }) : { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; }).get(); } }); //Serialize an array of form elements or a set of //key/values into a query string jQuery.param = function( a, traditional ) { var prefix, s = [], add = function( key, value ) { // If value is a function, invoke it and return its value value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); }; // Set traditional to true for jQuery <= 1.3.2 behavior. if ( traditional === undefined ) { traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; } // If an array was passed in, assume that it is an array of form elements. if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { // Serialize the form elements jQuery.each( a, function() { add( this.name, this.value ); }); } else { // If traditional, encode the "old" way (the way 1.3.2 or older // did it), otherwise encode params recursively. for ( prefix in a ) { buildParams( prefix, a[ prefix ], traditional, add ); } } // Return the resulting serialization return s.join( "&" ).replace( r20, "+" ); }; function buildParams( prefix, obj, traditional, add ) { var name; if ( jQuery.isArray( obj ) ) { // Serialize array item. jQuery.each( obj, function( i, v ) { if ( traditional || rbracket.test( prefix ) ) { // Treat each array item as a scalar. add( prefix, v ); } else { // If array item is non-scalar (array or object), encode its // numeric index to resolve deserialization ambiguity issues. // Note that rack (as of 1.0.0) can't currently deserialize // nested arrays properly, and attempting to do so may cause // a server error. Possible fixes are to modify rack's // deserialization algorithm or to provide an option or flag // to force array serialization to be shallow. buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); } }); } else if ( !traditional && jQuery.type( obj ) === "object" ) { // Serialize object item. for ( name in obj ) { buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); } } else { // Serialize scalar item. add( prefix, obj ); } } var // Document location ajaxLocParts, ajaxLocation, rhash = /#.*$/, rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL // #7653, #8125, #8152: local protocol detection rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, rquery = /\?/, rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, rts = /([?&])_=[^&]*/, rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, // Keep a copy of the old load method _load = jQuery.fn.load, /* Prefilters * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) * 2) These are called: * - BEFORE asking for a transport * - AFTER param serialization (s.data is a string if s.processData is true) * 3) key is the dataType * 4) the catchall symbol "*" can be used * 5) execution will start with transport dataType and THEN continue down to "*" if needed */ prefilters = {}, /* Transports bindings * 1) key is the dataType * 2) the catchall symbol "*" can be used * 3) selection will start with transport dataType and THEN go to "*" if needed */ transports = {}, // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression allTypes = ["*/"] + ["*"]; // #8138, IE may throw an exception when accessing // a field from window.location if document.domain has been set try { ajaxLocation = location.href; } catch( e ) { // Use the href attribute of an A element // since IE will modify it given document.location ajaxLocation = document.createElement( "a" ); ajaxLocation.href = ""; ajaxLocation = ajaxLocation.href; } // Segment location into parts ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport function addToPrefiltersOrTransports( structure ) { // dataTypeExpression is optional and defaults to "*" return function( dataTypeExpression, func ) { if ( typeof dataTypeExpression !== "string" ) { func = dataTypeExpression; dataTypeExpression = "*"; } var dataType, list, placeBefore, dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ), i = 0, length = dataTypes.length; if ( jQuery.isFunction( func ) ) { // For each dataType in the dataTypeExpression for ( ; i < length; i++ ) { dataType = dataTypes[ i ]; // We control if we're asked to add before // any existing element placeBefore = /^\+/.test( dataType ); if ( placeBefore ) { dataType = dataType.substr( 1 ) || "*"; } list = structure[ dataType ] = structure[ dataType ] || []; // then we add to the structure accordingly list[ placeBefore ? "unshift" : "push" ]( func ); } } }; } // Base inspection function for prefilters and transports function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, dataType /* internal */, inspected /* internal */ ) { dataType = dataType || options.dataTypes[ 0 ]; inspected = inspected || {}; inspected[ dataType ] = true; var selection, list = structure[ dataType ], i = 0, length = list ? list.length : 0, executeOnly = ( structure === prefilters ); for ( ; i < length && ( executeOnly || !selection ); i++ ) { selection = list[ i ]( options, originalOptions, jqXHR ); // If we got redirected to another dataType // we try there if executing only and not done already if ( typeof selection === "string" ) { if ( !executeOnly || inspected[ selection ] ) { selection = undefined; } else { options.dataTypes.unshift( selection ); selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, selection, inspected ); } } } // If we're only executing or nothing was selected // we try the catchall dataType if not done already if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { selection = inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, "*", inspected ); } // unnecessary when only executing (prefilters) // but it'll be ignored by the caller in that case return selection; } // A special extend for ajax options // that takes "flat" options (not to be deep extended) // Fixes #9887 function ajaxExtend( target, src ) { var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {}; for ( key in src ) { if ( src[ key ] !== undefined ) { ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; } } if ( deep ) { jQuery.extend( true, target, deep ); } } jQuery.fn.load = function( url, params, callback ) { if ( typeof url !== "string" && _load ) { return _load.apply( this, arguments ); } // Don't do a request if no elements are being requested if ( !this.length ) { return this; } var selector, type, response, self = this, off = url.indexOf(" "); if ( off >= 0 ) { selector = url.slice( off, url.length ); url = url.slice( 0, off ); } // If it's a function if ( jQuery.isFunction( params ) ) { // We assume that it's the callback callback = params; params = undefined; // Otherwise, build a param string } else if ( params && typeof params === "object" ) { type = "POST"; } // Request the remote document jQuery.ajax({ url: url, // if "type" variable is undefined, then "GET" method will be used type: type, dataType: "html", data: params, complete: function( jqXHR, status ) { if ( callback ) { self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); } } }).done(function( responseText ) { // Save response for use in complete callback response = arguments; // See if a selector was specified self.html( selector ? // Create a dummy div to hold the results jQuery("<div>") // inject the contents of the document in, removing the scripts // to avoid any 'Permission Denied' errors in IE .append( responseText.replace( rscript, "" ) ) // Locate the specified elements .find( selector ) : // If not, just inject the full result responseText ); }); return this; }; // Attach a bunch of functions for handling common AJAX events jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ jQuery.fn[ o ] = function( f ){ return this.on( o, f ); }; }); jQuery.each( [ "get", "post" ], function( i, method ) { jQuery[ method ] = function( url, data, callback, type ) { // shift arguments if data argument was omitted if ( jQuery.isFunction( data ) ) { type = type || callback; callback = data; data = undefined; } return jQuery.ajax({ type: method, url: url, data: data, success: callback, dataType: type }); }; }); jQuery.extend({ getScript: function( url, callback ) { return jQuery.get( url, undefined, callback, "script" ); }, getJSON: function( url, data, callback ) { return jQuery.get( url, data, callback, "json" ); }, // Creates a full fledged settings object into target // with both ajaxSettings and settings fields. // If target is omitted, writes into ajaxSettings. ajaxSetup: function( target, settings ) { if ( settings ) { // Building a settings object ajaxExtend( target, jQuery.ajaxSettings ); } else { // Extending ajaxSettings settings = target; target = jQuery.ajaxSettings; } ajaxExtend( target, settings ); return target; }, ajaxSettings: { url: ajaxLocation, isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), global: true, type: "GET", contentType: "application/x-www-form-urlencoded; charset=UTF-8", processData: true, async: true, /* timeout: 0, data: null, dataType: null, username: null, password: null, cache: null, throws: false, traditional: false, headers: {}, */ accepts: { xml: "application/xml, text/xml", html: "text/html", text: "text/plain", json: "application/json, text/javascript", "*": allTypes }, contents: { xml: /xml/, html: /html/, json: /json/ }, responseFields: { xml: "responseXML", text: "responseText" }, // List of data converters // 1) key format is "source_type destination_type" (a single space in-between) // 2) the catchall symbol "*" can be used for source_type converters: { // Convert anything to text "* text": window.String, // Text to html (true = no transformation) "text html": true, // Evaluate text as a json expression "text json": jQuery.parseJSON, // Parse text as xml "text xml": jQuery.parseXML }, // For options that shouldn't be deep extended: // you can add your own custom options here if // and when you create one that shouldn't be // deep extended (see ajaxExtend) flatOptions: { context: true, url: true } }, ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), ajaxTransport: addToPrefiltersOrTransports( transports ), // Main method ajax: function( url, options ) { // If url is an object, simulate pre-1.5 signature if ( typeof url === "object" ) { options = url; url = undefined; } // Force options to be an object options = options || {}; var // ifModified key ifModifiedKey, // Response headers responseHeadersString, responseHeaders, // transport transport, // timeout handle timeoutTimer, // Cross-domain detection vars parts, // To know if global events are to be dispatched fireGlobals, // Loop variable i, // Create the final options object s = jQuery.ajaxSetup( {}, options ), // Callbacks context callbackContext = s.context || s, // Context for global events // It's the callbackContext if one was provided in the options // and if it's a DOM node or a jQuery collection globalEventContext = callbackContext !== s && ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? jQuery( callbackContext ) : jQuery.event, // Deferreds deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks( "once memory" ), // Status-dependent callbacks statusCode = s.statusCode || {}, // Headers (they are sent all at once) requestHeaders = {}, requestHeadersNames = {}, // The jqXHR state state = 0, // Default abort message strAbort = "canceled", // Fake xhr jqXHR = { readyState: 0, // Caches the header setRequestHeader: function( name, value ) { if ( !state ) { var lname = name.toLowerCase(); name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; requestHeaders[ name ] = value; } return this; }, // Raw string getAllResponseHeaders: function() { return state === 2 ? responseHeadersString : null; }, // Builds headers hashtable if needed getResponseHeader: function( key ) { var match; if ( state === 2 ) { if ( !responseHeaders ) { responseHeaders = {}; while( ( match = rheaders.exec( responseHeadersString ) ) ) { responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; } } match = responseHeaders[ key.toLowerCase() ]; } return match === undefined ? null : match; }, // Overrides response content-type header overrideMimeType: function( type ) { if ( !state ) { s.mimeType = type; } return this; }, // Cancel the request abort: function( statusText ) { statusText = statusText || strAbort; if ( transport ) { transport.abort( statusText ); } done( 0, statusText ); return this; } }; // Callback for when everything is done // It is defined here because jslint complains if it is declared // at the end of the function (which would be more logical and readable) function done( status, nativeStatusText, responses, headers ) { var isSuccess, success, error, response, modified, statusText = nativeStatusText; // Called once if ( state === 2 ) { return; } // State is "done" now state = 2; // Clear timeout if it exists if ( timeoutTimer ) { clearTimeout( timeoutTimer ); } // Dereference transport for early garbage collection // (no matter how long the jqXHR object will be used) transport = undefined; // Cache response headers responseHeadersString = headers || ""; // Set readyState jqXHR.readyState = status > 0 ? 4 : 0; // Get response data if ( responses ) { response = ajaxHandleResponses( s, jqXHR, responses ); } // If successful, handle type chaining if ( status >= 200 && status < 300 || status === 304 ) { // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { modified = jqXHR.getResponseHeader("Last-Modified"); if ( modified ) { jQuery.lastModified[ ifModifiedKey ] = modified; } modified = jqXHR.getResponseHeader("Etag"); if ( modified ) { jQuery.etag[ ifModifiedKey ] = modified; } } // If not modified if ( status === 304 ) { statusText = "notmodified"; isSuccess = true; // If we have data } else { isSuccess = ajaxConvert( s, response ); statusText = isSuccess.state; success = isSuccess.data; error = isSuccess.error; isSuccess = !error; } } else { // We extract error from statusText // then normalize statusText and status for non-aborts error = statusText; if ( !statusText || status ) { statusText = "error"; if ( status < 0 ) { status = 0; } } } // Set data for the fake xhr object jqXHR.status = status; jqXHR.statusText = ( nativeStatusText || statusText ) + ""; // Success/Error if ( isSuccess ) { deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); } else { deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); } // Status-dependent callbacks jqXHR.statusCode( statusCode ); statusCode = undefined; if ( fireGlobals ) { globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), [ jqXHR, s, isSuccess ? success : error ] ); } // Complete completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); if ( fireGlobals ) { globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); // Handle the global AJAX counter if ( !( --jQuery.active ) ) { jQuery.event.trigger( "ajaxStop" ); } } } // Attach deferreds deferred.promise( jqXHR ); jqXHR.success = jqXHR.done; jqXHR.error = jqXHR.fail; jqXHR.complete = completeDeferred.add; // Status-dependent callbacks jqXHR.statusCode = function( map ) { if ( map ) { var tmp; if ( state < 2 ) { for ( tmp in map ) { statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; } } else { tmp = map[ jqXHR.status ]; jqXHR.always( tmp ); } } return this; }; // Remove hash character (#7531: and string promotion) // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) // We also use the url parameter if available s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); // Extract dataTypes list s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace ); // A cross-domain request is in order when we have a protocol:host:port mismatch if ( s.crossDomain == null ) { parts = rurl.exec( s.url.toLowerCase() ) || false; s.crossDomain = parts && ( parts.join(":") + ( parts[ 3 ] ? "" : parts[ 1 ] === "http:" ? 80 : 443 ) ) !== ( ajaxLocParts.join(":") + ( ajaxLocParts[ 3 ] ? "" : ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ); } // Convert data if not already a string if ( s.data && s.processData && typeof s.data !== "string" ) { s.data = jQuery.param( s.data, s.traditional ); } // Apply prefilters inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); // If request was aborted inside a prefilter, stop there if ( state === 2 ) { return jqXHR; } // We can fire global events as of now if asked to fireGlobals = s.global; // Uppercase the type s.type = s.type.toUpperCase(); // Determine if request has content s.hasContent = !rnoContent.test( s.type ); // Watch for a new set of requests if ( fireGlobals && jQuery.active++ === 0 ) { jQuery.event.trigger( "ajaxStart" ); } // More options handling for requests with no content if ( !s.hasContent ) { // If data is available, append data to url if ( s.data ) { s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; // #9682: remove data so that it's not used in an eventual retry delete s.data; } // Get ifModifiedKey before adding the anti-cache parameter ifModifiedKey = s.url; // Add anti-cache in url if needed if ( s.cache === false ) { var ts = jQuery.now(), // try replacing _= if it is there ret = s.url.replace( rts, "$1_=" + ts ); // if nothing was replaced, add timestamp to the end s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" ); } } // Set the correct header, if data is being sent if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { jqXHR.setRequestHeader( "Content-Type", s.contentType ); } // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. if ( s.ifModified ) { ifModifiedKey = ifModifiedKey || s.url; if ( jQuery.lastModified[ ifModifiedKey ] ) { jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); } if ( jQuery.etag[ ifModifiedKey ] ) { jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); } } // Set the Accepts header for the server, depending on the dataType jqXHR.setRequestHeader( "Accept", s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : s.accepts[ "*" ] ); // Check for headers option for ( i in s.headers ) { jqXHR.setRequestHeader( i, s.headers[ i ] ); } // Allow custom headers/mimetypes and early abort if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { // Abort if not done already and return return jqXHR.abort(); } // aborting is no longer a cancellation strAbort = "abort"; // Install callbacks on deferreds for ( i in { success: 1, error: 1, complete: 1 } ) { jqXHR[ i ]( s[ i ] ); } // Get transport transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); // If no transport, we auto-abort if ( !transport ) { done( -1, "No Transport" ); } else { jqXHR.readyState = 1; // Send global event if ( fireGlobals ) { globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); } // Timeout if ( s.async && s.timeout > 0 ) { timeoutTimer = setTimeout( function(){ jqXHR.abort( "timeout" ); }, s.timeout ); } try { state = 1; transport.send( requestHeaders, done ); } catch (e) { // Propagate exception as error if not done if ( state < 2 ) { done( -1, e ); // Simply rethrow otherwise } else { throw e; } } } return jqXHR; }, // Counter for holding the number of active queries active: 0, // Last-Modified header cache for next request lastModified: {}, etag: {} }); /* Handles responses to an ajax request: * - sets all responseXXX fields accordingly * - finds the right dataType (mediates between content-type and expected dataType) * - returns the corresponding response */ function ajaxHandleResponses( s, jqXHR, responses ) { var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes, responseFields = s.responseFields; // Fill responseXXX fields for ( type in responseFields ) { if ( type in responses ) { jqXHR[ responseFields[type] ] = responses[ type ]; } } // Remove auto dataType and get content-type in the process while( dataTypes[ 0 ] === "*" ) { dataTypes.shift(); if ( ct === undefined ) { ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); } } // Check if we're dealing with a known content-type if ( ct ) { for ( type in contents ) { if ( contents[ type ] && contents[ type ].test( ct ) ) { dataTypes.unshift( type ); break; } } } // Check to see if we have a response for the expected dataType if ( dataTypes[ 0 ] in responses ) { finalDataType = dataTypes[ 0 ]; } else { // Try convertible dataTypes for ( type in responses ) { if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { finalDataType = type; break; } if ( !firstDataType ) { firstDataType = type; } } // Or just use first one finalDataType = finalDataType || firstDataType; } // If we found a dataType // We add the dataType to the list if needed // and return the corresponding response if ( finalDataType ) { if ( finalDataType !== dataTypes[ 0 ] ) { dataTypes.unshift( finalDataType ); } return responses[ finalDataType ]; } } // Chain conversions given the request and the original response function ajaxConvert( s, response ) { var conv, conv2, current, tmp, // Work with a copy of dataTypes in case we need to modify it for conversion dataTypes = s.dataTypes.slice(), prev = dataTypes[ 0 ], converters = {}, i = 0; // Apply the dataFilter if provided if ( s.dataFilter ) { response = s.dataFilter( response, s.dataType ); } // Create converters map with lowercased keys if ( dataTypes[ 1 ] ) { for ( conv in s.converters ) { converters[ conv.toLowerCase() ] = s.converters[ conv ]; } } // Convert to each sequential dataType, tolerating list modification for ( ; (current = dataTypes[++i]); ) { // There's only work to do if current dataType is non-auto if ( current !== "*" ) { // Convert response if prev dataType is non-auto and differs from current if ( prev !== "*" && prev !== current ) { // Seek a direct converter conv = converters[ prev + " " + current ] || converters[ "* " + current ]; // If none found, seek a pair if ( !conv ) { for ( conv2 in converters ) { // If conv2 outputs current tmp = conv2.split(" "); if ( tmp[ 1 ] === current ) { // If prev can be converted to accepted input conv = converters[ prev + " " + tmp[ 0 ] ] || converters[ "* " + tmp[ 0 ] ]; if ( conv ) { // Condense equivalence converters if ( conv === true ) { conv = converters[ conv2 ]; // Otherwise, insert the intermediate dataType } else if ( converters[ conv2 ] !== true ) { current = tmp[ 0 ]; dataTypes.splice( i--, 0, current ); } break; } } } } // Apply converter (if not an equivalence) if ( conv !== true ) { // Unless errors are allowed to bubble, catch and return them if ( conv && s["throws"] ) { response = conv( response ); } else { try { response = conv( response ); } catch ( e ) { return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; } } } } // Update prev for next iteration prev = current; } } return { state: "success", data: response }; } var oldCallbacks = [], rquestion = /\?/, rjsonp = /(=)\?(?=&|$)|\?\?/, nonce = jQuery.now(); // Default jsonp settings jQuery.ajaxSetup({ jsonp: "callback", jsonpCallback: function() { var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); this[ callback ] = true; return callback; } }); // Detect, normalize options and install callbacks for jsonp requests jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { var callbackName, overwritten, responseContainer, data = s.data, url = s.url, hasCallback = s.jsonp !== false, replaceInUrl = hasCallback && rjsonp.test( url ), replaceInData = hasCallback && !replaceInUrl && typeof data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( data ); // Handle iff the expected data type is "jsonp" or we have a parameter to set if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) { // Get callback name, remembering preexisting value associated with it callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback; overwritten = window[ callbackName ]; // Insert callback into url or form data if ( replaceInUrl ) { s.url = url.replace( rjsonp, "$1" + callbackName ); } else if ( replaceInData ) { s.data = data.replace( rjsonp, "$1" + callbackName ); } else if ( hasCallback ) { s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; } // Use data converter to retrieve json after script execution s.converters["script json"] = function() { if ( !responseContainer ) { jQuery.error( callbackName + " was not called" ); } return responseContainer[ 0 ]; }; // force json dataType s.dataTypes[ 0 ] = "json"; // Install callback window[ callbackName ] = function() { responseContainer = arguments; }; // Clean-up function (fires after converters) jqXHR.always(function() { // Restore preexisting value window[ callbackName ] = overwritten; // Save back as free if ( s[ callbackName ] ) { // make sure that re-using the options doesn't screw things around s.jsonpCallback = originalSettings.jsonpCallback; // save the callback name for future use oldCallbacks.push( callbackName ); } // Call if it was a function and we have a response if ( responseContainer && jQuery.isFunction( overwritten ) ) { overwritten( responseContainer[ 0 ] ); } responseContainer = overwritten = undefined; }); // Delegate to script return "script"; } }); // Install script dataType jQuery.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /javascript|ecmascript/ }, converters: { "text script": function( text ) { jQuery.globalEval( text ); return text; } } }); // Handle cache's special case and global jQuery.ajaxPrefilter( "script", function( s ) { if ( s.cache === undefined ) { s.cache = false; } if ( s.crossDomain ) { s.type = "GET"; s.global = false; } }); // Bind script tag hack transport jQuery.ajaxTransport( "script", function(s) { // This transport only deals with cross domain requests if ( s.crossDomain ) { var script, head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; return { send: function( _, callback ) { script = document.createElement( "script" ); script.async = "async"; if ( s.scriptCharset ) { script.charset = s.scriptCharset; } script.src = s.url; // Attach handlers for all browsers script.onload = script.onreadystatechange = function( _, isAbort ) { if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { // Handle memory leak in IE script.onload = script.onreadystatechange = null; // Remove the script if ( head && script.parentNode ) { head.removeChild( script ); } // Dereference the script script = undefined; // Callback if not abort if ( !isAbort ) { callback( 200, "success" ); } } }; // Use insertBefore instead of appendChild to circumvent an IE6 bug. // This arises when a base node is used (#2709 and #4378). head.insertBefore( script, head.firstChild ); }, abort: function() { if ( script ) { script.onload( 0, 1 ); } } }; } }); var xhrCallbacks, // #5280: Internet Explorer will keep connections alive if we don't abort on unload xhrOnUnloadAbort = window.ActiveXObject ? function() { // Abort all pending requests for ( var key in xhrCallbacks ) { xhrCallbacks[ key ]( 0, 1 ); } } : false, xhrId = 0; // Functions to create xhrs function createStandardXHR() { try { return new window.XMLHttpRequest(); } catch( e ) {} } function createActiveXHR() { try { return new window.ActiveXObject( "Microsoft.XMLHTTP" ); } catch( e ) {} } // Create the request object // (This is still attached to ajaxSettings for backward compatibility) jQuery.ajaxSettings.xhr = window.ActiveXObject ? /* Microsoft failed to properly * implement the XMLHttpRequest in IE7 (can't request local files), * so we use the ActiveXObject when it is available * Additionally XMLHttpRequest can be disabled in IE7/IE8 so * we need a fallback. */ function() { return !this.isLocal && createStandardXHR() || createActiveXHR(); } : // For all other browsers, use the standard XMLHttpRequest object createStandardXHR; // Determine support properties (function( xhr ) { jQuery.extend( jQuery.support, { ajax: !!xhr, cors: !!xhr && ( "withCredentials" in xhr ) }); })( jQuery.ajaxSettings.xhr() ); // Create transport if the browser can provide an xhr if ( jQuery.support.ajax ) { jQuery.ajaxTransport(function( s ) { // Cross domain only allowed if supported through XMLHttpRequest if ( !s.crossDomain || jQuery.support.cors ) { var callback; return { send: function( headers, complete ) { // Get a new xhr var handle, i, xhr = s.xhr(); // Open the socket // Passing null username, generates a login popup on Opera (#2865) if ( s.username ) { xhr.open( s.type, s.url, s.async, s.username, s.password ); } else { xhr.open( s.type, s.url, s.async ); } // Apply custom fields if provided if ( s.xhrFields ) { for ( i in s.xhrFields ) { xhr[ i ] = s.xhrFields[ i ]; } } // Override mime type if needed if ( s.mimeType && xhr.overrideMimeType ) { xhr.overrideMimeType( s.mimeType ); } // X-Requested-With header // For cross-domain requests, seeing as conditions for a preflight are // akin to a jigsaw puzzle, we simply never set it to be sure. // (it can always be set on a per-request basis or even using ajaxSetup) // For same-domain requests, won't change header if already provided. if ( !s.crossDomain && !headers["X-Requested-With"] ) { headers[ "X-Requested-With" ] = "XMLHttpRequest"; } // Need an extra try/catch for cross domain requests in Firefox 3 try { for ( i in headers ) { xhr.setRequestHeader( i, headers[ i ] ); } } catch( _ ) {} // Do send the request // This may raise an exception which is actually // handled in jQuery.ajax (so no try/catch here) xhr.send( ( s.hasContent && s.data ) || null ); // Listener callback = function( _, isAbort ) { var status, statusText, responseHeaders, responses, xml; // Firefox throws exceptions when accessing properties // of an xhr when a network error occurred // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) try { // Was never called and is aborted or complete if ( callback && ( isAbort || xhr.readyState === 4 ) ) { // Only called once callback = undefined; // Do not keep as active anymore if ( handle ) { xhr.onreadystatechange = jQuery.noop; if ( xhrOnUnloadAbort ) { delete xhrCallbacks[ handle ]; } } // If it's an abort if ( isAbort ) { // Abort it manually if needed if ( xhr.readyState !== 4 ) { xhr.abort(); } } else { status = xhr.status; responseHeaders = xhr.getAllResponseHeaders(); responses = {}; xml = xhr.responseXML; // Construct response list if ( xml && xml.documentElement /* #4958 */ ) { responses.xml = xml; } // When requesting binary data, IE6-9 will throw an exception // on any attempt to access responseText (#11426) try { responses.text = xhr.responseText; } catch( _ ) { } // Firefox throws an exception when accessing // statusText for faulty cross-domain requests try { statusText = xhr.statusText; } catch( e ) { // We normalize with Webkit giving an empty statusText statusText = ""; } // Filter status for non standard behaviors // If the request is local and we have data: assume a success // (success with no data won't get notified, that's the best we // can do given current implementations) if ( !status && s.isLocal && !s.crossDomain ) { status = responses.text ? 200 : 404; // IE - #1450: sometimes returns 1223 when it should be 204 } else if ( status === 1223 ) { status = 204; } } } } catch( firefoxAccessException ) { if ( !isAbort ) { complete( -1, firefoxAccessException ); } } // Call complete if needed if ( responses ) { complete( status, statusText, responses, responseHeaders ); } }; if ( !s.async ) { // if we're in sync mode we fire the callback callback(); } else if ( xhr.readyState === 4 ) { // (IE6 & IE7) if it's in cache and has been // retrieved directly we need to fire the callback setTimeout( callback, 0 ); } else { handle = ++xhrId; if ( xhrOnUnloadAbort ) { // Create the active xhrs callbacks list if needed // and attach the unload handler if ( !xhrCallbacks ) { xhrCallbacks = {}; jQuery( window ).unload( xhrOnUnloadAbort ); } // Add to list of active xhrs callbacks xhrCallbacks[ handle ] = callback; } xhr.onreadystatechange = callback; } }, abort: function() { if ( callback ) { callback(0,1); } } }; } }); } var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), rrun = /queueHooks$/, animationPrefilters = [ defaultPrefilter ], tweeners = { "*": [function( prop, value ) { var end, unit, tween = this.createTween( prop, value ), parts = rfxnum.exec( value ), target = tween.cur(), start = +target || 0, scale = 1, maxIterations = 20; if ( parts ) { end = +parts[2]; unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); // We need to compute starting value if ( unit !== "px" && start ) { // Iteratively approximate from a nonzero starting point // Prefer the current property, because this process will be trivial if it uses the same units // Fallback to end or a simple constant start = jQuery.css( tween.elem, prop, true ) || end || 1; do { // If previous iteration zeroed out, double until we get *something* // Use a string for doubling factor so we don't accidentally see scale as unchanged below scale = scale || ".5"; // Adjust and apply start = start / scale; jQuery.style( tween.elem, prop, start + unit ); // Update scale, tolerating zero or NaN from tween.cur() // And breaking the loop if scale is unchanged or perfect, or if we've just had enough } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); } tween.unit = unit; tween.start = start; // If a +=/-= token was provided, we're doing a relative animation tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; } return tween; }] }; // Animations created synchronously will run synchronously function createFxNow() { setTimeout(function() { fxNow = undefined; }, 0 ); return ( fxNow = jQuery.now() ); } function createTweens( animation, props ) { jQuery.each( props, function( prop, value ) { var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), index = 0, length = collection.length; for ( ; index < length; index++ ) { if ( collection[ index ].call( animation, prop, value ) ) { // we're done with this property return; } } }); } function Animation( elem, properties, options ) { var result, index = 0, tweenerIndex = 0, length = animationPrefilters.length, deferred = jQuery.Deferred().always( function() { // don't match elem in the :animated selector delete tick.elem; }), tick = function() { var currentTime = fxNow || createFxNow(), remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), percent = 1 - ( remaining / animation.duration || 0 ), index = 0, length = animation.tweens.length; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( percent ); } deferred.notifyWith( elem, [ animation, percent, remaining ]); if ( percent < 1 && length ) { return remaining; } else { deferred.resolveWith( elem, [ animation ] ); return false; } }, animation = deferred.promise({ elem: elem, props: jQuery.extend( {}, properties ), opts: jQuery.extend( true, { specialEasing: {} }, options ), originalProperties: properties, originalOptions: options, startTime: fxNow || createFxNow(), duration: options.duration, tweens: [], createTween: function( prop, end, easing ) { var tween = jQuery.Tween( elem, animation.opts, prop, end, animation.opts.specialEasing[ prop ] || animation.opts.easing ); animation.tweens.push( tween ); return tween; }, stop: function( gotoEnd ) { var index = 0, // if we are going to the end, we want to run all the tweens // otherwise we skip this part length = gotoEnd ? animation.tweens.length : 0; for ( ; index < length ; index++ ) { animation.tweens[ index ].run( 1 ); } // resolve when we played the last frame // otherwise, reject if ( gotoEnd ) { deferred.resolveWith( elem, [ animation, gotoEnd ] ); } else { deferred.rejectWith( elem, [ animation, gotoEnd ] ); } return this; } }), props = animation.props; propFilter( props, animation.opts.specialEasing ); for ( ; index < length ; index++ ) { result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); if ( result ) { return result; } } createTweens( animation, props ); if ( jQuery.isFunction( animation.opts.start ) ) { animation.opts.start.call( elem, animation ); } jQuery.fx.timer( jQuery.extend( tick, { anim: animation, queue: animation.opts.queue, elem: elem }) ); // attach callbacks from options return animation.progress( animation.opts.progress ) .done( animation.opts.done, animation.opts.complete ) .fail( animation.opts.fail ) .always( animation.opts.always ); } function propFilter( props, specialEasing ) { var index, name, easing, value, hooks; // camelCase, specialEasing and expand cssHook pass for ( index in props ) { name = jQuery.camelCase( index ); easing = specialEasing[ name ]; value = props[ index ]; if ( jQuery.isArray( value ) ) { easing = value[ 1 ]; value = props[ index ] = value[ 0 ]; } if ( index !== name ) { props[ name ] = value; delete props[ index ]; } hooks = jQuery.cssHooks[ name ]; if ( hooks && "expand" in hooks ) { value = hooks.expand( value ); delete props[ name ]; // not quite $.extend, this wont overwrite keys already present. // also - reusing 'index' from above because we have the correct "name" for ( index in value ) { if ( !( index in props ) ) { props[ index ] = value[ index ]; specialEasing[ index ] = easing; } } } else { specialEasing[ name ] = easing; } } } jQuery.Animation = jQuery.extend( Animation, { tweener: function( props, callback ) { if ( jQuery.isFunction( props ) ) { callback = props; props = [ "*" ]; } else { props = props.split(" "); } var prop, index = 0, length = props.length; for ( ; index < length ; index++ ) { prop = props[ index ]; tweeners[ prop ] = tweeners[ prop ] || []; tweeners[ prop ].unshift( callback ); } }, prefilter: function( callback, prepend ) { if ( prepend ) { animationPrefilters.unshift( callback ); } else { animationPrefilters.push( callback ); } } }); function defaultPrefilter( elem, props, opts ) { var index, prop, value, length, dataShow, tween, hooks, oldfire, anim = this, style = elem.style, orig = {}, handled = [], hidden = elem.nodeType && isHidden( elem ); // handle queue: false promises if ( !opts.queue ) { hooks = jQuery._queueHooks( elem, "fx" ); if ( hooks.unqueued == null ) { hooks.unqueued = 0; oldfire = hooks.empty.fire; hooks.empty.fire = function() { if ( !hooks.unqueued ) { oldfire(); } }; } hooks.unqueued++; anim.always(function() { // doing this makes sure that the complete handler will be called // before this completes anim.always(function() { hooks.unqueued--; if ( !jQuery.queue( elem, "fx" ).length ) { hooks.empty.fire(); } }); }); } // height/width overflow pass if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { // Make sure that nothing sneaks out // Record all 3 overflow attributes because IE does not // change the overflow attribute when overflowX and // overflowY are set to the same value opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; // Set display property to inline-block for height/width // animations on inline elements that are having width/height animated if ( jQuery.css( elem, "display" ) === "inline" && jQuery.css( elem, "float" ) === "none" ) { // inline-level elements accept inline-block; // block-level elements need to be inline with layout if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { style.display = "inline-block"; } else { style.zoom = 1; } } } if ( opts.overflow ) { style.overflow = "hidden"; if ( !jQuery.support.shrinkWrapBlocks ) { anim.done(function() { style.overflow = opts.overflow[ 0 ]; style.overflowX = opts.overflow[ 1 ]; style.overflowY = opts.overflow[ 2 ]; }); } } // show/hide pass for ( index in props ) { value = props[ index ]; if ( rfxtypes.exec( value ) ) { delete props[ index ]; if ( value === ( hidden ? "hide" : "show" ) ) { continue; } handled.push( index ); } } length = handled.length; if ( length ) { dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); if ( hidden ) { jQuery( elem ).show(); } else { anim.done(function() { jQuery( elem ).hide(); }); } anim.done(function() { var prop; jQuery.removeData( elem, "fxshow", true ); for ( prop in orig ) { jQuery.style( elem, prop, orig[ prop ] ); } }); for ( index = 0 ; index < length ; index++ ) { prop = handled[ index ]; tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); if ( !( prop in dataShow ) ) { dataShow[ prop ] = tween.start; if ( hidden ) { tween.end = tween.start; tween.start = prop === "width" || prop === "height" ? 1 : 0; } } } } } function Tween( elem, options, prop, end, easing ) { return new Tween.prototype.init( elem, options, prop, end, easing ); } jQuery.Tween = Tween; Tween.prototype = { constructor: Tween, init: function( elem, options, prop, end, easing, unit ) { this.elem = elem; this.prop = prop; this.easing = easing || "swing"; this.options = options; this.start = this.now = this.cur(); this.end = end; this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); }, cur: function() { var hooks = Tween.propHooks[ this.prop ]; return hooks && hooks.get ? hooks.get( this ) : Tween.propHooks._default.get( this ); }, run: function( percent ) { var eased, hooks = Tween.propHooks[ this.prop ]; if ( this.options.duration ) { this.pos = eased = jQuery.easing[ this.easing ]( percent, this.options.duration * percent, 0, 1, this.options.duration ); } else { this.pos = eased = percent; } this.now = ( this.end - this.start ) * eased + this.start; if ( this.options.step ) { this.options.step.call( this.elem, this.now, this ); } if ( hooks && hooks.set ) { hooks.set( this ); } else { Tween.propHooks._default.set( this ); } return this; } }; Tween.prototype.init.prototype = Tween.prototype; Tween.propHooks = { _default: { get: function( tween ) { var result; if ( tween.elem[ tween.prop ] != null && (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { return tween.elem[ tween.prop ]; } // passing any value as a 4th parameter to .css will automatically // attempt a parseFloat and fallback to a string if the parse fails // so, simple values such as "10px" are parsed to Float. // complex values such as "rotate(1rad)" are returned as is. result = jQuery.css( tween.elem, tween.prop, false, "" ); // Empty strings, null, undefined and "auto" are converted to 0. return !result || result === "auto" ? 0 : result; }, set: function( tween ) { // use step hook for back compat - use cssHook if its there - use .style if its // available and use plain properties where available if ( jQuery.fx.step[ tween.prop ] ) { jQuery.fx.step[ tween.prop ]( tween ); } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); } else { tween.elem[ tween.prop ] = tween.now; } } } }; // Remove in 2.0 - this supports IE8's panic based approach // to setting things on disconnected nodes Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { set: function( tween ) { if ( tween.elem.nodeType && tween.elem.parentNode ) { tween.elem[ tween.prop ] = tween.now; } } }; jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { var cssFn = jQuery.fn[ name ]; jQuery.fn[ name ] = function( speed, easing, callback ) { return speed == null || typeof speed === "boolean" || // special check for .toggle( handler, handler, ... ) ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ? cssFn.apply( this, arguments ) : this.animate( genFx( name, true ), speed, easing, callback ); }; }); jQuery.fn.extend({ fadeTo: function( speed, to, easing, callback ) { // show any hidden elements after setting opacity to 0 return this.filter( isHidden ).css( "opacity", 0 ).show() // animate to the value specified .end().animate({ opacity: to }, speed, easing, callback ); }, animate: function( prop, speed, easing, callback ) { var empty = jQuery.isEmptyObject( prop ), optall = jQuery.speed( speed, easing, callback ), doAnimation = function() { // Operate on a copy of prop so per-property easing won't be lost var anim = Animation( this, jQuery.extend( {}, prop ), optall ); // Empty animations resolve immediately if ( empty ) { anim.stop( true ); } }; return empty || optall.queue === false ? this.each( doAnimation ) : this.queue( optall.queue, doAnimation ); }, stop: function( type, clearQueue, gotoEnd ) { var stopQueue = function( hooks ) { var stop = hooks.stop; delete hooks.stop; stop( gotoEnd ); }; if ( typeof type !== "string" ) { gotoEnd = clearQueue; clearQueue = type; type = undefined; } if ( clearQueue && type !== false ) { this.queue( type || "fx", [] ); } return this.each(function() { var dequeue = true, index = type != null && type + "queueHooks", timers = jQuery.timers, data = jQuery._data( this ); if ( index ) { if ( data[ index ] && data[ index ].stop ) { stopQueue( data[ index ] ); } } else { for ( index in data ) { if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { stopQueue( data[ index ] ); } } } for ( index = timers.length; index--; ) { if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { timers[ index ].anim.stop( gotoEnd ); dequeue = false; timers.splice( index, 1 ); } } // start the next in the queue if the last step wasn't forced // timers currently will call their complete callbacks, which will dequeue // but only if they were gotoEnd if ( dequeue || !gotoEnd ) { jQuery.dequeue( this, type ); } }); } }); // Generate parameters to create a standard animation function genFx( type, includeWidth ) { var which, attrs = { height: type }, i = 0; // if we include width, step value is 1 to do all cssExpand values, // if we don't include width, step value is 2 to skip over Left and Right includeWidth = includeWidth? 1 : 0; for( ; i < 4 ; i += 2 - includeWidth ) { which = cssExpand[ i ]; attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; } if ( includeWidth ) { attrs.opacity = attrs.width = type; } return attrs; } // Generate shortcuts for custom animations jQuery.each({ slideDown: genFx("show"), slideUp: genFx("hide"), slideToggle: genFx("toggle"), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle" } }, function( name, props ) { jQuery.fn[ name ] = function( speed, easing, callback ) { return this.animate( props, speed, easing, callback ); }; }); jQuery.speed = function( speed, easing, fn ) { var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { complete: fn || !fn && easing || jQuery.isFunction( speed ) && speed, duration: speed, easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing }; opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; // normalize opt.queue - true/undefined/null -> "fx" if ( opt.queue == null || opt.queue === true ) { opt.queue = "fx"; } // Queueing opt.old = opt.complete; opt.complete = function() { if ( jQuery.isFunction( opt.old ) ) { opt.old.call( this ); } if ( opt.queue ) { jQuery.dequeue( this, opt.queue ); } }; return opt; }; jQuery.easing = { linear: function( p ) { return p; }, swing: function( p ) { return 0.5 - Math.cos( p*Math.PI ) / 2; } }; jQuery.timers = []; jQuery.fx = Tween.prototype.init; jQuery.fx.tick = function() { var timer, timers = jQuery.timers, i = 0; for ( ; i < timers.length; i++ ) { timer = timers[ i ]; // Checks the timer has not already been removed if ( !timer() && timers[ i ] === timer ) { timers.splice( i--, 1 ); } } if ( !timers.length ) { jQuery.fx.stop(); } }; jQuery.fx.timer = function( timer ) { if ( timer() && jQuery.timers.push( timer ) && !timerId ) { timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); } }; jQuery.fx.interval = 13; jQuery.fx.stop = function() { clearInterval( timerId ); timerId = null; }; jQuery.fx.speeds = { slow: 600, fast: 200, // Default speed _default: 400 }; // Back Compat <1.8 extension point jQuery.fx.step = {}; if ( jQuery.expr && jQuery.expr.filters ) { jQuery.expr.filters.animated = function( elem ) { return jQuery.grep(jQuery.timers, function( fn ) { return elem === fn.elem; }).length; }; } var rroot = /^(?:body|html)$/i; jQuery.fn.offset = function( options ) { if ( arguments.length ) { return options === undefined ? this : this.each(function( i ) { jQuery.offset.setOffset( this, options, i ); }); } var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft, box = { top: 0, left: 0 }, elem = this[ 0 ], doc = elem && elem.ownerDocument; if ( !doc ) { return; } if ( (body = doc.body) === elem ) { return jQuery.offset.bodyOffset( elem ); } docElem = doc.documentElement; // Make sure it's not a disconnected DOM node if ( !jQuery.contains( docElem, elem ) ) { return box; } // If we don't have gBCR, just use 0,0 rather than error // BlackBerry 5, iOS 3 (original iPhone) if ( typeof elem.getBoundingClientRect !== "undefined" ) { box = elem.getBoundingClientRect(); } win = getWindow( doc ); clientTop = docElem.clientTop || body.clientTop || 0; clientLeft = docElem.clientLeft || body.clientLeft || 0; scrollTop = win.pageYOffset || docElem.scrollTop; scrollLeft = win.pageXOffset || docElem.scrollLeft; return { top: box.top + scrollTop - clientTop, left: box.left + scrollLeft - clientLeft }; }; jQuery.offset = { bodyOffset: function( body ) { var top = body.offsetTop, left = body.offsetLeft; if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) { top += parseFloat( jQuery.css(body, "marginTop") ) || 0; left += parseFloat( jQuery.css(body, "marginLeft") ) || 0; } return { top: top, left: left }; }, setOffset: function( elem, options, i ) { var position = jQuery.css( elem, "position" ); // set position first, in-case top/left are set even on static elem if ( position === "static" ) { elem.style.position = "relative"; } var curElem = jQuery( elem ), curOffset = curElem.offset(), curCSSTop = jQuery.css( elem, "top" ), curCSSLeft = jQuery.css( elem, "left" ), calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, props = {}, curPosition = {}, curTop, curLeft; // need to be able to calculate position if either top or left is auto and position is either absolute or fixed if ( calculatePosition ) { curPosition = curElem.position(); curTop = curPosition.top; curLeft = curPosition.left; } else { curTop = parseFloat( curCSSTop ) || 0; curLeft = parseFloat( curCSSLeft ) || 0; } if ( jQuery.isFunction( options ) ) { options = options.call( elem, i, curOffset ); } if ( options.top != null ) { props.top = ( options.top - curOffset.top ) + curTop; } if ( options.left != null ) { props.left = ( options.left - curOffset.left ) + curLeft; } if ( "using" in options ) { options.using.call( elem, props ); } else { curElem.css( props ); } } }; jQuery.fn.extend({ position: function() { if ( !this[0] ) { return; } var elem = this[0], // Get *real* offsetParent offsetParent = this.offsetParent(), // Get correct offsets offset = this.offset(), parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset(); // Subtract element margins // note: when an element has margin: auto the offsetLeft and marginLeft // are the same in Safari causing offset.left to incorrectly be 0 offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0; offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0; // Add offsetParent borders parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0; parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0; // Subtract the two offsets return { top: offset.top - parentOffset.top, left: offset.left - parentOffset.left }; }, offsetParent: function() { return this.map(function() { var offsetParent = this.offsetParent || document.body; while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) { offsetParent = offsetParent.offsetParent; } return offsetParent || document.body; }); } }); // Create scrollLeft and scrollTop methods jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { var top = /Y/.test( prop ); jQuery.fn[ method ] = function( val ) { return jQuery.access( this, function( elem, method, val ) { var win = getWindow( elem ); if ( val === undefined ) { return win ? (prop in win) ? win[ prop ] : win.document.documentElement[ method ] : elem[ method ]; } if ( win ) { win.scrollTo( !top ? val : jQuery( win ).scrollLeft(), top ? val : jQuery( win ).scrollTop() ); } else { elem[ method ] = val; } }, method, val, arguments.length, null ); }; }); function getWindow( elem ) { return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 ? elem.defaultView || elem.parentWindow : false; } // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { // margin is only for outerHeight, outerWidth jQuery.fn[ funcName ] = function( margin, value ) { var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); return jQuery.access( this, function( elem, type, value ) { var doc; if ( jQuery.isWindow( elem ) ) { // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there // isn't a whole lot we can do. See pull request at this URL for discussion: // https://github.com/jquery/jquery/pull/764 return elem.document.documentElement[ "client" + name ]; } // Get document width or height if ( elem.nodeType === 9 ) { doc = elem.documentElement; // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. return Math.max( elem.body[ "scroll" + name ], doc[ "scroll" + name ], elem.body[ "offset" + name ], doc[ "offset" + name ], doc[ "client" + name ] ); } return value === undefined ? // Get width or height on the element, requesting but not forcing parseFloat jQuery.css( elem, type, value, extra ) : // Set width or height on the element jQuery.style( elem, type, value, extra ); }, type, chainable ? margin : undefined, chainable, null ); }; }); }); // Expose jQuery to the global object window.jQuery = window.$ = jQuery; // Expose jQuery as an AMD module, but only for AMD loaders that // understand the issues with loading multiple versions of jQuery // in a page that all might call define(). The loader will indicate // they have special allowances for multiple jQuery versions by // specifying define.amd.jQuery = true. Register as a named module, // since jQuery can be concatenated with other files that may use define, // but not use a proper concatenation script that understands anonymous // AMD modules. A named AMD is safest and most robust way to register. // Lowercase jquery is used because AMD module names are derived from // file names, and jQuery is normally delivered in a lowercase file name. // Do this after creating the global so that if an AMD module wants to call // noConflict to hide this version of jQuery, it will work. if ( typeof define === "function" && define.amd && define.amd.jQuery ) { define( "jquery", [], function () { return jQuery; } ); } })( window ); /** * @license AngularJS v1.1.5 * (c) 2010-2012 Google, Inc. http://angularjs.org * License: MIT */ (function(window, document){ var _jQuery = window.jQuery.noConflict(true); //////////////////////////////////// /** * @ngdoc function * @name angular.lowercase * @function * * @description Converts the specified string to lowercase. * @param {string} string String to be converted to lowercase. * @returns {string} Lowercased string. */ var lowercase = function(string){return isString(string) ? string.toLowerCase() : string;}; /** * @ngdoc function * @name angular.uppercase * @function * * @description Converts the specified string to uppercase. * @param {string} string String to be converted to uppercase. * @returns {string} Uppercased string. */ var uppercase = function(string){return isString(string) ? string.toUpperCase() : string;}; var manualLowercase = function(s) { return isString(s) ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);}) : s; }; var manualUppercase = function(s) { return isString(s) ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);}) : s; }; // String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish // locale, for this reason we need to detect this case and redefine lowercase/uppercase methods // with correct but slower alternatives. if ('i' !== 'I'.toLowerCase()) { lowercase = manualLowercase; uppercase = manualUppercase; } var /** holds major version number for IE or NaN for real browsers */ msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]), jqLite, // delay binding since jQuery could be loaded after us. jQuery, // delay binding slice = [].slice, push = [].push, toString = Object.prototype.toString, _angular = window.angular, /** @name angular */ angular = window.angular || (window.angular = {}), angularModule, nodeName_, uid = ['0', '0', '0']; /** * @ngdoc function * @name angular.noConflict * @function * * @description * Restores the previous global value of angular and returns the current instance. Other libraries may already use the * angular namespace. Or a previous version of angular is already loaded on the page. In these cases you may want to * restore the previous namespace and keep a reference to angular. * * @return {Object} The current angular namespace */ function noConflict() { var a = window.angular; window.angular = _angular; return a; } /** * @private * @param {*} obj * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments, ...) */ function isArrayLike(obj) { if (!obj || (typeof obj.length !== 'number')) return false; // We have on object which has length property. Should we treat it as array? if (typeof obj.hasOwnProperty != 'function' && typeof obj.constructor != 'function') { // This is here for IE8: it is a bogus object treat it as array; return true; } else { return obj instanceof JQLite || // JQLite (jQuery && obj instanceof jQuery) || // jQuery toString.call(obj) !== '[object Object]' || // some browser native object typeof obj.callee === 'function'; // arguments (on IE8 looks like regular obj) } } /** * @ngdoc function * @name angular.forEach * @function * * @description * Invokes the `iterator` function once for each item in `obj` collection, which can be either an * object or an array. The `iterator` function is invoked with `iterator(value, key)`, where `value` * is the value of an object property or an array element and `key` is the object property key or * array element index. Specifying a `context` for the function is optional. * * Note: this function was previously known as `angular.foreach`. * <pre> var values = {name: 'misko', gender: 'male'}; var log = []; angular.forEach(values, function(value, key){ this.push(key + ': ' + value); }, log); expect(log).toEqual(['name: misko', 'gender:male']); </pre> * * @param {Object|Array} obj Object to iterate over. * @param {Function} iterator Iterator function. * @param {Object=} context Object to become context (`this`) for the iterator function. * @returns {Object|Array} Reference to `obj`. */ function forEach(obj, iterator, context) { var key; if (obj) { if (isFunction(obj)){ for (key in obj) { if (key != 'prototype' && key != 'length' && key != 'name' && obj.hasOwnProperty(key)) { iterator.call(context, obj[key], key); } } } else if (obj.forEach && obj.forEach !== forEach) { obj.forEach(iterator, context); } else if (isArrayLike(obj)) { for (key = 0; key < obj.length; key++) iterator.call(context, obj[key], key); } else { for (key in obj) { if (obj.hasOwnProperty(key)) { iterator.call(context, obj[key], key); } } } } return obj; } function sortedKeys(obj) { var keys = []; for (var key in obj) { if (obj.hasOwnProperty(key)) { keys.push(key); } } return keys.sort(); } function forEachSorted(obj, iterator, context) { var keys = sortedKeys(obj); for ( var i = 0; i < keys.length; i++) { iterator.call(context, obj[keys[i]], keys[i]); } return keys; } /** * when using forEach the params are value, key, but it is often useful to have key, value. * @param {function(string, *)} iteratorFn * @returns {function(*, string)} */ function reverseParams(iteratorFn) { return function(value, key) { iteratorFn(key, value) }; } /** * A consistent way of creating unique IDs in angular. The ID is a sequence of alpha numeric * characters such as '012ABC'. The reason why we are not using simply a number counter is that * the number string gets longer over time, and it can also overflow, where as the nextId * will grow much slower, it is a string, and it will never overflow. * * @returns an unique alpha-numeric string */ function nextUid() { var index = uid.length; var digit; while(index) { index--; digit = uid[index].charCodeAt(0); if (digit == 57 /*'9'*/) { uid[index] = 'A'; return uid.join(''); } if (digit == 90 /*'Z'*/) { uid[index] = '0'; } else { uid[index] = String.fromCharCode(digit + 1); return uid.join(''); } } uid.unshift('0'); return uid.join(''); } /** * Set or clear the hashkey for an object. * @param obj object * @param h the hashkey (!truthy to delete the hashkey) */ function setHashKey(obj, h) { if (h) { obj.$$hashKey = h; } else { delete obj.$$hashKey; } } /** * @ngdoc function * @name angular.extend * @function * * @description * Extends the destination object `dst` by copying all of the properties from the `src` object(s) * to `dst`. You can specify multiple `src` objects. * * @param {Object} dst Destination object. * @param {...Object} src Source object(s). * @returns {Object} Reference to `dst`. */ function extend(dst) { var h = dst.$$hashKey; forEach(arguments, function(obj){ if (obj !== dst) { forEach(obj, function(value, key){ dst[key] = value; }); } }); setHashKey(dst,h); return dst; } function int(str) { return parseInt(str, 10); } function inherit(parent, extra) { return extend(new (extend(function() {}, {prototype:parent}))(), extra); } var START_SPACE = /^\s*/; var END_SPACE = /\s*$/; function stripWhitespace(str) { return isString(str) ? str.replace(START_SPACE, '').replace(END_SPACE, '') : str; } /** * @ngdoc function * @name angular.noop * @function * * @description * A function that performs no operations. This function can be useful when writing code in the * functional style. <pre> function foo(callback) { var result = calculateResult(); (callback || angular.noop)(result); } </pre> */ function noop() {} noop.$inject = []; /** * @ngdoc function * @name angular.identity * @function * * @description * A function that returns its first argument. This function is useful when writing code in the * functional style. * <pre> function transformer(transformationFn, value) { return (transformationFn || identity)(value); }; </pre> */ function identity($) {return $;} identity.$inject = []; function valueFn(value) {return function() {return value;};} /** * @ngdoc function * @name angular.isUndefined * @function * * @description * Determines if a reference is undefined. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is undefined. */ function isUndefined(value){return typeof value == 'undefined';} /** * @ngdoc function * @name angular.isDefined * @function * * @description * Determines if a reference is defined. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is defined. */ function isDefined(value){return typeof value != 'undefined';} /** * @ngdoc function * @name angular.isObject * @function * * @description * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not * considered to be objects. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is an `Object` but not `null`. */ function isObject(value){return value != null && typeof value == 'object';} /** * @ngdoc function * @name angular.isString * @function * * @description * Determines if a reference is a `String`. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `String`. */ function isString(value){return typeof value == 'string';} /** * @ngdoc function * @name angular.isNumber * @function * * @description * Determines if a reference is a `Number`. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `Number`. */ function isNumber(value){return typeof value == 'number';} /** * @ngdoc function * @name angular.isDate * @function * * @description * Determines if a value is a date. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `Date`. */ function isDate(value){ return toString.apply(value) == '[object Date]'; } /** * @ngdoc function * @name angular.isArray * @function * * @description * Determines if a reference is an `Array`. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is an `Array`. */ function isArray(value) { return toString.apply(value) == '[object Array]'; } /** * @ngdoc function * @name angular.isFunction * @function * * @description * Determines if a reference is a `Function`. * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a `Function`. */ function isFunction(value){return typeof value == 'function';} /** * Checks if `obj` is a window object. * * @private * @param {*} obj Object to check * @returns {boolean} True if `obj` is a window obj. */ function isWindow(obj) { return obj && obj.document && obj.location && obj.alert && obj.setInterval; } function isScope(obj) { return obj && obj.$evalAsync && obj.$watch; } function isFile(obj) { return toString.apply(obj) === '[object File]'; } function isBoolean(value) { return typeof value == 'boolean'; } function trim(value) { return isString(value) ? value.replace(/^\s*/, '').replace(/\s*$/, '') : value; } /** * @ngdoc function * @name angular.isElement * @function * * @description * Determines if a reference is a DOM element (or wrapped jQuery element). * * @param {*} value Reference to check. * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element). */ function isElement(node) { return node && (node.nodeName // we are a direct element || (node.bind && node.find)); // we have a bind and find method part of jQuery API } /** * @param str 'key1,key2,...' * @returns {object} in the form of {key1:true, key2:true, ...} */ function makeMap(str){ var obj = {}, items = str.split(","), i; for ( i = 0; i < items.length; i++ ) obj[ items[i] ] = true; return obj; } if (msie < 9) { nodeName_ = function(element) { element = element.nodeName ? element : element[0]; return (element.scopeName && element.scopeName != 'HTML') ? uppercase(element.scopeName + ':' + element.nodeName) : element.nodeName; }; } else { nodeName_ = function(element) { return element.nodeName ? element.nodeName : element[0].nodeName; }; } function map(obj, iterator, context) { var results = []; forEach(obj, function(value, index, list) { results.push(iterator.call(context, value, index, list)); }); return results; } /** * @description * Determines the number of elements in an array, the number of properties an object has, or * the length of a string. * * Note: This function is used to augment the Object type in Angular expressions. See * {@link angular.Object} for more information about Angular arrays. * * @param {Object|Array|string} obj Object, array, or string to inspect. * @param {boolean} [ownPropsOnly=false] Count only "own" properties in an object * @returns {number} The size of `obj` or `0` if `obj` is neither an object nor an array. */ function size(obj, ownPropsOnly) { var size = 0, key; if (isArray(obj) || isString(obj)) { return obj.length; } else if (isObject(obj)){ for (key in obj) if (!ownPropsOnly || obj.hasOwnProperty(key)) size++; } return size; } function includes(array, obj) { return indexOf(array, obj) != -1; } function indexOf(array, obj) { if (array.indexOf) return array.indexOf(obj); for ( var i = 0; i < array.length; i++) { if (obj === array[i]) return i; } return -1; } function arrayRemove(array, value) { var index = indexOf(array, value); if (index >=0) array.splice(index, 1); return value; } function isLeafNode (node) { if (node) { switch (node.nodeName) { case "OPTION": case "PRE": case "TITLE": return true; } } return false; } /** * @ngdoc function * @name angular.copy * @function * * @description * Creates a deep copy of `source`, which should be an object or an array. * * * If no destination is supplied, a copy of the object or array is created. * * If a destination is provided, all of its elements (for array) or properties (for objects) * are deleted and then all elements/properties from the source are copied to it. * * If `source` is not an object or array, `source` is returned. * * Note: this function is used to augment the Object type in Angular expressions. See * {@link ng.$filter} for more information about Angular arrays. * * @param {*} source The source that will be used to make a copy. * Can be any type, including primitives, `null`, and `undefined`. * @param {(Object|Array)=} destination Destination into which the source is copied. If * provided, must be of the same type as `source`. * @returns {*} The copy or updated `destination`, if `destination` was specified. */ function copy(source, destination){ if (isWindow(source) || isScope(source)) throw Error("Can't copy Window or Scope"); if (!destination) { destination = source; if (source) { if (isArray(source)) { destination = copy(source, []); } else if (isDate(source)) { destination = new Date(source.getTime()); } else if (isObject(source)) { destination = copy(source, {}); } } } else { if (source === destination) throw Error("Can't copy equivalent objects or arrays"); if (isArray(source)) { destination.length = 0; for ( var i = 0; i < source.length; i++) { destination.push(copy(source[i])); } } else { var h = destination.$$hashKey; forEach(destination, function(value, key){ delete destination[key]; }); for ( var key in source) { destination[key] = copy(source[key]); } setHashKey(destination,h); } } return destination; } /** * Create a shallow copy of an object */ function shallowCopy(src, dst) { dst = dst || {}; for(var key in src) { if (src.hasOwnProperty(key) && key.substr(0, 2) !== '$$') { dst[key] = src[key]; } } return dst; } /** * @ngdoc function * @name angular.equals * @function * * @description * Determines if two objects or two values are equivalent. Supports value types, arrays and * objects. * * Two objects or values are considered equivalent if at least one of the following is true: * * * Both objects or values pass `===` comparison. * * Both objects or values are of the same type and all of their properties pass `===` comparison. * * Both values are NaN. (In JavasScript, NaN == NaN => false. But we consider two NaN as equal) * * During a property comparison, properties of `function` type and properties with names * that begin with `$` are ignored. * * Scope and DOMWindow objects are being compared only by identify (`===`). * * @param {*} o1 Object or value to compare. * @param {*} o2 Object or value to compare. * @returns {boolean} True if arguments are equal. */ function equals(o1, o2) { if (o1 === o2) return true; if (o1 === null || o2 === null) return false; if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN var t1 = typeof o1, t2 = typeof o2, length, key, keySet; if (t1 == t2) { if (t1 == 'object') { if (isArray(o1)) { if ((length = o1.length) == o2.length) { for(key=0; key<length; key++) { if (!equals(o1[key], o2[key])) return false; } return true; } } else if (isDate(o1)) { return isDate(o2) && o1.getTime() == o2.getTime(); } else { if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2)) return false; keySet = {}; for(key in o1) { if (key.charAt(0) === '$' || isFunction(o1[key])) continue; if (!equals(o1[key], o2[key])) return false; keySet[key] = true; } for(key in o2) { if (!keySet[key] && key.charAt(0) !== '$' && o2[key] !== undefined && !isFunction(o2[key])) return false; } return true; } } } return false; } function concat(array1, array2, index) { return array1.concat(slice.call(array2, index)); } function sliceArgs(args, startIndex) { return slice.call(args, startIndex || 0); } /** * @ngdoc function * @name angular.bind * @function * * @description * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for * `fn`). You can supply optional `args` that are prebound to the function. This feature is also * known as [function currying](http://en.wikipedia.org/wiki/Currying). * * @param {Object} self Context which `fn` should be evaluated in. * @param {function()} fn Function to be bound. * @param {...*} args Optional arguments to be prebound to the `fn` function call. * @returns {function()} Function that wraps the `fn` with all the specified bindings. */ function bind(self, fn) { var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : []; if (isFunction(fn) && !(fn instanceof RegExp)) { return curryArgs.length ? function() { return arguments.length ? fn.apply(self, curryArgs.concat(slice.call(arguments, 0))) : fn.apply(self, curryArgs); } : function() { return arguments.length ? fn.apply(self, arguments) : fn.call(self); }; } else { // in IE, native methods are not functions so they cannot be bound (note: they don't need to be) return fn; } } function toJsonReplacer(key, value) { var val = value; if (/^\$+/.test(key)) { val = undefined; } else if (isWindow(value)) { val = '$WINDOW'; } else if (value && document === value) { val = '$DOCUMENT'; } else if (isScope(value)) { val = '$SCOPE'; } return val; } /** * @ngdoc function * @name angular.toJson * @function * * @description * Serializes input into a JSON-formatted string. * * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON. * @param {boolean=} pretty If set to true, the JSON output will contain newlines and whitespace. * @returns {string} Jsonified string representing `obj`. */ function toJson(obj, pretty) { return JSON.stringify(obj, toJsonReplacer, pretty ? ' ' : null); } /** * @ngdoc function * @name angular.fromJson * @function * * @description * Deserializes a JSON string. * * @param {string} json JSON string to deserialize. * @returns {Object|Array|Date|string|number} Deserialized thingy. */ function fromJson(json) { return isString(json) ? JSON.parse(json) : json; } function toBoolean(value) { if (value && value.length !== 0) { var v = lowercase("" + value); value = !(v == 'f' || v == '0' || v == 'false' || v == 'no' || v == 'n' || v == '[]'); } else { value = false; } return value; } /** * @returns {string} Returns the string representation of the element. */ function startingTag(element) { element = jqLite(element).clone(); try { // turns out IE does not let you set .html() on elements which // are not allowed to have children. So we just ignore it. element.html(''); } catch(e) {} // As Per DOM Standards var TEXT_NODE = 3; var elemHtml = jqLite('<div>').append(element).html(); try { return element[0].nodeType === TEXT_NODE ? lowercase(elemHtml) : elemHtml. match(/^(<[^>]+>)/)[1]. replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); }); } catch(e) { return lowercase(elemHtml); } } ///////////////////////////////////////////////// /** * Parses an escaped url query string into key-value pairs. * @returns Object.<(string|boolean)> */ function parseKeyValue(/**string*/keyValue) { var obj = {}, key_value, key; forEach((keyValue || "").split('&'), function(keyValue){ if (keyValue) { key_value = keyValue.split('='); key = decodeURIComponent(key_value[0]); obj[key] = isDefined(key_value[1]) ? decodeURIComponent(key_value[1]) : true; } }); return obj; } function toKeyValue(obj) { var parts = []; forEach(obj, function(value, key) { parts.push(encodeUriQuery(key, true) + (value === true ? '' : '=' + encodeUriQuery(value, true))); }); return parts.length ? parts.join('&') : ''; } /** * We need our custom method because encodeURIComponent is too aggressive and doesn't follow * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path * segments: * segment = *pchar * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" * pct-encoded = "%" HEXDIG HEXDIG * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" * / "*" / "+" / "," / ";" / "=" */ function encodeUriSegment(val) { return encodeUriQuery(val, true). replace(/%26/gi, '&'). replace(/%3D/gi, '='). replace(/%2B/gi, '+'); } /** * This method is intended for encoding *key* or *value* parts of query component. We need a custom * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be * encoded per http://tools.ietf.org/html/rfc3986: * query = *( pchar / "/" / "?" ) * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" * pct-encoded = "%" HEXDIG HEXDIG * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" * / "*" / "+" / "," / ";" / "=" */ function encodeUriQuery(val, pctEncodeSpaces) { return encodeURIComponent(val). replace(/%40/gi, '@'). replace(/%3A/gi, ':'). replace(/%24/g, '$'). replace(/%2C/gi, ','). replace(/%20/g, (pctEncodeSpaces ? '%20' : '+')); } /** * @ngdoc directive * @name ng.directive:ngApp * * @element ANY * @param {angular.Module} ngApp an optional application * {@link angular.module module} name to load. * * @description * * Use this directive to auto-bootstrap an application. Only * one directive can be used per HTML document. The directive * designates the root of the application and is typically placed * at the root of the page. * * In the example below if the `ngApp` directive would not be placed * on the `html` element then the document would not be compiled * and the `{{ 1+2 }}` would not be resolved to `3`. * * `ngApp` is the easiest way to bootstrap an application. * <doc:example> <doc:source> I can add: 1 + 2 = {{ 1+2 }} </doc:source> </doc:example> * */ function angularInit(element, bootstrap) { var elements = [element], appElement, module, names = ['ng:app', 'ng-app', 'x-ng-app', 'data-ng-app'], NG_APP_CLASS_REGEXP = /\sng[:\-]app(:\s*([\w\d_]+);?)?\s/; function append(element) { element && elements.push(element); } forEach(names, function(name) { names[name] = true; append(document.getElementById(name)); name = name.replace(':', '\\:'); if (element.querySelectorAll) { forEach(element.querySelectorAll('.' + name), append); forEach(element.querySelectorAll('.' + name + '\\:'), append); forEach(element.querySelectorAll('[' + name + ']'), append); } }); forEach(elements, function(element) { if (!appElement) { var className = ' ' + element.className + ' '; var match = NG_APP_CLASS_REGEXP.exec(className); if (match) { appElement = element; module = (match[2] || '').replace(/\s+/g, ','); } else { forEach(element.attributes, function(attr) { if (!appElement && names[attr.name]) { appElement = element; module = attr.value; } }); } } }); if (appElement) { bootstrap(appElement, module ? [module] : []); } } /** * @ngdoc function * @name angular.bootstrap * @description * Use this function to manually start up angular application. * * See: {@link guide/bootstrap Bootstrap} * * @param {Element} element DOM element which is the root of angular application. * @param {Array<String|Function>=} modules an array of module declarations. See: {@link angular.module modules} * @returns {AUTO.$injector} Returns the newly created injector for this app. */ function bootstrap(element, modules) { var resumeBootstrapInternal = function() { element = jqLite(element); modules = modules || []; modules.unshift(['$provide', function($provide) { $provide.value('$rootElement', element); }]); modules.unshift('ng'); var injector = createInjector(modules); injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector', '$animator', function(scope, element, compile, injector, animator) { scope.$apply(function() { element.data('$injector', injector); compile(element)(scope); }); animator.enabled(true); }] ); return injector; }; var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/; if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) { return resumeBootstrapInternal(); } window.name = window.name.replace(NG_DEFER_BOOTSTRAP, ''); angular.resumeBootstrap = function(extraModules) { forEach(extraModules, function(module) { modules.push(module); }); resumeBootstrapInternal(); }; } var SNAKE_CASE_REGEXP = /[A-Z]/g; function snake_case(name, separator){ separator = separator || '_'; return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) { return (pos ? separator : '') + letter.toLowerCase(); }); } function bindJQuery() { // bind to jQuery if present; jQuery = window.jQuery; // reset to jQuery or default to us. if (jQuery) { jqLite = jQuery; extend(jQuery.fn, { scope: JQLitePrototype.scope, controller: JQLitePrototype.controller, injector: JQLitePrototype.injector, inheritedData: JQLitePrototype.inheritedData }); JQLitePatchJQueryRemove('remove', true); JQLitePatchJQueryRemove('empty'); JQLitePatchJQueryRemove('html'); } else { jqLite = JQLite; } angular.element = jqLite; } /** * throw error if the argument is falsy. */ function assertArg(arg, name, reason) { if (!arg) { throw new Error("Argument '" + (name || '?') + "' is " + (reason || "required")); } return arg; } function assertArgFn(arg, name, acceptArrayAnnotation) { if (acceptArrayAnnotation && isArray(arg)) { arg = arg[arg.length - 1]; } assertArg(isFunction(arg), name, 'not a function, got ' + (arg && typeof arg == 'object' ? arg.constructor.name || 'Object' : typeof arg)); return arg; } /** * @ngdoc interface * @name angular.Module * @description * * Interface for configuring angular {@link angular.module modules}. */ function setupModuleLoader(window) { function ensure(obj, name, factory) { return obj[name] || (obj[name] = factory()); } return ensure(ensure(window, 'angular', Object), 'module', function() { /** @type {Object.<string, angular.Module>} */ var modules = {}; /** * @ngdoc function * @name angular.module * @description * * The `angular.module` is a global place for creating and registering Angular modules. All * modules (angular core or 3rd party) that should be available to an application must be * registered using this mechanism. * * * # Module * * A module is a collocation of services, directives, filters, and configuration information. Module * is used to configure the {@link AUTO.$injector $injector}. * * <pre> * // Create a new module * var myModule = angular.module('myModule', []); * * // register a new service * myModule.value('appName', 'MyCoolApp'); * * // configure existing services inside initialization blocks. * myModule.config(function($locationProvider) { * // Configure existing providers * $locationProvider.hashPrefix('!'); * }); * </pre> * * Then you can create an injector and load your modules like this: * * <pre> * var injector = angular.injector(['ng', 'MyModule']) * </pre> * * However it's more likely that you'll just use * {@link ng.directive:ngApp ngApp} or * {@link angular.bootstrap} to simplify this process for you. * * @param {!string} name The name of the module to create or retrieve. * @param {Array.<string>=} requires If specified then new module is being created. If unspecified then the * the module is being retrieved for further configuration. * @param {Function} configFn Optional configuration function for the module. Same as * {@link angular.Module#config Module#config()}. * @returns {module} new module with the {@link angular.Module} api. */ return function module(name, requires, configFn) { if (requires && modules.hasOwnProperty(name)) { modules[name] = null; } return ensure(modules, name, function() { if (!requires) { throw Error('No module: ' + name); } /** @type {!Array.<Array.<*>>} */ var invokeQueue = []; /** @type {!Array.<Function>} */ var runBlocks = []; var config = invokeLater('$injector', 'invoke'); /** @type {angular.Module} */ var moduleInstance = { // Private state _invokeQueue: invokeQueue, _runBlocks: runBlocks, /** * @ngdoc property * @name angular.Module#requires * @propertyOf angular.Module * @returns {Array.<string>} List of module names which must be loaded before this module. * @description * Holds the list of modules which the injector will load before the current module is loaded. */ requires: requires, /** * @ngdoc property * @name angular.Module#name * @propertyOf angular.Module * @returns {string} Name of the module. * @description */ name: name, /** * @ngdoc method * @name angular.Module#provider * @methodOf angular.Module * @param {string} name service name * @param {Function} providerType Construction function for creating new instance of the service. * @description * See {@link AUTO.$provide#provider $provide.provider()}. */ provider: invokeLater('$provide', 'provider'), /** * @ngdoc method * @name angular.Module#factory * @methodOf angular.Module * @param {string} name service name * @param {Function} providerFunction Function for creating new instance of the service. * @description * See {@link AUTO.$provide#factory $provide.factory()}. */ factory: invokeLater('$provide', 'factory'), /** * @ngdoc method * @name angular.Module#service * @methodOf angular.Module * @param {string} name service name * @param {Function} constructor A constructor function that will be instantiated. * @description * See {@link AUTO.$provide#service $provide.service()}. */ service: invokeLater('$provide', 'service'), /** * @ngdoc method * @name angular.Module#value * @methodOf angular.Module * @param {string} name service name * @param {*} object Service instance object. * @description * See {@link AUTO.$provide#value $provide.value()}. */ value: invokeLater('$provide', 'value'), /** * @ngdoc method * @name angular.Module#constant * @methodOf angular.Module * @param {string} name constant name * @param {*} object Constant value. * @description * Because the constant are fixed, they get applied before other provide methods. * See {@link AUTO.$provide#constant $provide.constant()}. */ constant: invokeLater('$provide', 'constant', 'unshift'), /** * @ngdoc method * @name angular.Module#animation * @methodOf angular.Module * @param {string} name animation name * @param {Function} animationFactory Factory function for creating new instance of an animation. * @description * * Defines an animation hook that can be later used with {@link ng.directive:ngAnimate ngAnimate} * alongside {@link ng.directive:ngAnimate#Description common ng directives} as well as custom directives. * <pre> * module.animation('animation-name', function($inject1, $inject2) { * return { * //this gets called in preparation to setup an animation * setup : function(element) { ... }, * * //this gets called once the animation is run * start : function(element, done, memo) { ... } * } * }) * </pre> * * See {@link ng.$animationProvider#register $animationProvider.register()} and * {@link ng.directive:ngAnimate ngAnimate} for more information. */ animation: invokeLater('$animationProvider', 'register'), /** * @ngdoc method * @name angular.Module#filter * @methodOf angular.Module * @param {string} name Filter name. * @param {Function} filterFactory Factory function for creating new instance of filter. * @description * See {@link ng.$filterProvider#register $filterProvider.register()}. */ filter: invokeLater('$filterProvider', 'register'), /** * @ngdoc method * @name angular.Module#controller * @methodOf angular.Module * @param {string} name Controller name. * @param {Function} constructor Controller constructor function. * @description * See {@link ng.$controllerProvider#register $controllerProvider.register()}. */ controller: invokeLater('$controllerProvider', 'register'), /** * @ngdoc method * @name angular.Module#directive * @methodOf angular.Module * @param {string} name directive name * @param {Function} directiveFactory Factory function for creating new instance of * directives. * @description * See {@link ng.$compileProvider#directive $compileProvider.directive()}. */ directive: invokeLater('$compileProvider', 'directive'), /** * @ngdoc method * @name angular.Module#config * @methodOf angular.Module * @param {Function} configFn Execute this function on module load. Useful for service * configuration. * @description * Use this method to register work which needs to be performed on module loading. */ config: config, /** * @ngdoc method * @name angular.Module#run * @methodOf angular.Module * @param {Function} initializationFn Execute this function after injector creation. * Useful for application initialization. * @description * Use this method to register work which should be performed when the injector is done * loading all modules. */ run: function(block) { runBlocks.push(block); return this; } }; if (configFn) { config(configFn); } return moduleInstance; /** * @param {string} provider * @param {string} method * @param {String=} insertMethod * @returns {angular.Module} */ function invokeLater(provider, method, insertMethod) { return function() { invokeQueue[insertMethod || 'push']([provider, method, arguments]); return moduleInstance; } } }); }; }); } /** * @ngdoc property * @name angular.version * @description * An object that contains information about the current AngularJS version. This object has the * following properties: * * - `full` – `{string}` – Full version string, such as "0.9.18". * - `major` – `{number}` – Major version number, such as "0". * - `minor` – `{number}` – Minor version number, such as "9". * - `dot` – `{number}` – Dot version number, such as "18". * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat". */ var version = { full: '1.1.5', // all of these placeholder strings will be replaced by grunt's major: 1, // package task minor: 1, dot: 5, codeName: 'triangle-squarification' }; function publishExternalAPI(angular){ extend(angular, { 'bootstrap': bootstrap, 'copy': copy, 'extend': extend, 'equals': equals, 'element': jqLite, 'forEach': forEach, 'injector': createInjector, 'noop':noop, 'bind':bind, 'toJson': toJson, 'fromJson': fromJson, 'identity':identity, 'isUndefined': isUndefined, 'isDefined': isDefined, 'isString': isString, 'isFunction': isFunction, 'isObject': isObject, 'isNumber': isNumber, 'isElement': isElement, 'isArray': isArray, 'version': version, 'isDate': isDate, 'lowercase': lowercase, 'uppercase': uppercase, 'callbacks': {counter: 0}, 'noConflict': noConflict }); angularModule = setupModuleLoader(window); try { angularModule('ngLocale'); } catch (e) { angularModule('ngLocale', []).provider('$locale', $LocaleProvider); } angularModule('ng', ['ngLocale'], ['$provide', function ngModule($provide) { $provide.provider('$compile', $CompileProvider). directive({ a: htmlAnchorDirective, input: inputDirective, textarea: inputDirective, form: formDirective, script: scriptDirective, select: selectDirective, style: styleDirective, option: optionDirective, ngBind: ngBindDirective, ngBindHtmlUnsafe: ngBindHtmlUnsafeDirective, ngBindTemplate: ngBindTemplateDirective, ngClass: ngClassDirective, ngClassEven: ngClassEvenDirective, ngClassOdd: ngClassOddDirective, ngCsp: ngCspDirective, ngCloak: ngCloakDirective, ngController: ngControllerDirective, ngForm: ngFormDirective, ngHide: ngHideDirective, ngIf: ngIfDirective, ngInclude: ngIncludeDirective, ngInit: ngInitDirective, ngNonBindable: ngNonBindableDirective, ngPluralize: ngPluralizeDirective, ngRepeat: ngRepeatDirective, ngShow: ngShowDirective, ngSubmit: ngSubmitDirective, ngStyle: ngStyleDirective, ngSwitch: ngSwitchDirective, ngSwitchWhen: ngSwitchWhenDirective, ngSwitchDefault: ngSwitchDefaultDirective, ngOptions: ngOptionsDirective, ngView: ngViewDirective, ngTransclude: ngTranscludeDirective, ngModel: ngModelDirective, ngList: ngListDirective, ngChange: ngChangeDirective, required: requiredDirective, ngRequired: requiredDirective, ngValue: ngValueDirective }). directive(ngAttributeAliasDirectives). directive(ngEventDirectives); $provide.provider({ $anchorScroll: $AnchorScrollProvider, $animation: $AnimationProvider, $animator: $AnimatorProvider, $browser: $BrowserProvider, $cacheFactory: $CacheFactoryProvider, $controller: $ControllerProvider, $document: $DocumentProvider, $exceptionHandler: $ExceptionHandlerProvider, $filter: $FilterProvider, $interpolate: $InterpolateProvider, $http: $HttpProvider, $httpBackend: $HttpBackendProvider, $location: $LocationProvider, $log: $LogProvider, $parse: $ParseProvider, $route: $RouteProvider, $routeParams: $RouteParamsProvider, $rootScope: $RootScopeProvider, $q: $QProvider, $sniffer: $SnifferProvider, $templateCache: $TemplateCacheProvider, $timeout: $TimeoutProvider, $window: $WindowProvider }); } ]); } ////////////////////////////////// //JQLite ////////////////////////////////// /** * @ngdoc function * @name angular.element * @function * * @description * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element. * `angular.element` can be either an alias for [jQuery](http://api.jquery.com/jQuery/) function, if * jQuery is available, or a function that wraps the element or string in Angular's jQuery lite * implementation (commonly referred to as jqLite). * * Real jQuery always takes precedence over jqLite, provided it was loaded before `DOMContentLoaded` * event fired. * * jqLite is a tiny, API-compatible subset of jQuery that allows * Angular to manipulate the DOM. jqLite implements only the most commonly needed functionality * within a very small footprint, so only a subset of the jQuery API - methods, arguments and * invocation styles - are supported. * * Note: All element references in Angular are always wrapped with jQuery or jqLite; they are never * raw DOM references. * * ## Angular's jQuery lite provides the following methods: * * - [addClass()](http://api.jquery.com/addClass/) * - [after()](http://api.jquery.com/after/) * - [append()](http://api.jquery.com/append/) * - [attr()](http://api.jquery.com/attr/) * - [bind()](http://api.jquery.com/bind/) - Does not support namespaces * - [children()](http://api.jquery.com/children/) - Does not support selectors * - [clone()](http://api.jquery.com/clone/) * - [contents()](http://api.jquery.com/contents/) * - [css()](http://api.jquery.com/css/) * - [data()](http://api.jquery.com/data/) * - [eq()](http://api.jquery.com/eq/) * - [find()](http://api.jquery.com/find/) - Limited to lookups by tag name * - [hasClass()](http://api.jquery.com/hasClass/) * - [html()](http://api.jquery.com/html/) * - [next()](http://api.jquery.com/next/) - Does not support selectors * - [parent()](http://api.jquery.com/parent/) - Does not support selectors * - [prepend()](http://api.jquery.com/prepend/) * - [prop()](http://api.jquery.com/prop/) * - [ready()](http://api.jquery.com/ready/) * - [remove()](http://api.jquery.com/remove/) * - [removeAttr()](http://api.jquery.com/removeAttr/) * - [removeClass()](http://api.jquery.com/removeClass/) * - [removeData()](http://api.jquery.com/removeData/) * - [replaceWith()](http://api.jquery.com/replaceWith/) * - [text()](http://api.jquery.com/text/) * - [toggleClass()](http://api.jquery.com/toggleClass/) * - [triggerHandler()](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers. * - [unbind()](http://api.jquery.com/unbind/) - Does not support namespaces * - [val()](http://api.jquery.com/val/) * - [wrap()](http://api.jquery.com/wrap/) * * ## In addition to the above, Angular provides additional methods to both jQuery and jQuery lite: * * - `controller(name)` - retrieves the controller of the current element or its parent. By default * retrieves controller associated with the `ngController` directive. If `name` is provided as * camelCase directive name, then the controller for this directive will be retrieved (e.g. * `'ngModel'`). * - `injector()` - retrieves the injector of the current element or its parent. * - `scope()` - retrieves the {@link api/ng.$rootScope.Scope scope} of the current * element or its parent. * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top * parent element is reached. * * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery. * @returns {Object} jQuery object. */ var jqCache = JQLite.cache = {}, jqName = JQLite.expando = 'ng-' + new Date().getTime(), jqId = 1, addEventListenerFn = (window.document.addEventListener ? function(element, type, fn) {element.addEventListener(type, fn, false);} : function(element, type, fn) {element.attachEvent('on' + type, fn);}), removeEventListenerFn = (window.document.removeEventListener ? function(element, type, fn) {element.removeEventListener(type, fn, false); } : function(element, type, fn) {element.detachEvent('on' + type, fn); }); function jqNextId() { return ++jqId; } var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g; var MOZ_HACK_REGEXP = /^moz([A-Z])/; /** * Converts snake_case to camelCase. * Also there is special case for Moz prefix starting with upper case letter. * @param name Name to normalize */ function camelCase(name) { return name. replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) { return offset ? letter.toUpperCase() : letter; }). replace(MOZ_HACK_REGEXP, 'Moz$1'); } ///////////////////////////////////////////// // jQuery mutation patch // // In conjunction with bindJQuery intercepts all jQuery's DOM destruction apis and fires a // $destroy event on all DOM nodes being removed. // ///////////////////////////////////////////// function JQLitePatchJQueryRemove(name, dispatchThis) { var originalJqFn = jQuery.fn[name]; originalJqFn = originalJqFn.$original || originalJqFn; removePatch.$original = originalJqFn; jQuery.fn[name] = removePatch; function removePatch() { var list = [this], fireEvent = dispatchThis, set, setIndex, setLength, element, childIndex, childLength, children, fns, events; while(list.length) { set = list.shift(); for(setIndex = 0, setLength = set.length; setIndex < setLength; setIndex++) { element = jqLite(set[setIndex]); if (fireEvent) { element.triggerHandler('$destroy'); } else { fireEvent = !fireEvent; } for(childIndex = 0, childLength = (children = element.children()).length; childIndex < childLength; childIndex++) { list.push(jQuery(children[childIndex])); } } } return originalJqFn.apply(this, arguments); } } ///////////////////////////////////////////// function JQLite(element) { if (element instanceof JQLite) { return element; } if (!(this instanceof JQLite)) { if (isString(element) && element.charAt(0) != '<') { throw Error('selectors not implemented'); } return new JQLite(element); } if (isString(element)) { var div = document.createElement('div'); // Read about the NoScope elements here: // http://msdn.microsoft.com/en-us/library/ms533897(VS.85).aspx div.innerHTML = '<div>&#160;</div>' + element; // IE insanity to make NoScope elements work! div.removeChild(div.firstChild); // remove the superfluous div JQLiteAddNodes(this, div.childNodes); this.remove(); // detach the elements from the temporary DOM div. } else { JQLiteAddNodes(this, element); } } function JQLiteClone(element) { return element.cloneNode(true); } function JQLiteDealoc(element){ JQLiteRemoveData(element); for ( var i = 0, children = element.childNodes || []; i < children.length; i++) { JQLiteDealoc(children[i]); } } function JQLiteUnbind(element, type, fn) { var events = JQLiteExpandoStore(element, 'events'), handle = JQLiteExpandoStore(element, 'handle'); if (!handle) return; //no listeners registered if (isUndefined(type)) { forEach(events, function(eventHandler, type) { removeEventListenerFn(element, type, eventHandler); delete events[type]; }); } else { if (isUndefined(fn)) { removeEventListenerFn(element, type, events[type]); delete events[type]; } else { arrayRemove(events[type], fn); } } } function JQLiteRemoveData(element) { var expandoId = element[jqName], expandoStore = jqCache[expandoId]; if (expandoStore) { if (expandoStore.handle) { expandoStore.events.$destroy && expandoStore.handle({}, '$destroy'); JQLiteUnbind(element); } delete jqCache[expandoId]; element[jqName] = undefined; // ie does not allow deletion of attributes on elements. } } function JQLiteExpandoStore(element, key, value) { var expandoId = element[jqName], expandoStore = jqCache[expandoId || -1]; if (isDefined(value)) { if (!expandoStore) { element[jqName] = expandoId = jqNextId(); expandoStore = jqCache[expandoId] = {}; } expandoStore[key] = value; } else { return expandoStore && expandoStore[key]; } } function JQLiteData(element, key, value) { var data = JQLiteExpandoStore(element, 'data'), isSetter = isDefined(value), keyDefined = !isSetter && isDefined(key), isSimpleGetter = keyDefined && !isObject(key); if (!data && !isSimpleGetter) { JQLiteExpandoStore(element, 'data', data = {}); } if (isSetter) { data[key] = value; } else { if (keyDefined) { if (isSimpleGetter) { // don't create data in this case. return data && data[key]; } else { extend(data, key); } } else { return data; } } } function JQLiteHasClass(element, selector) { return ((" " + element.className + " ").replace(/[\n\t]/g, " "). indexOf( " " + selector + " " ) > -1); } function JQLiteRemoveClass(element, cssClasses) { if (cssClasses) { forEach(cssClasses.split(' '), function(cssClass) { element.className = trim( (" " + element.className + " ") .replace(/[\n\t]/g, " ") .replace(" " + trim(cssClass) + " ", " ") ); }); } } function JQLiteAddClass(element, cssClasses) { if (cssClasses) { forEach(cssClasses.split(' '), function(cssClass) { if (!JQLiteHasClass(element, cssClass)) { element.className = trim(element.className + ' ' + trim(cssClass)); } }); } } function JQLiteAddNodes(root, elements) { if (elements) { elements = (!elements.nodeName && isDefined(elements.length) && !isWindow(elements)) ? elements : [ elements ]; for(var i=0; i < elements.length; i++) { root.push(elements[i]); } } } function JQLiteController(element, name) { return JQLiteInheritedData(element, '$' + (name || 'ngController' ) + 'Controller'); } function JQLiteInheritedData(element, name, value) { element = jqLite(element); // if element is the document object work with the html element instead // this makes $(document).scope() possible if(element[0].nodeType == 9) { element = element.find('html'); } while (element.length) { if (value = element.data(name)) return value; element = element.parent(); } } ////////////////////////////////////////// // Functions which are declared directly. ////////////////////////////////////////// var JQLitePrototype = JQLite.prototype = { ready: function(fn) { var fired = false; function trigger() { if (fired) return; fired = true; fn(); } // check if document already is loaded if (document.readyState === 'complete'){ setTimeout(trigger); } else { this.bind('DOMContentLoaded', trigger); // works for modern browsers and IE9 // we can not use jqLite since we are not done loading and jQuery could be loaded later. JQLite(window).bind('load', trigger); // fallback to window.onload for others } }, toString: function() { var value = []; forEach(this, function(e){ value.push('' + e);}); return '[' + value.join(', ') + ']'; }, eq: function(index) { return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]); }, length: 0, push: push, sort: [].sort, splice: [].splice }; ////////////////////////////////////////// // Functions iterating getter/setters. // these functions return self on setter and // value on get. ////////////////////////////////////////// var BOOLEAN_ATTR = {}; forEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) { BOOLEAN_ATTR[lowercase(value)] = value; }); var BOOLEAN_ELEMENTS = {}; forEach('input,select,option,textarea,button,form,details'.split(','), function(value) { BOOLEAN_ELEMENTS[uppercase(value)] = true; }); function getBooleanAttrName(element, name) { // check dom last since we will most likely fail on name var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()]; // booleanAttr is here twice to minimize DOM access return booleanAttr && BOOLEAN_ELEMENTS[element.nodeName] && booleanAttr; } forEach({ data: JQLiteData, inheritedData: JQLiteInheritedData, scope: function(element) { return JQLiteInheritedData(element, '$scope'); }, controller: JQLiteController , injector: function(element) { return JQLiteInheritedData(element, '$injector'); }, removeAttr: function(element,name) { element.removeAttribute(name); }, hasClass: JQLiteHasClass, css: function(element, name, value) { name = camelCase(name); if (isDefined(value)) { element.style[name] = value; } else { var val; if (msie <= 8) { // this is some IE specific weirdness that jQuery 1.6.4 does not sure why val = element.currentStyle && element.currentStyle[name]; if (val === '') val = 'auto'; } val = val || element.style[name]; if (msie <= 8) { // jquery weirdness :-/ val = (val === '') ? undefined : val; } return val; } }, attr: function(element, name, value){ var lowercasedName = lowercase(name); if (BOOLEAN_ATTR[lowercasedName]) { if (isDefined(value)) { if (!!value) { element[name] = true; element.setAttribute(name, lowercasedName); } else { element[name] = false; element.removeAttribute(lowercasedName); } } else { return (element[name] || (element.attributes.getNamedItem(name)|| noop).specified) ? lowercasedName : undefined; } } else if (isDefined(value)) { element.setAttribute(name, value); } else if (element.getAttribute) { // the extra argument "2" is to get the right thing for a.href in IE, see jQuery code // some elements (e.g. Document) don't have get attribute, so return undefined var ret = element.getAttribute(name, 2); // normalize non-existing attributes to undefined (as jQuery) return ret === null ? undefined : ret; } }, prop: function(element, name, value) { if (isDefined(value)) { element[name] = value; } else { return element[name]; } }, text: extend((msie < 9) ? function(element, value) { if (element.nodeType == 1 /** Element */) { if (isUndefined(value)) return element.innerText; element.innerText = value; } else { if (isUndefined(value)) return element.nodeValue; element.nodeValue = value; } } : function(element, value) { if (isUndefined(value)) { return element.textContent; } element.textContent = value; }, {$dv:''}), val: function(element, value) { if (isUndefined(value)) { return element.value; } element.value = value; }, html: function(element, value) { if (isUndefined(value)) { return element.innerHTML; } for (var i = 0, childNodes = element.childNodes; i < childNodes.length; i++) { JQLiteDealoc(childNodes[i]); } element.innerHTML = value; } }, function(fn, name){ /** * Properties: writes return selection, reads return first value */ JQLite.prototype[name] = function(arg1, arg2) { var i, key; // JQLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it // in a way that survives minification. if (((fn.length == 2 && (fn !== JQLiteHasClass && fn !== JQLiteController)) ? arg1 : arg2) === undefined) { if (isObject(arg1)) { // we are a write, but the object properties are the key/values for(i=0; i < this.length; i++) { if (fn === JQLiteData) { // data() takes the whole object in jQuery fn(this[i], arg1); } else { for (key in arg1) { fn(this[i], key, arg1[key]); } } } // return self for chaining return this; } else { // we are a read, so read the first child. if (this.length) return fn(this[0], arg1, arg2); } } else { // we are a write, so apply to all children for(i=0; i < this.length; i++) { fn(this[i], arg1, arg2); } // return self for chaining return this; } return fn.$dv; }; }); function createEventHandler(element, events) { var eventHandler = function (event, type) { if (!event.preventDefault) { event.preventDefault = function() { event.returnValue = false; //ie }; } if (!event.stopPropagation) { event.stopPropagation = function() { event.cancelBubble = true; //ie }; } if (!event.target) { event.target = event.srcElement || document; } if (isUndefined(event.defaultPrevented)) { var prevent = event.preventDefault; event.preventDefault = function() { event.defaultPrevented = true; prevent.call(event); }; event.defaultPrevented = false; } event.isDefaultPrevented = function() { return event.defaultPrevented || event.returnValue == false; }; forEach(events[type || event.type], function(fn) { fn.call(element, event); }); // Remove monkey-patched methods (IE), // as they would cause memory leaks in IE8. if (msie <= 8) { // IE7/8 does not allow to delete property on native object event.preventDefault = null; event.stopPropagation = null; event.isDefaultPrevented = null; } else { // It shouldn't affect normal browsers (native methods are defined on prototype). delete event.preventDefault; delete event.stopPropagation; delete event.isDefaultPrevented; } }; eventHandler.elem = element; return eventHandler; } ////////////////////////////////////////// // Functions iterating traversal. // These functions chain results into a single // selector. ////////////////////////////////////////// forEach({ removeData: JQLiteRemoveData, dealoc: JQLiteDealoc, bind: function bindFn(element, type, fn){ var events = JQLiteExpandoStore(element, 'events'), handle = JQLiteExpandoStore(element, 'handle'); if (!events) JQLiteExpandoStore(element, 'events', events = {}); if (!handle) JQLiteExpandoStore(element, 'handle', handle = createEventHandler(element, events)); forEach(type.split(' '), function(type){ var eventFns = events[type]; if (!eventFns) { if (type == 'mouseenter' || type == 'mouseleave') { var contains = document.body.contains || document.body.compareDocumentPosition ? function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && ( adown.contains ? adown.contains( bup ) : a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 )); } : function( a, b ) { if ( b ) { while ( (b = b.parentNode) ) { if ( b === a ) { return true; } } } return false; }; events[type] = []; // Refer to jQuery's implementation of mouseenter & mouseleave // Read about mouseenter and mouseleave: // http://www.quirksmode.org/js/events_mouse.html#link8 var eventmap = { mouseleave : "mouseout", mouseenter : "mouseover"} bindFn(element, eventmap[type], function(event) { var ret, target = this, related = event.relatedTarget; // For mousenter/leave call the handler if related is outside the target. // NB: No relatedTarget if the mouse left/entered the browser window if ( !related || (related !== target && !contains(target, related)) ){ handle(event, type); } }); } else { addEventListenerFn(element, type, handle); events[type] = []; } eventFns = events[type] } eventFns.push(fn); }); }, unbind: JQLiteUnbind, replaceWith: function(element, replaceNode) { var index, parent = element.parentNode; JQLiteDealoc(element); forEach(new JQLite(replaceNode), function(node){ if (index) { parent.insertBefore(node, index.nextSibling); } else { parent.replaceChild(node, element); } index = node; }); }, children: function(element) { var children = []; forEach(element.childNodes, function(element){ if (element.nodeType === 1) children.push(element); }); return children; }, contents: function(element) { return element.childNodes || []; }, append: function(element, node) { forEach(new JQLite(node), function(child){ if (element.nodeType === 1 || element.nodeType === 11) { element.appendChild(child); } }); }, prepend: function(element, node) { if (element.nodeType === 1) { var index = element.firstChild; forEach(new JQLite(node), function(child){ if (index) { element.insertBefore(child, index); } else { element.appendChild(child); index = child; } }); } }, wrap: function(element, wrapNode) { wrapNode = jqLite(wrapNode)[0]; var parent = element.parentNode; if (parent) { parent.replaceChild(wrapNode, element); } wrapNode.appendChild(element); }, remove: function(element) { JQLiteDealoc(element); var parent = element.parentNode; if (parent) parent.removeChild(element); }, after: function(element, newElement) { var index = element, parent = element.parentNode; forEach(new JQLite(newElement), function(node){ parent.insertBefore(node, index.nextSibling); index = node; }); }, addClass: JQLiteAddClass, removeClass: JQLiteRemoveClass, toggleClass: function(element, selector, condition) { if (isUndefined(condition)) { condition = !JQLiteHasClass(element, selector); } (condition ? JQLiteAddClass : JQLiteRemoveClass)(element, selector); }, parent: function(element) { var parent = element.parentNode; return parent && parent.nodeType !== 11 ? parent : null; }, next: function(element) { if (element.nextElementSibling) { return element.nextElementSibling; } // IE8 doesn't have nextElementSibling var elm = element.nextSibling; while (elm != null && elm.nodeType !== 1) { elm = elm.nextSibling; } return elm; }, find: function(element, selector) { return element.getElementsByTagName(selector); }, clone: JQLiteClone, triggerHandler: function(element, eventName) { var eventFns = (JQLiteExpandoStore(element, 'events') || {})[eventName]; var event; forEach(eventFns, function(fn) { fn.call(element, {preventDefault: noop}); }); } }, function(fn, name){ /** * chaining functions */ JQLite.prototype[name] = function(arg1, arg2) { var value; for(var i=0; i < this.length; i++) { if (value == undefined) { value = fn(this[i], arg1, arg2); if (value !== undefined) { // any function which returns a value needs to be wrapped value = jqLite(value); } } else { JQLiteAddNodes(value, fn(this[i], arg1, arg2)); } } return value == undefined ? this : value; }; }); /** * Computes a hash of an 'obj'. * Hash of a: * string is string * number is number as string * object is either result of calling $$hashKey function on the object or uniquely generated id, * that is also assigned to the $$hashKey property of the object. * * @param obj * @returns {string} hash string such that the same input will have the same hash string. * The resulting string key is in 'type:hashKey' format. */ function hashKey(obj) { var objType = typeof obj, key; if (objType == 'object' && obj !== null) { if (typeof (key = obj.$$hashKey) == 'function') { // must invoke on object to keep the right this key = obj.$$hashKey(); } else if (key === undefined) { key = obj.$$hashKey = nextUid(); } } else { key = obj; } return objType + ':' + key; } /** * HashMap which can use objects as keys */ function HashMap(array){ forEach(array, this.put, this); } HashMap.prototype = { /** * Store key value pair * @param key key to store can be any type * @param value value to store can be any type */ put: function(key, value) { this[hashKey(key)] = value; }, /** * @param key * @returns the value for the key */ get: function(key) { return this[hashKey(key)]; }, /** * Remove the key/value pair * @param key */ remove: function(key) { var value = this[key = hashKey(key)]; delete this[key]; return value; } }; /** * @ngdoc function * @name angular.injector * @function * * @description * Creates an injector function that can be used for retrieving services as well as for * dependency injection (see {@link guide/di dependency injection}). * * @param {Array.<string|Function>} modules A list of module functions or their aliases. See * {@link angular.module}. The `ng` module must be explicitly added. * @returns {function()} Injector function. See {@link AUTO.$injector $injector}. * * @example * Typical usage * <pre> * // create an injector * var $injector = angular.injector(['ng']); * * // use the injector to kick off your application * // use the type inference to auto inject arguments, or use implicit injection * $injector.invoke(function($rootScope, $compile, $document){ * $compile($document)($rootScope); * $rootScope.$digest(); * }); * </pre> */ /** * @ngdoc overview * @name AUTO * @description * * Implicit module which gets automatically added to each {@link AUTO.$injector $injector}. */ var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m; var FN_ARG_SPLIT = /,/; var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/; var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; function annotate(fn) { var $inject, fnText, argDecl, last; if (typeof fn == 'function') { if (!($inject = fn.$inject)) { $inject = []; fnText = fn.toString().replace(STRIP_COMMENTS, ''); argDecl = fnText.match(FN_ARGS); forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){ arg.replace(FN_ARG, function(all, underscore, name){ $inject.push(name); }); }); fn.$inject = $inject; } } else if (isArray(fn)) { last = fn.length - 1; assertArgFn(fn[last], 'fn'); $inject = fn.slice(0, last); } else { assertArgFn(fn, 'fn', true); } return $inject; } /////////////////////////////////////// /** * @ngdoc object * @name AUTO.$injector * @function * * @description * * `$injector` is used to retrieve object instances as defined by * {@link AUTO.$provide provider}, instantiate types, invoke methods, * and load modules. * * The following always holds true: * * <pre> * var $injector = angular.injector(); * expect($injector.get('$injector')).toBe($injector); * expect($injector.invoke(function($injector){ * return $injector; * }).toBe($injector); * </pre> * * # Injection Function Annotation * * JavaScript does not have annotations, and annotations are needed for dependency injection. The * following are all valid ways of annotating function with injection arguments and are equivalent. * * <pre> * // inferred (only works if code not minified/obfuscated) * $injector.invoke(function(serviceA){}); * * // annotated * function explicit(serviceA) {}; * explicit.$inject = ['serviceA']; * $injector.invoke(explicit); * * // inline * $injector.invoke(['serviceA', function(serviceA){}]); * </pre> * * ## Inference * * In JavaScript calling `toString()` on a function returns the function definition. The definition can then be * parsed and the function arguments can be extracted. *NOTE:* This does not work with minification, and obfuscation * tools since these tools change the argument names. * * ## `$inject` Annotation * By adding a `$inject` property onto a function the injection parameters can be specified. * * ## Inline * As an array of injection names, where the last item in the array is the function to call. */ /** * @ngdoc method * @name AUTO.$injector#get * @methodOf AUTO.$injector * * @description * Return an instance of the service. * * @param {string} name The name of the instance to retrieve. * @return {*} The instance. */ /** * @ngdoc method * @name AUTO.$injector#invoke * @methodOf AUTO.$injector * * @description * Invoke the method and supply the method arguments from the `$injector`. * * @param {!function} fn The function to invoke. The function arguments come form the function annotation. * @param {Object=} self The `this` for the invoked method. * @param {Object=} locals Optional object. If preset then any argument names are read from this object first, before * the `$injector` is consulted. * @returns {*} the value returned by the invoked `fn` function. */ /** * @ngdoc method * @name AUTO.$injector#has * @methodOf AUTO.$injector * * @description * Allows the user to query if the particular service exist. * * @param {string} Name of the service to query. * @returns {boolean} returns true if injector has given service. */ /** * @ngdoc method * @name AUTO.$injector#instantiate * @methodOf AUTO.$injector * @description * Create a new instance of JS type. The method takes a constructor function invokes the new operator and supplies * all of the arguments to the constructor function as specified by the constructor annotation. * * @param {function} Type Annotated constructor function. * @param {Object=} locals Optional object. If preset then any argument names are read from this object first, before * the `$injector` is consulted. * @returns {Object} new instance of `Type`. */ /** * @ngdoc method * @name AUTO.$injector#annotate * @methodOf AUTO.$injector * * @description * Returns an array of service names which the function is requesting for injection. This API is used by the injector * to determine which services need to be injected into the function when the function is invoked. There are three * ways in which the function can be annotated with the needed dependencies. * * # Argument names * * The simplest form is to extract the dependencies from the arguments of the function. This is done by converting * the function into a string using `toString()` method and extracting the argument names. * <pre> * // Given * function MyController($scope, $route) { * // ... * } * * // Then * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']); * </pre> * * This method does not work with code minfication / obfuscation. For this reason the following annotation strategies * are supported. * * # The `$inject` property * * If a function has an `$inject` property and its value is an array of strings, then the strings represent names of * services to be injected into the function. * <pre> * // Given * var MyController = function(obfuscatedScope, obfuscatedRoute) { * // ... * } * // Define function dependencies * MyController.$inject = ['$scope', '$route']; * * // Then * expect(injector.annotate(MyController)).toEqual(['$scope', '$route']); * </pre> * * # The array notation * * It is often desirable to inline Injected functions and that's when setting the `$inject` property is very * inconvenient. In these situations using the array notation to specify the dependencies in a way that survives * minification is a better choice: * * <pre> * // We wish to write this (not minification / obfuscation safe) * injector.invoke(function($compile, $rootScope) { * // ... * }); * * // We are forced to write break inlining * var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) { * // ... * }; * tmpFn.$inject = ['$compile', '$rootScope']; * injector.invoke(tmpFn); * * // To better support inline function the inline annotation is supported * injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) { * // ... * }]); * * // Therefore * expect(injector.annotate( * ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}]) * ).toEqual(['$compile', '$rootScope']); * </pre> * * @param {function|Array.<string|Function>} fn Function for which dependent service names need to be retrieved as described * above. * * @returns {Array.<string>} The names of the services which the function requires. */ /** * @ngdoc object * @name AUTO.$provide * * @description * * Use `$provide` to register new providers with the `$injector`. The providers are the factories for the instance. * The providers share the same name as the instance they create with `Provider` suffixed to them. * * A provider is an object with a `$get()` method. The injector calls the `$get` method to create a new instance of * a service. The Provider can have additional methods which would allow for configuration of the provider. * * <pre> * function GreetProvider() { * var salutation = 'Hello'; * * this.salutation = function(text) { * salutation = text; * }; * * this.$get = function() { * return function (name) { * return salutation + ' ' + name + '!'; * }; * }; * } * * describe('Greeter', function(){ * * beforeEach(module(function($provide) { * $provide.provider('greet', GreetProvider); * })); * * it('should greet', inject(function(greet) { * expect(greet('angular')).toEqual('Hello angular!'); * })); * * it('should allow configuration of salutation', function() { * module(function(greetProvider) { * greetProvider.salutation('Ahoj'); * }); * inject(function(greet) { * expect(greet('angular')).toEqual('Ahoj angular!'); * }); * }); * </pre> */ /** * @ngdoc method * @name AUTO.$provide#provider * @methodOf AUTO.$provide * @description * * Register a provider for a service. The providers can be retrieved and can have additional configuration methods. * * @param {string} name The name of the instance. NOTE: the provider will be available under `name + 'Provider'` key. * @param {(Object|function())} provider If the provider is: * * - `Object`: then it should have a `$get` method. The `$get` method will be invoked using * {@link AUTO.$injector#invoke $injector.invoke()} when an instance needs to be created. * - `Constructor`: a new instance of the provider will be created using * {@link AUTO.$injector#instantiate $injector.instantiate()}, then treated as `object`. * * @returns {Object} registered provider instance */ /** * @ngdoc method * @name AUTO.$provide#factory * @methodOf AUTO.$provide * @description * * A short hand for configuring services if only `$get` method is required. * * @param {string} name The name of the instance. * @param {function()} $getFn The $getFn for the instance creation. Internally this is a short hand for * `$provide.provider(name, {$get: $getFn})`. * @returns {Object} registered provider instance */ /** * @ngdoc method * @name AUTO.$provide#service * @methodOf AUTO.$provide * @description * * A short hand for registering service of given class. * * @param {string} name The name of the instance. * @param {Function} constructor A class (constructor function) that will be instantiated. * @returns {Object} registered provider instance */ /** * @ngdoc method * @name AUTO.$provide#value * @methodOf AUTO.$provide * @description * * A short hand for configuring services if the `$get` method is a constant. * * @param {string} name The name of the instance. * @param {*} value The value. * @returns {Object} registered provider instance */ /** * @ngdoc method * @name AUTO.$provide#constant * @methodOf AUTO.$provide * @description * * A constant value, but unlike {@link AUTO.$provide#value value} it can be injected * into configuration function (other modules) and it is not interceptable by * {@link AUTO.$provide#decorator decorator}. * * @param {string} name The name of the constant. * @param {*} value The constant value. * @returns {Object} registered instance */ /** * @ngdoc method * @name AUTO.$provide#decorator * @methodOf AUTO.$provide * @description * * Decoration of service, allows the decorator to intercept the service instance creation. The * returned instance may be the original instance, or a new instance which delegates to the * original instance. * * @param {string} name The name of the service to decorate. * @param {function()} decorator This function will be invoked when the service needs to be * instantiated. The function is called using the {@link AUTO.$injector#invoke * injector.invoke} method and is therefore fully injectable. Local injection arguments: * * * `$delegate` - The original service instance, which can be monkey patched, configured, * decorated or delegated to. */ function createInjector(modulesToLoad) { var INSTANTIATING = {}, providerSuffix = 'Provider', path = [], loadedModules = new HashMap(), providerCache = { $provide: { provider: supportObject(provider), factory: supportObject(factory), service: supportObject(service), value: supportObject(value), constant: supportObject(constant), decorator: decorator } }, providerInjector = (providerCache.$injector = createInternalInjector(providerCache, function() { throw Error("Unknown provider: " + path.join(' <- ')); })), instanceCache = {}, instanceInjector = (instanceCache.$injector = createInternalInjector(instanceCache, function(servicename) { var provider = providerInjector.get(servicename + providerSuffix); return instanceInjector.invoke(provider.$get, provider); })); forEach(loadModules(modulesToLoad), function(fn) { instanceInjector.invoke(fn || noop); }); return instanceInjector; //////////////////////////////////// // $provider //////////////////////////////////// function supportObject(delegate) { return function(key, value) { if (isObject(key)) { forEach(key, reverseParams(delegate)); } else { return delegate(key, value); } } } function provider(name, provider_) { if (isFunction(provider_) || isArray(provider_)) { provider_ = providerInjector.instantiate(provider_); } if (!provider_.$get) { throw Error('Provider ' + name + ' must define $get factory method.'); } return providerCache[name + providerSuffix] = provider_; } function factory(name, factoryFn) { return provider(name, { $get: factoryFn }); } function service(name, constructor) { return factory(name, ['$injector', function($injector) { return $injector.instantiate(constructor); }]); } function value(name, value) { return factory(name, valueFn(value)); } function constant(name, value) { providerCache[name] = value; instanceCache[name] = value; } function decorator(serviceName, decorFn) { var origProvider = providerInjector.get(serviceName + providerSuffix), orig$get = origProvider.$get; origProvider.$get = function() { var origInstance = instanceInjector.invoke(orig$get, origProvider); return instanceInjector.invoke(decorFn, null, {$delegate: origInstance}); }; } //////////////////////////////////// // Module Loading //////////////////////////////////// function loadModules(modulesToLoad){ var runBlocks = []; forEach(modulesToLoad, function(module) { if (loadedModules.get(module)) return; loadedModules.put(module, true); if (isString(module)) { var moduleFn = angularModule(module); runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks); try { for(var invokeQueue = moduleFn._invokeQueue, i = 0, ii = invokeQueue.length; i < ii; i++) { var invokeArgs = invokeQueue[i], provider = providerInjector.get(invokeArgs[0]); provider[invokeArgs[1]].apply(provider, invokeArgs[2]); } } catch (e) { if (e.message) e.message += ' from ' + module; throw e; } } else if (isFunction(module)) { try { runBlocks.push(providerInjector.invoke(module)); } catch (e) { if (e.message) e.message += ' from ' + module; throw e; } } else if (isArray(module)) { try { runBlocks.push(providerInjector.invoke(module)); } catch (e) { if (e.message) e.message += ' from ' + String(module[module.length - 1]); throw e; } } else { assertArgFn(module, 'module'); } }); return runBlocks; } //////////////////////////////////// // internal Injector //////////////////////////////////// function createInternalInjector(cache, factory) { function getService(serviceName) { if (typeof serviceName !== 'string') { throw Error('Service name expected'); } if (cache.hasOwnProperty(serviceName)) { if (cache[serviceName] === INSTANTIATING) { throw Error('Circular dependency: ' + path.join(' <- ')); } return cache[serviceName]; } else { try { path.unshift(serviceName); cache[serviceName] = INSTANTIATING; return cache[serviceName] = factory(serviceName); } finally { path.shift(); } } } function invoke(fn, self, locals){ var args = [], $inject = annotate(fn), length, i, key; for(i = 0, length = $inject.length; i < length; i++) { key = $inject[i]; args.push( locals && locals.hasOwnProperty(key) ? locals[key] : getService(key) ); } if (!fn.$inject) { // this means that we must be an array. fn = fn[length]; } // Performance optimization: http://jsperf.com/apply-vs-call-vs-invoke switch (self ? -1 : args.length) { case 0: return fn(); case 1: return fn(args[0]); case 2: return fn(args[0], args[1]); case 3: return fn(args[0], args[1], args[2]); case 4: return fn(args[0], args[1], args[2], args[3]); case 5: return fn(args[0], args[1], args[2], args[3], args[4]); case 6: return fn(args[0], args[1], args[2], args[3], args[4], args[5]); case 7: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); case 8: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); case 9: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]); case 10: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], args[9]); default: return fn.apply(self, args); } } function instantiate(Type, locals) { var Constructor = function() {}, instance, returnedValue; // Check if Type is annotated and use just the given function at n-1 as parameter // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]); Constructor.prototype = (isArray(Type) ? Type[Type.length - 1] : Type).prototype; instance = new Constructor(); returnedValue = invoke(Type, instance, locals); return isObject(returnedValue) ? returnedValue : instance; } return { invoke: invoke, instantiate: instantiate, get: getService, annotate: annotate, has: function(name) { return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name); } }; } } /** * @ngdoc function * @name ng.$anchorScroll * @requires $window * @requires $location * @requires $rootScope * * @description * When called, it checks current value of `$location.hash()` and scroll to related element, * according to rules specified in * {@link http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document Html5 spec}. * * It also watches the `$location.hash()` and scroll whenever it changes to match any anchor. * This can be disabled by calling `$anchorScrollProvider.disableAutoScrolling()`. */ function $AnchorScrollProvider() { var autoScrollingEnabled = true; this.disableAutoScrolling = function() { autoScrollingEnabled = false; }; this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) { var document = $window.document; // helper function to get first anchor from a NodeList // can't use filter.filter, as it accepts only instances of Array // and IE can't convert NodeList to an array using [].slice // TODO(vojta): use filter if we change it to accept lists as well function getFirstAnchor(list) { var result = null; forEach(list, function(element) { if (!result && lowercase(element.nodeName) === 'a') result = element; }); return result; } function scroll() { var hash = $location.hash(), elm; // empty hash, scroll to the top of the page if (!hash) $window.scrollTo(0, 0); // element with given id else if ((elm = document.getElementById(hash))) elm.scrollIntoView(); // first anchor with given name :-D else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) elm.scrollIntoView(); // no element and hash == 'top', scroll to the top of the page else if (hash === 'top') $window.scrollTo(0, 0); } // does not scroll when user clicks on anchor link that is currently on // (no url change, no $location.hash() change), browser native does scroll if (autoScrollingEnabled) { $rootScope.$watch(function autoScrollWatch() {return $location.hash();}, function autoScrollWatchAction() { $rootScope.$evalAsync(scroll); }); } return scroll; }]; } /** * @ngdoc object * @name ng.$animationProvider * @description * * The $AnimationProvider provider allows developers to register and access custom JavaScript animations directly inside * of a module. * */ $AnimationProvider.$inject = ['$provide']; function $AnimationProvider($provide) { var suffix = 'Animation'; /** * @ngdoc function * @name ng.$animation#register * @methodOf ng.$animationProvider * * @description * Registers a new injectable animation factory function. The factory function produces the animation object which * has these two properties: * * * `setup`: `function(Element):*` A function which receives the starting state of the element. The purpose * of this function is to get the element ready for animation. Optionally the function returns an memento which * is passed to the `start` function. * * `start`: `function(Element, doneFunction, *)` The element to animate, the `doneFunction` to be called on * element animation completion, and an optional memento from the `setup` function. * * @param {string} name The name of the animation. * @param {function} factory The factory function that will be executed to return the animation object. * */ this.register = function(name, factory) { $provide.factory(camelCase(name) + suffix, factory); }; this.$get = ['$injector', function($injector) { /** * @ngdoc function * @name ng.$animation * @function * * @description * The $animation service is used to retrieve any defined animation functions. When executed, the $animation service * will return a object that contains the setup and start functions that were defined for the animation. * * @param {String} name Name of the animation function to retrieve. Animation functions are registered and stored * inside of the AngularJS DI so a call to $animate('custom') is the same as injecting `customAnimation` * via dependency injection. * @return {Object} the animation object which contains the `setup` and `start` functions that perform the animation. */ return function $animation(name) { if (name) { var animationName = camelCase(name) + suffix; if ($injector.has(animationName)) { return $injector.get(animationName); } } }; }]; } // NOTE: this is a pseudo directive. /** * @ngdoc directive * @name ng.directive:ngAnimate * * @description * The `ngAnimate` directive works as an attribute that is attached alongside pre-existing directives. * It effects how the directive will perform DOM manipulation. This allows for complex animations to take place * without burdening the directive which uses the animation with animation details. The built in directives * `ngRepeat`, `ngInclude`, `ngSwitch`, `ngShow`, `ngHide` and `ngView` already accept `ngAnimate` directive. * Custom directives can take advantage of animation through {@link ng.$animator $animator service}. * * Below is a more detailed breakdown of the supported callback events provided by pre-exisitng ng directives: * * | Directive | Supported Animations | * |========================================================== |====================================================| * | {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave and move | * | {@link ng.directive:ngView#animations ngView} | enter and leave | * | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave | * | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave | * | {@link ng.directive:ngIf#animations ngIf} | enter and leave | * | {@link ng.directive:ngShow#animations ngShow & ngHide} | show and hide | * * You can find out more information about animations upon visiting each directive page. * * Below is an example of a directive that makes use of the ngAnimate attribute: * * <pre> * <!-- you can also use data-ng-animate, ng:animate or x-ng-animate as well --> * <ANY ng-directive ng-animate="{event1: 'animation-name', event2: 'animation-name-2'}"></ANY> * * <!-- you can also use a short hand --> * <ANY ng-directive ng-animate=" 'animation' "></ANY> * <!-- which expands to --> * <ANY ng-directive ng-animate="{ enter: 'animation-enter', leave: 'animation-leave', ...}"></ANY> * * <!-- keep in mind that ng-animate can take expressions --> * <ANY ng-directive ng-animate=" computeCurrentAnimation() "></ANY> * </pre> * * The `event1` and `event2` attributes refer to the animation events specific to the directive that has been assigned. * * Keep in mind that if an animation is running, no child element of such animation can also be animated. * * <h2>CSS-defined Animations</h2> * By default, ngAnimate attaches two CSS classes per animation event to the DOM element to achieve the animation. * It is up to you, the developer, to ensure that the animations take place using cross-browser CSS3 transitions as * well as CSS animations. * * The following code below demonstrates how to perform animations using **CSS transitions** with ngAnimate: * * <pre> * <style type="text/css"> * /&#42; * The animate-enter CSS class is the event name that you * have provided within the ngAnimate attribute. * &#42;/ * .animate-enter { * -webkit-transition: 1s linear all; /&#42; Safari/Chrome &#42;/ * -moz-transition: 1s linear all; /&#42; Firefox &#42;/ * -o-transition: 1s linear all; /&#42; Opera &#42;/ * transition: 1s linear all; /&#42; IE10+ and Future Browsers &#42;/ * * /&#42; The animation preparation code &#42;/ * opacity: 0; * } * * /&#42; * Keep in mind that you want to combine both CSS * classes together to avoid any CSS-specificity * conflicts * &#42;/ * .animate-enter.animate-enter-active { * /&#42; The animation code itself &#42;/ * opacity: 1; * } * </style> * * <div ng-directive ng-animate="{enter: 'animate-enter'}"></div> * </pre> * * The following code below demonstrates how to perform animations using **CSS animations** with ngAnimate: * * <pre> * <style type="text/css"> * .animate-enter { * -webkit-animation: enter_sequence 1s linear; /&#42; Safari/Chrome &#42;/ * -moz-animation: enter_sequence 1s linear; /&#42; Firefox &#42;/ * -o-animation: enter_sequence 1s linear; /&#42; Opera &#42;/ * animation: enter_sequence 1s linear; /&#42; IE10+ and Future Browsers &#42;/ * } * &#64-webkit-keyframes enter_sequence { * from { opacity:0; } * to { opacity:1; } * } * &#64-moz-keyframes enter_sequence { * from { opacity:0; } * to { opacity:1; } * } * &#64-o-keyframes enter_sequence { * from { opacity:0; } * to { opacity:1; } * } * &#64keyframes enter_sequence { * from { opacity:0; } * to { opacity:1; } * } * </style> * * <div ng-directive ng-animate="{enter: 'animate-enter'}"></div> * </pre> * * ngAnimate will first examine any CSS animation code and then fallback to using CSS transitions. * * Upon DOM mutation, the event class is added first, then the browser is allowed to reflow the content and then, * the active class is added to trigger the animation. The ngAnimate directive will automatically extract the duration * of the animation to determine when the animation ends. Once the animation is over then both CSS classes will be * removed from the DOM. If a browser does not support CSS transitions or CSS animations then the animation will start and end * immediately resulting in a DOM element that is at it's final state. This final state is when the DOM element * has no CSS transition/animation classes surrounding it. * * <h2>JavaScript-defined Animations</h2> * In the event that you do not want to use CSS3 transitions or CSS3 animations or if you wish to offer animations to browsers that do not * yet support them, then you can make use of JavaScript animations defined inside of your AngularJS module. * * <pre> * var ngModule = angular.module('YourApp', []); * ngModule.animation('animate-enter', function() { * return { * setup : function(element) { * //prepare the element for animation * element.css({ 'opacity': 0 }); * var memo = "..."; //this value is passed to the start function * return memo; * }, * start : function(element, done, memo) { * //start the animation * element.animate({ * 'opacity' : 1 * }, function() { * //call when the animation is complete * done() * }); * } * } * }); * </pre> * * As you can see, the JavaScript code follows a similar template to the CSS3 animations. Once defined, the animation * can be used in the same way with the ngAnimate attribute. Keep in mind that, when using JavaScript-enabled * animations, ngAnimate will also add in the same CSS classes that CSS-enabled animations do (even if you're not using * CSS animations) to animated the element, but it will not attempt to find any CSS3 transition or animation duration/delay values. * It will instead close off the animation once the provided done function is executed. So it's important that you * make sure your animations remember to fire off the done function once the animations are complete. * * @param {expression} ngAnimate Used to configure the DOM manipulation animations. * */ var $AnimatorProvider = function() { var NG_ANIMATE_CONTROLLER = '$ngAnimateController'; var rootAnimateController = {running:true}; this.$get = ['$animation', '$window', '$sniffer', '$rootElement', '$rootScope', function($animation, $window, $sniffer, $rootElement, $rootScope) { $rootElement.data(NG_ANIMATE_CONTROLLER, rootAnimateController); /** * @ngdoc function * @name ng.$animator * @function * * @description * The $animator.create service provides the DOM manipulation API which is decorated with animations. * * @param {Scope} scope the scope for the ng-animate. * @param {Attributes} attr the attributes object which contains the ngAnimate key / value pair. (The attributes are * passed into the linking function of the directive using the `$animator`.) * @return {object} the animator object which contains the enter, leave, move, show, hide and animate methods. */ var AnimatorService = function(scope, attrs) { var animator = {}; /** * @ngdoc function * @name ng.animator#enter * @methodOf ng.$animator * @function * * @description * Injects the element object into the DOM (inside of the parent element) and then runs the enter animation. * * @param {jQuery/jqLite element} element the element that will be the focus of the enter animation * @param {jQuery/jqLite element} parent the parent element of the element that will be the focus of the enter animation * @param {jQuery/jqLite element} after the sibling element (which is the previous element) of the element that will be the focus of the enter animation */ animator.enter = animateActionFactory('enter', insert, noop); /** * @ngdoc function * @name ng.animator#leave * @methodOf ng.$animator * @function * * @description * Runs the leave animation operation and, upon completion, removes the element from the DOM. * * @param {jQuery/jqLite element} element the element that will be the focus of the leave animation * @param {jQuery/jqLite element} parent the parent element of the element that will be the focus of the leave animation */ animator.leave = animateActionFactory('leave', noop, remove); /** * @ngdoc function * @name ng.animator#move * @methodOf ng.$animator * @function * * @description * Fires the move DOM operation. Just before the animation starts, the animator will either append it into the parent container or * add the element directly after the after element if present. Then the move animation will be run. * * @param {jQuery/jqLite element} element the element that will be the focus of the move animation * @param {jQuery/jqLite element} parent the parent element of the element that will be the focus of the move animation * @param {jQuery/jqLite element} after the sibling element (which is the previous element) of the element that will be the focus of the move animation */ animator.move = animateActionFactory('move', move, noop); /** * @ngdoc function * @name ng.animator#show * @methodOf ng.$animator * @function * * @description * Reveals the element by setting the CSS property `display` to `block` and then starts the show animation directly after. * * @param {jQuery/jqLite element} element the element that will be rendered visible or hidden */ animator.show = animateActionFactory('show', show, noop); /** * @ngdoc function * @name ng.animator#hide * @methodOf ng.$animator * * @description * Starts the hide animation first and sets the CSS `display` property to `none` upon completion. * * @param {jQuery/jqLite element} element the element that will be rendered visible or hidden */ animator.hide = animateActionFactory('hide', noop, hide); /** * @ngdoc function * @name ng.animator#animate * @methodOf ng.$animator * * @description * Triggers a custom animation event to be executed on the given element * * @param {jQuery/jqLite element} element that will be animated */ animator.animate = function(event, element) { animateActionFactory(event, noop, noop)(element); } return animator; function animateActionFactory(type, beforeFn, afterFn) { return function(element, parent, after) { var ngAnimateValue = scope.$eval(attrs.ngAnimate); var className = ngAnimateValue ? isObject(ngAnimateValue) ? ngAnimateValue[type] : ngAnimateValue + '-' + type : ''; var animationPolyfill = $animation(className); var polyfillSetup = animationPolyfill && animationPolyfill.setup; var polyfillStart = animationPolyfill && animationPolyfill.start; var polyfillCancel = animationPolyfill && animationPolyfill.cancel; if (!className) { beforeFn(element, parent, after); afterFn(element, parent, after); } else { var activeClassName = className + '-active'; if (!parent) { parent = after ? after.parent() : element.parent(); } if ((!$sniffer.transitions && !polyfillSetup && !polyfillStart) || (parent.inheritedData(NG_ANIMATE_CONTROLLER) || noop).running) { beforeFn(element, parent, after); afterFn(element, parent, after); return; } var animationData = element.data(NG_ANIMATE_CONTROLLER) || {}; if(animationData.running) { (polyfillCancel || noop)(element); animationData.done(); } element.data(NG_ANIMATE_CONTROLLER, {running:true, done:done}); element.addClass(className); beforeFn(element, parent, after); if (element.length == 0) return done(); var memento = (polyfillSetup || noop)(element); // $window.setTimeout(beginAnimation, 0); this was causing the element not to animate // keep at 1 for animation dom rerender $window.setTimeout(beginAnimation, 1); } function parseMaxTime(str) { var total = 0, values = isString(str) ? str.split(/\s*,\s*/) : []; forEach(values, function(value) { total = Math.max(parseFloat(value) || 0, total); }); return total; } function beginAnimation() { element.addClass(activeClassName); if (polyfillStart) { polyfillStart(element, done, memento); } else if (isFunction($window.getComputedStyle)) { //one day all browsers will have these properties var w3cAnimationProp = 'animation'; var w3cTransitionProp = 'transition'; //but some still use vendor-prefixed styles var vendorAnimationProp = $sniffer.vendorPrefix + 'Animation'; var vendorTransitionProp = $sniffer.vendorPrefix + 'Transition'; var durationKey = 'Duration', delayKey = 'Delay', animationIterationCountKey = 'IterationCount', duration = 0; //we want all the styles defined before and after var ELEMENT_NODE = 1; forEach(element, function(element) { if (element.nodeType == ELEMENT_NODE) { var w3cProp = w3cTransitionProp, vendorProp = vendorTransitionProp, iterations = 1, elementStyles = $window.getComputedStyle(element) || {}; //use CSS Animations over CSS Transitions if(parseFloat(elementStyles[w3cAnimationProp + durationKey]) > 0 || parseFloat(elementStyles[vendorAnimationProp + durationKey]) > 0) { w3cProp = w3cAnimationProp; vendorProp = vendorAnimationProp; iterations = Math.max(parseInt(elementStyles[w3cProp + animationIterationCountKey]) || 0, parseInt(elementStyles[vendorProp + animationIterationCountKey]) || 0, iterations); } var parsedDelay = Math.max(parseMaxTime(elementStyles[w3cProp + delayKey]), parseMaxTime(elementStyles[vendorProp + delayKey])); var parsedDuration = Math.max(parseMaxTime(elementStyles[w3cProp + durationKey]), parseMaxTime(elementStyles[vendorProp + durationKey])); duration = Math.max(parsedDelay + (iterations * parsedDuration), duration); } }); $window.setTimeout(done, duration * 1000); } else { done(); } } function done() { if(!done.run) { done.run = true; afterFn(element, parent, after); element.removeClass(className); element.removeClass(activeClassName); element.removeData(NG_ANIMATE_CONTROLLER); } } }; } function show(element) { element.css('display', ''); } function hide(element) { element.css('display', 'none'); } function insert(element, parent, after) { if (after) { after.after(element); } else { parent.append(element); } } function remove(element) { element.remove(); } function move(element, parent, after) { // Do not remove element before insert. Removing will cause data associated with the // element to be dropped. Insert will implicitly do the remove. insert(element, parent, after); } }; /** * @ngdoc function * @name ng.animator#enabled * @methodOf ng.$animator * @function * * @param {Boolean=} If provided then set the animation on or off. * @return {Boolean} Current animation state. * * @description * Globally enables/disables animations. * */ AnimatorService.enabled = function(value) { if (arguments.length) { rootAnimateController.running = !value; } return !rootAnimateController.running; }; return AnimatorService; }]; }; /** * ! This is a private undocumented service ! * * @name ng.$browser * @requires $log * @description * This object has two goals: * * - hide all the global state in the browser caused by the window object * - abstract away all the browser specific features and inconsistencies * * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser` * service, which can be used for convenient testing of the application without the interaction with * the real browser apis. */ /** * @param {object} window The global window object. * @param {object} document jQuery wrapped document. * @param {function()} XHR XMLHttpRequest constructor. * @param {object} $log console.log or an object with the same interface. * @param {object} $sniffer $sniffer service */ function Browser(window, document, $log, $sniffer) { var self = this, rawDocument = document[0], location = window.location, history = window.history, setTimeout = window.setTimeout, clearTimeout = window.clearTimeout, pendingDeferIds = {}; self.isMock = false; var outstandingRequestCount = 0; var outstandingRequestCallbacks = []; // TODO(vojta): remove this temporary api self.$$completeOutstandingRequest = completeOutstandingRequest; self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; }; /** * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks` * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed. */ function completeOutstandingRequest(fn) { try { fn.apply(null, sliceArgs(arguments, 1)); } finally { outstandingRequestCount--; if (outstandingRequestCount === 0) { while(outstandingRequestCallbacks.length) { try { outstandingRequestCallbacks.pop()(); } catch (e) { $log.error(e); } } } } } /** * @private * Note: this method is used only by scenario runner * TODO(vojta): prefix this method with $$ ? * @param {function()} callback Function that will be called when no outstanding request */ self.notifyWhenNoOutstandingRequests = function(callback) { // force browser to execute all pollFns - this is needed so that cookies and other pollers fire // at some deterministic time in respect to the test runner's actions. Leaving things up to the // regular poller would result in flaky tests. forEach(pollFns, function(pollFn){ pollFn(); }); if (outstandingRequestCount === 0) { callback(); } else { outstandingRequestCallbacks.push(callback); } }; ////////////////////////////////////////////////////////////// // Poll Watcher API ////////////////////////////////////////////////////////////// var pollFns = [], pollTimeout; /** * @name ng.$browser#addPollFn * @methodOf ng.$browser * * @param {function()} fn Poll function to add * * @description * Adds a function to the list of functions that poller periodically executes, * and starts polling if not started yet. * * @returns {function()} the added function */ self.addPollFn = function(fn) { if (isUndefined(pollTimeout)) startPoller(100, setTimeout); pollFns.push(fn); return fn; }; /** * @param {number} interval How often should browser call poll functions (ms) * @param {function()} setTimeout Reference to a real or fake `setTimeout` function. * * @description * Configures the poller to run in the specified intervals, using the specified * setTimeout fn and kicks it off. */ function startPoller(interval, setTimeout) { (function check() { forEach(pollFns, function(pollFn){ pollFn(); }); pollTimeout = setTimeout(check, interval); })(); } ////////////////////////////////////////////////////////////// // URL API ////////////////////////////////////////////////////////////// var lastBrowserUrl = location.href, baseElement = document.find('base'); /** * @name ng.$browser#url * @methodOf ng.$browser * * @description * GETTER: * Without any argument, this method just returns current value of location.href. * * SETTER: * With at least one argument, this method sets url to new value. * If html5 history api supported, pushState/replaceState is used, otherwise * location.href/location.replace is used. * Returns its own instance to allow chaining * * NOTE: this api is intended for use only by the $location service. Please use the * {@link ng.$location $location service} to change url. * * @param {string} url New url (when used as setter) * @param {boolean=} replace Should new url replace current history record ? */ self.url = function(url, replace) { // setter if (url) { if (lastBrowserUrl == url) return; lastBrowserUrl = url; if ($sniffer.history) { if (replace) history.replaceState(null, '', url); else { history.pushState(null, '', url); // Crazy Opera Bug: http://my.opera.com/community/forums/topic.dml?id=1185462 baseElement.attr('href', baseElement.attr('href')); } } else { if (replace) location.replace(url); else location.href = url; } return self; // getter } else { // the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172 return location.href.replace(/%27/g,"'"); } }; var urlChangeListeners = [], urlChangeInit = false; function fireUrlChange() { if (lastBrowserUrl == self.url()) return; lastBrowserUrl = self.url(); forEach(urlChangeListeners, function(listener) { listener(self.url()); }); } /** * @name ng.$browser#onUrlChange * @methodOf ng.$browser * @TODO(vojta): refactor to use node's syntax for events * * @description * Register callback function that will be called, when url changes. * * It's only called when the url is changed by outside of angular: * - user types different url into address bar * - user clicks on history (forward/back) button * - user clicks on a link * * It's not called when url is changed by $browser.url() method * * The listener gets called with new url as parameter. * * NOTE: this api is intended for use only by the $location service. Please use the * {@link ng.$location $location service} to monitor url changes in angular apps. * * @param {function(string)} listener Listener function to be called when url changes. * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous. */ self.onUrlChange = function(callback) { if (!urlChangeInit) { // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera) // don't fire popstate when user change the address bar and don't fire hashchange when url // changed by push/replaceState // html5 history api - popstate event if ($sniffer.history) jqLite(window).bind('popstate', fireUrlChange); // hashchange event if ($sniffer.hashchange) jqLite(window).bind('hashchange', fireUrlChange); // polling else self.addPollFn(fireUrlChange); urlChangeInit = true; } urlChangeListeners.push(callback); return callback; }; ////////////////////////////////////////////////////////////// // Misc API ////////////////////////////////////////////////////////////// /** * Returns current <base href> * (always relative - without domain) * * @returns {string=} */ self.baseHref = function() { var href = baseElement.attr('href'); return href ? href.replace(/^https?\:\/\/[^\/]*/, '') : ''; }; ////////////////////////////////////////////////////////////// // Cookies API ////////////////////////////////////////////////////////////// var lastCookies = {}; var lastCookieString = ''; var cookiePath = self.baseHref(); /** * @name ng.$browser#cookies * @methodOf ng.$browser * * @param {string=} name Cookie name * @param {string=} value Cookie value * * @description * The cookies method provides a 'private' low level access to browser cookies. * It is not meant to be used directly, use the $cookie service instead. * * The return values vary depending on the arguments that the method was called with as follows: * <ul> * <li>cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify it</li> * <li>cookies(name, value) -> set name to value, if value is undefined delete the cookie</li> * <li>cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that way)</li> * </ul> * * @returns {Object} Hash of all cookies (if called without any parameter) */ self.cookies = function(name, value) { var cookieLength, cookieArray, cookie, i, index; if (name) { if (value === undefined) { rawDocument.cookie = escape(name) + "=;path=" + cookiePath + ";expires=Thu, 01 Jan 1970 00:00:00 GMT"; } else { if (isString(value)) { cookieLength = (rawDocument.cookie = escape(name) + '=' + escape(value) + ';path=' + cookiePath).length + 1; // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum: // - 300 cookies // - 20 cookies per unique domain // - 4096 bytes per cookie if (cookieLength > 4096) { $log.warn("Cookie '"+ name +"' possibly not set or overflowed because it was too large ("+ cookieLength + " > 4096 bytes)!"); } } } } else { if (rawDocument.cookie !== lastCookieString) { lastCookieString = rawDocument.cookie; cookieArray = lastCookieString.split("; "); lastCookies = {}; for (i = 0; i < cookieArray.length; i++) { cookie = cookieArray[i]; index = cookie.indexOf('='); if (index > 0) { //ignore nameless cookies var name = unescape(cookie.substring(0, index)); // the first value that is seen for a cookie is the most // specific one. values for the same cookie name that // follow are for less specific paths. if (lastCookies[name] === undefined) { lastCookies[name] = unescape(cookie.substring(index + 1)); } } } } return lastCookies; } }; /** * @name ng.$browser#defer * @methodOf ng.$browser * @param {function()} fn A function, who's execution should be defered. * @param {number=} [delay=0] of milliseconds to defer the function execution. * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`. * * @description * Executes a fn asynchronously via `setTimeout(fn, delay)`. * * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed * via `$browser.defer.flush()`. * */ self.defer = function(fn, delay) { var timeoutId; outstandingRequestCount++; timeoutId = setTimeout(function() { delete pendingDeferIds[timeoutId]; completeOutstandingRequest(fn); }, delay || 0); pendingDeferIds[timeoutId] = true; return timeoutId; }; /** * @name ng.$browser#defer.cancel * @methodOf ng.$browser.defer * * @description * Cancels a defered task identified with `deferId`. * * @param {*} deferId Token returned by the `$browser.defer` function. * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully canceled. */ self.defer.cancel = function(deferId) { if (pendingDeferIds[deferId]) { delete pendingDeferIds[deferId]; clearTimeout(deferId); completeOutstandingRequest(noop); return true; } return false; }; } function $BrowserProvider(){ this.$get = ['$window', '$log', '$sniffer', '$document', function( $window, $log, $sniffer, $document){ return new Browser($window, $document, $log, $sniffer); }]; } /** * @ngdoc object * @name ng.$cacheFactory * * @description * Factory that constructs cache objects. * * * @param {string} cacheId Name or id of the newly created cache. * @param {object=} options Options object that specifies the cache behavior. Properties: * * - `{number=}` `capacity` — turns the cache into LRU cache. * * @returns {object} Newly created cache object with the following set of methods: * * - `{object}` `info()` — Returns id, size, and options of cache. * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns it. * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss. * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache. * - `{void}` `removeAll()` — Removes all cached values. * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory. * */ function $CacheFactoryProvider() { this.$get = function() { var caches = {}; function cacheFactory(cacheId, options) { if (cacheId in caches) { throw Error('cacheId ' + cacheId + ' taken'); } var size = 0, stats = extend({}, options, {id: cacheId}), data = {}, capacity = (options && options.capacity) || Number.MAX_VALUE, lruHash = {}, freshEnd = null, staleEnd = null; return caches[cacheId] = { put: function(key, value) { var lruEntry = lruHash[key] || (lruHash[key] = {key: key}); refresh(lruEntry); if (isUndefined(value)) return; if (!(key in data)) size++; data[key] = value; if (size > capacity) { this.remove(staleEnd.key); } return value; }, get: function(key) { var lruEntry = lruHash[key]; if (!lruEntry) return; refresh(lruEntry); return data[key]; }, remove: function(key) { var lruEntry = lruHash[key]; if (!lruEntry) return; if (lruEntry == freshEnd) freshEnd = lruEntry.p; if (lruEntry == staleEnd) staleEnd = lruEntry.n; link(lruEntry.n,lruEntry.p); delete lruHash[key]; delete data[key]; size--; }, removeAll: function() { data = {}; size = 0; lruHash = {}; freshEnd = staleEnd = null; }, destroy: function() { data = null; stats = null; lruHash = null; delete caches[cacheId]; }, info: function() { return extend({}, stats, {size: size}); } }; /** * makes the `entry` the freshEnd of the LRU linked list */ function refresh(entry) { if (entry != freshEnd) { if (!staleEnd) { staleEnd = entry; } else if (staleEnd == entry) { staleEnd = entry.n; } link(entry.n, entry.p); link(entry, freshEnd); freshEnd = entry; freshEnd.n = null; } } /** * bidirectionally links two entries of the LRU linked list */ function link(nextEntry, prevEntry) { if (nextEntry != prevEntry) { if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify } } } cacheFactory.info = function() { var info = {}; forEach(caches, function(cache, cacheId) { info[cacheId] = cache.info(); }); return info; }; cacheFactory.get = function(cacheId) { return caches[cacheId]; }; return cacheFactory; }; } /** * @ngdoc object * @name ng.$templateCache * * @description * Cache used for storing html templates. * * See {@link ng.$cacheFactory $cacheFactory}. * */ function $TemplateCacheProvider() { this.$get = ['$cacheFactory', function($cacheFactory) { return $cacheFactory('templates'); }]; } /* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE! * * DOM-related variables: * * - "node" - DOM Node * - "element" - DOM Element or Node * - "$node" or "$element" - jqLite-wrapped node or element * * * Compiler related stuff: * * - "linkFn" - linking fn of a single directive * - "nodeLinkFn" - function that aggregates all linking fns for a particular node * - "childLinkFn" - function that aggregates all linking fns for child nodes of a particular node * - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList) */ var NON_ASSIGNABLE_MODEL_EXPRESSION = 'Non-assignable model expression: '; /** * @ngdoc function * @name ng.$compile * @function * * @description * Compiles a piece of HTML string or DOM into a template and produces a template function, which * can then be used to link {@link ng.$rootScope.Scope scope} and the template together. * * The compilation is a process of walking the DOM tree and trying to match DOM elements to * {@link ng.$compileProvider#directive directives}. For each match it * executes corresponding template function and collects the * instance functions into a single template function which is then returned. * * The template function can then be used once to produce the view or as it is the case with * {@link ng.directive:ngRepeat repeater} many-times, in which * case each call results in a view that is a DOM clone of the original template. * <doc:example module="compile"> <doc:source> <script> // declare a new module, and inject the $compileProvider angular.module('compile', [], function($compileProvider) { // configure new 'compile' directive by passing a directive // factory function. The factory function injects the '$compile' $compileProvider.directive('compile', function($compile) { // directive factory creates a link function return function(scope, element, attrs) { scope.$watch( function(scope) { // watch the 'compile' expression for changes return scope.$eval(attrs.compile); }, function(value) { // when the 'compile' expression changes // assign it into the current DOM element.html(value); // compile the new DOM and link it to the current // scope. // NOTE: we only compile .childNodes so that // we don't get into infinite loop compiling ourselves $compile(element.contents())(scope); } ); }; }) }); function Ctrl($scope) { $scope.name = 'Angular'; $scope.html = 'Hello {{name}}'; } </script> <div ng-controller="Ctrl"> <input ng-model="name"> <br> <textarea ng-model="html"></textarea> <br> <div compile="html"></div> </div> </doc:source> <doc:scenario> it('should auto compile', function() { expect(element('div[compile]').text()).toBe('Hello Angular'); input('html').enter('{{name}}!'); expect(element('div[compile]').text()).toBe('Angular!'); }); </doc:scenario> </doc:example> * * * @param {string|DOMElement} element Element or HTML string to compile into a template function. * @param {function(angular.Scope[, cloneAttachFn]} transclude function available to directives. * @param {number} maxPriority only apply directives lower then given priority (Only effects the * root element(s), not their children) * @returns {function(scope[, cloneAttachFn])} a link function which is used to bind template * (a DOM element/tree) to a scope. Where: * * * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to. * * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the * `template` and call the `cloneAttachFn` function allowing the caller to attach the * cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is * called as: <br> `cloneAttachFn(clonedElement, scope)` where: * * * `clonedElement` - is a clone of the original `element` passed into the compiler. * * `scope` - is the current scope with which the linking function is working with. * * Calling the linking function returns the element of the template. It is either the original element * passed in, or the clone of the element if the `cloneAttachFn` is provided. * * After linking the view is not updated until after a call to $digest which typically is done by * Angular automatically. * * If you need access to the bound view, there are two ways to do it: * * - If you are not asking the linking function to clone the template, create the DOM element(s) * before you send them to the compiler and keep this reference around. * <pre> * var element = $compile('<p>{{total}}</p>')(scope); * </pre> * * - if on the other hand, you need the element to be cloned, the view reference from the original * example would not point to the clone, but rather to the original template that was cloned. In * this case, you can access the clone via the cloneAttachFn: * <pre> * var templateHTML = angular.element('<p>{{total}}</p>'), * scope = ....; * * var clonedElement = $compile(templateHTML)(scope, function(clonedElement, scope) { * //attach the clone to DOM document at the right place * }); * * //now we have reference to the cloned DOM via `clone` * </pre> * * * For information on how the compiler works, see the * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide. */ /** * @ngdoc service * @name ng.$compileProvider * @function * * @description */ $CompileProvider.$inject = ['$provide']; function $CompileProvider($provide) { var hasDirectives = {}, Suffix = 'Directive', COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/, CLASS_DIRECTIVE_REGEXP = /(([\d\w\-_]+)(?:\:([^;]+))?;?)/, MULTI_ROOT_TEMPLATE_ERROR = 'Template must have exactly one root element. was: ', urlSanitizationWhitelist = /^\s*(https?|ftp|mailto|file):/; /** * @ngdoc function * @name ng.$compileProvider#directive * @methodOf ng.$compileProvider * @function * * @description * Register a new directives with the compiler. * * @param {string} name Name of the directive in camel-case. (ie <code>ngBind</code> which will match as * <code>ng-bind</code>). * @param {function} directiveFactory An injectable directive factory function. See {@link guide/directive} for more * info. * @returns {ng.$compileProvider} Self for chaining. */ this.directive = function registerDirective(name, directiveFactory) { if (isString(name)) { assertArg(directiveFactory, 'directive'); if (!hasDirectives.hasOwnProperty(name)) { hasDirectives[name] = []; $provide.factory(name + Suffix, ['$injector', '$exceptionHandler', function($injector, $exceptionHandler) { var directives = []; forEach(hasDirectives[name], function(directiveFactory) { try { var directive = $injector.invoke(directiveFactory); if (isFunction(directive)) { directive = { compile: valueFn(directive) }; } else if (!directive.compile && directive.link) { directive.compile = valueFn(directive.link); } directive.priority = directive.priority || 0; directive.name = directive.name || name; directive.require = directive.require || (directive.controller && directive.name); directive.restrict = directive.restrict || 'A'; directives.push(directive); } catch (e) { $exceptionHandler(e); } }); return directives; }]); } hasDirectives[name].push(directiveFactory); } else { forEach(name, reverseParams(registerDirective)); } return this; }; /** * @ngdoc function * @name ng.$compileProvider#urlSanitizationWhitelist * @methodOf ng.$compileProvider * @function * * @description * Retrieves or overrides the default regular expression that is used for whitelisting of safe * urls during a[href] sanitization. * * The sanitization is a security measure aimed at prevent XSS attacks via html links. * * Any url about to be assigned to a[href] via data-binding is first normalized and turned into an * absolute url. Afterwards the url is matched against the `urlSanitizationWhitelist` regular * expression. If a match is found the original url is written into the dom. Otherwise the * absolute url is prefixed with `'unsafe:'` string and only then it is written into the DOM. * * @param {RegExp=} regexp New regexp to whitelist urls with. * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for * chaining otherwise. */ this.urlSanitizationWhitelist = function(regexp) { if (isDefined(regexp)) { urlSanitizationWhitelist = regexp; return this; } return urlSanitizationWhitelist; }; this.$get = [ '$injector', '$interpolate', '$exceptionHandler', '$http', '$templateCache', '$parse', '$controller', '$rootScope', '$document', function($injector, $interpolate, $exceptionHandler, $http, $templateCache, $parse, $controller, $rootScope, $document) { var Attributes = function(element, attr) { this.$$element = element; this.$attr = attr || {}; }; Attributes.prototype = { $normalize: directiveNormalize, /** * Set a normalized attribute on the element in a way such that all directives * can share the attribute. This function properly handles boolean attributes. * @param {string} key Normalized key. (ie ngAttribute) * @param {string|boolean} value The value to set. If `null` attribute will be deleted. * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute. * Defaults to true. * @param {string=} attrName Optional none normalized name. Defaults to key. */ $set: function(key, value, writeAttr, attrName) { var booleanKey = getBooleanAttrName(this.$$element[0], key), $$observers = this.$$observers, normalizedVal; if (booleanKey) { this.$$element.prop(key, value); attrName = booleanKey; } this[key] = value; // translate normalized key to actual key if (attrName) { this.$attr[key] = attrName; } else { attrName = this.$attr[key]; if (!attrName) { this.$attr[key] = attrName = snake_case(key, '-'); } } // sanitize a[href] values if (nodeName_(this.$$element[0]) === 'A' && key === 'href') { urlSanitizationNode.setAttribute('href', value); // href property always returns normalized absolute url, so we can match against that normalizedVal = urlSanitizationNode.href; if (!normalizedVal.match(urlSanitizationWhitelist)) { this[key] = value = 'unsafe:' + normalizedVal; } } if (writeAttr !== false) { if (value === null || value === undefined) { this.$$element.removeAttr(attrName); } else { this.$$element.attr(attrName, value); } } // fire observers $$observers && forEach($$observers[key], function(fn) { try { fn(value); } catch (e) { $exceptionHandler(e); } }); }, /** * Observe an interpolated attribute. * The observer will never be called, if given attribute is not interpolated. * * @param {string} key Normalized key. (ie ngAttribute) . * @param {function(*)} fn Function that will be called whenever the attribute value changes. * @returns {function(*)} the `fn` Function passed in. */ $observe: function(key, fn) { var attrs = this, $$observers = (attrs.$$observers || (attrs.$$observers = {})), listeners = ($$observers[key] || ($$observers[key] = [])); listeners.push(fn); $rootScope.$evalAsync(function() { if (!listeners.$$inter) { // no one registered attribute interpolation function, so lets call it manually fn(attrs[key]); } }); return fn; } }; var urlSanitizationNode = $document[0].createElement('a'), startSymbol = $interpolate.startSymbol(), endSymbol = $interpolate.endSymbol(), denormalizeTemplate = (startSymbol == '{{' || endSymbol == '}}') ? identity : function denormalizeTemplate(template) { return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol); }, NG_ATTR_BINDING = /^ngAttr[A-Z]/; return compile; //================================ function compile($compileNodes, transcludeFn, maxPriority) { if (!($compileNodes instanceof jqLite)) { // jquery always rewraps, whereas we need to preserve the original selector so that we can modify it. $compileNodes = jqLite($compileNodes); } // We can not compile top level text elements since text nodes can be merged and we will // not be able to attach scope data to them, so we will wrap them in <span> forEach($compileNodes, function(node, index){ if (node.nodeType == 3 /* text node */ && node.nodeValue.match(/\S+/) /* non-empty */ ) { $compileNodes[index] = jqLite(node).wrap('<span></span>').parent()[0]; } }); var compositeLinkFn = compileNodes($compileNodes, transcludeFn, $compileNodes, maxPriority); return function publicLinkFn(scope, cloneConnectFn){ assertArg(scope, 'scope'); // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart // and sometimes changes the structure of the DOM. var $linkNode = cloneConnectFn ? JQLitePrototype.clone.call($compileNodes) // IMPORTANT!!! : $compileNodes; // Attach scope only to non-text nodes. for(var i = 0, ii = $linkNode.length; i<ii; i++) { var node = $linkNode[i]; if (node.nodeType == 1 /* element */ || node.nodeType == 9 /* document */) { $linkNode.eq(i).data('$scope', scope); } } safeAddClass($linkNode, 'ng-scope'); if (cloneConnectFn) cloneConnectFn($linkNode, scope); if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode); return $linkNode; }; } function wrongMode(localName, mode) { throw Error("Unsupported '" + mode + "' for '" + localName + "'."); } function safeAddClass($element, className) { try { $element.addClass(className); } catch(e) { // ignore, since it means that we are trying to set class on // SVG element, where class name is read-only. } } /** * Compile function matches each node in nodeList against the directives. Once all directives * for a particular node are collected their compile functions are executed. The compile * functions return values - the linking functions - are combined into a composite linking * function, which is the a linking function for the node. * * @param {NodeList} nodeList an array of nodes or NodeList to compile * @param {function(angular.Scope[, cloneAttachFn]} transcludeFn A linking function, where the * scope argument is auto-generated to the new child of the transcluded parent scope. * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then the * rootElement must be set the jqLite collection of the compile root. This is * needed so that the jqLite collection items can be replaced with widgets. * @param {number=} max directive priority * @returns {?function} A composite linking function of all of the matched directives or null. */ function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority) { var linkFns = [], nodeLinkFn, childLinkFn, directives, attrs, linkFnFound; for(var i = 0; i < nodeList.length; i++) { attrs = new Attributes(); // we must always refer to nodeList[i] since the nodes can be replaced underneath us. directives = collectDirectives(nodeList[i], [], attrs, maxPriority); nodeLinkFn = (directives.length) ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement) : null; childLinkFn = (nodeLinkFn && nodeLinkFn.terminal || !nodeList[i].childNodes || !nodeList[i].childNodes.length) ? null : compileNodes(nodeList[i].childNodes, nodeLinkFn ? nodeLinkFn.transclude : transcludeFn); linkFns.push(nodeLinkFn); linkFns.push(childLinkFn); linkFnFound = (linkFnFound || nodeLinkFn || childLinkFn); } // return a linking function if we have found anything, null otherwise return linkFnFound ? compositeLinkFn : null; function compositeLinkFn(scope, nodeList, $rootElement, boundTranscludeFn) { var nodeLinkFn, childLinkFn, node, childScope, childTranscludeFn, i, ii, n; // copy nodeList so that linking doesn't break due to live list updates. var stableNodeList = []; for (i = 0, ii = nodeList.length; i < ii; i++) { stableNodeList.push(nodeList[i]); } for(i = 0, n = 0, ii = linkFns.length; i < ii; n++) { node = stableNodeList[n]; nodeLinkFn = linkFns[i++]; childLinkFn = linkFns[i++]; if (nodeLinkFn) { if (nodeLinkFn.scope) { childScope = scope.$new(isObject(nodeLinkFn.scope)); jqLite(node).data('$scope', childScope); } else { childScope = scope; } childTranscludeFn = nodeLinkFn.transclude; if (childTranscludeFn || (!boundTranscludeFn && transcludeFn)) { nodeLinkFn(childLinkFn, childScope, node, $rootElement, (function(transcludeFn) { return function(cloneFn) { var transcludeScope = scope.$new(); transcludeScope.$$transcluded = true; return transcludeFn(transcludeScope, cloneFn). bind('$destroy', bind(transcludeScope, transcludeScope.$destroy)); }; })(childTranscludeFn || transcludeFn) ); } else { nodeLinkFn(childLinkFn, childScope, node, undefined, boundTranscludeFn); } } else if (childLinkFn) { childLinkFn(scope, node.childNodes, undefined, boundTranscludeFn); } } } } /** * Looks for directives on the given node and adds them to the directive collection which is * sorted. * * @param node Node to search. * @param directives An array to which the directives are added to. This array is sorted before * the function returns. * @param attrs The shared attrs object which is used to populate the normalized attributes. * @param {number=} maxPriority Max directive priority. */ function collectDirectives(node, directives, attrs, maxPriority) { var nodeType = node.nodeType, attrsMap = attrs.$attr, match, className; switch(nodeType) { case 1: /* Element */ // use the node name: <directive> addDirective(directives, directiveNormalize(nodeName_(node).toLowerCase()), 'E', maxPriority); // iterate over the attributes for (var attr, name, nName, ngAttrName, value, nAttrs = node.attributes, j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) { attr = nAttrs[j]; if (attr.specified) { name = attr.name; // support ngAttr attribute binding ngAttrName = directiveNormalize(name); if (NG_ATTR_BINDING.test(ngAttrName)) { name = ngAttrName.substr(6).toLowerCase(); } nName = directiveNormalize(name.toLowerCase()); attrsMap[nName] = name; attrs[nName] = value = trim((msie && name == 'href') ? decodeURIComponent(node.getAttribute(name, 2)) : attr.value); if (getBooleanAttrName(node, nName)) { attrs[nName] = true; // presence means true } addAttrInterpolateDirective(node, directives, value, nName); addDirective(directives, nName, 'A', maxPriority); } } // use class as directive className = node.className; if (isString(className) && className !== '') { while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) { nName = directiveNormalize(match[2]); if (addDirective(directives, nName, 'C', maxPriority)) { attrs[nName] = trim(match[3]); } className = className.substr(match.index + match[0].length); } } break; case 3: /* Text Node */ addTextInterpolateDirective(directives, node.nodeValue); break; case 8: /* Comment */ try { match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue); if (match) { nName = directiveNormalize(match[1]); if (addDirective(directives, nName, 'M', maxPriority)) { attrs[nName] = trim(match[2]); } } } catch (e) { // turns out that under some circumstances IE9 throws errors when one attempts to read comment's node value. // Just ignore it and continue. (Can't seem to reproduce in test case.) } break; } directives.sort(byPriority); return directives; } /** * Once the directives have been collected, their compile functions are executed. This method * is responsible for inlining directive templates as well as terminating the application * of the directives if the terminal directive has been reached. * * @param {Array} directives Array of collected directives to execute their compile function. * this needs to be pre-sorted by priority order. * @param {Node} compileNode The raw DOM node to apply the compile functions to * @param {Object} templateAttrs The shared attribute function * @param {function(angular.Scope[, cloneAttachFn]} transcludeFn A linking function, where the * scope argument is auto-generated to the new child of the transcluded parent scope. * @param {JQLite} jqCollection If we are working on the root of the compile tree then this * argument has the root jqLite array so that we can replace nodes on it. * @returns linkFn */ function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, jqCollection) { var terminalPriority = -Number.MAX_VALUE, preLinkFns = [], postLinkFns = [], newScopeDirective = null, newIsolateScopeDirective = null, templateDirective = null, $compileNode = templateAttrs.$$element = jqLite(compileNode), directive, directiveName, $template, transcludeDirective, childTranscludeFn = transcludeFn, controllerDirectives, linkFn, directiveValue; // executes all directives on the current element for(var i = 0, ii = directives.length; i < ii; i++) { directive = directives[i]; $template = undefined; if (terminalPriority > directive.priority) { break; // prevent further processing of directives } if (directiveValue = directive.scope) { assertNoDuplicate('isolated scope', newIsolateScopeDirective, directive, $compileNode); if (isObject(directiveValue)) { safeAddClass($compileNode, 'ng-isolate-scope'); newIsolateScopeDirective = directive; } safeAddClass($compileNode, 'ng-scope'); newScopeDirective = newScopeDirective || directive; } directiveName = directive.name; if (directiveValue = directive.controller) { controllerDirectives = controllerDirectives || {}; assertNoDuplicate("'" + directiveName + "' controller", controllerDirectives[directiveName], directive, $compileNode); controllerDirectives[directiveName] = directive; } if (directiveValue = directive.transclude) { assertNoDuplicate('transclusion', transcludeDirective, directive, $compileNode); transcludeDirective = directive; terminalPriority = directive.priority; if (directiveValue == 'element') { $template = jqLite(compileNode); $compileNode = templateAttrs.$$element = jqLite(document.createComment(' ' + directiveName + ': ' + templateAttrs[directiveName] + ' ')); compileNode = $compileNode[0]; replaceWith(jqCollection, jqLite($template[0]), compileNode); childTranscludeFn = compile($template, transcludeFn, terminalPriority); } else { $template = jqLite(JQLiteClone(compileNode)).contents(); $compileNode.html(''); // clear contents childTranscludeFn = compile($template, transcludeFn); } } if (directive.template) { assertNoDuplicate('template', templateDirective, directive, $compileNode); templateDirective = directive; directiveValue = (isFunction(directive.template)) ? directive.template($compileNode, templateAttrs) : directive.template; directiveValue = denormalizeTemplate(directiveValue); if (directive.replace) { $template = jqLite('<div>' + trim(directiveValue) + '</div>').contents(); compileNode = $template[0]; if ($template.length != 1 || compileNode.nodeType !== 1) { throw new Error(MULTI_ROOT_TEMPLATE_ERROR + directiveValue); } replaceWith(jqCollection, $compileNode, compileNode); var newTemplateAttrs = {$attr: {}}; // combine directives from the original node and from the template: // - take the array of directives for this element // - split it into two parts, those that were already applied and those that weren't // - collect directives from the template, add them to the second group and sort them // - append the second group with new directives to the first group directives = directives.concat( collectDirectives( compileNode, directives.splice(i + 1, directives.length - (i + 1)), newTemplateAttrs ) ); mergeTemplateAttributes(templateAttrs, newTemplateAttrs); ii = directives.length; } else { $compileNode.html(directiveValue); } } if (directive.templateUrl) { assertNoDuplicate('template', templateDirective, directive, $compileNode); templateDirective = directive; nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), nodeLinkFn, $compileNode, templateAttrs, jqCollection, directive.replace, childTranscludeFn); ii = directives.length; } else if (directive.compile) { try { linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn); if (isFunction(linkFn)) { addLinkFns(null, linkFn); } else if (linkFn) { addLinkFns(linkFn.pre, linkFn.post); } } catch (e) { $exceptionHandler(e, startingTag($compileNode)); } } if (directive.terminal) { nodeLinkFn.terminal = true; terminalPriority = Math.max(terminalPriority, directive.priority); } } nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope; nodeLinkFn.transclude = transcludeDirective && childTranscludeFn; // might be normal or delayed nodeLinkFn depending on if templateUrl is present return nodeLinkFn; //////////////////// function addLinkFns(pre, post) { if (pre) { pre.require = directive.require; preLinkFns.push(pre); } if (post) { post.require = directive.require; postLinkFns.push(post); } } function getControllers(require, $element) { var value, retrievalMethod = 'data', optional = false; if (isString(require)) { while((value = require.charAt(0)) == '^' || value == '?') { require = require.substr(1); if (value == '^') { retrievalMethod = 'inheritedData'; } optional = optional || value == '?'; } value = $element[retrievalMethod]('$' + require + 'Controller'); if (!value && !optional) { throw Error("No controller: " + require); } return value; } else if (isArray(require)) { value = []; forEach(require, function(require) { value.push(getControllers(require, $element)); }); } return value; } function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) { var attrs, $element, i, ii, linkFn, controller; if (compileNode === linkNode) { attrs = templateAttrs; } else { attrs = shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr)); } $element = attrs.$$element; if (newIsolateScopeDirective) { var LOCAL_REGEXP = /^\s*([@=&])(\??)\s*(\w*)\s*$/; var parentScope = scope.$parent || scope; forEach(newIsolateScopeDirective.scope, function(definiton, scopeName) { var match = definiton.match(LOCAL_REGEXP) || [], attrName = match[3] || scopeName, optional = (match[2] == '?'), mode = match[1], // @, =, or & lastValue, parentGet, parentSet; scope.$$isolateBindings[scopeName] = mode + attrName; switch (mode) { case '@': { attrs.$observe(attrName, function(value) { scope[scopeName] = value; }); attrs.$$observers[attrName].$$scope = parentScope; if( attrs[attrName] ) { // If the attribute has been provided then we trigger an interpolation to ensure the value is there for use in the link fn scope[scopeName] = $interpolate(attrs[attrName])(parentScope); } break; } case '=': { if (optional && !attrs[attrName]) { return; } parentGet = $parse(attrs[attrName]); parentSet = parentGet.assign || function() { // reset the change, or we will throw this exception on every $digest lastValue = scope[scopeName] = parentGet(parentScope); throw Error(NON_ASSIGNABLE_MODEL_EXPRESSION + attrs[attrName] + ' (directive: ' + newIsolateScopeDirective.name + ')'); }; lastValue = scope[scopeName] = parentGet(parentScope); scope.$watch(function parentValueWatch() { var parentValue = parentGet(parentScope); if (parentValue !== scope[scopeName]) { // we are out of sync and need to copy if (parentValue !== lastValue) { // parent changed and it has precedence lastValue = scope[scopeName] = parentValue; } else { // if the parent can be assigned then do so parentSet(parentScope, parentValue = lastValue = scope[scopeName]); } } return parentValue; }); break; } case '&': { parentGet = $parse(attrs[attrName]); scope[scopeName] = function(locals) { return parentGet(parentScope, locals); }; break; } default: { throw Error('Invalid isolate scope definition for directive ' + newIsolateScopeDirective.name + ': ' + definiton); } } }); } if (controllerDirectives) { forEach(controllerDirectives, function(directive) { var locals = { $scope: scope, $element: $element, $attrs: attrs, $transclude: boundTranscludeFn }; controller = directive.controller; if (controller == '@') { controller = attrs[directive.name]; } $element.data( '$' + directive.name + 'Controller', $controller(controller, locals)); }); } // PRELINKING for(i = 0, ii = preLinkFns.length; i < ii; i++) { try { linkFn = preLinkFns[i]; linkFn(scope, $element, attrs, linkFn.require && getControllers(linkFn.require, $element)); } catch (e) { $exceptionHandler(e, startingTag($element)); } } // RECURSION childLinkFn && childLinkFn(scope, linkNode.childNodes, undefined, boundTranscludeFn); // POSTLINKING for(i = 0, ii = postLinkFns.length; i < ii; i++) { try { linkFn = postLinkFns[i]; linkFn(scope, $element, attrs, linkFn.require && getControllers(linkFn.require, $element)); } catch (e) { $exceptionHandler(e, startingTag($element)); } } } } /** * looks up the directive and decorates it with exception handling and proper parameters. We * call this the boundDirective. * * @param {string} name name of the directive to look up. * @param {string} location The directive must be found in specific format. * String containing any of theses characters: * * * `E`: element name * * `A': attribute * * `C`: class * * `M`: comment * @returns true if directive was added. */ function addDirective(tDirectives, name, location, maxPriority) { var match = false; if (hasDirectives.hasOwnProperty(name)) { for(var directive, directives = $injector.get(name + Suffix), i = 0, ii = directives.length; i<ii; i++) { try { directive = directives[i]; if ( (maxPriority === undefined || maxPriority > directive.priority) && directive.restrict.indexOf(location) != -1) { tDirectives.push(directive); match = true; } } catch(e) { $exceptionHandler(e); } } } return match; } /** * When the element is replaced with HTML template then the new attributes * on the template need to be merged with the existing attributes in the DOM. * The desired effect is to have both of the attributes present. * * @param {object} dst destination attributes (original DOM) * @param {object} src source attributes (from the directive template) */ function mergeTemplateAttributes(dst, src) { var srcAttr = src.$attr, dstAttr = dst.$attr, $element = dst.$$element; // reapply the old attributes to the new element forEach(dst, function(value, key) { if (key.charAt(0) != '$') { if (src[key]) { value += (key === 'style' ? ';' : ' ') + src[key]; } dst.$set(key, value, true, srcAttr[key]); } }); // copy the new attributes on the old attrs object forEach(src, function(value, key) { if (key == 'class') { safeAddClass($element, value); dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value; } else if (key == 'style') { $element.attr('style', $element.attr('style') + ';' + value); } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) { dst[key] = value; dstAttr[key] = srcAttr[key]; } }); } function compileTemplateUrl(directives, beforeTemplateNodeLinkFn, $compileNode, tAttrs, $rootElement, replace, childTranscludeFn) { var linkQueue = [], afterTemplateNodeLinkFn, afterTemplateChildLinkFn, beforeTemplateCompileNode = $compileNode[0], origAsyncDirective = directives.shift(), // The fact that we have to copy and patch the directive seems wrong! derivedSyncDirective = extend({}, origAsyncDirective, { controller: null, templateUrl: null, transclude: null, scope: null }), templateUrl = (isFunction(origAsyncDirective.templateUrl)) ? origAsyncDirective.templateUrl($compileNode, tAttrs) : origAsyncDirective.templateUrl; $compileNode.html(''); $http.get(templateUrl, {cache: $templateCache}). success(function(content) { var compileNode, tempTemplateAttrs, $template; content = denormalizeTemplate(content); if (replace) { $template = jqLite('<div>' + trim(content) + '</div>').contents(); compileNode = $template[0]; if ($template.length != 1 || compileNode.nodeType !== 1) { throw new Error(MULTI_ROOT_TEMPLATE_ERROR + content); } tempTemplateAttrs = {$attr: {}}; replaceWith($rootElement, $compileNode, compileNode); collectDirectives(compileNode, directives, tempTemplateAttrs); mergeTemplateAttributes(tAttrs, tempTemplateAttrs); } else { compileNode = beforeTemplateCompileNode; $compileNode.html(content); } directives.unshift(derivedSyncDirective); afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs, childTranscludeFn); afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn); while(linkQueue.length) { var scope = linkQueue.shift(), beforeTemplateLinkNode = linkQueue.shift(), linkRootElement = linkQueue.shift(), controller = linkQueue.shift(), linkNode = compileNode; if (beforeTemplateLinkNode !== beforeTemplateCompileNode) { // it was cloned therefore we have to clone as well. linkNode = JQLiteClone(compileNode); replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode); } afterTemplateNodeLinkFn(function() { beforeTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement, controller); }, scope, linkNode, $rootElement, controller); } linkQueue = null; }). error(function(response, code, headers, config) { throw Error('Failed to load template: ' + config.url); }); return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, controller) { if (linkQueue) { linkQueue.push(scope); linkQueue.push(node); linkQueue.push(rootElement); linkQueue.push(controller); } else { afterTemplateNodeLinkFn(function() { beforeTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, controller); }, scope, node, rootElement, controller); } }; } /** * Sorting function for bound directives. */ function byPriority(a, b) { return b.priority - a.priority; } function assertNoDuplicate(what, previousDirective, directive, element) { if (previousDirective) { throw Error('Multiple directives [' + previousDirective.name + ', ' + directive.name + '] asking for ' + what + ' on: ' + startingTag(element)); } } function addTextInterpolateDirective(directives, text) { var interpolateFn = $interpolate(text, true); if (interpolateFn) { directives.push({ priority: 0, compile: valueFn(function textInterpolateLinkFn(scope, node) { var parent = node.parent(), bindings = parent.data('$binding') || []; bindings.push(interpolateFn); safeAddClass(parent.data('$binding', bindings), 'ng-binding'); scope.$watch(interpolateFn, function interpolateFnWatchAction(value) { node[0].nodeValue = value; }); }) }); } } function addAttrInterpolateDirective(node, directives, value, name) { var interpolateFn = $interpolate(value, true); // no interpolation found -> ignore if (!interpolateFn) return; directives.push({ priority: 100, compile: valueFn(function attrInterpolateLinkFn(scope, element, attr) { var $$observers = (attr.$$observers || (attr.$$observers = {})); // we need to interpolate again, in case the attribute value has been updated // (e.g. by another directive's compile function) interpolateFn = $interpolate(attr[name], true); // if attribute was updated so that there is no interpolation going on we don't want to // register any observers if (!interpolateFn) return; attr[name] = interpolateFn(scope); ($$observers[name] || ($$observers[name] = [])).$$inter = true; (attr.$$observers && attr.$$observers[name].$$scope || scope). $watch(interpolateFn, function interpolateFnWatchAction(value) { attr.$set(name, value); }); }) }); } /** * This is a special jqLite.replaceWith, which can replace items which * have no parents, provided that the containing jqLite collection is provided. * * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes * in the root of the tree. * @param {JqLite} $element The jqLite element which we are going to replace. We keep the shell, * but replace its DOM node reference. * @param {Node} newNode The new DOM node. */ function replaceWith($rootElement, $element, newNode) { var oldNode = $element[0], parent = oldNode.parentNode, i, ii; if ($rootElement) { for(i = 0, ii = $rootElement.length; i < ii; i++) { if ($rootElement[i] == oldNode) { $rootElement[i] = newNode; break; } } } if (parent) { parent.replaceChild(newNode, oldNode); } newNode[jqLite.expando] = oldNode[jqLite.expando]; $element[0] = newNode; } }]; } var PREFIX_REGEXP = /^(x[\:\-_]|data[\:\-_])/i; /** * Converts all accepted directives format into proper directive name. * All of these will become 'myDirective': * my:DiRective * my-directive * x-my-directive * data-my:directive * * Also there is special case for Moz prefix starting with upper case letter. * @param name Name to normalize */ function directiveNormalize(name) { return camelCase(name.replace(PREFIX_REGEXP, '')); } /** * @ngdoc object * @name ng.$compile.directive.Attributes * @description * * A shared object between directive compile / linking functions which contains normalized DOM element * attributes. The the values reflect current binding state `{{ }}`. The normalization is needed * since all of these are treated as equivalent in Angular: * * <span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a"> */ /** * @ngdoc property * @name ng.$compile.directive.Attributes#$attr * @propertyOf ng.$compile.directive.Attributes * @returns {object} A map of DOM element attribute names to the normalized name. This is * needed to do reverse lookup from normalized name back to actual name. */ /** * @ngdoc function * @name ng.$compile.directive.Attributes#$set * @methodOf ng.$compile.directive.Attributes * @function * * @description * Set DOM element attribute value. * * * @param {string} name Normalized element attribute name of the property to modify. The name is * revers translated using the {@link ng.$compile.directive.Attributes#$attr $attr} * property to the original name. * @param {string} value Value to set the attribute to. The value can be an interpolated string. */ /** * Closure compiler type information */ function nodesetLinkingFn( /* angular.Scope */ scope, /* NodeList */ nodeList, /* Element */ rootElement, /* function(Function) */ boundTranscludeFn ){} function directiveLinkingFn( /* nodesetLinkingFn */ nodesetLinkingFn, /* angular.Scope */ scope, /* Node */ node, /* Element */ rootElement, /* function(Function) */ boundTranscludeFn ){} /** * @ngdoc object * @name ng.$controllerProvider * @description * The {@link ng.$controller $controller service} is used by Angular to create new * controllers. * * This provider allows controller registration via the * {@link ng.$controllerProvider#register register} method. */ function $ControllerProvider() { var controllers = {}, CNTRL_REG = /^(\S+)(\s+as\s+(\w+))?$/; /** * @ngdoc function * @name ng.$controllerProvider#register * @methodOf ng.$controllerProvider * @param {string} name Controller name * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI * annotations in the array notation). */ this.register = function(name, constructor) { if (isObject(name)) { extend(controllers, name) } else { controllers[name] = constructor; } }; this.$get = ['$injector', '$window', function($injector, $window) { /** * @ngdoc function * @name ng.$controller * @requires $injector * * @param {Function|string} constructor If called with a function then it's considered to be the * controller constructor function. Otherwise it's considered to be a string which is used * to retrieve the controller constructor using the following steps: * * * check if a controller with given name is registered via `$controllerProvider` * * check if evaluating the string on the current scope returns a constructor * * check `window[constructor]` on the global `window` object * * @param {Object} locals Injection locals for Controller. * @return {Object} Instance of given controller. * * @description * `$controller` service is responsible for instantiating controllers. * * It's just a simple call to {@link AUTO.$injector $injector}, but extracted into * a service, so that one can override this service with {@link https://gist.github.com/1649788 * BC version}. */ return function(expression, locals) { var instance, match, constructor, identifier; if(isString(expression)) { match = expression.match(CNTRL_REG), constructor = match[1], identifier = match[3]; expression = controllers.hasOwnProperty(constructor) ? controllers[constructor] : getter(locals.$scope, constructor, true) || getter($window, constructor, true); assertArgFn(expression, constructor, true); } instance = $injector.instantiate(expression, locals); if (identifier) { if (typeof locals.$scope !== 'object') { throw new Error('Can not export controller as "' + identifier + '". ' + 'No scope object provided!'); } locals.$scope[identifier] = instance; } return instance; }; }]; } /** * @ngdoc object * @name ng.$document * @requires $window * * @description * A {@link angular.element jQuery (lite)}-wrapped reference to the browser's `window.document` * element. */ function $DocumentProvider(){ this.$get = ['$window', function(window){ return jqLite(window.document); }]; } /** * @ngdoc function * @name ng.$exceptionHandler * @requires $log * * @description * Any uncaught exception in angular expressions is delegated to this service. * The default implementation simply delegates to `$log.error` which logs it into * the browser console. * * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing. * * @param {Error} exception Exception associated with the error. * @param {string=} cause optional information about the context in which * the error was thrown. * */ function $ExceptionHandlerProvider() { this.$get = ['$log', function($log) { return function(exception, cause) { $log.error.apply($log, arguments); }; }]; } /** * @ngdoc object * @name ng.$interpolateProvider * @function * * @description * * Used for configuring the interpolation markup. Defaults to `{{` and `}}`. */ function $InterpolateProvider() { var startSymbol = '{{'; var endSymbol = '}}'; /** * @ngdoc method * @name ng.$interpolateProvider#startSymbol * @methodOf ng.$interpolateProvider * @description * Symbol to denote start of expression in the interpolated string. Defaults to `{{`. * * @param {string=} value new value to set the starting symbol to. * @returns {string|self} Returns the symbol when used as getter and self if used as setter. */ this.startSymbol = function(value){ if (value) { startSymbol = value; return this; } else { return startSymbol; } }; /** * @ngdoc method * @name ng.$interpolateProvider#endSymbol * @methodOf ng.$interpolateProvider * @description * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`. * * @param {string=} value new value to set the ending symbol to. * @returns {string|self} Returns the symbol when used as getter and self if used as setter. */ this.endSymbol = function(value){ if (value) { endSymbol = value; return this; } else { return endSymbol; } }; this.$get = ['$parse', '$exceptionHandler', function($parse, $exceptionHandler) { var startSymbolLength = startSymbol.length, endSymbolLength = endSymbol.length; /** * @ngdoc function * @name ng.$interpolate * @function * * @requires $parse * * @description * * Compiles a string with markup into an interpolation function. This service is used by the * HTML {@link ng.$compile $compile} service for data binding. See * {@link ng.$interpolateProvider $interpolateProvider} for configuring the * interpolation markup. * * <pre> var $interpolate = ...; // injected var exp = $interpolate('Hello {{name}}!'); expect(exp({name:'Angular'}).toEqual('Hello Angular!'); </pre> * * * @param {string} text The text with markup to interpolate. * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have * embedded expression in order to return an interpolation function. Strings with no * embedded expression will return null for the interpolation function. * @returns {function(context)} an interpolation function which is used to compute the interpolated * string. The function has these parameters: * * * `context`: an object against which any expressions embedded in the strings are evaluated * against. * */ function $interpolate(text, mustHaveExpression) { var startIndex, endIndex, index = 0, parts = [], length = text.length, hasInterpolation = false, fn, exp, concat = []; while(index < length) { if ( ((startIndex = text.indexOf(startSymbol, index)) != -1) && ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1) ) { (index != startIndex) && parts.push(text.substring(index, startIndex)); parts.push(fn = $parse(exp = text.substring(startIndex + startSymbolLength, endIndex))); fn.exp = exp; index = endIndex + endSymbolLength; hasInterpolation = true; } else { // we did not find anything, so we have to add the remainder to the parts array (index != length) && parts.push(text.substring(index)); index = length; } } if (!(length = parts.length)) { // we added, nothing, must have been an empty string. parts.push(''); length = 1; } if (!mustHaveExpression || hasInterpolation) { concat.length = length; fn = function(context) { try { for(var i = 0, ii = length, part; i<ii; i++) { if (typeof (part = parts[i]) == 'function') { part = part(context); if (part == null || part == undefined) { part = ''; } else if (typeof part != 'string') { part = toJson(part); } } concat[i] = part; } return concat.join(''); } catch(err) { var newErr = new Error('Error while interpolating: ' + text + '\n' + err.toString()); $exceptionHandler(newErr); } }; fn.exp = text; fn.parts = parts; return fn; } } /** * @ngdoc method * @name ng.$interpolate#startSymbol * @methodOf ng.$interpolate * @description * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`. * * Use {@link ng.$interpolateProvider#startSymbol $interpolateProvider#startSymbol} to change * the symbol. * * @returns {string} start symbol. */ $interpolate.startSymbol = function() { return startSymbol; } /** * @ngdoc method * @name ng.$interpolate#endSymbol * @methodOf ng.$interpolate * @description * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`. * * Use {@link ng.$interpolateProvider#endSymbol $interpolateProvider#endSymbol} to change * the symbol. * * @returns {string} start symbol. */ $interpolate.endSymbol = function() { return endSymbol; } return $interpolate; }]; } var SERVER_MATCH = /^([^:]+):\/\/(\w+:{0,1}\w*@)?(\{?[\w\.-]*\}?)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/, PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/, DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21}; /** * Encode path using encodeUriSegment, ignoring forward slashes * * @param {string} path Path to encode * @returns {string} */ function encodePath(path) { var segments = path.split('/'), i = segments.length; while (i--) { segments[i] = encodeUriSegment(segments[i]); } return segments.join('/'); } function matchUrl(url, obj) { var match = SERVER_MATCH.exec(url); obj.$$protocol = match[1]; obj.$$host = match[3]; obj.$$port = int(match[5]) || DEFAULT_PORTS[match[1]] || null; } function matchAppUrl(url, obj) { var match = PATH_MATCH.exec(url); obj.$$path = decodeURIComponent(match[1]); obj.$$search = parseKeyValue(match[3]); obj.$$hash = decodeURIComponent(match[5] || ''); // make sure path starts with '/'; if (obj.$$path && obj.$$path.charAt(0) != '/') obj.$$path = '/' + obj.$$path; } function composeProtocolHostPort(protocol, host, port) { return protocol + '://' + host + (port == DEFAULT_PORTS[protocol] ? '' : ':' + port); } /** * * @param {string} begin * @param {string} whole * @param {string} otherwise * @returns {string} returns text from whole after begin or otherwise if it does not begin with expected string. */ function beginsWith(begin, whole, otherwise) { return whole.indexOf(begin) == 0 ? whole.substr(begin.length) : otherwise; } function stripHash(url) { var index = url.indexOf('#'); return index == -1 ? url : url.substr(0, index); } function stripFile(url) { return url.substr(0, stripHash(url).lastIndexOf('/') + 1); } /* return the server only */ function serverBase(url) { return url.substring(0, url.indexOf('/', url.indexOf('//') + 2)); } /** * LocationHtml5Url represents an url * This object is exposed as $location service when HTML5 mode is enabled and supported * * @constructor * @param {string} appBase application base URL * @param {string} basePrefix url path prefix */ function LocationHtml5Url(appBase, basePrefix) { basePrefix = basePrefix || ''; var appBaseNoFile = stripFile(appBase); /** * Parse given html5 (regular) url string into properties * @param {string} newAbsoluteUrl HTML5 url * @private */ this.$$parse = function(url) { var parsed = {} matchUrl(url, parsed); var pathUrl = beginsWith(appBaseNoFile, url); if (!isString(pathUrl)) { throw Error('Invalid url "' + url + '", missing path prefix "' + appBaseNoFile + '".'); } matchAppUrl(pathUrl, parsed); extend(this, parsed); if (!this.$$path) { this.$$path = '/'; } this.$$compose(); }; /** * Compose url and update `absUrl` property * @private */ this.$$compose = function() { var search = toKeyValue(this.$$search), hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/' }; this.$$rewrite = function(url) { var appUrl, prevAppUrl; if ( (appUrl = beginsWith(appBase, url)) !== undefined ) { prevAppUrl = appUrl; if ( (appUrl = beginsWith(basePrefix, appUrl)) !== undefined ) { return appBaseNoFile + (beginsWith('/', appUrl) || appUrl); } else { return appBase + prevAppUrl; } } else if ( (appUrl = beginsWith(appBaseNoFile, url)) !== undefined ) { return appBaseNoFile + appUrl; } else if (appBaseNoFile == url + '/') { return appBaseNoFile; } } } /** * LocationHashbangUrl represents url * This object is exposed as $location service when html5 history api is disabled or not supported * * @constructor * @param {string} appBase application base URL * @param {string} hashPrefix hashbang prefix */ function LocationHashbangUrl(appBase, hashPrefix) { var appBaseNoFile = stripFile(appBase); /** * Parse given hashbang url into properties * @param {string} url Hashbang url * @private */ this.$$parse = function(url) { matchUrl(url, this); var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url); if (!isString(withoutBaseUrl)) { throw new Error('Invalid url "' + url + '", does not start with "' + appBase + '".'); } var withoutHashUrl = withoutBaseUrl.charAt(0) == '#' ? beginsWith(hashPrefix, withoutBaseUrl) : withoutBaseUrl; if (!isString(withoutHashUrl)) { throw new Error('Invalid url "' + url + '", missing hash prefix "' + hashPrefix + '".'); } matchAppUrl(withoutHashUrl, this); this.$$compose(); }; /** * Compose hashbang url and update `absUrl` property * @private */ this.$$compose = function() { var search = toKeyValue(this.$$search), hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : ''; this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash; this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : ''); }; this.$$rewrite = function(url) { if(stripHash(appBase) == stripHash(url)) { return url; } } } /** * LocationHashbangUrl represents url * This object is exposed as $location service when html5 history api is enabled but the browser * does not support it. * * @constructor * @param {string} appBase application base URL * @param {string} hashPrefix hashbang prefix */ function LocationHashbangInHtml5Url(appBase, hashPrefix) { LocationHashbangUrl.apply(this, arguments); var appBaseNoFile = stripFile(appBase); this.$$rewrite = function(url) { var appUrl; if ( appBase == stripHash(url) ) { return url; } else if ( (appUrl = beginsWith(appBaseNoFile, url)) ) { return appBase + hashPrefix + appUrl; } else if ( appBaseNoFile === url + '/') { return appBaseNoFile; } } } LocationHashbangInHtml5Url.prototype = LocationHashbangUrl.prototype = LocationHtml5Url.prototype = { /** * Has any change been replacing ? * @private */ $$replace: false, /** * @ngdoc method * @name ng.$location#absUrl * @methodOf ng.$location * * @description * This method is getter only. * * Return full url representation with all segments encoded according to rules specified in * {@link http://www.ietf.org/rfc/rfc3986.txt RFC 3986}. * * @return {string} full url */ absUrl: locationGetter('$$absUrl'), /** * @ngdoc method * @name ng.$location#url * @methodOf ng.$location * * @description * This method is getter / setter. * * Return url (e.g. `/path?a=b#hash`) when called without any parameter. * * Change path, search and hash, when called with parameter and return `$location`. * * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`) * @return {string} url */ url: function(url, replace) { if (isUndefined(url)) return this.$$url; var match = PATH_MATCH.exec(url); if (match[1]) this.path(decodeURIComponent(match[1])); if (match[2] || match[1]) this.search(match[3] || ''); this.hash(match[5] || '', replace); return this; }, /** * @ngdoc method * @name ng.$location#protocol * @methodOf ng.$location * * @description * This method is getter only. * * Return protocol of current url. * * @return {string} protocol of current url */ protocol: locationGetter('$$protocol'), /** * @ngdoc method * @name ng.$location#host * @methodOf ng.$location * * @description * This method is getter only. * * Return host of current url. * * @return {string} host of current url. */ host: locationGetter('$$host'), /** * @ngdoc method * @name ng.$location#port * @methodOf ng.$location * * @description * This method is getter only. * * Return port of current url. * * @return {Number} port */ port: locationGetter('$$port'), /** * @ngdoc method * @name ng.$location#path * @methodOf ng.$location * * @description * This method is getter / setter. * * Return path of current url when called without any parameter. * * Change path when called with parameter and return `$location`. * * Note: Path should always begin with forward slash (/), this method will add the forward slash * if it is missing. * * @param {string=} path New path * @return {string} path */ path: locationGetterSetter('$$path', function(path) { return path.charAt(0) == '/' ? path : '/' + path; }), /** * @ngdoc method * @name ng.$location#search * @methodOf ng.$location * * @description * This method is getter / setter. * * Return search part (as object) of current url when called without any parameter. * * Change search part when called with parameter and return `$location`. * * @param {string|object<string,string>=} search New search params - string or hash object * @param {string=} paramValue If `search` is a string, then `paramValue` will override only a * single search parameter. If the value is `null`, the parameter will be deleted. * * @return {string} search */ search: function(search, paramValue) { if (isUndefined(search)) return this.$$search; if (isDefined(paramValue)) { if (paramValue === null) { delete this.$$search[search]; } else { this.$$search[search] = paramValue; } } else { this.$$search = isString(search) ? parseKeyValue(search) : search; } this.$$compose(); return this; }, /** * @ngdoc method * @name ng.$location#hash * @methodOf ng.$location * * @description * This method is getter / setter. * * Return hash fragment when called without any parameter. * * Change hash fragment when called with parameter and return `$location`. * * @param {string=} hash New hash fragment * @return {string} hash */ hash: locationGetterSetter('$$hash', identity), /** * @ngdoc method * @name ng.$location#replace * @methodOf ng.$location * * @description * If called, all changes to $location during current `$digest` will be replacing current history * record, instead of adding new one. */ replace: function() { this.$$replace = true; return this; } }; function locationGetter(property) { return function() { return this[property]; }; } function locationGetterSetter(property, preprocess) { return function(value) { if (isUndefined(value)) return this[property]; this[property] = preprocess(value); this.$$compose(); return this; }; } /** * @ngdoc object * @name ng.$location * * @requires $browser * @requires $sniffer * @requires $rootElement * * @description * The $location service parses the URL in the browser address bar (based on the * {@link https://developer.mozilla.org/en/window.location window.location}) and makes the URL * available to your application. Changes to the URL in the address bar are reflected into * $location service and changes to $location are reflected into the browser address bar. * * **The $location service:** * * - Exposes the current URL in the browser address bar, so you can * - Watch and observe the URL. * - Change the URL. * - Synchronizes the URL with the browser when the user * - Changes the address bar. * - Clicks the back or forward button (or clicks a History link). * - Clicks on a link. * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash). * * For more information see {@link guide/dev_guide.services.$location Developer Guide: Angular * Services: Using $location} */ /** * @ngdoc object * @name ng.$locationProvider * @description * Use the `$locationProvider` to configure how the application deep linking paths are stored. */ function $LocationProvider(){ var hashPrefix = '', html5Mode = false; /** * @ngdoc property * @name ng.$locationProvider#hashPrefix * @methodOf ng.$locationProvider * @description * @param {string=} prefix Prefix for hash part (containing path and search) * @returns {*} current value if used as getter or itself (chaining) if used as setter */ this.hashPrefix = function(prefix) { if (isDefined(prefix)) { hashPrefix = prefix; return this; } else { return hashPrefix; } }; /** * @ngdoc property * @name ng.$locationProvider#html5Mode * @methodOf ng.$locationProvider * @description * @param {string=} mode Use HTML5 strategy if available. * @returns {*} current value if used as getter or itself (chaining) if used as setter */ this.html5Mode = function(mode) { if (isDefined(mode)) { html5Mode = mode; return this; } else { return html5Mode; } }; this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', function( $rootScope, $browser, $sniffer, $rootElement) { var $location, LocationMode, baseHref = $browser.baseHref(), initialUrl = $browser.url(), appBase; if (html5Mode) { appBase = baseHref ? serverBase(initialUrl) + baseHref : initialUrl; LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url; } else { appBase = stripHash(initialUrl); LocationMode = LocationHashbangUrl; } $location = new LocationMode(appBase, '#' + hashPrefix); $location.$$parse($location.$$rewrite(initialUrl)); $rootElement.bind('click', function(event) { // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser) // currently we open nice url link and redirect then if (event.ctrlKey || event.metaKey || event.which == 2) return; var elm = jqLite(event.target); // traverse the DOM up to find first A tag while (lowercase(elm[0].nodeName) !== 'a') { // ignore rewriting if no A tag (reached root element, or no parent - removed from document) if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return; } var absHref = elm.prop('href'); var rewrittenUrl = $location.$$rewrite(absHref); if (absHref && !elm.attr('target') && rewrittenUrl && !event.isDefaultPrevented()) { event.preventDefault(); if (rewrittenUrl != $browser.url()) { // update location manually $location.$$parse(rewrittenUrl); $rootScope.$apply(); // hack to work around FF6 bug 684208 when scenario runner clicks on links window.angular['ff-684208-preventDefault'] = true; } } }); // rewrite hashbang url <> html5 url if ($location.absUrl() != initialUrl) { $browser.url($location.absUrl(), true); } // update $location when $browser url changes $browser.onUrlChange(function(newUrl) { if ($location.absUrl() != newUrl) { if ($rootScope.$broadcast('$locationChangeStart', newUrl, $location.absUrl()).defaultPrevented) { $browser.url($location.absUrl()); return; } $rootScope.$evalAsync(function() { var oldUrl = $location.absUrl(); $location.$$parse(newUrl); afterLocationChange(oldUrl); }); if (!$rootScope.$$phase) $rootScope.$digest(); } }); // update browser var changeCounter = 0; $rootScope.$watch(function $locationWatch() { var oldUrl = $browser.url(); var currentReplace = $location.$$replace; if (!changeCounter || oldUrl != $location.absUrl()) { changeCounter++; $rootScope.$evalAsync(function() { if ($rootScope.$broadcast('$locationChangeStart', $location.absUrl(), oldUrl). defaultPrevented) { $location.$$parse(oldUrl); } else { $browser.url($location.absUrl(), currentReplace); afterLocationChange(oldUrl); } }); } $location.$$replace = false; return changeCounter; }); return $location; function afterLocationChange(oldUrl) { $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl); } }]; } /** * @ngdoc object * @name ng.$log * @requires $window * * @description * Simple service for logging. Default implementation writes the message * into the browser's console (if present). * * The main purpose of this service is to simplify debugging and troubleshooting. * * @example <example> <file name="script.js"> function LogCtrl($scope, $log) { $scope.$log = $log; $scope.message = 'Hello World!'; } </file> <file name="index.html"> <div ng-controller="LogCtrl"> <p>Reload this page with open console, enter text and hit the log button...</p> Message: <input type="text" ng-model="message"/> <button ng-click="$log.log(message)">log</button> <button ng-click="$log.warn(message)">warn</button> <button ng-click="$log.info(message)">info</button> <button ng-click="$log.error(message)">error</button> </div> </file> </example> */ /** * @ngdoc object * @name ng.$logProvider * @description * Use the `$logProvider` to configure how the application logs messages */ function $LogProvider(){ var debug = true, self = this; /** * @ngdoc property * @name ng.$logProvider#debugEnabled * @methodOf ng.$logProvider * @description * @param {string=} flag enable or disable debug level messages * @returns {*} current value if used as getter or itself (chaining) if used as setter */ this.debugEnabled = function(flag) { if (isDefined(flag)) { debug = flag; return this; } else { return debug; } }; this.$get = ['$window', function($window){ return { /** * @ngdoc method * @name ng.$log#log * @methodOf ng.$log * * @description * Write a log message */ log: consoleLog('log'), /** * @ngdoc method * @name ng.$log#warn * @methodOf ng.$log * * @description * Write a warning message */ warn: consoleLog('warn'), /** * @ngdoc method * @name ng.$log#info * @methodOf ng.$log * * @description * Write an information message */ info: consoleLog('info'), /** * @ngdoc method * @name ng.$log#error * @methodOf ng.$log * * @description * Write an error message */ error: consoleLog('error'), /** * @ngdoc method * @name ng.$log#debug * @methodOf ng.$log * * @description * Write a debug message */ debug: (function () { var fn = consoleLog('debug'); return function() { if (debug) { fn.apply(self, arguments); } } }()) }; function formatError(arg) { if (arg instanceof Error) { if (arg.stack) { arg = (arg.message && arg.stack.indexOf(arg.message) === -1) ? 'Error: ' + arg.message + '\n' + arg.stack : arg.stack; } else if (arg.sourceURL) { arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line; } } return arg; } function consoleLog(type) { var console = $window.console || {}, logFn = console[type] || console.log || noop; if (logFn.apply) { return function() { var args = []; forEach(arguments, function(arg) { args.push(formatError(arg)); }); return logFn.apply(console, args); }; } // we are IE which either doesn't have window.console => this is noop and we do nothing, // or we are IE where console.log doesn't have apply so we log at least first 2 args return function(arg1, arg2) { logFn(arg1, arg2); } } }]; } var OPERATORS = { 'null':function(){return null;}, 'true':function(){return true;}, 'false':function(){return false;}, undefined:noop, '+':function(self, locals, a,b){ a=a(self, locals); b=b(self, locals); if (isDefined(a)) { if (isDefined(b)) { return a + b; } return a; } return isDefined(b)?b:undefined;}, '-':function(self, locals, a,b){a=a(self, locals); b=b(self, locals); return (isDefined(a)?a:0)-(isDefined(b)?b:0);}, '*':function(self, locals, a,b){return a(self, locals)*b(self, locals);}, '/':function(self, locals, a,b){return a(self, locals)/b(self, locals);}, '%':function(self, locals, a,b){return a(self, locals)%b(self, locals);}, '^':function(self, locals, a,b){return a(self, locals)^b(self, locals);}, '=':noop, '===':function(self, locals, a, b){return a(self, locals)===b(self, locals);}, '!==':function(self, locals, a, b){return a(self, locals)!==b(self, locals);}, '==':function(self, locals, a,b){return a(self, locals)==b(self, locals);}, '!=':function(self, locals, a,b){return a(self, locals)!=b(self, locals);}, '<':function(self, locals, a,b){return a(self, locals)<b(self, locals);}, '>':function(self, locals, a,b){return a(self, locals)>b(self, locals);}, '<=':function(self, locals, a,b){return a(self, locals)<=b(self, locals);}, '>=':function(self, locals, a,b){return a(self, locals)>=b(self, locals);}, '&&':function(self, locals, a,b){return a(self, locals)&&b(self, locals);}, '||':function(self, locals, a,b){return a(self, locals)||b(self, locals);}, '&':function(self, locals, a,b){return a(self, locals)&b(self, locals);}, // '|':function(self, locals, a,b){return a|b;}, '|':function(self, locals, a,b){return b(self, locals)(self, locals, a(self, locals));}, '!':function(self, locals, a){return !a(self, locals);} }; var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'}; function lex(text, csp){ var tokens = [], token, index = 0, json = [], ch, lastCh = ':'; // can start regexp while (index < text.length) { ch = text.charAt(index); if (is('"\'')) { readString(ch); } else if (isNumber(ch) || is('.') && isNumber(peek())) { readNumber(); } else if (isIdent(ch)) { readIdent(); // identifiers can only be if the preceding char was a { or , if (was('{,') && json[0]=='{' && (token=tokens[tokens.length-1])) { token.json = token.text.indexOf('.') == -1; } } else if (is('(){}[].,;:?')) { tokens.push({ index:index, text:ch, json:(was(':[,') && is('{[')) || is('}]:,') }); if (is('{[')) json.unshift(ch); if (is('}]')) json.shift(); index++; } else if (isWhitespace(ch)) { index++; continue; } else { var ch2 = ch + peek(), ch3 = ch2 + peek(2), fn = OPERATORS[ch], fn2 = OPERATORS[ch2], fn3 = OPERATORS[ch3]; if (fn3) { tokens.push({index:index, text:ch3, fn:fn3}); index += 3; } else if (fn2) { tokens.push({index:index, text:ch2, fn:fn2}); index += 2; } else if (fn) { tokens.push({index:index, text:ch, fn:fn, json: was('[,:') && is('+-')}); index += 1; } else { throwError("Unexpected next character ", index, index+1); } } lastCh = ch; } return tokens; function is(chars) { return chars.indexOf(ch) != -1; } function was(chars) { return chars.indexOf(lastCh) != -1; } function peek(i) { var num = i || 1; return index + num < text.length ? text.charAt(index + num) : false; } function isNumber(ch) { return '0' <= ch && ch <= '9'; } function isWhitespace(ch) { return ch == ' ' || ch == '\r' || ch == '\t' || ch == '\n' || ch == '\v' || ch == '\u00A0'; // IE treats non-breaking space as \u00A0 } function isIdent(ch) { return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || '_' == ch || ch == '$'; } function isExpOperator(ch) { return ch == '-' || ch == '+' || isNumber(ch); } function throwError(error, start, end) { end = end || index; throw Error("Lexer Error: " + error + " at column" + (isDefined(start) ? "s " + start + "-" + index + " [" + text.substring(start, end) + "]" : " " + end) + " in expression [" + text + "]."); } function readNumber() { var number = ""; var start = index; while (index < text.length) { var ch = lowercase(text.charAt(index)); if (ch == '.' || isNumber(ch)) { number += ch; } else { var peekCh = peek(); if (ch == 'e' && isExpOperator(peekCh)) { number += ch; } else if (isExpOperator(ch) && peekCh && isNumber(peekCh) && number.charAt(number.length - 1) == 'e') { number += ch; } else if (isExpOperator(ch) && (!peekCh || !isNumber(peekCh)) && number.charAt(number.length - 1) == 'e') { throwError('Invalid exponent'); } else { break; } } index++; } number = 1 * number; tokens.push({index:start, text:number, json:true, fn:function() {return number;}}); } function readIdent() { var ident = "", start = index, lastDot, peekIndex, methodName, ch; while (index < text.length) { ch = text.charAt(index); if (ch == '.' || isIdent(ch) || isNumber(ch)) { if (ch == '.') lastDot = index; ident += ch; } else { break; } index++; } //check if this is not a method invocation and if it is back out to last dot if (lastDot) { peekIndex = index; while(peekIndex < text.length) { ch = text.charAt(peekIndex); if (ch == '(') { methodName = ident.substr(lastDot - start + 1); ident = ident.substr(0, lastDot - start); index = peekIndex; break; } if(isWhitespace(ch)) { peekIndex++; } else { break; } } } var token = { index:start, text:ident }; if (OPERATORS.hasOwnProperty(ident)) { token.fn = token.json = OPERATORS[ident]; } else { var getter = getterFn(ident, csp); token.fn = extend(function(self, locals) { return (getter(self, locals)); }, { assign: function(self, value) { return setter(self, ident, value); } }); } tokens.push(token); if (methodName) { tokens.push({ index:lastDot, text: '.', json: false }); tokens.push({ index: lastDot + 1, text: methodName, json: false }); } } function readString(quote) { var start = index; index++; var string = ""; var rawString = quote; var escape = false; while (index < text.length) { var ch = text.charAt(index); rawString += ch; if (escape) { if (ch == 'u') { var hex = text.substring(index + 1, index + 5); if (!hex.match(/[\da-f]{4}/i)) throwError( "Invalid unicode escape [\\u" + hex + "]"); index += 4; string += String.fromCharCode(parseInt(hex, 16)); } else { var rep = ESCAPE[ch]; if (rep) { string += rep; } else { string += ch; } } escape = false; } else if (ch == '\\') { escape = true; } else if (ch == quote) { index++; tokens.push({ index:start, text:rawString, string:string, json:true, fn:function() { return string; } }); return; } else { string += ch; } index++; } throwError("Unterminated quote", start); } } ///////////////////////////////////////// function parser(text, json, $filter, csp){ var ZERO = valueFn(0), value, tokens = lex(text, csp), assignment = _assignment, functionCall = _functionCall, fieldAccess = _fieldAccess, objectIndex = _objectIndex, filterChain = _filterChain; if(json){ // The extra level of aliasing is here, just in case the lexer misses something, so that // we prevent any accidental execution in JSON. assignment = logicalOR; functionCall = fieldAccess = objectIndex = filterChain = function() { throwError("is not valid json", {text:text, index:0}); }; value = primary(); } else { value = statements(); } if (tokens.length !== 0) { throwError("is an unexpected token", tokens[0]); } value.literal = !!value.literal; value.constant = !!value.constant; return value; /////////////////////////////////// function throwError(msg, token) { throw Error("Syntax Error: Token '" + token.text + "' " + msg + " at column " + (token.index + 1) + " of the expression [" + text + "] starting at [" + text.substring(token.index) + "]."); } function peekToken() { if (tokens.length === 0) throw Error("Unexpected end of expression: " + text); return tokens[0]; } function peek(e1, e2, e3, e4) { if (tokens.length > 0) { var token = tokens[0]; var t = token.text; if (t==e1 || t==e2 || t==e3 || t==e4 || (!e1 && !e2 && !e3 && !e4)) { return token; } } return false; } function expect(e1, e2, e3, e4){ var token = peek(e1, e2, e3, e4); if (token) { if (json && !token.json) { throwError("is not valid json", token); } tokens.shift(); return token; } return false; } function consume(e1){ if (!expect(e1)) { throwError("is unexpected, expecting [" + e1 + "]", peek()); } } function unaryFn(fn, right) { return extend(function(self, locals) { return fn(self, locals, right); }, { constant:right.constant }); } function ternaryFn(left, middle, right){ return extend(function(self, locals){ return left(self, locals) ? middle(self, locals) : right(self, locals); }, { constant: left.constant && middle.constant && right.constant }); } function binaryFn(left, fn, right) { return extend(function(self, locals) { return fn(self, locals, left, right); }, { constant:left.constant && right.constant }); } function statements() { var statements = []; while(true) { if (tokens.length > 0 && !peek('}', ')', ';', ']')) statements.push(filterChain()); if (!expect(';')) { // optimize for the common case where there is only one statement. // TODO(size): maybe we should not support multiple statements? return statements.length == 1 ? statements[0] : function(self, locals){ var value; for ( var i = 0; i < statements.length; i++) { var statement = statements[i]; if (statement) value = statement(self, locals); } return value; }; } } } function _filterChain() { var left = expression(); var token; while(true) { if ((token = expect('|'))) { left = binaryFn(left, token.fn, filter()); } else { return left; } } } function filter() { var token = expect(); var fn = $filter(token.text); var argsFn = []; while(true) { if ((token = expect(':'))) { argsFn.push(expression()); } else { var fnInvoke = function(self, locals, input){ var args = [input]; for ( var i = 0; i < argsFn.length; i++) { args.push(argsFn[i](self, locals)); } return fn.apply(self, args); }; return function() { return fnInvoke; }; } } } function expression() { return assignment(); } function _assignment() { var left = ternary(); var right; var token; if ((token = expect('='))) { if (!left.assign) { throwError("implies assignment but [" + text.substring(0, token.index) + "] can not be assigned to", token); } right = ternary(); return function(scope, locals){ return left.assign(scope, right(scope, locals), locals); }; } else { return left; } } function ternary() { var left = logicalOR(); var middle; var token; if((token = expect('?'))){ middle = ternary(); if((token = expect(':'))){ return ternaryFn(left, middle, ternary()); } else { throwError('expected :', token); } } else { return left; } } function logicalOR() { var left = logicalAND(); var token; while(true) { if ((token = expect('||'))) { left = binaryFn(left, token.fn, logicalAND()); } else { return left; } } } function logicalAND() { var left = equality(); var token; if ((token = expect('&&'))) { left = binaryFn(left, token.fn, logicalAND()); } return left; } function equality() { var left = relational(); var token; if ((token = expect('==','!=','===','!=='))) { left = binaryFn(left, token.fn, equality()); } return left; } function relational() { var left = additive(); var token; if ((token = expect('<', '>', '<=', '>='))) { left = binaryFn(left, token.fn, relational()); } return left; } function additive() { var left = multiplicative(); var token; while ((token = expect('+','-'))) { left = binaryFn(left, token.fn, multiplicative()); } return left; } function multiplicative() { var left = unary(); var token; while ((token = expect('*','/','%'))) { left = binaryFn(left, token.fn, unary()); } return left; } function unary() { var token; if (expect('+')) { return primary(); } else if ((token = expect('-'))) { return binaryFn(ZERO, token.fn, unary()); } else if ((token = expect('!'))) { return unaryFn(token.fn, unary()); } else { return primary(); } } function primary() { var primary; if (expect('(')) { primary = filterChain(); consume(')'); } else if (expect('[')) { primary = arrayDeclaration(); } else if (expect('{')) { primary = object(); } else { var token = expect(); primary = token.fn; if (!primary) { throwError("not a primary expression", token); } if (token.json) { primary.constant = primary.literal = true; } } var next, context; while ((next = expect('(', '[', '.'))) { if (next.text === '(') { primary = functionCall(primary, context); context = null; } else if (next.text === '[') { context = primary; primary = objectIndex(primary); } else if (next.text === '.') { context = primary; primary = fieldAccess(primary); } else { throwError("IMPOSSIBLE"); } } return primary; } function _fieldAccess(object) { var field = expect().text; var getter = getterFn(field, csp); return extend( function(scope, locals, self) { return getter(self || object(scope, locals), locals); }, { assign:function(scope, value, locals) { return setter(object(scope, locals), field, value); } } ); } function _objectIndex(obj) { var indexFn = expression(); consume(']'); return extend( function(self, locals){ var o = obj(self, locals), i = indexFn(self, locals), v, p; if (!o) return undefined; v = o[i]; if (v && v.then) { p = v; if (!('$$v' in v)) { p.$$v = undefined; p.then(function(val) { p.$$v = val; }); } v = v.$$v; } return v; }, { assign:function(self, value, locals){ return obj(self, locals)[indexFn(self, locals)] = value; } }); } function _functionCall(fn, contextGetter) { var argsFn = []; if (peekToken().text != ')') { do { argsFn.push(expression()); } while (expect(',')); } consume(')'); return function(scope, locals){ var args = [], context = contextGetter ? contextGetter(scope, locals) : scope; for ( var i = 0; i < argsFn.length; i++) { args.push(argsFn[i](scope, locals)); } var fnPtr = fn(scope, locals, context) || noop; // IE stupidity! return fnPtr.apply ? fnPtr.apply(context, args) : fnPtr(args[0], args[1], args[2], args[3], args[4]); }; } // This is used with json array declaration function arrayDeclaration () { var elementFns = []; var allConstant = true; if (peekToken().text != ']') { do { var elementFn = expression(); elementFns.push(elementFn); if (!elementFn.constant) { allConstant = false; } } while (expect(',')); } consume(']'); return extend(function(self, locals){ var array = []; for ( var i = 0; i < elementFns.length; i++) { array.push(elementFns[i](self, locals)); } return array; }, { literal:true, constant:allConstant }); } function object () { var keyValues = []; var allConstant = true; if (peekToken().text != '}') { do { var token = expect(), key = token.string || token.text; consume(":"); var value = expression(); keyValues.push({key:key, value:value}); if (!value.constant) { allConstant = false; } } while (expect(',')); } consume('}'); return extend(function(self, locals){ var object = {}; for ( var i = 0; i < keyValues.length; i++) { var keyValue = keyValues[i]; object[keyValue.key] = keyValue.value(self, locals); } return object; }, { literal:true, constant:allConstant }); } } ////////////////////////////////////////////////// // Parser helper functions ////////////////////////////////////////////////// function setter(obj, path, setValue) { var element = path.split('.'); for (var i = 0; element.length > 1; i++) { var key = element.shift(); var propertyObj = obj[key]; if (!propertyObj) { propertyObj = {}; obj[key] = propertyObj; } obj = propertyObj; } obj[element.shift()] = setValue; return setValue; } /** * Return the value accessible from the object by path. Any undefined traversals are ignored * @param {Object} obj starting object * @param {string} path path to traverse * @param {boolean=true} bindFnToScope * @returns value as accessible by path */ //TODO(misko): this function needs to be removed function getter(obj, path, bindFnToScope) { if (!path) return obj; var keys = path.split('.'); var key; var lastInstance = obj; var len = keys.length; for (var i = 0; i < len; i++) { key = keys[i]; if (obj) { obj = (lastInstance = obj)[key]; } } if (!bindFnToScope && isFunction(obj)) { return bind(lastInstance, obj); } return obj; } var getterFnCache = {}; /** * Implementation of the "Black Hole" variant from: * - http://jsperf.com/angularjs-parse-getter/4 * - http://jsperf.com/path-evaluation-simplified/7 */ function cspSafeGetterFn(key0, key1, key2, key3, key4) { return function(scope, locals) { var pathVal = (locals && locals.hasOwnProperty(key0)) ? locals : scope, promise; if (pathVal === null || pathVal === undefined) return pathVal; pathVal = pathVal[key0]; if (pathVal && pathVal.then) { if (!("$$v" in pathVal)) { promise = pathVal; promise.$$v = undefined; promise.then(function(val) { promise.$$v = val; }); } pathVal = pathVal.$$v; } if (!key1 || pathVal === null || pathVal === undefined) return pathVal; pathVal = pathVal[key1]; if (pathVal && pathVal.then) { if (!("$$v" in pathVal)) { promise = pathVal; promise.$$v = undefined; promise.then(function(val) { promise.$$v = val; }); } pathVal = pathVal.$$v; } if (!key2 || pathVal === null || pathVal === undefined) return pathVal; pathVal = pathVal[key2]; if (pathVal && pathVal.then) { if (!("$$v" in pathVal)) { promise = pathVal; promise.$$v = undefined; promise.then(function(val) { promise.$$v = val; }); } pathVal = pathVal.$$v; } if (!key3 || pathVal === null || pathVal === undefined) return pathVal; pathVal = pathVal[key3]; if (pathVal && pathVal.then) { if (!("$$v" in pathVal)) { promise = pathVal; promise.$$v = undefined; promise.then(function(val) { promise.$$v = val; }); } pathVal = pathVal.$$v; } if (!key4 || pathVal === null || pathVal === undefined) return pathVal; pathVal = pathVal[key4]; if (pathVal && pathVal.then) { if (!("$$v" in pathVal)) { promise = pathVal; promise.$$v = undefined; promise.then(function(val) { promise.$$v = val; }); } pathVal = pathVal.$$v; } return pathVal; }; } function getterFn(path, csp) { if (getterFnCache.hasOwnProperty(path)) { return getterFnCache[path]; } var pathKeys = path.split('.'), pathKeysLength = pathKeys.length, fn; if (csp) { fn = (pathKeysLength < 6) ? cspSafeGetterFn(pathKeys[0], pathKeys[1], pathKeys[2], pathKeys[3], pathKeys[4]) : function(scope, locals) { var i = 0, val; do { val = cspSafeGetterFn( pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++], pathKeys[i++] )(scope, locals); locals = undefined; // clear after first iteration scope = val; } while (i < pathKeysLength); return val; } } else { var code = 'var l, fn, p;\n'; forEach(pathKeys, function(key, index) { code += 'if(s === null || s === undefined) return s;\n' + 'l=s;\n' + 's='+ (index // we simply dereference 's' on any .dot notation ? 's' // but if we are first then we check locals first, and if so read it first : '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"]' + ';\n' + 'if (s && s.then) {\n' + ' if (!("$$v" in s)) {\n' + ' p=s;\n' + ' p.$$v = undefined;\n' + ' p.then(function(v) {p.$$v=v;});\n' + '}\n' + ' s=s.$$v\n' + '}\n'; }); code += 'return s;'; fn = Function('s', 'k', code); // s=scope, k=locals fn.toString = function() { return code; }; } return getterFnCache[path] = fn; } /////////////////////////////////// /** * @ngdoc function * @name ng.$parse * @function * * @description * * Converts Angular {@link guide/expression expression} into a function. * * <pre> * var getter = $parse('user.name'); * var setter = getter.assign; * var context = {user:{name:'angular'}}; * var locals = {user:{name:'local'}}; * * expect(getter(context)).toEqual('angular'); * setter(context, 'newValue'); * expect(context.user.name).toEqual('newValue'); * expect(getter(context, locals)).toEqual('local'); * </pre> * * * @param {string} expression String expression to compile. * @returns {function(context, locals)} a function which represents the compiled expression: * * * `context` – `{object}` – an object against which any expressions embedded in the strings * are evaluated against (typically a scope object). * * `locals` – `{object=}` – local variables context object, useful for overriding values in * `context`. * * The returned function also has the following properties: * * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript * literal. * * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript * constant literals. * * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be * set to a function to change its value on the given context. * */ function $ParseProvider() { var cache = {}; this.$get = ['$filter', '$sniffer', function($filter, $sniffer) { return function(exp) { switch(typeof exp) { case 'string': return cache.hasOwnProperty(exp) ? cache[exp] : cache[exp] = parser(exp, false, $filter, $sniffer.csp); case 'function': return exp; default: return noop; } }; }]; } /** * @ngdoc service * @name ng.$q * @requires $rootScope * * @description * A promise/deferred implementation inspired by [Kris Kowal's Q](https://github.com/kriskowal/q). * * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an * interface for interacting with an object that represents the result of an action that is * performed asynchronously, and may or may not be finished at any given point in time. * * From the perspective of dealing with error handling, deferred and promise APIs are to * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming. * * <pre> * // for the purpose of this example let's assume that variables `$q` and `scope` are * // available in the current lexical scope (they could have been injected or passed in). * * function asyncGreet(name) { * var deferred = $q.defer(); * * setTimeout(function() { * // since this fn executes async in a future turn of the event loop, we need to wrap * // our code into an $apply call so that the model changes are properly observed. * scope.$apply(function() { * if (okToGreet(name)) { * deferred.resolve('Hello, ' + name + '!'); * } else { * deferred.reject('Greeting ' + name + ' is not allowed.'); * } * }); * }, 1000); * * return deferred.promise; * } * * var promise = asyncGreet('Robin Hood'); * promise.then(function(greeting) { * alert('Success: ' + greeting); * }, function(reason) { * alert('Failed: ' + reason); * }); * </pre> * * At first it might not be obvious why this extra complexity is worth the trouble. The payoff * comes in the way of * [guarantees that promise and deferred APIs make](https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md). * * Additionally the promise api allows for composition that is very hard to do with the * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach. * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the * section on serial or parallel joining of promises. * * * # The Deferred API * * A new instance of deferred is constructed by calling `$q.defer()`. * * The purpose of the deferred object is to expose the associated Promise instance as well as APIs * that can be used for signaling the successful or unsuccessful completion of the task. * * **Methods** * * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection * constructed via `$q.reject`, the promise will be rejected instead. * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to * resolving it with a rejection constructed via `$q.reject`. * * **Properties** * * - promise – `{Promise}` – promise object associated with this deferred. * * * # The Promise API * * A new promise instance is created when a deferred instance is created and can be retrieved by * calling `deferred.promise`. * * The purpose of the promise object is to allow for interested parties to get access to the result * of the deferred task when it completes. * * **Methods** * * - `then(successCallback, errorCallback)` – regardless of when the promise was or will be resolved * or rejected calls one of the success or error callbacks asynchronously as soon as the result * is available. The callbacks are called with a single argument the result or rejection reason. * * This method *returns a new promise* which is resolved or rejected via the return value of the * `successCallback` or `errorCallback`. * * - `always(callback)` – allows you to observe either the fulfillment or rejection of a promise, * but to do so without modifying the final value. This is useful to release resources or do some * clean-up that needs to be done whether the promise was rejected or resolved. See the [full * specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for * more information. * * # Chaining promises * * Because calling `then` api of a promise returns a new derived promise, it is easily possible * to create a chain of promises: * * <pre> * promiseB = promiseA.then(function(result) { * return result + 1; * }); * * // promiseB will be resolved immediately after promiseA is resolved and its value will be * // the result of promiseA incremented by 1 * </pre> * * It is possible to create chains of any length and since a promise can be resolved with another * promise (which will defer its resolution further), it is possible to pause/defer resolution of * the promises at any point in the chain. This makes it possible to implement powerful apis like * $http's response interceptors. * * * # Differences between Kris Kowal's Q and $q * * There are three main differences: * * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation * mechanism in angular, which means faster propagation of resolution or rejection into your * models and avoiding unnecessary browser repaints, which would result in flickering UI. * - $q promises are recognized by the templating engine in angular, which means that in templates * you can treat promises attached to a scope as if they were the resulting values. * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains * all the important functionality needed for common async tasks. * * # Testing * * <pre> * it('should simulate promise', inject(function($q, $rootScope) { * var deferred = $q.defer(); * var promise = deferred.promise; * var resolvedValue; * * promise.then(function(value) { resolvedValue = value; }); * expect(resolvedValue).toBeUndefined(); * * // Simulate resolving of promise * deferred.resolve(123); * // Note that the 'then' function does not get called synchronously. * // This is because we want the promise API to always be async, whether or not * // it got called synchronously or asynchronously. * expect(resolvedValue).toBeUndefined(); * * // Propagate promise resolution to 'then' functions using $apply(). * $rootScope.$apply(); * expect(resolvedValue).toEqual(123); * }); * </pre> */ function $QProvider() { this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) { return qFactory(function(callback) { $rootScope.$evalAsync(callback); }, $exceptionHandler); }]; } /** * Constructs a promise manager. * * @param {function(function)} nextTick Function for executing functions in the next turn. * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for * debugging purposes. * @returns {object} Promise manager. */ function qFactory(nextTick, exceptionHandler) { /** * @ngdoc * @name ng.$q#defer * @methodOf ng.$q * @description * Creates a `Deferred` object which represents a task which will finish in the future. * * @returns {Deferred} Returns a new instance of deferred. */ var defer = function() { var pending = [], value, deferred; deferred = { resolve: function(val) { if (pending) { var callbacks = pending; pending = undefined; value = ref(val); if (callbacks.length) { nextTick(function() { var callback; for (var i = 0, ii = callbacks.length; i < ii; i++) { callback = callbacks[i]; value.then(callback[0], callback[1]); } }); } } }, reject: function(reason) { deferred.resolve(reject(reason)); }, promise: { then: function(callback, errback) { var result = defer(); var wrappedCallback = function(value) { try { result.resolve((callback || defaultCallback)(value)); } catch(e) { exceptionHandler(e); result.reject(e); } }; var wrappedErrback = function(reason) { try { result.resolve((errback || defaultErrback)(reason)); } catch(e) { exceptionHandler(e); result.reject(e); } }; if (pending) { pending.push([wrappedCallback, wrappedErrback]); } else { value.then(wrappedCallback, wrappedErrback); } return result.promise; }, always: function(callback) { function makePromise(value, resolved) { var result = defer(); if (resolved) { result.resolve(value); } else { result.reject(value); } return result.promise; } function handleCallback(value, isResolved) { var callbackOutput = null; try { callbackOutput = (callback ||defaultCallback)(); } catch(e) { return makePromise(e, false); } if (callbackOutput && callbackOutput.then) { return callbackOutput.then(function() { return makePromise(value, isResolved); }, function(error) { return makePromise(error, false); }); } else { return makePromise(value, isResolved); } } return this.then(function(value) { return handleCallback(value, true); }, function(error) { return handleCallback(error, false); }); } } }; return deferred; }; var ref = function(value) { if (value && value.then) return value; return { then: function(callback) { var result = defer(); nextTick(function() { result.resolve(callback(value)); }); return result.promise; } }; }; /** * @ngdoc * @name ng.$q#reject * @methodOf ng.$q * @description * Creates a promise that is resolved as rejected with the specified `reason`. This api should be * used to forward rejection in a chain of promises. If you are dealing with the last promise in * a promise chain, you don't need to worry about it. * * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of * `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via * a promise error callback and you want to forward the error to the promise derived from the * current promise, you have to "rethrow" the error by returning a rejection constructed via * `reject`. * * <pre> * promiseB = promiseA.then(function(result) { * // success: do something and resolve promiseB * // with the old or a new result * return result; * }, function(reason) { * // error: handle the error if possible and * // resolve promiseB with newPromiseOrValue, * // otherwise forward the rejection to promiseB * if (canHandle(reason)) { * // handle the error and recover * return newPromiseOrValue; * } * return $q.reject(reason); * }); * </pre> * * @param {*} reason Constant, message, exception or an object representing the rejection reason. * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`. */ var reject = function(reason) { return { then: function(callback, errback) { var result = defer(); nextTick(function() { result.resolve((errback || defaultErrback)(reason)); }); return result.promise; } }; }; /** * @ngdoc * @name ng.$q#when * @methodOf ng.$q * @description * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. * This is useful when you are dealing with an object that might or might not be a promise, or if * the promise comes from a source that can't be trusted. * * @param {*} value Value or a promise * @returns {Promise} Returns a promise of the passed value or promise */ var when = function(value, callback, errback) { var result = defer(), done; var wrappedCallback = function(value) { try { return (callback || defaultCallback)(value); } catch (e) { exceptionHandler(e); return reject(e); } }; var wrappedErrback = function(reason) { try { return (errback || defaultErrback)(reason); } catch (e) { exceptionHandler(e); return reject(e); } }; nextTick(function() { ref(value).then(function(value) { if (done) return; done = true; result.resolve(ref(value).then(wrappedCallback, wrappedErrback)); }, function(reason) { if (done) return; done = true; result.resolve(wrappedErrback(reason)); }); }); return result.promise; }; function defaultCallback(value) { return value; } function defaultErrback(reason) { return reject(reason); } /** * @ngdoc * @name ng.$q#all * @methodOf ng.$q * @description * Combines multiple promises into a single promise that is resolved when all of the input * promises are resolved. * * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises. * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values, * each value corresponding to the promise at the same index/key in the `promises` array/hash. If any of * the promises is resolved with a rejection, this resulting promise will be resolved with the * same rejection. */ function all(promises) { var deferred = defer(), counter = 0, results = isArray(promises) ? [] : {}; forEach(promises, function(promise, key) { counter++; ref(promise).then(function(value) { if (results.hasOwnProperty(key)) return; results[key] = value; if (!(--counter)) deferred.resolve(results); }, function(reason) { if (results.hasOwnProperty(key)) return; deferred.reject(reason); }); }); if (counter === 0) { deferred.resolve(results); } return deferred.promise; } return { defer: defer, reject: reject, when: when, all: all }; } /** * @ngdoc object * @name ng.$routeProvider * @function * * @description * * Used for configuring routes. See {@link ng.$route $route} for an example. */ function $RouteProvider(){ var routes = {}; /** * @ngdoc method * @name ng.$routeProvider#when * @methodOf ng.$routeProvider * * @param {string} path Route path (matched against `$location.path`). If `$location.path` * contains redundant trailing slash or is missing one, the route will still match and the * `$location.path` will be updated to add or drop the trailing slash to exactly match the * route definition. * * * `path` can contain named groups starting with a colon (`:name`). All characters up * to the next slash are matched and stored in `$routeParams` under the given `name` * when the route matches. * * `path` can contain named groups starting with a star (`*name`). All characters are * eagerly stored in `$routeParams` under the given `name` when the route matches. * * For example, routes like `/color/:color/largecode/*largecode/edit` will match * `/color/brown/largecode/code/with/slashs/edit` and extract: * * * `color: brown` * * `largecode: code/with/slashs`. * * * @param {Object} route Mapping information to be assigned to `$route.current` on route * match. * * Object properties: * * - `controller` – `{(string|function()=}` – Controller fn that should be associated with newly * created scope or the name of a {@link angular.Module#controller registered controller} * if passed as a string. * - `controllerAs` – `{string=}` – A controller alias name. If present the controller will be * published to scope under the `controllerAs` name. * - `template` – `{string=|function()=}` – html template as a string or function that returns * an html template as a string which should be used by {@link ng.directive:ngView ngView} or * {@link ng.directive:ngInclude ngInclude} directives. * This property takes precedence over `templateUrl`. * * If `template` is a function, it will be called with the following parameters: * * - `{Array.<Object>}` - route parameters extracted from the current * `$location.path()` by applying the current route * * - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html * template that should be used by {@link ng.directive:ngView ngView}. * * If `templateUrl` is a function, it will be called with the following parameters: * * - `{Array.<Object>}` - route parameters extracted from the current * `$location.path()` by applying the current route * * - `resolve` - `{Object.<string, function>=}` - An optional map of dependencies which should * be injected into the controller. If any of these dependencies are promises, they will be * resolved and converted to a value before the controller is instantiated and the * `$routeChangeSuccess` event is fired. The map object is: * * - `key` – `{string}`: a name of a dependency to be injected into the controller. * - `factory` - `{string|function}`: If `string` then it is an alias for a service. * Otherwise if function, then it is {@link api/AUTO.$injector#invoke injected} * and the return value is treated as the dependency. If the result is a promise, it is resolved * before its value is injected into the controller. * * - `redirectTo` – {(string|function())=} – value to update * {@link ng.$location $location} path with and trigger route redirection. * * If `redirectTo` is a function, it will be called with the following parameters: * * - `{Object.<string>}` - route parameters extracted from the current * `$location.path()` by applying the current route templateUrl. * - `{string}` - current `$location.path()` * - `{Object}` - current `$location.search()` * * The custom `redirectTo` function is expected to return a string which will be used * to update `$location.path()` and `$location.search()`. * * - `[reloadOnSearch=true]` - {boolean=} - reload route when only $location.search() * changes. * * If the option is set to `false` and url in the browser changes, then * `$routeUpdate` event is broadcasted on the root scope. * * - `[caseInsensitiveMatch=false]` - {boolean=} - match routes without being case sensitive * * If the option is set to `true`, then the particular route can be matched without being * case sensitive * * @returns {Object} self * * @description * Adds a new route definition to the `$route` service. */ this.when = function(path, route) { routes[path] = extend({reloadOnSearch: true, caseInsensitiveMatch: false}, route); // create redirection for trailing slashes if (path) { var redirectPath = (path[path.length-1] == '/') ? path.substr(0, path.length-1) : path +'/'; routes[redirectPath] = {redirectTo: path}; } return this; }; /** * @ngdoc method * @name ng.$routeProvider#otherwise * @methodOf ng.$routeProvider * * @description * Sets route definition that will be used on route change when no other route definition * is matched. * * @param {Object} params Mapping information to be assigned to `$route.current`. * @returns {Object} self */ this.otherwise = function(params) { this.when(null, params); return this; }; this.$get = ['$rootScope', '$location', '$routeParams', '$q', '$injector', '$http', '$templateCache', function( $rootScope, $location, $routeParams, $q, $injector, $http, $templateCache) { /** * @ngdoc object * @name ng.$route * @requires $location * @requires $routeParams * * @property {Object} current Reference to the current route definition. * The route definition contains: * * - `controller`: The controller constructor as define in route definition. * - `locals`: A map of locals which is used by {@link ng.$controller $controller} service for * controller instantiation. The `locals` contain * the resolved values of the `resolve` map. Additionally the `locals` also contain: * * - `$scope` - The current route scope. * - `$template` - The current route template HTML. * * @property {Array.<Object>} routes Array of all configured routes. * * @description * Is used for deep-linking URLs to controllers and views (HTML partials). * It watches `$location.url()` and tries to map the path to an existing route definition. * * You can define routes through {@link ng.$routeProvider $routeProvider}'s API. * * The `$route` service is typically used in conjunction with {@link ng.directive:ngView ngView} * directive and the {@link ng.$routeParams $routeParams} service. * * @example This example shows how changing the URL hash causes the `$route` to match a route against the URL, and the `ngView` pulls in the partial. Note that this example is using {@link ng.directive:script inlined templates} to get it working on jsfiddle as well. <example module="ngView"> <file name="index.html"> <div ng-controller="MainCntl"> Choose: <a href="Book/Moby">Moby</a> | <a href="Book/Moby/ch/1">Moby: Ch1</a> | <a href="Book/Gatsby">Gatsby</a> | <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> | <a href="Book/Scarlet">Scarlet Letter</a><br/> <div ng-view></div> <hr /> <pre>$location.path() = {{$location.path()}}</pre> <pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre> <pre>$route.current.params = {{$route.current.params}}</pre> <pre>$route.current.scope.name = {{$route.current.scope.name}}</pre> <pre>$routeParams = {{$routeParams}}</pre> </div> </file> <file name="book.html"> controller: {{name}}<br /> Book Id: {{params.bookId}}<br /> </file> <file name="chapter.html"> controller: {{name}}<br /> Book Id: {{params.bookId}}<br /> Chapter Id: {{params.chapterId}} </file> <file name="script.js"> angular.module('ngView', [], function($routeProvider, $locationProvider) { $routeProvider.when('/Book/:bookId', { templateUrl: 'book.html', controller: BookCntl, resolve: { // I will cause a 1 second delay delay: function($q, $timeout) { var delay = $q.defer(); $timeout(delay.resolve, 1000); return delay.promise; } } }); $routeProvider.when('/Book/:bookId/ch/:chapterId', { templateUrl: 'chapter.html', controller: ChapterCntl }); // configure html5 to get links working on jsfiddle $locationProvider.html5Mode(true); }); function MainCntl($scope, $route, $routeParams, $location) { $scope.$route = $route; $scope.$location = $location; $scope.$routeParams = $routeParams; } function BookCntl($scope, $routeParams) { $scope.name = "BookCntl"; $scope.params = $routeParams; } function ChapterCntl($scope, $routeParams) { $scope.name = "ChapterCntl"; $scope.params = $routeParams; } </file> <file name="scenario.js"> it('should load and compile correct template', function() { element('a:contains("Moby: Ch1")').click(); var content = element('.doc-example-live [ng-view]').text(); expect(content).toMatch(/controller\: ChapterCntl/); expect(content).toMatch(/Book Id\: Moby/); expect(content).toMatch(/Chapter Id\: 1/); element('a:contains("Scarlet")').click(); sleep(2); // promises are not part of scenario waiting content = element('.doc-example-live [ng-view]').text(); expect(content).toMatch(/controller\: BookCntl/); expect(content).toMatch(/Book Id\: Scarlet/); }); </file> </example> */ /** * @ngdoc event * @name ng.$route#$routeChangeStart * @eventOf ng.$route * @eventType broadcast on root scope * @description * Broadcasted before a route change. At this point the route services starts * resolving all of the dependencies needed for the route change to occurs. * Typically this involves fetching the view template as well as any dependencies * defined in `resolve` route property. Once all of the dependencies are resolved * `$routeChangeSuccess` is fired. * * @param {Route} next Future route information. * @param {Route} current Current route information. */ /** * @ngdoc event * @name ng.$route#$routeChangeSuccess * @eventOf ng.$route * @eventType broadcast on root scope * @description * Broadcasted after a route dependencies are resolved. * {@link ng.directive:ngView ngView} listens for the directive * to instantiate the controller and render the view. * * @param {Object} angularEvent Synthetic event object. * @param {Route} current Current route information. * @param {Route|Undefined} previous Previous route information, or undefined if current is first route entered. */ /** * @ngdoc event * @name ng.$route#$routeChangeError * @eventOf ng.$route * @eventType broadcast on root scope * @description * Broadcasted if any of the resolve promises are rejected. * * @param {Route} current Current route information. * @param {Route} previous Previous route information. * @param {Route} rejection Rejection of the promise. Usually the error of the failed promise. */ /** * @ngdoc event * @name ng.$route#$routeUpdate * @eventOf ng.$route * @eventType broadcast on root scope * @description * * The `reloadOnSearch` property has been set to false, and we are reusing the same * instance of the Controller. */ var forceReload = false, $route = { routes: routes, /** * @ngdoc method * @name ng.$route#reload * @methodOf ng.$route * * @description * Causes `$route` service to reload the current route even if * {@link ng.$location $location} hasn't changed. * * As a result of that, {@link ng.directive:ngView ngView} * creates new scope, reinstantiates the controller. */ reload: function() { forceReload = true; $rootScope.$evalAsync(updateRoute); } }; $rootScope.$on('$locationChangeSuccess', updateRoute); return $route; ///////////////////////////////////////////////////// /** * @param on {string} current url * @param when {string} route when template to match the url against * @param whenProperties {Object} properties to define when's matching behavior * @return {?Object} */ function switchRouteMatcher(on, when, whenProperties) { // TODO(i): this code is convoluted and inefficient, we should construct the route matching // regex only once and then reuse it // Escape regexp special characters. when = '^' + when.replace(/[-\/\\^$:*+?.()|[\]{}]/g, "\\$&") + '$'; var regex = '', params = [], dst = {}; var re = /\\([:*])(\w+)/g, paramMatch, lastMatchedIndex = 0; while ((paramMatch = re.exec(when)) !== null) { // Find each :param in `when` and replace it with a capturing group. // Append all other sections of when unchanged. regex += when.slice(lastMatchedIndex, paramMatch.index); switch(paramMatch[1]) { case ':': regex += '([^\\/]*)'; break; case '*': regex += '(.*)'; break; } params.push(paramMatch[2]); lastMatchedIndex = re.lastIndex; } // Append trailing path part. regex += when.substr(lastMatchedIndex); var match = on.match(new RegExp(regex, whenProperties.caseInsensitiveMatch ? 'i' : '')); if (match) { forEach(params, function(name, index) { dst[name] = match[index + 1]; }); } return match ? dst : null; } function updateRoute() { var next = parseRoute(), last = $route.current; if (next && last && next.$$route === last.$$route && equals(next.pathParams, last.pathParams) && !next.reloadOnSearch && !forceReload) { last.params = next.params; copy(last.params, $routeParams); $rootScope.$broadcast('$routeUpdate', last); } else if (next || last) { forceReload = false; $rootScope.$broadcast('$routeChangeStart', next, last); $route.current = next; if (next) { if (next.redirectTo) { if (isString(next.redirectTo)) { $location.path(interpolate(next.redirectTo, next.params)).search(next.params) .replace(); } else { $location.url(next.redirectTo(next.pathParams, $location.path(), $location.search())) .replace(); } } } $q.when(next). then(function() { if (next) { var locals = extend({}, next.resolve), template; forEach(locals, function(value, key) { locals[key] = isString(value) ? $injector.get(value) : $injector.invoke(value); }); if (isDefined(template = next.template)) { if (isFunction(template)) { template = template(next.params); } } else if (isDefined(template = next.templateUrl)) { if (isFunction(template)) { template = template(next.params); } if (isDefined(template)) { next.loadedTemplateUrl = template; template = $http.get(template, {cache: $templateCache}). then(function(response) { return response.data; }); } } if (isDefined(template)) { locals['$template'] = template; } return $q.all(locals); } }). // after route change then(function(locals) { if (next == $route.current) { if (next) { next.locals = locals; copy(next.params, $routeParams); } $rootScope.$broadcast('$routeChangeSuccess', next, last); } }, function(error) { if (next == $route.current) { $rootScope.$broadcast('$routeChangeError', next, last, error); } }); } } /** * @returns the current active route, by matching it against the URL */ function parseRoute() { // Match a route var params, match; forEach(routes, function(route, path) { if (!match && (params = switchRouteMatcher($location.path(), path, route))) { match = inherit(route, { params: extend({}, $location.search(), params), pathParams: params}); match.$$route = route; } }); // No route matched; fallback to "otherwise" route return match || routes[null] && inherit(routes[null], {params: {}, pathParams:{}}); } /** * @returns interpolation of the redirect path with the parameters */ function interpolate(string, params) { var result = []; forEach((string||'').split(':'), function(segment, i) { if (i == 0) { result.push(segment); } else { var segmentMatch = segment.match(/(\w+)(.*)/); var key = segmentMatch[1]; result.push(params[key]); result.push(segmentMatch[2] || ''); delete params[key]; } }); return result.join(''); } }]; } /** * @ngdoc object * @name ng.$routeParams * @requires $route * * @description * Current set of route parameters. The route parameters are a combination of the * {@link ng.$location $location} `search()`, and `path()`. The `path` parameters * are extracted when the {@link ng.$route $route} path is matched. * * In case of parameter name collision, `path` params take precedence over `search` params. * * The service guarantees that the identity of the `$routeParams` object will remain unchanged * (but its properties will likely change) even when a route change occurs. * * @example * <pre> * // Given: * // URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby * // Route: /Chapter/:chapterId/Section/:sectionId * // * // Then * $routeParams ==> {chapterId:1, sectionId:2, search:'moby'} * </pre> */ function $RouteParamsProvider() { this.$get = valueFn({}); } /** * DESIGN NOTES * * The design decisions behind the scope are heavily favored for speed and memory consumption. * * The typical use of scope is to watch the expressions, which most of the time return the same * value as last time so we optimize the operation. * * Closures construction is expensive in terms of speed as well as memory: * - No closures, instead use prototypical inheritance for API * - Internal state needs to be stored on scope directly, which means that private state is * exposed as $$____ properties * * Loop operations are optimized by using while(count--) { ... } * - this means that in order to keep the same order of execution as addition we have to add * items to the array at the beginning (shift) instead of at the end (push) * * Child scopes are created and removed often * - Using an array would be slow since inserts in middle are expensive so we use linked list * * There are few watches then a lot of observers. This is why you don't want the observer to be * implemented in the same way as watch. Watch requires return of initialization function which * are expensive to construct. */ /** * @ngdoc object * @name ng.$rootScopeProvider * @description * * Provider for the $rootScope service. */ /** * @ngdoc function * @name ng.$rootScopeProvider#digestTtl * @methodOf ng.$rootScopeProvider * @description * * Sets the number of digest iterations the scope should attempt to execute before giving up and * assuming that the model is unstable. * * The current default is 10 iterations. * * @param {number} limit The number of digest iterations. */ /** * @ngdoc object * @name ng.$rootScope * @description * * Every application has a single root {@link ng.$rootScope.Scope scope}. * All other scopes are child scopes of the root scope. Scopes provide mechanism for watching the model and provide * event processing life-cycle. See {@link guide/scope developer guide on scopes}. */ function $RootScopeProvider(){ var TTL = 10; this.digestTtl = function(value) { if (arguments.length) { TTL = value; } return TTL; }; this.$get = ['$injector', '$exceptionHandler', '$parse', function( $injector, $exceptionHandler, $parse) { /** * @ngdoc function * @name ng.$rootScope.Scope * * @description * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the * {@link AUTO.$injector $injector}. Child scopes are created using the * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when * compiled HTML template is executed.) * * Here is a simple scope snippet to show how you can interact with the scope. * <pre> * <file src="./test/ng/rootScopeSpec.js" tag="docs1" /> * </pre> * * # Inheritance * A scope can inherit from a parent scope, as in this example: * <pre> var parent = $rootScope; var child = parent.$new(); parent.salutation = "Hello"; child.name = "World"; expect(child.salutation).toEqual('Hello'); child.salutation = "Welcome"; expect(child.salutation).toEqual('Welcome'); expect(parent.salutation).toEqual('Hello'); * </pre> * * * @param {Object.<string, function()>=} providers Map of service factory which need to be provided * for the current scope. Defaults to {@link ng}. * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should * append/override services provided by `providers`. This is handy when unit-testing and having * the need to override a default service. * @returns {Object} Newly created scope. * */ function Scope() { this.$id = nextUid(); this.$$phase = this.$parent = this.$$watchers = this.$$nextSibling = this.$$prevSibling = this.$$childHead = this.$$childTail = null; this['this'] = this.$root = this; this.$$destroyed = false; this.$$asyncQueue = []; this.$$listeners = {}; this.$$isolateBindings = {}; } /** * @ngdoc property * @name ng.$rootScope.Scope#$id * @propertyOf ng.$rootScope.Scope * @returns {number} Unique scope ID (monotonically increasing alphanumeric sequence) useful for * debugging. */ Scope.prototype = { /** * @ngdoc function * @name ng.$rootScope.Scope#$new * @methodOf ng.$rootScope.Scope * @function * * @description * Creates a new child {@link ng.$rootScope.Scope scope}. * * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} and * {@link ng.$rootScope.Scope#$digest $digest()} events. The scope can be removed from the scope * hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}. * * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is desired for * the scope and its child scopes to be permanently detached from the parent and thus stop * participating in model change detection and listener notification by invoking. * * @param {boolean} isolate if true then the scope does not prototypically inherit from the * parent scope. The scope is isolated, as it can not see parent scope properties. * When creating widgets it is useful for the widget to not accidentally read parent * state. * * @returns {Object} The newly created child scope. * */ $new: function(isolate) { var Child, child; if (isFunction(isolate)) { // TODO: remove at some point throw Error('API-CHANGE: Use $controller to instantiate controllers.'); } if (isolate) { child = new Scope(); child.$root = this.$root; } else { Child = function() {}; // should be anonymous; This is so that when the minifier munges // the name it does not become random set of chars. These will then show up as class // name in the debugger. Child.prototype = this; child = new Child(); child.$id = nextUid(); } child['this'] = child; child.$$listeners = {}; child.$parent = this; child.$$watchers = child.$$nextSibling = child.$$childHead = child.$$childTail = null; child.$$prevSibling = this.$$childTail; if (this.$$childHead) { this.$$childTail.$$nextSibling = child; this.$$childTail = child; } else { this.$$childHead = this.$$childTail = child; } return child; }, /** * @ngdoc function * @name ng.$rootScope.Scope#$watch * @methodOf ng.$rootScope.Scope * @function * * @description * Registers a `listener` callback to be executed whenever the `watchExpression` changes. * * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest $digest()} and * should return the value which will be watched. (Since {@link ng.$rootScope.Scope#$digest $digest()} * reruns when it detects changes the `watchExpression` can execute multiple times per * {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.) * - The `listener` is called only when the value from the current `watchExpression` and the * previous call to `watchExpression` are not equal (with the exception of the initial run, * see below). The inequality is determined according to * {@link angular.equals} function. To save the value of the object for later comparison, the * {@link angular.copy} function is used. It also means that watching complex options will * have adverse memory and performance implications. * - The watch `listener` may change the model, which may trigger other `listener`s to fire. This * is achieved by rerunning the watchers until no changes are detected. The rerun iteration * limit is 10 to prevent an infinite loop deadlock. * * * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called, * you can register a `watchExpression` function with no `listener`. (Since `watchExpression` * can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a change is * detected, be prepared for multiple calls to your listener.) * * After a watcher is registered with the scope, the `listener` fn is called asynchronously * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the * watcher. In rare cases, this is undesirable because the listener is called when the result * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the * listener was called due to initialization. * * * # Example * <pre> // let's assume that scope was dependency injected as the $rootScope var scope = $rootScope; scope.name = 'misko'; scope.counter = 0; expect(scope.counter).toEqual(0); scope.$watch('name', function(newValue, oldValue) { scope.counter = scope.counter + 1; }); expect(scope.counter).toEqual(0); scope.$digest(); // no variable change expect(scope.counter).toEqual(0); scope.name = 'adam'; scope.$digest(); expect(scope.counter).toEqual(1); * </pre> * * * * @param {(function()|string)} watchExpression Expression that is evaluated on each * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers a * call to the `listener`. * * - `string`: Evaluated as {@link guide/expression expression} * - `function(scope)`: called with current `scope` as a parameter. * @param {(function()|string)=} listener Callback called whenever the return value of * the `watchExpression` changes. * * - `string`: Evaluated as {@link guide/expression expression} * - `function(newValue, oldValue, scope)`: called with current and previous values as parameters. * * @param {boolean=} objectEquality Compare object for equality rather than for reference. * @returns {function()} Returns a deregistration function for this listener. */ $watch: function(watchExp, listener, objectEquality) { var scope = this, get = compileToFn(watchExp, 'watch'), array = scope.$$watchers, watcher = { fn: listener, last: initWatchVal, get: get, exp: watchExp, eq: !!objectEquality }; // in the case user pass string, we need to compile it, do we really need this ? if (!isFunction(listener)) { var listenFn = compileToFn(listener || noop, 'listener'); watcher.fn = function(newVal, oldVal, scope) {listenFn(scope);}; } if (typeof watchExp == 'string' && get.constant) { var originalFn = watcher.fn; watcher.fn = function(newVal, oldVal, scope) { originalFn.call(this, newVal, oldVal, scope); arrayRemove(array, watcher); }; } if (!array) { array = scope.$$watchers = []; } // we use unshift since we use a while loop in $digest for speed. // the while loop reads in reverse order. array.unshift(watcher); return function() { arrayRemove(array, watcher); }; }, /** * @ngdoc function * @name ng.$rootScope.Scope#$watchCollection * @methodOf ng.$rootScope.Scope * @function * * @description * Shallow watches the properties of an object and fires whenever any of the properties change * (for arrays this implies watching the array items, for object maps this implies watching the properties). * If a change is detected the `listener` callback is fired. * * - The `obj` collection is observed via standard $watch operation and is examined on every call to $digest() to * see if any items have been added, removed, or moved. * - The `listener` is called whenever anything within the `obj` has changed. Examples include adding new items * into the object or array, removing and moving items around. * * * # Example * <pre> $scope.names = ['igor', 'matias', 'misko', 'james']; $scope.dataCount = 4; $scope.$watchCollection('names', function(newNames, oldNames) { $scope.dataCount = newNames.length; }); expect($scope.dataCount).toEqual(4); $scope.$digest(); //still at 4 ... no changes expect($scope.dataCount).toEqual(4); $scope.names.pop(); $scope.$digest(); //now there's been a change expect($scope.dataCount).toEqual(3); * </pre> * * * @param {string|Function(scope)} obj Evaluated as {@link guide/expression expression}. The expression value * should evaluate to an object or an array which is observed on each * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the collection will trigger * a call to the `listener`. * * @param {function(newCollection, oldCollection, scope)} listener a callback function that is fired with both * the `newCollection` and `oldCollection` as parameters. * The `newCollection` object is the newly modified data obtained from the `obj` expression and the * `oldCollection` object is a copy of the former collection data. * The `scope` refers to the current scope. * * @returns {function()} Returns a de-registration function for this listener. When the de-registration function is executed * then the internal watch operation is terminated. */ $watchCollection: function(obj, listener) { var self = this; var oldValue; var newValue; var changeDetected = 0; var objGetter = $parse(obj); var internalArray = []; var internalObject = {}; var oldLength = 0; function $watchCollectionWatch() { newValue = objGetter(self); var newLength, key; if (!isObject(newValue)) { if (oldValue !== newValue) { oldValue = newValue; changeDetected++; } } else if (isArrayLike(newValue)) { if (oldValue !== internalArray) { // we are transitioning from something which was not an array into array. oldValue = internalArray; oldLength = oldValue.length = 0; changeDetected++; } newLength = newValue.length; if (oldLength !== newLength) { // if lengths do not match we need to trigger change notification changeDetected++; oldValue.length = oldLength = newLength; } // copy the items to oldValue and look for changes. for (var i = 0; i < newLength; i++) { if (oldValue[i] !== newValue[i]) { changeDetected++; oldValue[i] = newValue[i]; } } } else { if (oldValue !== internalObject) { // we are transitioning from something which was not an object into object. oldValue = internalObject = {}; oldLength = 0; changeDetected++; } // copy the items to oldValue and look for changes. newLength = 0; for (key in newValue) { if (newValue.hasOwnProperty(key)) { newLength++; if (oldValue.hasOwnProperty(key)) { if (oldValue[key] !== newValue[key]) { changeDetected++; oldValue[key] = newValue[key]; } } else { oldLength++; oldValue[key] = newValue[key]; changeDetected++; } } } if (oldLength > newLength) { // we used to have more keys, need to find them and destroy them. changeDetected++; for(key in oldValue) { if (oldValue.hasOwnProperty(key) && !newValue.hasOwnProperty(key)) { oldLength--; delete oldValue[key]; } } } } return changeDetected; } function $watchCollectionAction() { listener(newValue, oldValue, self); } return this.$watch($watchCollectionWatch, $watchCollectionAction); }, /** * @ngdoc function * @name ng.$rootScope.Scope#$digest * @methodOf ng.$rootScope.Scope * @function * * @description * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and its children. * Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change the model, the * `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers} until no more listeners are * firing. This means that it is possible to get into an infinite loop. This function will throw * `'Maximum iteration limit exceeded.'` if the number of iterations exceeds 10. * * Usually you don't call `$digest()` directly in * {@link ng.directive:ngController controllers} or in * {@link ng.$compileProvider#directive directives}. * Instead a call to {@link ng.$rootScope.Scope#$apply $apply()} (typically from within a * {@link ng.$compileProvider#directive directives}) will force a `$digest()`. * * If you want to be notified whenever `$digest()` is called, * you can register a `watchExpression` function with {@link ng.$rootScope.Scope#$watch $watch()} * with no `listener`. * * You may have a need to call `$digest()` from within unit-tests, to simulate the scope * life-cycle. * * # Example * <pre> var scope = ...; scope.name = 'misko'; scope.counter = 0; expect(scope.counter).toEqual(0); scope.$watch('name', function(newValue, oldValue) { scope.counter = scope.counter + 1; }); expect(scope.counter).toEqual(0); scope.$digest(); // no variable change expect(scope.counter).toEqual(0); scope.name = 'adam'; scope.$digest(); expect(scope.counter).toEqual(1); * </pre> * */ $digest: function() { var watch, value, last, watchers, asyncQueue = this.$$asyncQueue, length, dirty, ttl = TTL, next, current, target = this, watchLog = [], logIdx, logMsg; beginPhase('$digest'); do { // "while dirty" loop dirty = false; current = target; while(asyncQueue.length) { try { current.$eval(asyncQueue.shift()); } catch (e) { $exceptionHandler(e); } } do { // "traverse the scopes" loop if ((watchers = current.$$watchers)) { // process our watches length = watchers.length; while (length--) { try { watch = watchers[length]; // Most common watches are on primitives, in which case we can short // circuit it with === operator, only when === fails do we use .equals if ((value = watch.get(current)) !== (last = watch.last) && !(watch.eq ? equals(value, last) : (typeof value == 'number' && typeof last == 'number' && isNaN(value) && isNaN(last)))) { dirty = true; watch.last = watch.eq ? copy(value) : value; watch.fn(value, ((last === initWatchVal) ? value : last), current); if (ttl < 5) { logIdx = 4 - ttl; if (!watchLog[logIdx]) watchLog[logIdx] = []; logMsg = (isFunction(watch.exp)) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp; logMsg += '; newVal: ' + toJson(value) + '; oldVal: ' + toJson(last); watchLog[logIdx].push(logMsg); } } } catch (e) { $exceptionHandler(e); } } } // Insanity Warning: scope depth-first traversal // yes, this code is a bit crazy, but it works and we have tests to prove it! // this piece should be kept in sync with the traversal in $broadcast if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) { while(current !== target && !(next = current.$$nextSibling)) { current = current.$parent; } } } while ((current = next)); if(dirty && !(ttl--)) { clearPhase(); throw Error(TTL + ' $digest() iterations reached. Aborting!\n' + 'Watchers fired in the last 5 iterations: ' + toJson(watchLog)); } } while (dirty || asyncQueue.length); clearPhase(); }, /** * @ngdoc event * @name ng.$rootScope.Scope#$destroy * @eventOf ng.$rootScope.Scope * @eventType broadcast on scope being destroyed * * @description * Broadcasted when a scope and its children are being destroyed. */ /** * @ngdoc function * @name ng.$rootScope.Scope#$destroy * @methodOf ng.$rootScope.Scope * @function * * @description * Removes the current scope (and all of its children) from the parent scope. Removal implies * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer * propagate to the current scope and its children. Removal also implies that the current * scope is eligible for garbage collection. * * The `$destroy()` is usually used by directives such as * {@link ng.directive:ngRepeat ngRepeat} for managing the * unrolling of the loop. * * Just before a scope is destroyed a `$destroy` event is broadcasted on this scope. * Application code can register a `$destroy` event handler that will give it chance to * perform any necessary cleanup. */ $destroy: function() { // we can't destroy the root scope or a scope that has been already destroyed if ($rootScope == this || this.$$destroyed) return; var parent = this.$parent; this.$broadcast('$destroy'); this.$$destroyed = true; if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling; if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling; if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling; if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling; // This is bogus code that works around Chrome's GC leak // see: https://github.com/angular/angular.js/issues/1313#issuecomment-10378451 this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead = this.$$childTail = null; }, /** * @ngdoc function * @name ng.$rootScope.Scope#$eval * @methodOf ng.$rootScope.Scope * @function * * @description * Executes the `expression` on the current scope returning the result. Any exceptions in the * expression are propagated (uncaught). This is useful when evaluating Angular expressions. * * # Example * <pre> var scope = ng.$rootScope.Scope(); scope.a = 1; scope.b = 2; expect(scope.$eval('a+b')).toEqual(3); expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3); * </pre> * * @param {(string|function())=} expression An angular expression to be executed. * * - `string`: execute using the rules as defined in {@link guide/expression expression}. * - `function(scope)`: execute the function with the current `scope` parameter. * * @returns {*} The result of evaluating the expression. */ $eval: function(expr, locals) { return $parse(expr)(this, locals); }, /** * @ngdoc function * @name ng.$rootScope.Scope#$evalAsync * @methodOf ng.$rootScope.Scope * @function * * @description * Executes the expression on the current scope at a later point in time. * * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only that: * * - it will execute in the current script execution context (before any DOM rendering). * - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after * `expression` execution. * * Any exceptions from the execution of the expression are forwarded to the * {@link ng.$exceptionHandler $exceptionHandler} service. * * @param {(string|function())=} expression An angular expression to be executed. * * - `string`: execute using the rules as defined in {@link guide/expression expression}. * - `function(scope)`: execute the function with the current `scope` parameter. * */ $evalAsync: function(expr) { this.$$asyncQueue.push(expr); }, /** * @ngdoc function * @name ng.$rootScope.Scope#$apply * @methodOf ng.$rootScope.Scope * @function * * @description * `$apply()` is used to execute an expression in angular from outside of the angular framework. * (For example from browser DOM events, setTimeout, XHR or third party libraries). * Because we are calling into the angular framework we need to perform proper scope life-cycle * of {@link ng.$exceptionHandler exception handling}, * {@link ng.$rootScope.Scope#$digest executing watches}. * * ## Life cycle * * # Pseudo-Code of `$apply()` * <pre> function $apply(expr) { try { return $eval(expr); } catch (e) { $exceptionHandler(e); } finally { $root.$digest(); } } * </pre> * * * Scope's `$apply()` method transitions through the following stages: * * 1. The {@link guide/expression expression} is executed using the * {@link ng.$rootScope.Scope#$eval $eval()} method. * 2. Any exceptions from the execution of the expression are forwarded to the * {@link ng.$exceptionHandler $exceptionHandler} service. * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the expression * was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method. * * * @param {(string|function())=} exp An angular expression to be executed. * * - `string`: execute using the rules as defined in {@link guide/expression expression}. * - `function(scope)`: execute the function with current `scope` parameter. * * @returns {*} The result of evaluating the expression. */ $apply: function(expr) { try { beginPhase('$apply'); return this.$eval(expr); } catch (e) { $exceptionHandler(e); } finally { clearPhase(); try { $rootScope.$digest(); } catch (e) { $exceptionHandler(e); throw e; } } }, /** * @ngdoc function * @name ng.$rootScope.Scope#$on * @methodOf ng.$rootScope.Scope * @function * * @description * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for discussion of * event life cycle. * * The event listener function format is: `function(event, args...)`. The `event` object * passed into the listener has the following attributes: * * - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or `$broadcast`-ed. * - `currentScope` - `{Scope}`: the current scope which is handling the event. * - `name` - `{string}`: Name of the event. * - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel further event * propagation (available only for events that were `$emit`-ed). * - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag to true. * - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called. * * @param {string} name Event name to listen on. * @param {function(event, args...)} listener Function to call when the event is emitted. * @returns {function()} Returns a deregistration function for this listener. */ $on: function(name, listener) { var namedListeners = this.$$listeners[name]; if (!namedListeners) { this.$$listeners[name] = namedListeners = []; } namedListeners.push(listener); return function() { namedListeners[indexOf(namedListeners, listener)] = null; }; }, /** * @ngdoc function * @name ng.$rootScope.Scope#$emit * @methodOf ng.$rootScope.Scope * @function * * @description * Dispatches an event `name` upwards through the scope hierarchy notifying the * registered {@link ng.$rootScope.Scope#$on} listeners. * * The event life cycle starts at the scope on which `$emit` was called. All * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get notified. * Afterwards, the event traverses upwards toward the root scope and calls all registered * listeners along the way. The event will stop propagating if one of the listeners cancels it. * * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed * onto the {@link ng.$exceptionHandler $exceptionHandler} service. * * @param {string} name Event name to emit. * @param {...*} args Optional set of arguments which will be passed onto the event listeners. * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on} */ $emit: function(name, args) { var empty = [], namedListeners, scope = this, stopPropagation = false, event = { name: name, targetScope: scope, stopPropagation: function() {stopPropagation = true;}, preventDefault: function() { event.defaultPrevented = true; }, defaultPrevented: false }, listenerArgs = concat([event], arguments, 1), i, length; do { namedListeners = scope.$$listeners[name] || empty; event.currentScope = scope; for (i=0, length=namedListeners.length; i<length; i++) { // if listeners were deregistered, defragment the array if (!namedListeners[i]) { namedListeners.splice(i, 1); i--; length--; continue; } try { namedListeners[i].apply(null, listenerArgs); if (stopPropagation) return event; } catch (e) { $exceptionHandler(e); } } //traverse upwards scope = scope.$parent; } while (scope); return event; }, /** * @ngdoc function * @name ng.$rootScope.Scope#$broadcast * @methodOf ng.$rootScope.Scope * @function * * @description * Dispatches an event `name` downwards to all child scopes (and their children) notifying the * registered {@link ng.$rootScope.Scope#$on} listeners. * * The event life cycle starts at the scope on which `$broadcast` was called. All * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get notified. * Afterwards, the event propagates to all direct and indirect scopes of the current scope and * calls all registered listeners along the way. The event cannot be canceled. * * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed * onto the {@link ng.$exceptionHandler $exceptionHandler} service. * * @param {string} name Event name to broadcast. * @param {...*} args Optional set of arguments which will be passed onto the event listeners. * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on} */ $broadcast: function(name, args) { var target = this, current = target, next = target, event = { name: name, targetScope: target, preventDefault: function() { event.defaultPrevented = true; }, defaultPrevented: false }, listenerArgs = concat([event], arguments, 1), listeners, i, length; //down while you can, then up and next sibling or up and next sibling until back at root do { current = next; event.currentScope = current; listeners = current.$$listeners[name] || []; for (i=0, length = listeners.length; i<length; i++) { // if listeners were deregistered, defragment the array if (!listeners[i]) { listeners.splice(i, 1); i--; length--; continue; } try { listeners[i].apply(null, listenerArgs); } catch(e) { $exceptionHandler(e); } } // Insanity Warning: scope depth-first traversal // yes, this code is a bit crazy, but it works and we have tests to prove it! // this piece should be kept in sync with the traversal in $digest if (!(next = (current.$$childHead || (current !== target && current.$$nextSibling)))) { while(current !== target && !(next = current.$$nextSibling)) { current = current.$parent; } } } while ((current = next)); return event; } }; var $rootScope = new Scope(); return $rootScope; function beginPhase(phase) { if ($rootScope.$$phase) { throw Error($rootScope.$$phase + ' already in progress'); } $rootScope.$$phase = phase; } function clearPhase() { $rootScope.$$phase = null; } function compileToFn(exp, name) { var fn = $parse(exp); assertArgFn(fn, name); return fn; } /** * function used as an initial value for watchers. * because it's unique we can easily tell it apart from other values */ function initWatchVal() {} }]; } /** * !!! This is an undocumented "private" service !!! * * @name ng.$sniffer * @requires $window * @requires $document * * @property {boolean} history Does the browser support html5 history api ? * @property {boolean} hashchange Does the browser support hashchange event ? * @property {boolean} transitions Does the browser support CSS transition events ? * @property {boolean} animations Does the browser support CSS animation events ? * * @description * This is very simple implementation of testing browser's features. */ function $SnifferProvider() { this.$get = ['$window', '$document', function($window, $document) { var eventSupport = {}, android = int((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]), document = $document[0] || {}, vendorPrefix, vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/, bodyStyle = document.body && document.body.style, transitions = false, animations = false, match; if (bodyStyle) { for(var prop in bodyStyle) { if(match = vendorRegex.exec(prop)) { vendorPrefix = match[0]; vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1); break; } } transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle)); animations = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle)); } return { // Android has history.pushState, but it does not update location correctly // so let's not use the history API at all. // http://code.google.com/p/android/issues/detail?id=17471 // https://github.com/angular/angular.js/issues/904 history: !!($window.history && $window.history.pushState && !(android < 4)), hashchange: 'onhashchange' in $window && // IE8 compatible mode lies (!document.documentMode || document.documentMode > 7), hasEvent: function(event) { // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have // it. In particular the event is not fired when backspace or delete key are pressed or // when cut operation is performed. if (event == 'input' && msie == 9) return false; if (isUndefined(eventSupport[event])) { var divElm = document.createElement('div'); eventSupport[event] = 'on' + event in divElm; } return eventSupport[event]; }, csp: document.securityPolicy ? document.securityPolicy.isActive : false, vendorPrefix: vendorPrefix, transitions : transitions, animations : animations }; }]; } /** * @ngdoc object * @name ng.$window * * @description * A reference to the browser's `window` object. While `window` * is globally available in JavaScript, it causes testability problems, because * it is a global variable. In angular we always refer to it through the * `$window` service, so it may be overridden, removed or mocked for testing. * * All expressions are evaluated with respect to current scope so they don't * suffer from window globality. * * @example <doc:example> <doc:source> <script> function Ctrl($scope, $window) { $scope.$window = $window; $scope.greeting = 'Hello, World!'; } </script> <div ng-controller="Ctrl"> <input type="text" ng-model="greeting" /> <button ng-click="$window.alert(greeting)">ALERT</button> </div> </doc:source> <doc:scenario> it('should display the greeting in the input box', function() { input('greeting').enter('Hello, E2E Tests'); // If we click the button it will block the test runner // element(':button').click(); }); </doc:scenario> </doc:example> */ function $WindowProvider(){ this.$get = valueFn(window); } /** * Parse headers into key value object * * @param {string} headers Raw headers as a string * @returns {Object} Parsed headers as key value object */ function parseHeaders(headers) { var parsed = {}, key, val, i; if (!headers) return parsed; forEach(headers.split('\n'), function(line) { i = line.indexOf(':'); key = lowercase(trim(line.substr(0, i))); val = trim(line.substr(i + 1)); if (key) { if (parsed[key]) { parsed[key] += ', ' + val; } else { parsed[key] = val; } } }); return parsed; } var IS_SAME_DOMAIN_URL_MATCH = /^(([^:]+):)?\/\/(\w+:{0,1}\w*@)?([\w\.-]*)?(:([0-9]+))?(.*)$/; /** * Parse a request and location URL and determine whether this is a same-domain request. * * @param {string} requestUrl The url of the request. * @param {string} locationUrl The current browser location url. * @returns {boolean} Whether the request is for the same domain. */ function isSameDomain(requestUrl, locationUrl) { var match = IS_SAME_DOMAIN_URL_MATCH.exec(requestUrl); // if requestUrl is relative, the regex does not match. if (match == null) return true; var domain1 = { protocol: match[2], host: match[4], port: int(match[6]) || DEFAULT_PORTS[match[2]] || null, // IE8 sets unmatched groups to '' instead of undefined. relativeProtocol: match[2] === undefined || match[2] === '' }; match = SERVER_MATCH.exec(locationUrl); var domain2 = { protocol: match[1], host: match[3], port: int(match[5]) || DEFAULT_PORTS[match[1]] || null }; return (domain1.protocol == domain2.protocol || domain1.relativeProtocol) && domain1.host == domain2.host && (domain1.port == domain2.port || (domain1.relativeProtocol && domain2.port == DEFAULT_PORTS[domain2.protocol])); } /** * Returns a function that provides access to parsed headers. * * Headers are lazy parsed when first requested. * @see parseHeaders * * @param {(string|Object)} headers Headers to provide access to. * @returns {function(string=)} Returns a getter function which if called with: * * - if called with single an argument returns a single header value or null * - if called with no arguments returns an object containing all headers. */ function headersGetter(headers) { var headersObj = isObject(headers) ? headers : undefined; return function(name) { if (!headersObj) headersObj = parseHeaders(headers); if (name) { return headersObj[lowercase(name)] || null; } return headersObj; }; } /** * Chain all given functions * * This function is used for both request and response transforming * * @param {*} data Data to transform. * @param {function(string=)} headers Http headers getter fn. * @param {(function|Array.<function>)} fns Function or an array of functions. * @returns {*} Transformed data. */ function transformData(data, headers, fns) { if (isFunction(fns)) return fns(data, headers); forEach(fns, function(fn) { data = fn(data, headers); }); return data; } function isSuccess(status) { return 200 <= status && status < 300; } function $HttpProvider() { var JSON_START = /^\s*(\[|\{[^\{])/, JSON_END = /[\}\]]\s*$/, PROTECTION_PREFIX = /^\)\]\}',?\n/, CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': 'application/json;charset=utf-8'}; var defaults = this.defaults = { // transform incoming response data transformResponse: [function(data) { if (isString(data)) { // strip json vulnerability protection prefix data = data.replace(PROTECTION_PREFIX, ''); if (JSON_START.test(data) && JSON_END.test(data)) data = fromJson(data, true); } return data; }], // transform outgoing request data transformRequest: [function(d) { return isObject(d) && !isFile(d) ? toJson(d) : d; }], // default headers headers: { common: { 'Accept': 'application/json, text/plain, */*' }, post: CONTENT_TYPE_APPLICATION_JSON, put: CONTENT_TYPE_APPLICATION_JSON, patch: CONTENT_TYPE_APPLICATION_JSON }, xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN' }; /** * Are order by request. I.E. they are applied in the same order as * array on request, but revers order on response. */ var interceptorFactories = this.interceptors = []; /** * For historical reasons, response interceptors ordered by the order in which * they are applied to response. (This is in revers to interceptorFactories) */ var responseInterceptorFactories = this.responseInterceptors = []; this.$get = ['$httpBackend', '$browser', '$cacheFactory', '$rootScope', '$q', '$injector', function($httpBackend, $browser, $cacheFactory, $rootScope, $q, $injector) { var defaultCache = $cacheFactory('$http'); /** * Interceptors stored in reverse order. Inner interceptors before outer interceptors. * The reversal is needed so that we can build up the interception chain around the * server request. */ var reversedInterceptors = []; forEach(interceptorFactories, function(interceptorFactory) { reversedInterceptors.unshift(isString(interceptorFactory) ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory)); }); forEach(responseInterceptorFactories, function(interceptorFactory, index) { var responseFn = isString(interceptorFactory) ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory); /** * Response interceptors go before "around" interceptors (no real reason, just * had to pick one.) But they are already revesed, so we can't use unshift, hence * the splice. */ reversedInterceptors.splice(index, 0, { response: function(response) { return responseFn($q.when(response)); }, responseError: function(response) { return responseFn($q.reject(response)); } }); }); /** * @ngdoc function * @name ng.$http * @requires $httpBackend * @requires $browser * @requires $cacheFactory * @requires $rootScope * @requires $q * @requires $injector * * @description * The `$http` service is a core Angular service that facilitates communication with the remote * HTTP servers via the browser's {@link https://developer.mozilla.org/en/xmlhttprequest * XMLHttpRequest} object or via {@link http://en.wikipedia.org/wiki/JSONP JSONP}. * * For unit testing applications that use `$http` service, see * {@link ngMock.$httpBackend $httpBackend mock}. * * For a higher level of abstraction, please check out the {@link ngResource.$resource * $resource} service. * * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage * it is important to familiarize yourself with these APIs and the guarantees they provide. * * * # General usage * The `$http` service is a function which takes a single argument — a configuration object — * that is used to generate an HTTP request and returns a {@link ng.$q promise} * with two $http specific methods: `success` and `error`. * * <pre> * $http({method: 'GET', url: '/someUrl'}). * success(function(data, status, headers, config) { * // this callback will be called asynchronously * // when the response is available * }). * error(function(data, status, headers, config) { * // called asynchronously if an error occurs * // or server returns response with an error status. * }); * </pre> * * Since the returned value of calling the $http function is a `promise`, you can also use * the `then` method to register callbacks, and these callbacks will receive a single argument – * an object representing the response. See the API signature and type info below for more * details. * * A response status code between 200 and 299 is considered a success status and * will result in the success callback being called. Note that if the response is a redirect, * XMLHttpRequest will transparently follow it, meaning that the error callback will not be * called for such responses. * * # Shortcut methods * * Since all invocations of the $http service require passing in an HTTP method and URL, and * POST/PUT requests require request data to be provided as well, shortcut methods * were created: * * <pre> * $http.get('/someUrl').success(successCallback); * $http.post('/someUrl', data).success(successCallback); * </pre> * * Complete list of shortcut methods: * * - {@link ng.$http#get $http.get} * - {@link ng.$http#head $http.head} * - {@link ng.$http#post $http.post} * - {@link ng.$http#put $http.put} * - {@link ng.$http#delete $http.delete} * - {@link ng.$http#jsonp $http.jsonp} * * * # Setting HTTP Headers * * The $http service will automatically add certain HTTP headers to all requests. These defaults * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration * object, which currently contains this default configuration: * * - `$httpProvider.defaults.headers.common` (headers that are common for all requests): * - `Accept: application/json, text/plain, * / *` * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests) * - `Content-Type: application/json` * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests) * - `Content-Type: application/json` * * To add or overwrite these defaults, simply add or remove a property from these configuration * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object * with the lowercased HTTP method name as the key, e.g. * `$httpProvider.defaults.headers.get['My-Header']='value'`. * * Additionally, the defaults can be set at runtime via the `$http.defaults` object in the same * fashion. * * * # Transforming Requests and Responses * * Both requests and responses can be transformed using transform functions. By default, Angular * applies these transformations: * * Request transformations: * * - If the `data` property of the request configuration object contains an object, serialize it into * JSON format. * * Response transformations: * * - If XSRF prefix is detected, strip it (see Security Considerations section below). * - If JSON response is detected, deserialize it using a JSON parser. * * To globally augment or override the default transforms, modify the `$httpProvider.defaults.transformRequest` and * `$httpProvider.defaults.transformResponse` properties. These properties are by default an * array of transform functions, which allows you to `push` or `unshift` a new transformation function into the * transformation chain. You can also decide to completely override any default transformations by assigning your * transformation functions to these properties directly without the array wrapper. * * Similarly, to locally override the request/response transforms, augment the `transformRequest` and/or * `transformResponse` properties of the configuration object passed into `$http`. * * * # Caching * * To enable caching, set the configuration property `cache` to `true`. When the cache is * enabled, `$http` stores the response from the server in local cache. Next time the * response is served from the cache without sending a request to the server. * * Note that even if the response is served from cache, delivery of the data is asynchronous in * the same way that real requests are. * * If there are multiple GET requests for the same URL that should be cached using the same * cache, but the cache is not populated yet, only one request to the server will be made and * the remaining requests will be fulfilled using the response from the first request. * * A custom default cache built with $cacheFactory can be provided in $http.defaults.cache. * To skip it, set configuration property `cache` to `false`. * * * # Interceptors * * Before you start creating interceptors, be sure to understand the * {@link ng.$q $q and deferred/promise APIs}. * * For purposes of global error handling, authentication, or any kind of synchronous or * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be * able to intercept requests before they are handed to the server and * responses before they are handed over to the application code that * initiated these requests. The interceptors leverage the {@link ng.$q * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing. * * The interceptors are service factories that are registered with the `$httpProvider` by * adding them to the `$httpProvider.interceptors` array. The factory is called and * injected with dependencies (if specified) and returns the interceptor. * * There are two kinds of interceptors (and two kinds of rejection interceptors): * * * `request`: interceptors get called with http `config` object. The function is free to modify * the `config` or create a new one. The function needs to return the `config` directly or as a * promise. * * `requestError`: interceptor gets called when a previous interceptor threw an error or resolved * with a rejection. * * `response`: interceptors get called with http `response` object. The function is free to modify * the `response` or create a new one. The function needs to return the `response` directly or as a * promise. * * `responseError`: interceptor gets called when a previous interceptor threw an error or resolved * with a rejection. * * * <pre> * // register the interceptor as a service * $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) { * return { * // optional method * 'request': function(config) { * // do something on success * return config || $q.when(config); * }, * * // optional method * 'requestError': function(rejection) { * // do something on error * if (canRecover(rejection)) { * return responseOrNewPromise * } * return $q.reject(rejection); * }, * * * * // optional method * 'response': function(response) { * // do something on success * return response || $q.when(response); * }, * * // optional method * 'responseError': function(rejection) { * // do something on error * if (canRecover(rejection)) { * return responseOrNewPromise * } * return $q.reject(rejection); * }; * } * }); * * $httpProvider.interceptors.push('myHttpInterceptor'); * * * // register the interceptor via an anonymous factory * $httpProvider.interceptors.push(function($q, dependency1, dependency2) { * return { * 'request': function(config) { * // same as above * }, * 'response': function(response) { * // same as above * } * }); * </pre> * * # Response interceptors (DEPRECATED) * * Before you start creating interceptors, be sure to understand the * {@link ng.$q $q and deferred/promise APIs}. * * For purposes of global error handling, authentication or any kind of synchronous or * asynchronous preprocessing of received responses, it is desirable to be able to intercept * responses for http requests before they are handed over to the application code that * initiated these requests. The response interceptors leverage the {@link ng.$q * promise apis} to fulfil this need for both synchronous and asynchronous preprocessing. * * The interceptors are service factories that are registered with the $httpProvider by * adding them to the `$httpProvider.responseInterceptors` array. The factory is called and * injected with dependencies (if specified) and returns the interceptor — a function that * takes a {@link ng.$q promise} and returns the original or a new promise. * * <pre> * // register the interceptor as a service * $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) { * return function(promise) { * return promise.then(function(response) { * // do something on success * }, function(response) { * // do something on error * if (canRecover(response)) { * return responseOrNewPromise * } * return $q.reject(response); * }); * } * }); * * $httpProvider.responseInterceptors.push('myHttpInterceptor'); * * * // register the interceptor via an anonymous factory * $httpProvider.responseInterceptors.push(function($q, dependency1, dependency2) { * return function(promise) { * // same as above * } * }); * </pre> * * * # Security Considerations * * When designing web applications, consider security threats from: * * - {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx * JSON vulnerability} * - {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF} * * Both server and the client must cooperate in order to eliminate these threats. Angular comes * pre-configured with strategies that address these issues, but for this to work backend server * cooperation is required. * * ## JSON Vulnerability Protection * * A {@link http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx * JSON vulnerability} allows third party website to turn your JSON resource URL into * {@link http://en.wikipedia.org/wiki/JSONP JSONP} request under some conditions. To * counter this your server can prefix all JSON requests with following string `")]}',\n"`. * Angular will automatically strip the prefix before processing it as JSON. * * For example if your server needs to return: * <pre> * ['one','two'] * </pre> * * which is vulnerable to attack, your server can return: * <pre> * )]}', * ['one','two'] * </pre> * * Angular will strip the prefix, before processing the JSON. * * * ## Cross Site Request Forgery (XSRF) Protection * * {@link http://en.wikipedia.org/wiki/Cross-site_request_forgery XSRF} is a technique by which * an unauthorized site can gain your user's private data. Angular provides a mechanism * to counter XSRF. When performing XHR requests, the $http service reads a token from a cookie * (by default, `XSRF-TOKEN`) and sets it as an HTTP header (`X-XSRF-TOKEN`). Since only * JavaScript that runs on your domain could read the cookie, your server can be assured that * the XHR came from JavaScript running on your domain. The header will not be set for * cross-domain requests. * * To take advantage of this, your server needs to set a token in a JavaScript readable session * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure * that only JavaScript running on your domain could have sent the request. The token must be * unique for each user and must be verifiable by the server (to prevent the JavaScript from making * up its own tokens). We recommend that the token is a digest of your site's authentication * cookie with a {@link https://en.wikipedia.org/wiki/Salt_(cryptography) salt} for added security. * * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName * properties of either $httpProvider.defaults, or the per-request config object. * * * @param {object} config Object describing the request to be made and how it should be * processed. The object has following properties: * * - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc) * - **url** – `{string}` – Absolute or relative URL of the resource that is being requested. * - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be turned to * `?key1=value1&key2=value2` after the url. If the value is not a string, it will be JSONified. * - **data** – `{string|Object}` – Data to be sent as the request message data. * - **headers** – `{Object}` – Map of strings representing HTTP headers to send to the server. * - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token. * - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token. * - **transformRequest** – `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` – * transform function or an array of such functions. The transform function takes the http * request body and headers and returns its transformed (typically serialized) version. * - **transformResponse** – `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` – * transform function or an array of such functions. The transform function takes the http * response body and headers and returns its transformed (typically deserialized) version. * - **cache** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the * GET request, otherwise if a cache instance built with * {@link ng.$cacheFactory $cacheFactory}, this cache will be used for * caching. * - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise} * that should abort the request when resolved. * - **withCredentials** - `{boolean}` - whether to to set the `withCredentials` flag on the * XHR object. See {@link https://developer.mozilla.org/en/http_access_control#section_5 * requests with credentials} for more information. * - **responseType** - `{string}` - see {@link * https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType requestType}. * * @returns {HttpPromise} Returns a {@link ng.$q promise} object with the * standard `then` method and two http specific methods: `success` and `error`. The `then` * method takes two arguments a success and an error callback which will be called with a * response object. The `success` and `error` methods take a single argument - a function that * will be called when the request succeeds or fails respectively. The arguments passed into * these functions are destructured representation of the response object passed into the * `then` method. The response object has these properties: * * - **data** – `{string|Object}` – The response body transformed with the transform functions. * - **status** – `{number}` – HTTP status code of the response. * - **headers** – `{function([headerName])}` – Header getter function. * - **config** – `{Object}` – The configuration object that was used to generate the request. * * @property {Array.<Object>} pendingRequests Array of config objects for currently pending * requests. This is primarily meant to be used for debugging purposes. * * * @example <example> <file name="index.html"> <div ng-controller="FetchCtrl"> <select ng-model="method"> <option>GET</option> <option>JSONP</option> </select> <input type="text" ng-model="url" size="80"/> <button ng-click="fetch()">fetch</button><br> <button ng-click="updateModel('GET', 'http-hello.html')">Sample GET</button> <button ng-click="updateModel('JSONP', 'http://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">Sample JSONP</button> <button ng-click="updateModel('JSONP', 'http://angularjs.org/doesntexist&callback=JSON_CALLBACK')">Invalid JSONP</button> <pre>http status code: {{status}}</pre> <pre>http response data: {{data}}</pre> </div> </file> <file name="script.js"> function FetchCtrl($scope, $http, $templateCache) { $scope.method = 'GET'; $scope.url = 'http-hello.html'; $scope.fetch = function() { $scope.code = null; $scope.response = null; $http({method: $scope.method, url: $scope.url, cache: $templateCache}). success(function(data, status) { $scope.status = status; $scope.data = data; }). error(function(data, status) { $scope.data = data || "Request failed"; $scope.status = status; }); }; $scope.updateModel = function(method, url) { $scope.method = method; $scope.url = url; }; } </file> <file name="http-hello.html"> Hello, $http! </file> <file name="scenario.js"> it('should make an xhr GET request', function() { element(':button:contains("Sample GET")').click(); element(':button:contains("fetch")').click(); expect(binding('status')).toBe('200'); expect(binding('data')).toMatch(/Hello, \$http!/); }); it('should make a JSONP request to angularjs.org', function() { element(':button:contains("Sample JSONP")').click(); element(':button:contains("fetch")').click(); expect(binding('status')).toBe('200'); expect(binding('data')).toMatch(/Super Hero!/); }); it('should make JSONP request to invalid URL and invoke the error handler', function() { element(':button:contains("Invalid JSONP")').click(); element(':button:contains("fetch")').click(); expect(binding('status')).toBe('0'); expect(binding('data')).toBe('Request failed'); }); </file> </example> */ function $http(requestConfig) { var config = { transformRequest: defaults.transformRequest, transformResponse: defaults.transformResponse }; var headers = {}; extend(config, requestConfig); config.headers = headers; config.method = uppercase(config.method); extend(headers, defaults.headers.common, defaults.headers[lowercase(config.method)], requestConfig.headers); var xsrfValue = isSameDomain(config.url, $browser.url()) ? $browser.cookies()[config.xsrfCookieName || defaults.xsrfCookieName] : undefined; if (xsrfValue) { headers[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue; } var serverRequest = function(config) { var reqData = transformData(config.data, headersGetter(headers), config.transformRequest); // strip content-type if data is undefined if (isUndefined(config.data)) { delete headers['Content-Type']; } if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) { config.withCredentials = defaults.withCredentials; } // send request return sendReq(config, reqData, headers).then(transformResponse, transformResponse); }; var chain = [serverRequest, undefined]; var promise = $q.when(config); // apply interceptors forEach(reversedInterceptors, function(interceptor) { if (interceptor.request || interceptor.requestError) { chain.unshift(interceptor.request, interceptor.requestError); } if (interceptor.response || interceptor.responseError) { chain.push(interceptor.response, interceptor.responseError); } }); while(chain.length) { var thenFn = chain.shift(); var rejectFn = chain.shift(); promise = promise.then(thenFn, rejectFn); } promise.success = function(fn) { promise.then(function(response) { fn(response.data, response.status, response.headers, config); }); return promise; }; promise.error = function(fn) { promise.then(null, function(response) { fn(response.data, response.status, response.headers, config); }); return promise; }; return promise; function transformResponse(response) { // make a copy since the response must be cacheable var resp = extend({}, response, { data: transformData(response.data, response.headers, config.transformResponse) }); return (isSuccess(response.status)) ? resp : $q.reject(resp); } } $http.pendingRequests = []; /** * @ngdoc method * @name ng.$http#get * @methodOf ng.$http * * @description * Shortcut method to perform `GET` request. * * @param {string} url Relative or absolute URL specifying the destination of the request * @param {Object=} config Optional configuration object * @returns {HttpPromise} Future object */ /** * @ngdoc method * @name ng.$http#delete * @methodOf ng.$http * * @description * Shortcut method to perform `DELETE` request. * * @param {string} url Relative or absolute URL specifying the destination of the request * @param {Object=} config Optional configuration object * @returns {HttpPromise} Future object */ /** * @ngdoc method * @name ng.$http#head * @methodOf ng.$http * * @description * Shortcut method to perform `HEAD` request. * * @param {string} url Relative or absolute URL specifying the destination of the request * @param {Object=} config Optional configuration object * @returns {HttpPromise} Future object */ /** * @ngdoc method * @name ng.$http#jsonp * @methodOf ng.$http * * @description * Shortcut method to perform `JSONP` request. * * @param {string} url Relative or absolute URL specifying the destination of the request. * Should contain `JSON_CALLBACK` string. * @param {Object=} config Optional configuration object * @returns {HttpPromise} Future object */ createShortMethods('get', 'delete', 'head', 'jsonp'); /** * @ngdoc method * @name ng.$http#post * @methodOf ng.$http * * @description * Shortcut method to perform `POST` request. * * @param {string} url Relative or absolute URL specifying the destination of the request * @param {*} data Request content * @param {Object=} config Optional configuration object * @returns {HttpPromise} Future object */ /** * @ngdoc method * @name ng.$http#put * @methodOf ng.$http * * @description * Shortcut method to perform `PUT` request. * * @param {string} url Relative or absolute URL specifying the destination of the request * @param {*} data Request content * @param {Object=} config Optional configuration object * @returns {HttpPromise} Future object */ createShortMethodsWithData('post', 'put'); /** * @ngdoc property * @name ng.$http#defaults * @propertyOf ng.$http * * @description * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of * default headers, withCredentials as well as request and response transformations. * * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above. */ $http.defaults = defaults; return $http; function createShortMethods(names) { forEach(arguments, function(name) { $http[name] = function(url, config) { return $http(extend(config || {}, { method: name, url: url })); }; }); } function createShortMethodsWithData(name) { forEach(arguments, function(name) { $http[name] = function(url, data, config) { return $http(extend(config || {}, { method: name, url: url, data: data })); }; }); } /** * Makes the request. * * !!! ACCESSES CLOSURE VARS: * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests */ function sendReq(config, reqData, reqHeaders) { var deferred = $q.defer(), promise = deferred.promise, cache, cachedResp, url = buildUrl(config.url, config.params); $http.pendingRequests.push(config); promise.then(removePendingReq, removePendingReq); if ((config.cache || defaults.cache) && config.cache !== false && config.method == 'GET') { cache = isObject(config.cache) ? config.cache : isObject(defaults.cache) ? defaults.cache : defaultCache; } if (cache) { cachedResp = cache.get(url); if (cachedResp) { if (cachedResp.then) { // cached request has already been sent, but there is no response yet cachedResp.then(removePendingReq, removePendingReq); return cachedResp; } else { // serving from cache if (isArray(cachedResp)) { resolvePromise(cachedResp[1], cachedResp[0], copy(cachedResp[2])); } else { resolvePromise(cachedResp, 200, {}); } } } else { // put the promise for the non-transformed response into cache as a placeholder cache.put(url, promise); } } // if we won't have the response in cache, send the request to the backend if (!cachedResp) { $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout, config.withCredentials, config.responseType); } return promise; /** * Callback registered to $httpBackend(): * - caches the response if desired * - resolves the raw $http promise * - calls $apply */ function done(status, response, headersString) { if (cache) { if (isSuccess(status)) { cache.put(url, [status, response, parseHeaders(headersString)]); } else { // remove promise from the cache cache.remove(url); } } resolvePromise(response, status, headersString); if (!$rootScope.$$phase) $rootScope.$apply(); } /** * Resolves the raw $http promise. */ function resolvePromise(response, status, headers) { // normalize internal statuses to 0 status = Math.max(status, 0); (isSuccess(status) ? deferred.resolve : deferred.reject)({ data: response, status: status, headers: headersGetter(headers), config: config }); } function removePendingReq() { var idx = indexOf($http.pendingRequests, config); if (idx !== -1) $http.pendingRequests.splice(idx, 1); } } function buildUrl(url, params) { if (!params) return url; var parts = []; forEachSorted(params, function(value, key) { if (value == null || value == undefined) return; if (!isArray(value)) value = [value]; forEach(value, function(v) { if (isObject(v)) { v = toJson(v); } parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(v)); }); }); return url + ((url.indexOf('?') == -1) ? '?' : '&') + parts.join('&'); } }]; } var XHR = window.XMLHttpRequest || function() { try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e1) {} try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e2) {} try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e3) {} throw new Error("This browser does not support XMLHttpRequest."); }; /** * @ngdoc object * @name ng.$httpBackend * @requires $browser * @requires $window * @requires $document * * @description * HTTP backend used by the {@link ng.$http service} that delegates to * XMLHttpRequest object or JSONP and deals with browser incompatibilities. * * You should never need to use this service directly, instead use the higher-level abstractions: * {@link ng.$http $http} or {@link ngResource.$resource $resource}. * * During testing this implementation is swapped with {@link ngMock.$httpBackend mock * $httpBackend} which can be trained with responses. */ function $HttpBackendProvider() { this.$get = ['$browser', '$window', '$document', function($browser, $window, $document) { return createHttpBackend($browser, XHR, $browser.defer, $window.angular.callbacks, $document[0], $window.location.protocol.replace(':', '')); }]; } function createHttpBackend($browser, XHR, $browserDefer, callbacks, rawDocument, locationProtocol) { // TODO(vojta): fix the signature return function(method, url, post, callback, headers, timeout, withCredentials, responseType) { var status; $browser.$$incOutstandingRequestCount(); url = url || $browser.url(); if (lowercase(method) == 'jsonp') { var callbackId = '_' + (callbacks.counter++).toString(36); callbacks[callbackId] = function(data) { callbacks[callbackId].data = data; }; var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId), function() { if (callbacks[callbackId].data) { completeRequest(callback, 200, callbacks[callbackId].data); } else { completeRequest(callback, status || -2); } delete callbacks[callbackId]; }); } else { var xhr = new XHR(); xhr.open(method, url, true); forEach(headers, function(value, key) { if (value) xhr.setRequestHeader(key, value); }); // In IE6 and 7, this might be called synchronously when xhr.send below is called and the // response is in the cache. the promise api will ensure that to the app code the api is // always async xhr.onreadystatechange = function() { if (xhr.readyState == 4) { var responseHeaders = xhr.getAllResponseHeaders(); // TODO(vojta): remove once Firefox 21 gets released. // begin: workaround to overcome Firefox CORS http response headers bug // https://bugzilla.mozilla.org/show_bug.cgi?id=608735 // Firefox already patched in nightly. Should land in Firefox 21. // CORS "simple response headers" http://www.w3.org/TR/cors/ var value, simpleHeaders = ["Cache-Control", "Content-Language", "Content-Type", "Expires", "Last-Modified", "Pragma"]; if (!responseHeaders) { responseHeaders = ""; forEach(simpleHeaders, function (header) { var value = xhr.getResponseHeader(header); if (value) { responseHeaders += header + ": " + value + "\n"; } }); } // end of the workaround. // responseText is the old-school way of retrieving response (supported by IE8 & 9) // response and responseType properties were introduced in XHR Level2 spec (supported by IE10) completeRequest(callback, status || xhr.status, (xhr.responseType ? xhr.response : xhr.responseText), responseHeaders); } }; if (withCredentials) { xhr.withCredentials = true; } if (responseType) { xhr.responseType = responseType; } xhr.send(post || ''); } if (timeout > 0) { var timeoutId = $browserDefer(timeoutRequest, timeout); } else if (timeout && timeout.then) { timeout.then(timeoutRequest); } function timeoutRequest() { status = -1; jsonpDone && jsonpDone(); xhr && xhr.abort(); } function completeRequest(callback, status, response, headersString) { // URL_MATCH is defined in src/service/location.js var protocol = (url.match(SERVER_MATCH) || ['', locationProtocol])[1]; // cancel timeout and subsequent timeout promise resolution timeoutId && $browserDefer.cancel(timeoutId); jsonpDone = xhr = null; // fix status code for file protocol (it's always 0) status = (protocol == 'file') ? (response ? 200 : 404) : status; // normalize IE bug (http://bugs.jquery.com/ticket/1450) status = status == 1223 ? 204 : status; callback(status, response, headersString); $browser.$$completeOutstandingRequest(noop); } }; function jsonpReq(url, done) { // we can't use jQuery/jqLite here because jQuery does crazy shit with script elements, e.g.: // - fetches local scripts via XHR and evals them // - adds and immediately removes script elements from the document var script = rawDocument.createElement('script'), doneWrapper = function() { rawDocument.body.removeChild(script); if (done) done(); }; script.type = 'text/javascript'; script.src = url; if (msie) { script.onreadystatechange = function() { if (/loaded|complete/.test(script.readyState)) doneWrapper(); }; } else { script.onload = script.onerror = doneWrapper; } rawDocument.body.appendChild(script); return doneWrapper; } } /** * @ngdoc object * @name ng.$locale * * @description * $locale service provides localization rules for various Angular components. As of right now the * only public api is: * * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`) */ function $LocaleProvider(){ this.$get = function() { return { id: 'en-us', NUMBER_FORMATS: { DECIMAL_SEP: '.', GROUP_SEP: ',', PATTERNS: [ { // Decimal Pattern minInt: 1, minFrac: 0, maxFrac: 3, posPre: '', posSuf: '', negPre: '-', negSuf: '', gSize: 3, lgSize: 3 },{ //Currency Pattern minInt: 1, minFrac: 2, maxFrac: 2, posPre: '\u00A4', posSuf: '', negPre: '(\u00A4', negSuf: ')', gSize: 3, lgSize: 3 } ], CURRENCY_SYM: '$' }, DATETIME_FORMATS: { MONTH: 'January,February,March,April,May,June,July,August,September,October,November,December' .split(','), SHORTMONTH: 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','), DAY: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','), SHORTDAY: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(','), AMPMS: ['AM','PM'], medium: 'MMM d, y h:mm:ss a', short: 'M/d/yy h:mm a', fullDate: 'EEEE, MMMM d, y', longDate: 'MMMM d, y', mediumDate: 'MMM d, y', shortDate: 'M/d/yy', mediumTime: 'h:mm:ss a', shortTime: 'h:mm a' }, pluralCat: function(num) { if (num === 1) { return 'one'; } return 'other'; } }; }; } function $TimeoutProvider() { this.$get = ['$rootScope', '$browser', '$q', '$exceptionHandler', function($rootScope, $browser, $q, $exceptionHandler) { var deferreds = {}; /** * @ngdoc function * @name ng.$timeout * @requires $browser * * @description * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch * block and delegates any exceptions to * {@link ng.$exceptionHandler $exceptionHandler} service. * * The return value of registering a timeout function is a promise, which will be resolved when * the timeout is reached and the timeout function is executed. * * To cancel a timeout request, call `$timeout.cancel(promise)`. * * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to * synchronously flush the queue of deferred functions. * * @param {function()} fn A function, whose execution should be delayed. * @param {number=} [delay=0] Delay in milliseconds. * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block. * @returns {Promise} Promise that will be resolved when the timeout is reached. The value this * promise will be resolved with is the return value of the `fn` function. */ function timeout(fn, delay, invokeApply) { var deferred = $q.defer(), promise = deferred.promise, skipApply = (isDefined(invokeApply) && !invokeApply), timeoutId, cleanup; timeoutId = $browser.defer(function() { try { deferred.resolve(fn()); } catch(e) { deferred.reject(e); $exceptionHandler(e); } if (!skipApply) $rootScope.$apply(); }, delay); cleanup = function() { delete deferreds[promise.$$timeoutId]; }; promise.$$timeoutId = timeoutId; deferreds[timeoutId] = deferred; promise.then(cleanup, cleanup); return promise; } /** * @ngdoc function * @name ng.$timeout#cancel * @methodOf ng.$timeout * * @description * Cancels a task associated with the `promise`. As a result of this, the promise will be * resolved with a rejection. * * @param {Promise=} promise Promise returned by the `$timeout` function. * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully * canceled. */ timeout.cancel = function(promise) { if (promise && promise.$$timeoutId in deferreds) { deferreds[promise.$$timeoutId].reject('canceled'); return $browser.defer.cancel(promise.$$timeoutId); } return false; }; return timeout; }]; } /** * @ngdoc object * @name ng.$filterProvider * @description * * Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To * achieve this a filter definition consists of a factory function which is annotated with dependencies and is * responsible for creating a filter function. * * <pre> * // Filter registration * function MyModule($provide, $filterProvider) { * // create a service to demonstrate injection (not always needed) * $provide.value('greet', function(name){ * return 'Hello ' + name + '!'; * }); * * // register a filter factory which uses the * // greet service to demonstrate DI. * $filterProvider.register('greet', function(greet){ * // return the filter function which uses the greet service * // to generate salutation * return function(text) { * // filters need to be forgiving so check input validity * return text && greet(text) || text; * }; * }); * } * </pre> * * The filter function is registered with the `$injector` under the filter name suffixe with `Filter`. * <pre> * it('should be the same instance', inject( * function($filterProvider) { * $filterProvider.register('reverse', function(){ * return ...; * }); * }, * function($filter, reverseFilter) { * expect($filter('reverse')).toBe(reverseFilter); * }); * </pre> * * * For more information about how angular filters work, and how to create your own filters, see * {@link guide/dev_guide.templates.filters Understanding Angular Filters} in the angular Developer * Guide. */ /** * @ngdoc method * @name ng.$filterProvider#register * @methodOf ng.$filterProvider * @description * Register filter factory function. * * @param {String} name Name of the filter. * @param {function} fn The filter factory function which is injectable. */ /** * @ngdoc function * @name ng.$filter * @function * @description * Filters are used for formatting data displayed to the user. * * The general syntax in templates is as follows: * * {{ expression [| filter_name[:parameter_value] ... ] }} * * @param {String} name Name of the filter function to retrieve * @return {Function} the filter function */ $FilterProvider.$inject = ['$provide']; function $FilterProvider($provide) { var suffix = 'Filter'; function register(name, factory) { return $provide.factory(name + suffix, factory); } this.register = register; this.$get = ['$injector', function($injector) { return function(name) { return $injector.get(name + suffix); } }]; //////////////////////////////////////// register('currency', currencyFilter); register('date', dateFilter); register('filter', filterFilter); register('json', jsonFilter); register('limitTo', limitToFilter); register('lowercase', lowercaseFilter); register('number', numberFilter); register('orderBy', orderByFilter); register('uppercase', uppercaseFilter); } /** * @ngdoc filter * @name ng.filter:filter * @function * * @description * Selects a subset of items from `array` and returns it as a new array. * * Note: This function is used to augment the `Array` type in Angular expressions. See * {@link ng.$filter} for more information about Angular arrays. * * @param {Array} array The source array. * @param {string|Object|function()} expression The predicate to be used for selecting items from * `array`. * * Can be one of: * * - `string`: Predicate that results in a substring match using the value of `expression` * string. All strings or objects with string properties in `array` that contain this string * will be returned. The predicate can be negated by prefixing the string with `!`. * * - `Object`: A pattern object can be used to filter specific properties on objects contained * by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items * which have property `name` containing "M" and property `phone` containing "1". A special * property name `$` can be used (as in `{$:"text"}`) to accept a match against any * property of the object. That's equivalent to the simple substring match with a `string` * as described above. * * - `function`: A predicate function can be used to write arbitrary filters. The function is * called for each element of `array`. The final result is an array of those elements that * the predicate returned true for. * * @param {function(expected, actual)|true|undefined} comparator Comparator which is used in * determining if the expected value (from the filter expression) and actual value (from * the object in the array) should be considered a match. * * Can be one of: * * - `function(expected, actual)`: * The function will be given the object value and the predicate value to compare and * should return true if the item should be included in filtered result. * * - `true`: A shorthand for `function(expected, actual) { return angular.equals(expected, actual)}`. * this is essentially strict comparison of expected and actual. * * - `false|undefined`: A short hand for a function which will look for a substring match in case * insensitive way. * * @example <doc:example> <doc:source> <div ng-init="friends = [{name:'John', phone:'555-1276'}, {name:'Mary', phone:'800-BIG-MARY'}, {name:'Mike', phone:'555-4321'}, {name:'Adam', phone:'555-5678'}, {name:'Julie', phone:'555-8765'}, {name:'Juliette', phone:'555-5678'}]"></div> Search: <input ng-model="searchText"> <table id="searchTextResults"> <tr><th>Name</th><th>Phone</th></tr> <tr ng-repeat="friend in friends | filter:searchText"> <td>{{friend.name}}</td> <td>{{friend.phone}}</td> </tr> </table> <hr> Any: <input ng-model="search.$"> <br> Name only <input ng-model="search.name"><br> Phone only <input ng-model="search.phone"><br> Equality <input type="checkbox" ng-model="strict"><br> <table id="searchObjResults"> <tr><th>Name</th><th>Phone</th></tr> <tr ng-repeat="friend in friends | filter:search:strict"> <td>{{friend.name}}</td> <td>{{friend.phone}}</td> </tr> </table> </doc:source> <doc:scenario> it('should search across all fields when filtering with a string', function() { input('searchText').enter('m'); expect(repeater('#searchTextResults tr', 'friend in friends').column('friend.name')). toEqual(['Mary', 'Mike', 'Adam']); input('searchText').enter('76'); expect(repeater('#searchTextResults tr', 'friend in friends').column('friend.name')). toEqual(['John', 'Julie']); }); it('should search in specific fields when filtering with a predicate object', function() { input('search.$').enter('i'); expect(repeater('#searchObjResults tr', 'friend in friends').column('friend.name')). toEqual(['Mary', 'Mike', 'Julie', 'Juliette']); }); it('should use a equal comparison when comparator is true', function() { input('search.name').enter('Julie'); input('strict').check(); expect(repeater('#searchObjResults tr', 'friend in friends').column('friend.name')). toEqual(['Julie']); }); </doc:scenario> </doc:example> */ function filterFilter() { return function(array, expression, comperator) { if (!isArray(array)) return array; var predicates = []; predicates.check = function(value) { for (var j = 0; j < predicates.length; j++) { if(!predicates[j](value)) { return false; } } return true; }; switch(typeof comperator) { case "function": break; case "boolean": if(comperator == true) { comperator = function(obj, text) { return angular.equals(obj, text); } break; } default: comperator = function(obj, text) { text = (''+text).toLowerCase(); return (''+obj).toLowerCase().indexOf(text) > -1 }; } var search = function(obj, text){ if (typeof text == 'string' && text.charAt(0) === '!') { return !search(obj, text.substr(1)); } switch (typeof obj) { case "boolean": case "number": case "string": return comperator(obj, text); case "object": switch (typeof text) { case "object": return comperator(obj, text); break; default: for ( var objKey in obj) { if (objKey.charAt(0) !== '$' && search(obj[objKey], text)) { return true; } } break; } return false; case "array": for ( var i = 0; i < obj.length; i++) { if (search(obj[i], text)) { return true; } } return false; default: return false; } }; switch (typeof expression) { case "boolean": case "number": case "string": expression = {$:expression}; case "object": for (var key in expression) { if (key == '$') { (function() { if (!expression[key]) return; var path = key predicates.push(function(value) { return search(value, expression[path]); }); })(); } else { (function() { if (!expression[key]) return; var path = key; predicates.push(function(value) { return search(getter(value,path), expression[path]); }); })(); } } break; case 'function': predicates.push(expression); break; default: return array; } var filtered = []; for ( var j = 0; j < array.length; j++) { var value = array[j]; if (predicates.check(value)) { filtered.push(value); } } return filtered; } } /** * @ngdoc filter * @name ng.filter:currency * @function * * @description * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default * symbol for current locale is used. * * @param {number} amount Input to filter. * @param {string=} symbol Currency symbol or identifier to be displayed. * @returns {string} Formatted number. * * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.amount = 1234.56; } </script> <div ng-controller="Ctrl"> <input type="number" ng-model="amount"> <br> default currency symbol ($): {{amount | currency}}<br> custom currency identifier (USD$): {{amount | currency:"USD$"}} </div> </doc:source> <doc:scenario> it('should init with 1234.56', function() { expect(binding('amount | currency')).toBe('$1,234.56'); expect(binding('amount | currency:"USD$"')).toBe('USD$1,234.56'); }); it('should update', function() { input('amount').enter('-1234'); expect(binding('amount | currency')).toBe('($1,234.00)'); expect(binding('amount | currency:"USD$"')).toBe('(USD$1,234.00)'); }); </doc:scenario> </doc:example> */ currencyFilter.$inject = ['$locale']; function currencyFilter($locale) { var formats = $locale.NUMBER_FORMATS; return function(amount, currencySymbol){ if (isUndefined(currencySymbol)) currencySymbol = formats.CURRENCY_SYM; return formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, 2). replace(/\u00A4/g, currencySymbol); }; } /** * @ngdoc filter * @name ng.filter:number * @function * * @description * Formats a number as text. * * If the input is not a number an empty string is returned. * * @param {number|string} number Number to format. * @param {(number|string)=} [fractionSize=2] Number of decimal places to round the number to. * @returns {string} Number rounded to decimalPlaces and places a “,” after each third digit. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.val = 1234.56789; } </script> <div ng-controller="Ctrl"> Enter number: <input ng-model='val'><br> Default formatting: {{val | number}}<br> No fractions: {{val | number:0}}<br> Negative number: {{-val | number:4}} </div> </doc:source> <doc:scenario> it('should format numbers', function() { expect(binding('val | number')).toBe('1,234.568'); expect(binding('val | number:0')).toBe('1,235'); expect(binding('-val | number:4')).toBe('-1,234.5679'); }); it('should update', function() { input('val').enter('3374.333'); expect(binding('val | number')).toBe('3,374.333'); expect(binding('val | number:0')).toBe('3,374'); expect(binding('-val | number:4')).toBe('-3,374.3330'); }); </doc:scenario> </doc:example> */ numberFilter.$inject = ['$locale']; function numberFilter($locale) { var formats = $locale.NUMBER_FORMATS; return function(number, fractionSize) { return formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize); }; } var DECIMAL_SEP = '.'; function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) { if (isNaN(number) || !isFinite(number)) return ''; var isNegative = number < 0; number = Math.abs(number); var numStr = number + '', formatedText = '', parts = []; var hasExponent = false; if (numStr.indexOf('e') !== -1) { var match = numStr.match(/([\d\.]+)e(-?)(\d+)/); if (match && match[2] == '-' && match[3] > fractionSize + 1) { numStr = '0'; } else { formatedText = numStr; hasExponent = true; } } if (!hasExponent) { var fractionLen = (numStr.split(DECIMAL_SEP)[1] || '').length; // determine fractionSize if it is not specified if (isUndefined(fractionSize)) { fractionSize = Math.min(Math.max(pattern.minFrac, fractionLen), pattern.maxFrac); } var pow = Math.pow(10, fractionSize); number = Math.round(number * pow) / pow; var fraction = ('' + number).split(DECIMAL_SEP); var whole = fraction[0]; fraction = fraction[1] || ''; var pos = 0, lgroup = pattern.lgSize, group = pattern.gSize; if (whole.length >= (lgroup + group)) { pos = whole.length - lgroup; for (var i = 0; i < pos; i++) { if ((pos - i)%group === 0 && i !== 0) { formatedText += groupSep; } formatedText += whole.charAt(i); } } for (i = pos; i < whole.length; i++) { if ((whole.length - i)%lgroup === 0 && i !== 0) { formatedText += groupSep; } formatedText += whole.charAt(i); } // format fraction part. while(fraction.length < fractionSize) { fraction += '0'; } if (fractionSize && fractionSize !== "0") formatedText += decimalSep + fraction.substr(0, fractionSize); } parts.push(isNegative ? pattern.negPre : pattern.posPre); parts.push(formatedText); parts.push(isNegative ? pattern.negSuf : pattern.posSuf); return parts.join(''); } function padNumber(num, digits, trim) { var neg = ''; if (num < 0) { neg = '-'; num = -num; } num = '' + num; while(num.length < digits) num = '0' + num; if (trim) num = num.substr(num.length - digits); return neg + num; } function dateGetter(name, size, offset, trim) { offset = offset || 0; return function(date) { var value = date['get' + name](); if (offset > 0 || value > -offset) value += offset; if (value === 0 && offset == -12 ) value = 12; return padNumber(value, size, trim); }; } function dateStrGetter(name, shortForm) { return function(date, formats) { var value = date['get' + name](); var get = uppercase(shortForm ? ('SHORT' + name) : name); return formats[get][value]; }; } function timeZoneGetter(date) { var zone = -1 * date.getTimezoneOffset(); var paddedZone = (zone >= 0) ? "+" : ""; paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) + padNumber(Math.abs(zone % 60), 2); return paddedZone; } function ampmGetter(date, formats) { return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1]; } var DATE_FORMATS = { yyyy: dateGetter('FullYear', 4), yy: dateGetter('FullYear', 2, 0, true), y: dateGetter('FullYear', 1), MMMM: dateStrGetter('Month'), MMM: dateStrGetter('Month', true), MM: dateGetter('Month', 2, 1), M: dateGetter('Month', 1, 1), dd: dateGetter('Date', 2), d: dateGetter('Date', 1), HH: dateGetter('Hours', 2), H: dateGetter('Hours', 1), hh: dateGetter('Hours', 2, -12), h: dateGetter('Hours', 1, -12), mm: dateGetter('Minutes', 2), m: dateGetter('Minutes', 1), ss: dateGetter('Seconds', 2), s: dateGetter('Seconds', 1), // while ISO 8601 requires fractions to be prefixed with `.` or `,` // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions sss: dateGetter('Milliseconds', 3), EEEE: dateStrGetter('Day'), EEE: dateStrGetter('Day', true), a: ampmGetter, Z: timeZoneGetter }; var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/, NUMBER_STRING = /^\d+$/; /** * @ngdoc filter * @name ng.filter:date * @function * * @description * Formats `date` to a string based on the requested `format`. * * `format` string can be composed of the following elements: * * * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010) * * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10) * * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199) * * `'MMMM'`: Month in year (January-December) * * `'MMM'`: Month in year (Jan-Dec) * * `'MM'`: Month in year, padded (01-12) * * `'M'`: Month in year (1-12) * * `'dd'`: Day in month, padded (01-31) * * `'d'`: Day in month (1-31) * * `'EEEE'`: Day in Week,(Sunday-Saturday) * * `'EEE'`: Day in Week, (Sun-Sat) * * `'HH'`: Hour in day, padded (00-23) * * `'H'`: Hour in day (0-23) * * `'hh'`: Hour in am/pm, padded (01-12) * * `'h'`: Hour in am/pm, (1-12) * * `'mm'`: Minute in hour, padded (00-59) * * `'m'`: Minute in hour (0-59) * * `'ss'`: Second in minute, padded (00-59) * * `'s'`: Second in minute (0-59) * * `'.sss' or ',sss'`: Millisecond in second, padded (000-999) * * `'a'`: am/pm marker * * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200) * * `format` string can also be one of the following predefined * {@link guide/i18n localizable formats}: * * * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale * (e.g. Sep 3, 2010 12:05:08 pm) * * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US locale (e.g. 9/3/10 12:05 pm) * * `'fullDate'`: equivalent to `'EEEE, MMMM d,y'` for en_US locale * (e.g. Friday, September 3, 2010) * * `'longDate'`: equivalent to `'MMMM d, y'` for en_US locale (e.g. September 3, 2010 * * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US locale (e.g. Sep 3, 2010) * * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10) * * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 pm) * * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 pm) * * `format` string can contain literal values. These need to be quoted with single quotes (e.g. * `"h 'in the morning'"`). In order to output single quote, use two single quotes in a sequence * (e.g. `"h o''clock"`). * * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or * number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.SSSZ and its * shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is * specified in the string input, the time is considered to be in the local timezone. * @param {string=} format Formatting rules (see Description). If not specified, * `mediumDate` is used. * @returns {string} Formatted string or the input if input is not recognized as date/millis. * * @example <doc:example> <doc:source> <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>: {{1288323623006 | date:'medium'}}<br> <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>: {{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}<br> <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>: {{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}<br> </doc:source> <doc:scenario> it('should format date', function() { expect(binding("1288323623006 | date:'medium'")). toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/); expect(binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")). toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/); expect(binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")). toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/); }); </doc:scenario> </doc:example> */ dateFilter.$inject = ['$locale']; function dateFilter($locale) { var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; // 1 2 3 4 5 6 7 8 9 10 11 function jsonStringToDate(string) { var match; if (match = string.match(R_ISO8601_STR)) { var date = new Date(0), tzHour = 0, tzMin = 0, dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear, timeSetter = match[8] ? date.setUTCHours : date.setHours; if (match[9]) { tzHour = int(match[9] + match[10]); tzMin = int(match[9] + match[11]); } dateSetter.call(date, int(match[1]), int(match[2]) - 1, int(match[3])); var h = int(match[4]||0) - tzHour; var m = int(match[5]||0) - tzMin var s = int(match[6]||0); var ms = Math.round(parseFloat('0.' + (match[7]||0)) * 1000); timeSetter.call(date, h, m, s, ms); return date; } return string; } return function(date, format) { var text = '', parts = [], fn, match; format = format || 'mediumDate'; format = $locale.DATETIME_FORMATS[format] || format; if (isString(date)) { if (NUMBER_STRING.test(date)) { date = int(date); } else { date = jsonStringToDate(date); } } if (isNumber(date)) { date = new Date(date); } if (!isDate(date)) { return date; } while(format) { match = DATE_FORMATS_SPLIT.exec(format); if (match) { parts = concat(parts, match, 1); format = parts.pop(); } else { parts.push(format); format = null; } } forEach(parts, function(value){ fn = DATE_FORMATS[value]; text += fn ? fn(date, $locale.DATETIME_FORMATS) : value.replace(/(^'|'$)/g, '').replace(/''/g, "'"); }); return text; }; } /** * @ngdoc filter * @name ng.filter:json * @function * * @description * Allows you to convert a JavaScript object into JSON string. * * This filter is mostly useful for debugging. When using the double curly {{value}} notation * the binding is automatically converted to JSON. * * @param {*} object Any JavaScript object (including arrays and primitive types) to filter. * @returns {string} JSON string. * * * @example: <doc:example> <doc:source> <pre>{{ {'name':'value'} | json }}</pre> </doc:source> <doc:scenario> it('should jsonify filtered objects', function() { expect(binding("{'name':'value'}")).toMatch(/\{\n "name": ?"value"\n}/); }); </doc:scenario> </doc:example> * */ function jsonFilter() { return function(object) { return toJson(object, true); }; } /** * @ngdoc filter * @name ng.filter:lowercase * @function * @description * Converts string to lowercase. * @see angular.lowercase */ var lowercaseFilter = valueFn(lowercase); /** * @ngdoc filter * @name ng.filter:uppercase * @function * @description * Converts string to uppercase. * @see angular.uppercase */ var uppercaseFilter = valueFn(uppercase); /** * @ngdoc function * @name ng.filter:limitTo * @function * * @description * Creates a new array or string containing only a specified number of elements. The elements * are taken from either the beginning or the end of the source array or string, as specified by * the value and sign (positive or negative) of `limit`. * * Note: This function is used to augment the `Array` type in Angular expressions. See * {@link ng.$filter} for more information about Angular arrays. * * @param {Array|string} input Source array or string to be limited. * @param {string|number} limit The length of the returned array or string. If the `limit` number * is positive, `limit` number of items from the beginning of the source array/string are copied. * If the number is negative, `limit` number of items from the end of the source array/string * are copied. The `limit` will be trimmed if it exceeds `array.length` * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array * had less than `limit` elements. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.numbers = [1,2,3,4,5,6,7,8,9]; $scope.letters = "abcdefghi"; $scope.numLimit = 3; $scope.letterLimit = 3; } </script> <div ng-controller="Ctrl"> Limit {{numbers}} to: <input type="integer" ng-model="numLimit"> <p>Output numbers: {{ numbers | limitTo:numLimit }}</p> Limit {{letters}} to: <input type="integer" ng-model="letterLimit"> <p>Output letters: {{ letters | limitTo:letterLimit }}</p> </div> </doc:source> <doc:scenario> it('should limit the number array to first three items', function() { expect(element('.doc-example-live input[ng-model=numLimit]').val()).toBe('3'); expect(element('.doc-example-live input[ng-model=letterLimit]').val()).toBe('3'); expect(binding('numbers | limitTo:numLimit')).toEqual('[1,2,3]'); expect(binding('letters | limitTo:letterLimit')).toEqual('abc'); }); it('should update the output when -3 is entered', function() { input('numLimit').enter(-3); input('letterLimit').enter(-3); expect(binding('numbers | limitTo:numLimit')).toEqual('[7,8,9]'); expect(binding('letters | limitTo:letterLimit')).toEqual('ghi'); }); it('should not exceed the maximum size of input array', function() { input('numLimit').enter(100); input('letterLimit').enter(100); expect(binding('numbers | limitTo:numLimit')).toEqual('[1,2,3,4,5,6,7,8,9]'); expect(binding('letters | limitTo:letterLimit')).toEqual('abcdefghi'); }); </doc:scenario> </doc:example> */ function limitToFilter(){ return function(input, limit) { if (!isArray(input) && !isString(input)) return input; limit = int(limit); if (isString(input)) { //NaN check on limit if (limit) { return limit >= 0 ? input.slice(0, limit) : input.slice(limit, input.length); } else { return ""; } } var out = [], i, n; // if abs(limit) exceeds maximum length, trim it if (limit > input.length) limit = input.length; else if (limit < -input.length) limit = -input.length; if (limit > 0) { i = 0; n = limit; } else { i = input.length + limit; n = input.length; } for (; i<n; i++) { out.push(input[i]); } return out; } } /** * @ngdoc function * @name ng.filter:orderBy * @function * * @description * Orders a specified `array` by the `expression` predicate. * * Note: this function is used to augment the `Array` type in Angular expressions. See * {@link ng.$filter} for more information about Angular arrays. * * @param {Array} array The array to sort. * @param {function(*)|string|Array.<(function(*)|string)>} expression A predicate to be * used by the comparator to determine the order of elements. * * Can be one of: * * - `function`: Getter function. The result of this function will be sorted using the * `<`, `=`, `>` operator. * - `string`: An Angular expression which evaluates to an object to order by, such as 'name' * to sort by a property called 'name'. Optionally prefixed with `+` or `-` to control * ascending or descending sort order (for example, +name or -name). * - `Array`: An array of function or string predicates. The first predicate in the array * is used for sorting, but when two items are equivalent, the next predicate is used. * * @param {boolean=} reverse Reverse the order the array. * @returns {Array} Sorted copy of the source array. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.friends = [{name:'John', phone:'555-1212', age:10}, {name:'Mary', phone:'555-9876', age:19}, {name:'Mike', phone:'555-4321', age:21}, {name:'Adam', phone:'555-5678', age:35}, {name:'Julie', phone:'555-8765', age:29}] $scope.predicate = '-age'; } </script> <div ng-controller="Ctrl"> <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre> <hr/> [ <a href="" ng-click="predicate=''">unsorted</a> ] <table class="friend"> <tr> <th><a href="" ng-click="predicate = 'name'; reverse=false">Name</a> (<a href ng-click="predicate = '-name'; reverse=false">^</a>)</th> <th><a href="" ng-click="predicate = 'phone'; reverse=!reverse">Phone Number</a></th> <th><a href="" ng-click="predicate = 'age'; reverse=!reverse">Age</a></th> </tr> <tr ng-repeat="friend in friends | orderBy:predicate:reverse"> <td>{{friend.name}}</td> <td>{{friend.phone}}</td> <td>{{friend.age}}</td> </tr> </table> </div> </doc:source> <doc:scenario> it('should be reverse ordered by aged', function() { expect(binding('predicate')).toBe('-age'); expect(repeater('table.friend', 'friend in friends').column('friend.age')). toEqual(['35', '29', '21', '19', '10']); expect(repeater('table.friend', 'friend in friends').column('friend.name')). toEqual(['Adam', 'Julie', 'Mike', 'Mary', 'John']); }); it('should reorder the table when user selects different predicate', function() { element('.doc-example-live a:contains("Name")').click(); expect(repeater('table.friend', 'friend in friends').column('friend.name')). toEqual(['Adam', 'John', 'Julie', 'Mary', 'Mike']); expect(repeater('table.friend', 'friend in friends').column('friend.age')). toEqual(['35', '10', '29', '19', '21']); element('.doc-example-live a:contains("Phone")').click(); expect(repeater('table.friend', 'friend in friends').column('friend.phone')). toEqual(['555-9876', '555-8765', '555-5678', '555-4321', '555-1212']); expect(repeater('table.friend', 'friend in friends').column('friend.name')). toEqual(['Mary', 'Julie', 'Adam', 'Mike', 'John']); }); </doc:scenario> </doc:example> */ orderByFilter.$inject = ['$parse']; function orderByFilter($parse){ return function(array, sortPredicate, reverseOrder) { if (!isArray(array)) return array; if (!sortPredicate) return array; sortPredicate = isArray(sortPredicate) ? sortPredicate: [sortPredicate]; sortPredicate = map(sortPredicate, function(predicate){ var descending = false, get = predicate || identity; if (isString(predicate)) { if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) { descending = predicate.charAt(0) == '-'; predicate = predicate.substring(1); } get = $parse(predicate); } return reverseComparator(function(a,b){ return compare(get(a),get(b)); }, descending); }); var arrayCopy = []; for ( var i = 0; i < array.length; i++) { arrayCopy.push(array[i]); } return arrayCopy.sort(reverseComparator(comparator, reverseOrder)); function comparator(o1, o2){ for ( var i = 0; i < sortPredicate.length; i++) { var comp = sortPredicate[i](o1, o2); if (comp !== 0) return comp; } return 0; } function reverseComparator(comp, descending) { return toBoolean(descending) ? function(a,b){return comp(b,a);} : comp; } function compare(v1, v2){ var t1 = typeof v1; var t2 = typeof v2; if (t1 == t2) { if (t1 == "string") v1 = v1.toLowerCase(); if (t1 == "string") v2 = v2.toLowerCase(); if (v1 === v2) return 0; return v1 < v2 ? -1 : 1; } else { return t1 < t2 ? -1 : 1; } } } } function ngDirective(directive) { if (isFunction(directive)) { directive = { link: directive } } directive.restrict = directive.restrict || 'AC'; return valueFn(directive); } /** * @ngdoc directive * @name ng.directive:a * @restrict E * * @description * Modifies the default behavior of html A tag, so that the default action is prevented when href * attribute is empty. * * The reasoning for this change is to allow easy creation of action links with `ngClick` directive * without changing the location or causing page reloads, e.g.: * `<a href="" ng-click="model.$save()">Save</a>` */ var htmlAnchorDirective = valueFn({ restrict: 'E', compile: function(element, attr) { if (msie <= 8) { // turn <a href ng-click="..">link</a> into a stylable link in IE // but only if it doesn't have name attribute, in which case it's an anchor if (!attr.href && !attr.name) { attr.$set('href', ''); } // add a comment node to anchors to workaround IE bug that causes element content to be reset // to new attribute content if attribute is updated with value containing @ and element also // contains value with @ // see issue #1949 element.append(document.createComment('IE fix')); } return function(scope, element) { element.bind('click', function(event){ // if we have no href url, then don't navigate anywhere. if (!element.attr('href')) { event.preventDefault(); } }); } } }); /** * @ngdoc directive * @name ng.directive:ngHref * @restrict A * * @description * Using Angular markup like {{hash}} in an href attribute makes * the page open to a wrong URL, if the user clicks that link before * angular has a chance to replace the {{hash}} with actual URL, the * link will be broken and will most likely return a 404 error. * The `ngHref` directive solves this problem. * * The buggy way to write it: * <pre> * <a href="http://www.gravatar.com/avatar/{{hash}}"/> * </pre> * * The correct way to write it: * <pre> * <a ng-href="http://www.gravatar.com/avatar/{{hash}}"/> * </pre> * * @element A * @param {template} ngHref any string which can contain `{{}}` markup. * * @example * This example uses `link` variable inside `href` attribute: <doc:example> <doc:source> <input ng-model="value" /><br /> <a id="link-1" href ng-click="value = 1">link 1</a> (link, don't reload)<br /> <a id="link-2" href="" ng-click="value = 2">link 2</a> (link, don't reload)<br /> <a id="link-3" ng-href="/{{'123'}}">link 3</a> (link, reload!)<br /> <a id="link-4" href="" name="xx" ng-click="value = 4">anchor</a> (link, don't reload)<br /> <a id="link-5" name="xxx" ng-click="value = 5">anchor</a> (no link)<br /> <a id="link-6" ng-href="{{value}}">link</a> (link, change location) </doc:source> <doc:scenario> it('should execute ng-click but not reload when href without value', function() { element('#link-1').click(); expect(input('value').val()).toEqual('1'); expect(element('#link-1').attr('href')).toBe(""); }); it('should execute ng-click but not reload when href empty string', function() { element('#link-2').click(); expect(input('value').val()).toEqual('2'); expect(element('#link-2').attr('href')).toBe(""); }); it('should execute ng-click and change url when ng-href specified', function() { expect(element('#link-3').attr('href')).toBe("/123"); element('#link-3').click(); expect(browser().window().path()).toEqual('/123'); }); it('should execute ng-click but not reload when href empty string and name specified', function() { element('#link-4').click(); expect(input('value').val()).toEqual('4'); expect(element('#link-4').attr('href')).toBe(''); }); it('should execute ng-click but not reload when no href but name specified', function() { element('#link-5').click(); expect(input('value').val()).toEqual('5'); expect(element('#link-5').attr('href')).toBe(undefined); }); it('should only change url when only ng-href', function() { input('value').enter('6'); expect(element('#link-6').attr('href')).toBe('6'); element('#link-6').click(); expect(browser().location().url()).toEqual('/6'); }); </doc:scenario> </doc:example> */ /** * @ngdoc directive * @name ng.directive:ngSrc * @restrict A * * @description * Using Angular markup like `{{hash}}` in a `src` attribute doesn't * work right: The browser will fetch from the URL with the literal * text `{{hash}}` until Angular replaces the expression inside * `{{hash}}`. The `ngSrc` directive solves this problem. * * The buggy way to write it: * <pre> * <img src="http://www.gravatar.com/avatar/{{hash}}"/> * </pre> * * The correct way to write it: * <pre> * <img ng-src="http://www.gravatar.com/avatar/{{hash}}"/> * </pre> * * @element IMG * @param {template} ngSrc any string which can contain `{{}}` markup. */ /** * @ngdoc directive * @name ng.directive:ngSrcset * @restrict A * * @description * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't * work right: The browser will fetch from the URL with the literal * text `{{hash}}` until Angular replaces the expression inside * `{{hash}}`. The `ngSrcset` directive solves this problem. * * The buggy way to write it: * <pre> * <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x"/> * </pre> * * The correct way to write it: * <pre> * <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x"/> * </pre> * * @element IMG * @param {template} ngSrcset any string which can contain `{{}}` markup. */ /** * @ngdoc directive * @name ng.directive:ngDisabled * @restrict A * * @description * * The following markup will make the button enabled on Chrome/Firefox but not on IE8 and older IEs: * <pre> * <div ng-init="scope = { isDisabled: false }"> * <button disabled="{{scope.isDisabled}}">Disabled</button> * </div> * </pre> * * The HTML specs do not require browsers to preserve the special attributes such as disabled. * (The presence of them means true and absence means false) * This prevents the angular compiler from correctly retrieving the binding expression. * To solve this problem, we introduce the `ngDisabled` directive. * * @example <doc:example> <doc:source> Click me to toggle: <input type="checkbox" ng-model="checked"><br/> <button ng-model="button" ng-disabled="checked">Button</button> </doc:source> <doc:scenario> it('should toggle button', function() { expect(element('.doc-example-live :button').prop('disabled')).toBeFalsy(); input('checked').check(); expect(element('.doc-example-live :button').prop('disabled')).toBeTruthy(); }); </doc:scenario> </doc:example> * * @element INPUT * @param {expression} ngDisabled Angular expression that will be evaluated. */ /** * @ngdoc directive * @name ng.directive:ngChecked * @restrict A * * @description * The HTML specs do not require browsers to preserve the special attributes such as checked. * (The presence of them means true and absence means false) * This prevents the angular compiler from correctly retrieving the binding expression. * To solve this problem, we introduce the `ngChecked` directive. * @example <doc:example> <doc:source> Check me to check both: <input type="checkbox" ng-model="master"><br/> <input id="checkSlave" type="checkbox" ng-checked="master"> </doc:source> <doc:scenario> it('should check both checkBoxes', function() { expect(element('.doc-example-live #checkSlave').prop('checked')).toBeFalsy(); input('master').check(); expect(element('.doc-example-live #checkSlave').prop('checked')).toBeTruthy(); }); </doc:scenario> </doc:example> * * @element INPUT * @param {expression} ngChecked Angular expression that will be evaluated. */ /** * @ngdoc directive * @name ng.directive:ngMultiple * @restrict A * * @description * The HTML specs do not require browsers to preserve the special attributes such as multiple. * (The presence of them means true and absence means false) * This prevents the angular compiler from correctly retrieving the binding expression. * To solve this problem, we introduce the `ngMultiple` directive. * * @example <doc:example> <doc:source> Check me check multiple: <input type="checkbox" ng-model="checked"><br/> <select id="select" ng-multiple="checked"> <option>Misko</option> <option>Igor</option> <option>Vojta</option> <option>Di</option> </select> </doc:source> <doc:scenario> it('should toggle multiple', function() { expect(element('.doc-example-live #select').prop('multiple')).toBeFalsy(); input('checked').check(); expect(element('.doc-example-live #select').prop('multiple')).toBeTruthy(); }); </doc:scenario> </doc:example> * * @element SELECT * @param {expression} ngMultiple Angular expression that will be evaluated. */ /** * @ngdoc directive * @name ng.directive:ngReadonly * @restrict A * * @description * The HTML specs do not require browsers to preserve the special attributes such as readonly. * (The presence of them means true and absence means false) * This prevents the angular compiler from correctly retrieving the binding expression. * To solve this problem, we introduce the `ngReadonly` directive. * @example <doc:example> <doc:source> Check me to make text readonly: <input type="checkbox" ng-model="checked"><br/> <input type="text" ng-readonly="checked" value="I'm Angular"/> </doc:source> <doc:scenario> it('should toggle readonly attr', function() { expect(element('.doc-example-live :text').prop('readonly')).toBeFalsy(); input('checked').check(); expect(element('.doc-example-live :text').prop('readonly')).toBeTruthy(); }); </doc:scenario> </doc:example> * * @element INPUT * @param {string} expression Angular expression that will be evaluated. */ /** * @ngdoc directive * @name ng.directive:ngSelected * @restrict A * * @description * The HTML specs do not require browsers to preserve the special attributes such as selected. * (The presence of them means true and absence means false) * This prevents the angular compiler from correctly retrieving the binding expression. * To solve this problem, we introduced the `ngSelected` directive. * @example <doc:example> <doc:source> Check me to select: <input type="checkbox" ng-model="selected"><br/> <select> <option>Hello!</option> <option id="greet" ng-selected="selected">Greetings!</option> </select> </doc:source> <doc:scenario> it('should select Greetings!', function() { expect(element('.doc-example-live #greet').prop('selected')).toBeFalsy(); input('selected').check(); expect(element('.doc-example-live #greet').prop('selected')).toBeTruthy(); }); </doc:scenario> </doc:example> * * @element OPTION * @param {string} expression Angular expression that will be evaluated. */ /** * @ngdoc directive * @name ng.directive:ngOpen * @restrict A * * @description * The HTML specs do not require browsers to preserve the special attributes such as open. * (The presence of them means true and absence means false) * This prevents the angular compiler from correctly retrieving the binding expression. * To solve this problem, we introduce the `ngOpen` directive. * * @example <doc:example> <doc:source> Check me check multiple: <input type="checkbox" ng-model="open"><br/> <details id="details" ng-open="open"> <summary>Show/Hide me</summary> </details> </doc:source> <doc:scenario> it('should toggle open', function() { expect(element('#details').prop('open')).toBeFalsy(); input('open').check(); expect(element('#details').prop('open')).toBeTruthy(); }); </doc:scenario> </doc:example> * * @element DETAILS * @param {string} expression Angular expression that will be evaluated. */ var ngAttributeAliasDirectives = {}; // boolean attrs are evaluated forEach(BOOLEAN_ATTR, function(propName, attrName) { var normalized = directiveNormalize('ng-' + attrName); ngAttributeAliasDirectives[normalized] = function() { return { priority: 100, compile: function() { return function(scope, element, attr) { scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) { attr.$set(attrName, !!value); }); }; } }; }; }); // ng-src, ng-srcset, ng-href are interpolated forEach(['src', 'srcset', 'href'], function(attrName) { var normalized = directiveNormalize('ng-' + attrName); ngAttributeAliasDirectives[normalized] = function() { return { priority: 99, // it needs to run after the attributes are interpolated link: function(scope, element, attr) { attr.$observe(normalized, function(value) { if (!value) return; attr.$set(attrName, value); // on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need // to set the property as well to achieve the desired effect. // we use attr[attrName] value since $set can sanitize the url. if (msie) element.prop(attrName, attr[attrName]); }); } }; }; }); var nullFormCtrl = { $addControl: noop, $removeControl: noop, $setValidity: noop, $setDirty: noop, $setPristine: noop }; /** * @ngdoc object * @name ng.directive:form.FormController * * @property {boolean} $pristine True if user has not interacted with the form yet. * @property {boolean} $dirty True if user has already interacted with the form. * @property {boolean} $valid True if all of the containing forms and controls are valid. * @property {boolean} $invalid True if at least one containing control or form is invalid. * * @property {Object} $error Is an object hash, containing references to all invalid controls or * forms, where: * * - keys are validation tokens (error names) — such as `required`, `url` or `email`), * - values are arrays of controls or forms that are invalid with given error. * * @description * `FormController` keeps track of all its controls and nested forms as well as state of them, * such as being valid/invalid or dirty/pristine. * * Each {@link ng.directive:form form} directive creates an instance * of `FormController`. * */ //asks for $scope to fool the BC controller module FormController.$inject = ['$element', '$attrs', '$scope']; function FormController(element, attrs) { var form = this, parentForm = element.parent().controller('form') || nullFormCtrl, invalidCount = 0, // used to easily determine if we are valid errors = form.$error = {}, controls = []; // init state form.$name = attrs.name; form.$dirty = false; form.$pristine = true; form.$valid = true; form.$invalid = false; parentForm.$addControl(form); // Setup initial state of the control element.addClass(PRISTINE_CLASS); toggleValidCss(true); // convenience method for easy toggling of classes function toggleValidCss(isValid, validationErrorKey) { validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : ''; element. removeClass((isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey). addClass((isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey); } form.$addControl = function(control) { controls.push(control); if (control.$name && !form.hasOwnProperty(control.$name)) { form[control.$name] = control; } }; form.$removeControl = function(control) { if (control.$name && form[control.$name] === control) { delete form[control.$name]; } forEach(errors, function(queue, validationToken) { form.$setValidity(validationToken, true, control); }); arrayRemove(controls, control); }; form.$setValidity = function(validationToken, isValid, control) { var queue = errors[validationToken]; if (isValid) { if (queue) { arrayRemove(queue, control); if (!queue.length) { invalidCount--; if (!invalidCount) { toggleValidCss(isValid); form.$valid = true; form.$invalid = false; } errors[validationToken] = false; toggleValidCss(true, validationToken); parentForm.$setValidity(validationToken, true, form); } } } else { if (!invalidCount) { toggleValidCss(isValid); } if (queue) { if (includes(queue, control)) return; } else { errors[validationToken] = queue = []; invalidCount++; toggleValidCss(false, validationToken); parentForm.$setValidity(validationToken, false, form); } queue.push(control); form.$valid = false; form.$invalid = true; } }; form.$setDirty = function() { element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS); form.$dirty = true; form.$pristine = false; parentForm.$setDirty(); }; /** * @ngdoc function * @name ng.directive:form.FormController#$setPristine * @methodOf ng.directive:form.FormController * * @description * Sets the form to its pristine state. * * This method can be called to remove the 'ng-dirty' class and set the form to its pristine * state (ng-pristine class). This method will also propagate to all the controls contained * in this form. * * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after * saving or resetting it. */ form.$setPristine = function () { element.removeClass(DIRTY_CLASS).addClass(PRISTINE_CLASS); form.$dirty = false; form.$pristine = true; forEach(controls, function(control) { control.$setPristine(); }); }; } /** * @ngdoc directive * @name ng.directive:ngForm * @restrict EAC * * @description * Nestable alias of {@link ng.directive:form `form`} directive. HTML * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a * sub-group of controls needs to be determined. * * @param {string=} name|ngForm Name of the form. If specified, the form controller will be published into * related scope, under this name. * */ /** * @ngdoc directive * @name ng.directive:form * @restrict E * * @description * Directive that instantiates * {@link ng.directive:form.FormController FormController}. * * If `name` attribute is specified, the form controller is published onto the current scope under * this name. * * # Alias: {@link ng.directive:ngForm `ngForm`} * * In angular forms can be nested. This means that the outer form is valid when all of the child * forms are valid as well. However browsers do not allow nesting of `<form>` elements, for this * reason angular provides {@link ng.directive:ngForm `ngForm`} alias * which behaves identical to `<form>` but allows form nesting. * * * # CSS classes * - `ng-valid` Is set if the form is valid. * - `ng-invalid` Is set if the form is invalid. * - `ng-pristine` Is set if the form is pristine. * - `ng-dirty` Is set if the form is dirty. * * * # Submitting a form and preventing default action * * Since the role of forms in client-side Angular applications is different than in classical * roundtrip apps, it is desirable for the browser not to translate the form submission into a full * page reload that sends the data to the server. Instead some javascript logic should be triggered * to handle the form submission in application specific way. * * For this reason, Angular prevents the default action (form submission to the server) unless the * `<form>` element has an `action` attribute specified. * * You can use one of the following two ways to specify what javascript method should be called when * a form is submitted: * * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element * - {@link ng.directive:ngClick ngClick} directive on the first * button or input field of type submit (input[type=submit]) * * To prevent double execution of the handler, use only one of ngSubmit or ngClick directives. This * is because of the following form submission rules coming from the html spec: * * - If a form has only one input field then hitting enter in this field triggers form submit * (`ngSubmit`) * - if a form has has 2+ input fields and no buttons or input[type=submit] then hitting enter * doesn't trigger submit * - if a form has one or more input fields and one or more buttons or input[type=submit] then * hitting enter in any of the input fields will trigger the click handler on the *first* button or * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`) * * @param {string=} name Name of the form. If specified, the form controller will be published into * related scope, under this name. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.userType = 'guest'; } </script> <form name="myForm" ng-controller="Ctrl"> userType: <input name="input" ng-model="userType" required> <span class="error" ng-show="myForm.input.$error.required">Required!</span><br> <tt>userType = {{userType}}</tt><br> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br> <tt>myForm.$valid = {{myForm.$valid}}</tt><br> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br> </form> </doc:source> <doc:scenario> it('should initialize to model', function() { expect(binding('userType')).toEqual('guest'); expect(binding('myForm.input.$valid')).toEqual('true'); }); it('should be invalid if empty', function() { input('userType').enter(''); expect(binding('userType')).toEqual(''); expect(binding('myForm.input.$valid')).toEqual('false'); }); </doc:scenario> </doc:example> */ var formDirectiveFactory = function(isNgForm) { return ['$timeout', function($timeout) { var formDirective = { name: 'form', restrict: 'E', controller: FormController, compile: function() { return { pre: function(scope, formElement, attr, controller) { if (!attr.action) { // we can't use jq events because if a form is destroyed during submission the default // action is not prevented. see #1238 // // IE 9 is not affected because it doesn't fire a submit event and try to do a full // page reload if the form was destroyed by submission of the form via a click handler // on a button in the form. Looks like an IE9 specific bug. var preventDefaultListener = function(event) { event.preventDefault ? event.preventDefault() : event.returnValue = false; // IE }; addEventListenerFn(formElement[0], 'submit', preventDefaultListener); // unregister the preventDefault listener so that we don't not leak memory but in a // way that will achieve the prevention of the default action. formElement.bind('$destroy', function() { $timeout(function() { removeEventListenerFn(formElement[0], 'submit', preventDefaultListener); }, 0, false); }); } var parentFormCtrl = formElement.parent().controller('form'), alias = attr.name || attr.ngForm; if (alias) { scope[alias] = controller; } if (parentFormCtrl) { formElement.bind('$destroy', function() { parentFormCtrl.$removeControl(controller); if (alias) { scope[alias] = undefined; } extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards }); } } }; } }; return isNgForm ? extend(copy(formDirective), {restrict: 'EAC'}) : formDirective; }]; }; var formDirective = formDirectiveFactory(); var ngFormDirective = formDirectiveFactory(true); var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/; var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/; var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/; var inputType = { /** * @ngdoc inputType * @name ng.directive:input.text * * @description * Standard HTML text input with angular data binding. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} required Adds `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than * minlength. * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than * maxlength. * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for * patterns defined as scope expressions. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trimming the * input. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.text = 'guest'; $scope.word = /^\s*\w*\s*$/; } </script> <form name="myForm" ng-controller="Ctrl"> Single word: <input type="text" name="input" ng-model="text" ng-pattern="word" required ng-trim="false"> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.pattern"> Single word only!</span> <tt>text = {{text}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> </form> </doc:source> <doc:scenario> it('should initialize to model', function() { expect(binding('text')).toEqual('guest'); expect(binding('myForm.input.$valid')).toEqual('true'); }); it('should be invalid if empty', function() { input('text').enter(''); expect(binding('text')).toEqual(''); expect(binding('myForm.input.$valid')).toEqual('false'); }); it('should be invalid if multi word', function() { input('text').enter('hello world'); expect(binding('myForm.input.$valid')).toEqual('false'); }); it('should not be trimmed', function() { input('text').enter('untrimmed '); expect(binding('text')).toEqual('untrimmed '); expect(binding('myForm.input.$valid')).toEqual('true'); }); </doc:scenario> </doc:example> */ 'text': textInputType, /** * @ngdoc inputType * @name ng.directive:input.number * * @description * Text input with number validation and transformation. Sets the `number` validation * error if not a valid number. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than * minlength. * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than * maxlength. * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for * patterns defined as scope expressions. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.value = 12; } </script> <form name="myForm" ng-controller="Ctrl"> Number: <input type="number" name="input" ng-model="value" min="0" max="99" required> <span class="error" ng-show="myForm.list.$error.required"> Required!</span> <span class="error" ng-show="myForm.list.$error.number"> Not valid number!</span> <tt>value = {{value}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> </form> </doc:source> <doc:scenario> it('should initialize to model', function() { expect(binding('value')).toEqual('12'); expect(binding('myForm.input.$valid')).toEqual('true'); }); it('should be invalid if empty', function() { input('value').enter(''); expect(binding('value')).toEqual(''); expect(binding('myForm.input.$valid')).toEqual('false'); }); it('should be invalid if over max', function() { input('value').enter('123'); expect(binding('value')).toEqual(''); expect(binding('myForm.input.$valid')).toEqual('false'); }); </doc:scenario> </doc:example> */ 'number': numberInputType, /** * @ngdoc inputType * @name ng.directive:input.url * * @description * Text input with URL validation. Sets the `url` validation error key if the content is not a * valid URL. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than * minlength. * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than * maxlength. * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for * patterns defined as scope expressions. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.text = 'http://google.com'; } </script> <form name="myForm" ng-controller="Ctrl"> URL: <input type="url" name="input" ng-model="text" required> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.url"> Not valid url!</span> <tt>text = {{text}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/> </form> </doc:source> <doc:scenario> it('should initialize to model', function() { expect(binding('text')).toEqual('http://google.com'); expect(binding('myForm.input.$valid')).toEqual('true'); }); it('should be invalid if empty', function() { input('text').enter(''); expect(binding('text')).toEqual(''); expect(binding('myForm.input.$valid')).toEqual('false'); }); it('should be invalid if not url', function() { input('text').enter('xxx'); expect(binding('myForm.input.$valid')).toEqual('false'); }); </doc:scenario> </doc:example> */ 'url': urlInputType, /** * @ngdoc inputType * @name ng.directive:input.email * * @description * Text input with email validation. Sets the `email` validation error key if not a valid email * address. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than * minlength. * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than * maxlength. * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for * patterns defined as scope expressions. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.text = '[email protected]'; } </script> <form name="myForm" ng-controller="Ctrl"> Email: <input type="email" name="input" ng-model="text" required> <span class="error" ng-show="myForm.input.$error.required"> Required!</span> <span class="error" ng-show="myForm.input.$error.email"> Not valid email!</span> <tt>text = {{text}}</tt><br/> <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/> <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/> </form> </doc:source> <doc:scenario> it('should initialize to model', function() { expect(binding('text')).toEqual('[email protected]'); expect(binding('myForm.input.$valid')).toEqual('true'); }); it('should be invalid if empty', function() { input('text').enter(''); expect(binding('text')).toEqual(''); expect(binding('myForm.input.$valid')).toEqual('false'); }); it('should be invalid if not email', function() { input('text').enter('xxx'); expect(binding('myForm.input.$valid')).toEqual('false'); }); </doc:scenario> </doc:example> */ 'email': emailInputType, /** * @ngdoc inputType * @name ng.directive:input.radio * * @description * HTML radio button. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string} value The value to which the expression should be set when selected. * @param {string=} name Property name of the form under which the control is published. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.color = 'blue'; } </script> <form name="myForm" ng-controller="Ctrl"> <input type="radio" ng-model="color" value="red"> Red <br/> <input type="radio" ng-model="color" value="green"> Green <br/> <input type="radio" ng-model="color" value="blue"> Blue <br/> <tt>color = {{color}}</tt><br/> </form> </doc:source> <doc:scenario> it('should change state', function() { expect(binding('color')).toEqual('blue'); input('color').select('red'); expect(binding('color')).toEqual('red'); }); </doc:scenario> </doc:example> */ 'radio': radioInputType, /** * @ngdoc inputType * @name ng.directive:input.checkbox * * @description * HTML checkbox. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} ngTrueValue The value to which the expression should be set when selected. * @param {string=} ngFalseValue The value to which the expression should be set when not selected. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.value1 = true; $scope.value2 = 'YES' } </script> <form name="myForm" ng-controller="Ctrl"> Value1: <input type="checkbox" ng-model="value1"> <br/> Value2: <input type="checkbox" ng-model="value2" ng-true-value="YES" ng-false-value="NO"> <br/> <tt>value1 = {{value1}}</tt><br/> <tt>value2 = {{value2}}</tt><br/> </form> </doc:source> <doc:scenario> it('should change state', function() { expect(binding('value1')).toEqual('true'); expect(binding('value2')).toEqual('YES'); input('value1').check(); input('value2').check(); expect(binding('value1')).toEqual('false'); expect(binding('value2')).toEqual('NO'); }); </doc:scenario> </doc:example> */ 'checkbox': checkboxInputType, 'hidden': noop, 'button': noop, 'submit': noop, 'reset': noop }; function isEmpty(value) { return isUndefined(value) || value === '' || value === null || value !== value; } function textInputType(scope, element, attr, ctrl, $sniffer, $browser) { var listener = function() { var value = element.val(); // By default we will trim the value // If the attribute ng-trim exists we will avoid trimming // e.g. <input ng-model="foo" ng-trim="false"> if (toBoolean(attr.ngTrim || 'T')) { value = trim(value); } if (ctrl.$viewValue !== value) { scope.$apply(function() { ctrl.$setViewValue(value); }); } }; // if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the // input event on backspace, delete or cut if ($sniffer.hasEvent('input')) { element.bind('input', listener); } else { var timeout; var deferListener = function() { if (!timeout) { timeout = $browser.defer(function() { listener(); timeout = null; }); } }; element.bind('keydown', function(event) { var key = event.keyCode; // ignore // command modifiers arrows if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return; deferListener(); }); // if user paste into input using mouse, we need "change" event to catch it element.bind('change', listener); // if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it if ($sniffer.hasEvent('paste')) { element.bind('paste cut', deferListener); } } ctrl.$render = function() { element.val(isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue); }; // pattern validator var pattern = attr.ngPattern, patternValidator, match; var validate = function(regexp, value) { if (isEmpty(value) || regexp.test(value)) { ctrl.$setValidity('pattern', true); return value; } else { ctrl.$setValidity('pattern', false); return undefined; } }; if (pattern) { match = pattern.match(/^\/(.*)\/([gim]*)$/); if (match) { pattern = new RegExp(match[1], match[2]); patternValidator = function(value) { return validate(pattern, value) }; } else { patternValidator = function(value) { var patternObj = scope.$eval(pattern); if (!patternObj || !patternObj.test) { throw new Error('Expected ' + pattern + ' to be a RegExp but was ' + patternObj); } return validate(patternObj, value); }; } ctrl.$formatters.push(patternValidator); ctrl.$parsers.push(patternValidator); } // min length validator if (attr.ngMinlength) { var minlength = int(attr.ngMinlength); var minLengthValidator = function(value) { if (!isEmpty(value) && value.length < minlength) { ctrl.$setValidity('minlength', false); return undefined; } else { ctrl.$setValidity('minlength', true); return value; } }; ctrl.$parsers.push(minLengthValidator); ctrl.$formatters.push(minLengthValidator); } // max length validator if (attr.ngMaxlength) { var maxlength = int(attr.ngMaxlength); var maxLengthValidator = function(value) { if (!isEmpty(value) && value.length > maxlength) { ctrl.$setValidity('maxlength', false); return undefined; } else { ctrl.$setValidity('maxlength', true); return value; } }; ctrl.$parsers.push(maxLengthValidator); ctrl.$formatters.push(maxLengthValidator); } } function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) { textInputType(scope, element, attr, ctrl, $sniffer, $browser); ctrl.$parsers.push(function(value) { var empty = isEmpty(value); if (empty || NUMBER_REGEXP.test(value)) { ctrl.$setValidity('number', true); return value === '' ? null : (empty ? value : parseFloat(value)); } else { ctrl.$setValidity('number', false); return undefined; } }); ctrl.$formatters.push(function(value) { return isEmpty(value) ? '' : '' + value; }); if (attr.min) { var min = parseFloat(attr.min); var minValidator = function(value) { if (!isEmpty(value) && value < min) { ctrl.$setValidity('min', false); return undefined; } else { ctrl.$setValidity('min', true); return value; } }; ctrl.$parsers.push(minValidator); ctrl.$formatters.push(minValidator); } if (attr.max) { var max = parseFloat(attr.max); var maxValidator = function(value) { if (!isEmpty(value) && value > max) { ctrl.$setValidity('max', false); return undefined; } else { ctrl.$setValidity('max', true); return value; } }; ctrl.$parsers.push(maxValidator); ctrl.$formatters.push(maxValidator); } ctrl.$formatters.push(function(value) { if (isEmpty(value) || isNumber(value)) { ctrl.$setValidity('number', true); return value; } else { ctrl.$setValidity('number', false); return undefined; } }); } function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) { textInputType(scope, element, attr, ctrl, $sniffer, $browser); var urlValidator = function(value) { if (isEmpty(value) || URL_REGEXP.test(value)) { ctrl.$setValidity('url', true); return value; } else { ctrl.$setValidity('url', false); return undefined; } }; ctrl.$formatters.push(urlValidator); ctrl.$parsers.push(urlValidator); } function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) { textInputType(scope, element, attr, ctrl, $sniffer, $browser); var emailValidator = function(value) { if (isEmpty(value) || EMAIL_REGEXP.test(value)) { ctrl.$setValidity('email', true); return value; } else { ctrl.$setValidity('email', false); return undefined; } }; ctrl.$formatters.push(emailValidator); ctrl.$parsers.push(emailValidator); } function radioInputType(scope, element, attr, ctrl) { // make the name unique, if not defined if (isUndefined(attr.name)) { element.attr('name', nextUid()); } element.bind('click', function() { if (element[0].checked) { scope.$apply(function() { ctrl.$setViewValue(attr.value); }); } }); ctrl.$render = function() { var value = attr.value; element[0].checked = (value == ctrl.$viewValue); }; attr.$observe('value', ctrl.$render); } function checkboxInputType(scope, element, attr, ctrl) { var trueValue = attr.ngTrueValue, falseValue = attr.ngFalseValue; if (!isString(trueValue)) trueValue = true; if (!isString(falseValue)) falseValue = false; element.bind('click', function() { scope.$apply(function() { ctrl.$setViewValue(element[0].checked); }); }); ctrl.$render = function() { element[0].checked = ctrl.$viewValue; }; ctrl.$formatters.push(function(value) { return value === trueValue; }); ctrl.$parsers.push(function(value) { return value ? trueValue : falseValue; }); } /** * @ngdoc directive * @name ng.directive:textarea * @restrict E * * @description * HTML textarea element control with angular data-binding. The data-binding and validation * properties of this element are exactly the same as those of the * {@link ng.directive:input input element}. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than * minlength. * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than * maxlength. * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for * patterns defined as scope expressions. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. */ /** * @ngdoc directive * @name ng.directive:input * @restrict E * * @description * HTML input element control with angular data-binding. Input control follows HTML5 input types * and polyfills the HTML5 validation behavior for older browsers. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} required Sets `required` validation error key if the value is not entered. * @param {boolean=} ngRequired Sets `required` attribute if set to true * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than * minlength. * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than * maxlength. * @param {string=} ngPattern Sets `pattern` validation error key if the value does not match the * RegExp pattern expression. Expected value is `/regexp/` for inline patterns or `regexp` for * patterns defined as scope expressions. * @param {string=} ngChange Angular expression to be executed when input changes due to user * interaction with the input element. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.user = {name: 'guest', last: 'visitor'}; } </script> <div ng-controller="Ctrl"> <form name="myForm"> User name: <input type="text" name="userName" ng-model="user.name" required> <span class="error" ng-show="myForm.userName.$error.required"> Required!</span><br> Last name: <input type="text" name="lastName" ng-model="user.last" ng-minlength="3" ng-maxlength="10"> <span class="error" ng-show="myForm.lastName.$error.minlength"> Too short!</span> <span class="error" ng-show="myForm.lastName.$error.maxlength"> Too long!</span><br> </form> <hr> <tt>user = {{user}}</tt><br/> <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br> <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br> <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br> <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br> <tt>myForm.$valid = {{myForm.$valid}}</tt><br> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br> <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br> <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br> </div> </doc:source> <doc:scenario> it('should initialize to model', function() { expect(binding('user')).toEqual('{"name":"guest","last":"visitor"}'); expect(binding('myForm.userName.$valid')).toEqual('true'); expect(binding('myForm.$valid')).toEqual('true'); }); it('should be invalid if empty when required', function() { input('user.name').enter(''); expect(binding('user')).toEqual('{"last":"visitor"}'); expect(binding('myForm.userName.$valid')).toEqual('false'); expect(binding('myForm.$valid')).toEqual('false'); }); it('should be valid if empty when min length is set', function() { input('user.last').enter(''); expect(binding('user')).toEqual('{"name":"guest","last":""}'); expect(binding('myForm.lastName.$valid')).toEqual('true'); expect(binding('myForm.$valid')).toEqual('true'); }); it('should be invalid if less than required min length', function() { input('user.last').enter('xx'); expect(binding('user')).toEqual('{"name":"guest"}'); expect(binding('myForm.lastName.$valid')).toEqual('false'); expect(binding('myForm.lastName.$error')).toMatch(/minlength/); expect(binding('myForm.$valid')).toEqual('false'); }); it('should be invalid if longer than max length', function() { input('user.last').enter('some ridiculously long name'); expect(binding('user')) .toEqual('{"name":"guest"}'); expect(binding('myForm.lastName.$valid')).toEqual('false'); expect(binding('myForm.lastName.$error')).toMatch(/maxlength/); expect(binding('myForm.$valid')).toEqual('false'); }); </doc:scenario> </doc:example> */ var inputDirective = ['$browser', '$sniffer', function($browser, $sniffer) { return { restrict: 'E', require: '?ngModel', link: function(scope, element, attr, ctrl) { if (ctrl) { (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrl, $sniffer, $browser); } } }; }]; var VALID_CLASS = 'ng-valid', INVALID_CLASS = 'ng-invalid', PRISTINE_CLASS = 'ng-pristine', DIRTY_CLASS = 'ng-dirty'; /** * @ngdoc object * @name ng.directive:ngModel.NgModelController * * @property {string} $viewValue Actual string value in the view. * @property {*} $modelValue The value in the model, that the control is bound to. * @property {Array.<Function>} $parsers Whenever the control reads value from the DOM, it executes * all of these functions to sanitize / convert the value as well as validate. * * @property {Array.<Function>} $formatters Whenever the model value changes, it executes all of * these functions to convert the value as well as validate. * * @property {Object} $error An object hash with all errors as keys. * * @property {boolean} $pristine True if user has not interacted with the control yet. * @property {boolean} $dirty True if user has already interacted with the control. * @property {boolean} $valid True if there is no error. * @property {boolean} $invalid True if at least one error on the control. * * @description * * `NgModelController` provides API for the `ng-model` directive. The controller contains * services for data-binding, validation, CSS update, value formatting and parsing. It * specifically does not contain any logic which deals with DOM rendering or listening to * DOM events. The `NgModelController` is meant to be extended by other directives where, the * directive provides DOM manipulation and the `NgModelController` provides the data-binding. * * This example shows how to use `NgModelController` with a custom control to achieve * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`) * collaborate together to achieve the desired result. * * <example module="customControl"> <file name="style.css"> [contenteditable] { border: 1px solid black; background-color: white; min-height: 20px; } .ng-invalid { border: 1px solid red; } </file> <file name="script.js"> angular.module('customControl', []). directive('contenteditable', function() { return { restrict: 'A', // only activate on element attribute require: '?ngModel', // get a hold of NgModelController link: function(scope, element, attrs, ngModel) { if(!ngModel) return; // do nothing if no ng-model // Specify how UI should be updated ngModel.$render = function() { element.html(ngModel.$viewValue || ''); }; // Listen for change events to enable binding element.bind('blur keyup change', function() { scope.$apply(read); }); read(); // initialize // Write data to the model function read() { ngModel.$setViewValue(element.html()); } } }; }); </file> <file name="index.html"> <form name="myForm"> <div contenteditable name="myWidget" ng-model="userContent" required>Change me!</div> <span ng-show="myForm.myWidget.$error.required">Required!</span> <hr> <textarea ng-model="userContent"></textarea> </form> </file> <file name="scenario.js"> it('should data-bind and become invalid', function() { var contentEditable = element('[contenteditable]'); expect(contentEditable.text()).toEqual('Change me!'); input('userContent').enter(''); expect(contentEditable.text()).toEqual(''); expect(contentEditable.prop('className')).toMatch(/ng-invalid-required/); }); </file> * </example> * */ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', function($scope, $exceptionHandler, $attr, $element, $parse) { this.$viewValue = Number.NaN; this.$modelValue = Number.NaN; this.$parsers = []; this.$formatters = []; this.$viewChangeListeners = []; this.$pristine = true; this.$dirty = false; this.$valid = true; this.$invalid = false; this.$name = $attr.name; var ngModelGet = $parse($attr.ngModel), ngModelSet = ngModelGet.assign; if (!ngModelSet) { throw Error(NON_ASSIGNABLE_MODEL_EXPRESSION + $attr.ngModel + ' (' + startingTag($element) + ')'); } /** * @ngdoc function * @name ng.directive:ngModel.NgModelController#$render * @methodOf ng.directive:ngModel.NgModelController * * @description * Called when the view needs to be updated. It is expected that the user of the ng-model * directive will implement this method. */ this.$render = noop; var parentForm = $element.inheritedData('$formController') || nullFormCtrl, invalidCount = 0, // used to easily determine if we are valid $error = this.$error = {}; // keep invalid keys here // Setup initial state of the control $element.addClass(PRISTINE_CLASS); toggleValidCss(true); // convenience method for easy toggling of classes function toggleValidCss(isValid, validationErrorKey) { validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : ''; $element. removeClass((isValid ? INVALID_CLASS : VALID_CLASS) + validationErrorKey). addClass((isValid ? VALID_CLASS : INVALID_CLASS) + validationErrorKey); } /** * @ngdoc function * @name ng.directive:ngModel.NgModelController#$setValidity * @methodOf ng.directive:ngModel.NgModelController * * @description * Change the validity state, and notifies the form when the control changes validity. (i.e. it * does not notify form if given validator is already marked as invalid). * * This method should be called by validators - i.e. the parser or formatter functions. * * @param {string} validationErrorKey Name of the validator. the `validationErrorKey` will assign * to `$error[validationErrorKey]=isValid` so that it is available for data-binding. * The `validationErrorKey` should be in camelCase and will get converted into dash-case * for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error` * class and can be bound to as `{{someForm.someControl.$error.myError}}` . * @param {boolean} isValid Whether the current state is valid (true) or invalid (false). */ this.$setValidity = function(validationErrorKey, isValid) { if ($error[validationErrorKey] === !isValid) return; if (isValid) { if ($error[validationErrorKey]) invalidCount--; if (!invalidCount) { toggleValidCss(true); this.$valid = true; this.$invalid = false; } } else { toggleValidCss(false); this.$invalid = true; this.$valid = false; invalidCount++; } $error[validationErrorKey] = !isValid; toggleValidCss(isValid, validationErrorKey); parentForm.$setValidity(validationErrorKey, isValid, this); }; /** * @ngdoc function * @name ng.directive:ngModel.NgModelController#$setPristine * @methodOf ng.directive:ngModel.NgModelController * * @description * Sets the control to its pristine state. * * This method can be called to remove the 'ng-dirty' class and set the control to its pristine * state (ng-pristine class). */ this.$setPristine = function () { this.$dirty = false; this.$pristine = true; $element.removeClass(DIRTY_CLASS).addClass(PRISTINE_CLASS); }; /** * @ngdoc function * @name ng.directive:ngModel.NgModelController#$setViewValue * @methodOf ng.directive:ngModel.NgModelController * * @description * Read a value from view. * * This method should be called from within a DOM event handler. * For example {@link ng.directive:input input} or * {@link ng.directive:select select} directives call it. * * It internally calls all `parsers` and if resulted value is valid, updates the model and * calls all registered change listeners. * * @param {string} value Value from the view. */ this.$setViewValue = function(value) { this.$viewValue = value; // change to dirty if (this.$pristine) { this.$dirty = true; this.$pristine = false; $element.removeClass(PRISTINE_CLASS).addClass(DIRTY_CLASS); parentForm.$setDirty(); } forEach(this.$parsers, function(fn) { value = fn(value); }); if (this.$modelValue !== value) { this.$modelValue = value; ngModelSet($scope, value); forEach(this.$viewChangeListeners, function(listener) { try { listener(); } catch(e) { $exceptionHandler(e); } }) } }; // model -> value var ctrl = this; $scope.$watch(function ngModelWatch() { var value = ngModelGet($scope); // if scope model value and ngModel value are out of sync if (ctrl.$modelValue !== value) { var formatters = ctrl.$formatters, idx = formatters.length; ctrl.$modelValue = value; while(idx--) { value = formatters[idx](value); } if (ctrl.$viewValue !== value) { ctrl.$viewValue = value; ctrl.$render(); } } }); }]; /** * @ngdoc directive * @name ng.directive:ngModel * * @element input * * @description * Is directive that tells Angular to do two-way data binding. It works together with `input`, * `select`, `textarea`. You can easily write your own directives to use `ngModel` as well. * * `ngModel` is responsible for: * * - binding the view into the model, which other directives such as `input`, `textarea` or `select` * require, * - providing validation behavior (i.e. required, number, email, url), * - keeping state of the control (valid/invalid, dirty/pristine, validation errors), * - setting related css class onto the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`), * - register the control with parent {@link ng.directive:form form}. * * For basic examples, how to use `ngModel`, see: * * - {@link ng.directive:input input} * - {@link ng.directive:input.text text} * - {@link ng.directive:input.checkbox checkbox} * - {@link ng.directive:input.radio radio} * - {@link ng.directive:input.number number} * - {@link ng.directive:input.email email} * - {@link ng.directive:input.url url} * - {@link ng.directive:select select} * - {@link ng.directive:textarea textarea} * */ var ngModelDirective = function() { return { require: ['ngModel', '^?form'], controller: NgModelController, link: function(scope, element, attr, ctrls) { // notify others, especially parent forms var modelCtrl = ctrls[0], formCtrl = ctrls[1] || nullFormCtrl; formCtrl.$addControl(modelCtrl); element.bind('$destroy', function() { formCtrl.$removeControl(modelCtrl); }); } }; }; /** * @ngdoc directive * @name ng.directive:ngChange * @restrict E * * @description * Evaluate given expression when user changes the input. * The expression is not evaluated when the value change is coming from the model. * * Note, this directive requires `ngModel` to be present. * * @element input * * @example * <doc:example> * <doc:source> * <script> * function Controller($scope) { * $scope.counter = 0; * $scope.change = function() { * $scope.counter++; * }; * } * </script> * <div ng-controller="Controller"> * <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" /> * <input type="checkbox" ng-model="confirmed" id="ng-change-example2" /> * <label for="ng-change-example2">Confirmed</label><br /> * debug = {{confirmed}}<br /> * counter = {{counter}} * </div> * </doc:source> * <doc:scenario> * it('should evaluate the expression if changing from view', function() { * expect(binding('counter')).toEqual('0'); * element('#ng-change-example1').click(); * expect(binding('counter')).toEqual('1'); * expect(binding('confirmed')).toEqual('true'); * }); * * it('should not evaluate the expression if changing from model', function() { * element('#ng-change-example2').click(); * expect(binding('counter')).toEqual('0'); * expect(binding('confirmed')).toEqual('true'); * }); * </doc:scenario> * </doc:example> */ var ngChangeDirective = valueFn({ require: 'ngModel', link: function(scope, element, attr, ctrl) { ctrl.$viewChangeListeners.push(function() { scope.$eval(attr.ngChange); }); } }); var requiredDirective = function() { return { require: '?ngModel', link: function(scope, elm, attr, ctrl) { if (!ctrl) return; attr.required = true; // force truthy in case we are on non input element var validator = function(value) { if (attr.required && (isEmpty(value) || value === false)) { ctrl.$setValidity('required', false); return; } else { ctrl.$setValidity('required', true); return value; } }; ctrl.$formatters.push(validator); ctrl.$parsers.unshift(validator); attr.$observe('required', function() { validator(ctrl.$viewValue); }); } }; }; /** * @ngdoc directive * @name ng.directive:ngList * * @description * Text input that converts between comma-separated string into an array of strings. * * @element input * @param {string=} ngList optional delimiter that should be used to split the value. If * specified in form `/something/` then the value will be converted into a regular expression. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.names = ['igor', 'misko', 'vojta']; } </script> <form name="myForm" ng-controller="Ctrl"> List: <input name="namesInput" ng-model="names" ng-list required> <span class="error" ng-show="myForm.list.$error.required"> Required!</span> <tt>names = {{names}}</tt><br/> <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/> <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/> <tt>myForm.$valid = {{myForm.$valid}}</tt><br/> <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/> </form> </doc:source> <doc:scenario> it('should initialize to model', function() { expect(binding('names')).toEqual('["igor","misko","vojta"]'); expect(binding('myForm.namesInput.$valid')).toEqual('true'); }); it('should be invalid if empty', function() { input('names').enter(''); expect(binding('names')).toEqual('[]'); expect(binding('myForm.namesInput.$valid')).toEqual('false'); }); </doc:scenario> </doc:example> */ var ngListDirective = function() { return { require: 'ngModel', link: function(scope, element, attr, ctrl) { var match = /\/(.*)\//.exec(attr.ngList), separator = match && new RegExp(match[1]) || attr.ngList || ','; var parse = function(viewValue) { var list = []; if (viewValue) { forEach(viewValue.split(separator), function(value) { if (value) list.push(trim(value)); }); } return list; }; ctrl.$parsers.push(parse); ctrl.$formatters.push(function(value) { if (isArray(value)) { return value.join(', '); } return undefined; }); } }; }; var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/; var ngValueDirective = function() { return { priority: 100, compile: function(tpl, tplAttr) { if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) { return function(scope, elm, attr) { attr.$set('value', scope.$eval(attr.ngValue)); }; } else { return function(scope, elm, attr) { scope.$watch(attr.ngValue, function valueWatchAction(value) { attr.$set('value', value, false); }); }; } } }; }; /** * @ngdoc directive * @name ng.directive:ngBind * * @description * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element * with the value of a given expression, and to update the text content when the value of that * expression changes. * * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like * `{{ expression }}` which is similar but less verbose. * * One scenario in which the use of `ngBind` is preferred over `{{ expression }}` binding is when * it's desirable to put bindings into template that is momentarily displayed by the browser in its * raw state before Angular compiles it. Since `ngBind` is an element attribute, it makes the * bindings invisible to the user while the page is loading. * * An alternative solution to this problem would be using the * {@link ng.directive:ngCloak ngCloak} directive. * * * @element ANY * @param {expression} ngBind {@link guide/expression Expression} to evaluate. * * @example * Enter a name in the Live Preview text box; the greeting below the text box changes instantly. <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.name = 'Whirled'; } </script> <div ng-controller="Ctrl"> Enter name: <input type="text" ng-model="name"><br> Hello <span ng-bind="name"></span>! </div> </doc:source> <doc:scenario> it('should check ng-bind', function() { expect(using('.doc-example-live').binding('name')).toBe('Whirled'); using('.doc-example-live').input('name').enter('world'); expect(using('.doc-example-live').binding('name')).toBe('world'); }); </doc:scenario> </doc:example> */ var ngBindDirective = ngDirective(function(scope, element, attr) { element.addClass('ng-binding').data('$binding', attr.ngBind); scope.$watch(attr.ngBind, function ngBindWatchAction(value) { element.text(value == undefined ? '' : value); }); }); /** * @ngdoc directive * @name ng.directive:ngBindTemplate * * @description * The `ngBindTemplate` directive specifies that the element * text should be replaced with the template in ngBindTemplate. * Unlike ngBind the ngBindTemplate can contain multiple `{{` `}}` * expressions. (This is required since some HTML elements * can not have SPAN elements such as TITLE, or OPTION to name a few.) * * @element ANY * @param {string} ngBindTemplate template of form * <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval. * * @example * Try it here: enter text in text box and watch the greeting change. <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.salutation = 'Hello'; $scope.name = 'World'; } </script> <div ng-controller="Ctrl"> Salutation: <input type="text" ng-model="salutation"><br> Name: <input type="text" ng-model="name"><br> <pre ng-bind-template="{{salutation}} {{name}}!"></pre> </div> </doc:source> <doc:scenario> it('should check ng-bind', function() { expect(using('.doc-example-live').binding('salutation')). toBe('Hello'); expect(using('.doc-example-live').binding('name')). toBe('World'); using('.doc-example-live').input('salutation').enter('Greetings'); using('.doc-example-live').input('name').enter('user'); expect(using('.doc-example-live').binding('salutation')). toBe('Greetings'); expect(using('.doc-example-live').binding('name')). toBe('user'); }); </doc:scenario> </doc:example> */ var ngBindTemplateDirective = ['$interpolate', function($interpolate) { return function(scope, element, attr) { // TODO: move this to scenario runner var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate)); element.addClass('ng-binding').data('$binding', interpolateFn); attr.$observe('ngBindTemplate', function(value) { element.text(value); }); } }]; /** * @ngdoc directive * @name ng.directive:ngBindHtmlUnsafe * * @description * Creates a binding that will innerHTML the result of evaluating the `expression` into the current * element. *The innerHTML-ed content will not be sanitized!* You should use this directive only if * {@link ngSanitize.directive:ngBindHtml ngBindHtml} directive is too * restrictive and when you absolutely trust the source of the content you are binding to. * * See {@link ngSanitize.$sanitize $sanitize} docs for examples. * * @element ANY * @param {expression} ngBindHtmlUnsafe {@link guide/expression Expression} to evaluate. */ var ngBindHtmlUnsafeDirective = [function() { return function(scope, element, attr) { element.addClass('ng-binding').data('$binding', attr.ngBindHtmlUnsafe); scope.$watch(attr.ngBindHtmlUnsafe, function ngBindHtmlUnsafeWatchAction(value) { element.html(value || ''); }); }; }]; function classDirective(name, selector) { name = 'ngClass' + name; return ngDirective(function(scope, element, attr) { var oldVal = undefined; scope.$watch(attr[name], ngClassWatchAction, true); attr.$observe('class', function(value) { var ngClass = scope.$eval(attr[name]); ngClassWatchAction(ngClass, ngClass); }); if (name !== 'ngClass') { scope.$watch('$index', function($index, old$index) { var mod = $index & 1; if (mod !== old$index & 1) { if (mod === selector) { addClass(scope.$eval(attr[name])); } else { removeClass(scope.$eval(attr[name])); } } }); } function ngClassWatchAction(newVal) { if (selector === true || scope.$index % 2 === selector) { if (oldVal && !equals(newVal,oldVal)) { removeClass(oldVal); } addClass(newVal); } oldVal = copy(newVal); } function removeClass(classVal) { if (isObject(classVal) && !isArray(classVal)) { classVal = map(classVal, function(v, k) { if (v) return k }); } element.removeClass(isArray(classVal) ? classVal.join(' ') : classVal); } function addClass(classVal) { if (isObject(classVal) && !isArray(classVal)) { classVal = map(classVal, function(v, k) { if (v) return k }); } if (classVal) { element.addClass(isArray(classVal) ? classVal.join(' ') : classVal); } } }); } /** * @ngdoc directive * @name ng.directive:ngClass * * @description * The `ngClass` allows you to set CSS class on HTML element dynamically by databinding an * expression that represents all classes to be added. * * The directive won't add duplicate classes if a particular class was already set. * * When the expression changes, the previously added classes are removed and only then the * new classes are added. * * @element ANY * @param {expression} ngClass {@link guide/expression Expression} to eval. The result * of the evaluation can be a string representing space delimited class * names, an array, or a map of class names to boolean values. * * @example <example> <file name="index.html"> <input type="button" value="set" ng-click="myVar='my-class'"> <input type="button" value="clear" ng-click="myVar=''"> <br> <span ng-class="myVar">Sample Text</span> </file> <file name="style.css"> .my-class { color: red; } </file> <file name="scenario.js"> it('should check ng-class', function() { expect(element('.doc-example-live span').prop('className')).not(). toMatch(/my-class/); using('.doc-example-live').element(':button:first').click(); expect(element('.doc-example-live span').prop('className')). toMatch(/my-class/); using('.doc-example-live').element(':button:last').click(); expect(element('.doc-example-live span').prop('className')).not(). toMatch(/my-class/); }); </file> </example> */ var ngClassDirective = classDirective('', true); /** * @ngdoc directive * @name ng.directive:ngClassOdd * * @description * The `ngClassOdd` and `ngClassEven` directives work exactly as * {@link ng.directive:ngClass ngClass}, except it works in * conjunction with `ngRepeat` and takes affect only on odd (even) rows. * * This directive can be applied only within a scope of an * {@link ng.directive:ngRepeat ngRepeat}. * * @element ANY * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result * of the evaluation can be a string representing space delimited class names or an array. * * @example <example> <file name="index.html"> <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']"> <li ng-repeat="name in names"> <span ng-class-odd="'odd'" ng-class-even="'even'"> {{name}} </span> </li> </ol> </file> <file name="style.css"> .odd { color: red; } .even { color: blue; } </file> <file name="scenario.js"> it('should check ng-class-odd and ng-class-even', function() { expect(element('.doc-example-live li:first span').prop('className')). toMatch(/odd/); expect(element('.doc-example-live li:last span').prop('className')). toMatch(/even/); }); </file> </example> */ var ngClassOddDirective = classDirective('Odd', 0); /** * @ngdoc directive * @name ng.directive:ngClassEven * * @description * The `ngClassOdd` and `ngClassEven` directives work exactly as * {@link ng.directive:ngClass ngClass}, except it works in * conjunction with `ngRepeat` and takes affect only on odd (even) rows. * * This directive can be applied only within a scope of an * {@link ng.directive:ngRepeat ngRepeat}. * * @element ANY * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The * result of the evaluation can be a string representing space delimited class names or an array. * * @example <example> <file name="index.html"> <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']"> <li ng-repeat="name in names"> <span ng-class-odd="'odd'" ng-class-even="'even'"> {{name}} &nbsp; &nbsp; &nbsp; </span> </li> </ol> </file> <file name="style.css"> .odd { color: red; } .even { color: blue; } </file> <file name="scenario.js"> it('should check ng-class-odd and ng-class-even', function() { expect(element('.doc-example-live li:first span').prop('className')). toMatch(/odd/); expect(element('.doc-example-live li:last span').prop('className')). toMatch(/even/); }); </file> </example> */ var ngClassEvenDirective = classDirective('Even', 1); /** * @ngdoc directive * @name ng.directive:ngCloak * * @description * The `ngCloak` directive is used to prevent the Angular html template from being briefly * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this * directive to avoid the undesirable flicker effect caused by the html template display. * * The directive can be applied to the `<body>` element, but typically a fine-grained application is * preferred in order to benefit from progressive rendering of the browser view. * * `ngCloak` works in cooperation with a css rule that is embedded within `angular.js` and * `angular.min.js` files. Following is the css rule: * * <pre> * [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { * display: none; * } * </pre> * * When this css rule is loaded by the browser, all html elements (including their children) that * are tagged with the `ng-cloak` directive are hidden. When Angular comes across this directive * during the compilation of the template it deletes the `ngCloak` element attribute, which * makes the compiled element visible. * * For the best result, `angular.js` script must be loaded in the head section of the html file; * alternatively, the css rule (above) must be included in the external stylesheet of the * application. * * Legacy browsers, like IE7, do not provide attribute selector support (added in CSS 2.1) so they * cannot match the `[ng\:cloak]` selector. To work around this limitation, you must add the css * class `ngCloak` in addition to `ngCloak` directive as shown in the example below. * * @element ANY * * @example <doc:example> <doc:source> <div id="template1" ng-cloak>{{ 'hello' }}</div> <div id="template2" ng-cloak class="ng-cloak">{{ 'hello IE7' }}</div> </doc:source> <doc:scenario> it('should remove the template directive and css class', function() { expect(element('.doc-example-live #template1').attr('ng-cloak')). not().toBeDefined(); expect(element('.doc-example-live #template2').attr('ng-cloak')). not().toBeDefined(); }); </doc:scenario> </doc:example> * */ var ngCloakDirective = ngDirective({ compile: function(element, attr) { attr.$set('ngCloak', undefined); element.removeClass('ng-cloak'); } }); /** * @ngdoc directive * @name ng.directive:ngController * * @description * The `ngController` directive assigns behavior to a scope. This is a key aspect of how angular * supports the principles behind the Model-View-Controller design pattern. * * MVC components in angular: * * * Model — The Model is data in scope properties; scopes are attached to the DOM. * * View — The template (HTML with data bindings) is rendered into the View. * * Controller — The `ngController` directive specifies a Controller class; the class has * methods that typically express the business logic behind the application. * * Note that an alternative way to define controllers is via the {@link ng.$route $route} service. * * @element ANY * @scope * @param {expression} ngController Name of a globally accessible constructor function or an * {@link guide/expression expression} that on the current scope evaluates to a * constructor function. The controller instance can further be published into the scope * by adding `as localName` the controller name attribute. * * @example * Here is a simple form for editing user contact information. Adding, removing, clearing, and * greeting are methods declared on the controller (see source tab). These methods can * easily be called from the angular markup. Notice that the scope becomes the `this` for the * controller's instance. This allows for easy access to the view data from the controller. Also * notice that any changes to the data are automatically reflected in the View without the need * for a manual update. The example is included in two different declaration styles based on * your style preferences. <doc:example> <doc:source> <script> function SettingsController() { this.name = "John Smith"; this.contacts = [ {type: 'phone', value: '408 555 1212'}, {type: 'email', value: '[email protected]'} ]; }; SettingsController.prototype.greet = function() { alert(this.name); }; SettingsController.prototype.addContact = function() { this.contacts.push({type: 'email', value: '[email protected]'}); }; SettingsController.prototype.removeContact = function(contactToRemove) { var index = this.contacts.indexOf(contactToRemove); this.contacts.splice(index, 1); }; SettingsController.prototype.clearContact = function(contact) { contact.type = 'phone'; contact.value = ''; }; </script> <div ng-controller="SettingsController as settings"> Name: <input type="text" ng-model="settings.name"/> [ <a href="" ng-click="settings.greet()">greet</a> ]<br/> Contact: <ul> <li ng-repeat="contact in settings.contacts"> <select ng-model="contact.type"> <option>phone</option> <option>email</option> </select> <input type="text" ng-model="contact.value"/> [ <a href="" ng-click="settings.clearContact(contact)">clear</a> | <a href="" ng-click="settings.removeContact(contact)">X</a> ] </li> <li>[ <a href="" ng-click="settings.addContact()">add</a> ]</li> </ul> </div> </doc:source> <doc:scenario> it('should check controller', function() { expect(element('.doc-example-live div>:input').val()).toBe('John Smith'); expect(element('.doc-example-live li:nth-child(1) input').val()) .toBe('408 555 1212'); expect(element('.doc-example-live li:nth-child(2) input').val()) .toBe('[email protected]'); element('.doc-example-live li:first a:contains("clear")').click(); expect(element('.doc-example-live li:first input').val()).toBe(''); element('.doc-example-live li:last a:contains("add")').click(); expect(element('.doc-example-live li:nth-child(3) input').val()) .toBe('[email protected]'); }); </doc:scenario> </doc:example> <doc:example> <doc:source> <script> function SettingsController($scope) { $scope.name = "John Smith"; $scope.contacts = [ {type:'phone', value:'408 555 1212'}, {type:'email', value:'[email protected]'} ]; $scope.greet = function() { alert(this.name); }; $scope.addContact = function() { this.contacts.push({type:'email', value:'[email protected]'}); }; $scope.removeContact = function(contactToRemove) { var index = this.contacts.indexOf(contactToRemove); this.contacts.splice(index, 1); }; $scope.clearContact = function(contact) { contact.type = 'phone'; contact.value = ''; }; } </script> <div ng-controller="SettingsController"> Name: <input type="text" ng-model="name"/> [ <a href="" ng-click="greet()">greet</a> ]<br/> Contact: <ul> <li ng-repeat="contact in contacts"> <select ng-model="contact.type"> <option>phone</option> <option>email</option> </select> <input type="text" ng-model="contact.value"/> [ <a href="" ng-click="clearContact(contact)">clear</a> | <a href="" ng-click="removeContact(contact)">X</a> ] </li> <li>[ <a href="" ng-click="addContact()">add</a> ]</li> </ul> </div> </doc:source> <doc:scenario> it('should check controller', function() { expect(element('.doc-example-live div>:input').val()).toBe('John Smith'); expect(element('.doc-example-live li:nth-child(1) input').val()) .toBe('408 555 1212'); expect(element('.doc-example-live li:nth-child(2) input').val()) .toBe('[email protected]'); element('.doc-example-live li:first a:contains("clear")').click(); expect(element('.doc-example-live li:first input').val()).toBe(''); element('.doc-example-live li:last a:contains("add")').click(); expect(element('.doc-example-live li:nth-child(3) input').val()) .toBe('[email protected]'); }); </doc:scenario> </doc:example> */ var ngControllerDirective = [function() { return { scope: true, controller: '@' }; }]; /** * @ngdoc directive * @name ng.directive:ngCsp * @priority 1000 * * @element html * @description * Enables [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) support. * * This is necessary when developing things like Google Chrome Extensions. * * CSP forbids apps to use `eval` or `Function(string)` generated functions (among other things). * For us to be compatible, we just need to implement the "getterFn" in $parse without violating * any of these restrictions. * * AngularJS uses `Function(string)` generated functions as a speed optimization. By applying `ngCsp` * it is be possible to opt into the CSP compatible mode. When this mode is on AngularJS will * evaluate all expressions up to 30% slower than in non-CSP mode, but no security violations will * be raised. * * In order to use this feature put `ngCsp` directive on the root element of the application. * * @example * This example shows how to apply the `ngCsp` directive to the `html` tag. <pre> <!doctype html> <html ng-app ng-csp> ... ... </html> </pre> */ var ngCspDirective = ['$sniffer', function($sniffer) { return { priority: 1000, compile: function() { $sniffer.csp = true; } }; }]; /** * @ngdoc directive * @name ng.directive:ngClick * * @description * The ngClick allows you to specify custom behavior when * element is clicked. * * @element ANY * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon * click. (Event object is available as `$event`) * * @example <doc:example> <doc:source> <button ng-click="count = count + 1" ng-init="count=0"> Increment </button> count: {{count}} </doc:source> <doc:scenario> it('should check ng-click', function() { expect(binding('count')).toBe('0'); element('.doc-example-live :button').click(); expect(binding('count')).toBe('1'); }); </doc:scenario> </doc:example> */ /* * A directive that allows creation of custom onclick handlers that are defined as angular * expressions and are compiled and executed within the current scope. * * Events that are handled via these handler are always configured not to propagate further. */ var ngEventDirectives = {}; forEach( 'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress'.split(' '), function(name) { var directiveName = directiveNormalize('ng-' + name); ngEventDirectives[directiveName] = ['$parse', function($parse) { return function(scope, element, attr) { var fn = $parse(attr[directiveName]); element.bind(lowercase(name), function(event) { scope.$apply(function() { fn(scope, {$event:event}); }); }); }; }]; } ); /** * @ngdoc directive * @name ng.directive:ngDblclick * * @description * The `ngDblclick` directive allows you to specify custom behavior on dblclick event. * * @element ANY * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon * dblclick. (Event object is available as `$event`) * * @example * See {@link ng.directive:ngClick ngClick} */ /** * @ngdoc directive * @name ng.directive:ngMousedown * * @description * The ngMousedown directive allows you to specify custom behavior on mousedown event. * * @element ANY * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon * mousedown. (Event object is available as `$event`) * * @example * See {@link ng.directive:ngClick ngClick} */ /** * @ngdoc directive * @name ng.directive:ngMouseup * * @description * Specify custom behavior on mouseup event. * * @element ANY * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon * mouseup. (Event object is available as `$event`) * * @example * See {@link ng.directive:ngClick ngClick} */ /** * @ngdoc directive * @name ng.directive:ngMouseover * * @description * Specify custom behavior on mouseover event. * * @element ANY * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon * mouseover. (Event object is available as `$event`) * * @example * See {@link ng.directive:ngClick ngClick} */ /** * @ngdoc directive * @name ng.directive:ngMouseenter * * @description * Specify custom behavior on mouseenter event. * * @element ANY * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon * mouseenter. (Event object is available as `$event`) * * @example * See {@link ng.directive:ngClick ngClick} */ /** * @ngdoc directive * @name ng.directive:ngMouseleave * * @description * Specify custom behavior on mouseleave event. * * @element ANY * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon * mouseleave. (Event object is available as `$event`) * * @example * See {@link ng.directive:ngClick ngClick} */ /** * @ngdoc directive * @name ng.directive:ngMousemove * * @description * Specify custom behavior on mousemove event. * * @element ANY * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon * mousemove. (Event object is available as `$event`) * * @example * See {@link ng.directive:ngClick ngClick} */ /** * @ngdoc directive * @name ng.directive:ngKeydown * * @description * Specify custom behavior on keydown event. * * @element ANY * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) * * @example * See {@link ng.directive:ngClick ngClick} */ /** * @ngdoc directive * @name ng.directive:ngKeyup * * @description * Specify custom behavior on keyup event. * * @element ANY * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) * * @example * See {@link ng.directive:ngClick ngClick} */ /** * @ngdoc directive * @name ng.directive:ngKeypress * * @description * Specify custom behavior on keypress event. * * @element ANY * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon * keypress. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.) * * @example * See {@link ng.directive:ngClick ngClick} */ /** * @ngdoc directive * @name ng.directive:ngSubmit * * @description * Enables binding angular expressions to onsubmit events. * * Additionally it prevents the default action (which for form means sending the request to the * server and reloading the current page). * * @element form * @param {expression} ngSubmit {@link guide/expression Expression} to eval. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.list = []; $scope.text = 'hello'; $scope.submit = function() { if (this.text) { this.list.push(this.text); this.text = ''; } }; } </script> <form ng-submit="submit()" ng-controller="Ctrl"> Enter text and hit enter: <input type="text" ng-model="text" name="text" /> <input type="submit" id="submit" value="Submit" /> <pre>list={{list}}</pre> </form> </doc:source> <doc:scenario> it('should check ng-submit', function() { expect(binding('list')).toBe('[]'); element('.doc-example-live #submit').click(); expect(binding('list')).toBe('["hello"]'); expect(input('text').val()).toBe(''); }); it('should ignore empty strings', function() { expect(binding('list')).toBe('[]'); element('.doc-example-live #submit').click(); element('.doc-example-live #submit').click(); expect(binding('list')).toBe('["hello"]'); }); </doc:scenario> </doc:example> */ var ngSubmitDirective = ngDirective(function(scope, element, attrs) { element.bind('submit', function() { scope.$apply(attrs.ngSubmit); }); }); /** * @ngdoc directive * @name ng.directive:ngIf * @restrict A * * @description * The `ngIf` directive removes and recreates a portion of the DOM tree (HTML) * conditionally based on **"falsy"** and **"truthy"** values, respectively, evaluated within * an {expression}. In other words, if the expression assigned to **ngIf evaluates to a false * value** then **the element is removed from the DOM** and **if true** then **a clone of the * element is reinserted into the DOM**. * * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the * element in the DOM rather than changing its visibility via the `display` css property. A common * case when this difference is significant is when using css selectors that rely on an element's * position within the DOM (HTML), such as the `:first-child` or `:last-child` pseudo-classes. * * Note that **when an element is removed using ngIf its scope is destroyed** and **a new scope * is created when the element is restored**. The scope created within `ngIf` inherits from * its parent scope using * {@link https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-Prototypal-Inheritance prototypal inheritance}. * An important implication of this is if `ngModel` is used within `ngIf` to bind to * a javascript primitive defined in the parent scope. In this case any modifications made to the * variable within the child scope will override (hide) the value in the parent scope. * * Also, `ngIf` recreates elements using their compiled state. An example scenario of this behavior * is if an element's class attribute is directly modified after it's compiled, using something like * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element * the added class will be lost because the original compiled state is used to regenerate the element. * * Additionally, you can provide animations via the ngAnimate attribute to animate the **enter** * and **leave** effects. * * @animations * enter - happens just after the ngIf contents change and a new DOM element is created and injected into the ngIf container * leave - happens just before the ngIf contents are removed from the DOM * * @element ANY * @scope * @param {expression} ngIf If the {@link guide/expression expression} is falsy then * the element is removed from the DOM tree (HTML). * * @example <example animations="true"> <file name="index.html"> Click me: <input type="checkbox" ng-model="checked" ng-init="checked=true" /><br/> Show when checked: <span ng-if="checked" ng-animate="'example'"> I'm removed when the checkbox is unchecked. </span> </file> <file name="animations.css"> .example-leave, .example-enter { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; -moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; -ms-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; -o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; } .example-enter { opacity:0; } .example-enter.example-enter-active { opacity:1; } .example-leave { opacity:1; } .example-leave.example-leave-active { opacity:0; } </file> </example> */ var ngIfDirective = ['$animator', function($animator) { return { transclude: 'element', priority: 1000, terminal: true, restrict: 'A', compile: function (element, attr, transclude) { return function ($scope, $element, $attr) { var animate = $animator($scope, $attr); var childElement, childScope; $scope.$watch($attr.ngIf, function ngIfWatchAction(value) { if (childElement) { animate.leave(childElement); childElement = undefined; } if (childScope) { childScope.$destroy(); childScope = undefined; } if (toBoolean(value)) { childScope = $scope.$new(); transclude(childScope, function (clone) { childElement = clone; animate.enter(clone, $element.parent(), $element); }); } }); } } } }]; /** * @ngdoc directive * @name ng.directive:ngInclude * @restrict ECA * * @description * Fetches, compiles and includes an external HTML fragment. * * Keep in mind that Same Origin Policy applies to included resources * (e.g. ngInclude won't work for cross-domain requests on all browsers and for * file:// access on some browsers). * * Additionally, you can also provide animations via the ngAnimate attribute to animate the **enter** * and **leave** effects. * * @animations * enter - happens just after the ngInclude contents change and a new DOM element is created and injected into the ngInclude container * leave - happens just after the ngInclude contents change and just before the former contents are removed from the DOM * * @scope * * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant, * make sure you wrap it in quotes, e.g. `src="'myPartialTemplate.html'"`. * @param {string=} onload Expression to evaluate when a new partial is loaded. * * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll * $anchorScroll} to scroll the viewport after the content is loaded. * * - If the attribute is not set, disable scrolling. * - If the attribute is set without value, enable scrolling. * - Otherwise enable scrolling only if the expression evaluates to truthy value. * * @example <example animations="true"> <file name="index.html"> <div ng-controller="Ctrl"> <select ng-model="template" ng-options="t.name for t in templates"> <option value="">(blank)</option> </select> url of the template: <tt>{{template.url}}</tt> <hr/> <div class="example-animate-container" ng-include="template.url" ng-animate="{enter: 'example-enter', leave: 'example-leave'}"></div> </div> </file> <file name="script.js"> function Ctrl($scope) { $scope.templates = [ { name: 'template1.html', url: 'template1.html'} , { name: 'template2.html', url: 'template2.html'} ]; $scope.template = $scope.templates[0]; } </file> <file name="template1.html"> <div>Content of template1.html</div> </file> <file name="template2.html"> <div>Content of template2.html</div> </file> <file name="animations.css"> .example-leave, .example-enter { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; -moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; -ms-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; -o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; position:absolute; top:0; left:0; right:0; bottom:0; } .example-animate-container > * { display:block; padding:10px; } .example-enter { top:-50px; } .example-enter.example-enter-active { top:0; } .example-leave { top:0; } .example-leave.example-leave-active { top:50px; } </file> <file name="scenario.js"> it('should load template1.html', function() { expect(element('.doc-example-live [ng-include]').text()). toMatch(/Content of template1.html/); }); it('should load template2.html', function() { select('template').option('1'); expect(element('.doc-example-live [ng-include]').text()). toMatch(/Content of template2.html/); }); it('should change to blank', function() { select('template').option(''); expect(element('.doc-example-live [ng-include]').text()).toEqual(''); }); </file> </example> */ /** * @ngdoc event * @name ng.directive:ngInclude#$includeContentRequested * @eventOf ng.directive:ngInclude * @eventType emit on the scope ngInclude was declared in * @description * Emitted every time the ngInclude content is requested. */ /** * @ngdoc event * @name ng.directive:ngInclude#$includeContentLoaded * @eventOf ng.directive:ngInclude * @eventType emit on the current ngInclude scope * @description * Emitted every time the ngInclude content is reloaded. */ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile', '$animator', function($http, $templateCache, $anchorScroll, $compile, $animator) { return { restrict: 'ECA', terminal: true, compile: function(element, attr) { var srcExp = attr.ngInclude || attr.src, onloadExp = attr.onload || '', autoScrollExp = attr.autoscroll; return function(scope, element, attr) { var animate = $animator(scope, attr); var changeCounter = 0, childScope; var clearContent = function() { if (childScope) { childScope.$destroy(); childScope = null; } animate.leave(element.contents(), element); }; scope.$watch(srcExp, function ngIncludeWatchAction(src) { var thisChangeId = ++changeCounter; if (src) { $http.get(src, {cache: $templateCache}).success(function(response) { if (thisChangeId !== changeCounter) return; if (childScope) childScope.$destroy(); childScope = scope.$new(); animate.leave(element.contents(), element); var contents = jqLite('<div/>').html(response).contents(); animate.enter(contents, element); $compile(contents)(childScope); if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) { $anchorScroll(); } childScope.$emit('$includeContentLoaded'); scope.$eval(onloadExp); }).error(function() { if (thisChangeId === changeCounter) clearContent(); }); scope.$emit('$includeContentRequested'); } else { clearContent(); } }); }; } }; }]; /** * @ngdoc directive * @name ng.directive:ngInit * * @description * The `ngInit` directive specifies initialization tasks to be executed * before the template enters execution mode during bootstrap. * * @element ANY * @param {expression} ngInit {@link guide/expression Expression} to eval. * * @example <doc:example> <doc:source> <div ng-init="greeting='Hello'; person='World'"> {{greeting}} {{person}}! </div> </doc:source> <doc:scenario> it('should check greeting', function() { expect(binding('greeting')).toBe('Hello'); expect(binding('person')).toBe('World'); }); </doc:scenario> </doc:example> */ var ngInitDirective = ngDirective({ compile: function() { return { pre: function(scope, element, attrs) { scope.$eval(attrs.ngInit); } } } }); /** * @ngdoc directive * @name ng.directive:ngNonBindable * @priority 1000 * * @description * Sometimes it is necessary to write code which looks like bindings but which should be left alone * by angular. Use `ngNonBindable` to make angular ignore a chunk of HTML. * * @element ANY * * @example * In this example there are two location where a simple binding (`{{}}`) is present, but the one * wrapped in `ngNonBindable` is left alone. * * @example <doc:example> <doc:source> <div>Normal: {{1 + 2}}</div> <div ng-non-bindable>Ignored: {{1 + 2}}</div> </doc:source> <doc:scenario> it('should check ng-non-bindable', function() { expect(using('.doc-example-live').binding('1 + 2')).toBe('3'); expect(using('.doc-example-live').element('div:last').text()). toMatch(/1 \+ 2/); }); </doc:scenario> </doc:example> */ var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 }); /** * @ngdoc directive * @name ng.directive:ngPluralize * @restrict EA * * @description * # Overview * `ngPluralize` is a directive that displays messages according to en-US localization rules. * These rules are bundled with angular.js and the rules can be overridden * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive * by specifying the mappings between * {@link http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html * plural categories} and the strings to be displayed. * * # Plural categories and explicit number rules * There are two * {@link http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html * plural categories} in Angular's default en-US locale: "one" and "other". * * While a plural category may match many numbers (for example, in en-US locale, "other" can match * any number that is not 1), an explicit number rule can only match one number. For example, the * explicit number rule for "3" matches the number 3. You will see the use of plural categories * and explicit number rules throughout later parts of this documentation. * * # Configuring ngPluralize * You configure ngPluralize by providing 2 attributes: `count` and `when`. * You can also provide an optional attribute, `offset`. * * The value of the `count` attribute can be either a string or an {@link guide/expression * Angular expression}; these are evaluated on the current scope for its bound value. * * The `when` attribute specifies the mappings between plural categories and the actual * string to be displayed. The value of the attribute should be a JSON object so that Angular * can interpret it correctly. * * The following example shows how to configure ngPluralize: * * <pre> * <ng-pluralize count="personCount" when="{'0': 'Nobody is viewing.', * 'one': '1 person is viewing.', * 'other': '{} people are viewing.'}"> * </ng-pluralize> *</pre> * * In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not * specify this rule, 0 would be matched to the "other" category and "0 people are viewing" * would be shown instead of "Nobody is viewing". You can specify an explicit number rule for * other numbers, for example 12, so that instead of showing "12 people are viewing", you can * show "a dozen people are viewing". * * You can use a set of closed braces(`{}`) as a placeholder for the number that you want substituted * into pluralized strings. In the previous example, Angular will replace `{}` with * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder * for <span ng-non-bindable>{{numberExpression}}</span>. * * # Configuring ngPluralize with offset * The `offset` attribute allows further customization of pluralized text, which can result in * a better user experience. For example, instead of the message "4 people are viewing this document", * you might display "John, Kate and 2 others are viewing this document". * The offset attribute allows you to offset a number by any desired value. * Let's take a look at an example: * * <pre> * <ng-pluralize count="personCount" offset=2 * when="{'0': 'Nobody is viewing.', * '1': '{{person1}} is viewing.', * '2': '{{person1}} and {{person2}} are viewing.', * 'one': '{{person1}}, {{person2}} and one other person are viewing.', * 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}"> * </ng-pluralize> * </pre> * * Notice that we are still using two plural categories(one, other), but we added * three explicit number rules 0, 1 and 2. * When one person, perhaps John, views the document, "John is viewing" will be shown. * When three people view the document, no explicit number rule is found, so * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category. * In this case, plural category 'one' is matched and "John, Marry and one other person are viewing" * is shown. * * Note that when you specify offsets, you must provide explicit number rules for * numbers from 0 up to and including the offset. If you use an offset of 3, for example, * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for * plural categories "one" and "other". * * @param {string|expression} count The variable to be bounded to. * @param {string} when The mapping between plural category to its corresponding strings. * @param {number=} offset Offset to deduct from the total number. * * @example <doc:example> <doc:source> <script> function Ctrl($scope) { $scope.person1 = 'Igor'; $scope.person2 = 'Misko'; $scope.personCount = 1; } </script> <div ng-controller="Ctrl"> Person 1:<input type="text" ng-model="person1" value="Igor" /><br/> Person 2:<input type="text" ng-model="person2" value="Misko" /><br/> Number of People:<input type="text" ng-model="personCount" value="1" /><br/> <!--- Example with simple pluralization rules for en locale ---> Without Offset: <ng-pluralize count="personCount" when="{'0': 'Nobody is viewing.', 'one': '1 person is viewing.', 'other': '{} people are viewing.'}"> </ng-pluralize><br> <!--- Example with offset ---> With Offset(2): <ng-pluralize count="personCount" offset=2 when="{'0': 'Nobody is viewing.', '1': '{{person1}} is viewing.', '2': '{{person1}} and {{person2}} are viewing.', 'one': '{{person1}}, {{person2}} and one other person are viewing.', 'other': '{{person1}}, {{person2}} and {} other people are viewing.'}"> </ng-pluralize> </div> </doc:source> <doc:scenario> it('should show correct pluralized string', function() { expect(element('.doc-example-live ng-pluralize:first').text()). toBe('1 person is viewing.'); expect(element('.doc-example-live ng-pluralize:last').text()). toBe('Igor is viewing.'); using('.doc-example-live').input('personCount').enter('0'); expect(element('.doc-example-live ng-pluralize:first').text()). toBe('Nobody is viewing.'); expect(element('.doc-example-live ng-pluralize:last').text()). toBe('Nobody is viewing.'); using('.doc-example-live').input('personCount').enter('2'); expect(element('.doc-example-live ng-pluralize:first').text()). toBe('2 people are viewing.'); expect(element('.doc-example-live ng-pluralize:last').text()). toBe('Igor and Misko are viewing.'); using('.doc-example-live').input('personCount').enter('3'); expect(element('.doc-example-live ng-pluralize:first').text()). toBe('3 people are viewing.'); expect(element('.doc-example-live ng-pluralize:last').text()). toBe('Igor, Misko and one other person are viewing.'); using('.doc-example-live').input('personCount').enter('4'); expect(element('.doc-example-live ng-pluralize:first').text()). toBe('4 people are viewing.'); expect(element('.doc-example-live ng-pluralize:last').text()). toBe('Igor, Misko and 2 other people are viewing.'); }); it('should show data-binded names', function() { using('.doc-example-live').input('personCount').enter('4'); expect(element('.doc-example-live ng-pluralize:last').text()). toBe('Igor, Misko and 2 other people are viewing.'); using('.doc-example-live').input('person1').enter('Di'); using('.doc-example-live').input('person2').enter('Vojta'); expect(element('.doc-example-live ng-pluralize:last').text()). toBe('Di, Vojta and 2 other people are viewing.'); }); </doc:scenario> </doc:example> */ var ngPluralizeDirective = ['$locale', '$interpolate', function($locale, $interpolate) { var BRACE = /{}/g; return { restrict: 'EA', link: function(scope, element, attr) { var numberExp = attr.count, whenExp = element.attr(attr.$attr.when), // this is because we have {{}} in attrs offset = attr.offset || 0, whens = scope.$eval(whenExp), whensExpFns = {}, startSymbol = $interpolate.startSymbol(), endSymbol = $interpolate.endSymbol(); forEach(whens, function(expression, key) { whensExpFns[key] = $interpolate(expression.replace(BRACE, startSymbol + numberExp + '-' + offset + endSymbol)); }); scope.$watch(function ngPluralizeWatch() { var value = parseFloat(scope.$eval(numberExp)); if (!isNaN(value)) { //if explicit number rule such as 1, 2, 3... is defined, just use it. Otherwise, //check it against pluralization rules in $locale service if (!(value in whens)) value = $locale.pluralCat(value - offset); return whensExpFns[value](scope, element, true); } else { return ''; } }, function ngPluralizeWatchAction(newVal) { element.text(newVal); }); } }; }]; /** * @ngdoc directive * @name ng.directive:ngRepeat * * @description * The `ngRepeat` directive instantiates a template once per item from a collection. Each template * instance gets its own scope, where the given loop variable is set to the current collection item, * and `$index` is set to the item index or key. * * Special properties are exposed on the local scope of each template instance, including: * * * `$index` – `{number}` – iterator offset of the repeated element (0..length-1) * * `$first` – `{boolean}` – true if the repeated element is first in the iterator. * * `$middle` – `{boolean}` – true if the repeated element is between the first and last in the iterator. * * `$last` – `{boolean}` – true if the repeated element is last in the iterator. * * Additionally, you can also provide animations via the ngAnimate attribute to animate the **enter**, * **leave** and **move** effects. * * @animations * enter - when a new item is added to the list or when an item is revealed after a filter * leave - when an item is removed from the list or when an item is filtered out * move - when an adjacent item is filtered out causing a reorder or when the item contents are reordered * * @element ANY * @scope * @priority 1000 * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These * formats are currently supported: * * * `variable in expression` – where variable is the user defined loop variable and `expression` * is a scope expression giving the collection to enumerate. * * For example: `track in cd.tracks`. * * * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers, * and `expression` is the scope expression giving the collection to enumerate. * * For example: `(name, age) in {'adam':10, 'amalie':12}`. * * * `variable in expression track by tracking_expression` – You can also provide an optional tracking function * which can be used to associate the objects in the collection with the DOM elements. If no tractking function * is specified the ng-repeat associates elements by identity in the collection. It is an error to have * more then one tractking function to resolve to the same key. (This would mean that two distinct objects are * mapped to the same DOM element, which is not possible.) * * For example: `item in items` is equivalent to `item in items track by $id(item)'. This implies that the DOM elements * will be associated by item identity in the array. * * For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique * `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements * with the corresponding item in the array by identity. Moving the same object in array would move the DOM * element in the same way ian the DOM. * * For example: `item in items track by item.id` Is a typical pattern when the items come from the database. In this * case the object identity does not matter. Two objects are considered equivalent as long as their `id` * property is same. * * @example * This example initializes the scope to a list of names and * then uses `ngRepeat` to display every person: <example animations="true"> <file name="index.html"> <div ng-init="friends = [ {name:'John', age:25, gender:'boy'}, {name:'Jessie', age:30, gender:'girl'}, {name:'Johanna', age:28, gender:'girl'}, {name:'Joy', age:15, gender:'girl'}, {name:'Mary', age:28, gender:'girl'}, {name:'Peter', age:95, gender:'boy'}, {name:'Sebastian', age:50, gender:'boy'}, {name:'Erika', age:27, gender:'girl'}, {name:'Patrick', age:40, gender:'boy'}, {name:'Samantha', age:60, gender:'girl'} ]"> I have {{friends.length}} friends. They are: <input type="search" ng-model="q" placeholder="filter friends..." /> <ul> <li ng-repeat="friend in friends | filter:q" ng-animate="{enter: 'example-repeat-enter', leave: 'example-repeat-leave', move: 'example-repeat-move'}"> [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old. </li> </ul> </div> </file> <file name="animations.css"> .example-repeat-enter, .example-repeat-leave, .example-repeat-move { -webkit-transition:all linear 0.5s; -moz-transition:all linear 0.5s; -ms-transition:all linear 0.5s; -o-transition:all linear 0.5s; transition:all linear 0.5s; } .example-repeat-enter { line-height:0; opacity:0; } .example-repeat-enter.example-repeat-enter-active { line-height:20px; opacity:1; } .example-repeat-leave { opacity:1; line-height:20px; } .example-repeat-leave.example-repeat-leave-active { opacity:0; line-height:0; } .example-repeat-move { } .example-repeat-move.example-repeat-move-active { } </file> <file name="scenario.js"> it('should render initial data set', function() { var r = using('.doc-example-live').repeater('ul li'); expect(r.count()).toBe(10); expect(r.row(0)).toEqual(["1","John","25"]); expect(r.row(1)).toEqual(["2","Jessie","30"]); expect(r.row(9)).toEqual(["10","Samantha","60"]); expect(binding('friends.length')).toBe("10"); }); it('should update repeater when filter predicate changes', function() { var r = using('.doc-example-live').repeater('ul li'); expect(r.count()).toBe(10); input('q').enter('ma'); expect(r.count()).toBe(2); expect(r.row(0)).toEqual(["1","Mary","28"]); expect(r.row(1)).toEqual(["2","Samantha","60"]); }); </file> </example> */ var ngRepeatDirective = ['$parse', '$animator', function($parse, $animator) { var NG_REMOVED = '$$NG_REMOVED'; return { transclude: 'element', priority: 1000, terminal: true, compile: function(element, attr, linker) { return function($scope, $element, $attr){ var animate = $animator($scope, $attr); var expression = $attr.ngRepeat; var match = expression.match(/^\s*(.+)\s+in\s+(.*?)\s*(\s+track\s+by\s+(.+)\s*)?$/), trackByExp, trackByExpGetter, trackByIdFn, lhs, rhs, valueIdentifier, keyIdentifier, hashFnLocals = {$id: hashKey}; if (!match) { throw Error("Expected ngRepeat in form of '_item_ in _collection_[ track by _id_]' but got '" + expression + "'."); } lhs = match[1]; rhs = match[2]; trackByExp = match[4]; if (trackByExp) { trackByExpGetter = $parse(trackByExp); trackByIdFn = function(key, value, index) { // assign key, value, and $index to the locals so that they can be used in hash functions if (keyIdentifier) hashFnLocals[keyIdentifier] = key; hashFnLocals[valueIdentifier] = value; hashFnLocals.$index = index; return trackByExpGetter($scope, hashFnLocals); }; } else { trackByIdFn = function(key, value) { return hashKey(value); } } match = lhs.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/); if (!match) { throw Error("'item' in 'item in collection' should be identifier or (key, value) but got '" + lhs + "'."); } valueIdentifier = match[3] || match[1]; keyIdentifier = match[2]; // Store a list of elements from previous run. This is a hash where key is the item from the // iterator, and the value is objects with following properties. // - scope: bound scope // - element: previous element. // - index: position var lastBlockMap = {}; //watch props $scope.$watchCollection(rhs, function ngRepeatAction(collection){ var index, length, cursor = $element, // current position of the node nextCursor, // Same as lastBlockMap but it has the current state. It will become the // lastBlockMap on the next iteration. nextBlockMap = {}, arrayLength, childScope, key, value, // key/value of iteration trackById, collectionKeys, block, // last object information {scope, element, id} nextBlockOrder = []; if (isArrayLike(collection)) { collectionKeys = collection; } else { // if object, extract keys, sort them and use to determine order of iteration over obj props collectionKeys = []; for (key in collection) { if (collection.hasOwnProperty(key) && key.charAt(0) != '$') { collectionKeys.push(key); } } collectionKeys.sort(); } arrayLength = collectionKeys.length; // locate existing items length = nextBlockOrder.length = collectionKeys.length; for(index = 0; index < length; index++) { key = (collection === collectionKeys) ? index : collectionKeys[index]; value = collection[key]; trackById = trackByIdFn(key, value, index); if(lastBlockMap.hasOwnProperty(trackById)) { block = lastBlockMap[trackById] delete lastBlockMap[trackById]; nextBlockMap[trackById] = block; nextBlockOrder[index] = block; } else if (nextBlockMap.hasOwnProperty(trackById)) { // restore lastBlockMap forEach(nextBlockOrder, function(block) { if (block && block.element) lastBlockMap[block.id] = block; }); // This is a duplicate and we need to throw an error throw new Error('Duplicates in a repeater are not allowed. Repeater: ' + expression + ' key: ' + trackById); } else { // new never before seen block nextBlockOrder[index] = { id: trackById }; nextBlockMap[trackById] = false; } } // remove existing items for (key in lastBlockMap) { if (lastBlockMap.hasOwnProperty(key)) { block = lastBlockMap[key]; animate.leave(block.element); block.element[0][NG_REMOVED] = true; block.scope.$destroy(); } } // we are not using forEach for perf reasons (trying to avoid #call) for (index = 0, length = collectionKeys.length; index < length; index++) { key = (collection === collectionKeys) ? index : collectionKeys[index]; value = collection[key]; block = nextBlockOrder[index]; if (block.element) { // if we have already seen this object, then we need to reuse the // associated scope/element childScope = block.scope; nextCursor = cursor[0]; do { nextCursor = nextCursor.nextSibling; } while(nextCursor && nextCursor[NG_REMOVED]); if (block.element[0] == nextCursor) { // do nothing cursor = block.element; } else { // existing item which got moved animate.move(block.element, null, cursor); cursor = block.element; } } else { // new item which we don't know about childScope = $scope.$new(); } childScope[valueIdentifier] = value; if (keyIdentifier) childScope[keyIdentifier] = key; childScope.$index = index; childScope.$first = (index === 0); childScope.$last = (index === (arrayLength - 1)); childScope.$middle = !(childScope.$first || childScope.$last); if (!block.element) { linker(childScope, function(clone) { animate.enter(clone, null, cursor); cursor = clone; block.scope = childScope; block.element = clone; nextBlockMap[block.id] = block; }); } } lastBlockMap = nextBlockMap; }); }; } }; }]; /** * @ngdoc directive * @name ng.directive:ngShow * * @description * The `ngShow` and `ngHide` directives show or hide a portion of the DOM tree (HTML) * conditionally based on **"truthy"** values evaluated within an {expression}. In other * words, if the expression assigned to **ngShow evaluates to a true value** then **the element is set to visible** * (via `display:block` in css) and **if false** then **the element is set to hidden** (so display:none). * With ngHide this is the reverse whereas true values cause the element itself to become * hidden. * * Additionally, you can also provide animations via the ngAnimate attribute to animate the **show** * and **hide** effects. * * @animations * show - happens after the ngShow expression evaluates to a truthy value and the contents are set to visible * hide - happens before the ngShow expression evaluates to a non truthy value and just before the contents are set to hidden * * @element ANY * @param {expression} ngShow If the {@link guide/expression expression} is truthy * then the element is shown or hidden respectively. * * @example <example animations="true"> <file name="index.html"> Click me: <input type="checkbox" ng-model="checked"><br/> <div> Show: <span class="check-element" ng-show="checked" ng-animate="{show: 'example-show', hide: 'example-hide'}"> <span class="icon-thumbs-up"></span> I show up when your checkbox is checked. </span> </div> <div> Hide: <span class="check-element" ng-hide="checked" ng-animate="{show: 'example-show', hide: 'example-hide'}"> <span class="icon-thumbs-down"></span> I hide when your checkbox is checked. </span> </div> </file> <file name="animations.css"> .example-show, .example-hide { -webkit-transition:all linear 0.5s; -moz-transition:all linear 0.5s; -ms-transition:all linear 0.5s; -o-transition:all linear 0.5s; transition:all linear 0.5s; } .example-show { line-height:0; opacity:0; padding:0 10px; } .example-show-active.example-show-active { line-height:20px; opacity:1; padding:10px; border:1px solid black; background:white; } .example-hide { line-height:20px; opacity:1; padding:10px; border:1px solid black; background:white; } .example-hide-active.example-hide-active { line-height:0; opacity:0; padding:0 10px; } .check-element { padding:10px; border:1px solid black; background:white; } </file> <file name="scenario.js"> it('should check ng-show / ng-hide', function() { expect(element('.doc-example-live span:first:hidden').count()).toEqual(1); expect(element('.doc-example-live span:last:visible').count()).toEqual(1); input('checked').check(); expect(element('.doc-example-live span:first:visible').count()).toEqual(1); expect(element('.doc-example-live span:last:hidden').count()).toEqual(1); }); </file> </example> */ //TODO(misko): refactor to remove element from the DOM var ngShowDirective = ['$animator', function($animator) { return function(scope, element, attr) { var animate = $animator(scope, attr); scope.$watch(attr.ngShow, function ngShowWatchAction(value){ animate[toBoolean(value) ? 'show' : 'hide'](element); }); }; }]; /** * @ngdoc directive * @name ng.directive:ngHide * * @description * The `ngShow` and `ngHide` directives show or hide a portion of the DOM tree (HTML) * conditionally based on **"truthy"** values evaluated within an {expression}. In other * words, if the expression assigned to **ngShow evaluates to a true value** then **the element is set to visible** * (via `display:block` in css) and **if false** then **the element is set to hidden** (so display:none). * With ngHide this is the reverse whereas true values cause the element itself to become * hidden. * * Additionally, you can also provide animations via the ngAnimate attribute to animate the **show** * and **hide** effects. * * @animations * show - happens after the ngHide expression evaluates to a non truthy value and the contents are set to visible * hide - happens after the ngHide expression evaluates to a truthy value and just before the contents are set to hidden * * @element ANY * @param {expression} ngHide If the {@link guide/expression expression} is truthy then * the element is shown or hidden respectively. * * @example <example animations="true"> <file name="index.html"> Click me: <input type="checkbox" ng-model="checked"><br/> <div> Show: <span class="check-element" ng-show="checked" ng-animate="{show: 'example-show', hide: 'example-hide'}"> <span class="icon-thumbs-up"></span> I show up when your checkbox is checked. </span> </div> <div> Hide: <span class="check-element" ng-hide="checked" ng-animate="{show: 'example-show', hide: 'example-hide'}"> <span class="icon-thumbs-down"></span> I hide when your checkbox is checked. </span> </div> </file> <file name="animations.css"> .example-show, .example-hide { -webkit-transition:all linear 0.5s; -moz-transition:all linear 0.5s; -ms-transition:all linear 0.5s; -o-transition:all linear 0.5s; transition:all linear 0.5s; } .example-show { line-height:0; opacity:0; padding:0 10px; } .example-show.example-show-active { line-height:20px; opacity:1; padding:10px; border:1px solid black; background:white; } .example-hide { line-height:20px; opacity:1; padding:10px; border:1px solid black; background:white; } .example-hide.example-hide-active { line-height:0; opacity:0; padding:0 10px; } .check-element { padding:10px; border:1px solid black; background:white; } </file> <file name="scenario.js"> it('should check ng-show / ng-hide', function() { expect(element('.doc-example-live .check-element:first:hidden').count()).toEqual(1); expect(element('.doc-example-live .check-element:last:visible').count()).toEqual(1); input('checked').check(); expect(element('.doc-example-live .check-element:first:visible').count()).toEqual(1); expect(element('.doc-example-live .check-element:last:hidden').count()).toEqual(1); }); </file> </example> */ //TODO(misko): refactor to remove element from the DOM var ngHideDirective = ['$animator', function($animator) { return function(scope, element, attr) { var animate = $animator(scope, attr); scope.$watch(attr.ngHide, function ngHideWatchAction(value){ animate[toBoolean(value) ? 'hide' : 'show'](element); }); }; }]; /** * @ngdoc directive * @name ng.directive:ngStyle * * @description * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally. * * @element ANY * @param {expression} ngStyle {@link guide/expression Expression} which evals to an * object whose keys are CSS style names and values are corresponding values for those CSS * keys. * * @example <example> <file name="index.html"> <input type="button" value="set" ng-click="myStyle={color:'red'}"> <input type="button" value="clear" ng-click="myStyle={}"> <br/> <span ng-style="myStyle">Sample Text</span> <pre>myStyle={{myStyle}}</pre> </file> <file name="style.css"> span { color: black; } </file> <file name="scenario.js"> it('should check ng-style', function() { expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)'); element('.doc-example-live :button[value=set]').click(); expect(element('.doc-example-live span').css('color')).toBe('rgb(255, 0, 0)'); element('.doc-example-live :button[value=clear]').click(); expect(element('.doc-example-live span').css('color')).toBe('rgb(0, 0, 0)'); }); </file> </example> */ var ngStyleDirective = ngDirective(function(scope, element, attr) { scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) { if (oldStyles && (newStyles !== oldStyles)) { forEach(oldStyles, function(val, style) { element.css(style, '');}); } if (newStyles) element.css(newStyles); }, true); }); /** * @ngdoc directive * @name ng.directive:ngSwitch * @restrict EA * * @description * The ngSwitch directive is used to conditionally swap DOM structure on your template based on a scope expression. * Elements within ngSwitch but without ngSwitchWhen or ngSwitchDefault directives will be preserved at the location * as specified in the template. * * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it * from the template cache), ngSwitch simply choses one of the nested elements and makes it visible based on which element * matches the value obtained from the evaluated expression. In other words, you define a container element * (where you place the directive), place an expression on the **on="..." attribute** * (or the **ng-switch="..." attribute**), define any inner elements inside of the directive and place * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default * attribute is displayed. * * Additionally, you can also provide animations via the ngAnimate attribute to animate the **enter** * and **leave** effects. * * @animations * enter - happens after the ngSwtich contents change and the matched child element is placed inside the container * leave - happens just after the ngSwitch contents change and just before the former contents are removed from the DOM * * @usage * <ANY ng-switch="expression"> * <ANY ng-switch-when="matchValue1">...</ANY> * <ANY ng-switch-when="matchValue2">...</ANY> * <ANY ng-switch-default>...</ANY> * </ANY> * * @scope * @param {*} ngSwitch|on expression to match against <tt>ng-switch-when</tt>. * @paramDescription * On child elements add: * * * `ngSwitchWhen`: the case statement to match against. If match then this * case will be displayed. If the same match appears multiple times, all the * elements will be displayed. * * `ngSwitchDefault`: the default case when no other case match. If there * are multiple default cases, all of them will be displayed when no other * case match. * * * @example <example animations="true"> <file name="index.html"> <div ng-controller="Ctrl"> <select ng-model="selection" ng-options="item for item in items"> </select> <tt>selection={{selection}}</tt> <hr/> <div class="example-animate-container" ng-switch on="selection" ng-animate="{enter: 'example-enter', leave: 'example-leave'}"> <div ng-switch-when="settings">Settings Div</div> <div ng-switch-when="home">Home Span</div> <div ng-switch-default>default</div> </div> </div> </file> <file name="script.js"> function Ctrl($scope) { $scope.items = ['settings', 'home', 'other']; $scope.selection = $scope.items[0]; } </file> <file name="animations.css"> .example-leave, .example-enter { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; -moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; -ms-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; -o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s; position:absolute; top:0; left:0; right:0; bottom:0; } .example-animate-container > * { display:block; padding:10px; } .example-enter { top:-50px; } .example-enter.example-enter-active { top:0; } .example-leave { top:0; } .example-leave.example-leave-active { top:50px; } </file> <file name="scenario.js"> it('should start in settings', function() { expect(element('.doc-example-live [ng-switch]').text()).toMatch(/Settings Div/); }); it('should change to home', function() { select('selection').option('home'); expect(element('.doc-example-live [ng-switch]').text()).toMatch(/Home Span/); }); it('should select default', function() { select('selection').option('other'); expect(element('.doc-example-live [ng-switch]').text()).toMatch(/default/); }); </file> </example> */ var ngSwitchDirective = ['$animator', function($animator) { return { restrict: 'EA', require: 'ngSwitch', // asks for $scope to fool the BC controller module controller: ['$scope', function ngSwitchController() { this.cases = {}; }], link: function(scope, element, attr, ngSwitchController) { var animate = $animator(scope, attr); var watchExpr = attr.ngSwitch || attr.on, selectedTranscludes, selectedElements, selectedScopes = []; scope.$watch(watchExpr, function ngSwitchWatchAction(value) { for (var i= 0, ii=selectedScopes.length; i<ii; i++) { selectedScopes[i].$destroy(); animate.leave(selectedElements[i]); } selectedElements = []; selectedScopes = []; if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) { scope.$eval(attr.change); forEach(selectedTranscludes, function(selectedTransclude) { var selectedScope = scope.$new(); selectedScopes.push(selectedScope); selectedTransclude.transclude(selectedScope, function(caseElement) { var anchor = selectedTransclude.element; selectedElements.push(caseElement); animate.enter(caseElement, anchor.parent(), anchor); }); }); } }); } } }]; var ngSwitchWhenDirective = ngDirective({ transclude: 'element', priority: 500, require: '^ngSwitch', compile: function(element, attrs, transclude) { return function(scope, element, attr, ctrl) { ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []); ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: transclude, element: element }); }; } }); var ngSwitchDefaultDirective = ngDirective({ transclude: 'element', priority: 500, require: '^ngSwitch', compile: function(element, attrs, transclude) { return function(scope, element, attr, ctrl) { ctrl.cases['?'] = (ctrl.cases['?'] || []); ctrl.cases['?'].push({ transclude: transclude, element: element }); }; } }); /** * @ngdoc directive * @name ng.directive:ngTransclude * * @description * Insert the transcluded DOM here. * * @element ANY * * @example <doc:example module="transclude"> <doc:source> <script> function Ctrl($scope) { $scope.title = 'Lorem Ipsum'; $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...'; } angular.module('transclude', []) .directive('pane', function(){ return { restrict: 'E', transclude: true, scope: 'isolate', locals: { title:'bind' }, template: '<div style="border: 1px solid black;">' + '<div style="background-color: gray">{{title}}</div>' + '<div ng-transclude></div>' + '</div>' }; }); </script> <div ng-controller="Ctrl"> <input ng-model="title"><br> <textarea ng-model="text"></textarea> <br/> <pane title="{{title}}">{{text}}</pane> </div> </doc:source> <doc:scenario> it('should have transcluded', function() { input('title').enter('TITLE'); input('text').enter('TEXT'); expect(binding('title')).toEqual('TITLE'); expect(binding('text')).toEqual('TEXT'); }); </doc:scenario> </doc:example> * */ var ngTranscludeDirective = ngDirective({ controller: ['$transclude', '$element', function($transclude, $element) { $transclude(function(clone) { $element.append(clone); }); }] }); /** * @ngdoc directive * @name ng.directive:ngView * @restrict ECA * * @description * # Overview * `ngView` is a directive that complements the {@link ng.$route $route} service by * including the rendered template of the current route into the main layout (`index.html`) file. * Every time the current route changes, the included view changes with it according to the * configuration of the `$route` service. * * Additionally, you can also provide animations via the ngAnimate attribute to animate the **enter** * and **leave** effects. * * @animations * enter - happens just after the ngView contents are changed (when the new view DOM element is inserted into the DOM) * leave - happens just after the current ngView contents change and just before the former contents are removed from the DOM * * @scope * @example <example module="ngView" animations="true"> <file name="index.html"> <div ng-controller="MainCntl as main"> Choose: <a href="Book/Moby">Moby</a> | <a href="Book/Moby/ch/1">Moby: Ch1</a> | <a href="Book/Gatsby">Gatsby</a> | <a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> | <a href="Book/Scarlet">Scarlet Letter</a><br/> <div ng-view class="example-animate-container" ng-animate="{enter: 'example-enter', leave: 'example-leave'}"></div> <hr /> <pre>$location.path() = {{main.$location.path()}}</pre> <pre>$route.current.templateUrl = {{main.$route.current.templateUrl}}</pre> <pre>$route.current.params = {{main.$route.current.params}}</pre> <pre>$route.current.scope.name = {{main.$route.current.scope.name}}</pre> <pre>$routeParams = {{main.$routeParams}}</pre> </div> </file> <file name="book.html"> <div> controller: {{book.name}}<br /> Book Id: {{book.params.bookId}}<br /> </div> </file> <file name="chapter.html"> <div> controller: {{chapter.name}}<br /> Book Id: {{chapter.params.bookId}}<br /> Chapter Id: {{chapter.params.chapterId}} </div> </file> <file name="animations.css"> .example-leave, .example-enter { -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; -moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; -ms-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; -o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s; } .example-animate-container { position:relative; height:100px; } .example-animate-container > * { display:block; width:100%; border-left:1px solid black; position:absolute; top:0; left:0; right:0; bottom:0; padding:10px; } .example-enter { left:100%; } .example-enter.example-enter-active { left:0; } .example-leave { } .example-leave.example-leave-active { left:-100%; } </file> <file name="script.js"> angular.module('ngView', [], function($routeProvider, $locationProvider) { $routeProvider.when('/Book/:bookId', { templateUrl: 'book.html', controller: BookCntl, controllerAs: 'book' }); $routeProvider.when('/Book/:bookId/ch/:chapterId', { templateUrl: 'chapter.html', controller: ChapterCntl, controllerAs: 'chapter' }); // configure html5 to get links working on jsfiddle $locationProvider.html5Mode(true); }); function MainCntl($route, $routeParams, $location) { this.$route = $route; this.$location = $location; this.$routeParams = $routeParams; } function BookCntl($routeParams) { this.name = "BookCntl"; this.params = $routeParams; } function ChapterCntl($routeParams) { this.name = "ChapterCntl"; this.params = $routeParams; } </file> <file name="scenario.js"> it('should load and compile correct template', function() { element('a:contains("Moby: Ch1")').click(); var content = element('.doc-example-live [ng-view]').text(); expect(content).toMatch(/controller\: ChapterCntl/); expect(content).toMatch(/Book Id\: Moby/); expect(content).toMatch(/Chapter Id\: 1/); element('a:contains("Scarlet")').click(); content = element('.doc-example-live [ng-view]').text(); expect(content).toMatch(/controller\: BookCntl/); expect(content).toMatch(/Book Id\: Scarlet/); }); </file> </example> */ /** * @ngdoc event * @name ng.directive:ngView#$viewContentLoaded * @eventOf ng.directive:ngView * @eventType emit on the current ngView scope * @description * Emitted every time the ngView content is reloaded. */ var ngViewDirective = ['$http', '$templateCache', '$route', '$anchorScroll', '$compile', '$controller', '$animator', function($http, $templateCache, $route, $anchorScroll, $compile, $controller, $animator) { return { restrict: 'ECA', terminal: true, link: function(scope, element, attr) { var lastScope, onloadExp = attr.onload || '', animate = $animator(scope, attr); scope.$on('$routeChangeSuccess', update); update(); function destroyLastScope() { if (lastScope) { lastScope.$destroy(); lastScope = null; } } function clearContent() { animate.leave(element.contents(), element); destroyLastScope(); } function update() { var locals = $route.current && $route.current.locals, template = locals && locals.$template; if (template) { clearContent(); var enterElements = jqLite('<div></div>').html(template).contents(); animate.enter(enterElements, element); var link = $compile(enterElements), current = $route.current, controller; lastScope = current.scope = scope.$new(); if (current.controller) { locals.$scope = lastScope; controller = $controller(current.controller, locals); if (current.controllerAs) { lastScope[current.controllerAs] = controller; } element.children().data('$ngControllerController', controller); } link(lastScope); lastScope.$emit('$viewContentLoaded'); lastScope.$eval(onloadExp); // $anchorScroll might listen on event... $anchorScroll(); } else { clearContent(); } } } }; }]; /** * @ngdoc directive * @name ng.directive:script * * @description * Load content of a script tag, with type `text/ng-template`, into `$templateCache`, so that the * template can be used by `ngInclude`, `ngView` or directive templates. * * @restrict E * @param {'text/ng-template'} type must be set to `'text/ng-template'` * * @example <doc:example> <doc:source> <script type="text/ng-template" id="/tpl.html"> Content of the template. </script> <a ng-click="currentTpl='/tpl.html'" id="tpl-link">Load inlined template</a> <div id="tpl-content" ng-include src="currentTpl"></div> </doc:source> <doc:scenario> it('should load template defined inside script tag', function() { element('#tpl-link').click(); expect(element('#tpl-content').text()).toMatch(/Content of the template/); }); </doc:scenario> </doc:example> */ var scriptDirective = ['$templateCache', function($templateCache) { return { restrict: 'E', terminal: true, compile: function(element, attr) { if (attr.type == 'text/ng-template') { var templateUrl = attr.id, // IE is not consistent, in scripts we have to read .text but in other nodes we have to read .textContent text = element[0].text; $templateCache.put(templateUrl, text); } } }; }]; /** * @ngdoc directive * @name ng.directive:select * @restrict E * * @description * HTML `SELECT` element with angular data-binding. * * # `ngOptions` * * Optionally `ngOptions` attribute can be used to dynamically generate a list of `<option>` * elements for a `<select>` element using an array or an object obtained by evaluating the * `ngOptions` expression. *˝˝ * When an item in the select menu is select, the value of array element or object property * represented by the selected option will be bound to the model identified by the `ngModel` * directive of the parent select element. * * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can * be nested into the `<select>` element. This element will then represent `null` or "not selected" * option. See example below for demonstration. * * Note: `ngOptions` provides iterator facility for `<option>` element which should be used instead * of {@link ng.directive:ngRepeat ngRepeat} when you want the * `select` model to be bound to a non-string value. This is because an option element can currently * be bound to string values only. * * @param {string} ngModel Assignable angular expression to data-bind to. * @param {string=} name Property name of the form under which the control is published. * @param {string=} required The control is considered valid only if value is entered. * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of * `required` when you want to data-bind to the `required` attribute. * @param {comprehension_expression=} ngOptions in one of the following forms: * * * for array data sources: * * `label` **`for`** `value` **`in`** `array` * * `select` **`as`** `label` **`for`** `value` **`in`** `array` * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` * * `select` **`as`** `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr` * * for object data sources: * * `label` **`for (`**`key` **`,`** `value`**`) in`** `object` * * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object` * * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object` * * `select` **`as`** `label` **`group by`** `group` * **`for` `(`**`key`**`,`** `value`**`) in`** `object` * * Where: * * * `array` / `object`: an expression which evaluates to an array / object to iterate over. * * `value`: local variable which will refer to each item in the `array` or each property value * of `object` during iteration. * * `key`: local variable which will refer to a property name in `object` during iteration. * * `label`: The result of this expression will be the label for `<option>` element. The * `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`). * * `select`: The result of this expression will be bound to the model of the parent `<select>` * element. If not specified, `select` expression will default to `value`. * * `group`: The result of this expression will be used to group options using the `<optgroup>` * DOM element. * * `trackexpr`: Used when working with an array of objects. The result of this expression will be * used to identify the objects in the array. The `trackexpr` will most likely refer to the * `value` variable (e.g. `value.propertyName`). * * @example <doc:example> <doc:source> <script> function MyCntrl($scope) { $scope.colors = [ {name:'black', shade:'dark'}, {name:'white', shade:'light'}, {name:'red', shade:'dark'}, {name:'blue', shade:'dark'}, {name:'yellow', shade:'light'} ]; $scope.color = $scope.colors[2]; // red } </script> <div ng-controller="MyCntrl"> <ul> <li ng-repeat="color in colors"> Name: <input ng-model="color.name"> [<a href ng-click="colors.splice($index, 1)">X</a>] </li> <li> [<a href ng-click="colors.push({})">add</a>] </li> </ul> <hr/> Color (null not allowed): <select ng-model="color" ng-options="c.name for c in colors"></select><br> Color (null allowed): <span class="nullable"> <select ng-model="color" ng-options="c.name for c in colors"> <option value="">-- chose color --</option> </select> </span><br/> Color grouped by shade: <select ng-model="color" ng-options="c.name group by c.shade for c in colors"> </select><br/> Select <a href ng-click="color={name:'not in list'}">bogus</a>.<br> <hr/> Currently selected: {{ {selected_color:color} }} <div style="border:solid 1px black; height:20px" ng-style="{'background-color':color.name}"> </div> </div> </doc:source> <doc:scenario> it('should check ng-options', function() { expect(binding('{selected_color:color}')).toMatch('red'); select('color').option('0'); expect(binding('{selected_color:color}')).toMatch('black'); using('.nullable').select('color').option(''); expect(binding('{selected_color:color}')).toMatch('null'); }); </doc:scenario> </doc:example> */ var ngOptionsDirective = valueFn({ terminal: true }); var selectDirective = ['$compile', '$parse', function($compile, $parse) { //0000111110000000000022220000000000000000000000333300000000000000444444444444444440000000005555555555555555500000006666666666666666600000000000000007777000000000000000000088888 var NG_OPTIONS_REGEXP = /^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*?)(?:\s+track\s+by\s+(.*?))?$/, nullModelCtrl = {$setViewValue: noop}; return { restrict: 'E', require: ['select', '?ngModel'], controller: ['$element', '$scope', '$attrs', function($element, $scope, $attrs) { var self = this, optionsMap = {}, ngModelCtrl = nullModelCtrl, nullOption, unknownOption; self.databound = $attrs.ngModel; self.init = function(ngModelCtrl_, nullOption_, unknownOption_) { ngModelCtrl = ngModelCtrl_; nullOption = nullOption_; unknownOption = unknownOption_; } self.addOption = function(value) { optionsMap[value] = true; if (ngModelCtrl.$viewValue == value) { $element.val(value); if (unknownOption.parent()) unknownOption.remove(); } }; self.removeOption = function(value) { if (this.hasOption(value)) { delete optionsMap[value]; if (ngModelCtrl.$viewValue == value) { this.renderUnknownOption(value); } } }; self.renderUnknownOption = function(val) { var unknownVal = '? ' + hashKey(val) + ' ?'; unknownOption.val(unknownVal); $element.prepend(unknownOption); $element.val(unknownVal); unknownOption.prop('selected', true); // needed for IE } self.hasOption = function(value) { return optionsMap.hasOwnProperty(value); } $scope.$on('$destroy', function() { // disable unknown option so that we don't do work when the whole select is being destroyed self.renderUnknownOption = noop; }); }], link: function(scope, element, attr, ctrls) { // if ngModel is not defined, we don't need to do anything if (!ctrls[1]) return; var selectCtrl = ctrls[0], ngModelCtrl = ctrls[1], multiple = attr.multiple, optionsExp = attr.ngOptions, nullOption = false, // if false, user will not be able to select it (used by ngOptions) emptyOption, // we can't just jqLite('<option>') since jqLite is not smart enough // to create it in <select> and IE barfs otherwise. optionTemplate = jqLite(document.createElement('option')), optGroupTemplate =jqLite(document.createElement('optgroup')), unknownOption = optionTemplate.clone(); // find "null" option for(var i = 0, children = element.children(), ii = children.length; i < ii; i++) { if (children[i].value == '') { emptyOption = nullOption = children.eq(i); break; } } selectCtrl.init(ngModelCtrl, nullOption, unknownOption); // required validator if (multiple && (attr.required || attr.ngRequired)) { var requiredValidator = function(value) { ngModelCtrl.$setValidity('required', !attr.required || (value && value.length)); return value; }; ngModelCtrl.$parsers.push(requiredValidator); ngModelCtrl.$formatters.unshift(requiredValidator); attr.$observe('required', function() { requiredValidator(ngModelCtrl.$viewValue); }); } if (optionsExp) Options(scope, element, ngModelCtrl); else if (multiple) Multiple(scope, element, ngModelCtrl); else Single(scope, element, ngModelCtrl, selectCtrl); //////////////////////////// function Single(scope, selectElement, ngModelCtrl, selectCtrl) { ngModelCtrl.$render = function() { var viewValue = ngModelCtrl.$viewValue; if (selectCtrl.hasOption(viewValue)) { if (unknownOption.parent()) unknownOption.remove(); selectElement.val(viewValue); if (viewValue === '') emptyOption.prop('selected', true); // to make IE9 happy } else { if (isUndefined(viewValue) && emptyOption) { selectElement.val(''); } else { selectCtrl.renderUnknownOption(viewValue); } } }; selectElement.bind('change', function() { scope.$apply(function() { if (unknownOption.parent()) unknownOption.remove(); ngModelCtrl.$setViewValue(selectElement.val()); }); }); } function Multiple(scope, selectElement, ctrl) { var lastView; ctrl.$render = function() { var items = new HashMap(ctrl.$viewValue); forEach(selectElement.find('option'), function(option) { option.selected = isDefined(items.get(option.value)); }); }; // we have to do it on each watch since ngModel watches reference, but // we need to work of an array, so we need to see if anything was inserted/removed scope.$watch(function selectMultipleWatch() { if (!equals(lastView, ctrl.$viewValue)) { lastView = copy(ctrl.$viewValue); ctrl.$render(); } }); selectElement.bind('change', function() { scope.$apply(function() { var array = []; forEach(selectElement.find('option'), function(option) { if (option.selected) { array.push(option.value); } }); ctrl.$setViewValue(array); }); }); } function Options(scope, selectElement, ctrl) { var match; if (! (match = optionsExp.match(NG_OPTIONS_REGEXP))) { throw Error( "Expected ngOptions in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_ (track by _expr_)?'" + " but got '" + optionsExp + "'."); } var displayFn = $parse(match[2] || match[1]), valueName = match[4] || match[6], keyName = match[5], groupByFn = $parse(match[3] || ''), valueFn = $parse(match[2] ? match[1] : valueName), valuesFn = $parse(match[7]), track = match[8], trackFn = track ? $parse(match[8]) : null, // This is an array of array of existing option groups in DOM. We try to reuse these if possible // optionGroupsCache[0] is the options with no option group // optionGroupsCache[?][0] is the parent: either the SELECT or OPTGROUP element optionGroupsCache = [[{element: selectElement, label:''}]]; if (nullOption) { // compile the element since there might be bindings in it $compile(nullOption)(scope); // remove the class, which is added automatically because we recompile the element and it // becomes the compilation root nullOption.removeClass('ng-scope'); // we need to remove it before calling selectElement.html('') because otherwise IE will // remove the label from the element. wtf? nullOption.remove(); } // clear contents, we'll add what's needed based on the model selectElement.html(''); selectElement.bind('change', function() { scope.$apply(function() { var optionGroup, collection = valuesFn(scope) || [], locals = {}, key, value, optionElement, index, groupIndex, length, groupLength; if (multiple) { value = []; for (groupIndex = 0, groupLength = optionGroupsCache.length; groupIndex < groupLength; groupIndex++) { // list of options for that group. (first item has the parent) optionGroup = optionGroupsCache[groupIndex]; for(index = 1, length = optionGroup.length; index < length; index++) { if ((optionElement = optionGroup[index].element)[0].selected) { key = optionElement.val(); if (keyName) locals[keyName] = key; if (trackFn) { for (var trackIndex = 0; trackIndex < collection.length; trackIndex++) { locals[valueName] = collection[trackIndex]; if (trackFn(scope, locals) == key) break; } } else { locals[valueName] = collection[key]; } value.push(valueFn(scope, locals)); } } } } else { key = selectElement.val(); if (key == '?') { value = undefined; } else if (key == ''){ value = null; } else { if (trackFn) { for (var trackIndex = 0; trackIndex < collection.length; trackIndex++) { locals[valueName] = collection[trackIndex]; if (trackFn(scope, locals) == key) { value = valueFn(scope, locals); break; } } } else { locals[valueName] = collection[key]; if (keyName) locals[keyName] = key; value = valueFn(scope, locals); } } } ctrl.$setViewValue(value); }); }); ctrl.$render = render; // TODO(vojta): can't we optimize this ? scope.$watch(render); function render() { var optionGroups = {'':[]}, // Temporary location for the option groups before we render them optionGroupNames = [''], optionGroupName, optionGroup, option, existingParent, existingOptions, existingOption, modelValue = ctrl.$modelValue, values = valuesFn(scope) || [], keys = keyName ? sortedKeys(values) : values, groupLength, length, groupIndex, index, locals = {}, selected, selectedSet = false, // nothing is selected yet lastElement, element, label; if (multiple) { if (trackFn && isArray(modelValue)) { selectedSet = new HashMap([]); for (var trackIndex = 0; trackIndex < modelValue.length; trackIndex++) { locals[valueName] = modelValue[trackIndex]; selectedSet.put(trackFn(scope, locals), modelValue[trackIndex]); } } else { selectedSet = new HashMap(modelValue); } } // We now build up the list of options we need (we merge later) for (index = 0; length = keys.length, index < length; index++) { locals[valueName] = values[keyName ? locals[keyName]=keys[index]:index]; optionGroupName = groupByFn(scope, locals) || ''; if (!(optionGroup = optionGroups[optionGroupName])) { optionGroup = optionGroups[optionGroupName] = []; optionGroupNames.push(optionGroupName); } if (multiple) { selected = selectedSet.remove(trackFn ? trackFn(scope, locals) : valueFn(scope, locals)) != undefined; } else { if (trackFn) { var modelCast = {}; modelCast[valueName] = modelValue; selected = trackFn(scope, modelCast) === trackFn(scope, locals); } else { selected = modelValue === valueFn(scope, locals); } selectedSet = selectedSet || selected; // see if at least one item is selected } label = displayFn(scope, locals); // what will be seen by the user label = label === undefined ? '' : label; // doing displayFn(scope, locals) || '' overwrites zero values optionGroup.push({ id: trackFn ? trackFn(scope, locals) : (keyName ? keys[index] : index), // either the index into array or key from object label: label, selected: selected // determine if we should be selected }); } if (!multiple) { if (nullOption || modelValue === null) { // insert null option if we have a placeholder, or the model is null optionGroups[''].unshift({id:'', label:'', selected:!selectedSet}); } else if (!selectedSet) { // option could not be found, we have to insert the undefined item optionGroups[''].unshift({id:'?', label:'', selected:true}); } } // Now we need to update the list of DOM nodes to match the optionGroups we computed above for (groupIndex = 0, groupLength = optionGroupNames.length; groupIndex < groupLength; groupIndex++) { // current option group name or '' if no group optionGroupName = optionGroupNames[groupIndex]; // list of options for that group. (first item has the parent) optionGroup = optionGroups[optionGroupName]; if (optionGroupsCache.length <= groupIndex) { // we need to grow the optionGroups existingParent = { element: optGroupTemplate.clone().attr('label', optionGroupName), label: optionGroup.label }; existingOptions = [existingParent]; optionGroupsCache.push(existingOptions); selectElement.append(existingParent.element); } else { existingOptions = optionGroupsCache[groupIndex]; existingParent = existingOptions[0]; // either SELECT (no group) or OPTGROUP element // update the OPTGROUP label if not the same. if (existingParent.label != optionGroupName) { existingParent.element.attr('label', existingParent.label = optionGroupName); } } lastElement = null; // start at the beginning for(index = 0, length = optionGroup.length; index < length; index++) { option = optionGroup[index]; if ((existingOption = existingOptions[index+1])) { // reuse elements lastElement = existingOption.element; if (existingOption.label !== option.label) { lastElement.text(existingOption.label = option.label); } if (existingOption.id !== option.id) { lastElement.val(existingOption.id = option.id); } // lastElement.prop('selected') provided by jQuery has side-effects if (lastElement[0].selected !== option.selected) { lastElement.prop('selected', (existingOption.selected = option.selected)); } } else { // grow elements // if it's a null option if (option.id === '' && nullOption) { // put back the pre-compiled element element = nullOption; } else { // jQuery(v1.4.2) Bug: We should be able to chain the method calls, but // in this version of jQuery on some browser the .text() returns a string // rather then the element. (element = optionTemplate.clone()) .val(option.id) .attr('selected', option.selected) .text(option.label); } existingOptions.push(existingOption = { element: element, label: option.label, id: option.id, selected: option.selected }); if (lastElement) { lastElement.after(element); } else { existingParent.element.append(element); } lastElement = element; } } // remove any excessive OPTIONs in a group index++; // increment since the existingOptions[0] is parent element not OPTION while(existingOptions.length > index) { existingOptions.pop().element.remove(); } } // remove any excessive OPTGROUPs from select while(optionGroupsCache.length > groupIndex) { optionGroupsCache.pop()[0].element.remove(); } } } } } }]; var optionDirective = ['$interpolate', function($interpolate) { var nullSelectCtrl = { addOption: noop, removeOption: noop }; return { restrict: 'E', priority: 100, compile: function(element, attr) { if (isUndefined(attr.value)) { var interpolateFn = $interpolate(element.text(), true); if (!interpolateFn) { attr.$set('value', element.text()); } } return function (scope, element, attr) { var selectCtrlName = '$selectController', parent = element.parent(), selectCtrl = parent.data(selectCtrlName) || parent.parent().data(selectCtrlName); // in case we are in optgroup if (selectCtrl && selectCtrl.databound) { // For some reason Opera defaults to true and if not overridden this messes up the repeater. // We don't want the view to drive the initialization of the model anyway. element.prop('selected', false); } else { selectCtrl = nullSelectCtrl; } if (interpolateFn) { scope.$watch(interpolateFn, function interpolateWatchAction(newVal, oldVal) { attr.$set('value', newVal); if (newVal !== oldVal) selectCtrl.removeOption(oldVal); selectCtrl.addOption(newVal); }); } else { selectCtrl.addOption(attr.value); } element.bind('$destroy', function() { selectCtrl.removeOption(attr.value); }); }; } } }]; var styleDirective = valueFn({ restrict: 'E', terminal: true }); /** * Setup file for the Scenario. * Must be first in the compilation/bootstrap list. */ // Public namespace angular.scenario = angular.scenario || {}; /** * Defines a new output format. * * @param {string} name the name of the new output format * @param {function()} fn function(context, runner) that generates the output */ angular.scenario.output = angular.scenario.output || function(name, fn) { angular.scenario.output[name] = fn; }; /** * Defines a new DSL statement. If your factory function returns a Future * it's returned, otherwise the result is assumed to be a map of functions * for chaining. Chained functions are subject to the same rules. * * Note: All functions on the chain are bound to the chain scope so values * set on "this" in your statement function are available in the chained * functions. * * @param {string} name The name of the statement * @param {function()} fn Factory function(), return a function for * the statement. */ angular.scenario.dsl = angular.scenario.dsl || function(name, fn) { angular.scenario.dsl[name] = function() { function executeStatement(statement, args) { var result = statement.apply(this, args); if (angular.isFunction(result) || result instanceof angular.scenario.Future) return result; var self = this; var chain = angular.extend({}, result); angular.forEach(chain, function(value, name) { if (angular.isFunction(value)) { chain[name] = function() { return executeStatement.call(self, value, arguments); }; } else { chain[name] = value; } }); return chain; } var statement = fn.apply(this, arguments); return function() { return executeStatement.call(this, statement, arguments); }; }; }; /** * Defines a new matcher for use with the expects() statement. The value * this.actual (like in Jasmine) is available in your matcher to compare * against. Your function should return a boolean. The future is automatically * created for you. * * @param {string} name The name of the matcher * @param {function()} fn The matching function(expected). */ angular.scenario.matcher = angular.scenario.matcher || function(name, fn) { angular.scenario.matcher[name] = function(expected) { var prefix = 'expect ' + this.future.name + ' '; if (this.inverse) { prefix += 'not '; } var self = this; this.addFuture(prefix + name + ' ' + angular.toJson(expected), function(done) { var error; self.actual = self.future.value; if ((self.inverse && fn.call(self, expected)) || (!self.inverse && !fn.call(self, expected))) { error = 'expected ' + angular.toJson(expected) + ' but was ' + angular.toJson(self.actual); } done(error); }); }; }; /** * Initialize the scenario runner and run ! * * Access global window and document object * Access $runner through closure * * @param {Object=} config Config options */ angular.scenario.setUpAndRun = function(config) { var href = window.location.href; var body = _jQuery(document.body); var output = []; var objModel = new angular.scenario.ObjectModel($runner); if (config && config.scenario_output) { output = config.scenario_output.split(','); } angular.forEach(angular.scenario.output, function(fn, name) { if (!output.length || indexOf(output,name) != -1) { var context = body.append('<div></div>').find('div:last'); context.attr('id', name); fn.call({}, context, $runner, objModel); } }); if (!/^http/.test(href) && !/^https/.test(href)) { body.append('<p id="system-error"></p>'); body.find('#system-error').text( 'Scenario runner must be run using http or https. The protocol ' + href.split(':')[0] + ':// is not supported.' ); return; } var appFrame = body.append('<div id="application"></div>').find('#application'); var application = new angular.scenario.Application(appFrame); $runner.on('RunnerEnd', function() { appFrame.css('display', 'none'); appFrame.find('iframe').attr('src', 'about:blank'); }); $runner.on('RunnerError', function(error) { if (window.console) { console.log(formatException(error)); } else { // Do something for IE alert(error); } }); $runner.run(application); }; /** * Iterates through list with iterator function that must call the * continueFunction to continue iterating. * * @param {Array} list list to iterate over * @param {function()} iterator Callback function(value, continueFunction) * @param {function()} done Callback function(error, result) called when * iteration finishes or an error occurs. */ function asyncForEach(list, iterator, done) { var i = 0; function loop(error, index) { if (index && index > i) { i = index; } if (error || i >= list.length) { done(error); } else { try { iterator(list[i++], loop); } catch (e) { done(e); } } } loop(); } /** * Formats an exception into a string with the stack trace, but limits * to a specific line length. * * @param {Object} error The exception to format, can be anything throwable * @param {Number=} [maxStackLines=5] max lines of the stack trace to include * default is 5. */ function formatException(error, maxStackLines) { maxStackLines = maxStackLines || 5; var message = error.toString(); if (error.stack) { var stack = error.stack.split('\n'); if (stack[0].indexOf(message) === -1) { maxStackLines++; stack.unshift(error.message); } message = stack.slice(0, maxStackLines).join('\n'); } return message; } /** * Returns a function that gets the file name and line number from a * location in the stack if available based on the call site. * * Note: this returns another function because accessing .stack is very * expensive in Chrome. * * @param {Number} offset Number of stack lines to skip */ function callerFile(offset) { var error = new Error(); return function() { var line = (error.stack || '').split('\n')[offset]; // Clean up the stack trace line if (line) { if (line.indexOf('@') !== -1) { // Firefox line = line.substring(line.indexOf('@')+1); } else { // Chrome line = line.substring(line.indexOf('(')+1).replace(')', ''); } } return line || ''; }; } /** * Don't use the jQuery trigger method since it works incorrectly. * * jQuery notifies listeners and then changes the state of a checkbox and * does not create a real browser event. A real click changes the state of * the checkbox and then notifies listeners. * * To work around this we instead use our own handler that fires a real event. */ (function(fn){ var parentTrigger = fn.trigger; fn.trigger = function(type) { if (/(click|change|keydown|blur|input|mousedown|mouseup)/.test(type)) { var processDefaults = []; this.each(function(index, node) { processDefaults.push(browserTrigger(node, type)); }); // this is not compatible with jQuery - we return an array of returned values, // so that scenario runner know whether JS code has preventDefault() of the event or not... return processDefaults; } return parentTrigger.apply(this, arguments); }; })(_jQuery.fn); /** * Finds all bindings with the substring match of name and returns an * array of their values. * * @param {string} bindExp The name to match * @return {Array.<string>} String of binding values */ _jQuery.fn.bindings = function(windowJquery, bindExp) { var result = [], match, bindSelector = '.ng-binding:visible'; if (angular.isString(bindExp)) { bindExp = bindExp.replace(/\s/g, ''); match = function (actualExp) { if (actualExp) { actualExp = actualExp.replace(/\s/g, ''); if (actualExp == bindExp) return true; if (actualExp.indexOf(bindExp) == 0) { return actualExp.charAt(bindExp.length) == '|'; } } } } else if (bindExp) { match = function(actualExp) { return actualExp && bindExp.exec(actualExp); } } else { match = function(actualExp) { return !!actualExp; }; } var selection = this.find(bindSelector); if (this.is(bindSelector)) { selection = selection.add(this); } function push(value) { if (value == undefined) { value = ''; } else if (typeof value != 'string') { value = angular.toJson(value); } result.push('' + value); } selection.each(function() { var element = windowJquery(this), binding; if (binding = element.data('$binding')) { if (typeof binding == 'string') { if (match(binding)) { push(element.scope().$eval(binding)); } } else { if (!angular.isArray(binding)) { binding = [binding]; } for(var fns, j=0, jj=binding.length; j<jj; j++) { fns = binding[j]; if (fns.parts) { fns = fns.parts; } else { fns = [fns]; } for (var scope, fn, i = 0, ii = fns.length; i < ii; i++) { if(match((fn = fns[i]).exp)) { push(fn(scope = scope || element.scope())); } } } } } }); return result; }; (function() { var msie = parseInt((/msie (\d+)/.exec(navigator.userAgent.toLowerCase()) || [])[1], 10); function indexOf(array, obj) { if (array.indexOf) return array.indexOf(obj); for ( var i = 0; i < array.length; i++) { if (obj === array[i]) return i; } return -1; } /** * Triggers a browser event. Attempts to choose the right event if one is * not specified. * * @param {Object} element Either a wrapped jQuery/jqLite node or a DOMElement * @param {string} eventType Optional event type. * @param {Array.<string>=} keys Optional list of pressed keys * (valid values: 'alt', 'meta', 'shift', 'ctrl') * @param {number} x Optional x-coordinate for mouse/touch events. * @param {number} y Optional y-coordinate for mouse/touch events. */ window.browserTrigger = function browserTrigger(element, eventType, keys, x, y) { if (element && !element.nodeName) element = element[0]; if (!element) return; var inputType = (element.type) ? element.type.toLowerCase() : null, nodeName = element.nodeName.toLowerCase(); if (!eventType) { eventType = { 'text': 'change', 'textarea': 'change', 'hidden': 'change', 'password': 'change', 'button': 'click', 'submit': 'click', 'reset': 'click', 'image': 'click', 'checkbox': 'click', 'radio': 'click', 'select-one': 'change', 'select-multiple': 'change', '_default_': 'click' }[inputType || '_default_']; } if (nodeName == 'option') { element.parentNode.value = element.value; element = element.parentNode; eventType = 'change'; } keys = keys || []; function pressed(key) { return indexOf(keys, key) !== -1; } if (msie < 9) { if (inputType == 'radio' || inputType == 'checkbox') { element.checked = !element.checked; } // WTF!!! Error: Unspecified error. // Don't know why, but some elements when detached seem to be in inconsistent state and // calling .fireEvent() on them will result in very unhelpful error (Error: Unspecified error) // forcing the browser to compute the element position (by reading its CSS) // puts the element in consistent state. element.style.posLeft; // TODO(vojta): create event objects with pressed keys to get it working on IE<9 var ret = element.fireEvent('on' + eventType); if (inputType == 'submit') { while(element) { if (element.nodeName.toLowerCase() == 'form') { element.fireEvent('onsubmit'); break; } element = element.parentNode; } } return ret; } else { var evnt = document.createEvent('MouseEvents'), originalPreventDefault = evnt.preventDefault, appWindow = element.ownerDocument.defaultView, fakeProcessDefault = true, finalProcessDefault, angular = appWindow.angular || {}; // igor: temporary fix for https://bugzilla.mozilla.org/show_bug.cgi?id=684208 angular['ff-684208-preventDefault'] = false; evnt.preventDefault = function() { fakeProcessDefault = false; return originalPreventDefault.apply(evnt, arguments); }; x = x || 0; y = y || 0; evnt.initMouseEvent(eventType, true, true, window, 0, x, y, x, y, pressed('ctrl'), pressed('alt'), pressed('shift'), pressed('meta'), 0, element); element.dispatchEvent(evnt); finalProcessDefault = !(angular['ff-684208-preventDefault'] || !fakeProcessDefault); delete angular['ff-684208-preventDefault']; return finalProcessDefault; } } }()); /** * Represents the application currently being tested and abstracts usage * of iframes or separate windows. * * @param {Object} context jQuery wrapper around HTML context. */ angular.scenario.Application = function(context) { this.context = context; context.append( '<h2>Current URL: <a href="about:blank">None</a></h2>' + '<div id="test-frames"></div>' ); }; /** * Gets the jQuery collection of frames. Don't use this directly because * frames may go stale. * * @private * @return {Object} jQuery collection */ angular.scenario.Application.prototype.getFrame_ = function() { return this.context.find('#test-frames iframe:last'); }; /** * Gets the window of the test runner frame. Always favor executeAction() * instead of this method since it prevents you from getting a stale window. * * @private * @return {Object} the window of the frame */ angular.scenario.Application.prototype.getWindow_ = function() { var contentWindow = this.getFrame_().prop('contentWindow'); if (!contentWindow) throw 'Frame window is not accessible.'; return contentWindow; }; /** * Changes the location of the frame. * * @param {string} url The URL. If it begins with a # then only the * hash of the page is changed. * @param {function()} loadFn function($window, $document) Called when frame loads. * @param {function()} errorFn function(error) Called if any error when loading. */ angular.scenario.Application.prototype.navigateTo = function(url, loadFn, errorFn) { var self = this; var frame = self.getFrame_(); //TODO(esprehn): Refactor to use rethrow() errorFn = errorFn || function(e) { throw e; }; if (url === 'about:blank') { errorFn('Sandbox Error: Navigating to about:blank is not allowed.'); } else if (url.charAt(0) === '#') { url = frame.attr('src').split('#')[0] + url; frame.attr('src', url); self.executeAction(loadFn); } else { frame.remove(); self.context.find('#test-frames').append('<iframe>'); frame = self.getFrame_(); frame.load(function() { frame.unbind(); try { var $window = self.getWindow_(); if ($window.angular) { // Disable animations // TODO(i): this doesn't disable javascript animations // we don't need that for our tests, but it should be done $window.angular.resumeBootstrap([['$provide', function($provide) { $provide.decorator('$sniffer', function($delegate) { $delegate.transitions = false; $delegate.animations = false; return $delegate; }); }]]); } self.executeAction(loadFn); } catch (e) { errorFn(e); } }).attr('src', url); // for IE compatibility set the name *after* setting the frame url frame[0].contentWindow.name = "NG_DEFER_BOOTSTRAP!"; } self.context.find('> h2 a').attr('href', url).text(url); }; /** * Executes a function in the context of the tested application. Will wait * for all pending angular xhr requests before executing. * * @param {function()} action The callback to execute. function($window, $document) * $document is a jQuery wrapped document. */ angular.scenario.Application.prototype.executeAction = function(action) { var self = this; var $window = this.getWindow_(); if (!$window.document) { throw 'Sandbox Error: Application document not accessible.'; } if (!$window.angular) { return action.call(this, $window, _jQuery($window.document)); } angularInit($window.document, function(element) { var $injector = $window.angular.element(element).injector(); var $element = _jQuery(element); $element.injector = function() { return $injector; }; $injector.invoke(function($browser){ $browser.notifyWhenNoOutstandingRequests(function() { action.call(self, $window, $element); }); }); }); }; /** * The representation of define blocks. Don't used directly, instead use * define() in your tests. * * @param {string} descName Name of the block * @param {Object} parent describe or undefined if the root. */ angular.scenario.Describe = function(descName, parent) { this.only = parent && parent.only; this.beforeEachFns = []; this.afterEachFns = []; this.its = []; this.children = []; this.name = descName; this.parent = parent; this.id = angular.scenario.Describe.id++; /** * Calls all before functions. */ var beforeEachFns = this.beforeEachFns; this.setupBefore = function() { if (parent) parent.setupBefore.call(this); angular.forEach(beforeEachFns, function(fn) { fn.call(this); }, this); }; /** * Calls all after functions. */ var afterEachFns = this.afterEachFns; this.setupAfter = function() { angular.forEach(afterEachFns, function(fn) { fn.call(this); }, this); if (parent) parent.setupAfter.call(this); }; }; // Shared Unique ID generator for every describe block angular.scenario.Describe.id = 0; // Shared Unique ID generator for every it (spec) angular.scenario.Describe.specId = 0; /** * Defines a block to execute before each it or nested describe. * * @param {function()} body Body of the block. */ angular.scenario.Describe.prototype.beforeEach = function(body) { this.beforeEachFns.push(body); }; /** * Defines a block to execute after each it or nested describe. * * @param {function()} body Body of the block. */ angular.scenario.Describe.prototype.afterEach = function(body) { this.afterEachFns.push(body); }; /** * Creates a new describe block that's a child of this one. * * @param {string} name Name of the block. Appended to the parent block's name. * @param {function()} body Body of the block. */ angular.scenario.Describe.prototype.describe = function(name, body) { var child = new angular.scenario.Describe(name, this); this.children.push(child); body.call(child); }; /** * Same as describe() but makes ddescribe blocks the only to run. * * @param {string} name Name of the test. * @param {function()} body Body of the block. */ angular.scenario.Describe.prototype.ddescribe = function(name, body) { var child = new angular.scenario.Describe(name, this); child.only = true; this.children.push(child); body.call(child); }; /** * Use to disable a describe block. */ angular.scenario.Describe.prototype.xdescribe = angular.noop; /** * Defines a test. * * @param {string} name Name of the test. * @param {function()} vody Body of the block. */ angular.scenario.Describe.prototype.it = function(name, body) { this.its.push({ id: angular.scenario.Describe.specId++, definition: this, only: this.only, name: name, before: this.setupBefore, body: body, after: this.setupAfter }); }; /** * Same as it() but makes iit tests the only test to run. * * @param {string} name Name of the test. * @param {function()} body Body of the block. */ angular.scenario.Describe.prototype.iit = function(name, body) { this.it.apply(this, arguments); this.its[this.its.length-1].only = true; }; /** * Use to disable a test block. */ angular.scenario.Describe.prototype.xit = angular.noop; /** * Gets an array of functions representing all the tests (recursively). * that can be executed with SpecRunner's. * * @return {Array<Object>} Array of it blocks { * definition : Object // parent Describe * only: boolean * name: string * before: Function * body: Function * after: Function * } */ angular.scenario.Describe.prototype.getSpecs = function() { var specs = arguments[0] || []; angular.forEach(this.children, function(child) { child.getSpecs(specs); }); angular.forEach(this.its, function(it) { specs.push(it); }); var only = []; angular.forEach(specs, function(it) { if (it.only) { only.push(it); } }); return (only.length && only) || specs; }; /** * A future action in a spec. * * @param {string} name of the future action * @param {function()} future callback(error, result) * @param {function()} Optional. function that returns the file/line number. */ angular.scenario.Future = function(name, behavior, line) { this.name = name; this.behavior = behavior; this.fulfilled = false; this.value = undefined; this.parser = angular.identity; this.line = line || function() { return ''; }; }; /** * Executes the behavior of the closure. * * @param {function()} doneFn Callback function(error, result) */ angular.scenario.Future.prototype.execute = function(doneFn) { var self = this; this.behavior(function(error, result) { self.fulfilled = true; if (result) { try { result = self.parser(result); } catch(e) { error = e; } } self.value = error || result; doneFn(error, result); }); }; /** * Configures the future to convert it's final with a function fn(value) * * @param {function()} fn function(value) that returns the parsed value */ angular.scenario.Future.prototype.parsedWith = function(fn) { this.parser = fn; return this; }; /** * Configures the future to parse it's final value from JSON * into objects. */ angular.scenario.Future.prototype.fromJson = function() { return this.parsedWith(angular.fromJson); }; /** * Configures the future to convert it's final value from objects * into JSON. */ angular.scenario.Future.prototype.toJson = function() { return this.parsedWith(angular.toJson); }; /** * Maintains an object tree from the runner events. * * @param {Object} runner The scenario Runner instance to connect to. * * TODO(esprehn): Every output type creates one of these, but we probably * want one global shared instance. Need to handle events better too * so the HTML output doesn't need to do spec model.getSpec(spec.id) * silliness. * * TODO(vojta) refactor on, emit methods (from all objects) - use inheritance */ angular.scenario.ObjectModel = function(runner) { var self = this; this.specMap = {}; this.listeners = []; this.value = { name: '', children: {} }; runner.on('SpecBegin', function(spec) { var block = self.value, definitions = []; angular.forEach(self.getDefinitionPath(spec), function(def) { if (!block.children[def.name]) { block.children[def.name] = { id: def.id, name: def.name, children: {}, specs: {} }; } block = block.children[def.name]; definitions.push(def.name); }); var it = self.specMap[spec.id] = block.specs[spec.name] = new angular.scenario.ObjectModel.Spec(spec.id, spec.name, definitions); // forward the event self.emit('SpecBegin', it); }); runner.on('SpecError', function(spec, error) { var it = self.getSpec(spec.id); it.status = 'error'; it.error = error; // forward the event self.emit('SpecError', it, error); }); runner.on('SpecEnd', function(spec) { var it = self.getSpec(spec.id); complete(it); // forward the event self.emit('SpecEnd', it); }); runner.on('StepBegin', function(spec, step) { var it = self.getSpec(spec.id); var step = new angular.scenario.ObjectModel.Step(step.name); it.steps.push(step); // forward the event self.emit('StepBegin', it, step); }); runner.on('StepEnd', function(spec) { var it = self.getSpec(spec.id); var step = it.getLastStep(); if (step.name !== step.name) throw 'Events fired in the wrong order. Step names don\'t match.'; complete(step); // forward the event self.emit('StepEnd', it, step); }); runner.on('StepFailure', function(spec, step, error) { var it = self.getSpec(spec.id), modelStep = it.getLastStep(); modelStep.setErrorStatus('failure', error, step.line()); it.setStatusFromStep(modelStep); // forward the event self.emit('StepFailure', it, modelStep, error); }); runner.on('StepError', function(spec, step, error) { var it = self.getSpec(spec.id), modelStep = it.getLastStep(); modelStep.setErrorStatus('error', error, step.line()); it.setStatusFromStep(modelStep); // forward the event self.emit('StepError', it, modelStep, error); }); runner.on('RunnerBegin', function() { self.emit('RunnerBegin'); }); runner.on('RunnerEnd', function() { self.emit('RunnerEnd'); }); function complete(item) { item.endTime = new Date().getTime(); item.duration = item.endTime - item.startTime; item.status = item.status || 'success'; } }; /** * Adds a listener for an event. * * @param {string} eventName Name of the event to add a handler for * @param {function()} listener Function that will be called when event is fired */ angular.scenario.ObjectModel.prototype.on = function(eventName, listener) { eventName = eventName.toLowerCase(); this.listeners[eventName] = this.listeners[eventName] || []; this.listeners[eventName].push(listener); }; /** * Emits an event which notifies listeners and passes extra * arguments. * * @param {string} eventName Name of the event to fire. */ angular.scenario.ObjectModel.prototype.emit = function(eventName) { var self = this, args = Array.prototype.slice.call(arguments, 1), eventName = eventName.toLowerCase(); if (this.listeners[eventName]) { angular.forEach(this.listeners[eventName], function(listener) { listener.apply(self, args); }); } }; /** * Computes the path of definition describe blocks that wrap around * this spec. * * @param spec Spec to compute the path for. * @return {Array<Describe>} The describe block path */ angular.scenario.ObjectModel.prototype.getDefinitionPath = function(spec) { var path = []; var currentDefinition = spec.definition; while (currentDefinition && currentDefinition.name) { path.unshift(currentDefinition); currentDefinition = currentDefinition.parent; } return path; }; /** * Gets a spec by id. * * @param {string} The id of the spec to get the object for. * @return {Object} the Spec instance */ angular.scenario.ObjectModel.prototype.getSpec = function(id) { return this.specMap[id]; }; /** * A single it block. * * @param {string} id Id of the spec * @param {string} name Name of the spec * @param {Array<string>=} definitionNames List of all describe block names that wrap this spec */ angular.scenario.ObjectModel.Spec = function(id, name, definitionNames) { this.id = id; this.name = name; this.startTime = new Date().getTime(); this.steps = []; this.fullDefinitionName = (definitionNames || []).join(' '); }; /** * Adds a new step to the Spec. * * @param {string} step Name of the step (really name of the future) * @return {Object} the added step */ angular.scenario.ObjectModel.Spec.prototype.addStep = function(name) { var step = new angular.scenario.ObjectModel.Step(name); this.steps.push(step); return step; }; /** * Gets the most recent step. * * @return {Object} the step */ angular.scenario.ObjectModel.Spec.prototype.getLastStep = function() { return this.steps[this.steps.length-1]; }; /** * Set status of the Spec from given Step * * @param {angular.scenario.ObjectModel.Step} step */ angular.scenario.ObjectModel.Spec.prototype.setStatusFromStep = function(step) { if (!this.status || step.status == 'error') { this.status = step.status; this.error = step.error; this.line = step.line; } }; /** * A single step inside a Spec. * * @param {string} step Name of the step */ angular.scenario.ObjectModel.Step = function(name) { this.name = name; this.startTime = new Date().getTime(); }; /** * Helper method for setting all error status related properties * * @param {string} status * @param {string} error * @param {string} line */ angular.scenario.ObjectModel.Step.prototype.setErrorStatus = function(status, error, line) { this.status = status; this.error = error; this.line = line; }; /** * Runner for scenarios * * Has to be initialized before any test is loaded, * because it publishes the API into window (global space). */ angular.scenario.Runner = function($window) { this.listeners = []; this.$window = $window; this.rootDescribe = new angular.scenario.Describe(); this.currentDescribe = this.rootDescribe; this.api = { it: this.it, iit: this.iit, xit: angular.noop, describe: this.describe, ddescribe: this.ddescribe, xdescribe: angular.noop, beforeEach: this.beforeEach, afterEach: this.afterEach }; angular.forEach(this.api, angular.bind(this, function(fn, key) { this.$window[key] = angular.bind(this, fn); })); }; /** * Emits an event which notifies listeners and passes extra * arguments. * * @param {string} eventName Name of the event to fire. */ angular.scenario.Runner.prototype.emit = function(eventName) { var self = this; var args = Array.prototype.slice.call(arguments, 1); eventName = eventName.toLowerCase(); if (!this.listeners[eventName]) return; angular.forEach(this.listeners[eventName], function(listener) { listener.apply(self, args); }); }; /** * Adds a listener for an event. * * @param {string} eventName The name of the event to add a handler for * @param {string} listener The fn(...) that takes the extra arguments from emit() */ angular.scenario.Runner.prototype.on = function(eventName, listener) { eventName = eventName.toLowerCase(); this.listeners[eventName] = this.listeners[eventName] || []; this.listeners[eventName].push(listener); }; /** * Defines a describe block of a spec. * * @see Describe.js * * @param {string} name Name of the block * @param {function()} body Body of the block */ angular.scenario.Runner.prototype.describe = function(name, body) { var self = this; this.currentDescribe.describe(name, function() { var parentDescribe = self.currentDescribe; self.currentDescribe = this; try { body.call(this); } finally { self.currentDescribe = parentDescribe; } }); }; /** * Same as describe, but makes ddescribe the only blocks to run. * * @see Describe.js * * @param {string} name Name of the block * @param {function()} body Body of the block */ angular.scenario.Runner.prototype.ddescribe = function(name, body) { var self = this; this.currentDescribe.ddescribe(name, function() { var parentDescribe = self.currentDescribe; self.currentDescribe = this; try { body.call(this); } finally { self.currentDescribe = parentDescribe; } }); }; /** * Defines a test in a describe block of a spec. * * @see Describe.js * * @param {string} name Name of the block * @param {function()} body Body of the block */ angular.scenario.Runner.prototype.it = function(name, body) { this.currentDescribe.it(name, body); }; /** * Same as it, but makes iit tests the only tests to run. * * @see Describe.js * * @param {string} name Name of the block * @param {function()} body Body of the block */ angular.scenario.Runner.prototype.iit = function(name, body) { this.currentDescribe.iit(name, body); }; /** * Defines a function to be called before each it block in the describe * (and before all nested describes). * * @see Describe.js * * @param {function()} Callback to execute */ angular.scenario.Runner.prototype.beforeEach = function(body) { this.currentDescribe.beforeEach(body); }; /** * Defines a function to be called after each it block in the describe * (and before all nested describes). * * @see Describe.js * * @param {function()} Callback to execute */ angular.scenario.Runner.prototype.afterEach = function(body) { this.currentDescribe.afterEach(body); }; /** * Creates a new spec runner. * * @private * @param {Object} scope parent scope */ angular.scenario.Runner.prototype.createSpecRunner_ = function(scope) { var child = scope.$new(); var Cls = angular.scenario.SpecRunner; // Export all the methods to child scope manually as now we don't mess controllers with scopes // TODO(vojta): refactor scenario runner so that these objects are not tightly coupled as current for (var name in Cls.prototype) child[name] = angular.bind(child, Cls.prototype[name]); Cls.call(child); return child; }; /** * Runs all the loaded tests with the specified runner class on the * provided application. * * @param {angular.scenario.Application} application App to remote control. */ angular.scenario.Runner.prototype.run = function(application) { var self = this; var $root = angular.injector(['ng']).get('$rootScope'); angular.extend($root, this); angular.forEach(angular.scenario.Runner.prototype, function(fn, name) { $root[name] = angular.bind(self, fn); }); $root.application = application; $root.emit('RunnerBegin'); asyncForEach(this.rootDescribe.getSpecs(), function(spec, specDone) { var dslCache = {}; var runner = self.createSpecRunner_($root); angular.forEach(angular.scenario.dsl, function(fn, key) { dslCache[key] = fn.call($root); }); angular.forEach(angular.scenario.dsl, function(fn, key) { self.$window[key] = function() { var line = callerFile(3); var scope = runner.$new(); // Make the dsl accessible on the current chain scope.dsl = {}; angular.forEach(dslCache, function(fn, key) { scope.dsl[key] = function() { return dslCache[key].apply(scope, arguments); }; }); // Make these methods work on the current chain scope.addFuture = function() { Array.prototype.push.call(arguments, line); return angular.scenario.SpecRunner. prototype.addFuture.apply(scope, arguments); }; scope.addFutureAction = function() { Array.prototype.push.call(arguments, line); return angular.scenario.SpecRunner. prototype.addFutureAction.apply(scope, arguments); }; return scope.dsl[key].apply(scope, arguments); }; }); runner.run(spec, function() { runner.$destroy(); specDone.apply(this, arguments); }); }, function(error) { if (error) { self.emit('RunnerError', error); } self.emit('RunnerEnd'); }); }; /** * This class is the "this" of the it/beforeEach/afterEach method. * Responsibilities: * - "this" for it/beforeEach/afterEach * - keep state for single it/beforeEach/afterEach execution * - keep track of all of the futures to execute * - run single spec (execute each future) */ angular.scenario.SpecRunner = function() { this.futures = []; this.afterIndex = 0; }; /** * Executes a spec which is an it block with associated before/after functions * based on the describe nesting. * * @param {Object} spec A spec object * @param {function()} specDone function that is called when the spec finshes. Function(error, index) */ angular.scenario.SpecRunner.prototype.run = function(spec, specDone) { var self = this; this.spec = spec; this.emit('SpecBegin', spec); try { spec.before.call(this); spec.body.call(this); this.afterIndex = this.futures.length; spec.after.call(this); } catch (e) { this.emit('SpecError', spec, e); this.emit('SpecEnd', spec); specDone(); return; } var handleError = function(error, done) { if (self.error) { return done(); } self.error = true; done(null, self.afterIndex); }; asyncForEach( this.futures, function(future, futureDone) { self.step = future; self.emit('StepBegin', spec, future); try { future.execute(function(error) { if (error) { self.emit('StepFailure', spec, future, error); self.emit('StepEnd', spec, future); return handleError(error, futureDone); } self.emit('StepEnd', spec, future); self.$window.setTimeout(function() { futureDone(); }, 0); }); } catch (e) { self.emit('StepError', spec, future, e); self.emit('StepEnd', spec, future); handleError(e, futureDone); } }, function(e) { if (e) { self.emit('SpecError', spec, e); } self.emit('SpecEnd', spec); // Call done in a timeout so exceptions don't recursively // call this function self.$window.setTimeout(function() { specDone(); }, 0); } ); }; /** * Adds a new future action. * * Note: Do not pass line manually. It happens automatically. * * @param {string} name Name of the future * @param {function()} behavior Behavior of the future * @param {function()} line fn() that returns file/line number */ angular.scenario.SpecRunner.prototype.addFuture = function(name, behavior, line) { var future = new angular.scenario.Future(name, angular.bind(this, behavior), line); this.futures.push(future); return future; }; /** * Adds a new future action to be executed on the application window. * * Note: Do not pass line manually. It happens automatically. * * @param {string} name Name of the future * @param {function()} behavior Behavior of the future * @param {function()} line fn() that returns file/line number */ angular.scenario.SpecRunner.prototype.addFutureAction = function(name, behavior, line) { var self = this; var NG = /\[ng\\\:/; return this.addFuture(name, function(done) { this.application.executeAction(function($window, $document) { //TODO(esprehn): Refactor this so it doesn't need to be in here. $document.elements = function(selector) { var args = Array.prototype.slice.call(arguments, 1); selector = (self.selector || '') + ' ' + (selector || ''); selector = _jQuery.trim(selector) || '*'; angular.forEach(args, function(value, index) { selector = selector.replace('$' + (index + 1), value); }); var result = $document.find(selector); if (selector.match(NG)) { angular.forEach(['[ng-','[data-ng-','[x-ng-'], function(value, index){ result = result.add(selector.replace(NG, value), $document); }); } if (!result.length) { throw { type: 'selector', message: 'Selector ' + selector + ' did not match any elements.' }; } return result; }; try { behavior.call(self, $window, $document, done); } catch(e) { if (e.type && e.type === 'selector') { done(e.message); } else { throw e; } } }); }, line); }; /** * Shared DSL statements that are useful to all scenarios. */ /** * Usage: * pause() pauses until you call resume() in the console */ angular.scenario.dsl('pause', function() { return function() { return this.addFuture('pausing for you to resume', function(done) { this.emit('InteractivePause', this.spec, this.step); this.$window.resume = function() { done(); }; }); }; }); /** * Usage: * sleep(seconds) pauses the test for specified number of seconds */ angular.scenario.dsl('sleep', function() { return function(time) { return this.addFuture('sleep for ' + time + ' seconds', function(done) { this.$window.setTimeout(function() { done(null, time * 1000); }, time * 1000); }); }; }); /** * Usage: * browser().navigateTo(url) Loads the url into the frame * browser().navigateTo(url, fn) where fn(url) is called and returns the URL to navigate to * browser().reload() refresh the page (reload the same URL) * browser().window.href() window.location.href * browser().window.path() window.location.pathname * browser().window.search() window.location.search * browser().window.hash() window.location.hash without # prefix * browser().location().url() see ng.$location#url * browser().location().path() see ng.$location#path * browser().location().search() see ng.$location#search * browser().location().hash() see ng.$location#hash */ angular.scenario.dsl('browser', function() { var chain = {}; chain.navigateTo = function(url, delegate) { var application = this.application; return this.addFuture("browser navigate to '" + url + "'", function(done) { if (delegate) { url = delegate.call(this, url); } application.navigateTo(url, function() { done(null, url); }, done); }); }; chain.reload = function() { var application = this.application; return this.addFutureAction('browser reload', function($window, $document, done) { var href = $window.location.href; application.navigateTo(href, function() { done(null, href); }, done); }); }; chain.window = function() { var api = {}; api.href = function() { return this.addFutureAction('window.location.href', function($window, $document, done) { done(null, $window.location.href); }); }; api.path = function() { return this.addFutureAction('window.location.path', function($window, $document, done) { done(null, $window.location.pathname); }); }; api.search = function() { return this.addFutureAction('window.location.search', function($window, $document, done) { done(null, $window.location.search); }); }; api.hash = function() { return this.addFutureAction('window.location.hash', function($window, $document, done) { done(null, $window.location.hash.replace('#', '')); }); }; return api; }; chain.location = function() { var api = {}; api.url = function() { return this.addFutureAction('$location.url()', function($window, $document, done) { done(null, $document.injector().get('$location').url()); }); }; api.path = function() { return this.addFutureAction('$location.path()', function($window, $document, done) { done(null, $document.injector().get('$location').path()); }); }; api.search = function() { return this.addFutureAction('$location.search()', function($window, $document, done) { done(null, $document.injector().get('$location').search()); }); }; api.hash = function() { return this.addFutureAction('$location.hash()', function($window, $document, done) { done(null, $document.injector().get('$location').hash()); }); }; return api; }; return function() { return chain; }; }); /** * Usage: * expect(future).{matcher} where matcher is one of the matchers defined * with angular.scenario.matcher * * ex. expect(binding("name")).toEqual("Elliott") */ angular.scenario.dsl('expect', function() { var chain = angular.extend({}, angular.scenario.matcher); chain.not = function() { this.inverse = true; return chain; }; return function(future) { this.future = future; return chain; }; }); /** * Usage: * using(selector, label) scopes the next DSL element selection * * ex. * using('#foo', "'Foo' text field").input('bar') */ angular.scenario.dsl('using', function() { return function(selector, label) { this.selector = _jQuery.trim((this.selector||'') + ' ' + selector); if (angular.isString(label) && label.length) { this.label = label + ' ( ' + this.selector + ' )'; } else { this.label = this.selector; } return this.dsl; }; }); /** * Usage: * binding(name) returns the value of the first matching binding */ angular.scenario.dsl('binding', function() { return function(name) { return this.addFutureAction("select binding '" + name + "'", function($window, $document, done) { var values = $document.elements().bindings($window.angular.element, name); if (!values.length) { return done("Binding selector '" + name + "' did not match."); } done(null, values[0]); }); }; }); /** * Usage: * input(name).enter(value) enters value in input with specified name * input(name).check() checks checkbox * input(name).select(value) selects the radio button with specified name/value * input(name).val() returns the value of the input. */ angular.scenario.dsl('input', function() { var chain = {}; var supportInputEvent = 'oninput' in document.createElement('div') && msie != 9; chain.enter = function(value, event) { return this.addFutureAction("input '" + this.name + "' enter '" + value + "'", function($window, $document, done) { var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':input'); input.val(value); input.trigger(event || (supportInputEvent ? 'input' : 'change')); done(); }); }; chain.check = function() { return this.addFutureAction("checkbox '" + this.name + "' toggle", function($window, $document, done) { var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':checkbox'); input.trigger('click'); done(); }); }; chain.select = function(value) { return this.addFutureAction("radio button '" + this.name + "' toggle '" + value + "'", function($window, $document, done) { var input = $document. elements('[ng\\:model="$1"][value="$2"]', this.name, value).filter(':radio'); input.trigger('click'); done(); }); }; chain.val = function() { return this.addFutureAction("return input val", function($window, $document, done) { var input = $document.elements('[ng\\:model="$1"]', this.name).filter(':input'); done(null,input.val()); }); }; return function(name) { this.name = name; return chain; }; }); /** * Usage: * repeater('#products table', 'Product List').count() number of rows * repeater('#products table', 'Product List').row(1) all bindings in row as an array * repeater('#products table', 'Product List').column('product.name') all values across all rows in an array */ angular.scenario.dsl('repeater', function() { var chain = {}; chain.count = function() { return this.addFutureAction("repeater '" + this.label + "' count", function($window, $document, done) { try { done(null, $document.elements().length); } catch (e) { done(null, 0); } }); }; chain.column = function(binding) { return this.addFutureAction("repeater '" + this.label + "' column '" + binding + "'", function($window, $document, done) { done(null, $document.elements().bindings($window.angular.element, binding)); }); }; chain.row = function(index) { return this.addFutureAction("repeater '" + this.label + "' row '" + index + "'", function($window, $document, done) { var matches = $document.elements().slice(index, index + 1); if (!matches.length) return done('row ' + index + ' out of bounds'); done(null, matches.bindings($window.angular.element)); }); }; return function(selector, label) { this.dsl.using(selector, label); return chain; }; }); /** * Usage: * select(name).option('value') select one option * select(name).options('value1', 'value2', ...) select options from a multi select */ angular.scenario.dsl('select', function() { var chain = {}; chain.option = function(value) { return this.addFutureAction("select '" + this.name + "' option '" + value + "'", function($window, $document, done) { var select = $document.elements('select[ng\\:model="$1"]', this.name); var option = select.find('option[value="' + value + '"]'); if (option.length) { select.val(value); } else { option = select.find('option:contains("' + value + '")'); if (option.length) { select.val(option.val()); } else { return done("option '" + value + "' not found"); } } select.trigger('change'); done(); }); }; chain.options = function() { var values = arguments; return this.addFutureAction("select '" + this.name + "' options '" + values + "'", function($window, $document, done) { var select = $document.elements('select[multiple][ng\\:model="$1"]', this.name); select.val(values); select.trigger('change'); done(); }); }; return function(name) { this.name = name; return chain; }; }); /** * Usage: * element(selector, label).count() get the number of elements that match selector * element(selector, label).click() clicks an element * element(selector, label).mouseover() mouseover an element * element(selector, label).mousedown() mousedown an element * element(selector, label).mouseup() mouseup an element * element(selector, label).query(fn) executes fn(selectedElements, done) * element(selector, label).{method}() gets the value (as defined by jQuery, ex. val) * element(selector, label).{method}(value) sets the value (as defined by jQuery, ex. val) * element(selector, label).{method}(key) gets the value (as defined by jQuery, ex. attr) * element(selector, label).{method}(key, value) sets the value (as defined by jQuery, ex. attr) */ angular.scenario.dsl('element', function() { var KEY_VALUE_METHODS = ['attr', 'css', 'prop']; var VALUE_METHODS = [ 'val', 'text', 'html', 'height', 'innerHeight', 'outerHeight', 'width', 'innerWidth', 'outerWidth', 'position', 'scrollLeft', 'scrollTop', 'offset' ]; var chain = {}; chain.count = function() { return this.addFutureAction("element '" + this.label + "' count", function($window, $document, done) { try { done(null, $document.elements().length); } catch (e) { done(null, 0); } }); }; chain.click = function() { return this.addFutureAction("element '" + this.label + "' click", function($window, $document, done) { var elements = $document.elements(); var href = elements.attr('href'); var eventProcessDefault = elements.trigger('click')[0]; if (href && elements[0].nodeName.toUpperCase() === 'A' && eventProcessDefault) { this.application.navigateTo(href, function() { done(); }, done); } else { done(); } }); }; chain.dblclick = function() { return this.addFutureAction("element '" + this.label + "' dblclick", function($window, $document, done) { var elements = $document.elements(); var href = elements.attr('href'); var eventProcessDefault = elements.trigger('dblclick')[0]; if (href && elements[0].nodeName.toUpperCase() === 'A' && eventProcessDefault) { this.application.navigateTo(href, function() { done(); }, done); } else { done(); } }); }; chain.mouseover = function() { return this.addFutureAction("element '" + this.label + "' mouseover", function($window, $document, done) { var elements = $document.elements(); elements.trigger('mouseover'); done(); }); }; chain.mousedown = function() { return this.addFutureAction("element '" + this.label + "' mousedown", function($window, $document, done) { var elements = $document.elements(); elements.trigger('mousedown'); done(); }); }; chain.mouseup = function() { return this.addFutureAction("element '" + this.label + "' mouseup", function($window, $document, done) { var elements = $document.elements(); elements.trigger('mouseup'); done(); }); }; chain.query = function(fn) { return this.addFutureAction('element ' + this.label + ' custom query', function($window, $document, done) { fn.call(this, $document.elements(), done); }); }; angular.forEach(KEY_VALUE_METHODS, function(methodName) { chain[methodName] = function(name, value) { var args = arguments, futureName = (args.length == 1) ? "element '" + this.label + "' get " + methodName + " '" + name + "'" : "element '" + this.label + "' set " + methodName + " '" + name + "' to " + "'" + value + "'"; return this.addFutureAction(futureName, function($window, $document, done) { var element = $document.elements(); done(null, element[methodName].apply(element, args)); }); }; }); angular.forEach(VALUE_METHODS, function(methodName) { chain[methodName] = function(value) { var args = arguments, futureName = (args.length == 0) ? "element '" + this.label + "' " + methodName : futureName = "element '" + this.label + "' set " + methodName + " to '" + value + "'"; return this.addFutureAction(futureName, function($window, $document, done) { var element = $document.elements(); done(null, element[methodName].apply(element, args)); }); }; }); return function(selector, label) { this.dsl.using(selector, label); return chain; }; }); /** * Matchers for implementing specs. Follows the Jasmine spec conventions. */ angular.scenario.matcher('toEqual', function(expected) { return angular.equals(this.actual, expected); }); angular.scenario.matcher('toBe', function(expected) { return this.actual === expected; }); angular.scenario.matcher('toBeDefined', function() { return angular.isDefined(this.actual); }); angular.scenario.matcher('toBeTruthy', function() { return this.actual; }); angular.scenario.matcher('toBeFalsy', function() { return !this.actual; }); angular.scenario.matcher('toMatch', function(expected) { return new RegExp(expected).test(this.actual); }); angular.scenario.matcher('toBeNull', function() { return this.actual === null; }); angular.scenario.matcher('toContain', function(expected) { return includes(this.actual, expected); }); angular.scenario.matcher('toBeLessThan', function(expected) { return this.actual < expected; }); angular.scenario.matcher('toBeGreaterThan', function(expected) { return this.actual > expected; }); /** * User Interface for the Scenario Runner. * * TODO(esprehn): This should be refactored now that ObjectModel exists * to use angular bindings for the UI. */ angular.scenario.output('html', function(context, runner, model) { var specUiMap = {}, lastStepUiMap = {}; context.append( '<div id="header">' + ' <h1><span class="angular">AngularJS</span>: Scenario Test Runner</h1>' + ' <ul id="status-legend" class="status-display">' + ' <li class="status-error">0 Errors</li>' + ' <li class="status-failure">0 Failures</li>' + ' <li class="status-success">0 Passed</li>' + ' </ul>' + '</div>' + '<div id="specs">' + ' <div class="test-children"></div>' + '</div>' ); runner.on('InteractivePause', function(spec) { var ui = lastStepUiMap[spec.id]; ui.find('.test-title'). html('paused... <a href="javascript:resume()">resume</a> when ready.'); }); runner.on('SpecBegin', function(spec) { var ui = findContext(spec); ui.find('> .tests').append( '<li class="status-pending test-it"></li>' ); ui = ui.find('> .tests li:last'); ui.append( '<div class="test-info">' + ' <p class="test-title">' + ' <span class="timer-result"></span>' + ' <span class="test-name"></span>' + ' </p>' + '</div>' + '<div class="scrollpane">' + ' <ol class="test-actions"></ol>' + '</div>' ); ui.find('> .test-info .test-name').text(spec.name); ui.find('> .test-info').click(function() { var scrollpane = ui.find('> .scrollpane'); var actions = scrollpane.find('> .test-actions'); var name = context.find('> .test-info .test-name'); if (actions.find(':visible').length) { actions.hide(); name.removeClass('open').addClass('closed'); } else { actions.show(); scrollpane.attr('scrollTop', scrollpane.attr('scrollHeight')); name.removeClass('closed').addClass('open'); } }); specUiMap[spec.id] = ui; }); runner.on('SpecError', function(spec, error) { var ui = specUiMap[spec.id]; ui.append('<pre></pre>'); ui.find('> pre').text(formatException(error)); }); runner.on('SpecEnd', function(spec) { var ui = specUiMap[spec.id]; spec = model.getSpec(spec.id); ui.removeClass('status-pending'); ui.addClass('status-' + spec.status); ui.find("> .test-info .timer-result").text(spec.duration + "ms"); if (spec.status === 'success') { ui.find('> .test-info .test-name').addClass('closed'); ui.find('> .scrollpane .test-actions').hide(); } updateTotals(spec.status); }); runner.on('StepBegin', function(spec, step) { var ui = specUiMap[spec.id]; spec = model.getSpec(spec.id); step = spec.getLastStep(); ui.find('> .scrollpane .test-actions').append('<li class="status-pending"></li>'); var stepUi = lastStepUiMap[spec.id] = ui.find('> .scrollpane .test-actions li:last'); stepUi.append( '<div class="timer-result"></div>' + '<div class="test-title"></div>' ); stepUi.find('> .test-title').text(step.name); var scrollpane = stepUi.parents('.scrollpane'); scrollpane.attr('scrollTop', scrollpane.attr('scrollHeight')); }); runner.on('StepFailure', function(spec, step, error) { var ui = lastStepUiMap[spec.id]; addError(ui, step.line, error); }); runner.on('StepError', function(spec, step, error) { var ui = lastStepUiMap[spec.id]; addError(ui, step.line, error); }); runner.on('StepEnd', function(spec, step) { var stepUi = lastStepUiMap[spec.id]; spec = model.getSpec(spec.id); step = spec.getLastStep(); stepUi.find('.timer-result').text(step.duration + 'ms'); stepUi.removeClass('status-pending'); stepUi.addClass('status-' + step.status); var scrollpane = specUiMap[spec.id].find('> .scrollpane'); scrollpane.attr('scrollTop', scrollpane.attr('scrollHeight')); }); /** * Finds the context of a spec block defined by the passed definition. * * @param {Object} The definition created by the Describe object. */ function findContext(spec) { var currentContext = context.find('#specs'); angular.forEach(model.getDefinitionPath(spec), function(defn) { var id = 'describe-' + defn.id; if (!context.find('#' + id).length) { currentContext.find('> .test-children').append( '<div class="test-describe" id="' + id + '">' + ' <h2></h2>' + ' <div class="test-children"></div>' + ' <ul class="tests"></ul>' + '</div>' ); context.find('#' + id).find('> h2').text('describe: ' + defn.name); } currentContext = context.find('#' + id); }); return context.find('#describe-' + spec.definition.id); } /** * Updates the test counter for the status. * * @param {string} the status. */ function updateTotals(status) { var legend = context.find('#status-legend .status-' + status); var parts = legend.text().split(' '); var value = (parts[0] * 1) + 1; legend.text(value + ' ' + parts[1]); } /** * Add an error to a step. * * @param {Object} The JQuery wrapped context * @param {function()} fn() that should return the file/line number of the error * @param {Object} the error. */ function addError(context, line, error) { context.find('.test-title').append('<pre></pre>'); var message = _jQuery.trim(line() + '\n\n' + formatException(error)); context.find('.test-title pre:last').text(message); } }); /** * Generates JSON output into a context. */ angular.scenario.output('json', function(context, runner, model) { model.on('RunnerEnd', function() { context.text(angular.toJson(model.value)); }); }); /** * Generates XML output into a context. */ angular.scenario.output('xml', function(context, runner, model) { var $ = function(args) {return new context.init(args);}; model.on('RunnerEnd', function() { var scenario = $('<scenario></scenario>'); context.append(scenario); serializeXml(scenario, model.value); }); /** * Convert the tree into XML. * * @param {Object} context jQuery context to add the XML to. * @param {Object} tree node to serialize */ function serializeXml(context, tree) { angular.forEach(tree.children, function(child) { var describeContext = $('<describe></describe>'); describeContext.attr('id', child.id); describeContext.attr('name', child.name); context.append(describeContext); serializeXml(describeContext, child); }); var its = $('<its></its>'); context.append(its); angular.forEach(tree.specs, function(spec) { var it = $('<it></it>'); it.attr('id', spec.id); it.attr('name', spec.name); it.attr('duration', spec.duration); it.attr('status', spec.status); its.append(it); angular.forEach(spec.steps, function(step) { var stepContext = $('<step></step>'); stepContext.attr('name', step.name); stepContext.attr('duration', step.duration); stepContext.attr('status', step.status); it.append(stepContext); if (step.error) { var error = $('<error></error>'); stepContext.append(error); error.text(formatException(step.error)); } }); }); } }); /** * Creates a global value $result with the result of the runner. */ angular.scenario.output('object', function(context, runner, model) { runner.$window.$result = model.value; }); bindJQuery(); publishExternalAPI(angular); var $runner = new angular.scenario.Runner(window), scripts = document.getElementsByTagName('script'), script = scripts[scripts.length - 1], config = {}; angular.forEach(script.attributes, function(attr) { var match = attr.name.match(/ng[:\-](.*)/); if (match) { config[match[1]] = attr.value || true; } }); if (config.autotest) { JQLite(document).ready(function() { angular.scenario.setUpAndRun(config); }); } })(window, document); angular.element(document).find('head').append('<style type="text/css">@charset "UTF-8";\n\n[ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak],\n.ng-cloak, .x-ng-cloak {\n display: none;\n}\n\nng\\:form {\n display: block;\n}\n</style>'); angular.element(document).find('head').append('<style type="text/css">@charset "UTF-8";\n/* CSS Document */\n\n/** Structure */\nbody {\n font-family: Arial, sans-serif;\n margin: 0;\n font-size: 14px;\n}\n\n#system-error {\n font-size: 1.5em;\n text-align: center;\n}\n\n#json, #xml {\n display: none;\n}\n\n#header {\n position: fixed;\n width: 100%;\n}\n\n#specs {\n padding-top: 50px;\n}\n\n#header .angular {\n font-family: Courier New, monospace;\n font-weight: bold;\n}\n\n#header h1 {\n font-weight: normal;\n float: left;\n font-size: 30px;\n line-height: 30px;\n margin: 0;\n padding: 10px 10px;\n height: 30px;\n}\n\n#application h2,\n#specs h2 {\n margin: 0;\n padding: 0.5em;\n font-size: 1.1em;\n}\n\n#status-legend {\n margin-top: 10px;\n margin-right: 10px;\n}\n\n#header,\n#application,\n.test-info,\n.test-actions li {\n overflow: hidden;\n}\n\n#application {\n margin: 10px;\n}\n\n#application iframe {\n width: 100%;\n height: 758px;\n}\n\n#application .popout {\n float: right;\n}\n\n#application iframe {\n border: none;\n}\n\n.tests li,\n.test-actions li,\n.test-it li,\n.test-it ol,\n.status-display {\n list-style-type: none;\n}\n\n.tests,\n.test-it ol,\n.status-display {\n margin: 0;\n padding: 0;\n}\n\n.test-info {\n margin-left: 1em;\n margin-top: 0.5em;\n border-radius: 8px 0 0 8px;\n -webkit-border-radius: 8px 0 0 8px;\n -moz-border-radius: 8px 0 0 8px;\n cursor: pointer;\n}\n\n.test-info:hover .test-name {\n text-decoration: underline;\n}\n\n.test-info .closed:before {\n content: \'\\25b8\\00A0\';\n}\n\n.test-info .open:before {\n content: \'\\25be\\00A0\';\n font-weight: bold;\n}\n\n.test-it ol {\n margin-left: 2.5em;\n}\n\n.status-display,\n.status-display li {\n float: right;\n}\n\n.status-display li {\n padding: 5px 10px;\n}\n\n.timer-result,\n.test-title {\n display: inline-block;\n margin: 0;\n padding: 4px;\n}\n\n.test-actions .test-title,\n.test-actions .test-result {\n display: table-cell;\n padding-left: 0.5em;\n padding-right: 0.5em;\n}\n\n.test-actions {\n display: table;\n}\n\n.test-actions li {\n display: table-row;\n}\n\n.timer-result {\n width: 4em;\n padding: 0 10px;\n text-align: right;\n font-family: monospace;\n}\n\n.test-it pre,\n.test-actions pre {\n clear: left;\n color: black;\n margin-left: 6em;\n}\n\n.test-describe {\n padding-bottom: 0.5em;\n}\n\n.test-describe .test-describe {\n margin: 5px 5px 10px 2em;\n}\n\n.test-actions .status-pending .test-title:before {\n content: \'\\00bb\\00A0\';\n}\n\n.scrollpane {\n max-height: 20em;\n overflow: auto;\n}\n\n/** Colors */\n\n#header {\n background-color: #F2C200;\n}\n\n#specs h2 {\n border-top: 2px solid #BABAD1;\n}\n\n#specs h2,\n#application h2 {\n background-color: #efefef;\n}\n\n#application {\n border: 1px solid #BABAD1;\n}\n\n.test-describe .test-describe {\n border-left: 1px solid #BABAD1;\n border-right: 1px solid #BABAD1;\n border-bottom: 1px solid #BABAD1;\n}\n\n.status-display {\n border: 1px solid #777;\n}\n\n.status-display .status-pending,\n.status-pending .test-info {\n background-color: #F9EEBC;\n}\n\n.status-display .status-success,\n.status-success .test-info {\n background-color: #B1D7A1;\n}\n\n.status-display .status-failure,\n.status-failure .test-info {\n background-color: #FF8286;\n}\n\n.status-display .status-error,\n.status-error .test-info {\n background-color: black;\n color: white;\n}\n\n.test-actions .status-success .test-title {\n color: #30B30A;\n}\n\n.test-actions .status-failure .test-title {\n color: #DF0000;\n}\n\n.test-actions .status-error .test-title {\n color: black;\n}\n\n.test-actions .timer-result {\n color: #888;\n}\n</style>');
build/ui/af.ui.jquery.js
chengjunjian/appframework
/*! intel-appframework - v2.1.0 - 2014-04-29 */ /** * jq.appframework.js * @copyright Intel 2013 * @author Ian Maffett * @description A plugin to allow jQuery developers to use App Framework UI */ /* jshint eqeqeq:false */ (function($,window){ "use strict"; var nundefined, document = window.document,classCache = {},isWin8=(typeof(MSApp)==="object"),_jsonPID = 1; function classRE(name) { return name in classCache ? classCache[name] : (classCache[name] = new RegExp("(^|\\s)" + name + "(\\s|$)")); } function _shimNodes(nodes, obj) { if (!nodes) return; if (nodes.nodeType) { obj[obj.length++] = nodes; return; } for (var i = 0, iz = nodes.length; i < iz; i++) obj[obj.length++] = nodes[i]; } $.extend($.fn,{ /* @param {String} attribute to get * @param {String} value to set as * @return {Object} an appframework object * @title $().css(attribute,[value]) */ vendorCss: function (attribute, value, obj) { return this.css($.feat.cssPrefix + attribute, value, obj); }, /** * Performs a css vendor specific transform:translate operation on the collection. * ``` $("#main").cssTranslate('200px,0,0'); ``` * @param {String} Transform values * @return {Object} an appframework object * @title $().vendorCss(value) */ cssTranslate: function (val) { return this.vendorCss("Transform", "translate" + $.feat.cssTransformStart + val + $.feat.cssTransformEnd); }, /** * Gets the computed style of CSS values * ``` $("#main").computedStyle('display'); ``` * @param {String} css property * @return {Int|String|Float|} css vlaue * @title $().computedStyle() */ computedStyle:function(val){ if(this.length===0||val==nundefined) return; return window.getComputedStyle(this[0],"")[val]; }, replaceClass: function(name, newName) { if (name == nundefined || newName == nundefined) return this; var replaceClassFn=function(cname) { classList = classList.replace(classRE(cname), " "); }; for (var i = 0; i < this.length; i++) { if (name == nundefined) { this[i].className = newName; continue; } var classList = this[i].className; name.split(/\s+/g).concat(newName.split(/\s+/g)).forEach(replaceClassFn); classList = classList.trim(); if (classList.length > 0) { this[i].className = (classList + " " + newName).trim(); } else this[i].className = newName; } return this; } }); function detectUA($, userAgent) { $.os = {}; $.os.webkit = userAgent.match(/WebKit\/([\d.]+)/) ? true : false; $.os.android = userAgent.match(/(Android)\s+([\d.]+)/) || userAgent.match(/Silk-Accelerated/) ? true : false; $.os.androidICS = $.os.android && userAgent.match(/(Android)\s4/) ? true : false; $.os.ipad = userAgent.match(/(iPad).*OS\s([\d_]+)/) ? true : false; $.os.iphone = !$.os.ipad && userAgent.match(/(iPhone\sOS)\s([\d_]+)/) ? true : false; $.os.ios7 = ($.os.ipad||$.os.iphone)&&userAgent.match(/7_/) ? true : false; $.os.webos = userAgent.match(/(webOS|hpwOS)[\s\/]([\d.]+)/) ? true : false; $.os.touchpad = $.os.webos && userAgent.match(/TouchPad/) ? true : false; $.os.ios = $.os.ipad || $.os.iphone; $.os.playbook = userAgent.match(/PlayBook/) ? true : false; $.os.blackberry10 = userAgent.match(/BB10/) ? true : false; $.os.blackberry = $.os.playbook || $.os.blackberry10|| userAgent.match(/BlackBerry/) ? true : false; $.os.chrome = userAgent.match(/Chrome/) ? true : false; $.os.opera = userAgent.match(/Opera/) ? true : false; $.os.fennec = userAgent.match(/fennec/i) ? true : userAgent.match(/Firefox/) ? true : false; $.os.ie = userAgent.match(/MSIE 10.0/i)||userAgent.match(/Trident\/7/i) ? true : false; $.os.ieTouch = $.os.ie && userAgent.toLowerCase().match(/touch/i) ? true : false; $.os.tizen = userAgent.match(/Tizen/i)?true:false; $.os.supportsTouch = ((window.DocumentTouch && document instanceof window.DocumentTouch) || "ontouchstart" in window); $.os.kindle=userAgent.match(/Silk-Accelerated/)?true:false; //features $.feat = {}; var head = document.documentElement.getElementsByTagName("head")[0]; $.feat.nativeTouchScroll = typeof(head.style["-webkit-overflow-scrolling"]) !== "undefined" && ($.os.ios||$.os.blackberry10); $.feat.cssPrefix = $.os.webkit ? "Webkit" : $.os.fennec ? "Moz" : $.os.ie ? "ms" : $.os.opera ? "O" : ""; $.feat.cssTransformStart = !$.os.opera ? "3d(" : "("; $.feat.cssTransformEnd = !$.os.opera ? ",0)" : ")"; if ($.os.android && !$.os.webkit) $.os.android = false; } detectUA($, navigator.userAgent); $.__detectUA = detectUA; //needed for unit tests /** * Utility function to create a psuedo GUID ``` var id= $.uuid(); ``` * @title $.uuid */ $.uuid = function () { var S4 = function () { return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); }; return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4()); }; /** * Gets the css matrix, or creates a fake one ``` $.getCssMatrix(domElement) ``` @returns matrix with postion */ $.getCssMatrix = function(ele) { if ($.is$(ele)) ele = ele.get(0); var matrixFn = window.WebKitCSSMatrix || window.MSCSSMatrix; if (ele === nundefined) { if (matrixFn) { return new matrixFn(); } else { return { a: 0, b: 0, c: 0, d: 0, e: 0, f: 0 }; } } var computedStyle = window.getComputedStyle(ele); var transform = computedStyle.webkitTransform || computedStyle.transform || computedStyle[$.feat.cssPrefix + "Transform"]; if (matrixFn) return new matrixFn(transform); else if (transform) { //fake css matrix var mat = transform.replace(/[^0-9\-.,]/g, "").split(","); return { a: +mat[0], b: +mat[1], c: +mat[2], d: +mat[3], e: +mat[4], f: +mat[5] }; } else { return { a: 0, b: 0, c: 0, d: 0, e: 0, f: 0 }; } }; /** * $.create - a faster alertnative to $("<div id='main'>this is some text</div>"); ``` $.create("div",{id:'main',innerHTML:'this is some text'}); $.create("<div id='main'>this is some text</div>"); ``` * @param {String} DOM Element type or html * @param [{Object}] properties to apply to the element * @return {Object} Returns an appframework object * @title $.create(type,[params]) */ $.create = function(type, props) { var elem; var f = new $(); if (props || type[0] !== "<") { if (props.html){ props.innerHTML = props.html; delete props.html; } elem = document.createElement(type); for (var j in props) { elem[j] = props[j]; } f[f.length++] = elem; } else { elem = document.createElement("div"); if (isWin8) { MSApp.execUnsafeLocalFunction(function() { elem.innerHTML = type.trim(); }); } else elem.innerHTML = type; _shimNodes(elem.childNodes, f); } return f; }; /** * $.query - a faster alertnative to $("div"); ``` $.query(".panel"); ``` * @param {String} selector * @param {Object} [context] * @return {Object} Returns an appframework object * @title $.query(selector,[context]) */ $.query = function (sel, what) { try { return $(sel,what); } catch(e) { return $(); } }; /* The following are for events on objects */ /** * Bind an event to an object instead of a DOM Node ``` $.bind(this,'event',function(){}); ``` * @param {Object} object * @param {String} event name * @param {Function} function to execute * @title $.bind(object,event,function); */ $.bind = function (obj, ev, f) { if (!obj.__events) obj.__events = {}; if (!$.isArray(ev)) ev = [ev]; for (var i = 0; i < ev.length; i++) { if (!obj.__events[ev[i]]) obj.__events[ev[i]] = []; obj.__events[ev[i]].push(f); } }; /** * Trigger an event to an object instead of a DOM Node ``` $.trigger(this,'event',arguments); ``` * @param {Object} object * @param {String} event name * @param {Array} arguments * @title $.trigger(object,event,argments); */ $.trigger = function (obj, ev, args) { var ret = true; if (!obj.__events) return ret; if (!$.isArray(ev)) ev = [ev]; if (!$.isArray(args)) args = []; for (var i = 0; i < ev.length; i++) { if (obj.__events[ev[i]]) { var evts = obj.__events[ev[i]]; for (var j = 0; j < evts.length; j++) if ($.isFunction(evts[j]) && evts[j].apply(obj, args) === false) ret = false; } } return ret; }; /** * Unbind an event to an object instead of a DOM Node ``` $.unbind(this,'event',function(){}); ``` * @param {Object} object * @param {String} event name * @param {Function} function to execute * @title $.unbind(object,event,function); */ $.unbind = function (obj, ev, f) { if (!obj.__events) return; if(ev==nundefined) { delete obj.__events; return; } if (!$.isArray(ev)) ev = [ev]; for (var i = 0; i < ev.length; i++) { if (obj.__events[ev[i]]) { var evts = obj.__events[ev[i]]; for (var j = 0; j < evts.length; j++) { if (f ==nundefined) delete evts[j]; if (evts[j] === f) { evts.splice(j, 1); break; } } } } }; $.cleanUpContent = function(){}; $.isObject = function (obj) { return typeof obj === "object"; }; $.asap = function (fn, context, args) { if (!$.isFunction(fn)) throw "$.asap - argument is not a valid function"; setTimeout(function(){ fn.apply(context,args); }); }; /** * this function executes javascript in HTML. ``` $.parseJS(content) ``` * @param {String|DOM} content * @title $.parseJS(content); */ var remoteJSPages = {}; $.parseJS = function (div) { if (!div) return; if (typeof (div) === "string") { var elem = document.createElement("div"); if(isWin8){ MSApp.execUnsafeLocalFunction(function(){ elem.innerHTML = div; }); } else elem.innerHTML = div; div = elem; } var scripts = div.getElementsByTagName("script"); div = null; for (var i = 0; i < scripts.length; i++) { if (scripts[i].src.length > 0 && !remoteJSPages[scripts[i].src]&&!isWin8) { var doc = document.createElement("script"); doc.type = scripts[i].type; doc.src = scripts[i].src; document.getElementsByTagName("head")[0].appendChild(doc); remoteJSPages[scripts[i].src] = 1; doc = null; } else { window["eval"](scripts[i].innerHTML); } } }; $.is$ = function (obj) { return obj instanceof $; }; $.jsonP = function(options) { if (isWin8) { options.type = "get"; options.dataType = null; return $.get(options); } var callbackName = "jsonp_callback" + (++_jsonPID); var abortTimeout = "", context, callback; var script = document.createElement("script"); window[callbackName] = function(data) { clearTimeout(abortTimeout); $(script).remove(); delete window[callbackName]; options.success.call(context, data); }; if (options.url.indexOf("callback=?") !== -1) { script.src = options.url.replace(/=\?/, "=" + callbackName); } else { callback = options.jsonp ? options.jsonp : "callback"; if (options.url.indexOf("?") === -1) { options.url += ("?" + callback + "=" + callbackName); } else { options.url += ("&" + callback + "=" + callbackName); } script.src = options.url; } if (options.error) { script.onerror = function() { clearTimeout(abortTimeout); options.error.call(context, "", "error"); }; } $("head").append(script); if (options.timeout > 0) abortTimeout = setTimeout(function() { options.error.call(context, "", "timeout"); }, options.timeout); return {}; }; //Shim to put touch events on the jQuery special event var oldAdd=$.event.add; $.event.add=function(){ var oldHandler=arguments[2]; var self=this; var handler=function(){ var oldArgs=arguments; if(oldArgs[0].originalEvent&&oldArgs[0].originalEvent.touches){ oldArgs[0].touches=oldArgs[0].originalEvent.touches; oldArgs[0].changedTouches=oldArgs[0].originalEvent.changedTouches; oldArgs[0].targetTouches=oldArgs[0].originalEvent.targetTouches; } oldHandler.apply(oldArgs[0].currentTarget,oldArgs); }; arguments[2]=handler; oldAdd.apply($, arguments); }; window.$afm=$; if (!window.numOnly) { window.numOnly = function numOnly(val) { if (val ===undefined || val === "") return 0; if (isNaN(parseFloat(val))) { if (val.replace) { val = val.replace(/[^0-9.-]/g, ""); } else return 0; } return parseFloat(val); }; } })(jQuery,window); window.af=window.jq=jQuery; /** * af.actionsheet - an actionsheet for html5 mobile apps * Copyright 2012 - Intel */ /* EXAMPLE You can pass in an HTML string that will get rendered $(document.body).actionsheet('<a >Back</a><a onclick="alert(\'hi\');" >Show Alert 3</a><a onclick="alert(\'goodbye\');">Show Alert 4</a>'); You can also use an arra of objects to show each item. There are three propertyes text - the text to display cssClasses - extra css classes handler - click handler function $(document.body).actionsheet( [{ text: 'back', cssClasses: 'red', handler: function () { $.ui.goBack(); } }, { text: 'show alert 5', cssClasses: 'blue', handler: function () { alert("hi"); } }, { text: 'show alert 6', cssClasses: '', handler: function () { alert("goodbye"); } }] ); */ /* global af*/ (function($) { "use strict"; $.fn.actionsheet = function(opts) { var tmp; for (var i = 0; i < this.length; i++) { tmp = new actionsheet(this[i], opts); } return this.length === 1 ? tmp : this; }; var actionsheet = (function() { var actionsheet = function(elID, opts) { if (typeof elID === "string" || elID instanceof String) { this.el = document.getElementById(elID); } else { this.el = elID; } if (!this.el) { window.alert("Could not find element for actionsheet " + elID); return; } if (this instanceof actionsheet) { if (typeof(opts) === "object") { for (var j in opts) { this[j] = opts[j]; } } } else { return new actionsheet(elID, opts); } // try { var that = this; var markStart = "<div id='af_actionsheet'><div style='width:100%'>"; var markEnd = "</div></div>"; var markup; var noop=function(){}; if (typeof opts === "string") { markup = $(markStart + opts + "<a href='javascript:;' class='cancel'>Cancel</a>" + markEnd); } else if (typeof opts === "object") { markup = $(markStart + markEnd); var container = $(markup.children().get(0)); opts.push({ text: "Cancel", cssClasses: "cancel" }); for (var i = 0; i < opts.length; i++) { var item = $("<a href='javascript:;'>" + (opts[i].text || "TEXT NOT ENTERED") + "</a>"); item[0].onclick = (opts[i].handler || noop); if (opts[i].cssClasses && opts[i].cssClasses.length > 0) item.addClass(opts[i].cssClasses); container.append(item); } } $(elID).find("#af_actionsheet").remove(); $(elID).find("#af_action_mask").remove(); $(elID).append(markup); markup.vendorCss("Transition", "all 0ms"); markup.cssTranslate("0,0"); markup.css("top", window.innerHeight + "px"); this.el.style.overflow = "hidden"; markup.on("click", "a", function() { that.hideSheet(); return false; }); this.activeSheet = markup; $(elID).append("<div id='af_action_mask' style='position:absolute;top:0px;left:0px;right:0px;bottom:0px;z-index:9998;background:rgba(0,0,0,.4)'/>"); setTimeout(function() { markup.vendorCss("Transition", "all 300ms"); markup.cssTranslate("0," + (-(markup.height())) + "px"); }, 10); $("#af_action_mask").bind("touchstart touchmove touchend click",function(e){ e.preventDefault(); e.stopPropagation(); }); }; actionsheet.prototype = { activeSheet: null, hideSheet: function() { var that = this; this.activeSheet.off("click", "a", function() { that.hideSheet(); }); $(this.el).find("#af_action_mask").unbind("click").remove(); this.activeSheet.vendorCss("Transition", "all 0ms"); var markup = this.activeSheet; var theEl = this.el; setTimeout(function() { markup.vendorCss("Transition", "all 300ms"); markup.cssTranslate("0,0px"); setTimeout(function() { markup.remove(); markup = null; theEl.style.overflow = "none"; }, 500); }, 10); } }; return actionsheet; })(); })(af); /** * af.css3animate - a css3 animation library that supports chaning/callbacks * Copyright 2013 - Intel */ /* EXAMPLE $("#animate").css3Animate({ width: "100px", height: "100px", x: "20%", y: "30%", time: "1000ms", opacity: .5, callback: function () { //execute when finished } }); //Chain animations $("#animate").css3Animate({ x: 20, y: 30, time: "300ms", callback: function () { $("#animate").css3Animate({ x: 20, y: 30, time: "500ms", previous: true, callback: function () { reset(); } }); } }); */ /* global af*/ /* global numOnly*/ (function($) { "use strict"; var cache = []; var objId = function(obj) { if (!obj.afCSS3AnimateId) obj.afCSS3AnimateId = $.uuid(); return obj.afCSS3AnimateId; }; var getEl = function(elID) { if (typeof elID === "string" || elID instanceof String) { return document.getElementById(elID); } else if ($.is$(elID)) { return elID[0]; } else { return elID; } }; var getCSS3Animate = function(obj, options) { var tmp, id, el = getEl(obj); //first one id = objId(el); if (cache[id]) { cache[id].animate(options); tmp = cache[id]; } else { tmp = css3Animate(el, options); cache[id] = tmp; } return tmp; }; $.fn.css3Animate = function(opts) { //keep old callback system - backwards compatibility - should be deprecated in future versions if (!opts.complete && opts.callback) opts.complete = opts.callback; //first on var tmp = getCSS3Animate(this[0], opts); opts.complete = null; opts.sucess = null; opts.failure = null; for (var i = 1; i < this.length; i++) { tmp.link(this[i], opts); } return tmp; }; $.css3AnimateQueue = function() { return new css3Animate.queue(); }; var translateOpen = $.feat.cssTransformStart; var translateClose = $.feat.cssTransformEnd; var transitionEnd = $.feat.cssPrefix.replace(/-/g, "") + "TransitionEnd"; transitionEnd = ($.os.fennec || $.feat.cssPrefix === "" || $.os.ie) ? "transitionend" : transitionEnd; transitionEnd = transitionEnd.replace(transitionEnd.charAt(0), transitionEnd.charAt(0).toLowerCase()); var css3Animate = (function() { var css3Animate = function(elID, options) { if (!(this instanceof css3Animate)) return new css3Animate(elID, options); //start doing stuff this.callbacksStack = []; this.activeEvent = null; this.countStack = 0; this.isActive = false; this.el = elID; this.linkFinishedProxy = $.proxy(this.linkFinished, this); if (!this.el) return; this.animate(options); var that = this; af(this.el).bind("destroy", function() { var id = that.el.afCSS3AnimateId; that.callbacksStack = []; if (cache[id]) delete cache[id]; }); }; css3Animate.prototype = { animate: function(options) { //cancel current active animation on this object if (this.isActive) this.cancel(); this.isActive = true; if (!options) { window.alert("Please provide configuration options for animation of " + this.el.id); return; } var classMode = !! options.addClass; var scale, time; var timeNum = numOnly(options.time); if (classMode) { //class defines properties being changed if (options.removeClass) { af(this.el).replaceClass(options.removeClass, options.addClass); } else { af(this.el).addClass(options.addClass); } } else { //property by property if (timeNum === 0) options.time = 0; if (!options.y) options.y = 0; if (!options.x) options.x = 0; if (options.previous) { var cssMatrix = new $.getCssMatrix(this.el); options.y += numOnly(cssMatrix.f); options.x += numOnly(cssMatrix.e); } if (!options.origin) options.origin = "0% 0%"; if (!options.scale) options.scale = "1"; if (!options.rotateY) options.rotateY = "0"; if (!options.rotateX) options.rotateX = "0"; if (!options.skewY) options.skewY = "0"; if (!options.skewX) options.skewX = "0"; if (!options.timingFunction) options.timingFunction = "linear"; //check for percent or numbers if (typeof(options.x) === "number" || (options.x.indexOf("%") === -1 && options.x.toLowerCase().indexOf("px") === -1 && options.x.toLowerCase().indexOf("deg") === -1)) options.x = parseInt(options.x, 10) + "px"; if (typeof(options.y) === "number" || (options.y.indexOf("%") === -1 && options.y.toLowerCase().indexOf("px") === -1 && options.y.toLowerCase().indexOf("deg") === -1)) options.y = parseInt(options.y, 10) + "px"; var trans = "translate" + translateOpen + (options.x) + "," + (options.y) + translateClose + " scale(" + parseFloat(options.scale) + ") rotate(" + options.rotateX + ")"; if (!$.os.opera) trans += " rotateY(" + options.rotateY + ")"; trans += " skew(" + options.skewX + "," + options.skewY + ")"; this.el.style[$.feat.cssPrefix + "Transform"] = trans; this.el.style[$.feat.cssPrefix + "BackfaceVisibility"] = "hidden"; var properties = $.feat.cssPrefix + "Transform"; if (options.opacity !== undefined) { this.el.style.opacity = options.opacity; properties += ", opacity"; } if (options.width) { this.el.style.width = options.width; properties = "all"; } if (options.height) { this.el.style.height = options.height; properties = "all"; } this.el.style[$.feat.cssPrefix + "TransitionProperty"] = "all"; if (("" + options.time).indexOf("s") === -1) { scale = "ms"; time = options.time + scale; } else if (options.time.indexOf("ms") !== -1) { scale = "ms"; time = options.time; } else { scale = "s"; time = options.time + scale; } if (options.delay) { this.el.style[$.feat.cssPrefix + "TransitionDelay"] = options.delay; } this.el.style[$.feat.cssPrefix + "TransitionDuration"] = time; this.el.style[$.feat.cssPrefix + "TransitionTimingFunction"] = options.timingFunction; this.el.style[$.feat.cssPrefix + "TransformOrigin"] = options.origin; } //add callback to the stack this.callbacksStack.push({ complete: options.complete, success: options.success, failure: options.failure }); this.countStack++; var that = this, duration; var style = window.getComputedStyle(this.el); if (classMode) { //get the duration duration = style[$.feat.cssPrefix + "TransitionDuration"]; timeNum = numOnly(duration); options.time = timeNum; if (duration.indexOf("ms") !== -1) { scale = "ms"; } else { scale = "s"; options.time *= 1000; } } //finish asap if (timeNum === 0 || (scale === "ms" && timeNum < 5) || style.display === "none") { //the duration is nearly 0 or the element is not displayed, finish immediatly $.asap($.proxy(this.finishAnimation, this, [false])); //this.finishAnimation(); //set transitionend event } else { //setup the event normally this.activeEvent = function(event) { clearTimeout(that.timeout); that.finishAnimation(event); that.el.removeEventListener(transitionEnd, that.activeEvent, false); }; that.timeout = setTimeout(this.activeEvent, numOnly(options.time) + 50); this.el.addEventListener(transitionEnd, this.activeEvent, false); } }, addCallbackHook: function(callback) { if (callback) this.callbacksStack.push(callback); this.countStack++; return this.linkFinishedProxy; }, linkFinished: function(canceled) { if (canceled) this.cancel(); else this.finishAnimation(); }, finishAnimation: function(event) { if (event && event.preventDefault) event.preventDefault(); if (!this.isActive) return; this.countStack--; if (this.countStack === 0) this.fireCallbacks(false); }, fireCallbacks: function(canceled) { this.clearEvents(); //keep callbacks after cleanup // (if any of the callbacks overrides this object, callbacks will keep on fire as expected) var callbacks = this.callbacksStack; //cleanup this.cleanup(); //fire all callbacks for (var i = 0; i < callbacks.length; i++) { var complete = callbacks[i].complete; var success = callbacks[i].success; var failure = callbacks[i].failure; //fire callbacks if (typeof(complete) === "function") complete(canceled); //success/failure if (canceled && typeof(failure) === "function") failure(); else if (typeof(success) === "function") success(); } }, cancel: function() { if (!this.isActive) return; this.fireCallbacks(true); //fire failure callbacks }, cleanup: function() { this.callbacksStack = []; this.isActive = false; this.countStack = 0; }, clearEvents: function() { if (this.activeEvent) { this.el.removeEventListener(transitionEnd, this.activeEvent, false); } this.activeEvent = null; }, link: function(elID, opts) { var callbacks = { complete: opts.complete, success: opts.success, failure: opts.failure }; opts.complete = this.addCallbackHook(callbacks); opts.success = null; opts.failure = null; //run the animation with the replaced callbacks getCSS3Animate(elID, opts); //set the old callback back in the obj to avoid strange stuff opts.complete = callbacks.complete; opts.success = callbacks.success; opts.failure = callbacks.failure; return this; } }; return css3Animate; })(); css3Animate.queue = function() { return { elements: [], push: function(el) { this.elements.push(el); }, pop: function() { return this.elements.pop(); }, run: function() { var that = this; if (this.elements.length === 0) return; if (typeof(this.elements[0]) === "function") { var func = this.shift(); func(); } if (this.elements.length === 0) return; var params = this.shift(); if (this.elements.length > 0) { params.complete = function(canceled) { if (!canceled) that.run(); }; } css3Animate(document.getElementById(params.id), params); }, shift: function() { return this.elements.shift(); } }; }; })(af); /** * @license MIT - https://github.com/darius/requestAnimationFrame/commit/4f27a5a21902a883330da4663bea953b2f96cb15#diff-9879d6db96fd29134fc802214163b95a http://paulirish.com/2011/requestanimationframe-for-smart-animating/ http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel MIT license Adapted from https://gist.github.com/paulirish/1579671 which derived from http://paulirish.com/2011/requestanimationframe-for-smart-animating/ http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating requestAnimationFrame polyfill by Erik Möller. Fixes from Paul Irish, Tino Zijdel, Andrew Mao, Klemen Slavič, Darius Bacon */ if (!Date.now) Date.now = function() { "use strict"; return new Date().getTime(); }; (function() { "use strict"; var vendors = ["webkit", "moz","ms"]; for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) { var vp = vendors[i]; window.requestAnimationFrame = window[vp+"RequestAnimationFrame"]; window.cancelAnimationFrame = (window[vp+"CancelAnimationFrame"] || window[vp+"CancelRequestAnimationFrame"]); } if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) { var lastTime = 0; window.requestAnimationFrame = function(callback) { var now = Date.now(); var nextTime = Math.max(lastTime + 16, now); return setTimeout(function() { callback(lastTime = nextTime); }, nextTime - now); }; window.cancelAnimationFrame = clearTimeout; } }()); /** * af.animate - an experimental animation library that uses matrices and requestAnimationFrame * Only supports x/y now and is used by the scroller library * Copyright 2013 - Intel */ (function($) { "use strict"; var cache = []; var objId = function(obj) { if (!obj.afAnimateId) obj.afAnimateId = $.uuid(); return obj.afAnimateId; }; var getEl = function(elID) { if (typeof elID === "string" || elID instanceof String) { return document.getElementById(elID); } else if ($.is$(elID)) { return elID[0]; } else { return elID; } }; var getAnimate = function(obj, options) { var tmp, id, el = getEl(obj); //first one id = objId(el); if (cache[id]) { if(options) cache[id].animate(options); tmp = cache[id]; } else { tmp = Animate(el, options); cache[id] = tmp; } return tmp; }; $.fn.animateCss = function(opts) { var tmp = getAnimate(this[0], opts); return tmp; }; var Animate = function(elID, options) { if (!(this instanceof Animate)) return new Animate(elID, options); this.el=elID; //start doing stuff if (!this.el) return; if(options) this.animate(options); var that = this; af(this.el).bind("destroy", function() { var id = that.el.afAnimateId; if (cache[id]) delete cache[id]; }); }; Animate.prototype = { animationTimer:null, isAnimating:false, startX:0, startY:0, runTime:0, endX:0, endY:0, currX:0, currY:0, animationStartTime:0, pauseTime:0, completeCB:null, easingFn:"linear", animateOpts:{}, updateCb:null, animate: function(options) { var that=this; if(that.isAnimating) return; that.isAnimating=true; window.cancelAnimationFrame(that.animationTimer); if (!options) { options={ x:0, y:0, duration:0 }; } this.easingFn=options.easing||"linear"; this.completeCB=options.complete||null; this.updateCB=options.update||null; this.runTime=numOnly(options.duration); options.complete&&(delete options.complete); this.animateOpts=options; this.startTime=Date.now(); this.startMatrix=$.getCssMatrix(this.el); if(this.runTime===0) this.doAnimate(); }, start:function(){ this.doAnimate(); }, doAnimate:function(){ var now = Date.now(), nextX, nextY,easeStep,that=this; if (this.runTime===0||(now >= this.startTime + this.runTime)) { that.setPosition(this.animateOpts.x,this.animateOpts.y); that.isAnimating = false; if(this.updateCB) this.updateCB({x:this.animateOpts.x,y:this.animateOpts.y}); if(this.completeCB) this.completeCB(); return; } now = (now - this.startTime) / this.runTime; now=now>1?1:now; easeStep = tweens[this.easingFn](now); nextX = (this.animateOpts.x - this.startMatrix.e) * easeStep + this.startMatrix.e; nextY = (this.animateOpts.y - this.startMatrix.f) * easeStep + this.startMatrix.f; this.setPosition(nextX,nextY); if(this.updateCB) this.updateCB({x:nextX,y:nextY}); if (this.isAnimating) this.animationTimer = window.requestAnimationFrame(function(){that.doAnimate();}); }, setPosition:function(x,y){ this.el.style[$.feat.cssPrefix+"Transform"]="matrix3d( 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, "+x+", "+y+", 0, 1 )"; this.currX=x; this.currY=y; }, stop:function(){ this.isAnimating=false; window.cancelAnimationFrame(this.animationTimer); this.pauseTime=Date.now()-this.startTime; }, resume:function(){ this.isAnimating=true; this.startTime=Date.now()-this.pauseTime; this.doAnimate(); } }; var tweens = { linear:function (k) { return k; }, easeOutSine:function (k) { return Math.sin(k * Math.PI / 2 ); } }; })(af); /** * af.passwordBox - password box replacement for html5 mobile apps on android due to a bug with CSS3 translate3d * @copyright 2011 - Intel */ /* global af*/ (function ($) { "use strict"; $.passwordBox = function () { return new passwordBox(); }; var passwordBox = function () { this.oldPasswords = {}; }; passwordBox.prototype = { showPasswordPlainText: false, getOldPasswords: function (elID) { // if ($.os.android == false) return; - iOS users seem to want this too, so we'll let everyone join the party var container = elID && document.getElementById(elID) ? document.getElementById(elID) : document; if (!container) { window.alert("Could not find container element for passwordBox " + elID); return; } var sels = container.getElementsByTagName("input"); for (var i = 0; i < sels.length; i++) { if (sels[i].type !== "password") continue; if($.os.webkit){ sels[i].type = "text"; $(sels[i]).vendorCss("TextSecurity","disc"); } } }, changePasswordVisiblity: function (what, id) { what = parseInt(what,10); var theEl = document.getElementById(id); if (what === 1) { //show $(theEl).vendorCss("TextSecurity","none"); } else { $(theEl).vendorCss("TextSecurity","disc"); } if(!$.os.webkit) { if(what === 1) theEl.type="text"; else theEl.type="password"; } theEl = null; } }; })(af); /** * af.scroller * created by Intel with modifications by Carlos Ouro @ Badoo and Intel * Supports iOS native touch scrolling * Optimizations and bug improvements by Intel * @copyright Intel */ /* global numOnly*/ (function ($) { "use strict"; var HIDE_REFRESH_TIME = 325; // hide animation of pull2ref duration in ms var cache = []; var objId = function (obj) { if (!obj.afScrollerId) obj.afScrollerId = $.uuid(); return obj.afScrollerId; }; $.fn.scroller = function (opts) { var tmp, id; for (var i = 0; i < this.length; i++) { //cache system id = objId(this[i]); if (!cache[id]) { if (!opts) opts = {}; if (!$.feat.nativeTouchScroll) opts.useJsScroll = true; tmp = scroller(this[i], opts); cache[id] = tmp; } else { tmp = cache[id]; } } return this.length === 1 ? tmp : this; }; var boundTouchLayer = false; function checkConsistency(id) { if (!cache[id].el) { delete cache[id]; return false; } return true; } function bindTouchLayer() { //use a single bind for all scrollers if ($.os.android && !$.os.chrome && $.os.webkit) { var androidFixOn = false; //connect to touchLayer to detect editMode $.bind($.touchLayer, ["cancel-enter-edit", "exit-edit"], function () { if (androidFixOn) { androidFixOn = false; //dehactivate on scroller for (var el in cache) if (checkConsistency(el) && cache[el].androidFormsMode) cache[el].stopFormsMode(); } }); } boundTouchLayer = true; } var scroller = (function () { var jsScroller, nativeScroller; //initialize and js/native mode selector var scroller = function (elID, opts) { var el; if (!boundTouchLayer && $.touchLayer && $.isObject($.touchLayer)) bindTouchLayer(); else if (!$.touchLayer || !$.isObject($.touchLayer)) $.touchLayer = {}; if (typeof elID === "string" || elID instanceof String) { el = document.getElementById(elID); } else { el = elID; } if (!el) { window.alert("Could not find element for scroller " + elID); return; } var checkClassEl=$(el); if(opts.hasParent) checkClassEl=checkClassEl.parent(); if(checkClassEl.hasClass("x-scroll")) opts.horizontalScroll=true; if(checkClassEl.hasClass("y-scroll")) opts.verticalScroll=true; if ($.os.desktop) return new scrollerCore(el, opts); else if (opts.useJsScroll) return new jsScroller(el, opts); return new nativeScroller(el, opts); }; //parent abstract class (common functionality) var scrollerCore = function (el, opts) { this.el = el; this.afEl = $(this.el); for (var j in opts) { this[j] = opts[j]; } }; scrollerCore.prototype = { //core default properties refresh: false, refreshContent: "Pull to Refresh", refreshHangTimeout: 2000, refreshHeight: 60, refreshElement: null, refreshCancelCB: null, refreshRunning: false, scrollTop: 0, scrollLeft: 0, preventHideRefresh: true, verticalScroll: true, horizontalScroll: false, refreshTriggered: false, moved: false, eventsActive: false, rememberEventsActive: false, scrollingLocked: false, autoEnable: true, blockFormsFix: false, loggedPcentY: 0, loggedPcentX: 0, infinite: false, infiniteEndCheck: false, infiniteTriggered: false, scrollSkip: false, scrollTopInterval: null, scrollLeftInterval: null, bubbles:true, lockBounce:false, initScrollProgress:false, _scrollTo: function (params, time) { time = parseInt(time, 10); if (time === 0 || isNaN(time)) { this.el.scrollTop = Math.abs(params.y); this.el.scrollLeft = Math.abs(params.x); return; } var singleTick = 10; var distPerTick = (this.el.scrollTop - params.y) / Math.ceil(time / singleTick); var distLPerTick = (this.el.scrollLeft - params.x) / Math.ceil(time / singleTick); var self = this; var toRunY = Math.ceil(this.el.scrollTop - params.y) / distPerTick; var toRunX = Math.ceil(this.el.scrollLeft - params.x) / distPerTick; var xRun =0, yRun = 0; self.scrollTopInterval = window.setInterval(function () { self.el.scrollTop -= distPerTick; yRun++; if (yRun >= toRunY) { self.el.scrollTop = params.y; clearInterval(self.scrollTopInterval); } }, singleTick); self.scrollLeftInterval = window.setInterval(function () { self.el.scrollLeft -= distLPerTick; xRun++; if (xRun >= toRunX) { self.el.scrollLeft = params.x; clearInterval(self.scrollLeftInterval); } }, singleTick); }, enable: function () {}, disable: function () {}, hideScrollbars: function () {}, addPullToRefresh: function () {}, /** * We do step animations for "native" - iOS is acceptable and desktop browsers are fine * instead of css3 */ _scrollToTop: function (time) { this._scrollTo({ x: 0, y: 0 }, time); }, _scrollToBottom: function (time) { this._scrollTo({ x: 0, y: this.el.scrollHeight - this.el.offsetHeight }, time); }, scrollToBottom: function (time) { return this._scrollToBottom(time); }, scrollToTop: function (time) { return this._scrollToTop(time); }, //methods init: function (el, opts) { this.el = el; this.afEl = $(this.el); this.defaultProperties(); for (var j in opts) { this[j] = opts[j]; } //assign self destruct var that = this; var orientationChangeProxy = function () { //no need to readjust if disabled... if (that.eventsActive && !$.feat.nativeTouchScroll&&(!$.ui || ($.ui.activeDiv === that.container)) ) { that.adjustScroll(); } }; this.afEl.bind("destroy", function () { that.disable(true); //with destroy notice var id = that.el.afScrollerId; if (cache[id]) delete cache[id]; $.unbind($.touchLayer, "orientationchange-reshape", orientationChangeProxy); }); $.bind($.touchLayer, "orientationchange-reshape", orientationChangeProxy); $(window).bind("resize", orientationChangeProxy); }, needsFormsFix: function (focusEl) { return this.useJsScroll && this.isEnabled() && this.el.style.display !== "none" && $(focusEl).closest(this.afEl).size() > 0; }, handleEvent: function (e) { if (!this.scrollingLocked) { switch (e.type) { case "touchstart": clearInterval(this.scrollTopInterval); this.preventHideRefresh = !this.refreshRunning; // if it's not running why prevent it xD this.moved = false; this.onTouchStart(e); if(!this.bubbles) e.stopPropagation(); break; case "touchmove": this.onTouchMove(e); if(!this.bubbles) e.stopPropagation(); break; case "touchend": this.onTouchEnd(e); if(!this.bubbles) e.stopPropagation(); break; case "scroll": this.onScroll(e); break; } } }, coreAddPullToRefresh: function (rEl) { if (rEl) this.refreshElement = rEl; //Add the pull to refresh text. Not optimal but keeps from others overwriting the content and worrying about italics //add the refresh div var afEl; if (this.refreshElement === null) { var orginalEl = document.getElementById(this.container.id + "_pulldown"); if (orginalEl !== null) { afEl = $(orginalEl); } else { afEl = $("<div id='" + this.container.id + "_pulldown' class='afscroll_refresh' style='position:relative;height:60px;text-align:center;line-height:60px;font-weight:bold;'>" + this.refreshContent + "</div>"); } } else { afEl = $(this.refreshElement); } var el = afEl.get(0); this.refreshContainer = $("<div style='overflow:hidden;height:0;width:100%;display:none;background:inherit;-webkit-backface-visibility: hidden !important;'></div>"); $(this.el).prepend(this.refreshContainer.prepend(el)); this.refreshContainer = this.refreshContainer[0]; }, fireRefreshRelease: function (triggered) { if (!this.refresh || !triggered) return; this.setRefreshContent("Refreshing..."); var autoCancel = $.trigger(this, "refresh-release", [triggered]) !== false; this.preventHideRefresh = false; this.refreshRunning = true; if (autoCancel) { var that = this; if (this.refreshHangTimeout > 0) this.refreshCancelCB = setTimeout(function () { that.hideRefresh(); }, this.refreshHangTimeout); } }, setRefreshContent: function (content) { $(this.container).find(".afscroll_refresh").html(content); }, lock: function () { if (this.scrollingLocked) return; this.scrollingLocked = true; this.rememberEventsActive = this.eventsActive; if (this.eventsActive) { this.disable(); } }, unlock: function () { if (!this.scrollingLocked) return; this.scrollingLocked = false; if (this.rememberEventsActive) { this.enable(); } }, scrollToItem: function (el, where) { //TODO: add functionality for x position if (!$.is$(el)) el = $(el); var newTop,itemPos,panelTop,itemTop; if (where === "bottom") { itemPos = el.offset(); newTop = itemPos.top - this.afEl.offset().bottom + itemPos.height; newTop += 4; //add a small space } else { itemTop = el.offset().top; newTop = itemTop - document.body.scrollTop; panelTop = this.afEl.offset().top; if (document.body.scrollTop < panelTop) { newTop -= panelTop; } newTop -= 4; //add a small space } this.scrollBy({ y: newTop, x: 0 }, 0); }, setPaddings: function (top, bottom) { var el = $(this.el); var curTop = numOnly(el.css("paddingTop")); el.css("paddingTop", top + "px").css("paddingBottom", bottom + "px"); //don't let padding mess with scroll this.scrollBy({ y: top - curTop, x: 0 }); }, //freak of mathematics, but for our cases it works divide: function (a, b) { return b !== 0 ? a / b : 0; }, isEnabled: function () { return this.eventsActive; }, addInfinite: function () { this.infinite = true; }, clearInfinite: function () { this.infiniteTriggered = false; this.scrollSkip = true; }, scrollTo:function (pos, time) { return this._scrollTo(pos, time); }, updateP2rHackPosition:function(){} }; //extend to jsScroller and nativeScroller (constructs) jsScroller = function (el, opts) { this.init(el, opts); if(opts.hasParent) this.container = this.el.parentNode; else { //copy/etc var $div=$.create("div",{}); $div.append($(this.el).contents()); $(this.el).append($div); this.container=this.el; this.el=$div.get(0); } this.container.afScrollerId = el.afScrollerId; this.afEl = $(this.container); if (this.container.style.overflow !== "hidden") this.container.style.overflow = "hidden"; this.addPullToRefresh(null, true); if(opts.autoEnable) this.autoEnable=opts.autoEnable; if (this.autoEnable) this.enable(true); var scrollDiv; //create vertical scroll if (this.verticalScroll && this.verticalScroll === true && this.scrollBars === true) { scrollDiv = createScrollBar(5, 20); scrollDiv.style.top = "0px"; if (this.vScrollCSS) scrollDiv.className = this.vScrollCSS; //scrollDiv.style.opacity = "0"; scrollDiv.style.display="none"; this.container.appendChild(scrollDiv); this.vscrollBar = scrollDiv; scrollDiv = null; } //create horizontal scroll if (this.horizontalScroll && this.horizontalScroll === true && this.scrollBars === true) { scrollDiv = createScrollBar(20, 5); scrollDiv.style.bottom = "0px"; if (this.hScrollCSS) scrollDiv.className = this.hScrollCSS; //scrollDiv.style.opacity = "0"; scrollDiv.style.display="none"; this.container.appendChild(scrollDiv); this.hscrollBar = scrollDiv; scrollDiv = null; } if (this.horizontalScroll) this.el.style.cssFloat = "left"; this.el.hasScroller = true; }; nativeScroller = function (el, opts) { if(opts.nativeParent){ el=el.parentNode; } this.init(el, opts); var $el = $(el); if (opts.replaceParent === true) { var oldParent = $el.parent(); $el.css("height", oldParent.height()).css("width", oldParent.width()); $el.insertBefore($el.parent()); //$el.parent().parent().append($el); oldParent.remove(); } this.container = this.el; $el.css("-webkit-overflow-scrolling", "touch"); if(opts.autoEnable) this.autoEnable=opts.autoEnable; if(this.autoEnable) this.enable(); }; nativeScroller.prototype = new scrollerCore(); jsScroller.prototype = new scrollerCore(); ///Native scroller nativeScroller.prototype.defaultProperties = function () { this.refreshContainer = null; this.dY = this.cY = 0; this.dX = this.cX = 0; this.cancelPropagation = false; this.loggedPcentY = 0; this.loggedPcentX = 0; this.xReset=0; this.yReset=0; var that = this; this.adjustScrollOverflowProxy = function () { that.afEl.css("overflow", "auto"); that.afEl.parent().css("overflow","hidden"); }; }; nativeScroller.prototype.enable = function (firstExecution) { if (this.eventsActive) return; this.eventsActive = true; //unlock overflow this.el.style.overflow = "auto"; //this.el.parentNode.style.overflow="hidden"; //set current scroll if (!firstExecution) this.adjustScroll(); //set events this.el.addEventListener("touchstart", this, false); this.el.addEventListener("scroll", this, false); this.updateP2rHackPosition(); }; nativeScroller.prototype.disable = function (destroy) { if (!this.eventsActive) return; //log current scroll this.logPos(this.el.scrollLeft, this.el.scrollTop); //lock overflow if (!destroy&&!$.ui) { this.el.style.overflow = "hidden"; } //remove events this.el.removeEventListener("touchstart", this, false); this.el.removeEventListener("touchmove", this, false); this.el.removeEventListener("touchend", this, false); this.el.removeEventListener("scroll", this, false); this.eventsActive = false; }; nativeScroller.prototype.addPullToRefresh = function (el, leaveRefresh) { if (!leaveRefresh) this.refresh = true; if (this.refresh && this.refresh === true) { this.coreAddPullToRefresh(el); this.refreshContainer.style.position = "absolute"; this.refreshContainer.style.top = "-60px"; this.refreshContainer.style.height = "60px"; this.refreshContainer.style.display = "block"; this.updateP2rHackPosition(); } }; nativeScroller.prototype.updateP2rHackPosition=function(){ if(!this.refresh) return $(this.el).find(".p2rhack").remove(); var el=$(this.el).find(".p2rhack"); if(el.length === 0){ $(this.el).append("<div class='p2rhack' style='position:absolute;width:1px;height:1px;opacity:0;background:transparent;z-index:-1;-webkit-transform:translate3d(-1px,0,0);'></div>"); el=$(this.el).find(".p2rhack"); } el.css("top",this.el.scrollHeight+this.refreshHeight+1+"px"); }; nativeScroller.prototype.onTouchStart = function (e) { this.lastScrollInfo= { top:0 }; this.xReset=this.yReset=0; if(this.verticalScroll){ if(this.el.scrollTop===0&&this.refresh){ this.el.scrollTop=1; this.yReset=-1; } if(this.el.scrollTop===(this.el.scrollHeight - this.el.clientHeight)&&this.infinite){ this.el.scrollTop-=1; this.yReset=1; } } if(this.horizontalScroll){ if(this.el.scrollLeft===0){ this.el.scrollLeft=1; this.xReset=-1; } if(this.el.scrollLeft===(this.el.scrollWidth-this.el.clientWidth)){ this.el.scrollLeft-=1; this.xReset=1; } } if (this.refreshCancelCB) clearTimeout(this.refreshCancelCB); //get refresh ready if(this.refresh) this.el.addEventListener("touchend",this,false); this.el.addEventListener("touchmove", this,false); this.dY = e.touches[0].pageY; this.dX = e.touches[0].pageX; this.startTop=this.el.scrollTop; this.startLeft=this.el.scrollLeft; if (this.refresh || this.infinite) { if (this.refresh && this.dY < 0) { this.showRefresh(); } } }; nativeScroller.prototype.onTouchMove = function (e) { var newcY = e.touches[0].pageY - this.dY; var newcX = e.touches[0].pageX - this.dX; //var scorllTop var atTop=(this.el.scrollHeight-this.el.scrollTop)===this.el.clientHeight&&newcY<0; var atRight=(this.el.scrollWidth-this.el.scrollLeft)===this.el.clientWidth&&newcX<0; var preventDefault=e.target.tagName.toLowerCase()!=="input"; if(this.verticalScroll){ if(this.startTop===0&&this.el.scrollTop===0&&newcY>0) preventDefault&&e.preventDefault(); } if(this.horizontalScroll&&this.startTop===0&&this.el.scrollLeft===0&&newcX>0){ preventDefault&&e.preventDefault(); } if(this.verticalScroll&&atTop){ preventDefault&&e.preventDefault(); } if(this.horizontalScroll&&atRight){ preventDefault&&e.preventDefault(); } if (!this.moved) { $.trigger(this, "scrollstart", [this.el,{x:newcX,y:newcY}]); $.trigger($.touchLayer, "scrollstart", [this.el,{x:newcX,y:newcY}]); if(!this.refresh) this.el.addEventListener("touchend", this, false); this.moved = true; } if(this.horizontalScroll){ if(Math.abs(newcY)>Math.abs(newcX)){ e.preventDefault(); } } //check for trigger if (this.refresh && (this.el.scrollTop < -this.refreshHeight)) { this.showRefresh(); //check for cancel when refresh is running } else if (this.refresh && this.refreshTriggered && this.refreshRunning && (this.el.scrollTop > this.refreshHeight)) { this.refreshTriggered = false; this.refreshRunning = false; if (this.refreshCancelCB) clearTimeout(this.refreshCancelCB); this.hideRefresh(false); this.setRefreshContent("Pull to Refresh"); $.trigger(this, "refresh-cancel"); //check for cancel when refresh is not running } else if (this.refresh && this.refreshTriggered && !this.refreshRunning && (this.el.scrollTop > -this.refreshHeight)) { this.refreshTriggered = false; this.refreshRunning = false; if (this.refreshCancelCB) clearTimeout(this.refreshCancelCB); this.hideRefresh(false); this.setRefreshContent("Pull to Refresh"); $.trigger(this, "refresh-cancel"); } this.cY = newcY; this.cX = newcX; this.lastScrollInfo.top=this.cY; if(this.initScrollProgress){ $.trigger(this,"scroll",[{x:-this.el.scrollLeft,y:-this.el.scrollTop}]); $.trigger($.touchLayer,"scroll",[{x:-this.el.scrollLeft,y:-this.el.scrollTop}]); } }; nativeScroller.prototype.showRefresh = function () { if (!this.refreshTriggered) { this.refreshTriggered = true; this.setRefreshContent("Release to Refresh"); $.trigger(this, "refresh-trigger"); } }; nativeScroller.prototype.onTouchEnd = function () { var triggered = this.el.scrollTop <= -(this.refreshHeight); var that=this; this.fireRefreshRelease(triggered, true); if(!this.moved){ this.el.scrollTop+=this.yReset; this.el.scrollLeft+=this.xReset; } if (triggered&&this.refresh) { //lock in place //that.refreshContainer.style.position = ""; //iOS has a bug that it will jump when scrolling back up, so we add a fake element while we reset the pull to refresh position //then we remove it right away var tmp=$.create("<div style='height:"+this.el.clientHeight+this.refreshHeight+"px;width:1px;-webkit-transform:translated3d(-1px,0,0)'></div>"); $(this.el).append(tmp); that.refreshContainer.style.top = "0px"; that.refreshContainer.style.position=""; setTimeout(function(){ tmp.remove(); }); } //this.dY = this.cY = 0; this.el.removeEventListener("touchmove", this, false); this.el.removeEventListener("touchend", this, false); this.infiniteEndCheck = true; if (this.infinite && !this.infiniteTriggered && ((this.el.scrollTop) >= (this.el.scrollHeight - this.el.clientHeight))) { this.infiniteTriggered = true; $.trigger(this, "infinite-scroll"); this.infiniteEndCheck = true; } this.touchEndFired = true; //pollyfil for scroll end since webkit doesn"t give any events during the "flick" var max = 200; var self = this; var currPos = { top: this.el.scrollTop, left: this.el.scrollLeft }; var counter = 0; clearInterval(self.nativePolling); self.nativePolling = setInterval(function () { counter++; if(counter === parseInt(max/8,10)) { if(self.initScrollProgress){ $.trigger(self,"scroll",[{x:-self.el.scrollLeft+self.cX,y:-self.el.scrollTop+self.cY}]); $.trigger($.touchLayer,"scroll",[{x:-self.el.scrollLeft+self.cX,y:-self.el.scrollTop+self.cY}]); } } if (counter >= max) { clearInterval(self.nativePolling); if(self.initScrollProgress){ $.trigger(self,"scroll",[{x:-self.el.scrollLeft,y:-self.el.scrollTop}]); $.trigger($.touchLayer,"scroll",[{x:-self.el.scrollLeft,y:-self.el.scrollTop}]); } return; } if (self.el.scrollTop !== currPos.top || self.el.scrollLeft !== currPos.left) { clearInterval(self.nativePolling); $.trigger($.touchLayer, "scrollend", [self.el]); //notify touchLayer of this elements scrollend $.trigger(self, "scrollend", [self.el]); if(self.initScrollProgress){ $.trigger(self,"scroll",[{x:-self.el.scrollLeft,y:-self.el.scrollTop}]); $.trigger($.touchLayer,"scroll",[{x:-self.el.scrollLeft,y:-self.el.scrollTop}]); } } }, 20); }; nativeScroller.prototype.hideRefresh = function (animate) { if (this.preventHideRefresh) return; var that = this; var endAnimationCb = function (canceled) { that.refreshContainer.style.top = "-60px"; that.refreshContainer.style.position = "absolute"; that.dY = that.cY = 0; if (!canceled) { //not sure if this should be the correct logic.... that.el.style[$.feat.cssPrefix + "Transform"] = "none"; that.el.style[$.feat.cssPrefix + "TransitionProperty"] = "none"; that.el.scrollTop = 0; that.logPos(that.el.scrollLeft, 0); that.refreshRunning = false; that.setRefreshContent("Pull to Refresh"); $.trigger(that, "refresh-finish"); } }; if (animate === false || !that.afEl.css3Animate) { endAnimationCb(); } else { that.afEl.css3Animate({ y: (that.el.scrollTop - that.refreshHeight) + "px", x: "0%", time: HIDE_REFRESH_TIME + "ms", complete: endAnimationCb }); } this.refreshTriggered = false; //this.el.addEventListener("touchend", this, false); }; nativeScroller.prototype.hideScrollbars = function () {}; nativeScroller.prototype.scrollTo = function (pos, time) { this.logPos(pos.x, pos.y); pos.x *= -1; pos.y *= -1; return this._scrollTo(pos, time); }; nativeScroller.prototype.scrollBy = function (pos, time) { pos.x += this.el.scrollLeft; pos.y += this.el.scrollTop; this.logPos(this.el.scrollLeft, this.el.scrollTop); return this._scrollTo(pos, time); }; nativeScroller.prototype.scrollToBottom = function (time) { //this.el.scrollTop = this.el.scrollHeight; this._scrollToBottom(time); this.logPos(this.el.scrollLeft, this.el.scrollTop); }; nativeScroller.prototype.onScroll = function () { if (this.infinite && this.touchEndFired) { this.touchEndFired = false; return; } if (this.scrollSkip) { this.scrollSkip = false; return; } if (this.infinite) { if (!this.infiniteTriggered && (this.el.scrollTop >= (this.el.scrollHeight - this.el.clientHeight))) { this.infiniteTriggered = true; $.trigger(this, "infinite-scroll"); this.infiniteEndCheck = true; } } var that = this; if (this.infinite && this.infiniteEndCheck && this.infiniteTriggered) { this.infiniteEndCheck = false; $.trigger(that, "infinite-scroll-end"); } }; nativeScroller.prototype.logPos = function (x, y) { this.loggedPcentX = this.divide(x, (this.el.scrollWidth)); this.loggedPcentY = this.divide(y, (this.el.scrollHeight)); this.scrollLeft = x; this.scrollTop = y; if (isNaN(this.loggedPcentX)) this.loggedPcentX = 0; if (isNaN(this.loggedPcentY)) this.loggedPcentY = 0; }; nativeScroller.prototype.adjustScroll = function () { this.adjustScrollOverflowProxy(); this.el.scrollLeft = this.loggedPcentX * (this.el.scrollWidth); this.el.scrollTop = this.loggedPcentY * (this.el.scrollHeight); this.logPos(this.el.scrollLeft, this.el.scrollTop); }; //JS scroller jsScroller.prototype.defaultProperties = function () { this.boolScrollLock = false; this.currentScrollingObject = null; this.elementInfo = null; this.verticalScroll = true; this.horizontalScroll = false; this.scrollBars = true; this.vscrollBar = null; this.hscrollBar = null; this.hScrollCSS = "scrollBar"; this.vScrollCSS = "scrollBar"; this.firstEventInfo = null; this.moved = false; this.preventPullToRefresh = true; this.isScrolling = false; this.androidFormsMode = false; this.refreshSafeKeep = false; this.lastScrollbar = ""; this.finishScrollingObject = null; this.container = null; this.scrollingFinishCB = null; this.loggedPcentY = 0; this.loggedPcentX = 0; this.androidPerfHack=0; }; function createScrollBar(width, height) { var scrollDiv = document.createElement("div"); scrollDiv.style.position = "absolute"; scrollDiv.style.width = width + "px"; scrollDiv.style.height = height + "px"; scrollDiv.style[$.feat.cssPrefix + "BorderRadius"] = "2px"; scrollDiv.style.borderRadius = "2px"; scrollDiv.style.display="none"; scrollDiv.className = "scrollBar"; scrollDiv.style.background = "black"; return scrollDiv; } jsScroller.prototype.enable = function (firstExecution) { if (this.eventsActive) return; this.eventsActive = true; if (!firstExecution) this.adjustScroll(); else this.scrollerMoveCSS({ x: 0, y: 0 }, 0); //add listeners this.container.addEventListener("touchstart", this, false); this.container.addEventListener("touchmove", this, false); this.container.addEventListener("touchend", this, false); }; jsScroller.prototype.adjustScroll = function () { //set top/left var size = this.getViewportSize(); this.scrollerMoveCSS({ x: Math.round(this.loggedPcentX * (this.el.clientWidth - size.w)), y: Math.round(this.loggedPcentY * (this.el.clientHeight - size.h)) }, 0); }; jsScroller.prototype.disable = function () { if (!this.eventsActive) return; //log top/left var cssMatrix = this.getCSSMatrix(this.el); this.logPos((numOnly(cssMatrix.e) - numOnly(this.container.scrollLeft)), (numOnly(cssMatrix.f) - numOnly(this.container.scrollTop))); //remove event listeners this.container.removeEventListener("touchstart", this, false); this.container.removeEventListener("touchmove", this, false); this.container.removeEventListener("touchend", this, false); this.eventsActive = false; }; jsScroller.prototype.addPullToRefresh = function (el, leaveRefresh) { if (!leaveRefresh) this.refresh = true; if (this.refresh && this.refresh === true) { this.coreAddPullToRefresh(el); this.el.style.overflow = "visible"; } }; jsScroller.prototype.hideScrollbars = function () { if (this.hscrollBar) { this.hscrollBar.style.display="none"; this.hscrollBar.style[$.feat.cssPrefix + "TransitionDuration"] = "0ms"; } if (this.vscrollBar) { this.vscrollBar.style.display="none"; this.vscrollBar.style[$.feat.cssPrefix + "TransitionDuration"] = "0ms"; } }; jsScroller.prototype.getViewportSize = function () { var style = window.getComputedStyle(this.container); if (isNaN(numOnly(style.paddingTop))) window.alert((typeof style.paddingTop) + "::" + style.paddingTop + ":"); return { h: (this.container.clientHeight > window.innerHeight ? window.innerHeight : this.container.clientHeight - numOnly(style.paddingTop) - numOnly(style.paddingBottom)), w: (this.container.clientWidth > window.innerWidth ? window.innerWidth : this.container.clientWidth - numOnly(style.paddingLeft) - numOnly(style.paddingRight)) }; }; jsScroller.prototype.onTouchStart = function (event) { this.moved = false; this.currentScrollingObject = null; $(this.el).animateCss().stop(); if (!this.container) return; if (this.refreshCancelCB) { clearTimeout(this.refreshCancelCB); this.refreshCancelCB = null; } if (this.scrollingFinishCB) { clearTimeout(this.scrollingFinishCB); this.scrollingFinishCB = null; } //disable if locked if (event.touches.length !== 1 || this.boolScrollLock) return; // Allow interaction to legit calls, like select boxes, etc. if (event.touches[0].target && event.touches[0].target.type !== undefined) { var tagname = event.touches[0].target.tagName.toLowerCase(); if (tagname === "select" ) // stuff we need to allow // access to legit calls return; } //default variables var scrollInfo = { //current position top: 0, left: 0, //current movement speedY: 0, speedX: 0, absSpeedY: 0, absSpeedX: 0, deltaY: 0, deltaX: 0, absDeltaY: 0, absDeltaX: 0, y: 0, x: 0, duration: 0 }; //element info this.elementInfo = {}; var size = this.getViewportSize(); this.elementInfo.bottomMargin = size.h; this.elementInfo.maxTop = (this.el.clientHeight - this.elementInfo.bottomMargin); if (this.elementInfo.maxTop < 0) this.elementInfo.maxTop = 0; this.elementInfo.divHeight = this.el.clientHeight; this.elementInfo.rightMargin = size.w; this.elementInfo.maxLeft = (this.el.clientWidth - this.elementInfo.rightMargin); if (this.elementInfo.maxLeft < 0) this.elementInfo.maxLeft = 0; this.elementInfo.divWidth = this.el.clientWidth; this.elementInfo.hasVertScroll = this.verticalScroll || this.elementInfo.maxTop > 0; this.elementInfo.hasHorScroll = this.elementInfo.maxLeft > 0; this.elementInfo.requiresVScrollBar = this.vscrollBar && this.elementInfo.hasVertScroll; this.elementInfo.requiresHScrollBar = this.hscrollBar && this.elementInfo.hasHorScroll; //save event this.saveEventInfo(event); this.saveFirstEventInfo(event); //get the current top var cssMatrix = this.getCSSMatrix(this.el); scrollInfo.top = numOnly(cssMatrix.f) - numOnly(this.container.scrollTop); scrollInfo.left = numOnly(cssMatrix.e) - numOnly(this.container.scrollLeft); this.container.scrollTop = this.container.scrollLeft = 0; this.currentScrollingObject = this.el; //get refresh ready if (this.refresh && scrollInfo.top === 0) { this.refreshContainer.style.display = "block"; this.refreshHeight = this.refreshContainer.firstChild.clientHeight; this.refreshContainer.firstChild.style.top = (-this.refreshHeight) + "px"; this.refreshContainer.style.overflow = "visible"; this.preventPullToRefresh = false; } else if (scrollInfo.top < 0) { this.preventPullToRefresh = true; if (this.refresh) this.refreshContainer.style.overflow = "hidden"; } //set target scrollInfo.x = scrollInfo.left; scrollInfo.y = scrollInfo.top; //vertical scroll bar if (this.setVScrollBar(scrollInfo, 0, 0)) { if (this.container.clientWidth > window.innerWidth) this.vscrollBar.style.right = "0px"; else this.vscrollBar.style.right = "0px"; this.vscrollBar.style[$.feat.cssPrefix + "Transition"] = ""; $(this.vscrollBar).animateCss().stop(); } //horizontal scroll if (this.setHScrollBar(scrollInfo, 0, 0)) { if (this.container.clientHeight > window.innerHeight) this.hscrollBar.style.top = (window.innerHeight - numOnly(this.hscrollBar.style.height)) + "px"; else this.hscrollBar.style.bottom = numOnly(this.hscrollBar.style.height); this.hscrollBar.style[$.feat.cssPrefix + "Transition"] = ""; $(this.hscrollBar).animateCss().stop(); } //save scrollInfo this.lastScrollInfo = scrollInfo; this.hasMoved = false; if(this.elementInfo.maxTop === 0 && this.elementInfo.maxLeft === 0 && this.lockBounce) this.scrollToTop(0); else this.scrollerMoveCSS(this.lastScrollInfo, 0); this.scrollerMoveCSS(this.lastScrollInfo, 0); }; jsScroller.prototype.getCSSMatrix = function (el) { if (this.androidFormsMode) { //absolute mode var top = parseInt(el.style.marginTop,10); var left = parseInt(el.style.marginLeft,10); if (isNaN(top)) top = 0; if (isNaN(left)) left = 0; return { f: top, e: left }; } else { //regular transform var obj = $.getCssMatrix(el); return obj; } }; jsScroller.prototype.saveEventInfo = function (event) { this.lastEventInfo = { pageX: event.touches[0].pageX, pageY: event.touches[0].pageY, time: event.timeStamp }; }; jsScroller.prototype.saveFirstEventInfo = function (event) { this.firstEventInfo = { pageX: event.touches[0].pageX, pageY: event.touches[0].pageY, time: event.timeStamp }; }; jsScroller.prototype.setVScrollBar = function (scrollInfo, time, timingFunction) { if (!this.elementInfo.requiresVScrollBar) return false; var newHeight = (parseFloat(this.elementInfo.bottomMargin / this.elementInfo.divHeight) * this.elementInfo.bottomMargin) + "px"; if(numOnly(newHeight) > this.elementInfo.bottomMargin) newHeight = this.elementInfo.bottomMargin+"px"; if (newHeight !== this.vscrollBar.style.height) this.vscrollBar.style.height = newHeight; var pos = (this.elementInfo.bottomMargin - numOnly(this.vscrollBar.style.height)) - (((this.elementInfo.maxTop + scrollInfo.y) / this.elementInfo.maxTop) * (this.elementInfo.bottomMargin - numOnly(this.vscrollBar.style.height))); if (pos > this.elementInfo.bottomMargin) pos = this.elementInfo.bottomMargin; if (pos < 0) pos = 0; this.scrollbarMoveCSS(this.vscrollBar, { x: 0, y: pos }, time, timingFunction); return true; }; jsScroller.prototype.setHScrollBar = function (scrollInfo, time, timingFunction) { if (!this.elementInfo.requiresHScrollBar) return false; var newWidth = (parseFloat(this.elementInfo.rightMargin / this.elementInfo.divWidth) * this.elementInfo.rightMargin) + "px"; if (newWidth !== this.hscrollBar.style.width) this.hscrollBar.style.width = newWidth; var pos = (this.elementInfo.rightMargin - numOnly(this.hscrollBar.style.width)) - (((this.elementInfo.maxLeft + scrollInfo.x) / this.elementInfo.maxLeft) * (this.elementInfo.rightMargin - numOnly(this.hscrollBar.style.width))); if (pos > this.elementInfo.rightMargin) pos = this.elementInfo.rightMargin; if (pos < 0) pos = 0; this.scrollbarMoveCSS(this.hscrollBar, { x: pos, y: 0 }, time, timingFunction); return true; }; jsScroller.prototype.onTouchMove = function (event) { if (this.currentScrollingObject === null) return; //event.preventDefault(); var scrollInfo = this.calculateMovement(event); this.calculateTarget(scrollInfo); this.lastScrollInfo = scrollInfo; if (!this.moved) { $.trigger(this, "scrollstart",[this.el,{x:this.lastScrollInfo.top,y:this.lastScrollInfo.left}]); $.trigger($.touchLayer, "scrollstart", [this.el,{x:this.lastScrollInfo.top,y:this.lastScrollInfo.left}]); if (this.elementInfo.requiresVScrollBar) this.vscrollBar.style.display="block"; if (this.elementInfo.requiresHScrollBar) this.hscrollBar.style.display="block"; } this.moved = true; if (this.refresh && scrollInfo.top === 0) { this.refreshContainer.style.display = "block"; this.refreshHeight = this.refreshContainer.firstChild.clientHeight; this.refreshContainer.firstChild.style.top = (-this.refreshHeight) + "px"; this.refreshContainer.style.overflow = "visible"; this.preventPullToRefresh = false; } else if (scrollInfo.top < 0) { this.preventPullToRefresh = true; if (this.refresh) this.refreshContainer.style.overflow = "hidden"; } this.saveEventInfo(event); if (this.isScrolling===false){ // && (this.lastScrollInfo.x != this.lastScrollInfo.left || this.lastScrollInfo.y != this.lastScrollInfo.top)) { this.isScrolling = true; if (this.onScrollStart) this.onScrollStart(); } //proceed normally var cssMatrix = this.getCSSMatrix(this.el); this.lastScrollInfo.top = numOnly(cssMatrix.f); this.lastScrollInfo.left = numOnly(cssMatrix.e); this.recalculateDeltaY(this.lastScrollInfo); this.recalculateDeltaX(this.lastScrollInfo); //boundaries control this.checkYboundary(this.lastScrollInfo); if (this.elementInfo.hasHorScroll) this.checkXboundary(this.lastScrollInfo); //pull to refresh elastic var positiveOverflow = this.lastScrollInfo.y > 0 && this.lastScrollInfo.deltaY > 0; var negativeOverflow = this.lastScrollInfo.y < -this.elementInfo.maxTop && this.lastScrollInfo.deltaY < 0; var overflow,pcent,baseTop; if (positiveOverflow || negativeOverflow) { overflow = positiveOverflow ? this.lastScrollInfo.y : -this.lastScrollInfo.y - this.elementInfo.maxTop; pcent = (this.container.clientHeight - overflow) / this.container.clientHeight; if (pcent < 0.5) pcent = 0.5; //cur top, maxTop or 0? baseTop = 0; if ((positiveOverflow && this.lastScrollInfo.top > 0) || (negativeOverflow && this.lastScrollInfo.top < -this.elementInfo.maxTop)) { baseTop = this.lastScrollInfo.top; } else if (negativeOverflow) { baseTop = -this.elementInfo.maxTop; } var changeY = this.lastScrollInfo.deltaY * pcent; var absChangeY = Math.abs(this.lastScrollInfo.deltaY * pcent); if (absChangeY < 1) changeY = positiveOverflow ? 1 : -1; this.lastScrollInfo.y = baseTop + changeY; } if(this.elementInfo.hasHorScroll){ positiveOverflow = this.lastScrollInfo.x > 0 && this.lastScrollInfo.deltaX > 0; negativeOverflow = this.lastScrollInfo.x < -this.elementInfo.maxLeft && this.lastScrollInfo.deltaX < 0; if (positiveOverflow || negativeOverflow) { overflow = positiveOverflow ? this.lastScrollInfo.x : -this.lastScrollInfo.x - this.elementInfo.maxLeft; pcent = (this.container.clientWidth - overflow) / this.container.clientWidth; if (pcent < 0.5) pcent = 0.5; //cur top, maxTop or 0? baseTop = 0; if ((positiveOverflow && this.lastScrollInfo.left > 0) || (negativeOverflow && this.lastScrollInfo.left < -this.elementInfo.maxLeft)) { baseTop = this.lastScrollInfo.left; } else if (negativeOverflow) { baseTop = -this.elementInfo.maxLeft; } var changeX = this.lastScrollInfo.deltaX * pcent; var absChangeX = Math.abs(this.lastScrollInfo.deltaX * pcent); if (absChangeX < 1) changeX = positiveOverflow ? 1 : -1; this.lastScrollInfo.x = baseTop + changeX; } } if(this.lockBounce||(!this.refresh)){ if(this.lastScrollInfo.x>0){ this.lastScrollInfo.x=0; // this.hscrollBar.style.display="none"; } else if(this.lastScrollInfo.x*-1>this.elementInfo.maxLeft){ this.lastScrollInfo.x=this.elementInfo.maxLeft*-1; // this.hscrollBar.style.display="none"; } if(this.lastScrollInfo.y>0){ this.lastScrollInfo.y=0; //this.vscrollBar.style.display="none"; } else if(this.lastScrollInfo.y*-1>this.elementInfo.maxTop){ // this.vscrollBar.style.display="none"; this.lastScrollInfo.y=this.elementInfo.maxTop*-1; } } //move this.scrollerMoveCSS(this.lastScrollInfo, 0); this.setVScrollBar(this.lastScrollInfo, 0, 0); this.setHScrollBar(this.lastScrollInfo, 0, 0); //check refresh triggering if (this.refresh && !this.preventPullToRefresh) { if (!this.refreshTriggered && this.lastScrollInfo.top > this.refreshHeight) { this.refreshTriggered = true; this.setRefreshContent("Release to Refresh"); $.trigger(this, "refresh-trigger"); } else if (this.refreshTriggered && this.lastScrollInfo.top < this.refreshHeight) { this.refreshTriggered = false; this.setRefreshContent("Pull to Refresh"); $.trigger(this, "refresh-cancel"); } } if (this.infinite && !this.infiniteTriggered) { if ((Math.abs(this.lastScrollInfo.top) > (this.el.clientHeight - this.container.clientHeight))) { this.infiniteTriggered = true; $.trigger(this, "infinite-scroll"); } } }; jsScroller.prototype.calculateMovement = function (event, last) { //default variables var scrollInfo = { //current position top: 0, left: 0, //current movement speedY: 0, speedX: 0, absSpeedY: 0, absSpeedX: 0, deltaY: 0, deltaX: 0, absDeltaY: 0, absDeltaX: 0, y: 0, x: 0, duration: 0 }; var prevEventInfo = last ? this.firstEventInfo : this.lastEventInfo; var pageX = last ? event.pageX : event.touches[0].pageX; var pageY = last ? event.pageY : event.touches[0].pageY; var time = last ? event.time : event.timeStamp; scrollInfo.deltaY = this.elementInfo.hasVertScroll ? pageY - prevEventInfo.pageY : 0; scrollInfo.deltaX = this.elementInfo.hasHorScroll ? pageX - prevEventInfo.pageX : 0; scrollInfo.time = time; scrollInfo.duration = time - prevEventInfo.time; return scrollInfo; }; jsScroller.prototype.calculateTarget = function (scrollInfo) { scrollInfo.y = this.lastScrollInfo.y + scrollInfo.deltaY; scrollInfo.x = this.lastScrollInfo.x + scrollInfo.deltaX; if(Math.abs(scrollInfo.deltaY)>0) scrollInfo.y+=(scrollInfo.deltaY>0?1:-1)*(this.elementInfo.divHeight*this.androidPerfHack); if(Math.abs(scrollInfo.deltaX)>0) scrollInfo.x+=(scrollInfo.deltaX>0?1:-1)*(this.elementInfo.divWidth*this.androidPerfHack); }; jsScroller.prototype.checkYboundary = function (scrollInfo) { var minTop = this.container.clientHeight / 2; var maxTop = this.elementInfo.maxTop + minTop; //y boundaries if (scrollInfo.y > minTop) scrollInfo.y = minTop; else if (-scrollInfo.y > maxTop) scrollInfo.y = -maxTop; else return; this.recalculateDeltaY(scrollInfo); }; jsScroller.prototype.checkXboundary = function (scrollInfo) { //x boundaries var minLeft=this.container.clientWidth/2; var maxLeft=this.elementInfo.maxLeft+minLeft; if (scrollInfo.x > minLeft) scrollInfo.x = minLeft; else if (-scrollInfo.x > maxLeft) scrollInfo.x = -maxLeft; else return; this.recalculateDeltaX(scrollInfo); }; jsScroller.prototype.recalculateDeltaY = function (scrollInfo) { //recalculate delta var oldAbsDeltaY = Math.abs(scrollInfo.deltaY); scrollInfo.deltaY = scrollInfo.y - scrollInfo.top; var newAbsDeltaY = Math.abs(scrollInfo.deltaY); //recalculate duration at same speed scrollInfo.duration = scrollInfo.duration * newAbsDeltaY / oldAbsDeltaY; }; jsScroller.prototype.recalculateDeltaX = function (scrollInfo) { //recalculate delta var oldAbsDeltaX = Math.abs(scrollInfo.deltaX); scrollInfo.deltaX = scrollInfo.x - scrollInfo.left; var newAbsDeltaX = Math.abs(scrollInfo.deltaX); //recalculate duration at same speed scrollInfo.duration = scrollInfo.duration * newAbsDeltaX / oldAbsDeltaX; }; jsScroller.prototype.hideRefresh = function (animate) { var that = this; if (this.preventHideRefresh) return; var endAnimationCb = function () { that.setRefreshContent("Pull to Refresh"); $.trigger(that, "refresh-finish"); }; this.scrollerMoveCSS({x: 0, y: 0}, HIDE_REFRESH_TIME); if (animate === false || !that.afEl.css3Animate) { endAnimationCb(); } else { that.afEl.css3Animate({ time: HIDE_REFRESH_TIME + "ms", complete: endAnimationCb }); } this.refreshTriggered = false; }; jsScroller.prototype.setMomentum = function (scrollInfo) { var deceleration = 0.0008; //calculate movement speed scrollInfo.speedY = this.divide(scrollInfo.deltaY, scrollInfo.duration); scrollInfo.speedX = this.divide(scrollInfo.deltaX, scrollInfo.duration); scrollInfo.absSpeedY = Math.abs(scrollInfo.speedY); scrollInfo.absSpeedX = Math.abs(scrollInfo.speedX); scrollInfo.absDeltaY = Math.abs(scrollInfo.deltaY); scrollInfo.absDeltaX = Math.abs(scrollInfo.deltaX); //set momentum if (scrollInfo.absDeltaY > 0) { scrollInfo.deltaY += (scrollInfo.deltaY < 0 ? -1 : 1) * (scrollInfo.absSpeedY * scrollInfo.absSpeedY) / (2 * deceleration); scrollInfo.absDeltaY = Math.abs(scrollInfo.deltaY); scrollInfo.duration = scrollInfo.absSpeedY / deceleration; scrollInfo.speedY = scrollInfo.deltaY / scrollInfo.duration; scrollInfo.absSpeedY = Math.abs(scrollInfo.speedY); if (scrollInfo.absSpeedY < deceleration * 100 || scrollInfo.absDeltaY < 5) scrollInfo.deltaY = scrollInfo.absDeltaY = scrollInfo.duration = scrollInfo.speedY = scrollInfo.absSpeedY = 0; } else if (scrollInfo.absDeltaX) { scrollInfo.deltaX += (scrollInfo.deltaX < 0 ? -1 : 1) * (scrollInfo.absSpeedX * scrollInfo.absSpeedX) / (2 * deceleration); scrollInfo.absDeltaX = Math.abs(scrollInfo.deltaX); scrollInfo.duration = scrollInfo.absSpeedX / deceleration; scrollInfo.speedX = scrollInfo.deltaX / scrollInfo.duration; scrollInfo.absSpeedX = Math.abs(scrollInfo.speedX); if (scrollInfo.absSpeedX < deceleration * 100 || scrollInfo.absDeltaX < 5) scrollInfo.deltaX = scrollInfo.absDeltaX = scrollInfo.duration = scrollInfo.speedX = scrollInfo.absSpeedX = 0; } else scrollInfo.duration = 0; }; jsScroller.prototype.onTouchEnd = function () { if (this.currentScrollingObject === null || !this.moved) return; //event.preventDefault(); this.finishScrollingObject = this.currentScrollingObject; this.currentScrollingObject = null; var scrollInfo = this.calculateMovement(this.lastEventInfo, true); if (!this.androidFormsMode) { this.setMomentum(scrollInfo); } this.calculateTarget(scrollInfo); //get the current top var cssMatrix = this.getCSSMatrix(this.el); scrollInfo.top = numOnly(cssMatrix.f); scrollInfo.left = numOnly(cssMatrix.e); //boundaries control this.checkYboundary(scrollInfo); if (this.elementInfo.hasHorScroll) this.checkXboundary(scrollInfo); var triggered = !this.preventPullToRefresh && (scrollInfo.top > this.refreshHeight || scrollInfo.y > this.refreshHeight); this.fireRefreshRelease(triggered, scrollInfo.top > 0); //refresh hang in if (this.refresh && triggered) { scrollInfo.y = this.refreshHeight; scrollInfo.duration = HIDE_REFRESH_TIME; //top boundary } else if (scrollInfo.y >= 0) { scrollInfo.y = 0; if (scrollInfo.top >= 0) scrollInfo.duration = HIDE_REFRESH_TIME; //lower boundary } else if (-scrollInfo.y > this.elementInfo.maxTop || this.elementInfo.maxTop === 0) { scrollInfo.y = -this.elementInfo.maxTop; if (-scrollInfo.top > this.elementInfo.maxTop) scrollInfo.duration = HIDE_REFRESH_TIME; //all others } if(this.elementInfo.hasHorScroll){ if(scrollInfo.x>=0) { scrollInfo.x=0; if(scrollInfo.left>=0&&this.refresh) scrollInfo.duration=HIDE_REFRESH_TIME; } else if(-scrollInfo.x>this.elementInfo.maxLeft||this.elementInfo.maxLeft===0){ scrollInfo.x=-this.elementInfo.maxLeft; if(-scrollInfo.left>this.elementInfo.maxLeft&&this.refresh) scrollInfo.duration=HIDE_REFRESH_TIME; } } if ((scrollInfo.x === scrollInfo.left && scrollInfo.y === scrollInfo.top) || this.androidFormsMode) scrollInfo.duration = 0; this.scrollerMoveCSS(scrollInfo, scrollInfo.duration, "cubic-bezier(0.33,0.66,0.66,1)"); this.setVScrollBar(scrollInfo, scrollInfo.duration, "cubic-bezier(0.33,0.66,0.66,1)"); this.setHScrollBar(scrollInfo, scrollInfo.duration, "cubic-bezier(0.33,0.66,0.66,1)"); this.setFinishCalback(scrollInfo.duration); if (this.infinite && !this.infiniteTriggered) { if ((Math.abs(scrollInfo.y) >= (this.el.clientHeight - this.container.clientHeight))) { var self = this; setTimeout(function(){ self.infiniteTriggered = true; $.trigger(self, "infinite-scroll"); },scrollInfo.duration-50); } } }; //finish callback jsScroller.prototype.setFinishCalback = function (duration) { var that = this; this.scrollingFinishCB = setTimeout(function () { that.hideScrollbars(); $.trigger($.touchLayer, "scrollend", [that.el]); //notify touchLayer of this elements scrollend $.trigger(that, "scrollend", [that.el]); that.isScrolling = false; that.elementInfo = null; //reset elementInfo when idle) if (that.infinite&&that.infiniteTriggered) $.trigger(that, "infinite-scroll-end"); }, duration); }; //Android Forms Fix jsScroller.prototype.startFormsMode = function () { if (this.blockFormsFix) return; //get prev values var cssMatrix = this.getCSSMatrix(this.el); //toggle vars this.refreshSafeKeep = this.refresh; this.refresh = false; this.androidFormsMode = true; //set new css rules this.el.style[$.feat.cssPrefix + "Transform"] = "none"; this.el.style[$.feat.cssPrefix + "Transition"] = "none"; this.el.style[$.feat.cssPrefix + "Perspective"] = "none"; //set position this.scrollerMoveCSS({ x: numOnly(cssMatrix.e), y: numOnly(cssMatrix.f) }, 0); //container this.container.style[$.feat.cssPrefix + "Perspective"] = "none"; this.container.style[$.feat.cssPrefix + "BackfaceVisibility"] = "visible"; //scrollbars if (this.vscrollBar) { this.vscrollBar.style[$.feat.cssPrefix + "Transform"] = "none"; this.vscrollBar.style[$.feat.cssPrefix + "Transition"] = "none"; this.vscrollBar.style[$.feat.cssPrefix + "Perspective"] = "none"; this.vscrollBar.style[$.feat.cssPrefix + "BackfaceVisibility"] = "visible"; } if (this.hscrollBar) { this.hscrollBar.style[$.feat.cssPrefix + "Transform"] = "none"; this.hscrollBar.style[$.feat.cssPrefix + "Transition"] = "none"; this.hscrollBar.style[$.feat.cssPrefix + "Perspective"] = "none"; this.hscrollBar.style[$.feat.cssPrefix + "BackfaceVisibility"] = "visible"; } }; jsScroller.prototype.stopFormsMode = function () { if (this.blockFormsFix) return; //get prev values var cssMatrix = this.getCSSMatrix(this.el); //toggle vars this.refresh = this.refreshSafeKeep; this.androidFormsMode = false; //set new css rules this.el.style[$.feat.cssPrefix + "Perspective"] = 1000; this.el.style.marginTop = 0; this.el.style.marginLeft = 0; this.el.style[$.feat.cssPrefix + "Transition"] = "0ms linear"; //reactivate transitions //set position this.scrollerMoveCSS({ x: numOnly(cssMatrix.e), y: numOnly(cssMatrix.f) }, 0); //container this.container.style[$.feat.cssPrefix + "Perspective"] = 1000; this.container.style[$.feat.cssPrefix + "BackfaceVisibility"] = "hidden"; //scrollbars if (this.vscrollBar) { this.vscrollBar.style[$.feat.cssPrefix + "Perspective"] = 1000; this.vscrollBar.style[$.feat.cssPrefix + "BackfaceVisibility"] = "hidden"; } if (this.hscrollBar) { this.hscrollBar.style[$.feat.cssPrefix + "Perspective"] = 1000; this.hscrollBar.style[$.feat.cssPrefix + "BackfaceVisibility"] = "hidden"; } }; jsScroller.prototype.scrollerMoveCSS = function (distanceToMove, time, timingFunction) { if (!time) time = 0; if (!timingFunction) timingFunction = "linear"; time = numOnly(time); var self=this; if (this.el && this.el.style) { //do not touch the DOM if disabled if (this.eventsActive) { if (this.androidFormsMode) { this.el.style.marginTop = Math.round(distanceToMove.y) + "px"; this.el.style.marginLeft = Math.round(distanceToMove.x) + "px"; } else { var opts={ x:distanceToMove.x, y:distanceToMove.y, duration:time, easing:"easeOutSine" }; if(self.initScrollProgress){ opts.update=function(pos){ $.trigger(self,"scroll",[pos]); $.trigger($.touchLayer,"scroll",[pos]); }; } $(this.el).animateCss(opts).start(); } } // Position should be updated even when the scroller is disabled so we log the change this.logPos(distanceToMove.x, distanceToMove.y); } }; jsScroller.prototype.logPos = function (x, y) { var size; if (!this.elementInfo) { size = this.getViewportSize(); } else { size = { h: this.elementInfo.bottomMargin, w: this.elementInfo.rightMargin }; } this.loggedPcentX = this.divide(x, (this.el.clientWidth - size.w)); this.loggedPcentY = this.divide(y, (this.el.clientHeight - size.h)); this.scrollTop = y; this.scrollLeft = x; }; jsScroller.prototype.scrollbarMoveCSS = function (el, distanceToMove, time, timingFunction) { if (!time) time = 0; if (!timingFunction) timingFunction = "linear"; if (el && el.style) { if (this.androidFormsMode) { el.style.marginTop = Math.round(distanceToMove.y) + "px"; el.style.marginLeft = Math.round(distanceToMove.x) + "px"; } else { $(el).animateCss({x:distanceToMove.x,y:distanceToMove.y,duration:time,easing:"easeOutSine"}).start(); } } }; jsScroller.prototype.scrollTo = function (pos, time) { if (!time) time = 0; this.scrollerMoveCSS(pos, time); }; jsScroller.prototype.scrollBy = function (pos, time) { var cssMatrix = this.getCSSMatrix(this.el); var startTop = numOnly(cssMatrix.f); var startLeft = numOnly(cssMatrix.e); this.scrollTo({ y: startTop - pos.y, x: startLeft - pos.x }, time); }; jsScroller.prototype.scrollToBottom = function (time) { this.scrollTo({ y: -1 * (this.el.clientHeight - this.container.clientHeight), x: 0 }, time); }; jsScroller.prototype.scrollToTop = function (time) { this.scrollTo({ x: 0, y: 0 }, time); }; return scroller; })(); })(af); /** * copyright: 2011 Intel * description: This script will replace all drop downs with friendly select controls. Users can still interact * with the old drop down box as normal with javascript, and this will be reflected */ /* global af*/ /* global numOnly*/ (function($) { /*jshint camelcase: false, validthis:true */ "use strict"; function updateOption(prop, oldValue, newValue) { if (newValue === true) { if (!this.getAttribute("multiple")) $.selectBox.updateMaskValue(this.parentNode.id, this.text, this.value); this.parentNode.value = this.value; } return newValue; } function updateIndex(prop, oldValue, newValue) { if (this.options[newValue]) { if (!this.getAttribute("multiple")) $.selectBox.updateMaskValue(this.linker, this.options[newValue].value, this.options[newValue].text); this.value = this.options[newValue].value; } return newValue; } function destroy(e) { var el = e.target; $(el.linker).remove(); delete el.linker; e.stopPropagation(); } $.selectBox = { scroller: null, currLinker: null, getOldSelects: function(elID) { if (!$.os.android || $.os.androidICS) return; if (!$.fn.scroller) { window.alert("This library requires af.scroller"); return; } var container = elID && document.getElementById(elID) ? document.getElementById(elID) : document; if (!container) { window.alert("Could not find container element for af.selectBox " + elID); return; } var sels = container.getElementsByTagName("select"); var that = this; for (var i = 0; i < sels.length; i++) { var el = sels[i]; el.style.display = "none"; var fixer = $.create("div", { className: "afFakeSelect" }); fixer.get(0).linker = sels[i]; el.linker = fixer.get(0); fixer.insertAfter(sels[i]); el.watch("selectedIndex", updateIndex); for (var j = 0; j < el.options.length; j++) { el.options[j].watch("selected", updateOption); if (el.options[j].selected) fixer.html(el.options[j].text); } $(el).one("destroy", destroy); } that.createHtml(); }, updateDropdown: function(el) { if (!el) return; for (var j = 0; j < el.options.length; j++) { if (el.options[j].selected) el.linker.innerHTML = el.options[j].text; } el = null; }, initDropDown: function(el) { if (el.disabled) return; if (!el || !el.options || el.options.length === 0) return; var foundInd = 0; var $scr = $("#afSelectBoxfix"); $scr.html("<ul></ul>"); var $list = $scr.find("ul"); for (var j = 0; j < el.options.length; j++) { el.options[j].watch("selected", updateOption); var checked = (el.options[j].selected) ? "selected" : ""; if (checked) foundInd = j + 1; var row = $.create("li", { html: el.options[j].text, className: checked }); row.data("ind", j); $list.append(row); } $("#afModalMask").show(); try { if (foundInd > 0 && el.getAttribute("multiple") !== "multiple") { var scrollToPos = 0; var scrollThreshold = numOnly($list.find("li").computedStyle("height")); var theHeight = numOnly($("#afSelectBoxContainer").computedStyle("height")); if (foundInd * scrollThreshold >= theHeight) scrollToPos = (foundInd - 1) * -scrollThreshold; this.scroller.scrollTo({ x: 0, y: scrollToPos }); } } catch (e) { console.log("error init dropdown" + e); } var selClose = $("#afSelectClose").css("display") === "block" ? numOnly($("#afSelectClose").height()) : 0; $("#afSelectWrapper").height((numOnly($("#afSelectBoxContainer").height()) - selClose) + "px"); }, updateMaskValue: function(linker, value, val2) { $(linker).html(val2); }, setDropDownValue: function(el, value) { if (!el) return; var $el = $(el); value = parseInt(value, 10); if (!el.getAttribute("multiple")) { el.selectedIndex = value; $el.find("option").prop("selected", false); $el.find("option:nth-child(" + (value + 1) + ")").prop("selected", true); this.scroller.scrollTo({ x: 0, y: 0 }); this.hideDropDown(); } else { //multi select // var myEl = $el.find("option:nth-child(" + (value + 1) + ")").get(0); var myList = $("#afSelectBoxfix li:nth-child(" + (value + 1) + ")"); if (myList.hasClass("selected")) { myList.removeClass("selected"); // myEl.selected = false; } else { myList.addClass("selected"); // myEl.selected = true; } } $(el).trigger("change"); el = null; }, hideDropDown: function() { $("#afModalMask").hide(); $("#afSelectBoxfix").html(""); }, createHtml: function() { var that = this; if (document.getElementById("afSelectBoxfix")) { return; } $(document).ready(function() { $(document).on("click", ".afFakeSelect", function() { if (this.linker.disabled) return; that.currLinker = this; if (this.linker.getAttribute("multiple") === "multiple") $("#afSelectClose").show(); else $("#afSelectClose").hide(); that.initDropDown(this.linker); }); var container = $.create("div", { id: "afSelectBoxContainer" }); var modalDiv = $.create("div", { id: "afSelectBoxfix" }); var modalWrapper = $.create("div", { id: "afSelectWrapper" }); modalWrapper.css("position", "relative"); modalWrapper.append(modalDiv); var closeDiv = $.create("div", { id: "afSelectClose", html: "<a id='afSelectDone'>Done</a> <a id='afSelectCancel'>Cancel</a>" }); var modalMask = $.create("div", { id:"afModalMask" }); var $afui = $("#afui"); container.prepend(closeDiv).append(modalWrapper); modalMask.append(container); if ($afui.length > 0) $afui.append(modalMask); else document.body.appendChild(modalMask.get(0)); that.scroller = $.query("#afSelectBoxfix").scroller({ scroller: false, verticalScroll: true, vScrollCSS: "afselectscrollBarV", hasParent:true }); $("#afModalMask").on("click",function(e){ var $e=$(e.target); if($e.closest("#afSelectBoxContainer").length === 0) that.hideDropDown(); }); $("#afSelectBoxfix").on("click", "li", function(e) { var $el = $(e.target); that.setDropDownValue(that.currLinker.linker, $el.data("ind")); }); $("#afSelectBoxContainer").on("click", "a", function(e) { if (e.target.id === "afSelectCancel") return that.hideDropDown(); var $sel = $(that.currLinker.linker); $sel.find("option").prop("selected", false); $("#afSelectBoxfix li").each(function() { var $el = $(this); if ($el.hasClass("selected")) { var ind = parseInt($el.data("ind"), 10); $sel.find("option:nth-child(" + (ind + 1) + ")").prop("selected", true); that.currLinker.innerHTML = $el.html(); } }); that.hideDropDown(); e.stopPropagation(); e.preventDefault(); return false; }); }); } }; //The following is based off Eli Grey's shim //https://gist.github.com/384583 //We use HTMLElement to not cause problems with other objects if (!HTMLElement.prototype.watch) { HTMLElement.prototype.watch = function(prop, handler) { var oldval = this[prop], newval = oldval, getter = function() { return newval; }, setter = function(val) { oldval = newval; newval = handler.call(this, prop, oldval, val); return newval; }; if (delete this[prop]) { // can't watch constants if (HTMLElement.defineProperty) { // ECMAScript 5 HTMLElement.defineProperty(this, prop, { get: getter, set: setter, enumerable: false, configurable: true }); } else if (HTMLElement.prototype.__defineGetter__ && HTMLElement.prototype.__defineSetter__) { // legacy HTMLElement.prototype.__defineGetter__.call(this, prop, getter); HTMLElement.prototype.__defineSetter__.call(this, prop, setter); } } }; } if (!HTMLElement.prototype.unwatch) { HTMLElement.prototype.unwatch = function(prop) { var val = this[prop]; delete this[prop]; // remove accessors this[prop] = val; }; } })(af); //Touch events are based from zepto/touch.js //Many modifications and enhancements made /** * Simply include this in your project to get access to the following touch events on an element * tap * doubleTap * singleTap * longPress * swipe * swipeLeft * swipeRight * swipeUp * swipeDown */ /* global af*/ (function($) { "use strict"; var touch = {}, touchTimeout; function parentIfText(node) { return "tagName" in node ? node : node.parentNode; } function swipeDirection(x1, x2, y1, y2) { var xDelta = Math.abs(x1 - x2), yDelta = Math.abs(y1 - y2); if (xDelta >= yDelta) { return (x1 - x2 > 0 ? "Left" : "Right"); } else { return (y1 - y2 > 0 ? "Up" : "Down"); } } var longTapDelay = 750; function longTap() { if (touch.last && (Date.now() - touch.last >= longTapDelay)) { touch.el.trigger("longTap"); touch = {}; } } var longTapTimer; $(document).ready(function() { var prevEl; $(document.body).bind("touchstart", function(e) { if (e.originalEvent) e = e.originalEvent; if (!e.touches || e.touches.length === 0) return; var now = Date.now(), delta = now - (touch.last || now); if (!e.touches || e.touches.length === 0) return; touch.el = $(parentIfText(e.touches[0].target)); touchTimeout && clearTimeout(touchTimeout); touch.x1 = e.touches[0].pageX; touch.y1 = e.touches[0].pageY; touch.x2 = touch.y2 = 0; if (delta > 0 && delta <= 250) touch.isDoubleTap = true; touch.last = now; longTapTimer = setTimeout(longTap, longTapDelay); if ($.ui.useAutoPressed && !touch.el.data("ignore-pressed")) touch.el.addClass("pressed"); if (prevEl && $.ui.useAutoPressed && !prevEl.data("ignore-pressed") && prevEl[0] !== touch.el[0]) prevEl.removeClass("pressed"); prevEl = touch.el; }).bind("touchmove", function(e) { if(e.originalEvent) e = e.originalEvent; touch.x2 = e.touches[0].pageX; touch.y2 = e.touches[0].pageY; clearTimeout(longTapTimer); }).bind("touchend", function(e) { if(e.originalEvent) e=e.originalEvent; if (!touch.el) return; if ($.ui.useAutoPressed && !touch.el.data("ignore-pressed")) touch.el.removeClass("pressed"); if (touch.isDoubleTap) { touch.el.trigger("doubleTap"); touch = {}; } else if (touch.x2 > 0 || touch.y2 > 0) { (Math.abs(touch.x1 - touch.x2) > 30 || Math.abs(touch.y1 - touch.y2) > 30) && touch.el.trigger("swipe") && touch.el.trigger("swipe" + (swipeDirection(touch.x1, touch.x2, touch.y1, touch.y2))); touch.x1 = touch.x2 = touch.y1 = touch.y2 = touch.last = 0; } else if ("last" in touch) { touch.el.trigger("tap"); touchTimeout = setTimeout(function() { touchTimeout = null; if (touch.el) touch.el.trigger("singleTap"); touch = {}; }, 250); } }).bind("touchcancel", function() { if(touch.el && $.ui.useAutoPressed && !touch.el.data("ignore-pressed")) touch.el.removeClass("pressed"); touch = {}; clearTimeout(longTapTimer); }); }); ["swipe", "swipeLeft", "swipeRight", "swipeUp", "swipeDown", "doubleTap", "tap", "singleTap", "longTap"].forEach(function(m) { $.fn[m] = function(callback) { return this.bind(m, callback); }; }); })(af); //TouchLayer contributed by Carlos Ouro @ Badoo //un-authoritive layer between touches and actions on the DOM //(un-authoritive: listeners do not require useCapture) //handles overlooking JS and native scrolling, panning, //no delay on click, edit mode focus, preventing defaults, resizing content, //enter/exit edit mode (keyboard on screen), prevent clicks on momentum, etc //It can be used independently in other apps but it is required by jqUi //Object Events //Enter Edit Mode: //pre-enter-edit - when a possible enter-edit is actioned - happens before actual click or focus (android can still reposition elements and event is actioned) //cancel-enter-edit - when a pre-enter-edit does not result in a enter-edit //enter-edit - on a enter edit mode focus //enter-edit-reshape - focus resized/scrolled event //in-edit-reshape - resized/scrolled event when a different element is focused //Exit Edit Mode //exit-edit - on blur //exit-edit-reshape - blur resized/scrolled event //Other //orientationchange-reshape - resize event due to an orientationchange action //reshape - window.resize/window.scroll event (ignores onfocus "shaking") - general reshape notice /* global numOnly*/ /* jshint camelcase:false */ (function($) { "use strict"; //singleton $.touchLayer = function(el) { // if($.os.desktop||!$.os.webkit) return; $.touchLayer = new touchLayer(el); return $.touchLayer; }; //configuration stuff var inputElements = ["input", "select", "textarea"]; var autoBlurInputTypes = ["button", "radio", "checkbox", "range", "date"]; var requiresJSFocus = $.os.ios; //devices which require .focus() on dynamic click events var verySensitiveTouch = $.os.blackberry; //devices which have a very sensitive touch and touchmove is easily fired even on simple taps var inputElementRequiresNativeTap = $.os.blackberry||$.os.fennec || ($.os.android); //devices which require the touchstart event to bleed through in order to actually fire the click on select elements // var selectElementRequiresNativeTap = $.os.blackberry||$.os.fennec || ($.os.android && !$.os.chrome); //devices which require the touchstart event to bleed through in order to actually fire the click on select elements // var focusScrolls = $.os.ios; //devices scrolling on focus instead of resizing var requirePanning = $.os.ios&&!$.os.ios7; //devices which require panning feature var addressBarError = 0.97; //max 3% error in position var maxHideTries = 2; //HideAdressBar does not retry more than 2 times (3 overall) var skipTouchEnd = false; //Fix iOS bug with alerts/confirms var cancelClick = false; var touchLayer = function(el) { this.clearTouchVars(); el.addEventListener("touchstart", this, false); el.addEventListener("touchmove", this, false); el.addEventListener("touchend", this, false); el.addEventListener("click", this, false); el.addEventListener("focusin", this, false); document.addEventListener("scroll", this, false); window.addEventListener("resize", this, false); window.addEventListener("orientationchange", this, false); this.layer = el; //proxies this.scrollEndedProxy_ = $.proxy(this.scrollEnded, this); this.exitEditProxy_ = $.proxy(this.exitExit, this, []); this.launchFixUIProxy_ = $.proxy(this.launchFixUI, this); var that = this; this.scrollTimeoutExpireProxy_ = function() { that.scrollTimeout_ = null; that.scrollTimeoutEl_.addEventListener("scroll", that.scrollEndedProxy_, false); }; this.retestAndFixUIProxy_ = function() { if ($.os.android && !$.os.chrome) that.layer.style.height = "100%"; $.asap(that.testAndFixUI, that, arguments); }; //iPhone double clicks workaround document.addEventListener("click", function(e) { if (cancelClick) { e.preventDefault(); e.stopPropagation(); return false; } if (e.clientX !== undefined && that.lastTouchStartX !== null) { if (2 > Math.abs(that.lastTouchStartX - e.clientX) && 2 > Math.abs(that.lastTouchStartY - e.clientY)) { e.preventDefault(); e.stopPropagation(); } } }, true); //js scrollers self binding $.bind(this, "scrollstart", function(el) { that.isScrolling = true; that.scrollingEl_ = el; if (!$.feat.nativeTouchScroll) that.scrollerIsScrolling = true; that.fireEvent("UIEvents", "scrollstart", el, false, false); }); $.bind(this, "scrollend", function(el) { that.isScrolling = false; if (!$.feat.nativeTouchScroll) that.scrollerIsScrolling = false; that.fireEvent("UIEvents", "scrollend", el, false, false); }); //fix layer positioning this.hideAddressBar(0,1); this.launchFixUI(5); //try a lot to set page into place }; touchLayer.prototype = { dX: 0, dY: 0, cX: 0, cY: 0, touchStartX: null, touchStartY: null, //elements layer: null, scrollingEl_: null, scrollTimeoutEl_: null, //handles / proxies scrollTimeout_: null, reshapeTimeout_: null, scrollEndedProxy_: null, exitEditProxy_: null, launchFixUIProxy_: null, reHideAddressBarTimeout_: null, retestAndFixUIProxy_: null, //options panElementId: "header", //public locks blockClicks: false, //private locks allowDocumentScroll_: false, ignoreNextResize_: false, blockPossibleClick_: false, //status vars isScrolling: false, isScrollingVertical_: false, wasPanning_: false, isPanning_: false, isFocused_: false, justBlurred_: false, requiresNativeTap: false, holdingReshapeType_: null, trackingClick: false, scrollerIsScrolling: false, handleEvent: function(e) { switch (e.type) { case "touchstart": this.onTouchStart(e); break; case "touchmove": this.onTouchMove(e); break; case "touchend": this.onTouchEnd(e); break; case "click": this.onClick(e); break; case "blur": this.onBlur(e); break; case "scroll": this.onScroll(e); break; case "orientationchange": this.onOrientationChange(e); break; case "resize": this.onResize(e); break; case "focusin": this.onFocusIn(e); break; } }, launchFixUI: function(maxTries) { //this.log("launchFixUI"); if (!maxTries) maxTries = maxHideTries; if (this.reHideAddressBarTimeout_ === null) return this.testAndFixUI(0, maxTries); }, resetFixUI: function() { //this.log("resetFixUI"); if (this.reHideAddressBarTimeout_) clearTimeout(this.reHideAddressBarTimeout_); this.reHideAddressBarTimeout_ = null; }, testAndFixUI: function(retry, maxTries) { //this.log("testAndFixUI"); //for ios or if the heights are incompatible (and not close) var refH = this.getReferenceHeight(); var curH = this.getCurrentHeight(); if ((refH !== curH && !(curH * addressBarError < refH && refH * addressBarError < curH))) { //panic! page is out of place! this.hideAddressBar(retry, maxTries); return true; } if ($.os.android) this.resetFixUI(); return false; }, hideAddressBar: function(retry, maxTries) { if($.ui && $.ui.isIntel) return; if (retry >= maxTries) { this.resetFixUI(); return; //avoid a possible loop } //this.log("hiding address bar"); if ($.os.desktop || $.os.kindle) { this.layer.style.height = "100%"; } else if ($.os.android) { //on some phones its immediate window.scrollTo(1, 1); this.layer.style.height = this.isFocused_ || window.innerHeight >= window.outerHeight ? (window.innerHeight) + "px" : (window.outerHeight) + "px"; //sometimes android devices are stubborn var that = this; //re-test in a bit (some androids (SII, Nexus S, etc) fail to resize on first try) var nextTry = retry + 1; this.reHideAddressBarTimeout_ = setTimeout(that.retestAndFixUIProxy_, 250 * nextTry, nextTry, maxTries); //each fix is progressibily longer (slower phones fix) } else if (!this.isFocused_) { document.documentElement.style.height = "5000px"; window.scrollTo(0, 0); document.documentElement.style.height = window.innerHeight + "px"; this.layer.style.height = window.innerHeight + "px"; } }, getReferenceHeight: function() { //the height the page should be at return window.innerHeight; }, getCurrentHeight: function() { //the height the page really is at if ($.os.android) { return window.innerHeight; } else return numOnly(document.documentElement.style.height); //TODO: works well on iPhone, test BB }, onOrientationChange: function() { //this.log("orientationchange"); //if a resize already happened, fire the orientationchange var self=this; var didBlur=false; if(this.focusedElement){ didBlur=true; this.focusedElement.blur(); } if (!this.holdingReshapeType_ && this.reshapeTimeout_) { this.fireReshapeEvent("orientationchange"); } else this.previewReshapeEvent("orientationchange"); if($.os.android && $.os.chrome) { this.layer.style.height = "100%"; var time = didBlur ? 600 : 0; setTimeout(function(){ self.hideAddressBar(0,1); }, time); } }, onResize: function() { //avoid infinite loop on iPhone if (this.ignoreNextResize_) { //this.log("ignored resize"); this.ignoreNextResize_ = false; return; } //this.logInfo("resize"); if (this.launchFixUI()) { this.reshapeAction(); } }, onClick: function(e) { //handle forms var tag = e.target && e.target.tagName !== undefined ? e.target.tagName.toLowerCase() : ""; //this.log("click on "+tag); if (inputElements.indexOf(tag) !== -1 && (!this.isFocused_ || e.target !== (this.focusedElement))) { var type = e.target && e.target.type !== undefined ? e.target.type.toLowerCase() : ""; var autoBlur = autoBlurInputTypes.indexOf(type) !== -1; //focus if (!autoBlur) { //remove previous blur event if this keeps focus if (this.isFocused_) { this.focusedElement.removeEventListener("blur", this, false); } this.focusedElement = e.target; this.focusedElement.addEventListener("blur", this, false); //android bug workaround for UI if (!this.isFocused_ && !this.justBlurred_) { //this.log("enter edit mode"); $.trigger(this, "enter-edit", [e.target]); //fire / preview reshape event if ($.os.ios) { var that = this; setTimeout(function() { that.fireReshapeEvent("enter-edit"); }, 300); //TODO: get accurate reading from window scrolling motion and get rid of timeout } else this.previewReshapeEvent("enter-edit"); } this.isFocused_ = true; } else { this.isFocused_ = false; } this.justBlurred_ = false; this.allowDocumentScroll_ = true; //fire focus action if (requiresJSFocus) { e.target.focus(); } //BB10 needs to be preventDefault on touchstart and thus need manual blur on click } else if ($.os.blackberry10 && this.isFocused_) { this.focusedElement.blur(); } }, previewReshapeEvent: function(ev) { //a reshape event of this type should fire within the next 750 ms, otherwise fire it yourself var that = this; this.reshapeTimeout_ = setTimeout(function() { that.fireReshapeEvent(ev); that.reshapeTimeout_ = null; that.holdingReshapeType_ = null; }, 750); this.holdingReshapeType_ = ev; }, fireReshapeEvent: function(ev) { //this.log(ev?ev+"-reshape":"unknown-reshape"); $.trigger(this, "reshape"); //trigger a general reshape notice $.trigger(this, ev ? ev + "-reshape" : "unknown-reshape"); //trigger the specific reshape }, reshapeAction: function() { if (this.reshapeTimeout_) { //we have a specific reshape event waiting for a reshapeAction, fire it now clearTimeout(this.reshapeTimeout_); this.fireReshapeEvent(this.holdingReshapeType_); this.holdingReshapeType_ = null; this.reshapeTimeout_ = null; } else this.previewReshapeEvent(); }, onFocusIn: function(e) { if (!this.isFocused_) this.onClick(e); }, onBlur: function(e) { if ($.os.android && e.target === window) return; //ignore window blurs this.isFocused_ = false; //just in case... if (this.focusedElement) this.focusedElement.removeEventListener("blur", this, false); this.focusedElement = null; //make sure this blur is not followed by another focus this.justBlurred_ = true; $.asap(this.exitEditProxy_, this, [e.target]); }, exitExit: function(el) { this.justBlurred_ = false; if (!this.isFocused_) { //this.log("exit edit mode"); $.trigger(this, "exit-edit", [el]); //do not allow scroll anymore this.allowDocumentScroll_ = false; //fire / preview reshape event if ($.os.ios) { var that = this; setTimeout(function() { that.fireReshapeEvent("exit-edit"); }, 300); //TODO: get accurate reading from window scrolling motion and get rid of timeout } else this.previewReshapeEvent("exit-edit"); } }, onScroll: function(e) { //this.log("document scroll detected "+document.body.scrollTop); if (!this.allowDocumentScroll_ && !this.isPanning_ && e.target === document) { this.allowDocumentScroll_ = true; if (this.wasPanning_) { this.wasPanning_ = false; //give it a couple of seconds setTimeout(this.launchFixUIProxy_, 2000, [maxHideTries]); } else { //this.log("scroll forced page into place"); this.launchFixUI(); } } }, onTouchStart: function(e) { //setup initial touch position this.dX = e.touches[0].pageX; this.dY = e.touches[0].pageY; this.lastTimestamp = e.timeStamp; this.lastTouchStartX = this.lastTouchStartY = null; if ($.os.ios) { if (skipTouchEnd === e.touches[0].identifier) { cancelClick = true; e.preventDefault(); skipTouchEnd=false; return false; } skipTouchEnd = e.touches[0].identifier; cancelClick = false; } if (this.scrollerIsScrolling) { this.moved = true; this.scrollerIsScrolling = false; e.preventDefault(); return false; } this.trackingClick = true; //check dom if necessary if (requirePanning || $.feat.nativeTouchScroll) this.checkDOMTree(e.target, this.layer); //scrollend check if (this.isScrolling) { //remove prev timeout if (this.scrollTimeout_ !== null) { clearTimeout(this.scrollTimeout_); this.scrollTimeout_ = null; //different element, trigger scrollend anyway if (this.scrollTimeoutEl_ !== this.scrollingEl_) this.scrollEnded(false); else this.blockPossibleClick_ = true; //check if event was already set } else if (this.scrollTimeoutEl_) { //trigger this.scrollEnded(true); this.blockPossibleClick_ = true; } } // We allow forcing native tap in android devices (required in special cases) var forceNativeTap = ($.os.android && e && e.target && e.target.getAttribute && e.target.getAttribute("data-touchlayer") === "ignore"); //if on edit mode, allow all native touches //(BB10 must still be prevented, always clicks even after move) if (forceNativeTap || (this.isFocused_ && !$.os.blackberry10)) { this.requiresNativeTap = true; this.allowDocumentScroll_ = true; //some stupid phones require a native tap in order for the native input elements to work } else if (inputElementRequiresNativeTap && e.target && e.target.tagName !== undefined) { var tag = e.target.tagName.toLowerCase(); if (inputElements.indexOf(tag) !== -1) { //notify scrollers (android forms bug), except for selects //if(tag != "select") $.trigger(this, "pre-enter-edit", [e.target]); this.requiresNativeTap = true; } } else if (e.target && e.target.tagName !== undefined && e.target.tagName.toLowerCase() === "input" && e.target.type === "range") { this.requiresNativeTap = true; } //do not prevent default on chrome. Chrome >=33 has issues with this if($.os.chrome||$.os.fennec) return; //prevent default if possible if (!this.isPanning_ && !this.requiresNativeTap) { if ((this.isScrolling && !$.feat.nativeTouchScroll) || (!this.isScrolling)) e.preventDefault(); //demand vertical scroll (don"t let it pan the page) } else if (this.isScrollingVertical_) { this.demandVerticalScroll(); } }, demandVerticalScroll: function() { //if at top or bottom adjust scroll var atTop = this.scrollingEl_.scrollTop <= 0; if (atTop) { //this.log("adjusting scrollTop to 1"); this.scrollingEl_.scrollTop = 1; } else { var scrollHeight = this.scrollingEl_.scrollTop + this.scrollingEl_.clientHeight; var atBottom = scrollHeight >= this.scrollingEl_.scrollHeight; if (atBottom) { //this.log("adjusting scrollTop to max-1"); this.scrollingEl_.scrollTop = this.scrollingEl_.scrollHeight - this.scrollingEl_.clientHeight - 1; } } }, //set rules here to ignore scrolling check on these elements //consider forcing user to use scroller object to assess these... might be causing bugs ignoreScrolling: function(el) { if (el.scrollWidth === undefined || el.clientWidth === undefined) return true; if (el.scrollHeight === undefined || el.clientHeight === undefined) return true; return false; }, allowsVerticalScroll: function(el, styles) { var overflowY = styles.overflowY; if (overflowY === "scroll") return true; if (overflowY === "auto" && el.scrollHeight > el.clientHeight) return true; return false; }, allowsHorizontalScroll: function(el, styles) { var overflowX = styles.overflowX; if (overflowX === "scroll") return true; if (overflowX === "auto" && el.scrollWidth > el.clientWidth) return true; return false; }, //check if pan or native scroll is possible checkDOMTree: function(el, parentTarget) { //check panning //temporarily disabled for android - click vs panning issues if (requirePanning && this.panElementId === el.id) { this.isPanning_ = true; return; } //check native scroll if ($.feat.nativeTouchScroll) { //prevent errors if (this.ignoreScrolling(el)) { return; } //check if vertical or hor scroll are allowed var styles = window.getComputedStyle(el); if (this.allowsVerticalScroll(el, styles)) { this.isScrollingVertical_ = true; this.scrollingEl_ = el; this.isScrolling = true; return; } else if (this.allowsHorizontalScroll(el, styles)) { this.isScrollingVertical_ = false; this.scrollingEl_ = null; this.isScrolling = true; } } //check recursive up to top element var isTarget = (el === parentTarget); if (!isTarget && el.parentNode) this.checkDOMTree(el.parentNode, parentTarget); }, //scroll finish detectors scrollEnded: function(e) { //this.log("scrollEnded"); if (this.scrollTimeoutEl_ === null) { return; } if (e) this.scrollTimeoutEl_.removeEventListener("scroll", this.scrollEndedProxy_, false); this.fireEvent("UIEvents", "scrollend", this.scrollTimeoutEl_, false, false); this.scrollTimeoutEl_ = null; }, onTouchMove: function(e) { //set it as moved var wasMoving = this.moved; this.moved = true; //very sensitive devices check if (verySensitiveTouch) { this.cY = e.touches[0].pageY - this.dY; this.cX = e.touches[0].pageX - this.dX; } //panning check if (this.isPanning_) { return; } //native scroll (for scrollend) if (this.isScrolling) { if (!wasMoving) { //this.log("scrollstart"); this.fireEvent("UIEvents", "scrollstart", this.scrollingEl_, false, false); } //if(this.isScrollingVertical_) { this.speedY = (this.lastY - e.touches[0].pageY) / (e.timeStamp - this.lastTimestamp); this.lastY = e.touches[0].pageY; this.lastX = e.touches[0].pageX; this.lastTimestamp = e.timeStamp; //} } //non-native scroll devices if ((!$.os.blackberry10)) { //legacy stuff for old browsers if (!this.isScrolling || !$.feat.nativeTouchScroll) e.preventDefault(); return; } //e.stopImmediatPropegation(); //e.stopPropagation(); }, onTouchEnd: function(e) { //double check moved for sensitive devices) var itMoved = this.moved; if (verySensitiveTouch) { itMoved = itMoved && !(Math.abs(this.cX) < 10 && Math.abs(this.cY) < 10); } //don't allow document scroll unless a specific click demands it further ahead if (!$.os.ios || !this.requiresNativeTap) this.allowDocumentScroll_ = false; //panning action if (this.isPanning_ && itMoved) { //wait 2 secs and cancel this.wasPanning_ = true; //a generated click } else if (!itMoved && !this.requiresNativeTap) { this.scrollerIsScrolling = false; if (!this.trackingClick) { return; } //NOTE: on android if touchstart is not preventDefault(), click will fire even if touchend is prevented //this is one of the reasons why scrolling and panning can not be nice and native like on iPhone e.preventDefault(); //fire click if (!this.blockClicks && !this.blockPossibleClick_) { var theTarget = e.target; var changedTouches = e.changedTouches ? e.changedTouches[0] : e.touches[0]; if (theTarget.nodeType === 3) theTarget = theTarget.parentNode; this.fireEvent("Event", "click", theTarget, true, e.mouseToTouch, changedTouches[0]); this.lastTouchStartX = this.dX; this.lastTouchStartY = this.dY; } } else if (itMoved) { //setup scrollend stuff if (this.isScrolling) { this.scrollTimeoutEl_ = this.scrollingEl_; if (Math.abs(this.speedY) < 0.01) { //fire scrollend immediatly //this.log(" scrollend immediately "+this.speedY); this.scrollEnded(false); } else { //wait for scroll event //this.log($.debug.since()+" setting scroll timeout "+this.speedY); this.scrollTimeout_ = setTimeout(this.scrollTimeoutExpireProxy_, 30); } } //trigger cancel-enter-edit on inputs if (this.requiresNativeTap) { if (!this.isFocused_) $.trigger(this, "cancel-enter-edit", [e.target]); } } if($.os.blackberry10) { this.lastTouchStartX = this.dX; this.lastTouchStartY = this.dY; } this.clearTouchVars(); }, clearTouchVars: function() { //this.log("clearing touchVars"); this.speedY = this.lastY = this.cY = this.cX = this.dX = this.dY = 0; this.moved = false; this.isPanning_ = false; this.isScrolling = false; this.isScrollingVertical_ = false; this.requiresNativeTap = false; this.blockPossibleClick_ = false; this.trackingClick = false; }, fireEvent: function(eventType, eventName, target, bubbles, mouseToTouch, data) { //this.log("Firing event "+eventName); //create the event and set the options var theEvent = document.createEvent(eventType); theEvent.initEvent(eventName, bubbles, true); //theEvent.target = target; if (data) { $.each(data, function(key, val) { theEvent.key = val; }); } //af.DesktopBrowsers flag if (mouseToTouch) theEvent.mouseToTouch = true; target.dispatchEvent(theEvent); } }; })(af); /** * af.popup - a popup/alert library for html5 mobile apps * copyright Indiepath 2011 - Tim Fisher * Modifications/enhancements by Intel for App Framework * */ /* EXAMPLE $.query("body").popup({ title:"Alert! Alert!", message:"This is a test of the emergency alert system!! Don't PANIC!", cancelText:"Cancel me", cancelCallback: function(){console.log("cancelled");}, doneText:"I'm done!", doneCallback: function(){console.log("Done for!");}, cancelOnly:false, doneClass:'button', cancelClass:'button', onShow:function(){console.log("showing popup");} autoCloseDone:true, //default is true will close the popup when done is clicked. suppressTitle:false //Do not show the title if set to true }); You can programatically trigger a close by dispatching a "close" event to it. $.query("body").popup({title:'Alert',id:'myTestPopup'}); $("#myTestPopup").trigger("close"); */ /* global af */ (function ($) { "use strict"; $.fn.popup = function (opts) { return new popup(this[0], opts); }; var queue = []; var popup = (function () { var popup = function (containerEl, opts) { if (typeof containerEl === "string" || containerEl instanceof String) { this.container = document.getElementById(containerEl); } else { this.container = containerEl; } if (!this.container) { window.alert("Error finding container for popup " + containerEl); return; } try { if (typeof (opts) === "string" || typeof (opts) === "number") opts = { message: opts, cancelOnly: "true", cancelText: "OK" }; this.id = opts.id = opts.id || $.uuid(); //opts is passed by reference this.addCssClass = opts.addCssClass ? opts.addCssClass : ""; this.suppressTitle = opts.suppressTitle || this.suppressTitle; this.title = opts.suppressTitle ? "" : (opts.title || "Alert"); this.message = opts.message || ""; this.cancelText = opts.cancelText || "Cancel"; this.cancelCallback = opts.cancelCallback || function () {}; this.cancelClass = opts.cancelClass || "button"; this.doneText = opts.doneText || "Done"; this.doneCallback = opts.doneCallback || function () { // no action by default }; this.doneClass = opts.doneClass || "button"; this.cancelOnly = opts.cancelOnly || false; this.onShow = opts.onShow || function () {}; this.autoCloseDone = opts.autoCloseDone !== undefined ? opts.autoCloseDone : true; queue.push(this); if (queue.length === 1) this.show(); } catch (e) { console.log("error adding popup " + e); } }; popup.prototype = { id: null, addCssClass: null, title: null, message: null, cancelText: null, cancelCallback: null, cancelClass: null, doneText: null, doneCallback: null, doneClass: null, cancelOnly: false, onShow: null, autoCloseDone: true, suppressTitle: false, show: function () { var self = this; var markup = "<div id='" + this.id + "' class='afPopup hidden "+ this.addCssClass + "'>"+ "<header>" + this.title + "</header>"+ "<div>" + this.message + "</div>"+ "<footer>"+ "<a href='javascript:;' class='" + this.cancelClass + "' id='cancel'>" + this.cancelText + "</a>"+ "<a href='javascript:;' class='" + this.doneClass + "' id='action'>" + this.doneText + "</a>"+ "<div style='clear:both'></div>"+ "</footer>"+ "</div>"; $(this.container).append($(markup)); var $el = $.query("#" + this.id); $el.bind("close", function () { self.hide(); }); if (this.cancelOnly) { $el.find("A#action").hide(); $el.find("A#cancel").addClass("center"); } $el.find("A").each(function () { var button = $(this); button.bind("click", function (e) { if (button.attr("id") === "cancel") { self.cancelCallback.call(self.cancelCallback, self); self.hide(); } else { self.doneCallback.call(self.doneCallback, self); if (self.autoCloseDone) self.hide(); } e.preventDefault(); }); }); self.positionPopup(); $.blockUI(0.5); $el.bind("orientationchange", function () { self.positionPopup(); }); //force header/footer showing to fix CSS style bugs $el.find("header").show(); $el.find("footer").show(); setTimeout(function(){ $el.removeClass("hidden"); self.onShow(self); },50); }, hide: function () { var self = this; $.query("#" + self.id).addClass("hidden"); $.unblockUI(); if(!$.os.ie&&!$.os.android){ setTimeout(function () { self.remove(); }, 250); } else self.remove(); }, remove: function () { var self = this; var $el = $.query("#" + self.id); $el.unbind("close"); $el.find("BUTTON#action").unbind("click"); $el.find("BUTTON#cancel").unbind("click"); $el.unbind("orientationchange").remove(); queue.splice(0, 1); if (queue.length > 0) queue[0].show(); }, positionPopup: function () { var popup = $.query("#" + this.id); popup.css("top", ((window.innerHeight / 2.5) + window.pageYOffset) - (popup[0].clientHeight / 2) + "px"); popup.css("left", (window.innerWidth / 2) - (popup[0].clientWidth / 2) + "px"); } }; return popup; })(); var uiBlocked = false; $.blockUI = function (opacity) { if (uiBlocked) return; opacity = opacity ? " style='opacity:" + opacity + ";'" : ""; $.query("BODY").prepend($("<div id='mask'" + opacity + "></div>")); $.query("BODY DIV#mask").bind("touchstart", function (e) { e.preventDefault(); }); $.query("BODY DIV#mask").bind("touchmove", function (e) { e.preventDefault(); }); uiBlocked = true; }; $.unblockUI = function () { uiBlocked = false; $.query("BODY DIV#mask").unbind("touchstart"); $.query("BODY DIV#mask").unbind("touchmove"); $("BODY DIV#mask").remove(); }; })(af); /** * appframework.ui - A User Interface library for App Framework applications * * @copyright 2011 Intel * @author Intel * @version 2.0 */ /* global af*/ /* global numOnly*/ /* global intel*/ /* jshint camelcase:false*/ (function($) { "use strict"; var startPath = window.location.pathname + window.location.search; var defaultHash = window.location.hash; var previousTarget = defaultHash; var ui = function() { // Init the page var that = this; /** * Helper function to setup the transition objects * Custom transitions can be added via $.ui.availableTransitions ``` $.ui.availableTransitions['none']=function(); ``` */ this.availableTransitions = {}; this.availableTransitions["default"] = this.availableTransitions.none = this.noTransition; //setup the menu and boot touchLayer //Hack for AMD/requireJS support //set autolaunch = false if ((typeof define === "function" && define.amd)||(typeof module !== "undefined" && module.exports)) { that.autoLaunch=false; } var setupAFDom = function() { //boot touchLayer //create afui element if it still does not exist var afui = document.getElementById("afui"); if (afui === null) { afui = document.createElement("div"); afui.id = "afui"; var body = document.body; while (body&&body.firstChild) { afui.appendChild(body.firstChild); } $(document.body).prepend(afui); } that.isIntel="intel" in window&&window.intel&&window.intel.xdk&&"app" in window.intel.xdk; if ($.os.supportsTouch) $.touchLayer(afui); setupCustomTheme(); }; if (document.readyState === "complete" || document.readyState === "loaded") { setupAFDom(); if(that.init) that.autoBoot(); else{ $(window).one("afui:init", function() { that.autoBoot(); }); } } else $(document).ready( function() { setupAFDom(); if(that.init) that.autoBoot(); else{ $(window).one("afui:init", function() { that.autoBoot(); }); } }, false); if (!("intel" in window)){ window.intel = {xdk:{}}; window.intel.xdk.webRoot = ""; } //click back event window.addEventListener("popstate", function() { if(!that.useInternalRouting) return; var id = that.getPanelId(document.location.hash); var hashChecker = document.location.href.replace(document.location.origin + "/", ""); //make sure we allow hash changes outside afui if (hashChecker === "#") return; if (id === "" && that.history.length === 1) //Fix going back to first panel and an empty hash id = "#" + that.firstDiv.id; if (id === "") return; if (af(id).filter(".panel").length === 0) return; if (id !== "#" + that.activeDiv.id) that.goBack(); }, false); function setupCustomTheme() { if (that.useOSThemes) { $("#afui").removeClass("ios ios7 win8 tizen bb android light dark"); if ($.os.android) $("#afui").addClass("android"); else if ($.os.ie) { $("#afui").addClass("win8"); } else if ($.os.blackberry||$.os.blackberry10||$.os.playbook) { $("#afui").addClass("bb"); that.backButtonText = "Back"; } else if ($.os.ios7){ $("#afui").addClass("ios7"); if(that.overlayStatusbar){ that.ready(function(){ $(".header").addClass("overlayStatusbar"); }); } } else if ($.os.ios) $("#afui").addClass("ios"); else if($.os.tizen) $("#afui").addClass("tizen"); } if($.os.ios){ $("head").find("#iosBlurrHack").remove(); var hackStyle="-webkit-backface-visibility: hidden;"; //ios webview still has issues //if(navigator.userAgent.indexOf("Safari") === -1) { hackStyle+="-webkit-perspective:1000;"; //} //$("head").append("<style id='iosBlurrHack'>#afui .panel {"+hackStyle+"} #afui .panel > * {-webkit-backface-visibility:hidden;}</style>"); $("head").append("<style id='iosBlurrHack'>#afui .y-scroll > *, #afui .x-scroll > * {"+hackStyle+"}</style>"); } else if ($.os.android&&!$.os.androidICS){ that.transitionTime = "150ms"; } else if($.os.fennec){ that.ready(function(){ window.addEventListener("deviceorientation",function(){ var tmpH=numOnly($("#header").height())+numOnly($("#navbar").height()); $("#content").css("height",window.innerHeight-tmpH); }); }); } } }; ui.prototype = { init:false, transitionTime: "230ms", showLoading: true, loadingText: "Loading Content", loadContentQueue: [], isIntel: false, titlebar: "", navbar: "", header: "", viewportContainer: "", remotePages: {}, history: [], homeDiv: "", screenWidth: "", content: "", modalWindow: "", customFooter: false, defaultFooter: "", defaultHeader: null, customMenu: false, customAside:false, defaultAside:"", defaultMenu: "", _readyFunc: null, doingTransition: false, passwordBox: $.passwordBox ? new $.passwordBox() : false, selectBox: $.selectBox ? $.selectBox : false, ajaxUrl: "", transitionType: "slide", scrollingDivs: {}, firstDiv: "", hasLaunched: false, isLaunching:false, launchCompleted: false, activeDiv: "", customClickHandler: "", menuAnimation: null, togglingSideMenu: false, sideMenuWidth: "200px", handheldMinWidth: "768", trimBackButtonText: true, useOSThemes: true, overlayStatusbar: false, lockPageBounce: false, animateHeaders: true, useAutoPressed: true, horizontalScroll:false, _currentHeaderID:"defaultHeader", useInternalRouting:true, autoBoot: function() { this.hasLaunched = true; var that=this; if (this.autoLaunch) { if(this.isIntel){ var xdkLaunch=function(){ that.launch(); document.removeEventListener("intel.xdk.device.ready",xdkLaunch); }; document.addEventListener("intel.xdk.device.ready",xdkLaunch); } else { this.launch(); } } }, css3animate: function(el, opts) { el = $(el); return el.css3Animate(opts); }, dispatchPanelEvent:function(fnc,myPanel){ if (typeof fnc === "string" && window[fnc]) { return window[fnc](myPanel); } else if(fnc.indexOf(".")!==-1){ var scope=window,items=fnc.split("."),len=items.length,i=0; for(i;i<len-1;i++){ scope=scope[items[i]]; if(scope===undefined) return; } return scope[items[i]](myPanel); } }, /** * This enables the tab bar ability to keep pressed states on elements ``` $.ui.enableTabBar(); ``` @title $.ui.enableTabBar */ enableTabBar:function(){ $(document).on("click",".button-grouped.tabbed",function(e){ var $el=$(e.target); $el.closest(".tabbed").find(".button").data("ignore-pressed","true").removeClass("pressed"); //this is a hack, but the touchEvents plugn will remove pressed $el.closest(".button").addClass("pressed"); setTimeout(function(){ $el.closest(".button").addClass("pressed"); }); }); }, /** * This disables the tab bar ability to keep pressed states on elements ``` $.ui.disableTabBar(); ``` * @title $.ui.disableTabBar */ disableTabBar:function(){ $(document).off("click",".button-grouped.tabbed"); $(".button-grouped.tabbed .button").removeAttr("data-ignore-pressed"); }, /** * This changes the side menu width ``` $.ui.setLeftSideMenuWidth('300px'); ``` * @title $.ui.setLeftSideMenuWidth */ setLeftSideMenuWidth: function(width) { this.sideMenuWidth = width; //override the css style width = width + ""; width = width.replace("px", "") + "px"; var theWidth=numOnly(window.innerWidth)-numOnly(width); $("head").find("style#afui_sideMenuWidth").remove(); var css = "@media handheld, only screen and (min-width: 768px) {"+ "#afui > #navbar.hasMenu.splitview, #afui > #header.hasMenu.splitview, #afui > #content.hasMenu.splitview {"+ " margin-left:"+width+" !important;"+ " width: "+(theWidth)+"px !important;"+ "}"+ "}"+ "#afui #menu {width:" + width + " !important}"; $("head").append("<style id='afui_sideMenuWidth'>"+css+"</style>"); }, setSideMenuWidth:function(){ this.setLeftSideMenuWidth.apply(this,arguments); }, /** * This changes the side menu width ``` $.ui.setRightSideMenuWidth('300px'); ``` *@title $.ui.setRightSideMenuWidth */ setRightSideMenuWidth: function(width) { this.sideMenuWidth = width; //override the css style width = width + ""; width = width.replace("px", "") + "px"; $("head").find("style#afui_asideMenuWidth").remove(); $("head").append("<style id='afui_asideMenuWidth'>#afui #aside_menu {width:" + width + " !important}</style>"); }, /** * this will disable native scrolling on iOS ``` $.ui.disableNativeScrolling); ``` *@title $.ui.disableNativeScrolling */ disableNativeScrolling: function() { $.feat.nativeTouchScroll = false; }, /** * This is a boolean property. When set to true, we manage history and update the hash ``` $.ui.manageHistory=false;//Don't manage for apps using Backbone ``` *@title $.ui.manageHistory */ manageHistory: true, /** * This is a boolean property. When set to true (default) it will load that panel when the app is started ``` $.ui.loadDefaultHash=false; //Never load the page from the hash when the app is started $.ui.loadDefaultHash=true; //Default ``` *@title $.ui.loadDefaultHash */ loadDefaultHash: true, /** * This is a boolean that when set to true will add "&cache=_rand_" to any ajax loaded link The default is false ``` $.ui.useAjaxCacheBuster=true; ``` *@title $.ui.useAjaxCacheBuster */ useAjaxCacheBuster: false, /** * This is a shorthand call to the $.actionsheet plugin. We wire it to the afui div automatically ``` $.ui.actionsheet("<a href='javascript:;' class='button'>Settings</a> <a href='javascript:;' class='button red'>Logout</a>") $.ui.actionsheet("[{ text: 'back', cssClasses: 'red', handler: function () { $.ui.goBack(); ; } }, { text: 'show alert 5', cssClasses: 'blue', handler: function () { alert("hi"); } }, { text: 'show alert 6', cssClasses: '', handler: function () { alert("goodbye"); } }]"); ``` * @param {(string|Array.<string>)} links * @title $.ui.actionsheet() */ actionsheet: function(opts) { return $.query("#afui").actionsheet(opts); }, /** * This is a wrapper to $.popup.js plugin. If you pass in a text string, it acts like an alert box and just gives a message ``` $.ui.popup(opts); $.ui.popup( { title:"Alert! Alert!", message:"This is a test of the emergency alert system!! Don't PANIC!", cancelText:"Cancel me", cancelCallback: function(){console.log("cancelled");}, doneText:"I'm done!", doneCallback: function(){console.log("Done for!");}, cancelOnly:false }); $.ui.popup('Hi there'); ``` * @param {(object|string)} options * @title $.ui.popup(opts) */ popup: function(opts) { return $.query("#afui").popup(opts); }, /** *This will throw up a mask and block the UI ``` $.ui.blockUI(.9) ```` * @param {number} opacity * @title $.ui.blockUI(opacity) */ blockUI: function(opacity) { $.blockUI(opacity); }, /** *This will remove the UI mask ``` $.ui.unblockUI() ```` * @title $.ui.unblockUI() */ unblockUI: function() { $.unblockUI(); }, /** * Will remove the bottom nav bar menu from your application ``` $.ui.removeFooterMenu(); ``` * @title $.ui.removeFooterMenu */ removeFooterMenu: function() { $.query("#navbar").hide(); //$.query("#content").css("bottom", "0px"); this.showNavMenu = false; }, /** * Boolean if you want to show the bottom nav menu. ``` $.ui.showNavMenu = false; ``` * @api private * @title $.ui.showNavMenu */ showNavMenu: true, /** * Boolean if you want to auto launch afui ``` $.ui.autoLaunch = false; // * @title $.ui.autoLaunch */ autoLaunch: true, /** * Boolean if you want to show the back button ``` $.ui.showBackButton = false; // * @title $.ui.showBackButton */ showBackbutton: true, // Kept for backward compatibility. showBackButton: true, /** * Override the back button text ``` $.ui.backButtonText="Back" ``` * @title $.ui.backButtonText */ backButtonText: "", /** * Boolean if you want to reset the scroller position when navigating panels. Default is true ``` $.ui.resetScrollers=false; //Do not reset the scrollers when switching panels ``` * @title $.ui.resetScrollers */ resetScrollers: true, /** * function to fire when afui is ready and completed launch ``` $.ui.ready(function(){console.log('afui is ready');}); ``` * @param {function} param function to execute * @title $.ui.ready */ ready: function(param) { if (this.launchCompleted) param(); else { $(document).one("afui:ready", function() { param(); }); } }, /** * Override the back button class name ``` $.ui.setBackButtonStyle('newClass'); ``` * @param {string} className new class name * @title $.ui.setBackButtonStyle(class) */ setBackButtonStyle: function(className) { $.query("#header .backButton").get(0).className=className; }, /** * Initiate a back transition ``` $.ui.goBack() ``` * @title $.ui.goBack() * @param {number=} delta relative position from the last element (> 0) */ goBack: function(delta) { delta = Math.min(Math.abs(~~delta || 1), this.history.length); if (delta) { var tmpEl = this.history.splice(-delta).shift(); this.loadContent(tmpEl.target + "", 0, 1, tmpEl.transition); this.transitionType = tmpEl.transition; this.updateHash(tmpEl.target); } }, /** * Clear the history queue ``` $.ui.clearHistory() ``` * @title $.ui.clearHistory() */ clearHistory: function() { this.history = []; this.setBackButtonVisibility(false); }, /** * PushHistory ``` $.ui.pushHistory(previousPage, newPage, transition, hashExtras) ``` * @api private * @title $.ui.pushHistory() */ pushHistory: function(previousPage, newPage, transition, hashExtras) { //push into local history this.history.push({ target: previousPage, transition: transition }); //push into the browser history try { if (!this.manageHistory) return; window.history.pushState(newPage, newPage, startPath + "#" + newPage + hashExtras); $(window).trigger("hashchange", null, { newUrl: startPath + "#" + newPage + hashExtras, oldUrl: startPath + previousPage }); } catch (e) {} }, /** * Updates the current window hash * * @param {string} newHash New Hash value * @title $.ui.updateHash(newHash) * @api private */ updateHash: function(newHash) { if (!this.manageHistory) return; newHash = newHash.indexOf("#") === -1 ? "#" + newHash : newHash; //force having the # in the begginning as a standard previousTarget = newHash; var previousHash = window.location.hash; var panelName = this.getPanelId(newHash).substring(1); //remove the # try { window.history.replaceState(panelName, panelName, startPath + newHash); $(window).trigger("hashchange", null, { newUrl: startPath + newHash, oldUrl: startPath + previousHash }); } catch (e) {} }, /*gets the panel name from an hash*/ getPanelId: function(hash) { var firstSlash = hash.indexOf("/"); return firstSlash === -1 ? hash : hash.substring(0, firstSlash); }, /** * Update a badge on the selected target. Position can be bl = bottom left tl = top left br = bottom right tr = top right (default) ``` $.ui.updateBadge("#mydiv","3","bl","green"); ``` * @param {string} target * @param {string} value * @param {string=} position * @param {(string=|object)} color Color or CSS hash * @title $.ui.updateBadge(target,value,[position],[color]) */ updateBadge: function(target, value, position, color) { if (position === undefined) position = ""; var $target = $(target); var badge = $target.find("span.af-badge"); if (badge.length === 0) { if ($target.css("position") !== "absolute") $target.css("position", "relative"); badge = $.create("span", { className: "af-badge " + position, html: value }); $target.append(badge); } else badge.html(value); badge.removeClass("tl bl br tr"); badge.addClass(position); if (color === undefined) color = "red"; if ($.isObject(color)) { badge.css(color); } else if (color) { badge.css("background", color); } badge.data("ignore-pressed", "true"); }, /** * Removes a badge from the selected target. ``` $.ui.removeBadge("#mydiv"); ``` * @param {string} target * @title $.ui.removeBadge(target) */ removeBadge: function(target) { $(target).find("span.af-badge").remove(); }, /** * Toggles the bottom nav menu. Force is a boolean to force show or hide. ``` $.ui.toggleNavMenu();//toggle it $.ui.toggleNavMenu(true); //force show it ``` * @param {boolean=} force * @title $.ui.toggleNavMenu([force]) */ toggleNavMenu: function(force) { if (!this.showNavMenu) return; if ($.query("#navbar").css("display") !== "none" && ((force !== undefined && force !== true) || force === undefined)) { $.query("#navbar").hide(); } else if (force === undefined || (force !== undefined && force === true)) { $.query("#navbar").show(); } }, /** * Toggles the top header menu. Force is a boolean to force show or hide. ``` $.ui.toggleHeaderMenu();//toggle it ``` * @param {boolean=} force * @title $.ui.toggleHeaderMenu([force]) */ toggleHeaderMenu: function(force) { if ($.query("#header").css("display") !== "none" && ((force !== undefined && force !== true) || force === undefined)) { $.query("#header").hide(); } else if (force === undefined || (force !== undefined && force === true)) { $.query("#header").show(); } }, /** * Toggles the right hand side menu */ toggleAsideMenu:function(){ this.toggleRightSideMenu.apply(this,arguments); }, toggleRightSideMenu:function(force,callback,time){ if(!this.isAsideMenuEnabled()) return; return this.toggleLeftSideMenu(force,callback,time,true); }, /** * Toggles the side menu. Force is a boolean to force show or hide. ``` $.ui.toggleSideMenu();//toggle it ``` * @param {boolean=} force * @param {function=} callback Callback function to execute after menu toggle is finished * @param {number=} time Time to run the transition * @param {boolean=} aside * @title $.ui.toggleSideMenu([force],[callback],[time]) */ toggleLeftSideMenu: function(force, callback, time, aside) { if ((!this.isSideMenuEnabled()&&!this.isAsideMenuEnabled()) || this.togglingSideMenu) return; if(!aside&&!this.isSideMenuEnabled()) return; if(!aside&&$.ui.splitview && window.innerWidth >= $.ui.handheldMinWidth) return; var that = this; var menu = $.query("#menu"); var asideMenu= $.query("#aside_menu"); var els = $.query("#content, #header, #navbar"); var panelMask = $.query(".afui_panel_mask"); time = time || this.transitionTime; var open = this.isSideMenuOn(); var toX=aside?"-"+asideMenu.width():menu.width(); // add panel mask to block when side menu is open for phone devices if(panelMask.length === 0 && window.innerWidth < $.ui.handheldMinWidth){ els.append("<div class='afui_panel_mask'></div>"); panelMask = $.query(".afui_panel_mask"); $(".afui_panel_mask").bind("click", function(){ $.ui.toggleSideMenu(false, null, null, aside); }); } //Here we need to check if we are toggling the left to right, or right to left var menuPos=this.getSideMenuPosition(); if(open&&!aside&&menuPos<0) open=false; else if(open&&aside&&menuPos>0) open=false; if (force === 2 || (!open && ((force !== undefined && force !== false) || force === undefined))) { this.togglingSideMenu = true; if(!aside) menu.show(); else asideMenu.show(); that.css3animate(els, { x: toX, time: time, complete: function(canceled) { that.togglingSideMenu = false; els.vendorCss("Transition", ""); if (callback) callback(canceled); if(panelMask.length !== 0 && window.innerWidth < $.ui.handheldMinWidth){ panelMask.show(); } } }); } else if (force === undefined || (force !== undefined && force === false)) { this.togglingSideMenu = true; that.css3animate(els, { x: "0px", time: time, complete: function(canceled) { // els.removeClass("on"); els.vendorCss("Transition", ""); els.vendorCss("Transform", ""); that.togglingSideMenu = false; if (callback) callback(canceled); if(!$.ui.splitview) menu.hide(); asideMenu.hide(); if(panelMask.length !== 0 && window.innerWidth < $.ui.handheldMinWidth){ panelMask.hide(); } } }); } }, toggleSideMenu:function(){ this.toggleLeftSideMenu.apply(this,arguments); }, /** * Disables the side menu ``` $.ui.disableSideMenu(); ``` * @title $.ui.disableSideMenu(); */ disableSideMenu: function() { this.disableLeftSideMenu(); }, disableLeftSideMenu:function(){ var els = $.query("#content, #header, #navbar"); if (this.isSideMenuOn()) { this.toggleSideMenu(false, function(canceled) { if (!canceled) els.removeClass("hasMenu"); }); } else els.removeClass("hasMenu"); }, /** * Enables the side menu if it has been disabled ``` $.ui.enableSideMenu(); ``` * @title $.ui.enableSideMenu(); */ enableLeftSideMenu: function() { $.query("#content, #header, #navbar").addClass("hasMenu"); }, enableSideMenu:function(){ return this.enableLeftSideMenu(); }, /** * Disables the side menu ``` $.ui.disableSideMenu(); ``` * @title $.ui.disableSideMenu(); */ disableRightSideMenu:function(){ var els = $.query("#content, #header, #navbar"); if (this.isSideMenuOn()) { this.toggleSideMenu(false, function(canceled) { if (!canceled) els.removeClass("hasAside"); }); } else els.removeClass("hasAside"); }, /** * Enables the side menu if it has been disabled ``` $.ui.enableRightSideMenu(); ``` * @title $.ui.enableRightSideMenu(); */ enableRightSideMenu: function() { $.query("#content, #header, #navbar").addClass("hasAside"); }, /** * * @title $.ui.isSideMenuEnabled(); * @api private */ isSideMenuEnabled: function() { return $.query("#content").hasClass("hasMenu"); }, /** * * @title $.ui.isAsideMenuEnabled(); * @api private */ isAsideMenuEnabled: function() { return $.query("#content").hasClass("hasAside"); }, /** * * @title $.ui.enableSideMenu(); * @api private */ isSideMenuOn: function() { var menu = this.getSideMenuPosition() !==0 ? true : false; return (this.isSideMenuEnabled()||this.isAsideMenuEnabled) && menu; }, /** * @title $.ui.getSideMenuPosition(); * @api private */ getSideMenuPosition:function(){ return numOnly(parseFloat($.getCssMatrix($("#content")).e)); }, /** * Boolean that will disable the splitview before launch ``` $.ui.splitView=false; ``` * @title $.ui.splitview */ splitview:true, /** * Disables the split view on tablets ``` $.ui.disableSplitView(); ``` * @title $.ui.disableSplitView(); */ disableSplitView:function(){ $.query("#content, #header, #navbar, #menu").removeClass("splitview"); this.splitview=false; }, /** * Reference to the default footer * @api private */ prevFooter: null, /** * Updates the elements in the navbar ``` $.ui.updateNavbarElements(elements); ``` * @param {(string|object)} elems * @title $.ui.updateNavbarElements(Elements) */ updateNavbarElements: function(elems) { if (this.prevFooter) { if (this.prevFooter.data("parent")){ var useScroller = this.scrollingDivs.hasOwnProperty(this.prevFooter.data("parent")); if($.feat.nativeTouchScroll||$.os.desktop || !useScroller ){ this.prevFooter.appendTo("#" + this.prevFooter.data("parent")); } else { this.prevFooter.appendTo($("#" + this.prevFooter.data("parent")).find(".afScrollPanel")); } } else this.prevFooter.appendTo("#afui"); } if (!$.is$(elems)) //inline footer { elems = $.query("#" + elems); } $.query("#navbar").append(elems); this.prevFooter = elems; var tmpAnchors = $.query("#navbar > footer > a:not(.button)"); if (tmpAnchors.length > 0) { tmpAnchors.data("ignore-pressed", "true").data("resetHistory", "true"); var width = parseFloat(100 / tmpAnchors.length); tmpAnchors.css("width", width + "%"); } var nodes = $.query("#navbar footer"); if (nodes.length === 0) return; nodes = nodes.get(0).childNodes; for (var i = 0; i < nodes.length; i++) { if (nodes[i].nodeType === 3) { nodes[i].parentNode.removeChild(nodes[i]); } } }, /** * Reference to the previous header * @api private */ prevHeader: null, /** * Updates the elements in the header ``` $.ui.updateHeaderElements(elements); ``` * @param {(string|object)} elems * @param {boolean} goBack * @title $.ui.updateHeaderElements(Elements) */ updateHeaderElements: function(elems, goBack) { var that = this; if (!$.is$(elems)) //inline footer { elems = $.query("#" + elems); } if (elems === this.prevHeader) return; this._currentHeaderID=elems.prop("id"); if (this.prevHeader) { var useScroller = this.scrollingDivs.hasOwnProperty(this.prevHeader.data("parent")); //Let's slide them out $.query("#header").append(elems); //Do not animate - sometimes they act funky if (!$.ui.animateHeaders) { if (that.prevHeader.data("parent")){ if($.feat.nativeTouchScroll||$.os.desktop || !useScroller ){ this.prevHeader.appendTo("#" + this.prevHeader.data("parent")); } else { this.prevHeader.appendTo($("#" + this.prevHeader.data("parent")).find(".afScrollPanel")); } } else that.prevHeader.appendTo("#afui"); that.prevHeader = elems; return; } var from = goBack ? "100px" : "-100px"; var to = goBack ? "-100px" : "100px"; that.prevHeader.addClass("ignore"); that.css3animate(elems, { x: to, opacity: 0.3, time: "1ms" }); that.css3animate(that.prevHeader, { x: from, y: 0, opacity: 0.3, time: that.transitionTime, delay: numOnly(that.transitionTime) / 5 + "ms", complete: function() { if (that.prevHeader.data("parent")){ if($.feat.nativeTouchScroll||$.os.desktop || !useScroller ){ that.prevHeader.appendTo("#" + that.prevHeader.data("parent")); } else { that.prevHeader.appendTo($("#" + that.prevHeader.data("parent")).find(".afScrollPanel")); } } else that.prevHeader.appendTo("#afui"); that.prevHeader.removeClass("ignore"); that.css3animate(that.prevHeader, { x: to, opacity: 1, time: "1ms" }); that.prevHeader = elems; } }); that.css3animate(elems, { x: "0px", opacity: 1, time: that.transitionTime }); } else { $.query("#header").append(elems); this.prevHeader = elems; } }, /** * @api private */ previAsideMenu:null, /** * Updates the right hand aside menus */ updateAsideElements:function(){ return this.updateRightSideMenuElements.apply(this,arguments); }, updateRightSideMenuElements:function(elems){ if (elems === undefined || elems === null) return; var nb = $.query("#aside_menu_scroller"); if (this.prevAsideMenu) { this.prevAsideMenu.insertBefore("#afui #aside_menu"); this.prevAsideMenu = null; } if (!$.is$(elems)) elems = $.query("#" + elems); if($(elems).attr("title")){ $(elems).prepend( $.create("header", {className:"header"}).append( $.create("h1", {html:$(elems).attr("title")}).get(0)) ); $(elems).removeAttr("title"); } nb.html(""); nb.append(elems); this.prevAsideMenu = elems; //Move the scroller to the top and hide it this.scrollingDivs.aside_menu_scroller.hideScrollbars(); this.scrollingDivs.aside_menu_scroller.scrollToTop(); }, /** * @api private * Kept for backwards compatibility */ updateSideMenu: function(elems) { return this.updateSideMenuElements(elems); }, /** * Updates the elements in the side menu ``` $.ui.updateSideMenuElements(elements); ``` * @param {...(string|object)} elements * @title $.ui.updateSideMenuElements(elements) */ updateSideMenuElements: function() { return this.updateLeftSideMenuElements.apply(this,arguments); }, updateLeftSideMenuElements:function(elems) { if (elems === undefined || elems === null) return; var nb = $.query("#menu_scroller"); if (this.prevMenu) { this.prevMenu.insertBefore("#afui #menu"); this.prevMenu = null; } if (!$.is$(elems)) elems = $.query("#" + elems); if($(elems).attr("title")){ $(elems).prepend( $.create("header", {className:"header"}).append( $.create("h1", {html:$(elems).attr("title")}).get(0)) ); $(elems).removeAttr("title"); } nb.html(""); nb.append(elems); this.prevMenu = elems; //Move the scroller to the top and hide it this.scrollingDivs.menu_scroller.hideScrollbars(); this.scrollingDivs.menu_scroller.scrollToTop(); }, /** * Set the title of the current panel ``` $.ui.setTitle("new title"); ``` * @param {string} val * @title $.ui.setTitle(value) */ setTitle: function(val) { if(this._currentHeaderID !== "defaultHeader") return; $.query("#header header:not(.ignore) #pageTitle").html(val); }, /** * Override the text for the back button ``` $.ui.setBackButtonText("GO..."); ``` * @param {string} text * @title $.ui.setBackButtonText(text) */ setBackButtonText: function(text) { if(this._currentHeaderID !== "defaultHeader") return; if (this.trimBackButtonText && text.length >= 7) text = text.substring(0, 5) + "..."; if (this.backButtonText.length > 0) $.query("#header header:not(.ignore) .backButton").html(this.backButtonText); else $.query("#header header:not(.ignore) .backButton").html(text); }, /** * Toggle visibility of the back button */ setBackButtonVisibility: function(show) { if (!show) $.query("#header .backButton").css("visibility", "hidden"); else $.query("#header .backButton").css("visibility", "visible"); }, /** * Show the loading mask ``` $.ui.showMask() $.ui.showMask('Doing work') ``` * @param {string=} text * @title $.ui.showMask(text); */ showMask: function(text) { if (!text) text = this.loadingText || ""; $.query("#afui_mask>h1").html(text); $.query("#afui_mask").show(); }, /** * Hide the loading mask * @title $.ui.hideMask(); */ hideMask: function() { $.query("#afui_mask").hide(); }, /** * @api private */ modalReference_:null, /** * Load a content panel in a modal window. ``` $.ui.showModal("#myDiv","fade"); ``` * @param {(string|object)} id panel to show * @param {string=} trans * @title $.ui.showModal(); */ showModal: function(id, trans) { var that = this; this.modalTransition = trans || "up"; var modalDiv = $.query("#modalContainer"); if (typeof(id) === "string") id = "#" + id.replace("#", ""); var $panel = $.query(id); this.modalReference_=$panel; var modalParent=$.query("#afui_modal"); if ($panel.length) { var useScroller = this.scrollingDivs.hasOwnProperty($panel.attr("id")); //modalDiv.html($.feat.nativeTouchScroll || !useScroller ? $.query(id).html() : $.query(id).get(0).childNodes[0].innerHTML + '', true); var elemsToCopy; if($.feat.nativeTouchScroll||$.os.desktop || !useScroller ){ elemsToCopy=$panel.contents(); modalDiv.append(elemsToCopy); } else { elemsToCopy=$($panel.get(0).childNodes[0]).contents(); //modalDiv.append(elemsToCopy); modalDiv.children().eq(0).append(elemsToCopy); } this.runTransition(this.modalTransition, that.modalTransContainer, that.modalWindow, false); $(that.modalWindow).css("display",""); $(that.modalWindow).addClass("display","flexContainer"); if (useScroller) { this.scrollingDivs.modal_container.enable(that.resetScrollers); } else { this.scrollingDivs.modal_container.disable(); } modalDiv.addClass("panel").show(); //modal header if($panel.data("header") === "none"){ // no header modalParent.find("#modalHeader").hide(); } else if(elemsToCopy.filter("header").length>0){ // custom header modalParent.find("#modalHeader").append(elemsToCopy.filter("header")).show(); } else { // add default header with close modalParent.find("#modalHeader").append( $.create("header", {}).append( $.create("h1", {html:$panel.data("title")}).get(0)) .append( $.create("a", {className:"button icon close"}).attr("onclick","$.ui.hideModal()").get(0) )).show(); } //modal footer if($panel.data("footer") === "none"){ // no footer modalParent.find("#modalFooter").hide(); } else if(elemsToCopy.filter("footer").length>0){ // custom footer modalParent.find("#modalFooter").append(elemsToCopy.filter("footer")).show(); var tmpAnchors = $.query("#modalFooter > footer > a:not(.button)"); if (tmpAnchors.length > 0) { var width = parseFloat(100 / tmpAnchors.length); tmpAnchors.css("width", width + "%"); } var nodes = $.query("#modalFooter footer"); if (nodes.length === 0) return; nodes = nodes.get(0).childNodes; for (var i = 0; i < nodes.length; i++) { if (nodes[i].nodeType === 3) { nodes[i].parentNode.removeChild(nodes[i]); } } } else { // no default footer modalParent.find("#modalFooter").hide(); } this.scrollToTop("modal"); modalDiv.data("panel", id); var myPanel=$panel.get(0); var fnc = myPanel.getAttribute("data-load"); if(fnc) this.dispatchPanelEvent(fnc,myPanel); $panel.trigger("loadpanel"); } }, /** * Hide the modal window and remove the content. We remove any event listeners on the contents. ``` $.ui.hideModal(""); ``` * @title $.ui.hideModal(); */ hideModal: function() { var self = this; var $cnt=$.query("#modalContainer"); var useScroller = this.scrollingDivs.hasOwnProperty(this.modalReference_.attr("id")); this.runTransition(self.modalTransition, self.modalWindow, self.modalTransContainer, true); this.scrollingDivs.modal_container.disable(); var tmp = $.query($cnt.data("panel")); var fnc = tmp.data("unload"); if(fnc) this.dispatchPanelEvent(fnc,tmp.get(0)); tmp.trigger("unloadpanel"); setTimeout(function(){ if($.feat.nativeTouchScroll||$.os.desktop || !useScroller){ self.modalReference_.append($("#modalHeader header")); self.modalReference_.append($cnt.contents()); self.modalReference_.append($("#modalFooter footer")); } else { self.modalReference_.children().eq(0).append($("#modalHeader header")); $(self.modalReference_.get(0).childNodes[0]).append($cnt.children().eq(0).contents()); self.modalReference_.children().eq(0).append($("#modalFooter footer")); } // $cnt.html("", true); },this.transitionTime); }, /** * Update the HTML in a content panel ``` $.ui.updatePanel("#myDiv","This is the new content"); ``` * @param {(string|object)} id * @param {string} content HTML to update with * @title $.ui.updatePanel(id,content); */ updatePanel: function(id, content) { id = "#" + id.replace("#", ""); var el = $.query(id).get(0); if (!el) return; var newDiv = $.create("div", { html: content }); if (newDiv.children(".panel") && newDiv.children(".panel").length > 0) newDiv = newDiv.children(".panel").get(0); else newDiv = newDiv.get(0); if (el.getAttribute("js-scrolling") && (el.getAttribute("js-scrolling").toLowerCase() === "yes" || el.getAttribute("js-scrolling").toLowerCase() === "true")) { $.cleanUpContent(el.childNodes[0], false, true); $(el.childNodes[0]).html(content); } else { $.cleanUpContent(el, false, true); $(el).html(content); var scr=this.scrollingDivs[el.id]; if(scr&&scr.refresh) scr.addPullToRefresh(); } if (newDiv.getAttribute("data-title")) el.setAttribute("data-title",newDiv.getAttribute("data-title")); }, /** * Same as $.ui.updatePanel. kept for backwards compatibility ``` $.ui.updateContentDiv("#myDiv","This is the new content"); ``` * @param {(string|object)} id * @param {string} content HTML to update with * @title $.ui.updateContentDiv(id, content); */ updateContentDiv: function(id, content) { return this.updatePanel(id, content); }, /** * Dynamically creates a new panel. It wires events, creates the scroller, applies Android fixes, etc. ``` $.ui.addContentDiv("myDiv","This is the new content","Title"); ``` * @param {(string|object)} el Element to add * @param {string} content * @param {string} title * @param {boolean=} refresh Enable refresh on pull * @param {function=} refreshFunc * @title $.ui.addContentDiv(id, content, title); */ addContentDiv: function(el, content, title, refresh, refreshFunc) { el = typeof(el) !== "string" ? el : el.indexOf("#") === -1 ? "#" + el : el; var myEl = $.query(el).get(0); var newDiv, newId; if (!myEl) { newDiv = $.create("div", { html: content }); if (newDiv.children(".panel") && newDiv.children(".panel").length > 0) newDiv = newDiv.children(".panel").get(0); else newDiv = newDiv.get(0); if (!newDiv.getAttribute("data-title") && title) newDiv.setAttribute("data-title",title); newId = (newDiv.id) ? newDiv.id : el.replace("#", ""); //figure out the new id - either the id from the loaded div.panel or the crc32 hash newDiv.id = newId; if (newDiv.id !== el) newDiv.setAttribute("data-crc", el.replace("#", "")); } else { newDiv = myEl; } newDiv.className = "panel"; newId = newDiv.id; this.addDivAndScroll(newDiv, refresh, refreshFunc); myEl = null; newDiv = null; return newId; }, /** * Takes a div and sets up scrolling for it.. ``` $.ui.addDivAndScroll(object); ``` * @param {object} tmp Element * @param {boolean=} refreshPull * @param {function} refreshFunc * @param {object=} container * @title $.ui.addDivAndScroll(element); * @api private */ addDivAndScroll: function(tmp, refreshPull, refreshFunc, container) { var self=this; var jsScroll = false, scrollEl; var overflowStyle = tmp.style.overflow; var hasScroll = overflowStyle !== "hidden" && overflowStyle !== "visible"; container = container || this.content; //sets up scroll when required and not supported if (!$.feat.nativeTouchScroll && hasScroll&&!$.os.desktop) tmp.setAttribute("js-scrolling", "true"); if (tmp.getAttribute("js-scrolling") && (tmp.getAttribute("js-scrolling").toLowerCase() === "yes" || tmp.getAttribute("js-scrolling").toLowerCase() === "true")) { jsScroll = true; hasScroll = true; } var title = tmp.getAttribute("data-title")||tmp.title; tmp.title = ""; tmp.setAttribute("data-title",title); if($(tmp).hasClass("no-scroll") || (tmp.getAttribute("scrolling") && tmp.getAttribute("scrolling") === "no")) { hasScroll = false; jsScroll = false; tmp.removeAttribute("js-scrolling"); } if (!jsScroll ) { container.appendChild(tmp); scrollEl = tmp; tmp.style["-webkit-overflow-scrolling"] = "none"; } else { //WE need to clone the div so we keep events scrollEl=tmp; container.appendChild(tmp); /*scrollEl = tmp.cloneNode(false); tmp.title = null; tmp.id = null; var $tmp = $(tmp); $tmp.removeAttr("data-footer data-aside data-nav data-header selected data-load data-unload data-tab data-crc title data-title"); $tmp.replaceClass("panel", "afScrollPanel"); scrollEl.appendChild(tmp); container.appendChild(scrollEl); */ if (this.selectBox !== false) this.selectBox.getOldSelects(scrollEl.id); if (this.passwordBox !== false) this.passwordBox.getOldPasswords(scrollEl.id); } if (hasScroll) { this.scrollingDivs[scrollEl.id] = ($(tmp).scroller({ scrollBars: true, verticalScroll: true, horizontalScroll: self.horizontalScroll, vScrollCSS: "afScrollbar", refresh: refreshPull, useJsScroll: jsScroll, lockBounce: this.lockPageBounce, autoEnable: false //dont enable the events unnecessarilly })); //backwards compatibility $(tmp).addClass("y-scroll"); if(self.horizontalScroll) $(tmp).addClass("x-scroll"); if (refreshFunc) $.bind(this.scrollingDivs[scrollEl.id], "refresh-release", function(trigger) { if (trigger) refreshFunc(); }); if(jsScroll){ $(tmp).children().eq(0).addClass("afScrollPanel"); } } return scrollEl.id; }, /** * Scrolls a panel to the top ``` $.ui.scrollToTop(id); ``` * @param {string} id * @param {string} time Time to scroll * @title $.ui.scrollToTop(id); */ scrollToTop: function(id, time) { time = time || "300ms"; id = id.replace("#", ""); if (this.scrollingDivs[id]) { this.scrollingDivs[id].scrollToTop(time); } }, /** * Scrolls a panel to the bottom ``` $.ui.scrollToBottom(id,time); ``` * @param {string} id * @param {string} time Time to scroll * @title $.ui.scrollToBottom(id); */ scrollToBottom: function(id, time) { id = id.replace("#", ""); if (this.scrollingDivs[id]) { this.scrollingDivs[id].scrollToBottom(time); } }, /** * This is used when a transition fires to do helper events. We check to see if we need to change the nav menus, footer, and fire * the load/onload functions for panels ``` $.ui.parsePanelFunctions(currentDiv, oldDiv); ``` * @param {object} what current div * @param {object=} oldDiv old div * @param {boolean=} goBack * @title $.ui.parsePanelFunctions(currentDiv, oldDiv); * @api private */ parsePanelFunctions: function(what, oldDiv, goBack) { //check for custom footer var that = this; var hasFooter = what.getAttribute("data-footer"); var hasHeader = what.getAttribute("data-header"); //$asap removed since animations are fixed in css3animate if (hasFooter && hasFooter.toLowerCase() === "none") { that.toggleNavMenu(false); hasFooter = false; } else { that.toggleNavMenu(true); } if (hasFooter && that.customFooter !== hasFooter) { that.customFooter = hasFooter; that.updateNavbarElements(hasFooter); } else if (hasFooter !== that.customFooter) { if (that.customFooter) that.updateNavbarElements(that.defaultFooter); that.customFooter = false; } if (hasHeader && hasHeader.toLowerCase() === "none") { that.toggleHeaderMenu(false); hasHeader=false; } else { that.toggleHeaderMenu(true); } if (hasHeader && that.customHeader !== hasHeader) { that.customHeader = hasHeader; that.updateHeaderElements(hasHeader, goBack); } else if (hasHeader !== that.customHeader) { if (that.customHeader) { that.updateHeaderElements(that.defaultHeader, goBack); //that.setTitle(that.activeDiv.title); } that.customHeader = false; } //Load inline footers var inlineFooters = $(what).find("footer"); if (inlineFooters.length > 0) { that.customFooter = what.id; inlineFooters.data("parent", what.id); that.updateNavbarElements(inlineFooters); } //load inline headers var inlineHeader = $(what).find("header"); if (inlineHeader.length > 0) { that.customHeader = what.id; inlineHeader.data("parent", what.id); that.updateHeaderElements(inlineHeader, goBack); } //check if the panel has a footer if (what.getAttribute("data-tab")) { //Allow the dev to force the footer menu $.query("#navbar>footer>a:not(.button)").removeClass("pressed"); $.query("#navbar #" + what.getAttribute("data-tab")).addClass("pressed"); } var hasMenu = what.getAttribute("data-left-menu")||what.getAttribute("data-nav"); if (hasMenu && this.customMenu !== hasMenu) { this.customMenu = hasMenu; this.updateSideMenuElements(hasMenu); } else if (hasMenu !== this.customMenu) { if (this.customMenu) { this.updateSideMenuElements(this.defaultMenu); } this.customMenu = false; } var hasAside =what.getAttribute("data-right-menu")|| what.getAttribute("data-aside"); if(hasAside && this.customAside !== hasAside){ this.customAside= hasAside; this.updateAsideElements(hasAside); } else if(hasAside !== this.customAside) { if(this.customAside){ this.updateAsideElements(this.defaultAside); } this.customAside=false; } if (oldDiv) { fnc = oldDiv.getAttribute("data-unload"); if(fnc) this.dispatchPanelEvent(fnc,oldDiv); $(oldDiv).trigger("unloadpanel"); } var fnc = what.getAttribute("data-load"); if(fnc) this.dispatchPanelEvent(fnc,what); $(what).trigger("loadpanel"); if (this.isSideMenuOn()) { that.toggleSideMenu(false); } }, /** * Helper function that parses a contents html for any script tags and either adds them or executes the code * @api private */ parseScriptTags: function(div) { if (!div) return; if(!$.fn||$.fn.namespace!=="appframework") return; $.parseJS(div); }, /** * This is called to initiate a transition or load content via ajax. * We can pass in a hash+id or URL and then we parse the panel for additional functions ``` $.ui.loadContent("#main",false,false,"up"); ``` * @param {string} target * @param {boolean=} newtab (resets history) * @param {boolean=} go back (initiate the back click) * @param {string=} transition * @param {object=} anchor * @title $.ui.loadContent(target, newTab, goBack, transition, anchor); * @api public */ loadContent: function(target, newTab, back, transition, anchor) { if (this.doingTransition) { this.loadContentQueue.push([target, newTab, back, transition, anchor]); return; } if (target.length === 0) return; var loadAjax = true; anchor = anchor || document.createElement("a"); //Hack to allow passing in no anchor if (target.indexOf("#") === -1) { var urlHash = "url" + crc32(target); //Ajax urls var crcCheck = $.query("div.panel[data-crc='" + urlHash + "']"); if ($.query("#" + target).length > 0) { loadAjax = false; } else if (crcCheck.length > 0) { loadAjax = false; if (anchor.getAttribute("data-refresh-ajax") === "true" || (anchor.refresh && anchor.refresh === true || this.isAjaxApp)) { loadAjax = true; } else { target = "#" + crcCheck.get(0).id; } } else if ($.query("#" + urlHash).length > 0) { //ajax div already exists. Let's see if we should be refreshing it. loadAjax = false; if (anchor.getAttribute("data-refresh-ajax") === "true" || (anchor.refresh && anchor.refresh === true || this.isAjaxApp)) { loadAjax = true; } else target = "#" + urlHash; } } if (target.indexOf("#") === -1 && loadAjax) { this.loadAjax(target, newTab, back, transition, anchor); } else { this.loadDiv(target, newTab, back, transition); } }, /** * This is called internally by loadContent. Here we are loading a div instead of an Ajax link ``` $.ui.loadDiv("#main",false,false,"up"); ``` * @param {string} target * @param {boolean=} newtab (resets history) * @param {boolean=} back Go back (initiate the back click) * @param {string=} transition * @title $.ui.loadDiv(target,newTab,goBack,transition); * @api private */ loadDiv: function(target, newTab, back, transition) { // load a div var that = this; var what = target.replace("#", ""); var slashIndex = what.indexOf("/"); var hashLink = ""; if (slashIndex !== -1) { // Ignore everything after the slash for loading hashLink = what.substr(slashIndex); what = what.substr(0, slashIndex); } what = $.query("#" + what).get(0); if (!what) { $(document).trigger("missingpanel", null, {missingTarget: target}); return; } if (what === this.activeDiv && !back) { //toggle the menu if applicable if (this.isSideMenuOn()) this.toggleSideMenu(false); return; } this.transitionType = transition; var oldDiv = this.activeDiv; var currWhat = what; if (what.getAttribute("data-modal") === "true" || what.getAttribute("modal") === "true") { return this.showModal(what.id); } if (oldDiv === currWhat) //prevent it from going to itself return; if (newTab) { this.clearHistory(); this.pushHistory("#" + this.firstDiv.id, what.id, transition, hashLink); } else if (!back) { this.pushHistory(previousTarget, what.id, transition, hashLink); } previousTarget = "#" + what.id + hashLink; this.doingTransition = true; oldDiv.style.display = "block"; currWhat.style.display = "block"; this.runTransition(transition, oldDiv, currWhat, back); //Let's check if it has a function to run to update the data this.parsePanelFunctions(what, oldDiv, back); //Need to call after parsePanelFunctions, since new headers can override this.loadContentData(what, newTab, back, transition); //this fixes a bug in iOS where a div flashes when the the overflow property is changed from auto to hidden if($.feat.nativeTouchScroll) { setTimeout(function() { if (that.scrollingDivs[oldDiv.id]) { that.scrollingDivs[oldDiv.id].disable(); } }, numOnly(that.transitionTime) + 50); } else if (typeof that.scrollingDivs[oldDiv.id] !== "undefined") that.scrollingDivs[oldDiv.id].disable(); }, /** * This is called internally by loadDiv. This sets up the back button in the header and scroller for the panel ``` $.ui.loadContentData("#main",false,false,"up"); ``` * @param {string} target * @param {boolean=} newtab (resets history) * @param {boolean=} go back (initiate the back click) * @title $.ui.loadContentData(target,newTab,goBack); * @api private */ loadContentData: function(what, newTab, back) { var prevId, el, val, slashIndex; if (back) { if (this.history.length > 0) { val = this.history[this.history.length - 1]; slashIndex = val.target.indexOf("/"); if (slashIndex !== -1) { prevId = val.target.substr(0, slashIndex); } else prevId = val.target; el = $.query(prevId).get(0); //make sure panel is there if (el) this.setBackButtonText(el.getAttribute("data-title")); else this.setBackButtonText("Back"); } } else if (this.activeDiv.getAttribute("data-title")) this.setBackButtonText(this.activeDiv.getAttribute("data-title")); else this.setBackButtonText("Back"); if (what.getAttribute("data-title")) { this.setTitle(what.getAttribute("data-title")); } if (newTab) { this.setBackButtonText(this.firstDiv.getAttribute("data-title")); if (what === this.firstDiv) { this.history.length = 0; } } $("#header #menubadge").css("float", "right"); if (this.history.length === 0) { this.setBackButtonVisibility(false); this.history = []; $("#header #menubadge").css("float", "left"); } else { this.setBackButtonVisibility( this.showBackButton && this.showBackbutton ); } this.activeDiv = what; if (this.scrollingDivs[this.activeDiv.id]) { this.scrollingDivs[this.activeDiv.id].enable(this.resetScrollers); } }, /** * This is called internally by loadContent. Here we are using Ajax to fetch the data ``` $.ui.loadDiv("page.html",false,false,"up"); ``` * @param {string} target * @param {boolean=} newtab (resets history) * @param {boolean=} go back (initiate the back click) * @param {string=} transition * @param {object=} anchor * @title $.ui.loadDiv(target,newTab,goBack,transition); * @api private */ loadAjax: function(target, newTab, back, transition, anchor) { // XML Request if (this.activeDiv.id === "afui_ajax" && target === this.ajaxUrl) return; var urlHash = "url" + crc32(target); //Ajax urls var that = this; if (target.indexOf("http") === -1) target = intel.xdk.webRoot + target; var xmlhttp = new XMLHttpRequest(); if (anchor && typeof(anchor) !== "object") { anchor = document.createElement("a"); anchor.setAttribute("data-persist-ajax", true); } anchor = anchor || document.createElement("a"); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState === 4 && xmlhttp.status === 200) { this.doingTransition = false; var refreshFunction; var doReturn = false; var retainDiv = $.query("#" + urlHash); //Here we check to see if we are retaining the div, if so update it if (retainDiv.length > 0) { that.updatePanel(urlHash, xmlhttp.responseText); retainDiv.get(0).setAttribute("data-title",anchor.title ? anchor.title : target); } else if (anchor.getAttribute("data-persist-ajax") || that.isAjaxApp) { var refresh = (anchor.getAttribute("data-pull-scroller") === "true") ? true : false; refreshFunction = refresh ? function() { anchor.refresh = true; that.loadContent(target, newTab, back, transition, anchor); anchor.refresh = false; } : null; //that.addContentDiv(urlHash, xmlhttp.responseText, refresh, refreshFunction); var contents = $(xmlhttp.responseText); if (contents.hasClass("panel")) { urlHash=contents.attr("id"); contents = contents.get(0).innerHTML; } else contents = contents.html(); if ($("#" + urlHash).length > 0) { that.updatePanel("#" + urlHash, contents); } else if ($("div.panel[data-crc='" + urlHash + "']").length > 0) { that.updatePanel($("div.panel[data-crc='" + urlHash + "']").get(0).id, contents); urlHash = $("div.panel[data-crc='" + urlHash + "']").get(0).id; } else urlHash = that.addContentDiv(urlHash, xmlhttp.responseText, anchor.title ? anchor.title : target, refresh, refreshFunction); } else { that.updatePanel("afui_ajax", xmlhttp.responseText); $.query("#afui_ajax").attr("data-title",anchor.title ? anchor.title : target); that.loadContent("#afui_ajax", newTab, back, transition); doReturn = true; } //Let's load the content now. //We need to check for any script tags and handle them var div = document.createElement("div"); $(div).html(xmlhttp.responseText); that.parseScriptTags(div); if (doReturn) { if (that.showLoading) that.hideMask(); return; } that.loadContent("#" + urlHash, newTab, back, transition); if (that.showLoading) that.hideMask(); return null; } else if(xmlhttp.readyState === 4) { $.ui.hideMask(); } }; this.ajaxUrl = target; var newtarget = this.useAjaxCacheBuster ? target + (target.split("?")[1] ? "&" : "?") + "cache=" + Math.random() * 10000000000000000 : target; xmlhttp.open("GET", newtarget, true); xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest"); xmlhttp.send(); // show Ajax Mask if (this.showLoading) this.showMask(); }, /** * This executes the transition for the panel ``` $.ui.runTransition(transition,oldDiv,currDiv,back) ``` * @api private * @title $.ui.runTransition(transition,oldDiv,currDiv,back) */ runTransition: function(transition, oldDiv, currWhat, back) { if (!this.availableTransitions[transition]) transition = "default"; if(oldDiv.style.display==="none") oldDiv.style.display = "block"; if(currWhat.style.display==="none") currWhat.style.display = "block"; this.availableTransitions[transition].call(this, oldDiv, currWhat, back); }, /** * This is callled when you want to launch afui. If autoLaunch is set to true, it gets called on DOMContentLoaded. * If autoLaunch is set to false, you can manually invoke it. ``` $.ui.autoLaunch=false; $.ui.launch(); ``` * @title $.ui.launch(); */ launch: function() { if (this.hasLaunched === false || this.launchCompleted) { this.hasLaunched = true; return; } if(this.isLaunching) return true; this.isLaunching=true; var that = this; this.viewportContainer = af.query("#afui"); this.navbar = af.query("#navbar").get(0); this.content = af.query("#content").get(0); this.header = af.query("#header").get(0); this.menu = af.query("#menu").get(0); //set anchor click handler for UI this.viewportContainer.on("click", "a", function(e) { if(that.useInternalRouting) checkAnchorClick(e, e.currentTarget); }); //enter-edit scroll paddings fix //focus scroll adjust fix var enterEditEl = null; //on enter-edit keep a reference of the actioned element $.bind($.touchLayer, "enter-edit", function(el) { enterEditEl = el; }); //enter-edit-reshape panel padding and scroll adjust if($.os.android&&!$.os.androidICS) { $.bind($.touchLayer, "enter-edit-reshape", function() { //onReshape UI fixes //check if focused element is within active panel var jQel = $(enterEditEl); var jQactive = jQel.closest(that.activeDiv); if (jQactive && jQactive.size() > 0) { var elPos = jQel.offset(); var containerPos = jQactive.offset(); if (elPos.bottom > containerPos.bottom && elPos.height < containerPos.height) { //apply fix that.scrollingDivs[that.activeDiv.id].scrollToItem(jQel, "bottom"); } } }); $.bind($.touchLayer, "exit-edit-reshape", function() { if (that.activeDiv && that.activeDiv.id && that.scrollingDivs.hasOwnProperty(that.activeDiv.id)) { that.scrollingDivs[that.activeDiv.id].setPaddings(0, 0); } }); } //elements setup if (!this.navbar) { this.navbar = $.create("div", { id: "navbar" }).get(0); this.viewportContainer.append(this.navbar); } if (!this.header) { this.header = $.create("div", { id: "header" }).get(0); this.viewportContainer.prepend(this.header); } if (!this.content) { this.content = $.create("div", { id: "content" }).get(0); $(this.content).insertAfter(this.header); } if (!this.menu) { this.menu = $.create("div", { id: "menu", html: "<div id='menu_scroller'></div>" }).get(0); this.viewportContainer.append(this.menu); this.menu.style.overflow = "hidden"; this.scrollingDivs.menu_scroller = $.query("#menu_scroller").scroller({ scrollBars: true, verticalScroll: true, vScrollCSS: "afScrollbar", useJsScroll: !$.feat.nativeTouchScroll, autoEnable: true, lockBounce: this.lockPageBounce, hasParent:true }); if ($.feat.nativeTouchScroll) $.query("#menu_scroller").css("height", "100%"); this.asideMenu = $.create("div", { id: "aside_menu", html: "<div id='aside_menu_scroller'></div>" }).get(0); this.viewportContainer.append(this.asideMenu); this.asideMenu.style.overflow = "hidden"; this.scrollingDivs.aside_menu_scroller = $.query("#aside_menu_scroller").scroller({ scrollBars: true, verticalScroll: true, vScrollCSS: "afScrollbar", useJsScroll: !$.feat.nativeTouchScroll, autoEnable: true, lockBounce: this.lockPageBounce, hasParent:true }); if ($.feat.nativeTouchScroll) $.query("#aside_menu_scroller").css("height", "100%"); } //insert backbutton (should optionally be left to developer..) $(this.header).html("<a class='backButton button'></a> <h1 id='pageTitle'></h1>" + this.header.innerHTML); this.backButton = $.query("#header .backButton").css("visibility", "hidden"); $(document).on("click", "#header .backButton", function(e) { e.preventDefault(); that.goBack(); }); //page title (should optionally be left to developer..) this.titlebar = $.query("#header #pageTitle").get(0); //setup ajax mask this.addContentDiv("afui_ajax", ""); var maskDiv = $.create("div", { id: "afui_mask", className: "ui-loader", html: "<span class='ui-icon ui-icon-loading spin'></span><h1>Loading Content</h1>" }).css({ "z-index": 20000, display: "none" }); document.body.appendChild(maskDiv.get(0)); //setup modalDiv var modalDiv = $.create("div", { id: "afui_modal" }).get(0); $(modalDiv).hide(); modalDiv.appendChild($.create("div",{ id:"modalHeader", className:"header" }).get(0)); modalDiv.appendChild($.create("div", { id: "modalContainer" }).get(0)); modalDiv.appendChild($.create("div",{ id:"modalFooter", className:"footer" }).get(0)); this.modalTransContainer = $.create("div", { id: "modalTransContainer" }).appendTo(modalDiv).get(0); this.viewportContainer.append(modalDiv); this.scrollingDivs.modal_container = $.query("#modalContainer").scroller({ scrollBars: true, vertical: true, vScrollCSS: "afScrollbar", lockBounce: this.lockPageBounce }); this.modalWindow = modalDiv; //get first div, defer var defer = {}; var contentDivs = this.viewportContainer.get(0).querySelectorAll(".panel"); for (var i = 0; i < contentDivs.length; i++) { var el = contentDivs[i]; var tmp = el; var prevSibling = el.previousSibling; if (el.parentNode && el.parentNode.id !== "content") { if (tmp.getAttribute("selected")) this.firstDiv = el; this.addDivAndScroll(tmp); $.query("#content").append(el); } else if (!el.parsedContent) { el.parsedContent = 1; if (tmp.getAttribute("selected")) this.firstDiv = el; this.addDivAndScroll(el); $(el).insertAfter(prevSibling); } if (el.getAttribute("data-defer")) { defer[el.id] = el.getAttribute("data-defer"); } if (!this.firstDiv) this.firstDiv = el; el = null; } contentDivs = null; var loadingDefer = false; var toLoad = Object.keys(defer).length; var loadDeferred=function(j){ $.ajax({ url: intel.xdk.webRoot + defer[j], success: function(data) { if (data.length > 0) { that.updatePanel(j, data); that.parseScriptTags($.query("#" + j).get(0)); } loaded++; if (loaded >= toLoad) { loadingDefer = false; $(document).trigger("defer:loaded"); } }, error: function() { //still trigger the file as being loaded to not block $.ui.ready console.log("Error with deferred load " + intel.xdk.webRoot + defer[j]); loaded++; if (loaded >= toLoad) { loadingDefer = false; $(document).trigger("defer:loaded"); } } }); }; if (toLoad > 0) { loadingDefer = true; var loaded = 0; for (var j in defer) { loadDeferred(j); } } if (this.firstDiv) { this.activeDiv = this.firstDiv; if (this.scrollingDivs[this.activeDiv.id]) { this.scrollingDivs[this.activeDiv.id].enable(); } var loadFirstDiv = function() { $.query("#navbar").append($.create("footer", { id: "defaultNav" }).append($.query("#navbar").children())); that.defaultFooter = "defaultNav"; that.prevFooter = $.query("#defaultNav"); that.updateNavbarElements(that.prevFooter); //setup initial menu var firstMenu = $.query("nav").get(0); if (firstMenu) { that.defaultMenu = $(firstMenu); that.updateSideMenuElements(that.defaultMenu); that.prevMenu = that.defaultMenu; } var firstAside = $.query("aside").get(0); if(firstAside) { that.defaultAside=$(firstAside); that.updateAsideElements(that.defaultAside); that.prevAsideMenu=that.defaultAside; } //get default header that.defaultHeader = "defaultHeader"; $.query("#header").append($.create("header", { id: "defaultHeader" }).append($.query("#header").children())); that.prevHeader = $.query("#defaultHeader"); $.query("#header").addClass("header"); $.query("#navbar").addClass("footer"); // $.query("#navbar").on("click", "footer>a:not(.button)", function(e) { $.query("#navbar>footer>a").not(e.currentTarget).removeClass("pressed"); $(e.currentTarget).addClass("pressed"); }); //There is a bug in chrome with @media queries where the header was not getting repainted if ($.query("nav").length > 0) { var splitViewClass=that.splitview?" splitview":""; $.query("#afui #header").addClass("hasMenu"+splitViewClass); $.query("#afui #content").addClass("hasMenu"+splitViewClass); $.query("#afui #navbar").addClass("hasMenu"+splitViewClass); $.query("#afui #menu").addClass("hasMenu"+splitViewClass); $.query("#afui #aside_menu").addClass(splitViewClass); } if($.query("aside").length > 0) { $.query("#afui #header, #afui #content, #afui #navbar").addClass("hasAside"); } $.query("#afui #menu").addClass("tabletMenu"); //go to activeDiv if($.ui.splitview&&window.innerWidth>parseInt($.ui.handheldMinWidth,10)){ $.ui.sideMenuWidth=$("#menu").width()+"px"; } var firstPanelId = that.getPanelId(defaultHash); //that.history=[{target:'#'+that.firstDiv.id}]; //set the first id as origin of path var isFirstPanel = (firstPanelId!==null&&firstPanelId === "#" + that.firstDiv.id); if (firstPanelId.length > 0 && that.loadDefaultHash && !isFirstPanel) { that.loadContent(defaultHash, true, false, "none"); //load the active page as a newTab with no transition } else { previousTarget = "#" + that.firstDiv.id; that.firstDiv.style.display = "block"; //Let's check if it has a function to run to update the data that.parsePanelFunctions(that.firstDiv); //Need to call after parsePanelFunctions, since new headers can override that.loadContentData(that.firstDiv); $.query("#header .backButton").css("visibility", "hidden"); if (that.firstDiv.getAttribute("data-modal") === "true" || that.firstDiv.getAttribute("modal") === "true") { that.showModal(that.firstDiv.id); } } that.launchCompleted = true; //trigger ui ready $.query("#afui #splashscreen").remove(); setTimeout(function(){ $(document).trigger("afui:ready"); }); }; if (loadingDefer) { $(document).one("defer:loaded", loadFirstDiv); } else loadFirstDiv(); } else { //Don't block afui:ready from dispatching, even though there's no content setTimeout(function(){ $(document).trigger("afui:ready"); }); } $.bind(that, "content-loaded", function() { if (that.loadContentQueue.length > 0) { var tmp = that.loadContentQueue.splice(0, 1)[0]; that.loadContent(tmp[0], tmp[1], tmp[2], tmp[3], tmp[4]); } }); if (window.navigator.standalone||this.isIntel) { this.blockPageScroll(); } this.enableTabBar(); this.topClickScroll(); }, /** * This simulates the click and scroll to top of browsers */ topClickScroll: function() { var that = this; document.getElementById("header").addEventListener("click", function(e) { if (e.clientY <= 15 && e.target.nodeName.toLowerCase() === "h1") //hack - the title spans the whole width of the header that.scrollingDivs[that.activeDiv.id].scrollToTop("100"); }); }, /** * This blocks the page from scrolling/panning. Usefull for native apps */ blockPageScroll: function() { $.query("#afui #header").bind("touchmove", function(e) { e.preventDefault(); }); }, /** * This is the default transition. It simply shows the new panel and hides the old */ noTransition: function(oldDiv, currDiv) { currDiv.style.display = "block"; oldDiv.style.display = "block"; var that = this; that.clearAnimations(currDiv); that.css3animate(oldDiv, { x: "0%", y: 0 }); that.finishTransition(oldDiv); currDiv.style.zIndex = 2; oldDiv.style.zIndex = 1; }, /** * This must be called at the end of every transition to hide the old div and reset the doingTransition variable * * @param {object} oldDiv Div that transitioned out * @param {object=} currDiv * @title $.ui.finishTransition(oldDiv) */ finishTransition: function(oldDiv, currDiv) { oldDiv.style.display = "none"; this.doingTransition = false; if (currDiv) this.clearAnimations(currDiv); if (oldDiv) this.clearAnimations(oldDiv); $.trigger(this, "content-loaded"); }, /** * This must be called at the end of every transition to remove all transforms and transitions attached to the inView object (performance + native scroll) * * @param {object} inViewDiv Div that transitioned out * @title $.ui.finishTransition(oldDiv) */ clearAnimations: function(inViewDiv) { inViewDiv.style[$.feat.cssPrefix + "Transform"] = "none"; inViewDiv.style[$.feat.cssPrefix + "Transition"] = "none"; } /** * END * @api private */ }; //lookup for a clicked anchor recursively and fire UI own actions when applicable var checkAnchorClick = function(e, theTarget) { var afui = document.getElementById("afui"); if (theTarget === (afui)) { return; } //this technique fails when considerable content exists inside anchor, should be recursive ? if (theTarget.tagName.toLowerCase() !== "a" && theTarget.parentNode) return checkAnchorClick(e, theTarget.parentNode); //let's try the parent (recursive) //anchors if (theTarget.tagName !== "undefined" && theTarget.tagName.toLowerCase() === "a") { var custom = (typeof $.ui.customClickHandler === "function") ? $.ui.customClickHandler : false; if (custom !== false) { if ($.ui.customClickHandler(theTarget,e)) return e.preventDefault(); } if (theTarget.href.toLowerCase().indexOf("javascript:") !== -1 || theTarget.getAttribute("data-ignore")) { return; } //external links if (theTarget.hash.indexOf("#") === -1 && theTarget.target.length > 0) { if (theTarget.href.toLowerCase().indexOf("javascript:") !== 0) { if ($.ui.isIntel) { e.preventDefault(); intel.xdk.device.launchExternal(theTarget.href); } else if (!$.os.desktop) { e.target.target = "_blank"; } } return; } /* IE 10 fixes*/ var href = theTarget.href, prefix = location.protocol + "//" + location.hostname + ":" + location.port + location.pathname; if (href.indexOf(prefix) === 0) { href = href.substring(prefix.length); } //empty links if (href === "#" || (href.indexOf("#") === href.length - 1) || (href.length === 0 && theTarget.hash.length === 0)) return e.preventDefault(); //internal links //http urls var urlRegex=/^((http|https|file):\/\/)/; //only call prevent default on http/fileurls. If it's a protocol handler, do not call prevent default. //It will fall through to the ajax call and fail if(theTarget.href.indexOf(":") !== -1 &&urlRegex.test(theTarget.href)) e.preventDefault(); var mytransition = theTarget.getAttribute("data-transition"); var resetHistory = theTarget.getAttribute("data-resetHistory"); resetHistory = resetHistory && resetHistory.toLowerCase() === "true" ? true : false; href = theTarget.hash.length > 0 ? theTarget.hash : href; $.ui.loadContent(href, resetHistory, 0, mytransition, theTarget); return; } }; var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D"; /* Number */ var crc32 = function( /* String */ str, /* Number */ crc) { if (crc === undefined) crc = 0; var n = 0; //a number between 0 and 255 var x = 0; //an hex number crc = crc ^ (-1); for (var i = 0, iTop = str.length; i < iTop; i++) { n = (crc ^ str.charCodeAt(i)) & 0xFF; x = "0x" + table.substr(n * 9, 8); crc = (crc >>> 8) ^ x; } return (crc ^ (-1))>>>0; }; $.ui = new ui(); $.ui.init=true; $(window).trigger("afui:preinit"); $(window).trigger("afui:init"); })(af); //The following functions are utilitiy functions for afui within intel xdk. (function($) { "use strict"; var xdkDeviceReady=function(){ $.ui.isIntel=true; setTimeout(function() { document.getElementById("afui").style.height = "100%"; document.body.style.height = "100%"; document.documentElement.style.minHeight = window.innerHeight; }, 30); document.removeEventListener("intel.xdk.device.ready",xdkDeviceReady); }; document.addEventListener("intel.xdk.device.ready",xdkDeviceReady); //Fix an ios bug where scrolling will not work with rotation if ($.feat.nativeTouchScroll) { document.addEventListener("orientationchange", function() { if ($.ui.scrollingDivs[$.ui.activeDiv.id]) { var tmpscroller = $.ui.scrollingDivs[$.ui.activeDiv.id]; if(!tmpscroller) return; if (tmpscroller.el.scrollTop === 0) { tmpscroller.disable(); setTimeout(function() { tmpscroller.enable(); }, 300); } if(tmpscroller.refresh) tmpscroller.updateP2rHackPosition(); } }); } })(af); /* global af*/ (function($ui){ "use strict"; function fadeTransition (oldDiv, currDiv, back) { /*jshint validthis:true */ var that = this; if (back) { currDiv.style.zIndex = 1; oldDiv.style.zIndex = 2; that.clearAnimations(currDiv); that.css3animate(oldDiv, { x: "0%", time: $ui.transitionTime, opacity: 0.1, complete: function(canceled) { if(canceled) { that.finishTransition(oldDiv, currDiv); return; } that.css3animate(oldDiv, { x: "-100%", opacity: 1, complete: function() { that.finishTransition(oldDiv); } }); currDiv.style.zIndex = 2; oldDiv.style.zIndex = 1; } }); } else { oldDiv.style.zIndex = 1; currDiv.style.zIndex = 2; currDiv.style.opacity = 0; that.css3animate(currDiv, { x: "0%", opacity: 0.1, complete: function() { that.css3animate(currDiv, { x: "0%", time: $ui.transitionTime, opacity: 1, complete:function(canceled){ if(canceled) { that.finishTransition(oldDiv, currDiv); return; } that.clearAnimations(currDiv); that.css3animate(oldDiv, { x: "-100%", y: 0, complete: function() { that.finishTransition(oldDiv); } }); } }); } }); } } $ui.availableTransitions.fade = fadeTransition; })(af.ui); /* global af*/ (function ($ui) { "use strict"; function flipTransition(oldDiv, currDiv, back) { /*jshint validthis:true */ var that = this; if (back) { that.css3animate(currDiv, { x: "100%", scale: 0.8, rotateY: "180deg", complete: function () { that.css3animate(currDiv, { x: "0%", scale: 1, time: $ui.transitionTime, rotateY: "0deg", complete: function () { that.clearAnimations(currDiv); } }); } }); that.css3animate(oldDiv, { x: "100%", time: $ui.transitionTime, scale: 0.8, rotateY: "180deg", complete: function () { that.css3animate(oldDiv, { x: "-100%", opacity: 1, scale: 1, rotateY: "0deg", complete: function () { that.finishTransition(oldDiv); } }); currDiv.style.zIndex = 2; oldDiv.style.zIndex = 1; } }); } else { oldDiv.style.zIndex = 1; currDiv.style.zIndex = 2; that.css3animate(currDiv, { x: "100%", scale: 0.8, rotateY: "180deg", complete: function () { that.css3animate(currDiv, { x: "0%", scale: 1, time: $ui.transitionTime, rotateY: "0deg", complete: function () { that.clearAnimations(currDiv); } }); } }); that.css3animate(oldDiv, { x: "100%", time: $ui.transitionTime, scale: 0.8, rotateY: "180deg", complete: function () { that.css3animate(oldDiv, { x: "-100%", opacity: 1, scale: 1, rotateY: "0deg", complete: function () { that.finishTransition(oldDiv); } }); currDiv.style.zIndex = 2; oldDiv.style.zIndex = 1; } }); } } $ui.availableTransitions.flip = flipTransition; })(af.ui); /* global af*/ (function ($ui) { "use strict"; function popTransition(oldDiv, currDiv, back) { /*jshint validthis:true */ var that = this; if (back) { currDiv.style.zIndex = 1; oldDiv.style.zIndex = 2; that.clearAnimations(currDiv); that.css3animate(oldDiv, { x:"0%", time: $ui.transitionTime, opacity: 0.1, scale: 0.2, origin:"50% 50%", complete: function (canceled) { if (canceled) { that.finishTransition(oldDiv); return; } that.css3animate(oldDiv, { x: "-100%", complete: function () { that.finishTransition(oldDiv); } }); currDiv.style.zIndex = 2; oldDiv.style.zIndex = 1; } }); } else { oldDiv.style.zIndex = 1; currDiv.style.zIndex = 2; that.css3animate(currDiv, { x: "0%", scale: 0.2, origin: "50%" + " 50%", opacity: 0.1, time:"0ms", complete: function () { that.css3animate(currDiv, { x: "0%", time: $ui.transitionTime, scale: 1, opacity: 1, origin: "0%" + " 0%", complete: function (canceled) { if (canceled) { that.finishTransition(oldDiv, currDiv); return; } that.clearAnimations(currDiv); that.css3animate(oldDiv, { x: "100%", y: 0, complete: function () { that.finishTransition(oldDiv); } }); } }); } }); } } $ui.availableTransitions.pop = popTransition; })(af.ui); /* global af*/ (function ($ui) { "use strict"; /** * Initiate a sliding transition. This is a sample to show how transitions are implemented. These are registered in $ui.availableTransitions and take in three parameters. * @param {Object} previous panel * @param {Object} current panel * @param {Boolean} go back * @title $ui.slideTransition(previousPanel,currentPanel,goBack); */ function slideTransition(oldDiv, currDiv, back) { /*jshint validthis:true */ var that = this; if (back) { that.css3animate(oldDiv, { x: "0%", y: "0%", complete: function () { that.css3animate(oldDiv, { x: "100%", time: $ui.transitionTime, complete: function () { that.finishTransition(oldDiv, currDiv); } }).link(currDiv, { x: "0%", time: $ui.transitionTime }); } }).link(currDiv, { x: "-100%", y: "0%" }); } else { that.css3animate(oldDiv, { x: "0%", y: "0%", complete: function () { that.css3animate(oldDiv, { x: "-100%", time: $ui.transitionTime, complete: function () { that.finishTransition(oldDiv, currDiv); } }).link(currDiv, { x: "0%", time: $ui.transitionTime }); } }).link(currDiv, { x: "100%", y: "0%" }); } } $ui.availableTransitions.slide = slideTransition; $ui.availableTransitions["default"] = slideTransition; })(af.ui); /* global af*/ (function ($ui) { "use strict"; function slideDownTransition(oldDiv, currDiv, back) { /*jshint validthis:true */ var that = this; if (back) { oldDiv.style.zIndex = 2; currDiv.style.zIndex = 1; that.css3animate(oldDiv, { y: "0%", x: "0%", complete: function () { that.css3animate(oldDiv, { y: "-100%", time: $ui.transitionTime, complete: function () { that.finishTransition(oldDiv, currDiv); } }); } }); } else { oldDiv.style.zIndex = 1; currDiv.style.zIndex = 2; that.css3animate(currDiv, { y: "-100%", x: "0%", time:"10ms", complete: function () { that.css3animate(currDiv, { y: "0%", time: $ui.transitionTime, complete: function () { that.finishTransition(oldDiv, currDiv); } }); } }); } } $ui.availableTransitions.down = slideDownTransition; })(af.ui); /* global af*/ (function ($ui) { "use strict"; function slideUpTransition(oldDiv, currDiv, back) { /*jshint validthis:true */ var that = this; if (back) { oldDiv.style.zIndex = 2; currDiv.style.zIndex = 1; that.css3animate(oldDiv, { y: "0%", x: "0%", complete: function () { that.css3animate(oldDiv, { y: "100%", time: $ui.transitionTime, complete: function () { that.finishTransition(oldDiv, currDiv); } }); } }); } else { oldDiv.style.zIndex = 1; currDiv.style.zIndex = 2; that.css3animate(currDiv, { y: "100%", x: "0%", time:"10ms", complete: function () { that.css3animate(currDiv, { y: "0%", time: $ui.transitionTime, complete: function () { that.finishTransition(oldDiv, currDiv); } }); } }); } } $ui.availableTransitions.up = slideUpTransition; })(af.ui); /** * af.8tiles - Provides a WP8 theme and handles showing the menu * Copyright 2012 - Intel * This plugin is meant to be used inside App Framework UI */ /* global af*/ (function($) { "use strict"; if (!$) { throw "This plugin requires AFUi"; } function wire8Tiles() { $.ui.isWin8 = true; if (!$.os.ie) return; if (!$.ui.isSideMenuEnabled()) return; $.ui.ready(function() { if($.ui.tilesLoaded) return; $.ui.tilesLoaded=true; if(window.innerWidth>$.ui.handheldMinWidth) return true; if ($.ui.slideSideMenu) $.ui.slideSideMenu = false; //we need to make sure the menu button shows up in the bottom navbar $.query("#afui #navbar footer").append("<a id='metroMenu' onclick='$.ui.toggleSideMenu()'>•••</a>"); var tmpAnchors = $.query("#afui #navbar").find("a").not(".button"); if (tmpAnchors.length > 0) { tmpAnchors.data("ignore-pressed", "true").data("resetHistory", "true"); var width = parseFloat(100 / tmpAnchors.length); tmpAnchors.css("width", width + "%"); } var oldUpdate = $.ui.updateNavbarElements; $.ui.updateNavbarElements = function() { oldUpdate.apply($.ui, arguments); if ($.query("#afui #navbar #metroMenu").length === 1) return; $.query("#afui #navbar footer").append("<a id='metroMenu' onclick='$.ui.toggleSideMenu()'>•••</a>"); }; $.ui.isSideMenuOn = function() { var menu = parseInt($.getCssMatrix($("#navbar")).f,10) < 0 ? true : false; return this.isSideMenuEnabled() && menu; }; $.ui.toggleRightSideMenu=function(force,callback,time) { if ((!this.isAsideMenuEnabled()) || this.togglingAsideMenu) return; var aside=true; if(!aside&&!this.isSideMenuEnabled()) return; if(!aside&&$.ui.splitview) return; var that = this; var menu=$("#menu"); var asideMenu= $.query("#aside_menu"); var els = $.query("#content, #header, #navbar"); var panelMask = $.query(".afui_panel_mask"); time = time || this.transitionTime; var open = $("#aside_menu").css("display")==="block"; var toX=aside?"-"+that.sideMenuWidth:that.sideMenuWidth; // add panel mask to block when side menu is open for phone devices if(panelMask.length === 0 && window.innerWidth < $.ui.handheldMinWidth){ els.append("<div class='afui_panel_mask'></div>"); panelMask = $.query(".afui_panel_mask"); $(".afui_panel_mask").bind("click", function(){ $.ui.toggleSideMenu(false, null, null, aside); }); } //Here we need to check if we are toggling the left to right, or right to left var menuPos=this.getSideMenuPosition(); if(open&&!aside&&menuPos<0) open=false; else if(open&&aside&&menuPos>0) open=false; if (force === 2 || (!open && ((force !== undefined && force !== false) || force === undefined))) { this.togglingSideMenu = true; if(!aside) menu.show(); else asideMenu.show(); that.css3animate(els, { x: toX, time: time, complete: function(canceled) { that.togglingSideMenu = false; els.vendorCss("Transition", ""); if (callback) callback(canceled); if(panelMask.length !== 0 && window.innerWidth < $.ui.handheldMinWidth){ panelMask.show(); } } }); } else if (force === undefined || (force !== undefined && force === false)) { this.togglingSideMenu = true; that.css3animate(els, { x: "0px", time: time, complete: function(canceled) { // els.removeClass("on"); els.vendorCss("Transition", ""); els.vendorCss("Transform", ""); that.togglingSideMenu = false; if (callback) callback(canceled); if(!$.ui.splitview) menu.hide(); asideMenu.hide(); if(panelMask.length !== 0 && window.innerWidth < $.ui.handheldMinWidth){ panelMask.hide(); } } }); } }; $.ui.toggleLeftSideMenu = function(force, callback) { if (!this.isSideMenuEnabled() || this.togglingSideMenu) return; this.togglingSideMenu = true; var that = this; var menu = $.query("#menu"); var els = $.query("#navbar"); var open = this.isSideMenuOn(); if (force === 2 || (!open && ((force !== undefined && force !== false) || force === undefined))) { menu.show(); that.css3animate(els, { y: "-150px", time: $.ui.transitionTime, complete: function() { that.togglingSideMenu = false; if (callback) callback(true); } }); that.css3animate(menu, { y: "0px", time: $.ui.transitionTime }); } else if (force === undefined || (force !== undefined && force === false)) { that.css3animate(els, { y: "0", time: $.ui.transitionTime, complete: function() { that.togglingSideMenu = false; if (callback) callback(true); menu.hide(); } }); that.css3animate(menu, { y: "150px", time: $.ui.transitionTime }); } }; }); } if (!$.ui) { $(document).ready(function() { wire8Tiles(); }); } else { $.ui.ready(function(){ wire8Tiles(); }); } })(af);
amd/transpiled/Nav.js
mgechev/react-bootstrap
define( ["./react-es6","./react-es6/lib/cx","./BootstrapMixin","./utils","exports"], function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __exports__) { "use strict"; /** @jsx React.DOM */ var React = __dependency1__["default"]; var classSet = __dependency2__["default"]; var BootstrapMixin = __dependency3__["default"]; var utils = __dependency4__["default"]; var Nav = React.createClass({displayName: 'Nav', mixins: [BootstrapMixin], propTypes: { bsStyle: React.PropTypes.oneOf(['tabs','pills']).isRequired, bsVariation: React.PropTypes.oneOf(['stacked','justified']), onSelect: React.PropTypes.func }, getDefaultProps: function () { return { bsClass: 'nav' }; }, render: function () { var classes = this.getBsClassSet(); return this.transferPropsTo( React.DOM.nav(null, React.DOM.ul( {className:classSet(classes)}, utils.modifyChildren(this.props.children, this.renderNavItem) ) ) ); }, renderNavItem: function (child) { return utils.cloneWithProps( child, { isActive: this.props.activeKey != null ? child.props.key === this.props.activeKey : null, onSelect: utils.createChainedFunction(child.onSelect, this.props.onSelect), ref: child.props.ref, key: child.props.key } ); } }); __exports__["default"] = Nav; });
ajax/libs/yui/3.6.0/datatable-core/datatable-core-debug.js
WebReflection/cdnjs
YUI.add('datatable-core', function(Y) { /** 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']});
app/javascript/mastodon/features/account_timeline/components/moved_note.js
ashfurrow/mastodon
import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { FormattedMessage } from 'react-intl'; import ImmutablePureComponent from 'react-immutable-pure-component'; import AvatarOverlay from '../../../components/avatar_overlay'; import DisplayName from '../../../components/display_name'; import Icon from 'mastodon/components/icon'; export default class MovedNote extends ImmutablePureComponent { static contextTypes = { router: PropTypes.object, }; static propTypes = { from: ImmutablePropTypes.map.isRequired, to: ImmutablePropTypes.map.isRequired, }; handleAccountClick = e => { if (e.button === 0) { e.preventDefault(); this.context.router.history.push(`/@${this.props.to.get('acct')}`); } e.stopPropagation(); } render () { const { from, to } = this.props; const displayNameHtml = { __html: from.get('display_name_html') }; return ( <div className='account__moved-note'> <div className='account__moved-note__message'> <div className='account__moved-note__icon-wrapper'><Icon id='suitcase' className='account__moved-note__icon' fixedWidth /></div> <FormattedMessage id='account.moved_to' defaultMessage='{name} has moved to:' values={{ name: <bdi><strong dangerouslySetInnerHTML={displayNameHtml} /></bdi> }} /> </div> <a href={to.get('url')} onClick={this.handleAccountClick} className='detailed-status__display-name'> <div className='detailed-status__display-avatar'><AvatarOverlay account={to} friend={from} /></div> <DisplayName account={to} /> </a> </div> ); } }
ajax/libs/react-table/3.1.2/react-table.js
seogi1004/cdnjs
(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.reactTable = 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(require,module,exports){ "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _objectWithoutProperties(e,t){var a={};for(var s in e)t.indexOf(s)>=0||Object.prototype.hasOwnProperty.call(e,s)&&(a[s]=e[s]);return a}var _typeof2="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};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReactTableDefaults=void 0;var _typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(e){return"undefined"==typeof e?"undefined":_typeof2(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":"undefined"==typeof e?"undefined":_typeof2(e)},_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(e[s]=a[s])}return e},_react=require("react"),_react2=_interopRequireDefault(_react),_classnames=require("classnames"),_classnames2=_interopRequireDefault(_classnames),_utils=require("./utils"),_utils2=_interopRequireDefault(_utils),_pagination=require("./pagination"),_pagination2=_interopRequireDefault(_pagination),ReactTableDefaults=exports.ReactTableDefaults={data:[],loading:!1,pageSize:20,showPagination:!0,showPageSizeOptions:!0,pageSizeOptions:[5,10,20,25,50,100],showPageJump:!0,onChange:function(){return null},className:"-striped -highlight",tableClassName:"",theadClassName:"",tbodyClassName:"",trClassName:"",trClassCallback:function(e){return null},thClassName:"",thGroupClassName:"",tdClassName:"",paginationClassName:"",style:{},tableStyle:{},theadStyle:{},tbodyStyle:{},trStyle:{},trStyleCallback:function(e){},thStyle:{},tdStyle:{},paginationStyle:{},column:{sortable:!0,show:!0,className:"",style:{},innerClassName:"",innerStyle:{},headerClassName:"",headerStyle:{},headerInnerClassName:"",headerInnerStyle:{}},previousText:"Previous",nextText:"Next",loadingText:"Loading...",tableComponent:function(e){return _react2.default.createElement("table",e,e.children)},theadComponent:function(e){return _react2.default.createElement("thead",e,e.children)},tbodyComponent:function(e){return _react2.default.createElement("tbody",e,e.children)},trComponent:function(e){return _react2.default.createElement("tr",e,e.children)},thComponent:function(e){var t=e.toggleSort,a=_objectWithoutProperties(e,["toggleSort"]);return _react2.default.createElement("th",_extends({},a,{onClick:function(e){t&&t(e)}}),e.children)},tdComponent:function(e){return _react2.default.createElement("td",e,e.children)},previousComponent:null,nextComponent:null,loadingComponent:function(e){return _react2.default.createElement("div",{className:(0,_classnames2.default)("-loading",{"-active":e.loading})},_react2.default.createElement("div",{className:"-loading-inner"},e.loadingText))}};exports.default=_react2.default.createClass({displayName:"src",getDefaultProps:function(){return ReactTableDefaults},getInitialState:function(){return{page:0,sorting:!1}},componentDidMount:function(){this.fireOnChange()},fireOnChange:function(){this.props.onChange({page:this.getPropOrState("page"),pageSize:this.getStateOrProp("pageSize"),pages:this.getPagesLength(),sorting:this.getSorting()},this)},getPropOrState:function(e){return _utils2.default.getFirstDefined(this.props[e],this.state[e])},getStateOrProp:function(e){return _utils2.default.getFirstDefined(this.state[e],this.props[e])},getInitSorting:function(e){if(!e)return[];var t=e.filter(function(e){return"undefined"!=typeof e.sort}).map(function(e){return{id:e.id,asc:"asc"===e.sort}});return t.length?t:[{id:e[0].id,asc:!0}]},sortData:function(e,t){return _utils2.default.orderBy(e,t.map(function(e){return function(t){return null===t[e.id]||void 0===t[e.id]?-(1/0):"string"==typeof t[e.id]?t[e.id].toLowerCase():t[e.id]}}),t.map(function(e){return e.asc?"asc":"desc"}))},makeDecoratedColumn:function(e){var t=Object.assign({},this.props.column,e);if("string"==typeof t.accessor){var a=function(){t.id=t.id||t.accessor;var e=t.accessor;return t.accessor=function(t){return _utils2.default.get(t,e)},{v:t}}();if("object"===("undefined"==typeof a?"undefined":_typeof(a)))return a.v}if(t.accessor&&!t.id)throw console.warn(t),new Error("A column id is required if using a non-string accessor for column above.");return t.accessor||(t.accessor=function(e){}),t},getSorting:function(e){return this.props.sorting||(this.state.sorting&&this.state.sorting.length?this.state.sorting:this.getInitSorting(e))},getPagesLength:function(){return this.props.manual?this.props.pages:Math.ceil(this.props.data.length/this.getStateOrProp("pageSize"))},getMinRows:function(){return _utils2.default.getFirstDefined(this.props.minRows,this.props.pageSize)},render:function(){var e=this,t=[],a=[],s=[],n=!1;this.props.columns.forEach(function(e){e.columns&&(n=!0)});var r=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};a.push(Object.assign({},t,{columns:e})),s=[]},o=this.props.columns.filter(function(e){return _utils2.default.getFirstDefined(e.show,!0)});o.forEach(function(a,o){if(a.columns){var i=a.columns.filter(function(e){return _utils2.default.getFirstDefined(e.show,!0)});i.forEach(function(a){t.push(e.makeDecoratedColumn(a))}),n&&(s.length>0&&r(s),r(_utils2.default.takeRight(t,i.length),a))}else t.push(e.makeDecoratedColumn(a)),s.push(_utils2.default.last(t))}),n&&s.length>0&&r(s);var i=this.getSorting(t),l=this.props.data.map(function(e,a){var s={__original:e,__index:a};return t.forEach(function(t){s[t.id]=t.accessor(e)}),s}),c=this.props.manual?l:this.sortData(l,i),u=this.getPropOrState("page"),p=this.getStateOrProp("pageSize"),d=this.getPagesLength(),f=p*u,h=f+p,m=this.props.manual?c:c.slice(f,h),g=this.getMinRows(),y=d>1?_utils2.default.range(p-m.length):g?_utils2.default.range(Math.max(g-m.length,0)):[],_=u>0,S=u+1<d,C=this.props.tableComponent,b=this.props.theadComponent,v=this.props.tbodyComponent,N=this.props.trComponent,O=this.props.thComponent,w=this.props.tdComponent,E=this.props.previousComponent,P=this.props.nextComponent,x=this.props.loadingComponent;return _react2.default.createElement("div",{className:(0,_classnames2.default)(this.props.className,"ReactTable"),style:this.props.style},_react2.default.createElement(C,{className:(0,_classnames2.default)(this.props.tableClassName),style:this.props.tableStyle},n&&_react2.default.createElement(b,{className:(0,_classnames2.default)(this.props.theadGroupClassName,"-headerGroups"),style:this.props.theadStyle},_react2.default.createElement(N,{className:this.props.trClassName,style:this.props.trStyle},a.map(function(t,a){return _react2.default.createElement(O,{key:a,colSpan:t.columns.length,className:(0,_classnames2.default)(e.props.thClassname,t.headerClassName),style:Object.assign({},e.props.thStyle,t.headerStyle)},_react2.default.createElement("div",{className:(0,_classnames2.default)(t.headerInnerClassName,"-th-inner"),style:Object.assign({},e.props.thInnerStyle,t.headerInnerStyle)},"function"==typeof t.header?_react2.default.createElement(t.header,{data:e.props.data,column:t}):t.header))}))),_react2.default.createElement(b,{className:(0,_classnames2.default)(this.props.theadClassName),style:this.props.theadStyle},_react2.default.createElement(N,{className:this.props.trClassName,style:this.props.trStyle},t.map(function(t,a){var s=i.find(function(e){return e.id===t.id}),n="function"==typeof t.show?t.show():t.show;return _react2.default.createElement(O,{key:a,className:(0,_classnames2.default)(e.props.thClassname,t.headerClassName,s?s.asc?"-sort-asc":"-sort-desc":"",{"-cursor-pointer":t.sortable,"-hidden":!n}),style:Object.assign({},e.props.thStyle,t.headerStyle),toggleSort:function(a){t.sortable&&e.sortColumn(t,a.shiftKey)}},_react2.default.createElement("div",{className:(0,_classnames2.default)(t.headerInnerClassName,"-th-inner"),style:Object.assign({},t.headerInnerStyle,{minWidth:t.minWidth+"px"})},"function"==typeof t.header?_react2.default.createElement(t.header,{data:e.props.data,column:t}):t.header))}))),_react2.default.createElement(v,{className:(0,_classnames2.default)(this.props.tbodyClassName),style:this.props.tbodyStyle},m.map(function(a,s){var n={row:a.__original,rowValues:a,index:a.__index,viewIndex:s};return _react2.default.createElement(N,{key:s,className:(0,_classnames2.default)(e.props.trClassName,e.props.trClassCallback(n)),style:Object.assign({},e.props.trStyle,e.props.trStyleCallback(n))},t.map(function(t,a){var s=t.render,r="function"==typeof t.show?t.show():t.show;return _react2.default.createElement(w,{key:a,className:(0,_classnames2.default)(t.className,{hidden:!r}),style:Object.assign({},e.props.tdStyle,t.style)},_react2.default.createElement("div",{className:(0,_classnames2.default)(t.innerClassName,"-td-inner"),style:Object.assign({},t.innerStyle,{minWidth:t.minWidth+"px"})},"function"==typeof s?_react2.default.createElement(s,_extends({},n,{value:n.rowValues[t.id]})):"undefined"!=typeof s?s:n.rowValues[t.id]))}))}),y.map(function(a,s){return _react2.default.createElement(N,{key:s,className:(0,_classnames2.default)(e.props.trClassName,"-padRow"),style:e.props.trStyle},t.map(function(t,a){var s="function"==typeof t.show?t.show():t.show;return _react2.default.createElement(w,{key:a,className:(0,_classnames2.default)(t.className,{hidden:!s}),style:Object.assign({},e.props.tdStyle,t.style)},_react2.default.createElement("div",{className:(0,_classnames2.default)(t.innerClassName,"-td-inner"),style:Object.assign({},t.innerStyle,{minWidth:t.minWidth+"px"})}," "))}))}))),this.props.showPagination&&_react2.default.createElement(_pagination2.default,{currentPage:u,pagesLength:d,pageSize:p,showPageSizeOptions:this.props.showPageSizeOptions,pageSizeOptions:this.props.pageSizeOptions,showPageJump:this.props.showPageJump,canPrevious:_,canNext:S,previousText:this.props.previousText,nextText:this.props.nextText,previousComponent:E,nextComponent:P,onChange:this.setPage,onPageSizeChange:this.setPageSize}),_react2.default.createElement(x,this.props))},setPage:function(e){var t=this;this.setState({page:e},function(){t.fireOnChange()})},setPageSize:function(e){var t=this,a=this.getStateOrProp("pageSize"),s=this.getPropOrState("page"),n=a*s,r=Math.floor(n/e);this.setState({pageSize:e,page:r},function(){t.fireOnChange()})},sortColumn:function(e,t){var a=this,s=this.getSorting(),n=_utils2.default.clone(this.state.sorting||[]),r=n.findIndex(function(t){return t.id===e.id});if(r>-1){var o=n[r];o.asc?(o.asc=!1,t||(n=[o])):t?n.splice(r,1):(o.asc=!0,n=[o])}else t?n.push({id:e.id,asc:!0}):n=[{id:e.id,asc:!0}];var i=0===r||!s.length&&n.length||!t?0:this.state.page;this.setState({page:i,sorting:n},function(){a.fireOnChange()})}}); },{"./pagination":2,"./utils":3,"classnames":4,"react":"react"}],2:[function(require,module,exports){ "use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)Object.prototype.hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},_react=require("react"),_react2=_interopRequireDefault(_react),_classnames=require("classnames"),_classnames2=_interopRequireDefault(_classnames),defaultButton=function(e){return _react2.default.createElement("button",_extends({},e,{className:"-btn"}),e.children)};exports.default=_react2.default.createClass({displayName:"pagination",getInitialState:function(){return{page:this.props.currentPage}},componentWillReceiveProps:function(e){this.setState({page:e.currentPage})},getSafePage:function(e){return Math.min(Math.max(e,0),this.props.pagesLength-1)},changePage:function(e){e=this.getSafePage(e),this.setState({page:e}),this.props.onChange(e)},applyPage:function(e){e&&e.preventDefault();var t=this.state.page;this.changePage(""===t?this.props.currentPage:t)},render:function(){var e=this,t=this.props,a=t.currentPage,n=t.pagesLength,r=t.showPageSizeOptions,s=t.pageSizeOptions,c=t.pageSize,i=t.showPageJump,l=t.canPrevious,u=t.canNext,p=t.onPageSizeChange,o=this.props.PreviousComponent||defaultButton,g=this.props.NextComponent||defaultButton;return _react2.default.createElement("div",{className:(0,_classnames2.default)(this.props.paginationClassName,"-pagination"),style:this.props.paginationStyle},_react2.default.createElement("div",{className:"-previous"},_react2.default.createElement(o,{onClick:function(t){l&&e.changePage(a-1)},disabled:!l},this.props.previousText)),_react2.default.createElement("div",{className:"-center"},_react2.default.createElement("span",{className:"-pageInfo"},"Page ",i?_react2.default.createElement("form",{className:"-pageJump",onSubmit:this.applyPage},_react2.default.createElement("input",{type:""===this.state.page?"text":"number",onChange:function(t){var a=t.target.value,n=a-1;return""===a?e.setState({page:a}):void e.setState({page:e.getSafePage(n)})},value:""===this.state.page?"":this.state.page+1,onBlur:this.applyPage})):_react2.default.createElement("span",{className:"-currentPage"},a+1)," of ",_react2.default.createElement("span",{className:"-totalPages"},n)),r&&_react2.default.createElement("span",{className:"select-wrap -pageSizeOptions"},_react2.default.createElement("select",{onChange:function(e){return p(Number(e.target.value))},value:c},s.map(function(e,t){return _react2.default.createElement("option",{key:t,value:e},e," rows")})))),_react2.default.createElement("div",{className:"-next"},_react2.default.createElement(g,{onClick:function(t){u&&e.changePage(a+1)},disabled:!u},this.props.nextText)))}}); },{"classnames":4,"react":"react"}],3:[function(require,module,exports){ "use strict";function remove(r,e){return r.filter(function(t,n){var i=e(t);return!!i&&(r.splice(n,1),!0)})}function get(r,e){return isArray(e)&&(e=e.join(".")),e.replace("[",".").replace("]","").split(".").reduce(function(r,e){return r[e]},r)}function takeRight(r,e){var t=e>r.length?0:r.length-e;return r.slice(t)}function last(r){return r[r.length-1]}function range(r){for(var e=[],t=0;t<r;t++)e.push(r);return e}function orderBy(r,e,t){return r.sort(function(r,n){for(var i=0;i<e.length;i++){var o=e[i],u=o(r),f=o(n),a=t[i]===!1||"desc"===t[i];if(u>f)return a?-1:1;if(u<f)return a?1:-1}return 0})}function clone(r){return JSON.parse(JSON.stringify(r,function(r,e){return"function"==typeof e?e.toString():e}))}function isArray(r){return Array.isArray(r)}function getFirstDefined(){for(var r=arguments.length,e=Array(r),t=0;t<r;t++)e[t]=arguments[t];for(var n=0;n<e.length;n++)if("undefined"!=typeof e[n])return e[n]}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default={get:get,takeRight:takeRight,last:last,orderBy:orderBy,range:range,clone:clone,remove:remove,getFirstDefined:getFirstDefined}; },{}],4:[function(require,module,exports){ !function(){"use strict";function e(){for(var r=[],o=0;o<arguments.length;o++){var f=arguments[o];if(f){var i=typeof f;if("string"===i||"number"===i)r.push(f);else if(Array.isArray(f))r.push(e.apply(null,f));else if("object"===i)for(var t in f)n.call(f,t)&&f[t]&&r.push(t)}}return r.join(" ")}var n={}.hasOwnProperty;"undefined"!=typeof module&&module.exports?module.exports=e:"function"==typeof define&&"object"==typeof define.amd&&define.amd?define("classnames",[],function(){return e}):window.classNames=e}(); },{}]},{},[1])(1) });
src/containers/Counter.js
gios/top-request
import React, { Component } from 'react' // eslint-disable-line no-unused-vars import { connect } from 'react-redux' import { increase, decrease } from '../actions/counterActions' class Counter extends Component { render() { const { dispatch, amount, hello } = this.props return ( <div className="col-sm-4 col-sm-offset-4" style={{textAlign: 'center'}}> Value: {amount} and Say {hello}<br /> <button onClick={() => dispatch(increase(1))}>Increase</button> <button onClick={() => dispatch(decrease(1))}>Decrease</button> </div> ) } } function inject(state) { return { amount: state.reducers.number.get('amount'), hello: (state.routing.location.state !== null) ? state.routing.location.state.name : 'None' } } export default connect(inject)(Counter)
docs/src/app/components/pages/components/Menu/ExampleIcons.js
IsenrichO/mui-with-arrows
import React from 'react'; import Paper from 'material-ui/Paper'; import Menu from 'material-ui/Menu'; import MenuItem from 'material-ui/MenuItem'; import RemoveRedEye from 'material-ui/svg-icons/image/remove-red-eye'; import PersonAdd from 'material-ui/svg-icons/social/person-add'; import ContentLink from 'material-ui/svg-icons/content/link'; import Divider from 'material-ui/Divider'; import ContentCopy from 'material-ui/svg-icons/content/content-copy'; import Download from 'material-ui/svg-icons/file/file-download'; import Delete from 'material-ui/svg-icons/action/delete'; import FontIcon from 'material-ui/FontIcon'; const style = { paper: { display: 'inline-block', float: 'left', margin: '16px 32px 16px 0', }, rightIcon: { textAlign: 'center', lineHeight: '24px', }, }; const MenuExampleIcons = () => ( <div> <Paper style={style.paper}> <Menu> <MenuItem primaryText="Preview" leftIcon={<RemoveRedEye />} /> <MenuItem primaryText="Share" leftIcon={<PersonAdd />} /> <MenuItem primaryText="Get links" leftIcon={<ContentLink />} /> <Divider /> <MenuItem primaryText="Make a copy" leftIcon={<ContentCopy />} /> <MenuItem primaryText="Download" leftIcon={<Download />} /> <Divider /> <MenuItem primaryText="Remove" leftIcon={<Delete />} /> </Menu> </Paper> <Paper style={style.paper}> <Menu> <MenuItem primaryText="Clear Config" /> <MenuItem primaryText="New Config" rightIcon={<PersonAdd />} /> <MenuItem primaryText="Project" rightIcon={<FontIcon className="material-icons">settings</FontIcon>} /> <MenuItem primaryText="Workspace" rightIcon={ <FontIcon className="material-icons" style={{color: '#559'}}>settings</FontIcon> } /> <MenuItem primaryText="Paragraph" rightIcon={<b style={style.rightIcon}>¶</b>} /> <MenuItem primaryText="Section" rightIcon={<b style={style.rightIcon}>§</b>} /> </Menu> </Paper> </div> ); export default MenuExampleIcons;
react-client/src/components/Text.js
francoabaroa/escape-reality
import {Entity} from 'aframe-react'; import React from 'react'; export default props => { const extraProps = AFRAME.utils.extend({}, props); delete extraProps.color; delete extraProps.text; return <Entity text={{text: props.text}} material={{color: props.color}} {...extraProps}/> };
src/redux/utils/createDevToolsWindow.js
tiengtinh/react-redux-animated-posts
import React from 'react' import ReactDOM from 'react-dom' import { Provider } from 'react-redux' import DevTools from '../../containers/DevToolsWindow' export default function createDevToolsWindow (store) { const win = window.open( null, 'redux-devtools', // give it a name so it reuses the same window `width=400,height=${window.outerHeight},menubar=no,location=no,resizable=yes,scrollbars=no,status=no` ) // reload in case it's reusing the same window with the old content win.location.reload() // wait a little bit for it to reload, then render setTimeout(() => { // Wait for the reload to prevent: // "Uncaught Error: Invariant Violation: _registerComponent(...): Target container is not a DOM element." win.document.write('<div id="react-devtools-root"></div>') win.document.body.style.margin = '0' ReactDOM.render( <Provider store={store}> <DevTools /> </Provider> , win.document.getElementById('react-devtools-root') ) }, 10) }
src/svg-icons/places/pool.js
hwo411/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let PlacesPool = (props) => ( <SvgIcon {...props}> <path d="M22 21c-1.11 0-1.73-.37-2.18-.64-.37-.22-.6-.36-1.15-.36-.56 0-.78.13-1.15.36-.46.27-1.07.64-2.18.64s-1.73-.37-2.18-.64c-.37-.22-.6-.36-1.15-.36-.56 0-.78.13-1.15.36-.46.27-1.08.64-2.19.64-1.11 0-1.73-.37-2.18-.64-.37-.23-.6-.36-1.15-.36s-.78.13-1.15.36c-.46.27-1.08.64-2.19.64v-2c.56 0 .78-.13 1.15-.36.46-.27 1.08-.64 2.19-.64s1.73.37 2.18.64c.37.23.59.36 1.15.36.56 0 .78-.13 1.15-.36.46-.27 1.08-.64 2.19-.64 1.11 0 1.73.37 2.18.64.37.22.6.36 1.15.36s.78-.13 1.15-.36c.45-.27 1.07-.64 2.18-.64s1.73.37 2.18.64c.37.23.59.36 1.15.36v2zm0-4.5c-1.11 0-1.73-.37-2.18-.64-.37-.22-.6-.36-1.15-.36-.56 0-.78.13-1.15.36-.45.27-1.07.64-2.18.64s-1.73-.37-2.18-.64c-.37-.22-.6-.36-1.15-.36-.56 0-.78.13-1.15.36-.45.27-1.07.64-2.18.64s-1.73-.37-2.18-.64c-.37-.22-.6-.36-1.15-.36s-.78.13-1.15.36c-.47.27-1.09.64-2.2.64v-2c.56 0 .78-.13 1.15-.36.45-.27 1.07-.64 2.18-.64s1.73.37 2.18.64c.37.22.6.36 1.15.36.56 0 .78-.13 1.15-.36.45-.27 1.07-.64 2.18-.64s1.73.37 2.18.64c.37.22.6.36 1.15.36s.78-.13 1.15-.36c.45-.27 1.07-.64 2.18-.64s1.73.37 2.18.64c.37.22.6.36 1.15.36v2zM8.67 12c.56 0 .78-.13 1.15-.36.46-.27 1.08-.64 2.19-.64 1.11 0 1.73.37 2.18.64.37.22.6.36 1.15.36s.78-.13 1.15-.36c.12-.07.26-.15.41-.23L10.48 5C8.93 3.45 7.5 2.99 5 3v2.5c1.82-.01 2.89.39 4 1.5l1 1-3.25 3.25c.31.12.56.27.77.39.37.23.59.36 1.15.36z"/><circle cx="16.5" cy="5.5" r="2.5"/> </SvgIcon> ); PlacesPool = pure(PlacesPool); PlacesPool.displayName = 'PlacesPool'; PlacesPool.muiName = 'SvgIcon'; export default PlacesPool;
ui/webui/resources/js/cr/ui/list.js
7kbird/chrome
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // require: array_data_model.js // require: list_selection_model.js // require: list_selection_controller.js // require: list_item.js /** * @fileoverview This implements a list control. */ cr.define('cr.ui', function() { /** @const */ var ListSelectionModel = cr.ui.ListSelectionModel; /** @const */ var ListSelectionController = cr.ui.ListSelectionController; /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; /** * Whether a mouse event is inside the element viewport. This will return * false if the mouseevent was generated over a border or a scrollbar. * @param {!HTMLElement} el The element to test the event with. * @param {!Event} e The mouse event. * @param {boolean} Whether the mouse event was inside the viewport. */ function inViewport(el, e) { var rect = el.getBoundingClientRect(); var x = e.clientX; var y = e.clientY; return x >= rect.left + el.clientLeft && x < rect.left + el.clientLeft + el.clientWidth && y >= rect.top + el.clientTop && y < rect.top + el.clientTop + el.clientHeight; } function getComputedStyle(el) { return el.ownerDocument.defaultView.getComputedStyle(el); } /** * Creates a new list element. * @param {Object=} opt_propertyBag Optional properties. * @constructor * @extends {HTMLUListElement} */ var List = cr.ui.define('list'); List.prototype = { __proto__: HTMLUListElement.prototype, /** * Measured size of list items. This is lazily calculated the first time it * is needed. Note that lead item is allowed to have a different height, to * accommodate lists where a single item at a time can be expanded to show * more detail. * @type {{height: number, marginTop: number, marginBottom:number, * width: number, marginLeft: number, marginRight:number}} * @private */ measured_: undefined, /** * Whether or not the list is autoexpanding. If true, the list resizes * its height to accomadate all children. * @type {boolean} * @private */ autoExpands_: false, /** * Whether or not the rows on list have various heights. If true, all the * rows have the same fixed height. Otherwise, each row resizes its height * to accommodate all contents. * @type {boolean} * @private */ fixedHeight_: true, /** * Whether or not the list view has a blank space below the last row. * @type {boolean} * @private */ remainingSpace_: true, /** * Function used to create grid items. * @type {function(): !ListItem} * @private */ itemConstructor_: cr.ui.ListItem, /** * Function used to create grid items. * @type {function(): !ListItem} */ get itemConstructor() { return this.itemConstructor_; }, set itemConstructor(func) { if (func != this.itemConstructor_) { this.itemConstructor_ = func; this.cachedItems_ = {}; this.redraw(); } }, dataModel_: null, /** * The data model driving the list. * @type {ArrayDataModel} */ set dataModel(dataModel) { if (this.dataModel_ != dataModel) { if (!this.boundHandleDataModelPermuted_) { this.boundHandleDataModelPermuted_ = this.handleDataModelPermuted_.bind(this); this.boundHandleDataModelChange_ = this.handleDataModelChange_.bind(this); } if (this.dataModel_) { this.dataModel_.removeEventListener( 'permuted', this.boundHandleDataModelPermuted_); this.dataModel_.removeEventListener('change', this.boundHandleDataModelChange_); } this.dataModel_ = dataModel; this.cachedItems_ = {}; this.cachedItemHeights_ = {}; this.selectionModel.clear(); if (dataModel) this.selectionModel.adjustLength(dataModel.length); if (this.dataModel_) { this.dataModel_.addEventListener( 'permuted', this.boundHandleDataModelPermuted_); this.dataModel_.addEventListener('change', this.boundHandleDataModelChange_); } this.redraw(); } }, get dataModel() { return this.dataModel_; }, /** * Cached item for measuring the default item size by measureItem(). * @type {ListItem} */ cachedMeasuredItem_: null, /** * The selection model to use. * @type {cr.ui.ListSelectionModel} */ get selectionModel() { return this.selectionModel_; }, set selectionModel(sm) { var oldSm = this.selectionModel_; if (oldSm == sm) return; if (!this.boundHandleOnChange_) { this.boundHandleOnChange_ = this.handleOnChange_.bind(this); this.boundHandleLeadChange_ = this.handleLeadChange_.bind(this); } if (oldSm) { oldSm.removeEventListener('change', this.boundHandleOnChange_); oldSm.removeEventListener('leadIndexChange', this.boundHandleLeadChange_); } this.selectionModel_ = sm; this.selectionController_ = this.createSelectionController(sm); if (sm) { sm.addEventListener('change', this.boundHandleOnChange_); sm.addEventListener('leadIndexChange', this.boundHandleLeadChange_); } }, /** * Whether or not the list auto-expands. * @type {boolean} */ get autoExpands() { return this.autoExpands_; }, set autoExpands(autoExpands) { if (this.autoExpands_ == autoExpands) return; this.autoExpands_ = autoExpands; this.redraw(); }, /** * Whether or not the rows on list have various heights. * @type {boolean} */ get fixedHeight() { return this.fixedHeight_; }, set fixedHeight(fixedHeight) { if (this.fixedHeight_ == fixedHeight) return; this.fixedHeight_ = fixedHeight; this.redraw(); }, /** * Convenience alias for selectionModel.selectedItem * @type {*} */ get selectedItem() { var dataModel = this.dataModel; if (dataModel) { var index = this.selectionModel.selectedIndex; if (index != -1) return dataModel.item(index); } return null; }, set selectedItem(selectedItem) { var dataModel = this.dataModel; if (dataModel) { var index = this.dataModel.indexOf(selectedItem); this.selectionModel.selectedIndex = index; } }, /** * Convenience alias for selectionModel.selectedItems * @type {!Array<*>} */ get selectedItems() { var indexes = this.selectionModel.selectedIndexes; var dataModel = this.dataModel; if (dataModel) { return indexes.map(function(i) { return dataModel.item(i); }); } return []; }, /** * The HTML elements representing the items. * @type {HTMLCollection} */ get items() { return Array.prototype.filter.call(this.children, this.isItem, this); }, /** * Returns true if the child is a list item. Subclasses may override this * to filter out certain elements. * @param {Node} child Child of the list. * @return {boolean} True if a list item. */ isItem: function(child) { return child.nodeType == Node.ELEMENT_NODE && child != this.beforeFiller_ && child != this.afterFiller_; }, batchCount_: 0, /** * When making a lot of updates to the list, the code could be wrapped in * the startBatchUpdates and finishBatchUpdates to increase performance. Be * sure that the code will not return without calling endBatchUpdates or the * list will not be correctly updated. */ startBatchUpdates: function() { this.batchCount_++; }, /** * See startBatchUpdates. */ endBatchUpdates: function() { this.batchCount_--; if (this.batchCount_ == 0) this.redraw(); }, /** * Initializes the element. */ decorate: function() { // Add fillers. this.beforeFiller_ = this.ownerDocument.createElement('div'); this.afterFiller_ = this.ownerDocument.createElement('div'); this.beforeFiller_.className = 'spacer'; this.afterFiller_.className = 'spacer'; this.textContent = ''; this.appendChild(this.beforeFiller_); this.appendChild(this.afterFiller_); var length = this.dataModel ? this.dataModel.length : 0; this.selectionModel = new ListSelectionModel(length); this.addEventListener('dblclick', this.handleDoubleClick_); this.addEventListener('mousedown', handleMouseDown); this.addEventListener('dragstart', handleDragStart, true); this.addEventListener('mouseup', this.handlePointerDownUp_); this.addEventListener('keydown', this.handleKeyDown); this.addEventListener('focus', this.handleElementFocus_, true); this.addEventListener('blur', this.handleElementBlur_, true); this.addEventListener('scroll', this.handleScroll.bind(this)); this.setAttribute('role', 'list'); // Make list focusable if (!this.hasAttribute('tabindex')) this.tabIndex = 0; // Try to get an unique id prefix from the id of this element or the // nearest ancestor with an id. var element = this; while (element && !element.id) element = element.parentElement; if (element && element.id) this.uniqueIdPrefix_ = element.id; else this.uniqueIdPrefix_ = 'list'; // The next id suffix to use when giving each item an unique id. this.nextUniqueIdSuffix_ = 0; }, /** * @param {ListItem=} item The list item to measure. * @return {number} The height of the given item. If the fixed height on CSS * is set by 'px', uses that value as height. Otherwise, measures the size. * @private */ measureItemHeight_: function(item) { return this.measureItem(item).height; }, /** * @return {number} The height of default item, measuring it if necessary. * @private */ getDefaultItemHeight_: function() { return this.getDefaultItemSize_().height; }, /** * @param {number} index The index of the item. * @return {number} The height of the item, measuring it if necessary. */ getItemHeightByIndex_: function(index) { // If |this.fixedHeight_| is true, all the rows have same default height. if (this.fixedHeight_) return this.getDefaultItemHeight_(); if (this.cachedItemHeights_[index]) return this.cachedItemHeights_[index]; var item = this.getListItemByIndex(index); if (item) { var h = this.measureItemHeight_(item); this.cachedItemHeights_[index] = h; return h; } return this.getDefaultItemHeight_(); }, /** * @return {{height: number, width: number}} The height and width * of default item, measuring it if necessary. * @private */ getDefaultItemSize_: function() { if (!this.measured_ || !this.measured_.height) { this.measured_ = this.measureItem(); } return this.measured_; }, /** * Creates an item (dataModel.item(0)) and measures its height. The item is * cached instead of creating a new one every time.. * @param {ListItem=} opt_item The list item to use to do the measuring. If * this is not provided an item will be created based on the first value * in the model. * @return {{height: number, marginTop: number, marginBottom:number, * width: number, marginLeft: number, marginRight:number}} * The height and width of the item, taking * margins into account, and the top, bottom, left and right margins * themselves. */ measureItem: function(opt_item) { var dataModel = this.dataModel; if (!dataModel || !dataModel.length) return 0; var item = opt_item || this.cachedMeasuredItem_ || this.createItem(dataModel.item(0)); if (!opt_item) { this.cachedMeasuredItem_ = item; this.appendChild(item); } var rect = item.getBoundingClientRect(); var cs = getComputedStyle(item); var mt = parseFloat(cs.marginTop); var mb = parseFloat(cs.marginBottom); var ml = parseFloat(cs.marginLeft); var mr = parseFloat(cs.marginRight); var h = rect.height; var w = rect.width; var mh = 0; var mv = 0; // Handle margin collapsing. if (mt < 0 && mb < 0) { mv = Math.min(mt, mb); } else if (mt >= 0 && mb >= 0) { mv = Math.max(mt, mb); } else { mv = mt + mb; } h += mv; if (ml < 0 && mr < 0) { mh = Math.min(ml, mr); } else if (ml >= 0 && mr >= 0) { mh = Math.max(ml, mr); } else { mh = ml + mr; } w += mh; if (!opt_item) this.removeChild(item); return { height: Math.max(0, h), marginTop: mt, marginBottom: mb, width: Math.max(0, w), marginLeft: ml, marginRight: mr}; }, /** * Callback for the double click event. * @param {Event} e The mouse event object. * @private */ handleDoubleClick_: function(e) { if (this.disabled) return; var target = e.target; target = this.getListItemAncestor(target); if (target) this.activateItemAtIndex(this.getIndexOfListItem(target)); }, /** * Callback for mousedown and mouseup events. * @param {Event} e The mouse event object. * @private */ handlePointerDownUp_: function(e) { if (this.disabled) return; var target = e.target; // If the target was this element we need to make sure that the user did // not click on a border or a scrollbar. if (target == this) { if (inViewport(target, e)) this.selectionController_.handlePointerDownUp(e, -1); return; } target = this.getListItemAncestor(target); var index = this.getIndexOfListItem(target); this.selectionController_.handlePointerDownUp(e, index); }, /** * Called when an element in the list is focused. Marks the list as having * a focused element, and dispatches an event if it didn't have focus. * @param {Event} e The focus event. * @private */ handleElementFocus_: function(e) { if (!this.hasElementFocus) this.hasElementFocus = true; }, /** * Called when an element in the list is blurred. If focus moves outside * the list, marks the list as no longer having focus and dispatches an * event. * @param {Event} e The blur event. * @private */ handleElementBlur_: function(e) { if (!this.contains(e.relatedTarget)) this.hasElementFocus = false; }, /** * Returns the list item element containing the given element, or null if * it doesn't belong to any list item element. * @param {HTMLElement} element The element. * @return {ListItem} The list item containing |element|, or null. */ getListItemAncestor: function(element) { var container = element; while (container && container.parentNode != this) { container = container.parentNode; } return container; }, /** * Handle a keydown event. * @param {Event} e The keydown event. * @return {boolean} Whether the key event was handled. */ handleKeyDown: function(e) { if (this.disabled) return; return this.selectionController_.handleKeyDown(e); }, /** * Handle a scroll event. * @param {Event} e The scroll event. */ handleScroll: function(e) { requestAnimationFrame(this.redraw.bind(this)); }, /** * Callback from the selection model. We dispatch {@code change} events * when the selection changes. * @param {!Event} e Event with change info. * @private */ handleOnChange_: function(ce) { ce.changes.forEach(function(change) { var listItem = this.getListItemByIndex(change.index); if (listItem) { listItem.selected = change.selected; if (change.selected) { listItem.setAttribute('aria-posinset', change.index + 1); listItem.setAttribute('aria-setsize', this.dataModel.length); this.setAttribute('aria-activedescendant', listItem.id); } else { listItem.removeAttribute('aria-posinset'); listItem.removeAttribute('aria-setsize'); } } }, this); cr.dispatchSimpleEvent(this, 'change'); }, /** * Handles a change of the lead item from the selection model. * @param {Event} pe The property change event. * @private */ handleLeadChange_: function(pe) { var element; if (pe.oldValue != -1) { if ((element = this.getListItemByIndex(pe.oldValue))) element.lead = false; } if (pe.newValue != -1) { if ((element = this.getListItemByIndex(pe.newValue))) element.lead = true; if (pe.oldValue != pe.newValue) { this.scrollIndexIntoView(pe.newValue); // If the lead item has a different height than other items, then we // may run into a problem that requires a second attempt to scroll // it into view. The first scroll attempt will trigger a redraw, // which will clear out the list and repopulate it with new items. // During the redraw, the list may shrink temporarily, which if the // lead item is the last item, will move the scrollTop up since it // cannot extend beyond the end of the list. (Sadly, being scrolled to // the bottom of the list is not "sticky.") So, we set a timeout to // rescroll the list after this all gets sorted out. This is perhaps // not the most elegant solution, but no others seem obvious. var self = this; window.setTimeout(function() { self.scrollIndexIntoView(pe.newValue); }); } } }, /** * This handles data model 'permuted' event. * this event is dispatched as a part of sort or splice. * We need to * - adjust the cache. * - adjust selection. * - redraw. (called in this.endBatchUpdates()) * It is important that the cache adjustment happens before selection model * adjustments. * @param {Event} e The 'permuted' event. */ handleDataModelPermuted_: function(e) { var newCachedItems = {}; for (var index in this.cachedItems_) { if (e.permutation[index] != -1) { var newIndex = e.permutation[index]; newCachedItems[newIndex] = this.cachedItems_[index]; newCachedItems[newIndex].listIndex = newIndex; } } this.cachedItems_ = newCachedItems; this.pinnedItem_ = null; var newCachedItemHeights = {}; for (var index in this.cachedItemHeights_) { if (e.permutation[index] != -1) { newCachedItemHeights[e.permutation[index]] = this.cachedItemHeights_[index]; } } this.cachedItemHeights_ = newCachedItemHeights; this.startBatchUpdates(); var sm = this.selectionModel; sm.adjustLength(e.newLength); sm.adjustToReordering(e.permutation); this.endBatchUpdates(); }, handleDataModelChange_: function(e) { delete this.cachedItems_[e.index]; delete this.cachedItemHeights_[e.index]; this.cachedMeasuredItem_ = null; if (e.index >= this.firstIndex_ && (e.index < this.lastIndex_ || this.remainingSpace_)) { this.redraw(); } }, /** * @param {number} index The index of the item. * @return {number} The top position of the item inside the list. */ getItemTop: function(index) { if (this.fixedHeight_) { var itemHeight = this.getDefaultItemHeight_(); return index * itemHeight; } else { this.ensureAllItemSizesInCache(); var top = 0; for (var i = 0; i < index; i++) { top += this.getItemHeightByIndex_(i); } return top; } }, /** * @param {number} index The index of the item. * @return {number} The row of the item. May vary in the case * of multiple columns. */ getItemRow: function(index) { return index; }, /** * @param {number} row The row. * @return {number} The index of the first item in the row. */ getFirstItemInRow: function(row) { return row; }, /** * Ensures that a given index is inside the viewport. * @param {number} index The index of the item to scroll into view. * @return {boolean} Whether any scrolling was needed. */ scrollIndexIntoView: function(index) { var dataModel = this.dataModel; if (!dataModel || index < 0 || index >= dataModel.length) return false; var itemHeight = this.getItemHeightByIndex_(index); var scrollTop = this.scrollTop; var top = this.getItemTop(index); var clientHeight = this.clientHeight; var cs = getComputedStyle(this); var paddingY = parseInt(cs.paddingTop, 10) + parseInt(cs.paddingBottom, 10); var availableHeight = clientHeight - paddingY; var self = this; // Function to adjust the tops of viewport and row. function scrollToAdjustTop() { self.scrollTop = top; return true; }; // Function to adjust the bottoms of viewport and row. function scrollToAdjustBottom() { self.scrollTop = top + itemHeight - availableHeight; return true; }; // Check if the entire of given indexed row can be shown in the viewport. if (itemHeight <= availableHeight) { if (top < scrollTop) return scrollToAdjustTop(); if (scrollTop + availableHeight < top + itemHeight) return scrollToAdjustBottom(); } else { if (scrollTop < top) return scrollToAdjustTop(); if (top + itemHeight < scrollTop + availableHeight) return scrollToAdjustBottom(); } return false; }, /** * @return {!ClientRect} The rect to use for the context menu. */ getRectForContextMenu: function() { // TODO(arv): Add trait support so we can share more code between trees // and lists. var index = this.selectionModel.selectedIndex; var el = this.getListItemByIndex(index); if (el) return el.getBoundingClientRect(); return this.getBoundingClientRect(); }, /** * Takes a value from the data model and finds the associated list item. * @param {*} value The value in the data model that we want to get the list * item for. * @return {ListItem} The first found list item or null if not found. */ getListItem: function(value) { var dataModel = this.dataModel; if (dataModel) { var index = dataModel.indexOf(value); return this.getListItemByIndex(index); } return null; }, /** * Find the list item element at the given index. * @param {number} index The index of the list item to get. * @return {ListItem} The found list item or null if not found. */ getListItemByIndex: function(index) { return this.cachedItems_[index] || null; }, /** * Find the index of the given list item element. * @param {ListItem} item The list item to get the index of. * @return {number} The index of the list item, or -1 if not found. */ getIndexOfListItem: function(item) { var index = item.listIndex; if (this.cachedItems_[index] == item) { return index; } return -1; }, /** * Creates a new list item. * @param {*} value The value to use for the item. * @return {!ListItem} The newly created list item. */ createItem: function(value) { var item = new this.itemConstructor_(value); item.label = value; item.id = this.uniqueIdPrefix_ + '-' + this.nextUniqueIdSuffix_++; if (typeof item.decorate == 'function') item.decorate(); return item; }, /** * Creates the selection controller to use internally. * @param {cr.ui.ListSelectionModel} sm The underlying selection model. * @return {!cr.ui.ListSelectionController} The newly created selection * controller. */ createSelectionController: function(sm) { return new ListSelectionController(sm); }, /** * Return the heights (in pixels) of the top of the given item index within * the list, and the height of the given item itself, accounting for the * possibility that the lead item may be a different height. * @param {number} index The index to find the top height of. * @return {{top: number, height: number}} The heights for the given index. * @private */ getHeightsForIndex_: function(index) { var itemHeight = this.getItemHeightByIndex_(index); var top = this.getItemTop(index); return {top: top, height: itemHeight}; }, /** * Find the index of the list item containing the given y offset (measured * in pixels from the top) within the list. In the case of multiple columns, * returns the first index in the row. * @param {number} offset The y offset in pixels to get the index of. * @return {number} The index of the list item. Returns the list size if * given offset exceeds the height of list. * @private */ getIndexForListOffset_: function(offset) { var itemHeight = this.getDefaultItemHeight_(); if (!itemHeight) return this.dataModel.length; if (this.fixedHeight_) return this.getFirstItemInRow(Math.floor(offset / itemHeight)); // If offset exceeds the height of list. var lastHeight = 0; if (this.dataModel.length) { var h = this.getHeightsForIndex_(this.dataModel.length - 1); lastHeight = h.top + h.height; } if (lastHeight < offset) return this.dataModel.length; // Estimates index. var estimatedIndex = Math.min(Math.floor(offset / itemHeight), this.dataModel.length - 1); var isIncrementing = this.getItemTop(estimatedIndex) < offset; // Searchs the correct index. do { var heights = this.getHeightsForIndex_(estimatedIndex); var top = heights.top; var height = heights.height; if (top <= offset && offset <= (top + height)) break; isIncrementing ? ++estimatedIndex : --estimatedIndex; } while (0 < estimatedIndex && estimatedIndex < this.dataModel.length); return estimatedIndex; }, /** * Return the number of items that occupy the range of heights between the * top of the start item and the end offset. * @param {number} startIndex The index of the first visible item. * @param {number} endOffset The y offset in pixels of the end of the list. * @return {number} The number of list items visible. * @private */ countItemsInRange_: function(startIndex, endOffset) { var endIndex = this.getIndexForListOffset_(endOffset); return endIndex - startIndex + 1; }, /** * Calculates the number of items fitting in the given viewport. * @param {number} scrollTop The scroll top position. * @param {number} clientHeight The height of viewport. * @return {{first: number, length: number, last: number}} The index of * first item in view port, The number of items, The item past the last. */ getItemsInViewPort: function(scrollTop, clientHeight) { if (this.autoExpands_) { return { first: 0, length: this.dataModel.length, last: this.dataModel.length}; } else { var firstIndex = this.getIndexForListOffset_(scrollTop); var lastIndex = this.getIndexForListOffset_(scrollTop + clientHeight); return { first: firstIndex, length: lastIndex - firstIndex + 1, last: lastIndex + 1}; } }, /** * Merges list items currently existing in the list with items in the range * [firstIndex, lastIndex). Removes or adds items if needed. * Doesn't delete {@code this.pinnedItem_} if it is present (instead hides * it if it is out of the range). * @param {number} firstIndex The index of first item, inclusively. * @param {number} lastIndex The index of last item, exclusively. */ mergeItems: function(firstIndex, lastIndex) { var self = this; var dataModel = this.dataModel; var currentIndex = firstIndex; function insert() { var dataItem = dataModel.item(currentIndex); var newItem = self.cachedItems_[currentIndex] || self.createItem(dataItem); newItem.listIndex = currentIndex; self.cachedItems_[currentIndex] = newItem; self.insertBefore(newItem, item); currentIndex++; } function remove() { var next = item.nextSibling; if (item != self.pinnedItem_) self.removeChild(item); item = next; } for (var item = this.beforeFiller_.nextSibling; item != this.afterFiller_ && currentIndex < lastIndex;) { if (!this.isItem(item)) { item = item.nextSibling; continue; } var index = item.listIndex; if (this.cachedItems_[index] != item || index < currentIndex) { remove(); } else if (index == currentIndex) { this.cachedItems_[currentIndex] = item; item = item.nextSibling; currentIndex++; } else { // index > currentIndex insert(); } } while (item != this.afterFiller_) { if (this.isItem(item)) remove(); else item = item.nextSibling; } if (this.pinnedItem_) { var index = this.pinnedItem_.listIndex; this.pinnedItem_.hidden = index < firstIndex || index >= lastIndex; this.cachedItems_[index] = this.pinnedItem_; if (index >= lastIndex) item = this.pinnedItem_; // Insert new items before this one. } while (currentIndex < lastIndex) insert(); }, /** * Ensures that all the item sizes in the list have been already cached. */ ensureAllItemSizesInCache: function() { var measuringIndexes = []; var isElementAppended = []; for (var y = 0; y < this.dataModel.length; y++) { if (!this.cachedItemHeights_[y]) { measuringIndexes.push(y); isElementAppended.push(false); } } var measuringItems = []; // Adds temporary elements. for (var y = 0; y < measuringIndexes.length; y++) { var index = measuringIndexes[y]; var dataItem = this.dataModel.item(index); var listItem = this.cachedItems_[index] || this.createItem(dataItem); listItem.listIndex = index; // If |listItems| is not on the list, apppends it to the list and sets // the flag. if (!listItem.parentNode) { this.appendChild(listItem); isElementAppended[y] = true; } this.cachedItems_[index] = listItem; measuringItems.push(listItem); } // All mesurings must be placed after adding all the elements, to prevent // performance reducing. for (var y = 0; y < measuringIndexes.length; y++) { var index = measuringIndexes[y]; this.cachedItemHeights_[index] = this.measureItemHeight_(measuringItems[y]); } // Removes all the temprary elements. for (var y = 0; y < measuringIndexes.length; y++) { // If the list item has been appended above, removes it. if (isElementAppended[y]) this.removeChild(measuringItems[y]); } }, /** * Returns the height of after filler in the list. * @param {number} lastIndex The index of item past the last in viewport. * @return {number} The height of after filler. */ getAfterFillerHeight: function(lastIndex) { if (this.fixedHeight_) { var itemHeight = this.getDefaultItemHeight_(); return (this.dataModel.length - lastIndex) * itemHeight; } var height = 0; for (var i = lastIndex; i < this.dataModel.length; i++) height += this.getItemHeightByIndex_(i); return height; }, /** * Redraws the viewport. */ redraw: function() { if (this.batchCount_ != 0) return; var dataModel = this.dataModel; if (!dataModel || !this.autoExpands_ && this.clientHeight == 0) { this.cachedItems_ = {}; this.firstIndex_ = 0; this.lastIndex_ = 0; this.remainingSpace_ = this.clientHeight != 0; this.mergeItems(0, 0, {}, {}); return; } // Save the previous positions before any manipulation of elements. var scrollTop = this.scrollTop; var clientHeight = this.clientHeight; // Store all the item sizes into the cache in advance, to prevent // interleave measuring with mutating dom. if (!this.fixedHeight_) this.ensureAllItemSizesInCache(); var autoExpands = this.autoExpands_; var itemsInViewPort = this.getItemsInViewPort(scrollTop, clientHeight); // Draws the hidden rows just above/below the viewport to prevent // flashing in scroll. var firstIndex = Math.max( 0, Math.min(dataModel.length - 1, itemsInViewPort.first - 1)); var lastIndex = Math.min(itemsInViewPort.last + 1, dataModel.length); var beforeFillerHeight = this.autoExpands ? 0 : this.getItemTop(firstIndex); var afterFillerHeight = this.autoExpands ? 0 : this.getAfterFillerHeight(lastIndex); this.beforeFiller_.style.height = beforeFillerHeight + 'px'; var sm = this.selectionModel; var leadIndex = sm.leadIndex; // If the pinned item is hidden and it is not the lead item, then remove // it from cache. Note, that we restore the hidden status to false, since // the item is still in cache, and may be reused. if (this.pinnedItem_ && this.pinnedItem_ != this.cachedItems_[leadIndex]) { if (this.pinnedItem_.hidden) { this.removeChild(this.pinnedItem_); this.pinnedItem_.hidden = false; } this.pinnedItem_ = undefined; } this.mergeItems(firstIndex, lastIndex); if (!this.pinnedItem_ && this.cachedItems_[leadIndex] && this.cachedItems_[leadIndex].parentNode == this) { this.pinnedItem_ = this.cachedItems_[leadIndex]; } this.afterFiller_.style.height = afterFillerHeight + 'px'; // Restores the number of pixels scrolled, since it might be changed while // DOM operations. this.scrollTop = scrollTop; // We don't set the lead or selected properties until after adding all // items, in case they force relayout in response to these events. if (leadIndex != -1 && this.cachedItems_[leadIndex]) this.cachedItems_[leadIndex].lead = true; for (var y = firstIndex; y < lastIndex; y++) { if (sm.getIndexSelected(y) != this.cachedItems_[y].selected) this.cachedItems_[y].selected = !this.cachedItems_[y].selected; } this.firstIndex_ = firstIndex; this.lastIndex_ = lastIndex; this.remainingSpace_ = itemsInViewPort.last > dataModel.length; // Mesurings must be placed after adding all the elements, to prevent // performance reducing. if (!this.fixedHeight_) { for (var y = firstIndex; y < lastIndex; y++) { this.cachedItemHeights_[y] = this.measureItemHeight_(this.cachedItems_[y]); } } }, /** * Restore the lead item that is present in the list but may be updated * in the data model (supposed to be used inside a batch update). Usually * such an item would be recreated in the redraw method. If reinsertion * is undesirable (for instance to prevent losing focus) the item may be * updated and restored. Assumed the listItem relates to the same data item * as the lead item in the begin of the batch update. * * @param {ListItem} leadItem Already existing lead item. */ restoreLeadItem: function(leadItem) { delete this.cachedItems_[leadItem.listIndex]; leadItem.listIndex = this.selectionModel.leadIndex; this.pinnedItem_ = this.cachedItems_[leadItem.listIndex] = leadItem; }, /** * Invalidates list by removing cached items. */ invalidate: function() { this.cachedItems_ = {}; this.cachedItemSized_ = {}; }, /** * Redraws a single item. * @param {number} index The row index to redraw. */ redrawItem: function(index) { if (index >= this.firstIndex_ && (index < this.lastIndex_ || this.remainingSpace_)) { delete this.cachedItems_[index]; this.redraw(); } }, /** * Called when a list item is activated, currently only by a double click * event. * @param {number} index The index of the activated item. */ activateItemAtIndex: function(index) { }, /** * Returns a ListItem for the leadIndex. If the item isn't present in the * list creates it and inserts to the list (may be invisible if it's out of * the visible range). * * Item returned from this method won't be removed until it remains a lead * item or til the data model changes (unlike other items that could be * removed when they go out of the visible range). * * @return {cr.ui.ListItem} The lead item for the list. */ ensureLeadItemExists: function() { var index = this.selectionModel.leadIndex; if (index < 0) return null; var cachedItems = this.cachedItems_ || {}; var item = cachedItems[index] || this.createItem(this.dataModel.item(index)); if (this.pinnedItem_ != item && this.pinnedItem_ && this.pinnedItem_.hidden) { this.removeChild(this.pinnedItem_); } this.pinnedItem_ = item; cachedItems[index] = item; item.listIndex = index; if (item.parentNode == this) return item; if (this.batchCount_ != 0) item.hidden = true; // Item will get to the right place in redraw. Choose place to insert // reducing items reinsertion. if (index <= this.firstIndex_) this.insertBefore(item, this.beforeFiller_.nextSibling); else this.insertBefore(item, this.afterFiller_); this.redraw(); return item; }, /** * Starts drag selection by reacting 'dragstart' event. * @param {Event} event Event of dragstart. */ startDragSelection: function(event) { event.preventDefault(); var border = document.createElement('div'); border.className = 'drag-selection-border'; var rect = this.getBoundingClientRect(); var startX = event.clientX - rect.left + this.scrollLeft; var startY = event.clientY - rect.top + this.scrollTop; border.style.left = startX + 'px'; border.style.top = startY + 'px'; var onMouseMove = function(event) { var inRect = this.getBoundingClientRect(); var x = event.clientX - inRect.left + this.scrollLeft; var y = event.clientY - inRect.top + this.scrollTop; border.style.left = Math.min(startX, x) + 'px'; border.style.top = Math.min(startY, y) + 'px'; border.style.width = Math.abs(startX - x) + 'px'; border.style.height = Math.abs(startY - y) + 'px'; }.bind(this); var onMouseUp = function() { this.removeChild(border); document.removeEventListener('mousemove', onMouseMove, true); document.removeEventListener('mouseup', onMouseUp, true); }.bind(this); document.addEventListener('mousemove', onMouseMove, true); document.addEventListener('mouseup', onMouseUp, true); this.appendChild(border); }, }; cr.defineProperty(List, 'disabled', cr.PropertyKind.BOOL_ATTR); /** * Whether the list or one of its descendents has focus. This is necessary * because list items can contain controls that can be focused, and for some * purposes (e.g., styling), the list can still be conceptually focused at * that point even though it doesn't actually have the page focus. */ cr.defineProperty(List, 'hasElementFocus', cr.PropertyKind.BOOL_ATTR); /** * Mousedown event handler. * @this {List} * @param {MouseEvent} e The mouse event object. */ function handleMouseDown(e) { var listItem = this.getListItemAncestor(e.target); var wasSelected = listItem && listItem.selected; this.handlePointerDownUp_(e); if (e.defaultPrevented || e.button != 0) return; // The following hack is required only if the listItem gets selected. if (!listItem || wasSelected || !listItem.selected) return; // If non-focusable area in a list item is clicked and the item still // contains the focused element, the item did a special focus handling // [1] and we should not focus on the list. // // [1] For example, clicking non-focusable area gives focus on the first // form control in the item. if (!containsFocusableElement(e.target, listItem) && listItem.contains(listItem.ownerDocument.activeElement)) { e.preventDefault(); } } /** * Dragstart event handler. * If there is an item at starting position of drag operation and the item * is not selected, select it. * @this {List} * @param {MouseEvent} e The event object for 'dragstart'. */ function handleDragStart(e) { var element = e.target.ownerDocument.elementFromPoint(e.clientX, e.clientY); var listItem = this.getListItemAncestor(element); if (!listItem) return; var index = this.getIndexOfListItem(listItem); if (index == -1) return; var isAlreadySelected = this.selectionModel_.getIndexSelected(index); if (!isAlreadySelected) this.selectionModel_.selectedIndex = index; } /** * Check if |start| or its ancestor under |root| is focusable. * This is a helper for handleMouseDown. * @param {!Element} start An element which we start to check. * @param {!Element} root An element which we finish to check. * @return {boolean} True if we found a focusable element. */ function containsFocusableElement(start, root) { for (var element = start; element && element != root; element = element.parentElement) { if (element.tabIndex >= 0 && !element.disabled) return true; } return false; } return { List: List }; });
springboot/GReact/node_modules/react-bootstrap/es/ModalDialog.js
ezsimple/java
import _extends from 'babel-runtime/helpers/extends'; import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties'; import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import classNames from 'classnames'; import React from 'react'; import { bsClass, bsSizes, getClassSet, prefix, splitBsProps } from './utils/bootstrapUtils'; import { Size } from './utils/StyleConfig'; var propTypes = { /** * A css class to apply to the Modal dialog DOM node. */ dialogClassName: React.PropTypes.string }; var ModalDialog = function (_React$Component) { _inherits(ModalDialog, _React$Component); function ModalDialog() { _classCallCheck(this, ModalDialog); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } ModalDialog.prototype.render = function render() { var _extends2; var _props = this.props, dialogClassName = _props.dialogClassName, className = _props.className, style = _props.style, children = _props.children, props = _objectWithoutProperties(_props, ['dialogClassName', 'className', 'style', 'children']); var _splitBsProps = splitBsProps(props), bsProps = _splitBsProps[0], elementProps = _splitBsProps[1]; var bsClassName = prefix(bsProps); var modalStyle = _extends({ display: 'block' }, style); var dialogClasses = _extends({}, getClassSet(bsProps), (_extends2 = {}, _extends2[bsClassName] = false, _extends2[prefix(bsProps, 'dialog')] = true, _extends2)); return React.createElement( 'div', _extends({}, elementProps, { tabIndex: '-1', role: 'dialog', style: modalStyle, className: classNames(className, bsClassName) }), React.createElement( 'div', { className: classNames(dialogClassName, dialogClasses) }, React.createElement( 'div', { className: prefix(bsProps, 'content'), role: 'document' }, children ) ) ); }; return ModalDialog; }(React.Component); ModalDialog.propTypes = propTypes; export default bsClass('modal', bsSizes([Size.LARGE, Size.SMALL], ModalDialog));
admin/frontend/pages/developer-tools/form-builder.js
latteware/marble-seed
import React from 'react' import PageComponent from '~base/page-component' import {loggedIn} from '~base/middlewares/' import FormBuilder from './components/builder' import 'react-select/scss/default.scss' import 'react-datepicker/src/stylesheets/datepicker.scss' import MarbleForm from '~base/components/marble-form' class FormBuilderContainer extends PageComponent { constructor (props) { super(props) this.state = { ...this.baseState, schema: {}, formData: {}, result: null, currentDisplay: 'form' } } onChange (schema) { this.setState({ schema }) } handleChange (data) { this.setState({formData: data}) } setCurrentDisplay (currentDisplay) { this.setState({currentDisplay}) } setResult (result) { this.setState({ formData: {}, result }) } render () { const basicStates = super.getBasicStates() if (basicStates) { return basicStates } const { schema, currentDisplay, result, formData } = this.state const formEl = <div> <MarbleForm schema={schema} formData={formData} onChange={(data) => this.handleChange(data)} onSubmit={(data) => this.setResult(data)} /> <div style={{maxWidth: 500, overflowX: 'scroll'}}> {result && <pre style={{marginTop: 20}}>{JSON.stringify(result, null, 2)}</pre>} </div> </div> return ( <div className='columns c-flex-1 is-marginless'> <div className='column is-paddingless'> <div className='section'> <div className='columns'> <div className='column'> <div className='card'> <header className='card-header'> <p className='card-header-title'> Form Builder </p> </header> <div className='card-content'> <FormBuilder initialSchema={schema} onChange={schema => this.onChange(schema)} /> </div> </div> </div> <div className='column'> <div className='card'> <header className='card-header'> <p className='card-header-title'> Form Schema </p> <div className='tabs'> <ul> <li onClick={() => this.setCurrentDisplay('form')} className={currentDisplay === 'form' ? 'is-active' : ''}><a>Form</a></li> <li onClick={() => this.setCurrentDisplay('schema')} className={currentDisplay === 'schema' ? 'is-active' : ''}><a>Schema</a></li> </ul> </div> </header> <div className='card-content'> { currentDisplay === 'form' && formEl } { currentDisplay === 'schema' && <pre>{JSON.stringify(schema, null, 2)}</pre> } </div> </div> </div> </div> </div> </div> </div> ) } } FormBuilderContainer.config({ name: 'form-builder', path: '/devtools/form-builder', icon: 'file', title: 'Form Builder', breadcrumbs: [ {label: 'Dashboard', path: '/'}, {label: 'Developer tools'}, {label: 'Form builder'} ], exact: true, validate: loggedIn }) export default FormBuilderContainer
ajax/libs/yasqe/1.2.5/yasqe.min.js
IonicaBizauKitchen/cdnjs
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var t;"undefined"!=typeof window?t=window:"undefined"!=typeof global?t=global:"undefined"!=typeof self&&(t=self),t.YASQE=e()}}(function(){var e;return function t(e,i,r){function n(s,a){if(!i[s]){if(!e[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(o)return o(s,!0);throw new Error("Cannot find module '"+s+"'")}var u=i[s]={exports:{}};e[s][0].call(u.exports,function(t){var i=e[s][1][t];return n(i?i:t)},u,u.exports,t,e,i,r)}return i[s].exports}for(var o="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}({1:[function(e){$=jquery=e("jquery"),$.deparam=function(e,t){var i={},r={"true":!0,"false":!1,"null":null};return $.each(e.replace(/\+/g," ").split("&"),function(e,n){var o,s=n.split("="),a=decodeURIComponent(s[0]),l=i,u=0,p=a.split("]["),c=p.length-1;if(/\[/.test(p[0])&&/\]$/.test(p[c])?(p[c]=p[c].replace(/\]$/,""),p=p.shift().split("[").concat(p),c=p.length-1):c=0,2===s.length)if(o=decodeURIComponent(s[1]),t&&(o=o&&!isNaN(o)?+o:"undefined"===o?void 0:void 0!==r[o]?r[o]:o),c)for(;c>=u;u++)a=""===p[u]?l.length:p[u],l=l[a]=c>u?l[a]||(p[u+1]&&isNaN(p[u+1])?{}:[]):o;else $.isArray(i[a])?i[a].push(o):i[a]=void 0!==i[a]?[i[a],o]:o;else a&&(i[a]=t?void 0:"")}),i}},{jquery:9}],2:[function(t,i,r){!function(n){"object"==typeof r&&"object"==typeof i?n(t("codemirror")):"function"==typeof e&&e.amd?e(["codemirror"],n):n(CodeMirror)}(function(e){"use strict";e.defineMode("sparql11",function(e){function t(){var e,t,i="<[^<>\"'|{}^\\\x00- ]*>",r="[A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]",n=r+"|_",o="("+n+"|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])",s="("+n+"|[0-9])("+n+"|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])*",a="\\?"+s,l="\\$"+s,p="("+r+")((("+o+")|\\.)*("+o+"))?",c="[0-9A-Fa-f]",d="(%"+c+c+")",E="(\\\\[_~\\.\\-!\\$&'\\(\\)\\*\\+,;=/\\?#@%])",h="("+d+"|"+E+")";"sparql11"==u?(e="("+n+"|:|[0-9]|"+h+")(("+o+"|\\.|:|"+h+")*("+o+"|:|"+h+"))?",t="_:("+n+"|[0-9])(("+o+"|\\.)*"+o+")?"):(e="("+n+"|[0-9])((("+o+")|\\.)*("+o+"))?",t="_:"+e);var f="("+p+")?:",m=f+e,g="@[a-zA-Z]+(-[a-zA-Z0-9]+)*",v="[eE][\\+-]?[0-9]+",x="[0-9]+",N="(([0-9]+\\.[0-9]*)|(\\.[0-9]+))",L="(([0-9]+\\.[0-9]*"+v+")|(\\.[0-9]+"+v+")|([0-9]+"+v+"))",I="\\+"+x,T="\\+"+N,y="\\+"+L,A="-"+x,S="-"+N,C="-"+L,R="\\\\[tbnrf\\\\\"']",b="'(([^\\x27\\x5C\\x0A\\x0D])|"+R+")*'",O='"(([^\\x22\\x5C\\x0A\\x0D])|'+R+')*"',P="'''(('|'')?([^'\\\\]|"+R+"))*'''",D='"""(("|"")?([^"\\\\]|'+R+'))*"""',_="[\\x20\\x09\\x0D\\x0A]",M="#([^\\n\\r]*[\\n\\r]|[^\\n\\r]*$)",w="("+_+"|("+M+"))*",G="\\("+w+"\\)",k="\\["+w+"\\]",B={terminal:[{name:"WS",regex:new RegExp("^"+_+"+"),style:"ws"},{name:"COMMENT",regex:new RegExp("^"+M),style:"comment"},{name:"IRI_REF",regex:new RegExp("^"+i),style:"variable-3"},{name:"VAR1",regex:new RegExp("^"+a),style:"atom"},{name:"VAR2",regex:new RegExp("^"+l),style:"atom"},{name:"LANGTAG",regex:new RegExp("^"+g),style:"meta"},{name:"DOUBLE",regex:new RegExp("^"+L),style:"number"},{name:"DECIMAL",regex:new RegExp("^"+N),style:"number"},{name:"INTEGER",regex:new RegExp("^"+x),style:"number"},{name:"DOUBLE_POSITIVE",regex:new RegExp("^"+y),style:"number"},{name:"DECIMAL_POSITIVE",regex:new RegExp("^"+T),style:"number"},{name:"INTEGER_POSITIVE",regex:new RegExp("^"+I),style:"number"},{name:"DOUBLE_NEGATIVE",regex:new RegExp("^"+C),style:"number"},{name:"DECIMAL_NEGATIVE",regex:new RegExp("^"+S),style:"number"},{name:"INTEGER_NEGATIVE",regex:new RegExp("^"+A),style:"number"},{name:"STRING_LITERAL_LONG1",regex:new RegExp("^"+P),style:"string"},{name:"STRING_LITERAL_LONG2",regex:new RegExp("^"+D),style:"string"},{name:"STRING_LITERAL1",regex:new RegExp("^"+b),style:"string"},{name:"STRING_LITERAL2",regex:new RegExp("^"+O),style:"string"},{name:"NIL",regex:new RegExp("^"+G),style:"punc"},{name:"ANON",regex:new RegExp("^"+k),style:"punc"},{name:"PNAME_LN",regex:new RegExp("^"+m),style:"string-2"},{name:"PNAME_NS",regex:new RegExp("^"+f),style:"string-2"},{name:"BLANK_NODE_LABEL",regex:new RegExp("^"+t),style:"string-2"}]};return B}function i(e){var t=[],i=o[e];if(void 0!=i)for(var r in i)t.push(r.toString());else t.push(e);return t}function r(e,t){function r(){for(var t=null,i=0;i<E.length;++i)if(t=e.match(E[i].regex,!0,!1))return{cat:E[i].name,style:E[i].style,text:t[0]};return(t=e.match(s,!0,!1))?{cat:e.current().toUpperCase(),style:"keyword",text:t[0]}:(t=e.match(a,!0,!1))?{cat:e.current(),style:"punc",text:t[0]}:(t=e.match(/^.[A-Za-z0-9]*/,!0,!1),{cat:"<invalid_token>",style:"error",text:t[0]})}function n(){var i=e.column();t.errorStartPos=i,t.errorEndPos=i+c.text.length}function l(e){null==t.queryType&&("SELECT"==e||"CONSTRUCT"==e||"ASK"==e||"DESCRIBE"==e)&&(t.queryType=e)}function u(e){"disallowVars"==e?t.allowVars=!1:"allowVars"==e?t.allowVars=!0:"disallowBnodes"==e?t.allowBnodes=!1:"allowBnodes"==e?t.allowBnodes=!0:"storeProperty"==e&&(t.storeProperty=!0)}function p(e){return(t.allowVars||"var"!=e)&&(t.allowBnodes||"blankNode"!=e&&"blankNodePropertyList"!=e&&"blankNodePropertyListPath"!=e)}0==e.pos&&(t.possibleCurrent=t.possibleNext);var c=r();if("<invalid_token>"==c.cat)return 1==t.OK&&(t.OK=!1,n()),t.complete=!1,c.style;if("WS"==c.cat||"COMMENT"==c.cat)return t.possibleCurrent=t.possibleNext,c.style;for(var d,h=!1,f=c.cat;t.stack.length>0&&f&&t.OK&&!h;)if(d=t.stack.pop(),o[d]){var m=o[d][f];if(void 0!=m&&p(d)){for(var g=m.length-1;g>=0;--g)t.stack.push(m[g]);u(d)}else t.OK=!1,t.complete=!1,n(),t.stack.push(d)}else if(d==f){h=!0,l(d);for(var v=!0,x=t.stack.length;x>0;--x){var N=o[t.stack[x-1]];N&&N.$||(v=!1)}t.complete=v,t.storeProperty&&"punc"!=f.cat&&(t.lastProperty=c.text,t.storeProperty=!1)}else t.OK=!1,t.complete=!1,n();return!h&&t.OK&&(t.OK=!1,t.complete=!1,n()),t.possibleCurrent=t.possibleNext,t.possibleNext=i(t.stack[t.stack.length-1]),c.style}function n(t,i){var r=0,n=t.stack.length-1;if(/^[\}\]\)]/.test(i)){for(var o=i.substr(0,1);n>=0;--n)if(t.stack[n]==o){--n;break}}else{var s=h[t.stack[n]];s&&(r+=s,--n)}for(;n>=0;--n){var s=f[t.stack[n]];s&&(r+=s)}return r*e.indentUnit}var o=(e.indentUnit,{"*[&&,valueLogical]":{"&&":["[&&,valueLogical]","*[&&,valueLogical]"],AS:[],")":[],",":[],"||":[],";":[]},"*[,,expression]":{",":["[,,expression]","*[,,expression]"],")":[]},"*[,,objectPath]":{",":["[,,objectPath]","*[,,objectPath]"],".":[],";":[],"]":[],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"*[,,object]":{",":["[,,object]","*[,,object]"],".":[],";":[],"]":[],"}":[],GRAPH:[],"{":[],OPTIONAL:[],MINUS:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[]},"*[/,pathEltOrInverse]":{"/":["[/,pathEltOrInverse]","*[/,pathEltOrInverse]"],"|":[],")":[],"(":[],"[":[],VAR1:[],VAR2:[],NIL:[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[]},"*[;,?[or([verbPath,verbSimple]),objectList]]":{";":["[;,?[or([verbPath,verbSimple]),objectList]]","*[;,?[or([verbPath,verbSimple]),objectList]]"],".":[],"]":[],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"*[;,?[verb,objectList]]":{";":["[;,?[verb,objectList]]","*[;,?[verb,objectList]]"],".":[],"]":[],"}":[],GRAPH:[],"{":[],OPTIONAL:[],MINUS:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[]},"*[UNION,groupGraphPattern]":{UNION:["[UNION,groupGraphPattern]","*[UNION,groupGraphPattern]"],VAR1:[],VAR2:[],NIL:[],"(":[],"[":[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],".":[],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"*[graphPatternNotTriples,?.,?triplesBlock]":{"{":["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],OPTIONAL:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],MINUS:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],GRAPH:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],SERVICE:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],FILTER:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],BIND:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],VALUES:["[graphPatternNotTriples,?.,?triplesBlock]","*[graphPatternNotTriples,?.,?triplesBlock]"],"}":[]},"*[quadsNotTriples,?.,?triplesTemplate]":{GRAPH:["[quadsNotTriples,?.,?triplesTemplate]","*[quadsNotTriples,?.,?triplesTemplate]"],"}":[]},"*[|,pathOneInPropertySet]":{"|":["[|,pathOneInPropertySet]","*[|,pathOneInPropertySet]"],")":[]},"*[|,pathSequence]":{"|":["[|,pathSequence]","*[|,pathSequence]"],")":[],"(":[],"[":[],VAR1:[],VAR2:[],NIL:[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[]},"*[||,conditionalAndExpression]":{"||":["[||,conditionalAndExpression]","*[||,conditionalAndExpression]"],AS:[],")":[],",":[],";":[]},"*dataBlockValue":{UNDEF:["dataBlockValue","*dataBlockValue"],IRI_REF:["dataBlockValue","*dataBlockValue"],TRUE:["dataBlockValue","*dataBlockValue"],FALSE:["dataBlockValue","*dataBlockValue"],PNAME_LN:["dataBlockValue","*dataBlockValue"],PNAME_NS:["dataBlockValue","*dataBlockValue"],STRING_LITERAL1:["dataBlockValue","*dataBlockValue"],STRING_LITERAL2:["dataBlockValue","*dataBlockValue"],STRING_LITERAL_LONG1:["dataBlockValue","*dataBlockValue"],STRING_LITERAL_LONG2:["dataBlockValue","*dataBlockValue"],INTEGER:["dataBlockValue","*dataBlockValue"],DECIMAL:["dataBlockValue","*dataBlockValue"],DOUBLE:["dataBlockValue","*dataBlockValue"],INTEGER_POSITIVE:["dataBlockValue","*dataBlockValue"],DECIMAL_POSITIVE:["dataBlockValue","*dataBlockValue"],DOUBLE_POSITIVE:["dataBlockValue","*dataBlockValue"],INTEGER_NEGATIVE:["dataBlockValue","*dataBlockValue"],DECIMAL_NEGATIVE:["dataBlockValue","*dataBlockValue"],DOUBLE_NEGATIVE:["dataBlockValue","*dataBlockValue"],"}":[],")":[]},"*datasetClause":{FROM:["datasetClause","*datasetClause"],WHERE:[],"{":[]},"*describeDatasetClause":{FROM:["describeDatasetClause","*describeDatasetClause"],ORDER:[],HAVING:[],GROUP:[],LIMIT:[],OFFSET:[],WHERE:[],"{":[],VALUES:[],$:[]},"*graphNode":{"(":["graphNode","*graphNode"],"[":["graphNode","*graphNode"],VAR1:["graphNode","*graphNode"],VAR2:["graphNode","*graphNode"],NIL:["graphNode","*graphNode"],IRI_REF:["graphNode","*graphNode"],TRUE:["graphNode","*graphNode"],FALSE:["graphNode","*graphNode"],BLANK_NODE_LABEL:["graphNode","*graphNode"],ANON:["graphNode","*graphNode"],PNAME_LN:["graphNode","*graphNode"],PNAME_NS:["graphNode","*graphNode"],STRING_LITERAL1:["graphNode","*graphNode"],STRING_LITERAL2:["graphNode","*graphNode"],STRING_LITERAL_LONG1:["graphNode","*graphNode"],STRING_LITERAL_LONG2:["graphNode","*graphNode"],INTEGER:["graphNode","*graphNode"],DECIMAL:["graphNode","*graphNode"],DOUBLE:["graphNode","*graphNode"],INTEGER_POSITIVE:["graphNode","*graphNode"],DECIMAL_POSITIVE:["graphNode","*graphNode"],DOUBLE_POSITIVE:["graphNode","*graphNode"],INTEGER_NEGATIVE:["graphNode","*graphNode"],DECIMAL_NEGATIVE:["graphNode","*graphNode"],DOUBLE_NEGATIVE:["graphNode","*graphNode"],")":[]},"*graphNodePath":{"(":["graphNodePath","*graphNodePath"],"[":["graphNodePath","*graphNodePath"],VAR1:["graphNodePath","*graphNodePath"],VAR2:["graphNodePath","*graphNodePath"],NIL:["graphNodePath","*graphNodePath"],IRI_REF:["graphNodePath","*graphNodePath"],TRUE:["graphNodePath","*graphNodePath"],FALSE:["graphNodePath","*graphNodePath"],BLANK_NODE_LABEL:["graphNodePath","*graphNodePath"],ANON:["graphNodePath","*graphNodePath"],PNAME_LN:["graphNodePath","*graphNodePath"],PNAME_NS:["graphNodePath","*graphNodePath"],STRING_LITERAL1:["graphNodePath","*graphNodePath"],STRING_LITERAL2:["graphNodePath","*graphNodePath"],STRING_LITERAL_LONG1:["graphNodePath","*graphNodePath"],STRING_LITERAL_LONG2:["graphNodePath","*graphNodePath"],INTEGER:["graphNodePath","*graphNodePath"],DECIMAL:["graphNodePath","*graphNodePath"],DOUBLE:["graphNodePath","*graphNodePath"],INTEGER_POSITIVE:["graphNodePath","*graphNodePath"],DECIMAL_POSITIVE:["graphNodePath","*graphNodePath"],DOUBLE_POSITIVE:["graphNodePath","*graphNodePath"],INTEGER_NEGATIVE:["graphNodePath","*graphNodePath"],DECIMAL_NEGATIVE:["graphNodePath","*graphNodePath"],DOUBLE_NEGATIVE:["graphNodePath","*graphNodePath"],")":[]},"*groupCondition":{"(":["groupCondition","*groupCondition"],STR:["groupCondition","*groupCondition"],LANG:["groupCondition","*groupCondition"],LANGMATCHES:["groupCondition","*groupCondition"],DATATYPE:["groupCondition","*groupCondition"],BOUND:["groupCondition","*groupCondition"],IRI:["groupCondition","*groupCondition"],URI:["groupCondition","*groupCondition"],BNODE:["groupCondition","*groupCondition"],RAND:["groupCondition","*groupCondition"],ABS:["groupCondition","*groupCondition"],CEIL:["groupCondition","*groupCondition"],FLOOR:["groupCondition","*groupCondition"],ROUND:["groupCondition","*groupCondition"],CONCAT:["groupCondition","*groupCondition"],STRLEN:["groupCondition","*groupCondition"],UCASE:["groupCondition","*groupCondition"],LCASE:["groupCondition","*groupCondition"],ENCODE_FOR_URI:["groupCondition","*groupCondition"],CONTAINS:["groupCondition","*groupCondition"],STRSTARTS:["groupCondition","*groupCondition"],STRENDS:["groupCondition","*groupCondition"],STRBEFORE:["groupCondition","*groupCondition"],STRAFTER:["groupCondition","*groupCondition"],YEAR:["groupCondition","*groupCondition"],MONTH:["groupCondition","*groupCondition"],DAY:["groupCondition","*groupCondition"],HOURS:["groupCondition","*groupCondition"],MINUTES:["groupCondition","*groupCondition"],SECONDS:["groupCondition","*groupCondition"],TIMEZONE:["groupCondition","*groupCondition"],TZ:["groupCondition","*groupCondition"],NOW:["groupCondition","*groupCondition"],UUID:["groupCondition","*groupCondition"],STRUUID:["groupCondition","*groupCondition"],MD5:["groupCondition","*groupCondition"],SHA1:["groupCondition","*groupCondition"],SHA256:["groupCondition","*groupCondition"],SHA384:["groupCondition","*groupCondition"],SHA512:["groupCondition","*groupCondition"],COALESCE:["groupCondition","*groupCondition"],IF:["groupCondition","*groupCondition"],STRLANG:["groupCondition","*groupCondition"],STRDT:["groupCondition","*groupCondition"],SAMETERM:["groupCondition","*groupCondition"],ISIRI:["groupCondition","*groupCondition"],ISURI:["groupCondition","*groupCondition"],ISBLANK:["groupCondition","*groupCondition"],ISLITERAL:["groupCondition","*groupCondition"],ISNUMERIC:["groupCondition","*groupCondition"],VAR1:["groupCondition","*groupCondition"],VAR2:["groupCondition","*groupCondition"],SUBSTR:["groupCondition","*groupCondition"],REPLACE:["groupCondition","*groupCondition"],REGEX:["groupCondition","*groupCondition"],EXISTS:["groupCondition","*groupCondition"],NOT:["groupCondition","*groupCondition"],IRI_REF:["groupCondition","*groupCondition"],PNAME_LN:["groupCondition","*groupCondition"],PNAME_NS:["groupCondition","*groupCondition"],VALUES:[],LIMIT:[],OFFSET:[],ORDER:[],HAVING:[],$:[],"}":[]},"*havingCondition":{"(":["havingCondition","*havingCondition"],STR:["havingCondition","*havingCondition"],LANG:["havingCondition","*havingCondition"],LANGMATCHES:["havingCondition","*havingCondition"],DATATYPE:["havingCondition","*havingCondition"],BOUND:["havingCondition","*havingCondition"],IRI:["havingCondition","*havingCondition"],URI:["havingCondition","*havingCondition"],BNODE:["havingCondition","*havingCondition"],RAND:["havingCondition","*havingCondition"],ABS:["havingCondition","*havingCondition"],CEIL:["havingCondition","*havingCondition"],FLOOR:["havingCondition","*havingCondition"],ROUND:["havingCondition","*havingCondition"],CONCAT:["havingCondition","*havingCondition"],STRLEN:["havingCondition","*havingCondition"],UCASE:["havingCondition","*havingCondition"],LCASE:["havingCondition","*havingCondition"],ENCODE_FOR_URI:["havingCondition","*havingCondition"],CONTAINS:["havingCondition","*havingCondition"],STRSTARTS:["havingCondition","*havingCondition"],STRENDS:["havingCondition","*havingCondition"],STRBEFORE:["havingCondition","*havingCondition"],STRAFTER:["havingCondition","*havingCondition"],YEAR:["havingCondition","*havingCondition"],MONTH:["havingCondition","*havingCondition"],DAY:["havingCondition","*havingCondition"],HOURS:["havingCondition","*havingCondition"],MINUTES:["havingCondition","*havingCondition"],SECONDS:["havingCondition","*havingCondition"],TIMEZONE:["havingCondition","*havingCondition"],TZ:["havingCondition","*havingCondition"],NOW:["havingCondition","*havingCondition"],UUID:["havingCondition","*havingCondition"],STRUUID:["havingCondition","*havingCondition"],MD5:["havingCondition","*havingCondition"],SHA1:["havingCondition","*havingCondition"],SHA256:["havingCondition","*havingCondition"],SHA384:["havingCondition","*havingCondition"],SHA512:["havingCondition","*havingCondition"],COALESCE:["havingCondition","*havingCondition"],IF:["havingCondition","*havingCondition"],STRLANG:["havingCondition","*havingCondition"],STRDT:["havingCondition","*havingCondition"],SAMETERM:["havingCondition","*havingCondition"],ISIRI:["havingCondition","*havingCondition"],ISURI:["havingCondition","*havingCondition"],ISBLANK:["havingCondition","*havingCondition"],ISLITERAL:["havingCondition","*havingCondition"],ISNUMERIC:["havingCondition","*havingCondition"],SUBSTR:["havingCondition","*havingCondition"],REPLACE:["havingCondition","*havingCondition"],REGEX:["havingCondition","*havingCondition"],EXISTS:["havingCondition","*havingCondition"],NOT:["havingCondition","*havingCondition"],IRI_REF:["havingCondition","*havingCondition"],PNAME_LN:["havingCondition","*havingCondition"],PNAME_NS:["havingCondition","*havingCondition"],VALUES:[],LIMIT:[],OFFSET:[],ORDER:[],$:[],"}":[]},"*or([[ (,*dataBlockValue,)],NIL])":{"(":["or([[ (,*dataBlockValue,)],NIL])","*or([[ (,*dataBlockValue,)],NIL])"],NIL:["or([[ (,*dataBlockValue,)],NIL])","*or([[ (,*dataBlockValue,)],NIL])"],"}":[]},"*or([[*,unaryExpression],[/,unaryExpression]])":{"*":["or([[*,unaryExpression],[/,unaryExpression]])","*or([[*,unaryExpression],[/,unaryExpression]])"],"/":["or([[*,unaryExpression],[/,unaryExpression]])","*or([[*,unaryExpression],[/,unaryExpression]])"],AS:[],")":[],",":[],"||":[],"&&":[],"=":[],"!=":[],"<":[],">":[],"<=":[],">=":[],IN:[],NOT:[],"+":[],"-":[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],";":[]},"*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])":{"+":["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],"-":["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],INTEGER_POSITIVE:["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DECIMAL_POSITIVE:["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DOUBLE_POSITIVE:["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],INTEGER_NEGATIVE:["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DECIMAL_NEGATIVE:["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DOUBLE_NEGATIVE:["or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],AS:[],")":[],",":[],"||":[],"&&":[],"=":[],"!=":[],"<":[],">":[],"<=":[],">=":[],IN:[],NOT:[],";":[]},"*or([var,[ (,expression,AS,var,)]])":{"(":["or([var,[ (,expression,AS,var,)]])","*or([var,[ (,expression,AS,var,)]])"],VAR1:["or([var,[ (,expression,AS,var,)]])","*or([var,[ (,expression,AS,var,)]])"],VAR2:["or([var,[ (,expression,AS,var,)]])","*or([var,[ (,expression,AS,var,)]])"],WHERE:[],"{":[],FROM:[]},"*orderCondition":{ASC:["orderCondition","*orderCondition"],DESC:["orderCondition","*orderCondition"],VAR1:["orderCondition","*orderCondition"],VAR2:["orderCondition","*orderCondition"],"(":["orderCondition","*orderCondition"],STR:["orderCondition","*orderCondition"],LANG:["orderCondition","*orderCondition"],LANGMATCHES:["orderCondition","*orderCondition"],DATATYPE:["orderCondition","*orderCondition"],BOUND:["orderCondition","*orderCondition"],IRI:["orderCondition","*orderCondition"],URI:["orderCondition","*orderCondition"],BNODE:["orderCondition","*orderCondition"],RAND:["orderCondition","*orderCondition"],ABS:["orderCondition","*orderCondition"],CEIL:["orderCondition","*orderCondition"],FLOOR:["orderCondition","*orderCondition"],ROUND:["orderCondition","*orderCondition"],CONCAT:["orderCondition","*orderCondition"],STRLEN:["orderCondition","*orderCondition"],UCASE:["orderCondition","*orderCondition"],LCASE:["orderCondition","*orderCondition"],ENCODE_FOR_URI:["orderCondition","*orderCondition"],CONTAINS:["orderCondition","*orderCondition"],STRSTARTS:["orderCondition","*orderCondition"],STRENDS:["orderCondition","*orderCondition"],STRBEFORE:["orderCondition","*orderCondition"],STRAFTER:["orderCondition","*orderCondition"],YEAR:["orderCondition","*orderCondition"],MONTH:["orderCondition","*orderCondition"],DAY:["orderCondition","*orderCondition"],HOURS:["orderCondition","*orderCondition"],MINUTES:["orderCondition","*orderCondition"],SECONDS:["orderCondition","*orderCondition"],TIMEZONE:["orderCondition","*orderCondition"],TZ:["orderCondition","*orderCondition"],NOW:["orderCondition","*orderCondition"],UUID:["orderCondition","*orderCondition"],STRUUID:["orderCondition","*orderCondition"],MD5:["orderCondition","*orderCondition"],SHA1:["orderCondition","*orderCondition"],SHA256:["orderCondition","*orderCondition"],SHA384:["orderCondition","*orderCondition"],SHA512:["orderCondition","*orderCondition"],COALESCE:["orderCondition","*orderCondition"],IF:["orderCondition","*orderCondition"],STRLANG:["orderCondition","*orderCondition"],STRDT:["orderCondition","*orderCondition"],SAMETERM:["orderCondition","*orderCondition"],ISIRI:["orderCondition","*orderCondition"],ISURI:["orderCondition","*orderCondition"],ISBLANK:["orderCondition","*orderCondition"],ISLITERAL:["orderCondition","*orderCondition"],ISNUMERIC:["orderCondition","*orderCondition"],SUBSTR:["orderCondition","*orderCondition"],REPLACE:["orderCondition","*orderCondition"],REGEX:["orderCondition","*orderCondition"],EXISTS:["orderCondition","*orderCondition"],NOT:["orderCondition","*orderCondition"],IRI_REF:["orderCondition","*orderCondition"],PNAME_LN:["orderCondition","*orderCondition"],PNAME_NS:["orderCondition","*orderCondition"],VALUES:[],LIMIT:[],OFFSET:[],$:[],"}":[]},"*prefixDecl":{PREFIX:["prefixDecl","*prefixDecl"],$:[],CONSTRUCT:[],DESCRIBE:[],ASK:[],INSERT:[],DELETE:[],SELECT:[],LOAD:[],CLEAR:[],DROP:[],ADD:[],MOVE:[],COPY:[],CREATE:[],WITH:[]},"*usingClause":{USING:["usingClause","*usingClause"],WHERE:[]},"*var":{VAR1:["var","*var"],VAR2:["var","*var"],")":[]},"*varOrIRIref":{VAR1:["varOrIRIref","*varOrIRIref"],VAR2:["varOrIRIref","*varOrIRIref"],IRI_REF:["varOrIRIref","*varOrIRIref"],PNAME_LN:["varOrIRIref","*varOrIRIref"],PNAME_NS:["varOrIRIref","*varOrIRIref"],ORDER:[],HAVING:[],GROUP:[],LIMIT:[],OFFSET:[],WHERE:[],"{":[],FROM:[],VALUES:[],$:[]},"+graphNode":{"(":["graphNode","*graphNode"],"[":["graphNode","*graphNode"],VAR1:["graphNode","*graphNode"],VAR2:["graphNode","*graphNode"],NIL:["graphNode","*graphNode"],IRI_REF:["graphNode","*graphNode"],TRUE:["graphNode","*graphNode"],FALSE:["graphNode","*graphNode"],BLANK_NODE_LABEL:["graphNode","*graphNode"],ANON:["graphNode","*graphNode"],PNAME_LN:["graphNode","*graphNode"],PNAME_NS:["graphNode","*graphNode"],STRING_LITERAL1:["graphNode","*graphNode"],STRING_LITERAL2:["graphNode","*graphNode"],STRING_LITERAL_LONG1:["graphNode","*graphNode"],STRING_LITERAL_LONG2:["graphNode","*graphNode"],INTEGER:["graphNode","*graphNode"],DECIMAL:["graphNode","*graphNode"],DOUBLE:["graphNode","*graphNode"],INTEGER_POSITIVE:["graphNode","*graphNode"],DECIMAL_POSITIVE:["graphNode","*graphNode"],DOUBLE_POSITIVE:["graphNode","*graphNode"],INTEGER_NEGATIVE:["graphNode","*graphNode"],DECIMAL_NEGATIVE:["graphNode","*graphNode"],DOUBLE_NEGATIVE:["graphNode","*graphNode"]},"+graphNodePath":{"(":["graphNodePath","*graphNodePath"],"[":["graphNodePath","*graphNodePath"],VAR1:["graphNodePath","*graphNodePath"],VAR2:["graphNodePath","*graphNodePath"],NIL:["graphNodePath","*graphNodePath"],IRI_REF:["graphNodePath","*graphNodePath"],TRUE:["graphNodePath","*graphNodePath"],FALSE:["graphNodePath","*graphNodePath"],BLANK_NODE_LABEL:["graphNodePath","*graphNodePath"],ANON:["graphNodePath","*graphNodePath"],PNAME_LN:["graphNodePath","*graphNodePath"],PNAME_NS:["graphNodePath","*graphNodePath"],STRING_LITERAL1:["graphNodePath","*graphNodePath"],STRING_LITERAL2:["graphNodePath","*graphNodePath"],STRING_LITERAL_LONG1:["graphNodePath","*graphNodePath"],STRING_LITERAL_LONG2:["graphNodePath","*graphNodePath"],INTEGER:["graphNodePath","*graphNodePath"],DECIMAL:["graphNodePath","*graphNodePath"],DOUBLE:["graphNodePath","*graphNodePath"],INTEGER_POSITIVE:["graphNodePath","*graphNodePath"],DECIMAL_POSITIVE:["graphNodePath","*graphNodePath"],DOUBLE_POSITIVE:["graphNodePath","*graphNodePath"],INTEGER_NEGATIVE:["graphNodePath","*graphNodePath"],DECIMAL_NEGATIVE:["graphNodePath","*graphNodePath"],DOUBLE_NEGATIVE:["graphNodePath","*graphNodePath"]},"+groupCondition":{"(":["groupCondition","*groupCondition"],STR:["groupCondition","*groupCondition"],LANG:["groupCondition","*groupCondition"],LANGMATCHES:["groupCondition","*groupCondition"],DATATYPE:["groupCondition","*groupCondition"],BOUND:["groupCondition","*groupCondition"],IRI:["groupCondition","*groupCondition"],URI:["groupCondition","*groupCondition"],BNODE:["groupCondition","*groupCondition"],RAND:["groupCondition","*groupCondition"],ABS:["groupCondition","*groupCondition"],CEIL:["groupCondition","*groupCondition"],FLOOR:["groupCondition","*groupCondition"],ROUND:["groupCondition","*groupCondition"],CONCAT:["groupCondition","*groupCondition"],STRLEN:["groupCondition","*groupCondition"],UCASE:["groupCondition","*groupCondition"],LCASE:["groupCondition","*groupCondition"],ENCODE_FOR_URI:["groupCondition","*groupCondition"],CONTAINS:["groupCondition","*groupCondition"],STRSTARTS:["groupCondition","*groupCondition"],STRENDS:["groupCondition","*groupCondition"],STRBEFORE:["groupCondition","*groupCondition"],STRAFTER:["groupCondition","*groupCondition"],YEAR:["groupCondition","*groupCondition"],MONTH:["groupCondition","*groupCondition"],DAY:["groupCondition","*groupCondition"],HOURS:["groupCondition","*groupCondition"],MINUTES:["groupCondition","*groupCondition"],SECONDS:["groupCondition","*groupCondition"],TIMEZONE:["groupCondition","*groupCondition"],TZ:["groupCondition","*groupCondition"],NOW:["groupCondition","*groupCondition"],UUID:["groupCondition","*groupCondition"],STRUUID:["groupCondition","*groupCondition"],MD5:["groupCondition","*groupCondition"],SHA1:["groupCondition","*groupCondition"],SHA256:["groupCondition","*groupCondition"],SHA384:["groupCondition","*groupCondition"],SHA512:["groupCondition","*groupCondition"],COALESCE:["groupCondition","*groupCondition"],IF:["groupCondition","*groupCondition"],STRLANG:["groupCondition","*groupCondition"],STRDT:["groupCondition","*groupCondition"],SAMETERM:["groupCondition","*groupCondition"],ISIRI:["groupCondition","*groupCondition"],ISURI:["groupCondition","*groupCondition"],ISBLANK:["groupCondition","*groupCondition"],ISLITERAL:["groupCondition","*groupCondition"],ISNUMERIC:["groupCondition","*groupCondition"],VAR1:["groupCondition","*groupCondition"],VAR2:["groupCondition","*groupCondition"],SUBSTR:["groupCondition","*groupCondition"],REPLACE:["groupCondition","*groupCondition"],REGEX:["groupCondition","*groupCondition"],EXISTS:["groupCondition","*groupCondition"],NOT:["groupCondition","*groupCondition"],IRI_REF:["groupCondition","*groupCondition"],PNAME_LN:["groupCondition","*groupCondition"],PNAME_NS:["groupCondition","*groupCondition"]},"+havingCondition":{"(":["havingCondition","*havingCondition"],STR:["havingCondition","*havingCondition"],LANG:["havingCondition","*havingCondition"],LANGMATCHES:["havingCondition","*havingCondition"],DATATYPE:["havingCondition","*havingCondition"],BOUND:["havingCondition","*havingCondition"],IRI:["havingCondition","*havingCondition"],URI:["havingCondition","*havingCondition"],BNODE:["havingCondition","*havingCondition"],RAND:["havingCondition","*havingCondition"],ABS:["havingCondition","*havingCondition"],CEIL:["havingCondition","*havingCondition"],FLOOR:["havingCondition","*havingCondition"],ROUND:["havingCondition","*havingCondition"],CONCAT:["havingCondition","*havingCondition"],STRLEN:["havingCondition","*havingCondition"],UCASE:["havingCondition","*havingCondition"],LCASE:["havingCondition","*havingCondition"],ENCODE_FOR_URI:["havingCondition","*havingCondition"],CONTAINS:["havingCondition","*havingCondition"],STRSTARTS:["havingCondition","*havingCondition"],STRENDS:["havingCondition","*havingCondition"],STRBEFORE:["havingCondition","*havingCondition"],STRAFTER:["havingCondition","*havingCondition"],YEAR:["havingCondition","*havingCondition"],MONTH:["havingCondition","*havingCondition"],DAY:["havingCondition","*havingCondition"],HOURS:["havingCondition","*havingCondition"],MINUTES:["havingCondition","*havingCondition"],SECONDS:["havingCondition","*havingCondition"],TIMEZONE:["havingCondition","*havingCondition"],TZ:["havingCondition","*havingCondition"],NOW:["havingCondition","*havingCondition"],UUID:["havingCondition","*havingCondition"],STRUUID:["havingCondition","*havingCondition"],MD5:["havingCondition","*havingCondition"],SHA1:["havingCondition","*havingCondition"],SHA256:["havingCondition","*havingCondition"],SHA384:["havingCondition","*havingCondition"],SHA512:["havingCondition","*havingCondition"],COALESCE:["havingCondition","*havingCondition"],IF:["havingCondition","*havingCondition"],STRLANG:["havingCondition","*havingCondition"],STRDT:["havingCondition","*havingCondition"],SAMETERM:["havingCondition","*havingCondition"],ISIRI:["havingCondition","*havingCondition"],ISURI:["havingCondition","*havingCondition"],ISBLANK:["havingCondition","*havingCondition"],ISLITERAL:["havingCondition","*havingCondition"],ISNUMERIC:["havingCondition","*havingCondition"],SUBSTR:["havingCondition","*havingCondition"],REPLACE:["havingCondition","*havingCondition"],REGEX:["havingCondition","*havingCondition"],EXISTS:["havingCondition","*havingCondition"],NOT:["havingCondition","*havingCondition"],IRI_REF:["havingCondition","*havingCondition"],PNAME_LN:["havingCondition","*havingCondition"],PNAME_NS:["havingCondition","*havingCondition"]},"+or([var,[ (,expression,AS,var,)]])":{"(":["or([var,[ (,expression,AS,var,)]])","*or([var,[ (,expression,AS,var,)]])"],VAR1:["or([var,[ (,expression,AS,var,)]])","*or([var,[ (,expression,AS,var,)]])"],VAR2:["or([var,[ (,expression,AS,var,)]])","*or([var,[ (,expression,AS,var,)]])"]},"+orderCondition":{ASC:["orderCondition","*orderCondition"],DESC:["orderCondition","*orderCondition"],VAR1:["orderCondition","*orderCondition"],VAR2:["orderCondition","*orderCondition"],"(":["orderCondition","*orderCondition"],STR:["orderCondition","*orderCondition"],LANG:["orderCondition","*orderCondition"],LANGMATCHES:["orderCondition","*orderCondition"],DATATYPE:["orderCondition","*orderCondition"],BOUND:["orderCondition","*orderCondition"],IRI:["orderCondition","*orderCondition"],URI:["orderCondition","*orderCondition"],BNODE:["orderCondition","*orderCondition"],RAND:["orderCondition","*orderCondition"],ABS:["orderCondition","*orderCondition"],CEIL:["orderCondition","*orderCondition"],FLOOR:["orderCondition","*orderCondition"],ROUND:["orderCondition","*orderCondition"],CONCAT:["orderCondition","*orderCondition"],STRLEN:["orderCondition","*orderCondition"],UCASE:["orderCondition","*orderCondition"],LCASE:["orderCondition","*orderCondition"],ENCODE_FOR_URI:["orderCondition","*orderCondition"],CONTAINS:["orderCondition","*orderCondition"],STRSTARTS:["orderCondition","*orderCondition"],STRENDS:["orderCondition","*orderCondition"],STRBEFORE:["orderCondition","*orderCondition"],STRAFTER:["orderCondition","*orderCondition"],YEAR:["orderCondition","*orderCondition"],MONTH:["orderCondition","*orderCondition"],DAY:["orderCondition","*orderCondition"],HOURS:["orderCondition","*orderCondition"],MINUTES:["orderCondition","*orderCondition"],SECONDS:["orderCondition","*orderCondition"],TIMEZONE:["orderCondition","*orderCondition"],TZ:["orderCondition","*orderCondition"],NOW:["orderCondition","*orderCondition"],UUID:["orderCondition","*orderCondition"],STRUUID:["orderCondition","*orderCondition"],MD5:["orderCondition","*orderCondition"],SHA1:["orderCondition","*orderCondition"],SHA256:["orderCondition","*orderCondition"],SHA384:["orderCondition","*orderCondition"],SHA512:["orderCondition","*orderCondition"],COALESCE:["orderCondition","*orderCondition"],IF:["orderCondition","*orderCondition"],STRLANG:["orderCondition","*orderCondition"],STRDT:["orderCondition","*orderCondition"],SAMETERM:["orderCondition","*orderCondition"],ISIRI:["orderCondition","*orderCondition"],ISURI:["orderCondition","*orderCondition"],ISBLANK:["orderCondition","*orderCondition"],ISLITERAL:["orderCondition","*orderCondition"],ISNUMERIC:["orderCondition","*orderCondition"],SUBSTR:["orderCondition","*orderCondition"],REPLACE:["orderCondition","*orderCondition"],REGEX:["orderCondition","*orderCondition"],EXISTS:["orderCondition","*orderCondition"],NOT:["orderCondition","*orderCondition"],IRI_REF:["orderCondition","*orderCondition"],PNAME_LN:["orderCondition","*orderCondition"],PNAME_NS:["orderCondition","*orderCondition"]},"+varOrIRIref":{VAR1:["varOrIRIref","*varOrIRIref"],VAR2:["varOrIRIref","*varOrIRIref"],IRI_REF:["varOrIRIref","*varOrIRIref"],PNAME_LN:["varOrIRIref","*varOrIRIref"],PNAME_NS:["varOrIRIref","*varOrIRIref"]},"?.":{".":["."],VAR1:[],VAR2:[],NIL:[],"(":[],"[":[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],GRAPH:[],"{":[],OPTIONAL:[],MINUS:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"?DISTINCT":{DISTINCT:["DISTINCT"],"!":[],"+":[],"-":[],VAR1:[],VAR2:[],"(":[],STR:[],LANG:[],LANGMATCHES:[],DATATYPE:[],BOUND:[],IRI:[],URI:[],BNODE:[],RAND:[],ABS:[],CEIL:[],FLOOR:[],ROUND:[],CONCAT:[],STRLEN:[],UCASE:[],LCASE:[],ENCODE_FOR_URI:[],CONTAINS:[],STRSTARTS:[],STRENDS:[],STRBEFORE:[],STRAFTER:[],YEAR:[],MONTH:[],DAY:[],HOURS:[],MINUTES:[],SECONDS:[],TIMEZONE:[],TZ:[],NOW:[],UUID:[],STRUUID:[],MD5:[],SHA1:[],SHA256:[],SHA384:[],SHA512:[],COALESCE:[],IF:[],STRLANG:[],STRDT:[],SAMETERM:[],ISIRI:[],ISURI:[],ISBLANK:[],ISLITERAL:[],ISNUMERIC:[],TRUE:[],FALSE:[],COUNT:[],SUM:[],MIN:[],MAX:[],AVG:[],SAMPLE:[],GROUP_CONCAT:[],SUBSTR:[],REPLACE:[],REGEX:[],EXISTS:[],NOT:[],IRI_REF:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],PNAME_LN:[],PNAME_NS:[],"*":[]},"?GRAPH":{GRAPH:["GRAPH"],IRI_REF:[],PNAME_LN:[],PNAME_NS:[]},"?SILENT":{SILENT:["SILENT"],VAR1:[],VAR2:[],IRI_REF:[],PNAME_LN:[],PNAME_NS:[]},"?SILENT_1":{SILENT:["SILENT"],IRI_REF:[],PNAME_LN:[],PNAME_NS:[]},"?SILENT_2":{SILENT:["SILENT"],GRAPH:[],DEFAULT:[],NAMED:[],ALL:[]},"?SILENT_3":{SILENT:["SILENT"],GRAPH:[]},"?SILENT_4":{SILENT:["SILENT"],DEFAULT:[],GRAPH:[],IRI_REF:[],PNAME_LN:[],PNAME_NS:[]},"?WHERE":{WHERE:["WHERE"],"{":[]},"?[,,expression]":{",":["[,,expression]"],")":[]},"?[.,?constructTriples]":{".":["[.,?constructTriples]"],"}":[]},"?[.,?triplesBlock]":{".":["[.,?triplesBlock]"],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"?[.,?triplesTemplate]":{".":["[.,?triplesTemplate]"],"}":[],GRAPH:[]},"?[;,SEPARATOR,=,string]":{";":["[;,SEPARATOR,=,string]"],")":[]},"?[;,update]":{";":["[;,update]"],$:[]},"?[AS,var]":{AS:["[AS,var]"],")":[]},"?[INTO,graphRef]":{INTO:["[INTO,graphRef]"],";":[],$:[]},"?[or([verbPath,verbSimple]),objectList]":{VAR1:["[or([verbPath,verbSimple]),objectList]"],VAR2:["[or([verbPath,verbSimple]),objectList]"],"^":["[or([verbPath,verbSimple]),objectList]"],a:["[or([verbPath,verbSimple]),objectList]"],"!":["[or([verbPath,verbSimple]),objectList]"],"(":["[or([verbPath,verbSimple]),objectList]"],IRI_REF:["[or([verbPath,verbSimple]),objectList]"],PNAME_LN:["[or([verbPath,verbSimple]),objectList]"],PNAME_NS:["[or([verbPath,verbSimple]),objectList]"],";":[],".":[],"]":[],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"?[pathOneInPropertySet,*[|,pathOneInPropertySet]]":{a:["[pathOneInPropertySet,*[|,pathOneInPropertySet]]"],"^":["[pathOneInPropertySet,*[|,pathOneInPropertySet]]"],IRI_REF:["[pathOneInPropertySet,*[|,pathOneInPropertySet]]"],PNAME_LN:["[pathOneInPropertySet,*[|,pathOneInPropertySet]]"],PNAME_NS:["[pathOneInPropertySet,*[|,pathOneInPropertySet]]"],")":[]},"?[update1,?[;,update]]":{INSERT:["[update1,?[;,update]]"],DELETE:["[update1,?[;,update]]"],LOAD:["[update1,?[;,update]]"],CLEAR:["[update1,?[;,update]]"],DROP:["[update1,?[;,update]]"],ADD:["[update1,?[;,update]]"],MOVE:["[update1,?[;,update]]"],COPY:["[update1,?[;,update]]"],CREATE:["[update1,?[;,update]]"],WITH:["[update1,?[;,update]]"],$:[]},"?[verb,objectList]":{a:["[verb,objectList]"],VAR1:["[verb,objectList]"],VAR2:["[verb,objectList]"],IRI_REF:["[verb,objectList]"],PNAME_LN:["[verb,objectList]"],PNAME_NS:["[verb,objectList]"],";":[],".":[],"]":[],"}":[],GRAPH:[],"{":[],OPTIONAL:[],MINUS:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[]},"?argList":{NIL:["argList"],"(":["argList"],AS:[],")":[],",":[],"||":[],"&&":[],"=":[],"!=":[],"<":[],">":[],"<=":[],">=":[],IN:[],NOT:[],"+":[],"-":[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],"*":[],"/":[],";":[]},"?baseDecl":{BASE:["baseDecl"],$:[],CONSTRUCT:[],DESCRIBE:[],ASK:[],INSERT:[],DELETE:[],SELECT:[],LOAD:[],CLEAR:[],DROP:[],ADD:[],MOVE:[],COPY:[],CREATE:[],WITH:[],PREFIX:[]},"?constructTriples":{VAR1:["constructTriples"],VAR2:["constructTriples"],NIL:["constructTriples"],"(":["constructTriples"],"[":["constructTriples"],IRI_REF:["constructTriples"],TRUE:["constructTriples"],FALSE:["constructTriples"],BLANK_NODE_LABEL:["constructTriples"],ANON:["constructTriples"],PNAME_LN:["constructTriples"],PNAME_NS:["constructTriples"],STRING_LITERAL1:["constructTriples"],STRING_LITERAL2:["constructTriples"],STRING_LITERAL_LONG1:["constructTriples"],STRING_LITERAL_LONG2:["constructTriples"],INTEGER:["constructTriples"],DECIMAL:["constructTriples"],DOUBLE:["constructTriples"],INTEGER_POSITIVE:["constructTriples"],DECIMAL_POSITIVE:["constructTriples"],DOUBLE_POSITIVE:["constructTriples"],INTEGER_NEGATIVE:["constructTriples"],DECIMAL_NEGATIVE:["constructTriples"],DOUBLE_NEGATIVE:["constructTriples"],"}":[]},"?groupClause":{GROUP:["groupClause"],VALUES:[],LIMIT:[],OFFSET:[],ORDER:[],HAVING:[],$:[],"}":[]},"?havingClause":{HAVING:["havingClause"],VALUES:[],LIMIT:[],OFFSET:[],ORDER:[],$:[],"}":[]},"?insertClause":{INSERT:["insertClause"],WHERE:[],USING:[]},"?limitClause":{LIMIT:["limitClause"],VALUES:[],$:[],"}":[]},"?limitOffsetClauses":{LIMIT:["limitOffsetClauses"],OFFSET:["limitOffsetClauses"],VALUES:[],$:[],"}":[]},"?offsetClause":{OFFSET:["offsetClause"],VALUES:[],$:[],"}":[]},"?or([DISTINCT,REDUCED])":{DISTINCT:["or([DISTINCT,REDUCED])"],REDUCED:["or([DISTINCT,REDUCED])"],"*":[],"(":[],VAR1:[],VAR2:[]},"?or([LANGTAG,[^^,iriRef]])":{LANGTAG:["or([LANGTAG,[^^,iriRef]])"],"^^":["or([LANGTAG,[^^,iriRef]])"],UNDEF:[],IRI_REF:[],TRUE:[],FALSE:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],a:[],VAR1:[],VAR2:[],"^":[],"!":[],"(":[],".":[],";":[],",":[],AS:[],")":[],"||":[],"&&":[],"=":[],"!=":[],"<":[],">":[],"<=":[],">=":[],IN:[],NOT:[],"+":[],"-":[],"*":[],"/":[],"}":[],"[":[],NIL:[],BLANK_NODE_LABEL:[],ANON:[],"]":[],GRAPH:[],"{":[],OPTIONAL:[],MINUS:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[]},"?or([[*,unaryExpression],[/,unaryExpression]])":{"*":["or([[*,unaryExpression],[/,unaryExpression]])"],"/":["or([[*,unaryExpression],[/,unaryExpression]])"],"+":[],"-":[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[],AS:[],")":[],",":[],"||":[],"&&":[],"=":[],"!=":[],"<":[],">":[],"<=":[],">=":[],IN:[],NOT:[],";":[]},"?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])":{"=":["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],"!=":["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],"<":["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],">":["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],"<=":["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],">=":["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],IN:["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],NOT:["or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],AS:[],")":[],",":[],"||":[],"&&":[],";":[]},"?orderClause":{ORDER:["orderClause"],VALUES:[],LIMIT:[],OFFSET:[],$:[],"}":[]},"?pathMod":{"*":["pathMod"],"?":["pathMod"],"+":["pathMod"],"{":["pathMod"],"|":[],"/":[],")":[],"(":[],"[":[],VAR1:[],VAR2:[],NIL:[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[]},"?triplesBlock":{VAR1:["triplesBlock"],VAR2:["triplesBlock"],NIL:["triplesBlock"],"(":["triplesBlock"],"[":["triplesBlock"],IRI_REF:["triplesBlock"],TRUE:["triplesBlock"],FALSE:["triplesBlock"],BLANK_NODE_LABEL:["triplesBlock"],ANON:["triplesBlock"],PNAME_LN:["triplesBlock"],PNAME_NS:["triplesBlock"],STRING_LITERAL1:["triplesBlock"],STRING_LITERAL2:["triplesBlock"],STRING_LITERAL_LONG1:["triplesBlock"],STRING_LITERAL_LONG2:["triplesBlock"],INTEGER:["triplesBlock"],DECIMAL:["triplesBlock"],DOUBLE:["triplesBlock"],INTEGER_POSITIVE:["triplesBlock"],DECIMAL_POSITIVE:["triplesBlock"],DOUBLE_POSITIVE:["triplesBlock"],INTEGER_NEGATIVE:["triplesBlock"],DECIMAL_NEGATIVE:["triplesBlock"],DOUBLE_NEGATIVE:["triplesBlock"],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},"?triplesTemplate":{VAR1:["triplesTemplate"],VAR2:["triplesTemplate"],NIL:["triplesTemplate"],"(":["triplesTemplate"],"[":["triplesTemplate"],IRI_REF:["triplesTemplate"],TRUE:["triplesTemplate"],FALSE:["triplesTemplate"],BLANK_NODE_LABEL:["triplesTemplate"],ANON:["triplesTemplate"],PNAME_LN:["triplesTemplate"],PNAME_NS:["triplesTemplate"],STRING_LITERAL1:["triplesTemplate"],STRING_LITERAL2:["triplesTemplate"],STRING_LITERAL_LONG1:["triplesTemplate"],STRING_LITERAL_LONG2:["triplesTemplate"],INTEGER:["triplesTemplate"],DECIMAL:["triplesTemplate"],DOUBLE:["triplesTemplate"],INTEGER_POSITIVE:["triplesTemplate"],DECIMAL_POSITIVE:["triplesTemplate"],DOUBLE_POSITIVE:["triplesTemplate"],INTEGER_NEGATIVE:["triplesTemplate"],DECIMAL_NEGATIVE:["triplesTemplate"],DOUBLE_NEGATIVE:["triplesTemplate"],"}":[],GRAPH:[]},"?whereClause":{WHERE:["whereClause"],"{":["whereClause"],ORDER:[],HAVING:[],GROUP:[],LIMIT:[],OFFSET:[],VALUES:[],$:[]},"[ (,*dataBlockValue,)]":{"(":["(","*dataBlockValue",")"]},"[ (,*var,)]":{"(":["(","*var",")"]},"[ (,expression,)]":{"(":["(","expression",")"]},"[ (,expression,AS,var,)]":{"(":["(","expression","AS","var",")"]},"[!=,numericExpression]":{"!=":["!=","numericExpression"]},"[&&,valueLogical]":{"&&":["&&","valueLogical"]},"[*,unaryExpression]":{"*":["*","unaryExpression"]},"[*datasetClause,WHERE,{,?triplesTemplate,},solutionModifier]":{WHERE:["*datasetClause","WHERE","{","?triplesTemplate","}","solutionModifier"],FROM:["*datasetClause","WHERE","{","?triplesTemplate","}","solutionModifier"]},"[+,multiplicativeExpression]":{"+":["+","multiplicativeExpression"]},"[,,expression]":{",":[",","expression"]},"[,,integer,}]":{",":[",","integer","}"]},"[,,objectPath]":{",":[",","objectPath"]},"[,,object]":{",":[",","object"]},"[,,or([},[integer,}]])]":{",":[",","or([},[integer,}]])"]},"[-,multiplicativeExpression]":{"-":["-","multiplicativeExpression"]},"[.,?constructTriples]":{".":[".","?constructTriples"]},"[.,?triplesBlock]":{".":[".","?triplesBlock"]},"[.,?triplesTemplate]":{".":[".","?triplesTemplate"]},"[/,pathEltOrInverse]":{"/":["/","pathEltOrInverse"]},"[/,unaryExpression]":{"/":["/","unaryExpression"]},"[;,?[or([verbPath,verbSimple]),objectList]]":{";":[";","?[or([verbPath,verbSimple]),objectList]"]},"[;,?[verb,objectList]]":{";":[";","?[verb,objectList]"]},"[;,SEPARATOR,=,string]":{";":[";","SEPARATOR","=","string"]},"[;,update]":{";":[";","update"]},"[<,numericExpression]":{"<":["<","numericExpression"]},"[<=,numericExpression]":{"<=":["<=","numericExpression"]},"[=,numericExpression]":{"=":["=","numericExpression"]},"[>,numericExpression]":{">":[">","numericExpression"]},"[>=,numericExpression]":{">=":[">=","numericExpression"]},"[AS,var]":{AS:["AS","var"]},"[IN,expressionList]":{IN:["IN","expressionList"]},"[INTO,graphRef]":{INTO:["INTO","graphRef"]},"[NAMED,iriRef]":{NAMED:["NAMED","iriRef"]},"[NOT,IN,expressionList]":{NOT:["NOT","IN","expressionList"]},"[UNION,groupGraphPattern]":{UNION:["UNION","groupGraphPattern"]},"[^^,iriRef]":{"^^":["^^","iriRef"]},"[constructTemplate,*datasetClause,whereClause,solutionModifier]":{"{":["constructTemplate","*datasetClause","whereClause","solutionModifier"]},"[deleteClause,?insertClause]":{DELETE:["deleteClause","?insertClause"]},"[graphPatternNotTriples,?.,?triplesBlock]":{"{":["graphPatternNotTriples","?.","?triplesBlock"],OPTIONAL:["graphPatternNotTriples","?.","?triplesBlock"],MINUS:["graphPatternNotTriples","?.","?triplesBlock"],GRAPH:["graphPatternNotTriples","?.","?triplesBlock"],SERVICE:["graphPatternNotTriples","?.","?triplesBlock"],FILTER:["graphPatternNotTriples","?.","?triplesBlock"],BIND:["graphPatternNotTriples","?.","?triplesBlock"],VALUES:["graphPatternNotTriples","?.","?triplesBlock"]},"[integer,or([[,,or([},[integer,}]])],}])]":{INTEGER:["integer","or([[,,or([},[integer,}]])],}])"]},"[integer,}]":{INTEGER:["integer","}"]},"[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]":{INTEGER_POSITIVE:["or([numericLiteralPositive,numericLiteralNegative])","?or([[*,unaryExpression],[/,unaryExpression]])"],DECIMAL_POSITIVE:["or([numericLiteralPositive,numericLiteralNegative])","?or([[*,unaryExpression],[/,unaryExpression]])"],DOUBLE_POSITIVE:["or([numericLiteralPositive,numericLiteralNegative])","?or([[*,unaryExpression],[/,unaryExpression]])"],INTEGER_NEGATIVE:["or([numericLiteralPositive,numericLiteralNegative])","?or([[*,unaryExpression],[/,unaryExpression]])"],DECIMAL_NEGATIVE:["or([numericLiteralPositive,numericLiteralNegative])","?or([[*,unaryExpression],[/,unaryExpression]])"],DOUBLE_NEGATIVE:["or([numericLiteralPositive,numericLiteralNegative])","?or([[*,unaryExpression],[/,unaryExpression]])"]},"[or([verbPath,verbSimple]),objectList]":{VAR1:["or([verbPath,verbSimple])","objectList"],VAR2:["or([verbPath,verbSimple])","objectList"],"^":["or([verbPath,verbSimple])","objectList"],a:["or([verbPath,verbSimple])","objectList"],"!":["or([verbPath,verbSimple])","objectList"],"(":["or([verbPath,verbSimple])","objectList"],IRI_REF:["or([verbPath,verbSimple])","objectList"],PNAME_LN:["or([verbPath,verbSimple])","objectList"],PNAME_NS:["or([verbPath,verbSimple])","objectList"]},"[pathOneInPropertySet,*[|,pathOneInPropertySet]]":{a:["pathOneInPropertySet","*[|,pathOneInPropertySet]"],"^":["pathOneInPropertySet","*[|,pathOneInPropertySet]"],IRI_REF:["pathOneInPropertySet","*[|,pathOneInPropertySet]"],PNAME_LN:["pathOneInPropertySet","*[|,pathOneInPropertySet]"],PNAME_NS:["pathOneInPropertySet","*[|,pathOneInPropertySet]"]},"[quadsNotTriples,?.,?triplesTemplate]":{GRAPH:["quadsNotTriples","?.","?triplesTemplate"]},"[update1,?[;,update]]":{INSERT:["update1","?[;,update]"],DELETE:["update1","?[;,update]"],LOAD:["update1","?[;,update]"],CLEAR:["update1","?[;,update]"],DROP:["update1","?[;,update]"],ADD:["update1","?[;,update]"],MOVE:["update1","?[;,update]"],COPY:["update1","?[;,update]"],CREATE:["update1","?[;,update]"],WITH:["update1","?[;,update]"]},"[verb,objectList]":{a:["verb","objectList"],VAR1:["verb","objectList"],VAR2:["verb","objectList"],IRI_REF:["verb","objectList"],PNAME_LN:["verb","objectList"],PNAME_NS:["verb","objectList"]},"[|,pathOneInPropertySet]":{"|":["|","pathOneInPropertySet"]},"[|,pathSequence]":{"|":["|","pathSequence"]},"[||,conditionalAndExpression]":{"||":["||","conditionalAndExpression"]},add:{ADD:["ADD","?SILENT_4","graphOrDefault","TO","graphOrDefault"]},additiveExpression:{"!":["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],"+":["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],"-":["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],VAR1:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],VAR2:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],"(":["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STR:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],LANG:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],LANGMATCHES:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DATATYPE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],BOUND:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],IRI:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],URI:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],BNODE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],RAND:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ABS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],CEIL:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],FLOOR:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ROUND:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],CONCAT:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRLEN:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],UCASE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],LCASE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ENCODE_FOR_URI:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],CONTAINS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRSTARTS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRENDS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRBEFORE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRAFTER:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],YEAR:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],MONTH:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DAY:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],HOURS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],MINUTES:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SECONDS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],TIMEZONE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],TZ:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],NOW:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],UUID:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRUUID:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],MD5:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SHA1:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SHA256:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SHA384:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SHA512:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],COALESCE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],IF:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRLANG:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRDT:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SAMETERM:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ISIRI:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ISURI:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ISBLANK:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ISLITERAL:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],ISNUMERIC:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],TRUE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],FALSE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],COUNT:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SUM:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],MIN:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],MAX:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],AVG:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SAMPLE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],GROUP_CONCAT:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],SUBSTR:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],REPLACE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],REGEX:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],EXISTS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],NOT:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],IRI_REF:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRING_LITERAL1:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRING_LITERAL2:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRING_LITERAL_LONG1:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],STRING_LITERAL_LONG2:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],INTEGER:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DECIMAL:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DOUBLE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],INTEGER_POSITIVE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DECIMAL_POSITIVE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DOUBLE_POSITIVE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],INTEGER_NEGATIVE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DECIMAL_NEGATIVE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],DOUBLE_NEGATIVE:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],PNAME_LN:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"],PNAME_NS:["multiplicativeExpression","*or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])"]},aggregate:{COUNT:["COUNT","(","?DISTINCT","or([*,expression])",")"],SUM:["SUM","(","?DISTINCT","expression",")"],MIN:["MIN","(","?DISTINCT","expression",")"],MAX:["MAX","(","?DISTINCT","expression",")"],AVG:["AVG","(","?DISTINCT","expression",")"],SAMPLE:["SAMPLE","(","?DISTINCT","expression",")"],GROUP_CONCAT:["GROUP_CONCAT","(","?DISTINCT","expression","?[;,SEPARATOR,=,string]",")"]},allowBnodes:{"}":[]},allowVars:{"}":[]},argList:{NIL:["NIL"],"(":["(","?DISTINCT","expression","*[,,expression]",")"]},askQuery:{ASK:["ASK","*datasetClause","whereClause","solutionModifier"]},baseDecl:{BASE:["BASE","IRI_REF"]},bind:{BIND:["BIND","(","expression","AS","var",")"]},blankNode:{BLANK_NODE_LABEL:["BLANK_NODE_LABEL"],ANON:["ANON"]},blankNodePropertyList:{"[":["[","propertyListNotEmpty","]"]},blankNodePropertyListPath:{"[":["[","propertyListPathNotEmpty","]"]},booleanLiteral:{TRUE:["TRUE"],FALSE:["FALSE"]},brackettedExpression:{"(":["(","expression",")"]},builtInCall:{STR:["STR","(","expression",")"],LANG:["LANG","(","expression",")"],LANGMATCHES:["LANGMATCHES","(","expression",",","expression",")"],DATATYPE:["DATATYPE","(","expression",")"],BOUND:["BOUND","(","var",")"],IRI:["IRI","(","expression",")"],URI:["URI","(","expression",")"],BNODE:["BNODE","or([[ (,expression,)],NIL])"],RAND:["RAND","NIL"],ABS:["ABS","(","expression",")"],CEIL:["CEIL","(","expression",")"],FLOOR:["FLOOR","(","expression",")"],ROUND:["ROUND","(","expression",")"],CONCAT:["CONCAT","expressionList"],SUBSTR:["substringExpression"],STRLEN:["STRLEN","(","expression",")"],REPLACE:["strReplaceExpression"],UCASE:["UCASE","(","expression",")"],LCASE:["LCASE","(","expression",")"],ENCODE_FOR_URI:["ENCODE_FOR_URI","(","expression",")"],CONTAINS:["CONTAINS","(","expression",",","expression",")"],STRSTARTS:["STRSTARTS","(","expression",",","expression",")"],STRENDS:["STRENDS","(","expression",",","expression",")"],STRBEFORE:["STRBEFORE","(","expression",",","expression",")"],STRAFTER:["STRAFTER","(","expression",",","expression",")"],YEAR:["YEAR","(","expression",")"],MONTH:["MONTH","(","expression",")"],DAY:["DAY","(","expression",")"],HOURS:["HOURS","(","expression",")"],MINUTES:["MINUTES","(","expression",")"],SECONDS:["SECONDS","(","expression",")"],TIMEZONE:["TIMEZONE","(","expression",")"],TZ:["TZ","(","expression",")"],NOW:["NOW","NIL"],UUID:["UUID","NIL"],STRUUID:["STRUUID","NIL"],MD5:["MD5","(","expression",")"],SHA1:["SHA1","(","expression",")"],SHA256:["SHA256","(","expression",")"],SHA384:["SHA384","(","expression",")"],SHA512:["SHA512","(","expression",")"],COALESCE:["COALESCE","expressionList"],IF:["IF","(","expression",",","expression",",","expression",")"],STRLANG:["STRLANG","(","expression",",","expression",")"],STRDT:["STRDT","(","expression",",","expression",")"],SAMETERM:["SAMETERM","(","expression",",","expression",")"],ISIRI:["ISIRI","(","expression",")"],ISURI:["ISURI","(","expression",")"],ISBLANK:["ISBLANK","(","expression",")"],ISLITERAL:["ISLITERAL","(","expression",")"],ISNUMERIC:["ISNUMERIC","(","expression",")"],REGEX:["regexExpression"],EXISTS:["existsFunc"],NOT:["notExistsFunc"]},clear:{CLEAR:["CLEAR","?SILENT_2","graphRefAll"]},collection:{"(":["(","+graphNode",")"]},collectionPath:{"(":["(","+graphNodePath",")"]},conditionalAndExpression:{"!":["valueLogical","*[&&,valueLogical]"],"+":["valueLogical","*[&&,valueLogical]"],"-":["valueLogical","*[&&,valueLogical]"],VAR1:["valueLogical","*[&&,valueLogical]"],VAR2:["valueLogical","*[&&,valueLogical]"],"(":["valueLogical","*[&&,valueLogical]"],STR:["valueLogical","*[&&,valueLogical]"],LANG:["valueLogical","*[&&,valueLogical]"],LANGMATCHES:["valueLogical","*[&&,valueLogical]"],DATATYPE:["valueLogical","*[&&,valueLogical]"],BOUND:["valueLogical","*[&&,valueLogical]"],IRI:["valueLogical","*[&&,valueLogical]"],URI:["valueLogical","*[&&,valueLogical]"],BNODE:["valueLogical","*[&&,valueLogical]"],RAND:["valueLogical","*[&&,valueLogical]"],ABS:["valueLogical","*[&&,valueLogical]"],CEIL:["valueLogical","*[&&,valueLogical]"],FLOOR:["valueLogical","*[&&,valueLogical]"],ROUND:["valueLogical","*[&&,valueLogical]"],CONCAT:["valueLogical","*[&&,valueLogical]"],STRLEN:["valueLogical","*[&&,valueLogical]"],UCASE:["valueLogical","*[&&,valueLogical]"],LCASE:["valueLogical","*[&&,valueLogical]"],ENCODE_FOR_URI:["valueLogical","*[&&,valueLogical]"],CONTAINS:["valueLogical","*[&&,valueLogical]"],STRSTARTS:["valueLogical","*[&&,valueLogical]"],STRENDS:["valueLogical","*[&&,valueLogical]"],STRBEFORE:["valueLogical","*[&&,valueLogical]"],STRAFTER:["valueLogical","*[&&,valueLogical]"],YEAR:["valueLogical","*[&&,valueLogical]"],MONTH:["valueLogical","*[&&,valueLogical]"],DAY:["valueLogical","*[&&,valueLogical]"],HOURS:["valueLogical","*[&&,valueLogical]"],MINUTES:["valueLogical","*[&&,valueLogical]"],SECONDS:["valueLogical","*[&&,valueLogical]"],TIMEZONE:["valueLogical","*[&&,valueLogical]"],TZ:["valueLogical","*[&&,valueLogical]"],NOW:["valueLogical","*[&&,valueLogical]"],UUID:["valueLogical","*[&&,valueLogical]"],STRUUID:["valueLogical","*[&&,valueLogical]"],MD5:["valueLogical","*[&&,valueLogical]"],SHA1:["valueLogical","*[&&,valueLogical]"],SHA256:["valueLogical","*[&&,valueLogical]"],SHA384:["valueLogical","*[&&,valueLogical]"],SHA512:["valueLogical","*[&&,valueLogical]"],COALESCE:["valueLogical","*[&&,valueLogical]"],IF:["valueLogical","*[&&,valueLogical]"],STRLANG:["valueLogical","*[&&,valueLogical]"],STRDT:["valueLogical","*[&&,valueLogical]"],SAMETERM:["valueLogical","*[&&,valueLogical]"],ISIRI:["valueLogical","*[&&,valueLogical]"],ISURI:["valueLogical","*[&&,valueLogical]"],ISBLANK:["valueLogical","*[&&,valueLogical]"],ISLITERAL:["valueLogical","*[&&,valueLogical]"],ISNUMERIC:["valueLogical","*[&&,valueLogical]"],TRUE:["valueLogical","*[&&,valueLogical]"],FALSE:["valueLogical","*[&&,valueLogical]"],COUNT:["valueLogical","*[&&,valueLogical]"],SUM:["valueLogical","*[&&,valueLogical]"],MIN:["valueLogical","*[&&,valueLogical]"],MAX:["valueLogical","*[&&,valueLogical]"],AVG:["valueLogical","*[&&,valueLogical]"],SAMPLE:["valueLogical","*[&&,valueLogical]"],GROUP_CONCAT:["valueLogical","*[&&,valueLogical]"],SUBSTR:["valueLogical","*[&&,valueLogical]"],REPLACE:["valueLogical","*[&&,valueLogical]"],REGEX:["valueLogical","*[&&,valueLogical]"],EXISTS:["valueLogical","*[&&,valueLogical]"],NOT:["valueLogical","*[&&,valueLogical]"],IRI_REF:["valueLogical","*[&&,valueLogical]"],STRING_LITERAL1:["valueLogical","*[&&,valueLogical]"],STRING_LITERAL2:["valueLogical","*[&&,valueLogical]"],STRING_LITERAL_LONG1:["valueLogical","*[&&,valueLogical]"],STRING_LITERAL_LONG2:["valueLogical","*[&&,valueLogical]"],INTEGER:["valueLogical","*[&&,valueLogical]"],DECIMAL:["valueLogical","*[&&,valueLogical]"],DOUBLE:["valueLogical","*[&&,valueLogical]"],INTEGER_POSITIVE:["valueLogical","*[&&,valueLogical]"],DECIMAL_POSITIVE:["valueLogical","*[&&,valueLogical]"],DOUBLE_POSITIVE:["valueLogical","*[&&,valueLogical]"],INTEGER_NEGATIVE:["valueLogical","*[&&,valueLogical]"],DECIMAL_NEGATIVE:["valueLogical","*[&&,valueLogical]"],DOUBLE_NEGATIVE:["valueLogical","*[&&,valueLogical]"],PNAME_LN:["valueLogical","*[&&,valueLogical]"],PNAME_NS:["valueLogical","*[&&,valueLogical]"]},conditionalOrExpression:{"!":["conditionalAndExpression","*[||,conditionalAndExpression]"],"+":["conditionalAndExpression","*[||,conditionalAndExpression]"],"-":["conditionalAndExpression","*[||,conditionalAndExpression]"],VAR1:["conditionalAndExpression","*[||,conditionalAndExpression]"],VAR2:["conditionalAndExpression","*[||,conditionalAndExpression]"],"(":["conditionalAndExpression","*[||,conditionalAndExpression]"],STR:["conditionalAndExpression","*[||,conditionalAndExpression]"],LANG:["conditionalAndExpression","*[||,conditionalAndExpression]"],LANGMATCHES:["conditionalAndExpression","*[||,conditionalAndExpression]"],DATATYPE:["conditionalAndExpression","*[||,conditionalAndExpression]"],BOUND:["conditionalAndExpression","*[||,conditionalAndExpression]"],IRI:["conditionalAndExpression","*[||,conditionalAndExpression]"],URI:["conditionalAndExpression","*[||,conditionalAndExpression]"],BNODE:["conditionalAndExpression","*[||,conditionalAndExpression]"],RAND:["conditionalAndExpression","*[||,conditionalAndExpression]"],ABS:["conditionalAndExpression","*[||,conditionalAndExpression]"],CEIL:["conditionalAndExpression","*[||,conditionalAndExpression]"],FLOOR:["conditionalAndExpression","*[||,conditionalAndExpression]"],ROUND:["conditionalAndExpression","*[||,conditionalAndExpression]"],CONCAT:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRLEN:["conditionalAndExpression","*[||,conditionalAndExpression]"],UCASE:["conditionalAndExpression","*[||,conditionalAndExpression]"],LCASE:["conditionalAndExpression","*[||,conditionalAndExpression]"],ENCODE_FOR_URI:["conditionalAndExpression","*[||,conditionalAndExpression]"],CONTAINS:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRSTARTS:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRENDS:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRBEFORE:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRAFTER:["conditionalAndExpression","*[||,conditionalAndExpression]"],YEAR:["conditionalAndExpression","*[||,conditionalAndExpression]"],MONTH:["conditionalAndExpression","*[||,conditionalAndExpression]"],DAY:["conditionalAndExpression","*[||,conditionalAndExpression]"],HOURS:["conditionalAndExpression","*[||,conditionalAndExpression]"],MINUTES:["conditionalAndExpression","*[||,conditionalAndExpression]"],SECONDS:["conditionalAndExpression","*[||,conditionalAndExpression]"],TIMEZONE:["conditionalAndExpression","*[||,conditionalAndExpression]"],TZ:["conditionalAndExpression","*[||,conditionalAndExpression]"],NOW:["conditionalAndExpression","*[||,conditionalAndExpression]"],UUID:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRUUID:["conditionalAndExpression","*[||,conditionalAndExpression]"],MD5:["conditionalAndExpression","*[||,conditionalAndExpression]"],SHA1:["conditionalAndExpression","*[||,conditionalAndExpression]"],SHA256:["conditionalAndExpression","*[||,conditionalAndExpression]"],SHA384:["conditionalAndExpression","*[||,conditionalAndExpression]"],SHA512:["conditionalAndExpression","*[||,conditionalAndExpression]"],COALESCE:["conditionalAndExpression","*[||,conditionalAndExpression]"],IF:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRLANG:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRDT:["conditionalAndExpression","*[||,conditionalAndExpression]"],SAMETERM:["conditionalAndExpression","*[||,conditionalAndExpression]"],ISIRI:["conditionalAndExpression","*[||,conditionalAndExpression]"],ISURI:["conditionalAndExpression","*[||,conditionalAndExpression]"],ISBLANK:["conditionalAndExpression","*[||,conditionalAndExpression]"],ISLITERAL:["conditionalAndExpression","*[||,conditionalAndExpression]"],ISNUMERIC:["conditionalAndExpression","*[||,conditionalAndExpression]"],TRUE:["conditionalAndExpression","*[||,conditionalAndExpression]"],FALSE:["conditionalAndExpression","*[||,conditionalAndExpression]"],COUNT:["conditionalAndExpression","*[||,conditionalAndExpression]"],SUM:["conditionalAndExpression","*[||,conditionalAndExpression]"],MIN:["conditionalAndExpression","*[||,conditionalAndExpression]"],MAX:["conditionalAndExpression","*[||,conditionalAndExpression]"],AVG:["conditionalAndExpression","*[||,conditionalAndExpression]"],SAMPLE:["conditionalAndExpression","*[||,conditionalAndExpression]"],GROUP_CONCAT:["conditionalAndExpression","*[||,conditionalAndExpression]"],SUBSTR:["conditionalAndExpression","*[||,conditionalAndExpression]"],REPLACE:["conditionalAndExpression","*[||,conditionalAndExpression]"],REGEX:["conditionalAndExpression","*[||,conditionalAndExpression]"],EXISTS:["conditionalAndExpression","*[||,conditionalAndExpression]"],NOT:["conditionalAndExpression","*[||,conditionalAndExpression]"],IRI_REF:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRING_LITERAL1:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRING_LITERAL2:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRING_LITERAL_LONG1:["conditionalAndExpression","*[||,conditionalAndExpression]"],STRING_LITERAL_LONG2:["conditionalAndExpression","*[||,conditionalAndExpression]"],INTEGER:["conditionalAndExpression","*[||,conditionalAndExpression]"],DECIMAL:["conditionalAndExpression","*[||,conditionalAndExpression]"],DOUBLE:["conditionalAndExpression","*[||,conditionalAndExpression]"],INTEGER_POSITIVE:["conditionalAndExpression","*[||,conditionalAndExpression]"],DECIMAL_POSITIVE:["conditionalAndExpression","*[||,conditionalAndExpression]"],DOUBLE_POSITIVE:["conditionalAndExpression","*[||,conditionalAndExpression]"],INTEGER_NEGATIVE:["conditionalAndExpression","*[||,conditionalAndExpression]"],DECIMAL_NEGATIVE:["conditionalAndExpression","*[||,conditionalAndExpression]"],DOUBLE_NEGATIVE:["conditionalAndExpression","*[||,conditionalAndExpression]"],PNAME_LN:["conditionalAndExpression","*[||,conditionalAndExpression]"],PNAME_NS:["conditionalAndExpression","*[||,conditionalAndExpression]"]},constraint:{"(":["brackettedExpression"],STR:["builtInCall"],LANG:["builtInCall"],LANGMATCHES:["builtInCall"],DATATYPE:["builtInCall"],BOUND:["builtInCall"],IRI:["builtInCall"],URI:["builtInCall"],BNODE:["builtInCall"],RAND:["builtInCall"],ABS:["builtInCall"],CEIL:["builtInCall"],FLOOR:["builtInCall"],ROUND:["builtInCall"],CONCAT:["builtInCall"],STRLEN:["builtInCall"],UCASE:["builtInCall"],LCASE:["builtInCall"],ENCODE_FOR_URI:["builtInCall"],CONTAINS:["builtInCall"],STRSTARTS:["builtInCall"],STRENDS:["builtInCall"],STRBEFORE:["builtInCall"],STRAFTER:["builtInCall"],YEAR:["builtInCall"],MONTH:["builtInCall"],DAY:["builtInCall"],HOURS:["builtInCall"],MINUTES:["builtInCall"],SECONDS:["builtInCall"],TIMEZONE:["builtInCall"],TZ:["builtInCall"],NOW:["builtInCall"],UUID:["builtInCall"],STRUUID:["builtInCall"],MD5:["builtInCall"],SHA1:["builtInCall"],SHA256:["builtInCall"],SHA384:["builtInCall"],SHA512:["builtInCall"],COALESCE:["builtInCall"],IF:["builtInCall"],STRLANG:["builtInCall"],STRDT:["builtInCall"],SAMETERM:["builtInCall"],ISIRI:["builtInCall"],ISURI:["builtInCall"],ISBLANK:["builtInCall"],ISLITERAL:["builtInCall"],ISNUMERIC:["builtInCall"],SUBSTR:["builtInCall"],REPLACE:["builtInCall"],REGEX:["builtInCall"],EXISTS:["builtInCall"],NOT:["builtInCall"],IRI_REF:["functionCall"],PNAME_LN:["functionCall"],PNAME_NS:["functionCall"]},constructQuery:{CONSTRUCT:["CONSTRUCT","or([[constructTemplate,*datasetClause,whereClause,solutionModifier],[*datasetClause,WHERE,{,?triplesTemplate,},solutionModifier]])"]},constructTemplate:{"{":["{","?constructTriples","}"]},constructTriples:{VAR1:["triplesSameSubject","?[.,?constructTriples]"],VAR2:["triplesSameSubject","?[.,?constructTriples]"],NIL:["triplesSameSubject","?[.,?constructTriples]"],"(":["triplesSameSubject","?[.,?constructTriples]"],"[":["triplesSameSubject","?[.,?constructTriples]"],IRI_REF:["triplesSameSubject","?[.,?constructTriples]"],TRUE:["triplesSameSubject","?[.,?constructTriples]"],FALSE:["triplesSameSubject","?[.,?constructTriples]"],BLANK_NODE_LABEL:["triplesSameSubject","?[.,?constructTriples]"],ANON:["triplesSameSubject","?[.,?constructTriples]"],PNAME_LN:["triplesSameSubject","?[.,?constructTriples]"],PNAME_NS:["triplesSameSubject","?[.,?constructTriples]"],STRING_LITERAL1:["triplesSameSubject","?[.,?constructTriples]"],STRING_LITERAL2:["triplesSameSubject","?[.,?constructTriples]"],STRING_LITERAL_LONG1:["triplesSameSubject","?[.,?constructTriples]"],STRING_LITERAL_LONG2:["triplesSameSubject","?[.,?constructTriples]"],INTEGER:["triplesSameSubject","?[.,?constructTriples]"],DECIMAL:["triplesSameSubject","?[.,?constructTriples]"],DOUBLE:["triplesSameSubject","?[.,?constructTriples]"],INTEGER_POSITIVE:["triplesSameSubject","?[.,?constructTriples]"],DECIMAL_POSITIVE:["triplesSameSubject","?[.,?constructTriples]"],DOUBLE_POSITIVE:["triplesSameSubject","?[.,?constructTriples]"],INTEGER_NEGATIVE:["triplesSameSubject","?[.,?constructTriples]"],DECIMAL_NEGATIVE:["triplesSameSubject","?[.,?constructTriples]"],DOUBLE_NEGATIVE:["triplesSameSubject","?[.,?constructTriples]"]},copy:{COPY:["COPY","?SILENT_4","graphOrDefault","TO","graphOrDefault"]},create:{CREATE:["CREATE","?SILENT_3","graphRef"]},dataBlock:{NIL:["or([inlineDataOneVar,inlineDataFull])"],"(":["or([inlineDataOneVar,inlineDataFull])"],VAR1:["or([inlineDataOneVar,inlineDataFull])"],VAR2:["or([inlineDataOneVar,inlineDataFull])"]},dataBlockValue:{IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"],STRING_LITERAL1:["rdfLiteral"],STRING_LITERAL2:["rdfLiteral"],STRING_LITERAL_LONG1:["rdfLiteral"],STRING_LITERAL_LONG2:["rdfLiteral"],INTEGER:["numericLiteral"],DECIMAL:["numericLiteral"],DOUBLE:["numericLiteral"],INTEGER_POSITIVE:["numericLiteral"],DECIMAL_POSITIVE:["numericLiteral"],DOUBLE_POSITIVE:["numericLiteral"],INTEGER_NEGATIVE:["numericLiteral"],DECIMAL_NEGATIVE:["numericLiteral"],DOUBLE_NEGATIVE:["numericLiteral"],TRUE:["booleanLiteral"],FALSE:["booleanLiteral"],UNDEF:["UNDEF"]},datasetClause:{FROM:["FROM","or([defaultGraphClause,namedGraphClause])"]},defaultGraphClause:{IRI_REF:["sourceSelector"],PNAME_LN:["sourceSelector"],PNAME_NS:["sourceSelector"]},delete1:{DATA:["DATA","quadDataNoBnodes"],WHERE:["WHERE","quadPatternNoBnodes"],"{":["quadPatternNoBnodes","?insertClause","*usingClause","WHERE","groupGraphPattern"]},deleteClause:{DELETE:["DELETE","quadPattern"]},describeDatasetClause:{FROM:["FROM","or([defaultGraphClause,namedGraphClause])"]},describeQuery:{DESCRIBE:["DESCRIBE","or([+varOrIRIref,*])","*describeDatasetClause","?whereClause","solutionModifier"]},disallowBnodes:{"}":[],GRAPH:[],VAR1:[],VAR2:[],NIL:[],"(":[],"[":[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[]},disallowVars:{"}":[],GRAPH:[],VAR1:[],VAR2:[],NIL:[],"(":[],"[":[],IRI_REF:[],TRUE:[],FALSE:[],BLANK_NODE_LABEL:[],ANON:[],PNAME_LN:[],PNAME_NS:[],STRING_LITERAL1:[],STRING_LITERAL2:[],STRING_LITERAL_LONG1:[],STRING_LITERAL_LONG2:[],INTEGER:[],DECIMAL:[],DOUBLE:[],INTEGER_POSITIVE:[],DECIMAL_POSITIVE:[],DOUBLE_POSITIVE:[],INTEGER_NEGATIVE:[],DECIMAL_NEGATIVE:[],DOUBLE_NEGATIVE:[]},drop:{DROP:["DROP","?SILENT_2","graphRefAll"]},existsFunc:{EXISTS:["EXISTS","groupGraphPattern"]},expression:{"!":["conditionalOrExpression"],"+":["conditionalOrExpression"],"-":["conditionalOrExpression"],VAR1:["conditionalOrExpression"],VAR2:["conditionalOrExpression"],"(":["conditionalOrExpression"],STR:["conditionalOrExpression"],LANG:["conditionalOrExpression"],LANGMATCHES:["conditionalOrExpression"],DATATYPE:["conditionalOrExpression"],BOUND:["conditionalOrExpression"],IRI:["conditionalOrExpression"],URI:["conditionalOrExpression"],BNODE:["conditionalOrExpression"],RAND:["conditionalOrExpression"],ABS:["conditionalOrExpression"],CEIL:["conditionalOrExpression"],FLOOR:["conditionalOrExpression"],ROUND:["conditionalOrExpression"],CONCAT:["conditionalOrExpression"],STRLEN:["conditionalOrExpression"],UCASE:["conditionalOrExpression"],LCASE:["conditionalOrExpression"],ENCODE_FOR_URI:["conditionalOrExpression"],CONTAINS:["conditionalOrExpression"],STRSTARTS:["conditionalOrExpression"],STRENDS:["conditionalOrExpression"],STRBEFORE:["conditionalOrExpression"],STRAFTER:["conditionalOrExpression"],YEAR:["conditionalOrExpression"],MONTH:["conditionalOrExpression"],DAY:["conditionalOrExpression"],HOURS:["conditionalOrExpression"],MINUTES:["conditionalOrExpression"],SECONDS:["conditionalOrExpression"],TIMEZONE:["conditionalOrExpression"],TZ:["conditionalOrExpression"],NOW:["conditionalOrExpression"],UUID:["conditionalOrExpression"],STRUUID:["conditionalOrExpression"],MD5:["conditionalOrExpression"],SHA1:["conditionalOrExpression"],SHA256:["conditionalOrExpression"],SHA384:["conditionalOrExpression"],SHA512:["conditionalOrExpression"],COALESCE:["conditionalOrExpression"],IF:["conditionalOrExpression"],STRLANG:["conditionalOrExpression"],STRDT:["conditionalOrExpression"],SAMETERM:["conditionalOrExpression"],ISIRI:["conditionalOrExpression"],ISURI:["conditionalOrExpression"],ISBLANK:["conditionalOrExpression"],ISLITERAL:["conditionalOrExpression"],ISNUMERIC:["conditionalOrExpression"],TRUE:["conditionalOrExpression"],FALSE:["conditionalOrExpression"],COUNT:["conditionalOrExpression"],SUM:["conditionalOrExpression"],MIN:["conditionalOrExpression"],MAX:["conditionalOrExpression"],AVG:["conditionalOrExpression"],SAMPLE:["conditionalOrExpression"],GROUP_CONCAT:["conditionalOrExpression"],SUBSTR:["conditionalOrExpression"],REPLACE:["conditionalOrExpression"],REGEX:["conditionalOrExpression"],EXISTS:["conditionalOrExpression"],NOT:["conditionalOrExpression"],IRI_REF:["conditionalOrExpression"],STRING_LITERAL1:["conditionalOrExpression"],STRING_LITERAL2:["conditionalOrExpression"],STRING_LITERAL_LONG1:["conditionalOrExpression"],STRING_LITERAL_LONG2:["conditionalOrExpression"],INTEGER:["conditionalOrExpression"],DECIMAL:["conditionalOrExpression"],DOUBLE:["conditionalOrExpression"],INTEGER_POSITIVE:["conditionalOrExpression"],DECIMAL_POSITIVE:["conditionalOrExpression"],DOUBLE_POSITIVE:["conditionalOrExpression"],INTEGER_NEGATIVE:["conditionalOrExpression"],DECIMAL_NEGATIVE:["conditionalOrExpression"],DOUBLE_NEGATIVE:["conditionalOrExpression"],PNAME_LN:["conditionalOrExpression"],PNAME_NS:["conditionalOrExpression"]},expressionList:{NIL:["NIL"],"(":["(","expression","*[,,expression]",")"]},filter:{FILTER:["FILTER","constraint"]},functionCall:{IRI_REF:["iriRef","argList"],PNAME_LN:["iriRef","argList"],PNAME_NS:["iriRef","argList"]},graphGraphPattern:{GRAPH:["GRAPH","varOrIRIref","groupGraphPattern"]},graphNode:{VAR1:["varOrTerm"],VAR2:["varOrTerm"],NIL:["varOrTerm"],IRI_REF:["varOrTerm"],TRUE:["varOrTerm"],FALSE:["varOrTerm"],BLANK_NODE_LABEL:["varOrTerm"],ANON:["varOrTerm"],PNAME_LN:["varOrTerm"],PNAME_NS:["varOrTerm"],STRING_LITERAL1:["varOrTerm"],STRING_LITERAL2:["varOrTerm"],STRING_LITERAL_LONG1:["varOrTerm"],STRING_LITERAL_LONG2:["varOrTerm"],INTEGER:["varOrTerm"],DECIMAL:["varOrTerm"],DOUBLE:["varOrTerm"],INTEGER_POSITIVE:["varOrTerm"],DECIMAL_POSITIVE:["varOrTerm"],DOUBLE_POSITIVE:["varOrTerm"],INTEGER_NEGATIVE:["varOrTerm"],DECIMAL_NEGATIVE:["varOrTerm"],DOUBLE_NEGATIVE:["varOrTerm"],"(":["triplesNode"],"[":["triplesNode"]},graphNodePath:{VAR1:["varOrTerm"],VAR2:["varOrTerm"],NIL:["varOrTerm"],IRI_REF:["varOrTerm"],TRUE:["varOrTerm"],FALSE:["varOrTerm"],BLANK_NODE_LABEL:["varOrTerm"],ANON:["varOrTerm"],PNAME_LN:["varOrTerm"],PNAME_NS:["varOrTerm"],STRING_LITERAL1:["varOrTerm"],STRING_LITERAL2:["varOrTerm"],STRING_LITERAL_LONG1:["varOrTerm"],STRING_LITERAL_LONG2:["varOrTerm"],INTEGER:["varOrTerm"],DECIMAL:["varOrTerm"],DOUBLE:["varOrTerm"],INTEGER_POSITIVE:["varOrTerm"],DECIMAL_POSITIVE:["varOrTerm"],DOUBLE_POSITIVE:["varOrTerm"],INTEGER_NEGATIVE:["varOrTerm"],DECIMAL_NEGATIVE:["varOrTerm"],DOUBLE_NEGATIVE:["varOrTerm"],"(":["triplesNodePath"],"[":["triplesNodePath"]},graphOrDefault:{DEFAULT:["DEFAULT"],IRI_REF:["?GRAPH","iriRef"],PNAME_LN:["?GRAPH","iriRef"],PNAME_NS:["?GRAPH","iriRef"],GRAPH:["?GRAPH","iriRef"]},graphPatternNotTriples:{"{":["groupOrUnionGraphPattern"],OPTIONAL:["optionalGraphPattern"],MINUS:["minusGraphPattern"],GRAPH:["graphGraphPattern"],SERVICE:["serviceGraphPattern"],FILTER:["filter"],BIND:["bind"],VALUES:["inlineData"]},graphRef:{GRAPH:["GRAPH","iriRef"]},graphRefAll:{GRAPH:["graphRef"],DEFAULT:["DEFAULT"],NAMED:["NAMED"],ALL:["ALL"]},graphTerm:{IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"],STRING_LITERAL1:["rdfLiteral"],STRING_LITERAL2:["rdfLiteral"],STRING_LITERAL_LONG1:["rdfLiteral"],STRING_LITERAL_LONG2:["rdfLiteral"],INTEGER:["numericLiteral"],DECIMAL:["numericLiteral"],DOUBLE:["numericLiteral"],INTEGER_POSITIVE:["numericLiteral"],DECIMAL_POSITIVE:["numericLiteral"],DOUBLE_POSITIVE:["numericLiteral"],INTEGER_NEGATIVE:["numericLiteral"],DECIMAL_NEGATIVE:["numericLiteral"],DOUBLE_NEGATIVE:["numericLiteral"],TRUE:["booleanLiteral"],FALSE:["booleanLiteral"],BLANK_NODE_LABEL:["blankNode"],ANON:["blankNode"],NIL:["NIL"]},groupClause:{GROUP:["GROUP","BY","+groupCondition"]},groupCondition:{STR:["builtInCall"],LANG:["builtInCall"],LANGMATCHES:["builtInCall"],DATATYPE:["builtInCall"],BOUND:["builtInCall"],IRI:["builtInCall"],URI:["builtInCall"],BNODE:["builtInCall"],RAND:["builtInCall"],ABS:["builtInCall"],CEIL:["builtInCall"],FLOOR:["builtInCall"],ROUND:["builtInCall"],CONCAT:["builtInCall"],STRLEN:["builtInCall"],UCASE:["builtInCall"],LCASE:["builtInCall"],ENCODE_FOR_URI:["builtInCall"],CONTAINS:["builtInCall"],STRSTARTS:["builtInCall"],STRENDS:["builtInCall"],STRBEFORE:["builtInCall"],STRAFTER:["builtInCall"],YEAR:["builtInCall"],MONTH:["builtInCall"],DAY:["builtInCall"],HOURS:["builtInCall"],MINUTES:["builtInCall"],SECONDS:["builtInCall"],TIMEZONE:["builtInCall"],TZ:["builtInCall"],NOW:["builtInCall"],UUID:["builtInCall"],STRUUID:["builtInCall"],MD5:["builtInCall"],SHA1:["builtInCall"],SHA256:["builtInCall"],SHA384:["builtInCall"],SHA512:["builtInCall"],COALESCE:["builtInCall"],IF:["builtInCall"],STRLANG:["builtInCall"],STRDT:["builtInCall"],SAMETERM:["builtInCall"],ISIRI:["builtInCall"],ISURI:["builtInCall"],ISBLANK:["builtInCall"],ISLITERAL:["builtInCall"],ISNUMERIC:["builtInCall"],SUBSTR:["builtInCall"],REPLACE:["builtInCall"],REGEX:["builtInCall"],EXISTS:["builtInCall"],NOT:["builtInCall"],IRI_REF:["functionCall"],PNAME_LN:["functionCall"],PNAME_NS:["functionCall"],"(":["(","expression","?[AS,var]",")"],VAR1:["var"],VAR2:["var"]},groupGraphPattern:{"{":["{","or([subSelect,groupGraphPatternSub])","}"]},groupGraphPatternSub:{"{":["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],OPTIONAL:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],MINUS:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],GRAPH:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],SERVICE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],FILTER:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],BIND:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],VALUES:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],VAR1:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],VAR2:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],NIL:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],"(":["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],"[":["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],IRI_REF:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],TRUE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],FALSE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],BLANK_NODE_LABEL:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],ANON:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],PNAME_LN:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],PNAME_NS:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],STRING_LITERAL1:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],STRING_LITERAL2:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],STRING_LITERAL_LONG1:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],STRING_LITERAL_LONG2:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],INTEGER:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],DECIMAL:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],DOUBLE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],INTEGER_POSITIVE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],DECIMAL_POSITIVE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],DOUBLE_POSITIVE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],INTEGER_NEGATIVE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],DECIMAL_NEGATIVE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],DOUBLE_NEGATIVE:["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"],"}":["?triplesBlock","*[graphPatternNotTriples,?.,?triplesBlock]"]},groupOrUnionGraphPattern:{"{":["groupGraphPattern","*[UNION,groupGraphPattern]"]},havingClause:{HAVING:["HAVING","+havingCondition"]},havingCondition:{"(":["constraint"],STR:["constraint"],LANG:["constraint"],LANGMATCHES:["constraint"],DATATYPE:["constraint"],BOUND:["constraint"],IRI:["constraint"],URI:["constraint"],BNODE:["constraint"],RAND:["constraint"],ABS:["constraint"],CEIL:["constraint"],FLOOR:["constraint"],ROUND:["constraint"],CONCAT:["constraint"],STRLEN:["constraint"],UCASE:["constraint"],LCASE:["constraint"],ENCODE_FOR_URI:["constraint"],CONTAINS:["constraint"],STRSTARTS:["constraint"],STRENDS:["constraint"],STRBEFORE:["constraint"],STRAFTER:["constraint"],YEAR:["constraint"],MONTH:["constraint"],DAY:["constraint"],HOURS:["constraint"],MINUTES:["constraint"],SECONDS:["constraint"],TIMEZONE:["constraint"],TZ:["constraint"],NOW:["constraint"],UUID:["constraint"],STRUUID:["constraint"],MD5:["constraint"],SHA1:["constraint"],SHA256:["constraint"],SHA384:["constraint"],SHA512:["constraint"],COALESCE:["constraint"],IF:["constraint"],STRLANG:["constraint"],STRDT:["constraint"],SAMETERM:["constraint"],ISIRI:["constraint"],ISURI:["constraint"],ISBLANK:["constraint"],ISLITERAL:["constraint"],ISNUMERIC:["constraint"],SUBSTR:["constraint"],REPLACE:["constraint"],REGEX:["constraint"],EXISTS:["constraint"],NOT:["constraint"],IRI_REF:["constraint"],PNAME_LN:["constraint"],PNAME_NS:["constraint"]},inlineData:{VALUES:["VALUES","dataBlock"]},inlineDataFull:{NIL:["or([NIL,[ (,*var,)]])","{","*or([[ (,*dataBlockValue,)],NIL])","}"],"(":["or([NIL,[ (,*var,)]])","{","*or([[ (,*dataBlockValue,)],NIL])","}"]},inlineDataOneVar:{VAR1:["var","{","*dataBlockValue","}"],VAR2:["var","{","*dataBlockValue","}"]},insert1:{DATA:["DATA","quadData"],"{":["quadPattern","*usingClause","WHERE","groupGraphPattern"]},insertClause:{INSERT:["INSERT","quadPattern"]},integer:{INTEGER:["INTEGER"]},iriRef:{IRI_REF:["IRI_REF"],PNAME_LN:["prefixedName"],PNAME_NS:["prefixedName"]},iriRefOrFunction:{IRI_REF:["iriRef","?argList"],PNAME_LN:["iriRef","?argList"],PNAME_NS:["iriRef","?argList"]},limitClause:{LIMIT:["LIMIT","INTEGER"]},limitOffsetClauses:{LIMIT:["limitClause","?offsetClause"],OFFSET:["offsetClause","?limitClause"]},load:{LOAD:["LOAD","?SILENT_1","iriRef","?[INTO,graphRef]"]},minusGraphPattern:{MINUS:["MINUS","groupGraphPattern"]},modify:{WITH:["WITH","iriRef","or([[deleteClause,?insertClause],insertClause])","*usingClause","WHERE","groupGraphPattern"]},move:{MOVE:["MOVE","?SILENT_4","graphOrDefault","TO","graphOrDefault"]},multiplicativeExpression:{"!":["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],"+":["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],"-":["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],VAR1:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],VAR2:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],"(":["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STR:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],LANG:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],LANGMATCHES:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DATATYPE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],BOUND:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],IRI:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],URI:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],BNODE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],RAND:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ABS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],CEIL:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],FLOOR:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ROUND:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],CONCAT:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRLEN:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],UCASE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],LCASE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ENCODE_FOR_URI:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],CONTAINS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRSTARTS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRENDS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRBEFORE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRAFTER:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],YEAR:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],MONTH:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DAY:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],HOURS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],MINUTES:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SECONDS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],TIMEZONE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],TZ:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],NOW:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],UUID:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRUUID:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],MD5:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SHA1:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SHA256:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SHA384:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SHA512:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],COALESCE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],IF:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRLANG:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRDT:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SAMETERM:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ISIRI:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ISURI:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ISBLANK:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ISLITERAL:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],ISNUMERIC:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],TRUE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],FALSE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],COUNT:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SUM:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],MIN:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],MAX:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],AVG:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SAMPLE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],GROUP_CONCAT:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],SUBSTR:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],REPLACE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],REGEX:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],EXISTS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],NOT:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],IRI_REF:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRING_LITERAL1:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRING_LITERAL2:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRING_LITERAL_LONG1:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],STRING_LITERAL_LONG2:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],INTEGER:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DECIMAL:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DOUBLE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],INTEGER_POSITIVE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DECIMAL_POSITIVE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DOUBLE_POSITIVE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],INTEGER_NEGATIVE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DECIMAL_NEGATIVE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],DOUBLE_NEGATIVE:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],PNAME_LN:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"],PNAME_NS:["unaryExpression","*or([[*,unaryExpression],[/,unaryExpression]])"]},namedGraphClause:{NAMED:["NAMED","sourceSelector"]},notExistsFunc:{NOT:["NOT","EXISTS","groupGraphPattern"]},numericExpression:{"!":["additiveExpression"],"+":["additiveExpression"],"-":["additiveExpression"],VAR1:["additiveExpression"],VAR2:["additiveExpression"],"(":["additiveExpression"],STR:["additiveExpression"],LANG:["additiveExpression"],LANGMATCHES:["additiveExpression"],DATATYPE:["additiveExpression"],BOUND:["additiveExpression"],IRI:["additiveExpression"],URI:["additiveExpression"],BNODE:["additiveExpression"],RAND:["additiveExpression"],ABS:["additiveExpression"],CEIL:["additiveExpression"],FLOOR:["additiveExpression"],ROUND:["additiveExpression"],CONCAT:["additiveExpression"],STRLEN:["additiveExpression"],UCASE:["additiveExpression"],LCASE:["additiveExpression"],ENCODE_FOR_URI:["additiveExpression"],CONTAINS:["additiveExpression"],STRSTARTS:["additiveExpression"],STRENDS:["additiveExpression"],STRBEFORE:["additiveExpression"],STRAFTER:["additiveExpression"],YEAR:["additiveExpression"],MONTH:["additiveExpression"],DAY:["additiveExpression"],HOURS:["additiveExpression"],MINUTES:["additiveExpression"],SECONDS:["additiveExpression"],TIMEZONE:["additiveExpression"],TZ:["additiveExpression"],NOW:["additiveExpression"],UUID:["additiveExpression"],STRUUID:["additiveExpression"],MD5:["additiveExpression"],SHA1:["additiveExpression"],SHA256:["additiveExpression"],SHA384:["additiveExpression"],SHA512:["additiveExpression"],COALESCE:["additiveExpression"],IF:["additiveExpression"],STRLANG:["additiveExpression"],STRDT:["additiveExpression"],SAMETERM:["additiveExpression"],ISIRI:["additiveExpression"],ISURI:["additiveExpression"],ISBLANK:["additiveExpression"],ISLITERAL:["additiveExpression"],ISNUMERIC:["additiveExpression"],TRUE:["additiveExpression"],FALSE:["additiveExpression"],COUNT:["additiveExpression"],SUM:["additiveExpression"],MIN:["additiveExpression"],MAX:["additiveExpression"],AVG:["additiveExpression"],SAMPLE:["additiveExpression"],GROUP_CONCAT:["additiveExpression"],SUBSTR:["additiveExpression"],REPLACE:["additiveExpression"],REGEX:["additiveExpression"],EXISTS:["additiveExpression"],NOT:["additiveExpression"],IRI_REF:["additiveExpression"],STRING_LITERAL1:["additiveExpression"],STRING_LITERAL2:["additiveExpression"],STRING_LITERAL_LONG1:["additiveExpression"],STRING_LITERAL_LONG2:["additiveExpression"],INTEGER:["additiveExpression"],DECIMAL:["additiveExpression"],DOUBLE:["additiveExpression"],INTEGER_POSITIVE:["additiveExpression"],DECIMAL_POSITIVE:["additiveExpression"],DOUBLE_POSITIVE:["additiveExpression"],INTEGER_NEGATIVE:["additiveExpression"],DECIMAL_NEGATIVE:["additiveExpression"],DOUBLE_NEGATIVE:["additiveExpression"],PNAME_LN:["additiveExpression"],PNAME_NS:["additiveExpression"]},numericLiteral:{INTEGER:["numericLiteralUnsigned"],DECIMAL:["numericLiteralUnsigned"],DOUBLE:["numericLiteralUnsigned"],INTEGER_POSITIVE:["numericLiteralPositive"],DECIMAL_POSITIVE:["numericLiteralPositive"],DOUBLE_POSITIVE:["numericLiteralPositive"],INTEGER_NEGATIVE:["numericLiteralNegative"],DECIMAL_NEGATIVE:["numericLiteralNegative"],DOUBLE_NEGATIVE:["numericLiteralNegative"]},numericLiteralNegative:{INTEGER_NEGATIVE:["INTEGER_NEGATIVE"],DECIMAL_NEGATIVE:["DECIMAL_NEGATIVE"],DOUBLE_NEGATIVE:["DOUBLE_NEGATIVE"]},numericLiteralPositive:{INTEGER_POSITIVE:["INTEGER_POSITIVE"],DECIMAL_POSITIVE:["DECIMAL_POSITIVE"],DOUBLE_POSITIVE:["DOUBLE_POSITIVE"]},numericLiteralUnsigned:{INTEGER:["INTEGER"],DECIMAL:["DECIMAL"],DOUBLE:["DOUBLE"]},object:{"(":["graphNode"],"[":["graphNode"],VAR1:["graphNode"],VAR2:["graphNode"],NIL:["graphNode"],IRI_REF:["graphNode"],TRUE:["graphNode"],FALSE:["graphNode"],BLANK_NODE_LABEL:["graphNode"],ANON:["graphNode"],PNAME_LN:["graphNode"],PNAME_NS:["graphNode"],STRING_LITERAL1:["graphNode"],STRING_LITERAL2:["graphNode"],STRING_LITERAL_LONG1:["graphNode"],STRING_LITERAL_LONG2:["graphNode"],INTEGER:["graphNode"],DECIMAL:["graphNode"],DOUBLE:["graphNode"],INTEGER_POSITIVE:["graphNode"],DECIMAL_POSITIVE:["graphNode"],DOUBLE_POSITIVE:["graphNode"],INTEGER_NEGATIVE:["graphNode"],DECIMAL_NEGATIVE:["graphNode"],DOUBLE_NEGATIVE:["graphNode"]},objectList:{"(":["object","*[,,object]"],"[":["object","*[,,object]"],VAR1:["object","*[,,object]"],VAR2:["object","*[,,object]"],NIL:["object","*[,,object]"],IRI_REF:["object","*[,,object]"],TRUE:["object","*[,,object]"],FALSE:["object","*[,,object]"],BLANK_NODE_LABEL:["object","*[,,object]"],ANON:["object","*[,,object]"],PNAME_LN:["object","*[,,object]"],PNAME_NS:["object","*[,,object]"],STRING_LITERAL1:["object","*[,,object]"],STRING_LITERAL2:["object","*[,,object]"],STRING_LITERAL_LONG1:["object","*[,,object]"],STRING_LITERAL_LONG2:["object","*[,,object]"],INTEGER:["object","*[,,object]"],DECIMAL:["object","*[,,object]"],DOUBLE:["object","*[,,object]"],INTEGER_POSITIVE:["object","*[,,object]"],DECIMAL_POSITIVE:["object","*[,,object]"],DOUBLE_POSITIVE:["object","*[,,object]"],INTEGER_NEGATIVE:["object","*[,,object]"],DECIMAL_NEGATIVE:["object","*[,,object]"],DOUBLE_NEGATIVE:["object","*[,,object]"]},objectListPath:{"(":["objectPath","*[,,objectPath]"],"[":["objectPath","*[,,objectPath]"],VAR1:["objectPath","*[,,objectPath]"],VAR2:["objectPath","*[,,objectPath]"],NIL:["objectPath","*[,,objectPath]"],IRI_REF:["objectPath","*[,,objectPath]"],TRUE:["objectPath","*[,,objectPath]"],FALSE:["objectPath","*[,,objectPath]"],BLANK_NODE_LABEL:["objectPath","*[,,objectPath]"],ANON:["objectPath","*[,,objectPath]"],PNAME_LN:["objectPath","*[,,objectPath]"],PNAME_NS:["objectPath","*[,,objectPath]"],STRING_LITERAL1:["objectPath","*[,,objectPath]"],STRING_LITERAL2:["objectPath","*[,,objectPath]"],STRING_LITERAL_LONG1:["objectPath","*[,,objectPath]"],STRING_LITERAL_LONG2:["objectPath","*[,,objectPath]"],INTEGER:["objectPath","*[,,objectPath]"],DECIMAL:["objectPath","*[,,objectPath]"],DOUBLE:["objectPath","*[,,objectPath]"],INTEGER_POSITIVE:["objectPath","*[,,objectPath]"],DECIMAL_POSITIVE:["objectPath","*[,,objectPath]"],DOUBLE_POSITIVE:["objectPath","*[,,objectPath]"],INTEGER_NEGATIVE:["objectPath","*[,,objectPath]"],DECIMAL_NEGATIVE:["objectPath","*[,,objectPath]"],DOUBLE_NEGATIVE:["objectPath","*[,,objectPath]"]},objectPath:{"(":["graphNodePath"],"[":["graphNodePath"],VAR1:["graphNodePath"],VAR2:["graphNodePath"],NIL:["graphNodePath"],IRI_REF:["graphNodePath"],TRUE:["graphNodePath"],FALSE:["graphNodePath"],BLANK_NODE_LABEL:["graphNodePath"],ANON:["graphNodePath"],PNAME_LN:["graphNodePath"],PNAME_NS:["graphNodePath"],STRING_LITERAL1:["graphNodePath"],STRING_LITERAL2:["graphNodePath"],STRING_LITERAL_LONG1:["graphNodePath"],STRING_LITERAL_LONG2:["graphNodePath"],INTEGER:["graphNodePath"],DECIMAL:["graphNodePath"],DOUBLE:["graphNodePath"],INTEGER_POSITIVE:["graphNodePath"],DECIMAL_POSITIVE:["graphNodePath"],DOUBLE_POSITIVE:["graphNodePath"],INTEGER_NEGATIVE:["graphNodePath"],DECIMAL_NEGATIVE:["graphNodePath"],DOUBLE_NEGATIVE:["graphNodePath"]},offsetClause:{OFFSET:["OFFSET","INTEGER"]},optionalGraphPattern:{OPTIONAL:["OPTIONAL","groupGraphPattern"]},"or([*,expression])":{"*":["*"],"!":["expression"],"+":["expression"],"-":["expression"],VAR1:["expression"],VAR2:["expression"],"(":["expression"],STR:["expression"],LANG:["expression"],LANGMATCHES:["expression"],DATATYPE:["expression"],BOUND:["expression"],IRI:["expression"],URI:["expression"],BNODE:["expression"],RAND:["expression"],ABS:["expression"],CEIL:["expression"],FLOOR:["expression"],ROUND:["expression"],CONCAT:["expression"],STRLEN:["expression"],UCASE:["expression"],LCASE:["expression"],ENCODE_FOR_URI:["expression"],CONTAINS:["expression"],STRSTARTS:["expression"],STRENDS:["expression"],STRBEFORE:["expression"],STRAFTER:["expression"],YEAR:["expression"],MONTH:["expression"],DAY:["expression"],HOURS:["expression"],MINUTES:["expression"],SECONDS:["expression"],TIMEZONE:["expression"],TZ:["expression"],NOW:["expression"],UUID:["expression"],STRUUID:["expression"],MD5:["expression"],SHA1:["expression"],SHA256:["expression"],SHA384:["expression"],SHA512:["expression"],COALESCE:["expression"],IF:["expression"],STRLANG:["expression"],STRDT:["expression"],SAMETERM:["expression"],ISIRI:["expression"],ISURI:["expression"],ISBLANK:["expression"],ISLITERAL:["expression"],ISNUMERIC:["expression"],TRUE:["expression"],FALSE:["expression"],COUNT:["expression"],SUM:["expression"],MIN:["expression"],MAX:["expression"],AVG:["expression"],SAMPLE:["expression"],GROUP_CONCAT:["expression"],SUBSTR:["expression"],REPLACE:["expression"],REGEX:["expression"],EXISTS:["expression"],NOT:["expression"],IRI_REF:["expression"],STRING_LITERAL1:["expression"],STRING_LITERAL2:["expression"],STRING_LITERAL_LONG1:["expression"],STRING_LITERAL_LONG2:["expression"],INTEGER:["expression"],DECIMAL:["expression"],DOUBLE:["expression"],INTEGER_POSITIVE:["expression"],DECIMAL_POSITIVE:["expression"],DOUBLE_POSITIVE:["expression"],INTEGER_NEGATIVE:["expression"],DECIMAL_NEGATIVE:["expression"],DOUBLE_NEGATIVE:["expression"],PNAME_LN:["expression"],PNAME_NS:["expression"]},"or([+or([var,[ (,expression,AS,var,)]]),*])":{"(":["+or([var,[ (,expression,AS,var,)]])"],VAR1:["+or([var,[ (,expression,AS,var,)]])"],VAR2:["+or([var,[ (,expression,AS,var,)]])"],"*":["*"]},"or([+varOrIRIref,*])":{VAR1:["+varOrIRIref"],VAR2:["+varOrIRIref"],IRI_REF:["+varOrIRIref"],PNAME_LN:["+varOrIRIref"],PNAME_NS:["+varOrIRIref"],"*":["*"]},"or([ASC,DESC])":{ASC:["ASC"],DESC:["DESC"]},"or([DISTINCT,REDUCED])":{DISTINCT:["DISTINCT"],REDUCED:["REDUCED"]},"or([LANGTAG,[^^,iriRef]])":{LANGTAG:["LANGTAG"],"^^":["[^^,iriRef]"]},"or([NIL,[ (,*var,)]])":{NIL:["NIL"],"(":["[ (,*var,)]"]},"or([[ (,*dataBlockValue,)],NIL])":{"(":["[ (,*dataBlockValue,)]"],NIL:["NIL"]},"or([[ (,expression,)],NIL])":{"(":["[ (,expression,)]"],NIL:["NIL"]},"or([[*,unaryExpression],[/,unaryExpression]])":{"*":["[*,unaryExpression]"],"/":["[/,unaryExpression]"]},"or([[+,multiplicativeExpression],[-,multiplicativeExpression],[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]])":{"+":["[+,multiplicativeExpression]"],"-":["[-,multiplicativeExpression]"],INTEGER_POSITIVE:["[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]"],DECIMAL_POSITIVE:["[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]"],DOUBLE_POSITIVE:["[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]"],INTEGER_NEGATIVE:["[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]"],DECIMAL_NEGATIVE:["[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]"],DOUBLE_NEGATIVE:["[or([numericLiteralPositive,numericLiteralNegative]),?or([[*,unaryExpression],[/,unaryExpression]])]"]},"or([[,,or([},[integer,}]])],}])":{",":["[,,or([},[integer,}]])]"],"}":["}"]},"or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])":{"=":["[=,numericExpression]"],"!=":["[!=,numericExpression]"],"<":["[<,numericExpression]"],">":["[>,numericExpression]"],"<=":["[<=,numericExpression]"],">=":["[>=,numericExpression]"],IN:["[IN,expressionList]"],NOT:["[NOT,IN,expressionList]"]},"or([[constructTemplate,*datasetClause,whereClause,solutionModifier],[*datasetClause,WHERE,{,?triplesTemplate,},solutionModifier]])":{"{":["[constructTemplate,*datasetClause,whereClause,solutionModifier]"],WHERE:["[*datasetClause,WHERE,{,?triplesTemplate,},solutionModifier]"],FROM:["[*datasetClause,WHERE,{,?triplesTemplate,},solutionModifier]"]},"or([[deleteClause,?insertClause],insertClause])":{DELETE:["[deleteClause,?insertClause]"],INSERT:["insertClause"]},"or([[integer,or([[,,or([},[integer,}]])],}])],[,,integer,}]])":{INTEGER:["[integer,or([[,,or([},[integer,}]])],}])]"],",":["[,,integer,}]"]},"or([defaultGraphClause,namedGraphClause])":{IRI_REF:["defaultGraphClause"],PNAME_LN:["defaultGraphClause"],PNAME_NS:["defaultGraphClause"],NAMED:["namedGraphClause"]},"or([inlineDataOneVar,inlineDataFull])":{VAR1:["inlineDataOneVar"],VAR2:["inlineDataOneVar"],NIL:["inlineDataFull"],"(":["inlineDataFull"]},"or([iriRef,[NAMED,iriRef]])":{IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"],NAMED:["[NAMED,iriRef]"]},"or([iriRef,a])":{IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"],a:["a"]},"or([numericLiteralPositive,numericLiteralNegative])":{INTEGER_POSITIVE:["numericLiteralPositive"],DECIMAL_POSITIVE:["numericLiteralPositive"],DOUBLE_POSITIVE:["numericLiteralPositive"],INTEGER_NEGATIVE:["numericLiteralNegative"],DECIMAL_NEGATIVE:["numericLiteralNegative"],DOUBLE_NEGATIVE:["numericLiteralNegative"]},"or([queryAll,updateAll])":{CONSTRUCT:["queryAll"],DESCRIBE:["queryAll"],ASK:["queryAll"],SELECT:["queryAll"],INSERT:["updateAll"],DELETE:["updateAll"],LOAD:["updateAll"],CLEAR:["updateAll"],DROP:["updateAll"],ADD:["updateAll"],MOVE:["updateAll"],COPY:["updateAll"],CREATE:["updateAll"],WITH:["updateAll"],$:["updateAll"]},"or([selectQuery,constructQuery,describeQuery,askQuery])":{SELECT:["selectQuery"],CONSTRUCT:["constructQuery"],DESCRIBE:["describeQuery"],ASK:["askQuery"]},"or([subSelect,groupGraphPatternSub])":{SELECT:["subSelect"],"{":["groupGraphPatternSub"],OPTIONAL:["groupGraphPatternSub"],MINUS:["groupGraphPatternSub"],GRAPH:["groupGraphPatternSub"],SERVICE:["groupGraphPatternSub"],FILTER:["groupGraphPatternSub"],BIND:["groupGraphPatternSub"],VALUES:["groupGraphPatternSub"],VAR1:["groupGraphPatternSub"],VAR2:["groupGraphPatternSub"],NIL:["groupGraphPatternSub"],"(":["groupGraphPatternSub"],"[":["groupGraphPatternSub"],IRI_REF:["groupGraphPatternSub"],TRUE:["groupGraphPatternSub"],FALSE:["groupGraphPatternSub"],BLANK_NODE_LABEL:["groupGraphPatternSub"],ANON:["groupGraphPatternSub"],PNAME_LN:["groupGraphPatternSub"],PNAME_NS:["groupGraphPatternSub"],STRING_LITERAL1:["groupGraphPatternSub"],STRING_LITERAL2:["groupGraphPatternSub"],STRING_LITERAL_LONG1:["groupGraphPatternSub"],STRING_LITERAL_LONG2:["groupGraphPatternSub"],INTEGER:["groupGraphPatternSub"],DECIMAL:["groupGraphPatternSub"],DOUBLE:["groupGraphPatternSub"],INTEGER_POSITIVE:["groupGraphPatternSub"],DECIMAL_POSITIVE:["groupGraphPatternSub"],DOUBLE_POSITIVE:["groupGraphPatternSub"],INTEGER_NEGATIVE:["groupGraphPatternSub"],DECIMAL_NEGATIVE:["groupGraphPatternSub"],DOUBLE_NEGATIVE:["groupGraphPatternSub"],"}":["groupGraphPatternSub"]},"or([var,[ (,expression,AS,var,)]])":{VAR1:["var"],VAR2:["var"],"(":["[ (,expression,AS,var,)]"]},"or([verbPath,verbSimple])":{"^":["verbPath"],a:["verbPath"],"!":["verbPath"],"(":["verbPath"],IRI_REF:["verbPath"],PNAME_LN:["verbPath"],PNAME_NS:["verbPath"],VAR1:["verbSimple"],VAR2:["verbSimple"]},"or([},[integer,}]])":{"}":["}"],INTEGER:["[integer,}]"]},orderClause:{ORDER:["ORDER","BY","+orderCondition"]},orderCondition:{ASC:["or([ASC,DESC])","brackettedExpression"],DESC:["or([ASC,DESC])","brackettedExpression"],"(":["constraint"],STR:["constraint"],LANG:["constraint"],LANGMATCHES:["constraint"],DATATYPE:["constraint"],BOUND:["constraint"],IRI:["constraint"],URI:["constraint"],BNODE:["constraint"],RAND:["constraint"],ABS:["constraint"],CEIL:["constraint"],FLOOR:["constraint"],ROUND:["constraint"],CONCAT:["constraint"],STRLEN:["constraint"],UCASE:["constraint"],LCASE:["constraint"],ENCODE_FOR_URI:["constraint"],CONTAINS:["constraint"],STRSTARTS:["constraint"],STRENDS:["constraint"],STRBEFORE:["constraint"],STRAFTER:["constraint"],YEAR:["constraint"],MONTH:["constraint"],DAY:["constraint"],HOURS:["constraint"],MINUTES:["constraint"],SECONDS:["constraint"],TIMEZONE:["constraint"],TZ:["constraint"],NOW:["constraint"],UUID:["constraint"],STRUUID:["constraint"],MD5:["constraint"],SHA1:["constraint"],SHA256:["constraint"],SHA384:["constraint"],SHA512:["constraint"],COALESCE:["constraint"],IF:["constraint"],STRLANG:["constraint"],STRDT:["constraint"],SAMETERM:["constraint"],ISIRI:["constraint"],ISURI:["constraint"],ISBLANK:["constraint"],ISLITERAL:["constraint"],ISNUMERIC:["constraint"],SUBSTR:["constraint"],REPLACE:["constraint"],REGEX:["constraint"],EXISTS:["constraint"],NOT:["constraint"],IRI_REF:["constraint"],PNAME_LN:["constraint"],PNAME_NS:["constraint"],VAR1:["var"],VAR2:["var"]},path:{"^":["pathAlternative"],a:["pathAlternative"],"!":["pathAlternative"],"(":["pathAlternative"],IRI_REF:["pathAlternative"],PNAME_LN:["pathAlternative"],PNAME_NS:["pathAlternative"]},pathAlternative:{"^":["pathSequence","*[|,pathSequence]"],a:["pathSequence","*[|,pathSequence]"],"!":["pathSequence","*[|,pathSequence]"],"(":["pathSequence","*[|,pathSequence]"],IRI_REF:["pathSequence","*[|,pathSequence]"],PNAME_LN:["pathSequence","*[|,pathSequence]"],PNAME_NS:["pathSequence","*[|,pathSequence]"]},pathElt:{a:["pathPrimary","?pathMod"],"!":["pathPrimary","?pathMod"],"(":["pathPrimary","?pathMod"],IRI_REF:["pathPrimary","?pathMod"],PNAME_LN:["pathPrimary","?pathMod"],PNAME_NS:["pathPrimary","?pathMod"]},pathEltOrInverse:{a:["pathElt"],"!":["pathElt"],"(":["pathElt"],IRI_REF:["pathElt"],PNAME_LN:["pathElt"],PNAME_NS:["pathElt"],"^":["^","pathElt"]},pathMod:{"*":["*"],"?":["?"],"+":["+"],"{":["{","or([[integer,or([[,,or([},[integer,}]])],}])],[,,integer,}]])"]},pathNegatedPropertySet:{a:["pathOneInPropertySet"],"^":["pathOneInPropertySet"],IRI_REF:["pathOneInPropertySet"],PNAME_LN:["pathOneInPropertySet"],PNAME_NS:["pathOneInPropertySet"],"(":["(","?[pathOneInPropertySet,*[|,pathOneInPropertySet]]",")"]},pathOneInPropertySet:{IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"],a:["a"],"^":["^","or([iriRef,a])"]},pathPrimary:{IRI_REF:["storeProperty","iriRef"],PNAME_LN:["storeProperty","iriRef"],PNAME_NS:["storeProperty","iriRef"],a:["storeProperty","a"],"!":["!","pathNegatedPropertySet"],"(":["(","path",")"]},pathSequence:{"^":["pathEltOrInverse","*[/,pathEltOrInverse]"],a:["pathEltOrInverse","*[/,pathEltOrInverse]"],"!":["pathEltOrInverse","*[/,pathEltOrInverse]"],"(":["pathEltOrInverse","*[/,pathEltOrInverse]"],IRI_REF:["pathEltOrInverse","*[/,pathEltOrInverse]"],PNAME_LN:["pathEltOrInverse","*[/,pathEltOrInverse]"],PNAME_NS:["pathEltOrInverse","*[/,pathEltOrInverse]"]},prefixDecl:{PREFIX:["PREFIX","PNAME_NS","IRI_REF"]},prefixedName:{PNAME_LN:["PNAME_LN"],PNAME_NS:["PNAME_NS"]},primaryExpression:{"(":["brackettedExpression"],STR:["builtInCall"],LANG:["builtInCall"],LANGMATCHES:["builtInCall"],DATATYPE:["builtInCall"],BOUND:["builtInCall"],IRI:["builtInCall"],URI:["builtInCall"],BNODE:["builtInCall"],RAND:["builtInCall"],ABS:["builtInCall"],CEIL:["builtInCall"],FLOOR:["builtInCall"],ROUND:["builtInCall"],CONCAT:["builtInCall"],STRLEN:["builtInCall"],UCASE:["builtInCall"],LCASE:["builtInCall"],ENCODE_FOR_URI:["builtInCall"],CONTAINS:["builtInCall"],STRSTARTS:["builtInCall"],STRENDS:["builtInCall"],STRBEFORE:["builtInCall"],STRAFTER:["builtInCall"],YEAR:["builtInCall"],MONTH:["builtInCall"],DAY:["builtInCall"],HOURS:["builtInCall"],MINUTES:["builtInCall"],SECONDS:["builtInCall"],TIMEZONE:["builtInCall"],TZ:["builtInCall"],NOW:["builtInCall"],UUID:["builtInCall"],STRUUID:["builtInCall"],MD5:["builtInCall"],SHA1:["builtInCall"],SHA256:["builtInCall"],SHA384:["builtInCall"],SHA512:["builtInCall"],COALESCE:["builtInCall"],IF:["builtInCall"],STRLANG:["builtInCall"],STRDT:["builtInCall"],SAMETERM:["builtInCall"],ISIRI:["builtInCall"],ISURI:["builtInCall"],ISBLANK:["builtInCall"],ISLITERAL:["builtInCall"],ISNUMERIC:["builtInCall"],SUBSTR:["builtInCall"],REPLACE:["builtInCall"],REGEX:["builtInCall"],EXISTS:["builtInCall"],NOT:["builtInCall"],IRI_REF:["iriRefOrFunction"],PNAME_LN:["iriRefOrFunction"],PNAME_NS:["iriRefOrFunction"],STRING_LITERAL1:["rdfLiteral"],STRING_LITERAL2:["rdfLiteral"],STRING_LITERAL_LONG1:["rdfLiteral"],STRING_LITERAL_LONG2:["rdfLiteral"],INTEGER:["numericLiteral"],DECIMAL:["numericLiteral"],DOUBLE:["numericLiteral"],INTEGER_POSITIVE:["numericLiteral"],DECIMAL_POSITIVE:["numericLiteral"],DOUBLE_POSITIVE:["numericLiteral"],INTEGER_NEGATIVE:["numericLiteral"],DECIMAL_NEGATIVE:["numericLiteral"],DOUBLE_NEGATIVE:["numericLiteral"],TRUE:["booleanLiteral"],FALSE:["booleanLiteral"],VAR1:["var"],VAR2:["var"],COUNT:["aggregate"],SUM:["aggregate"],MIN:["aggregate"],MAX:["aggregate"],AVG:["aggregate"],SAMPLE:["aggregate"],GROUP_CONCAT:["aggregate"]},prologue:{PREFIX:["?baseDecl","*prefixDecl"],BASE:["?baseDecl","*prefixDecl"],$:["?baseDecl","*prefixDecl"],CONSTRUCT:["?baseDecl","*prefixDecl"],DESCRIBE:["?baseDecl","*prefixDecl"],ASK:["?baseDecl","*prefixDecl"],INSERT:["?baseDecl","*prefixDecl"],DELETE:["?baseDecl","*prefixDecl"],SELECT:["?baseDecl","*prefixDecl"],LOAD:["?baseDecl","*prefixDecl"],CLEAR:["?baseDecl","*prefixDecl"],DROP:["?baseDecl","*prefixDecl"],ADD:["?baseDecl","*prefixDecl"],MOVE:["?baseDecl","*prefixDecl"],COPY:["?baseDecl","*prefixDecl"],CREATE:["?baseDecl","*prefixDecl"],WITH:["?baseDecl","*prefixDecl"]},propertyList:{a:["propertyListNotEmpty"],VAR1:["propertyListNotEmpty"],VAR2:["propertyListNotEmpty"],IRI_REF:["propertyListNotEmpty"],PNAME_LN:["propertyListNotEmpty"],PNAME_NS:["propertyListNotEmpty"],".":[],"}":[],GRAPH:[]},propertyListNotEmpty:{a:["verb","objectList","*[;,?[verb,objectList]]"],VAR1:["verb","objectList","*[;,?[verb,objectList]]"],VAR2:["verb","objectList","*[;,?[verb,objectList]]"],IRI_REF:["verb","objectList","*[;,?[verb,objectList]]"],PNAME_LN:["verb","objectList","*[;,?[verb,objectList]]"],PNAME_NS:["verb","objectList","*[;,?[verb,objectList]]"]},propertyListPath:{a:["propertyListNotEmpty"],VAR1:["propertyListNotEmpty"],VAR2:["propertyListNotEmpty"],IRI_REF:["propertyListNotEmpty"],PNAME_LN:["propertyListNotEmpty"],PNAME_NS:["propertyListNotEmpty"],".":[],"{":[],OPTIONAL:[],MINUS:[],GRAPH:[],SERVICE:[],FILTER:[],BIND:[],VALUES:[],"}":[]},propertyListPathNotEmpty:{VAR1:["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],VAR2:["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],"^":["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],a:["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],"!":["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],"(":["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],IRI_REF:["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],PNAME_LN:["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"],PNAME_NS:["or([verbPath,verbSimple])","objectListPath","*[;,?[or([verbPath,verbSimple]),objectList]]"]},quadData:{"{":["{","disallowVars","quads","allowVars","}"]},quadDataNoBnodes:{"{":["{","disallowBnodes","disallowVars","quads","allowVars","allowBnodes","}"]},quadPattern:{"{":["{","quads","}"]},quadPatternNoBnodes:{"{":["{","disallowBnodes","quads","allowBnodes","}"]},quads:{GRAPH:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],VAR1:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],VAR2:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],NIL:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],"(":["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],"[":["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],IRI_REF:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],TRUE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],FALSE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],BLANK_NODE_LABEL:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],ANON:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],PNAME_LN:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],PNAME_NS:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],STRING_LITERAL1:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],STRING_LITERAL2:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],STRING_LITERAL_LONG1:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],STRING_LITERAL_LONG2:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],INTEGER:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],DECIMAL:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],DOUBLE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],INTEGER_POSITIVE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],DECIMAL_POSITIVE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],DOUBLE_POSITIVE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],INTEGER_NEGATIVE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],DECIMAL_NEGATIVE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],DOUBLE_NEGATIVE:["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"],"}":["?triplesTemplate","*[quadsNotTriples,?.,?triplesTemplate]"]},quadsNotTriples:{GRAPH:["GRAPH","varOrIRIref","{","?triplesTemplate","}"]},queryAll:{CONSTRUCT:["or([selectQuery,constructQuery,describeQuery,askQuery])","valuesClause"],DESCRIBE:["or([selectQuery,constructQuery,describeQuery,askQuery])","valuesClause"],ASK:["or([selectQuery,constructQuery,describeQuery,askQuery])","valuesClause"],SELECT:["or([selectQuery,constructQuery,describeQuery,askQuery])","valuesClause"]},rdfLiteral:{STRING_LITERAL1:["string","?or([LANGTAG,[^^,iriRef]])"],STRING_LITERAL2:["string","?or([LANGTAG,[^^,iriRef]])"],STRING_LITERAL_LONG1:["string","?or([LANGTAG,[^^,iriRef]])"],STRING_LITERAL_LONG2:["string","?or([LANGTAG,[^^,iriRef]])"]},regexExpression:{REGEX:["REGEX","(","expression",",","expression","?[,,expression]",")"]},relationalExpression:{"!":["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],"+":["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],"-":["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],VAR1:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],VAR2:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],"(":["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STR:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],LANG:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],LANGMATCHES:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DATATYPE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],BOUND:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],IRI:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],URI:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],BNODE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],RAND:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ABS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],CEIL:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],FLOOR:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ROUND:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],CONCAT:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRLEN:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],UCASE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],LCASE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ENCODE_FOR_URI:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],CONTAINS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRSTARTS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRENDS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRBEFORE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRAFTER:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],YEAR:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],MONTH:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DAY:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],HOURS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],MINUTES:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SECONDS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],TIMEZONE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],TZ:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],NOW:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],UUID:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRUUID:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],MD5:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SHA1:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SHA256:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SHA384:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SHA512:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],COALESCE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],IF:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRLANG:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRDT:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SAMETERM:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ISIRI:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ISURI:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ISBLANK:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ISLITERAL:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],ISNUMERIC:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],TRUE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],FALSE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],COUNT:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SUM:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],MIN:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],MAX:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],AVG:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SAMPLE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],GROUP_CONCAT:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],SUBSTR:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],REPLACE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],REGEX:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],EXISTS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],NOT:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],IRI_REF:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRING_LITERAL1:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRING_LITERAL2:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRING_LITERAL_LONG1:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],STRING_LITERAL_LONG2:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],INTEGER:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DECIMAL:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DOUBLE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],INTEGER_POSITIVE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DECIMAL_POSITIVE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DOUBLE_POSITIVE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],INTEGER_NEGATIVE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DECIMAL_NEGATIVE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],DOUBLE_NEGATIVE:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],PNAME_LN:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"],PNAME_NS:["numericExpression","?or([[=,numericExpression],[!=,numericExpression],[<,numericExpression],[>,numericExpression],[<=,numericExpression],[>=,numericExpression],[IN,expressionList],[NOT,IN,expressionList]])"]},selectClause:{SELECT:["SELECT","?or([DISTINCT,REDUCED])","or([+or([var,[ (,expression,AS,var,)]]),*])"]},selectQuery:{SELECT:["selectClause","*datasetClause","whereClause","solutionModifier"]},serviceGraphPattern:{SERVICE:["SERVICE","?SILENT","varOrIRIref","groupGraphPattern"]},solutionModifier:{LIMIT:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],OFFSET:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],ORDER:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],HAVING:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],GROUP:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],VALUES:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],$:["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"],"}":["?groupClause","?havingClause","?orderClause","?limitOffsetClauses"]},sourceSelector:{IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"]},sparql11:{$:["prologue","or([queryAll,updateAll])","$"],CONSTRUCT:["prologue","or([queryAll,updateAll])","$"],DESCRIBE:["prologue","or([queryAll,updateAll])","$"],ASK:["prologue","or([queryAll,updateAll])","$"],INSERT:["prologue","or([queryAll,updateAll])","$"],DELETE:["prologue","or([queryAll,updateAll])","$"],SELECT:["prologue","or([queryAll,updateAll])","$"],LOAD:["prologue","or([queryAll,updateAll])","$"],CLEAR:["prologue","or([queryAll,updateAll])","$"],DROP:["prologue","or([queryAll,updateAll])","$"],ADD:["prologue","or([queryAll,updateAll])","$"],MOVE:["prologue","or([queryAll,updateAll])","$"],COPY:["prologue","or([queryAll,updateAll])","$"],CREATE:["prologue","or([queryAll,updateAll])","$"],WITH:["prologue","or([queryAll,updateAll])","$"],PREFIX:["prologue","or([queryAll,updateAll])","$"],BASE:["prologue","or([queryAll,updateAll])","$"]},storeProperty:{VAR1:[],VAR2:[],IRI_REF:[],PNAME_LN:[],PNAME_NS:[],a:[]},strReplaceExpression:{REPLACE:["REPLACE","(","expression",",","expression",",","expression","?[,,expression]",")"]},string:{STRING_LITERAL1:["STRING_LITERAL1"],STRING_LITERAL2:["STRING_LITERAL2"],STRING_LITERAL_LONG1:["STRING_LITERAL_LONG1"],STRING_LITERAL_LONG2:["STRING_LITERAL_LONG2"]},subSelect:{SELECT:["selectClause","whereClause","solutionModifier","valuesClause"]},substringExpression:{SUBSTR:["SUBSTR","(","expression",",","expression","?[,,expression]",")"]},triplesBlock:{VAR1:["triplesSameSubjectPath","?[.,?triplesBlock]"],VAR2:["triplesSameSubjectPath","?[.,?triplesBlock]"],NIL:["triplesSameSubjectPath","?[.,?triplesBlock]"],"(":["triplesSameSubjectPath","?[.,?triplesBlock]"],"[":["triplesSameSubjectPath","?[.,?triplesBlock]"],IRI_REF:["triplesSameSubjectPath","?[.,?triplesBlock]"],TRUE:["triplesSameSubjectPath","?[.,?triplesBlock]"],FALSE:["triplesSameSubjectPath","?[.,?triplesBlock]"],BLANK_NODE_LABEL:["triplesSameSubjectPath","?[.,?triplesBlock]"],ANON:["triplesSameSubjectPath","?[.,?triplesBlock]"],PNAME_LN:["triplesSameSubjectPath","?[.,?triplesBlock]"],PNAME_NS:["triplesSameSubjectPath","?[.,?triplesBlock]"],STRING_LITERAL1:["triplesSameSubjectPath","?[.,?triplesBlock]"],STRING_LITERAL2:["triplesSameSubjectPath","?[.,?triplesBlock]"],STRING_LITERAL_LONG1:["triplesSameSubjectPath","?[.,?triplesBlock]"],STRING_LITERAL_LONG2:["triplesSameSubjectPath","?[.,?triplesBlock]"],INTEGER:["triplesSameSubjectPath","?[.,?triplesBlock]"],DECIMAL:["triplesSameSubjectPath","?[.,?triplesBlock]"],DOUBLE:["triplesSameSubjectPath","?[.,?triplesBlock]"],INTEGER_POSITIVE:["triplesSameSubjectPath","?[.,?triplesBlock]"],DECIMAL_POSITIVE:["triplesSameSubjectPath","?[.,?triplesBlock]"],DOUBLE_POSITIVE:["triplesSameSubjectPath","?[.,?triplesBlock]"],INTEGER_NEGATIVE:["triplesSameSubjectPath","?[.,?triplesBlock]"],DECIMAL_NEGATIVE:["triplesSameSubjectPath","?[.,?triplesBlock]"],DOUBLE_NEGATIVE:["triplesSameSubjectPath","?[.,?triplesBlock]"]},triplesNode:{"(":["collection"],"[":["blankNodePropertyList"]},triplesNodePath:{"(":["collectionPath"],"[":["blankNodePropertyListPath"]},triplesSameSubject:{VAR1:["varOrTerm","propertyListNotEmpty"],VAR2:["varOrTerm","propertyListNotEmpty"],NIL:["varOrTerm","propertyListNotEmpty"],IRI_REF:["varOrTerm","propertyListNotEmpty"],TRUE:["varOrTerm","propertyListNotEmpty"],FALSE:["varOrTerm","propertyListNotEmpty"],BLANK_NODE_LABEL:["varOrTerm","propertyListNotEmpty"],ANON:["varOrTerm","propertyListNotEmpty"],PNAME_LN:["varOrTerm","propertyListNotEmpty"],PNAME_NS:["varOrTerm","propertyListNotEmpty"],STRING_LITERAL1:["varOrTerm","propertyListNotEmpty"],STRING_LITERAL2:["varOrTerm","propertyListNotEmpty"],STRING_LITERAL_LONG1:["varOrTerm","propertyListNotEmpty"],STRING_LITERAL_LONG2:["varOrTerm","propertyListNotEmpty"],INTEGER:["varOrTerm","propertyListNotEmpty"],DECIMAL:["varOrTerm","propertyListNotEmpty"],DOUBLE:["varOrTerm","propertyListNotEmpty"],INTEGER_POSITIVE:["varOrTerm","propertyListNotEmpty"],DECIMAL_POSITIVE:["varOrTerm","propertyListNotEmpty"],DOUBLE_POSITIVE:["varOrTerm","propertyListNotEmpty"],INTEGER_NEGATIVE:["varOrTerm","propertyListNotEmpty"],DECIMAL_NEGATIVE:["varOrTerm","propertyListNotEmpty"],DOUBLE_NEGATIVE:["varOrTerm","propertyListNotEmpty"],"(":["triplesNode","propertyList"],"[":["triplesNode","propertyList"]},triplesSameSubjectPath:{VAR1:["varOrTerm","propertyListPathNotEmpty"],VAR2:["varOrTerm","propertyListPathNotEmpty"],NIL:["varOrTerm","propertyListPathNotEmpty"],IRI_REF:["varOrTerm","propertyListPathNotEmpty"],TRUE:["varOrTerm","propertyListPathNotEmpty"],FALSE:["varOrTerm","propertyListPathNotEmpty"],BLANK_NODE_LABEL:["varOrTerm","propertyListPathNotEmpty"],ANON:["varOrTerm","propertyListPathNotEmpty"],PNAME_LN:["varOrTerm","propertyListPathNotEmpty"],PNAME_NS:["varOrTerm","propertyListPathNotEmpty"],STRING_LITERAL1:["varOrTerm","propertyListPathNotEmpty"],STRING_LITERAL2:["varOrTerm","propertyListPathNotEmpty"],STRING_LITERAL_LONG1:["varOrTerm","propertyListPathNotEmpty"],STRING_LITERAL_LONG2:["varOrTerm","propertyListPathNotEmpty"],INTEGER:["varOrTerm","propertyListPathNotEmpty"],DECIMAL:["varOrTerm","propertyListPathNotEmpty"],DOUBLE:["varOrTerm","propertyListPathNotEmpty"],INTEGER_POSITIVE:["varOrTerm","propertyListPathNotEmpty"],DECIMAL_POSITIVE:["varOrTerm","propertyListPathNotEmpty"],DOUBLE_POSITIVE:["varOrTerm","propertyListPathNotEmpty"],INTEGER_NEGATIVE:["varOrTerm","propertyListPathNotEmpty"],DECIMAL_NEGATIVE:["varOrTerm","propertyListPathNotEmpty"],DOUBLE_NEGATIVE:["varOrTerm","propertyListPathNotEmpty"],"(":["triplesNodePath","propertyListPath"],"[":["triplesNodePath","propertyListPath"]},triplesTemplate:{VAR1:["triplesSameSubject","?[.,?triplesTemplate]"],VAR2:["triplesSameSubject","?[.,?triplesTemplate]"],NIL:["triplesSameSubject","?[.,?triplesTemplate]"],"(":["triplesSameSubject","?[.,?triplesTemplate]"],"[":["triplesSameSubject","?[.,?triplesTemplate]"],IRI_REF:["triplesSameSubject","?[.,?triplesTemplate]"],TRUE:["triplesSameSubject","?[.,?triplesTemplate]"],FALSE:["triplesSameSubject","?[.,?triplesTemplate]"],BLANK_NODE_LABEL:["triplesSameSubject","?[.,?triplesTemplate]"],ANON:["triplesSameSubject","?[.,?triplesTemplate]"],PNAME_LN:["triplesSameSubject","?[.,?triplesTemplate]"],PNAME_NS:["triplesSameSubject","?[.,?triplesTemplate]"],STRING_LITERAL1:["triplesSameSubject","?[.,?triplesTemplate]"],STRING_LITERAL2:["triplesSameSubject","?[.,?triplesTemplate]"],STRING_LITERAL_LONG1:["triplesSameSubject","?[.,?triplesTemplate]"],STRING_LITERAL_LONG2:["triplesSameSubject","?[.,?triplesTemplate]"],INTEGER:["triplesSameSubject","?[.,?triplesTemplate]"],DECIMAL:["triplesSameSubject","?[.,?triplesTemplate]"],DOUBLE:["triplesSameSubject","?[.,?triplesTemplate]"],INTEGER_POSITIVE:["triplesSameSubject","?[.,?triplesTemplate]"],DECIMAL_POSITIVE:["triplesSameSubject","?[.,?triplesTemplate]"],DOUBLE_POSITIVE:["triplesSameSubject","?[.,?triplesTemplate]"],INTEGER_NEGATIVE:["triplesSameSubject","?[.,?triplesTemplate]"],DECIMAL_NEGATIVE:["triplesSameSubject","?[.,?triplesTemplate]"],DOUBLE_NEGATIVE:["triplesSameSubject","?[.,?triplesTemplate]"]},unaryExpression:{"!":["!","primaryExpression"],"+":["+","primaryExpression"],"-":["-","primaryExpression"],VAR1:["primaryExpression"],VAR2:["primaryExpression"],"(":["primaryExpression"],STR:["primaryExpression"],LANG:["primaryExpression"],LANGMATCHES:["primaryExpression"],DATATYPE:["primaryExpression"],BOUND:["primaryExpression"],IRI:["primaryExpression"],URI:["primaryExpression"],BNODE:["primaryExpression"],RAND:["primaryExpression"],ABS:["primaryExpression"],CEIL:["primaryExpression"],FLOOR:["primaryExpression"],ROUND:["primaryExpression"],CONCAT:["primaryExpression"],STRLEN:["primaryExpression"],UCASE:["primaryExpression"],LCASE:["primaryExpression"],ENCODE_FOR_URI:["primaryExpression"],CONTAINS:["primaryExpression"],STRSTARTS:["primaryExpression"],STRENDS:["primaryExpression"],STRBEFORE:["primaryExpression"],STRAFTER:["primaryExpression"],YEAR:["primaryExpression"],MONTH:["primaryExpression"],DAY:["primaryExpression"],HOURS:["primaryExpression"],MINUTES:["primaryExpression"],SECONDS:["primaryExpression"],TIMEZONE:["primaryExpression"],TZ:["primaryExpression"],NOW:["primaryExpression"],UUID:["primaryExpression"],STRUUID:["primaryExpression"],MD5:["primaryExpression"],SHA1:["primaryExpression"],SHA256:["primaryExpression"],SHA384:["primaryExpression"],SHA512:["primaryExpression"],COALESCE:["primaryExpression"],IF:["primaryExpression"],STRLANG:["primaryExpression"],STRDT:["primaryExpression"],SAMETERM:["primaryExpression"],ISIRI:["primaryExpression"],ISURI:["primaryExpression"],ISBLANK:["primaryExpression"],ISLITERAL:["primaryExpression"],ISNUMERIC:["primaryExpression"],TRUE:["primaryExpression"],FALSE:["primaryExpression"],COUNT:["primaryExpression"],SUM:["primaryExpression"],MIN:["primaryExpression"],MAX:["primaryExpression"],AVG:["primaryExpression"],SAMPLE:["primaryExpression"],GROUP_CONCAT:["primaryExpression"],SUBSTR:["primaryExpression"],REPLACE:["primaryExpression"],REGEX:["primaryExpression"],EXISTS:["primaryExpression"],NOT:["primaryExpression"],IRI_REF:["primaryExpression"],STRING_LITERAL1:["primaryExpression"],STRING_LITERAL2:["primaryExpression"],STRING_LITERAL_LONG1:["primaryExpression"],STRING_LITERAL_LONG2:["primaryExpression"],INTEGER:["primaryExpression"],DECIMAL:["primaryExpression"],DOUBLE:["primaryExpression"],INTEGER_POSITIVE:["primaryExpression"],DECIMAL_POSITIVE:["primaryExpression"],DOUBLE_POSITIVE:["primaryExpression"],INTEGER_NEGATIVE:["primaryExpression"],DECIMAL_NEGATIVE:["primaryExpression"],DOUBLE_NEGATIVE:["primaryExpression"],PNAME_LN:["primaryExpression"],PNAME_NS:["primaryExpression"]},update:{INSERT:["prologue","?[update1,?[;,update]]"],DELETE:["prologue","?[update1,?[;,update]]"],LOAD:["prologue","?[update1,?[;,update]]"],CLEAR:["prologue","?[update1,?[;,update]]"],DROP:["prologue","?[update1,?[;,update]]"],ADD:["prologue","?[update1,?[;,update]]"],MOVE:["prologue","?[update1,?[;,update]]"],COPY:["prologue","?[update1,?[;,update]]"],CREATE:["prologue","?[update1,?[;,update]]"],WITH:["prologue","?[update1,?[;,update]]"],PREFIX:["prologue","?[update1,?[;,update]]"],BASE:["prologue","?[update1,?[;,update]]"],$:["prologue","?[update1,?[;,update]]"]},update1:{LOAD:["load"],CLEAR:["clear"],DROP:["drop"],ADD:["add"],MOVE:["move"],COPY:["copy"],CREATE:["create"],INSERT:["INSERT","insert1"],DELETE:["DELETE","delete1"],WITH:["modify"]},updateAll:{INSERT:["?[update1,?[;,update]]"],DELETE:["?[update1,?[;,update]]"],LOAD:["?[update1,?[;,update]]"],CLEAR:["?[update1,?[;,update]]"],DROP:["?[update1,?[;,update]]"],ADD:["?[update1,?[;,update]]"],MOVE:["?[update1,?[;,update]]"],COPY:["?[update1,?[;,update]]"],CREATE:["?[update1,?[;,update]]"],WITH:["?[update1,?[;,update]]"],$:["?[update1,?[;,update]]"]},usingClause:{USING:["USING","or([iriRef,[NAMED,iriRef]])"]},valueLogical:{"!":["relationalExpression"],"+":["relationalExpression"],"-":["relationalExpression"],VAR1:["relationalExpression"],VAR2:["relationalExpression"],"(":["relationalExpression"],STR:["relationalExpression"],LANG:["relationalExpression"],LANGMATCHES:["relationalExpression"],DATATYPE:["relationalExpression"],BOUND:["relationalExpression"],IRI:["relationalExpression"],URI:["relationalExpression"],BNODE:["relationalExpression"],RAND:["relationalExpression"],ABS:["relationalExpression"],CEIL:["relationalExpression"],FLOOR:["relationalExpression"],ROUND:["relationalExpression"],CONCAT:["relationalExpression"],STRLEN:["relationalExpression"],UCASE:["relationalExpression"],LCASE:["relationalExpression"],ENCODE_FOR_URI:["relationalExpression"],CONTAINS:["relationalExpression"],STRSTARTS:["relationalExpression"],STRENDS:["relationalExpression"],STRBEFORE:["relationalExpression"],STRAFTER:["relationalExpression"],YEAR:["relationalExpression"],MONTH:["relationalExpression"],DAY:["relationalExpression"],HOURS:["relationalExpression"],MINUTES:["relationalExpression"],SECONDS:["relationalExpression"],TIMEZONE:["relationalExpression"],TZ:["relationalExpression"],NOW:["relationalExpression"],UUID:["relationalExpression"],STRUUID:["relationalExpression"],MD5:["relationalExpression"],SHA1:["relationalExpression"],SHA256:["relationalExpression"],SHA384:["relationalExpression"],SHA512:["relationalExpression"],COALESCE:["relationalExpression"],IF:["relationalExpression"],STRLANG:["relationalExpression"],STRDT:["relationalExpression"],SAMETERM:["relationalExpression"],ISIRI:["relationalExpression"],ISURI:["relationalExpression"],ISBLANK:["relationalExpression"],ISLITERAL:["relationalExpression"],ISNUMERIC:["relationalExpression"],TRUE:["relationalExpression"],FALSE:["relationalExpression"],COUNT:["relationalExpression"],SUM:["relationalExpression"],MIN:["relationalExpression"],MAX:["relationalExpression"],AVG:["relationalExpression"],SAMPLE:["relationalExpression"],GROUP_CONCAT:["relationalExpression"],SUBSTR:["relationalExpression"],REPLACE:["relationalExpression"],REGEX:["relationalExpression"],EXISTS:["relationalExpression"],NOT:["relationalExpression"],IRI_REF:["relationalExpression"],STRING_LITERAL1:["relationalExpression"],STRING_LITERAL2:["relationalExpression"],STRING_LITERAL_LONG1:["relationalExpression"],STRING_LITERAL_LONG2:["relationalExpression"],INTEGER:["relationalExpression"],DECIMAL:["relationalExpression"],DOUBLE:["relationalExpression"],INTEGER_POSITIVE:["relationalExpression"],DECIMAL_POSITIVE:["relationalExpression"],DOUBLE_POSITIVE:["relationalExpression"],INTEGER_NEGATIVE:["relationalExpression"],DECIMAL_NEGATIVE:["relationalExpression"],DOUBLE_NEGATIVE:["relationalExpression"],PNAME_LN:["relationalExpression"],PNAME_NS:["relationalExpression"]},valuesClause:{VALUES:["VALUES","dataBlock"],$:[],"}":[]},"var":{VAR1:["VAR1"],VAR2:["VAR2"]},varOrIRIref:{VAR1:["var"],VAR2:["var"],IRI_REF:["iriRef"],PNAME_LN:["iriRef"],PNAME_NS:["iriRef"]},varOrTerm:{VAR1:["var"],VAR2:["var"],NIL:["graphTerm"],IRI_REF:["graphTerm"],TRUE:["graphTerm"],FALSE:["graphTerm"],BLANK_NODE_LABEL:["graphTerm"],ANON:["graphTerm"],PNAME_LN:["graphTerm"],PNAME_NS:["graphTerm"],STRING_LITERAL1:["graphTerm"],STRING_LITERAL2:["graphTerm"],STRING_LITERAL_LONG1:["graphTerm"],STRING_LITERAL_LONG2:["graphTerm"],INTEGER:["graphTerm"],DECIMAL:["graphTerm"],DOUBLE:["graphTerm"],INTEGER_POSITIVE:["graphTerm"],DECIMAL_POSITIVE:["graphTerm"],DOUBLE_POSITIVE:["graphTerm"],INTEGER_NEGATIVE:["graphTerm"],DECIMAL_NEGATIVE:["graphTerm"],DOUBLE_NEGATIVE:["graphTerm"]},verb:{VAR1:["storeProperty","varOrIRIref"],VAR2:["storeProperty","varOrIRIref"],IRI_REF:["storeProperty","varOrIRIref"],PNAME_LN:["storeProperty","varOrIRIref"],PNAME_NS:["storeProperty","varOrIRIref"],a:["storeProperty","a"]},verbPath:{"^":["path"],a:["path"],"!":["path"],"(":["path"],IRI_REF:["path"],PNAME_LN:["path"],PNAME_NS:["path"]},verbSimple:{VAR1:["var"],VAR2:["var"]},whereClause:{"{":["?WHERE","groupGraphPattern"],WHERE:["?WHERE","groupGraphPattern"]}}),s=/^(GROUP_CONCAT|DATATYPE|BASE|PREFIX|SELECT|CONSTRUCT|DESCRIBE|ASK|FROM|NAMED|ORDER|BY|LIMIT|ASC|DESC|OFFSET|DISTINCT|REDUCED|WHERE|GRAPH|OPTIONAL|UNION|FILTER|GROUP|HAVING|AS|VALUES|LOAD|CLEAR|DROP|CREATE|MOVE|COPY|SILENT|INSERT|DELETE|DATA|WITH|TO|USING|NAMED|MINUS|BIND|LANGMATCHES|LANG|BOUND|SAMETERM|ISIRI|ISURI|ISBLANK|ISLITERAL|REGEX|TRUE|FALSE|UNDEF|ADD|DEFAULT|ALL|SERVICE|INTO|IN|NOT|IRI|URI|BNODE|RAND|ABS|CEIL|FLOOR|ROUND|CONCAT|STRLEN|UCASE|LCASE|ENCODE_FOR_URI|CONTAINS|STRSTARTS|STRENDS|STRBEFORE|STRAFTER|YEAR|MONTH|DAY|HOURS|MINUTES|SECONDS|TIMEZONE|TZ|NOW|UUID|STRUUID|MD5|SHA1|SHA256|SHA384|SHA512|COALESCE|IF|STRLANG|STRDT|ISNUMERIC|SUBSTR|REPLACE|EXISTS|COUNT|SUM|MIN|MAX|AVG|SAMPLE|SEPARATOR|STR)/i,a=/^(\*|a|\.|\{|\}|,|\(|\)|;|\[|\]|\|\||&&|=|!=|!|<=|>=|<|>|\+|-|\/|\^\^|\?|\||\^)/,l=null,u="sparql11",p="sparql11",c=!0,d=t(),E=d.terminal,h={"*[,, object]":3,"*[(,),object]":3,"*[(,),objectPath]":3,"*[/,pathEltOrInverse]":2,object:2,objectPath:2,objectList:2,objectListPath:2,storeProperty:2,pathMod:2,"?pathMod":2,propertyListNotEmpty:1,propertyList:1,propertyListPath:1,propertyListPathNotEmpty:1,"?[verb,objectList]":1,"?[or([verbPath, verbSimple]),objectList]":1},f={"}":1,"]":0,")":1,"{":-1,"(":-1,"*[;,?[or([verbPath,verbSimple]),objectList]]":1}; return{token:r,startState:function(){return{tokenize:r,OK:!0,complete:c,errorStartPos:null,errorEndPos:null,queryType:l,possibleCurrent:i(p),possibleNext:i(p),allowVars:!0,allowBnodes:!0,storeProperty:!1,lastProperty:"",stack:[p]}},indent:n,electricChars:"}])"}}),e.defineMIME("application/x-sparql-query","sparql11")})},{codemirror:8}],3:[function(e,t){t.exports=Trie=function(){this.words=0,this.prefixes=0,this.children=[]},Trie.prototype={insert:function(e,t){if(0!=e.length){var i,r,n=this;if(void 0===t&&(t=0),t===e.length)return void n.words++;n.prefixes++,i=e[t],void 0===n.children[i]&&(n.children[i]=new Trie),r=n.children[i],r.insert(e,t+1)}},remove:function(e,t){if(0!=e.length){var i,r,n=this;if(void 0===t&&(t=0),void 0!==n){if(t===e.length)return void n.words--;n.prefixes--,i=e[t],r=n.children[i],r.remove(e,t+1)}}},update:function(e,t){0!=e.length&&0!=t.length&&(this.remove(e),this.insert(t))},countWord:function(e,t){if(0==e.length)return 0;var i,r,n=this,o=0;return void 0===t&&(t=0),t===e.length?n.words:(i=e[t],r=n.children[i],void 0!==r&&(o=r.countWord(e,t+1)),o)},countPrefix:function(e,t){if(0==e.length)return 0;var i,r,n=this,o=0;if(void 0===t&&(t=0),t===e.length)return n.prefixes;var i=e[t];return r=n.children[i],void 0!==r&&(o=r.countPrefix(e,t+1)),o},find:function(e){return 0==e.length?!1:this.countWord(e)>0?!0:!1},getAllWords:function(e){var t,i,r=this,n=[];if(void 0===e&&(e=""),void 0===r)return[];r.words>0&&n.push(e);for(t in r.children)i=r.children[t],n=n.concat(i.getAllWords(e+t));return n},autoComplete:function(e,t){var i,r,n=this;return 0==e.length?void 0===t?n.getAllWords(e):[]:(void 0===t&&(t=0),i=e[t],r=n.children[i],void 0===r?[]:t===e.length-1?r.getAllWords(e):r.autoComplete(e,t+1))}}},{}],4:[function(t,i,r){!function(n){"object"==typeof r&&"object"==typeof i?n(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],n):n(CodeMirror)}(function(e){function t(e,t,r,n){var o=e.getLineHandle(t.line),l=t.ch-1,u=l>=0&&a[o.text.charAt(l)]||a[o.text.charAt(++l)];if(!u)return null;var p=">"==u.charAt(1)?1:-1;if(r&&p>0!=(l==t.ch))return null;var c=e.getTokenTypeAt(s(t.line,l+1)),d=i(e,s(t.line,l+(p>0?1:0)),p,c||null,n);return null==d?null:{from:s(t.line,l),to:d&&d.pos,match:d&&d.ch==u.charAt(0),forward:p>0}}function i(e,t,i,r,n){for(var o=n&&n.maxScanLineLength||1e4,l=n&&n.maxScanLines||1e3,u=[],p=n&&n.bracketRegex?n.bracketRegex:/[(){}[\]]/,c=i>0?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),d=t.line;d!=c;d+=i){var E=e.getLine(d);if(E){var h=i>0?0:E.length-1,f=i>0?E.length:-1;if(!(E.length>o))for(d==t.line&&(h=t.ch-(0>i?1:0));h!=f;h+=i){var m=E.charAt(h);if(p.test(m)&&(void 0===r||e.getTokenTypeAt(s(d,h+1))==r)){var g=a[m];if(">"==g.charAt(1)==i>0)u.push(m);else{if(!u.length)return{pos:s(d,h),ch:m};u.pop()}}}}}return d-i==(i>0?e.lastLine():e.firstLine())?!1:null}function r(e,i,r){for(var n=e.state.matchBrackets.maxHighlightLineLength||1e3,a=[],l=e.listSelections(),u=0;u<l.length;u++){var p=l[u].empty()&&t(e,l[u].head,!1,r);if(p&&e.getLine(p.from.line).length<=n){var c=p.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";a.push(e.markText(p.from,s(p.from.line,p.from.ch+1),{className:c})),p.to&&e.getLine(p.to.line).length<=n&&a.push(e.markText(p.to,s(p.to.line,p.to.ch+1),{className:c}))}}if(a.length){o&&e.state.focused&&e.display.input.focus();var d=function(){e.operation(function(){for(var e=0;e<a.length;e++)a[e].clear()})};if(!i)return d;setTimeout(d,800)}}function n(e){e.operation(function(){l&&(l(),l=null),l=r(e,!1,e.state.matchBrackets)})}var o=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),s=e.Pos,a={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},l=null;e.defineOption("matchBrackets",!1,function(t,i,r){r&&r!=e.Init&&t.off("cursorActivity",n),i&&(t.state.matchBrackets="object"==typeof i?i:{},t.on("cursorActivity",n))}),e.defineExtension("matchBrackets",function(){r(this,!0)}),e.defineExtension("findMatchingBracket",function(e,i,r){return t(this,e,i,r)}),e.defineExtension("scanForBracket",function(e,t,r,n){return i(this,e,t,r,n)})})},{"../../lib/codemirror":8}],5:[function(t,i,r){!function(n){"object"==typeof r&&"object"==typeof i?n(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],n):n(CodeMirror)}(function(e){"use strict";function t(e,t){this.cm=e,this.options=this.buildOptions(t),this.widget=this.onClose=null}function i(e){return"string"==typeof e?e:e.text}function r(e,t){function i(e,i){var n;n="string"!=typeof i?function(e){return i(e,t)}:r.hasOwnProperty(i)?r[i]:i,o[e]=n}var r={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(-t.menuSize()+1,!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close},n=e.options.customKeys,o=n?{}:r;if(n)for(var s in n)n.hasOwnProperty(s)&&i(s,n[s]);var a=e.options.extraKeys;if(a)for(var s in a)a.hasOwnProperty(s)&&i(s,a[s]);return o}function n(e,t){for(;t&&t!=e;){if("LI"===t.nodeName.toUpperCase()&&t.parentNode==e)return t;t=t.parentNode}}function o(t,o){this.completion=t,this.data=o;var l=this,u=t.cm,p=this.hints=document.createElement("ul");p.className="CodeMirror-hints",this.selectedHint=o.selectedHint||0;for(var c=o.list,d=0;d<c.length;++d){var E=p.appendChild(document.createElement("li")),h=c[d],f=s+(d!=this.selectedHint?"":" "+a);null!=h.className&&(f=h.className+" "+f),E.className=f,h.render?h.render(E,o,h):E.appendChild(document.createTextNode(h.displayText||i(h))),E.hintId=d}var m=u.cursorCoords(t.options.alignWithWord?o.from:null),g=m.left,v=m.bottom,x=!0;p.style.left=g+"px",p.style.top=v+"px";var N=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),L=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(t.options.container||document.body).appendChild(p);var I=p.getBoundingClientRect(),T=I.bottom-L;if(T>0){var y=I.bottom-I.top,A=I.top-(m.bottom-m.top);if(A-y>0)p.style.top=(v=A-y)+"px",x=!1;else if(y>L){p.style.height=L-5+"px",p.style.top=(v=m.bottom-I.top)+"px";var S=u.getCursor();o.from.ch!=S.ch&&(m=u.cursorCoords(S),p.style.left=(g=m.left)+"px",I=p.getBoundingClientRect())}}var C=I.left-N;if(C>0&&(I.right-I.left>N&&(p.style.width=N-5+"px",C-=I.right-I.left-N),p.style.left=(g=m.left-C)+"px"),u.addKeyMap(this.keyMap=r(t,{moveFocus:function(e,t){l.changeActive(l.selectedHint+e,t)},setFocus:function(e){l.changeActive(e)},menuSize:function(){return l.screenAmount()},length:c.length,close:function(){t.close()},pick:function(){l.pick()},data:o})),t.options.closeOnUnfocus){var R;u.on("blur",this.onBlur=function(){R=setTimeout(function(){t.close()},100)}),u.on("focus",this.onFocus=function(){clearTimeout(R)})}var b=u.getScrollInfo();return u.on("scroll",this.onScroll=function(){var e=u.getScrollInfo(),i=u.getWrapperElement().getBoundingClientRect(),r=v+b.top-e.top,n=r-(window.pageYOffset||(document.documentElement||document.body).scrollTop);return x||(n+=p.offsetHeight),n<=i.top||n>=i.bottom?t.close():(p.style.top=r+"px",void(p.style.left=g+b.left-e.left+"px"))}),e.on(p,"dblclick",function(e){var t=n(p,e.target||e.srcElement);t&&null!=t.hintId&&(l.changeActive(t.hintId),l.pick())}),e.on(p,"click",function(e){var i=n(p,e.target||e.srcElement);i&&null!=i.hintId&&(l.changeActive(i.hintId),t.options.completeOnSingleClick&&l.pick())}),e.on(p,"mousedown",function(){setTimeout(function(){u.focus()},20)}),e.signal(o,"select",c[0],p.firstChild),!0}var s="CodeMirror-hint",a="CodeMirror-hint-active";e.showHint=function(e,t,i){if(!t)return e.showHint(i);i&&i.async&&(t.async=!0);var r={hint:t};if(i)for(var n in i)r[n]=i[n];return e.showHint(r)},e.defineExtension("showHint",function(i){if(!(this.listSelections().length>1||this.somethingSelected())){this.state.completionActive&&this.state.completionActive.close();var r=this.state.completionActive=new t(this,i),n=r.options.hint;if(n)return e.signal(this,"startCompletion",this),n.async?void n(this,function(e){r.showHints(e)},r.options):r.showHints(n(this,r.options))}}),t.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.widget&&this.widget.close(),this.onClose&&this.onClose(),e.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(t,r){var n=t.list[r];n.hint?n.hint(this.cm,t,n):this.cm.replaceRange(i(n),n.from||t.from,n.to||t.to,"complete"),e.signal(t,"pick",n),this.close()},showHints:function(e){return e&&e.list.length&&this.active()?void(this.options.completeSingle&&1==e.list.length?this.pick(e,0):this.showWidget(e)):this.close()},showWidget:function(t){function i(){l||(l=!0,p.close(),p.cm.off("cursorActivity",a),t&&e.signal(t,"close"))}function r(){if(!l){e.signal(t,"update");var i=p.options.hint;i.async?i(p.cm,n,p.options):n(i(p.cm,p.options))}}function n(e){if(t=e,!l){if(!t||!t.list.length)return i();p.widget&&p.widget.close(),p.widget=new o(p,t)}}function s(){u&&(f(u),u=0)}function a(){s();var e=p.cm.getCursor(),t=p.cm.getLine(e.line);e.line!=d.line||t.length-e.ch!=E-d.ch||e.ch<d.ch||p.cm.somethingSelected()||e.ch&&c.test(t.charAt(e.ch-1))?p.close():(u=h(r),p.widget&&p.widget.close())}this.widget=new o(this,t),e.signal(t,"shown");var l,u=0,p=this,c=this.options.closeCharacters,d=this.cm.getCursor(),E=this.cm.getLine(d.line).length,h=window.requestAnimationFrame||function(e){return setTimeout(e,1e3/60)},f=window.cancelAnimationFrame||clearTimeout;this.cm.on("cursorActivity",a),this.onClose=i},buildOptions:function(e){var t=this.cm.options.hintOptions,i={};for(var r in l)i[r]=l[r];if(t)for(var r in t)void 0!==t[r]&&(i[r]=t[r]);if(e)for(var r in e)void 0!==e[r]&&(i[r]=e[r]);return i}},o.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var e=this.completion.cm;this.completion.options.closeOnUnfocus&&(e.off("blur",this.onBlur),e.off("focus",this.onFocus)),e.off("scroll",this.onScroll)}},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(t,i){if(t>=this.data.list.length?t=i?this.data.list.length-1:0:0>t&&(t=i?0:this.data.list.length-1),this.selectedHint!=t){var r=this.hints.childNodes[this.selectedHint];r.className=r.className.replace(" "+a,""),r=this.hints.childNodes[this.selectedHint=t],r.className+=" "+a,r.offsetTop<this.hints.scrollTop?this.hints.scrollTop=r.offsetTop-3:r.offsetTop+r.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=r.offsetTop+r.offsetHeight-this.hints.clientHeight+3),e.signal(this.data,"select",this.data.list[this.selectedHint],r)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},e.registerHelper("hint","auto",function(t,i){var r,n=t.getHelpers(t.getCursor(),"hint");if(n.length)for(var o=0;o<n.length;o++){var s=n[o](t,i);if(s&&s.list.length)return s}else if(r=t.getHelper(t.getCursor(),"hintWords")){if(r)return e.hint.fromList(t,{words:r})}else if(e.hint.anyword)return e.hint.anyword(t,i)}),e.registerHelper("hint","fromList",function(t,i){for(var r=t.getCursor(),n=t.getTokenAt(r),o=[],s=0;s<i.words.length;s++){var a=i.words[s];a.slice(0,n.string.length)==n.string&&o.push(a)}return o.length?{list:o,from:e.Pos(r.line,n.start),to:e.Pos(r.line,n.end)}:void 0}),e.commands.autocomplete=e.showHint;var l={hint:e.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!1,container:null,customKeys:null,extraKeys:null};e.defineOption("hintOptions",null)})},{"../../lib/codemirror":8}],6:[function(t,i,r){!function(n){"object"==typeof r&&"object"==typeof i?n(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],n):n(CodeMirror)}(function(e){"use strict";e.runMode=function(t,i,r,n){var o=e.getMode(e.defaults,i),s=/MSIE \d/.test(navigator.userAgent),a=s&&(null==document.documentMode||document.documentMode<9);if(1==r.nodeType){var l=n&&n.tabSize||e.defaults.tabSize,u=r,p=0;u.innerHTML="",r=function(e,t){if("\n"==e)return u.appendChild(document.createTextNode(a?"\r":e)),void(p=0);for(var i="",r=0;;){var n=e.indexOf(" ",r);if(-1==n){i+=e.slice(r),p+=e.length-r;break}p+=n-r,i+=e.slice(r,n);var o=l-p%l;p+=o;for(var s=0;o>s;++s)i+=" ";r=n+1}if(t){var c=u.appendChild(document.createElement("span"));c.className="cm-"+t.replace(/ +/g," cm-"),c.appendChild(document.createTextNode(i))}else u.appendChild(document.createTextNode(i))}}for(var c=e.splitLines(t),d=n&&n.state||e.startState(o),E=0,h=c.length;h>E;++E){E&&r("\n");var f=new e.StringStream(c[E]);for(!f.string&&o.blankLine&&o.blankLine(d);!f.eol();){var m=o.token(f,d);r(f.current(),m,E,f.start,d),f.start=f.pos}}}})},{"../../lib/codemirror":8}],7:[function(t,i,r){!function(n){"object"==typeof r&&"object"==typeof i?n(t("../../lib/codemirror")):"function"==typeof e&&e.amd?e(["../../lib/codemirror"],n):n(CodeMirror)}(function(e){"use strict";function t(e,t,n,o){if(this.atOccurrence=!1,this.doc=e,null==o&&"string"==typeof t&&(o=!1),n=n?e.clipPos(n):r(0,0),this.pos={from:n,to:n},"string"!=typeof t)t.global||(t=new RegExp(t.source,t.ignoreCase?"ig":"g")),this.matches=function(i,n){if(i){t.lastIndex=0;for(var o,s,a=e.getLine(n.line).slice(0,n.ch),l=0;;){t.lastIndex=l;var u=t.exec(a);if(!u)break;if(o=u,s=o.index,l=o.index+(o[0].length||1),l==a.length)break}var p=o&&o[0].length||0;p||(0==s&&0==a.length?o=void 0:s!=e.getLine(n.line).length&&p++)}else{t.lastIndex=n.ch;var a=e.getLine(n.line),o=t.exec(a),p=o&&o[0].length||0,s=o&&o.index;s+p==a.length||p||(p=1)}return o&&p?{from:r(n.line,s),to:r(n.line,s+p),match:o}:void 0};else{var s=t;o&&(t=t.toLowerCase());var a=o?function(e){return e.toLowerCase()}:function(e){return e},l=t.split("\n");if(1==l.length)this.matches=t.length?function(n,o){if(n){var l=e.getLine(o.line).slice(0,o.ch),u=a(l),p=u.lastIndexOf(t);if(p>-1)return p=i(l,u,p),{from:r(o.line,p),to:r(o.line,p+s.length)}}else{var l=e.getLine(o.line).slice(o.ch),u=a(l),p=u.indexOf(t);if(p>-1)return p=i(l,u,p)+o.ch,{from:r(o.line,p),to:r(o.line,p+s.length)}}}:function(){};else{var u=s.split("\n");this.matches=function(t,i){var n=l.length-1;if(t){if(i.line-(l.length-1)<e.firstLine())return;if(a(e.getLine(i.line).slice(0,u[n].length))!=l[l.length-1])return;for(var o=r(i.line,u[n].length),s=i.line-1,p=n-1;p>=1;--p,--s)if(l[p]!=a(e.getLine(s)))return;var c=e.getLine(s),d=c.length-u[0].length;if(a(c.slice(d))!=l[0])return;return{from:r(s,d),to:o}}if(!(i.line+(l.length-1)>e.lastLine())){var c=e.getLine(i.line),d=c.length-u[0].length;if(a(c.slice(d))==l[0]){for(var E=r(i.line,d),s=i.line+1,p=1;n>p;++p,++s)if(l[p]!=a(e.getLine(s)))return;if(e.getLine(s).slice(0,u[n].length)==l[n])return{from:E,to:r(s,u[n].length)}}}}}}}function i(e,t,i){if(e.length==t.length)return i;for(var r=Math.min(i,e.length);;){var n=e.slice(0,r).toLowerCase().length;if(i>n)++r;else{if(!(n>i))return r;--r}}}var r=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=r(e,0);return i.pos={from:t,to:t},i.atOccurrence=!1,!1}for(var i=this,n=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,n))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!n.line)return t(0);n=r(n.line-1,this.doc.getLine(n.line-1).length)}else{var o=this.doc.lineCount();if(n.line==o-1)return t(o);n=r(n.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(t){if(this.atOccurrence){var i=e.splitLines(t);this.doc.replaceRange(i,this.pos.from,this.pos.to),this.pos.to=r(this.pos.from.line+i.length-1,i[i.length-1].length+(1==i.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,i,r){return new t(this.doc,e,i,r)}),e.defineDocExtension("getSearchCursor",function(e,i,r){return new t(this,e,i,r)}),e.defineExtension("selectMatches",function(t,i){for(var r,n=[],o=this.getSearchCursor(t,this.getCursor("from"),i);(r=o.findNext())&&!(e.cmpPos(o.to(),this.getCursor("to"))>0);)n.push({anchor:o.from(),head:o.to()});n.length&&this.setSelections(n,0)})})},{"../../lib/codemirror":8}],8:[function(t,i,r){!function(t){if("object"==typeof r&&"object"==typeof i)i.exports=t();else{if("function"==typeof e&&e.amd)return e([],t);this.CodeMirror=t()}}(function(){"use strict";function e(i,r){if(!(this instanceof e))return new e(i,r);this.options=r=r||{},no(Ns,r,!1),h(r);var n=r.value;"string"==typeof n&&(n=new Ws(n,r.mode)),this.doc=n;var o=this.display=new t(i,n);o.wrapper.CodeMirror=this,p(this),l(this),r.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),r.autofocus&&!Jo&&Ei(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Qn},Bo&&setTimeout(oo(di,this,!0),20),mi(this),No();var s=this;$t(this,function(){s.curOp.forceUpdate=!0,vn(s,n),r.autofocus&&!Jo||ho()==o.input?setTimeout(oo(Ui,s),20):Vi(s);for(var e in Ls)Ls.hasOwnProperty(e)&&Ls[e](s,r[e],Is);for(var t=0;t<Ss.length;++t)Ss[t](s)})}function t(e,t){var i=this,r=i.input=uo("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none");Wo?r.style.width="1000px":r.setAttribute("wrap","off"),Zo&&(r.style.border="1px solid black"),r.setAttribute("autocorrect","off"),r.setAttribute("autocapitalize","off"),r.setAttribute("spellcheck","false"),i.inputDiv=uo("div",[r],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),i.scrollbarH=uo("div",[uo("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar"),i.scrollbarV=uo("div",[uo("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i.scrollbarFiller=uo("div",null,"CodeMirror-scrollbar-filler"),i.gutterFiller=uo("div",null,"CodeMirror-gutter-filler"),i.lineDiv=uo("div",null,"CodeMirror-code"),i.selectionDiv=uo("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=uo("div",null,"CodeMirror-cursors"),i.measure=uo("div",null,"CodeMirror-measure"),i.lineMeasure=uo("div",null,"CodeMirror-measure"),i.lineSpace=uo("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none"),i.mover=uo("div",[uo("div",[i.lineSpace],"CodeMirror-lines")],null,"position: relative"),i.sizer=uo("div",[i.mover],"CodeMirror-sizer"),i.heightForcer=uo("div",null,null,"position: absolute; height: "+ta+"px; width: 1px;"),i.gutters=uo("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=uo("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=uo("div",[i.inputDiv,i.scrollbarH,i.scrollbarV,i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),Uo&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),Zo&&(r.style.width="0px"),Wo||(i.scroller.draggable=!0),Ko&&(i.inputDiv.style.height="1px",i.inputDiv.style.position="absolute"),Uo&&(i.scrollbarH.style.minHeight=i.scrollbarV.style.minWidth="18px"),e.appendChild?e.appendChild(i.wrapper):e(i.wrapper),i.viewFrom=i.viewTo=t.first,i.view=[],i.externalMeasured=null,i.viewOffset=0,i.lastSizeC=0,i.updateLineNumbers=null,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.prevInput="",i.alignWidgets=!1,i.pollingFast=!1,i.poll=new Qn,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.inaccurateSelection=!1,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null}function i(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),r(t)}function r(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,vt(e,100),e.state.modeGen++,e.curOp&&ii(e)}function n(e){e.options.lineWrapping?(go(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth=""):(mo(e.display.wrapper,"CodeMirror-wrap"),E(e)),s(e),ii(e),wt(e),setTimeout(function(){m(e)},100)}function o(e){var t=zt(e.display),i=e.options.lineWrapping,r=i&&Math.max(5,e.display.scroller.clientWidth/Xt(e.display)-3);return function(n){if(Wr(e.doc,n))return 0;var o=0;if(n.widgets)for(var s=0;s<n.widgets.length;s++)n.widgets[s].height&&(o+=n.widgets[s].height);return i?o+(Math.ceil(n.text.length/r)||1)*t:o+t}}function s(e){var t=e.doc,i=o(e);t.iter(function(e){var t=i(e);t!=e.height&&In(e,t)})}function a(e){var t=Ps[e.options.keyMap],i=t.style;e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(i?" cm-keymap-"+i:"")}function l(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),wt(e)}function u(e){p(e),ii(e),setTimeout(function(){v(e)},20)}function p(e){var t=e.display.gutters,i=e.options.gutters;po(t);for(var r=0;r<i.length;++r){var n=i[r],o=t.appendChild(uo("div",null,"CodeMirror-gutter "+n));"CodeMirror-linenumbers"==n&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=r?"":"none",c(e)}function c(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px",e.display.scrollbarH.style.left=e.options.fixedGutter?t+"px":0}function d(e){if(0==e.height)return 0;for(var t,i=e.text.length,r=e;t=kr(r);){var n=t.find(0,!0);r=n.from.line,i+=n.from.ch-n.to.ch}for(r=e;t=Br(r);){var n=t.find(0,!0);i-=r.text.length-n.from.ch,r=n.to.line,i+=r.text.length-n.to.ch}return i}function E(e){var t=e.display,i=e.doc;t.maxLine=xn(i,i.first),t.maxLineLength=d(t.maxLine),t.maxLineChanged=!0,i.iter(function(e){var i=d(e);i>t.maxLineLength&&(t.maxLineLength=i,t.maxLine=e)})}function h(e){var t=to(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function f(e){var t=e.display.scroller;return{clientHeight:t.clientHeight,barHeight:e.display.scrollbarV.clientHeight,scrollWidth:t.scrollWidth,clientWidth:t.clientWidth,barWidth:e.display.scrollbarH.clientWidth,docHeight:Math.round(e.doc.height+Tt(e.display))}}function m(e,t){t||(t=f(e));var i=e.display,r=t.docHeight+ta,n=t.scrollWidth>t.clientWidth,o=r>t.clientHeight;if(o?(i.scrollbarV.style.display="block",i.scrollbarV.style.bottom=n?Io(i.measure)+"px":"0",i.scrollbarV.firstChild.style.height=Math.max(0,r-t.clientHeight+(t.barHeight||i.scrollbarV.clientHeight))+"px"):(i.scrollbarV.style.display="",i.scrollbarV.firstChild.style.height="0"),n?(i.scrollbarH.style.display="block",i.scrollbarH.style.right=o?Io(i.measure)+"px":"0",i.scrollbarH.firstChild.style.width=t.scrollWidth-t.clientWidth+(t.barWidth||i.scrollbarH.clientWidth)+"px"):(i.scrollbarH.style.display="",i.scrollbarH.firstChild.style.width="0"),n&&o?(i.scrollbarFiller.style.display="block",i.scrollbarFiller.style.height=i.scrollbarFiller.style.width=Io(i.measure)+"px"):i.scrollbarFiller.style.display="",n&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(i.gutterFiller.style.display="block",i.gutterFiller.style.height=Io(i.measure)+"px",i.gutterFiller.style.width=i.gutters.offsetWidth+"px"):i.gutterFiller.style.display="",!e.state.checkedOverlayScrollbar&&t.clientHeight>0){if(0===Io(i.measure)){var s=es&&!$o?"12px":"18px";i.scrollbarV.style.minWidth=i.scrollbarH.style.minHeight=s;var a=function(t){jn(t)!=i.scrollbarV&&jn(t)!=i.scrollbarH&&Qt(e,Ni)(t)};Qs(i.scrollbarV,"mousedown",a),Qs(i.scrollbarH,"mousedown",a)}e.state.checkedOverlayScrollbar=!0}}function g(e,t,i){var r=i&&null!=i.top?Math.max(0,i.top):e.scroller.scrollTop;r=Math.floor(r-It(e));var n=i&&null!=i.bottom?i.bottom:r+e.wrapper.clientHeight,o=yn(t,r),s=yn(t,n);if(i&&i.ensure){var a=i.ensure.from.line,l=i.ensure.to.line;if(o>a)return{from:a,to:yn(t,An(xn(t,a))+e.wrapper.clientHeight)};if(Math.min(l,t.lastLine())>=s)return{from:yn(t,An(xn(t,l))-e.wrapper.clientHeight),to:l}}return{from:o,to:Math.max(s,o+1)}}function v(e){var t=e.display,i=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=L(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,o=r+"px",s=0;s<i.length;s++)if(!i[s].hidden){e.options.fixedGutter&&i[s].gutter&&(i[s].gutter.style.left=o);var a=i[s].alignable;if(a)for(var l=0;l<a.length;l++)a[l].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+n+"px")}}function x(e){if(!e.options.lineNumbers)return!1;var t=e.doc,i=N(e.options,t.first+t.size-1),r=e.display;if(i.length!=r.lineNumChars){var n=r.measure.appendChild(uo("div",[uo("div",i)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=n.firstChild.offsetWidth,s=n.offsetWidth-o;return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-s),r.lineNumWidth=r.lineNumInnerWidth+s,r.lineNumChars=r.lineNumInnerWidth?i.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",c(e),!0}return!1}function N(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function L(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function I(e,t,i){for(var r,n=e.display.viewFrom,o=e.display.viewTo,s=g(e.display,e.doc,t),a=!0;;a=!1){var l=e.display.scroller.clientWidth;if(!T(e,s,i))break;r=!0,e.display.maxLineChanged&&!e.options.lineWrapping&&y(e);var u=f(e);if(ht(e),A(e,u),m(e,u),Wo&&e.options.lineWrapping&&S(e,u),a&&e.options.lineWrapping&&l!=e.display.scroller.clientWidth)i=!0;else if(i=!1,t&&null!=t.top&&(t={top:Math.min(u.docHeight-ta-u.clientHeight,t.top)}),s=g(e.display,e.doc,t),s.from>=e.display.viewFrom&&s.to<=e.display.viewTo)break}return e.display.updateLineNumbers=null,r&&(qn(e,"update",e),(e.display.viewFrom!=n||e.display.viewTo!=o)&&qn(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo)),r}function T(e,t,i){var r=e.display,n=e.doc;if(!r.wrapper.offsetWidth)return void ni(e);if(!(!i&&t.from>=r.viewFrom&&t.to<=r.viewTo&&0==li(e))){x(e)&&ni(e);var o=b(e),s=n.first+n.size,a=Math.max(t.from-e.options.viewportMargin,n.first),l=Math.min(s,t.to+e.options.viewportMargin);r.viewFrom<a&&a-r.viewFrom<20&&(a=Math.max(n.first,r.viewFrom)),r.viewTo>l&&r.viewTo-l<20&&(l=Math.min(s,r.viewTo)),ss&&(a=Fr(e.doc,a),l=jr(e.doc,l));var u=a!=r.viewFrom||l!=r.viewTo||r.lastSizeC!=r.wrapper.clientHeight;ai(e,a,l),r.viewOffset=An(xn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var p=li(e);if(u||0!=p||i){var c=ho();return p>4&&(r.lineDiv.style.display="none"),O(e,r.updateLineNumbers,o),p>4&&(r.lineDiv.style.display=""),c&&ho()!=c&&c.offsetHeight&&c.focus(),po(r.cursorDiv),po(r.selectionDiv),u&&(r.lastSizeC=r.wrapper.clientHeight,vt(e,400)),C(e),!0}}}function y(e){var t=e.display,i=Rt(e,t.maxLine,t.maxLine.text.length).left;t.maxLineChanged=!1;var r=Math.max(0,i+3),n=Math.max(0,t.sizer.offsetLeft+r+ta-t.scroller.clientWidth);t.sizer.style.minWidth=r+"px",n<e.doc.scrollLeft&&bi(e,Math.min(t.scroller.scrollLeft,n),!0)}function A(e,t){e.display.sizer.style.minHeight=e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=Math.max(t.docHeight,t.clientHeight-ta)+"px"}function S(e,t){e.display.sizer.offsetWidth+e.display.gutters.offsetWidth<e.display.scroller.clientWidth-1&&(e.display.sizer.style.minHeight=e.display.heightForcer.style.top="0px",e.display.gutters.style.height=t.docHeight+"px")}function C(e){for(var t=e.display,i=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var n,o=t.view[r];if(!o.hidden){if(Uo){var s=o.node.offsetTop+o.node.offsetHeight;n=s-i,i=s}else{var a=o.node.getBoundingClientRect();n=a.bottom-a.top}var l=o.line.height-n;if(2>n&&(n=zt(t)),(l>.001||-.001>l)&&(In(o.line,n),R(o.line),o.rest))for(var u=0;u<o.rest.length;u++)R(o.rest[u])}}}function R(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t)e.widgets[t].height=e.widgets[t].node.offsetHeight}function b(e){for(var t=e.display,i={},r={},n=t.gutters.firstChild,o=0;n;n=n.nextSibling,++o)i[e.options.gutters[o]]=n.offsetLeft,r[e.options.gutters[o]]=n.offsetWidth;return{fixedPos:L(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:i,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function O(e,t,i){function r(t){var i=t.nextSibling;return Wo&&es&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),i}for(var n=e.display,o=e.options.lineNumbers,s=n.lineDiv,a=s.firstChild,l=n.view,u=n.viewFrom,p=0;p<l.length;p++){var c=l[p];if(c.hidden);else if(c.node){for(;a!=c.node;)a=r(a);var d=o&&null!=t&&u>=t&&c.lineNumber;c.changes&&(to(c.changes,"gutter")>-1&&(d=!1),P(e,c,u,i)),d&&(po(c.lineNumber),c.lineNumber.appendChild(document.createTextNode(N(e.options,u)))),a=c.node.nextSibling}else{var E=U(e,c,u,i);s.insertBefore(E,a)}u+=c.size}for(;a;)a=r(a)}function P(e,t,i,r){for(var n=0;n<t.changes.length;n++){var o=t.changes[n];"text"==o?w(e,t):"gutter"==o?k(e,t,i,r):"class"==o?G(t):"widget"==o&&B(t,r)}t.changes=null}function D(e){return e.node==e.text&&(e.node=uo("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),Uo&&(e.node.style.zIndex=2)),e.node}function _(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var i=D(e);e.background=i.insertBefore(uo("div",null,t),i.firstChild)}}function M(e,t){var i=e.display.externalMeasured;return i&&i.line==t.line?(e.display.externalMeasured=null,t.measure=i.measure,i.built):sn(e,t)}function w(e,t){var i=t.text.className,r=M(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,G(t)):i&&(t.text.className=i)}function G(e){_(e),e.line.wrapClass?D(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function k(e,t,i,r){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var n=t.line.gutterMarkers;if(e.options.lineNumbers||n){var o=D(t),s=t.gutter=o.insertBefore(uo("div",null,"CodeMirror-gutter-wrapper","position: absolute; left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px"),t.text);if(!e.options.lineNumbers||n&&n["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(uo("div",N(e.options,i),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),n)for(var a=0;a<e.options.gutters.length;++a){var l=e.options.gutters[a],u=n.hasOwnProperty(l)&&n[l];u&&s.appendChild(uo("div",[u],"CodeMirror-gutter-elt","left: "+r.gutterLeft[l]+"px; width: "+r.gutterWidth[l]+"px"))}}}function B(e,t){e.alignable&&(e.alignable=null);for(var i,r=e.node.firstChild;r;r=i){var i=r.nextSibling;"CodeMirror-linewidget"==r.className&&e.node.removeChild(r)}V(e,t)}function U(e,t,i,r){var n=M(e,t);return t.text=t.node=n.pre,n.bgClass&&(t.bgClass=n.bgClass),n.textClass&&(t.textClass=n.textClass),G(t),k(e,t,i,r),V(t,r),t.node}function V(e,t){if(H(e.line,e,t,!0),e.rest)for(var i=0;i<e.rest.length;i++)H(e.rest[i],e,t,!1)}function H(e,t,i,r){if(e.widgets)for(var n=D(t),o=0,s=e.widgets;o<s.length;++o){var a=s[o],l=uo("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||(l.ignoreEvents=!0),F(a,l,t,i),r&&a.above?n.insertBefore(l,t.gutter||t.text):n.appendChild(l),qn(a,"redraw")}}function F(e,t,i,r){if(e.noHScroll){(i.alignable||(i.alignable=[])).push(t);var n=r.wrapperWidth;t.style.left=r.fixedPos+"px",e.coverGutter||(n-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=n+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function j(e){return as(e.line,e.ch) }function W(e,t){return ls(e,t)<0?t:e}function q(e,t){return ls(e,t)<0?e:t}function z(e,t){this.ranges=e,this.primIndex=t}function X(e,t){this.anchor=e,this.head=t}function Y(e,t){var i=e[t];e.sort(function(e,t){return ls(e.from(),t.from())}),t=to(e,i);for(var r=1;r<e.length;r++){var n=e[r],o=e[r-1];if(ls(o.to(),n.from())>=0){var s=q(o.from(),n.from()),a=W(o.to(),n.to()),l=o.empty()?n.from()==n.head:o.from()==o.head;t>=r&&--t,e.splice(--r,2,new X(l?a:s,l?s:a))}}return new z(e,t)}function K(e,t){return new z([new X(e,t||e)],0)}function $(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Q(e,t){if(t.line<e.first)return as(e.first,0);var i=e.first+e.size-1;return t.line>i?as(i,xn(e,i).text.length):Z(t,xn(e,t.line).text.length)}function Z(e,t){var i=e.ch;return null==i||i>t?as(e.line,t):0>i?as(e.line,0):e}function J(e,t){return t>=e.first&&t<e.first+e.size}function et(e,t){for(var i=[],r=0;r<t.length;r++)i[r]=Q(e,t[r]);return i}function tt(e,t,i,r){if(e.cm&&e.cm.display.shift||e.extend){var n=t.anchor;if(r){var o=ls(i,n)<0;o!=ls(r,n)<0?(n=i,i=r):o!=ls(i,r)<0&&(i=r)}return new X(n,i)}return new X(r||i,i)}function it(e,t,i,r){lt(e,new z([tt(e,e.sel.primary(),t,i)],0),r)}function rt(e,t,i){for(var r=[],n=0;n<e.sel.ranges.length;n++)r[n]=tt(e,e.sel.ranges[n],t[n],null);var o=Y(r,e.sel.primIndex);lt(e,o,i)}function nt(e,t,i,r){var n=e.sel.ranges.slice(0);n[t]=i,lt(e,Y(n,e.sel.primIndex),r)}function ot(e,t,i,r){lt(e,K(t,i),r)}function st(e,t){var i={ranges:t.ranges,update:function(t){this.ranges=[];for(var i=0;i<t.length;i++)this.ranges[i]=new X(Q(e,t[i].anchor),Q(e,t[i].head))}};return Js(e,"beforeSelectionChange",e,i),e.cm&&Js(e.cm,"beforeSelectionChange",e.cm,i),i.ranges!=t.ranges?Y(i.ranges,i.ranges.length-1):t}function at(e,t,i){var r=e.history.done,n=eo(r);n&&n.ranges?(r[r.length-1]=t,ut(e,t,i)):lt(e,t,i)}function lt(e,t,i){ut(e,t,i),_n(e,e.sel,e.cm?e.cm.curOp.id:0/0,i)}function ut(e,t,i){(Kn(e,"beforeSelectionChange")||e.cm&&Kn(e.cm,"beforeSelectionChange"))&&(t=st(e,t));var r=i&&i.bias||(ls(t.primary().head,e.sel.primary().head)<0?-1:1);pt(e,dt(e,t,r,!0)),i&&i.scroll===!1||!e.cm||sr(e.cm)}function pt(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,Yn(e.cm)),qn(e,"cursorActivity",e))}function ct(e){pt(e,dt(e,e.sel,null,!1),ra)}function dt(e,t,i,r){for(var n,o=0;o<t.ranges.length;o++){var s=t.ranges[o],a=Et(e,s.anchor,i,r),l=Et(e,s.head,i,r);(n||a!=s.anchor||l!=s.head)&&(n||(n=t.ranges.slice(0,o)),n[o]=new X(a,l))}return n?Y(n,t.primIndex):t}function Et(e,t,i,r){var n=!1,o=t,s=i||1;e.cantEdit=!1;e:for(;;){var a=xn(e,o.line);if(a.markedSpans)for(var l=0;l<a.markedSpans.length;++l){var u=a.markedSpans[l],p=u.marker;if((null==u.from||(p.inclusiveLeft?u.from<=o.ch:u.from<o.ch))&&(null==u.to||(p.inclusiveRight?u.to>=o.ch:u.to>o.ch))){if(r&&(Js(p,"beforeCursorEnter"),p.explicitlyCleared)){if(a.markedSpans){--l;continue}break}if(!p.atomic)continue;var c=p.find(0>s?-1:1);if(0==ls(c,o)&&(c.ch+=s,c.ch<0?c=c.line>e.first?Q(e,as(c.line-1)):null:c.ch>a.text.length&&(c=c.line<e.first+e.size-1?as(c.line+1,0):null),!c)){if(n)return r?(e.cantEdit=!0,as(e.first,0)):Et(e,t,i,!0);n=!0,c=t,s=-s}o=c;continue e}}return o}}function ht(e){for(var t=e.display,i=e.doc,r=document.createDocumentFragment(),n=document.createDocumentFragment(),o=0;o<i.sel.ranges.length;o++){var s=i.sel.ranges[o],a=s.empty();(a||e.options.showCursorWhenSelecting)&&ft(e,s,r),a||mt(e,s,n)}if(e.options.moveInputWithCursor){var l=Ht(e,i.sel.primary().head,"div"),u=t.wrapper.getBoundingClientRect(),p=t.lineDiv.getBoundingClientRect(),c=Math.max(0,Math.min(t.wrapper.clientHeight-10,l.top+p.top-u.top)),d=Math.max(0,Math.min(t.wrapper.clientWidth-10,l.left+p.left-u.left));t.inputDiv.style.top=c+"px",t.inputDiv.style.left=d+"px"}co(t.cursorDiv,r),co(t.selectionDiv,n)}function ft(e,t,i){var r=Ht(e,t.head,"div"),n=i.appendChild(uo("div"," ","CodeMirror-cursor"));if(n.style.left=r.left+"px",n.style.top=r.top+"px",n.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var o=i.appendChild(uo("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function mt(e,t,i){function r(e,t,i,r){0>t&&(t=0),t=Math.round(t),r=Math.round(r),a.appendChild(uo("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==i?p-e:i)+"px; height: "+(r-t)+"px"))}function n(t,i,n){function o(i,r){return Vt(e,as(t,i),"div",c,r)}var a,l,c=xn(s,t),d=c.text.length;return Ao(Sn(c),i||0,null==n?d:n,function(e,t,s){var c,E,h,f=o(e,"left");if(e==t)c=f,E=h=f.left;else{if(c=o(t-1,"right"),"rtl"==s){var m=f;f=c,c=m}E=f.left,h=c.right}null==i&&0==e&&(E=u),c.top-f.top>3&&(r(E,f.top,null,f.bottom),E=u,f.bottom<c.top&&r(E,f.bottom,null,c.top)),null==n&&t==d&&(h=p),(!a||f.top<a.top||f.top==a.top&&f.left<a.left)&&(a=f),(!l||c.bottom>l.bottom||c.bottom==l.bottom&&c.right>l.right)&&(l=c),u+1>E&&(E=u),r(E,c.top,h-E,c.bottom)}),{start:a,end:l}}var o=e.display,s=e.doc,a=document.createDocumentFragment(),l=yt(e.display),u=l.left,p=o.lineSpace.offsetWidth-l.right,c=t.from(),d=t.to();if(c.line==d.line)n(c.line,c.ch,d.ch);else{var E=xn(s,c.line),h=xn(s,d.line),f=Vr(E)==Vr(h),m=n(c.line,c.ch,f?E.text.length+1:null).end,g=n(d.line,f?0:null,d.ch).start;f&&(m.top<g.top-2?(r(m.right,m.top,null,m.bottom),r(u,g.top,g.left,g.bottom)):r(m.right,m.top,g.left-m.right,m.bottom)),m.bottom<g.top&&r(u,m.bottom,null,g.top)}i.appendChild(a)}function gt(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var i=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0&&(t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(i=!i)?"":"hidden"},e.options.cursorBlinkRate))}}function vt(e,t){e.doc.mode.startState&&e.doc.frontier<e.display.viewTo&&e.state.highlight.set(t,oo(xt,e))}function xt(e){var t=e.doc;if(t.frontier<t.first&&(t.frontier=t.first),!(t.frontier>=e.display.viewTo)){var i=+new Date+e.options.workTime,r=Rs(t.mode,Lt(e,t.frontier));$t(e,function(){t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(n){if(t.frontier>=e.display.viewFrom){var o=n.styles,s=tn(e,n,r,!0);n.styles=s.styles,s.classes?n.styleClasses=s.classes:n.styleClasses&&(n.styleClasses=null);for(var a=!o||o.length!=n.styles.length,l=0;!a&&l<o.length;++l)a=o[l]!=n.styles[l];a&&ri(e,t.frontier,"text"),n.stateAfter=Rs(t.mode,r)}else nn(e,n.text,r),n.stateAfter=t.frontier%5==0?Rs(t.mode,r):null;return++t.frontier,+new Date>i?(vt(e,e.options.workDelay),!0):void 0})})}}function Nt(e,t,i){for(var r,n,o=e.doc,s=i?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>s;--a){if(a<=o.first)return o.first;var l=xn(o,a-1);if(l.stateAfter&&(!i||a<=o.frontier))return a;var u=sa(l.text,null,e.options.tabSize);(null==n||r>u)&&(n=a-1,r=u)}return n}function Lt(e,t,i){var r=e.doc,n=e.display;if(!r.mode.startState)return!0;var o=Nt(e,t,i),s=o>r.first&&xn(r,o-1).stateAfter;return s=s?Rs(r.mode,s):bs(r.mode),r.iter(o,t,function(i){nn(e,i.text,s);var a=o==t-1||o%5==0||o>=n.viewFrom&&o<n.viewTo;i.stateAfter=a?Rs(r.mode,s):null,++o}),i&&(r.frontier=o),s}function It(e){return e.lineSpace.offsetTop}function Tt(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function yt(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=co(e.measure,uo("pre","x")),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(i.paddingLeft),right:parseInt(i.paddingRight)};return isNaN(r.left)||isNaN(r.right)||(e.cachedPaddingH=r),r}function At(e,t,i){var r=e.options.lineWrapping,n=r&&e.display.scroller.clientWidth;if(!t.measure.heights||r&&t.measure.width!=n){var o=t.measure.heights=[];if(r){t.measure.width=n;for(var s=t.text.firstChild.getClientRects(),a=0;a<s.length-1;a++){var l=s[a],u=s[a+1];Math.abs(l.bottom-u.bottom)>2&&o.push((l.bottom+u.top)/2-i.top)}}o.push(i.bottom-i.top)}}function St(e,t,i){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]};for(var r=0;r<e.rest.length;r++)if(Tn(e.rest[r])>i)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Ct(e,t){t=Vr(t);var i=Tn(t),r=e.display.externalMeasured=new ei(e.doc,t,i);r.lineN=i;var n=r.built=sn(e,r);return r.text=n.pre,co(e.display.lineMeasure,n.pre),r}function Rt(e,t,i,r){return Pt(e,Ot(e,t),i,r)}function bt(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[oi(e,t)];var i=e.display.externalMeasured;return i&&t>=i.lineN&&t<i.lineN+i.size?i:void 0}function Ot(e,t){var i=Tn(t),r=bt(e,i);r&&!r.text?r=null:r&&r.changes&&P(e,r,i,b(e)),r||(r=Ct(e,t));var n=St(r,t,i);return{line:t,view:r,rect:null,map:n.map,cache:n.cache,before:n.before,hasHeights:!1}}function Pt(e,t,i,r){t.before&&(i=-1);var n,o=i+(r||"");return t.cache.hasOwnProperty(o)?n=t.cache[o]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(At(e,t.view,t.rect),t.hasHeights=!0),n=Dt(e,t,i,r),n.bogus||(t.cache[o]=n)),{left:n.left,right:n.right,top:n.top,bottom:n.bottom}}function Dt(e,t,i,r){for(var n,o,s,a,l=t.map,u=0;u<l.length;u+=3){var p=l[u],c=l[u+1];if(p>i?(o=0,s=1,a="left"):c>i?(o=i-p,s=o+1):(u==l.length-3||i==c&&l[u+3]>i)&&(s=c-p,o=s-1,i>=c&&(a="right")),null!=o){if(n=l[u+2],p==c&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==o)for(;u&&l[u-2]==l[u-3]&&l[u-1].insertLeft;)n=l[(u-=3)+2],a="left";if("right"==r&&o==c-p)for(;u<l.length-3&&l[u+3]==l[u+4]&&!l[u+5].insertLeft;)n=l[(u+=3)+2],a="right";break}}var d;if(3==n.nodeType){for(;o&&lo(t.line.text.charAt(p+o));)--o;for(;c>p+s&&lo(t.line.text.charAt(p+s));)++s;if(Vo&&0==o&&s==c-p)d=n.parentNode.getBoundingClientRect();else if(jo&&e.options.lineWrapping){var E=ua(n,o,s).getClientRects();d=E.length?E["right"==r?E.length-1:0]:ds}else d=ua(n,o,s).getBoundingClientRect()||ds}else{o>0&&(a=r="right");var E;d=e.options.lineWrapping&&(E=n.getClientRects()).length>1?E["right"==r?E.length-1:0]:n.getBoundingClientRect()}if(Vo&&!o&&(!d||!d.left&&!d.right)){var h=n.parentNode.getClientRects()[0];d=h?{left:h.left,right:h.left+Xt(e.display),top:h.top,bottom:h.bottom}:ds}for(var f,m=(d.bottom+d.top)/2-t.rect.top,g=t.view.measure.heights,u=0;u<g.length-1&&!(m<g[u]);u++);f=u?g[u-1]:0,m=g[u];var v={left:("right"==a?d.right:d.left)-t.rect.left,right:("left"==a?d.left:d.right)-t.rect.left,top:f,bottom:m};return d.left||d.right||(v.bogus=!0),v}function _t(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Mt(e){e.display.externalMeasure=null,po(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)_t(e.display.view[t])}function wt(e){Mt(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Gt(){return window.pageXOffset||(document.documentElement||document.body).scrollLeft}function kt(){return window.pageYOffset||(document.documentElement||document.body).scrollTop}function Bt(e,t,i,r){if(t.widgets)for(var n=0;n<t.widgets.length;++n)if(t.widgets[n].above){var o=Xr(t.widgets[n]);i.top+=o,i.bottom+=o}if("line"==r)return i;r||(r="local");var s=An(t);if("local"==r?s+=It(e.display):s-=e.display.viewOffset,"page"==r||"window"==r){var a=e.display.lineSpace.getBoundingClientRect();s+=a.top+("window"==r?0:kt());var l=a.left+("window"==r?0:Gt());i.left+=l,i.right+=l}return i.top+=s,i.bottom+=s,i}function Ut(e,t,i){if("div"==i)return t;var r=t.left,n=t.top;if("page"==i)r-=Gt(),n-=kt();else if("local"==i||!i){var o=e.display.sizer.getBoundingClientRect();r+=o.left,n+=o.top}var s=e.display.lineSpace.getBoundingClientRect();return{left:r-s.left,top:n-s.top}}function Vt(e,t,i,r,n){return r||(r=xn(e.doc,t.line)),Bt(e,r,Rt(e,r,t.ch,n),i)}function Ht(e,t,i,r,n){function o(t,o){var s=Pt(e,n,t,o?"right":"left");return o?s.left=s.right:s.right=s.left,Bt(e,r,s,i)}function s(e,t){var i=a[t],r=i.level%2;return e==So(i)&&t&&i.level<a[t-1].level?(i=a[--t],e=Co(i)-(i.level%2?0:1),r=!0):e==Co(i)&&t<a.length-1&&i.level<a[t+1].level&&(i=a[++t],e=So(i)-i.level%2,r=!1),r&&e==i.to&&e>i.from?o(e-1):o(e,r)}r=r||xn(e.doc,t.line),n||(n=Ot(e,r));var a=Sn(r),l=t.ch;if(!a)return o(l);var u=_o(a,l),p=s(l,u);return null!=Ia&&(p.other=s(l,Ia)),p}function Ft(e,t){var i=0,t=Q(e.doc,t);e.options.lineWrapping||(i=Xt(e.display)*t.ch);var r=xn(e.doc,t.line),n=An(r)+It(e.display);return{left:i,right:i,top:n,bottom:n+r.height}}function jt(e,t,i,r){var n=as(e,t);return n.xRel=r,i&&(n.outside=!0),n}function Wt(e,t,i){var r=e.doc;if(i+=e.display.viewOffset,0>i)return jt(r.first,0,!0,-1);var n=yn(r,i),o=r.first+r.size-1;if(n>o)return jt(r.first+r.size-1,xn(r,o).text.length,!0,1);0>t&&(t=0);for(var s=xn(r,n);;){var a=qt(e,s,n,t,i),l=Br(s),u=l&&l.find(0,!0);if(!l||!(a.ch>u.from.ch||a.ch==u.from.ch&&a.xRel>0))return a;n=Tn(s=u.to.line)}}function qt(e,t,i,r,n){function o(r){var n=Ht(e,as(i,r),"line",t,u);return a=!0,s>n.bottom?n.left-l:s<n.top?n.left+l:(a=!1,n.left)}var s=n-An(t),a=!1,l=2*e.display.wrapper.clientWidth,u=Ot(e,t),p=Sn(t),c=t.text.length,d=Ro(t),E=bo(t),h=o(d),f=a,m=o(E),g=a;if(r>m)return jt(i,E,g,1);for(;;){if(p?E==d||E==wo(t,d,1):1>=E-d){for(var v=h>r||m-r>=r-h?d:E,x=r-(v==d?h:m);lo(t.text.charAt(v));)++v;var N=jt(i,v,v==d?f:g,-1>x?-1:x>1?1:0);return N}var L=Math.ceil(c/2),I=d+L;if(p){I=d;for(var T=0;L>T;++T)I=wo(t,I,1)}var y=o(I);y>r?(E=I,m=y,(g=a)&&(m+=1e3),c=L):(d=I,h=y,f=a,c-=L)}}function zt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==us){us=uo("pre");for(var t=0;49>t;++t)us.appendChild(document.createTextNode("x")),us.appendChild(uo("br"));us.appendChild(document.createTextNode("x"))}co(e.measure,us);var i=us.offsetHeight/50;return i>3&&(e.cachedTextHeight=i),po(e.measure),i||1}function Xt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=uo("span","xxxxxxxxxx"),i=uo("pre",[t]);co(e.measure,i);var r=t.getBoundingClientRect(),n=(r.right-r.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function Yt(e){e.curOp={viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,id:++Es},ea++||(Xs=[])}function Kt(e){var t=e.curOp,i=e.doc,r=e.display;if(e.curOp=null,t.updateMaxLine&&E(e),t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<r.viewFrom||t.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&e.options.lineWrapping){var n=I(e,{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate);e.display.scroller.offsetHeight&&(e.doc.scrollTop=e.display.scroller.scrollTop)}if(!n&&t.selectionChanged&&ht(e),n||t.startHeight==e.doc.height||m(e),null==r.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=t.scrollTop&&r.scroller.scrollTop!=t.scrollTop){var o=Math.max(0,Math.min(r.scroller.scrollHeight-r.scroller.clientHeight,t.scrollTop));r.scroller.scrollTop=r.scrollbarV.scrollTop=i.scrollTop=o}if(null!=t.scrollLeft&&r.scroller.scrollLeft!=t.scrollLeft){var s=Math.max(0,Math.min(r.scroller.scrollWidth-r.scroller.clientWidth,t.scrollLeft));r.scroller.scrollLeft=r.scrollbarH.scrollLeft=i.scrollLeft=s,v(e)}if(t.scrollToPos){var a=ir(e,Q(e.doc,t.scrollToPos.from),Q(e.doc,t.scrollToPos.to),t.scrollToPos.margin);t.scrollToPos.isCursor&&e.state.focused&&tr(e,a)}t.selectionChanged&&gt(e),e.state.focused&&t.updateInput&&di(e,t.typing);var l=t.maybeHiddenMarkers,u=t.maybeUnhiddenMarkers;if(l)for(var p=0;p<l.length;++p)l[p].lines.length||Js(l[p],"hide");if(u)for(var p=0;p<u.length;++p)u[p].lines.length&&Js(u[p],"unhide");var c;if(--ea||(c=Xs,Xs=null),t.changeObjs&&Js(e,"changes",e,t.changeObjs),c)for(var p=0;p<c.length;++p)c[p]();if(t.cursorActivityHandlers)for(var p=0;p<t.cursorActivityHandlers.length;p++)t.cursorActivityHandlers[p](e)}function $t(e,t){if(e.curOp)return t();Yt(e);try{return t()}finally{Kt(e)}}function Qt(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Yt(e);try{return t.apply(e,arguments)}finally{Kt(e)}}}function Zt(e){return function(){if(this.curOp)return e.apply(this,arguments);Yt(this);try{return e.apply(this,arguments)}finally{Kt(this)}}}function Jt(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);Yt(t);try{return e.apply(this,arguments)}finally{Kt(t)}}}function ei(e,t,i){this.line=t,this.rest=Hr(t),this.size=this.rest?Tn(eo(this.rest))-i+1:1,this.node=this.text=null,this.hidden=Wr(e,t)}function ti(e,t,i){for(var r,n=[],o=t;i>o;o=r){var s=new ei(e.doc,xn(e.doc,o),o);r=o+s.size,n.push(s)}return n}function ii(e,t,i,r){null==t&&(t=e.doc.first),null==i&&(i=e.doc.first+e.doc.size),r||(r=0);var n=e.display;if(r&&i<n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>t)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)ss&&Fr(e.doc,t)<n.viewTo&&ni(e);else if(i<=n.viewFrom)ss&&jr(e.doc,i+r)>n.viewFrom?ni(e):(n.viewFrom+=r,n.viewTo+=r);else if(t<=n.viewFrom&&i>=n.viewTo)ni(e);else if(t<=n.viewFrom){var o=si(e,i,i+r,1);o?(n.view=n.view.slice(o.index),n.viewFrom=o.lineN,n.viewTo+=r):ni(e)}else if(i>=n.viewTo){var o=si(e,t,t,-1);o?(n.view=n.view.slice(0,o.index),n.viewTo=o.lineN):ni(e)}else{var s=si(e,t,t,-1),a=si(e,i,i+r,1);s&&a?(n.view=n.view.slice(0,s.index).concat(ti(e,s.lineN,a.lineN)).concat(n.view.slice(a.index)),n.viewTo+=r):ni(e)}var l=n.externalMeasured;l&&(i<l.lineN?l.lineN+=r:t<l.lineN+l.size&&(n.externalMeasured=null))}function ri(e,t,i){e.curOp.viewChanged=!0;var r=e.display,n=e.display.externalMeasured;if(n&&t>=n.lineN&&t<n.lineN+n.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[oi(e,t)];if(null!=o.node){var s=o.changes||(o.changes=[]);-1==to(s,i)&&s.push(i)}}}function ni(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function oi(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var i=e.display.view,r=0;r<i.length;r++)if(t-=i[r].size,0>t)return r}function si(e,t,i,r){var n,o=oi(e,t),s=e.display.view;if(!ss||i==e.doc.first+e.doc.size)return{index:o,lineN:i};for(var a=0,l=e.display.viewFrom;o>a;a++)l+=s[a].size;if(l!=t){if(r>0){if(o==s.length-1)return null;n=l+s[o].size-t,o++}else n=l-t;t+=n,i+=n}for(;Fr(e.doc,i)!=i;){if(o==(0>r?0:s.length-1))return null;i+=r*s[o-(0>r?1:0)].size,o+=r}return{index:o,lineN:i}}function ai(e,t,i){var r=e.display,n=r.view;0==n.length||t>=r.viewTo||i<=r.viewFrom?(r.view=ti(e,t,i),r.viewFrom=t):(r.viewFrom>t?r.view=ti(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(oi(e,t))),r.viewFrom=t,r.viewTo<i?r.view=r.view.concat(ti(e,r.viewTo,i)):r.viewTo>i&&(r.view=r.view.slice(0,oi(e,i)))),r.viewTo=i}function li(e){for(var t=e.display.view,i=0,r=0;r<t.length;r++){var n=t[r];n.hidden||n.node&&!n.changes||++i}return i}function ui(e){e.display.pollingFast||e.display.poll.set(e.options.pollInterval,function(){ci(e),e.state.focused&&ui(e)})}function pi(e){function t(){var r=ci(e);r||i?(e.display.pollingFast=!1,ui(e)):(i=!0,e.display.poll.set(60,t))}var i=!1;e.display.pollingFast=!0,e.display.poll.set(20,t)}function ci(e){var t=e.display.input,i=e.display.prevInput,r=e.doc;if(!e.state.focused||xa(t)&&!i||fi(e)||e.options.disableInput)return!1;e.state.pasteIncoming&&e.state.fakedLastChar&&(t.value=t.value.substring(0,t.value.length-1),e.state.fakedLastChar=!1);var n=t.value;if(n==i&&!e.somethingSelected())return!1;if(jo&&!Vo&&e.display.inputHasSelection===n)return di(e),!1;var o=!e.curOp;o&&Yt(e),e.display.shift=!1,8203!=n.charCodeAt(0)||r.sel!=e.display.selForContextMenu||i||(i="​");for(var s=0,a=Math.min(i.length,n.length);a>s&&i.charCodeAt(s)==n.charCodeAt(s);)++s;for(var l=n.slice(s),u=va(l),p=e.state.pasteIncoming&&u.length>1&&r.sel.ranges.length==u.length,c=r.sel.ranges.length-1;c>=0;c--){var d=r.sel.ranges[c],E=d.from(),h=d.to();s<i.length?E=as(E.line,E.ch-(i.length-s)):e.state.overwrite&&d.empty()&&!e.state.pasteIncoming&&(h=as(h.line,Math.min(xn(r,h.line).text.length,h.ch+eo(u).length)));var f=e.curOp.updateInput,m={from:E,to:h,text:p?[u[c]]:u,origin:e.state.pasteIncoming?"paste":e.state.cutIncoming?"cut":"+input"};if(Yi(e.doc,m),qn(e,"inputRead",e,m),l&&!e.state.pasteIncoming&&e.options.electricChars&&e.options.smartIndent&&d.head.ch<100&&(!c||r.sel.ranges[c-1].head.line!=d.head.line)){var g=e.getModeAt(d.head);if(g.electricChars){for(var v=0;v<g.electricChars.length;v++)if(l.indexOf(g.electricChars.charAt(v))>-1){lr(e,d.head.line,"smart");break}}else if(g.electricInput){var x=xs(m);g.electricInput.test(xn(r,x.line).text.slice(0,x.ch))&&lr(e,d.head.line,"smart")}}}return sr(e),e.curOp.updateInput=f,e.curOp.typing=!0,n.length>1e3||n.indexOf("\n")>-1?t.value=e.display.prevInput="":e.display.prevInput=n,o&&Kt(e),e.state.pasteIncoming=e.state.cutIncoming=!1,!0}function di(e,t){var i,r,n=e.doc;if(e.somethingSelected()){e.display.prevInput="";var o=n.sel.primary();i=Na&&(o.to().line-o.from().line>100||(r=e.getSelection()).length>1e3);var s=i?"-":r||e.getSelection();e.display.input.value=s,e.state.focused&&la(e.display.input),jo&&!Vo&&(e.display.inputHasSelection=s)}else t||(e.display.prevInput=e.display.input.value="",jo&&!Vo&&(e.display.inputHasSelection=null));e.display.inaccurateSelection=i}function Ei(e){"nocursor"==e.options.readOnly||Jo&&ho()==e.display.input||e.display.input.focus()}function hi(e){e.state.focused||(Ei(e),Ui(e))}function fi(e){return e.options.readOnly||e.doc.cantEdit}function mi(e){function t(){e.state.focused&&setTimeout(oo(Ei,e),0)}function i(t){Xn(e,t)||$s(t)}function r(t){if(e.somethingSelected())n.inaccurateSelection&&(n.prevInput="",n.inaccurateSelection=!1,n.input.value=e.getSelection(),la(n.input));else{for(var i="",r=[],o=0;o<e.doc.sel.ranges.length;o++){var s=e.doc.sel.ranges[o].head.line,a={anchor:as(s,0),head:as(s+1,0)};r.push(a),i+=e.getRange(a.anchor,a.head)}"cut"==t.type?e.setSelections(r,null,ra):(n.prevInput="",n.input.value=i,la(n.input))}"cut"==t.type&&(e.state.cutIncoming=!0)}var n=e.display;Qs(n.scroller,"mousedown",Qt(e,Ni)),Bo?Qs(n.scroller,"dblclick",Qt(e,function(t){if(!Xn(e,t)){var i=xi(e,t);if(i&&!Ai(e,t)&&!vi(e.display,t)){Ys(t);var r=Er(e,i);it(e.doc,r.anchor,r.head)}}})):Qs(n.scroller,"dblclick",function(t){Xn(e,t)||Ys(t)}),Qs(n.lineSpace,"selectstart",function(e){vi(n,e)||Ys(e)}),ns||Qs(n.scroller,"contextmenu",function(t){Hi(e,t)}),Qs(n.scroller,"scroll",function(){n.scroller.clientHeight&&(Ri(e,n.scroller.scrollTop),bi(e,n.scroller.scrollLeft,!0),Js(e,"scroll",e))}),Qs(n.scrollbarV,"scroll",function(){n.scroller.clientHeight&&Ri(e,n.scrollbarV.scrollTop)}),Qs(n.scrollbarH,"scroll",function(){n.scroller.clientHeight&&bi(e,n.scrollbarH.scrollLeft)}),Qs(n.scroller,"mousewheel",function(t){Oi(e,t)}),Qs(n.scroller,"DOMMouseScroll",function(t){Oi(e,t)}),Qs(n.scrollbarH,"mousedown",t),Qs(n.scrollbarV,"mousedown",t),Qs(n.wrapper,"scroll",function(){n.wrapper.scrollTop=n.wrapper.scrollLeft=0}),Qs(n.input,"keyup",Qt(e,ki)),Qs(n.input,"input",function(){jo&&!Vo&&e.display.inputHasSelection&&(e.display.inputHasSelection=null),pi(e)}),Qs(n.input,"keydown",Qt(e,wi)),Qs(n.input,"keypress",Qt(e,Bi)),Qs(n.input,"focus",oo(Ui,e)),Qs(n.input,"blur",oo(Vi,e)),e.options.dragDrop&&(Qs(n.scroller,"dragstart",function(t){Ci(e,t)}),Qs(n.scroller,"dragenter",i),Qs(n.scroller,"dragover",i),Qs(n.scroller,"drop",Qt(e,Si))),Qs(n.scroller,"paste",function(t){vi(n,t)||(e.state.pasteIncoming=!0,Ei(e),pi(e))}),Qs(n.input,"paste",function(){if(Wo&&!e.state.fakedLastChar&&!(new Date-e.state.lastMiddleDown<200)){var t=n.input.selectionStart,i=n.input.selectionEnd;n.input.value+="$",n.input.selectionStart=t,n.input.selectionEnd=i,e.state.fakedLastChar=!0}e.state.pasteIncoming=!0,pi(e)}),Qs(n.input,"cut",r),Qs(n.input,"copy",r),Ko&&Qs(n.sizer,"mouseup",function(){ho()==n.input&&n.input.blur(),Ei(e)})}function gi(e){var t=e.display;t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,e.setSize()}function vi(e,t){for(var i=jn(t);i!=e.wrapper;i=i.parentNode)if(!i||i.ignoreEvents||i.parentNode==e.sizer&&i!=e.mover)return!0}function xi(e,t,i,r){var n=e.display;if(!i){var o=jn(t);if(o==n.scrollbarH||o==n.scrollbarV||o==n.scrollbarFiller||o==n.gutterFiller)return null}var s,a,l=n.lineSpace.getBoundingClientRect();try{s=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var u,p=Wt(e,s,a);if(r&&1==p.xRel&&(u=xn(e.doc,p.line).text).length==p.ch){var c=sa(u,u.length,e.options.tabSize)-u.length;p=as(p.line,Math.max(0,Math.round((s-yt(e.display).left)/Xt(e.display))-c))}return p}function Ni(e){if(!Xn(this,e)){var t=this,i=t.display;if(i.shift=e.shiftKey,vi(i,e))return void(Wo||(i.scroller.draggable=!1,setTimeout(function(){i.scroller.draggable=!0},100)));if(!Ai(t,e)){var r=xi(t,e);switch(window.focus(),Wn(e)){case 1:r?Li(t,e,r):jn(e)==i.scroller&&Ys(e);break;case 2:Wo&&(t.state.lastMiddleDown=+new Date),r&&it(t.doc,r),setTimeout(oo(Ei,t),20),Ys(e);break;case 3:ns&&Hi(t,e)}}}}function Li(e,t,i){setTimeout(oo(hi,e),0);var r,n=+new Date;cs&&cs.time>n-400&&0==ls(cs.pos,i)?r="triple":ps&&ps.time>n-400&&0==ls(ps.pos,i)?(r="double",cs={time:n,pos:i}):(r="single",ps={time:n,pos:i});var o=e.doc.sel,s=es?t.metaKey:t.ctrlKey;e.options.dragDrop&&ga&&!fi(e)&&"single"==r&&o.contains(i)>-1&&o.somethingSelected()?Ii(e,t,i,s):Ti(e,t,i,r,s)}function Ii(e,t,i,r){var n=e.display,o=Qt(e,function(s){Wo&&(n.scroller.draggable=!1),e.state.draggingText=!1,Zs(document,"mouseup",o),Zs(n.scroller,"drop",o),Math.abs(t.clientX-s.clientX)+Math.abs(t.clientY-s.clientY)<10&&(Ys(s),r||it(e.doc,i),Ei(e),Bo&&!Vo&&setTimeout(function(){document.body.focus(),Ei(e)},20))});Wo&&(n.scroller.draggable=!0),e.state.draggingText=o,n.scroller.dragDrop&&n.scroller.dragDrop(),Qs(document,"mouseup",o),Qs(n.scroller,"drop",o)}function Ti(e,t,i,r,n){function o(t){if(0!=ls(f,t))if(f=t,"rect"==r){for(var n=[],o=e.options.tabSize,s=sa(xn(u,i.line).text,i.ch,o),a=sa(xn(u,t.line).text,t.ch,o),l=Math.min(s,a),E=Math.max(s,a),h=Math.min(i.line,t.line),m=Math.min(e.lastLine(),Math.max(i.line,t.line));m>=h;h++){var g=xn(u,h).text,v=Zn(g,l,o);l==E?n.push(new X(as(h,v),as(h,v))):g.length>v&&n.push(new X(as(h,v),as(h,Zn(g,E,o))))}n.length||n.push(new X(i,i)),lt(u,Y(d.ranges.slice(0,c).concat(n),c),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var x=p,N=x.anchor,L=t;if("single"!=r){if("double"==r)var I=Er(e,t);else var I=new X(as(t.line,0),Q(u,as(t.line+1,0)));ls(I.anchor,N)>0?(L=I.head,N=q(x.from(),I.anchor)):(L=I.anchor,N=W(x.to(),I.head))}var n=d.ranges.slice(0);n[c]=new X(Q(u,N),L),lt(u,Y(n,c),na)}}function s(t){var i=++v,n=xi(e,t,!0,"rect"==r);if(n)if(0!=ls(n,f)){hi(e),o(n);var a=g(l,u);(n.line>=a.to||n.line<a.from)&&setTimeout(Qt(e,function(){v==i&&s(t)}),150)}else{var p=t.clientY<m.top?-20:t.clientY>m.bottom?20:0;p&&setTimeout(Qt(e,function(){v==i&&(l.scroller.scrollTop+=p,s(t))}),50)}}function a(t){v=1/0,Ys(t),Ei(e),Zs(document,"mousemove",x),Zs(document,"mouseup",N),u.history.lastSelOrigin=null}var l=e.display,u=e.doc;Ys(t);var p,c,d=u.sel;if(n&&!t.shiftKey?(c=u.sel.contains(i),p=c>-1?u.sel.ranges[c]:new X(i,i)):p=u.sel.primary(),t.altKey)r="rect",n||(p=new X(i,i)),i=xi(e,t,!0,!0),c=-1;else if("double"==r){var E=Er(e,i);p=e.display.shift||u.extend?tt(u,p,E.anchor,E.head):E}else if("triple"==r){var h=new X(as(i.line,0),Q(u,as(i.line+1,0)));p=e.display.shift||u.extend?tt(u,p,h.anchor,h.head):h}else p=tt(u,p,i);n?c>-1?nt(u,c,p,na):(c=u.sel.ranges.length,lt(u,Y(u.sel.ranges.concat([p]),c),{scroll:!1,origin:"*mouse"})):(c=0,lt(u,new z([p],0),na),d=u.sel);var f=i,m=l.wrapper.getBoundingClientRect(),v=0,x=Qt(e,function(e){(jo&&!Ho?e.buttons:Wn(e))?s(e):a(e)}),N=Qt(e,a);Qs(document,"mousemove",x),Qs(document,"mouseup",N)}function yi(e,t,i,r,n){try{var o=t.clientX,s=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&Ys(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(s>l.bottom||!Kn(e,i))return Fn(t);s-=l.top-a.viewOffset;for(var u=0;u<e.options.gutters.length;++u){var p=a.gutters.childNodes[u];if(p&&p.getBoundingClientRect().right>=o){var c=yn(e.doc,s),d=e.options.gutters[u];return n(e,i,e,c,d,t),Fn(t)}}}function Ai(e,t){return yi(e,t,"gutterClick",!0,qn)}function Si(e){var t=this;if(!Xn(t,e)&&!vi(t.display,e)){Ys(e),jo&&(hs=+new Date);var i=xi(t,e,!0),r=e.dataTransfer.files;if(i&&!fi(t))if(r&&r.length&&window.FileReader&&window.File)for(var n=r.length,o=Array(n),s=0,a=function(e,r){var a=new FileReader;a.onload=Qt(t,function(){if(o[r]=a.result,++s==n){i=Q(t.doc,i);var e={from:i,to:i,text:va(o.join("\n")),origin:"paste"};Yi(t.doc,e),at(t.doc,K(i,xs(e)))}}),a.readAsText(e)},l=0;n>l;++l)a(r[l],l);else{if(t.state.draggingText&&t.doc.sel.contains(i)>-1)return t.state.draggingText(e),void setTimeout(oo(Ei,t),20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(es?e.metaKey:e.ctrlKey))var u=t.listSelections();if(ut(t.doc,K(i,i)),u)for(var l=0;l<u.length;++l)er(t.doc,"",u[l].anchor,u[l].head,"drag");t.replaceSelection(o,"around","paste"),Ei(t)}}catch(e){}}}}function Ci(e,t){if(jo&&(!e.state.draggingText||+new Date-hs<100))return void $s(t);if(!Xn(e,t)&&!vi(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.setDragImage&&!Yo)){var i=uo("img",null,null,"position: fixed; left: 0; top: 0;");i.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",Xo&&(i.width=i.height=1,e.display.wrapper.appendChild(i),i._top=i.offsetTop),t.dataTransfer.setDragImage(i,0,0),Xo&&i.parentNode.removeChild(i)}}function Ri(e,t){Math.abs(e.doc.scrollTop-t)<2||(e.doc.scrollTop=t,ko||I(e,{top:t}),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t),e.display.scrollbarV.scrollTop!=t&&(e.display.scrollbarV.scrollTop=t),ko&&I(e),vt(e,100))}function bi(e,t,i){(i?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)||(t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),e.doc.scrollLeft=t,v(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbarH.scrollLeft!=t&&(e.display.scrollbarH.scrollLeft=t))}function Oi(e,t){var i=t.wheelDeltaX,r=t.wheelDeltaY;null==i&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(i=t.detail),null==r&&t.detail&&t.axis==t.VERTICAL_AXIS?r=t.detail:null==r&&(r=t.wheelDelta);var n=e.display,o=n.scroller;if(i&&o.scrollWidth>o.clientWidth||r&&o.scrollHeight>o.clientHeight){if(r&&es&&Wo)e:for(var s=t.target,a=n.view;s!=o;s=s.parentNode)for(var l=0;l<a.length;l++)if(a[l].node==s){e.display.currentWheelTarget=s;break e}if(i&&!ko&&!Xo&&null!=ms)return r&&Ri(e,Math.max(0,Math.min(o.scrollTop+r*ms,o.scrollHeight-o.clientHeight))),bi(e,Math.max(0,Math.min(o.scrollLeft+i*ms,o.scrollWidth-o.clientWidth))),Ys(t),void(n.wheelStartX=null);if(r&&null!=ms){var u=r*ms,p=e.doc.scrollTop,c=p+n.wrapper.clientHeight;0>u?p=Math.max(0,p+u-50):c=Math.min(e.doc.height,c+u+50),I(e,{top:p,bottom:c})}20>fs&&(null==n.wheelStartX?(n.wheelStartX=o.scrollLeft,n.wheelStartY=o.scrollTop,n.wheelDX=i,n.wheelDY=r,setTimeout(function(){if(null!=n.wheelStartX){var e=o.scrollLeft-n.wheelStartX,t=o.scrollTop-n.wheelStartY,i=t&&n.wheelDY&&t/n.wheelDY||e&&n.wheelDX&&e/n.wheelDX;n.wheelStartX=n.wheelStartY=null,i&&(ms=(ms*fs+i)/(fs+1),++fs)}},200)):(n.wheelDX+=i,n.wheelDY+=r))}}function Pi(e,t,i){if("string"==typeof t&&(t=Os[t],!t))return!1;e.display.pollingFast&&ci(e)&&(e.display.pollingFast=!1);var r=e.display.shift,n=!1;try{fi(e)&&(e.state.suppressEdits=!0),i&&(e.display.shift=!1),n=t(e)!=ia}finally{e.display.shift=r,e.state.suppressEdits=!1}return n}function Di(e){var t=e.state.keyMaps.slice(0);return e.options.extraKeys&&t.push(e.options.extraKeys),t.push(e.options.keyMap),t}function _i(e,t){var i=fr(e.options.keyMap),r=i.auto;clearTimeout(gs),r&&!_s(t)&&(gs=setTimeout(function(){fr(e.options.keyMap)==i&&(e.options.keyMap=r.call?r.call(null,e):r,a(e))},50));var n=Ms(t,!0),o=!1;if(!n)return!1;var s=Di(e);return o=t.shiftKey?Ds("Shift-"+n,s,function(t){return Pi(e,t,!0) })||Ds(n,s,function(t){return("string"==typeof t?/^go[A-Z]/.test(t):t.motion)?Pi(e,t):void 0}):Ds(n,s,function(t){return Pi(e,t)}),o&&(Ys(t),gt(e),qn(e,"keyHandled",e,n,t)),o}function Mi(e,t,i){var r=Ds("'"+i+"'",Di(e),function(t){return Pi(e,t,!0)});return r&&(Ys(t),gt(e),qn(e,"keyHandled",e,"'"+i+"'",t)),r}function wi(e){var t=this;if(hi(t),!Xn(t,e)){Bo&&27==e.keyCode&&(e.returnValue=!1);var i=e.keyCode;t.display.shift=16==i||e.shiftKey;var r=_i(t,e);Xo&&(vs=r?i:null,!r&&88==i&&!Na&&(es?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=i||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||Gi(t)}}function Gi(e){function t(e){18!=e.keyCode&&e.altKey||(mo(i,"CodeMirror-crosshair"),Zs(document,"keyup",t),Zs(document,"mouseover",t))}var i=e.display.lineDiv;go(i,"CodeMirror-crosshair"),Qs(document,"keyup",t),Qs(document,"mouseover",t)}function ki(e){Xn(this,e)||16==e.keyCode&&(this.doc.sel.shift=!1)}function Bi(e){var t=this;if(!Xn(t,e)){var i=e.keyCode,r=e.charCode;if(Xo&&i==vs)return vs=null,void Ys(e);if(!(Xo&&(!e.which||e.which<10)||Ko)||!_i(t,e)){var n=String.fromCharCode(null==r?i:r);Mi(t,e,n)||(jo&&!Vo&&(t.display.inputHasSelection=null),pi(t))}}}function Ui(e){"nocursor"!=e.options.readOnly&&(e.state.focused||(Js(e,"focus",e),e.state.focused=!0,go(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(di(e),Wo&&setTimeout(oo(di,e,!0),0))),ui(e),gt(e))}function Vi(e){e.state.focused&&(Js(e,"blur",e),e.state.focused=!1,mo(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150)}function Hi(e,t){function i(){if(null!=n.input.selectionStart){var t=e.somethingSelected(),i=n.input.value="​"+(t?n.input.value:"");n.prevInput=t?"":"​",n.input.selectionStart=1,n.input.selectionEnd=i.length,n.selForContextMenu=e.doc.sel}}function r(){if(n.inputDiv.style.position="relative",n.input.style.cssText=l,Vo&&(n.scrollbarV.scrollTop=n.scroller.scrollTop=s),ui(e),null!=n.input.selectionStart){(!jo||Vo)&&i();var t=0,r=function(){n.selForContextMenu==e.doc.sel&&0==n.input.selectionStart?Qt(e,Os.selectAll)(e):t++<10?n.detectingSelectAll=setTimeout(r,500):di(e)};n.detectingSelectAll=setTimeout(r,200)}}if(!Xn(e,t,"contextmenu")){var n=e.display;if(!vi(n,t)&&!Fi(e,t)){var o=xi(e,t),s=n.scroller.scrollTop;if(o&&!Xo){var a=e.options.resetSelectionOnContextMenu;a&&-1==e.doc.sel.contains(o)&&Qt(e,lt)(e.doc,K(o),ra);var l=n.input.style.cssText;if(n.inputDiv.style.position="absolute",n.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(t.clientY-5)+"px; left: "+(t.clientX-5)+"px; z-index: 1000; background: "+(jo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",Ei(e),di(e),e.somethingSelected()||(n.input.value=n.prevInput=" "),n.selForContextMenu=e.doc.sel,clearTimeout(n.detectingSelectAll),jo&&!Vo&&i(),ns){$s(t);var u=function(){Zs(window,"mouseup",u),setTimeout(r,20)};Qs(window,"mouseup",u)}else setTimeout(r,50)}}}}function Fi(e,t){return Kn(e,"gutterContextMenu")?yi(e,t,"gutterContextMenu",!1,Js):!1}function ji(e,t){if(ls(e,t.from)<0)return e;if(ls(e,t.to)<=0)return xs(t);var i=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=xs(t).ch-t.to.ch),as(i,r)}function Wi(e,t){for(var i=[],r=0;r<e.sel.ranges.length;r++){var n=e.sel.ranges[r];i.push(new X(ji(n.anchor,t),ji(n.head,t)))}return Y(i,e.sel.primIndex)}function qi(e,t,i){return e.line==t.line?as(i.line,e.ch-t.ch+i.ch):as(i.line+(e.line-t.line),e.ch)}function zi(e,t,i){for(var r=[],n=as(e.first,0),o=n,s=0;s<t.length;s++){var a=t[s],l=qi(a.from,n,o),u=qi(xs(a),n,o);if(n=a.to,o=u,"around"==i){var p=e.sel.ranges[s],c=ls(p.head,p.anchor)<0;r[s]=new X(c?u:l,c?l:u)}else r[s]=new X(l,l)}return new z(r,e.sel.primIndex)}function Xi(e,t,i){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){this.canceled=!0}};return i&&(r.update=function(t,i,r,n){t&&(this.from=Q(e,t)),i&&(this.to=Q(e,i)),r&&(this.text=r),void 0!==n&&(this.origin=n)}),Js(e,"beforeChange",e,r),e.cm&&Js(e.cm,"beforeChange",e.cm,r),r.canceled?null:{from:r.from,to:r.to,text:r.text,origin:r.origin}}function Yi(e,t,i){if(e.cm){if(!e.cm.curOp)return Qt(e.cm,Yi)(e,t,i);if(e.cm.state.suppressEdits)return}if(!(Kn(e,"beforeChange")||e.cm&&Kn(e.cm,"beforeChange"))||(t=Xi(e,t,!0))){var r=os&&!i&&Or(e,t.from,t.to);if(r)for(var n=r.length-1;n>=0;--n)Ki(e,{from:r[n].from,to:r[n].to,text:n?[""]:t.text});else Ki(e,t)}}function Ki(e,t){if(1!=t.text.length||""!=t.text[0]||0!=ls(t.from,t.to)){var i=Wi(e,t);Pn(e,t,i,e.cm?e.cm.curOp.id:0/0),Zi(e,t,i,Cr(e,t));var r=[];gn(e,function(e,i){i||-1!=to(r,e.history)||(Hn(e.history,t),r.push(e.history)),Zi(e,t,null,Cr(e,t))})}}function $i(e,t,i){if(!e.cm||!e.cm.state.suppressEdits){for(var r,n=e.history,o=e.sel,s="undo"==t?n.done:n.undone,a="undo"==t?n.undone:n.done,l=0;l<s.length&&(r=s[l],i?!r.ranges||r.equals(e.sel):r.ranges);l++);if(l!=s.length){for(n.lastOrigin=n.lastSelOrigin=null;r=s.pop(),r.ranges;){if(Mn(r,a),i&&!r.equals(e.sel))return void lt(e,r,{clearRedo:!1});o=r}var u=[];Mn(o,a),a.push({changes:u,generation:n.generation}),n.generation=r.generation||++n.maxGeneration;for(var p=Kn(e,"beforeChange")||e.cm&&Kn(e.cm,"beforeChange"),l=r.changes.length-1;l>=0;--l){var c=r.changes[l];if(c.origin=t,p&&!Xi(e,c,!1))return void(s.length=0);u.push(Rn(e,c));var d=l?Wi(e,c,null):eo(s);Zi(e,c,d,br(e,c)),!l&&e.cm&&e.cm.scrollIntoView(c);var E=[];gn(e,function(e,t){t||-1!=to(E,e.history)||(Hn(e.history,c),E.push(e.history)),Zi(e,c,null,br(e,c))})}}}}function Qi(e,t){if(0!=t&&(e.first+=t,e.sel=new z(io(e.sel.ranges,function(e){return new X(as(e.anchor.line+t,e.anchor.ch),as(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){ii(e.cm,e.first,e.first-t,t);for(var i=e.cm.display,r=i.viewFrom;r<i.viewTo;r++)ri(e.cm,r,"gutter")}}function Zi(e,t,i,r){if(e.cm&&!e.cm.curOp)return Qt(e.cm,Zi)(e,t,i,r);if(t.to.line<e.first)return void Qi(e,t.text.length-1-(t.to.line-t.from.line));if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var n=t.text.length-1-(e.first-t.from.line);Qi(e,n),t={from:as(e.first,0),to:as(t.to.line+n,t.to.ch),text:[eo(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:as(o,xn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Nn(e,t.from,t.to),i||(i=Wi(e,t,null)),e.cm?Ji(e.cm,t,r):hn(e,t,r),ut(e,i,ra)}}function Ji(e,t,i){var r=e.doc,n=e.display,s=t.from,a=t.to,l=!1,u=s.line;e.options.lineWrapping||(u=Tn(Vr(xn(r,s.line))),r.iter(u,a.line+1,function(e){return e==n.maxLine?(l=!0,!0):void 0})),r.sel.contains(t.from,t.to)>-1&&Yn(e),hn(r,t,i,o(e)),e.options.lineWrapping||(r.iter(u,s.line+t.text.length,function(e){var t=d(e);t>n.maxLineLength&&(n.maxLine=e,n.maxLineLength=t,n.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),r.frontier=Math.min(r.frontier,s.line),vt(e,400);var p=t.text.length-(a.line-s.line)-1;s.line!=a.line||1!=t.text.length||En(e.doc,t)?ii(e,s.line,a.line+1,p):ri(e,s.line,"text");var c=Kn(e,"changes"),E=Kn(e,"change");if(E||c){var h={from:s,to:a,text:t.text,removed:t.removed,origin:t.origin};E&&qn(e,"change",e,h),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function er(e,t,i,r,n){if(r||(r=i),ls(r,i)<0){var o=r;r=i,i=o}"string"==typeof t&&(t=va(t)),Yi(e,{from:i,to:r,text:t,origin:n})}function tr(e,t){var i=e.display,r=i.sizer.getBoundingClientRect(),n=null;if(t.top+r.top<0?n=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),null!=n&&!Qo){var o=uo("div","​",null,"position: absolute; top: "+(t.top-i.viewOffset-It(e.display))+"px; height: "+(t.bottom-t.top+ta)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(n),e.display.lineSpace.removeChild(o)}}function ir(e,t,i,r){for(null==r&&(r=0);;){var n=!1,o=Ht(e,t),s=i&&i!=t?Ht(e,i):o,a=nr(e,Math.min(o.left,s.left),Math.min(o.top,s.top)-r,Math.max(o.left,s.left),Math.max(o.bottom,s.bottom)+r),l=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=a.scrollTop&&(Ri(e,a.scrollTop),Math.abs(e.doc.scrollTop-l)>1&&(n=!0)),null!=a.scrollLeft&&(bi(e,a.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(n=!0)),!n)return o}}function rr(e,t,i,r,n){var o=nr(e,t,i,r,n);null!=o.scrollTop&&Ri(e,o.scrollTop),null!=o.scrollLeft&&bi(e,o.scrollLeft)}function nr(e,t,i,r,n){var o=e.display,s=zt(e.display);0>i&&(i=0);var a=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,l=o.scroller.clientHeight-ta,u={},p=e.doc.height+Tt(o),c=s>i,d=n>p-s;if(a>i)u.scrollTop=c?0:i;else if(n>a+l){var E=Math.min(i,(d?p:n)-l);E!=a&&(u.scrollTop=E)}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,f=o.scroller.clientWidth-ta;t+=o.gutters.offsetWidth,r+=o.gutters.offsetWidth;var m=o.gutters.offsetWidth,g=m+10>t;return h+m>t||g?(g&&(t=0),u.scrollLeft=Math.max(0,t-10-m)):r>f+h-3&&(u.scrollLeft=r+10-f),u}function or(e,t,i){(null!=t||null!=i)&&ar(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=i&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+i)}function sr(e){ar(e);var t=e.getCursor(),i=t,r=t;e.options.lineWrapping||(i=t.ch?as(t.line,t.ch-1):t,r=as(t.line,t.ch+1)),e.curOp.scrollToPos={from:i,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function ar(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var i=Ft(e,t.from),r=Ft(e,t.to),n=nr(e,Math.min(i.left,r.left),Math.min(i.top,r.top)-t.margin,Math.max(i.right,r.right),Math.max(i.bottom,r.bottom)+t.margin);e.scrollTo(n.scrollLeft,n.scrollTop)}}function lr(e,t,i,r){var n,o=e.doc;null==i&&(i="add"),"smart"==i&&(e.doc.mode.indent?n=Lt(e,t):i="prev");var s=e.options.tabSize,a=xn(o,t),l=sa(a.text,null,s);a.stateAfter&&(a.stateAfter=null);var u,p=a.text.match(/^\s*/)[0];if(r||/\S/.test(a.text)){if("smart"==i&&(u=e.doc.mode.indent(n,a.text.slice(p.length),a.text),u==ia)){if(!r)return;i="prev"}}else u=0,i="not";"prev"==i?u=t>o.first?sa(xn(o,t-1).text,null,s):0:"add"==i?u=l+e.options.indentUnit:"subtract"==i?u=l-e.options.indentUnit:"number"==typeof i&&(u=l+i),u=Math.max(0,u);var c="",d=0;if(e.options.indentWithTabs)for(var E=Math.floor(u/s);E;--E)d+=s,c+=" ";if(u>d&&(c+=Jn(u-d)),c!=p)er(e.doc,c,as(t,0),as(t,p.length),"+input");else for(var E=0;E<o.sel.ranges.length;E++){var h=o.sel.ranges[E];if(h.head.line==t&&h.head.ch<p.length){var d=as(t,p.length);nt(o,E,new X(d,d));break}}a.stateAfter=null}function ur(e,t,i,r){var n=t,o=t,s=e.doc;return"number"==typeof t?o=xn(s,$(s,t)):n=Tn(t),null==n?null:(r(o,n)&&ri(e,n,i),o)}function pr(e,t){for(var i=e.doc.sel.ranges,r=[],n=0;n<i.length;n++){for(var o=t(i[n]);r.length&&ls(o.from,eo(r).to)<=0;){var s=r.pop();if(ls(s.from,o.from)<0){o.from=s.from;break}}r.push(o)}$t(e,function(){for(var t=r.length-1;t>=0;t--)er(e.doc,"",r[t].from,r[t].to,"+delete");sr(e)})}function cr(e,t,i,r,n){function o(){var t=a+i;return t<e.first||t>=e.first+e.size?c=!1:(a=t,p=xn(e,t))}function s(e){var t=(n?wo:Go)(p,l,i,!0);if(null==t){if(e||!o())return c=!1;l=n?(0>i?bo:Ro)(p):0>i?p.text.length:0}else l=t;return!0}var a=t.line,l=t.ch,u=i,p=xn(e,a),c=!0;if("char"==r)s();else if("column"==r)s(!0);else if("word"==r||"group"==r)for(var d=null,E="group"==r,h=e.cm&&e.cm.getHelper(t,"wordChars"),f=!0;!(0>i)||s(!f);f=!1){var m=p.text.charAt(l)||"\n",g=so(m,h)?"w":E&&"\n"==m?"n":!E||/\s/.test(m)?null:"p";if(!E||f||g||(g="s"),d&&d!=g){0>i&&(i=1,s());break}if(g&&(d=g),i>0&&!s(!f))break}var v=Et(e,as(a,l),u,!0);return c||(v.hitSide=!0),v}function dr(e,t,i,r){var n,o=e.doc,s=t.left;if("page"==r){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);n=t.top+i*(a-(0>i?1.5:.5)*zt(e.display))}else"line"==r&&(n=i>0?t.bottom+3:t.top-3);for(;;){var l=Wt(e,s,n);if(!l.outside)break;if(0>i?0>=n:n>=o.height){l.hitSide=!0;break}n+=5*i}return l}function Er(e,t){var i=e.doc,r=xn(i,t.line).text,n=t.ch,o=t.ch;if(r){var s=e.getHelper(t,"wordChars");(t.xRel<0||o==r.length)&&n?--n:++o;for(var a=r.charAt(n),l=so(a,s)?function(e){return so(e,s)}:/\s/.test(a)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!so(e)};n>0&&l(r.charAt(n-1));)--n;for(;o<r.length&&l(r.charAt(o));)++o}return new X(as(t.line,n),as(t.line,o))}function hr(t,i,r,n){e.defaults[t]=i,r&&(Ls[t]=n?function(e,t,i){i!=Is&&r(e,t,i)}:r)}function fr(e){return"string"==typeof e?Ps[e]:e}function mr(e,t,i,r,n){if(r&&r.shared)return gr(e,t,i,r,n);if(e.cm&&!e.cm.curOp)return Qt(e.cm,mr)(e,t,i,r,n);var o=new Gs(e,n),s=ls(t,i);if(r&&no(r,o,!1),s>0||0==s&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=uo("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||(o.widgetNode.ignoreEvents=!0),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Ur(e,t.line,t,i,o)||t.line!=i.line&&Ur(e,i.line,t,i,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");ss=!0}o.addToHistory&&Pn(e,{from:t,to:i,origin:"markText"},e.sel,0/0);var a,l=t.line,u=e.cm;if(e.iter(l,i.line+1,function(e){u&&o.collapsed&&!u.options.lineWrapping&&Vr(e)==u.display.maxLine&&(a=!0),o.collapsed&&l!=t.line&&In(e,0),yr(e,new Lr(o,l==t.line?t.ch:null,l==i.line?i.ch:null)),++l}),o.collapsed&&e.iter(t.line,i.line+1,function(t){Wr(e,t)&&In(t,0)}),o.clearOnEnter&&Qs(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(os=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ks,o.atomic=!0),u){if(a&&(u.curOp.updateMaxLine=!0),o.collapsed)ii(u,t.line,i.line+1);else if(o.className||o.title||o.startStyle||o.endStyle)for(var p=t.line;p<=i.line;p++)ri(u,p,"text");o.atomic&&ct(u.doc),qn(u,"markerAdded",u,o)}return o}function gr(e,t,i,r,n){r=no(r),r.shared=!1;var o=[mr(e,t,i,r,n)],s=o[0],a=r.widgetNode;return gn(e,function(e){a&&(r.widgetNode=a.cloneNode(!0)),o.push(mr(e,Q(e,t),Q(e,i),r,n));for(var l=0;l<e.linked.length;++l)if(e.linked[l].isParent)return;s=eo(o)}),new Bs(o,s)}function vr(e){return e.findMarks(as(e.first,0),e.clipPos(as(e.lastLine())),function(e){return e.parent})}function xr(e,t){for(var i=0;i<t.length;i++){var r=t[i],n=r.find(),o=e.clipPos(n.from),s=e.clipPos(n.to);if(ls(o,s)){var a=mr(e,o,s,r.primary,r.primary.type);r.markers.push(a),a.parent=r}}}function Nr(e){for(var t=0;t<e.length;t++){var i=e[t],r=[i.primary.doc];gn(i.primary.doc,function(e){r.push(e)});for(var n=0;n<i.markers.length;n++){var o=i.markers[n];-1==to(r,o.doc)&&(o.parent=null,i.markers.splice(n--,1))}}}function Lr(e,t,i){this.marker=e,this.from=t,this.to=i}function Ir(e,t){if(e)for(var i=0;i<e.length;++i){var r=e[i];if(r.marker==t)return r}}function Tr(e,t){for(var i,r=0;r<e.length;++r)e[r]!=t&&(i||(i=[])).push(e[r]);return i}function yr(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}function Ar(e,t,i){if(e)for(var r,n=0;n<e.length;++n){var o=e[n],s=o.marker,a=null==o.from||(s.inclusiveLeft?o.from<=t:o.from<t);if(a||o.from==t&&"bookmark"==s.type&&(!i||!o.marker.insertLeft)){var l=null==o.to||(s.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new Lr(s,o.from,l?null:o.to))}}return r}function Sr(e,t,i){if(e)for(var r,n=0;n<e.length;++n){var o=e[n],s=o.marker,a=null==o.to||(s.inclusiveRight?o.to>=t:o.to>t);if(a||o.from==t&&"bookmark"==s.type&&(!i||o.marker.insertLeft)){var l=null==o.from||(s.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new Lr(s,l?null:o.from-t,null==o.to?null:o.to-t))}}return r}function Cr(e,t){var i=J(e,t.from.line)&&xn(e,t.from.line).markedSpans,r=J(e,t.to.line)&&xn(e,t.to.line).markedSpans;if(!i&&!r)return null;var n=t.from.ch,o=t.to.ch,s=0==ls(t.from,t.to),a=Ar(i,n,s),l=Sr(r,o,s),u=1==t.text.length,p=eo(t.text).length+(u?n:0);if(a)for(var c=0;c<a.length;++c){var d=a[c];if(null==d.to){var E=Ir(l,d.marker);E?u&&(d.to=null==E.to?null:E.to+p):d.to=n}}if(l)for(var c=0;c<l.length;++c){var d=l[c];if(null!=d.to&&(d.to+=p),null==d.from){var E=Ir(a,d.marker);E||(d.from=p,u&&(a||(a=[])).push(d))}else d.from+=p,u&&(a||(a=[])).push(d)}a&&(a=Rr(a)),l&&l!=a&&(l=Rr(l));var h=[a];if(!u){var f,m=t.text.length-2;if(m>0&&a)for(var c=0;c<a.length;++c)null==a[c].to&&(f||(f=[])).push(new Lr(a[c].marker,null,null));for(var c=0;m>c;++c)h.push(f);h.push(l)}return h}function Rr(e){for(var t=0;t<e.length;++t){var i=e[t];null!=i.from&&i.from==i.to&&i.marker.clearWhenEmpty!==!1&&e.splice(t--,1)}return e.length?e:null}function br(e,t){var i=kn(e,t),r=Cr(e,t);if(!i)return r;if(!r)return i;for(var n=0;n<i.length;++n){var o=i[n],s=r[n];if(o&&s)e:for(var a=0;a<s.length;++a){for(var l=s[a],u=0;u<o.length;++u)if(o[u].marker==l.marker)continue e;o.push(l)}else s&&(i[n]=s)}return i}function Or(e,t,i){var r=null;if(e.iter(t.line,i.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var i=e.markedSpans[t].marker;!i.readOnly||r&&-1!=to(r,i)||(r||(r=[])).push(i)}}),!r)return null;for(var n=[{from:t,to:i}],o=0;o<r.length;++o)for(var s=r[o],a=s.find(0),l=0;l<n.length;++l){var u=n[l];if(!(ls(u.to,a.from)<0||ls(u.from,a.to)>0)){var p=[l,1],c=ls(u.from,a.from),d=ls(u.to,a.to);(0>c||!s.inclusiveLeft&&!c)&&p.push({from:u.from,to:a.from}),(d>0||!s.inclusiveRight&&!d)&&p.push({from:a.to,to:u.to}),n.splice.apply(n,p),l+=p.length-1}}return n}function Pr(e){var t=e.markedSpans;if(t){for(var i=0;i<t.length;++i)t[i].marker.detachLine(e);e.markedSpans=null}}function Dr(e,t){if(t){for(var i=0;i<t.length;++i)t[i].marker.attachLine(e);e.markedSpans=t}}function _r(e){return e.inclusiveLeft?-1:0}function Mr(e){return e.inclusiveRight?1:0}function wr(e,t){var i=e.lines.length-t.lines.length;if(0!=i)return i;var r=e.find(),n=t.find(),o=ls(r.from,n.from)||_r(e)-_r(t);if(o)return-o;var s=ls(r.to,n.to)||Mr(e)-Mr(t);return s?s:t.id-e.id}function Gr(e,t){var i,r=ss&&e.markedSpans;if(r)for(var n,o=0;o<r.length;++o)n=r[o],n.marker.collapsed&&null==(t?n.from:n.to)&&(!i||wr(i,n.marker)<0)&&(i=n.marker);return i}function kr(e){return Gr(e,!0)}function Br(e){return Gr(e,!1)}function Ur(e,t,i,r,n){var o=xn(e,t),s=ss&&o.markedSpans;if(s)for(var a=0;a<s.length;++a){var l=s[a];if(l.marker.collapsed){var u=l.marker.find(0),p=ls(u.from,i)||_r(l.marker)-_r(n),c=ls(u.to,r)||Mr(l.marker)-Mr(n);if(!(p>=0&&0>=c||0>=p&&c>=0)&&(0>=p&&(ls(u.to,i)||Mr(l.marker)-_r(n))>0||p>=0&&(ls(u.from,r)||_r(l.marker)-Mr(n))<0))return!0}}}function Vr(e){for(var t;t=kr(e);)e=t.find(-1,!0).line;return e}function Hr(e){for(var t,i;t=Br(e);)e=t.find(1,!0).line,(i||(i=[])).push(e);return i}function Fr(e,t){var i=xn(e,t),r=Vr(i);return i==r?t:Tn(r)}function jr(e,t){if(t>e.lastLine())return t;var i,r=xn(e,t);if(!Wr(e,r))return t;for(;i=Br(r);)r=i.find(1,!0).line;return Tn(r)+1}function Wr(e,t){var i=ss&&t.markedSpans;if(i)for(var r,n=0;n<i.length;++n)if(r=i[n],r.marker.collapsed){if(null==r.from)return!0;if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&qr(e,t,r))return!0}}function qr(e,t,i){if(null==i.to){var r=i.marker.find(1,!0);return qr(e,r.line,Ir(r.line.markedSpans,i.marker))}if(i.marker.inclusiveRight&&i.to==t.text.length)return!0;for(var n,o=0;o<t.markedSpans.length;++o)if(n=t.markedSpans[o],n.marker.collapsed&&!n.marker.widgetNode&&n.from==i.to&&(null==n.to||n.to!=i.from)&&(n.marker.inclusiveLeft||i.marker.inclusiveRight)&&qr(e,t,n))return!0}function zr(e,t,i){An(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&or(e,null,i)}function Xr(e){return null!=e.height?e.height:(Eo(document.body,e.node)||co(e.cm.display.measure,uo("div",[e.node],null,"position: relative")),e.height=e.node.offsetHeight)}function Yr(e,t,i,r){var n=new Us(e,i,r);return n.noHScroll&&(e.display.alignWidgets=!0),ur(e,t,"widget",function(t){var i=t.widgets||(t.widgets=[]);if(null==n.insertAt?i.push(n):i.splice(Math.min(i.length-1,Math.max(0,n.insertAt)),0,n),n.line=t,!Wr(e.doc,t)){var r=An(t)<e.doc.scrollTop;In(t,t.height+Xr(n)),r&&or(e,null,n.height),e.curOp.forceUpdate=!0}return!0}),n}function Kr(e,t,i,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Pr(e),Dr(e,i);var n=r?r(e):1;n!=e.height&&In(e,n)}function $r(e){e.parent=null,Pr(e)}function Qr(e,t){if(e)for(;;){var i=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!i)break;e=e.slice(0,i.index)+e.slice(i.index+i[0].length);var r=i[1]?"bgClass":"textClass";null==t[r]?t[r]=i[2]:new RegExp("(?:^|s)"+i[2]+"(?:$|s)").test(t[r])||(t[r]+=" "+i[2])}return e}function Zr(t,i){if(t.blankLine)return t.blankLine(i);if(t.innerMode){var r=e.innerMode(t,i);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function Jr(e,t,i){for(var r=0;10>r;r++){var n=e.token(t,i);if(t.pos>t.start)return n}throw new Error("Mode "+e.name+" failed to advance stream.")}function en(t,i,r,n,o,s,a){var l=r.flattenSpans;null==l&&(l=t.options.flattenSpans);var u,p=0,c=null,d=new ws(i,t.options.tabSize);for(""==i&&Qr(Zr(r,n),s);!d.eol();){if(d.pos>t.options.maxHighlightLength?(l=!1,a&&nn(t,i,n,d.pos),d.pos=i.length,u=null):u=Qr(Jr(r,d,n),s),t.options.addModeClass){var E=e.innerMode(r,n).mode.name;E&&(u="m-"+(u?E+" "+u:E))}l&&c==u||(p<d.start&&o(d.start,c),p=d.start,c=u),d.start=d.pos}for(;p<d.pos;){var h=Math.min(d.pos,p+5e4);o(h,c),p=h}}function tn(e,t,i,r){var n=[e.state.modeGen],o={};en(e,t.text,e.doc.mode,i,function(e,t){n.push(e,t)},o,r);for(var s=0;s<e.state.overlays.length;++s){var a=e.state.overlays[s],l=1,u=0;en(e,t.text,a.mode,!0,function(e,t){for(var i=l;e>u;){var r=n[l];r>e&&n.splice(l,1,e,n[l+1],r),l+=2,u=Math.min(e,r)}if(t)if(a.opaque)n.splice(i,l-i,e,"cm-overlay "+t),l=i+2;else for(;l>i;i+=2){var o=n[i+1];n[i+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:n,classes:o.bgClass||o.textClass?o:null}}function rn(e,t){if(!t.styles||t.styles[0]!=e.state.modeGen){var i=tn(e,t,t.stateAfter=Lt(e,Tn(t)));t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null)}return t.styles}function nn(e,t,i,r){var n=e.doc.mode,o=new ws(t,e.options.tabSize);for(o.start=o.pos=r||0,""==t&&Zr(n,i);!o.eol()&&o.pos<=e.options.maxHighlightLength;)Jr(n,o,i),o.start=o.pos}function on(e,t){if(!e||/^\s*$/.test(e))return null;var i=t.addModeClass?Fs:Hs;return i[e]||(i[e]=e.replace(/\S+/g,"cm-$&"))}function sn(e,t){var i=uo("span",null,null,Wo?"padding-right: .1px":null),r={pre:uo("pre",[i]),content:i,col:0,pos:0,cm:e};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var o,s=n?t.rest[n-1]:t.line;r.pos=0,r.addToken=ln,(jo||Wo)&&e.getOption("lineWrapping")&&(r.addToken=un(r.addToken)),yo(e.display.measure)&&(o=Sn(s))&&(r.addToken=pn(r.addToken,o)),r.map=[],dn(s,r,rn(e,s)),s.styleClasses&&(s.styleClasses.bgClass&&(r.bgClass=vo(s.styleClasses.bgClass,r.bgClass||"")),s.styleClasses.textClass&&(r.textClass=vo(s.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(To(e.display.measure))),0==n?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return Js(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=vo(r.pre.className,r.textClass||"")),r}function an(e){var t=uo("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t}function ln(e,t,i,r,n,o){if(t){var s=e.cm.options.specialChars,a=!1;if(s.test(t))for(var l=document.createDocumentFragment(),u=0;;){s.lastIndex=u;var p=s.exec(t),c=p?p.index-u:t.length-u;if(c){var d=document.createTextNode(t.slice(u,u+c));l.appendChild(Vo?uo("span",[d]):d),e.map.push(e.pos,e.pos+c,d),e.col+=c,e.pos+=c}if(!p)break;if(u+=c+1," "==p[0]){var E=e.cm.options.tabSize,h=E-e.col%E,d=l.appendChild(uo("span",Jn(h),"cm-tab"));e.col+=h}else{var d=e.cm.options.specialCharPlaceholder(p[0]);l.appendChild(Vo?uo("span",[d]):d),e.col+=1}e.map.push(e.pos,e.pos+1,d),e.pos++}else{e.col+=t.length;var l=document.createTextNode(t);e.map.push(e.pos,e.pos+t.length,l),Vo&&(a=!0),e.pos+=t.length}if(i||r||n||a){var f=i||"";r&&(f+=r),n&&(f+=n);var m=uo("span",[l],f);return o&&(m.title=o),e.content.appendChild(m)}e.content.appendChild(l)}}function un(e){function t(e){for(var t=" ",i=0;i<e.length-2;++i)t+=i%2?" ":" ";return t+=" "}return function(i,r,n,o,s,a){e(i,r.replace(/ {3,}/g,t),n,o,s,a)}}function pn(e,t){return function(i,r,n,o,s,a){n=n?n+" cm-force-border":"cm-force-border";for(var l=i.pos,u=l+r.length;;){for(var p=0;p<t.length;p++){var c=t[p];if(c.to>l&&c.from<=l)break}if(c.to>=u)return e(i,r,n,o,s,a);e(i,r.slice(0,c.to-l),n,o,null,a),o=null,r=r.slice(c.to-l),l=c.to}}}function cn(e,t,i,r){var n=!r&&i.widgetNode;n&&(e.map.push(e.pos,e.pos+t,n),e.content.appendChild(n)),e.pos+=t}function dn(e,t,i){var r=e.markedSpans,n=e.text,o=0;if(r)for(var s,a,l,u,p,c,d=n.length,E=0,h=1,f="",m=0;;){if(m==E){a=l=u=p="",c=null,m=1/0;for(var g=[],v=0;v<r.length;++v){var x=r[v],N=x.marker;x.from<=E&&(null==x.to||x.to>E)?(null!=x.to&&m>x.to&&(m=x.to,l=""),N.className&&(a+=" "+N.className),N.startStyle&&x.from==E&&(u+=" "+N.startStyle),N.endStyle&&x.to==m&&(l+=" "+N.endStyle),N.title&&!p&&(p=N.title),N.collapsed&&(!c||wr(c.marker,N)<0)&&(c=x)):x.from>E&&m>x.from&&(m=x.from),"bookmark"==N.type&&x.from==E&&N.widgetNode&&g.push(N)}if(c&&(c.from||0)==E&&(cn(t,(null==c.to?d+1:c.to)-E,c.marker,null==c.from),null==c.to))return;if(!c&&g.length)for(var v=0;v<g.length;++v)cn(t,0,g[v])}if(E>=d)break;for(var L=Math.min(d,m);;){if(f){var I=E+f.length;if(!c){var T=I>L?f.slice(0,L-E):f;t.addToken(t,T,s?s+a:a,u,E+T.length==m?l:"",p)}if(I>=L){f=f.slice(L-E),E=L;break}E=I,u=""}f=n.slice(o,o=i[h++]),s=on(i[h++],t.cm.options)}}else for(var h=1;h<i.length;h+=2)t.addToken(t,n.slice(o,o=i[h]),on(i[h+1],t.cm.options))}function En(e,t){return 0==t.from.ch&&0==t.to.ch&&""==eo(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function hn(e,t,i,r){function n(e){return i?i[e]:null}function o(e,i,n){Kr(e,i,n,r),qn(e,"change",e,t)}var s=t.from,a=t.to,l=t.text,u=xn(e,s.line),p=xn(e,a.line),c=eo(l),d=n(l.length-1),E=a.line-s.line;if(En(e,t)){for(var h=0,f=[];h<l.length-1;++h)f.push(new Vs(l[h],n(h),r));o(p,p.text,d),E&&e.remove(s.line,E),f.length&&e.insert(s.line,f)}else if(u==p)if(1==l.length)o(u,u.text.slice(0,s.ch)+c+u.text.slice(a.ch),d);else{for(var f=[],h=1;h<l.length-1;++h)f.push(new Vs(l[h],n(h),r));f.push(new Vs(c+u.text.slice(a.ch),d,r)),o(u,u.text.slice(0,s.ch)+l[0],n(0)),e.insert(s.line+1,f)}else if(1==l.length)o(u,u.text.slice(0,s.ch)+l[0]+p.text.slice(a.ch),n(0)),e.remove(s.line+1,E);else{o(u,u.text.slice(0,s.ch)+l[0],n(0)),o(p,c+p.text.slice(a.ch),d);for(var h=1,f=[];h<l.length-1;++h)f.push(new Vs(l[h],n(h),r));E>1&&e.remove(s.line+1,E-1),e.insert(s.line+1,f)}qn(e,"change",e,t)}function fn(e){this.lines=e,this.parent=null;for(var t=0,i=0;t<e.length;++t)e[t].parent=this,i+=e[t].height;this.height=i}function mn(e){this.children=e;for(var t=0,i=0,r=0;r<e.length;++r){var n=e[r];t+=n.chunkSize(),i+=n.height,n.parent=this}this.size=t,this.height=i,this.parent=null}function gn(e,t,i){function r(e,n,o){if(e.linked)for(var s=0;s<e.linked.length;++s){var a=e.linked[s];if(a.doc!=n){var l=o&&a.sharedHist;(!i||l)&&(t(a.doc,l),r(a.doc,e,l))}}}r(e,null,!0)}function vn(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,s(e),i(e),e.options.lineWrapping||E(e),e.options.mode=t.modeOption,ii(e)}function xn(e,t){if(t-=e.first,0>t||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var i=e;!i.lines;)for(var r=0;;++r){var n=i.children[r],o=n.chunkSize();if(o>t){i=n;break}t-=o}return i.lines[t]}function Nn(e,t,i){var r=[],n=t.line;return e.iter(t.line,i.line+1,function(e){var o=e.text;n==i.line&&(o=o.slice(0,i.ch)),n==t.line&&(o=o.slice(t.ch)),r.push(o),++n}),r}function Ln(e,t,i){var r=[];return e.iter(t,i,function(e){r.push(e.text)}),r}function In(e,t){var i=t-e.height;if(i)for(var r=e;r;r=r.parent)r.height+=i}function Tn(e){if(null==e.parent)return null;for(var t=e.parent,i=to(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var n=0;r.children[n]!=t;++n)i+=r.children[n].chunkSize();return i+t.first}function yn(e,t){var i=e.first;e:do{for(var r=0;r<e.children.length;++r){var n=e.children[r],o=n.height;if(o>t){e=n;continue e}t-=o,i+=n.chunkSize()}return i}while(!e.lines);for(var r=0;r<e.lines.length;++r){var s=e.lines[r],a=s.height;if(a>t)break;t-=a}return i+r}function An(e){e=Vr(e);for(var t=0,i=e.parent,r=0;r<i.lines.length;++r){var n=i.lines[r];if(n==e)break;t+=n.height}for(var o=i.parent;o;i=o,o=i.parent)for(var r=0;r<o.children.length;++r){var s=o.children[r];if(s==i)break;t+=s.height}return t}function Sn(e){var t=e.order;return null==t&&(t=e.order=Ta(e.text)),t}function Cn(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Rn(e,t){var i={from:j(t.from),to:xs(t),text:Nn(e,t.from,t.to)};return wn(e,i,t.from.line,t.to.line+1),gn(e,function(e){wn(e,i,t.from.line,t.to.line+1)},!0),i}function bn(e){for(;e.length;){var t=eo(e);if(!t.ranges)break;e.pop()}}function On(e,t){return t?(bn(e.done),eo(e.done)):e.done.length&&!eo(e.done).ranges?eo(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),eo(e.done)):void 0}function Pn(e,t,i,r){var n=e.history;n.undone.length=0;var o,s=+new Date;if((n.lastOp==r||n.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&n.lastModTime>s-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=On(n,n.lastOp==r))){var a=eo(o.changes);0==ls(t.from,t.to)&&0==ls(t.from,a.to)?a.to=xs(t):o.changes.push(Rn(e,t))}else{var l=eo(n.done);for(l&&l.ranges||Mn(e.sel,n.done),o={changes:[Rn(e,t)],generation:n.generation},n.done.push(o);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(i),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=s,n.lastOp=r,n.lastOrigin=n.lastSelOrigin=t.origin,a||Js(e,"historyAdded")}function Dn(e,t,i,r){var n=t.charAt(0);return"*"==n||"+"==n&&i.ranges.length==r.ranges.length&&i.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function _n(e,t,i,r){var n=e.history,o=r&&r.origin;i==n.lastOp||o&&n.lastSelOrigin==o&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==o||Dn(e,o,eo(n.done),t))?n.done[n.done.length-1]=t:Mn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=o,n.lastOp=i,r&&r.clearRedo!==!1&&bn(n.undone)}function Mn(e,t){var i=eo(t);i&&i.ranges&&i.equals(e)||t.push(e)}function wn(e,t,i,r){var n=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,i),Math.min(e.first+e.size,r),function(i){i.markedSpans&&((n||(n=t["spans_"+e.id]={}))[o]=i.markedSpans),++o})}function Gn(e){if(!e)return null;for(var t,i=0;i<e.length;++i)e[i].marker.explicitlyCleared?t||(t=e.slice(0,i)):t&&t.push(e[i]);return t?t.length?t:null:e}function kn(e,t){var i=t["spans_"+e.id];if(!i)return null;for(var r=0,n=[];r<t.text.length;++r)n.push(Gn(i[r]));return n}function Bn(e,t,i){for(var r=0,n=[];r<e.length;++r){var o=e[r];if(o.ranges)n.push(i?z.prototype.deepCopy.call(o):o);else{var s=o.changes,a=[];n.push({changes:a});for(var l=0;l<s.length;++l){var u,p=s[l];if(a.push({from:p.from,to:p.to,text:p.text}),t)for(var c in p)(u=c.match(/^spans_(\d+)$/))&&to(t,Number(u[1]))>-1&&(eo(a)[c]=p[c],delete p[c])}}}return n}function Un(e,t,i,r){i<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function Vn(e,t,i,r){for(var n=0;n<e.length;++n){var o=e[n],s=!0;if(o.ranges){o.copied||(o=e[n]=o.deepCopy(),o.copied=!0);for(var a=0;a<o.ranges.length;a++)Un(o.ranges[a].anchor,t,i,r),Un(o.ranges[a].head,t,i,r)}else{for(var a=0;a<o.changes.length;++a){var l=o.changes[a];if(i<l.from.line)l.from=as(l.from.line+r,l.from.ch),l.to=as(l.to.line+r,l.to.ch);else if(t<=l.to.line){s=!1;break}}s||(e.splice(0,n+1),n=0)}}}function Hn(e,t){var i=t.from.line,r=t.to.line,n=t.text.length-(r-i)-1;Vn(e.done,i,r,n),Vn(e.undone,i,r,n)}function Fn(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function jn(e){return e.target||e.srcElement}function Wn(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),es&&e.ctrlKey&&1==t&&(t=3),t }function qn(e,t){function i(e){return function(){e.apply(null,n)}}var r=e._handlers&&e._handlers[t];if(r){var n=Array.prototype.slice.call(arguments,2);Xs||(++ea,Xs=[],setTimeout(zn,0));for(var o=0;o<r.length;++o)Xs.push(i(r[o]))}}function zn(){--ea;var e=Xs;Xs=null;for(var t=0;t<e.length;++t)e[t]()}function Xn(e,t,i){return Js(e,i||t.type,e,t),Fn(t)||t.codemirrorIgnore}function Yn(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var i=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==to(i,t[r])&&i.push(t[r])}function Kn(e,t){var i=e._handlers&&e._handlers[t];return i&&i.length>0}function $n(e){e.prototype.on=function(e,t){Qs(this,e,t)},e.prototype.off=function(e,t){Zs(this,e,t)}}function Qn(){this.id=null}function Zn(e,t,i){for(var r=0,n=0;;){var o=e.indexOf(" ",r);-1==o&&(o=e.length);var s=o-r;if(o==e.length||n+s>=t)return r+Math.min(s,t-n);if(n+=o-r,n+=i-n%i,r=o+1,n>=t)return r}}function Jn(e){for(;aa.length<=e;)aa.push(eo(aa)+" ");return aa[e]}function eo(e){return e[e.length-1]}function to(e,t){for(var i=0;i<e.length;++i)if(e[i]==t)return i;return-1}function io(e,t){for(var i=[],r=0;r<e.length;r++)i[r]=t(e[r],r);return i}function ro(e,t){var i;if(Object.create)i=Object.create(e);else{var r=function(){};r.prototype=e,i=new r}return t&&no(t,i),i}function no(e,t,i){t||(t={});for(var r in e)!e.hasOwnProperty(r)||i===!1&&t.hasOwnProperty(r)||(t[r]=e[r]);return t}function oo(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function so(e,t){return t?t.source.indexOf("\\w")>-1&&ca(e)?!0:t.test(e):ca(e)}function ao(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function lo(e){return e.charCodeAt(0)>=768&&da.test(e)}function uo(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),"string"==typeof t)n.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)n.appendChild(t[o]);return n}function po(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function co(e,t){return po(e).appendChild(t)}function Eo(e,t){if(e.contains)return e.contains(t);for(;t=t.parentNode;)if(t==e)return!0}function ho(){return document.activeElement}function fo(e){return new RegExp("\\b"+e+"\\b\\s*")}function mo(e,t){var i=fo(t);i.test(e.className)&&(e.className=e.className.replace(i,""))}function go(e,t){fo(t).test(e.className)||(e.className+=" "+t)}function vo(e,t){for(var i=e.split(" "),r=0;r<i.length;r++)i[r]&&!fo(i[r]).test(t)&&(t+=" "+i[r]);return t}function xo(e){if(document.body.getElementsByClassName)for(var t=document.body.getElementsByClassName("CodeMirror"),i=0;i<t.length;i++){var r=t[i].CodeMirror;r&&e(r)}}function No(){ma||(Lo(),ma=!0)}function Lo(){var e;Qs(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Ea=null,xo(gi)},100))}),Qs(window,"blur",function(){xo(Vi)})}function Io(e){if(null!=Ea)return Ea;var t=uo("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");return co(e,t),t.offsetWidth&&(Ea=t.offsetHeight-t.clientHeight),Ea||0}function To(e){if(null==ha){var t=uo("span","​");co(e,uo("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(ha=t.offsetWidth<=1&&t.offsetHeight>2&&!Uo)}return ha?uo("span","​"):uo("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function yo(e){if(null!=fa)return fa;var t=co(e,document.createTextNode("AخA")),i=ua(t,0,1).getBoundingClientRect();if(i.left==i.right)return!1;var r=ua(t,1,2).getBoundingClientRect();return fa=r.right-i.right<3}function Ao(e,t,i,r){if(!e)return r(t,i,"ltr");for(var n=!1,o=0;o<e.length;++o){var s=e[o];(s.from<i&&s.to>t||t==i&&s.to==t)&&(r(Math.max(s.from,t),Math.min(s.to,i),1==s.level?"rtl":"ltr"),n=!0)}n||r(t,i,"ltr")}function So(e){return e.level%2?e.to:e.from}function Co(e){return e.level%2?e.from:e.to}function Ro(e){var t=Sn(e);return t?So(t[0]):0}function bo(e){var t=Sn(e);return t?Co(eo(t)):e.text.length}function Oo(e,t){var i=xn(e.doc,t),r=Vr(i);r!=i&&(t=Tn(r));var n=Sn(r),o=n?n[0].level%2?bo(r):Ro(r):0;return as(t,o)}function Po(e,t){for(var i,r=xn(e.doc,t);i=Br(r);)r=i.find(1,!0).line,t=null;var n=Sn(r),o=n?n[0].level%2?Ro(r):bo(r):r.text.length;return as(null==t?Tn(r):t,o)}function Do(e,t,i){var r=e[0].level;return t==r?!0:i==r?!1:i>t}function _o(e,t){Ia=null;for(var i,r=0;r<e.length;++r){var n=e[r];if(n.from<t&&n.to>t)return r;if(n.from==t||n.to==t){if(null!=i)return Do(e,n.level,e[i].level)?(n.from!=n.to&&(Ia=i),r):(n.from!=n.to&&(Ia=r),i);i=r}}return i}function Mo(e,t,i,r){if(!r)return t+i;do t+=i;while(t>0&&lo(e.text.charAt(t)));return t}function wo(e,t,i,r){var n=Sn(e);if(!n)return Go(e,t,i,r);for(var o=_o(n,t),s=n[o],a=Mo(e,t,s.level%2?-i:i,r);;){if(a>s.from&&a<s.to)return a;if(a==s.from||a==s.to)return _o(n,a)==o?a:(s=n[o+=i],i>0==s.level%2?s.to:s.from);if(s=n[o+=i],!s)return null;a=i>0==s.level%2?Mo(e,s.to,-1,r):Mo(e,s.from,1,r)}}function Go(e,t,i,r){var n=t+i;if(r)for(;n>0&&lo(e.text.charAt(n));)n+=i;return 0>n||n>e.text.length?null:n}var ko=/gecko\/\d/i.test(navigator.userAgent),Bo=/MSIE \d/.test(navigator.userAgent),Uo=Bo&&(null==document.documentMode||document.documentMode<8),Vo=Bo&&(null==document.documentMode||document.documentMode<9),Ho=Bo&&(null==document.documentMode||document.documentMode<10),Fo=/Trident\/([7-9]|\d{2,})\./.test(navigator.userAgent),jo=Bo||Fo,Wo=/WebKit\//.test(navigator.userAgent),qo=Wo&&/Qt\/\d+\.\d+/.test(navigator.userAgent),zo=/Chrome\//.test(navigator.userAgent),Xo=/Opera\//.test(navigator.userAgent),Yo=/Apple Computer/.test(navigator.vendor),Ko=/KHTML\//.test(navigator.userAgent),$o=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),Qo=/PhantomJS/.test(navigator.userAgent),Zo=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Jo=Zo||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),es=Zo||/Mac/.test(navigator.platform),ts=/win/i.test(navigator.platform),is=Xo&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);is&&(is=Number(is[1])),is&&is>=15&&(Xo=!1,Wo=!0);var rs=es&&(qo||Xo&&(null==is||12.11>is)),ns=ko||jo&&!Vo,os=!1,ss=!1,as=e.Pos=function(e,t){return this instanceof as?(this.line=e,void(this.ch=t)):new as(e,t)},ls=e.cmpPos=function(e,t){return e.line-t.line||e.ch-t.ch};z.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t<this.ranges.length;t++){var i=this.ranges[t],r=e.ranges[t];if(0!=ls(i.anchor,r.anchor)||0!=ls(i.head,r.head))return!1}return!0},deepCopy:function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new X(j(this.ranges[t].anchor),j(this.ranges[t].head));return new z(e,this.primIndex)},somethingSelected:function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},contains:function(e,t){t||(t=e);for(var i=0;i<this.ranges.length;i++){var r=this.ranges[i];if(ls(t,r.from())>=0&&ls(e,r.to())<=0)return i}return-1}},X.prototype={from:function(){return q(this.anchor,this.head)},to:function(){return W(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var us,ps,cs,ds={left:0,right:0,top:0,bottom:0},Es=0,hs=0,fs=0,ms=null;jo?ms=-.53:ko?ms=15:zo?ms=-.7:Yo&&(ms=-1/3);var gs,vs=null,xs=e.changeEnd=function(e){return e.text?as(e.from.line+e.text.length-1,eo(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),Ei(this),pi(this)},setOption:function(e,t){var i=this.options,r=i[e];(i[e]!=t||"mode"==e)&&(i[e]=t,Ls.hasOwnProperty(e)&&Qt(this,Ls[e])(this,t,r))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](e)},removeKeyMap:function(e){for(var t=this.state.keyMaps,i=0;i<t.length;++i)if(t[i]==e||"string"!=typeof t[i]&&t[i].name==e)return t.splice(i,1),!0},addOverlay:Zt(function(t,i){var r=t.token?t:e.getMode(this.options,t);if(r.startState)throw new Error("Overlays may not be stateful.");this.state.overlays.push({mode:r,modeSpec:t,opaque:i&&i.opaque}),this.state.modeGen++,ii(this)}),removeOverlay:Zt(function(e){for(var t=this.state.overlays,i=0;i<t.length;++i){var r=t[i].modeSpec;if(r==e||"string"==typeof e&&r.name==e)return t.splice(i,1),this.state.modeGen++,void ii(this)}}),indentLine:Zt(function(e,t,i){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),J(this.doc,e)&&lr(this,e,t,i)}),indentSelection:Zt(function(e){for(var t=this.doc.sel.ranges,i=-1,r=0;r<t.length;r++){var n=t[r];if(n.empty())n.head.line>i&&(lr(this,n.head.line,e,!0),i=n.head.line,r==this.doc.sel.primIndex&&sr(this));else{var o=Math.max(i,n.from().line),s=n.to();i=Math.min(this.lastLine(),s.line-(s.ch?0:1))+1;for(var a=o;i>a;++a)lr(this,a,e)}}}),getTokenAt:function(e,t){var i=this.doc;e=Q(i,e);for(var r=Lt(this,e.line,t),n=this.doc.mode,o=xn(i,e.line),s=new ws(o.text,this.options.tabSize);s.pos<e.ch&&!s.eol();){s.start=s.pos;var a=Jr(n,s,r)}return{start:s.start,end:s.pos,string:s.current(),type:a||null,state:r}},getTokenTypeAt:function(e){e=Q(this.doc,e);var t,i=rn(this,xn(this.doc,e.line)),r=0,n=(i.length-1)/2,o=e.ch;if(0==o)t=i[2];else for(;;){var s=r+n>>1;if((s?i[2*s-1]:0)>=o)n=s;else{if(!(i[2*s+1]<o)){t=i[2*s+2];break}r=s+1}}var a=t?t.indexOf("cm-overlay "):-1;return 0>a?t:0==a?null:t.slice(0,a-1)},getModeAt:function(t){var i=this.doc.mode;return i.innerMode?e.innerMode(i,this.getTokenAt(t).state).mode:i},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var i=[];if(!Cs.hasOwnProperty(t))return Cs;var r=Cs[t],n=this.getModeAt(e);if("string"==typeof n[t])r[n[t]]&&i.push(r[n[t]]);else if(n[t])for(var o=0;o<n[t].length;o++){var s=r[n[t][o]];s&&i.push(s)}else n.helperType&&r[n.helperType]?i.push(r[n.helperType]):r[n.name]&&i.push(r[n.name]);for(var o=0;o<r._global.length;o++){var a=r._global[o];a.pred(n,this)&&-1==to(i,a.val)&&i.push(a.val)}return i},getStateAfter:function(e,t){var i=this.doc;return e=$(i,null==e?i.first+i.size-1:e),Lt(this,e+1,t)},cursorCoords:function(e,t){var i,r=this.doc.sel.primary();return i=null==e?r.head:"object"==typeof e?Q(this.doc,e):e?r.from():r.to(),Ht(this,i,t||"page")},charCoords:function(e,t){return Vt(this,Q(this.doc,e),t||"page")},coordsChar:function(e,t){return e=Ut(this,e,t||"page"),Wt(this,e.left,e.top)},lineAtHeight:function(e,t){return e=Ut(this,{top:e,left:0},t||"page").top,yn(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t){var i=!1,r=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>r&&(e=r,i=!0);var n=xn(this.doc,e);return Bt(this,n,{top:0,left:0},t||"page").top+(i?this.doc.height-An(n):0)},defaultTextHeight:function(){return zt(this.display)},defaultCharWidth:function(){return Xt(this.display)},setGutterMarker:Zt(function(e,t,i){return ur(this,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=i,!i&&ao(r)&&(e.gutterMarkers=null),!0})}),clearGutter:Zt(function(e){var t=this,i=t.doc,r=i.first;i.iter(function(i){i.gutterMarkers&&i.gutterMarkers[e]&&(i.gutterMarkers[e]=null,ri(t,r,"gutter"),ao(i.gutterMarkers)&&(i.gutterMarkers=null)),++r})}),addLineClass:Zt(function(e,t,i){return ur(this,e,"class",function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"wrapClass";if(e[r]){if(new RegExp("(?:^|\\s)"+i+"(?:$|\\s)").test(e[r]))return!1;e[r]+=" "+i}else e[r]=i;return!0})}),removeLineClass:Zt(function(e,t,i){return ur(this,e,"class",function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"wrapClass",n=e[r];if(!n)return!1;if(null==i)e[r]=null;else{var o=n.match(new RegExp("(?:^|\\s+)"+i+"(?:$|\\s+)"));if(!o)return!1;var s=o.index+o[0].length;e[r]=n.slice(0,o.index)+(o.index&&s!=n.length?" ":"")+n.slice(s)||null}return!0})}),addLineWidget:Zt(function(e,t,i){return Yr(this,e,t,i)}),removeLineWidget:function(e){e.clear()},lineInfo:function(e){if("number"==typeof e){if(!J(this.doc,e))return null;var t=e;if(e=xn(this.doc,e),!e)return null}else{var t=Tn(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,i,r,n){var o=this.display;e=Ht(this,Q(this.doc,e));var s=e.bottom,a=e.left;if(t.style.position="absolute",o.sizer.appendChild(t),"over"==r)s=e.top;else if("above"==r||"near"==r){var l=Math.max(o.wrapper.clientHeight,this.doc.height),u=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?s=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(s=e.bottom),a+t.offsetWidth>u&&(a=u-t.offsetWidth)}t.style.top=s+"px",t.style.left=t.style.right="","right"==n?(a=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==n?a=0:"middle"==n&&(a=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=a+"px"),i&&rr(this,a,s,a+t.offsetWidth,s+t.offsetHeight)},triggerOnKeyDown:Zt(wi),triggerOnKeyPress:Zt(Bi),triggerOnKeyUp:Zt(ki),execCommand:function(e){return Os.hasOwnProperty(e)?Os[e](this):void 0},findPosH:function(e,t,i,r){var n=1;0>t&&(n=-1,t=-t);for(var o=0,s=Q(this.doc,e);t>o&&(s=cr(this.doc,s,n,i,r),!s.hitSide);++o);return s},moveH:Zt(function(e,t){var i=this;i.extendSelectionsBy(function(r){return i.display.shift||i.doc.extend||r.empty()?cr(i.doc,r.head,e,t,i.options.rtlMoveVisually):0>e?r.from():r.to()},oa)}),deleteH:Zt(function(e,t){var i=this.doc.sel,r=this.doc;i.somethingSelected()?r.replaceSelection("",null,"+delete"):pr(this,function(i){var n=cr(r,i.head,e,t,!1);return 0>e?{from:n,to:i.head}:{from:i.head,to:n}})}),findPosV:function(e,t,i,r){var n=1,o=r;0>t&&(n=-1,t=-t);for(var s=0,a=Q(this.doc,e);t>s;++s){var l=Ht(this,a,"div");if(null==o?o=l.left:l.left=o,a=dr(this,l,n,i),a.hitSide)break}return a},moveV:Zt(function(e,t){var i=this,r=this.doc,n=[],o=!i.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy(function(s){if(o)return 0>e?s.from():s.to();var a=Ht(i,s.head,"div");null!=s.goalColumn&&(a.left=s.goalColumn),n.push(a.left);var l=dr(i,a,e,t);return"page"==t&&s==r.sel.primary()&&or(i,null,Vt(i,l,"div").top-a.top),l},oa),n.length)for(var s=0;s<r.sel.ranges.length;s++)r.sel.ranges[s].goalColumn=n[s]}),toggleOverwrite:function(e){(null==e||e!=this.state.overwrite)&&((this.state.overwrite=!this.state.overwrite)?go(this.display.cursorDiv,"CodeMirror-overwrite"):mo(this.display.cursorDiv,"CodeMirror-overwrite"),Js(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return ho()==this.display.input},scrollTo:Zt(function(e,t){(null!=e||null!=t)&&ar(this),null!=e&&(this.curOp.scrollLeft=e),null!=t&&(this.curOp.scrollTop=t)}),getScrollInfo:function(){var e=this.display.scroller,t=ta;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-t,width:e.scrollWidth-t,clientHeight:e.clientHeight-t,clientWidth:e.clientWidth-t}},scrollIntoView:Zt(function(e,t){if(null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:as(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line)ar(this),this.curOp.scrollToPos=e;else{var i=nr(this,Math.min(e.from.left,e.to.left),Math.min(e.from.top,e.to.top)-e.margin,Math.max(e.from.right,e.to.right),Math.max(e.from.bottom,e.to.bottom)+e.margin);this.scrollTo(i.scrollLeft,i.scrollTop)}}),setSize:Zt(function(e,t){function i(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}null!=e&&(this.display.wrapper.style.width=i(e)),null!=t&&(this.display.wrapper.style.height=i(t)),this.options.lineWrapping&&Mt(this),this.curOp.forceUpdate=!0,Js(this,"refresh",this)}),operation:function(e){return $t(this,e)},refresh:Zt(function(){var e=this.display.cachedTextHeight;ii(this),this.curOp.forceUpdate=!0,wt(this),this.scrollTo(this.doc.scrollLeft,this.doc.scrollTop),c(this),(null==e||Math.abs(e-zt(this.display))>.5)&&s(this),Js(this,"refresh",this)}),swapDoc:Zt(function(e){var t=this.doc;return t.cm=null,vn(this,e),wt(this),di(this),this.scrollTo(e.scrollLeft,e.scrollTop),qn(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},$n(e);var Ns=e.defaults={},Ls=e.optionHandlers={},Is=e.Init={toString:function(){return"CodeMirror.Init"}};hr("value","",function(e,t){e.setValue(t)},!0),hr("mode",null,function(e,t){e.doc.modeOption=t,i(e)},!0),hr("indentUnit",2,i,!0),hr("indentWithTabs",!1),hr("smartIndent",!0),hr("tabSize",4,function(e){r(e),wt(e),ii(e)},!0),hr("specialChars",/[\t\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/g,function(e,t){e.options.specialChars=new RegExp(t.source+(t.test(" ")?"":"| "),"g"),e.refresh()},!0),hr("specialCharPlaceholder",an,function(e){e.refresh()},!0),hr("electricChars",!0),hr("rtlMoveVisually",!ts),hr("wholeLineUpdateBefore",!0),hr("theme","default",function(e){l(e),u(e)},!0),hr("keyMap","default",a),hr("extraKeys",null),hr("lineWrapping",!1,n,!0),hr("gutters",[],function(e){h(e.options),u(e)},!0),hr("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?L(e.display)+"px":"0",e.refresh()},!0),hr("coverGutterNextToScrollbar",!1,m,!0),hr("lineNumbers",!1,function(e){h(e.options),u(e)},!0),hr("firstLineNumber",1,u,!0),hr("lineNumberFormatter",function(e){return e},u,!0),hr("showCursorWhenSelecting",!1,ht,!0),hr("resetSelectionOnContextMenu",!0),hr("readOnly",!1,function(e,t){"nocursor"==t?(Vi(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||di(e))}),hr("disableInput",!1,function(e,t){t||di(e)},!0),hr("dragDrop",!0),hr("cursorBlinkRate",530),hr("cursorScrollMargin",0),hr("cursorHeight",1),hr("workTime",100),hr("workDelay",100),hr("flattenSpans",!0,r,!0),hr("addModeClass",!1,r,!0),hr("pollInterval",100),hr("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),hr("historyEventDelay",1250),hr("viewportMargin",10,function(e){e.refresh()},!0),hr("maxHighlightLength",1e4,r,!0),hr("moveInputWithCursor",!0,function(e,t){t||(e.display.inputDiv.style.top=e.display.inputDiv.style.left=0)}),hr("tabindex",null,function(e,t){e.display.input.tabIndex=t||""}),hr("autofocus",null);var Ts=e.modes={},ys=e.mimeModes={};e.defineMode=function(t,i){if(e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2){i.dependencies=[];for(var r=2;r<arguments.length;++r)i.dependencies.push(arguments[r])}Ts[t]=i},e.defineMIME=function(e,t){ys[e]=t},e.resolveMode=function(t){if("string"==typeof t&&ys.hasOwnProperty(t))t=ys[t];else if(t&&"string"==typeof t.name&&ys.hasOwnProperty(t.name)){var i=ys[t.name];"string"==typeof i&&(i={name:i}),t=ro(i,t),t.name=i.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,i){var i=e.resolveMode(i),r=Ts[i.name];if(!r)return e.getMode(t,"text/plain");var n=r(t,i);if(As.hasOwnProperty(i.name)){var o=As[i.name];for(var s in o)o.hasOwnProperty(s)&&(n.hasOwnProperty(s)&&(n["_"+s]=n[s]),n[s]=o[s])}if(n.name=i.name,i.helperType&&(n.helperType=i.helperType),i.modeProps)for(var s in i.modeProps)n[s]=i.modeProps[s];return n},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var As=e.modeExtensions={};e.extendMode=function(e,t){var i=As.hasOwnProperty(e)?As[e]:As[e]={};no(t,i)},e.defineExtension=function(t,i){e.prototype[t]=i},e.defineDocExtension=function(e,t){Ws.prototype[e]=t},e.defineOption=hr;var Ss=[];e.defineInitHook=function(e){Ss.push(e)};var Cs=e.helpers={};e.registerHelper=function(t,i,r){Cs.hasOwnProperty(t)||(Cs[t]=e[t]={_global:[]}),Cs[t][i]=r},e.registerGlobalHelper=function(t,i,r,n){e.registerHelper(t,i,n),Cs[t]._global.push({pred:r,val:n})};var Rs=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var i={};for(var r in t){var n=t[r];n instanceof Array&&(n=n.concat([])),i[r]=n}return i},bs=e.startState=function(e,t,i){return e.startState?e.startState(t,i):!0};e.innerMode=function(e,t){for(;e.innerMode;){var i=e.innerMode(t);if(!i||i.mode==e)break;t=i.state,e=i.mode}return i||{mode:e,state:t}};var Os=e.commands={selectAll:function(e){e.setSelection(as(e.firstLine(),0),as(e.lastLine()),ra)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ra)},killLine:function(e){pr(e,function(t){if(t.empty()){var i=xn(e.doc,t.head.line).text.length;return t.head.ch==i&&t.head.line<e.lastLine()?{from:t.head,to:as(t.head.line+1,0)}:{from:t.head,to:as(t.head.line,i)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){pr(e,function(t){return{from:as(t.from().line,0),to:Q(e.doc,as(t.to().line+1,0))}})},delLineLeft:function(e){pr(e,function(e){return{from:as(e.from().line,0),to:e.from()}})},undo:function(e){e.undo()},redo:function(e){e.redo()},undoSelection:function(e){e.undoSelection()},redoSelection:function(e){e.redoSelection()},goDocStart:function(e){e.extendSelection(as(e.firstLine(),0))},goDocEnd:function(e){e.extendSelection(as(e.lastLine()))},goLineStart:function(e){e.extendSelectionsBy(function(t){return Oo(e,t.head.line)},oa)},goLineStartSmart:function(e){e.extendSelectionsBy(function(t){var i=Oo(e,t.head.line),r=e.getLineHandle(i.line),n=Sn(r);if(!n||0==n[0].level){var o=Math.max(0,r.text.search(/\S/)),s=t.head.line==i.line&&t.head.ch<=o&&t.head.ch;return as(i.line,s?0:o)}return i},oa)},goLineEnd:function(e){e.extendSelectionsBy(function(t){return Po(e,t.head.line)},oa)},goLineRight:function(e){e.extendSelectionsBy(function(t){var i=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:i},"div")},oa)},goLineLeft:function(e){e.extendSelectionsBy(function(t){var i=e.charCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:i},"div")},oa)},goLineUp:function(e){e.moveV(-1,"line")},goLineDown:function(e){e.moveV(1,"line")},goPageUp:function(e){e.moveV(-1,"page")},goPageDown:function(e){e.moveV(1,"page")},goCharLeft:function(e){e.moveH(-1,"char")},goCharRight:function(e){e.moveH(1,"char")},goColumnLeft:function(e){e.moveH(-1,"column")},goColumnRight:function(e){e.moveH(1,"column")},goWordLeft:function(e){e.moveH(-1,"word")},goGroupRight:function(e){e.moveH(1,"group")},goGroupLeft:function(e){e.moveH(-1,"group")},goWordRight:function(e){e.moveH(1,"word")},delCharBefore:function(e){e.deleteH(-1,"char")},delCharAfter:function(e){e.deleteH(1,"char")},delWordBefore:function(e){e.deleteH(-1,"word")},delWordAfter:function(e){e.deleteH(1,"word")},delGroupBefore:function(e){e.deleteH(-1,"group")},delGroupAfter:function(e){e.deleteH(1,"group")},indentAuto:function(e){e.indentSelection("smart")},indentMore:function(e){e.indentSelection("add")},indentLess:function(e){e.indentSelection("subtract")},insertTab:function(e){e.replaceSelection(" ")},insertSoftTab:function(e){for(var t=[],i=e.listSelections(),r=e.options.tabSize,n=0;n<i.length;n++){var o=i[n].from(),s=sa(e.getLine(o.line),o.ch,r);t.push(new Array(r-s%r+1).join(" "))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){$t(e,function(){for(var t=e.listSelections(),i=[],r=0;r<t.length;r++){var n=t[r].head,o=xn(e.doc,n.line).text;if(o)if(n.ch==o.length&&(n=new as(n.line,n.ch-1)),n.ch>0)n=new as(n.line,n.ch+1),e.replaceRange(o.charAt(n.ch-1)+o.charAt(n.ch-2),as(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var s=xn(e.doc,n.line-1).text;s&&e.replaceRange(o.charAt(0)+"\n"+s.charAt(s.length-1),as(n.line-1,s.length-1),as(n.line,1),"+transpose")}i.push(new X(n,n))}e.setSelections(i)})},newlineAndIndent:function(e){$t(e,function(){for(var t=e.listSelections().length,i=0;t>i;i++){var r=e.listSelections()[i];e.replaceRange("\n",r.anchor,r.head,"+input"),e.indentLine(r.from().line+1,null,!0),sr(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},Ps=e.keyMap={};Ps.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ps.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ps.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delLineLeft","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection",fallthrough:["basic","emacsy"]},Ps.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},Ps["default"]=es?Ps.macDefault:Ps.pcDefault;var Ds=e.lookupKey=function(e,t,i){function r(t){t=fr(t);var n=t[e];if(n===!1)return"stop";if(null!=n&&i(n))return!0;if(t.nofallthrough)return"stop";var o=t.fallthrough;if(null==o)return!1;if("[object Array]"!=Object.prototype.toString.call(o))return r(o);for(var s=0;s<o.length;++s){var a=r(o[s]);if(a)return a}return!1}for(var n=0;n<t.length;++n){var o=r(t[n]);if(o)return"stop"!=o}},_s=e.isModifierKey=function(e){var t=La[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t},Ms=e.keyName=function(e,t){if(Xo&&34==e.keyCode&&e["char"])return!1;var i=La[e.keyCode];return null==i||e.altGraphKey?!1:(e.altKey&&(i="Alt-"+i),(rs?e.metaKey:e.ctrlKey)&&(i="Ctrl-"+i),(rs?e.ctrlKey:e.metaKey)&&(i="Cmd-"+i),!t&&e.shiftKey&&(i="Shift-"+i),i)};e.fromTextArea=function(t,i){function r(){t.value=u.getValue()}if(i||(i={}),i.value=t.value,!i.tabindex&&t.tabindex&&(i.tabindex=t.tabindex),!i.placeholder&&t.placeholder&&(i.placeholder=t.placeholder),null==i.autofocus){var n=ho();i.autofocus=n==t||null!=t.getAttribute("autofocus")&&n==document.body}if(t.form&&(Qs(t.form,"submit",r),!i.leaveSubmitMethodAlone)){var o=t.form,s=o.submit;try{var a=o.submit=function(){r(),o.submit=s,o.submit(),o.submit=a}}catch(l){}}t.style.display="none";var u=e(function(e){t.parentNode.insertBefore(e,t.nextSibling)},i);return u.save=r,u.getTextArea=function(){return t},u.toTextArea=function(){r(),t.parentNode.removeChild(u.getWrapperElement()),t.style.display="",t.form&&(Zs(t.form,"submit",r),"function"==typeof t.form.submit&&(t.form.submit=s))},u};var ws=e.StringStream=function(e,t){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0};ws.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(e){var t=this.string.charAt(this.pos);if("string"==typeof e)var i=t==e;else var i=t&&(e.test?e.test(t):e(t));return i?(++this.pos,t):void 0},eatWhile:function(e){for(var t=this.pos;this.eat(e););return this.pos>t},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=sa(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?sa(this.string,this.lineStart,this.tabSize):0)},indentation:function(){return sa(this.string,null,this.tabSize)-(this.lineStart?sa(this.string,this.lineStart,this.tabSize):0)},match:function(e,t,i){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e);return r&&r.index>0?null:(r&&t!==!1&&(this.pos+=r[0].length),r)}var n=function(e){return i?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return n(o)==n(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var Gs=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e};$n(Gs),Gs.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Yt(e),Kn(this,"clear")){var i=this.find();i&&qn(this,"clear",i.from,i.to)}for(var r=null,n=null,o=0;o<this.lines.length;++o){var s=this.lines[o],a=Ir(s.markedSpans,this);e&&!this.collapsed?ri(e,Tn(s),"text"):e&&(null!=a.to&&(n=Tn(s)),null!=a.from&&(r=Tn(s))),s.markedSpans=Tr(s.markedSpans,a),null==a.from&&this.collapsed&&!Wr(this.doc,s)&&e&&In(s,zt(e.display))}if(e&&this.collapsed&&!e.options.lineWrapping)for(var o=0;o<this.lines.length;++o){var l=Vr(this.lines[o]),u=d(l);u>e.display.maxLineLength&&(e.display.maxLine=l,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&ii(e,r,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&ct(e.doc)),e&&qn(e,"markerCleared",e,this),t&&Kt(e),this.parent&&this.parent.clear()}},Gs.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var i,r,n=0;n<this.lines.length;++n){var o=this.lines[n],s=Ir(o.markedSpans,this);if(null!=s.from&&(i=as(t?o:Tn(o),s.from),-1==e))return i;if(null!=s.to&&(r=as(t?o:Tn(o),s.to),1==e))return r}return i&&{from:i,to:r}},Gs.prototype.changed=function(){var e=this.find(-1,!0),t=this,i=this.doc.cm;e&&i&&$t(i,function(){var r=e.line,n=Tn(e.line),o=bt(i,n);if(o&&(_t(o),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!Wr(t.doc,r)&&null!=t.height){var s=t.height;t.height=null;var a=Xr(t)-s;a&&In(r,r.height+a)}})},Gs.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=to(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Gs.prototype.detachLine=function(e){if(this.lines.splice(to(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}};var ks=0,Bs=e.SharedTextMarker=function(e,t){this.markers=e,this.primary=t;for(var i=0;i<e.length;++i)e[i].parent=this};$n(Bs),Bs.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();qn(this,"clear")}},Bs.prototype.find=function(e,t){return this.primary.find(e,t) };var Us=e.LineWidget=function(e,t,i){if(i)for(var r in i)i.hasOwnProperty(r)&&(this[r]=i[r]);this.cm=e,this.node=t};$n(Us),Us.prototype.clear=function(){var e=this.cm,t=this.line.widgets,i=this.line,r=Tn(i);if(null!=r&&t){for(var n=0;n<t.length;++n)t[n]==this&&t.splice(n--,1);t.length||(i.widgets=null);var o=Xr(this);$t(e,function(){zr(e,i,-o),ri(e,r,"widget"),In(i,Math.max(0,i.height-o))})}},Us.prototype.changed=function(){var e=this.height,t=this.cm,i=this.line;this.height=null;var r=Xr(this)-e;r&&$t(t,function(){t.curOp.forceUpdate=!0,zr(t,i,r),In(i,i.height+r)})};var Vs=e.Line=function(e,t,i){this.text=e,Dr(this,t),this.height=i?i(this):1};$n(Vs),Vs.prototype.lineNo=function(){return Tn(this)};var Hs={},Fs={};fn.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var i=e,r=e+t;r>i;++i){var n=this.lines[i];this.height-=n.height,$r(n),qn(n,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,i){this.height+=i,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,i){for(var r=e+t;r>e;++e)if(i(this.lines[e]))return!0}},mn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var i=0;i<this.children.length;++i){var r=this.children[i],n=r.chunkSize();if(n>e){var o=Math.min(t,n-e),s=r.height;if(r.removeInner(e,o),this.height-=s-r.height,n==o&&(this.children.splice(i--,1),r.parent=null),0==(t-=o))break;e=0}else e-=n}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof fn))){var a=[];this.collapse(a),this.children=[new fn(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,i){this.size+=t.length,this.height+=i;for(var r=0;r<this.children.length;++r){var n=this.children[r],o=n.chunkSize();if(o>=e){if(n.insertInner(e,t,i),n.lines&&n.lines.length>50){for(;n.lines.length>50;){var s=n.lines.splice(n.lines.length-25,25),a=new fn(s);n.height-=a.height,this.children.splice(r+1,0,a),a.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),i=new mn(t);if(e.parent){e.size-=i.size,e.height-=i.height;var r=to(e.parent.children,e);e.parent.children.splice(r+1,0,i)}else{var n=new mn(e.children);n.parent=e,e.children=[n,i],e=n}i.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,i){for(var r=0;r<this.children.length;++r){var n=this.children[r],o=n.chunkSize();if(o>e){var s=Math.min(t,o-e);if(n.iterN(e,s,i))return!0;if(0==(t-=s))break;e=0}else e-=o}}};var js=0,Ws=e.Doc=function(e,t,i){if(!(this instanceof Ws))return new Ws(e,t,i);null==i&&(i=0),mn.call(this,[new fn([new Vs("",null)])]),this.first=i,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=i;var r=as(i,0);this.sel=K(r),this.history=new Cn(null),this.id=++js,this.modeOption=t,"string"==typeof e&&(e=va(e)),hn(this,{from:r,to:r,text:e}),lt(this,K(r),ra)};Ws.prototype=ro(mn.prototype,{constructor:Ws,iter:function(e,t,i){i?this.iterN(e-this.first,t-e,i):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var i=0,r=0;r<t.length;++r)i+=t[r].height;this.insertInner(e-this.first,t,i)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Ln(this,this.first,this.first+this.size);return e===!1?t:t.join(e||"\n")},setValue:Jt(function(e){var t=as(this.first,0),i=this.first+this.size-1;Yi(this,{from:t,to:as(i,xn(this,i).text.length),text:va(e),origin:"setValue"},!0),lt(this,K(t))}),replaceRange:function(e,t,i,r){t=Q(this,t),i=i?Q(this,i):t,er(this,e,t,i,r)},getRange:function(e,t,i){var r=Nn(this,Q(this,e),Q(this,t));return i===!1?r:r.join(i||"\n")},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){return J(this,e)?xn(this,e):void 0},getLineNumber:function(e){return Tn(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=xn(this,e)),Vr(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Q(this,e)},getCursor:function(e){var t,i=this.sel.primary();return t=null==e||"head"==e?i.head:"anchor"==e?i.anchor:"end"==e||"to"==e||e===!1?i.to():i.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Jt(function(e,t,i){ot(this,Q(this,"number"==typeof e?as(e,t||0):e),null,i)}),setSelection:Jt(function(e,t,i){ot(this,Q(this,e),Q(this,t||e),i)}),extendSelection:Jt(function(e,t,i){it(this,Q(this,e),t&&Q(this,t),i)}),extendSelections:Jt(function(e,t){rt(this,et(this,e,t))}),extendSelectionsBy:Jt(function(e,t){rt(this,io(this.sel.ranges,e),t)}),setSelections:Jt(function(e,t,i){if(e.length){for(var r=0,n=[];r<e.length;r++)n[r]=new X(Q(this,e[r].anchor),Q(this,e[r].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),lt(this,Y(n,t),i)}}),addSelection:Jt(function(e,t,i){var r=this.sel.ranges.slice(0);r.push(new X(Q(this,e),Q(this,t||e))),lt(this,Y(r,r.length-1),i)}),getSelection:function(e){for(var t,i=this.sel.ranges,r=0;r<i.length;r++){var n=Nn(this,i[r].from(),i[r].to());t=t?t.concat(n):n}return e===!1?t:t.join(e||"\n")},getSelections:function(e){for(var t=[],i=this.sel.ranges,r=0;r<i.length;r++){var n=Nn(this,i[r].from(),i[r].to());e!==!1&&(n=n.join(e||"\n")),t[r]=n}return t},replaceSelection:function(e,t,i){for(var r=[],n=0;n<this.sel.ranges.length;n++)r[n]=e;this.replaceSelections(r,t,i||"+input")},replaceSelections:Jt(function(e,t,i){for(var r=[],n=this.sel,o=0;o<n.ranges.length;o++){var s=n.ranges[o];r[o]={from:s.from(),to:s.to(),text:va(e[o]),origin:i}}for(var a=t&&"end"!=t&&zi(this,r,t),o=r.length-1;o>=0;o--)Yi(this,r[o]);a?at(this,a):this.cm&&sr(this.cm)}),undo:Jt(function(){$i(this,"undo")}),redo:Jt(function(){$i(this,"redo")}),undoSelection:Jt(function(){$i(this,"undo",!0)}),redoSelection:Jt(function(){$i(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,i=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t;for(var r=0;r<e.undone.length;r++)e.undone[r].ranges||++i;return{undo:t,redo:i}},clearHistory:function(){this.history=new Cn(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Bn(this.history.done),undone:Bn(this.history.undone)}},setHistory:function(e){var t=this.history=new Cn(this.history.maxGeneration);t.done=Bn(e.done.slice(0),null,!0),t.undone=Bn(e.undone.slice(0),null,!0)},markText:function(e,t,i){return mr(this,Q(this,e),Q(this,t),i,"range")},setBookmark:function(e,t){var i={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared};return e=Q(this,e),mr(this,e,e,i,"bookmark")},findMarksAt:function(e){e=Q(this,e);var t=[],i=xn(this,e.line).markedSpans;if(i)for(var r=0;r<i.length;++r){var n=i[r];(null==n.from||n.from<=e.ch)&&(null==n.to||n.to>=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,i){e=Q(this,e),t=Q(this,t);var r=[],n=e.line;return this.iter(e.line,t.line+1,function(o){var s=o.markedSpans;if(s)for(var a=0;a<s.length;a++){var l=s[a];n==e.line&&e.ch>l.to||null==l.from&&n!=e.line||n==t.line&&l.from>t.ch||i&&!i(l.marker)||r.push(l.marker.parent||l.marker)}++n}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var i=t.markedSpans;if(i)for(var r=0;r<i.length;++r)null!=i[r].from&&e.push(i[r].marker)}),e},posFromIndex:function(e){var t,i=this.first;return this.iter(function(r){var n=r.text.length+1;return n>e?(t=e,!0):(e-=n,void++i)}),Q(this,as(i,t))},indexFromPos:function(e){e=Q(this,e);var t=e.ch;return e.line<this.first||e.ch<0?0:(this.iter(this.first,e.line,function(e){t+=e.text.length+1}),t)},copy:function(e){var t=new Ws(Ln(this,this.first,this.first+this.size),this.modeOption,this.first);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,i=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<i&&(i=e.to);var r=new Ws(Ln(this,t,i),e.mode||this.modeOption,t);return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],xr(r,vr(this)),r},unlinkDoc:function(t){if(t instanceof e&&(t=t.doc),this.linked)for(var i=0;i<this.linked.length;++i){var r=this.linked[i];if(r.doc==t){this.linked.splice(i,1),t.unlinkDoc(this),Nr(vr(this));break}}if(t.history==this.history){var n=[t.id];gn(t,function(e){n.push(e.id)},!0),t.history=new Cn(null),t.history.done=Bn(this.history.done,n),t.history.undone=Bn(this.history.undone,n)}},iterLinkedDocs:function(e){gn(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm}}),Ws.prototype.eachLine=Ws.prototype.iter;var qs="iter insert remove copy getEditor".split(" ");for(var zs in Ws.prototype)Ws.prototype.hasOwnProperty(zs)&&to(qs,zs)<0&&(e.prototype[zs]=function(e){return function(){return e.apply(this.doc,arguments)}}(Ws.prototype[zs]));$n(Ws);var Xs,Ys=e.e_preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},Ks=e.e_stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},$s=e.e_stop=function(e){Ys(e),Ks(e)},Qs=e.on=function(e,t,i){if(e.addEventListener)e.addEventListener(t,i,!1);else if(e.attachEvent)e.attachEvent("on"+t,i);else{var r=e._handlers||(e._handlers={}),n=r[t]||(r[t]=[]);n.push(i)}},Zs=e.off=function(e,t,i){if(e.removeEventListener)e.removeEventListener(t,i,!1);else if(e.detachEvent)e.detachEvent("on"+t,i);else{var r=e._handlers&&e._handlers[t];if(!r)return;for(var n=0;n<r.length;++n)if(r[n]==i){r.splice(n,1);break}}},Js=e.signal=function(e,t){var i=e._handlers&&e._handlers[t];if(i)for(var r=Array.prototype.slice.call(arguments,2),n=0;n<i.length;++n)i[n].apply(null,r)},ea=0,ta=30,ia=e.Pass={toString:function(){return"CodeMirror.Pass"}},ra={scroll:!1},na={origin:"*mouse"},oa={origin:"+move"};Qn.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var sa=e.countColumn=function(e,t,i,r,n){null==t&&(t=e.search(/[^\s\u00a0]/),-1==t&&(t=e.length));for(var o=r||0,s=n||0;;){var a=e.indexOf(" ",o);if(0>a||a>=t)return s+(t-o);s+=a-o,s+=i-s%i,o=a+1}},aa=[""],la=function(e){e.select()};Zo?la=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:jo&&(la=function(e){try{e.select()}catch(t){}}),[].indexOf&&(to=function(e,t){return e.indexOf(t)}),[].map&&(io=function(e,t){return e.map(t)});var ua,pa=/[\u00df\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,ca=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||pa.test(e))},da=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;ua=document.createRange?function(e,t,i){var r=document.createRange();return r.setEnd(e,i),r.setStart(e,t),r}:function(e,t,i){var r=document.body.createTextRange();return r.moveToElementText(e.parentNode),r.collapse(!0),r.moveEnd("character",i),r.moveStart("character",t),r},Bo&&(ho=function(){try{return document.activeElement}catch(e){return document.body}});var Ea,ha,fa,ma=!1,ga=function(){if(Vo)return!1;var e=uo("div");return"draggable"in e||"dragDrop"in e}(),va=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,i=[],r=e.length;r>=t;){var n=e.indexOf("\n",t);-1==n&&(n=e.length);var o=e.slice(t,"\r"==e.charAt(n-1)?n-1:n),s=o.indexOf("\r");-1!=s?(i.push(o.slice(0,s)),t+=s+1):(i.push(o),t=n+1)}return i}:function(e){return e.split(/\r\n?|\n/)},xa=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(i){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},Na=function(){var e=uo("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),La={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};e.keyNames=La,function(){for(var e=0;10>e;e++)La[e+48]=La[e+96]=String(e);for(var e=65;90>=e;e++)La[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)La[e+111]=La[e+63235]="F"+e}();var Ia,Ta=function(){function e(e){return 247>=e?i.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?r.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,i){this.level=e,this.from=t,this.to=i}var i="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",n=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,s=/[LRr]/,a=/[Lb1n]/,l=/[1n]/,u="L";return function(i){if(!n.test(i))return!1;for(var r,p=i.length,c=[],d=0;p>d;++d)c.push(r=e(i.charCodeAt(d)));for(var d=0,E=u;p>d;++d){var r=c[d];"m"==r?c[d]=E:E=r}for(var d=0,h=u;p>d;++d){var r=c[d];"1"==r&&"r"==h?c[d]="n":s.test(r)&&(h=r,"r"==r&&(c[d]="R"))}for(var d=1,E=c[0];p-1>d;++d){var r=c[d];"+"==r&&"1"==E&&"1"==c[d+1]?c[d]="1":","!=r||E!=c[d+1]||"1"!=E&&"n"!=E||(c[d]=E),E=r}for(var d=0;p>d;++d){var r=c[d];if(","==r)c[d]="N";else if("%"==r){for(var f=d+1;p>f&&"%"==c[f];++f);for(var m=d&&"!"==c[d-1]||p>f&&"1"==c[f]?"1":"N",g=d;f>g;++g)c[g]=m;d=f-1}}for(var d=0,h=u;p>d;++d){var r=c[d];"L"==h&&"1"==r?c[d]="L":s.test(r)&&(h=r)}for(var d=0;p>d;++d)if(o.test(c[d])){for(var f=d+1;p>f&&o.test(c[f]);++f);for(var v="L"==(d?c[d-1]:u),x="L"==(p>f?c[f]:u),m=v||x?"L":"R",g=d;f>g;++g)c[g]=m;d=f-1}for(var N,L=[],d=0;p>d;)if(a.test(c[d])){var I=d;for(++d;p>d&&a.test(c[d]);++d);L.push(new t(0,I,d))}else{var T=d,y=L.length;for(++d;p>d&&"L"!=c[d];++d);for(var g=T;d>g;)if(l.test(c[g])){g>T&&L.splice(y,0,new t(1,T,g));var A=g;for(++g;d>g&&l.test(c[g]);++g);L.splice(y,0,new t(2,A,g)),T=g}else++g;d>T&&L.splice(y,0,new t(1,T,d))}return 1==L[0].level&&(N=i.match(/^\s+/))&&(L[0].from=N[0].length,L.unshift(new t(0,0,N[0].length))),1==eo(L).level&&(N=i.match(/\s+$/))&&(eo(L).to-=N[0].length,L.push(new t(0,p-N[0].length,p))),L[0].level!=eo(L).level&&L.push(new t(L[0].level,p,p)),L}}();return e.version="4.2.0",e})},{}],9:[function(t,i){!function(e,t){"object"==typeof i&&"object"==typeof i.exports?i.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(t,i){function r(e){var t=e.length,i=ot.type(e);return"function"===i||ot.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===i||0===t||"number"==typeof t&&t>0&&t-1 in e}function n(e,t,i){if(ot.isFunction(t))return ot.grep(e,function(e,r){return!!t.call(e,r,e)!==i});if(t.nodeType)return ot.grep(e,function(e){return e===t!==i});if("string"==typeof t){if(Et.test(t))return ot.filter(t,e,i);t=ot.filter(t,e)}return ot.grep(e,function(e){return ot.inArray(e,t)>=0!==i})}function o(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function s(e){var t=Lt[e]={};return ot.each(e.match(Nt)||[],function(e,i){t[i]=!0}),t}function a(){ft.addEventListener?(ft.removeEventListener("DOMContentLoaded",l,!1),t.removeEventListener("load",l,!1)):(ft.detachEvent("onreadystatechange",l),t.detachEvent("onload",l))}function l(){(ft.addEventListener||"load"===event.type||"complete"===ft.readyState)&&(a(),ot.ready())}function u(e,t,i){if(void 0===i&&1===e.nodeType){var r="data-"+t.replace(St,"-$1").toLowerCase();if(i=e.getAttribute(r),"string"==typeof i){try{i="true"===i?!0:"false"===i?!1:"null"===i?null:+i+""===i?+i:At.test(i)?ot.parseJSON(i):i}catch(n){}ot.data(e,t,i)}else i=void 0}return i}function p(e){var t;for(t in e)if(("data"!==t||!ot.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,i,r){if(ot.acceptData(e)){var n,o,s=ot.expando,a=e.nodeType,l=a?ot.cache:e,u=a?e[s]:e[s]&&s;if(u&&l[u]&&(r||l[u].data)||void 0!==i||"string"!=typeof t)return u||(u=a?e[s]=K.pop()||ot.guid++:s),l[u]||(l[u]=a?{}:{toJSON:ot.noop}),("object"==typeof t||"function"==typeof t)&&(r?l[u]=ot.extend(l[u],t):l[u].data=ot.extend(l[u].data,t)),o=l[u],r||(o.data||(o.data={}),o=o.data),void 0!==i&&(o[ot.camelCase(t)]=i),"string"==typeof t?(n=o[t],null==n&&(n=o[ot.camelCase(t)])):n=o,n}}function d(e,t,i){if(ot.acceptData(e)){var r,n,o=e.nodeType,s=o?ot.cache:e,a=o?e[ot.expando]:ot.expando;if(s[a]){if(t&&(r=i?s[a]:s[a].data)){ot.isArray(t)?t=t.concat(ot.map(t,ot.camelCase)):t in r?t=[t]:(t=ot.camelCase(t),t=t in r?[t]:t.split(" ")),n=t.length;for(;n--;)delete r[t[n]];if(i?!p(r):!ot.isEmptyObject(r))return}(i||(delete s[a].data,p(s[a])))&&(o?ot.cleanData([e],!0):rt.deleteExpando||s!=s.window?delete s[a]:s[a]=null)}}}function E(){return!0}function h(){return!1}function f(){try{return ft.activeElement}catch(e){}}function m(e){var t=kt.split("|"),i=e.createDocumentFragment();if(i.createElement)for(;t.length;)i.createElement(t.pop());return i}function g(e,t){var i,r,n=0,o=typeof e.getElementsByTagName!==yt?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==yt?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],i=e.childNodes||e;null!=(r=i[n]);n++)!t||ot.nodeName(r,t)?o.push(r):ot.merge(o,g(r,t));return void 0===t||t&&ot.nodeName(e,t)?ot.merge([e],o):o}function v(e){Pt.test(e.type)&&(e.defaultChecked=e.checked)}function x(e,t){return ot.nodeName(e,"table")&&ot.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function N(e){return e.type=(null!==ot.find.attr(e,"type"))+"/"+e.type,e}function L(e){var t=Yt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function I(e,t){for(var i,r=0;null!=(i=e[r]);r++)ot._data(i,"globalEval",!t||ot._data(t[r],"globalEval"))}function T(e,t){if(1===t.nodeType&&ot.hasData(e)){var i,r,n,o=ot._data(e),s=ot._data(t,o),a=o.events;if(a){delete s.handle,s.events={};for(i in a)for(r=0,n=a[i].length;n>r;r++)ot.event.add(t,i,a[i][r])}s.data&&(s.data=ot.extend({},s.data))}}function y(e,t){var i,r,n;if(1===t.nodeType){if(i=t.nodeName.toLowerCase(),!rt.noCloneEvent&&t[ot.expando]){n=ot._data(t);for(r in n.events)ot.removeEvent(t,r,n.handle);t.removeAttribute(ot.expando)}"script"===i&&t.text!==e.text?(N(t).text=e.text,L(t)):"object"===i?(t.parentNode&&(t.outerHTML=e.outerHTML),rt.html5Clone&&e.innerHTML&&!ot.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===i&&Pt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===i?t.defaultSelected=t.selected=e.defaultSelected:("input"===i||"textarea"===i)&&(t.defaultValue=e.defaultValue)}}function A(e,i){var r,n=ot(i.createElement(e)).appendTo(i.body),o=t.getDefaultComputedStyle&&(r=t.getDefaultComputedStyle(n[0]))?r.display:ot.css(n[0],"display");return n.detach(),o}function S(e){var t=ft,i=ei[e];return i||(i=A(e,t),"none"!==i&&i||(Jt=(Jt||ot("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=(Jt[0].contentWindow||Jt[0].contentDocument).document,t.write(),t.close(),i=A(e,t),Jt.detach()),ei[e]=i),i}function C(e,t){return{get:function(){var i=e();if(null!=i)return i?void delete this.get:(this.get=t).apply(this,arguments)}}}function R(e,t){if(t in e)return t;for(var i=t.charAt(0).toUpperCase()+t.slice(1),r=t,n=Ei.length;n--;)if(t=Ei[n]+i,t in e)return t;return r}function b(e,t){for(var i,r,n,o=[],s=0,a=e.length;a>s;s++)r=e[s],r.style&&(o[s]=ot._data(r,"olddisplay"),i=r.style.display,t?(o[s]||"none"!==i||(r.style.display=""),""===r.style.display&&bt(r)&&(o[s]=ot._data(r,"olddisplay",S(r.nodeName)))):(n=bt(r),(i&&"none"!==i||!n)&&ot._data(r,"olddisplay",n?i:ot.css(r,"display"))));for(s=0;a>s;s++)r=e[s],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[s]||"":"none"));return e}function O(e,t,i){var r=ui.exec(t);return r?Math.max(0,r[1]-(i||0))+(r[2]||"px"):t}function P(e,t,i,r,n){for(var o=i===(r?"border":"content")?4:"width"===t?1:0,s=0;4>o;o+=2)"margin"===i&&(s+=ot.css(e,i+Rt[o],!0,n)),r?("content"===i&&(s-=ot.css(e,"padding"+Rt[o],!0,n)),"margin"!==i&&(s-=ot.css(e,"border"+Rt[o]+"Width",!0,n))):(s+=ot.css(e,"padding"+Rt[o],!0,n),"padding"!==i&&(s+=ot.css(e,"border"+Rt[o]+"Width",!0,n)));return s}function D(e,t,i){var r=!0,n="width"===t?e.offsetWidth:e.offsetHeight,o=ti(e),s=rt.boxSizing&&"border-box"===ot.css(e,"boxSizing",!1,o);if(0>=n||null==n){if(n=ii(e,t,o),(0>n||null==n)&&(n=e.style[t]),ni.test(n))return n;r=s&&(rt.boxSizingReliable()||n===e.style[t]),n=parseFloat(n)||0}return n+P(e,t,i||(s?"border":"content"),r,o)+"px"}function _(e,t,i,r,n){return new _.prototype.init(e,t,i,r,n)}function M(){return setTimeout(function(){hi=void 0}),hi=ot.now()}function w(e,t){var i,r={height:e},n=0;for(t=t?1:0;4>n;n+=2-t)i=Rt[n],r["margin"+i]=r["padding"+i]=e;return t&&(r.opacity=r.width=e),r}function G(e,t,i){for(var r,n=(Ni[t]||[]).concat(Ni["*"]),o=0,s=n.length;s>o;o++)if(r=n[o].call(i,t,e))return r}function k(e,t,i){var r,n,o,s,a,l,u,p,c=this,d={},E=e.style,h=e.nodeType&&bt(e),f=ot._data(e,"fxshow");i.queue||(a=ot._queueHooks(e,"fx"),null==a.unqueued&&(a.unqueued=0,l=a.empty.fire,a.empty.fire=function(){a.unqueued||l()}),a.unqueued++,c.always(function(){c.always(function(){a.unqueued--,ot.queue(e,"fx").length||a.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(i.overflow=[E.overflow,E.overflowX,E.overflowY],u=ot.css(e,"display"),p="none"===u?ot._data(e,"olddisplay")||S(e.nodeName):u,"inline"===p&&"none"===ot.css(e,"float")&&(rt.inlineBlockNeedsLayout&&"inline"!==S(e.nodeName)?E.zoom=1:E.display="inline-block")),i.overflow&&(E.overflow="hidden",rt.shrinkWrapBlocks()||c.always(function(){E.overflow=i.overflow[0],E.overflowX=i.overflow[1],E.overflowY=i.overflow[2]}));for(r in t)if(n=t[r],mi.exec(n)){if(delete t[r],o=o||"toggle"===n,n===(h?"hide":"show")){if("show"!==n||!f||void 0===f[r])continue;h=!0}d[r]=f&&f[r]||ot.style(e,r)}else u=void 0;if(ot.isEmptyObject(d))"inline"===("none"===u?S(e.nodeName):u)&&(E.display=u);else{f?"hidden"in f&&(h=f.hidden):f=ot._data(e,"fxshow",{}),o&&(f.hidden=!h),h?ot(e).show():c.done(function(){ot(e).hide()}),c.done(function(){var t;ot._removeData(e,"fxshow");for(t in d)ot.style(e,t,d[t])});for(r in d)s=G(h?f[r]:0,r,c),r in f||(f[r]=s.start,h&&(s.end=s.start,s.start="width"===r||"height"===r?1:0))}}function B(e,t){var i,r,n,o,s;for(i in e)if(r=ot.camelCase(i),n=t[r],o=e[i],ot.isArray(o)&&(n=o[1],o=e[i]=o[0]),i!==r&&(e[r]=o,delete e[i]),s=ot.cssHooks[r],s&&"expand"in s){o=s.expand(o),delete e[r];for(i in o)i in e||(e[i]=o[i],t[i]=n)}else t[r]=n}function U(e,t,i){var r,n,o=0,s=xi.length,a=ot.Deferred().always(function(){delete l.elem}),l=function(){if(n)return!1;for(var t=hi||M(),i=Math.max(0,u.startTime+u.duration-t),r=i/u.duration||0,o=1-r,s=0,l=u.tweens.length;l>s;s++)u.tweens[s].run(o);return a.notifyWith(e,[u,o,i]),1>o&&l?i:(a.resolveWith(e,[u]),!1)},u=a.promise({elem:e,props:ot.extend({},t),opts:ot.extend(!0,{specialEasing:{}},i),originalProperties:t,originalOptions:i,startTime:hi||M(),duration:i.duration,tweens:[],createTween:function(t,i){var r=ot.Tween(e,u.opts,t,i,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var i=0,r=t?u.tweens.length:0;if(n)return this;for(n=!0;r>i;i++)u.tweens[i].run(1);return t?a.resolveWith(e,[u,t]):a.rejectWith(e,[u,t]),this}}),p=u.props;for(B(p,u.opts.specialEasing);s>o;o++)if(r=xi[o].call(u,e,p,u.opts))return r;return ot.map(p,G,u),ot.isFunction(u.opts.start)&&u.opts.start.call(e,u),ot.fx.timer(ot.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 V(e){return function(t,i){"string"!=typeof t&&(i=t,t="*");var r,n=0,o=t.toLowerCase().match(Nt)||[];if(ot.isFunction(i))for(;r=o[n++];)"+"===r.charAt(0)?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(i)):(e[r]=e[r]||[]).push(i)}}function H(e,t,i,r){function n(a){var l;return o[a]=!0,ot.each(e[a]||[],function(e,a){var u=a(t,i,r);return"string"!=typeof u||s||o[u]?s?!(l=u):void 0:(t.dataTypes.unshift(u),n(u),!1)}),l}var o={},s=e===Wi;return n(t.dataTypes[0])||!o["*"]&&n("*")}function F(e,t){var i,r,n=ot.ajaxSettings.flatOptions||{};for(r in t)void 0!==t[r]&&((n[r]?e:i||(i={}))[r]=t[r]);return i&&ot.extend(!0,e,i),e}function j(e,t,i){for(var r,n,o,s,a=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),void 0===n&&(n=e.mimeType||t.getResponseHeader("Content-Type"));if(n)for(s in a)if(a[s]&&a[s].test(n)){l.unshift(s);break}if(l[0]in i)o=l[0];else{for(s in i){if(!l[0]||e.converters[s+" "+l[0]]){o=s;break}r||(r=s)}o=o||r}return o?(o!==l[0]&&l.unshift(o),i[o]):void 0}function W(e,t,i,r){var n,o,s,a,l,u={},p=e.dataTypes.slice();if(p[1])for(s in e.converters)u[s.toLowerCase()]=e.converters[s];for(o=p.shift();o;)if(e.responseFields[o]&&(i[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=p.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(s=u[l+" "+o]||u["* "+o],!s)for(n in u)if(a=n.split(" "),a[1]===o&&(s=u[l+" "+a[0]]||u["* "+a[0]])){s===!0?s=u[n]:u[n]!==!0&&(o=a[0],p.unshift(a[1]));break}if(s!==!0)if(s&&e["throws"])t=s(t);else try{t=s(t)}catch(c){return{state:"parsererror",error:s?c:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}function q(e,t,i,r){var n;if(ot.isArray(t))ot.each(t,function(t,n){i||Yi.test(e)?r(e,n):q(e+"["+("object"==typeof n?t:"")+"]",n,i,r)});else if(i||"object"!==ot.type(t))r(e,t);else for(n in t)q(e+"["+n+"]",t[n],i,r)}function z(){try{return new t.XMLHttpRequest}catch(e){}}function X(){try{return new t.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}function Y(e){return ot.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var K=[],$=K.slice,Q=K.concat,Z=K.push,J=K.indexOf,et={},tt=et.toString,it=et.hasOwnProperty,rt={},nt="1.11.1",ot=function(e,t){return new ot.fn.init(e,t)},st=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,at=/^-ms-/,lt=/-([\da-z])/gi,ut=function(e,t){return t.toUpperCase()};ot.fn=ot.prototype={jquery:nt,constructor:ot,selector:"",length:0,toArray:function(){return $.call(this)},get:function(e){return null!=e?0>e?this[e+this.length]:this[e]:$.call(this)},pushStack:function(e){var t=ot.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return ot.each(this,e,t)},map:function(e){return this.pushStack(ot.map(this,function(t,i){return e.call(t,i,t)}))},slice:function(){return this.pushStack($.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,i=+e+(0>e?t:0);return this.pushStack(i>=0&&t>i?[this[i]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:Z,sort:K.sort,splice:K.splice},ot.extend=ot.fn.extend=function(){var e,t,i,r,n,o,s=arguments[0]||{},a=1,l=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[a]||{},a++),"object"==typeof s||ot.isFunction(s)||(s={}),a===l&&(s=this,a--);l>a;a++)if(null!=(n=arguments[a]))for(r in n)e=s[r],i=n[r],s!==i&&(u&&i&&(ot.isPlainObject(i)||(t=ot.isArray(i)))?(t?(t=!1,o=e&&ot.isArray(e)?e:[]):o=e&&ot.isPlainObject(e)?e:{},s[r]=ot.extend(u,o,i)):void 0!==i&&(s[r]=i));return s},ot.extend({expando:"jQuery"+(nt+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===ot.type(e)},isArray:Array.isArray||function(e){return"array"===ot.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!ot.isArray(e)&&e-parseFloat(e)>=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==ot.type(e)||e.nodeType||ot.isWindow(e))return!1;try{if(e.constructor&&!it.call(e,"constructor")&&!it.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(i){return!1}if(rt.ownLast)for(t in e)return it.call(e,t);for(t in e);return void 0===t||it.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?et[tt.call(e)]||"object":typeof e},globalEval:function(e){e&&ot.trim(e)&&(t.execScript||function(e){t.eval.call(t,e)})(e)},camelCase:function(e){return e.replace(at,"ms-").replace(lt,ut)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,i){var n,o=0,s=e.length,a=r(e);if(i){if(a)for(;s>o&&(n=t.apply(e[o],i),n!==!1);o++);else for(o in e)if(n=t.apply(e[o],i),n===!1)break}else if(a)for(;s>o&&(n=t.call(e[o],o,e[o]),n!==!1);o++);else for(o in e)if(n=t.call(e[o],o,e[o]),n===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(st,"")},makeArray:function(e,t){var i=t||[];return null!=e&&(r(Object(e))?ot.merge(i,"string"==typeof e?[e]:e):Z.call(i,e)),i},inArray:function(e,t,i){var r;if(t){if(J)return J.call(t,e,i);for(r=t.length,i=i?0>i?Math.max(0,r+i):i:0;r>i;i++)if(i in t&&t[i]===e)return i}return-1},merge:function(e,t){for(var i=+t.length,r=0,n=e.length;i>r;)e[n++]=t[r++]; if(i!==i)for(;void 0!==t[r];)e[n++]=t[r++];return e.length=n,e},grep:function(e,t,i){for(var r,n=[],o=0,s=e.length,a=!i;s>o;o++)r=!t(e[o],o),r!==a&&n.push(e[o]);return n},map:function(e,t,i){var n,o=0,s=e.length,a=r(e),l=[];if(a)for(;s>o;o++)n=t(e[o],o,i),null!=n&&l.push(n);else for(o in e)n=t(e[o],o,i),null!=n&&l.push(n);return Q.apply([],l)},guid:1,proxy:function(e,t){var i,r,n;return"string"==typeof t&&(n=e[t],t=e,e=n),ot.isFunction(e)?(i=$.call(arguments,2),r=function(){return e.apply(t||this,i.concat($.call(arguments)))},r.guid=e.guid=e.guid||ot.guid++,r):void 0},now:function(){return+new Date},support:rt}),ot.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){et["[object "+t+"]"]=t.toLowerCase()});var pt=function(e){function t(e,t,i,r){var n,o,s,a,l,u,c,E,h,f;if((t?t.ownerDocument||t:V)!==D&&P(t),t=t||D,i=i||[],!e||"string"!=typeof e)return i;if(1!==(a=t.nodeType)&&9!==a)return[];if(M&&!r){if(n=vt.exec(e))if(s=n[1]){if(9===a){if(o=t.getElementById(s),!o||!o.parentNode)return i;if(o.id===s)return i.push(o),i}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(s))&&B(t,o)&&o.id===s)return i.push(o),i}else{if(n[2])return J.apply(i,t.getElementsByTagName(e)),i;if((s=n[3])&&L.getElementsByClassName&&t.getElementsByClassName)return J.apply(i,t.getElementsByClassName(s)),i}if(L.qsa&&(!w||!w.test(e))){if(E=c=U,h=t,f=9===a&&e,1===a&&"object"!==t.nodeName.toLowerCase()){for(u=A(e),(c=t.getAttribute("id"))?E=c.replace(Nt,"\\$&"):t.setAttribute("id",E),E="[id='"+E+"'] ",l=u.length;l--;)u[l]=E+d(u[l]);h=xt.test(e)&&p(t.parentNode)||t,f=u.join(",")}if(f)try{return J.apply(i,h.querySelectorAll(f)),i}catch(m){}finally{c||t.removeAttribute("id")}}}return C(e.replace(lt,"$1"),t,i,r)}function i(){function e(i,r){return t.push(i+" ")>I.cacheLength&&delete e[t.shift()],e[i+" "]=r}var t=[];return e}function r(e){return e[U]=!0,e}function n(e){var t=D.createElement("div");try{return!!e(t)}catch(i){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var i=e.split("|"),r=e.length;r--;)I.attrHandle[i[r]]=t}function s(e,t){var i=t&&e,r=i&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||Y)-(~e.sourceIndex||Y);if(r)return r;if(i)for(;i=i.nextSibling;)if(i===t)return-1;return e?1:-1}function a(e){return function(t){var i=t.nodeName.toLowerCase();return"input"===i&&t.type===e}}function l(e){return function(t){var i=t.nodeName.toLowerCase();return("input"===i||"button"===i)&&t.type===e}}function u(e){return r(function(t){return t=+t,r(function(i,r){for(var n,o=e([],i.length,t),s=o.length;s--;)i[n=o[s]]&&(i[n]=!(r[n]=i[n]))})})}function p(e){return e&&typeof e.getElementsByTagName!==X&&e}function c(){}function d(e){for(var t=0,i=e.length,r="";i>t;t++)r+=e[t].value;return r}function E(e,t,i){var r=t.dir,n=i&&"parentNode"===r,o=F++;return t.first?function(t,i,o){for(;t=t[r];)if(1===t.nodeType||n)return e(t,i,o)}:function(t,i,s){var a,l,u=[H,o];if(s){for(;t=t[r];)if((1===t.nodeType||n)&&e(t,i,s))return!0}else for(;t=t[r];)if(1===t.nodeType||n){if(l=t[U]||(t[U]={}),(a=l[r])&&a[0]===H&&a[1]===o)return u[2]=a[2];if(l[r]=u,u[2]=e(t,i,s))return!0}}}function h(e){return e.length>1?function(t,i,r){for(var n=e.length;n--;)if(!e[n](t,i,r))return!1;return!0}:e[0]}function f(e,i,r){for(var n=0,o=i.length;o>n;n++)t(e,i[n],r);return r}function m(e,t,i,r,n){for(var o,s=[],a=0,l=e.length,u=null!=t;l>a;a++)(o=e[a])&&(!i||i(o,r,n))&&(s.push(o),u&&t.push(a));return s}function g(e,t,i,n,o,s){return n&&!n[U]&&(n=g(n)),o&&!o[U]&&(o=g(o,s)),r(function(r,s,a,l){var u,p,c,d=[],E=[],h=s.length,g=r||f(t||"*",a.nodeType?[a]:a,[]),v=!e||!r&&t?g:m(g,d,e,a,l),x=i?o||(r?e:h||n)?[]:s:v;if(i&&i(v,x,a,l),n)for(u=m(x,E),n(u,[],a,l),p=u.length;p--;)(c=u[p])&&(x[E[p]]=!(v[E[p]]=c));if(r){if(o||e){if(o){for(u=[],p=x.length;p--;)(c=x[p])&&u.push(v[p]=c);o(null,x=[],u,l)}for(p=x.length;p--;)(c=x[p])&&(u=o?tt.call(r,c):d[p])>-1&&(r[u]=!(s[u]=c))}}else x=m(x===s?x.splice(h,x.length):x),o?o(null,s,x,l):J.apply(s,x)})}function v(e){for(var t,i,r,n=e.length,o=I.relative[e[0].type],s=o||I.relative[" "],a=o?1:0,l=E(function(e){return e===t},s,!0),u=E(function(e){return tt.call(t,e)>-1},s,!0),p=[function(e,i,r){return!o&&(r||i!==R)||((t=i).nodeType?l(e,i,r):u(e,i,r))}];n>a;a++)if(i=I.relative[e[a].type])p=[E(h(p),i)];else{if(i=I.filter[e[a].type].apply(null,e[a].matches),i[U]){for(r=++a;n>r&&!I.relative[e[r].type];r++);return g(a>1&&h(p),a>1&&d(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(lt,"$1"),i,r>a&&v(e.slice(a,r)),n>r&&v(e=e.slice(r)),n>r&&d(e))}p.push(i)}return h(p)}function x(e,i){var n=i.length>0,o=e.length>0,s=function(r,s,a,l,u){var p,c,d,E=0,h="0",f=r&&[],g=[],v=R,x=r||o&&I.find.TAG("*",u),N=H+=null==v?1:Math.random()||.1,L=x.length;for(u&&(R=s!==D&&s);h!==L&&null!=(p=x[h]);h++){if(o&&p){for(c=0;d=e[c++];)if(d(p,s,a)){l.push(p);break}u&&(H=N)}n&&((p=!d&&p)&&E--,r&&f.push(p))}if(E+=h,n&&h!==E){for(c=0;d=i[c++];)d(f,g,s,a);if(r){if(E>0)for(;h--;)f[h]||g[h]||(g[h]=Q.call(l));g=m(g)}J.apply(l,g),u&&!r&&g.length>0&&E+i.length>1&&t.uniqueSort(l)}return u&&(H=N,R=v),f};return n?r(s):s}var N,L,I,T,y,A,S,C,R,b,O,P,D,_,M,w,G,k,B,U="sizzle"+-new Date,V=e.document,H=0,F=0,j=i(),W=i(),q=i(),z=function(e,t){return e===t&&(O=!0),0},X="undefined",Y=1<<31,K={}.hasOwnProperty,$=[],Q=$.pop,Z=$.push,J=$.push,et=$.slice,tt=$.indexOf||function(e){for(var t=0,i=this.length;i>t;t++)if(this[t]===e)return t;return-1},it="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",rt="[\\x20\\t\\r\\n\\f]",nt="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ot=nt.replace("w","w#"),st="\\["+rt+"*("+nt+")(?:"+rt+"*([*^$|!~]?=)"+rt+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+ot+"))|)"+rt+"*\\]",at=":("+nt+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+st+")*)|.*)\\)|)",lt=new RegExp("^"+rt+"+|((?:^|[^\\\\])(?:\\\\.)*)"+rt+"+$","g"),ut=new RegExp("^"+rt+"*,"+rt+"*"),pt=new RegExp("^"+rt+"*([>+~]|"+rt+")"+rt+"*"),ct=new RegExp("="+rt+"*([^\\]'\"]*?)"+rt+"*\\]","g"),dt=new RegExp(at),Et=new RegExp("^"+ot+"$"),ht={ID:new RegExp("^#("+nt+")"),CLASS:new RegExp("^\\.("+nt+")"),TAG:new RegExp("^("+nt.replace("w","w*")+")"),ATTR:new RegExp("^"+st),PSEUDO:new RegExp("^"+at),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+rt+"*(even|odd|(([+-]|)(\\d*)n|)"+rt+"*(?:([+-]|)"+rt+"*(\\d+)|))"+rt+"*\\)|)","i"),bool:new RegExp("^(?:"+it+")$","i"),needsContext:new RegExp("^"+rt+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+rt+"*((?:-\\d)?\\d*)"+rt+"*\\)|)(?=[^-]|$)","i")},ft=/^(?:input|select|textarea|button)$/i,mt=/^h\d$/i,gt=/^[^{]+\{\s*\[native \w/,vt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,xt=/[+~]/,Nt=/'|\\/g,Lt=new RegExp("\\\\([\\da-f]{1,6}"+rt+"?|("+rt+")|.)","ig"),It=function(e,t,i){var r="0x"+t-65536;return r!==r||i?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)};try{J.apply($=et.call(V.childNodes),V.childNodes),$[V.childNodes.length].nodeType}catch(Tt){J={apply:$.length?function(e,t){Z.apply(e,et.call(t))}:function(e,t){for(var i=e.length,r=0;e[i++]=t[r++];);e.length=i-1}}}L=t.support={},y=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},P=t.setDocument=function(e){var t,i=e?e.ownerDocument||e:V,r=i.defaultView;return i!==D&&9===i.nodeType&&i.documentElement?(D=i,_=i.documentElement,M=!y(i),r&&r!==r.top&&(r.addEventListener?r.addEventListener("unload",function(){P()},!1):r.attachEvent&&r.attachEvent("onunload",function(){P()})),L.attributes=n(function(e){return e.className="i",!e.getAttribute("className")}),L.getElementsByTagName=n(function(e){return e.appendChild(i.createComment("")),!e.getElementsByTagName("*").length}),L.getElementsByClassName=gt.test(i.getElementsByClassName)&&n(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),L.getById=n(function(e){return _.appendChild(e).id=U,!i.getElementsByName||!i.getElementsByName(U).length}),L.getById?(I.find.ID=function(e,t){if(typeof t.getElementById!==X&&M){var i=t.getElementById(e);return i&&i.parentNode?[i]:[]}},I.filter.ID=function(e){var t=e.replace(Lt,It);return function(e){return e.getAttribute("id")===t}}):(delete I.find.ID,I.filter.ID=function(e){var t=e.replace(Lt,It);return function(e){var i=typeof e.getAttributeNode!==X&&e.getAttributeNode("id");return i&&i.value===t}}),I.find.TAG=L.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==X?t.getElementsByTagName(e):void 0}:function(e,t){var i,r=[],n=0,o=t.getElementsByTagName(e);if("*"===e){for(;i=o[n++];)1===i.nodeType&&r.push(i);return r}return o},I.find.CLASS=L.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==X&&M?t.getElementsByClassName(e):void 0},G=[],w=[],(L.qsa=gt.test(i.querySelectorAll))&&(n(function(e){e.innerHTML="<select msallowclip=''><option selected=''></option></select>",e.querySelectorAll("[msallowclip^='']").length&&w.push("[*^$]="+rt+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||w.push("\\["+rt+"*(?:value|"+it+")"),e.querySelectorAll(":checked").length||w.push(":checked")}),n(function(e){var t=i.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&w.push("name"+rt+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||w.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),w.push(",.*:")})),(L.matchesSelector=gt.test(k=_.matches||_.webkitMatchesSelector||_.mozMatchesSelector||_.oMatchesSelector||_.msMatchesSelector))&&n(function(e){L.disconnectedMatch=k.call(e,"div"),k.call(e,"[s!='']:x"),G.push("!=",at)}),w=w.length&&new RegExp(w.join("|")),G=G.length&&new RegExp(G.join("|")),t=gt.test(_.compareDocumentPosition),B=t||gt.test(_.contains)?function(e,t){var i=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(i.contains?i.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},z=t?function(e,t){if(e===t)return O=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r?r:(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&r||!L.sortDetached&&t.compareDocumentPosition(e)===r?e===i||e.ownerDocument===V&&B(V,e)?-1:t===i||t.ownerDocument===V&&B(V,t)?1:b?tt.call(b,e)-tt.call(b,t):0:4&r?-1:1)}:function(e,t){if(e===t)return O=!0,0;var r,n=0,o=e.parentNode,a=t.parentNode,l=[e],u=[t];if(!o||!a)return e===i?-1:t===i?1:o?-1:a?1:b?tt.call(b,e)-tt.call(b,t):0;if(o===a)return s(e,t);for(r=e;r=r.parentNode;)l.unshift(r);for(r=t;r=r.parentNode;)u.unshift(r);for(;l[n]===u[n];)n++;return n?s(l[n],u[n]):l[n]===V?-1:u[n]===V?1:0},i):D},t.matches=function(e,i){return t(e,null,null,i)},t.matchesSelector=function(e,i){if((e.ownerDocument||e)!==D&&P(e),i=i.replace(ct,"='$1']"),!(!L.matchesSelector||!M||G&&G.test(i)||w&&w.test(i)))try{var r=k.call(e,i);if(r||L.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(n){}return t(i,D,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==D&&P(e),B(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==D&&P(e);var i=I.attrHandle[t.toLowerCase()],r=i&&K.call(I.attrHandle,t.toLowerCase())?i(e,t,!M):void 0;return void 0!==r?r:L.attributes||!M?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,i=[],r=0,n=0;if(O=!L.detectDuplicates,b=!L.sortStable&&e.slice(0),e.sort(z),O){for(;t=e[n++];)t===e[n]&&(r=i.push(n));for(;r--;)e.splice(i[r],1)}return b=null,e},T=t.getText=function(e){var t,i="",r=0,n=e.nodeType;if(n){if(1===n||9===n||11===n){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)i+=T(e)}else if(3===n||4===n)return e.nodeValue}else for(;t=e[r++];)i+=T(t);return i},I=t.selectors={cacheLength:50,createPseudo:r,match:ht,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(Lt,It),e[3]=(e[3]||e[4]||e[5]||"").replace(Lt,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]||t.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]&&t.error(e[0]),e},PSEUDO:function(e){var t,i=!e[6]&&e[2];return ht.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":i&&dt.test(i)&&(t=A(i,!0))&&(t=i.indexOf(")",i.length-t)-i.length)&&(e[0]=e[0].slice(0,t),e[2]=i.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Lt,It).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=j[e+" "];return t||(t=new RegExp("(^|"+rt+")"+e+"("+rt+"|$)"))&&j(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==X&&e.getAttribute("class")||"")})},ATTR:function(e,i,r){return function(n){var o=t.attr(n,e);return null==o?"!="===i:i?(o+="","="===i?o===r:"!="===i?o!==r:"^="===i?r&&0===o.indexOf(r):"*="===i?r&&o.indexOf(r)>-1:"$="===i?r&&o.slice(-r.length)===r:"~="===i?(" "+o+" ").indexOf(r)>-1:"|="===i?o===r||o.slice(0,r.length+1)===r+"-":!1):!0}},CHILD:function(e,t,i,r,n){var o="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===n?function(e){return!!e.parentNode}:function(t,i,l){var u,p,c,d,E,h,f=o!==s?"nextSibling":"previousSibling",m=t.parentNode,g=a&&t.nodeName.toLowerCase(),v=!l&&!a;if(m){if(o){for(;f;){for(c=t;c=c[f];)if(a?c.nodeName.toLowerCase()===g:1===c.nodeType)return!1;h=f="only"===e&&!h&&"nextSibling"}return!0}if(h=[s?m.firstChild:m.lastChild],s&&v){for(p=m[U]||(m[U]={}),u=p[e]||[],E=u[0]===H&&u[1],d=u[0]===H&&u[2],c=E&&m.childNodes[E];c=++E&&c&&c[f]||(d=E=0)||h.pop();)if(1===c.nodeType&&++d&&c===t){p[e]=[H,E,d];break}}else if(v&&(u=(t[U]||(t[U]={}))[e])&&u[0]===H)d=u[1];else for(;(c=++E&&c&&c[f]||(d=E=0)||h.pop())&&((a?c.nodeName.toLowerCase()!==g:1!==c.nodeType)||!++d||(v&&((c[U]||(c[U]={}))[e]=[H,d]),c!==t)););return d-=n,d===r||d%r===0&&d/r>=0}}},PSEUDO:function(e,i){var n,o=I.pseudos[e]||I.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[U]?o(i):o.length>1?(n=[e,e,"",i],I.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,n=o(e,i),s=n.length;s--;)r=tt.call(e,n[s]),e[r]=!(t[r]=n[s])}):function(e){return o(e,0,n)}):o}},pseudos:{not:r(function(e){var t=[],i=[],n=S(e.replace(lt,"$1"));return n[U]?r(function(e,t,i,r){for(var o,s=n(e,null,r,[]),a=e.length;a--;)(o=s[a])&&(e[a]=!(t[a]=o))}):function(e,r,o){return t[0]=e,n(t,null,o,i),!i.pop()}}),has:r(function(e){return function(i){return t(e,i).length>0}}),contains:r(function(e){return function(t){return(t.textContent||t.innerText||T(t)).indexOf(e)>-1}}),lang:r(function(e){return Et.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(Lt,It).toLowerCase(),function(t){var i;do if(i=M?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return i=i.toLowerCase(),i===e||0===i.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var i=e.location&&e.location.hash;return i&&i.slice(1)===t.id},root:function(e){return e===_},focus:function(e){return e===D.activeElement&&(!D.hasFocus||D.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.nodeType<6)return!1;return!0},parent:function(e){return!I.pseudos.empty(e)},header:function(e){return mt.test(e.nodeName)},input:function(e){return ft.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"))||"text"===t.toLowerCase())},first:u(function(){return[0]}),last:u(function(e,t){return[t-1]}),eq:u(function(e,t,i){return[0>i?i+t:i]}),even:u(function(e,t){for(var i=0;t>i;i+=2)e.push(i);return e}),odd:u(function(e,t){for(var i=1;t>i;i+=2)e.push(i);return e}),lt:u(function(e,t,i){for(var r=0>i?i+t:i;--r>=0;)e.push(r);return e}),gt:u(function(e,t,i){for(var r=0>i?i+t:i;++r<t;)e.push(r);return e})}},I.pseudos.nth=I.pseudos.eq;for(N in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})I.pseudos[N]=a(N);for(N in{submit:!0,reset:!0})I.pseudos[N]=l(N);return c.prototype=I.filters=I.pseudos,I.setFilters=new c,A=t.tokenize=function(e,i){var r,n,o,s,a,l,u,p=W[e+" "];if(p)return i?0:p.slice(0);for(a=e,l=[],u=I.preFilter;a;){(!r||(n=ut.exec(a)))&&(n&&(a=a.slice(n[0].length)||a),l.push(o=[])),r=!1,(n=pt.exec(a))&&(r=n.shift(),o.push({value:r,type:n[0].replace(lt," ")}),a=a.slice(r.length));for(s in I.filter)!(n=ht[s].exec(a))||u[s]&&!(n=u[s](n))||(r=n.shift(),o.push({value:r,type:s,matches:n}),a=a.slice(r.length));if(!r)break}return i?a.length:a?t.error(e):W(e,l).slice(0)},S=t.compile=function(e,t){var i,r=[],n=[],o=q[e+" "];if(!o){for(t||(t=A(e)),i=t.length;i--;)o=v(t[i]),o[U]?r.push(o):n.push(o);o=q(e,x(n,r)),o.selector=e}return o},C=t.select=function(e,t,i,r){var n,o,s,a,l,u="function"==typeof e&&e,c=!r&&A(e=u.selector||e);if(i=i||[],1===c.length){if(o=c[0]=c[0].slice(0),o.length>2&&"ID"===(s=o[0]).type&&L.getById&&9===t.nodeType&&M&&I.relative[o[1].type]){if(t=(I.find.ID(s.matches[0].replace(Lt,It),t)||[])[0],!t)return i;u&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(n=ht.needsContext.test(e)?0:o.length;n--&&(s=o[n],!I.relative[a=s.type]);)if((l=I.find[a])&&(r=l(s.matches[0].replace(Lt,It),xt.test(o[0].type)&&p(t.parentNode)||t))){if(o.splice(n,1),e=r.length&&d(o),!e)return J.apply(i,r),i;break}}return(u||S(e,c))(r,t,!M,i,xt.test(e)&&p(t.parentNode)||t),i},L.sortStable=U.split("").sort(z).join("")===U,L.detectDuplicates=!!O,P(),L.sortDetached=n(function(e){return 1&e.compareDocumentPosition(D.createElement("div"))}),n(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,i){return i?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),L.attributes&&n(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,i){return i||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),n(function(e){return null==e.getAttribute("disabled")})||o(it,function(e,t,i){var r;return i?void 0:e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(t);ot.find=pt,ot.expr=pt.selectors,ot.expr[":"]=ot.expr.pseudos,ot.unique=pt.uniqueSort,ot.text=pt.getText,ot.isXMLDoc=pt.isXML,ot.contains=pt.contains;var ct=ot.expr.match.needsContext,dt=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,Et=/^.[^:#\[\.,]*$/;ot.filter=function(e,t,i){var r=t[0];return i&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?ot.find.matchesSelector(r,e)?[r]:[]:ot.find.matches(e,ot.grep(t,function(e){return 1===e.nodeType}))},ot.fn.extend({find:function(e){var t,i=[],r=this,n=r.length;if("string"!=typeof e)return this.pushStack(ot(e).filter(function(){for(t=0;n>t;t++)if(ot.contains(r[t],this))return!0}));for(t=0;n>t;t++)ot.find(e,r[t],i);return i=this.pushStack(n>1?ot.unique(i):i),i.selector=this.selector?this.selector+" "+e:e,i},filter:function(e){return this.pushStack(n(this,e||[],!1))},not:function(e){return this.pushStack(n(this,e||[],!0))},is:function(e){return!!n(this,"string"==typeof e&&ct.test(e)?ot(e):e||[],!1).length}});var ht,ft=t.document,mt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,gt=ot.fn.init=function(e,t){var i,r;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:mt.exec(e),!i||!i[1]&&t)return!t||t.jquery?(t||ht).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof ot?t[0]:t,ot.merge(this,ot.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:ft,!0)),dt.test(i[1])&&ot.isPlainObject(t))for(i in t)ot.isFunction(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}if(r=ft.getElementById(i[2]),r&&r.parentNode){if(r.id!==i[2])return ht.find(e);this.length=1,this[0]=r}return this.context=ft,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):ot.isFunction(e)?"undefined"!=typeof ht.ready?ht.ready(e):e(ot):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),ot.makeArray(e,this))};gt.prototype=ot.fn,ht=ot(ft);var vt=/^(?:parents|prev(?:Until|All))/,xt={children:!0,contents:!0,next:!0,prev:!0};ot.extend({dir:function(e,t,i){for(var r=[],n=e[t];n&&9!==n.nodeType&&(void 0===i||1!==n.nodeType||!ot(n).is(i));)1===n.nodeType&&r.push(n),n=n[t];return r},sibling:function(e,t){for(var i=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&i.push(e);return i}}),ot.fn.extend({has:function(e){var t,i=ot(e,this),r=i.length;return this.filter(function(){for(t=0;r>t;t++)if(ot.contains(this,i[t]))return!0})},closest:function(e,t){for(var i,r=0,n=this.length,o=[],s=ct.test(e)||"string"!=typeof e?ot(e,t||this.context):0;n>r;r++)for(i=this[r];i&&i!==t;i=i.parentNode)if(i.nodeType<11&&(s?s.index(i)>-1:1===i.nodeType&&ot.find.matchesSelector(i,e))){o.push(i);break}return this.pushStack(o.length>1?ot.unique(o):o)},index:function(e){return e?"string"==typeof e?ot.inArray(this[0],ot(e)):ot.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ot.unique(ot.merge(this.get(),ot(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ot.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return ot.dir(e,"parentNode")},parentsUntil:function(e,t,i){return ot.dir(e,"parentNode",i)},next:function(e){return o(e,"nextSibling")},prev:function(e){return o(e,"previousSibling")},nextAll:function(e){return ot.dir(e,"nextSibling")},prevAll:function(e){return ot.dir(e,"previousSibling")},nextUntil:function(e,t,i){return ot.dir(e,"nextSibling",i)},prevUntil:function(e,t,i){return ot.dir(e,"previousSibling",i)},siblings:function(e){return ot.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return ot.sibling(e.firstChild)},contents:function(e){return ot.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:ot.merge([],e.childNodes)}},function(e,t){ot.fn[e]=function(i,r){var n=ot.map(this,t,i);return"Until"!==e.slice(-5)&&(r=i),r&&"string"==typeof r&&(n=ot.filter(r,n)),this.length>1&&(xt[e]||(n=ot.unique(n)),vt.test(e)&&(n=n.reverse())),this.pushStack(n)}});var Nt=/\S+/g,Lt={};ot.Callbacks=function(e){e="string"==typeof e?Lt[e]||s(e):ot.extend({},e);var t,i,r,n,o,a,l=[],u=!e.once&&[],p=function(s){for(i=e.memory&&s,r=!0,o=a||0,a=0,n=l.length,t=!0;l&&n>o;o++)if(l[o].apply(s[0],s[1])===!1&&e.stopOnFalse){i=!1;break}t=!1,l&&(u?u.length&&p(u.shift()):i?l=[]:c.disable())},c={add:function(){if(l){var r=l.length;!function o(t){ot.each(t,function(t,i){var r=ot.type(i);"function"===r?e.unique&&c.has(i)||l.push(i):i&&i.length&&"string"!==r&&o(i)})}(arguments),t?n=l.length:i&&(a=r,p(i))}return this},remove:function(){return l&&ot.each(arguments,function(e,i){for(var r;(r=ot.inArray(i,l,r))>-1;)l.splice(r,1),t&&(n>=r&&n--,o>=r&&o--)}),this},has:function(e){return e?ot.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],n=0,this},disable:function(){return l=u=i=void 0,this},disabled:function(){return!l},lock:function(){return u=void 0,i||c.disable(),this},locked:function(){return!u},fireWith:function(e,i){return!l||r&&!u||(i=i||[],i=[e,i.slice?i.slice():i],t?u.push(i):p(i)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},ot.extend({Deferred:function(e){var t=[["resolve","done",ot.Callbacks("once memory"),"resolved"],["reject","fail",ot.Callbacks("once memory"),"rejected"],["notify","progress",ot.Callbacks("memory")]],i="pending",r={state:function(){return i},always:function(){return n.done(arguments).fail(arguments),this},then:function(){var e=arguments;return ot.Deferred(function(i){ot.each(t,function(t,o){var s=ot.isFunction(e[t])&&e[t];n[o[1]](function(){var e=s&&s.apply(this,arguments);e&&ot.isFunction(e.promise)?e.promise().done(i.resolve).fail(i.reject).progress(i.notify):i[o[0]+"With"](this===r?i.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?ot.extend(e,r):r}},n={};return r.pipe=r.then,ot.each(t,function(e,o){var s=o[2],a=o[3];r[o[1]]=s.add,a&&s.add(function(){i=a},t[1^e][2].disable,t[2][2].lock),n[o[0]]=function(){return n[o[0]+"With"](this===n?r:this,arguments),this},n[o[0]+"With"]=s.fireWith}),r.promise(n),e&&e.call(n,n),n},when:function(e){var t,i,r,n=0,o=$.call(arguments),s=o.length,a=1!==s||e&&ot.isFunction(e.promise)?s:0,l=1===a?e:ot.Deferred(),u=function(e,i,r){return function(n){i[e]=this,r[e]=arguments.length>1?$.call(arguments):n,r===t?l.notifyWith(i,r):--a||l.resolveWith(i,r)}};if(s>1)for(t=new Array(s),i=new Array(s),r=new Array(s);s>n;n++)o[n]&&ot.isFunction(o[n].promise)?o[n].promise().done(u(n,r,o)).fail(l.reject).progress(u(n,i,t)):--a;return a||l.resolveWith(r,o),l.promise()}});var It;ot.fn.ready=function(e){return ot.ready.promise().done(e),this},ot.extend({isReady:!1,readyWait:1,holdReady:function(e){e?ot.readyWait++:ot.ready(!0)},ready:function(e){if(e===!0?!--ot.readyWait:!ot.isReady){if(!ft.body)return setTimeout(ot.ready);ot.isReady=!0,e!==!0&&--ot.readyWait>0||(It.resolveWith(ft,[ot]),ot.fn.triggerHandler&&(ot(ft).triggerHandler("ready"),ot(ft).off("ready")))}}}),ot.ready.promise=function(e){if(!It)if(It=ot.Deferred(),"complete"===ft.readyState)setTimeout(ot.ready);else if(ft.addEventListener)ft.addEventListener("DOMContentLoaded",l,!1),t.addEventListener("load",l,!1);else{ft.attachEvent("onreadystatechange",l),t.attachEvent("onload",l);var i=!1;try{i=null==t.frameElement&&ft.documentElement}catch(r){}i&&i.doScroll&&!function n(){if(!ot.isReady){try{i.doScroll("left")}catch(e){return setTimeout(n,50)}a(),ot.ready()}}()}return It.promise(e)};var Tt,yt="undefined";for(Tt in ot(rt))break;rt.ownLast="0"!==Tt,rt.inlineBlockNeedsLayout=!1,ot(function(){var e,t,i,r;i=ft.getElementsByTagName("body")[0],i&&i.style&&(t=ft.createElement("div"),r=ft.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",i.appendChild(r).appendChild(t),typeof t.style.zoom!==yt&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",rt.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(i.style.zoom=1)),i.removeChild(r))}),function(){var e=ft.createElement("div");if(null==rt.deleteExpando){rt.deleteExpando=!0;try{delete e.test}catch(t){rt.deleteExpando=!1}}e=null}(),ot.acceptData=function(e){var t=ot.noData[(e.nodeName+" ").toLowerCase()],i=+e.nodeType||1;return 1!==i&&9!==i?!1:!t||t!==!0&&e.getAttribute("classid")===t};var At=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,St=/([A-Z])/g;ot.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?ot.cache[e[ot.expando]]:e[ot.expando],!!e&&!p(e)},data:function(e,t,i){return c(e,t,i)},removeData:function(e,t){return d(e,t)},_data:function(e,t,i){return c(e,t,i,!0)},_removeData:function(e,t){return d(e,t,!0)}}),ot.fn.extend({data:function(e,t){var i,r,n,o=this[0],s=o&&o.attributes;if(void 0===e){if(this.length&&(n=ot.data(o),1===o.nodeType&&!ot._data(o,"parsedAttrs"))){for(i=s.length;i--;)s[i]&&(r=s[i].name,0===r.indexOf("data-")&&(r=ot.camelCase(r.slice(5)),u(o,r,n[r])));ot._data(o,"parsedAttrs",!0)}return n}return"object"==typeof e?this.each(function(){ot.data(this,e)}):arguments.length>1?this.each(function(){ot.data(this,e,t)}):o?u(o,e,ot.data(o,e)):void 0},removeData:function(e){return this.each(function(){ot.removeData(this,e)})}}),ot.extend({queue:function(e,t,i){var r;return e?(t=(t||"fx")+"queue",r=ot._data(e,t),i&&(!r||ot.isArray(i)?r=ot._data(e,t,ot.makeArray(i)):r.push(i)),r||[]):void 0},dequeue:function(e,t){t=t||"fx";var i=ot.queue(e,t),r=i.length,n=i.shift(),o=ot._queueHooks(e,t),s=function(){ot.dequeue(e,t)};"inprogress"===n&&(n=i.shift(),r--),n&&("fx"===t&&i.unshift("inprogress"),delete o.stop,n.call(e,s,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var i=t+"queueHooks";return ot._data(e,i)||ot._data(e,i,{empty:ot.Callbacks("once memory").add(function(){ot._removeData(e,t+"queue"),ot._removeData(e,i)})})}}),ot.fn.extend({queue:function(e,t){var i=2;return"string"!=typeof e&&(t=e,e="fx",i--),arguments.length<i?ot.queue(this[0],e):void 0===t?this:this.each(function(){var i=ot.queue(this,e,t);ot._queueHooks(this,e),"fx"===e&&"inprogress"!==i[0]&&ot.dequeue(this,e)})},dequeue:function(e){return this.each(function(){ot.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var i,r=1,n=ot.Deferred(),o=this,s=this.length,a=function(){--r||n.resolveWith(o,[o])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";s--;)i=ot._data(o[s],e+"queueHooks"),i&&i.empty&&(r++,i.empty.add(a));return a(),n.promise(t)}});var Ct=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Rt=["Top","Right","Bottom","Left"],bt=function(e,t){return e=t||e,"none"===ot.css(e,"display")||!ot.contains(e.ownerDocument,e)},Ot=ot.access=function(e,t,i,r,n,o,s){var a=0,l=e.length,u=null==i;if("object"===ot.type(i)){n=!0;for(a in i)ot.access(e,t,a,i[a],!0,o,s)}else if(void 0!==r&&(n=!0,ot.isFunction(r)||(s=!0),u&&(s?(t.call(e,r),t=null):(u=t,t=function(e,t,i){return u.call(ot(e),i)})),t))for(;l>a;a++)t(e[a],i,s?r:r.call(e[a],a,t(e[a],i)));return n?e:u?t.call(e):l?t(e[0],i):o},Pt=/^(?:checkbox|radio)$/i;!function(){var e=ft.createElement("input"),t=ft.createElement("div"),i=ft.createDocumentFragment();if(t.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",rt.leadingWhitespace=3===t.firstChild.nodeType,rt.tbody=!t.getElementsByTagName("tbody").length,rt.htmlSerialize=!!t.getElementsByTagName("link").length,rt.html5Clone="<:nav></:nav>"!==ft.createElement("nav").cloneNode(!0).outerHTML,e.type="checkbox",e.checked=!0,i.appendChild(e),rt.appendChecked=e.checked,t.innerHTML="<textarea>x</textarea>",rt.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue,i.appendChild(t),t.innerHTML="<input type='radio' checked='checked' name='t'/>",rt.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,rt.noCloneEvent=!0,t.attachEvent&&(t.attachEvent("onclick",function(){rt.noCloneEvent=!1}),t.cloneNode(!0).click()),null==rt.deleteExpando){rt.deleteExpando=!0;try{delete t.test}catch(r){rt.deleteExpando=!1}}}(),function(){var e,i,r=ft.createElement("div");for(e in{submit:!0,change:!0,focusin:!0})i="on"+e,(rt[e+"Bubbles"]=i in t)||(r.setAttribute(i,"t"),rt[e+"Bubbles"]=r.attributes[i].expando===!1);r=null}();var Dt=/^(?:input|select|textarea)$/i,_t=/^key/,Mt=/^(?:mouse|pointer|contextmenu)|click/,wt=/^(?:focusinfocus|focusoutblur)$/,Gt=/^([^.]*)(?:\.(.+)|)$/;ot.event={global:{},add:function(e,t,i,r,n){var o,s,a,l,u,p,c,d,E,h,f,m=ot._data(e);if(m){for(i.handler&&(l=i,i=l.handler,n=l.selector),i.guid||(i.guid=ot.guid++),(s=m.events)||(s=m.events={}),(p=m.handle)||(p=m.handle=function(e){return typeof ot===yt||e&&ot.event.triggered===e.type?void 0:ot.event.dispatch.apply(p.elem,arguments)},p.elem=e),t=(t||"").match(Nt)||[""],a=t.length;a--;)o=Gt.exec(t[a])||[],E=f=o[1],h=(o[2]||"").split(".").sort(),E&&(u=ot.event.special[E]||{},E=(n?u.delegateType:u.bindType)||E,u=ot.event.special[E]||{},c=ot.extend({type:E,origType:f,data:r,handler:i,guid:i.guid,selector:n,needsContext:n&&ot.expr.match.needsContext.test(n),namespace:h.join(".")},l),(d=s[E])||(d=s[E]=[],d.delegateCount=0,u.setup&&u.setup.call(e,r,h,p)!==!1||(e.addEventListener?e.addEventListener(E,p,!1):e.attachEvent&&e.attachEvent("on"+E,p))),u.add&&(u.add.call(e,c),c.handler.guid||(c.handler.guid=i.guid)),n?d.splice(d.delegateCount++,0,c):d.push(c),ot.event.global[E]=!0); e=null}},remove:function(e,t,i,r,n){var o,s,a,l,u,p,c,d,E,h,f,m=ot.hasData(e)&&ot._data(e);if(m&&(p=m.events)){for(t=(t||"").match(Nt)||[""],u=t.length;u--;)if(a=Gt.exec(t[u])||[],E=f=a[1],h=(a[2]||"").split(".").sort(),E){for(c=ot.event.special[E]||{},E=(r?c.delegateType:c.bindType)||E,d=p[E]||[],a=a[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=d.length;o--;)s=d[o],!n&&f!==s.origType||i&&i.guid!==s.guid||a&&!a.test(s.namespace)||r&&r!==s.selector&&("**"!==r||!s.selector)||(d.splice(o,1),s.selector&&d.delegateCount--,c.remove&&c.remove.call(e,s));l&&!d.length&&(c.teardown&&c.teardown.call(e,h,m.handle)!==!1||ot.removeEvent(e,E,m.handle),delete p[E])}else for(E in p)ot.event.remove(e,E+t[u],i,r,!0);ot.isEmptyObject(p)&&(delete m.handle,ot._removeData(e,"events"))}},trigger:function(e,i,r,n){var o,s,a,l,u,p,c,d=[r||ft],E=it.call(e,"type")?e.type:e,h=it.call(e,"namespace")?e.namespace.split("."):[];if(a=p=r=r||ft,3!==r.nodeType&&8!==r.nodeType&&!wt.test(E+ot.event.triggered)&&(E.indexOf(".")>=0&&(h=E.split("."),E=h.shift(),h.sort()),s=E.indexOf(":")<0&&"on"+E,e=e[ot.expando]?e:new ot.Event(E,"object"==typeof e&&e),e.isTrigger=n?2:3,e.namespace=h.join("."),e.namespace_re=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=r),i=null==i?[e]:ot.makeArray(i,[e]),u=ot.event.special[E]||{},n||!u.trigger||u.trigger.apply(r,i)!==!1)){if(!n&&!u.noBubble&&!ot.isWindow(r)){for(l=u.delegateType||E,wt.test(l+E)||(a=a.parentNode);a;a=a.parentNode)d.push(a),p=a;p===(r.ownerDocument||ft)&&d.push(p.defaultView||p.parentWindow||t)}for(c=0;(a=d[c++])&&!e.isPropagationStopped();)e.type=c>1?l:u.bindType||E,o=(ot._data(a,"events")||{})[e.type]&&ot._data(a,"handle"),o&&o.apply(a,i),o=s&&a[s],o&&o.apply&&ot.acceptData(a)&&(e.result=o.apply(a,i),e.result===!1&&e.preventDefault());if(e.type=E,!n&&!e.isDefaultPrevented()&&(!u._default||u._default.apply(d.pop(),i)===!1)&&ot.acceptData(r)&&s&&r[E]&&!ot.isWindow(r)){p=r[s],p&&(r[s]=null),ot.event.triggered=E;try{r[E]()}catch(f){}ot.event.triggered=void 0,p&&(r[s]=p)}return e.result}},dispatch:function(e){e=ot.event.fix(e);var t,i,r,n,o,s=[],a=$.call(arguments),l=(ot._data(this,"events")||{})[e.type]||[],u=ot.event.special[e.type]||{};if(a[0]=e,e.delegateTarget=this,!u.preDispatch||u.preDispatch.call(this,e)!==!1){for(s=ot.event.handlers.call(this,e,l),t=0;(n=s[t++])&&!e.isPropagationStopped();)for(e.currentTarget=n.elem,o=0;(r=n.handlers[o++])&&!e.isImmediatePropagationStopped();)(!e.namespace_re||e.namespace_re.test(r.namespace))&&(e.handleObj=r,e.data=r.data,i=((ot.event.special[r.origType]||{}).handle||r.handler).apply(n.elem,a),void 0!==i&&(e.result=i)===!1&&(e.preventDefault(),e.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,e),e.result}},handlers:function(e,t){var i,r,n,o,s=[],a=t.delegateCount,l=e.target;if(a&&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(n=[],o=0;a>o;o++)r=t[o],i=r.selector+" ",void 0===n[i]&&(n[i]=r.needsContext?ot(i,this).index(l)>=0:ot.find(i,this,null,[l]).length),n[i]&&n.push(r);n.length&&s.push({elem:l,handlers:n})}return a<t.length&&s.push({elem:this,handlers:t.slice(a)}),s},fix:function(e){if(e[ot.expando])return e;var t,i,r,n=e.type,o=e,s=this.fixHooks[n];for(s||(this.fixHooks[n]=s=Mt.test(n)?this.mouseHooks:_t.test(n)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new ot.Event(o),t=r.length;t--;)i=r[t],e[i]=o[i];return e.target||(e.target=o.srcElement||ft),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,t){var i,r,n,o=t.button,s=t.fromElement;return null==e.pageX&&null!=t.clientX&&(r=e.target.ownerDocument||ft,n=r.documentElement,i=r.body,e.pageX=t.clientX+(n&&n.scrollLeft||i&&i.scrollLeft||0)-(n&&n.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(n&&n.scrollTop||i&&i.scrollTop||0)-(n&&n.clientTop||i&&i.clientTop||0)),!e.relatedTarget&&s&&(e.relatedTarget=s===e.target?t.toElement:s),e.which||void 0===o||(e.which=1&o?1:2&o?3:4&o?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==f()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===f()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return ot.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(e){return ot.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,i,r){var n=ot.extend(new ot.Event,i,{type:e,isSimulated:!0,originalEvent:{}});r?ot.event.trigger(n,null,t):ot.event.dispatch.call(t,n),n.isDefaultPrevented()&&i.preventDefault()}},ot.removeEvent=ft.removeEventListener?function(e,t,i){e.removeEventListener&&e.removeEventListener(t,i,!1)}:function(e,t,i){var r="on"+t;e.detachEvent&&(typeof e[r]===yt&&(e[r]=null),e.detachEvent(r,i))},ot.Event=function(e,t){return this instanceof ot.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&e.returnValue===!1?E:h):this.type=e,t&&ot.extend(this,t),this.timeStamp=e&&e.timeStamp||ot.now(),void(this[ot.expando]=!0)):new ot.Event(e,t)},ot.Event.prototype={isDefaultPrevented:h,isPropagationStopped:h,isImmediatePropagationStopped:h,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=E,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=E,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=E,e&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.stopPropagation()}},ot.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){ot.event.special[e]={delegateType:t,bindType:t,handle:function(e){var i,r=this,n=e.relatedTarget,o=e.handleObj;return(!n||n!==r&&!ot.contains(r,n))&&(e.type=o.origType,i=o.handler.apply(this,arguments),e.type=t),i}}}),rt.submitBubbles||(ot.event.special.submit={setup:function(){return ot.nodeName(this,"form")?!1:void ot.event.add(this,"click._submit keypress._submit",function(e){var t=e.target,i=ot.nodeName(t,"input")||ot.nodeName(t,"button")?t.form:void 0;i&&!ot._data(i,"submitBubbles")&&(ot.event.add(i,"submit._submit",function(e){e._submit_bubble=!0}),ot._data(i,"submitBubbles",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&ot.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return ot.nodeName(this,"form")?!1:void ot.event.remove(this,"._submit")}}),rt.changeBubbles||(ot.event.special.change={setup:function(){return Dt.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(ot.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),ot.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),ot.event.simulate("change",this,e,!0)})),!1):void ot.event.add(this,"beforeactivate._change",function(e){var t=e.target;Dt.test(t.nodeName)&&!ot._data(t,"changeBubbles")&&(ot.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||ot.event.simulate("change",this.parentNode,e,!0)}),ot._data(t,"changeBubbles",!0))})},handle:function(e){var t=e.target;return this!==t||e.isSimulated||e.isTrigger||"radio"!==t.type&&"checkbox"!==t.type?e.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return ot.event.remove(this,"._change"),!Dt.test(this.nodeName)}}),rt.focusinBubbles||ot.each({focus:"focusin",blur:"focusout"},function(e,t){var i=function(e){ot.event.simulate(t,e.target,ot.event.fix(e),!0)};ot.event.special[t]={setup:function(){var r=this.ownerDocument||this,n=ot._data(r,t);n||r.addEventListener(e,i,!0),ot._data(r,t,(n||0)+1)},teardown:function(){var r=this.ownerDocument||this,n=ot._data(r,t)-1;n?ot._data(r,t,n):(r.removeEventListener(e,i,!0),ot._removeData(r,t))}}}),ot.fn.extend({on:function(e,t,i,r,n){var o,s;if("object"==typeof e){"string"!=typeof t&&(i=i||t,t=void 0);for(o in e)this.on(o,t,i,e[o],n);return this}if(null==i&&null==r?(r=t,i=t=void 0):null==r&&("string"==typeof t?(r=i,i=void 0):(r=i,i=t,t=void 0)),r===!1)r=h;else if(!r)return this;return 1===n&&(s=r,r=function(e){return ot().off(e),s.apply(this,arguments)},r.guid=s.guid||(s.guid=ot.guid++)),this.each(function(){ot.event.add(this,e,r,i,t)})},one:function(e,t,i,r){return this.on(e,t,i,r,1)},off:function(e,t,i){var r,n;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,ot(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(n in e)this.off(n,t,e[n]);return this}return(t===!1||"function"==typeof t)&&(i=t,t=void 0),i===!1&&(i=h),this.each(function(){ot.event.remove(this,e,i,t)})},trigger:function(e,t){return this.each(function(){ot.event.trigger(e,t,this)})},triggerHandler:function(e,t){var i=this[0];return i?ot.event.trigger(e,t,i,!0):void 0}});var kt="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Bt=/ jQuery\d+="(?:null|\d+)"/g,Ut=new RegExp("<(?:"+kt+")[\\s/>]","i"),Vt=/^\s+/,Ht=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Ft=/<([\w:]+)/,jt=/<tbody/i,Wt=/<|&#?\w+;/,qt=/<(?:script|style|link)/i,zt=/checked\s*(?:[^=]|=\s*.checked.)/i,Xt=/^$|\/(?:java|ecma)script/i,Yt=/^true\/(.*)/,Kt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,$t={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:rt.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Qt=m(ft),Zt=Qt.appendChild(ft.createElement("div"));$t.optgroup=$t.option,$t.tbody=$t.tfoot=$t.colgroup=$t.caption=$t.thead,$t.th=$t.td,ot.extend({clone:function(e,t,i){var r,n,o,s,a,l=ot.contains(e.ownerDocument,e);if(rt.html5Clone||ot.isXMLDoc(e)||!Ut.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Zt.innerHTML=e.outerHTML,Zt.removeChild(o=Zt.firstChild)),!(rt.noCloneEvent&&rt.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ot.isXMLDoc(e)))for(r=g(o),a=g(e),s=0;null!=(n=a[s]);++s)r[s]&&y(n,r[s]);if(t)if(i)for(a=a||g(e),r=r||g(o),s=0;null!=(n=a[s]);s++)T(n,r[s]);else T(e,o);return r=g(o,"script"),r.length>0&&I(r,!l&&g(e,"script")),r=a=n=null,o},buildFragment:function(e,t,i,r){for(var n,o,s,a,l,u,p,c=e.length,d=m(t),E=[],h=0;c>h;h++)if(o=e[h],o||0===o)if("object"===ot.type(o))ot.merge(E,o.nodeType?[o]:o);else if(Wt.test(o)){for(a=a||d.appendChild(t.createElement("div")),l=(Ft.exec(o)||["",""])[1].toLowerCase(),p=$t[l]||$t._default,a.innerHTML=p[1]+o.replace(Ht,"<$1></$2>")+p[2],n=p[0];n--;)a=a.lastChild;if(!rt.leadingWhitespace&&Vt.test(o)&&E.push(t.createTextNode(Vt.exec(o)[0])),!rt.tbody)for(o="table"!==l||jt.test(o)?"<table>"!==p[1]||jt.test(o)?0:a:a.firstChild,n=o&&o.childNodes.length;n--;)ot.nodeName(u=o.childNodes[n],"tbody")&&!u.childNodes.length&&o.removeChild(u);for(ot.merge(E,a.childNodes),a.textContent="";a.firstChild;)a.removeChild(a.firstChild);a=d.lastChild}else E.push(t.createTextNode(o));for(a&&d.removeChild(a),rt.appendChecked||ot.grep(g(E,"input"),v),h=0;o=E[h++];)if((!r||-1===ot.inArray(o,r))&&(s=ot.contains(o.ownerDocument,o),a=g(d.appendChild(o),"script"),s&&I(a),i))for(n=0;o=a[n++];)Xt.test(o.type||"")&&i.push(o);return a=null,d},cleanData:function(e,t){for(var i,r,n,o,s=0,a=ot.expando,l=ot.cache,u=rt.deleteExpando,p=ot.event.special;null!=(i=e[s]);s++)if((t||ot.acceptData(i))&&(n=i[a],o=n&&l[n])){if(o.events)for(r in o.events)p[r]?ot.event.remove(i,r):ot.removeEvent(i,r,o.handle);l[n]&&(delete l[n],u?delete i[a]:typeof i.removeAttribute!==yt?i.removeAttribute(a):i[a]=null,K.push(n))}}}),ot.fn.extend({text:function(e){return Ot(this,function(e){return void 0===e?ot.text(this):this.empty().append((this[0]&&this[0].ownerDocument||ft).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=x(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=x(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){for(var i,r=e?ot.filter(e,this):this,n=0;null!=(i=r[n]);n++)t||1!==i.nodeType||ot.cleanData(g(i)),i.parentNode&&(t&&ot.contains(i.ownerDocument,i)&&I(g(i,"script")),i.parentNode.removeChild(i));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&ot.cleanData(g(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&ot.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 ot.clone(this,e,t)})},html:function(e){return Ot(this,function(e){var t=this[0]||{},i=0,r=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(Bt,""):void 0;if(!("string"!=typeof e||qt.test(e)||!rt.htmlSerialize&&Ut.test(e)||!rt.leadingWhitespace&&Vt.test(e)||$t[(Ft.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(Ht,"<$1></$2>");try{for(;r>i;i++)t=this[i]||{},1===t.nodeType&&(ot.cleanData(g(t,!1)),t.innerHTML=e);t=0}catch(n){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=arguments[0];return this.domManip(arguments,function(t){e=this.parentNode,ot.cleanData(g(this)),e&&e.replaceChild(t,this)}),e&&(e.length||e.nodeType)?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t){e=Q.apply([],e);var i,r,n,o,s,a,l=0,u=this.length,p=this,c=u-1,d=e[0],E=ot.isFunction(d);if(E||u>1&&"string"==typeof d&&!rt.checkClone&&zt.test(d))return this.each(function(i){var r=p.eq(i);E&&(e[0]=d.call(this,i,r.html())),r.domManip(e,t)});if(u&&(a=ot.buildFragment(e,this[0].ownerDocument,!1,this),i=a.firstChild,1===a.childNodes.length&&(a=i),i)){for(o=ot.map(g(a,"script"),N),n=o.length;u>l;l++)r=a,l!==c&&(r=ot.clone(r,!0,!0),n&&ot.merge(o,g(r,"script"))),t.call(this[l],r,l);if(n)for(s=o[o.length-1].ownerDocument,ot.map(o,L),l=0;n>l;l++)r=o[l],Xt.test(r.type||"")&&!ot._data(r,"globalEval")&&ot.contains(s,r)&&(r.src?ot._evalUrl&&ot._evalUrl(r.src):ot.globalEval((r.text||r.textContent||r.innerHTML||"").replace(Kt,"")));a=i=null}return this}}),ot.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){ot.fn[e]=function(e){for(var i,r=0,n=[],o=ot(e),s=o.length-1;s>=r;r++)i=r===s?this:this.clone(!0),ot(o[r])[t](i),Z.apply(n,i.get());return this.pushStack(n)}});var Jt,ei={};!function(){var e;rt.shrinkWrapBlocks=function(){if(null!=e)return e;e=!1;var t,i,r;return i=ft.getElementsByTagName("body")[0],i&&i.style?(t=ft.createElement("div"),r=ft.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",i.appendChild(r).appendChild(t),typeof t.style.zoom!==yt&&(t.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",t.appendChild(ft.createElement("div")).style.width="5px",e=3!==t.offsetWidth),i.removeChild(r),e):void 0}}();var ti,ii,ri=/^margin/,ni=new RegExp("^("+Ct+")(?!px)[a-z%]+$","i"),oi=/^(top|right|bottom|left)$/;t.getComputedStyle?(ti=function(e){return e.ownerDocument.defaultView.getComputedStyle(e,null)},ii=function(e,t,i){var r,n,o,s,a=e.style;return i=i||ti(e),s=i?i.getPropertyValue(t)||i[t]:void 0,i&&(""!==s||ot.contains(e.ownerDocument,e)||(s=ot.style(e,t)),ni.test(s)&&ri.test(t)&&(r=a.width,n=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=s,s=i.width,a.width=r,a.minWidth=n,a.maxWidth=o)),void 0===s?s:s+""}):ft.documentElement.currentStyle&&(ti=function(e){return e.currentStyle},ii=function(e,t,i){var r,n,o,s,a=e.style;return i=i||ti(e),s=i?i[t]:void 0,null==s&&a&&a[t]&&(s=a[t]),ni.test(s)&&!oi.test(t)&&(r=a.left,n=e.runtimeStyle,o=n&&n.left,o&&(n.left=e.currentStyle.left),a.left="fontSize"===t?"1em":s,s=a.pixelLeft+"px",a.left=r,o&&(n.left=o)),void 0===s?s:s+""||"auto"}),function(){function e(){var e,i,r,n;i=ft.getElementsByTagName("body")[0],i&&i.style&&(e=ft.createElement("div"),r=ft.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",i.appendChild(r).appendChild(e),e.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",o=s=!1,l=!0,t.getComputedStyle&&(o="1%"!==(t.getComputedStyle(e,null)||{}).top,s="4px"===(t.getComputedStyle(e,null)||{width:"4px"}).width,n=e.appendChild(ft.createElement("div")),n.style.cssText=e.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",n.style.marginRight=n.style.width="0",e.style.width="1px",l=!parseFloat((t.getComputedStyle(n,null)||{}).marginRight)),e.innerHTML="<table><tr><td></td><td>t</td></tr></table>",n=e.getElementsByTagName("td"),n[0].style.cssText="margin:0;border:0;padding:0;display:none",a=0===n[0].offsetHeight,a&&(n[0].style.display="",n[1].style.display="none",a=0===n[0].offsetHeight),i.removeChild(r))}var i,r,n,o,s,a,l;i=ft.createElement("div"),i.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=i.getElementsByTagName("a")[0],r=n&&n.style,r&&(r.cssText="float:left;opacity:.5",rt.opacity="0.5"===r.opacity,rt.cssFloat=!!r.cssFloat,i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",rt.clearCloneStyle="content-box"===i.style.backgroundClip,rt.boxSizing=""===r.boxSizing||""===r.MozBoxSizing||""===r.WebkitBoxSizing,ot.extend(rt,{reliableHiddenOffsets:function(){return null==a&&e(),a},boxSizingReliable:function(){return null==s&&e(),s},pixelPosition:function(){return null==o&&e(),o},reliableMarginRight:function(){return null==l&&e(),l}}))}(),ot.swap=function(e,t,i,r){var n,o,s={};for(o in t)s[o]=e.style[o],e.style[o]=t[o];n=i.apply(e,r||[]);for(o in t)e.style[o]=s[o];return n};var si=/alpha\([^)]*\)/i,ai=/opacity\s*=\s*([^)]*)/,li=/^(none|table(?!-c[ea]).+)/,ui=new RegExp("^("+Ct+")(.*)$","i"),pi=new RegExp("^([+-])=("+Ct+")","i"),ci={position:"absolute",visibility:"hidden",display:"block"},di={letterSpacing:"0",fontWeight:"400"},Ei=["Webkit","O","Moz","ms"];ot.extend({cssHooks:{opacity:{get:function(e,t){if(t){var i=ii(e,"opacity");return""===i?"1":i}}}},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":rt.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,i,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var n,o,s,a=ot.camelCase(t),l=e.style;if(t=ot.cssProps[a]||(ot.cssProps[a]=R(l,a)),s=ot.cssHooks[t]||ot.cssHooks[a],void 0===i)return s&&"get"in s&&void 0!==(n=s.get(e,!1,r))?n:l[t];if(o=typeof i,"string"===o&&(n=pi.exec(i))&&(i=(n[1]+1)*n[2]+parseFloat(ot.css(e,t)),o="number"),null!=i&&i===i&&("number"!==o||ot.cssNumber[a]||(i+="px"),rt.clearCloneStyle||""!==i||0!==t.indexOf("background")||(l[t]="inherit"),!(s&&"set"in s&&void 0===(i=s.set(e,i,r)))))try{l[t]=i}catch(u){}}},css:function(e,t,i,r){var n,o,s,a=ot.camelCase(t);return t=ot.cssProps[a]||(ot.cssProps[a]=R(e.style,a)),s=ot.cssHooks[t]||ot.cssHooks[a],s&&"get"in s&&(o=s.get(e,!0,i)),void 0===o&&(o=ii(e,t,r)),"normal"===o&&t in di&&(o=di[t]),""===i||i?(n=parseFloat(o),i===!0||ot.isNumeric(n)?n||0:o):o}}),ot.each(["height","width"],function(e,t){ot.cssHooks[t]={get:function(e,i,r){return i?li.test(ot.css(e,"display"))&&0===e.offsetWidth?ot.swap(e,ci,function(){return D(e,t,r)}):D(e,t,r):void 0},set:function(e,i,r){var n=r&&ti(e);return O(e,i,r?P(e,t,r,rt.boxSizing&&"border-box"===ot.css(e,"boxSizing",!1,n),n):0)}}}),rt.opacity||(ot.cssHooks.opacity={get:function(e,t){return ai.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var i=e.style,r=e.currentStyle,n=ot.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||i.filter||"";i.zoom=1,(t>=1||""===t)&&""===ot.trim(o.replace(si,""))&&i.removeAttribute&&(i.removeAttribute("filter"),""===t||r&&!r.filter)||(i.filter=si.test(o)?o.replace(si,n):o+" "+n)}}),ot.cssHooks.marginRight=C(rt.reliableMarginRight,function(e,t){return t?ot.swap(e,{display:"inline-block"},ii,[e,"marginRight"]):void 0}),ot.each({margin:"",padding:"",border:"Width"},function(e,t){ot.cssHooks[e+t]={expand:function(i){for(var r=0,n={},o="string"==typeof i?i.split(" "):[i];4>r;r++)n[e+Rt[r]+t]=o[r]||o[r-2]||o[0];return n}},ri.test(e)||(ot.cssHooks[e+t].set=O)}),ot.fn.extend({css:function(e,t){return Ot(this,function(e,t,i){var r,n,o={},s=0;if(ot.isArray(t)){for(r=ti(e),n=t.length;n>s;s++)o[t[s]]=ot.css(e,t[s],!1,r);return o}return void 0!==i?ot.style(e,t,i):ot.css(e,t)},e,t,arguments.length>1)},show:function(){return b(this,!0)},hide:function(){return b(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){bt(this)?ot(this).show():ot(this).hide()})}}),ot.Tween=_,_.prototype={constructor:_,init:function(e,t,i,r,n,o){this.elem=e,this.prop=i,this.easing=n||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(ot.cssNumber[i]?"":"px")},cur:function(){var e=_.propHooks[this.prop];return e&&e.get?e.get(this):_.propHooks._default.get(this)},run:function(e){var t,i=_.propHooks[this.prop];return this.pos=t=this.options.duration?ot.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),i&&i.set?i.set(this):_.propHooks._default.set(this),this}},_.prototype.init.prototype=_.prototype,_.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=ot.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){ot.fx.step[e.prop]?ot.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[ot.cssProps[e.prop]]||ot.cssHooks[e.prop])?ot.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},_.propHooks.scrollTop=_.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ot.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},ot.fx=_.prototype.init,ot.fx.step={};var hi,fi,mi=/^(?:toggle|show|hide)$/,gi=new RegExp("^(?:([+-])=|)("+Ct+")([a-z%]*)$","i"),vi=/queueHooks$/,xi=[k],Ni={"*":[function(e,t){var i=this.createTween(e,t),r=i.cur(),n=gi.exec(t),o=n&&n[3]||(ot.cssNumber[e]?"":"px"),s=(ot.cssNumber[e]||"px"!==o&&+r)&&gi.exec(ot.css(i.elem,e)),a=1,l=20;if(s&&s[3]!==o){o=o||s[3],n=n||[],s=+r||1;do a=a||".5",s/=a,ot.style(i.elem,e,s+o);while(a!==(a=i.cur()/r)&&1!==a&&--l)}return n&&(s=i.start=+s||+r||0,i.unit=o,i.end=n[1]?s+(n[1]+1)*n[2]:+n[2]),i}]};ot.Animation=ot.extend(U,{tweener:function(e,t){ot.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var i,r=0,n=e.length;n>r;r++)i=e[r],Ni[i]=Ni[i]||[],Ni[i].unshift(t)},prefilter:function(e,t){t?xi.unshift(e):xi.push(e)}}),ot.speed=function(e,t,i){var r=e&&"object"==typeof e?ot.extend({},e):{complete:i||!i&&t||ot.isFunction(e)&&e,duration:e,easing:i&&t||t&&!ot.isFunction(t)&&t};return r.duration=ot.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in ot.fx.speeds?ot.fx.speeds[r.duration]:ot.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){ot.isFunction(r.old)&&r.old.call(this),r.queue&&ot.dequeue(this,r.queue)},r},ot.fn.extend({fadeTo:function(e,t,i,r){return this.filter(bt).css("opacity",0).show().end().animate({opacity:t},e,i,r)},animate:function(e,t,i,r){var n=ot.isEmptyObject(e),o=ot.speed(t,i,r),s=function(){var t=U(this,ot.extend({},e),o);(n||ot._data(this,"finish"))&&t.stop(!0)};return s.finish=s,n||o.queue===!1?this.each(s):this.queue(o.queue,s)},stop:function(e,t,i){var r=function(e){var t=e.stop;delete e.stop,t(i)};return"string"!=typeof e&&(i=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=ot.timers,s=ot._data(this);if(n)s[n]&&s[n].stop&&r(s[n]);else for(n in s)s[n]&&s[n].stop&&vi.test(n)&&r(s[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(i),t=!1,o.splice(n,1));(t||!i)&&ot.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,i=ot._data(this),r=i[e+"queue"],n=i[e+"queueHooks"],o=ot.timers,s=r?r.length:0;for(i.finish=!0,ot.queue(this,e,[]),n&&n.stop&&n.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;s>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete i.finish})}}),ot.each(["toggle","show","hide"],function(e,t){var i=ot.fn[t];ot.fn[t]=function(e,r,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(w(t,!0),e,r,n)}}),ot.each({slideDown:w("show"),slideUp:w("hide"),slideToggle:w("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){ot.fn[e]=function(e,i,r){return this.animate(t,e,i,r)}}),ot.timers=[],ot.fx.tick=function(){var e,t=ot.timers,i=0;for(hi=ot.now();i<t.length;i++)e=t[i],e()||t[i]!==e||t.splice(i--,1);t.length||ot.fx.stop(),hi=void 0},ot.fx.timer=function(e){ot.timers.push(e),e()?ot.fx.start():ot.timers.pop()},ot.fx.interval=13,ot.fx.start=function(){fi||(fi=setInterval(ot.fx.tick,ot.fx.interval))},ot.fx.stop=function(){clearInterval(fi),fi=null},ot.fx.speeds={slow:600,fast:200,_default:400},ot.fn.delay=function(e,t){return e=ot.fx?ot.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,i){var r=setTimeout(t,e);i.stop=function(){clearTimeout(r)}})},function(){var e,t,i,r,n;t=ft.createElement("div"),t.setAttribute("className","t"),t.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",r=t.getElementsByTagName("a")[0],i=ft.createElement("select"),n=i.appendChild(ft.createElement("option")),e=t.getElementsByTagName("input")[0],r.style.cssText="top:1px",rt.getSetAttribute="t"!==t.className,rt.style=/top/.test(r.getAttribute("style")),rt.hrefNormalized="/a"===r.getAttribute("href"),rt.checkOn=!!e.value,rt.optSelected=n.selected,rt.enctype=!!ft.createElement("form").enctype,i.disabled=!0,rt.optDisabled=!n.disabled,e=ft.createElement("input"),e.setAttribute("value",""),rt.input=""===e.getAttribute("value"),e.value="t",e.setAttribute("type","radio"),rt.radioValue="t"===e.value}();var Li=/\r/g;ot.fn.extend({val:function(e){var t,i,r,n=this[0];{if(arguments.length)return r=ot.isFunction(e),this.each(function(i){var n;1===this.nodeType&&(n=r?e.call(this,i,ot(this).val()):e,null==n?n="":"number"==typeof n?n+="":ot.isArray(n)&&(n=ot.map(n,function(e){return null==e?"":e+""})),t=ot.valHooks[this.type]||ot.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,n,"value")||(this.value=n))});if(n)return t=ot.valHooks[n.type]||ot.valHooks[n.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(i=t.get(n,"value"))?i:(i=n.value,"string"==typeof i?i.replace(Li,""):null==i?"":i)}}}),ot.extend({valHooks:{option:{get:function(e){var t=ot.find.attr(e,"value");return null!=t?t:ot.trim(ot.text(e))}},select:{get:function(e){for(var t,i,r=e.options,n=e.selectedIndex,o="select-one"===e.type||0>n,s=o?null:[],a=o?n+1:r.length,l=0>n?a:o?n:0;a>l;l++)if(i=r[l],!(!i.selected&&l!==n||(rt.optDisabled?i.disabled:null!==i.getAttribute("disabled"))||i.parentNode.disabled&&ot.nodeName(i.parentNode,"optgroup"))){if(t=ot(i).val(),o)return t;s.push(t)}return s},set:function(e,t){for(var i,r,n=e.options,o=ot.makeArray(t),s=n.length;s--;)if(r=n[s],ot.inArray(ot.valHooks.option.get(r),o)>=0)try{r.selected=i=!0}catch(a){r.scrollHeight}else r.selected=!1;return i||(e.selectedIndex=-1),n}}}}),ot.each(["radio","checkbox"],function(){ot.valHooks[this]={set:function(e,t){return ot.isArray(t)?e.checked=ot.inArray(ot(e).val(),t)>=0:void 0}},rt.checkOn||(ot.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Ii,Ti,yi=ot.expr.attrHandle,Ai=/^(?:checked|selected)$/i,Si=rt.getSetAttribute,Ci=rt.input;ot.fn.extend({attr:function(e,t){return Ot(this,ot.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){ot.removeAttr(this,e)})}}),ot.extend({attr:function(e,t,i){var r,n,o=e.nodeType;if(e&&3!==o&&8!==o&&2!==o)return typeof e.getAttribute===yt?ot.prop(e,t,i):(1===o&&ot.isXMLDoc(e)||(t=t.toLowerCase(),r=ot.attrHooks[t]||(ot.expr.match.bool.test(t)?Ti:Ii)),void 0===i?r&&"get"in r&&null!==(n=r.get(e,t))?n:(n=ot.find.attr(e,t),null==n?void 0:n):null!==i?r&&"set"in r&&void 0!==(n=r.set(e,i,t))?n:(e.setAttribute(t,i+""),i):void ot.removeAttr(e,t))},removeAttr:function(e,t){var i,r,n=0,o=t&&t.match(Nt);if(o&&1===e.nodeType)for(;i=o[n++];)r=ot.propFix[i]||i,ot.expr.match.bool.test(i)?Ci&&Si||!Ai.test(i)?e[r]=!1:e[ot.camelCase("default-"+i)]=e[r]=!1:ot.attr(e,i,""),e.removeAttribute(Si?i:r)},attrHooks:{type:{set:function(e,t){if(!rt.radioValue&&"radio"===t&&ot.nodeName(e,"input")){var i=e.value;return e.setAttribute("type",t),i&&(e.value=i),t}}}}}),Ti={set:function(e,t,i){return t===!1?ot.removeAttr(e,i):Ci&&Si||!Ai.test(i)?e.setAttribute(!Si&&ot.propFix[i]||i,i):e[ot.camelCase("default-"+i)]=e[i]=!0,i}},ot.each(ot.expr.match.bool.source.match(/\w+/g),function(e,t){var i=yi[t]||ot.find.attr;yi[t]=Ci&&Si||!Ai.test(t)?function(e,t,r){var n,o;return r||(o=yi[t],yi[t]=n,n=null!=i(e,t,r)?t.toLowerCase():null,yi[t]=o),n}:function(e,t,i){return i?void 0:e[ot.camelCase("default-"+t)]?t.toLowerCase():null}}),Ci&&Si||(ot.attrHooks.value={set:function(e,t,i){return ot.nodeName(e,"input")?void(e.defaultValue=t):Ii&&Ii.set(e,t,i)}}),Si||(Ii={set:function(e,t,i){var r=e.getAttributeNode(i);return r||e.setAttributeNode(r=e.ownerDocument.createAttribute(i)),r.value=t+="","value"===i||t===e.getAttribute(i)?t:void 0}},yi.id=yi.name=yi.coords=function(e,t,i){var r;return i?void 0:(r=e.getAttributeNode(t))&&""!==r.value?r.value:null},ot.valHooks.button={get:function(e,t){var i=e.getAttributeNode(t);return i&&i.specified?i.value:void 0},set:Ii.set},ot.attrHooks.contenteditable={set:function(e,t,i){Ii.set(e,""===t?!1:t,i)}},ot.each(["width","height"],function(e,t){ot.attrHooks[t]={set:function(e,i){return""===i?(e.setAttribute(t,"auto"),i):void 0}}})),rt.style||(ot.attrHooks.style={get:function(e){return e.style.cssText||void 0},set:function(e,t){return e.style.cssText=t+""}});var Ri=/^(?:input|select|textarea|button|object)$/i,bi=/^(?:a|area)$/i;ot.fn.extend({prop:function(e,t){return Ot(this,ot.prop,e,t,arguments.length>1)},removeProp:function(e){return e=ot.propFix[e]||e,this.each(function(){try{this[e]=void 0,delete this[e] }catch(t){}})}}),ot.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(e,t,i){var r,n,o,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return o=1!==s||!ot.isXMLDoc(e),o&&(t=ot.propFix[t]||t,n=ot.propHooks[t]),void 0!==i?n&&"set"in n&&void 0!==(r=n.set(e,i,t))?r:e[t]=i:n&&"get"in n&&null!==(r=n.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=ot.find.attr(e,"tabindex");return t?parseInt(t,10):Ri.test(e.nodeName)||bi.test(e.nodeName)&&e.href?0:-1}}}}),rt.hrefNormalized||ot.each(["href","src"],function(e,t){ot.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),rt.optSelected||(ot.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),ot.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ot.propFix[this.toLowerCase()]=this}),rt.enctype||(ot.propFix.enctype="encoding");var Oi=/[\t\r\n\f]/g;ot.fn.extend({addClass:function(e){var t,i,r,n,o,s,a=0,l=this.length,u="string"==typeof e&&e;if(ot.isFunction(e))return this.each(function(t){ot(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(Nt)||[];l>a;a++)if(i=this[a],r=1===i.nodeType&&(i.className?(" "+i.className+" ").replace(Oi," "):" ")){for(o=0;n=t[o++];)r.indexOf(" "+n+" ")<0&&(r+=n+" ");s=ot.trim(r),i.className!==s&&(i.className=s)}return this},removeClass:function(e){var t,i,r,n,o,s,a=0,l=this.length,u=0===arguments.length||"string"==typeof e&&e;if(ot.isFunction(e))return this.each(function(t){ot(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(Nt)||[];l>a;a++)if(i=this[a],r=1===i.nodeType&&(i.className?(" "+i.className+" ").replace(Oi," "):"")){for(o=0;n=t[o++];)for(;r.indexOf(" "+n+" ")>=0;)r=r.replace(" "+n+" "," ");s=e?ot.trim(r):"",i.className!==s&&(i.className=s)}return this},toggleClass:function(e,t){var i=typeof e;return"boolean"==typeof t&&"string"===i?t?this.addClass(e):this.removeClass(e):this.each(ot.isFunction(e)?function(i){ot(this).toggleClass(e.call(this,i,this.className,t),t)}:function(){if("string"===i)for(var t,r=0,n=ot(this),o=e.match(Nt)||[];t=o[r++];)n.hasClass(t)?n.removeClass(t):n.addClass(t);else(i===yt||"boolean"===i)&&(this.className&&ot._data(this,"__className__",this.className),this.className=this.className||e===!1?"":ot._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",i=0,r=this.length;r>i;i++)if(1===this[i].nodeType&&(" "+this[i].className+" ").replace(Oi," ").indexOf(t)>=0)return!0;return!1}}),ot.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){ot.fn[t]=function(e,i){return arguments.length>0?this.on(t,null,e,i):this.trigger(t)}}),ot.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,i){return this.on(e,null,t,i)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,i,r){return this.on(t,e,i,r)},undelegate:function(e,t,i){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",i)}});var Pi=ot.now(),Di=/\?/,_i=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;ot.parseJSON=function(e){if(t.JSON&&t.JSON.parse)return t.JSON.parse(e+"");var i,r=null,n=ot.trim(e+"");return n&&!ot.trim(n.replace(_i,function(e,t,n,o){return i&&t&&(r=0),0===r?e:(i=n||t,r+=!o-!n,"")}))?Function("return "+n)():ot.error("Invalid JSON: "+e)},ot.parseXML=function(e){var i,r;if(!e||"string"!=typeof e)return null;try{t.DOMParser?(r=new DOMParser,i=r.parseFromString(e,"text/xml")):(i=new ActiveXObject("Microsoft.XMLDOM"),i.async="false",i.loadXML(e))}catch(n){i=void 0}return i&&i.documentElement&&!i.getElementsByTagName("parsererror").length||ot.error("Invalid XML: "+e),i};var Mi,wi,Gi=/#.*$/,ki=/([?&])_=[^&]*/,Bi=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Ui=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Vi=/^(?:GET|HEAD)$/,Hi=/^\/\//,Fi=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,ji={},Wi={},qi="*/".concat("*");try{wi=location.href}catch(zi){wi=ft.createElement("a"),wi.href="",wi=wi.href}Mi=Fi.exec(wi.toLowerCase())||[],ot.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:wi,type:"GET",isLocal:Ui.test(Mi[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":qi,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":ot.parseJSON,"text xml":ot.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?F(F(e,ot.ajaxSettings),t):F(ot.ajaxSettings,e)},ajaxPrefilter:V(ji),ajaxTransport:V(Wi),ajax:function(e,t){function i(e,t,i,r){var n,p,g,v,N,I=t;2!==x&&(x=2,a&&clearTimeout(a),u=void 0,s=r||"",L.readyState=e>0?4:0,n=e>=200&&300>e||304===e,i&&(v=j(c,L,i)),v=W(c,v,L,n),n?(c.ifModified&&(N=L.getResponseHeader("Last-Modified"),N&&(ot.lastModified[o]=N),N=L.getResponseHeader("etag"),N&&(ot.etag[o]=N)),204===e||"HEAD"===c.type?I="nocontent":304===e?I="notmodified":(I=v.state,p=v.data,g=v.error,n=!g)):(g=I,(e||!I)&&(I="error",0>e&&(e=0))),L.status=e,L.statusText=(t||I)+"",n?h.resolveWith(d,[p,I,L]):h.rejectWith(d,[L,I,g]),L.statusCode(m),m=void 0,l&&E.trigger(n?"ajaxSuccess":"ajaxError",[L,c,n?p:g]),f.fireWith(d,[L,I]),l&&(E.trigger("ajaxComplete",[L,c]),--ot.active||ot.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,n,o,s,a,l,u,p,c=ot.ajaxSetup({},t),d=c.context||c,E=c.context&&(d.nodeType||d.jquery)?ot(d):ot.event,h=ot.Deferred(),f=ot.Callbacks("once memory"),m=c.statusCode||{},g={},v={},x=0,N="canceled",L={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!p)for(p={};t=Bi.exec(s);)p[t[1].toLowerCase()]=t[2];t=p[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?s:null},setRequestHeader:function(e,t){var i=e.toLowerCase();return x||(e=v[i]=v[i]||e,g[e]=t),this},overrideMimeType:function(e){return x||(c.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else L.always(e[L.status]);return this},abort:function(e){var t=e||N;return u&&u.abort(t),i(0,t),this}};if(h.promise(L).complete=f.add,L.success=L.done,L.error=L.fail,c.url=((e||c.url||wi)+"").replace(Gi,"").replace(Hi,Mi[1]+"//"),c.type=t.method||t.type||c.method||c.type,c.dataTypes=ot.trim(c.dataType||"*").toLowerCase().match(Nt)||[""],null==c.crossDomain&&(r=Fi.exec(c.url.toLowerCase()),c.crossDomain=!(!r||r[1]===Mi[1]&&r[2]===Mi[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(Mi[3]||("http:"===Mi[1]?"80":"443")))),c.data&&c.processData&&"string"!=typeof c.data&&(c.data=ot.param(c.data,c.traditional)),H(ji,c,t,L),2===x)return L;l=c.global,l&&0===ot.active++&&ot.event.trigger("ajaxStart"),c.type=c.type.toUpperCase(),c.hasContent=!Vi.test(c.type),o=c.url,c.hasContent||(c.data&&(o=c.url+=(Di.test(o)?"&":"?")+c.data,delete c.data),c.cache===!1&&(c.url=ki.test(o)?o.replace(ki,"$1_="+Pi++):o+(Di.test(o)?"&":"?")+"_="+Pi++)),c.ifModified&&(ot.lastModified[o]&&L.setRequestHeader("If-Modified-Since",ot.lastModified[o]),ot.etag[o]&&L.setRequestHeader("If-None-Match",ot.etag[o])),(c.data&&c.hasContent&&c.contentType!==!1||t.contentType)&&L.setRequestHeader("Content-Type",c.contentType),L.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+("*"!==c.dataTypes[0]?", "+qi+"; q=0.01":""):c.accepts["*"]);for(n in c.headers)L.setRequestHeader(n,c.headers[n]);if(c.beforeSend&&(c.beforeSend.call(d,L,c)===!1||2===x))return L.abort();N="abort";for(n in{success:1,error:1,complete:1})L[n](c[n]);if(u=H(Wi,c,t,L)){L.readyState=1,l&&E.trigger("ajaxSend",[L,c]),c.async&&c.timeout>0&&(a=setTimeout(function(){L.abort("timeout")},c.timeout));try{x=1,u.send(g,i)}catch(I){if(!(2>x))throw I;i(-1,I)}}else i(-1,"No Transport");return L},getJSON:function(e,t,i){return ot.get(e,t,i,"json")},getScript:function(e,t){return ot.get(e,void 0,t,"script")}}),ot.each(["get","post"],function(e,t){ot[t]=function(e,i,r,n){return ot.isFunction(i)&&(n=n||r,r=i,i=void 0),ot.ajax({url:e,type:t,dataType:n,data:i,success:r})}}),ot.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ot.fn[t]=function(e){return this.on(t,e)}}),ot._evalUrl=function(e){return ot.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},ot.fn.extend({wrapAll:function(e){if(ot.isFunction(e))return this.each(function(t){ot(this).wrapAll(e.call(this,t))});if(this[0]){var t=ot(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return this.each(ot.isFunction(e)?function(t){ot(this).wrapInner(e.call(this,t))}:function(){var t=ot(this),i=t.contents();i.length?i.wrapAll(e):t.append(e)})},wrap:function(e){var t=ot.isFunction(e);return this.each(function(i){ot(this).wrapAll(t?e.call(this,i):e)})},unwrap:function(){return this.parent().each(function(){ot.nodeName(this,"body")||ot(this).replaceWith(this.childNodes)}).end()}}),ot.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0||!rt.reliableHiddenOffsets()&&"none"===(e.style&&e.style.display||ot.css(e,"display"))},ot.expr.filters.visible=function(e){return!ot.expr.filters.hidden(e)};var Xi=/%20/g,Yi=/\[\]$/,Ki=/\r?\n/g,$i=/^(?:submit|button|image|reset|file)$/i,Qi=/^(?:input|select|textarea|keygen)/i;ot.param=function(e,t){var i,r=[],n=function(e,t){t=ot.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=ot.ajaxSettings&&ot.ajaxSettings.traditional),ot.isArray(e)||e.jquery&&!ot.isPlainObject(e))ot.each(e,function(){n(this.name,this.value)});else for(i in e)q(i,e[i],t,n);return r.join("&").replace(Xi,"+")},ot.fn.extend({serialize:function(){return ot.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ot.prop(this,"elements");return e?ot.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ot(this).is(":disabled")&&Qi.test(this.nodeName)&&!$i.test(e)&&(this.checked||!Pt.test(e))}).map(function(e,t){var i=ot(this).val();return null==i?null:ot.isArray(i)?ot.map(i,function(e){return{name:t.name,value:e.replace(Ki,"\r\n")}}):{name:t.name,value:i.replace(Ki,"\r\n")}}).get()}}),ot.ajaxSettings.xhr=void 0!==t.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&z()||X()}:z;var Zi=0,Ji={},er=ot.ajaxSettings.xhr();t.ActiveXObject&&ot(t).on("unload",function(){for(var e in Ji)Ji[e](void 0,!0)}),rt.cors=!!er&&"withCredentials"in er,er=rt.ajax=!!er,er&&ot.ajaxTransport(function(e){if(!e.crossDomain||rt.cors){var t;return{send:function(i,r){var n,o=e.xhr(),s=++Zi;if(o.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(n in e.xhrFields)o[n]=e.xhrFields[n];e.mimeType&&o.overrideMimeType&&o.overrideMimeType(e.mimeType),e.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(n in i)void 0!==i[n]&&o.setRequestHeader(n,i[n]+"");o.send(e.hasContent&&e.data||null),t=function(i,n){var a,l,u;if(t&&(n||4===o.readyState))if(delete Ji[s],t=void 0,o.onreadystatechange=ot.noop,n)4!==o.readyState&&o.abort();else{u={},a=o.status,"string"==typeof o.responseText&&(u.text=o.responseText);try{l=o.statusText}catch(p){l=""}a||!e.isLocal||e.crossDomain?1223===a&&(a=204):a=u.text?200:404}u&&r(a,l,u,o.getAllResponseHeaders())},e.async?4===o.readyState?setTimeout(t):o.onreadystatechange=Ji[s]=t:t()},abort:function(){t&&t(void 0,!0)}}}}),ot.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return ot.globalEval(e),e}}}),ot.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),ot.ajaxTransport("script",function(e){if(e.crossDomain){var t,i=ft.head||ot("head")[0]||ft.documentElement;return{send:function(r,n){t=ft.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,i){(i||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,i||n(200,"success"))},i.insertBefore(t,i.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var tr=[],ir=/(=)\?(?=&|$)|\?\?/;ot.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=tr.pop()||ot.expando+"_"+Pi++;return this[e]=!0,e}}),ot.ajaxPrefilter("json jsonp",function(e,i,r){var n,o,s,a=e.jsonp!==!1&&(ir.test(e.url)?"url":"string"==typeof e.data&&!(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&ir.test(e.data)&&"data");return a||"jsonp"===e.dataTypes[0]?(n=e.jsonpCallback=ot.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(ir,"$1"+n):e.jsonp!==!1&&(e.url+=(Di.test(e.url)?"&":"?")+e.jsonp+"="+n),e.converters["script json"]=function(){return s||ot.error(n+" was not called"),s[0]},e.dataTypes[0]="json",o=t[n],t[n]=function(){s=arguments},r.always(function(){t[n]=o,e[n]&&(e.jsonpCallback=i.jsonpCallback,tr.push(n)),s&&ot.isFunction(o)&&o(s[0]),s=o=void 0}),"script"):void 0}),ot.parseHTML=function(e,t,i){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(i=t,t=!1),t=t||ft;var r=dt.exec(e),n=!i&&[];return r?[t.createElement(r[1])]:(r=ot.buildFragment([e],t,n),n&&n.length&&ot(n).remove(),ot.merge([],r.childNodes))};var rr=ot.fn.load;ot.fn.load=function(e,t,i){if("string"!=typeof e&&rr)return rr.apply(this,arguments);var r,n,o,s=this,a=e.indexOf(" ");return a>=0&&(r=ot.trim(e.slice(a,e.length)),e=e.slice(0,a)),ot.isFunction(t)?(i=t,t=void 0):t&&"object"==typeof t&&(o="POST"),s.length>0&&ot.ajax({url:e,type:o,dataType:"html",data:t}).done(function(e){n=arguments,s.html(r?ot("<div>").append(ot.parseHTML(e)).find(r):e)}).complete(i&&function(e,t){s.each(i,n||[e.responseText,t,e])}),this},ot.expr.filters.animated=function(e){return ot.grep(ot.timers,function(t){return e===t.elem}).length};var nr=t.document.documentElement;ot.offset={setOffset:function(e,t,i){var r,n,o,s,a,l,u,p=ot.css(e,"position"),c=ot(e),d={};"static"===p&&(e.style.position="relative"),a=c.offset(),o=ot.css(e,"top"),l=ot.css(e,"left"),u=("absolute"===p||"fixed"===p)&&ot.inArray("auto",[o,l])>-1,u?(r=c.position(),s=r.top,n=r.left):(s=parseFloat(o)||0,n=parseFloat(l)||0),ot.isFunction(t)&&(t=t.call(e,i,a)),null!=t.top&&(d.top=t.top-a.top+s),null!=t.left&&(d.left=t.left-a.left+n),"using"in t?t.using.call(e,d):c.css(d)}},ot.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){ot.offset.setOffset(this,e,t)});var t,i,r={top:0,left:0},n=this[0],o=n&&n.ownerDocument;if(o)return t=o.documentElement,ot.contains(t,n)?(typeof n.getBoundingClientRect!==yt&&(r=n.getBoundingClientRect()),i=Y(o),{top:r.top+(i.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(i.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):r},position:function(){if(this[0]){var e,t,i={top:0,left:0},r=this[0];return"fixed"===ot.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),ot.nodeName(e[0],"html")||(i=e.offset()),i.top+=ot.css(e[0],"borderTopWidth",!0),i.left+=ot.css(e[0],"borderLeftWidth",!0)),{top:t.top-i.top-ot.css(r,"marginTop",!0),left:t.left-i.left-ot.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||nr;e&&!ot.nodeName(e,"html")&&"static"===ot.css(e,"position");)e=e.offsetParent;return e||nr})}}),ot.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var i=/Y/.test(t);ot.fn[e]=function(r){return Ot(this,function(e,r,n){var o=Y(e);return void 0===n?o?t in o?o[t]:o.document.documentElement[r]:e[r]:void(o?o.scrollTo(i?ot(o).scrollLeft():n,i?n:ot(o).scrollTop()):e[r]=n)},e,r,arguments.length,null)}}),ot.each(["top","left"],function(e,t){ot.cssHooks[t]=C(rt.pixelPosition,function(e,i){return i?(i=ii(e,t),ni.test(i)?ot(e).position()[t]+"px":i):void 0})}),ot.each({Height:"height",Width:"width"},function(e,t){ot.each({padding:"inner"+e,content:t,"":"outer"+e},function(i,r){ot.fn[r]=function(r,n){var o=arguments.length&&(i||"boolean"!=typeof r),s=i||(r===!0||n===!0?"margin":"border");return Ot(this,function(t,i,r){var n;return ot.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(n=t.documentElement,Math.max(t.body["scroll"+e],n["scroll"+e],t.body["offset"+e],n["offset"+e],n["client"+e])):void 0===r?ot.css(t,i,s):ot.style(t,i,r,s)},t,o?r:void 0,o,null)}})}),ot.fn.size=function(){return this.length},ot.fn.andSelf=ot.fn.addBack,"function"==typeof e&&e.amd&&e("jquery",[],function(){return ot});var or=t.jQuery,sr=t.$;return ot.noConflict=function(e){return t.$===ot&&(t.$=sr),e&&t.jQuery===ot&&(t.jQuery=or),ot},typeof i===yt&&(t.jQuery=t.$=ot),ot})},{}],10:[function(t,i){!function(t){function r(){try{return u in t&&t[u]}catch(e){return!1}}function n(e){return function(){var t=Array.prototype.slice.call(arguments,0);t.unshift(s),c.appendChild(s),s.addBehavior("#default#userData"),s.load(u);var i=e.apply(a,t);return c.removeChild(s),i}}function o(e){return e.replace(/^d/,"___$&").replace(h,"___")}var s,a={},l=t.document,u="localStorage",p="script";if(a.disabled=!1,a.set=function(){},a.get=function(){},a.remove=function(){},a.clear=function(){},a.transact=function(e,t,i){var r=a.get(e);null==i&&(i=t,t=null),"undefined"==typeof r&&(r=t||{}),i(r),a.set(e,r)},a.getAll=function(){},a.forEach=function(){},a.serialize=function(e){return JSON.stringify(e)},a.deserialize=function(e){if("string"!=typeof e)return void 0;try{return JSON.parse(e)}catch(t){return e||void 0}},r())s=t[u],a.set=function(e,t){return void 0===t?a.remove(e):(s.setItem(e,a.serialize(t)),t)},a.get=function(e){return a.deserialize(s.getItem(e))},a.remove=function(e){s.removeItem(e)},a.clear=function(){s.clear()},a.getAll=function(){var e={};return a.forEach(function(t,i){e[t]=i}),e},a.forEach=function(e){for(var t=0;t<s.length;t++){var i=s.key(t);e(i,a.get(i))}};else if(l.documentElement.addBehavior){var c,d;try{d=new ActiveXObject("htmlfile"),d.open(),d.write("<"+p+">document.w=window</"+p+'><iframe src="/favicon.ico"></iframe>'),d.close(),c=d.w.frames[0].document,s=c.createElement("div")}catch(E){s=l.createElement("div"),c=l.body}var h=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");a.set=n(function(e,t,i){return t=o(t),void 0===i?a.remove(t):(e.setAttribute(t,a.serialize(i)),e.save(u),i)}),a.get=n(function(e,t){return t=o(t),a.deserialize(e.getAttribute(t))}),a.remove=n(function(e,t){t=o(t),e.removeAttribute(t),e.save(u)}),a.clear=n(function(e){var t=e.XMLDocument.documentElement.attributes;e.load(u);for(var i,r=0;i=t[r];r++)e.removeAttribute(i.name);e.save(u)}),a.getAll=function(){var e={};return a.forEach(function(t,i){e[t]=i}),e},a.forEach=n(function(e,t){for(var i,r=e.XMLDocument.documentElement.attributes,n=0;i=r[n];++n)t(i.name,a.deserialize(e.getAttribute(i.name)))})}try{var f="__storejs__";a.set(f,f),a.get(f)!=f&&(a.disabled=!0),a.remove(f)}catch(E){a.disabled=!0}a.enabled=!a.disabled,"undefined"!=typeof i&&i.exports&&this.module!==i?i.exports=a:"function"==typeof e&&e.amd?e(a):t.store=a}(Function("return this")())},{}],11:[function(e,t){t.exports=function(t){return e("jquery")(t).closest("[id]").attr("id")}},{jquery:9}],12:[function(e,t){var i=e("jquery"),r=t.exports={cross:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="30px" height="30px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"><g> <path d="M83.288,88.13c-2.114,2.112-5.575,2.112-7.689,0L53.659,66.188c-2.114-2.112-5.573-2.112-7.687,0L24.251,87.907 c-2.113,2.114-5.571,2.114-7.686,0l-4.693-4.691c-2.114-2.114-2.114-5.573,0-7.688l21.719-21.721c2.113-2.114,2.113-5.573,0-7.686 L11.872,24.4c-2.114-2.113-2.114-5.571,0-7.686l4.842-4.842c2.113-2.114,5.571-2.114,7.686,0L46.12,33.591 c2.114,2.114,5.572,2.114,7.688,0l21.721-21.719c2.114-2.114,5.573-2.114,7.687,0l4.695,4.695c2.111,2.113,2.111,5.571-0.003,7.686 L66.188,45.973c-2.112,2.114-2.112,5.573,0,7.686L88.13,75.602c2.112,2.111,2.112,5.572,0,7.687L83.288,88.13z"/></g></svg>',check:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="30px" height="30px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve"><path fill="#000000" d="M14.301,49.982l22.606,17.047L84.361,4.903c2.614-3.733,7.76-4.64,11.493-2.026l0.627,0.462 c3.732,2.614,4.64,7.758,2.025,11.492l-51.783,79.77c-1.955,2.791-3.896,3.762-7.301,3.988c-3.405,0.225-5.464-1.039-7.508-3.084 L2.447,61.814c-3.263-3.262-3.263-8.553,0-11.814l0.041-0.019C5.75,46.718,11.039,46.718,14.301,49.982z"/></svg>',unsorted:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="Layer_1" x="0px" y="0px" width="54.552711" height="113.78478" viewBox="0 0 54.552711 113.78478" enable-background="new 0 0 100 100" xml:space="preserve"><g id="g5" transform="matrix(-0.70522156,-0.70898699,-0.70898699,0.70522156,97.988199,55.081205)"><path style="fill:#000000" inkscape:connector-curvature="0" id="path7" d="M 57.911,66.915 45.808,55.063 42.904,52.238 31.661,41.25 31.435,41.083 31.131,40.775 30.794,40.523 30.486,40.3 30.069,40.05 29.815,39.911 29.285,39.659 29.089,39.576 28.474,39.326 28.363,39.297 H 28.336 L 27.665,39.128 27.526,39.1 26.94,38.99 26.714,38.961 26.212,38.934 h -0.31 -0.444 l -0.339,0.027 c -1.45,0.139 -2.876,0.671 -4.11,1.564 l -0.223,0.141 -0.279,0.25 -0.335,0.308 -0.054,0.029 -0.171,0.194 -0.334,0.364 -0.224,0.279 -0.25,0.336 -0.225,0.362 -0.192,0.308 -0.197,0.421 -0.142,0.279 -0.193,0.477 -0.084,0.222 -12.441,38.414 c -0.814,2.458 -0.313,5.029 1.115,6.988 v 0.026 l 0.418,0.532 0.17,0.165 0.251,0.281 0.084,0.079 0.283,0.281 0.25,0.194 0.474,0.367 0.083,0.053 c 2.015,1.371 4.641,1.874 7.131,1.094 L 55.228,80.776 c 4.303,-1.342 6.679,-5.814 5.308,-10.006 -0.387,-1.259 -1.086,-2.35 -1.979,-3.215 l -0.368,-0.337 -0.278,-0.303 z m -6.318,5.896 0.079,0.114 -37.369,11.57 11.854,-36.538 10.565,10.317 2.876,2.825 11.995,11.712 z" /></g><path style="fill:#000000" inkscape:connector-curvature="0" id="path7-9" d="m 8.8748339,52.571766 16.9382111,-0.222584 4.050851,-0.06665 15.719154,-0.222166 0.27778,-0.04246 0.43276,0.0017 0.41632,-0.06121 0.37532,-0.0611 0.47132,-0.119342 0.27767,-0.08206 0.55244,-0.198047 0.19707,-0.08043 0.61095,-0.259721 0.0988,-0.05825 0.019,-0.01914 0.59303,-0.356548 0.11787,-0.0788 0.49125,-0.337892 0.17994,-0.139779 0.37317,-0.336871 0.21862,-0.219786 0.31311,-0.31479 0.21993,-0.259387 c 0.92402,-1.126057 1.55249,-2.512251 1.78961,-4.016904 l 0.0573,-0.25754 0.0195,-0.374113 0.0179,-0.454719 0.0175,-0.05874 -0.0169,-0.258049 -0.0225,-0.493503 -0.0398,-0.355569 -0.0619,-0.414201 -0.098,-0.414812 -0.083,-0.353334 L 53.23955,41.1484 53.14185,40.850967 52.93977,40.377742 52.84157,40.161628 34.38021,4.2507375 C 33.211567,1.9401875 31.035446,0.48226552 28.639484,0.11316952 l -0.01843,-0.01834 -0.671963,-0.07882 -0.236871,0.0042 L 27.335984,-4.7826577e-7 27.220736,0.00379952 l -0.398804,0.0025 -0.313848,0.04043 -0.594474,0.07724 -0.09611,0.02147 C 23.424549,0.60716252 21.216017,2.1142355 20.013025,4.4296865 L 0.93967491,40.894479 c -2.08310801,3.997178 -0.588125,8.835482 3.35080799,10.819749 1.165535,0.613495 2.43199,0.88731 3.675026,0.864202 l 0.49845,-0.02325 0.410875,0.01658 z M 9.1502369,43.934401 9.0136999,43.910011 27.164145,9.2564625 44.70942,43.42818 l -14.765289,0.214677 -4.031106,0.0468 -16.7627881,0.244744 z" /></svg>',sortDesc:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="Layer_1" x="0px" y="0px" width="54.552711" height="113.78478" viewBox="0 0 54.552711 113.78478" enable-background="new 0 0 100 100" xml:space="preserve"><g id="g5" transform="matrix(-0.70522156,-0.70898699,-0.70898699,0.70522156,97.988199,55.081205)"><path style="fill:#000000" inkscape:connector-curvature="0" id="path7" d="M 57.911,66.915 45.808,55.063 42.904,52.238 31.661,41.25 31.435,41.083 31.131,40.775 30.794,40.523 30.486,40.3 30.069,40.05 29.815,39.911 29.285,39.659 29.089,39.576 28.474,39.326 28.363,39.297 H 28.336 L 27.665,39.128 27.526,39.1 26.94,38.99 26.714,38.961 26.212,38.934 h -0.31 -0.444 l -0.339,0.027 c -1.45,0.139 -2.876,0.671 -4.11,1.564 l -0.223,0.141 -0.279,0.25 -0.335,0.308 -0.054,0.029 -0.171,0.194 -0.334,0.364 -0.224,0.279 -0.25,0.336 -0.225,0.362 -0.192,0.308 -0.197,0.421 -0.142,0.279 -0.193,0.477 -0.084,0.222 -12.441,38.414 c -0.814,2.458 -0.313,5.029 1.115,6.988 v 0.026 l 0.418,0.532 0.17,0.165 0.251,0.281 0.084,0.079 0.283,0.281 0.25,0.194 0.474,0.367 0.083,0.053 c 2.015,1.371 4.641,1.874 7.131,1.094 L 55.228,80.776 c 4.303,-1.342 6.679,-5.814 5.308,-10.006 -0.387,-1.259 -1.086,-2.35 -1.979,-3.215 l -0.368,-0.337 -0.278,-0.303 z m -6.318,5.896 0.079,0.114 -37.369,11.57 11.854,-36.538 10.565,10.317 2.876,2.825 11.995,11.712 z" /></g><path style="fill:#000000" inkscape:connector-curvature="0" id="path9" d="m 27.813273,0.12823506 0.09753,0.02006 c 2.39093,0.458209 4.599455,1.96811104 5.80244,4.28639004 L 52.785897,40.894525 c 2.088044,4.002139 0.590949,8.836902 -3.348692,10.821875 -1.329078,0.688721 -2.766603,0.943695 -4.133174,0.841768 l -0.454018,0.02 L 27.910392,52.354171 23.855313,52.281851 8.14393,52.061827 7.862608,52.021477 7.429856,52.021738 7.014241,51.959818 6.638216,51.900838 6.164776,51.779369 5.889216,51.699439 5.338907,51.500691 5.139719,51.419551 4.545064,51.145023 4.430618,51.105123 4.410168,51.084563 3.817138,50.730843 3.693615,50.647783 3.207314,50.310611 3.028071,50.174369 2.652795,49.833957 2.433471,49.613462 2.140099,49.318523 1.901127,49.041407 C 0.97781,47.916059 0.347935,46.528448 0.11153,45.021676 L 0.05352,44.766255 0.05172,44.371683 0.01894,43.936017 0,43.877277 0.01836,43.62206 0.03666,43.122889 0.0765,42.765905 0.13912,42.352413 0.23568,41.940425 0.32288,41.588517 0.481021,41.151945 0.579391,40.853806 0.77369,40.381268 0.876097,40.162336 19.338869,4.2542801 c 1.172169,-2.308419 3.34759,-3.76846504 5.740829,-4.17716604 l 0.01975,0.01985 0.69605,-0.09573 0.218437,0.0225 0.490791,-0.02132 0.39809,0.0046 0.315972,0.03973 0.594462,0.08149 z" /></svg>',sortAsc:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" id="Layer_1" x="0px" y="0px" width="54.552711" height="113.78478" viewBox="0 0 54.552711 113.78478" enable-background="new 0 0 100 100" xml:space="preserve"><g id="g5" transform="matrix(-0.70522156,0.70898699,-0.70898699,-0.70522156,97.988199,58.704807)"><path style="fill:#000000" inkscape:connector-curvature="0" id="path7" d="M 57.911,66.915 45.808,55.063 42.904,52.238 31.661,41.25 31.435,41.083 31.131,40.775 30.794,40.523 30.486,40.3 30.069,40.05 29.815,39.911 29.285,39.659 29.089,39.576 28.474,39.326 28.363,39.297 H 28.336 L 27.665,39.128 27.526,39.1 26.94,38.99 26.714,38.961 26.212,38.934 h -0.31 -0.444 l -0.339,0.027 c -1.45,0.139 -2.876,0.671 -4.11,1.564 l -0.223,0.141 -0.279,0.25 -0.335,0.308 -0.054,0.029 -0.171,0.194 -0.334,0.364 -0.224,0.279 -0.25,0.336 -0.225,0.362 -0.192,0.308 -0.197,0.421 -0.142,0.279 -0.193,0.477 -0.084,0.222 -12.441,38.414 c -0.814,2.458 -0.313,5.029 1.115,6.988 v 0.026 l 0.418,0.532 0.17,0.165 0.251,0.281 0.084,0.079 0.283,0.281 0.25,0.194 0.474,0.367 0.083,0.053 c 2.015,1.371 4.641,1.874 7.131,1.094 L 55.228,80.776 c 4.303,-1.342 6.679,-5.814 5.308,-10.006 -0.387,-1.259 -1.086,-2.35 -1.979,-3.215 l -0.368,-0.337 -0.278,-0.303 z m -6.318,5.896 0.079,0.114 -37.369,11.57 11.854,-36.538 10.565,10.317 2.876,2.825 11.995,11.712 z" /></g><path style="fill:#000000" inkscape:connector-curvature="0" id="path9" d="m 27.813273,113.65778 0.09753,-0.0201 c 2.39093,-0.45821 4.599455,-1.96811 5.80244,-4.28639 L 52.785897,72.891487 c 2.088044,-4.002139 0.590949,-8.836902 -3.348692,-10.821875 -1.329078,-0.688721 -2.766603,-0.943695 -4.133174,-0.841768 l -0.454018,-0.02 -16.939621,0.223997 -4.055079,0.07232 -15.711383,0.220024 -0.281322,0.04035 -0.432752,-2.61e-4 -0.415615,0.06192 -0.376025,0.05898 -0.47344,0.121469 -0.27556,0.07993 -0.550309,0.198748 -0.199188,0.08114 -0.594655,0.274528 -0.114446,0.0399 -0.02045,0.02056 -0.59303,0.35372 -0.123523,0.08306 -0.486301,0.337172 -0.179243,0.136242 -0.375276,0.340412 -0.219324,0.220495 -0.293372,0.294939 -0.238972,0.277116 C 0.97781,65.869953 0.347935,67.257564 0.11153,68.764336 L 0.05352,69.019757 0.05172,69.414329 0.01894,69.849995 0,69.908735 l 0.01836,0.255217 0.0183,0.499171 0.03984,0.356984 0.06262,0.413492 0.09656,0.411988 0.0872,0.351908 0.158141,0.436572 0.09837,0.298139 0.194299,0.472538 0.102407,0.218932 18.462772,35.908054 c 1.172169,2.30842 3.34759,3.76847 5.740829,4.17717 l 0.01975,-0.0199 0.69605,0.0957 0.218437,-0.0225 0.490791,0.0213 0.39809,-0.005 0.315972,-0.0397 0.594462,-0.0815 z" /></svg>',loader:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="100%" height="100%" fill="black"> <circle cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(45 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.125s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(90 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.25s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(135 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.375s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(180 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(225 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.625s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(270 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.75s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(315 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.875s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle> <circle transform="rotate(180 16 16)" cx="16" cy="3" r="0"> <animate attributeName="r" values="0;3;0;0" dur="1s" repeatCount="indefinite" begin="0.5s" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" /> </circle></svg>',query:'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 80 80" enable-background="new 0 0 80 80" xml:space="preserve"><g id="Layer_1"></g><g id="Layer_2"> <path d="M64.622,2.411H14.995c-6.627,0-12,5.373-12,12v49.897c0,6.627,5.373,12,12,12h49.627c6.627,0,12-5.373,12-12V14.411 C76.622,7.783,71.249,2.411,64.622,2.411z M24.125,63.906V15.093L61,39.168L24.125,63.906z"/></g></svg>',queryInvalid:'<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 73.627 73.897" enable-background="new 0 0 80 80" xml:space="preserve" ><g id="Layer_1" transform="translate(-2.995,-2.411)" /><g id="Layer_2" transform="translate(-2.995,-2.411)"><path d="M 64.622,2.411 H 14.995 c -6.627,0 -12,5.373 -12,12 v 49.897 c 0,6.627 5.373,12 12,12 h 49.627 c 6.627,0 12,-5.373 12,-12 V 14.411 c 0,-6.628 -5.373,-12 -12,-12 z M 24.125,63.906 V 15.093 L 61,39.168 24.125,63.906 z" id="path6" inkscape:connector-curvature="0" /></g><g transform="matrix(0.76805408,0,0,0.76805408,-0.90231954,-2.0060895)" id="g3"><path style="fill:#c02608;fill-opacity:1" inkscape:connector-curvature="0" d="m 88.184,81.468 c 1.167,1.167 1.167,3.075 0,4.242 l -2.475,2.475 c -1.167,1.167 -3.076,1.167 -4.242,0 l -69.65,-69.65 c -1.167,-1.167 -1.167,-3.076 0,-4.242 l 2.476,-2.476 c 1.167,-1.167 3.076,-1.167 4.242,0 l 69.649,69.651 z" id="path5" /></g><g transform="matrix(0.76805408,0,0,0.76805408,-0.90231954,-2.0060895)" id="g7"><path style="fill:#c02608;fill-opacity:1" inkscape:connector-curvature="0" d="m 18.532,88.184 c -1.167,1.166 -3.076,1.166 -4.242,0 l -2.475,-2.475 c -1.167,-1.166 -1.167,-3.076 0,-4.242 l 69.65,-69.651 c 1.167,-1.167 3.075,-1.167 4.242,0 l 2.476,2.476 c 1.166,1.167 1.166,3.076 0,4.242 l -69.651,69.65 z" id="path9" /></g></svg>',draw:function(e,t){if(e){var n=r.getElement(t); n&&i(e).append(n)}},getElement:function(e){var t=e.id?r[e.id]:e.value;if(t&&0==t.indexOf("<svg")){var n=new DOMParser,o=n.parseFromString(t,"text/xml"),s=o.documentElement;if(e.width&&e.height){var a=i("<div class='svgContainer'></div>").width(e.width).height(e.height);return a.append(s)}return s}return!1}}},{jquery:9}],13:[function(e,t){t.exports={storage:e("./storage.js"),determineId:e("./determineId.js"),imgs:e("./imgs.js")}},{"./determineId.js":11,"./imgs.js":12,"./storage.js":14}],14:[function(e,t){{var i=e("store"),r={day:function(){return 864e5},month:function(){30*r.day()},year:function(){12*r.month()}};t.exports={set:function(e,t,n){"string"==typeof n&&(n=r[n]()),i.set(e,{val:t,exp:n,time:(new Date).getTime()})},get:function(e){var t=i.get(e);return t?t.exp&&(new Date).getTime()-t.time>t.exp?null:t.val:null}}}},{store:10}],15:[function(e,t){t.exports={name:"yasgui-yasqe",description:"Yet Another SPARQL Query Editor",version:"1.2.4",main:"src/main.js",licenses:[{type:"MIT",url:"http://yasgui.github.io/license.txt"}],devDependencies:{gulp:"~3.6.0","vinyl-source-stream":"~0.1.1",watchify:"^0.6.4","gulp-uglify":"^0.2.1","gulp-concat":"^2.2.0","gulp-minify-css":"^0.3.0","gulp-browserify":"^0.5.0","vinyl-buffer":"0.0.0",browserify:"^3.38.1",express:"^3.5.1","connect-livereload":"^0.3.2","gulp-livereload":"^1.3.1","gulp-util":"^2.2.14","gulp-connect":"^2.0.5","gulp-notify":"^1.2.5","gulp-embedlr":"^0.5.2","gulp-changed":"^0.3.0","gulp-imagemin":"^0.2.0","gulp-open":"^0.2.8",connect:"^2.14.4","gulp-debug":"^0.3.0",amplify:"0.0.11","twitter-bootstrap-3.0.0":"^3.0.0","gulp-yuidoc":"^0.1.2","gulp-jsvalidate":"^0.2.0"},bugs:"https://github.com/YASGUI/YASQE/issues/",keywords:["JavaScript","SPARQL","Editor","Semantic Web","Linked Data"],homepage:"http://yasgui.github.io/YASQE",maintainers:[{name:"Laurens Rietveld",email:"[email protected]",web:"http://laurensrietveld.nl"}],repository:{type:"git",url:"https://github.com/YASGUI/YASQE.git"},dependencies:{jquery:"~ 1.11.0",codemirror:"~4.2.0",amplify:"0.0.11",store:"^1.3.14","twitter-bootstrap-3.0.0":"^3.0.0","browserify-shim":"~3.2.0","yasgui-utils":"^1.0.0"},"browserify-shim":{"twitter-bootstrap-3.0.0":"bootstrap"},browserify:{transform:["browserify-shim"]}}},{}],16:[function(e,t){"use strict";function i(e,t,r){var n=e.getTokenAt({line:t,ch:r.start});return null!=n&&"ws"==n.type&&(n=i(e,t,n)),n}var r=e("jquery"),n=e("codemirror");e("codemirror/addon/hint/show-hint.js"),e("codemirror/addon/search/searchcursor.js"),e("codemirror/addon/edit/matchbrackets.js"),e("codemirror/addon/runmode/runmode.js"),window.console=window.console||{log:function(){}},e("../lib/flint.js");var o=e("../lib/trie.js"),s=t.exports=function(e,t){t=a(t);var i=l(n(e,t));return u(i),i},a=function(e){var t=r.extend(!0,{},s.defaults,e);return t},l=function(t){return t.query=function(e){s.executeQuery(t,e)},t.getPrefixesFromQuery=function(){return h(t)},t.storeBulkCompletions=function(i,r){p[i]=new o;for(var n=0;n<r.length;n++)p[i].insert(r[n]);var s=R(t,t.options.autocompletions[i].persistent);s&&e("yasgui-utils").storage.set(s,r,"month")},t.setCheckSyntaxErrors=function(e){t.options.syntaxErrorCheck=e,x(t)},t},u=function(t){var i=R(t,t.options.persistent);if(i){var r=e("yasgui-utils").storage.get(i);r&&t.setValue(r)}if(s.drawButtons(t),t.on("blur",function(e){s.storeQuery(e)}),t.on("change",function(e){x(e),s.appendPrefixIfNeeded(e),s.updateQueryButton(e),s.positionAbsoluteItems(e)}),t.on("cursorActivity",function(e){s.autoComplete(e,!0)}),t.prevQueryValid=!1,x(t),s.positionAbsoluteItems(t),t.options.autocompletions)for(var n in t.options.autocompletions)t.options.autocompletions[n].bulk&&E(t,n);t.options.consumeShareLink&&t.options.consumeShareLink(t)},p={},c={"string-2":"prefixed",atom:"var"},d=function(e,t){var i=!1;try{void 0!==e[t]&&(i=!0)}catch(r){}return i},E=function(t,i){var r=null;if(d(t.options.autocompletions[i],"get")&&(r=t.options.autocompletions[i].get),r instanceof Array)t.storeBulkCompletions(i,r);else{var n=null;if(R(t,t.options.autocompletions[i].persistent)&&(n=e("yasgui-utils").storage.get(R(t,t.options.autocompletions[i].persistent))),n&&n instanceof Array&&n.length>0)t.storeBulkCompletions(i,n);else if(r instanceof Function){var o=r(t);o&&o instanceof Array&&o.length>0&&t.storeBulkCompletions(i,o)}}},h=function(e){for(var t={},i=e.lineCount(),r=0;i>r;r++){var n=g(e,r);if(null!=n&&"PREFIX"==n.string.toUpperCase()){var o=g(e,r,n.end+1);if(o){var s=g(e,r,o.end+1);if(null!=o&&o.string.length>0&&null!=s&&s.string.length>0){var a=s.string;0==a.indexOf("<")&&(a=a.substring(1)),">"==a.slice(-1)&&(a=a.substring(0,a.length-1)),t[o.string]=a}}}}return t},f=function(e,t){for(var i=null,r=0,n=e.lineCount(),o=0;n>o;o++){var s=g(e,o);null==s||"PREFIX"!=s.string&&"BASE"!=s.string||(i=s,r=o)}if(null==i)e.replaceRange("PREFIX "+t+"\n",{line:0,ch:0});else{var a=m(e,r);e.replaceRange("\n"+a+"PREFIX "+t,{line:r})}},m=function(e,t,i){void 0==i&&(i=1);var r=e.getTokenAt({line:t,ch:i});return null==r||void 0==r||"ws"!=r.type?"":r.string+m(e,t,r.end+1)},g=function(e,t,i){void 0==i&&(i=1);var r=e.getTokenAt({line:t,ch:i});return null==r||void 0==r||r.end<i?null:"ws"==r.type?g(e,t,r.end+1):r},v=null,x=function(e,t){e.queryValid=!0,v&&(v(),v=null),e.clearGutter("gutterErrorBar");for(var i=null,n=0;n<e.lineCount();++n){var o=!1;if(e.prevQueryValid||(o=!0),i=e.getTokenAt({line:n,ch:e.getLine(n).length},o).state,0==i.OK){if(!e.options.syntaxErrorCheck)return void r(e.getWrapperElement).find(".sp-error").css("color","black");var s=document.createElement("span");s.innerHTML="&rarr;",s.className="gutterError",e.setGutterMarker(n,"gutterErrorBar",s),v=function(){e.markText({line:n,ch:i.errorStartPos},{line:n,ch:i.errorEndPos},"sp-error")},e.queryValid=!1;break}}if(e.prevQueryValid=e.queryValid,t&&null!=i&&void 0!=i.stack){var a=i.stack,l=i.stack.length;l>1?e.queryValid=!1:1==l&&"solutionModifier"!=a[0]&&"?limitOffsetClauses"!=a[0]&&"?offsetClause"!=a[0]&&(e.queryValid=!1)}};r.extend(s,n),s.positionAbsoluteItems=function(e){var t=r(e.getWrapperElement()).find(".CodeMirror-vscrollbar"),i=0;t.is(":visible")&&(i=t.outerWidth());var n=r(e.getWrapperElement()).find(".completionNotification");n.is(":visible")&&n.css("right",i);var o=r(e.getWrapperElement()).find(".yasqe_buttons");o.is(":visible")&&o.css("right",i)},s.createShareLink=function(e){return{query:e.getValue()}},s.consumeShareLink=function(t){e("../lib/deparam.js");var i=r.deparam(window.location.search.substring(1));i.query&&t.setValue(i.query)},s.drawButtons=function(t){var i=r("<div class='yasqe_buttons'></div>").appendTo(r(t.getWrapperElement()));if(t.options.createShareLink){var n=e("yasgui-utils").imgs.getElement({id:"share",width:"30px",height:"30px"});n.click(function(e){e.stopPropagation();var o=r("<div class='yasqe_sharePopup'></div>").appendTo(i);r("html").click(function(){o&&o.remove()}),o.click(function(e){e.stopPropagation()});var s=r("<textarea></textarea>").val(location.protocol+"//"+location.host+location.pathname+"?"+r.param(t.options.createShareLink(t)));s.focus(function(){var e=r(this);e.select(),e.mouseup(function(){return e.unbind("mouseup"),!1})}),o.empty().append(s);var a=n.position();o.css("top",a.top+n.outerHeight()+"px").css("left",a.left+n.outerWidth()-o.outerWidth()+"px")}).addClass("yasqe_share").attr("title","Share your query").appendTo(i)}if(t.options.sparql.showQueryButton){var o=40,a=40;r("<div class='yasqe_queryButton'></div>").click(function(){r(this).hasClass("query_busy")?(t.xhr&&t.xhr.abort(),s.updateQueryButton(t)):t.query()}).height(o).width(a).appendTo(i),s.updateQueryButton(t)}};var N={busy:"loader",valid:"query",error:"queryInvalid"};s.updateQueryButton=function(t,i){var n=r(t.getWrapperElement()).find(".yasqe_queryButton");0!=n.length&&(i||(i="valid",t.queryValid===!1&&(i="error")),i==t.queryStatus||"busy"!=i&&"valid"!=i&&"error"!=i||(n.empty().removeClass(function(e,t){return t.split(" ").filter(function(e){return 0==e.indexOf("query_")}).join(" ")}).addClass("query_"+i).append(e("yasgui-utils").imgs.getElement({id:N[i],width:"100%",height:"100%"})),t.queryStatus=i))},s.fromTextArea=function(e,t){t=a(t);var i=l(n.fromTextArea(e,t));return u(i),i},s.fetchFromPrefixCc=function(e){r.get("http://prefix.cc/popular/all.file.json",function(t){var i=[];for(var r in t)if("bif"!=r){var n=r+": <"+t[r]+">";i.push(n)}e.storeBulkCompletions("prefixes",i)})},s.determineId=function(e){return r(e.getWrapperElement()).closest("[id]").attr("id")},s.storeQuery=function(t){var i=R(t,t.options.persistent);i&&e("yasgui-utils").storage.set(i,t.getValue(),"month")},s.commentLines=function(e){for(var t=e.getCursor(!0).line,i=e.getCursor(!1).line,r=Math.min(t,i),n=Math.max(t,i),o=!0,s=r;n>=s;s++){var a=e.getLine(s);if(0==a.length||"#"!=a.substring(0,1)){o=!1;break}}for(var s=r;n>=s;s++)o?e.replaceRange("",{line:s,ch:0},{line:s,ch:1}):e.replaceRange("#",{line:s,ch:0})},s.copyLineUp=function(e){var t=e.getCursor(),i=e.lineCount();e.replaceRange("\n",{line:i-1,ch:e.getLine(i-1).length});for(var r=i;r>t.line;r--){var n=e.getLine(r-1);e.replaceRange(n,{line:r,ch:0},{line:r,ch:e.getLine(r).length})}},s.copyLineDown=function(e){s.copyLineUp(e);var t=e.getCursor();t.line++,e.setCursor(t)},s.doAutoFormat=function(e){if(e.somethingSelected()){var t={line:e.getCursor(!1).line,ch:e.getSelection().length};b(e,e.getCursor(!0),t)}else{var i=e.lineCount(),r=e.getTextArea().value.length;b(e,{line:0,ch:0},{line:i,ch:r})}},s.executeQuery=function(e,t){var i="function"==typeof t?t:null,n="object"==typeof t?t:{};if(e.options.sparql&&(n=r.extend({},e.options.sparql,n)),n.endpoint&&0!=n.endpoint.length){var o={url:n.endpoint,type:n.requestMethod,data:[{name:"query",value:e.getValue()}],headers:{Accept:n.acceptHeader}},a=!1;if(n.handlers)for(var l in n.handlers)n.handlers[l]&&(a=!0,o[l]=n.handlers[l]);if(a||i){if(i&&(o.complete=i),n.namedGraphs&&n.namedGraphs.length>0)for(var u=0;u<n.namedGraphs.length;u++)o.data.push({name:"named-graph-uri",value:n.namedGraphs[u]});if(n.defaultGraphs&&n.defaultGraphs.length>0)for(var u=0;u<n.defaultGraphs.length;u++)o.data.push({name:"default-graph-uri",value:n.defaultGraphs[u]});n.headers&&!r.isEmptyObject(n.headers)&&r.extend(o.headers,n.headers),n.args&&n.args.length>0&&r.merge(o.data,n.args),s.updateQueryButton(e,"busy");var p=function(){s.updateQueryButton(e)};if(o.complete){var c=o.complete;o.complete=function(e,t){c(e,t),p()}}else o.complete=p();e.xhr=r.ajax(o)}}};var L={};s.showCompletionNotification=function(e,t){e.options.autocompletions[t].autoshow||(L[t]||(L[t]=r("<div class='completionNotification'></div>")),L[t].show().text("Press "+(-1!=navigator.userAgent.indexOf("Mac OS X")?"CMD":"CTRL")+" - <spacebar> to autocomplete").appendTo(r(e.getWrapperElement())))},s.hideCompletionNotification=function(e,t){L[t]&&L[t].hide()};var I={properties:function(e){var t=T(e);if(0==t.string.indexOf("?"))return!1;if(r.inArray("a",t.state.possibleCurrent)>=0)return!0;var n=e.getCursor(),o=i(e,n.line,t);return"rdfs:subPropertyOf"==o.string?!0:!1},classes:function(e){var t=T(e);if(0==t.string.indexOf("?"))return!1;var r=e.getCursor(),n=i(e,r.line,t);return"a"==n.string?!0:"rdf:type"==n.string?!0:"rdfs:domain"==n.string?!0:"rdfs:range"==n.string?!0:!1},prefixes:function(e){var t=e.getCursor(),i=e.getTokenAt(t);if(e.getLine(t.line).length>t.ch)return!1;if("ws"!=i.type&&(i=T(e)),0==!i.string.indexOf("a")&&-1==r.inArray("PNAME_NS",i.state.possibleCurrent))return!1;var n=g(e,t.line);return null==n||"PREFIX"!=n.string.toUpperCase()?!1:!0}};s.autoComplete=function(e,t){if(!e.somethingSelected()&&e.options.autocompletions){var i=function(i){if(t&&(!e.options.autocompletions[i].autoShow||e.options.autocompletions[i].async))return!1;var r={closeCharacters:/(?=a)b/,type:i,completeSingle:!1};e.options.autocompletions[i].async&&(r.async=!0);s.showHint(e,C[i],r);return!0};for(var r in e.options.autocompletions)if(I[r](e)){if(!e.options.autocompletions[r].handlers||!e.options.autocompletions[r].handlers.validPosition||e.options.autocompletions[r].handlers.validPosition(e,r)!==!1){var n=i(r);if(n)break}}else e.options.autocompletions[r].handlers&&e.options.autocompletions[r].handlers.invalidPosition&&e.options.autocompletions[r].handlers.invalidPosition(e,r)}},s.appendPrefixIfNeeded=function(e){if(p.prefixes){var t=e.getCursor(),i=e.getTokenAt(t);if("prefixed"==c[i.type]){var r=i.string.indexOf(":");if(-1!==r){var n=g(e,t.line).string.toUpperCase(),o=e.getTokenAt({line:t.line,ch:i.start});if("PREFIX"!=n&&("ws"==o.type||null==o.type)){var s=i.string.substring(0,r+1),a=h(e);if(null==a[s]){var l=p.prefixes.autoComplete(s);l.length>0&&f(e,l[0])}}}}}};var T=function(e,t,i){i||(i=e.getCursor()),t||(t=e.getTokenAt(i));var r=e.getTokenAt({line:i.line,ch:t.start});return null!=r.type&&"ws"!=r.type&&null!=t.type&&"ws"!=t.type?(t.start=r.start,t.string=r.string+t.string,T(e,t,{line:i.line,ch:r.start})):null!=t.type&&"ws"==t.type?(t.start=t.start+1,t.string=t.string.substring(1),t):t},y=function(e,t){var i={};t=T(e,t);var r=h(e);if(0==!t.string.indexOf("<")&&(i.tokenPrefix=t.string.substring(0,t.string.indexOf(":")+1),null!=r[i.tokenPrefix]&&(i.tokenPrefixUri=r[i.tokenPrefix])),i.uri=t.string.trim(),0==!t.string.indexOf("<")&&t.string.indexOf(":")>-1)for(var n in r)if(r.hasOwnProperty(n)&&0==t.string.indexOf(n)){i.uri=r[n],i.uri+=t.string.substring(n.length);break}return 0==i.uri.indexOf("<")&&(i.uri=i.uri.substring(1)),-1!==i.uri.indexOf(">",i.length-1)&&(i.uri=i.uri.substring(0,i.uri.length-1)),i},A=function(e,t,i){var r=[];if(p[t])r=p[t].autoComplete(i);else if("function"==typeof e.options.autocompletions[t].get&&0==e.options.autocompletions[t].async)r=e.options.autocompletions[t].get(e,i,t);else if("object"==typeof e.options.autocompletions[t].get)for(var n=i.length,o=0;o<e.options.autocompletions[t].get.length;o++){var s=e.options.autocompletions[t].get[o];s.slice(0,n)==i&&r.push(s)}return r};s.fetchFromLov=function(t,i,n,o){if(!i||0==i.trim().length)return L[n]&&L[n].empty().append("Nothing to autocomplete yet!"),!1;var s=50,a={q:i,page:1};a.type="classes"==n?"class":"property";var l=[],u="",p=function(){u="http://lov.okfn.org/dataset/lov/api/v2/autocomplete/terms?"+r.param(a)};p();var c=function(){a.page++,p()},d=function(){r.get(u,function(e){for(var t=0;t<e.results.length;t++)l.push(e.results[t].uri);l.length<e.total_results&&l.length<s?(c(),d()):(L[n]&&(l.length>0?L[n].hide():L[n].text("0 matches found...")),o(l))}).fail(function(){L[n]&&L[n].empty().append("Failed fetching suggestions..")})};L[n]&&L[n].empty().append(r("<span>Fetchting autocompletions &nbsp;</span>")).append(e("yasgui-utils").imgs.getElement({id:"loader",width:"18px",height:"18px"}).css("vertical-align","middle")),d()};var S=function(e,t,i){i.text!=e.getTokenAt(e.getCursor()).string&&e.replaceRange(i.text,t.from,t.to)},C={};C.resourceHints=function(e,t,i){var r=function(i){for(var r=[],l=0;l<i.length;l++){var u=i[l];a.tokenPrefix&&a.uri&&a.tokenPrefixUri?(u=u.substring(a.tokenPrefixUri.length),u=a.tokenPrefix+u):u="<"+u+">",r.push({text:u,displayText:u,hint:S,className:t+"Hint"})}var p={completionToken:a.uri,list:r,from:{line:o.line,ch:n.start},to:{line:o.line,ch:n.end}};if(e.options.autocompletions[t].handlers)for(var c in e.options.autocompletions[t].handlers)e.options.autocompletions[t].handlers[c]&&s.on(p,c,e.options.autocompletions[t].handlers[c]);return p},n=T(e),o=e.getCursor(),a=y(e,n);if(a){if(!e.options.autocompletions[t].async)return r(A(e,t,a.uri));var l=function(e){i(r(e))};e.options.autocompletions[t].get(e,a.uri,t,l)}},C.properties=function(e,t){return C.resourceHints(e,"properties",t)},C.classes=function(e,t){return C.resourceHints(e,"classes",t)},C.prefixes=function(e,t){var i="prefixes",r=T(e),n=e.getCursor(),o=function(){r=/\s*/.test(r.string)&&"PREFIX"==e.getTokenAt({line:n.line,ch:r.start}).string.toUpperCase()?{start:n.ch,end:n.ch,string:"",state:r.state}:T(e,r,n)},a=function(t){var o={completionToken:r.uri,list:t,from:{line:n.line,ch:r.start},to:{line:n.line,ch:r.end}};if(e.options.autocompletions[i].handlers)for(var a in e.options.autocompletions[i].handlers)e.options.autocompletions[i].handlers[a]&&s.on(o,a,e.options.autocompletions[i].handlers[a]);return o};if(o(),r){if(!e.options.autocompletions[i].async)return a(A(e,i,r.string));var l=function(e){t(a(e))};e.options.autocompletions[i].get(e,r.uri,i,l)}};var R=function(e,t){var i=null;return t&&(i="string"==typeof t?t:t(e)),i},b=function(e,t,i){var r=e.indexFromPos(t),n=e.indexFromPos(i),o=O(e.getValue(),r,n);e.operation(function(){e.replaceRange(o,t,i);for(var n=e.posFromIndex(r).line,s=e.posFromIndex(r+o.length).line,a=n;s>=a;a++)e.indentLine(a,"smart")})},O=function(e,t,i){e=e.substring(t,i);var o=[["keyword","ws","prefixed","ws","uri"],["keyword","ws","uri"]],s=["{",".",";"],a=["}"],l=function(e){for(var t=0;t<o.length;t++)if(c.valueOf().toString()==o[t].valueOf().toString())return 1;for(var t=0;t<s.length;t++)if(e==s[t])return 1;for(var t=0;t<a.length;t++)if(""!=r.trim(p)&&e==a[t])return-1;return 0},u="",p="",c=[];return n.runMode(e,"sparql11",function(e,t){c.push(t);var i=l(e,t);0!=i?(1==i?(u+=e+"\n",p=""):(u+="\n"+e,p=e),c=[]):(p+=e,u+=e),1==c.length&&"sp-ws"==c[0]&&(c=[])}),r.trim(u.replace(/\n\s*\n/g,"\n"))};s.defaults=r.extend(s.defaults,{mode:"sparql11",value:"SELECT * WHERE {\n ?sub ?pred ?obj .\n} \nLIMIT 10",highlightSelectionMatches:{showToken:/\w/},tabMode:"indent",lineNumbers:!0,gutters:["gutterErrorBar","CodeMirror-linenumbers"],matchBrackets:!0,fixedGutter:!0,syntaxErrorCheck:!0,extraKeys:{"Ctrl-Space":s.autoComplete,"Cmd-Space":s.autoComplete,"Ctrl-D":s.deleteLine,"Ctrl-K":s.deleteLine,"Cmd-D":s.deleteLine,"Cmd-K":s.deleteLine,"Ctrl-/":s.commentLines,"Cmd-/":s.commentLines,"Ctrl-Alt-Down":s.copyLineDown,"Ctrl-Alt-Up":s.copyLineUp,"Cmd-Alt-Down":s.copyLineDown,"Cmd-Alt-Up":s.copyLineUp,"Shift-Ctrl-F":s.doAutoFormat,"Shift-Cmd-F":s.doAutoFormat,"Ctrl-]":s.indentMore,"Cmd-]":s.indentMore,"Ctrl-[":s.indentLess,"Cmd-[":s.indentLess,"Ctrl-S":s.storeQuery,"Cmd-S":s.storeQuery,"Ctrl-Enter":s.executeQuery,"Cmd-Enter":s.executeQuery},cursorHeight:.9,createShareLink:s.createShareLink,consumeShareLink:s.consumeShareLink,persistent:function(e){return"queryVal_"+s.determineId(e)},sparql:{showQueryButton:!1,endpoint:"http://dbpedia.org/sparql",requestMethod:"GET",acceptHeader:"application/sparql-results+json",namedGraphs:[],defaultGraphs:[],args:[],headers:{},handlers:{beforeSend:null,complete:null,error:null,success:null}},autocompletions:{prefixes:{get:s.fetchFromPrefixCc,async:!1,bulk:!0,autoShow:!0,autoAddDeclaration:!0,persistent:"prefixes",handlers:{validPosition:null,invalidPosition:null,shown:null,select:null,pick:null,close:null}},properties:{get:s.fetchFromLov,async:!0,bulk:!1,autoShow:!1,persistent:"properties",handlers:{validPosition:s.showCompletionNotification,invalidPosition:s.hideCompletionNotification,shown:function(){console.log("shown")},select:null,pick:null,close:null}},classes:{get:s.fetchFromLov,async:!0,bulk:!1,autoShow:!1,persistent:"classes",handlers:{validPosition:s.showCompletionNotification,invalidPosition:s.hideCompletionNotification,shown:null,select:null,pick:null,close:null}}}}),s.version={CodeMirror:n.version,YASQE:e("../package.json").version,jquery:r.fn.jquery,"yasgui-utils":e("yasgui-utils").version}},{"../lib/deparam.js":1,"../lib/flint.js":2,"../lib/trie.js":3,"../package.json":15,codemirror:8,"codemirror/addon/edit/matchbrackets.js":4,"codemirror/addon/hint/show-hint.js":5,"codemirror/addon/runmode/runmode.js":6,"codemirror/addon/search/searchcursor.js":7,jquery:9,"yasgui-utils":13}]},{},[16])(16)});
packages/@lyra/form-builder/src/inputs/ObjectInput/Field.js
VegaPublish/vega-studio
import FormBuilderPropTypes from '../../FormBuilderPropTypes' import PropTypes from 'prop-types' import React from 'react' import Fieldset from 'part:@lyra/components/fieldsets/default' import {FormBuilderInput} from '../../FormBuilderInput' import InvalidValue from '../InvalidValueInput' import {resolveTypeName} from '../../utils/resolveTypeName' import styles from './styles/Field.css' // This component renders a single type in an object type. It emits onChange events telling the owner about the name of the type // that changed. This gives the owner an opportunity to use the same event handler function for all of its fields export default class Field extends React.Component { static propTypes = { field: FormBuilderPropTypes.field.isRequired, value: PropTypes.any, onChange: PropTypes.func.isRequired, onFocus: PropTypes.func.isRequired, onBlur: PropTypes.func.isRequired, focusPath: PropTypes.array, readOnly: PropTypes.bool, markers: PropTypes.array, level: PropTypes.number } static defaultProps = { level: 0, focusPath: [] } handleChange = event => { const {field, onChange} = this.props if (!field.type.readOnly) { onChange(event, field) } } focus() { this._input.focus() } setInput = input => { this._input = input } render() { const { value, readOnly, field, level, onFocus, onBlur, markers, focusPath } = this.props if (typeof value !== 'undefined') { const expectedType = field.type.name const actualType = resolveTypeName(value) // todo: we should consider removing this, and not allow aliasing native types // + ensure custom object types always gets annotated with _type const isCompatible = actualType === field.type.jsonType if (expectedType !== actualType && !isCompatible) { return ( <div className={styles.root}> <Fieldset legend={field.type.title} level={level}> <InvalidValue value={value} onChange={this.handleChange} validTypes={[field.type.name]} actualType={actualType} ref={this.setInput} /> </Fieldset> </div> ) } } return ( <div className={styles.root}> <FormBuilderInput value={value} type={field.type} onChange={this.handleChange} path={[field.name]} onFocus={onFocus} onBlur={onBlur} readOnly={readOnly || field.type.readOnly} focusPath={focusPath} markers={markers} level={level} ref={this.setInput} /> </div> ) } }
src/packages/@ncigdc/modern_components/SuggestionFacet/SuggestionFacet.relay.js
NCI-GDC/portal-ui
// @flow import React from 'react'; import { graphql } from 'react-relay'; import { compose, withPropsOnChange, withState } from 'recompose'; import Query from '@ncigdc/modern_components/Query'; import { trim } from 'lodash'; export default (Component: ReactClass<*>) => compose( withState('facetSearch', 'setFacetSearch', ''), withPropsOnChange( ['queryType', 'facetSearch'], ({ facetSearch, queryType }) => { const showCases = queryType === 'case'; const showFiles = queryType === 'file'; const showProjects = queryType === 'project'; const showGenes = queryType === 'gene_centric'; return { variables: { query: trim(facetSearch), queryType: [queryType], showCases, showFiles, showGenes, showProjects, }, }; }, ), )((props: Object) => { return ( <Query Component={Component} parentProps={props} query={graphql` query SuggestionFacet_relayQuery( $query: String $queryType: [String] $showCases: Boolean! $showFiles: Boolean! $showGenes: Boolean! $showProjects: Boolean! ) { facetSearchHits: query(query: $query, types: $queryType) { files: hits @include(if: $showFiles) { id ... on File { file_id submitter_id file_name } } cases: hits @include(if: $showCases) { id ... on Case { case_id project { project_id } submitter_id } } projects: hits @include(if: $showProjects) { id ... on Project { project_id name primary_site } } genes: hits @include(if: $showGenes) { id ...on Gene { symbol name gene_id } } } } `} setFacetSearch={props.setFacetSearch} variables={props.variables} /> ); });
tests/routes/Home/components/HomeView.spec.js
ExtraGains/XLBS
import React from 'react' import { HomeView } from 'routes/Home/components/HomeView' import { render } from 'enzyme' describe('(View) Home', () => { let _component beforeEach(() => { _component = render(<HomeView />) }) it('Renders a welcome message', () => { const welcome = _component.find('h4') expect(welcome).to.exist expect(welcome.text()).to.match(/Welcome!/) }) it('Renders an awesome duck image', () => { const duck = _component.find('img') expect(duck).to.exist expect(duck.attr('alt')).to.match(/This is a duck, because Redux!/) }) })
packages/icons/src/md/action/NoteAdd.js
suitejs/suitejs
import React from 'react'; import IconBase from '@suitejs/icon-base'; function MdNoteAdd(props) { return ( <IconBase viewBox="0 0 48 48" {...props}> <path d="M28 4l12 12v24c0 2.21-1.79 4-4 4H11.98C9.77 44 8 42.21 8 40l.02-32c0-2.21 1.77-4 3.98-4h16zm4 28v-4h-6v-6h-4v6h-6v4h6v6h4v-6h6zm-6-14h11L26 7v11z" /> </IconBase> ); } export default MdNoteAdd;
addons/info/src/components/types/Shape.js
rhalff/storybook
import PropTypes from 'prop-types'; import React from 'react'; import { HighlightButton } from '@storybook/components'; import PrettyPropType from './PrettyPropType'; import PropertyLabel from './PropertyLabel'; import { TypeInfo, getPropTypes } from './proptypes'; const MARGIN_SIZE = 15; class Shape extends React.Component { constructor(props) { super(props); this.state = { minimized: false, }; } handleToggle = () => { this.setState({ minimized: !this.state.minimized, }); }; handleMouseEnter = () => { this.setState({ hover: true }); }; handleMouseLeave = () => { this.setState({ hover: false }); }; render() { const { propType, depth } = this.props; const propTypes = getPropTypes(propType); return ( <span> <HighlightButton onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} highlight={this.state.hover} onClick={this.handleToggle} > {'{'} </HighlightButton> <HighlightButton onClick={this.handleToggle}>...</HighlightButton> {!this.state.minimized && Object.keys(propTypes).map(childProperty => ( <div key={childProperty} style={{ marginLeft: depth * MARGIN_SIZE }}> <PropertyLabel property={childProperty} required={propTypes[childProperty].required} /> <PrettyPropType depth={depth + 1} propType={propTypes[childProperty]} /> , </div> ))} <HighlightButton onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave} highlight={this.state.hover} onClick={this.handleToggle} > {'}'} </HighlightButton> </span> ); } } Shape.propTypes = { propType: TypeInfo, depth: PropTypes.number.isRequired, }; Shape.defaultProps = { propType: null, }; export default Shape;
src/views/Components/Tabs/Tabs.js
hungtruongquoc/shipper_front
import React, { Component } from 'react'; import { TabContent, TabPane, Nav, NavItem, NavLink } from 'reactstrap'; import classnames from 'classnames'; class Tabs extends Component { constructor(props) { super(props); this.toggle = this.toggle.bind(this); this.state = { activeTab: '1' }; } toggle(tab) { if (this.state.activeTab !== tab) { this.setState({ activeTab: tab }); } } render() { return ( <div className="animated fadeIn"> <div className="row"> <div className="col-md-6 mb-2"> <Nav tabs> <NavItem> <NavLink className={classnames({ active: this.state.activeTab === '1' })} onClick={() => { this.toggle('1'); }} > Home </NavLink> </NavItem> <NavItem> <NavLink className={classnames({ active: this.state.activeTab === '2' })} onClick={() => { this.toggle('2'); }} > Profile </NavLink> </NavItem> <NavItem> <NavLink className={classnames({ active: this.state.activeTab === '3' })} onClick={() => { this.toggle('3'); }} > Messages </NavLink> </NavItem> </Nav> <TabContent activeTab={this.state.activeTab}> <TabPane tabId="1"> 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </TabPane> <TabPane tabId="2"> 2. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </TabPane> <TabPane tabId="3"> 2. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </TabPane> </TabContent> </div> <div className="col-md-6 mb-2"> <Nav tabs> <NavItem> <NavLink className={classnames({ active: this.state.activeTab === '1' })} onClick={() => { this.toggle('1'); }} > <i className="icon-calculator"></i> </NavLink> </NavItem> <NavItem> <NavLink className={classnames({ active: this.state.activeTab === '2' })} onClick={() => { this.toggle('2'); }} > <i className="icon-basket-loaded"></i> </NavLink> </NavItem> <NavItem> <NavLink className={classnames({ active: this.state.activeTab === '3' })} onClick={() => { this.toggle('3'); }} > <i className="icon-pie-chart"></i> </NavLink> </NavItem> </Nav> <TabContent activeTab={this.state.activeTab}> <TabPane tabId="1"> 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </TabPane> <TabPane tabId="2"> 2. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </TabPane> <TabPane tabId="3"> 2. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </TabPane> </TabContent> </div> <div className="col-md-6 mb-2"> <Nav tabs> <NavItem> <NavLink className={classnames({ active: this.state.activeTab === '1' })} onClick={() => { this.toggle('1'); }} > <i className="icon-calculator"></i> Calculator </NavLink> </NavItem> <NavItem> <NavLink className={classnames({ active: this.state.activeTab === '2' })} onClick={() => { this.toggle('2'); }} > <i className="icon-basket-loaded"></i> Shoping cart </NavLink> </NavItem> <NavItem> <NavLink className={classnames({ active: this.state.activeTab === '3' })} onClick={() => { this.toggle('3'); }} > <i className="icon-pie-chart"></i> Charts </NavLink> </NavItem> </Nav> <TabContent activeTab={this.state.activeTab}> <TabPane tabId="1"> 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </TabPane> <TabPane tabId="2"> 2. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </TabPane> <TabPane tabId="3"> 2. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </TabPane> </TabContent> </div> <div className="col-md-6 mb-2"> <Nav tabs> <NavItem> <NavLink className={classnames({ active: this.state.activeTab === '1' })} onClick={() => { this.toggle('1'); }} > <i className="icon-calculator"></i> Calculator &nbsp;<span className="badge badge-success">New</span> </NavLink> </NavItem> <NavItem> <NavLink className={classnames({ active: this.state.activeTab === '2' })} onClick={() => { this.toggle('2'); }} > <i className="icon-basket-loaded"></i> Shoping cart &nbsp;<span className="badge badge-pill badge-danger">29</span> </NavLink> </NavItem> <NavItem> <NavLink className={classnames({ active: this.state.activeTab === '3' })} onClick={() => { this.toggle('3'); }} > <i className="icon-pie-chart"></i> Charts </NavLink> </NavItem> </Nav> <TabContent activeTab={this.state.activeTab}> <TabPane tabId="1"> 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </TabPane> <TabPane tabId="2"> 2. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </TabPane> <TabPane tabId="3"> 2. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </TabPane> </TabContent> </div> </div> </div> ) } } export default Tabs;
src/svg-icons/hardware/tablet-android.js
ichiohta/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let HardwareTabletAndroid = (props) => ( <SvgIcon {...props}> <path d="M18 0H6C4.34 0 3 1.34 3 3v18c0 1.66 1.34 3 3 3h12c1.66 0 3-1.34 3-3V3c0-1.66-1.34-3-3-3zm-4 22h-4v-1h4v1zm5.25-3H4.75V3h14.5v16z"/> </SvgIcon> ); HardwareTabletAndroid = pure(HardwareTabletAndroid); HardwareTabletAndroid.displayName = 'HardwareTabletAndroid'; HardwareTabletAndroid.muiName = 'SvgIcon'; export default HardwareTabletAndroid;
packages/wix-style-react/src/Carousel/Pagination/Pagination.js
wix/wix-style-react
import React from 'react'; import PropTypes from 'prop-types'; import { st, classes } from './Pagination.st.css'; const Pagination = ({ className, originalClassName, pages }) => ( <div className={st(classes.root, className, originalClassName)}> {pages.map(page => _withDotClass(page))} </div> ); const _withDotClass = comp => { const { className } = comp.props; return React.cloneElement(comp, { className: st(classes.dot, className) }); }; Pagination.propTypes = { className: PropTypes.string, }; Pagination.displayName = 'Pagination'; export default Pagination;
client/app/components/ContentEditor/customPlugins/link-plugin/LinkButton.js
bryanph/Geist
import React from 'react'; import { EditorState, Entity, KeyBindingUtil, AtomicBlockUtils, SelectionState, Modifier } from 'draft-js' import styles from './styles.css'; import { insertLink, isActive } from './insertLink.js' class LinkButton extends React.Component { constructor(props) { super(props); this.isActive = this.isActive.bind(this) this.confirmLink = this._confirmLink.bind(this); this.state = { active: false, } } componentWillMount() { this.isActive(this.props) } _confirmLink() { this.props.setEditorState(insertLink(this.props.getEditorState())) } isActive(props, cb) { this.setState({ active: isActive(props.getEditorState()) }) } componentWillUpdate(nextProps) { this.isActive(nextProps) } render() { const className = [this.props.theme.button]; if (this.state.active) { className.push(this.props.theme['button-active']); } return ( <button className={className.join(' ')} onClick={this.confirmLink}> {this.props.label || "Link"} </button> ); } } export default LinkButton;
src/components/Html/Html.js
miketamis/locationPositioning
/*! React Starter Kit | MIT License | http://www.reactstarterkit.com/ */ import React, { Component, PropTypes } from 'react'; import { googleAnalyticsId } from '../../config'; class Html extends Component { static propTypes = { title: PropTypes.string, description: PropTypes.string, css: PropTypes.string, body: PropTypes.string.isRequired, }; static defaultProps = { title: '', description: '', }; trackingCode() { return ({__html: `(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=` + `function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;` + `e=o.createElement(i);r=o.getElementsByTagName(i)[0];` + `e.src='https://www.google-analytics.com/analytics.js';` + `r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));` + `ga('create','${googleAnalyticsId}','auto');ga('send','pageview');`, }); } render() { return ( <html className="no-js" lang=""> <head> <meta charSet="utf-8" /> <meta httpEquiv="X-UA-Compatible" content="IE=edge" /> <title>{this.props.title.length ? this.props.title : 'FishTale'}</title> <meta name="description" content={this.props.description} /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="apple-touch-icon" href="apple-touch-icon.png" /> <style id="css" dangerouslySetInnerHTML={{__html: this.props.css}} /> <link rel="stylesheet" href="//cdn.jsdelivr.net/flexboxgrid/6.3.0/flexboxgrid.min.css" type="text/css" /> </head> <body> <script src="https://maps.googleapis.com/maps/api/js"></script> <div id="app" dangerouslySetInnerHTML={{__html: this.props.body}} /> <script src="/app.js"></script> <script dangerouslySetInnerHTML={this.trackingCode()} /> </body> </html> ); } } export default Html;
src/EndorseContentLayout/EndorseContentLayout.spec.js
skyiea/wix-style-react
import React from 'react'; import EndorseContentLayout from './EndorseContentLayout.driver'; describe('EndorseContentLayout', () => { let driver; beforeEach(() => driver = new EndorseContentLayout()); it('should render', () => { driver.when.created(); expect(driver.get.root().length).toBe(1); }); const componentsToRender = ['head', 'content', 'primaryCta', 'secondaryCta']; it('should render children components from props', () => { componentsToRender .forEach(c => { driver.when.created({[c]: <div>hey hope you render</div>}); expect(driver.get[c]().text()).toBe('hey hope you render'); }); }); it('should not render anything when prop not given', () => { componentsToRender .forEach(c => { driver.when.created(); expect(driver.get[c]().length).toBe(0); }); }); });
app/javascript/mastodon/features/ui/components/navigation_panel.js
masto-donte-com-br/mastodon
import React from 'react'; import { NavLink, withRouter } from 'react-router-dom'; import { FormattedMessage } from 'react-intl'; import Icon from 'mastodon/components/icon'; import { showTrends } from 'mastodon/initial_state'; import NotificationsCounterIcon from './notifications_counter_icon'; import FollowRequestsNavLink from './follow_requests_nav_link'; import ListPanel from './list_panel'; import TrendsContainer from 'mastodon/features/getting_started/containers/trends_container'; const NavigationPanel = () => ( <div className='navigation-panel'> <NavLink className='column-link column-link--transparent' to='/home' data-preview-title-id='column.home' data-preview-icon='home' ><Icon className='column-link__icon' id='home' fixedWidth /><FormattedMessage id='tabs_bar.home' defaultMessage='Home' /></NavLink> <NavLink className='column-link column-link--transparent' to='/notifications' data-preview-title-id='column.notifications' data-preview-icon='bell' ><NotificationsCounterIcon className='column-link__icon' /><FormattedMessage id='tabs_bar.notifications' defaultMessage='Notifications' /></NavLink> <FollowRequestsNavLink /> <NavLink className='column-link column-link--transparent' to='/explore' data-preview-title-id='explore.title' data-preview-icon='hashtag'><Icon className='column-link__icon' id='hashtag' fixedWidth /><FormattedMessage id='explore.title' defaultMessage='Explore' /></NavLink> <NavLink className='column-link column-link--transparent' to='/public/local' data-preview-title-id='column.community' data-preview-icon='users' ><Icon className='column-link__icon' id='users' fixedWidth /><FormattedMessage id='tabs_bar.local_timeline' defaultMessage='Local' /></NavLink> <NavLink className='column-link column-link--transparent' exact to='/public' data-preview-title-id='column.public' data-preview-icon='globe' ><Icon className='column-link__icon' id='globe' fixedWidth /><FormattedMessage id='tabs_bar.federated_timeline' defaultMessage='Federated' /></NavLink> <NavLink className='column-link column-link--transparent' to='/conversations'><Icon className='column-link__icon' id='at' fixedWidth /><FormattedMessage id='navigation_bar.direct' defaultMessage='Direct messages' /></NavLink> <NavLink className='column-link column-link--transparent' to='/favourites'><Icon className='column-link__icon' id='star' fixedWidth /><FormattedMessage id='navigation_bar.favourites' defaultMessage='Favourites' /></NavLink> <NavLink className='column-link column-link--transparent' to='/bookmarks'><Icon className='column-link__icon' id='bookmark' fixedWidth /><FormattedMessage id='navigation_bar.bookmarks' defaultMessage='Bookmarks' /></NavLink> <NavLink className='column-link column-link--transparent' to='/lists'><Icon className='column-link__icon' id='list-ul' fixedWidth /><FormattedMessage id='navigation_bar.lists' defaultMessage='Lists' /></NavLink> <ListPanel /> <hr /> <a className='column-link column-link--transparent' href='/settings/preferences'><Icon className='column-link__icon' id='cog' fixedWidth /><FormattedMessage id='navigation_bar.preferences' defaultMessage='Preferences' /></a> <a className='column-link column-link--transparent' href='/relationships'><Icon className='column-link__icon' id='users' fixedWidth /><FormattedMessage id='navigation_bar.follows_and_followers' defaultMessage='Follows and followers' /></a> {showTrends && <div className='flex-spacer' />} {showTrends && <TrendsContainer />} </div> ); export default withRouter(NavigationPanel);
vam-client/src/ui/LoadingView.js
vistadataproject/nodeVISTAClients
import React from 'react'; import View from '~/react-views/View'; import './loading.css'; class LoadingView extends View { render() { return ( <div className="v-loader" style={{width:this.props.width, height:this.props.height, borderColor:this.props.color }} /> ) } } LoadingView.defaultProps = { width:'14px', height:'14px', color:'#999' }; export default LoadingView;
src/mongostick/frontend/src/components/OperationDetails.js
RockingRolli/mongostick
import React from 'react' export default (props) => { return ( <div> <pre>{JSON.stringify(props, null, 2)}</pre> </div> ) }
frontend/src/components/organizationProfile/edit/mandate/partnerProfileMandate.js
unicef/un-partner-portal
import R from 'ramda'; import React, { Component } from 'react'; import { withRouter, browserHistory as history } from 'react-router'; import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import { getFormInitialValues, SubmissionError } from 'redux-form'; import PartnerProfileMandateBackground from './partnerProfileMandateBackground'; import PartnerProfileMandateGovernance from './partnerProfileMandateGovernance'; import PartnerProfileMandateEthics from './partnerProfileMandateEthics'; import PartnerProfileMandateExperience from './partnerProfileMandateExperience'; import PartnerProfileMandatePopulation from './partnerProfileMandatePopulation'; import PartnerProfileMandateCountryPresence from './partnerProfileMandateCountryPresence'; import PartnerProfileMandateSecurity from './partnerProfileMandateSecurity'; import PartnerProfileStepperContainer from '../partnerProfileStepperContainer'; import { patchPartnerProfile } from '../../../../reducers/partnerProfileDetailsUpdate'; import { flatten } from '../../../../helpers/jsonMapper'; import { changedValues } from '../../../../helpers/apiHelper'; import { loadPartnerDetails } from '../../../../reducers/partnerProfileDetails'; import { emptyMsg } from '../partnerProfileEdit'; const STEPS = readOnly => [ { component: <PartnerProfileMandateBackground readOnly={readOnly} />, label: 'Background', name: 'background', }, { component: <PartnerProfileMandateGovernance readOnly={readOnly} />, label: 'Governance', name: 'governance', }, { component: <PartnerProfileMandateEthics readOnly={readOnly} />, label: 'Ethics', name: 'ethics', }, { component: <PartnerProfileMandateExperience readOnly={readOnly} />, label: 'Experience', name: 'experience', }, { component: <PartnerProfileMandatePopulation readOnly={readOnly} />, label: 'Population of Concern', name: 'populations_of_concern', infoText: 'Populations of Concern: is composed of various groups of people including ' + 'refugees, asylum-seekers, internally displaced persons (IDPs) protected/assisted by ' + 'UNHCR, stateless persons and returnees (returned refugees and IDPs).', }, { component: <PartnerProfileMandateCountryPresence readOnly={readOnly} />, label: 'Country Presence', name: 'country_presence', }, { component: <PartnerProfileMandateSecurity readOnly={readOnly} />, label: 'Security', name: 'security', }, ]; class PartnerProfileMandate extends Component { constructor(props) { super(props); this.state = { actionOnSubmit: {}, }; this.handleSubmit = this.handleSubmit.bind(this); this.handleNext = this.handleNext.bind(this); this.handleExit = this.handleExit.bind(this); } onSubmit() { const { partnerId, tabs, params: { type } } = this.props; if (this.state.actionOnSubmit === 'next') { const index = tabs.findIndex(itab => itab.path === type); history.push({ pathname: `/profile/${partnerId}/edit/${tabs[index + 1].path}`, }); } else if (this.state.actionOnSubmit === 'exit') { history.push(`/profile/${partnerId}/overview`); } } handleNext() { this.setState({ actionOnSubmit: 'next' }); } handleExit() { this.setState({ actionOnSubmit: 'exit' }); } handleSubmit(formValues) { const { initialValues, updateTab, partnerId, loadPartnerProfileDetails } = this.props; const mandateMission = flatten(formValues.mandate_mission); const initMandateMission = flatten(initialValues.mandate_mission); const convertExperiences = mandateMission.specializations ? R.flatten(R.map(item => (item.areas ? R.map(area => R.assoc('years', item.years, R.objOf('specialization_id', area)), item.areas) : []), mandateMission.specializations)) : []; const changed = changedValues(initMandateMission, mandateMission); let patchValues = R.assoc('experiences', R.filter(item => !R.isNil(item.specialization_id), convertExperiences), changed); if (R.isEmpty(patchValues.experiences)) { patchValues = R.dissoc('experiences', patchValues); } if (!R.isEmpty(patchValues)) { return updateTab(partnerId, 'mandate-mission', patchValues) .then(() => loadPartnerProfileDetails(partnerId).then(() => this.onSubmit())) .catch((error) => { const errorMsg = error.response.data.non_field_errors || 'Error while saving sections. Please try again.'; throw new SubmissionError({ ...error.response.data, _error: errorMsg, }); }); } throw new SubmissionError({ _error: emptyMsg, }); } render() { const { readOnly } = this.props; return (<PartnerProfileStepperContainer handleNext={this.handleNext} handleExit={this.handleExit} onSubmit={this.handleSubmit} name="mandate_mission" readOnly={readOnly} steps={STEPS(readOnly)} /> ); } } PartnerProfileMandate.propTypes = { readOnly: PropTypes.bool, partnerId: PropTypes.string, updateTab: PropTypes.func, initialValues: PropTypes.object, loadPartnerProfileDetails: PropTypes.func, params: PropTypes.object, tabs: PropTypes.array, }; const mapState = (state, ownProps) => ({ partnerId: ownProps.params.id, tabs: state.partnerProfileDetailsNav.tabs, initialValues: getFormInitialValues('partnerProfile')(state), }); const mapDispatch = dispatch => ({ loadPartnerProfileDetails: partnerId => dispatch(loadPartnerDetails(partnerId)), updateTab: (partnerId, tabName, body) => dispatch(patchPartnerProfile(partnerId, tabName, body)), dispatch, }); const connectedPartnerProfileMandate = connect(mapState, mapDispatch)(PartnerProfileMandate); export default withRouter(connectedPartnerProfileMandate);
src/Parser/Priest/Shadow/Modules/Spells/VoidformGraph.js
enragednuke/WoWAnalyzer
import React from 'react'; import PropTypes from 'prop-types'; import ChartistGraph from 'react-chartist'; import Chartist from 'chartist'; import 'chartist-plugin-legend'; import './VoidformsTab.css'; const formatDuration = (duration) => { const seconds = Math.floor(duration % 60); return `${Math.floor(duration / 60)}:${seconds < 10 ? `0${seconds}` : seconds}`; }; const MAX_MINDBENDER_MS = 21500; // changing this value will have a large impact on webbrowser performance. About 200 seems to be best of 2 worlds. const RESOLUTION_MS = 200; const TIMESTAMP_ERROR_MARGIN = 500; const NORMAL_VOIDFORM_MS_THRESHOLD = 70000; const SURRENDER_TO_MADNESS_VOIDFORM_MS_THRESHOLD = 150000; // current insanity formula: // d = 6 + (2/3)*x // where d = total drain of Insanity over 1 second // max insanity is 10000 (100 ingame) const INSANITY_DRAIN_INCREASE = 2 / 3 * 100; // ~66.67; const INSANITY_DRAIN_INITIAL = 6 * 100; // 600; const VOIDFORM_MINIMUM_INITIAL_INSANITY = 65 * 100; // 6500; const T20_4P_DECREASE_DRAIN_MODIFIER_NORMAL = 0.9; const T20_4P_DECREASE_DRAIN_MODIFIER_SURRENDER_TO_MADNESS = 0.95; const VoidformGraph = ({ lingeringInsanityStacks, mindbenderEvents, voidTorrentEvents, dispersionEvents, insanityEvents, surrenderToMadness = false, setT20P4 = false, fightEnd, ...voidform }) => { // todo: change ended to end on Voidform for consistency; const voidFormEnd = voidform.ended === undefined ? fightEnd : voidform.ended; const includesEndOfFight = voidform.ended === undefined || fightEnd <= voidform.ended + TIMESTAMP_ERROR_MARGIN; const MAX_TIME_IN_VOIDFORM = surrenderToMadness ? SURRENDER_TO_MADNESS_VOIDFORM_MS_THRESHOLD : NORMAL_VOIDFORM_MS_THRESHOLD; const labels = []; const stacksData = []; const insanityData = []; const insanityGeneratedData = []; const insanityDrain = []; const initialInsanity = insanityEvents.length > 0 ? insanityEvents[0].classResources[0].amount - (insanityEvents[0].resourceChange * 100) - (insanityEvents[0].waste * 100) : VOIDFORM_MINIMUM_INITIAL_INSANITY; const lingeringInsanityData = []; const mindbenderData = []; const voidTorrentData = []; const dispersionData = []; const endOfVoidformData = []; const endData = []; const INSANITY_DRAIN_MODIFIER = setT20P4 ? (surrenderToMadness ? T20_4P_DECREASE_DRAIN_MODIFIER_SURRENDER_TO_MADNESS : T20_4P_DECREASE_DRAIN_MODIFIER_NORMAL) : 1; const INSANITY_DRAIN_START = INSANITY_DRAIN_INITIAL * INSANITY_DRAIN_MODIFIER; const INSANITY_DRAIN_INCREASE_BY_SECOND = Math.round(INSANITY_DRAIN_INCREASE * INSANITY_DRAIN_MODIFIER); const atLabel = timestamp => Math.floor((timestamp - voidform.start) / RESOLUTION_MS); const voidFormIsOver = i => voidform.start + i * RESOLUTION_MS >= voidform.ended; const fillData = (array, eventStart, eventEnd, data = false) => { const amountOfSteps = Math.round((eventEnd - eventStart) / RESOLUTION_MS); const startStep = atLabel(eventStart); for (let i = 0; i < amountOfSteps; i += 1) { if (eventStart + i * RESOLUTION_MS >= voidform.ended) break; array[startStep + i] = data || stacksData[startStep + i]; } }; const steps = MAX_TIME_IN_VOIDFORM / RESOLUTION_MS; for (let i = 0; i < steps; i += 1) { labels[i] = i; stacksData[i] = null; lingeringInsanityData[i] = null; insanityData[i] = null; insanityGeneratedData[i] = null; mindbenderData[i] = null; voidTorrentData[i] = null; dispersionData[i] = null; endData[i] = null; endOfVoidformData[i] = null; } voidform.stacks.forEach(({ stack, timestamp }) => { fillData(stacksData, timestamp, timestamp + 1000, stack); }); // fill in dispersion gaps & 100s+ voidforms: for (let i = 0; i <= steps; i += 1) { if (stacksData[i] === null && (i * RESOLUTION_MS) + voidform.start < voidform.ended) stacksData[i] = stacksData[i - 1]; } endOfVoidformData[atLabel(voidform.ended) + 1] = 100; endOfVoidformData[atLabel(voidform.ended)] = 100; if (lingeringInsanityStacks.length > 0) lingeringInsanityData[0] = lingeringInsanityStacks[0].stack + 2; lingeringInsanityStacks.forEach(lingering => lingeringInsanityData[atLabel(lingering.timestamp)] = lingering.stack); dispersionEvents.filter(dispersion => dispersion.start >= voidform.start && dispersion.end <= voidFormEnd + TIMESTAMP_ERROR_MARGIN).forEach(dispersion => fillData(dispersionData, dispersion.start, dispersion.end)); mindbenderEvents.filter(mindbender => mindbender.start >= voidform.start && mindbender.end <= voidFormEnd + MAX_MINDBENDER_MS).forEach(mindbender => fillData(mindbenderData, mindbender.start, mindbender.end)); voidTorrentEvents.filter(voidTorrent => voidTorrent.start >= voidform.start && voidTorrent.end <= voidFormEnd + TIMESTAMP_ERROR_MARGIN).forEach(voidTorrent => fillData(voidTorrentData, voidTorrent.start, voidTorrent.end)); let currentDrain = INSANITY_DRAIN_START; let lastestDrainIncrease = 0; for (let i = 0; i < steps; i += 1) { // set drain to 0 if voidform ended: if (voidFormIsOver(i)) { currentDrain = 0; break; } // dont increase if dispersion/voidtorrent is active: if (dispersionData[i] === null && voidTorrentData[i] === null) { lastestDrainIncrease += 1; // only increase drain every second: if (lastestDrainIncrease % (1000 / RESOLUTION_MS) === 0) { currentDrain += INSANITY_DRAIN_INCREASE_BY_SECOND; } } insanityDrain[i] = currentDrain; } insanityData[0] = initialInsanity; insanityEvents.forEach(event => insanityData[atLabel(event.timestamp)] = event.classResources[0].amount); let latestInsanityDataAt = 0; for (let i = 0; i < steps; i += 1) { if (insanityData[i] === null) { insanityData[i] = insanityData[latestInsanityDataAt]; for (let j = latestInsanityDataAt; j <= i; j += 1) { if (dispersionData[j] === null && voidTorrentData[j] === null) { insanityData[i] -= insanityDrain[j] / (1000 / RESOLUTION_MS); } } if (insanityData[i] < 0) insanityData[i] = 0; } else { latestInsanityDataAt = i; } } let legends = { classNames: [ 'stacks', 'insanity', // 'insanityDrain', 'voidtorrent', 'mindbender', 'dispersion', 'endOfVoidform', ], }; let chartData = { labels, series: [ { className: 'stacks', name: 'Stacks', data: Object.keys(stacksData).map(key => stacksData[key]).slice(0, steps), }, { className: 'insanity', name: 'Insanity', data: Object.keys(insanityData).map(key => insanityData[key] / 100).slice(0, steps), }, { className: 'voidtorrent', name: 'Void Torrent', data: Object.keys(voidTorrentData).map(key => voidTorrentData[key]).slice(0, steps), }, // { // className: 'insanityDrain', // name: 'InsanityDrain', // data: Object.keys(insanityDrain).map(key => insanityDrain[key]/100).slice(0, steps), // }, { className: 'mindbender', name: 'Mindbender', data: Object.keys(mindbenderData).map(key => mindbenderData[key]).slice(0, steps), }, { className: 'dispersion', name: 'Dispersion', data: Object.keys(dispersionData).map(key => dispersionData[key]).slice(0, steps), }, { className: 'endOfVoidform', name: 'End of Voidform', data: Object.keys(endOfVoidformData).map(key => endOfVoidformData[key]).slice(0, steps), }, ], }; if (lingeringInsanityStacks.length > 0) { chartData = { ...chartData, series: [ { className: 'lingeringInsanity', name: 'Lingering Insanity', data: Object.keys(lingeringInsanityData).map(key => lingeringInsanityData[key]).slice(0, steps), }, ...chartData.series, ], }; legends = { ...legends, classNames: [ 'lingeringInsanity', ...legends.classNames, ], }; } if (includesEndOfFight) { const fightEndedAtSecond = atLabel(fightEnd); endData[fightEndedAtSecond - 1] = 100; endData[fightEndedAtSecond] = 100; chartData = { ...chartData, series: [ ...chartData.series, { className: 'endOfFight', name: 'End of Fight', data: Object.keys(endData).map(key => endData[key]).slice(0, steps), }, ], }; legends = { ...legends, classNames: [ ...legends.classNames, 'endOfFight', ], }; } return (<ChartistGraph data={chartData} options={{ low: 0, high: 100, series: { Stacks: { lineSmooth: Chartist.Interpolation.none({ fillHoles: true, }), showPoint: false, }, // 'insanityDrain': { // lineSmooth: Chartist.Interpolation.none({ // fillHoles: true, // }), // showPoint: false, // show: false, // }, Insanity: { lineSmooth: Chartist.Interpolation.none({ fillHoles: true, }), showPoint: false, }, Mindbender: { showArea: true, lineSmooth: Chartist.Interpolation.none({ fillHoles: true, }), }, 'Void Torrent': { showArea: true, }, Dispersion: { showArea: true, // lineSmooth: Chartist.Interpolation.step({ // fillHoles: true, // }), }, 'Lingering Insanity': { showArea: true, lineSmooth: Chartist.Interpolation.none({ fillHoles: true, }), }, 'End of Fight': { showArea: true, }, 'End of Voidform': { showArea: true, }, }, fullWidth: true, height: '200px', axisX: { labelInterpolationFnc: function skipLabels(ms) { const everySecond = surrenderToMadness ? 10 : 5; return (ms * (RESOLUTION_MS / 1000)) % everySecond === 0 ? formatDuration(ms * (RESOLUTION_MS / 1000)) : null; }, offset: 30, }, axisY: { onlyInteger: true, offset: 50, labelInterpolationFnc: function skipLabels(numberOfStacks) { return numberOfStacks; }, }, plugins: [ Chartist.plugins.legend(legends), ], }} type="Line" />); }; VoidformGraph.propTypes = { fightEnd: PropTypes.number, lingeringInsanityStacks: PropTypes.array, insanityEvents: PropTypes.array, mindbenderEvents: PropTypes.array, voidTorrentEvents: PropTypes.array, dispersionEvents: PropTypes.array, surrenderToMadness: PropTypes.bool, setT20P4: PropTypes.bool.isRequired, }; export default VoidformGraph;
src/svg-icons/image/photo-size-select-large.js
kittyjumbalaya/material-components-web
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImagePhotoSizeSelectLarge = (props) => ( <SvgIcon {...props}> <path d="M21 15h2v2h-2v-2zm0-4h2v2h-2v-2zm2 8h-2v2c1 0 2-1 2-2zM13 3h2v2h-2V3zm8 4h2v2h-2V7zm0-4v2h2c0-1-1-2-2-2zM1 7h2v2H1V7zm16-4h2v2h-2V3zm0 16h2v2h-2v-2zM3 3C2 3 1 4 1 5h2V3zm6 0h2v2H9V3zM5 3h2v2H5V3zm-4 8v8c0 1.1.9 2 2 2h12V11H1zm2 8l2.5-3.21 1.79 2.15 2.5-3.22L13 19H3z"/> </SvgIcon> ); ImagePhotoSizeSelectLarge = pure(ImagePhotoSizeSelectLarge); ImagePhotoSizeSelectLarge.displayName = 'ImagePhotoSizeSelectLarge'; ImagePhotoSizeSelectLarge.muiName = 'SvgIcon'; export default ImagePhotoSizeSelectLarge;
polyfill-service-web/app/components/PolyfillList/Polyfill.js
reiniergs/polyfill-service
import React from 'react'; import { Link } from 'react-router'; import Icon from '../Icon'; export default ({ name, sizeMin, sizeRaw }) => { return ( <div className="slds-tile slds-media"> <div className="slds-media__figure"> <Icon iconName="standard:solution" assistiveText={name} /> </div> <div className="slds-media__body"> <h3 className="slds-truncate" title="SLDS_038.zip"> <Link to={`polyfill/${name}`}>{name}</Link> </h3> <div className="slds-tile__detail slds-text-body--small"> <ul className="slds-list--horizontal slds-has-dividers--right"> <li className="slds-item">Size Raw</li> <li className="slds-item">{`${getKbSize(sizeRaw)}KB`}</li> </ul> <ul className="slds-list--horizontal slds-has-dividers--right"> <li className="slds-item">Size Min</li> <li className="slds-item">{`${getKbSize(sizeMin)}KB`}</li> </ul> </div> </div> </div> ) } function getKbSize(bytes) { return Math.round(bytes / 1024 * 100)/100; }
src/components/input/date/react-date-picker/header.js
KleeGroup/focus-components
let PropTypes = require('prop-types'); import React from 'react'; let P = PropTypes import onEnter from './on-enter'; export default class extends React.Component { static displayName = 'DatePickerHeader'; static propTypes = { onChange: P.func, onPrev: P.func, onNext: P.func, colspan: P.number, children: P.node }; render() { let props = this.props return (<div className='dp-header'> <div className='dp-nav-table'> <div className='dp-row'> <div tabIndex='1' role='link' className='dp-prev-nav dp-nav-cell dp-cell' onClick={props.onPrev} onKeyUp={onEnter(props.onPrev)} >{props.prevText} </div> <div tabIndex='1' role='link' className='dp-nav-view dp-cell' colSpan={props.colspan} onClick={props.onChange} onKeyUp={onEnter(props.onChange)} >{props.children}</div> <div tabIndex='1' role='link' className='dp-next-nav dp-nav-cell dp-cell' onClick={props.onNext} onKeyUp={onEnter(props.onNext)} >{props.nextText}</div> </div> </div> </div>) } }
ajax/libs/react-dnd/9.3.1/cjs/common/DndContext.min.js
cdnjs/cdnjs
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createDndContext=createDndContext,exports.DndContext=void 0;var React=_interopRequireWildcard(require("react")),_dndCore=require("dnd-core");function _interopRequireWildcard(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var n=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,t):{};n.get||n.set?Object.defineProperty(r,t,n):r[t]=e[t]}return r.default=e,r}var DndContext=React.createContext({dragDropManager:void 0});function createDndContext(e,r,t,n){return{dragDropManager:(0,_dndCore.createDragDropManager)(e,r,t,n)}}exports.DndContext=DndContext;
src/shared/views/topMenu/TopMenuHeader/TopMenuHeader.js
in-depth/indepth-core
import React from 'react' import styles from './topMenuHeader.css' const TopMenuHeader = (props) => { return ( <div className={styles.header}> <h1>{props.title}</h1> </div> ) } TopMenuHeader.propTypes = { title: React.PropTypes.string.isRequired, } export default TopMenuHeader
stories/ToggleSwitch/index.js
skyiea/wix-style-react
import React from 'react'; import story from '../utils/Components/Story'; import CodeExample from '../utils/Components/CodeExample'; import ExampleStandard from './ExampleStandard'; import ExampleStandardRaw from '!raw-loader!./ExampleStandard'; import ExampleSizes from './ExampleSizes'; import ExampleSizesRaw from '!raw-loader!./ExampleSizes'; import ExampleControlled from './ExampleControlled'; import ExampleControlledRaw from '!raw-loader!./ExampleControlled'; story({ category: 'Core', componentSrcFolder: 'ToggleSwitch', componentProps: (setProps, getProps) => ({ onChange: () => setProps({checked: !getProps().checked}) }), examples: ( <div> <CodeExample title="Standard" code={ExampleStandardRaw}> <ExampleStandard/> </CodeExample> <CodeExample title="Sizes" code={ExampleSizesRaw}> <ExampleSizes/> </CodeExample> <CodeExample title="Controlled input" code={ExampleControlledRaw}> <ExampleControlled/> </CodeExample> </div> ) });
src/components/Loans/OpenLoans/components/BulkClaimReturnedModal/BulkClaimReturnedModal.js
folio-org/ui-users
import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage, FormattedDate, injectIntl } from 'react-intl'; import { Link } from 'react-router-dom'; import { isEmpty } from 'lodash'; import moment from 'moment'; import { Button, Col, Layout, Modal, ModalFooter, MultiColumnList, Spinner, TextArea, } from '@folio/stripes/components'; import { getOpenRequestsPath } from '../../../../util'; import refundTransferClaimReturned from '../../../../util/refundTransferClaimReturned'; import css from '../../../../ModalContent'; class BulkClaimReturnedModal extends React.Component { static manifest = Object.freeze({ claimReturned: { type: 'okapi', fetch: false, throwErrors: false, POST: { path: 'circulation/loans/%{loanId}/claim-item-returned', }, }, feefineactions: { type: 'okapi', records: 'feefineactions', path: 'feefineactions', fetch: false, accumulate: true, }, accounts: { type: 'okapi', records: 'accounts', PUT: { path: 'accounts/%{activeAccount.id}', }, fetch: false, accumulate: true, }, activeAccount: {}, loanId: {}, }); static propTypes = { checkedLoansIndex: PropTypes.object.isRequired, intl: PropTypes.object.isRequired, mutator: PropTypes.shape({ claimReturned: PropTypes.shape({ POST: PropTypes.func.isRequired, }).isRequired, loanId: PropTypes.shape({ replace: PropTypes.func.isRequired, }).isRequired, accounts: PropTypes.shape({ GET: PropTypes.func.isRequired, PUT: PropTypes.func.isRequired, }), feefineactions: PropTypes.shape({ GET: PropTypes.func.isRequired, POST: PropTypes.func.isRequired, }), activeAccount: PropTypes.shape({ update: PropTypes.func, }).isRequired, }).isRequired, okapi: PropTypes.shape({ currentUser: PropTypes.object.isRequired, }).isRequired, stripes: PropTypes.shape({ connect: PropTypes.func.isRequired, hasPerm: PropTypes.func, }), onCancel: PropTypes.func.isRequired, open: PropTypes.bool.isRequired, requestCounts: PropTypes.object.isRequired, } constructor(props) { super(props); this.state = { additionalInfo: '', // The 'additional information' text included as part of a claim returned POST operationState: 'pre', // Whether we're at the start ('pre') or end ('post') of a transaction unchangedLoans: [], // An array of loans that were *not* changed (i.e., had errors) after a POST }; } // Return the number of requests for item @id // requestCounts is an object of the form {<item id>: <number of requests>}, // with keys present only if the item in question has >0 requests. Thus, if // none of the selected items have any requests on them, requestCounts === {}. getRequestCountForItem = id => { const { requestCounts, stripes, } = this.props; const itemRequestCount = requestCounts[id] || 0; if (itemRequestCount && stripes.hasPerm('ui-users.requests.all')) { return ( <Link data-test-item-request-count to={getOpenRequestsPath(id)} > {itemRequestCount} </Link>); } return itemRequestCount; } handleAdditionalInfoChange = e => { this.setState({ additionalInfo: e.target.value.trim() }); }; claimItemReturned = (loan) => { if (!loan) return null; this.props.mutator.loanId.replace(loan.id); return this.props.mutator.claimReturned.POST( { itemClaimedReturnedDateTime: moment().format(), comment: this.state.additionalInfo, } ); } claimAllReturned = () => { const promises = Object .values(this.props.checkedLoansIndex) .map(loan => this.claimItemReturned(loan) .then(refundTransferClaimReturned.refundTransfers(loan, this.props)) .catch(e => e)); Promise.all(promises) .then(results => this.finishClaims(results)); } finishClaims = (results) => { this.setState({ operationState: 'post', // Each item in the results array will either be a simple object that represents a // successful change (including an id value) or a larger object representing // a CORS error (identifiable by the properties ok: false and url). unchangedLoans: results.filter(r => r.ok === false).map(r => r.url?.match(/^.*\/(.*)\/claim-item-returned/)[1]), }); } onCancel = () => { this.setState({ operationState: 'pre' }); this.props.onCancel(); } // Renders a modal dialog containing a list of items to be claimed returned for both // pre-operation review and post-operation feedback (i.e., there's one modal, but the // contents will be different before and after clicking the 'Confirm' button.) render() { const { checkedLoansIndex, intl, open, } = this.props; const { additionalInfo, operationState, unchangedLoans, // List of loans for which the claim returned operation failed } = this.state; const loans = checkedLoansIndex ? Object.values(checkedLoansIndex) : []; // Controls for the preview dialog const preOpFooter = ( <ModalFooter> <Layout className="textRight"> <Button data-test-bulk-cr-cancel-button onClick={this.onCancel} > <FormattedMessage id="ui-users.cancel" /> </Button> <Button data-test-bulk-cr-confirm-button buttonStyle="primary" onClick={this.claimAllReturned} disabled={!additionalInfo} > <FormattedMessage id="ui-users.confirm" /> </Button> </Layout> </ModalFooter> ); // Control for the feedback dialog const postOpFooter = ( <ModalFooter> <Layout className="textRight"> <Button data-test-bulk-cr-close-button buttonStyle="primary" onClick={this.onCancel} > <FormattedMessage id="ui-users.blocks.closeButton" /> </Button> </Layout> </ModalFooter> ); const columns = [ 'bulkClaimReturnedTitle', 'bulkClaimReturnedDueDate', 'bulkClaimReturnedRequests', 'bulkClaimReturnedBarcode', 'bulkClaimReturnedCallNumber', 'bulkClaimReturnedLoanPolicy', ]; if (operationState === 'post') { columns.unshift('bulkClaimReturnedStatus'); } const statuses = { OK: <FormattedMessage id="ui-users.bulkClaimReturned.status.ok" />, NOT_OK: <FormattedMessage id="ui-users.bulkClaimReturned.status.notOk" />, }; const loansList = <MultiColumnList interactive={false} contentData={loans} visibleColumns={columns} columnMapping={{ bulkClaimReturnedStatus: <FormattedMessage id="ui-users.bulkClaimReturned.status" />, bulkClaimReturnedTitle: <FormattedMessage id="ui-users.bulkClaimReturned.item.title" />, bulkClaimReturnedDueDate: <FormattedMessage id="ui-users.dueDate" />, bulkClaimReturnedRequests: <FormattedMessage id="ui-users.loans.details.requests" />, bulkClaimReturnedBarcode: <FormattedMessage id="ui-users.item.barcode" />, bulkClaimReturnedCallNumber: <FormattedMessage id="ui-users.item.callNumberComponents.callNumber" />, bulkClaimReturnedLoanPolicy: <FormattedMessage id="ui-users.loans.details.loanPolicy" />, }} formatter={{ bulkClaimReturnedStatus: loan => (unchangedLoans.includes(loan.id) ? statuses.NOT_OK : statuses.OK), bulkClaimReturnedTitle: loan => loan?.item?.title, bulkClaimReturnedDueDate: loan => <FormattedDate value={loan?.dueDate} />, bulkClaimReturnedRequests: loan => this.getRequestCountForItem(loan?.item?.id), bulkClaimReturnedBarcode: loan => loan?.item?.barcode, bulkClaimReturnedCallNumber: loan => loan?.item?.callNumber, bulkClaimReturnedLoanPolicy: loan => loan?.loanPolicy?.name, }} />; let modalHeader; let statusMessage; if (operationState === 'pre') { modalHeader = <FormattedMessage id="ui-users.bulkClaimReturned.preConfirm" />; statusMessage = <FormattedMessage id="ui-users.bulkClaimReturned.summary" values={{ numLoans: loans.length }} />; } else { const numSuccessfulOperations = loans.length - unchangedLoans.length; modalHeader = <FormattedMessage id="ui-users.bulkClaimReturned.postConfirm" />; statusMessage = unchangedLoans.length > 0 ? <> <FormattedMessage id="ui-users.bulkClaimReturned.items.notOk" values={{ numItems: unchangedLoans.length }} /> {' '} <FormattedMessage id="ui-users.bulkClaimReturned.items.ok" values={{ numItems: numSuccessfulOperations }} /> </> : <FormattedMessage id="ui-users.bulkClaimReturned.items.ok" values={{ numItems: numSuccessfulOperations }} />; } const modalContent = <> {statusMessage} {loansList} {operationState === 'pre' && <Col sm={12} className={css.additionalInformation}> <TextArea data-test-bulk-claim-returned-additional-info label={<FormattedMessage id="ui-users.additionalInfo.label" />} placeholder={intl.formatMessage({ id: 'ui-users.bulkClaimReturned.moreInfoPlaceholder' })} required onChange={this.handleAdditionalInfoChange} /> </Col> } </>; return ( <Modal data-test-bulk-claim-returned-modal label={modalHeader} closeOnBackgroundClick dismissible onClose={this.onCancel} open={open} footer={operationState === 'pre' ? preOpFooter : postOpFooter} > { isEmpty(loans) ? <Layout className="textCentered"> <Spinner /> </Layout> : modalContent } </Modal> ); } } export default injectIntl(BulkClaimReturnedModal);
ajax/libs/angular.js/0.9.0/angular-scenario.min.js
ramda/cdnjs
/*! * jQuery JavaScript Library v1.4.2 * http://jquery.com/ * * Copyright 2010, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * Includes Sizzle.js * http://sizzlejs.com/ * Copyright 2010, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * * Date: Sat Feb 13 22:33:48 2010 -0500 */ (function(aM,C){var a=function(aY,aZ){return new a.fn.init(aY,aZ)},n=aM.jQuery,R=aM.$,ab=aM.document,X,P=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,aW=/^.[^:#\[\.,]*$/,ax=/\S/,M=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,e=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,b=navigator.userAgent,u,K=false,ad=[],aG,at=Object.prototype.toString,ap=Object.prototype.hasOwnProperty,g=Array.prototype.push,F=Array.prototype.slice,s=Array.prototype.indexOf;a.fn=a.prototype={init:function(aY,a1){var a0,a2,aZ,a3;if(!aY){return this}if(aY.nodeType){this.context=this[0]=aY;this.length=1;return this}if(aY==="body"&&!a1){this.context=ab;this[0]=ab.body;this.selector="body";this.length=1;return this}if(typeof aY==="string"){a0=P.exec(aY);if(a0&&(a0[1]||!a1)){if(a0[1]){a3=(a1?a1.ownerDocument||a1:ab);aZ=e.exec(aY);if(aZ){if(a.isPlainObject(a1)){aY=[ab.createElement(aZ[1])];a.fn.attr.call(aY,a1,true)}else{aY=[a3.createElement(aZ[1])]}}else{aZ=J([a0[1]],[a3]);aY=(aZ.cacheable?aZ.fragment.cloneNode(true):aZ.fragment).childNodes}return a.merge(this,aY)}else{a2=ab.getElementById(a0[2]);if(a2){if(a2.id!==a0[2]){return X.find(aY)}this.length=1;this[0]=a2}this.context=ab;this.selector=aY;return this}}else{if(!a1&&/^\w+$/.test(aY)){this.selector=aY;this.context=ab;aY=ab.getElementsByTagName(aY);return a.merge(this,aY)}else{if(!a1||a1.jquery){return(a1||X).find(aY)}else{return a(a1).find(aY)}}}}else{if(a.isFunction(aY)){return X.ready(aY)}}if(aY.selector!==C){this.selector=aY.selector;this.context=aY.context}return a.makeArray(aY,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(aY){return aY==null?this.toArray():(aY<0?this.slice(aY)[0]:this[aY])},pushStack:function(aZ,a1,aY){var a0=a();if(a.isArray(aZ)){g.apply(a0,aZ)}else{a.merge(a0,aZ)}a0.prevObject=this;a0.context=this.context;if(a1==="find"){a0.selector=this.selector+(this.selector?" ":"")+aY}else{if(a1){a0.selector=this.selector+"."+a1+"("+aY+")"}}return a0},each:function(aZ,aY){return a.each(this,aZ,aY)},ready:function(aY){a.bindReady();if(a.isReady){aY.call(ab,a)}else{if(ad){ad.push(aY)}}return this},eq:function(aY){return aY===-1?this.slice(aY):this.slice(aY,+aY+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(aY){return this.pushStack(a.map(this,function(a0,aZ){return aY.call(a0,aZ,a0)}))},end:function(){return this.prevObject||a(null)},push:g,sort:[].sort,splice:[].splice};a.fn.init.prototype=a.fn;a.extend=a.fn.extend=function(){var a3=arguments[0]||{},a2=1,a1=arguments.length,a5=false,a6,a0,aY,aZ;if(typeof a3==="boolean"){a5=a3;a3=arguments[1]||{};a2=2}if(typeof a3!=="object"&&!a.isFunction(a3)){a3={}}if(a1===a2){a3=this;--a2}for(;a2<a1;a2++){if((a6=arguments[a2])!=null){for(a0 in a6){aY=a3[a0];aZ=a6[a0];if(a3===aZ){continue}if(a5&&aZ&&(a.isPlainObject(aZ)||a.isArray(aZ))){var a4=aY&&(a.isPlainObject(aY)||a.isArray(aY))?aY:a.isArray(aZ)?[]:{};a3[a0]=a.extend(a5,a4,aZ)}else{if(aZ!==C){a3[a0]=aZ}}}}}return a3};a.extend({noConflict:function(aY){aM.$=R;if(aY){aM.jQuery=n}return a},isReady:false,ready:function(){if(!a.isReady){if(!ab.body){return setTimeout(a.ready,13)}a.isReady=true;if(ad){var aZ,aY=0;while((aZ=ad[aY++])){aZ.call(ab,a)}ad=null}if(a.fn.triggerHandler){a(ab).triggerHandler("ready")}}},bindReady:function(){if(K){return}K=true;if(ab.readyState==="complete"){return a.ready()}if(ab.addEventListener){ab.addEventListener("DOMContentLoaded",aG,false);aM.addEventListener("load",a.ready,false)}else{if(ab.attachEvent){ab.attachEvent("onreadystatechange",aG);aM.attachEvent("onload",a.ready);var aY=false;try{aY=aM.frameElement==null}catch(aZ){}if(ab.documentElement.doScroll&&aY){x()}}}},isFunction:function(aY){return at.call(aY)==="[object Function]"},isArray:function(aY){return at.call(aY)==="[object Array]"},isPlainObject:function(aZ){if(!aZ||at.call(aZ)!=="[object Object]"||aZ.nodeType||aZ.setInterval){return false}if(aZ.constructor&&!ap.call(aZ,"constructor")&&!ap.call(aZ.constructor.prototype,"isPrototypeOf")){return false}var aY;for(aY in aZ){}return aY===C||ap.call(aZ,aY)},isEmptyObject:function(aZ){for(var aY in aZ){return false}return true},error:function(aY){throw aY},parseJSON:function(aY){if(typeof aY!=="string"||!aY){return null}aY=a.trim(aY);if(/^[\],:{}\s]*$/.test(aY.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){return aM.JSON&&aM.JSON.parse?aM.JSON.parse(aY):(new Function("return "+aY))()}else{a.error("Invalid JSON: "+aY)}},noop:function(){},globalEval:function(a0){if(a0&&ax.test(a0)){var aZ=ab.getElementsByTagName("head")[0]||ab.documentElement,aY=ab.createElement("script");aY.type="text/javascript";if(a.support.scriptEval){aY.appendChild(ab.createTextNode(a0))}else{aY.text=a0}aZ.insertBefore(aY,aZ.firstChild);aZ.removeChild(aY)}},nodeName:function(aZ,aY){return aZ.nodeName&&aZ.nodeName.toUpperCase()===aY.toUpperCase()},each:function(a1,a5,a0){var aZ,a2=0,a3=a1.length,aY=a3===C||a.isFunction(a1);if(a0){if(aY){for(aZ in a1){if(a5.apply(a1[aZ],a0)===false){break}}}else{for(;a2<a3;){if(a5.apply(a1[a2++],a0)===false){break}}}}else{if(aY){for(aZ in a1){if(a5.call(a1[aZ],aZ,a1[aZ])===false){break}}}else{for(var a4=a1[0];a2<a3&&a5.call(a4,a2,a4)!==false;a4=a1[++a2]){}}}return a1},trim:function(aY){return(aY||"").replace(M,"")},makeArray:function(a0,aZ){var aY=aZ||[];if(a0!=null){if(a0.length==null||typeof a0==="string"||a.isFunction(a0)||(typeof a0!=="function"&&a0.setInterval)){g.call(aY,a0)}else{a.merge(aY,a0)}}return aY},inArray:function(a0,a1){if(a1.indexOf){return a1.indexOf(a0)}for(var aY=0,aZ=a1.length;aY<aZ;aY++){if(a1[aY]===a0){return aY}}return -1},merge:function(a2,a0){var a1=a2.length,aZ=0;if(typeof a0.length==="number"){for(var aY=a0.length;aZ<aY;aZ++){a2[a1++]=a0[aZ]}}else{while(a0[aZ]!==C){a2[a1++]=a0[aZ++]}}a2.length=a1;return a2},grep:function(aZ,a3,aY){var a0=[];for(var a1=0,a2=aZ.length;a1<a2;a1++){if(!aY!==!a3(aZ[a1],a1)){a0.push(aZ[a1])}}return a0},map:function(aZ,a4,aY){var a0=[],a3;for(var a1=0,a2=aZ.length;a1<a2;a1++){a3=a4(aZ[a1],a1,aY);if(a3!=null){a0[a0.length]=a3}}return a0.concat.apply([],a0)},guid:1,proxy:function(a0,aZ,aY){if(arguments.length===2){if(typeof aZ==="string"){aY=a0;a0=aY[aZ];aZ=C}else{if(aZ&&!a.isFunction(aZ)){aY=aZ;aZ=C}}}if(!aZ&&a0){aZ=function(){return a0.apply(aY||this,arguments)}}if(a0){aZ.guid=a0.guid=a0.guid||aZ.guid||a.guid++}return aZ},uaMatch:function(aZ){aZ=aZ.toLowerCase();var aY=/(webkit)[ \/]([\w.]+)/.exec(aZ)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(aZ)||/(msie) ([\w.]+)/.exec(aZ)||!/compatible/.test(aZ)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(aZ)||[];return{browser:aY[1]||"",version:aY[2]||"0"}},browser:{}});u=a.uaMatch(b);if(u.browser){a.browser[u.browser]=true;a.browser.version=u.version}if(a.browser.webkit){a.browser.safari=true}if(s){a.inArray=function(aY,aZ){return s.call(aZ,aY)}}X=a(ab);if(ab.addEventListener){aG=function(){ab.removeEventListener("DOMContentLoaded",aG,false);a.ready()}}else{if(ab.attachEvent){aG=function(){if(ab.readyState==="complete"){ab.detachEvent("onreadystatechange",aG);a.ready()}}}}function x(){if(a.isReady){return}try{ab.documentElement.doScroll("left")}catch(aY){setTimeout(x,1);return}a.ready()}function aV(aY,aZ){if(aZ.src){a.ajax({url:aZ.src,async:false,dataType:"script"})}else{a.globalEval(aZ.text||aZ.textContent||aZ.innerHTML||"")}if(aZ.parentNode){aZ.parentNode.removeChild(aZ)}}function an(aY,a6,a4,a0,a3,a5){var aZ=aY.length;if(typeof a6==="object"){for(var a1 in a6){an(aY,a1,a6[a1],a0,a3,a4)}return aY}if(a4!==C){a0=!a5&&a0&&a.isFunction(a4);for(var a2=0;a2<aZ;a2++){a3(aY[a2],a6,a0?a4.call(aY[a2],a2,a3(aY[a2],a6)):a4,a5)}return aY}return aZ?a3(aY[0],a6):C}function aP(){return(new Date).getTime()}(function(){a.support={};var a4=ab.documentElement,a3=ab.createElement("script"),aY=ab.createElement("div"),aZ="script"+aP();aY.style.display="none";aY.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var a6=aY.getElementsByTagName("*"),a5=aY.getElementsByTagName("a")[0];if(!a6||!a6.length||!a5){return}a.support={leadingWhitespace:aY.firstChild.nodeType===3,tbody:!aY.getElementsByTagName("tbody").length,htmlSerialize:!!aY.getElementsByTagName("link").length,style:/red/.test(a5.getAttribute("style")),hrefNormalized:a5.getAttribute("href")==="/a",opacity:/^0.55$/.test(a5.style.opacity),cssFloat:!!a5.style.cssFloat,checkOn:aY.getElementsByTagName("input")[0].value==="on",optSelected:ab.createElement("select").appendChild(ab.createElement("option")).selected,parentNode:aY.removeChild(aY.appendChild(ab.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};a3.type="text/javascript";try{a3.appendChild(ab.createTextNode("window."+aZ+"=1;"))}catch(a1){}a4.insertBefore(a3,a4.firstChild);if(aM[aZ]){a.support.scriptEval=true;delete aM[aZ]}try{delete a3.test}catch(a1){a.support.deleteExpando=false}a4.removeChild(a3);if(aY.attachEvent&&aY.fireEvent){aY.attachEvent("onclick",function a7(){a.support.noCloneEvent=false;aY.detachEvent("onclick",a7)});aY.cloneNode(true).fireEvent("onclick")}aY=ab.createElement("div");aY.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var a0=ab.createDocumentFragment();a0.appendChild(aY.firstChild);a.support.checkClone=a0.cloneNode(true).cloneNode(true).lastChild.checked;a(function(){var a8=ab.createElement("div");a8.style.width=a8.style.paddingLeft="1px";ab.body.appendChild(a8);a.boxModel=a.support.boxModel=a8.offsetWidth===2;ab.body.removeChild(a8).style.display="none";a8=null});var a2=function(a8){var ba=ab.createElement("div");a8="on"+a8;var a9=(a8 in ba);if(!a9){ba.setAttribute(a8,"return;");a9=typeof ba[a8]==="function"}ba=null;return a9};a.support.submitBubbles=a2("submit");a.support.changeBubbles=a2("change");a4=a3=aY=a6=a5=null})();a.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var aI="jQuery"+aP(),aH=0,aT={};a.extend({cache:{},expando:aI,noData:{embed:true,object:true,applet:true},data:function(a0,aZ,a2){if(a0.nodeName&&a.noData[a0.nodeName.toLowerCase()]){return}a0=a0==aM?aT:a0;var a3=a0[aI],aY=a.cache,a1;if(!a3&&typeof aZ==="string"&&a2===C){return null}if(!a3){a3=++aH}if(typeof aZ==="object"){a0[aI]=a3;a1=aY[a3]=a.extend(true,{},aZ)}else{if(!aY[a3]){a0[aI]=a3;aY[a3]={}}}a1=aY[a3];if(a2!==C){a1[aZ]=a2}return typeof aZ==="string"?a1[aZ]:a1},removeData:function(a0,aZ){if(a0.nodeName&&a.noData[a0.nodeName.toLowerCase()]){return}a0=a0==aM?aT:a0;var a2=a0[aI],aY=a.cache,a1=aY[a2];if(aZ){if(a1){delete a1[aZ];if(a.isEmptyObject(a1)){a.removeData(a0)}}}else{if(a.support.deleteExpando){delete a0[a.expando]}else{if(a0.removeAttribute){a0.removeAttribute(a.expando)}}delete aY[a2]}}});a.fn.extend({data:function(aY,a0){if(typeof aY==="undefined"&&this.length){return a.data(this[0])}else{if(typeof aY==="object"){return this.each(function(){a.data(this,aY)})}}var a1=aY.split(".");a1[1]=a1[1]?"."+a1[1]:"";if(a0===C){var aZ=this.triggerHandler("getData"+a1[1]+"!",[a1[0]]);if(aZ===C&&this.length){aZ=a.data(this[0],aY)}return aZ===C&&a1[1]?this.data(a1[0]):aZ}else{return this.trigger("setData"+a1[1]+"!",[a1[0],a0]).each(function(){a.data(this,aY,a0)})}},removeData:function(aY){return this.each(function(){a.removeData(this,aY)})}});a.extend({queue:function(aZ,aY,a1){if(!aZ){return}aY=(aY||"fx")+"queue";var a0=a.data(aZ,aY);if(!a1){return a0||[]}if(!a0||a.isArray(a1)){a0=a.data(aZ,aY,a.makeArray(a1))}else{a0.push(a1)}return a0},dequeue:function(a1,a0){a0=a0||"fx";var aY=a.queue(a1,a0),aZ=aY.shift();if(aZ==="inprogress"){aZ=aY.shift()}if(aZ){if(a0==="fx"){aY.unshift("inprogress")}aZ.call(a1,function(){a.dequeue(a1,a0)})}}});a.fn.extend({queue:function(aY,aZ){if(typeof aY!=="string"){aZ=aY;aY="fx"}if(aZ===C){return a.queue(this[0],aY)}return this.each(function(a1,a2){var a0=a.queue(this,aY,aZ);if(aY==="fx"&&a0[0]!=="inprogress"){a.dequeue(this,aY)}})},dequeue:function(aY){return this.each(function(){a.dequeue(this,aY)})},delay:function(aZ,aY){aZ=a.fx?a.fx.speeds[aZ]||aZ:aZ;aY=aY||"fx";return this.queue(aY,function(){var a0=this;setTimeout(function(){a.dequeue(a0,aY)},aZ)})},clearQueue:function(aY){return this.queue(aY||"fx",[])}});var ao=/[\n\t]/g,S=/\s+/,av=/\r/g,aQ=/href|src|style/,d=/(button|input)/i,z=/(button|input|object|select|textarea)/i,j=/^(a|area)$/i,I=/radio|checkbox/;a.fn.extend({attr:function(aY,aZ){return an(this,aY,aZ,true,a.attr)},removeAttr:function(aY,aZ){return this.each(function(){a.attr(this,aY,"");if(this.nodeType===1){this.removeAttribute(aY)}})},addClass:function(a5){if(a.isFunction(a5)){return this.each(function(a8){var a7=a(this);a7.addClass(a5.call(this,a8,a7.attr("class")))})}if(a5&&typeof a5==="string"){var aY=(a5||"").split(S);for(var a1=0,a0=this.length;a1<a0;a1++){var aZ=this[a1];if(aZ.nodeType===1){if(!aZ.className){aZ.className=a5}else{var a2=" "+aZ.className+" ",a4=aZ.className;for(var a3=0,a6=aY.length;a3<a6;a3++){if(a2.indexOf(" "+aY[a3]+" ")<0){a4+=" "+aY[a3]}}aZ.className=a.trim(a4)}}}}return this},removeClass:function(a3){if(a.isFunction(a3)){return this.each(function(a7){var a6=a(this);a6.removeClass(a3.call(this,a7,a6.attr("class")))})}if((a3&&typeof a3==="string")||a3===C){var a4=(a3||"").split(S);for(var a0=0,aZ=this.length;a0<aZ;a0++){var a2=this[a0];if(a2.nodeType===1&&a2.className){if(a3){var a1=(" "+a2.className+" ").replace(ao," ");for(var a5=0,aY=a4.length;a5<aY;a5++){a1=a1.replace(" "+a4[a5]+" "," ")}a2.className=a.trim(a1)}else{a2.className=""}}}}return this},toggleClass:function(a1,aZ){var a0=typeof a1,aY=typeof aZ==="boolean";if(a.isFunction(a1)){return this.each(function(a3){var a2=a(this);a2.toggleClass(a1.call(this,a3,a2.attr("class"),aZ),aZ)})}return this.each(function(){if(a0==="string"){var a4,a3=0,a2=a(this),a5=aZ,a6=a1.split(S);while((a4=a6[a3++])){a5=aY?a5:!a2.hasClass(a4);a2[a5?"addClass":"removeClass"](a4)}}else{if(a0==="undefined"||a0==="boolean"){if(this.className){a.data(this,"__className__",this.className)}this.className=this.className||a1===false?"":a.data(this,"__className__")||""}}})},hasClass:function(aY){var a1=" "+aY+" ";for(var a0=0,aZ=this.length;a0<aZ;a0++){if((" "+this[a0].className+" ").replace(ao," ").indexOf(a1)>-1){return true}}return false},val:function(a5){if(a5===C){var aZ=this[0];if(aZ){if(a.nodeName(aZ,"option")){return(aZ.attributes.value||{}).specified?aZ.value:aZ.text}if(a.nodeName(aZ,"select")){var a3=aZ.selectedIndex,a6=[],a7=aZ.options,a2=aZ.type==="select-one";if(a3<0){return null}for(var a0=a2?a3:0,a4=a2?a3+1:a7.length;a0<a4;a0++){var a1=a7[a0];if(a1.selected){a5=a(a1).val();if(a2){return a5}a6.push(a5)}}return a6}if(I.test(aZ.type)&&!a.support.checkOn){return aZ.getAttribute("value")===null?"on":aZ.value}return(aZ.value||"").replace(av,"")}return C}var aY=a.isFunction(a5);return this.each(function(ba){var a9=a(this),bb=a5;if(this.nodeType!==1){return}if(aY){bb=a5.call(this,ba,a9.val())}if(typeof bb==="number"){bb+=""}if(a.isArray(bb)&&I.test(this.type)){this.checked=a.inArray(a9.val(),bb)>=0}else{if(a.nodeName(this,"select")){var a8=a.makeArray(bb);a("option",this).each(function(){this.selected=a.inArray(a(this).val(),a8)>=0});if(!a8.length){this.selectedIndex=-1}}else{this.value=bb}}})}});a.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(aZ,aY,a4,a7){if(!aZ||aZ.nodeType===3||aZ.nodeType===8){return C}if(a7&&aY in a.attrFn){return a(aZ)[aY](a4)}var a0=aZ.nodeType!==1||!a.isXMLDoc(aZ),a3=a4!==C;aY=a0&&a.props[aY]||aY;if(aZ.nodeType===1){var a2=aQ.test(aY);if(aY==="selected"&&!a.support.optSelected){var a5=aZ.parentNode;if(a5){a5.selectedIndex;if(a5.parentNode){a5.parentNode.selectedIndex}}}if(aY in aZ&&a0&&!a2){if(a3){if(aY==="type"&&d.test(aZ.nodeName)&&aZ.parentNode){a.error("type property can't be changed")}aZ[aY]=a4}if(a.nodeName(aZ,"form")&&aZ.getAttributeNode(aY)){return aZ.getAttributeNode(aY).nodeValue}if(aY==="tabIndex"){var a6=aZ.getAttributeNode("tabIndex");return a6&&a6.specified?a6.value:z.test(aZ.nodeName)||j.test(aZ.nodeName)&&aZ.href?0:C}return aZ[aY]}if(!a.support.style&&a0&&aY==="style"){if(a3){aZ.style.cssText=""+a4}return aZ.style.cssText}if(a3){aZ.setAttribute(aY,""+a4)}var a1=!a.support.hrefNormalized&&a0&&a2?aZ.getAttribute(aY,2):aZ.getAttribute(aY);return a1===null?C:a1}return a.style(aZ,aY,a4)}});var aC=/\.(.*)$/,A=function(aY){return aY.replace(/[^\w\s\.\|`]/g,function(aZ){return"\\"+aZ})};a.event={add:function(a1,a5,ba,a3){if(a1.nodeType===3||a1.nodeType===8){return}if(a1.setInterval&&(a1!==aM&&!a1.frameElement)){a1=aM}var aZ,a9;if(ba.handler){aZ=ba;ba=aZ.handler}if(!ba.guid){ba.guid=a.guid++}var a6=a.data(a1);if(!a6){return}var bb=a6.events=a6.events||{},a4=a6.handle,a4;if(!a4){a6.handle=a4=function(){return typeof a!=="undefined"&&!a.event.triggered?a.event.handle.apply(a4.elem,arguments):C}}a4.elem=a1;a5=a5.split(" ");var a8,a2=0,aY;while((a8=a5[a2++])){a9=aZ?a.extend({},aZ):{handler:ba,data:a3};if(a8.indexOf(".")>-1){aY=a8.split(".");a8=aY.shift();a9.namespace=aY.slice(0).sort().join(".")}else{aY=[];a9.namespace=""}a9.type=a8;a9.guid=ba.guid;var a0=bb[a8],a7=a.event.special[a8]||{};if(!a0){a0=bb[a8]=[];if(!a7.setup||a7.setup.call(a1,a3,aY,a4)===false){if(a1.addEventListener){a1.addEventListener(a8,a4,false)}else{if(a1.attachEvent){a1.attachEvent("on"+a8,a4)}}}}if(a7.add){a7.add.call(a1,a9);if(!a9.handler.guid){a9.handler.guid=ba.guid}}a0.push(a9);a.event.global[a8]=true}a1=null},global:{},remove:function(bd,a8,aZ,a4){if(bd.nodeType===3||bd.nodeType===8){return}var bg,a3,a5,bb=0,a1,a6,a9,a2,a7,aY,bf,bc=a.data(bd),a0=bc&&bc.events;if(!bc||!a0){return}if(a8&&a8.type){aZ=a8.handler;a8=a8.type}if(!a8||typeof a8==="string"&&a8.charAt(0)==="."){a8=a8||"";for(a3 in a0){a.event.remove(bd,a3+a8)}return}a8=a8.split(" ");while((a3=a8[bb++])){bf=a3;aY=null;a1=a3.indexOf(".")<0;a6=[];if(!a1){a6=a3.split(".");a3=a6.shift();a9=new RegExp("(^|\\.)"+a.map(a6.slice(0).sort(),A).join("\\.(?:.*\\.)?")+"(\\.|$)")}a7=a0[a3];if(!a7){continue}if(!aZ){for(var ba=0;ba<a7.length;ba++){aY=a7[ba];if(a1||a9.test(aY.namespace)){a.event.remove(bd,bf,aY.handler,ba);a7.splice(ba--,1)}}continue}a2=a.event.special[a3]||{};for(var ba=a4||0;ba<a7.length;ba++){aY=a7[ba];if(aZ.guid===aY.guid){if(a1||a9.test(aY.namespace)){if(a4==null){a7.splice(ba--,1)}if(a2.remove){a2.remove.call(bd,aY)}}if(a4!=null){break}}}if(a7.length===0||a4!=null&&a7.length===1){if(!a2.teardown||a2.teardown.call(bd,a6)===false){ag(bd,a3,bc.handle)}bg=null;delete a0[a3]}}if(a.isEmptyObject(a0)){var be=bc.handle;if(be){be.elem=null}delete bc.events;delete bc.handle;if(a.isEmptyObject(bc)){a.removeData(bd)}}},trigger:function(aY,a2,a0){var a7=aY.type||aY,a1=arguments[3];if(!a1){aY=typeof aY==="object"?aY[aI]?aY:a.extend(a.Event(a7),aY):a.Event(a7);if(a7.indexOf("!")>=0){aY.type=a7=a7.slice(0,-1);aY.exclusive=true}if(!a0){aY.stopPropagation();if(a.event.global[a7]){a.each(a.cache,function(){if(this.events&&this.events[a7]){a.event.trigger(aY,a2,this.handle.elem)}})}}if(!a0||a0.nodeType===3||a0.nodeType===8){return C}aY.result=C;aY.target=a0;a2=a.makeArray(a2);a2.unshift(aY)}aY.currentTarget=a0;var a3=a.data(a0,"handle");if(a3){a3.apply(a0,a2)}var a8=a0.parentNode||a0.ownerDocument;try{if(!(a0&&a0.nodeName&&a.noData[a0.nodeName.toLowerCase()])){if(a0["on"+a7]&&a0["on"+a7].apply(a0,a2)===false){aY.result=false}}}catch(a5){}if(!aY.isPropagationStopped()&&a8){a.event.trigger(aY,a2,a8,true)}else{if(!aY.isDefaultPrevented()){var a4=aY.target,aZ,a9=a.nodeName(a4,"a")&&a7==="click",a6=a.event.special[a7]||{};if((!a6._default||a6._default.call(a0,aY)===false)&&!a9&&!(a4&&a4.nodeName&&a.noData[a4.nodeName.toLowerCase()])){try{if(a4[a7]){aZ=a4["on"+a7];if(aZ){a4["on"+a7]=null}a.event.triggered=true;a4[a7]()}}catch(a5){}if(aZ){a4["on"+a7]=aZ}a.event.triggered=false}}}},handle:function(aY){var a6,a0,aZ,a1,a7;aY=arguments[0]=a.event.fix(aY||aM.event);aY.currentTarget=this;a6=aY.type.indexOf(".")<0&&!aY.exclusive;if(!a6){aZ=aY.type.split(".");aY.type=aZ.shift();a1=new RegExp("(^|\\.)"+aZ.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}var a7=a.data(this,"events"),a0=a7[aY.type];if(a7&&a0){a0=a0.slice(0);for(var a3=0,a2=a0.length;a3<a2;a3++){var a5=a0[a3];if(a6||a1.test(a5.namespace)){aY.handler=a5.handler;aY.data=a5.data;aY.handleObj=a5;var a4=a5.handler.apply(this,arguments);if(a4!==C){aY.result=a4;if(a4===false){aY.preventDefault();aY.stopPropagation()}}if(aY.isImmediatePropagationStopped()){break}}}}return aY.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a1){if(a1[aI]){return a1}var aZ=a1;a1=a.Event(aZ);for(var a0=this.props.length,a3;a0;){a3=this.props[--a0];a1[a3]=aZ[a3]}if(!a1.target){a1.target=a1.srcElement||ab}if(a1.target.nodeType===3){a1.target=a1.target.parentNode}if(!a1.relatedTarget&&a1.fromElement){a1.relatedTarget=a1.fromElement===a1.target?a1.toElement:a1.fromElement}if(a1.pageX==null&&a1.clientX!=null){var a2=ab.documentElement,aY=ab.body;a1.pageX=a1.clientX+(a2&&a2.scrollLeft||aY&&aY.scrollLeft||0)-(a2&&a2.clientLeft||aY&&aY.clientLeft||0);a1.pageY=a1.clientY+(a2&&a2.scrollTop||aY&&aY.scrollTop||0)-(a2&&a2.clientTop||aY&&aY.clientTop||0)}if(!a1.which&&((a1.charCode||a1.charCode===0)?a1.charCode:a1.keyCode)){a1.which=a1.charCode||a1.keyCode}if(!a1.metaKey&&a1.ctrlKey){a1.metaKey=a1.ctrlKey}if(!a1.which&&a1.button!==C){a1.which=(a1.button&1?1:(a1.button&2?3:(a1.button&4?2:0)))}return a1},guid:100000000,proxy:a.proxy,special:{ready:{setup:a.bindReady,teardown:a.noop},live:{add:function(aY){a.event.add(this,aY.origType,a.extend({},aY,{handler:V}))},remove:function(aZ){var aY=true,a0=aZ.origType.replace(aC,"");a.each(a.data(this,"events").live||[],function(){if(a0===this.origType.replace(aC,"")){aY=false;return false}});if(aY){a.event.remove(this,aZ.origType,V)}}},beforeunload:{setup:function(a0,aZ,aY){if(this.setInterval){this.onbeforeunload=aY}return false},teardown:function(aZ,aY){if(this.onbeforeunload===aY){this.onbeforeunload=null}}}}};var ag=ab.removeEventListener?function(aZ,aY,a0){aZ.removeEventListener(aY,a0,false)}:function(aZ,aY,a0){aZ.detachEvent("on"+aY,a0)};a.Event=function(aY){if(!this.preventDefault){return new a.Event(aY)}if(aY&&aY.type){this.originalEvent=aY;this.type=aY.type}else{this.type=aY}this.timeStamp=aP();this[aI]=true};function aR(){return false}function f(){return true}a.Event.prototype={preventDefault:function(){this.isDefaultPrevented=f;var aY=this.originalEvent;if(!aY){return}if(aY.preventDefault){aY.preventDefault()}aY.returnValue=false},stopPropagation:function(){this.isPropagationStopped=f;var aY=this.originalEvent;if(!aY){return}if(aY.stopPropagation){aY.stopPropagation()}aY.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=f;this.stopPropagation()},isDefaultPrevented:aR,isPropagationStopped:aR,isImmediatePropagationStopped:aR};var Q=function(aZ){var aY=aZ.relatedTarget;try{while(aY&&aY!==this){aY=aY.parentNode}if(aY!==this){aZ.type=aZ.data;a.event.handle.apply(this,arguments)}}catch(a0){}},ay=function(aY){aY.type=aY.data;a.event.handle.apply(this,arguments)};a.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(aZ,aY){a.event.special[aZ]={setup:function(a0){a.event.add(this,aY,a0&&a0.selector?ay:Q,aZ)},teardown:function(a0){a.event.remove(this,aY,a0&&a0.selector?ay:Q)}}});if(!a.support.submitBubbles){a.event.special.submit={setup:function(aZ,aY){if(this.nodeName.toLowerCase()!=="form"){a.event.add(this,"click.specialSubmit",function(a2){var a1=a2.target,a0=a1.type;if((a0==="submit"||a0==="image")&&a(a1).closest("form").length){return aA("submit",this,arguments)}});a.event.add(this,"keypress.specialSubmit",function(a2){var a1=a2.target,a0=a1.type;if((a0==="text"||a0==="password")&&a(a1).closest("form").length&&a2.keyCode===13){return aA("submit",this,arguments)}})}else{return false}},teardown:function(aY){a.event.remove(this,".specialSubmit")}}}if(!a.support.changeBubbles){var aq=/textarea|input|select/i,aS,i=function(aZ){var aY=aZ.type,a0=aZ.value;if(aY==="radio"||aY==="checkbox"){a0=aZ.checked}else{if(aY==="select-multiple"){a0=aZ.selectedIndex>-1?a.map(aZ.options,function(a1){return a1.selected}).join("-"):""}else{if(aZ.nodeName.toLowerCase()==="select"){a0=aZ.selectedIndex}}}return a0},O=function O(a0){var aY=a0.target,aZ,a1;if(!aq.test(aY.nodeName)||aY.readOnly){return}aZ=a.data(aY,"_change_data");a1=i(aY);if(a0.type!=="focusout"||aY.type!=="radio"){a.data(aY,"_change_data",a1)}if(aZ===C||a1===aZ){return}if(aZ!=null||a1){a0.type="change";return a.event.trigger(a0,arguments[1],aY)}};a.event.special.change={filters:{focusout:O,click:function(a0){var aZ=a0.target,aY=aZ.type;if(aY==="radio"||aY==="checkbox"||aZ.nodeName.toLowerCase()==="select"){return O.call(this,a0)}},keydown:function(a0){var aZ=a0.target,aY=aZ.type;if((a0.keyCode===13&&aZ.nodeName.toLowerCase()!=="textarea")||(a0.keyCode===32&&(aY==="checkbox"||aY==="radio"))||aY==="select-multiple"){return O.call(this,a0)}},beforeactivate:function(aZ){var aY=aZ.target;a.data(aY,"_change_data",i(aY))}},setup:function(a0,aZ){if(this.type==="file"){return false}for(var aY in aS){a.event.add(this,aY+".specialChange",aS[aY])}return aq.test(this.nodeName)},teardown:function(aY){a.event.remove(this,".specialChange");return aq.test(this.nodeName)}};aS=a.event.special.change.filters}function aA(aZ,a0,aY){aY[0].type=aZ;return a.event.handle.apply(a0,aY)}if(ab.addEventListener){a.each({focus:"focusin",blur:"focusout"},function(a0,aY){a.event.special[aY]={setup:function(){this.addEventListener(a0,aZ,true)},teardown:function(){this.removeEventListener(a0,aZ,true)}};function aZ(a1){a1=a.event.fix(a1);a1.type=aY;return a.event.handle.call(this,a1)}})}a.each(["bind","one"],function(aZ,aY){a.fn[aY]=function(a5,a6,a4){if(typeof a5==="object"){for(var a2 in a5){this[aY](a2,a6,a5[a2],a4)}return this}if(a.isFunction(a6)){a4=a6;a6=C}var a3=aY==="one"?a.proxy(a4,function(a7){a(this).unbind(a7,a3);return a4.apply(this,arguments)}):a4;if(a5==="unload"&&aY!=="one"){this.one(a5,a6,a4)}else{for(var a1=0,a0=this.length;a1<a0;a1++){a.event.add(this[a1],a5,a3,a6)}}return this}});a.fn.extend({unbind:function(a2,a1){if(typeof a2==="object"&&!a2.preventDefault){for(var a0 in a2){this.unbind(a0,a2[a0])}}else{for(var aZ=0,aY=this.length;aZ<aY;aZ++){a.event.remove(this[aZ],a2,a1)}}return this},delegate:function(aY,aZ,a1,a0){return this.live(aZ,a1,a0,aY)},undelegate:function(aY,aZ,a0){if(arguments.length===0){return this.unbind("live")}else{return this.die(aZ,null,a0,aY)}},trigger:function(aY,aZ){return this.each(function(){a.event.trigger(aY,aZ,this)})},triggerHandler:function(aY,a0){if(this[0]){var aZ=a.Event(aY);aZ.preventDefault();aZ.stopPropagation();a.event.trigger(aZ,a0,this[0]);return aZ.result}},toggle:function(a0){var aY=arguments,aZ=1;while(aZ<aY.length){a.proxy(a0,aY[aZ++])}return this.click(a.proxy(a0,function(a1){var a2=(a.data(this,"lastToggle"+a0.guid)||0)%aZ;a.data(this,"lastToggle"+a0.guid,a2+1);a1.preventDefault();return aY[a2].apply(this,arguments)||false}))},hover:function(aY,aZ){return this.mouseenter(aY).mouseleave(aZ||aY)}});var aw={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};a.each(["live","die"],function(aZ,aY){a.fn[aY]=function(a7,a4,a9,a2){var a8,a5=0,a6,a1,ba,a3=a2||this.selector,a0=a2?this:a(this.context);if(a.isFunction(a4)){a9=a4;a4=C}a7=(a7||"").split(" ");while((a8=a7[a5++])!=null){a6=aC.exec(a8);a1="";if(a6){a1=a6[0];a8=a8.replace(aC,"")}if(a8==="hover"){a7.push("mouseenter"+a1,"mouseleave"+a1);continue}ba=a8;if(a8==="focus"||a8==="blur"){a7.push(aw[a8]+a1);a8=a8+a1}else{a8=(aw[a8]||a8)+a1}if(aY==="live"){a0.each(function(){a.event.add(this,m(a8,a3),{data:a4,selector:a3,handler:a9,origType:a8,origHandler:a9,preType:ba})})}else{a0.unbind(m(a8,a3),a9)}}return this}});function V(aY){var a8,aZ=[],bb=[],a7=arguments,ba,a6,a9,a1,a3,a5,a2,a4,bc=a.data(this,"events");if(aY.liveFired===this||!bc||!bc.live||aY.button&&aY.type==="click"){return}aY.liveFired=this;var a0=bc.live.slice(0);for(a3=0;a3<a0.length;a3++){a9=a0[a3];if(a9.origType.replace(aC,"")===aY.type){bb.push(a9.selector)}else{a0.splice(a3--,1)}}a6=a(aY.target).closest(bb,aY.currentTarget);for(a5=0,a2=a6.length;a5<a2;a5++){for(a3=0;a3<a0.length;a3++){a9=a0[a3];if(a6[a5].selector===a9.selector){a1=a6[a5].elem;ba=null;if(a9.preType==="mouseenter"||a9.preType==="mouseleave"){ba=a(aY.relatedTarget).closest(a9.selector)[0]}if(!ba||ba!==a1){aZ.push({elem:a1,handleObj:a9})}}}}for(a5=0,a2=aZ.length;a5<a2;a5++){a6=aZ[a5];aY.currentTarget=a6.elem;aY.data=a6.handleObj.data;aY.handleObj=a6.handleObj;if(a6.handleObj.origHandler.apply(a6.elem,a7)===false){a8=false;break}}return a8}function m(aZ,aY){return"live."+(aZ&&aZ!=="*"?aZ+".":"")+aY.replace(/\./g,"`").replace(/ /g,"&")}a.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").split(" "),function(aZ,aY){a.fn[aY]=function(a0){return a0?this.bind(aY,a0):this.trigger(aY)};if(a.attrFn){a.attrFn[aY]=true}});if(aM.attachEvent&&!aM.addEventListener){aM.attachEvent("onunload",function(){for(var aZ in a.cache){if(a.cache[aZ].handle){try{a.event.remove(a.cache[aZ].handle.elem)}catch(aY){}}}}); /*! * Sizzle CSS Selector Engine - v1.0 * Copyright 2009, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ }(function(){var a9=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,ba=0,bc=Object.prototype.toString,a4=false,a3=true;[0,0].sort(function(){a3=false;return 0});var a0=function(bl,bg,bo,bp){bo=bo||[];var br=bg=bg||ab;if(bg.nodeType!==1&&bg.nodeType!==9){return[]}if(!bl||typeof bl!=="string"){return bo}var bm=[],bi,bt,bw,bh,bk=true,bj=a1(bg),bq=bl;while((a9.exec(""),bi=a9.exec(bq))!==null){bq=bi[3];bm.push(bi[1]);if(bi[2]){bh=bi[3];break}}if(bm.length>1&&a5.exec(bl)){if(bm.length===2&&a6.relative[bm[0]]){bt=bd(bm[0]+bm[1],bg)}else{bt=a6.relative[bm[0]]?[bg]:a0(bm.shift(),bg);while(bm.length){bl=bm.shift();if(a6.relative[bl]){bl+=bm.shift()}bt=bd(bl,bt)}}}else{if(!bp&&bm.length>1&&bg.nodeType===9&&!bj&&a6.match.ID.test(bm[0])&&!a6.match.ID.test(bm[bm.length-1])){var bs=a0.find(bm.shift(),bg,bj);bg=bs.expr?a0.filter(bs.expr,bs.set)[0]:bs.set[0]}if(bg){var bs=bp?{expr:bm.pop(),set:a8(bp)}:a0.find(bm.pop(),bm.length===1&&(bm[0]==="~"||bm[0]==="+")&&bg.parentNode?bg.parentNode:bg,bj);bt=bs.expr?a0.filter(bs.expr,bs.set):bs.set;if(bm.length>0){bw=a8(bt)}else{bk=false}while(bm.length){var bv=bm.pop(),bu=bv;if(!a6.relative[bv]){bv=""}else{bu=bm.pop()}if(bu==null){bu=bg}a6.relative[bv](bw,bu,bj)}}else{bw=bm=[]}}if(!bw){bw=bt}if(!bw){a0.error(bv||bl)}if(bc.call(bw)==="[object Array]"){if(!bk){bo.push.apply(bo,bw)}else{if(bg&&bg.nodeType===1){for(var bn=0;bw[bn]!=null;bn++){if(bw[bn]&&(bw[bn]===true||bw[bn].nodeType===1&&a7(bg,bw[bn]))){bo.push(bt[bn])}}}else{for(var bn=0;bw[bn]!=null;bn++){if(bw[bn]&&bw[bn].nodeType===1){bo.push(bt[bn])}}}}}else{a8(bw,bo)}if(bh){a0(bh,br,bo,bp);a0.uniqueSort(bo)}return bo};a0.uniqueSort=function(bh){if(bb){a4=a3;bh.sort(bb);if(a4){for(var bg=1;bg<bh.length;bg++){if(bh[bg]===bh[bg-1]){bh.splice(bg--,1)}}}}return bh};a0.matches=function(bg,bh){return a0(bg,null,null,bh)};a0.find=function(bn,bg,bo){var bm,bk;if(!bn){return[]}for(var bj=0,bi=a6.order.length;bj<bi;bj++){var bl=a6.order[bj],bk;if((bk=a6.leftMatch[bl].exec(bn))){var bh=bk[1];bk.splice(1,1);if(bh.substr(bh.length-1)!=="\\"){bk[1]=(bk[1]||"").replace(/\\/g,"");bm=a6.find[bl](bk,bg,bo);if(bm!=null){bn=bn.replace(a6.match[bl],"");break}}}}if(!bm){bm=bg.getElementsByTagName("*")}return{set:bm,expr:bn}};a0.filter=function(br,bq,bu,bk){var bi=br,bw=[],bo=bq,bm,bg,bn=bq&&bq[0]&&a1(bq[0]);while(br&&bq.length){for(var bp in a6.filter){if((bm=a6.leftMatch[bp].exec(br))!=null&&bm[2]){var bh=a6.filter[bp],bv,bt,bj=bm[1];bg=false;bm.splice(1,1);if(bj.substr(bj.length-1)==="\\"){continue}if(bo===bw){bw=[]}if(a6.preFilter[bp]){bm=a6.preFilter[bp](bm,bo,bu,bw,bk,bn);if(!bm){bg=bv=true}else{if(bm===true){continue}}}if(bm){for(var bl=0;(bt=bo[bl])!=null;bl++){if(bt){bv=bh(bt,bm,bl,bo);var bs=bk^!!bv;if(bu&&bv!=null){if(bs){bg=true}else{bo[bl]=false}}else{if(bs){bw.push(bt);bg=true}}}}}if(bv!==C){if(!bu){bo=bw}br=br.replace(a6.match[bp],"");if(!bg){return[]}break}}}if(br===bi){if(bg==null){a0.error(br)}else{break}}bi=br}return bo};a0.error=function(bg){throw"Syntax error, unrecognized expression: "+bg};var a6=a0.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(bg){return bg.getAttribute("href")}},relative:{"+":function(bm,bh){var bj=typeof bh==="string",bl=bj&&!/\W/.test(bh),bn=bj&&!bl;if(bl){bh=bh.toLowerCase()}for(var bi=0,bg=bm.length,bk;bi<bg;bi++){if((bk=bm[bi])){while((bk=bk.previousSibling)&&bk.nodeType!==1){}bm[bi]=bn||bk&&bk.nodeName.toLowerCase()===bh?bk||false:bk===bh}}if(bn){a0.filter(bh,bm,true)}},">":function(bm,bh){var bk=typeof bh==="string";if(bk&&!/\W/.test(bh)){bh=bh.toLowerCase();for(var bi=0,bg=bm.length;bi<bg;bi++){var bl=bm[bi];if(bl){var bj=bl.parentNode;bm[bi]=bj.nodeName.toLowerCase()===bh?bj:false}}}else{for(var bi=0,bg=bm.length;bi<bg;bi++){var bl=bm[bi];if(bl){bm[bi]=bk?bl.parentNode:bl.parentNode===bh}}if(bk){a0.filter(bh,bm,true)}}},"":function(bj,bh,bl){var bi=ba++,bg=be;if(typeof bh==="string"&&!/\W/.test(bh)){var bk=bh=bh.toLowerCase();bg=aY}bg("parentNode",bh,bi,bj,bk,bl)},"~":function(bj,bh,bl){var bi=ba++,bg=be;if(typeof bh==="string"&&!/\W/.test(bh)){var bk=bh=bh.toLowerCase();bg=aY}bg("previousSibling",bh,bi,bj,bk,bl)}},find:{ID:function(bh,bi,bj){if(typeof bi.getElementById!=="undefined"&&!bj){var bg=bi.getElementById(bh[1]);return bg?[bg]:[]}},NAME:function(bi,bl){if(typeof bl.getElementsByName!=="undefined"){var bh=[],bk=bl.getElementsByName(bi[1]);for(var bj=0,bg=bk.length;bj<bg;bj++){if(bk[bj].getAttribute("name")===bi[1]){bh.push(bk[bj])}}return bh.length===0?null:bh}},TAG:function(bg,bh){return bh.getElementsByTagName(bg[1])}},preFilter:{CLASS:function(bj,bh,bi,bg,bm,bn){bj=" "+bj[1].replace(/\\/g,"")+" ";if(bn){return bj}for(var bk=0,bl;(bl=bh[bk])!=null;bk++){if(bl){if(bm^(bl.className&&(" "+bl.className+" ").replace(/[\t\n]/g," ").indexOf(bj)>=0)){if(!bi){bg.push(bl)}}else{if(bi){bh[bk]=false}}}}return false},ID:function(bg){return bg[1].replace(/\\/g,"")},TAG:function(bh,bg){return bh[1].toLowerCase()},CHILD:function(bg){if(bg[1]==="nth"){var bh=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(bg[2]==="even"&&"2n"||bg[2]==="odd"&&"2n+1"||!/\D/.test(bg[2])&&"0n+"+bg[2]||bg[2]);bg[2]=(bh[1]+(bh[2]||1))-0;bg[3]=bh[3]-0}bg[0]=ba++;return bg},ATTR:function(bk,bh,bi,bg,bl,bm){var bj=bk[1].replace(/\\/g,"");if(!bm&&a6.attrMap[bj]){bk[1]=a6.attrMap[bj]}if(bk[2]==="~="){bk[4]=" "+bk[4]+" "}return bk},PSEUDO:function(bk,bh,bi,bg,bl){if(bk[1]==="not"){if((a9.exec(bk[3])||"").length>1||/^\w/.test(bk[3])){bk[3]=a0(bk[3],null,null,bh)}else{var bj=a0.filter(bk[3],bh,bi,true^bl);if(!bi){bg.push.apply(bg,bj)}return false}}else{if(a6.match.POS.test(bk[0])||a6.match.CHILD.test(bk[0])){return true}}return bk},POS:function(bg){bg.unshift(true);return bg}},filters:{enabled:function(bg){return bg.disabled===false&&bg.type!=="hidden"},disabled:function(bg){return bg.disabled===true},checked:function(bg){return bg.checked===true},selected:function(bg){bg.parentNode.selectedIndex;return bg.selected===true},parent:function(bg){return !!bg.firstChild},empty:function(bg){return !bg.firstChild},has:function(bi,bh,bg){return !!a0(bg[3],bi).length},header:function(bg){return/h\d/i.test(bg.nodeName)},text:function(bg){return"text"===bg.type},radio:function(bg){return"radio"===bg.type},checkbox:function(bg){return"checkbox"===bg.type},file:function(bg){return"file"===bg.type},password:function(bg){return"password"===bg.type},submit:function(bg){return"submit"===bg.type},image:function(bg){return"image"===bg.type},reset:function(bg){return"reset"===bg.type},button:function(bg){return"button"===bg.type||bg.nodeName.toLowerCase()==="button"},input:function(bg){return/input|select|textarea|button/i.test(bg.nodeName)}},setFilters:{first:function(bh,bg){return bg===0},last:function(bi,bh,bg,bj){return bh===bj.length-1},even:function(bh,bg){return bg%2===0},odd:function(bh,bg){return bg%2===1},lt:function(bi,bh,bg){return bh<bg[3]-0},gt:function(bi,bh,bg){return bh>bg[3]-0},nth:function(bi,bh,bg){return bg[3]-0===bh},eq:function(bi,bh,bg){return bg[3]-0===bh}},filter:{PSEUDO:function(bm,bi,bj,bn){var bh=bi[1],bk=a6.filters[bh];if(bk){return bk(bm,bj,bi,bn)}else{if(bh==="contains"){return(bm.textContent||bm.innerText||aZ([bm])||"").indexOf(bi[3])>=0}else{if(bh==="not"){var bl=bi[3];for(var bj=0,bg=bl.length;bj<bg;bj++){if(bl[bj]===bm){return false}}return true}else{a0.error("Syntax error, unrecognized expression: "+bh)}}}},CHILD:function(bg,bj){var bm=bj[1],bh=bg;switch(bm){case"only":case"first":while((bh=bh.previousSibling)){if(bh.nodeType===1){return false}}if(bm==="first"){return true}bh=bg;case"last":while((bh=bh.nextSibling)){if(bh.nodeType===1){return false}}return true;case"nth":var bi=bj[2],bp=bj[3];if(bi===1&&bp===0){return true}var bl=bj[0],bo=bg.parentNode;if(bo&&(bo.sizcache!==bl||!bg.nodeIndex)){var bk=0;for(bh=bo.firstChild;bh;bh=bh.nextSibling){if(bh.nodeType===1){bh.nodeIndex=++bk}}bo.sizcache=bl}var bn=bg.nodeIndex-bp;if(bi===0){return bn===0}else{return(bn%bi===0&&bn/bi>=0)}}},ID:function(bh,bg){return bh.nodeType===1&&bh.getAttribute("id")===bg},TAG:function(bh,bg){return(bg==="*"&&bh.nodeType===1)||bh.nodeName.toLowerCase()===bg},CLASS:function(bh,bg){return(" "+(bh.className||bh.getAttribute("class"))+" ").indexOf(bg)>-1},ATTR:function(bl,bj){var bi=bj[1],bg=a6.attrHandle[bi]?a6.attrHandle[bi](bl):bl[bi]!=null?bl[bi]:bl.getAttribute(bi),bm=bg+"",bk=bj[2],bh=bj[4];return bg==null?bk==="!=":bk==="="?bm===bh:bk==="*="?bm.indexOf(bh)>=0:bk==="~="?(" "+bm+" ").indexOf(bh)>=0:!bh?bm&&bg!==false:bk==="!="?bm!==bh:bk==="^="?bm.indexOf(bh)===0:bk==="$="?bm.substr(bm.length-bh.length)===bh:bk==="|="?bm===bh||bm.substr(0,bh.length+1)===bh+"-":false},POS:function(bk,bh,bi,bl){var bg=bh[2],bj=a6.setFilters[bg];if(bj){return bj(bk,bi,bh,bl)}}}};var a5=a6.match.POS;for(var a2 in a6.match){a6.match[a2]=new RegExp(a6.match[a2].source+/(?![^\[]*\])(?![^\(]*\))/.source);a6.leftMatch[a2]=new RegExp(/(^(?:.|\r|\n)*?)/.source+a6.match[a2].source.replace(/\\(\d+)/g,function(bh,bg){return"\\"+(bg-0+1)}))}var a8=function(bh,bg){bh=Array.prototype.slice.call(bh,0);if(bg){bg.push.apply(bg,bh);return bg}return bh};try{Array.prototype.slice.call(ab.documentElement.childNodes,0)[0].nodeType}catch(bf){a8=function(bk,bj){var bh=bj||[];if(bc.call(bk)==="[object Array]"){Array.prototype.push.apply(bh,bk)}else{if(typeof bk.length==="number"){for(var bi=0,bg=bk.length;bi<bg;bi++){bh.push(bk[bi])}}else{for(var bi=0;bk[bi];bi++){bh.push(bk[bi])}}}return bh}}var bb;if(ab.documentElement.compareDocumentPosition){bb=function(bh,bg){if(!bh.compareDocumentPosition||!bg.compareDocumentPosition){if(bh==bg){a4=true}return bh.compareDocumentPosition?-1:1}var bi=bh.compareDocumentPosition(bg)&4?-1:bh===bg?0:1;if(bi===0){a4=true}return bi}}else{if("sourceIndex" in ab.documentElement){bb=function(bh,bg){if(!bh.sourceIndex||!bg.sourceIndex){if(bh==bg){a4=true}return bh.sourceIndex?-1:1}var bi=bh.sourceIndex-bg.sourceIndex;if(bi===0){a4=true}return bi}}else{if(ab.createRange){bb=function(bj,bh){if(!bj.ownerDocument||!bh.ownerDocument){if(bj==bh){a4=true}return bj.ownerDocument?-1:1}var bi=bj.ownerDocument.createRange(),bg=bh.ownerDocument.createRange();bi.setStart(bj,0);bi.setEnd(bj,0);bg.setStart(bh,0);bg.setEnd(bh,0);var bk=bi.compareBoundaryPoints(Range.START_TO_END,bg);if(bk===0){a4=true}return bk}}}}function aZ(bg){var bh="",bj;for(var bi=0;bg[bi];bi++){bj=bg[bi];if(bj.nodeType===3||bj.nodeType===4){bh+=bj.nodeValue}else{if(bj.nodeType!==8){bh+=aZ(bj.childNodes)}}}return bh}(function(){var bh=ab.createElement("div"),bi="script"+(new Date).getTime();bh.innerHTML="<a name='"+bi+"'/>";var bg=ab.documentElement;bg.insertBefore(bh,bg.firstChild);if(ab.getElementById(bi)){a6.find.ID=function(bk,bl,bm){if(typeof bl.getElementById!=="undefined"&&!bm){var bj=bl.getElementById(bk[1]);return bj?bj.id===bk[1]||typeof bj.getAttributeNode!=="undefined"&&bj.getAttributeNode("id").nodeValue===bk[1]?[bj]:C:[]}};a6.filter.ID=function(bl,bj){var bk=typeof bl.getAttributeNode!=="undefined"&&bl.getAttributeNode("id");return bl.nodeType===1&&bk&&bk.nodeValue===bj}}bg.removeChild(bh);bg=bh=null})();(function(){var bg=ab.createElement("div");bg.appendChild(ab.createComment(""));if(bg.getElementsByTagName("*").length>0){a6.find.TAG=function(bh,bl){var bk=bl.getElementsByTagName(bh[1]);if(bh[1]==="*"){var bj=[];for(var bi=0;bk[bi];bi++){if(bk[bi].nodeType===1){bj.push(bk[bi])}}bk=bj}return bk}}bg.innerHTML="<a href='#'></a>";if(bg.firstChild&&typeof bg.firstChild.getAttribute!=="undefined"&&bg.firstChild.getAttribute("href")!=="#"){a6.attrHandle.href=function(bh){return bh.getAttribute("href",2)}}bg=null})();if(ab.querySelectorAll){(function(){var bg=a0,bi=ab.createElement("div");bi.innerHTML="<p class='TEST'></p>";if(bi.querySelectorAll&&bi.querySelectorAll(".TEST").length===0){return}a0=function(bm,bl,bj,bk){bl=bl||ab;if(!bk&&bl.nodeType===9&&!a1(bl)){try{return a8(bl.querySelectorAll(bm),bj)}catch(bn){}}return bg(bm,bl,bj,bk)};for(var bh in bg){a0[bh]=bg[bh]}bi=null})()}(function(){var bg=ab.createElement("div");bg.innerHTML="<div class='test e'></div><div class='test'></div>";if(!bg.getElementsByClassName||bg.getElementsByClassName("e").length===0){return}bg.lastChild.className="e";if(bg.getElementsByClassName("e").length===1){return}a6.order.splice(1,0,"CLASS");a6.find.CLASS=function(bh,bi,bj){if(typeof bi.getElementsByClassName!=="undefined"&&!bj){return bi.getElementsByClassName(bh[1])}};bg=null})();function aY(bh,bm,bl,bp,bn,bo){for(var bj=0,bi=bp.length;bj<bi;bj++){var bg=bp[bj];if(bg){bg=bg[bh];var bk=false;while(bg){if(bg.sizcache===bl){bk=bp[bg.sizset];break}if(bg.nodeType===1&&!bo){bg.sizcache=bl;bg.sizset=bj}if(bg.nodeName.toLowerCase()===bm){bk=bg;break}bg=bg[bh]}bp[bj]=bk}}}function be(bh,bm,bl,bp,bn,bo){for(var bj=0,bi=bp.length;bj<bi;bj++){var bg=bp[bj];if(bg){bg=bg[bh];var bk=false;while(bg){if(bg.sizcache===bl){bk=bp[bg.sizset];break}if(bg.nodeType===1){if(!bo){bg.sizcache=bl;bg.sizset=bj}if(typeof bm!=="string"){if(bg===bm){bk=true;break}}else{if(a0.filter(bm,[bg]).length>0){bk=bg;break}}}bg=bg[bh]}bp[bj]=bk}}}var a7=ab.compareDocumentPosition?function(bh,bg){return !!(bh.compareDocumentPosition(bg)&16)}:function(bh,bg){return bh!==bg&&(bh.contains?bh.contains(bg):true)};var a1=function(bg){var bh=(bg?bg.ownerDocument||bg:0).documentElement;return bh?bh.nodeName!=="HTML":false};var bd=function(bg,bn){var bj=[],bk="",bl,bi=bn.nodeType?[bn]:bn;while((bl=a6.match.PSEUDO.exec(bg))){bk+=bl[0];bg=bg.replace(a6.match.PSEUDO,"")}bg=a6.relative[bg]?bg+"*":bg;for(var bm=0,bh=bi.length;bm<bh;bm++){a0(bg,bi[bm],bj)}return a0.filter(bk,bj)};a.find=a0;a.expr=a0.selectors;a.expr[":"]=a.expr.filters;a.unique=a0.uniqueSort;a.text=aZ;a.isXMLDoc=a1;a.contains=a7;return;aM.Sizzle=a0})();var N=/Until$/,Y=/^(?:parents|prevUntil|prevAll)/,aL=/,/,F=Array.prototype.slice;var ai=function(a1,a0,aY){if(a.isFunction(a0)){return a.grep(a1,function(a3,a2){return !!a0.call(a3,a2,a3)===aY})}else{if(a0.nodeType){return a.grep(a1,function(a3,a2){return(a3===a0)===aY})}else{if(typeof a0==="string"){var aZ=a.grep(a1,function(a2){return a2.nodeType===1});if(aW.test(a0)){return a.filter(a0,aZ,!aY)}else{a0=a.filter(a0,aZ)}}}}return a.grep(a1,function(a3,a2){return(a.inArray(a3,a0)>=0)===aY})};a.fn.extend({find:function(aY){var a0=this.pushStack("","find",aY),a3=0;for(var a1=0,aZ=this.length;a1<aZ;a1++){a3=a0.length;a.find(aY,this[a1],a0);if(a1>0){for(var a4=a3;a4<a0.length;a4++){for(var a2=0;a2<a3;a2++){if(a0[a2]===a0[a4]){a0.splice(a4--,1);break}}}}}return a0},has:function(aZ){var aY=a(aZ);return this.filter(function(){for(var a1=0,a0=aY.length;a1<a0;a1++){if(a.contains(this,aY[a1])){return true}}})},not:function(aY){return this.pushStack(ai(this,aY,false),"not",aY)},filter:function(aY){return this.pushStack(ai(this,aY,true),"filter",aY)},is:function(aY){return !!aY&&a.filter(aY,this).length>0},closest:function(a7,aY){if(a.isArray(a7)){var a4=[],a6=this[0],a3,a2={},a0;if(a6&&a7.length){for(var a1=0,aZ=a7.length;a1<aZ;a1++){a0=a7[a1];if(!a2[a0]){a2[a0]=a.expr.match.POS.test(a0)?a(a0,aY||this.context):a0}}while(a6&&a6.ownerDocument&&a6!==aY){for(a0 in a2){a3=a2[a0];if(a3.jquery?a3.index(a6)>-1:a(a6).is(a3)){a4.push({selector:a0,elem:a6});delete a2[a0]}}a6=a6.parentNode}}return a4}var a5=a.expr.match.POS.test(a7)?a(a7,aY||this.context):null;return this.map(function(a8,a9){while(a9&&a9.ownerDocument&&a9!==aY){if(a5?a5.index(a9)>-1:a(a9).is(a7)){return a9}a9=a9.parentNode}return null})},index:function(aY){if(!aY||typeof aY==="string"){return a.inArray(this[0],aY?a(aY):this.parent().children())}return a.inArray(aY.jquery?aY[0]:aY,this)},add:function(aY,aZ){var a1=typeof aY==="string"?a(aY,aZ||this.context):a.makeArray(aY),a0=a.merge(this.get(),a1);return this.pushStack(y(a1[0])||y(a0[0])?a0:a.unique(a0))},andSelf:function(){return this.add(this.prevObject)}});function y(aY){return !aY||!aY.parentNode||aY.parentNode.nodeType===11}a.each({parent:function(aZ){var aY=aZ.parentNode;return aY&&aY.nodeType!==11?aY:null},parents:function(aY){return a.dir(aY,"parentNode")},parentsUntil:function(aZ,aY,a0){return a.dir(aZ,"parentNode",a0)},next:function(aY){return a.nth(aY,2,"nextSibling")},prev:function(aY){return a.nth(aY,2,"previousSibling")},nextAll:function(aY){return a.dir(aY,"nextSibling")},prevAll:function(aY){return a.dir(aY,"previousSibling")},nextUntil:function(aZ,aY,a0){return a.dir(aZ,"nextSibling",a0)},prevUntil:function(aZ,aY,a0){return a.dir(aZ,"previousSibling",a0)},siblings:function(aY){return a.sibling(aY.parentNode.firstChild,aY)},children:function(aY){return a.sibling(aY.firstChild)},contents:function(aY){return a.nodeName(aY,"iframe")?aY.contentDocument||aY.contentWindow.document:a.makeArray(aY.childNodes)}},function(aY,aZ){a.fn[aY]=function(a2,a0){var a1=a.map(this,aZ,a2);if(!N.test(aY)){a0=a2}if(a0&&typeof a0==="string"){a1=a.filter(a0,a1)}a1=this.length>1?a.unique(a1):a1;if((this.length>1||aL.test(a0))&&Y.test(aY)){a1=a1.reverse()}return this.pushStack(a1,aY,F.call(arguments).join(","))}});a.extend({filter:function(a0,aY,aZ){if(aZ){a0=":not("+a0+")"}return a.find.matches(a0,aY)},dir:function(a0,aZ,a2){var aY=[],a1=a0[aZ];while(a1&&a1.nodeType!==9&&(a2===C||a1.nodeType!==1||!a(a1).is(a2))){if(a1.nodeType===1){aY.push(a1)}a1=a1[aZ]}return aY},nth:function(a2,aY,a0,a1){aY=aY||1;var aZ=0;for(;a2;a2=a2[a0]){if(a2.nodeType===1&&++aZ===aY){break}}return a2},sibling:function(a0,aZ){var aY=[];for(;a0;a0=a0.nextSibling){if(a0.nodeType===1&&a0!==aZ){aY.push(a0)}}return aY}});var T=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,H=/(<([\w:]+)[^>]*?)\/>/g,al=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,c=/<([\w:]+)/,t=/<tbody/i,L=/<|&#?\w+;/,E=/<script|<object|<embed|<option|<style/i,l=/checked\s*(?:[^=]|=\s*.checked.)/i,p=function(aZ,a0,aY){return al.test(aY)?aZ:a0+"></"+aY+">"},ac={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};ac.optgroup=ac.option;ac.tbody=ac.tfoot=ac.colgroup=ac.caption=ac.thead;ac.th=ac.td;if(!a.support.htmlSerialize){ac._default=[1,"div<div>","</div>"]}a.fn.extend({text:function(aY){if(a.isFunction(aY)){return this.each(function(a0){var aZ=a(this);aZ.text(aY.call(this,a0,aZ.text()))})}if(typeof aY!=="object"&&aY!==C){return this.empty().append((this[0]&&this[0].ownerDocument||ab).createTextNode(aY))}return a.text(this)},wrapAll:function(aY){if(a.isFunction(aY)){return this.each(function(a0){a(this).wrapAll(aY.call(this,a0))})}if(this[0]){var aZ=a(aY,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){aZ.insertBefore(this[0])}aZ.map(function(){var a0=this;while(a0.firstChild&&a0.firstChild.nodeType===1){a0=a0.firstChild}return a0}).append(this)}return this},wrapInner:function(aY){if(a.isFunction(aY)){return this.each(function(aZ){a(this).wrapInner(aY.call(this,aZ))})}return this.each(function(){var aZ=a(this),a0=aZ.contents();if(a0.length){a0.wrapAll(aY)}else{aZ.append(aY)}})},wrap:function(aY){return this.each(function(){a(this).wrapAll(aY)})},unwrap:function(){return this.parent().each(function(){if(!a.nodeName(this,"body")){a(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(aY){if(this.nodeType===1){this.appendChild(aY)}})},prepend:function(){return this.domManip(arguments,true,function(aY){if(this.nodeType===1){this.insertBefore(aY,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(aZ){this.parentNode.insertBefore(aZ,this)})}else{if(arguments.length){var aY=a(arguments[0]);aY.push.apply(aY,this.toArray());return this.pushStack(aY,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(aZ){this.parentNode.insertBefore(aZ,this.nextSibling)})}else{if(arguments.length){var aY=this.pushStack(this,"after",arguments);aY.push.apply(aY,a(arguments[0]).toArray());return aY}}},remove:function(aY,a1){for(var aZ=0,a0;(a0=this[aZ])!=null;aZ++){if(!aY||a.filter(aY,[a0]).length){if(!a1&&a0.nodeType===1){a.cleanData(a0.getElementsByTagName("*"));a.cleanData([a0])}if(a0.parentNode){a0.parentNode.removeChild(a0)}}}return this},empty:function(){for(var aY=0,aZ;(aZ=this[aY])!=null;aY++){if(aZ.nodeType===1){a.cleanData(aZ.getElementsByTagName("*"))}while(aZ.firstChild){aZ.removeChild(aZ.firstChild)}}return this},clone:function(aZ){var aY=this.map(function(){if(!a.support.noCloneEvent&&!a.isXMLDoc(this)){var a1=this.outerHTML,a0=this.ownerDocument;if(!a1){var a2=a0.createElement("div");a2.appendChild(this.cloneNode(true));a1=a2.innerHTML}return a.clean([a1.replace(T,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(Z,"")],a0)[0]}else{return this.cloneNode(true)}});if(aZ===true){q(this,aY);q(this.find("*"),aY.find("*"))}return aY},html:function(a0){if(a0===C){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(T,""):null}else{if(typeof a0==="string"&&!E.test(a0)&&(a.support.leadingWhitespace||!Z.test(a0))&&!ac[(c.exec(a0)||["",""])[1].toLowerCase()]){a0=a0.replace(H,p);try{for(var aZ=0,aY=this.length;aZ<aY;aZ++){if(this[aZ].nodeType===1){a.cleanData(this[aZ].getElementsByTagName("*"));this[aZ].innerHTML=a0}}}catch(a1){this.empty().append(a0)}}else{if(a.isFunction(a0)){this.each(function(a4){var a3=a(this),a2=a3.html();a3.empty().append(function(){return a0.call(this,a4,a2)})})}else{this.empty().append(a0)}}}return this},replaceWith:function(aY){if(this[0]&&this[0].parentNode){if(a.isFunction(aY)){return this.each(function(a1){var a0=a(this),aZ=a0.html();a0.replaceWith(aY.call(this,a1,aZ))})}if(typeof aY!=="string"){aY=a(aY).detach()}return this.each(function(){var a0=this.nextSibling,aZ=this.parentNode;a(this).remove();if(a0){a(a0).before(aY)}else{a(aZ).append(aY)}})}else{return this.pushStack(a(a.isFunction(aY)?aY():aY),"replaceWith",aY)}},detach:function(aY){return this.remove(aY,true)},domManip:function(a4,a9,a8){var a1,a2,a7=a4[0],aZ=[],a3,a6;if(!a.support.checkClone&&arguments.length===3&&typeof a7==="string"&&l.test(a7)){return this.each(function(){a(this).domManip(a4,a9,a8,true)})}if(a.isFunction(a7)){return this.each(function(bb){var ba=a(this);a4[0]=a7.call(this,bb,a9?ba.html():C);ba.domManip(a4,a9,a8)})}if(this[0]){a6=a7&&a7.parentNode;if(a.support.parentNode&&a6&&a6.nodeType===11&&a6.childNodes.length===this.length){a1={fragment:a6}}else{a1=J(a4,this,aZ)}a3=a1.fragment;if(a3.childNodes.length===1){a2=a3=a3.firstChild}else{a2=a3.firstChild}if(a2){a9=a9&&a.nodeName(a2,"tr");for(var a0=0,aY=this.length;a0<aY;a0++){a8.call(a9?a5(this[a0],a2):this[a0],a0>0||a1.cacheable||this.length>1?a3.cloneNode(true):a3)}}if(aZ.length){a.each(aZ,aV)}}return this;function a5(ba,bb){return a.nodeName(ba,"table")?(ba.getElementsByTagName("tbody")[0]||ba.appendChild(ba.ownerDocument.createElement("tbody"))):ba}}});function q(a0,aY){var aZ=0;aY.each(function(){if(this.nodeName!==(a0[aZ]&&a0[aZ].nodeName)){return}var a5=a.data(a0[aZ++]),a4=a.data(this,a5),a1=a5&&a5.events;if(a1){delete a4.handle;a4.events={};for(var a3 in a1){for(var a2 in a1[a3]){a.event.add(this,a3,a1[a3][a2],a1[a3][a2].data)}}}})}function J(a3,a1,aZ){var a2,aY,a0,a4=(a1&&a1[0]?a1[0].ownerDocument||a1[0]:ab);if(a3.length===1&&typeof a3[0]==="string"&&a3[0].length<512&&a4===ab&&!E.test(a3[0])&&(a.support.checkClone||!l.test(a3[0]))){aY=true;a0=a.fragments[a3[0]];if(a0){if(a0!==1){a2=a0}}}if(!a2){a2=a4.createDocumentFragment();a.clean(a3,a4,a2,aZ)}if(aY){a.fragments[a3[0]]=a0?a2:1}return{fragment:a2,cacheable:aY}}a.fragments={};a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(aY,aZ){a.fn[aY]=function(a0){var a3=[],a6=a(a0),a5=this.length===1&&this[0].parentNode;if(a5&&a5.nodeType===11&&a5.childNodes.length===1&&a6.length===1){a6[aZ](this[0]);return this}else{for(var a4=0,a1=a6.length;a4<a1;a4++){var a2=(a4>0?this.clone(true):this).get();a.fn[aZ].apply(a(a6[a4]),a2);a3=a3.concat(a2)}return this.pushStack(a3,aY,a6.selector)}}});a.extend({clean:function(a0,a2,a9,a4){a2=a2||ab;if(typeof a2.createElement==="undefined"){a2=a2.ownerDocument||a2[0]&&a2[0].ownerDocument||ab}var ba=[];for(var a8=0,a3;(a3=a0[a8])!=null;a8++){if(typeof a3==="number"){a3+=""}if(!a3){continue}if(typeof a3==="string"&&!L.test(a3)){a3=a2.createTextNode(a3)}else{if(typeof a3==="string"){a3=a3.replace(H,p);var bb=(c.exec(a3)||["",""])[1].toLowerCase(),a1=ac[bb]||ac._default,a7=a1[0],aZ=a2.createElement("div");aZ.innerHTML=a1[1]+a3+a1[2];while(a7--){aZ=aZ.lastChild}if(!a.support.tbody){var aY=t.test(a3),a6=bb==="table"&&!aY?aZ.firstChild&&aZ.firstChild.childNodes:a1[1]==="<table>"&&!aY?aZ.childNodes:[];for(var a5=a6.length-1;a5>=0;--a5){if(a.nodeName(a6[a5],"tbody")&&!a6[a5].childNodes.length){a6[a5].parentNode.removeChild(a6[a5])}}}if(!a.support.leadingWhitespace&&Z.test(a3)){aZ.insertBefore(a2.createTextNode(Z.exec(a3)[0]),aZ.firstChild)}a3=aZ.childNodes}}if(a3.nodeType){ba.push(a3)}else{ba=a.merge(ba,a3)}}if(a9){for(var a8=0;ba[a8];a8++){if(a4&&a.nodeName(ba[a8],"script")&&(!ba[a8].type||ba[a8].type.toLowerCase()==="text/javascript")){a4.push(ba[a8].parentNode?ba[a8].parentNode.removeChild(ba[a8]):ba[a8])}else{if(ba[a8].nodeType===1){ba.splice.apply(ba,[a8+1,0].concat(a.makeArray(ba[a8].getElementsByTagName("script"))))}a9.appendChild(ba[a8])}}}return ba},cleanData:function(aZ){var a2,a0,aY=a.cache,a5=a.event.special,a4=a.support.deleteExpando;for(var a3=0,a1;(a1=aZ[a3])!=null;a3++){a0=a1[a.expando];if(a0){a2=aY[a0];if(a2.events){for(var a6 in a2.events){if(a5[a6]){a.event.remove(a1,a6)}else{ag(a1,a6,a2.handle)}}}if(a4){delete a1[a.expando]}else{if(a1.removeAttribute){a1.removeAttribute(a.expando)}}delete aY[a0]}}}});var ar=/z-?index|font-?weight|opacity|zoom|line-?height/i,U=/alpha\([^)]*\)/,aa=/opacity=([^)]*)/,ah=/float/i,az=/-([a-z])/ig,v=/([A-Z])/g,aO=/^-?\d+(?:px)?$/i,aU=/^-?\d/,aK={position:"absolute",visibility:"hidden",display:"block"},W=["Left","Right"],aE=["Top","Bottom"],ak=ab.defaultView&&ab.defaultView.getComputedStyle,aN=a.support.cssFloat?"cssFloat":"styleFloat",k=function(aY,aZ){return aZ.toUpperCase()};a.fn.css=function(aY,aZ){return an(this,aY,aZ,true,function(a1,a0,a2){if(a2===C){return a.curCSS(a1,a0)}if(typeof a2==="number"&&!ar.test(a0)){a2+="px"}a.style(a1,a0,a2)})};a.extend({style:function(a2,aZ,a3){if(!a2||a2.nodeType===3||a2.nodeType===8){return C}if((aZ==="width"||aZ==="height")&&parseFloat(a3)<0){a3=C}var a1=a2.style||a2,a4=a3!==C;if(!a.support.opacity&&aZ==="opacity"){if(a4){a1.zoom=1;var aY=parseInt(a3,10)+""==="NaN"?"":"alpha(opacity="+a3*100+")";var a0=a1.filter||a.curCSS(a2,"filter")||"";a1.filter=U.test(a0)?a0.replace(U,aY):aY}return a1.filter&&a1.filter.indexOf("opacity=")>=0?(parseFloat(aa.exec(a1.filter)[1])/100)+"":""}if(ah.test(aZ)){aZ=aN}aZ=aZ.replace(az,k);if(a4){a1[aZ]=a3}return a1[aZ]},css:function(a1,aZ,a3,aY){if(aZ==="width"||aZ==="height"){var a5,a0=aK,a4=aZ==="width"?W:aE;function a2(){a5=aZ==="width"?a1.offsetWidth:a1.offsetHeight;if(aY==="border"){return}a.each(a4,function(){if(!aY){a5-=parseFloat(a.curCSS(a1,"padding"+this,true))||0}if(aY==="margin"){a5+=parseFloat(a.curCSS(a1,"margin"+this,true))||0}else{a5-=parseFloat(a.curCSS(a1,"border"+this+"Width",true))||0}})}if(a1.offsetWidth!==0){a2()}else{a.swap(a1,a0,a2)}return Math.max(0,Math.round(a5))}return a.curCSS(a1,aZ,a3)},curCSS:function(a4,aZ,a0){var a7,aY=a4.style,a1;if(!a.support.opacity&&aZ==="opacity"&&a4.currentStyle){a7=aa.test(a4.currentStyle.filter||"")?(parseFloat(RegExp.$1)/100)+"":"";return a7===""?"1":a7}if(ah.test(aZ)){aZ=aN}if(!a0&&aY&&aY[aZ]){a7=aY[aZ]}else{if(ak){if(ah.test(aZ)){aZ="float"}aZ=aZ.replace(v,"-$1").toLowerCase();var a6=a4.ownerDocument.defaultView;if(!a6){return null}var a8=a6.getComputedStyle(a4,null);if(a8){a7=a8.getPropertyValue(aZ)}if(aZ==="opacity"&&a7===""){a7="1"}}else{if(a4.currentStyle){var a3=aZ.replace(az,k);a7=a4.currentStyle[aZ]||a4.currentStyle[a3];if(!aO.test(a7)&&aU.test(a7)){var a2=aY.left,a5=a4.runtimeStyle.left;a4.runtimeStyle.left=a4.currentStyle.left;aY.left=a3==="fontSize"?"1em":(a7||0);a7=aY.pixelLeft+"px";aY.left=a2;a4.runtimeStyle.left=a5}}}}return a7},swap:function(a1,a0,a2){var aY={};for(var aZ in a0){aY[aZ]=a1.style[aZ];a1.style[aZ]=a0[aZ]}a2.call(a1);for(var aZ in a0){a1.style[aZ]=aY[aZ]}}});if(a.expr&&a.expr.filters){a.expr.filters.hidden=function(a1){var aZ=a1.offsetWidth,aY=a1.offsetHeight,a0=a1.nodeName.toLowerCase()==="tr";return aZ===0&&aY===0&&!a0?true:aZ>0&&aY>0&&!a0?false:a.curCSS(a1,"display")==="none"};a.expr.filters.visible=function(aY){return !a.expr.filters.hidden(aY)}}var af=aP(),aJ=/<script(.|\s)*?\/script>/gi,o=/select|textarea/i,aB=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,r=/=\?(&|$)/,D=/\?/,aX=/(\?|&)_=.*?(&|$)/,B=/^(\w+:)?\/\/([^\/?#]+)/,h=/%20/g,w=a.fn.load;a.fn.extend({load:function(a0,a3,a4){if(typeof a0!=="string"){return w.call(this,a0)}else{if(!this.length){return this}}var a2=a0.indexOf(" ");if(a2>=0){var aY=a0.slice(a2,a0.length);a0=a0.slice(0,a2)}var a1="GET";if(a3){if(a.isFunction(a3)){a4=a3;a3=null}else{if(typeof a3==="object"){a3=a.param(a3,a.ajaxSettings.traditional);a1="POST"}}}var aZ=this;a.ajax({url:a0,type:a1,dataType:"html",data:a3,complete:function(a6,a5){if(a5==="success"||a5==="notmodified"){aZ.html(aY?a("<div />").append(a6.responseText.replace(aJ,"")).find(aY):a6.responseText)}if(a4){aZ.each(a4,[a6.responseText,a5,a6])}}});return this},serialize:function(){return a.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?a.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||o.test(this.nodeName)||aB.test(this.type))}).map(function(aY,aZ){var a0=a(this).val();return a0==null?null:a.isArray(a0)?a.map(a0,function(a2,a1){return{name:aZ.name,value:a2}}):{name:aZ.name,value:a0}}).get()}});a.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(aY,aZ){a.fn[aZ]=function(a0){return this.bind(aZ,a0)}});a.extend({get:function(aY,a0,a1,aZ){if(a.isFunction(a0)){aZ=aZ||a1;a1=a0;a0=null}return a.ajax({type:"GET",url:aY,data:a0,success:a1,dataType:aZ})},getScript:function(aY,aZ){return a.get(aY,null,aZ,"script")},getJSON:function(aY,aZ,a0){return a.get(aY,aZ,a0,"json")},post:function(aY,a0,a1,aZ){if(a.isFunction(a0)){aZ=aZ||a1;a1=a0;a0={}}return a.ajax({type:"POST",url:aY,data:a0,success:a1,dataType:aZ})},ajaxSetup:function(aY){a.extend(a.ajaxSettings,aY)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:aM.XMLHttpRequest&&(aM.location.protocol!=="file:"||!aM.ActiveXObject)?function(){return new aM.XMLHttpRequest()}:function(){try{return new aM.ActiveXObject("Microsoft.XMLHTTP")}catch(aY){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(bd){var a8=a.extend(true,{},a.ajaxSettings,bd);var bi,bc,bh,bj=bd&&bd.context||a8,a0=a8.type.toUpperCase();if(a8.data&&a8.processData&&typeof a8.data!=="string"){a8.data=a.param(a8.data,a8.traditional)}if(a8.dataType==="jsonp"){if(a0==="GET"){if(!r.test(a8.url)){a8.url+=(D.test(a8.url)?"&":"?")+(a8.jsonp||"callback")+"=?"}}else{if(!a8.data||!r.test(a8.data)){a8.data=(a8.data?a8.data+"&":"")+(a8.jsonp||"callback")+"=?"}}a8.dataType="json"}if(a8.dataType==="json"&&(a8.data&&r.test(a8.data)||r.test(a8.url))){bi=a8.jsonpCallback||("jsonp"+af++);if(a8.data){a8.data=(a8.data+"").replace(r,"="+bi+"$1")}a8.url=a8.url.replace(r,"="+bi+"$1");a8.dataType="script";aM[bi]=aM[bi]||function(bk){bh=bk;a3();a6();aM[bi]=C;try{delete aM[bi]}catch(bl){}if(a1){a1.removeChild(bf)}}}if(a8.dataType==="script"&&a8.cache===null){a8.cache=false}if(a8.cache===false&&a0==="GET"){var aY=aP();var bg=a8.url.replace(aX,"$1_="+aY+"$2");a8.url=bg+((bg===a8.url)?(D.test(a8.url)?"&":"?")+"_="+aY:"")}if(a8.data&&a0==="GET"){a8.url+=(D.test(a8.url)?"&":"?")+a8.data}if(a8.global&&!a.active++){a.event.trigger("ajaxStart")}var bb=B.exec(a8.url),a2=bb&&(bb[1]&&bb[1]!==location.protocol||bb[2]!==location.host);if(a8.dataType==="script"&&a0==="GET"&&a2){var a1=ab.getElementsByTagName("head")[0]||ab.documentElement;var bf=ab.createElement("script");bf.src=a8.url;if(a8.scriptCharset){bf.charset=a8.scriptCharset}if(!bi){var ba=false;bf.onload=bf.onreadystatechange=function(){if(!ba&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){ba=true;a3();a6();bf.onload=bf.onreadystatechange=null;if(a1&&bf.parentNode){a1.removeChild(bf)}}}}a1.insertBefore(bf,a1.firstChild);return C}var a5=false;var a4=a8.xhr();if(!a4){return}if(a8.username){a4.open(a0,a8.url,a8.async,a8.username,a8.password)}else{a4.open(a0,a8.url,a8.async)}try{if(a8.data||bd&&bd.contentType){a4.setRequestHeader("Content-Type",a8.contentType)}if(a8.ifModified){if(a.lastModified[a8.url]){a4.setRequestHeader("If-Modified-Since",a.lastModified[a8.url])}if(a.etag[a8.url]){a4.setRequestHeader("If-None-Match",a.etag[a8.url])}}if(!a2){a4.setRequestHeader("X-Requested-With","XMLHttpRequest")}a4.setRequestHeader("Accept",a8.dataType&&a8.accepts[a8.dataType]?a8.accepts[a8.dataType]+", */*":a8.accepts._default)}catch(be){}if(a8.beforeSend&&a8.beforeSend.call(bj,a4,a8)===false){if(a8.global&&!--a.active){a.event.trigger("ajaxStop")}a4.abort();return false}if(a8.global){a9("ajaxSend",[a4,a8])}var a7=a4.onreadystatechange=function(bk){if(!a4||a4.readyState===0||bk==="abort"){if(!a5){a6()}a5=true;if(a4){a4.onreadystatechange=a.noop}}else{if(!a5&&a4&&(a4.readyState===4||bk==="timeout")){a5=true;a4.onreadystatechange=a.noop;bc=bk==="timeout"?"timeout":!a.httpSuccess(a4)?"error":a8.ifModified&&a.httpNotModified(a4,a8.url)?"notmodified":"success";var bm;if(bc==="success"){try{bh=a.httpData(a4,a8.dataType,a8)}catch(bl){bc="parsererror";bm=bl}}if(bc==="success"||bc==="notmodified"){if(!bi){a3()}}else{a.handleError(a8,a4,bc,bm)}a6();if(bk==="timeout"){a4.abort()}if(a8.async){a4=null}}}};try{var aZ=a4.abort;a4.abort=function(){if(a4){aZ.call(a4)}a7("abort")}}catch(be){}if(a8.async&&a8.timeout>0){setTimeout(function(){if(a4&&!a5){a7("timeout")}},a8.timeout)}try{a4.send(a0==="POST"||a0==="PUT"||a0==="DELETE"?a8.data:null)}catch(be){a.handleError(a8,a4,null,be);a6()}if(!a8.async){a7()}function a3(){if(a8.success){a8.success.call(bj,bh,bc,a4)}if(a8.global){a9("ajaxSuccess",[a4,a8])}}function a6(){if(a8.complete){a8.complete.call(bj,a4,bc)}if(a8.global){a9("ajaxComplete",[a4,a8])}if(a8.global&&!--a.active){a.event.trigger("ajaxStop")}}function a9(bl,bk){(a8.context?a(a8.context):a.event).trigger(bl,bk)}return a4},handleError:function(aZ,a1,aY,a0){if(aZ.error){aZ.error.call(aZ.context||aZ,a1,aY,a0)}if(aZ.global){(aZ.context?a(aZ.context):a.event).trigger("ajaxError",[a1,aZ,a0])}},active:0,httpSuccess:function(aZ){try{return !aZ.status&&location.protocol==="file:"||(aZ.status>=200&&aZ.status<300)||aZ.status===304||aZ.status===1223||aZ.status===0}catch(aY){}return false},httpNotModified:function(a1,aY){var a0=a1.getResponseHeader("Last-Modified"),aZ=a1.getResponseHeader("Etag");if(a0){a.lastModified[aY]=a0}if(aZ){a.etag[aY]=aZ}return a1.status===304||a1.status===0},httpData:function(a3,a1,a0){var aZ=a3.getResponseHeader("content-type")||"",aY=a1==="xml"||!a1&&aZ.indexOf("xml")>=0,a2=aY?a3.responseXML:a3.responseText;if(aY&&a2.documentElement.nodeName==="parsererror"){a.error("parsererror")}if(a0&&a0.dataFilter){a2=a0.dataFilter(a2,a1)}if(typeof a2==="string"){if(a1==="json"||!a1&&aZ.indexOf("json")>=0){a2=a.parseJSON(a2)}else{if(a1==="script"||!a1&&aZ.indexOf("javascript")>=0){a.globalEval(a2)}}}return a2},param:function(aY,a1){var aZ=[];if(a1===C){a1=a.ajaxSettings.traditional}if(a.isArray(aY)||aY.jquery){a.each(aY,function(){a3(this.name,this.value)})}else{for(var a2 in aY){a0(a2,aY[a2])}}return aZ.join("&").replace(h,"+");function a0(a4,a5){if(a.isArray(a5)){a.each(a5,function(a7,a6){if(a1||/\[\]$/.test(a4)){a3(a4,a6)}else{a0(a4+"["+(typeof a6==="object"||a.isArray(a6)?a7:"")+"]",a6)}})}else{if(!a1&&a5!=null&&typeof a5==="object"){a.each(a5,function(a7,a6){a0(a4+"["+a7+"]",a6)})}else{a3(a4,a5)}}}function a3(a4,a5){a5=a.isFunction(a5)?a5():a5;aZ[aZ.length]=encodeURIComponent(a4)+"="+encodeURIComponent(a5)}}});var G={},ae=/toggle|show|hide/,au=/^([+-]=)?([\d+-.]+)(.*)$/,aF,aj=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];a.fn.extend({show:function(aZ,a7){if(aZ||aZ===0){return this.animate(aD("show",3),aZ,a7)}else{for(var a4=0,a1=this.length;a4<a1;a4++){var aY=a.data(this[a4],"olddisplay");this[a4].style.display=aY||"";if(a.css(this[a4],"display")==="none"){var a6=this[a4].nodeName,a5;if(G[a6]){a5=G[a6]}else{var a0=a("<"+a6+" />").appendTo("body");a5=a0.css("display");if(a5==="none"){a5="block"}a0.remove();G[a6]=a5}a.data(this[a4],"olddisplay",a5)}}for(var a3=0,a2=this.length;a3<a2;a3++){this[a3].style.display=a.data(this[a3],"olddisplay")||""}return this}},hide:function(a3,a4){if(a3||a3===0){return this.animate(aD("hide",3),a3,a4)}else{for(var a2=0,aZ=this.length;a2<aZ;a2++){var aY=a.data(this[a2],"olddisplay");if(!aY&&aY!=="none"){a.data(this[a2],"olddisplay",a.css(this[a2],"display"))}}for(var a1=0,a0=this.length;a1<a0;a1++){this[a1].style.display="none"}return this}},_toggle:a.fn.toggle,toggle:function(a0,aZ){var aY=typeof a0==="boolean";if(a.isFunction(a0)&&a.isFunction(aZ)){this._toggle.apply(this,arguments)}else{if(a0==null||aY){this.each(function(){var a1=aY?a0:a(this).is(":hidden");a(this)[a1?"show":"hide"]()})}else{this.animate(aD("toggle",3),a0,aZ)}}return this},fadeTo:function(aY,a0,aZ){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:a0},aY,aZ)},animate:function(a2,aZ,a1,a0){var aY=a.speed(aZ,a1,a0);if(a.isEmptyObject(a2)){return this.each(aY.complete)}return this[aY.queue===false?"each":"queue"](function(){var a5=a.extend({},aY),a7,a6=this.nodeType===1&&a(this).is(":hidden"),a3=this;for(a7 in a2){var a4=a7.replace(az,k);if(a7!==a4){a2[a4]=a2[a7];delete a2[a7];a7=a4}if(a2[a7]==="hide"&&a6||a2[a7]==="show"&&!a6){return a5.complete.call(this)}if((a7==="height"||a7==="width")&&this.style){a5.display=a.css(this,"display");a5.overflow=this.style.overflow}if(a.isArray(a2[a7])){(a5.specialEasing=a5.specialEasing||{})[a7]=a2[a7][1];a2[a7]=a2[a7][0]}}if(a5.overflow!=null){this.style.overflow="hidden"}a5.curAnim=a.extend({},a2);a.each(a2,function(a9,bd){var bc=new a.fx(a3,a5,a9);if(ae.test(bd)){bc[bd==="toggle"?a6?"show":"hide":bd](a2)}else{var bb=au.exec(bd),be=bc.cur(true)||0;if(bb){var a8=parseFloat(bb[2]),ba=bb[3]||"px";if(ba!=="px"){a3.style[a9]=(a8||1)+ba;be=((a8||1)/bc.cur(true))*be;a3.style[a9]=be+ba}if(bb[1]){a8=((bb[1]==="-="?-1:1)*a8)+be}bc.custom(be,a8,ba)}else{bc.custom(be,bd,"")}}});return true})},stop:function(aZ,aY){var a0=a.timers;if(aZ){this.queue([])}this.each(function(){for(var a1=a0.length-1;a1>=0;a1--){if(a0[a1].elem===this){if(aY){a0[a1](true)}a0.splice(a1,1)}}});if(!aY){this.dequeue()}return this}});a.each({slideDown:aD("show",1),slideUp:aD("hide",1),slideToggle:aD("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(aY,aZ){a.fn[aY]=function(a0,a1){return this.animate(aZ,a0,a1)}});a.extend({speed:function(a0,a1,aZ){var aY=a0&&typeof a0==="object"?a0:{complete:aZ||!aZ&&a1||a.isFunction(a0)&&a0,duration:a0,easing:aZ&&a1||a1&&!a.isFunction(a1)&&a1};aY.duration=a.fx.off?0:typeof aY.duration==="number"?aY.duration:a.fx.speeds[aY.duration]||a.fx.speeds._default;aY.old=aY.complete;aY.complete=function(){if(aY.queue!==false){a(this).dequeue()}if(a.isFunction(aY.old)){aY.old.call(this)}};return aY},easing:{linear:function(a0,a1,aY,aZ){return aY+aZ*a0},swing:function(a0,a1,aY,aZ){return((-Math.cos(a0*Math.PI)/2)+0.5)*aZ+aY}},timers:[],fx:function(aZ,aY,a0){this.options=aY;this.elem=aZ;this.prop=a0;if(!aY.orig){aY.orig={}}}});a.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(a.fx.step[this.prop]||a.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(aZ){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var aY=parseFloat(a.css(this.elem,this.prop,aZ));return aY&&aY>-10000?aY:parseFloat(a.curCSS(this.elem,this.prop))||0},custom:function(a2,a1,a0){this.startTime=aP();this.start=a2;this.end=a1;this.unit=a0||this.unit||"px";this.now=this.start;this.pos=this.state=0;var aY=this;function aZ(a3){return aY.step(a3)}aZ.elem=this.elem;if(aZ()&&a.timers.push(aZ)&&!aF){aF=setInterval(a.fx.tick,13)}},show:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());a(this.elem).show()},hide:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a1){var a6=aP(),a2=true;if(a1||a6>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var a3 in this.options.curAnim){if(this.options.curAnim[a3]!==true){a2=false}}if(a2){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;var a0=a.data(this.elem,"olddisplay");this.elem.style.display=a0?a0:this.options.display;if(a.css(this.elem,"display")==="none"){this.elem.style.display="block"}}if(this.options.hide){a(this.elem).hide()}if(this.options.hide||this.options.show){for(var aY in this.options.curAnim){a.style(this.elem,aY,this.options.orig[aY])}}this.options.complete.call(this.elem)}return false}else{var aZ=a6-this.startTime;this.state=aZ/this.options.duration;var a4=this.options.specialEasing&&this.options.specialEasing[this.prop];var a5=this.options.easing||(a.easing.swing?"swing":"linear");this.pos=a.easing[a4||a5](this.state,aZ,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};a.extend(a.fx,{tick:function(){var aZ=a.timers;for(var aY=0;aY<aZ.length;aY++){if(!aZ[aY]()){aZ.splice(aY--,1)}}if(!aZ.length){a.fx.stop()}},stop:function(){clearInterval(aF);aF=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(aY){a.style(aY.elem,"opacity",aY.now)},_default:function(aY){if(aY.elem.style&&aY.elem.style[aY.prop]!=null){aY.elem.style[aY.prop]=(aY.prop==="width"||aY.prop==="height"?Math.max(0,aY.now):aY.now)+aY.unit}else{aY.elem[aY.prop]=aY.now}}}});if(a.expr&&a.expr.filters){a.expr.filters.animated=function(aY){return a.grep(a.timers,function(aZ){return aY===aZ.elem}).length}}function aD(aZ,aY){var a0={};a.each(aj.concat.apply([],aj.slice(0,aY)),function(){a0[this]=aZ});return a0}if("getBoundingClientRect" in ab.documentElement){a.fn.offset=function(a7){var a0=this[0];if(a7){return this.each(function(a8){a.offset.setOffset(this,a7,a8)})}if(!a0||!a0.ownerDocument){return null}if(a0===a0.ownerDocument.body){return a.offset.bodyOffset(a0)}var a2=a0.getBoundingClientRect(),a6=a0.ownerDocument,a3=a6.body,aY=a6.documentElement,a1=aY.clientTop||a3.clientTop||0,a4=aY.clientLeft||a3.clientLeft||0,a5=a2.top+(self.pageYOffset||a.support.boxModel&&aY.scrollTop||a3.scrollTop)-a1,aZ=a2.left+(self.pageXOffset||a.support.boxModel&&aY.scrollLeft||a3.scrollLeft)-a4;return{top:a5,left:aZ}}}else{a.fn.offset=function(a9){var a3=this[0];if(a9){return this.each(function(ba){a.offset.setOffset(this,a9,ba)})}if(!a3||!a3.ownerDocument){return null}if(a3===a3.ownerDocument.body){return a.offset.bodyOffset(a3)}a.offset.initialize();var a0=a3.offsetParent,aZ=a3,a8=a3.ownerDocument,a6,a1=a8.documentElement,a4=a8.body,a5=a8.defaultView,aY=a5?a5.getComputedStyle(a3,null):a3.currentStyle,a7=a3.offsetTop,a2=a3.offsetLeft;while((a3=a3.parentNode)&&a3!==a4&&a3!==a1){if(a.offset.supportsFixedPosition&&aY.position==="fixed"){break}a6=a5?a5.getComputedStyle(a3,null):a3.currentStyle;a7-=a3.scrollTop;a2-=a3.scrollLeft;if(a3===a0){a7+=a3.offsetTop;a2+=a3.offsetLeft;if(a.offset.doesNotAddBorder&&!(a.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(a3.nodeName))){a7+=parseFloat(a6.borderTopWidth)||0;a2+=parseFloat(a6.borderLeftWidth)||0}aZ=a0,a0=a3.offsetParent}if(a.offset.subtractsBorderForOverflowNotVisible&&a6.overflow!=="visible"){a7+=parseFloat(a6.borderTopWidth)||0;a2+=parseFloat(a6.borderLeftWidth)||0}aY=a6}if(aY.position==="relative"||aY.position==="static"){a7+=a4.offsetTop;a2+=a4.offsetLeft}if(a.offset.supportsFixedPosition&&aY.position==="fixed"){a7+=Math.max(a1.scrollTop,a4.scrollTop);a2+=Math.max(a1.scrollLeft,a4.scrollLeft)}return{top:a7,left:a2}}}a.offset={initialize:function(){var aY=ab.body,aZ=ab.createElement("div"),a2,a4,a3,a5,a0=parseFloat(a.curCSS(aY,"marginTop",true))||0,a1="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.extend(aZ.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});aZ.innerHTML=a1;aY.insertBefore(aZ,aY.firstChild);a2=aZ.firstChild;a4=a2.firstChild;a5=a2.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(a4.offsetTop!==5);this.doesAddBorderForTableAndCells=(a5.offsetTop===5);a4.style.position="fixed",a4.style.top="20px";this.supportsFixedPosition=(a4.offsetTop===20||a4.offsetTop===15);a4.style.position=a4.style.top="";a2.style.overflow="hidden",a2.style.position="relative";this.subtractsBorderForOverflowNotVisible=(a4.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(aY.offsetTop!==a0);aY.removeChild(aZ);aY=aZ=a2=a4=a3=a5=null;a.offset.initialize=a.noop},bodyOffset:function(aY){var a0=aY.offsetTop,aZ=aY.offsetLeft;a.offset.initialize();if(a.offset.doesNotIncludeMarginInBodyOffset){a0+=parseFloat(a.curCSS(aY,"marginTop",true))||0;aZ+=parseFloat(a.curCSS(aY,"marginLeft",true))||0}return{top:a0,left:aZ}},setOffset:function(a3,aZ,a0){if(/static/.test(a.curCSS(a3,"position"))){a3.style.position="relative"}var a2=a(a3),a5=a2.offset(),aY=parseInt(a.curCSS(a3,"top",true),10)||0,a4=parseInt(a.curCSS(a3,"left",true),10)||0;if(a.isFunction(aZ)){aZ=aZ.call(a3,a0,a5)}var a1={top:(aZ.top-a5.top)+aY,left:(aZ.left-a5.left)+a4};if("using" in aZ){aZ.using.call(a3,a1)}else{a2.css(a1)}}};a.fn.extend({position:function(){if(!this[0]){return null}var a0=this[0],aZ=this.offsetParent(),a1=this.offset(),aY=/^body|html$/i.test(aZ[0].nodeName)?{top:0,left:0}:aZ.offset();a1.top-=parseFloat(a.curCSS(a0,"marginTop",true))||0;a1.left-=parseFloat(a.curCSS(a0,"marginLeft",true))||0;aY.top+=parseFloat(a.curCSS(aZ[0],"borderTopWidth",true))||0;aY.left+=parseFloat(a.curCSS(aZ[0],"borderLeftWidth",true))||0;return{top:a1.top-aY.top,left:a1.left-aY.left}},offsetParent:function(){return this.map(function(){var aY=this.offsetParent||ab.body;while(aY&&(!/^body|html$/i.test(aY.nodeName)&&a.css(aY,"position")==="static")){aY=aY.offsetParent}return aY})}});a.each(["Left","Top"],function(aZ,aY){var a0="scroll"+aY;a.fn[a0]=function(a3){var a1=this[0],a2;if(!a1){return null}if(a3!==C){return this.each(function(){a2=am(this);if(a2){a2.scrollTo(!aZ?a3:a(a2).scrollLeft(),aZ?a3:a(a2).scrollTop())}else{this[a0]=a3}})}else{a2=am(a1);return a2?("pageXOffset" in a2)?a2[aZ?"pageYOffset":"pageXOffset"]:a.support.boxModel&&a2.document.documentElement[a0]||a2.document.body[a0]:a1[a0]}}});function am(aY){return("scrollTo" in aY&&aY.document)?aY:aY.nodeType===9?aY.defaultView||aY.parentWindow:false}a.each(["Height","Width"],function(aZ,aY){var a0=aY.toLowerCase();a.fn["inner"+aY]=function(){return this[0]?a.css(this[0],a0,false,"padding"):null};a.fn["outer"+aY]=function(a1){return this[0]?a.css(this[0],a0,false,a1?"margin":"border"):null};a.fn[a0]=function(a1){var a2=this[0];if(!a2){return a1==null?null:this}if(a.isFunction(a1)){return this.each(function(a4){var a3=a(this);a3[a0](a1.call(this,a4,a3[a0]()))})}return("scrollTo" in a2&&a2.document)?a2.document.compatMode==="CSS1Compat"&&a2.document.documentElement["client"+aY]||a2.document.body["client"+aY]:(a2.nodeType===9)?Math.max(a2.documentElement["client"+aY],a2.body["scroll"+aY],a2.documentElement["scroll"+aY],a2.body["offset"+aY],a2.documentElement["offset"+aY]):a1===C?a.css(a2,a0):this.css(a0,typeof a1==="string"?a1:a1+"px")}});aM.jQuery=aM.$=a})(window);(function(bq,o,aS){var bB=bq.jQuery.noConflict(true);if(typeof o.getAttribute==n){o.getAttribute=function(){}}var cg=undefined,aM=null,a7="$element",L="angular",aK="array",bC="boolean",a9="console",aP="date",av="display",b2="element",a8="function",Z="length",S="name",b="none",b4="noop",s="null",bJ="number",az="object",J="string",n="undefined",a="ng-exception",i="ng-validation-error",l="noop",aZ=-99999,ad=-1000,bH=99999,aw={FIRST:aZ,LAST:bH,WATCH:ad},bY=bq.jQuery||bq["$"],bD=bq._,ai=parseInt((/msie (\d+)/.exec(ac(navigator.userAgent))||[])[1],10),bM=bY||b8,V=Array.prototype.slice,y=Array.prototype.push,b5=bq[a9]?bd(bq[a9],bq[a9]["error"]||h):h,an=bq[L]||(bq[L]={}),W=aY(an,"markup"),p=aY(an,"attrMarkup"),T=aY(an,"directive"),x=aY(an,"widget",ac),au=aY(an,"validator"),bV=aY(an,"filter"),j=aY(an,"formatter"),a2=aY(an,"service"),aR=aY(an,"callbacks"),aj,U=/^(|.*\/)angular(-.*?)?(\.min)?.js(\?[^#]*)?(#(.*))?$/;function aB(cm,cl,ck){var cj;if(cm){if(A(cm)){for(cj in cm){if(cj!="prototype"&&cj!=Z&&cj!=S&&cm.hasOwnProperty(cj)){cl.call(ck,cm[cj],cj)}}}else{if(cm.forEach){cm.forEach(cl,ck)}else{if(cf(cm)&&aD(cm.length)){for(cj=0;cj<cm.length;cj++){cl.call(ck,cm[cj],cj)}}else{for(cj in cm){cl.call(ck,cm[cj],cj)}}}}}return cm}function ah(co,cm,cl){var cn=[];for(var ck in co){cn.push(ck)}cn.sort();for(var cj=0;cj<cn.length;cj++){cm.call(cl,co[cn[cj]],cn[cj])}return cn}function bA(cj){aB(arguments,function(ck){if(ck!==cj){aB(ck,function(cm,cl){cj[cl]=cm})}});return cj}function bz(ck,cj){return bA(new (bA(function(){},{prototype:ck}))(),cj)}function h(){}function ap(cj){return cj}function bS(cj){return function(){return cj}}function aY(cl,ck,cj){var cm;return cl[ck]||(cm=cl[ck]=function(cn,co,cp){cn=(cj||ap)(cn);if(bW(co)){cm[cn]=bA(co,cp||{})}return cm[cn]})}function b8(cj){if(cj){if(bK(cj)){var ck=o.createElement("div");ck.innerHTML=cj;cj=new a4(ck.childNodes)}else{if(!(cj instanceof a4)&&bh(cj)){cj=new a4(cj)}}}return cj}function ba(cj){return typeof cj==n}function bW(cj){return typeof cj!=n}function cf(cj){return cj!=aM&&typeof cj==az}function bK(cj){return typeof cj==J}function aD(cj){return typeof cj==bJ}function aN(cj){return cj instanceof Array}function A(cj){return typeof cj==a8}function q(cj){return aj(cj)=="#text"}function ac(cj){return bK(cj)?cj.toLowerCase():cj}function bg(cj){return bK(cj)?cj.toUpperCase():cj}function ak(cj){return bK(cj)?cj.replace(/^\s*/,"").replace(/\s*$/,""):cj}function bh(cj){return cj&&(cj.nodeName||cj instanceof a4||(bY&&cj instanceof bY))}function aE(cj){this.html=cj}if(ai){aj=function(cj){cj=cj.nodeName?cj:cj[0];return(cj.scopeName&&cj.scopeName!="HTML")?bg(cj.scopeName+":"+cj.nodeName):cj.nodeName}}else{aj=function(cj){return cj.nodeName?cj.nodeName:cj[0].nodeName}}function w(cj){return bM(cj[0].cloneNode(true))}function aA(ck){var cm=ck[0].getBoundingClientRect(),cl=(cm.width||(cm.right||0-cm.left||0)),cj=(cm.height||(cm.bottom||0-cm.top||0));return cl>0&&cj>0}function ar(cm,cl,ck){var cj=[];aB(cm,function(cp,cn,co){cj.push(cl.call(ck,cp,cn,co))});return cj}function al(ck){var cj=0;if(ck){if(aD(ck.length)){return ck.length}else{if(cf(ck)){for(key in ck){cj++}}}}return cj}function r(cl,ck){for(var cj=0;cj<cl.length;cj++){if(ck===cl[cj]){return true}}return false}function cc(cl,ck){for(var cj=0;cj<cl.length;cj++){if(ck===cl[cj]){return cj}}return -1}function by(cj){if(cj){switch(cj.nodeName){case"OPTION":case"PRE":case"TITLE":return true}}return false}function a5(cm,cj){if(!cj){cj=cm;if(cm){if(aN(cm)){cj=a5(cm,[])}else{if(cm instanceof Date){cj=new Date(cm.getTime())}else{if(cf(cm)){cj=a5(cm,{})}}}}}else{if(aN(cm)){while(cj.length){cj.pop()}for(var cl=0;cl<cm.length;cl++){cj.push(a5(cm[cl]))}}else{aB(cj,function(co,cn){delete cj[cn]});for(var ck in cm){cj[ck]=a5(cm[ck])}}}return cj}function m(cp,co){if(cp==co){return true}var cn=typeof cp,cl=typeof co,cm,ck,cj;if(cn==cl&&cn=="object"){if(cp instanceof Array){if((cm=cp.length)==co.length){for(ck=0;ck<cm;ck++){if(!m(cp[ck],co[ck])){return false}}return true}}else{cj={};for(ck in cp){if(ck.charAt(0)!=="$"&&!A(cp[ck])&&!m(cp[ck],co[ck])){return false}cj[ck]=true}for(ck in co){if(!cj[ck]&&ck.charAt(0)!=="$"&&!A(co[ck])){return false}}return true}}return false}function O(ck,cj){if(by(ck)){if(ai){ck.innerText=cj}else{ck.textContent=cj}}else{ck.innerHTML=cj}}function ca(cj){if(!cj||!cj.replace){return cj}return cj.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bk(ck){var cj=ck&&ck[0]&&ck[0].nodeName;return cj&&cj.charAt(0)!="#"&&!r(["TR","COL","COLGROUP","TBODY","THEAD","TFOOT"],cj)}function bv(ck,cl,cj){while(!bk(ck)){ck=ck.parent()||bM(o.body)}if(ck[0]["$NG_ERROR"]!==cj){ck[0]["$NG_ERROR"]=cj;if(cj){ck.addClass(cl);ck.attr(cl,cj)}else{ck.removeClass(cl);ck.removeAttr(cl)}}}function bU(cj){if(!cj||!cj.replace){return cj}return cj.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\"/g,"&quot;")}function aQ(cl,ck,cj){return cl.concat(V.call(ck,cj,ck.length))}function bd(ck,cl){var cj=arguments.length>2?V.call(arguments,2,arguments.length):[];if(typeof cl==a8){return cj.length?function(){return arguments.length?cl.apply(ck,cj.concat(V.call(arguments,0,arguments.length))):cl.apply(ck,cj)}:function(){return arguments.length?cl.apply(ck,arguments):cl.call(ck)}}else{return cl}}function bR(ck){if(ck&&ck.length!==0){var cj=ac(""+ck);ck=!(cj=="f"||cj=="0"||cj=="false"||cj=="no"||cj=="n"||cj=="[]")}else{ck=false}return ck}function aW(cm,cn){for(var cj in cm){var cl=cn[cj];var ck=typeof cl;if(ck==n){cn[cj]=K(bO(cm[cj]))}else{if(ck=="object"&&cl.constructor!=B&&cj.substring(0,1)!="$"){aW(cm[cj],cl)}}}}function aJ(cl,ck){var cm=new aO(W,p,T,x),cj=bM(cl);return cm.compile(cj)(cj,ck)}function Y(cm){var cl={},cj,ck;aB((cm||"").split("&"),function(cn){if(cn){cj=cn.split("=");ck=unescape(cj[0]);cl[ck]=bW(cj[1])?unescape(cj[1]):true}});return cl}function G(ck){var cj=[];aB(ck,function(cm,cl){cj.push(escape(cl)+(cm===true?"":"="+escape(cm)))});return cj.length?cj.join("&"):""}function a6(ck){if(ck.autobind){var cl=aJ(bq.document,aM,{"$config":ck}),cj=cl.$inject("$browser");if(ck.css){cj.addCss(ck.base_url+ck.css)}else{if(ai<8){cj.addJs(ck.base_url+ck.ie_compat,ck.ie_compat_id)}}cl.$init()}}function bf(ck,cn){var cj=ck.getElementsByTagName("script"),cm;cn=bA({ie_compat_id:"ng-ie-compat"},cn);for(var cl=0;cl<cj.length;cl++){cm=(cj[cl].src||"").match(U);if(cm){cn.base_url=cm[1];cn.ie_compat=cm[1]+"angular-ie-compat"+(cm[2]||"")+".js";bA(cn,Y(cm[6]));aL(bM(cj[cl]),function(cp,co){if(/^ng:/.exec(co)){co=co.substring(3).replace(/-/g,"_");if(co=="autobind"){cp=true}cn[co]=cp}})}}return cn}var B=[].constructor;function bO(cl,ck){var cj=[];bo(cj,cl,ck?"\n ":aM,[]);return cj.join("")}function K(cj){if(!cj){return cj}try{var cl=M(cj,true);var cm=cl.primary();cl.assertAllConsumed();return cm()}catch(ck){b5("fromJson error: ",cj,ck);throw ck}}an.toJson=bO;an.fromJson=K;function bo(ck,cm,cp,cr){if(typeof cm=="object"){if(r(cr,cm)){ck.push("RECURSION");return}cr.push(cm)}var cq=typeof cm;if(cm===aM){ck.push(s)}else{if(cq===a8){return}else{if(cq===bC){ck.push(""+cm)}else{if(cq===bJ){if(isNaN(cm)){ck.push(s)}else{ck.push(""+cm)}}else{if(cq===J){return ck.push(an.String["quoteUnicode"](cm))}else{if(cq===az){if(cm instanceof Array){ck.push("[");var co=cm.length;var cy=false;for(var cn=0;cn<co;cn++){var cv=cm[cn];if(cy){ck.push(",")}if(typeof cv==a8||typeof cv==n){ck.push(s)}else{bo(ck,cv,cp,cr)}cy=true}ck.push("]")}else{if(cm instanceof Date){ck.push(an.String["quoteUnicode"](an.Date["toString"](cm)))}else{ck.push("{");if(cp){ck.push(cp)}var cx=false;var cw=cp?cp+" ":false;var cu=[];for(var cl in cm){if(cl.indexOf("$")===0||cm[cl]===cg){continue}cu.push(cl)}cu.sort();for(var cj=0;cj<cu.length;cj++){var ct=cu[cj];var cs=cm[ct];if(typeof cs!=a8){if(cx){ck.push(",");if(cp){ck.push(cp)}}ck.push(an.String["quote"](ct));ck.push(":");bo(ck,cs,cw,cr);cx=true}}ck.push("}")}}}}}}}}if(typeof cm==az){cr.pop()}}function bX(cj){this.paths=[];this.children=[];this.inits=[];this.priority=cj;this.newScope=false}bX.prototype={init:function(cj,ck){var cl={};this.collectInits(cj,cl,ck);ah(cl,function(cm){aB(cm,function(cn){cn()})})},collectInits:function(cl,co,cr){var cn=co[this.priority],cp=cr;if(!cn){co[this.priority]=cn=[]}cl=bM(cl);if(this.newScope){cp=br(cr);cr.$onEval(cp.$eval)}aB(this.inits,function(ct){cn.push(function(){cp.$tryEval(function(){return cp.$inject(ct,cp,cl)},cl)})});var cm,cq=cl[0].childNodes,ck=this.children,cs=this.paths,cj=cs.length;for(cm=0;cm<cj;cm++){ck[cm].collectInits(cq[cs[cm]],co,cp)}},addInit:function(cj){if(cj){this.inits.push(cj)}},addChild:function(cj,ck){if(ck){this.paths.push(cj);this.children.push(ck)}},empty:function(){return this.inits.length===0&&this.paths.length===0}};function aO(cj,ck,cm,cl){this.markup=cj;this.attrMarkup=ck;this.directives=cm;this.widgets=cl}aO.prototype={compile:function(cn){cn=bM(cn);var cj=0,cm,cl=cn.parent();if(cl&&cl[0]){cl=cl[0];for(var ck=0;ck<cl.childNodes.length;ck++){if(cl.childNodes[ck]==cn[0]){cj=ck}}}cm=this.templatize(cn,cj,0)||new bX();return function(co,cq){co=bM(co);var cp=cq&&cq.$eval?cq:br(cq);return bA(cp,{$element:co,$init:function(){cm.init(co,cp);cp.$eval();delete cp.$init;return cp}})}},templatize:function(co,ck,cs){var cw=this,cp,cl=cw.directives,cr=true,cm=true,cv,cu={compile:bd(cw,cw.compile),comment:function(cx){return bM(o.createComment(cx))},element:function(cx){return bM(o.createElement(cx))},text:function(cx){return bM(o.createTextNode(cx))},descend:function(cx){if(bW(cx)){cr=cx}return cr},directives:function(cx){if(bW(cx)){cm=cx}return cm},scope:function(cx){if(bW(cx)){cv.newScope=cv.newScope||cx}return cv.newScope}};try{cs=co.attr("ng:eval-order")||cs||0}catch(cq){cs=cs||0}if(bK(cs)){cs=aw[bg(cs)]||parseInt(cs,10)}cv=new bX(cs);aL(co,function(cy,cx){if(!cp){if(cp=cw.widgets("@"+cx)){cp=bd(cu,cp,cy,co)}}});if(!cp){if(cp=cw.widgets(aj(co))){cp=bd(cu,cp,co)}}if(cp){cr=false;cm=false;var ct=co.parent();cv.addInit(cp.call(cu,co));if(ct&&ct[0]){co=bM(ct[0].childNodes[ck])}}if(cr){for(var cn=0,cj=co[0].childNodes;cn<cj.length;cn++){if(q(cj[cn])){aB(cw.markup,function(cx){if(cn<cj.length){var cy=bM(cj[cn]);cx.call(cu,cy.text(),cy,co)}})}}}if(cm){aL(co,function(cy,cx){aB(cw.attrMarkup,function(cz){cz.call(cu,cy,cx,co)})});aL(co,function(cy,cx){cv.addInit((cl[cx]||h).call(cu,cy,co))})}if(cr){aF(co,function(cy,cx){cv.addChild(cx,cw.templatize(cy,cx,cs))})}return cv.empty()?aM:cv}};function aF(ck,cl){var cj,cn=ck[0].childNodes||[],cm;for(cj=0;cj<cn.length;cj++){if(!q(cm=cn[cj])){cl(bM(cm),cj)}}}function aL(ck,co){var cl,cr=ck[0].attributes||[],cq,cn,cj,cp,cm={};for(cl=0;cl<cr.length;cl++){cn=cr[cl];cj=cn.name;cp=cn.value;if(ai&&cj=="href"){cp=decodeURIComponent(ck[0].getAttribute(cj,2))}cm[cj]=cp}ah(cm,co)}function bn(cr,cs,cp){if(!cs){return cr}var ck=cs.split(".");var cq;var cj=cr;var cm=ck.length;for(var cl=0;cl<cm;cl++){cq=ck[cl];if(!cq.match(/^[\$\w][\$\w\d]*$/)){throw"Expression '"+cs+"' is not a valid expression for accesing variables."}if(cr){cj=cr;cr=cr[cq]}if(ba(cr)&&cq.charAt(0)=="$"){var cn=an.Global["typeOf"](cj);cn=an[cn.charAt(0).toUpperCase()+cn.substring(1)];var co=cn?cn[[cq.substring(1)]]:cg;if(co){cr=bd(cj,co,cj);return cr}}}if(!cp&&A(cr)){return bd(cj,cr)}return cr}function bG(cj,cp,co){var cn=cp.split(".");for(var cm=0;cn.length>1;cm++){var cl=cn.shift();var ck=cj[cl];if(!ck){ck={};cj[cl]=ck}cj=ck}cj[cn.shift()]=co;return co}var am=0,b3={},ax={},cb={};aB(["abstract","boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","export","extends","false","final","finally","float","for",a8,"goto","if","implements","import","ininstanceof","intinterface","long","native","new",s,"package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","volatile","void",n,"while","with"],function(cj){cb[cj]=true});function bQ(cl){var cj=b3[cl];if(cj){return cj}var ck="var l, fn, t;\n";aB(cl.split("."),function(cn){cn=(cb[cn])?'["'+cn+'"]':"."+cn;ck+="if(!s) return s;\nl=s;\ns=s"+cn+';\nif(typeof s=="function") s = function(){ return l'+cn+".apply(l, arguments); };\n";if(cn.charAt(1)=="$"){var cm=cn.substr(2);ck+='if(!s) {\n t = angular.Global.typeOf(l);\n fn = (angular[t.charAt(0).toUpperCase() + t.substring(1)]||{})["'+cm+'"];\n if (fn) s = function(){ return fn.apply(l, [l].concat(Array.prototype.slice.call(arguments, 0, arguments.length))); };\n}\n'}});ck+="return s;";cj=Function("s",ck);cj.toString=function(){return ck};return b3[cl]=cj}function a3(cm){if(typeof cm===a8){return cm}var cj=ax[cm];if(!cj){var ck=M(cm);var cl=ck.statements();ck.assertAllConsumed();cj=ax[cm]=bA(function(){return cl(this)},{fnSelf:cl})}return cj}function ae(ck,cj){bv(ck,a,bW(cj)?bO(cj):cj)}function br(cq,co,cm){function cj(){}cq=cj.prototype=(cq||{});var cr=new cj();var cs={sorted:[]};var cn=[],ck={},cl=0;bA(cr,{"this":cr,$id:(am++),$parent:cq,$bind:bd(cr,bd,cr),$get:bd(cr,bn,cr),$set:bd(cr,bG,cr),$eval:function cp(cz){var cy=typeof cz;var cw,cv;var cu,cA;var ct;var cx;if(cy==n){for(cw=0,cv=cs.sorted.length;cw<cv;cw++){for(ct=cs.sorted[cw],cA=ct.length,cu=0;cu<cA;cu++){cr.$tryEval(ct[cu].fn,ct[cu].handler)}}while(cn.length){cx=cn.shift();delete ck[cx.$postEvalId];cr.$tryEval(cx)}}else{if(cy===a8){return cz.call(cr)}else{if(cy==="string"){return a3(cz).call(cr)}}}},$tryEval:function(cw,ct){var cu=typeof cw;try{if(cu==a8){return cw.call(cr)}else{if(cu=="string"){return a3(cw).call(cr)}}}catch(cv){(cr.$log||{error:b5}).error(cv);if(A(ct)){ct(cv)}else{if(ct){ae(ct,cv)}else{if(A(cr.$exceptionHandler)){cr.$exceptionHandler(cv)}}}}},$watch:function(cx,cw,ct){var cy=a3(cx),cv;cw=a3(cw);function cu(){var cA=cy.call(cr),cz=cv;if(cv!==cA){cv=cA;cr.$tryEval(function(){return cw.call(cr,cA,cz)},ct)}}cr.$onEval(ad,cu);cu()},$onEval:function(cu,cw,ct){if(!aD(cu)){ct=cw;cw=cu;cu=0}var cv=cs[cu];if(!cv){cv=cs[cu]=[];cv.priority=cu;cs.sorted.push(cv);cs.sorted.sort(function(cy,cx){return cy.priority-cx.priority})}cv.push({fn:a3(cw),handler:ct})},$postEval:function(cu){if(cu){var ct=a3(cu);var cv=ct.$postEvalId;if(!cv){cv="$"+cr.$id+"_"+(cl++);ct.$postEvalId=cv}if(!ck[cv]){cn.push(ck[cv]=ct)}}},$become:function(ct){if(A(ct)){cr.constructor=ct;aB(ct.prototype,function(cv,cu){cr[cu]=bd(cr,cv)});cr.$inject.apply(cr,aQ([ct,cr],arguments,1));if(A(ct.prototype.init)){cr.init()}}},$new:function(ct){var cu=br(cr);cu.$become.apply(cr,aQ([ct],arguments,1));cr.$onEval(cu.$eval);return cu}});if(!cq.$root){cr.$root=cr;cr.$parent=cr;(cr.$inject=bt(cr,co,cm))()}return cr}function bt(ck,cm,cj){cm=cm||a2;cj=cj||{};ck=ck||{};return function cl(cr,cq,co){var cp,cs,cn;if(bK(cr)){if(!cj.hasOwnProperty(cr)){cs=cm[cr];if(!cs){throw"Unknown provider for '"+cr+"'."}cj[cr]=cl(cs,ck)}cp=cj[cr]}else{if(aN(cr)){cp=[];aB(cr,function(ct){cp.push(cl(ct))})}else{if(A(cr)){cp=cl(cr.$inject||[]);cp=cr.apply(cq,aQ(cp,arguments,2))}else{if(cf(cr)){aB(cm,function(cu,ct){cn=cu.$creation;if(cn=="eager"){cl(ct)}if(cn=="eager-published"){bG(cr,ct,cl(ct))}})}else{cp=cl(ck)}}}}return cp}}var E={"null":function(cj){return aM},"true":function(cj){return true},"false":function(cj){return false},$undefined:h,"+":function(cl,ck,cj){return(bW(ck)?ck:0)+(bW(cj)?cj:0)},"-":function(cl,ck,cj){return(bW(ck)?ck:0)-(bW(cj)?cj:0)},"*":function(cl,ck,cj){return ck*cj},"/":function(cl,ck,cj){return ck/cj},"%":function(cl,ck,cj){return ck%cj},"^":function(cl,ck,cj){return ck^cj},"=":function(cl,ck,cj){return bG(cl,ck,cj)},"==":function(cl,ck,cj){return ck==cj},"!=":function(cl,ck,cj){return ck!=cj},"<":function(cl,ck,cj){return ck<cj},">":function(cl,ck,cj){return ck>cj},"<=":function(cl,ck,cj){return ck<=cj},">=":function(cl,ck,cj){return ck>=cj},"&&":function(cl,ck,cj){return ck&&cj},"||":function(cl,ck,cj){return ck||cj},"&":function(cl,ck,cj){return ck&cj},"|":function(cl,ck,cj){return cj(cl,ck)},"!":function(ck,cj){return !cj}};var N={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'};function a0(cx,cn){var cC=cn?20:-1,cz=[],cs,cr=0,cE=[],cv,cF=":";while(cr<cx.length){cv=cx.charAt(cr);if(cq("\"'")){cl(cv)}else{if(cy(cv)||cq(".")&&cy(cB())){cm()}else{if(cu("({[:,;")&&cq("/")){ck()}else{if(cA(cv)){cw();if(cu("{,")&&cE[0]=="{"&&(cs=cz[cz.length-1])){cs.json=cs.text.indexOf(".")==-1}}else{if(cq("(){}[].,;:")){cz.push({index:cr,text:cv,json:cq("{}[]:,")});if(cq("{[")){cE.unshift(cv)}if(cq("}]")){cE.shift()}cr++}else{if(cp(cv)){cr++;continue}else{var cj=cv+cB(),ct=E[cv],cD=E[cj];if(cD){cz.push({index:cr,text:cj,fn:cD});cr+=2}else{if(ct){cz.push({index:cr,text:cv,fn:ct,json:cu("[,:")&&cq("+-")});cr+=1}else{throw"Lexer Error: Unexpected next character ["+cx.substring(cr)+"] in expression '"+cx+"' at column '"+(cr+1)+"'."}}}}}}}}cF=cv}return cz;function cq(cG){return cG.indexOf(cv)!=-1}function cu(cG){return cG.indexOf(cF)!=-1}function cB(){return cr+1<cx.length?cx.charAt(cr+1):false}function cy(cG){return"0"<=cG&&cG<="9"}function cp(cG){return cG==" "||cG=="\r"||cG=="\t"||cG=="\n"||cG=="\v"}function cA(cG){return"a"<=cG&&cG<="z"||"A"<=cG&&cG<="Z"||"_"==cG||cG=="$"}function co(cG){return cG=="-"||cG=="+"}function cm(){var cI="";var cJ=cr;while(cr<cx.length){var cH=cx.charAt(cr);if(cH=="."||cy(cH)){cI+=cH}else{var cG=cB();if(cH=="E"&&co(cG)){cI+=cH}else{if(co(cH)&&cG&&cy(cG)&&cI.charAt(cI.length-1)=="E"){cI+=cH}else{if(co(cH)&&(!cG||!cy(cG))&&cI.charAt(cI.length-1)=="E"){throw'Lexer found invalid exponential value "'+cx+'"'}else{break}}}}cr++}cI=1*cI;cz.push({index:cJ,text:cI,json:true,fn:function(){return cI}})}function cw(){var cI="";var cJ=cr;while(cr<cx.length){var cH=cx.charAt(cr);if(cH=="."||cA(cH)||cy(cH)){cI+=cH}else{break}cr++}var cG=E[cI];if(!cG){cG=bQ(cI);cG.isAssignable=cI}cz.push({index:cJ,text:cI,fn:cG,json:E[cI]})}function cl(cG){var cN=cr;cr++;var cH="";var cI=cG;var cL=false;while(cr<cx.length){var cJ=cx.charAt(cr);cI+=cJ;if(cL){if(cJ=="u"){var cK=cx.substring(cr+1,cr+5);if(!cK.match(/[\da-f]{4}/i)){throw"Lexer Error: Invalid unicode escape [\\u"+cK+"] starting at column '"+cN+"' in expression '"+cx+"'."}cr+=4;cH+=String.fromCharCode(parseInt(cK,16))}else{var cM=N[cJ];if(cM){cH+=cM}else{cH+=cJ}}cL=false}else{if(cJ=="\\"){cL=true}else{if(cJ==cG){cr++;cz.push({index:cN,text:cI,string:cH,json:true,fn:function(){return(cH.length==cC)?an.String["toDate"](cH):cH}});return}else{cH+=cJ}}}cr++}throw"Lexer Error: Unterminated quote ["+cx.substring(cN)+"] starting at column '"+(cN+1)+"' in expression '"+cx+"'."}function ck(cI){var cM=cr;cr++;var cL="";var cK=false;while(cr<cx.length){var cJ=cx.charAt(cr);if(cK){cL+=cJ;cK=false}else{if(cJ==="\\"){cL+=cJ;cK=true}else{if(cJ==="/"){cr++;var cG="";if(cA(cx.charAt(cr))){cw();cG=cz.pop().text}var cH=new RegExp(cL,cG);cz.push({index:cM,text:cL,flags:cG,fn:function(){return cH}});return}else{cL+=cJ}}}cr++}throw"Lexer Error: Unterminated RegExp ["+cx.substring(cM)+"] starting at column '"+(cM+1)+"' in expression '"+cx+"'."}}function M(cI,cQ){var cw=bS(0),cL=a0(cI,cQ);return{assertAllConsumed:cC,primary:cz,statements:co,validator:cR,filter:cM,watch:cA};function cH(cV,cU){throw"Token '"+cU.text+"' is "+cV+" at column='"+(cU.index+1)+"' of expression '"+cI+"' starting at '"+cI.substring(cU.index)+"'."}function cp(){if(cL.length===0){throw"Unexpected end of expression: "+cI}return cL[0]}function cr(cZ,cY,cX,cW){if(cL.length>0){var cV=cL[0];var cU=cV.text;if(cU==cZ||cU==cY||cU==cX||cU==cW||(!cZ&&!cY&&!cX&&!cW)){return cV}}return false}function cl(cY,cX,cW,cV){var cU=cr(cY,cX,cW,cV);if(cU){if(cQ&&!cU.json){index=cU.index;throw"Expression at column='"+cU.index+"' of expression '"+cI+"' starting at '"+cI.substring(cU.index)+"' is not valid json."}cL.shift();this.currentToken=cU;return cU}return false}function cE(cV){if(!cl(cV)){var cU=cr();throw"Expecting '"+cV+"' at column '"+(cU.index+1)+"' in '"+cI+"' got '"+cI.substring(cU.index)+"'."}}function cv(cV,cU){return function(cW){return cV(cW,cU(cW))}}function cS(cW,cV,cU){return function(cX){return cV(cX,cW(cX),cU(cX))}}function cu(){return cL.length>0}function cC(){if(cL.length!==0){throw"Did not understand '"+cI.substring(cL[0].index)+"' while evaluating '"+cI+"'."}}function co(){var cU=[];while(true){if(cL.length>0&&!cr("}",")",";","]")){cU.push(cs())}if(!cl(";")){return function(cV){var cY;for(var cW=0;cW<cU.length;cW++){var cX=cU[cW];if(cX){cY=cX(cV)}}return cY}}}}function cs(){var cV=cG();var cU;while(true){if((cU=cl("|"))){cV=cS(cV,cU.fn,cM())}else{return cV}}}function cM(){return cj(bV)}function cR(){return cj(au)}function cj(cW){var cX=cm(cW);var cU=[];var cV;while(true){if((cV=cl(":"))){cU.push(cG())}else{var cY=function(c0,cZ){var c1=[cZ];for(var c2=0;c2<cU.length;c2++){c1.push(cU[c2](c0))}return cX.apply(c0,c1)};return function(){return cY}}}}function cG(){return cB()}function cB(){if(cl("throw")){var cU=cx();return function(cV){throw cU(cV)}}else{return cx()}}function cx(){var cW=cO();var cU;if(cU=cl("=")){if(!cW.isAssignable){throw"Left hand side '"+cI.substring(0,cU.index)+"' of assignment '"+cI.substring(cU.index)+"' is not assignable."}var cV=function(){return cW.isAssignable};return cS(cV,cU.fn,cO())}else{return cW}}function cO(){var cV=ct();var cU;while(true){if((cU=cl("||"))){cV=cS(cV,cU.fn,ct())}else{return cV}}}function ct(){var cV=cn();var cU;if((cU=cl("&&"))){cV=cS(cV,cU.fn,ct())}return cV}function cn(){var cV=cJ();var cU;if((cU=cl("==","!="))){cV=cS(cV,cU.fn,cn())}return cV}function cJ(){var cV=cK();var cU;if(cU=cl("<",">","<=",">=")){cV=cS(cV,cU.fn,cJ())}return cV}function cK(){var cV=ck();var cU;while(cU=cl("+","-")){cV=cS(cV,cU.fn,ck())}return cV}function ck(){var cV=cD();var cU;while(cU=cl("*","/","%")){cV=cS(cV,cU.fn,cD())}return cV}function cD(){var cU;if(cl("+")){return cz()}else{if(cU=cl("-")){return cS(cw,cU.fn,cD())}else{if(cU=cl("!")){return cv(cU.fn,cD())}else{return cz()}}}}function cm(cZ){var cY=cl();var cX=cY.text.split(".");var cU=cZ;var cW;for(var cV=0;cV<cX.length;cV++){cW=cX[cV];if(cU){cU=cU[cW]}}if(typeof cU!=a8){throw"Function '"+cY.text+"' at column '"+(cY.index+1)+"' in '"+cI+"' is not defined."}return cU}function cz(){var cW;if(cl("(")){var cX=cs();cE(")");cW=cX}else{if(cl("[")){cW=cq()}else{if(cl("{")){cW=cP()}else{var cU=cl();cW=cU.fn;if(!cW){cH("not a primary expression",cU)}}}}var cV;while(cV=cl("(","[",".")){if(cV.text==="("){cW=cF(cW)}else{if(cV.text==="["){cW=cy(cW)}else{if(cV.text==="."){cW=cN(cW)}else{throw"IMPOSSIBLE"}}}}return cW}function cN(cV){var cX=cl().text;var cU=bQ(cX);var cW=function(cY){return cU(cV(cY))};cW.isAssignable=cX;return cW}function cy(cV){var cU=cG();cE("]");if(cl("=")){var cW=cG();return function(cX){return cV(cX)[cU(cX)]=cW(cX)}}else{return function(cX){var cZ=cV(cX);var cY=cU(cX);return(cZ)?cZ[cY]:cg}}}function cF(cV){var cU=[];if(cp().text!=")"){do{cU.push(cG())}while(cl(","))}cE(")");return function(cX){var cY=[];for(var cZ=0;cZ<cU.length;cZ++){cY.push(cU[cZ](cX))}var cW=cV(cX)||h;return cW.apply?cW.apply(cX,cY):cW(cY[0],cY[1],cY[2],cY[3],cY[4])}}function cq(){var cU=[];if(cp().text!="]"){do{cU.push(cG())}while(cl(","))}cE("]");return function(cV){var cX=[];for(var cW=0;cW<cU.length;cW++){cX.push(cU[cW](cV))}return cX}}function cP(){var cU=[];if(cp().text!="}"){do{var cW=cl(),cV=cW.string||cW.text;cE(":");var cX=cG();cU.push({key:cV,value:cX})}while(cl(","))}cE("}");return function(cY){var cZ={};for(var c0=0;c0<cU.length;c0++){var c2=cU[c0];var c1=c2.value(cY);cZ[c2.key]=c1}return cZ}}function cA(){var cU=[];while(cu()){cU.push(cT());if(!cl(";")){cC()}}cC();return function(cV){for(var cW=0;cW<cU.length;cW++){var cX=cU[cW](cV);cV.addListener(cX.name,cX.fn)}}}function cT(){var cU=cl().text;cE(":");var cV;if(cp().text=="{"){cE("{");cV=co();cE("}")}else{cV=cG()}return function(cW){return{name:cU,fn:cV}}}}function bs(ck,cl){this.template=ck=ck+"#";this.defaults=cl||{};var cj=this.urlParams={};aB(ck.split(/\W/),function(cm){if(cm&&ck.match(new RegExp(":"+cm+"\\W"))){cj[cm]=true}})}bs.prototype={url:function(cn){var cm=[];var cj=this;var ck=this.template;cn=cn||{};aB(this.urlParams,function(cp,co){var cq=cn[co]||cj.defaults[co]||"";ck=ck.replace(new RegExp(":"+co+"(\\W)"),cq+"$1")});ck=ck.replace(/\/?#$/,"");var cl=[];ah(cn,function(cp,co){if(!cj.urlParams[co]){cl.push(encodeURI(co)+"="+encodeURI(cp))}});ck=ck.replace(/\/*$/,"");return ck+(cl.length?"?"+cl.join("&"):"")}};function bm(cj){this.xhr=cj}bm.DEFAULT_ACTIONS={get:{method:"GET"},save:{method:"POST"},query:{method:"GET",isArray:true},remove:{method:"DELETE"},"delete":{method:"DELETE"}};bm.prototype={route:function(cm,cn,cp){var ck=this;var cj=new bs(cm);cp=bA({},bm.DEFAULT_ACTIONS,cp);function cl(cr){var cq={};aB(cn||{},function(ct,cs){cq[cs]=ct.charAt&&ct.charAt(0)=="@"?bn(cr,ct.substr(1)):ct});return cq}function co(cq){a5(cq||{},this)}aB(cp,function(cs,cr){var cq=cs.method=="POST"||cs.method=="PUT";co[cr]=function(cu,ct,cz){var cx={};var cw;var cy=h;switch(arguments.length){case 3:cy=cz;case 2:if(A(ct)){cy=ct}else{cx=cu;cw=ct;break}case 1:if(A(cu)){cy=cu}else{if(cq){cw=cu}else{cx=cu}}break;case 0:break;default:throw"Expected between 0-3 arguments [params, data, callback], got "+arguments.length+" arguments."}var cv=this instanceof co?this:(cs.isArray?[]:new co(cw));ck.xhr(cs.method,cj.url(bA({},cs.params||{},cl(cw),cx)),cw,function(cB,cC,cA){if(cB==200){if(cs.isArray){cv.length=0;aB(cC,function(cD){cv.push(new co(cD))})}else{a5(cC,cv)}(cy||h)(cv)}else{throw {status:cB,response:cC,message:cB+": "+cC}}},cs.verifyCache);return cv};co.bind=function(ct){return ck.route(cm,bA({},cn,ct),cp)};co.prototype["$"+cr]=function(cu,ct){var cw=cl(this);var cx=h;switch(arguments.length){case 2:cw=cu;cx=ct;case 1:if(typeof cu==a8){cx=cu}else{cw=cu}case 0:break;default:throw"Expected between 1-2 arguments [params, callback], got "+arguments.length+" arguments."}var cv=cq?this:cg;co[cr].call(this,cw,cv,cx)}});return co}};var F=bq.XMLHttpRequest||function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(cl){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(ck){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(cj){}throw new Error("This browser does not support XMLHttpRequest.")};function ay(cu,cs,ct,cq,cx){var cv=this;cv.isMock=false;var cn=0;var cp=0;var cw=[];cv.xhr=function(cE,cz,cA,cD){if(A(cA)){cD=cA;cA=aM}if(ac(cE)=="json"){var cB="angular_"+Math.random()+"_"+(cn++);cB=cB.replace(/\d\./,"");var cy=cs[0].createElement("script");cy.type="text/javascript";cy.src=cz.replace("JSON_CALLBACK",cB);bq[cB]=function(cF){bq[cB]=cg;cD(200,cF)};ct.append(cy)}else{var cC=new cq();cC.open(cE,cz,true);cC.setRequestHeader("Content-Type","application/x-www-form-urlencoded");cC.setRequestHeader("Accept","application/json, text/plain, */*");cC.setRequestHeader("X-Requested-With","XMLHttpRequest");cp++;cC.onreadystatechange=function(){if(cC.readyState==4){try{cD(cC.status||200,cC.responseText)}finally{cp--;if(cp===0){while(cw.length){try{cw.pop()()}catch(cF){}}}}}};cC.send(cA||"")}};cv.notifyWhenNoOutstandingRequests=function(cy){if(cp===0){cy()}else{cw.push(cy)}};var cm=[];function cr(){aB(cm,function(cy){cy()})}cv.poll=cr;cv.addPollFn=function(cy){cm.push(cy);return cy};cv.startPoller=function(cz,cA){(function cy(){cr();cA(cy,cz)})()};cv.setUrl=function(cz){var cy=cu.href;if(!cy.match(/#/)){cy+="#"}if(!cz.match(/#/)){cz+="#"}cu.href=cz};cv.getUrl=function(){return cu.href};var cj=cs[0];var cl={};var ck="";cv.cookies=function(cz,cB){var cD,cy,cA,cC;if(cz){if(cB===cg){cj.cookie=escape(cz)+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT"}else{if(bK(cB)){cj.cookie=escape(cz)+"="+escape(cB);cD=cz.length+cB.length+1;if(cD>4096){cx.warn("Cookie '"+cz+"' possibly not set or overflowed because it was too large ("+cD+" > 4096 bytes)!")}if(cl.length>20){cx.warn("Cookie '"+cz+"' possibly not set or overflowed because too many cookies were already set ("+cl.length+" > 20 )")}}}}else{if(cj.cookie!==ck){ck=cj.cookie;cy=ck.split("; ");cl={};for(cA=0;cA<cy.length;cA++){cC=cy[cA].split("=");if(cC.length===2){cl[unescape(cC[0])]=unescape(cC[1])}}}return cl}};var co=h;cv.hover=function(cy){co=cy};cv.bind=function(){cs.bind("mouseover",function(cy){co(bM(ai?cy.srcElement:cy.target),true);return true});cs.bind("mouseleave mouseout click dblclick keypress keyup",function(cy){co(bM(cy.target),false);return true})};cv.addCss=function(cy){var cz=bM(cj.createElement("link"));cz.attr("rel","stylesheet");cz.attr("type","text/css");cz.attr("href",cy);ct.append(cz)};cv.addJs=function(cA,cz){var cy=bM(cj.createElement("script"));cy.attr("type","text/javascript");cy.attr("src",cA);if(cz){cy.attr("id",cz)}ct.append(cy)}}var bF={},b1="ng-"+new Date().getTime(),aa=1,ao=(bq.document.attachEvent?function(cj,cl,ck){cj.attachEvent("on"+cl,ck)}:function(cj,cl,ck){cj.addEventListener(cl,ck,false)}),e=(bq.document.detachEvent?function(cj,cl,ck){cj.detachEvent("on"+cl,ck)}:function(cj,cl,ck){cj.removeEventListener(cl,ck,false)});function bI(){return(aa++)}function ci(ck){var cl=ck[b1],cj=bF[cl];if(cj){aB(cj.bind||{},function(cn,cm){e(ck,cm,cn)});delete bF[cl];if(ai){ck[b1]=""}else{delete ck[b1]}}}function bE(cl){var co={},cm=cl[0].style,cn,cj,ck;if(typeof cm.length=="number"){for(ck=0;ck<cm.length;ck++){cj=cm[ck];co[cj]=cm[cj]}}else{for(cj in cm){cn=cm[cj];if(1*cj!=cj&&cj!="cssText"&&cn&&typeof cn=="string"&&cn!="false"){co[cj]=cn}}}return co}function a4(ck){if(bh(ck)){this[0]=ck;this.length=1}else{if(bW(ck.length)&&ck.item){for(var cj=0;cj<ck.length;cj++){this[cj]=ck[cj]}this.length=ck.length}}}a4.prototype={data:function(cl,cm){var ck=this[0],cn=ck[b1],cj=bF[cn||-1];if(bW(cm)){if(!cj){ck[b1]=cn=bI();cj=bF[cn]={}}cj[cl]=cm}else{return cj?cj[cl]:aM}},removeData:function(){ci(this[0])},dealoc:function(){(function cj(cm){ci(cm);for(var cl=0,ck=cm.childNodes;cl<ck.length;cl++){cj(ck[cl])}})(this[0])},bind:function(cn,cm){var cj=this,cl=cj[0],co=cj.data("bind"),ck;if(!co){this.data("bind",co={})}aB(cn.split(" "),function(cp){ck=co[cp];if(!ck){co[cp]=ck=function(cq){if(!cq.preventDefault){cq.preventDefault=function(){cq.returnValue=false}}if(!cq.stopPropagation){cq.stopPropagation=function(){cq.cancelBubble=true}}aB(ck.fns,function(cr){cr.call(cj,cq)})};ck.fns=[];ao(cl,cp,ck)}ck.fns.push(cm)})},replaceWith:function(cj){this[0].parentNode.replaceChild(bM(cj)[0],this[0])},children:function(){return new a4(this[0].childNodes)},append:function(ck){var cj=this[0];ck=bM(ck);aB(ck,function(cl){cj.appendChild(cl)})},remove:function(){this.dealoc();var cj=this[0].parentNode;if(cj){cj.removeChild(this[0])}},removeAttr:function(cj){this[0].removeAttribute(cj)},after:function(cj){this[0].parentNode.insertBefore(bM(cj)[0],this[0].nextSibling)},hasClass:function(cj){var ck=" "+cj+" ";if((" "+this[0].className+" ").replace(/[\n\t]/g," ").indexOf(ck)>-1){return true}return false},removeClass:function(cj){this[0].className=ak((" "+this[0].className+" ").replace(/[\n\t]/g," ").replace(" "+cj+" ",""))},toggleClass:function(cj,cl){var ck=this;(cl?ck.addClass:ck.removeClass).call(ck,cj)},addClass:function(cj){if(!this.hasClass(cj)){this[0].className=ak(this[0].className+" "+cj)}},css:function(cj,cl){var ck=this[0].style;if(bK(cj)){if(bW(cl)){ck[cj]=cl}else{return ck[cj]}}else{bA(ck,cj)}},attr:function(cj,ck){var cl=this[0];if(cf(cj)){aB(cj,function(cn,cm){cl.setAttribute(cm,cn)})}else{if(bW(ck)){cl.setAttribute(cj,ck)}else{return cl.getAttribute(cj,2)}}},text:function(cj){if(bW(cj)){this[0].textContent=cj}return this[0].textContent},val:function(cj){if(bW(cj)){this[0].value=cj}return this[0].value},html:function(ck){if(bW(ck)){var cj=0,cl=this[0].childNodes;for(;cj<cl.length;cj++){bM(cl[cj]).dealoc()}this[0].innerHTML=ck}return this[0].innerHTML},parent:function(){return bM(this[0].parentNode)},clone:function(){return bM(this[0].cloneNode(true))}};if(ai){bA(a4.prototype,{text:function(cj){var ck=this[0];if(ck.nodeType==3){if(bW(cj)){ck.nodeValue=cj}return ck.nodeValue}else{if(bW(cj)){ck.innerText=cj}return ck.innerText}}})}var aG={typeOf:function(ck){if(ck===aM){return s}var cj=typeof ck;if(cj==az){if(ck instanceof Array){return aK}if(ck instanceof Date){return aP}if(ck.nodeType==1){return b2}}return cj}};var ce={copy:a5,size:al,equals:m};var aU={extend:bA};var H={indexOf:cc,sum:function(co,cn){var cl=an.Function["compile"](cn);var ck=0;for(var cj=0;cj<co.length;cj++){var cm=1*cl(co[cj]);if(!isNaN(cm)){ck+=cm}}return ck},remove:function(cl,ck){var cj=cc(cl,ck);if(cj>=0){cl.splice(cj,1)}return ck},filter:function(cq,cp){var cl=[];cl.check=function(cs){for(var cr=0;cr<cl.length;cr++){if(!cl[cr](cs)){return false}}return true};var cn=function(ct,cu){if(cu.charAt(0)==="!"){return !cn(ct,cu.substr(1))}switch(typeof ct){case"boolean":case"number":case"string":return(""+ct).toLowerCase().indexOf(cu)>-1;case"object":for(var cs in ct){if(cs.charAt(0)!=="$"&&cn(ct[cs],cu)){return true}}return false;case"array":for(var cr=0;cr<ct.length;cr++){if(cn(ct[cr],cu)){return true}}return false;default:return false}};switch(typeof cp){case"boolean":case"number":case"string":cp={$:cp};case"object":for(var cm in cp){if(cm=="$"){(function(){var cr=(""+cp[cm]).toLowerCase();if(!cr){return}cl.push(function(cs){return cn(cs,cr)})})()}else{(function(){var cr=cm;var cs=(""+cp[cm]).toLowerCase();if(!cs){return}cl.push(function(ct){return cn(bn(ct,cr),cs)})})()}}break;case a8:cl.push(cp);break;default:return cq}var ck=[];for(var cj=0;cj<cq.length;cj++){var co=cq[cj];if(cl.check(co)){ck.push(co)}}return ck},add:function(ck,cj){ck.push(ba(cj)?{}:cj);return ck},count:function(cm,cl){if(!cl){return cm.length}var cj=an.Function["compile"](cl),ck=0;aB(cm,function(cn){if(cj(cn)){ck++}});return ck},orderBy:function(cq,cp,cn){cp=aN(cp)?cp:[cp];cp=ar(cp,function(cs){var ct=false,cr=cs||ap;if(bK(cs)){if((cs.charAt(0)=="+"||cs.charAt(0)=="-")){ct=cs.charAt(0)=="-";cs=cs.substring(1)}cr=a3(cs).fnSelf}return ck(function(cv,cu){return co(cr(cv),cr(cu))},ct)});var cm=[];for(var cl=0;cl<cq.length;cl++){cm.push(cq[cl])}return cm.sort(ck(cj,cn));function cj(cu,ct){for(var cs=0;cs<cp.length;cs++){var cr=cp[cs](cu,ct);if(cr!==0){return cr}}return 0}function ck(cr,cs){return bR(cs)?function(cu,ct){return cr(ct,cu)}:cr}function co(cu,ct){var cs=typeof cu;var cr=typeof ct;if(cs==cr){if(cs=="string"){cu=cu.toLowerCase()}if(cs=="string"){ct=ct.toLowerCase()}if(cu===ct){return 0}return cu<ct?-1:1}else{return cs<cr?-1:1}}}};var ag={quote:function(cj){return'"'+cj.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v")+'"'},quoteUnicode:function(cj){var co=an.String["quote"](cj);var cn=[];for(var ck=0;ck<co.length;ck++){var cl=co.charCodeAt(ck);if(cl<128){cn.push(co.charAt(ck))}else{var cm="000"+cl.toString(16);cn.push("\\u"+cm.substring(cm.length-4))}}return cn.join("")},toDate:function(cl){var ck;if(typeof cl=="string"&&(ck=cl.match(/^(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)Z$/))){var cj=new Date(0);cj.setUTCFullYear(ck[1],ck[2]-1,ck[3]);cj.setUTCHours(ck[4],ck[5],ck[6],0);return cj}return cl}};var X={toString:function(cj){function ck(cl){return cl<10?"0"+cl:cl}return !cj?cj:cj.getUTCFullYear()+"-"+ck(cj.getUTCMonth()+1)+"-"+ck(cj.getUTCDate())+"T"+ck(cj.getUTCHours())+":"+ck(cj.getUTCMinutes())+":"+ck(cj.getUTCSeconds())+"Z"}};var t={compile:function(cj){if(A(cj)){return cj}else{if(cj){return a3(cj).fnSelf}else{return ap}}}};function D(ck,cj){an[ck]=an[ck]||{};aB(cj,function(cl){bA(an[ck],cl)})}D("Global",[aG]);D("Collection",[aG,ce]);D("Array",[aG,ce,H]);D("Object",[aG,ce,aU]);D("String",[aG,ag]);D("Date",[aG,X]);an.Date["toString"]=X.toString;D("Function",[aG,ce,t]);bV.currency=function(cj){this.$element.toggleClass("ng-format-negative",cj<0);return"$"+bV.number.apply(this,[cj,2])};bV.number=function(co,cj){if(isNaN(co)||!isFinite(co)){return""}cj=typeof cj==n?2:cj;var ck=co<0;co=Math.abs(co);var cp=Math.pow(10,cj);var cr=""+Math.round(co*cp);var cq=cr.substring(0,cr.length-cj);cq=cq||"0";var cl=cr.substring(cr.length-cj);cr=ck?"-":"";for(var cn=0;cn<cq.length;cn++){if((cq.length-cn)%3===0&&cn!==0){cr+=","}cr+=cq.charAt(cn)}if(cj>0){for(var cm=cl.length;cm<cj;cm++){cl+="0"}cr+="."+cl.substring(0,cj)}return cr};function bP(ck,cl,cj){var cm="";if(ck<0){cm="-";ck=-ck}ck=""+ck;while(ck.length<cl){ck="0"+ck}if(cj){ck=ck.substr(ck.length-cl)}return cm+ck}function a1(ck,cl,cm,cj){return function(cn){var co=cn["get"+ck].call(cn);if(cm>0||co>-cm){co+=cm}if(co===0&&cm==-12){co=12}return bP(co,cl,cj)}}var be={yyyy:a1("FullYear",4),yy:a1("FullYear",2,0,true),MM:a1("Month",2,1),M:a1("Month",1,1),dd:a1("Date",2),d:a1("Date",1),HH:a1("Hours",2),H:a1("Hours",1),hh:a1("Hours",2,-12),h:a1("Hours",1,-12),mm:a1("Minutes",2),m:a1("Minutes",1),ss:a1("Seconds",2),s:a1("Seconds",1),a:function(cj){return cj.getHours()<12?"am":"pm"},Z:function(cj){var ck=cj.getTimezoneOffset();return bP(ck/60,2)+bP(Math.abs(ck%60),2)}};var af=/([^yMdHhmsaZ]*)(y+|M+|d+|H+|h+|m+|s+|a|Z)(.*)/;bV.date=function(cj,cm){if(!(cj instanceof Date)){return cj}var cn=cj.toLocaleDateString(),ck;if(cm&&bK(cm)){cn="";var cl=[];while(cm){cl=aQ(cl,af.exec(cm),1);cm=cl.pop()}aB(cl,function(co){ck=be[co];cn+=ck?ck(cj):co})}return cn};bV.json=function(cj){this.$element.addClass("ng-monospace");return bO(cj,true)};bV.lowercase=ac;bV.uppercase=bg;bV.html=function(cj){return new aE(cj)};bV.linky=function(cq){if(!cq){return cq}function cp(cr){return cr.replace(/([\/\.\*\+\?\|\(\)\[\]\{\}\\])/g,"\\$1")}var cj=/(ftp|http|https|mailto):\/\/([^\(\)|\s]+)/;var cm;var cl=cq;var co=[];while(cm=cl.match(cj)){var ck=cm[0].replace(/[\.\;\,\(\)\{\}\<\>]$/,"");var cn=cl.indexOf(ck);co.push(ca(cl.substr(0,cn)));co.push('<a href="'+ck+'">');co.push(ck);co.push("</a>");cl=cl.substring(cn+ck.length)}co.push(ca(cl));return new aE(co.join(""))};function aI(cj,ck){return{format:cj,parse:ck||cj}}function z(cj){return(bW(cj)&&cj!==aM)?""+cj:cj}var aC=/^\s*[-+]?\d*(\.\d*)?\s*$/;j.noop=aI(ap,ap);j.json=aI(bO,K);j["boolean"]=aI(z,bR);j.number=aI(z,function(cj){if(cj==aM||aC.exec(cj)){return cj===aM||cj===""?aM:1*cj}else{throw"Not a number"}});j.list=aI(function(cj){return cj?cj.join(", "):cj},function(ck){var cj=[];aB((ck||"").split(","),function(cl){cl=ak(cl);if(cl){cj.push(cl)}});return cj});j.trim=aI(function(cj){return cj?ak(""+cj):""});aB({noop:function(){return aM},regexp:function(ck,cj,cl){if(!ck.match(cj)){return cl||"Value does not match expected format "+cj+"."}else{return aM}},number:function(cm,cl,cj){var ck=1*cm;if(ck==cm){if(typeof cl!=n&&ck<cl){return"Value can not be less than "+cl+"."}if(typeof cl!=n&&ck>cj){return"Value can not be greater than "+cj+"."}return aM}else{return"Not a number"}},integer:function(cm,ck,cj){var cl=au.number(cm,ck,cj);if(cl){return cl}if(!(""+cm).match(/^\s*[\d+]*\s*$/)||cm!=Math.round(cm)){return"Not a whole number"}return aM},date:function(cl){var cj=/^(\d\d?)\/(\d\d?)\/(\d\d\d\d)$/.exec(cl);var ck=cj?new Date(cj[3],cj[1]-1,cj[2]):0;return(ck&&ck.getFullYear()==cj[3]&&ck.getMonth()==cj[1]-1&&ck.getDate()==cj[2])?aM:"Value is not a date. (Expecting format: 12/31/2009)."},ssn:function(cj){if(cj.match(/^\d\d\d-\d\d-\d\d\d\d$/)){return aM}return"SSN needs to be in 999-99-9999 format."},email:function(cj){if(cj.match(/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/)){return aM}return"Email needs to be in [email protected] format."},phone:function(cj){if(cj.match(/^1\(\d\d\d\)\d\d\d-\d\d\d\d$/)){return aM}if(cj.match(/^\+\d{2,3} (\(\d{1,5}\))?[\d ]+\d$/)){return aM}return"Phone number needs to be in 1(987)654-3210 format in North America or +999 (123) 45678 906 internationaly."},url:function(cj){if(cj.match(/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/)){return aM}return"URL needs to be in http://server[:port]/path format."},json:function(cj){try{K(cj);return aM}catch(ck){return ck.toString()}},asynchronous:function(cm,cp,ck){if(!cm){return}var co=this;var cn=co.$element;var cl=cn.data("$asyncValidator");if(!cl){cn.data("$asyncValidator",cl={inputs:{}})}cl.current=cm;var cj=cl.inputs[cm];if(!cj){cl.inputs[cm]=cj={inFlight:true};co.$invalidWidgets.markInvalid(co.$element);cn.addClass("ng-input-indicator-wait");cp(cm,function(cq,cr){cj.response=cr;cj.error=cq;cj.inFlight=false;if(cl.current==cm){cn.removeClass("ng-input-indicator-wait");co.$invalidWidgets.markValid(cn)}cn.data("$validate")();co.$root.$eval()})}else{if(cj.inFlight){co.$invalidWidgets.markInvalid(co.$element)}else{(ck||h)(cj.response)}}return cj.error}},function(ck,cj){au[cj]=ck});var C=/^(file|ftp|http|https):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,v=/^([^\?]*)?(\?([^\?]*))?$/,b0={http:80,https:443,ftp:21},bp="eager",bi=bp+"-published";function bN(ck,cm,cl,cj){a2(ck,cm,{$inject:cl,$creation:cj})}bN("$window",bd(bq,ap,bq),[],bi);bN("$document",function(cj){return bM(cj.document)},["$window"],bi);bN("$location",function(cp){var cw=this,ct={toString:ck,update:co,updateHash:cs},cm=cp.getUrl(),cq;cp.addPollFn(function(){if(cm!==cp.getUrl()){co(cm=cp.getUrl());cw.$eval()}});this.$onEval(aZ,cr);this.$onEval(bH,cr);co(cm);cq=ct.hash;return ct;function co(cx){if(bK(cx)){bA(ct,cv(cx))}else{if(bW(cx.hash)){bA(cx,cn(cx.hash))}bA(ct,cx);if(bW(cx.hashPath||cx.hashSearch)){ct.hash=cl(ct)}ct.href=cu(ct)}}function cs(cz,cx){var cy={};if(bK(cz)){cy.hashPath=cz;if(bW(cx)){cy.hashSearch=cx}}else{cy.hashSearch=cz}co(cy)}function ck(){cj();return ct.href}function cj(){if(ct.href==cm){if(ct.hash==cq){ct.hash=cl(ct)}ct.href=cu(ct)}co(ct.href)}function cr(){cj();if(ct.href!=cm){cp.setUrl(cm=ct.href);cq=ct.hash}}function cu(cz){var cy=G(cz.search);var cx=(cz.port==b0[cz.protocol]?aM:cz.port);return cz.protocol+"://"+cz.host+(cx?":"+cx:"")+cz.path+(cy?"?"+cy:"")+(cz.hash?"#"+cz.hash:"")}function cl(cy){var cx=G(cy.hashSearch);return escape(cy.hashPath)+(cx?"?"+cx:"")}function cv(cx){var cz={};var cy=C.exec(cx);if(cy){cz.href=cx.replace("#$","");cz.protocol=cy[1];cz.host=cy[3]||"";cz.port=cy[5]||b0[cz.protocol]||aM;cz.path=cy[6]||"";cz.search=Y(cy[8]);cz.hash=cy[10]||"";bA(cz,cn(cz.hash))}return cz}function cn(cz){var cy={};var cx=v.exec(cz);if(cx){cy.hash=cz;cy.hashPath=unescape(cx[1]||"");cy.hashSearch=Y(cx[3])}return cy}},["$browser"],bi);bN("$log",function(cl){var cj=cl.console||{log:h,warn:h,info:h,error:h},ck=cj.log||h;return{log:bd(cj,ck),warn:bd(cj,cj.warn||ck),info:bd(cj,cj.info||ck),error:bd(cj,cj.error||ck)}},["$window"],bi);bN("$exceptionHandler",function(cj){return function(ck){cj.error(ck)}},["$log"],bi);bN("$hover",function(co,ck){var cq,cm=this,cn,cp=300,cl=10,cj=bM(ck[0].body);co.hover(function(cu,cs){if(cs&&(cn=cu.attr(a)||cu.attr(i))){if(!cq){cq={callout:bM('<div id="ng-callout"></div>'),arrow:bM("<div></div>"),title:bM('<div class="ng-title"></div>'),content:bM('<div class="ng-content"></div>')};cq.callout.append(cq.arrow);cq.callout.append(cq.title);cq.callout.append(cq.content);cj.append(cq.callout)}var cr=cj[0].getBoundingClientRect(),ct=cu[0].getBoundingClientRect(),cv=cr.right-ct.right-cl;cq.title.text(cu.hasClass("ng-exception")?"EXCEPTION:":"Validation error...");cq.content.text(cn);if(cv<cp){cq.arrow.addClass("ng-arrow-right");cq.arrow.css({left:(cp+1)+"px"});cq.callout.css({position:"fixed",left:(ct.left-cl-cp-4)+"px",top:(ct.top-3)+"px",width:cp+"px"})}else{cq.arrow.addClass("ng-arrow-left");cq.callout.css({position:"fixed",left:(ct.right+cl)+"px",top:(ct.top-3)+"px",width:cp+"px"})}}else{if(cq){cq.callout.remove();cq=aM}}})},["$browser","$document"],bp);bN("$invalidWidgets",function(){var ck=[];ck.markValid=function(cm){var cl=cc(ck,cm);if(cl!=-1){ck.splice(cl,1)}};ck.markInvalid=function(cm){var cl=cc(ck,cm);if(cl===-1){ck.push(cm)}};ck.visible=function(){var cl=0;aB(ck,function(cm){cl=cl+(aA(cm)?1:0)});return cl};this.$onEval(bH,function(){for(var cl=0;cl<ck.length;){var cm=ck[cl];if(cj(cm[0])){ck.splice(cl,1);if(cm.dealoc){cm.dealoc()}}else{cl++}}});function cj(cm){if(cm==bq.document){return false}var cl=cm.parentNode;return !cl||cj(cl)}return ck},[],bi);function aT(ck,cj,cn){var cm="^"+cj.replace(/[\.\\\(\)\^\$]/g,"$1")+"$",co=[],cp={};aB(cj.split(/\W/),function(cr){if(cr){var cq=new RegExp(":"+cr+"([\\W])");if(cm.match(cq)){cm=cm.replace(cq,"([^/]*)$1");co.push(cr)}}});var cl=ck.match(new RegExp(cm));if(cl){aB(co,function(cr,cq){cp[cr]=cl[cq+1]});if(cn){this.$set(cn,cp)}}return cl?cp:aM}bN("$route",function(ck){var cj={},cl=[],cp=aT,cn=this,cm=0,cq={routes:cj,onChange:bd(cl,cl.push),when:function(cs,ct){if(an.isUndefined(cs)){return cj}var cr=cj[cs];if(!cr){cr=cj[cs]={}}if(ct){an.extend(cr,ct)}cm++;return cr}};function co(){var cr;cq.current=aM;an.foreach(cj,function(cs,ct){if(!cr){var cu=cp(ck.hashPath,ct);if(cu){cr=an.scope(cn);cq.current=an.extend({},cs,{scope:cr,params:an.extend({},ck.hashSearch,cu)})}}});an.foreach(cl,cn.$tryEval);if(cr){cr.$become(cq.current.controller)}}this.$watch(function(){return cm+ck.hash},co);return cq},["$location"],bi);bN("$xhr",function(ck,cj,cm){var cl=this;return function(cq,cn,co,cp){if(A(co)){cp=co;co=aM}if(co&&cf(co)){co=bO(co)}ck.xhr(cq,cn,co,function(cs,cr){try{if(bK(cr)&&/^\s*[\[\{]/.exec(cr)&&/[\}\]]\s*$/.exec(cr)){cr=K(cr)}if(cs==200){cp(cs,cr)}else{cj({method:cq,url:cn,data:co,callback:cp},{status:cs,body:cr})}}catch(ct){cm.error(ct)}finally{cl.$eval()}})}},["$browser","$xhr.error","$log"]);bN("$xhr.error",function(cj){return function(cl,ck){cj.error("ERROR: XHR: "+cl.url,cl,ck)}},["$log"]);bN("$xhr.bulk",function(ck,cj,cn){var co=[],cm=this;function cl(ct,cp,cq,cs){if(A(cq)){cs=cq;cq=aM}var cr;aB(cl.urls,function(cu){if(A(cu.match)?cu.match(cp):cu.match.exec(cp)){cr=cu}});if(cr){if(!cr.requests){cr.requests=[]}cr.requests.push({method:ct,url:cp,data:cq,callback:cs})}else{ck(ct,cp,cq,cs)}}cl.urls={};cl.flush=function(cp){aB(cl.urls,function(cq,cr){var cs=cq.requests;if(cs&&cs.length){cq.requests=[];cq.callbacks=[];ck("POST",cr,{requests:cs},function(cu,ct){aB(ct,function(cv,cw){try{if(cv.status==200){(cs[cw].callback||h)(cv.status,cv.response)}else{cj(cs[cw],cv)}}catch(cx){cn.error(cx)}});(cp||h)()});cm.$eval()}})};this.$onEval(bH,cl.flush);return cl},["$xhr","$xhr.error","$log"]);bN("$xhr.cache",function(cj){var cm={},cl=this;function ck(cs,cn,co,cr,cq){if(A(co)){cr=co;co=aM}if(cs=="GET"){var cp;if(cp=ck.data[cn]){cr(200,a5(cp.value));if(!cq){return}}if(cp=cm[cn]){cp.callbacks.push(cr)}else{cm[cn]={callbacks:[cr]};ck.delegate(cs,cn,co,function(ct,cu){if(ct==200){ck.data[cn]={value:cu}}var cv=cm[cn].callbacks;delete cm[cn];aB(cv,function(cx){try{(cx||h)(ct,a5(cu))}catch(cw){cl.$log.error(cw)}})})}}else{ck.data={};ck.delegate(cs,cn,co,cr)}}ck.data={};ck.delegate=cj;return ck},["$xhr.bulk"]);bN("$resource",function(cj){var ck=new bm(cj);return bd(ck,ck.route)},["$xhr.cache"]);bN("$cookies",function(ck){var cn=this,co={},cl={},cj;ck.addPollFn(function(){var cp=ck.cookies();if(cj!=cp){cj=cp;a5(cp,cl);a5(cp,co);cn.$eval()}})();this.$onEval(bH,cm);return co;function cm(){var cq,cr,cp;for(cq in cl){if(ba(co[cq])){ck.cookies(cq,cg)}}for(cq in co){if(co[cq]!==cl[cq]){ck.cookies(cq,co[cq]);cp=true}}if(cp){cp=!cp;cr=ck.cookies();for(cq in co){if(co[cq]!==cr[cq]){if(ba(cr[cq])){delete co[cq]}else{co[cq]=cr[cq]}cp=true}}if(cp){cn.$eval()}}}},["$browser"],bi);bN("$cookieStore",function(cj){return{get:function(ck){return K(cj[ck])},put:function(ck,cl){cj[ck]=bO(cl)},remove:function(ck){delete cj[ck]}}},["$cookies"],bi);T("ng:init",function(cj){return function(ck){this.$tryEval(cj,ck)}});T("ng:controller",function(cj){this.scope(true);return function(cl){var ck=bn(bq,cj,true)||bn(this,cj,true);if(!ck){throw"Can not find '"+cj+"' controller."}if(!A(ck)){throw"Reference '"+cj+"' is not a class."}this.$become(ck)}});T("ng:eval",function(cj){return function(ck){this.$onEval(cj,ck)}});T("ng:bind",function(cj){return function(cl){var ck=h,cm=h;this.$onEval(function(){var co,cr,cp,cq,cn=this.hasOwnProperty(a7)?this.$element:cg;this.$element=cl;cr=this.$tryEval(cj,function(cs){co=bO(cs)});this.$element=cn;if(ck===cr&&cm==co){return}cp=cr instanceof aE;cq=bh(cr);if(!cp&&!cq&&cf(cr)){cr=bO(cr)}if(cr!=ck||co!=cm){ck=cr;cm=co;bv(cl,a,co);if(co){cr=co}if(cp){cl.html(cr.html)}else{if(cq){cl.html("");cl.append(cr)}else{cl.text(cr===cg?"":cr)}}}},cl)}});var bb={};function ch(ck){var cj=bb[ck];if(!cj){var cl=[];aB(aH(ck),function(cn){var cm=b7(cn);cl.push(cm?function(cp){var co,cq=this.$tryEval(cm,function(cr){co=bO(cr)});bv(cp,a,co);return co?co:cq}:function(){return cn})});bb[ck]=cj=function(cp){var cr=[],cm=this,cn=this.hasOwnProperty(a7)?cm.$element:cg;cm.$element=cp;for(var co=0;co<cl.length;co++){var cq=cl[co].call(cm,cp);if(bh(cq)){cq=""}else{if(cf(cq)){cq=bO(cq,true)}}cr.push(cq)}cm.$element=cn;return cr.join("")}}return cj}T("ng:bind-template",function(cj){var ck=ch(cj);return function(cm){var cl;this.$onEval(function(){var cn=ck.call(this,cm);if(cn!=cl){cm.text(cn);cl=cn}},cm)}});var f={disabled:"disabled",readonly:"readOnly",checked:"checked"};T("ng:bind-attr",function(cj){return function(cm){var cl={};var ck=cm.parent().data("$update");this.$onEval(function(){var cn=this.$eval(cj);for(var co in cn){var cq=ch(cn[co]).call(this,cm),cp=f[ac(co)];if(cl[co]!==cq){cl[co]=cq;if(cp){if(cm[cp]=bR(cq)){cm.attr(cp,cq)}else{cm.removeAttr(co)}(cm.data("$validate")||h)()}else{cm.attr(co,cq)}this.$postEval(ck)}}},cm)}});x("@ng:non-bindable",h);x("@ng:repeat",function(cl,cj){cj.removeAttr("ng:repeat");cj.replaceWith(this.comment("ng:repeat: "+cl));var ck=this.compile(cj);return function(cm){var cq=cl.match(/^\s*(.+)\s+in\s+(.*)\s*$/),cn,ct,co,cs;if(!cq){throw"Expected ng:repeat in form of 'item in collection' but got '"+cl+"'."}cn=cq[1];ct=cq[2];cq=cn.match(/^([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\)$/);if(!cq){throw"'item' in 'item in collection' should be identifier or (key, value) but got '"+keyValue+"'."}co=cq[3]||cq[1];cs=cq[2];var cr=[],cp=this;this.$onEval(function(){var cw=0,cv=cr.length,cu,cA=cm,cz=this.$tryEval(ct,cm),cy=aN(cz);for(var cx in cz){if(!cy||cz.hasOwnProperty(cx)){if(cw<cv){cu=cr[cw];cu[co]=cz[cx];if(cs){cu[cs]=cx}}else{cu=ck(w(cj),br(cp));cu[co]=cz[cx];if(cs){cu[cs]=cx}cA.after(cu.$element);cu.$index=cw;cu.$element.attr("ng:repeat-index",cw);cu.$init();cr.push(cu)}cu.$eval();cA=cu.$element;cw++}}while(cr.length>cw){cr.pop().$element.remove()}},cm)}});T("ng:click",function(ck,cj){return function(cm){var cl=this;cm.bind("click",function(cn){cl.$tryEval(ck,cm);cl.$root.$eval();cn.stopPropagation()})}});T("ng:watch",function(ck,cj){return function(cm){var cl=this;M(ck).watch()({addListener:function(cn,co){cl.$watch(cn,function(){return co(cl)},cm)}})}});function bc(cj){return function(cm,ck){var cl=ck[0].className+" ";return function(cn){this.$onEval(function(){if(cj(this.$index)){var co=this.$eval(cm);if(aN(co)){co=co.join(" ")}cn[0].className=ak(cl+co)}},cn)}}}T("ng:class",bc(function(){return true}));T("ng:class-odd",bc(function(cj){return cj%2===0}));T("ng:class-even",bc(function(cj){return cj%2===1}));T("ng:show",function(ck,cj){return function(cl){this.$onEval(function(){cl.css(av,bR(this.$eval(ck))?"":b)},cl)}});T("ng:hide",function(ck,cj){return function(cl){this.$onEval(function(){cl.css(av,bR(this.$eval(ck))?b:"")},cl)}});T("ng:style",function(ck,cj){return function(cl){var cm=bE(cl);this.$onEval(function(){var co=this.$eval(ck)||{},cn,cp={};for(cn in co){if(cm[cn]===cg){cm[cn]=""}cp[cn]=co[cn]}for(cn in cm){cp[cn]=cp[cn]||cm[cn]}cl.css(cp)},cl)}});function aH(ck){var cl=[];var cm=0;var cj;while((cj=ck.indexOf("{{",cm))>-1){if(cm<cj){cl.push(ck.substr(cm,cj-cm))}cm=cj;cj=ck.indexOf("}}",cj);cj=cj<0?ck.length:cj+2;cl.push(ck.substr(cm,cj-cm));cm=cj}if(cm!=ck.length){cl.push(ck.substr(cm,ck.length-cm))}return cl.length===0?[ck]:cl}function b7(cj){var ck=cj.replace(/\n/gm," ").match(/^\{\{(.*)\}\}$/);return ck?ck[1]:aM}function b6(cj){return cj.length>1||b7(cj[0])!==aM}W("{{}}",function(cn,cm,cj){var cp=aH(cn),ck=this;if(b6(cp)){if(by(cj[0])){cj.attr("ng:bind-template",cn)}else{var cl=cm,co;aB(aH(cn),function(cs){var cr=b7(cs);if(cr){co=ck.element("span");co.attr("ng:bind",cr)}else{co=ck.text(cs)}if(ai&&cs.charAt(0)==" "){co=bM("<span>&nbsp;</span>");var cq=co.html();co.text(cs.substr(1));co.html(cq+co.html())}cl.after(co);cl=co});cm.remove()}}});W("OPTION",function(cm,cl,ck){if(aj(ck)=="OPTION"){var cj=o.createElement("select");cj.insertBefore(ck[0].cloneNode(true),aM);if(!cj.innerHTML.match(/<option(\s.*\s|\s)value\s*=\s*.*>.*<\/\s*option\s*>/gi)){ck.attr("value",cm)}}});var bj="ng:bind-attr";var aq={"ng:src":"src","ng:href":"href"};p("{{}}",function(cm,ck,cl){if(T(ck)||T("@"+ck)){return}if(ai&&ck=="src"){cm=decodeURI(cm)}var cn=aH(cm),cj;if(b6(cn)){cl.removeAttr(ck);cj=K(cl.attr(bj)||"{}");cj[aq[ck]||ck]=cm;cl.attr(bj,bO(cj))}});function bl(ck,cj){var cl=cj.attr("name");if(!cl){throw"Required field 'name' not found."}return{get:function(){return ck.$eval(cl)},set:function(cm){if(cm!==cg){return ck.$tryEval(cl+"="+bO(cm),cj)}}}}function aX(cm,cl){var cj=bl(cm,cl),cn=cl.attr("ng:format")||l,ck=j(cn);if(!ck){throw"Formatter named '"+cn+"' not found."}return{get:function(){return ck.format(cj.get())},set:function(co){return cj.set(ck.parse(co))}}}function d(cj){return M(cj).validator()()}function bw(cu,cn){var cl=cn.attr("ng:validate")||l,ck=d(cl),cj=cn.attr("ng:required"),cv=cn.attr("ng:format")||l,ct=j(cv),cs,cm,cp,co,cr=cu.$invalidWidgets||{markValid:h,markInvalid:h};if(!ck){throw"Validator named '"+cl+"' not found."}if(!ct){throw"Formatter named '"+cv+"' not found."}cs=ct.format;cm=ct.parse;if(cj){cu.$watch(cj,function(cw){co=cw;cq()})}else{co=cj===""}cn.data("$validate",cq);return{get:function(){if(cp){bv(cn,i,aM)}try{var cw=cm(cn.val());cq();return cw}catch(cx){cp=cx;bv(cn,i,cx)}},set:function(cx){var cw=cn.val(),cy=cs(cx);if(cw!=cy){cn.val(cy||"")}cq()}};function cq(){var cy=ak(cn.val());if(cn[0].disabled||cn[0].readOnly){bv(cn,i,aM);cr.markValid(cn)}else{var cx,cw=bz(cu,{$element:cn});cx=co&&!cy?"Required":(cy?ck(cw,cy):aM);bv(cn,i,cx);cp=cx;if(cx){cr.markInvalid(cn)}else{cr.markValid(cn)}}}}function at(ck,cj){var cm=cj[0],cl=cm.value;return{get:function(){return !!cm.checked},set:function(cn){cm.checked=bR(cn)}}}function cd(ck,cj){var cl=cj[0];return{get:function(){return cl.checked?cl.value:aM},set:function(cm){cl.checked=cm==cl.value}}}function bZ(cl,ck){var cj=ck[0].options;return{get:function(){var cm=[];aB(cj,function(cn){if(cn.selected){cm.push(cn.value)}});return cm},set:function(cm){var cn={};aB(cm,function(co){cn[co]=true});aB(cj,function(co){co.selected=cn[co.value]})}}}function I(){return{get:h,set:h}}var aV=bu("keyup change",bl,bw,g()),bx=bu("click",I,I,h),b9={text:aV,textarea:aV,hidden:aV,password:aV,button:bx,submit:bx,reset:bx,image:bx,checkbox:bu("click",aX,at,g(false)),radio:bu("click",aX,cd,bT),"select-one":bu("change",aX,bw,g(aM)),"select-multiple":bu("change",aX,bZ,g([]))};function g(cj){return function(cl,ck){var cm=ck.get();if(!cm&&bW(cj)){cm=a5(cj)}if(ba(cl.get())&&bW(cm)){cl.set(cm)}}}function bT(cm,cj,cn){var cl=cm.get(),co=cj.get(),ck=cn[0];ck.checked=false;ck.name=this.$id+"@"+ck.name;if(ba(cl)){cm.set(cl=aM)}if(cl==aM&&co!==aM){cm.set(co)}cj.set(cl)}function bu(cl,ck,cj,cm){return function(cq){var cr=this,cp=ck(cr,cq),cn=cj(cr,cq),cs=cq.attr("ng:change")||"",co;cm.call(cr,cp,cn,cq);this.$eval(cq.attr("ng:init")||"");if(cs||ck!==I){cq.bind(cl,function(cu){cp.set(cn.get());co=cp.get();cr.$tryEval(cs,cq);cr.$root.$eval();if(cm==h){cu.preventDefault()}})}function ct(){cn.set(co=cp.get())}ct();cq.data("$update",ct);cr.$watch(cp.get,function(cu){if(co!==cu){cn.set(co=cu)}})}}function R(cj){this.directives(true);return b9[ac(cj[0].type)]||h}x("input",R);x("textarea",R);x("button",R);x("select",function(cj){this.descend(true);return R.call(this,cj)});x("option",function(){this.descend(true);this.directives(true);return function(cj){this.$postEval(cj.parent().data("$update"))}});x("ng:include",function(ck){var cl=this,cj=ck.attr("src"),cm=ck.attr("scope")||"";if(ck[0]["ng:compiled"]){this.descend(true);this.directives(true)}else{ck[0]["ng:compiled"]=true;return bA(function(cr,cp){var cq=this,cn;var cs=0;function co(){cs++}this.$watch(cj,co);this.$watch(cm,co);cq.$onEval(function(){if(cn){cn.$eval()}});this.$watch(function(){return cs},function(){var cu=this.$eval(cj),ct=this.$eval(cm);if(cu){cr("GET",cu,function(cw,cv){cp.html(cv);cn=ct||br(cq);cl.compile(cp)(cp,cn);cn.$init()})}else{cn=null;cp.html("")}})},{$inject:["$xhr.cache"]})}});var k=x("ng:switch",function(cn){var co=this,cm=cn.attr("on"),cq=(cn.attr("using")||"equals"),cj=cq.split(":"),ck=k[cj.shift()],cl=cn.attr("change")||"",cp=[];if(!ck){throw"Using expression '"+cq+"' unknown."}aF(cn,function(cs){var cr=cs.attr("ng:switch-when");if(cr){cp.push({when:function(cu,cv){var ct=[cv,cr];aB(cj,function(cw){ct.push(cw)});return ck.apply(cu,ct)},change:cl,element:cs,template:co.compile(cs)})}});aB(cp,function(cr){cr.element.remove()});cn.html("");return function(cs){var ct=this,cr;this.$watch(cm,function(cu){cs.html("");cr=br(ct);aB(cp,function(cv){if(cv.when(cr,cu)){var cw=w(cv.element);cs.append(cw);cr.$tryEval(cv.change,cs);cv.template(cw,cr);cr.$init()}})});ct.$onEval(function(){if(cr){cr.$eval()}})}},{equals:function(ck,cj){return ck==cj},route:aT});an.widget("a",function(){this.descend(true);this.directives(true);return function(cj){if(cj.attr("href")===""){cj.bind("click",function(ck){ck.preventDefault()})}}});var bL;a2("$browser",function(cj){if(!bL){bL=new ay(bq.location,bM(bq.document),bM(bq.document.getElementsByTagName("head")[0]),F,cj);bL.startPoller(50,function(ck,cl){setTimeout(ck,cl)});bL.bind()}return bL},{inject:["$log"]});bA(an,{element:bM,compile:aJ,scope:br,copy:a5,extend:bA,equals:m,foreach:aB,injector:bt,noop:h,bind:bd,toJson:bO,fromJson:K,identity:ap,isUndefined:ba,isDefined:bW,isString:bK,isFunction:A,isObject:cf,isNumber:aD,isArray:aN});an.scenario=an.scenario||{};an.scenario.ui=an.scenario.ui||{};an.scenario.dsl=an.scenario.dsl||function(cj,ck){an.scenario.dsl[cj]=function(){function cl(cr,cp){var cn=cr.apply(this,cp);if(an.isFunction(cn)||cn instanceof an.scenario.Future){return cn}var co=this;var cq=an.extend({},cn);an.foreach(cq,function(ct,cs){if(an.isFunction(ct)){cq[cs]=function(){return cl.call(co,ct,arguments)}}else{cq[cs]=ct}});return cq}var cm=ck.apply(this,arguments);return function(){return cl.call(this,cm,arguments)}}};an.scenario.matcher=an.scenario.matcher||function(cj,ck){an.scenario.matcher[cj]=function(cm){var cn="expect "+this.future.name+" ";if(this.inverse){cn+="not "}var cl=this;this.addFuture(cn+cj+" "+an.toJson(cm),function(co){var cp;cl.actual=cl.future.value;if((cl.inverse&&ck.call(cl,cm))||(!cl.inverse&&!ck.call(cl,cm))){cp="expected "+an.toJson(cm)+" but was "+an.toJson(cl.actual)}co(cp)})}};function Q(cn,cm,ck){var cl=0;function cj(cp,co){if(co&&co>cl){cl=co}if(cp||cl>=cn.length){ck(cp)}else{try{cm(cn[cl++],cj)}catch(cq){ck(cq)}}}cj()}function P(ck,cl){cl=cl||5;var cm=ck.toString();if(ck.stack){var cj=ck.stack.split("\n");if(cj[0].indexOf(cm)===-1){cl++;cj.unshift(ck.message)}cm=cj.slice(0,cl).join("\n")}return cm}function u(ck){var cj=new Error();return function(){var cl=(cj.stack||"").split("\n")[ck];if(cl){if(cl.indexOf("@")!==-1){cl=cl.substring(cl.indexOf("@")+1)}else{cl=cl.substring(cl.indexOf("(")+1).replace(")","")}}return cl||""}}function c(cj,ck){if(cj&&!cj.nodeName){cj=cj[0]}if(!cj){return}if(!ck){ck={text:"change",textarea:"change",hidden:"change",password:"change",button:"click",submit:"click",reset:"click",image:"click",checkbox:"click",radio:"click","select-one":"change","select-multiple":"change"}[cj.type]||"click"}if(ac(aj(cj))=="option"){cj.parentNode.value=cj.value;cj=cj.parentNode;ck="change"}if(ai){cj.fireEvent("on"+ck)}else{var cl=o.createEvent("MouseEvents");cl.initMouseEvent(ck,true,true,bq,0,0,0,0,0,false,false,false,false,0,cj);cj.dispatchEvent(cl)}}bB.fn.trigger=function(cj){return this.each(function(ck,cl){c(cl,cj)})};an.scenario.Application=function(cj){this.context=cj;cj.append('<h2>Current URL: <a href="about:blank">None</a></h2>')};an.scenario.Application.prototype.getFrame=function(){return this.context.find("> iframe")};an.scenario.Application.prototype.getWindow=function(){var cj=this.getFrame().attr("contentWindow");if(!cj){throw"No window available because frame not loaded."}return cj};an.scenario.Application.prototype.navigateTo=function(ck,cj){this.getFrame().remove();this.context.append('<iframe src=""></iframe>');this.context.find("> h2 a").attr("href",ck).text(ck);this.getFrame().attr("src",ck).load(cj)};an.scenario.Application.prototype.executeAction=function(cj){var ck=this.getWindow();return cj.call(this,ck,bB(ck.document))};an.scenario.Describe=function(ck,cm){this.beforeEachFns=[];this.afterEachFns=[];this.its=[];this.children=[];this.name=ck;this.parent=cm;this.id=an.scenario.Describe.id++;var cj=this.beforeEachFns;this.setupBefore=function(){if(cm){cm.setupBefore.call(this)}an.foreach(cj,function(cn){cn.call(this)},this)};var cl=this.afterEachFns;this.setupAfter=function(){an.foreach(cl,function(cn){cn.call(this)},this);if(cm){cm.setupAfter.call(this)}}};an.scenario.Describe.id=0;an.scenario.Describe.prototype.beforeEach=function(cj){this.beforeEachFns.push(cj)};an.scenario.Describe.prototype.afterEach=function(cj){this.afterEachFns.push(cj)};an.scenario.Describe.prototype.describe=function(ck,cj){var cl=new an.scenario.Describe(ck,this);this.children.push(cl);cj.call(cl)};an.scenario.Describe.prototype.xdescribe=an.noop;an.scenario.Describe.prototype.it=function(cl,cj){var ck=this;this.its.push({definition:this,name:cl,before:ck.setupBefore,body:cj,after:ck.setupAfter})};an.scenario.Describe.prototype.xit=an.noop;an.scenario.Describe.prototype.getSpecs=function(){var cj=arguments[0]||[];an.foreach(this.children,function(ck){ck.getSpecs(cj)});an.foreach(this.its,function(ck){cj.push(ck)});return cj};an.scenario.Future=function(ck,cl,cj){this.name=ck;this.behavior=cl;this.fulfilled=false;this.value=undefined;this.parser=an.identity;this.line=cj||function(){return""}};an.scenario.Future.prototype.execute=function(ck){var cj=this;this.behavior(function(cm,cl){cj.fulfilled=true;if(cl){try{cl=cj.parser(cl)}catch(cn){cm=cn}}cj.value=cm||cl;ck(cm,cl)})};an.scenario.Future.prototype.parsedWith=function(cj){this.parser=cj;return this};an.scenario.Future.prototype.fromJson=function(){return this.parsedWith(an.fromJson)};an.scenario.Future.prototype.toJson=function(){return this.parsedWith(an.toJson)};an.scenario.ui.Html=function(cj){this.context=cj;cj.append('<div id="header"> <h1><span class="angular">&lt;angular/&gt;</span>: Scenario Test Runner</h1> <ul id="status-legend" class="status-display"> <li class="status-error">0 Errors</li> <li class="status-failure">0 Failures</li> <li class="status-success">0 Passed</li> </ul></div><div id="specs"> <div class="test-children"></div></div>')};an.scenario.ui.Html.SEVERITY=["pending","success","failure","error"];an.scenario.ui.Html.prototype.addSpec=function(ck){var cj=this;var cl=this.findContext(ck.definition);cl.find("> .tests").append('<li class="status-pending test-it"></li>');cl=cl.find("> .tests li:last");return new an.scenario.ui.Html.Spec(cl,ck.name,function(cm){cm=cj.context.find("#status-legend .status-"+cm);var co=cm.text().split(" ");var cn=(co[0]*1)+1;cm.text(cn+" "+co[1])})};an.scenario.ui.Html.prototype.findContext=function(cl){var cj=this;var cn=[];var ck=this.context.find("#specs");var cm=cl;while(cm&&cm.name){cn.unshift(cm);cm=cm.parent}an.foreach(cn,function(co){var cp="describe-"+co.id;if(!cj.context.find("#"+cp).length){ck.find("> .test-children").append('<div class="test-describe" id="'+cp+'"> <h2></h2> <div class="test-children"></div> <ul class="tests"></ul></div>');cj.context.find("#"+cp).find("> h2").text("describe: "+co.name)}ck=cj.context.find("#"+cp)});return this.context.find("#describe-"+cl.id)};an.scenario.ui.Html.Spec=function(ck,cj,cl){this.status="pending";this.context=ck;this.startTime=new Date().getTime();this.doneFn=cl;ck.append('<div class="test-info"> <p class="test-title"> <span class="timer-result"></span> <span class="test-name"></span> </p></div><div class="scrollpane"> <ol class="test-actions"> </ol></div>');ck.find("> .test-info").click(function(){var cn=ck.find("> .scrollpane");var co=cn.find("> .test-actions");var cm=ck.find("> .test-info .test-name");if(co.find(":visible").length){co.hide();cm.removeClass("open").addClass("closed")}else{co.show();cn.attr("scrollTop",cn.attr("scrollHeight"));cm.removeClass("closed").addClass("open")}});ck.find("> .test-info .test-name").text("it "+cj)};an.scenario.ui.Html.Spec.prototype.addStep=function(cl,cj){this.context.find("> .scrollpane .test-actions").append('<li class="status-pending"></li>');var cm=this.context.find("> .scrollpane .test-actions li:last");var ck=this;return new an.scenario.ui.Html.Step(cm,cl,cj,function(cn){if(cc(an.scenario.ui.Html.SEVERITY,cn)>cc(an.scenario.ui.Html.SEVERITY,ck.status)){ck.status=cn}var co=ck.context.find("> .scrollpane");co.attr("scrollTop",co.attr("scrollHeight"))})};an.scenario.ui.Html.Spec.prototype.complete=function(){this.context.removeClass("status-pending");var cj=new Date().getTime();this.context.find("> .test-info .timer-result").text((cj-this.startTime)+"ms");if(this.status==="success"){this.context.find("> .test-info .test-name").addClass("closed");this.context.find("> .scrollpane .test-actions").hide()}};an.scenario.ui.Html.Spec.prototype.finish=function(){this.complete();this.context.addClass("status-"+this.status);this.doneFn(this.status)};an.scenario.ui.Html.Spec.prototype.error=function(cj){this.status="error";this.context.append("<pre></pre>");this.context.find("> pre").text(P(cj));this.finish()};an.scenario.ui.Html.Step=function(cm,cl,cj,cn){this.context=cm;this.name=cl;this.location=cj;this.startTime=new Date().getTime();this.doneFn=cn;cm.append('<div class="timer-result"></div><div class="test-title"></div>');cm.find("> .test-title").text(cl);var ck=cm.parents(".scrollpane");ck.attr("scrollTop",ck.attr("scrollHeight"))};an.scenario.ui.Html.Step.prototype.complete=function(ck){this.context.removeClass("status-pending");var cj=new Date().getTime();this.context.find(".timer-result").text((cj-this.startTime)+"ms");if(ck){if(!this.context.find(".test-title pre").length){this.context.find(".test-title").append("<pre></pre>")}var cl=bB.trim(this.location()+"\n\n"+P(ck));this.context.find(".test-title pre").text(cl)}};an.scenario.ui.Html.Step.prototype.finish=function(cj){this.complete(cj);if(cj){this.context.addClass("status-failure");this.doneFn("failure")}else{this.context.addClass("status-success");this.doneFn("success")}};an.scenario.ui.Html.Step.prototype.error=function(cj){this.complete(cj);this.context.addClass("status-error");this.doneFn("error")};an.scenario.Describe=function(ck,cm){this.beforeEachFns=[];this.afterEachFns=[];this.its=[];this.children=[];this.name=ck;this.parent=cm;this.id=an.scenario.Describe.id++;var cj=this.beforeEachFns;this.setupBefore=function(){if(cm){cm.setupBefore.call(this)}an.foreach(cj,function(cn){cn.call(this)},this)};var cl=this.afterEachFns;this.setupAfter=function(){an.foreach(cl,function(cn){cn.call(this)},this);if(cm){cm.setupAfter.call(this)}}};an.scenario.Describe.id=0;an.scenario.Describe.prototype.beforeEach=function(cj){this.beforeEachFns.push(cj)};an.scenario.Describe.prototype.afterEach=function(cj){this.afterEachFns.push(cj)};an.scenario.Describe.prototype.describe=function(ck,cj){var cl=new an.scenario.Describe(ck,this);this.children.push(cl);cj.call(cl)};an.scenario.Describe.prototype.xdescribe=an.noop;an.scenario.Describe.prototype.it=function(cl,cj){var ck=this;this.its.push({definition:this,name:cl,before:ck.setupBefore,body:cj,after:ck.setupAfter})};an.scenario.Describe.prototype.xit=an.noop;an.scenario.Describe.prototype.getSpecs=function(){var cj=arguments[0]||[];an.foreach(this.children,function(ck){ck.getSpecs(cj)});an.foreach(this.its,function(ck){cj.push(ck)});return cj};an.scenario.Runner=function(cj){this.$window=cj;this.rootDescribe=new an.scenario.Describe();this.currentDescribe=this.rootDescribe;this.api={it:this.it,xit:an.noop,describe:this.describe,xdescribe:an.noop,beforeEach:this.beforeEach,afterEach:this.afterEach};an.foreach(this.api,an.bind(this,function(cl,ck){this.$window[ck]=an.bind(this,cl)}))};an.scenario.Runner.prototype.describe=function(cl,cj){var ck=this;this.currentDescribe.describe(cl,function(){var cm=ck.currentDescribe;ck.currentDescribe=this;try{cj.call(this)}finally{ck.currentDescribe=cm}})};an.scenario.Runner.prototype.it=function(ck,cj){this.currentDescribe.it(ck,cj)};an.scenario.Runner.prototype.beforeEach=function(cj){this.currentDescribe.beforeEach(cj)};an.scenario.Runner.prototype.afterEach=function(cj){this.currentDescribe.afterEach(cj)};an.scenario.Runner.prototype.run=function(cm,ck,cl,co){var cn=an.scope({},an.service);var cj=this;var cp=this.rootDescribe.getSpecs();cn.application=ck;cn.ui=cm;cn.setTimeout=function(){return cj.$window.setTimeout.apply(cj.$window,arguments)};Q(cp,function(cq,ct){var cr={};var cs=an.scope(cn);cs.$become(cl);an.foreach(an.scenario.dsl,function(cv,cu){cr[cu]=cv.call(cn)});an.foreach(an.scenario.dsl,function(cv,cu){cj.$window[cu]=function(){var cw=u(3);var cx=an.scope(cs);cx.dsl={};an.foreach(cr,function(cz,cy){cx.dsl[cy]=function(){return cr[cy].apply(cx,arguments)}});cx.addFuture=function(){Array.prototype.push.call(arguments,cw);return cl.prototype.addFuture.apply(cx,arguments)};cx.addFutureAction=function(){Array.prototype.push.call(arguments,cw);return cl.prototype.addFutureAction.apply(cx,arguments)};return cx.dsl[cu].apply(cx,arguments)}});cs.run(cm,cq,ct)},co||an.noop)};an.scenario.SpecRunner=function(){this.futures=[];this.afterIndex=0};an.scenario.SpecRunner.prototype.run=function(cm,cl,co){var ck=this;var cj=cm.addSpec(cl);try{cl.before.call(this);cl.body.call(this);this.afterIndex=this.futures.length;cl.after.call(this)}catch(cn){cj.error(cn);co();return}var cp=function(cr,cq){if(ck.error){return cq()}ck.error=true;cq(null,ck.afterIndex)};var cl=this;Q(this.futures,function(cq,cr){var cs=cj.addStep(cq.name,cq.line);try{cq.execute(function(cu){cs.finish(cu);if(cu){return cp(cu,cr)}cl.$window.setTimeout(function(){cr()},0)})}catch(ct){cs.error(ct);cp(ct,cr)}},function(cq){if(cq){cj.error(cq)}else{cj.finish()}co()})};an.scenario.SpecRunner.prototype.addFuture=function(cl,cm,ck){var cj=new an.scenario.Future(cl,an.bind(this,cm),ck);this.futures.push(cj);return cj};an.scenario.SpecRunner.prototype.addFutureAction=function(cl,cm,cj){var ck=this;return this.addFuture(cl,function(cn){this.application.executeAction(function(cq,cp){cp.elements=function(cs){var ct=Array.prototype.slice.call(arguments,1);if(ck.selector){cs=ck.selector+" "+(cs||"")}an.foreach(ct,function(cv,cu){cs=cs.replace("$"+(cu+1),cv)});var cr=cp.find(cs);if(!cr.length){throw {type:"selector",message:"Selector "+cs+" did not match any elements."}}return cr};try{cm.call(ck,cq,cp,cn)}catch(co){if(co.type&&co.type==="selector"){cn(co.message)}else{throw co}}})},cj)};an.scenario.dsl("wait",function(){return function(){return this.addFuture("waiting for you to call resume() in the console",function(cj){this.$window.resume=function(){cj()}})}});an.scenario.dsl("pause",function(){return function(cj){return this.addFuture("pause for "+cj+" seconds",function(ck){this.setTimeout(function(){ck(null,cj*1000)},cj*1000)})}});an.scenario.dsl("expect",function(){var cj=an.extend({},an.scenario.matcher);cj.not=function(){this.inverse=true;return cj};return function(ck){this.future=ck;return cj}});an.scenario.dsl("navigateTo",function(){return function(ck,cl){var cj=this.application;return this.addFuture("navigate to "+ck,function(cm){if(cl){ck=cl.call(this,ck)}cj.navigateTo(ck,function(){cj.executeAction(function(co){if(co.angular){var cn=co.angular.service.$browser();cn.poll();cn.notifyWhenNoOutstandingRequests(function(){cm(null,ck)})}else{cm(null,ck)}})})})}});an.scenario.dsl("using",function(){return function(cj){this.selector=(this.selector||"")+" "+cj;return this.dsl}});an.scenario.dsl("binding",function(){return function(cj){return this.addFutureAction("select binding '"+cj+"'",function(co,cn,ck){var cl;try{cl=cn.elements('[ng\\:bind-template*="{{$1}}"]',cj)}catch(cm){if(cm.type!=="selector"){throw cm}cl=cn.elements('[ng\\:bind="$1"]',cj)}ck(null,cl.text())})}});an.scenario.dsl("input",function(){var cj={};cj.enter=function(ck){return this.addFutureAction("input '"+this.name+"' enter '"+ck+"'",function(co,cn,cl){var cm=cn.elements('input[name="$1"]',this.name);cm.val(ck);cm.trigger("change");cl()})};cj.check=function(){return this.addFutureAction("checkbox '"+this.name+"' toggle",function(cn,cm,ck){var cl=cm.elements('input:checkbox[name="$1"]',this.name);cl.trigger("click");ck()})};cj.select=function(ck){return this.addFutureAction("radio button '"+this.name+"' toggle '"+ck+"'",function(co,cn,cl){var cm=cn.elements('input:radio[name$="@$1"][value="$2"]',this.name,ck);cm.trigger("click");cl()})};return function(ck){this.name=ck;return cj}});an.scenario.dsl("repeater",function(){var cj={};cj.count=function(){return this.addFutureAction("repeater "+this.selector+" count",function(cm,cl,ck){ck(null,cl.elements().size())})};cj.column=function(ck){return this.addFutureAction("repeater "+this.selector+" column "+ck,function(co,cn,cl){var cm=[];cn.elements().each(function(){bB(this).find(":visible").each(function(){var cp=bB(this);if(cp.attr("ng:bind")===ck){cm.push(cp.text())}})});cl(null,cm)})};cj.row=function(ck){return this.addFutureAction("repeater "+this.selector+" row "+ck,function(cp,co,cl){var cm=[];var cn=co.elements().slice(ck,ck+1);if(!cn.length){return cl("row "+ck+" out of bounds")}bB(cn[0]).find(":visible").each(function(){var cq=bB(this);if(cq.attr("ng:bind")){cm.push(cq.text())}});cl(null,cm)})};return function(ck){this.dsl.using(ck);return cj}});an.scenario.dsl("select",function(){var cj={};cj.option=function(ck){return this.addFutureAction("select "+this.name+" option "+ck,function(co,cn,cm){var cl=cn.elements('select[name="$1"]',this.name);cl.val(ck);cl.trigger("change");cm()})};cj.options=function(){var ck=arguments;return this.addFutureAction("select "+this.name+" options "+ck,function(co,cn,cm){var cl=cn.elements('select[multiple][name="$1"]',this.name);cl.val(ck);cl.trigger("change");cm()})};return function(ck){this.name=ck;return cj}});an.scenario.dsl("element",function(){var cj={};cj.click=function(){return this.addFutureAction("element "+this.selector+" click",function(cm,cl,ck){cl.elements().trigger("click");ck()})};cj.attr=function(ck,cm){var cl="element "+this.selector+" get attribute "+ck;if(cm){cl="element "+this.selector+" set attribute "+ck+" to "+cm}return this.addFutureAction(cl,function(cp,co,cn){cn(null,co.elements().attr(ck,cm))})};cj.val=function(cl){var ck="element "+this.selector+" value";if(cl){ck="element "+this.selector+" set value to "+cl}return this.addFutureAction(ck,function(co,cn,cm){cm(null,cn.elements().val(cl))})};cj.query=function(ck){return this.addFutureAction("element "+this.selector+" custom query",function(cn,cm,cl){ck.call(this,cm.elements(),cl)})};return function(ck){this.dsl.using(ck);return cj}});an.scenario.matcher("toEqual",function(cj){return an.equals(this.actual,cj)});an.scenario.matcher("toBeDefined",function(){return an.isDefined(this.actual)});an.scenario.matcher("toBeTruthy",function(){return this.actual});an.scenario.matcher("toBeFalsy",function(){return !this.actual});an.scenario.matcher("toMatch",function(cj){return new RegExp(cj).test(this.actual)});an.scenario.matcher("toBeNull",function(){return this.actual===null});an.scenario.matcher("toContain",function(cj){return r(this.actual,cj)});an.scenario.matcher("toBeLessThan",function(cj){return this.actual<cj});an.scenario.matcher("toBeGreaterThan",function(cj){return this.actual>cj});var ab=new an.scenario.Runner(bq);bq.onload=function(){try{if(aS){aS()}}catch(cm){}bB(o.body).append('<div id="runner"></div><div id="frame"></div>');var cn=bB("#frame");var ck=bB("#runner");var cj=new an.scenario.Application(cn);var cl=new an.scenario.ui.Html(ck);ab.run(cl,cj,an.scenario.SpecRunner,function(co){cn.remove();if(co){if(bq.console){console.log(co.stack||co)}else{alert(co)}}})}})(window,document,window.onload);document.write('<style type="text/css">@charset "UTF-8";\n\n.ng-format-negative {\n color: red;\n}\n\n.ng-exception {\n border: 2px solid #FF0000;\n font-family: "Courier New", Courier, monospace;\n font-size: smaller;\n}\n\n.ng-validation-error {\n border: 2px solid #FF0000;\n}\n\n\n/*****************\n * TIP\n *****************/\n#ng-callout {\n margin: 0;\n padding: 0;\n border: 0;\n outline: 0;\n font-size: 13px;\n font-weight: normal;\n font-family: Verdana, Arial, Helvetica, sans-serif;\n vertical-align: baseline;\n background: transparent;\n text-decoration: none;\n}\n\n#ng-callout .ng-arrow-left{\n background-image: url("data:image/gif;base64,R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMrSLoc/AG8FeUUIN+sGebWAnbKSJodqqlsOxJtqYooU9vvk+vcJIcTkg+QAAA7");\n background-repeat: no-repeat;\n background-position: left top;\n position: absolute;\n z-index:101;\n left:-12px;\n height:23px;\n width:10px;\n top:-3px;\n}\n\n#ng-callout .ng-arrow-right{\n background-image: url("data:image/gif;base64,R0lGODlhCwAXAKIAAMzMzO/v7/f39////////wAAAAAAAAAAACH5BAUUAAQALAAAAAALABcAAAMrCLTcoM29yN6k9socs91e5X3EyJloipYrO4ohTMqA0Fn2XVNswJe+H+SXAAA7");\n background-repeat: no-repeat;\n background-position: left top;\n position: absolute;\n z-index:101;\n height:23px;\n width:11px;\n top:-2px;\n}\n\n#ng-callout {\n position: absolute;\n z-index:100;\n border: 2px solid #CCCCCC;\n background-color: #fff;\n}\n\n#ng-callout .ng-content{\n padding:10px 10px 10px 10px;\n color:#333333;\n}\n\n#ng-callout .ng-title{\n background-color: #CCCCCC;\n text-align: left;\n padding-left: 8px;\n padding-bottom: 5px;\n padding-top: 2px;\n font-weight:bold;\n}\n\n\n/*****************\n * indicators\n *****************/\n.ng-input-indicator-wait {\n background-image: url("data:image/png;base64,R0lGODlhEAAQAPQAAP///wAAAPDw8IqKiuDg4EZGRnp6egAAAFhYWCQkJKysrL6+vhQUFJycnAQEBDY2NmhoaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAAFdyAgAgIJIeWoAkRCCMdBkKtIHIngyMKsErPBYbADpkSCwhDmQCBethRB6Vj4kFCkQPG4IlWDgrNRIwnO4UKBXDufzQvDMaoSDBgFb886MiQadgNABAokfCwzBA8LCg0Egl8jAggGAA1kBIA1BAYzlyILczULC2UhACH5BAkKAAAALAAAAAAQABAAAAV2ICACAmlAZTmOREEIyUEQjLKKxPHADhEvqxlgcGgkGI1DYSVAIAWMx+lwSKkICJ0QsHi9RgKBwnVTiRQQgwF4I4UFDQQEwi6/3YSGWRRmjhEETAJfIgMFCnAKM0KDV4EEEAQLiF18TAYNXDaSe3x6mjidN1s3IQAh+QQJCgAAACwAAAAAEAAQAAAFeCAgAgLZDGU5jgRECEUiCI+yioSDwDJyLKsXoHFQxBSHAoAAFBhqtMJg8DgQBgfrEsJAEAg4YhZIEiwgKtHiMBgtpg3wbUZXGO7kOb1MUKRFMysCChAoggJCIg0GC2aNe4gqQldfL4l/Ag1AXySJgn5LcoE3QXI3IQAh+QQJCgAAACwAAAAAEAAQAAAFdiAgAgLZNGU5joQhCEjxIssqEo8bC9BRjy9Ag7GILQ4QEoE0gBAEBcOpcBA0DoxSK/e8LRIHn+i1cK0IyKdg0VAoljYIg+GgnRrwVS/8IAkICyosBIQpBAMoKy9dImxPhS+GKkFrkX+TigtLlIyKXUF+NjagNiEAIfkECQoAAAAsAAAAABAAEAAABWwgIAICaRhlOY4EIgjH8R7LKhKHGwsMvb4AAy3WODBIBBKCsYA9TjuhDNDKEVSERezQEL0WrhXucRUQGuik7bFlngzqVW9LMl9XWvLdjFaJtDFqZ1cEZUB0dUgvL3dgP4WJZn4jkomWNpSTIyEAIfkECQoAAAAsAAAAABAAEAAABX4gIAICuSxlOY6CIgiD8RrEKgqGOwxwUrMlAoSwIzAGpJpgoSDAGifDY5kopBYDlEpAQBwevxfBtRIUGi8xwWkDNBCIwmC9Vq0aiQQDQuK+VgQPDXV9hCJjBwcFYU5pLwwHXQcMKSmNLQcIAExlbH8JBwttaX0ABAcNbWVbKyEAIfkECQoAAAAsAAAAABAAEAAABXkgIAICSRBlOY7CIghN8zbEKsKoIjdFzZaEgUBHKChMJtRwcWpAWoWnifm6ESAMhO8lQK0EEAV3rFopIBCEcGwDKAqPh4HUrY4ICHH1dSoTFgcHUiZjBhAJB2AHDykpKAwHAwdzf19KkASIPl9cDgcnDkdtNwiMJCshACH5BAkKAAAALAAAAAAQABAAAAV3ICACAkkQZTmOAiosiyAoxCq+KPxCNVsSMRgBsiClWrLTSWFoIQZHl6pleBh6suxKMIhlvzbAwkBWfFWrBQTxNLq2RG2yhSUkDs2b63AYDAoJXAcFRwADeAkJDX0AQCsEfAQMDAIPBz0rCgcxky0JRWE1AmwpKyEAIfkECQoAAAAsAAAAABAAEAAABXkgIAICKZzkqJ4nQZxLqZKv4NqNLKK2/Q4Ek4lFXChsg5ypJjs1II3gEDUSRInEGYAw6B6zM4JhrDAtEosVkLUtHA7RHaHAGJQEjsODcEg0FBAFVgkQJQ1pAwcDDw8KcFtSInwJAowCCA6RIwqZAgkPNgVpWndjdyohACH5BAkKAAAALAAAAAAQABAAAAV5ICACAimc5KieLEuUKvm2xAKLqDCfC2GaO9eL0LABWTiBYmA06W6kHgvCqEJiAIJiu3gcvgUsscHUERm+kaCxyxa+zRPk0SgJEgfIvbAdIAQLCAYlCj4DBw0IBQsMCjIqBAcPAooCBg9pKgsJLwUFOhCZKyQDA3YqIQAh+QQJCgAAACwAAAAAEAAQAAAFdSAgAgIpnOSonmxbqiThCrJKEHFbo8JxDDOZYFFb+A41E4H4OhkOipXwBElYITDAckFEOBgMQ3arkMkUBdxIUGZpEb7kaQBRlASPg0FQQHAbEEMGDSVEAA1QBhAED1E0NgwFAooCDWljaQIQCE5qMHcNhCkjIQAh+QQJCgAAACwAAAAAEAAQAAAFeSAgAgIpnOSoLgxxvqgKLEcCC65KEAByKK8cSpA4DAiHQ/DkKhGKh4ZCtCyZGo6F6iYYPAqFgYy02xkSaLEMV34tELyRYNEsCQyHlvWkGCzsPgMCEAY7Cg04Uk48LAsDhRA8MVQPEF0GAgqYYwSRlycNcWskCkApIyEAOwAAAAAAAAAAAA==");\n background-position: right;\n background-repeat: no-repeat;\n}\n</style>');document.write("<style type=\"text/css\">@charset \"UTF-8\";\n/* CSS Document */\n\n/** Structure */\nbody {\n font-family: Arial, sans-serif;\n margin: 0;\n font-size: 14px;\n}\n\n#header {\n position: fixed;\n width: 100%;\n}\n\n#specs {\n padding-top: 50px;\n}\n\n#header .angular {\n font-family: Courier New, monospace;\n font-weight: bold;\n}\n\n#header h1 {\n font-weight: normal;\n float: left;\n font-size: 30px;\n line-height: 30px;\n margin: 0;\n padding: 10px 10px;\n height: 30px;\n}\n\n#frame h2,\n#specs h2 {\n margin: 0;\n padding: 0.5em;\n font-size: 1.1em;\n}\n\n#status-legend {\n margin-top: 10px;\n margin-right: 10px;\n}\n\n#header,\n#frame,\n.test-info,\n.test-actions li {\n overflow: hidden;\n}\n\n#frame {\n margin: 10px;\n}\n\n#frame iframe {\n width: 100%;\n height: 758px;\n}\n\n#frame .popout {\n float: right;\n}\n\n#frame iframe {\n border: none;\n}\n\n.tests li,\n.test-actions li,\n.test-it li,\n.test-it ol,\n.status-display {\n list-style-type: none;\n}\n\n.tests,\n.test-it ol,\n.status-display {\n margin: 0;\n padding: 0;\n}\n\n.test-info {\n margin-left: 1em;\n margin-top: 0.5em;\n border-radius: 8px 0 0 8px;\n -webkit-border-radius: 8px 0 0 8px;\n -moz-border-radius: 8px 0 0 8px;\n cursor: pointer;\n}\n\n.test-info:hover .test-name {\n text-decoration: underline;\n}\n\n.test-info .closed:before {\n content: '\\25b8\\00A0';\n}\n\n.test-info .open:before {\n content: '\\25be\\00A0';\n font-weight: bold;\n}\n\n.test-it ol {\n margin-left: 2.5em;\n}\n\n.status-display,\n.status-display li {\n float: right;\n}\n\n.status-display li {\n padding: 5px 10px;\n}\n\n.timer-result,\n.test-title {\n display: inline-block;\n margin: 0;\n padding: 4px;\n}\n\n.test-actions .test-title,\n.test-actions .test-result {\n display: table-cell;\n padding-left: 0.5em;\n padding-right: 0.5em;\n}\n\n.test-actions {\n display: table;\n}\n\n.test-actions li {\n display: table-row;\n}\n\n.timer-result {\n width: 4em;\n padding: 0 10px;\n text-align: right;\n font-family: monospace;\n}\n\n.test-it pre,\n.test-actions pre {\n clear: left;\n color: black;\n margin-left: 6em;\n}\n\n.test-describe .test-describe {\n margin: 5px 5px 10px 2em;\n}\n\n.test-actions .status-pending .test-title:before {\n content: '\\00bb\\00A0';\n}\n\n.scrollpane {\n max-height: 20em;\n overflow: auto;\n}\n\n/** Colors */\n\n#header {\n background-color: #F2C200;\n}\n\n#specs h2 {\n border-top: 2px solid #BABAD1;\n}\n\n#specs h2,\n#frame h2 {\n background-color: #efefef;\n}\n\n#frame {\n border: 1px solid #BABAD1;\n}\n\n.test-describe .test-describe {\n border-left: 1px solid #BABAD1;\n border-right: 1px solid #BABAD1;\n border-bottom: 1px solid #BABAD1;\n}\n\n.status-display {\n border: 1px solid #777;\n}\n\n.status-display .status-pending,\n.status-pending .test-info {\n background-color: #F9EEBC;\n}\n\n.status-display .status-success,\n.status-success .test-info {\n background-color: #B1D7A1;\n}\n\n.status-display .status-failure,\n.status-failure .test-info {\n background-color: #FF8286;\n}\n\n.status-display .status-error,\n.status-error .test-info {\n background-color: black;\n color: white;\n}\n\n.test-actions .status-success .test-title {\n color: #30B30A;\n}\n\n.test-actions .status-failure .test-title {\n color: #DF0000;\n}\n\n.test-actions .status-error .test-title {\n color: black;\n}\n\n.test-actions .timer-result {\n color: #888;\n}\n</style>");
src/ItemsCarousel/withSwipe.js
bitriddler/react-items-carousel
import React from 'react'; import {calculateItemWidth} from './helpers'; const getFirstTouchClientX = (touches, defaultValue = 0) => { if (touches && touches.length > 0) { return touches[0].clientX; } return defaultValue; }; export default () => (Cpmt) => { return class WithSwipe extends React.Component { state = { startTouchX: 0, currentTouchX: 0, }; onWrapperTouchStart = e => { const touchClientX = getFirstTouchClientX(e.touches); this.setState({ startTouchX: touchClientX, currentTouchX: touchClientX }); }; onWrapperTouchEnd = e => { const { containerWidth, gutter, numberOfCards, firstAndLastGutter, showSlither, requestToChangeActive, activeItemIndex, } = this.props; const itemWidth = calculateItemWidth({ containerWidth, gutter, numberOfCards, firstAndLastGutter, showSlither, }); const touchClientX = getFirstTouchClientX(e.changedTouches); const touchRelativeX = this.state.startTouchX - touchClientX; // When the user swipes to 0.25 of the next item const threshold = 0.25; const noOfItemsToSwipe = Math.floor(Math.abs(touchRelativeX)/(itemWidth + gutter/2) + (1 - threshold)); if (noOfItemsToSwipe > 0) { requestToChangeActive( touchRelativeX < 0 ? activeItemIndex - noOfItemsToSwipe : activeItemIndex + noOfItemsToSwipe ); } this.setState({ startTouchX: 0, currentTouchX: 0 }); }; onWrapperTouchMove = e => { this.setState({ currentTouchX: getFirstTouchClientX(e.touches) }); }; render() { const { disableSwipe, isPlaceholderMode, } = this.props; const { startTouchX, currentTouchX, } = this.state; if (disableSwipe || isPlaceholderMode) { return ( <Cpmt {...this.props} touchRelativeX={0} /> ); } return ( <Cpmt {...this.props} onWrapperTouchStart={this.onWrapperTouchStart} onWrapperTouchEnd={this.onWrapperTouchEnd} onWrapperTouchMove={this.onWrapperTouchMove} touchRelativeX={startTouchX - currentTouchX} /> ) } } }
component/TitleIndex.js
jimju/BNDemo
'use strict' import React, { Component } from 'react'; import { Text, StyleSheet, View, InteractionManager, Image, Platform, TouchableOpacity, } from 'react-native'; import Notify from '../page/Notify'; import ProductSearch from '../page/ProductSearch'; const STATUS_BAR_HEIGHT = (Platform.OS === 'ios' ? 20 : 0) class TitleIndex extends React.Component { //跳转产品详情 _onSearchClick(){ const {navigator} = this.props; InteractionManager.runAfterInteractions(() => { navigator.push({ component: ProductSearch, name: 'ProductSearch', focus:'true' }); }); } //跳转消息 _onNotifyClick(){ const {navigator} = this.props; InteractionManager.runAfterInteractions(() => { navigator.push({ component: Notify, name: 'Notify', data:'消息', }); }); } render(){ return( <View style={styles.view}> <TouchableOpacity onPress={() => this._onNotifyClick()}> <Image style={[styles.image,{resizeMode:'stretch'}]} source={require('../res/images/information.png')}/> </TouchableOpacity> <Text style={styles.titlttext}>SEAGULL</Text> <TouchableOpacity onPress={() => this._onSearchClick()}> <Image style={styles.image} source={require('../res/images/searchmain.png')}/> </TouchableOpacity> </View> ); } } const styles = StyleSheet.create({ titlttext:{ flex:1, fontSize:20, color:'#ffffff', textAlign:'center' }, view:{ flexDirection:'row', backgroundColor:'#015ba7', height:40+STATUS_BAR_HEIGHT, paddingTop:STATUS_BAR_HEIGHT, alignItems:'center', }, image:{ width:30, height:30, margin:5, } }); export {TitleIndex as default};
fields/types/email/EmailColumn.js
vokal/keystone
import React from 'react'; import ItemsTableCell from '../../components/ItemsTableCell'; import ItemsTableValue from '../../components/ItemsTableValue'; var EmailColumn = React.createClass({ displayName: 'EmailColumn', propTypes: { col: React.PropTypes.object, data: React.PropTypes.object, }, renderValue () { const value = this.props.data.fields[this.props.col.path]; if (!value) return; return ( <ItemsTableValue to={'mailto:' + value} padded exterior field={this.props.col.type}> {value} </ItemsTableValue> ); }, render () { return ( <ItemsTableCell> {this.renderValue()} </ItemsTableCell> ); }, }); module.exports = EmailColumn;
ajax/libs/yui/3.6.0/event-custom-base/event-custom-base-debug.js
khasinski/cdnjs
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 * @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 {string} handle for the subscription * @static */ before: function(fn, obj, sFn, c) { // Y.log('Do before: ' + sFn, 'info', 'event'); 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 {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 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 {string} 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 {string} the subscription handle * @static */ 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 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) { // Y.log('Y.Do._delete: ' + sid, 'info', 'Event'); 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; ////////////////////////////////////////////////////////////////////////// // 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'; /** * 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 = { constructor: Y.CustomEvent, /** * 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 = 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); } }, /** * 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) { 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) { Y.log('ce.subscribe deprecated, use "on"', 'warn', 'deprecated'); 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. * @protected */ _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) { Y.log(this.id + ': ' + msg, cat || 'info', 'event'); } }, /** * 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); } } }, /** * 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()) { // 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) { Y.log('Missing event-custom-complex needed to emit a facade for: ' + this.type); 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; 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; }, /** * 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 = 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(); }, /** * Deletes the subscriber from the internal store of on() and after() * subscribers. * * @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 = { 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); } } }; /** * 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 {int} the number of detached listeners */ detach: function() { var evt = this.evt, detached = 0, i; if (evt) { // Y.log('EventHandle.detach: ' + this.sub, 'info', 'Event'); 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~', 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); // Y.log(t); } 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) { // Y.log('EventTarget constructor executed: ' + this._yuid); 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 = { 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=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 a callback function to a custom event fired by this object or * from an object that bubbles its events to this object. * * 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, * or pass an array of event names as the first argument to subscribe to * all listed events with the same callback. * * 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 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)); // Y.log("Node detected, redirecting with these args: " + args); 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) { Y.log('Using adaptor for ' + shorttype + ', ' + n, 'info', 'event'); 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() { Y.log('EventTarget subscribe() is deprecated, use on()', 'warn', 'deprecated'); 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() { Y.log('EventTarget unsubscribe() is deprecated, use detach()', 'warn', 'deprecated'); 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() { Y.log('EventTarget unsubscribeAll() is deprecated, use detachAll()', 'warn', 'deprecated'); 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; if (L.isObject(type)) { ret = {}; Y.each(type, function(v, k) { ret[k] = this.publish(k, v || opts); }, this); return ret; } type = (pre) ? _getType(type, pre) : type; this._monitor('publish', type, { args: arguments }); 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. * * @method _monitor * @param what {String} 'attach', 'detach', 'fire', or 'publish' * @param type {String} Name of the event being monitored * @param o {Object} Information about the event interaction, such as * fire() args, subscription category, publish 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; // Y.log('monitoring: ' + monitorevt); 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 {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 = 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); 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 **/ }, '@VERSION@' ,{requires:['oop']});
lib/js/validators.js
DAIAD/react-echarts
'use strict'; var React = require('react'); var _ = require('lodash'); var PropTypes = React.PropTypes; // A collection of validators for React properties (propTypes) var validateDimension = function validateDimension(props, propName, componentName) { var val = props[propName]; if (val == null) { return; // do not validate; nulls are allowed } if (_.isNumber(val)) { return; } else if (!/^[0-9]+.?([0-9]+)?(px|em|ex|%|vh|vw)$/.test(val.toString())) { return new Error('Invalid property `' + propName + '` supplied to' + ' `' + componentName + '`:' + 'Not a CSS dimension (width/height): ' + val); } }; module.exports = { validateDimension: validateDimension };
src/public/js/blog.js
bbondy/brianbondy.node
import React from 'react' import { Route, Switch } from 'react-router-dom' import BlogFilters from './blogFilters.js' import BlogPostList from './blogPostList.js' import BlogPost from './blogPost.js' export default class Blog extends React.Component { render () { return ( <div> <Switch> <Route path='/blog/filters' exact component={BlogFilters} /> <Route path='/blog/posted/:year' component={BlogPostList} /> <Route path='/blog/tagged/:tag' component={BlogPostList} /> <Route path='/blog/page/:page' component={BlogPostList} /> <Route path='/page/:page' component={BlogPostList} /> <Route path='/blog/posted/:year/page/:page' component={BlogPostList} /> <Route path='/blog/tagged/:tag/page/:page' component={BlogPostList} /> <Route path='/blog/:id/:slug' component={BlogPost} /> </Switch> </div>) } }
src/components/IconGrid/IconGridButton.js
ONSdigital/eq-author
import React from "react"; import PropTypes from "prop-types"; import styled from "styled-components"; import { colors } from "constants/theme"; const Button = styled.button` font-size: 0.7em; width: 7em; height: 7em; margin: 0.5em; padding: 0; cursor: pointer; background: transparent; border: 2px solid transparent; opacity: 1; transition: all 200ms ease-in-out; outline: none; flex: 1 1 auto; order: ${props => props.order}; &:hover { border-color: ${colors.borders}; } &:focus { border-color: ${colors.blue}; } &[disabled] { opacity: 0.5; background-color: transparent; cursor: default; pointer-events: none; } `; const Title = styled.h3` margin: 0; padding-top: 0.5em; font-weight: 400; `; const IconGridButton = ({ iconSrc, title, disabled, order, onClick, ...otherProps }) => { return ( <Button role="menuitem" title={title} onClick={onClick} disabled={disabled} order={order} type="button" {...otherProps} > <img src={iconSrc} alt={title} /> <Title>{title}</Title> </Button> ); }; IconGridButton.propTypes = { iconSrc: PropTypes.string.isRequired, title: PropTypes.string.isRequired, disabled: PropTypes.bool, order: PropTypes.number, onClick: PropTypes.func }; export default IconGridButton;
ajax/libs/tinymce/4.2.1/plugins/legacyoutput/plugin.js
AMoo-Miki/cdnjs
/** * plugin.js * * Released under LGPL License. * Copyright (c) 1999-2015 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing * * This plugin will force TinyMCE to produce deprecated legacy output such as font elements, u elements, align * attributes and so forth. There are a few cases where these old items might be needed for example in email applications or with Flash * * However you should NOT use this plugin if you are building some system that produces web contents such as a CMS. All these elements are * not apart of the newer specifications for HTML and XHTML. */ /*global tinymce:true */ (function(tinymce) { // Override inline_styles setting to force TinyMCE to produce deprecated contents tinymce.on('AddEditor', function(e) { e.editor.settings.inline_styles = false; }); tinymce.PluginManager.add('legacyoutput', function(editor, url, $) { editor.on('init', function() { var alignElements = 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', fontSizes = tinymce.explode(editor.settings.font_size_style_values), schema = editor.schema; // Override some internal formats to produce legacy elements and attributes editor.formatter.register({ // Change alignment formats to use the deprecated align attribute alignleft: {selector: alignElements, attributes: {align: 'left'}}, aligncenter: {selector: alignElements, attributes: {align: 'center'}}, alignright: {selector: alignElements, attributes: {align: 'right'}}, alignjustify: {selector: alignElements, attributes: {align: 'justify'}}, // Change the basic formatting elements to use deprecated element types bold: [ {inline: 'b', remove: 'all'}, {inline: 'strong', remove: 'all'}, {inline: 'span', styles: {fontWeight: 'bold'}} ], italic: [ {inline: 'i', remove: 'all'}, {inline: 'em', remove: 'all'}, {inline: 'span', styles: {fontStyle: 'italic'}} ], underline: [ {inline: 'u', remove: 'all'}, {inline: 'span', styles: {textDecoration: 'underline'}, exact: true} ], strikethrough: [ {inline: 'strike', remove: 'all'}, {inline: 'span', styles: {textDecoration: 'line-through'}, exact: true} ], // Change font size and font family to use the deprecated font element fontname: {inline: 'font', attributes: {face: '%value'}}, fontsize: { inline: 'font', attributes: { size: function(vars) { return tinymce.inArray(fontSizes, vars.value) + 1; } } }, // Setup font elements for colors as well forecolor: {inline: 'font', attributes: {color: '%value'}}, hilitecolor: {inline: 'font', styles: {backgroundColor: '%value'}} }); // Check that deprecated elements are allowed if not add them tinymce.each('b,i,u,strike'.split(','), function(name) { schema.addValidElements(name + '[*]'); }); // Add font element if it's missing if (!schema.getElementRule("font")) { schema.addValidElements("font[face|size|color|style]"); } // Add the missing and depreacted align attribute for the serialization engine tinymce.each(alignElements.split(','), function(name) { var rule = schema.getElementRule(name); if (rule) { if (!rule.attributes.align) { rule.attributes.align = {}; rule.attributesOrder.push('align'); } } }); }); editor.addButton('fontsizeselect', function() { var items = [], defaultFontsizeFormats = '8pt=1 10pt=2 12pt=3 14pt=4 18pt=5 24pt=6 36pt=7'; var fontsize_formats = editor.settings.fontsize_formats || defaultFontsizeFormats; editor.$.each(fontsize_formats.split(' '), function(i, item) { var text = item, value = item; var values = item.split('='); if (values.length > 1) { text = values[0]; value = values[1]; } items.push({text: text, value: value}); }); return { type: 'listbox', text: 'Font Sizes', tooltip: 'Font Sizes', values: items, fixedWidth: true, onPostRender: function() { var self = this; editor.on('NodeChange', function() { var fontElm; fontElm = editor.dom.getParent(editor.selection.getNode(), 'font'); if (fontElm) { self.value(fontElm.size); } else { self.value(''); } }); }, onclick: function(e) { if (e.control.settings.value) { editor.execCommand('FontSize', false, e.control.settings.value); } } }; }); editor.addButton('fontselect', function() { function createFormats(formats) { formats = formats.replace(/;$/, '').split(';'); var i = formats.length; while (i--) { formats[i] = formats[i].split('='); } return formats; } var defaultFontsFormats = 'Andale Mono=andale mono,monospace;' + 'Arial=arial,helvetica,sans-serif;' + 'Arial Black=arial black,sans-serif;' + 'Book Antiqua=book antiqua,palatino,serif;' + 'Comic Sans MS=comic sans ms,sans-serif;' + 'Courier New=courier new,courier,monospace;' + 'Georgia=georgia,palatino,serif;' + 'Helvetica=helvetica,arial,sans-serif;' + 'Impact=impact,sans-serif;' + 'Symbol=symbol;' + 'Tahoma=tahoma,arial,helvetica,sans-serif;' + 'Terminal=terminal,monaco,monospace;' + 'Times New Roman=times new roman,times,serif;' + 'Trebuchet MS=trebuchet ms,geneva,sans-serif;' + 'Verdana=verdana,geneva,sans-serif;' + 'Webdings=webdings;' + 'Wingdings=wingdings,zapf dingbats'; var items = [], fonts = createFormats(editor.settings.font_formats || defaultFontsFormats); $.each(fonts, function(i, font) { items.push({ text: {raw: font[0]}, value: font[1], textStyle: font[1].indexOf('dings') == -1 ? 'font-family:' + font[1] : '' }); }); return { type: 'listbox', text: 'Font Family', tooltip: 'Font Family', values: items, fixedWidth: true, onPostRender: function() { var self = this; editor.on('NodeChange', function() { var fontElm; fontElm = editor.dom.getParent(editor.selection.getNode(), 'font'); if (fontElm) { self.value(fontElm.face); } else { self.value(''); } }); }, onselect: function(e) { if (e.control.settings.value) { editor.execCommand('FontName', false, e.control.settings.value); } } }; }); }); })(tinymce);
app/set/userNameRender.js
hakale/bestCarRent
import React, { Component } from 'react'; var UserNameRender = React.createClass( { render() { return ( () ); } })
admin/node_modules/bs-recipes/recipes/webpack.react-hot-loader/app/js/main.js
develnk/irbispanel
import React from 'react'; import { render } from 'react-dom'; // It's important to not define HelloWorld component right in this file // because in that case it will do full page reload on change import HelloWorld from './HelloWorld.jsx'; render(<HelloWorld />, document.getElementById('react-root'));
heesong/src/index.js
hanheesong/hanheesong.github.io
import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import * as serviceWorker from './serviceWorker'; ReactDOM.render(<App />, document.getElementById('root')); // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. // Learn more about service workers: http://bit.ly/CRA-PWA serviceWorker.unregister();
ajax/libs/Hyphenator/4.0.0/patterns/en-gb.min.js
sashberd/cdnjs
Hyphenator.languages["en-gb"]={leftmin:2,rightmin:3,specialChars:"",patterns:{3:"sw2s2ym1p2chck1cl2cn2st24sss1rzz21moc1qcr2m5q2ct2byb1vcz2z5sd3bs1jbr4m3rs2hd2gbo2t3gd1jb1j1dosc2d1pdr2dt4m1v1dum3w2myd1vea2r2zr1we1bb2e2edn1az1irt2e1fe1j4aya4xr1q2av2tlzd4r2kr1jer1m1frh2r1fr2er1bqu44qft3ptr22ffy3wyv4y3ufl21fo1po2pn2ft3fut1wg1ba2ra4q2gh4ucm2ep5gp1fm5d2ap2aom1cg3p2gyuf2ha2h1bh1ch1d4nda2nhe22oz2oyo4xh1fh5h4hl2ot2hrun1h1wh2y2yp2aki2d2upie22ah2oo2igu4r2ii2omo1j2oiyn1lz42ip2iq2ir1aba4a2ocn3fuu4uv22ix1iz1jay1iy1h2lylx4l3wn5w2ji4jr4ng4jsy1gk1ck1fkk4y5fk1mkn21vok1pvr44vsk1t4vyk5vk1wl2aw5cn2ul3bw5fwh2wi2w1m1wowt4wy2wz4x1an1in1rn1ql3hxe4x1hx1ill24lsn3mlm2n1jx1ox3plr4x5wxx4",4:"d3gr_fi2xy3ty1a2x5usy5acx1urxu4on2ielph2xti4ni2gx4thn2ilx1t2x1s25niql3rix4osxo4n1logn2ivx5om1locl3ro2lo_l3nel1n4_hi2l5rul1mexi4pl1max3io_ex1l1lu_ig3ll5tll3sll3p_in14n2kl1loll3mn3le_ew4n1n4nne4l1lixi4cll3fn3nil1lal5skls4p_eu14no_l4ivx3erx3enl1itx1eml1isx5eg3lirli1qxe2d3lik5lihx1ec1lig4y1bn1oun4ow4li_x3c4yb2il1g2l2fox2as1leyn3p42lev1letx2ag4ni_l1te_es1nhy2yc1l4n1sw3tow5tenho4ns2cwra42lerle5qn2si3womwol4l1try1d4lek42ledwl1in3suw3la4le_l3don1teldi2nth2lce4yda4l1c2l1tu4lu_l4by_od4lbe4lu1a4laz_oi4l4awnt2iwes4l4aul4asn2tjla4p_or1n1tr5wein1tun2tyn1h2w4ednu1awe4b5nuc_os13nudl4all4af_ov4w3drl4aey3eenu3iw1b45nukl4ac5laa4la_4lue3kyllu1in1gu4wabn1go_ph2v5vikur5_en12vv2ks4ty3enk3slv5rov5ri4k1sk3rung1n2vowy1erkol4ko5a4vonk2novo2l2vo_5lupn2gingh4k3lok3lik3lak2l2ng2aki4wvi2tkis4k1inki2l5kihk3holu1vke4g3kee4kedkdo4_sa2k5d2_eg4k1b4kav4kap4vim4ka3ovi4lk4ann3v2nve2vic2ka4lju1v4vi_ju5ljui4_sh2ygi2nfo4_st44jo_3jo2jil43jigl4vi2vel3veive3gjew3jeu42ve_4jesjeo2y3gljal43jac2ja__th44ly_2izz_ti22izo_do2i5yeix3oy3in2i1wn2x4i2vov4ad2ny25nyc5vacn1z24va_nzy4uy4aux2o2oa2o3ag2ivauve2u4vayle2i3um2ittly1c4obau3tu2itrob2i4obo_up12ithob5tuts2lym2ut2o_ve2oc2ait1a2isyo1clo1crut2ioct2is1pis1lo1cy4usto2doo2du4isblyp2n4ew2ab_2abai4saoe3a2abbus1pir2sir4qoe4do5eeir1ioep5o5eqo3er2usco1etir1a3lyr3lywipy43oeuo3evi3poab1ro3ex4ofo2o1gur1uo2ga2abyac2a3lyzi5oxo3gii3oti1orioe4ur2so2gui1od2io22acio1h2ur1o2inuo3hao3heohy44ma_oi4cins24inqoig4ac1r2ino2inn4inl4inkur1ioi4our2f4oisoi4t2iniynd4ok3lok5u2ind2inco1loyn2eo1mai2moom1iur2ca2doim1iil3v4iluon1co2nead1ril3f4onh2ik24iju4adyae5aija4i5in4aed2mahae5gihy4ae5pur1aae4s2i1h4igions2i1geyng42ont4af_4afe5maka4fui3fyu2pri3foon2zn1eru4po4agli2fe2i1foo1iu1ph4ieua2groo4moo2pyn4yi1er4iemie5ia1heah4n4iec2ai24ai_ai3aa1icne2p4idraig2oo2tu1peo1paop1iy1o2u1ouu3os4oplid1ayo3d2icuop1uor1a2ick4ich2a1ja4ju2mam4iceak5u4ibuunu44iboib1i2oreiav4i3aui3atun5ror1iun5o2alei5aii3ah2unniaf4i5ae2ormhy4thyr4hy3ohyn4hy2m2orthy2l1man2nedhuz4un2ihu4gh1th4alko1sch4skhsi42mapu1mu2h1shry4hri4hre41mar4h1pum2ph2ou4osp4osuy2ph4oth4ho_u1mi2h1mh1leh3la2ne_h4irhi2pu1mao4u2oub2h1in2a2mhi4l4oueu1lu2ulsoug4h1ic2hi_u1loul3mnde24ulln2daheu2ul2iou3mam1ihet12ounhep1ow1iows4ow5yyp1nox3ih4eiox5oypo1oy5aoys4u1la4ul_am2pu2izmav4h2ea4he_y2prhdu42m1ban2ao1zo_ch4mb4dy5pu4pa_ha4m1paru2ic5pau2ui2h4ac4ha_u4gon1cug5z2uft43gynu4fou3fl3ufa5gymmb2iue4tgy2b4anhnc1t2g1w5paw3gun2p1bu4edueb4p1c42guep5d2an1og5to2pe_gs4tgs4c2g1san2s2ped3grug4rou2dog4reud4g1gr2n1crgov12gou3gosud4e3goop4ee3goe5god3goc5goa2go_pe2fg2nog1niuc3lg1na2gn2an2y2pes3gluyr4r3pet5aowyr4s4ap_4apa3glo4pexyr5uu4ch2gl24y2s5gip2me_3gioap1i2ph_gi4g3gib4gi_uba41g2igh2tg3hoa2prphe44aps2medg2gegg4ame2g2g1gy3shu1alua5hu2ag2g1f3get2ua2ph2lge4o1pho2tz23gen4phs1gel1typ4gef2ge_g5d4me2m1phug1at4pi_p2iety4a4ty_p2ilt3wopim23gait2wi3gagn3b44ga_5piqar3har1i1tutfu4c4fu_1menp2l23tunna2vfs4p2f3s1pla1fr2tu1ifo3v4tufp4ly2p1myso53foo2arrme4par2stu1afo2n4tu_4po_t2tytt5s3pod2aru4poffo2e3foc4fo_ar5zas1ays1t3flu2asc3flo3flan2asas2et3ti2fin5poypph44f5hf3fr1pr2f1fif1fena5o3feufe4t4pry2ps22asotta4p3sh5fei3fecass2p1sits2its4ht2sc2fe_4t1s2f5d4f5b5faw5farp1st2pt2as1u2fa_1f2aeyl44ey_1expe1wre3whe1waevu4p4trp1tupub1puc4p4uneus44eumeuk5eue4p4uset5zyzy4z1a14p1wet2t2p4y4tovpy3e3pyg3pylpy5t2za__av44ra_r2adras2et2ae1su1namr2bat1orr2berb2ir1c2r2clrct4nak24re_rea4e2sc4es_2erza2to5tok2erurei4erk44erj1tog3toere1qre1vza2irf4lr1g2r2gez4as4ri_2ereto1b2erd2to_2erc4m3hri3ori5reph14mi_2au24au_m1ic4auc4t3me1paeo3mt1lieo2leof2eo3b4enur1lar1leaun2r1loen2sen1ot1laen3kzeb4r1mur2n24ene2end3tiurn5nrnt4ze4d4ro_r2od4roiroo4r2opelv4e1lur4owti4q1tip4roxrpe2r2ph1tior3puaw1i5nahaw5y4mijr3ri_as12eleay3mayn4ays2r5rurry5ek4l2az2m2ilaze4e2ize2iv4eis2ba_t1ineig24eifeid45bahba4ir2seehy21timeh5se5hoe1h2e2gr2efuef4lna2ceep1ee2mee1iee5gee2fr3su2na_rt3ced4g1basede23mytr1turu3ar2udr4ufe1clru2le1ceru2pb1c2ec2a2b1deb2te2bre4bl3myi4be_3beaeb2iebe4eb2b2bedzib5r1v2r2veeau3t1icmy3e5bee3bef2r2yry2tz2ie1bel2sa_2sabeap25saebe3meak1ea4gsa4g3sai4ti_5sak4beobe3q4eabmy4dd3zo3dyndyl25dyksa2l2d2y2d1wsa4mbe3w2b1fbfa44b1hb4ha2bi_1biazi5mdu3udu2ps3apb4ie3ducbif42ths2du_z4isb1ilmi3od4swds3m4bimd5sl1saumi3pz3li3dox4s3bd4osd2or3doosby3bip4bi5qbir44zo_s1cab2iss1cedo4jd4ob4do_5zoa2d1mmtu4d5lu2bl2d1losch2d1la2dl4tha42th_m5si4m1ss2co2t3f1diu2se_se2a4bly2b1m3texbmi44b1nm4ry4bo_3boa2sed5bobdil4bo5h3sei1didse2p1dia4di_d4hu3bon4d1hxys4dg4ami2t2d5f1boo3dexs2es1set3sev3sex3sey2s1fsfi4_an1d3eqde1ps4idsif4bow2si4g2sin5boyzo5p3sipde3gs1it3dec2de_d3di2tep3miute2od1d4d3c4zot23davs2k24sk_d1atske2d3ap4sksd1agb3sc2sl44da_5zumb5sicy4tbso2te2ltei4cys4cy4m2b1tcyl34bu_5bubte2g1cyc2cy_bun2cu5v5cuu1cuss2le1curt4edc4ufc1tyc1tu4te_c1trs1n2s2na2so_t1ca5mix4b3w4zy_4by_3byibys45byt2ca_2tc23soes2olc1te5cafsos45cai5cakc1al3sou4t3bt4axc2ta4m1lcry2sph2s1plc2res2pos4pym3pum3pocoz4cov14mo_sre22moc5cao1caps1sa3cooss3mcon11cars4sns1sos1su1takss3wmod13coe4st_1tai3tah3coc3coa4co_taf4c3nim2pist3cc1atste2mo1mc4kem4ons1th2cim3cau2tab2ta_3cayc1c44stl3cilc3ch3syn4cigci3f4ce_4ci_3chrs1tu1cho2ced4chm1sylch5k4stw4cefce5gs4tysy4d4su_sug3sy1c3sui4ch_m3pa2cem4sy_cew4ce2t1cepsu5zm4op2swo2s3vzzo3",5:"n5tau2cenn3centsves45swee5cencsu5sus4urg1cen2sur3csu5pe3cerasun4a3cerdsum3i5cern5cesss4u2m1s2ulce4mo3cemi4celysy4bi4chab3chae3chaisui5ccelo45cellchec44ched3chee3chemsuf3fch1ersu3etsud4asuct44chessubt2ch5eusu4b13chewch5ex5chi_3chiasu5ansy4ce1styl3ceiv3chio5chip3cedi3cedestu4m5cedace4cicho3a5choc4chois4tud3chor3ceas2st3sstre43chots2tou3stonchow5cean3chur43chut5chyd3chyl3chym1c2i24ceab4ciaccia4mci3ca4cids4cie_ci3ers4toeci5etccle3cifi4ccip4ci3gast3lisyn5esyr5icat4ucim3aci3mes5tizs4thu4cinds4thac4atss4tec4cintci3olci5omci4pocisi4cit3rt2abockar5cka5tt5adeck5ifck4scc2atcs4teb3clasc2le22cle_c5lecc4at_clev3cli1mtad4icli2qclo4q4stakclue4clyp55clystad2rtae5n1c2o2case5car4vco5ba3tagrco3cico5custab23tail4cody2tairco5etco3grcar5mt4ais4col_col3atal2css5poco5lyta3lyco4met4anecomp4cap3uta4pass5liss1ins1sifs1siccon3scon3ts3siacapt4coop4co3orcop4eco3phco5plco3pocop4t2corassev3s5seus1sel1tard3corn4corotar3n5cort3cos_sre4ssreg5co5ta3tarr5cotytas3it3asmco3vacow5a5tassco5zic4anotas4t5craftat4rc4ran5spomcam4is4plysple2ca3maca3lys2pins2pids3phacal4m4speocri3lcron4so3vi4crousov5et5awacrym3cryo34c5s4csim5tawn43calcc3tacc4alaso5thct1an4soseca3gos3orycad4rc4teasor3os2o2ps4onect5esct5etct2ics2onaso3mo1so2mc3timsol3acaco3c4acesody4sod3oc5tio2s3odc3tittcas4tch5u4t1d4smo4dsmi3gc1tomc3tons3mensmas4b3utec2tres3man3bustc2tumte3cr2s1m4buss2s5lucslov5c2ulislo3cs3lits5leycu4mi5cunacun4e5cuni5cuolcu5pacu3pic3upl4tedds3lets5leabur3ebunt4cus5a3slauc3utr4tedobun4a4teeicy4bib4ulit3egoteg1rcy5noteg3us1latbsin41tellbsen4d4abr1d2acdach43tels3dact4b1s2sky3ld4aled4alg4bry_dam5a3damed3amida5mu3dangs5keybrum4d3ard5darms3ketbros4tem3as5kardat4ub4roa4teme4tenet5enm4tenob2ridteo5l4bre_5sivad3dlid3dyite3pe4s1ivde5awde4bisi4teb2ranbram44sismde1cr4dectded3i4sishs1is24bralde4gude3iosi4prtep5i4sio_1sio45sinkde5lo1d4emsin3is2ine4boxy1silibow3ssif5f4demybous4den4d4dened3enh4sidssi4de4sid_3bourde3oddeo3ldeon2si4cu5terd3sicc4s1ibde2pu5botishys44shu4d4eres3hon5shipsh3io1derider3k3dermsh5etsh1er4shab1teri2s1g4der3s5deru4des_de3sa5descbor4nter5k3terrdes4isexo23borides1psewo4de3sq2t2es5seum1de1t4tes_de5thde2tise5sh4ses_bor3d3septsep3atesi4t3esqdfol4tes4tteti4dgel4d4genbon4ebon4cdhot4bol4tbol3itet1rdi2ad3diarbol4e4d1ibd1ic_3sensdi4cedi3chd5iclsen5g1dictsem4osem2i5self4sele4boke5selasei3gd4ifo2boid3seedbod5i5dilldilo4di3luse4dabo5amdi1mi2d1indin4ese2cosec4a3di1odio4csea3wdip5t3diredi3riseas4di4s1d4iscs4eamb3lis3dissbli2q2s1d22s1cud3itos4coi2ditybli3oscof44blikscid5dix4i3bler4the_b3lan5dlefblag43dlewdlin45blac4b5k4bi5ve4d1n24bity4thea4thed4sceidog4abis4od4ol_s4ced5bismscav3sca2pd4ols5dom_1thei3theobi3ousbe4sdo5mos4bei4donybio5mbio3l4dor_dor4mdort41bi2ot4hersavi2dot1asaur52dousd4own4thi_th5lo2thm25binad3ral3dramdran4d4rassat1u3dreldres4sa2tedri4ed4rifs2a1td4romsas3s3sas_4d1s2th4mi3thotds4mi1th2rb2iledt5hobigu3bi5gadu1at5thurduch5sar5sdu4cosap3rbid5idu5en2santdu5indul3cd3uledul4lsan3adun4asamp43b2iddu3pl5durod5usesam5o5thymbi4b1dver2be3trsa3lube3sl3sale2bes_be1s2dy5ar5dy4e3thyrber5sdyll35dymi5berrdys3pberl4thys42beree1actbe5nuea5cue5addbe1neead1i1ti2ati3abben4deal3abel4tsad5osad5is3actean5i2t3ibsac4qe3appear3a5sacks3abl2belebe3labe3gube5grryp5arym4bry4goeas4t5rygmry5erbe3gobe4durvi4tr3veyr3vetr3vene4atube4doeav5ibed2it3ic_eaz5ibe3daebar43becube3caru3tirus4pe2beneb5et4bease5bile4bine4bisbdi4ve4bosrur4ibde4beb1rat2icie4bucru3putic1ut3id_run4trun4ge5camrun2eec3atr4umib3blir4umeech3ie4cibeci4ft4ida2b1b2ru3in3tidirue4lt5idsru4cerub3rr4ube1tif2ec1ror4tusti3fert5sirto5lr1t4oec1ulrt3li4tiffr2tize2dat3tigie4dede5dehrt3ivr2tinrth2ir5teue3deve5dew5barsr5tetr1ted4tigmr3tarrta4grt3abed1itedi2v5tigued3liedor4e4doxed1ror4suse2dulbar4nrs5liee4cers3ivee4doti4kabar4d5barbr4sitba4p1r3sioeem3ib4ansee4par4sileesi4ee3tot4illr5sieefal4rs3ibr3shir3sha5bangr3setb4anee4fugrsel4egel3egi5ae4gibe3glaeg3leeg4mir3secr3seat4ilte5gurban4abam4abal5utim1abal3abag4a5eidobaen43backr4sare4in_e3ince2inee1ingein5ir2sanei4p4eir3oazz4leis3ir2saleith4azyg4r4sagaz5eeaz3ar2r1s2ek3enek5isayth4e4lace5ladr3rymelam4r3ryi3tinnay5sirro4trrog5rrob3ay5larric4ax2idrrhe3rre2lele3orrap4el1ere1lesrra4h4r1r44tinst4intrpre4el5exrp5ise1lierph5ee3limav1isti3ocrp3atav3ige3livavas3r4oute3loae3locroul35rouero3tue2logro1te4rossr4osa4roreel3soror5dav5arelu4melus42t1ise5lyi3elytr4opr4rop_emar4tis4c5root1roomem5bie1me4e4meee4mele3mem3tissro1noro3murom4pe4miee2migro3lyro3laroid3e3mioro3ictis2te4miuro3gnro1fero3doava4ge2moge4moiro3cuem5om4emon5roccro5bre2morro4beav4abr5nute5mozrnuc4au3thr5nogr3noc3titlem3ume5muten3ace4nalrn3izrni5vr1nisrn3inr3nicrn5ibr5niaenct42t1ivr3neyr3netr3nelaus5pene5den3eern5are5nepe2nerr5nadr3nacrn3abt3iveen1et4aus_rmol4e3newen3gien3icr3mocrmil5en5inr5migaur4o5tleben3oieno2mrm4ieenov3aun3dr2micen3sprme2arm4asr2malr5madr3mac3tlefen2tor4litau3marlat33tlem5tlenen3uaen3ufen3uren5ut5enwa5tlewe4oche4odaaul4taul3ir3keyr3ketrk1ere5olutlin4eon4ae3onteop4te1or1r5kaseor3eeor5oeo1s2eo4toauc3oep4alaub5iepa4t4a2tyr2i4vr2ispris4cep5extmet2eph4ie2pige5pla2t3n2ri5orri4oprio4gatu4mrin4sr4inorin4e4rimse1p4u4rimmr4imbri2ma4rim_at1ulr4ileri2esera4gera4lri3erri5elrid4e2ricur4icl2riceri3boer3be2r2ib2a2tuer3cher3cltoas4ri5apri3am4toccat1ri4ered3r2hyrhos4tod4irgu5frg5lier3enr3gerr3geor5geee3reqer3erere4sa4trergal4r4gagat3rarfu4meret42a2tra5tozatos4ere4ver3exreur4er3glre3unre3tur3esq2res_er2ider3ierere4rer4aer3into5dore5phre1pe3reos3reogre3oce3river5iza3too4atoner3mer4enirene2rena4r3empr5em_re1le4ero_re1lam5ordreit3re3isre1inre3if2atolre2fe3reerree3mre1drre1de2r4ed4atogeru4beru5dre3cure3ce3reavr5eautol4ltolu5es5ames5an4atiure3agre3afr4ea_to5lye3seatom4be5seeat1itese4lr4dolrd3lie1shie5shurdi3ord2inr5digr4dier4desr2dares3imes3inr5dame4sitrc5titon4er5clor4clees4od3tonnrcis2rcil4eso3pe1sorr2cesrca4ston3ses4plr4bumr2bosrbit1r2binrbic4top4er4beses2sor3belrbe5ca4timrbar3e2stirb1anr4baga2tif4toreest4rrawn4tor5pra3sor4asktor4qr2aseras3cati2crare2eta3p4rarcran2tet4asra3mur5amnet5ayra3lyra3grra4de3tos_eter2r2acurac4aetex4e2th1r2abo2etia5rabera3bae5timet3inath5re3tir5quireti4u1quet2que_e2ton4quar5quaktos4ttot5uath3ipyr3etou4fet1ri5tourt3ousath3aet1ro4a2that5etetud4pu3tre4tumet4wetra5q3tray4ater4tre_4trede3urgeur5itren4pur3cpur5beut3ipu3pipun2tpun3i3puncev3atpun4aeve4n4trewpum4op4u4mpu5ere4vese1viapuch4e2vict2rieevid3ev5igpu5be2trilt2rit4trixe4viuevoc3p5tomp3tilata3st4rode4wage5wayew1erata3pew5ieew1inp5tiee3witatam4ex5icpt4ictro5ft2rotey4as2a2taey3s2p5tetp1tedez5ieas5uras4unfab4ip2tarfact2p4tan2f3agp4tad5falopt3abtro1v3psyc3troypso3mt4rucfar3itru3i2t4rytrys42asta3feast4silfeb5ras3ph2fed1as5orfe1lifem3i2t1t4p3sacf5enias4loas4la3feropro1l4pro_3ferrfer3v2fes_priv24priopren3aski43prempre1dfet4ot3tabpreb3as5iva3sit4pre_f5feta5siof5fiaf3ficf5fieffil3prar4ff4lepra5dffoc3prac1as3int5tanppi4ct5tast3tedfib5u4fic_ppet33fici4ficsppar34p1p2fiel4asep4p5oxi1fi2l4asedfin2apo1tefind3fin2ef1ing3p4os3portpor3pf3itapo4paas2crt3tlifle2s2ponyflin4t5toip4o2nasan2pom4eas4afa5ryta3ryot5torar3umt3tospo3caar2thar3soar2rhar4pupnos4tu5bufor5bar3oxtu5en5formplu2m2plesaro4ntu4is3plen3plegfrar44ple_fre4sar3odfruc42tum_3tumi4tumsf1tedtun4aft5es2p3k2p2itutu4netur4dtur4npis2sfug4ap4iscfun2gp4is_fur3npir4tfus5oar3guar5ghpi4pegadi4pip4at3wa4ar3en3gale3pi1op4innpin4e3galot3wit5pilo3piletwon4pig3n5tychpict4g5arcg4arepi4crpi3co4picagar5p5garr1ga4sgas5igas3o3piarar4bl3phyltyl5ig4at_2phy_phu5ity5mig4attgat5ugaud5ga5zaar3baara3va3rau5geal3gean2ge4d3gedi5gednar1at3type4gelege4li1tyr13phrage4lu2gelygem3i5gemoara3mph3ou3phorgen3oa3rajt5ziat5zie4gereph1is2ges_5gessphi4nua3ciget3aara2ga5quia5punua5lu1philg3ger4phic3phibg3gligglu3g5glyph3etg4grouan4og5haiuar3auar2dg4hosuar3iap5lia5pirph2angi4atu1b2igi5coap3in4phaeub5loub3ragi4orgi4otaph3igi5pag4i4s5gis_gi2t15gituu1c2aa5peug3laru5chrglec43glerap3alpe4wag4leypet3rpe2tia1pacaol3iglom34glopa5nyian5yap4ery3glyp2g1m4a5nuta3nurg4nabper3vp4eri4pere5percpe5ongn5eegn3eru4comg4niapen5upel5v4pelean3uluco5tgno4suc2trant4ruc3ubuc5ulu5cumgo4etgo4geu5dacg5oidgo3isgo2me5gonnpe2duud1algoph44gor_5gorg4gorsg4oryud5epgos4t1anth3pedsg1ousan2teu4derudev4grab43gram3pedigra2pudi3ogril43pedeu5doigro4gg5rongrop4ud5onan3scgru5ipe4coan5otan2osanor3g4stiu5doran2oeg4u2agu5ab5guan4annyg5uatan5no5gueu4aniuuen4ogu2magu4mi4anigpawk4uer3agur4ngur4u4gurypau3pani3fan3icues4san3euan4eagyn5ouga4cug2niug3uluhem3ui3alp5atohae3opas1t1p4ashag5uha5ichais4par3luid5ouil4apa3pypap3uhan2gpa3pepa4pahan4tpan3iha4pehap3lhar1ahar5bhar4dpan1ep4alspa3lohar3opain2paes4pad4rhat5ouil4to3zygozo5ihav5oana5kuin4san3aeuint4amyl5am3ului5pruis4t1head3hearui3vou4laba3mon4ulacu5lathe3doheek4ul4bohe3isul3caul4ch4uleaow5slow5shu5leehem1aow5in3amidow5hahem4pow1elhe3orulet4h1er_owd3lher2bowd4io5wayow3anow3ago1vish5erho5varouv5ah1erlouss42ouseh1ersoun2dul4evami2cul2fahet3ioul4tul4iaheum3ou5gihe4v4hev5ihex5oa3men3ambuu5lomhi4aram1atou5gaul4poh4iclh5ie_h1ierou3eth1iesama4gh3ifyhig4ohi5kaa5madoud5iou5coou5caa5lynhin4dou5brul1v45ou3aalv5uh2ins4o1trh4ioral1vahip3lum3amhir4ro4touhit4ahiv5aumar4u5masalu3bh3leth1l2ihli4aum2bio1t2oot4iv2h1n2o5tiaal3phho3anho4cou4micho5duho5epo4tedhold1o3taxo3tapot3ama5lowh2o4nos1uru4mos4ostaos4saos1pihon1o1hoodhoo5rh4opea4louo5sono5skeh4orno4sisos1inos5ifhosi4o3siaalos4os5eual1ora3looo2seta3lomoser4hr5erhres4um4paos5eohrim4h5rith3rodose5ga5loeo3secumpt4un5abun4aeht5aght5eeo4scio2schos4ceos4caht5eoht5esun2ce4aliuosar5un3doos3alosa5iory5phun4chunk4hun4thur3ior4unu1nicun4ie4or1uun3inal1in5aligal3ifal1iduni5por4schy1pehy3phuni1vor1ouun3iz2i1a2ia4blo5rooorm1ii2achiac3oa2letork5a5origa1leoun3kni2ag4ia3gnor3ifia3graleg4a3lec4ori_al3chor5gn4ialnor4fria5lyi5ambia3me5orexi3anti5apeia3phi2ardore4va5lavor3eiore3giat4uore3fal3atun3s4un5shun2tiibio4or4duib5lia1laei4bonibor4or4chi5bouib1riun3usoram4ic3acor5ali4calic1an2icariccu4akel4i5ceoa5ismich4io5raiora4g4icini5cioais1iic4lo2i2coico3cair3sair5pi5copop2ta2i1cri4crii4crui4cry1op1top5soopre4air5aop2plic3umopon4i5cut2i1cyuo3deain5oi5dayide4mo4poiain3iu1pato1phyid3ifi5digi5dili3dimo4pheo1phaidir4op1ero5peco4pabidi4vid3liid3olail3oai5guid3owu5peeid5riid3ulaid4aa5hoo2ieg2ie3gauper3i5ellahar22i1enien2da1h2aoo4sei2erio3opt4iernier2oi4erti3escagru5oon3iag3ri2i1eti4et_oo4leag5otook3iiev3au5pidiev3o4ag1nagli4if4fau5pola5giao5nuson5urifi4difi4n4i2fla5gheifoc5ont4rupre4af5tai3gadaev3a3igaraeth4i3geraet4aono3saes3ton5oionk4si3gonig1orig3oto1nioo5nigon3ifig1urae5siae3on4ura_aeco34uraead3umura2gik5anike4bi2l3aila4gon4id4a2duil4axil5dril4dui3lenon4guuras5on1eto3neoon1ee4oned4oneaad1owon5dyon3dril1ina3dos4onauon3aiil5iqona4do2mouil4moi5lonil3ouilth4il2trad3olil5uli5lumo4moi4adoi4ilymima4cim2agomni3im1alim5amom2naomme4om2itomil44adoeomi2co3mia3adjuome4gurc3ai5mogi3monim5ooome4dom4beo3mato2malo2macim5primpu4im1ulim5umin3abo4mabur4duadi4p4olytina4lol1ouin5amin3anin3apo3losol1or4olocur3eain3auin4aw4adilol3mia5difolle2ol2itolis4o5lifoli2eo1lia4inea4inedin5eeo3leuol1erine4so3lepo3leo4ineuinev5ol5chol4an4infu4ingaola4c4ingeur5ee4ingiad4haur1er4ingo4inguoith44adeeada3v4inico3isma5daiur3faac2too3inguril4ur1m4ac3ry4ino_in3oioil5i4inos4acou4oideo2i4d4acosurn5soi5chinse2o3ic_aco3din3si5insk4aco_ac3lio3ho4ack5aohab34acitacif4in5ulin5umin3unin3ura4cicuro4do5gyrur5oturph4iod5our3shio3gr4i1olio3maog4shio3moi5opeio3phi5opoiop4sa5cato4gro4ioreo2grio4got4iorlior4nio3sci3osei3osii4osoog2naur5taiot4aio5tho4gioio5tri4otyur1teo5geyac3alurth2ip3alipap4ogen1o3gasip1ato3gamurti4ur4vaofun4iphi4i4phuip3idi5pilip3ino4fulipir4ip5isab1uloflu42abs_ip3lou3sadi4pogus3agi4pomipon3i4powip2plab3omip4reoet4rip1uli5putus3alabli4i3quaab3laus4apoet3iira4co4et_ir4agus3atoes3t4abio2abiniray4ird3iire3air3ecir5eeirel4a3bieires4oelo4ab1icoe5icir4ima3bet5irizush5aoe5cuir5olir3omusil52abe4ir5taoe4biabay4us4pais5ado5dytis1alis3amis1anis3aris5av_za5ri2s3cod3ul_xy3lod5ruo3drouss4eod3liis2er5odizod5it4iseuod4ilodes4o5degode4co5cyt2isiais5icis3ie4isim_vo1c4isisis4keus1troc5uo2ismais1onocum4iso5pu5teooc1to5ispr2is1soc2te_vi2socre3u3tieiss4o4istao2cleu3tioo5chuoch4e4istho4cea4istloc5ago3cadis1tro4cab4istyi5sulis3urut3leutli4it5abita4c4itaiit3am_vec5it4asit3at_ur4oit3eeo3busob3ul_ura4_up3lo3braith5io5botith3rithy52itiao5bolob3ocit1ieit3ig4itim_un5uob1lio3blaob3iti5tiqut5smit3ivit4liit5lo4ito_it5ol2itonit1ou_un5sobe4lu4tul_un3goat5aoap5ioan4t4itueit1ulit1urit3us2i1u2_un3eiur5euven3oal4iiv1ati4vedu5vinoad5io3acto5ace_ul4luy5er2v3abives4iv3eti4vieiv3ifnyth4va1cavacu1iv1itva4geivoc3vag5rv1al_1vale_tor1vali25valu4izahiz3i2_til4iz5oivam4i_tho4va5mo5vannnwom4jac3ujag5u_te4mja5lonwin44vasev4at_jeop34vatuvect4_ta4m4velev1ellve1nejill55jis_4venu5ve3ojoc5ojoc5ujol4e_sis35verbju1di4ves__ses1ju3ninvi4tjut3a_se1qk4abinvel3kach4k3a4gkais5vi1b4vi4ca5vicuvign3vil3i5vimekar4i1kas_kaur42v1invin2evint4kcom43vi1oviol3kdol5vi5omke5dak5ede_rit2_rin4ken4dkeno4kep5tker5ak4erenu1trker4jker5okes4iket5anu4to5vi3pkfur4_re3w_re5uvire4kilo3vir3uk2in_3kind3nunc5numik3ingkin4ik2inskir3mkir4rv3ism3kis_k1ishkit5cvit2avit1rk5kervi3tu_re5ok5leak3lerk3let_re1mv3ity_re1ivi5zovolv41know3vorc4voreko5miko5pe3vorok5ro4_po2pv5ra4vrot4ks2miv3ure_pi2ev5verwag3owais4w3al_w3alswar4fwass4nu1men3ult5labrwas4tla2can4ulowa1tela4chla2conu4isw4bonla3cula4del5admw5die_out1nug4anu3enlag3r5lah4nud5i_oth54lale_osi4_or2o_or4ilam1ol5amu_ore4lan2d_or3dn5turntub5n3tua3weedweir4n5topwel3ilapi4n3tomn1t2o_op2i_on4ent3izla4tenti3pn3tign1tient4ibwent45laur_ome2_ol4d_of5twest3_oed5l4bit_ob3lw5hidl2catwid4elcen4n1thelch4el3darl3dedl3dehwi5ern4teol5dew_no4cl3dien3teln4tecwim2pld5li_ni4cwin2ecen3int1atnt1aln3swale3cawl1ernsta4_na5kle5drleg1an3s2t3leggn5sonleg3ons3ivwl4iensi2tlel5olelu5n3sion3sien3sid5lemml3emnle2mon4sicns3ibwon2tn3sh2n5seule1nen2seslen3on5seclen5ule3onleo4swoun4wp5inn4scun2sco_mis1_mi4enre3mnre4ix4ach4les_x4adenpri4x3aggnpos4npla4npil4leur5x3amil3eva5levexan5dle4wil5exaxano4lf5id_lyo3lf3on_lub3l4gall4gemlgi4al4gidl4goixas5pxcav3now3llias4lib1rl1ic_5lich_lo2pnove2nou5v2nousli4cul3ida3nounn4oug3lieul4ifel4ifoxcor5_li4p3notenot1a_li3oxec3r1l4illil4ilim2bno3splim4pnos4on4os_lin4dl4inenor4tn4oronop5i5nood4noneno2mo1nomi3linqnol4i3liogli4ollio3mliot4li3ou5liphlipt5x5edlx5edn_le2pl4iskno3la_le4ml2it_n5ol_no4fa3lithnoe4c3litrlit4uxer4gn4odyno4dinob4ln5obilk5atxer3on5nyi_ki4ex3ia_nnov3x4iasl5lasl4lawl5lebl1lecl1legl3leil1lellle5ml1lenl3lepl3leul3lev_is4o_is4c_ir3rx5ige_in3tllic4nlet4_in3ol5lie4n1l2l2linnk5ilnk5ifn3keyl5liolli5v_in2ixim3ank5ar_in3dllo2ql4lovnjam2_im5b_il4i_ig1n_idi2llun4l5lyal3lycl3lygl3lyhl3lyil5lymx4ime_hov3_ho2ll4mer_hi3bl5mipni3vox4it__he4ilneo4x4its5loadniv4ax4ode_hab2ni4ten5iss2locynis4onis4l_gos3n4isk4loi_lo5milom4mn4is_lon4expel43nipuni1ou5nioln4inu5ninnnin4jn4imelop4en3im1l3opm1lo1qnil4ax4tednik5e3nignn3igml4os_lo1soloss4_ga4mnift4nif4flo5tu5louplp1atlp3erxtre4l5phe_fo3cl2phol3piel3pitxur4b1y2ar_eye3_ex3a3yardl5samls5an4nicllsi4mls4isyas4i_eur4l1s2tni3ba3niac_es3tl5tar_es3pl4teiyca5mlth3inhyd5y3choltin4lti3tycom4lt4ory2cosnhab3_er2al4tusyder4_epi1luch4_eos5n2gumlu4cu_ent2lu1enlu5er_en3slu4ityel5olu4mo5lumpn4gry_en5c5lune_emp4n5gic_em3by5ettlusk5luss4_el2in5geen4gae_ei5rlut5r_ei3dygi5a_ec3t_eco3l4vorygo4i_dys3_du4c_do4eyl3osly4calyc4lyl5ouy1me4news3_de4wly4pay3meny5metnet1ry5miaym5inymot4yn4cim4acanet3an1est1nessn1escmact44mad_4mada4madsma4ge5magn2nes_yn3erma5ho3ma4i4mai_maid3_der2ner2vner5oyni4c_de1mneon4m3algneo3ln3end4n1enne2moyoun4n4ely2neleyp5alneis4man3a5negune3goneg3a3nedi_dav5m4ansne2coyper3m3aphy4petne4cl5neckn3earyph4en3dyind2wemar3vn4dunndu4bn2doundor4n5docnd1lin3diem4at_n1dicnd4hin5deznde4snde4ln1dedn3deayph3in3damm4atsn3daly4p1iy4poxyp5riyp4siypt3am5becn4cuny3ragm4besyr3atm2bicnct2oyr3icm4bisy5rigncoc4n1c2lm3blimbru4mbu3lmbur4yr3is_can1ys5agys5atmea5gn4cifme4bame4biy3s2c4med_n4cicn3chun3chon3chan5ceyme4dom5edy_bre2n5cetn3cer4melen1c2anbit4nbet4mel4tnbe4n_bov4ys1icys3in3men_2menaysi4o3nautnaus3me1nenat4rnati45meogys4sonas3s4merenas5p2me2snas5iys4tomes5qyz5er1me2tnam4nmet1e3nameza4bina3lyn5algmet3o_aus5_au3b_at3t_at3rza4tena5ivmi3co5nailm4ictzen4an5agom4idina4ginag4ami5fimig5an2ae_mi2gr_as4qmi5kaz5engm3ilanadi4nach4zer5a3millmi5lomil4t3m2immim5iz3et4_ari4_ar4e_ar5d5zic4_ap4i5my3c_any5z3ing3zlemz3ler_an3smu4sem5uncm2is_m4iscmi4semuff4zo3anmsol43zoo2_and2zo3olzo3onzo5op4mity_am2i_al1k_air3_ag5nmlun42m1m2_ag4amp5trmp3tompov5mpo2tmmig3_af3tmmis3mmob3m5mocmmor3mp3is4m1n2mnif4m4ninmni5omnis4mno5l_af3f_ae5d_ad3o_ad3em3pirmp1inmo4gom5pigm5oirmok4imol3amp5idz3zarm4phlmo3lyz5zasm4phe_ach4mona4z3ziemon1gmo4no_ace45most_ab4imo3spmop4t3morpz5zot",6:"reit4i_ab3olmo5rel3moriam5orizmor5onm3orab3morse_acet3_aer3i_al5immo3sta2m1ous_al3le4monedm4pancm4pantmpath3_am5ar_am3pemper3izo5oti_am3phmo4mis_ana3b_ana3s_an5damog5rimp3ily_an4el_an4enmmut3ammin3u_an4glmmet4e_ant3am3medizing5imman4d_ar5abm5itanm3ists_ar5apmsel5fm3ist_5missimis3hamuck4e4misemmul1t2_ar4cimu5niomun3ismus5comirab4mus5kemu3til_at5ar1m4intmin3olm4initmin5ie_bas4i_be3di5myst4_be3lo_be5sm5min4d_bi4er_bo3lo_ca3de_cam5inac4te_cam3oyr5olona4d4amil4adnad4opyr3i4t_car4imid5onn4agen_ca4timid4inmi4cus_cer4imi3cul3micromi4cinmet3ri4naledyp5syfn4aliameti4cmeth4i4metedmeta3tna5nas_cit4anan4ta_co5itnan4to_co3pa4n4ard_co3ru_co3simes5enmer4iam5erannas5tenat5alna5tatn4ateena3thenath4l5mentsn4ati_nat5icn4ato_na3tomna4tosy4peroy4periy5peremend5oyoung5naut3imen4agna5vel4m5emeyo4gisnbeau4_de3linbene4mel3on_de3nomel5een4cal_yn4golncel4i_de3ra_de3rimega5tncer4en4ces_yn5ast3medityn5ap4nch4ie4medieynand5ynago43mediaym4phame5and_de3vem5blern4cles_dia3s_di4atmb5ist_din4anc4tin_dio5cm5bil5m4beryncu4lo_east5_ed5emncus4tmbat4t_elu5sn3da4c3m4attn4dalema3topnd3ancmat5omma3tognde3ciyes5tey3est__em5innd3enc_em5pyn3derlm4atit_en5tay4drouma3term4atenndic5undid5aydro5snd5ilynd4inend3ise_epi3d_er4i4nd5itynd3ler_er4o2_eros43mas1ty4collnd5ourndrag5ndram4n5dronmassi4y4colima3sonyclam4mar5rima3roone3aloma5ronne2b3umar5ol5maran_erot3_er4rima5nilych5isne4du4manic4man3dr_eth3e3m4an__eval3ne5lianeli4g_far4imal4limal3le_fen4dm3alismal3efmal5ed5male24nered_fin3gxtra3vner4r5mal3apxtra5d2mago4ma4cisne3sia5machy_fu5ganes3trmac3adnet3icne4toglys5erxtern3neut5rnev5erlypt5olymph5n4eys_lyc5osl5vet4xter3ixpoun4nfran3lv5atelu5tocxpo5n2_ge3ron3gerin5gerolut5an3lur3olu3oringio4gn5glemn3glien5gliol3unta_go3nolu2m5uxo4matluc5ralu2c5o_hama5l3t4ivltim4alti4ciltern3lt5antl4tangltan3en4icabni4cen_hem5anict5a_hy3loni4diol3phinni4ersximet4lot5atnif5ti_ico3s_in3e2loros4lo5rof_is4li_iso5ml4ored_ka5ro_kin3e5nimetn4inesl3onizl3onisloni4e3lonia_lab4olo5neyl5onellon4allo5gan3lo3drl3odis_la4me_lan5ixen4opnitch4loc5ulni3thon4itosni5tra_lep5rni3trinit4urloc3al5lob3al2m3odnivoc4niz5enlm3ing_lig3anjur5illoc5ulloc3an5kerol3linel3linal5lin__loc3anland5lli5col4liclllib4e_loph3_mac5ulli4anlli5amxa5met_math5llact4nni3killa4balk3erslk3er_lkal5ono5billiv5id_ment4_mi3gr_mirk4liv3erl5ivat5litia5liternois5il3it5a5lisselint5inom3al3lingu5lingtling3i3nonicw5sterws5ingnora4tnor5dinor4ianor4isnor3ma_mi5to_mo3bil4inasl4ina_wotch4word5ili5ger_mon3a5lidifl4idarlict4o_mu3ninova4l5licionov3el_mu3sili4cienow5erli4ani_myth3_nari4le5trenpoin4npo5lale5tra3les4sle3scon4quefler3otleros4ler3om_nast4le5rigl4eric3w4isens3cotle5recwin4tr_nec3tle5nielen4dolend4e_nom3ol5endalem5onn5sickl5emizlem3isns5ifins3ing_nos3tn3s2is4leledle3gransolu4le4ginn4soren4soryn3spirl3egan_obed5nstil4le5chansur4e_ob3elntab4unt3agew5est__oe5sont5and_om5el_on4cewel4liweliz4nt3ast_opt5ant5athnt3ati_or3eo3leaguld3ish_pal5in4tee_n4teesld4ine_pa5tald3estn4ter_n3terin5tern_pecu3war4tel5deral4cerenther5_ped3elav5atlat5usn4tic_ward5r_pend4n4tics_pep3tn3tid4_pi3la_plic4_plos4_po3lan5tillnt3ing_pop5lvo3tar_pur4rn4tis_nt3ismnt3istvo5raclat5al4laredlar5delar5anntoni4lan4tr_re3cantra3dnt3ralviv5orn3tratviv5alnt3rilv5itien5trymlan3etlan4er3landsvi5telland3i3land_lan3atlam4ievi3tal2v5istla4ic_la4gisla3gerlac5on5visiola5cerla5ceolabel4vi5ridlab5ar_re3ta5numerkin5et_rib5anu3tatn5utivkey4wok5erelkal4iska5limk2a5bunven4enven5o_ros3ajuscu4_sac5rjel5laja5panja2c5oi5vorevin5ta_sal4inym5itv5iniz5vinit3vinciiv3erii4ver_iv5elsoad5ervin4aciv5el_oak5ero3alesiv5ancoal5ino5alitit5uar_sanc5oar5eroar4se_sap5ait4titoat5eeoat5eri4tric_sa3vo4i5titob3ing2obi3o_sci3e4itio_it4insit4in_it5icuiti4coi5tholitha5lobrom4it3erait3entit3enci3tectit4ana3istry_sea3si4s1to5vider_sect4oc5ato4o3ce25vict2ocen5ovice3r_se3groch5ino3chon_sen3tvi4atroci3aboci4al5verseis4taliss4ivis5sanis4saliss5adi3s2phocu4luver4neislun4ocuss4ver3m4ocut5ris3incis5horocyt5ood3al_ish3op4ishioode4gao5dendo3dentish5eeod3icao4d1ieod3igais3harod1is2v5eriei2s3etis5ere4is3enis3ellod5olood5ousise5cr4i1secisci5cver3eiver5eaven4tris5chiis3agevent5oir5teeir5ochve5niair4is_ir2i4do3elecoelli4ir5essoe3o4pire5liven4doi5rasoven4alvel3liir4ae_ir4abiv4ellaip3plii4poliip3linip4itiip1i4tip4ine_su5daiphen3i1ph2ei3pendog5ar5v3eleripar3oi4oursi4our_iot5icio5staogoni45ioriz4ioritiora4mvel3atiod3i4ioact4_sul3tintu5m_tar5oin3til_tect45vateein4tee_tel5avast3av5a4sovar4isin3osiin5osei3nos_oi5ki5oil3eri5noleoin3de4vantlvanta4oin4tr_ter4pin3ionin4iciin5ia_oit4aling3um4ingliok4ine4ingleing5hain5galo4lacko5laliinfol4olan5dol5ast_thol45val4vole2c4ol5eciol5efiine5teole4onin3esi4in5eoo3lestin5egain5drool3icao3lice_ti5niol5ickol3icsol5id_va5lieo3lier_tri3dinde3tvager4oli5goo5linaol3ingoli5osol5ip4indes5inde5pin5darollim34vagedol4lyi3vag3ava5ceo4inataol3oido4lona_tro4vi3nas_in4ars_turb44ol1ubo3lumi_turi4ol3us_oly3phin3airin5aglin4ado4inaceimpot5im5pieo4maneomast4_tu5te_tu3toi3mos_im5mesomeg5aome3liom3enaomen4to3meriim5inoim4inei3m2ieomic5rom4ie_imat5uom4inyomiss4uv5eri_un5cei5m2asim3ageil5ureomoli3o2mo4nom5onyo4mos__un5chilit5uom5pil_un3d2il4iteil5ippo5nas__uni3c_uni3o4iliou_un3k4oncat3on4cho_un3t4u4t1raon3deru4to5sili4feili4eri5lienonec4ri3lici_ve5loon5ellil3iaron3essil3ia_ong3atilesi45u5tiz4o1niaon5iar2oni4conic5aut3istut5ismon3iesigu5iti4g5roi5gretigno5m4onneson5odiign5izono4miu5tiniut3ingo5nota_ver3nig3andu4tereon4ter_vis3ionton5if5teeon4treif5icsut5eniutch4eif3ic_u3taneoof3eriev3erook3eri5eutiiet3ieool5iei3est_i1es2ties3eloop4ieieri4ni3eresus5uri4idomioot3erooz5eridol3ausur4eo5paliopa5raopath5id4istopens4id1is43operaus4treidios4_vi5sooph4ieo5philop5holi3dicuus1to4iderm5op3iesop5ingo3p2itid3eraust3ilid3encopol3ii5cun4op5onyop5oriopoun4o2p5ovicu4luop5plioprac4op3ranict5icopro4lop5ropic4terust5igust4icicon3ous5tanic5olaor5adoich5olus3tacic5ado4oralsib3utaoran3eab5areorb3ini4boseorch3iibios4ib3eraor5eadore5arore5caab5beri5atomia5theoreo5lor3escore3shor3essusk5eru4s1inor5ett4iaritianch5i2a3loial5lii3alitab3erdor3ia_4orianori4cius5ianorien4ab3erria5demori5gaori4no4orio_or5ion4oriosia5crii2ac2rus4canor3n4a5ornisor3nitor3oneabi5onor5oseor5osohys3teorrel3orres3hyol5ior4seyor4stihyl5enort3anort3atort3erab3itaor3thior4thror4titort3izor4toror5traort3reh4warthu3siahu4minhu5merhu4matht4ineht4fooht3ensht3eniab4ituht3en_ab3otah3rym3osec3uhrom4ios5encosens43abouthre5maabu4loab3useho4tonosi4alosi4anos5ideo3sierhort5hho5roghorn5ihor5etab3usio3sophos3opoho2p5ro3specho5niohong3ioss5aros4sithon3eyur3theos4taros5teeos5tenac5ablur5tesos3tilac5ardost3orho5neuhon5emhom5inot3a4gurs3orho4magach5alho5lysurs5ero5ta5vurs5alhol3aroter4muroti4ho3donachro4ur5o4mach5urac5onro5thorurn3ero5tillurn3alh5micao3tivao5tiviur5lieo5toneo4tornhirr5ihio5looturi4oty3lehi5noph5inizhi5nieh2in2ehimos4hi5merhi5ma4h3ifi4url5erhi4cinur5ionur4iliur4ie_ac2t5roult5ih4et3ahes3trh5erwaound5aac5uatur3ettoun3troup5liour3erou5sanh4eron5ousiaher5omur1e2tur3ersova3lead5eni4ovatiad3icao4ver_over3bover3sov4eteadi4opadis4iovis5oo2v5oshere3ohere3aherb3iherb3aher4ashende5ur5diehe5mopa3ditihemis4he3menowi5neh3el3ohel4lihe5liuhe3lioh5elinhe5lat5admithe5delhec3t4adram4heast5ad3ulahdeac5ae4cithavel4ura4cipac4tepa5douhas4tehar4tipa3gan4pagataed5isu5quet4pairmpa5lanpal3inag4ariharge4pan5ac4agerihant3ah5anizh1ani4agi4asham5an4aginopara5sup3ingpa3rocpa3rolpar5onhagi3oag3onihaged5agor4apa3terpati4naha5raaid5erail3erhadi4epaul5egust5apa5vilg4uredg4uraspaw5kigui5ta5guit43guardaim5erai5neagrum4bpec4tugru3en5ped3agrim3a4grameped3isgour4igo5noma3ing_5gnorig4ni2ope5leogn4in_pen4at5p4encu5orospen5drpen4ic3p4ennal5ablg2n3ingn5edlalact4until4g5natial5ais5gnathala3map3eronalc3atald5riun4nagg5nateglu5tiglu5tepes4s3ale5ma4g5lodun5ketpet3eng5lis4gli5ong4letrg4letoal3ibrali4cigin5gigi5ganun3istph5al_gi4alluni3sogh5eniph5esiggrav3ggi4a5al5icsg5gedlun4ine3germ4phi5thgeo3logen5ti4phobla5linigen5italin5ophos3pgen4dugel5ligel4ing4atosg4ato_gat5ivgast3ral5ipegasol5ga5rotp5icalu3n2ergar3eeg5antsgan4trp4iestpi5etip5ifieg5ant_un4dus4ganed4alis_gan5atpi3lotgam4blun4diepin5et3pingegali4a5p4insga5lenga4dosga4ciefu5tilpir5acfu3sil4furedfu4minundi4cpiss5aunde4tpis4trft4inefti4etf4ter_un3dedpla5noun4dalalk5ieun4as_al4lab4pled_frant4frag5aunabu44plism4plistal4lagu4n3a4umu4lofore3tfor4difor5ayfo5ramfon4deallig4fo4liefo1l4ifoeti42p5oidpois5iump5tepo4ly1poly3spoman5flum4iump5lipon4acpon4ceump3er3ponifpon5taf3licaf5iteepo5pleal3ogrpor3ea4poredpori4ffir2m1fin4nial3ous5fininpos1s2fi3nalu4moraumi4fyu2m5iffight5fier4cfid3enfi5delal5penp4pene4ficalumen4tal3tiep4pledp5plerp5pletal5uedal3uesffor3effoni4ff3linf2f3isal5ver2a1ly4fet4inaman5dul3siffet4ala3mas_fest5ipres3aulph3op3reseulph3i5pricipri4es4pri4mam5atuam4binfest3ap5riolpri4osul4litfess3o4privafer5ompro3boul4lispro4chfe5rocpron4aul4latam5elopro3r2pros4iu5litypro3thfer3ee4feredu5litipsal5tfemin5fea3tup5sin_fant3iul5ishpsul3i4fan3aul3ingfa5lonu3linefa2c3ufa3cetpt5arcez5ersp5tenapt5enn5pteryez5er_ex4on_ew5ishamen4dp2t3inpt4inep3tisep5tisievol5eevis5oam3eraev5ishev4ileam5erle4viabpudi4ce4veriam5icapu4laramic5rpu5lisu5lentu1len4a3miliev5eliev3astpun5gieva2p3eval5eev4abieu3tereu5teneudio5am5ilypu3tat5ulcheet3udeet3tere4trima5mis_et4riaul5ardet4ranetra5mamor5aetra5getor3iet3onaamort3am5ose3quera4quere4ques_et5olo5quinauit5er3quito4quitueti4naeti4gie3ticuuisti4ethyl3ra3bolamp3liuis3erampo5luin4taet5enia5nadian3agerag5ouuinc5u3raillra5ist4raliaet3eeret3atiet3ater4andian3aliran4dura5neeui3libra3niara3noiet5aryan3arca5nastan4conrant5orapol5rap5toet3arieta5merar3efand5auug3uraan5delet3al_es4ur5e2s3ulrass5aan5difug5lifra5tapra5tatrat5eurath4erat3ifan5ditra5tocan5eeran3ellra4tosra5tuirat5umrat3urrav5aian3ganrav3itestud4ra3ziees5tooe3stocangov4rb3alian4gures5taue5starest3anesta4brbel5orb3entes4siless5eeessar5rbic5uan5ifor5binee5s2pres5potan5ionrbu5t4es5pitrcant54anityr4celean3omaan4scoans3ilrcha3irch3alan4suran2t2ar3cheor4cherud3iedr4chinrch3isr3chites3onaan3talan5tamrciz4ies3olae3s4mie3skinrcolo4rcrit5an4thies4itses4it_e5sion3anthrrd4an_es5iesr5de4lr3dens4anticrd5essrd5ianan4tiee5sickes5ic_rd3ingesi4anrd1is2rd5lere3sh4aes5encrd5ouse5seg5e3sectescut5esci5eant4ives5chees5canre5altre5ambre3anire5antre5ascreas3oeryth35erwauan4tusreb5ucre3calrec4ceer4vilan5tymre3chaan3um_an5umsap5aroerund5ert5izer4thire3disre4dolape5lireed5iu4cender4terer5tedre3finuccen5re5grare3grereg3rire3groreg3ulaph5emer4repaph5olaphyl3ero5stero5iser3oidern3it4reledre3liarel3icre5ligreli4qrel3liern3isrem5acap5icuub3linern3errem5ulu4bicuren5atr4endiap4ineren4eser4moirenic5ren4itub5blyre5num4eri2ta3planre5olare3olier4iscer3ioure4pereri4onrep5idre3pinre3plere4preeri4nauari4ner3iffre5reare3r2uapo3thre3scrre3selre3semre3serap5ronre5sitre3speapt5at4arabiara5bore5stu3retarre3tenar3agear5agire1t2ore5tonre3trare3trere5trier4ianer3ia_ergi3ver3ettrev3elrevi4ter3etser3et_ar3agoar3allaran4ger3esier5eseere5olr4geneeren4e5erende4remeer5elser5ellr5hel4rhe5oler5el_er3egrer3ealerdi4eerd5arerb5oser3batar5apaer5atuarb5etar4bidty4letri5cliri3colri5corri4craarb3lirid4aler3apyer3apier3aphera4doar4bularch5otwi5liri5gamaren5dri5l4aar5ettar3ev5ar5iff5tur5oequin4rima4gar4illrim3ate4putarimen4e3pur5ept3or5turitr4inetturf5iturb3aep5rimt4uranrins5itu5racep3rehtun5it5rioneepol3iepol3ari5p2ari5piear5iniep3licarm3erris4ise4peteris4paris4pear5mit4ristiri3tonr5it5rep5ertriv4alar3nalar3nisriv3enriv3il5ri5zoar5oidep5arceor4derk5atir5kellrk5enia5rotieol5ata5roucr3kiertud5ier5kin_r5kinsrks4meen4tusent5uptu5denr3l4icr3liner5linsen4tritu4binen5tiarma5cetuari4ent3arr4mancr4manor4marir4maryen4susars5alart5atarth4een4sumens5alrm4icar5m2iden3otyenit5ut4tupermin4erm3ingarth3rar5tizen5iere2n3euen4ettrmu3lie3nessen5esiener5var5un4as5conrn3ateas5cotrn5edlt3tlerr3nessrn5esttti3tuas3ectt5test3encept4tereen3as_rn4inee2n3arrn3isten4annash5ayem4preash5ilem5pesas5ilyempa5rask5erem3orras5ochrob3letstay4e3moniem3oloemod4uemo3birody4n4emnitem4maee4mitaem3ismem5ingem3inar4oledas4silassit5as4tatro5melro3mitas4tiaas3tisemet4eron4ac4ronalas4titron5chron4dorong5ir5onmeem5ero4asto2as3traas4trit5roto4atabiem3anaro3peltro3spem3agor5opteel5tieelp5inel5opsrosi4aro5solel5op_5troopros4tiatar3aro3tatata3t4ro4terelo4dieloc3uelo5caat3eautri3me4roussell5izel4labrow3erelit4ttri3lie4li4seli3onr3pentrp5er_el3ingat3echr3pholrp3ingat5eerrpol3ar2p5ouele3vi3tricuelev3at5ricla5tel_e5lesstres4sele5phel3enor4reo4el5eni4e4ledelea5grricu4tre5prate5lerri4oseld3ertre4moat3entat3eraelast3el5ancel5age4traddeiv3ereit5ertra4co4atesse4ins_to3warehyd5re5g4oneg5nabefut5arsell5rs3er_rs3ersa3thene4fiteath3odr4shier5si2ato3temto5stra5thonrs3ingeem5eree2l1ieed3ere4d5urrstor4to3s4ped3ulo4a3tiator5oitor5ered3imeed5igrrt3ageto5radr4tareed5icsto4posr4tedlr3tel4r5tendrt3enito5piaa2t3in4atinaat5ingede3teton5earth3rir1t4icr4ticlr5tietr5tilar5tilltom5osrt5ilyedes3tr3tinart3ingr3titirti5tue4delee5dansrt5lete5culito4mogec4titrt5ridecti4cec4teratit3urtwis4e4cremtoma4nec3ratec5oroec3oratom3acat4iviec3lipruis5iecip5i4toledec5ath5at5odrun4clruncu42t3oidrun2d4e4caporu5netecal5ea4topsec3adea4toryebus5iebot3oe4belstode5cat3ronat5rouat4tagru3tale4bel_eav5our4vanceavi4ervel4ie3atrirven4erv5er_t4nerer3vestat3uraeatit4e3atifeat5ieeat3ertmo4t5east5iat3urge1as1s3ryngoau5ceraud5ereas5erryth4iaudic4ear4tee5ar2rear4liear3ereap5eream3ersac4teeam4blea3logeal3eread3liead3ersain4teac4tedy4ad_sa5lacdwell3sa3lies4al4t5tletrdvert3sa5minault5id5un4cdum4be5tledrs4an4etlant4san5ifdu5ettau5reodu5elldu5eliau5rordrunk3tiv3isaus5erdri4g3aut3ars5ativti3tradrast4d5railsau5ciaut3erdossi4sa3voudo5simdon4atdom5itt3itisdomin5doman4tit5ildo4lonscar4cdol5ittith4edol3endo4c3u4s4ces5dlestt4istrdi4val1di1v2ditor3av3ageava5latish5idithe4av5alr3tisand4iterd4itas3disiadisen34d5irodi4oladi5nossec5andin5gisecon4dimet4di5mersed4itdi3gamdig3al3di3evdi4ersd5icurse3lecselen55dicul2s4emedic4tesemi5dav5antdic5oldic5amt3iristi5quaav3end5sentmti3pliav3ernti5omosep4side4voisep3tiser4antiol3aser4to4servode3vitde3visdev3ils5estade3tesdes3tid3est_sev3enaviol4aw5er_de3sidde3sectin3uetin4tedes4casfor5esfran5der5os3dero45dernesh4abiaw5ersder4miaw5nieay5sta3dererde5reg4deredde3raiderac4si4allsiast5tin3ets3icatdepen42s5icldeont5si5cul4tinedba5birdens5aside5lsid3enbalm5ideni4eba5lonsi4ersde1n2ade4mosde3morba5nan5tilindemo4nti4letsin5etbardi44demiedel5lisi5nolsi3nusba5romdeli4esi5o5sde3lat5de3isde4fy_bar3onde4cilsist3asist3otigi5odeb5itsit5omdeac3td3dlerd4derebas4tedaugh3dativ4dast5a3d4as2d1an4ts3kierba4th4sk5ily3baticba5tiod4a4gid5ache3ti2encys5toc3utivbat5on4cur4oti3diecur4er1c2ultb4batab4bonecul5abcu5itycub3atctro5tbcord4ti3colct5olo3smithbdeac5tic5asct5ivec4tityc4tituc3t2isbed5elc3tinict5ing4s3oid4te3loct4in_so5lansol4erso3lic3solvebe5dra5ti5bube3lit3some_bend5ac4ticsbe5nigson5atbicen5son5orc4tentbi4ers5soriosor4its5orizc2t5eec3tato5bilesct5antc5ta5gctac5u5c4ruscrost4spast45thoug3b2ill3sperms5pero4thoptcre4to5creti3spher4t5hoocre4p3sp5id_s5pierspil4lcre3atsp3ingspi5nith3oli4creancra4tecras3tbimet55crani5bin4d3spons3spoonspru5dbind3ecous5t3co3trth4is_srep5ucost3aco5rolco3rels5sam24coreds5sengs3sent5th4ioss3er_s5seriss3ers3thinkt5hillbin5etcon4iecon4eyth3eryss4in_s4siness4is_s3s2itss4ivicon4chth3ernco3mo4co5masssol3ut5herds4soreth5erc5colouco3logco3inc4c3oidco3difco3dicsta3bic4lotrs4talebin5i4s3tas_theo3lc3lingbi3re4ste5arste5atbi5rusbisul54s1teds4tedls4tedn4stereth5eas3bituas3terost5est5blastcine5a4cinabs3ti3a3sticks3ticuthal3ms4tilyst3ing5s4tir5cimenth5al_st3lercigar5ci3estch5ousstone3bla5tu5blespblim3as4tose4chotis4tray4chosostrep33strucstru5dbment4tew3arch5oid5chlorstur4echizz4ch3innch4in_ch3ily3chicoche5va3chetech4erltetr5och4eriche3olcha3pa4boledbon4iesu5ingces5trcest5oce3remcer4bites5tusu3pinsupra3sur4ascept3a5testesur3pltest3aboni4ft3ess_bon4spcent4ab3oratbor5eebor5etbor5icter5nobor5iocen5cice4metce5lomter3itt4erinsy4chrcel3aice3darcci3d4ter5ifsy5photer5idcav3ilter3iabot3an3tablica3t2rta3bolta4bout4a3cete3reota3chyta4cidc4atom3casu35t2adjta5dor5terel3cas3scashi4tage5ota5gogca3roucar5oocar5oncar3olcar3nicar3ifter5ecca3reeter3ebta5lept4aliat4alin2tere45tallut2alo43ter3bt4eragtera4c3brachtan5atbran4db4reas5taneltan5iet5aniz4b2rescap3tica5piltent4atark5ican4trte5nog5brief5tennaca3noec2an4eta3stabring5t4ateu3tatist4ato_tat4ouca5nartat3uttau3tobri4osca5lefcal5ar4tenarcab5inb5ut5obut4ivten4ag3butiob5utinbu5tarte5cha5technbus5sibusi4ete5d2abur4rite5monb4ulosb5rist5tegicb5tletbro4mab4stacbso3lubsol3e4teledtel5izbscon4ct4ina", 7:"mor4atobstupe5buf5ferb5u5nattch5ettm3orat4call5inmor5talcan5tarcan5tedcan4tictar5ia_brev5ettant5anca3ra5ctand5er_ad4din5ta3mettam5arit4eratocar5ameboun5tital4l3atal5entmonolo4cas5tigta5chom3teres4ta5blemcaulk4iccent5rcces4sacel5ib5mpel5licel5lincen5ded5ternit4sweredswell5icend5encend5ersvest5isvers5acen5tedt5esses_ama5tem5perercen5testest5ertest5intest5orcep5ticmpet5itchan5gi5cherin4choredchor5olmphal5os5toratblem5atston4iecil5lin4mologu4mologss4tern_ster4iaci5nesscla5rifclemat45static4molog_5therapmogast4ssolu4b4theredcon4aticond5erconta5dcor5dedcord5ermpol5itcost5ercraft5ispon5gicra5niuspital5spic5ulspers5a4thorescret5orspens5ac5tariabi4fid_4sor3iecter4iab5ertinberga5mc5ticiabend5erso5metesoma5toctifi4esolv5erc5tin5o_an4on_ct4ivittici5ar3ti3cint4icityc5torisc5toriz4ticulecull5ercull5inbattle5cur5ialmmel5lislang5idal5lersk5iness5kiest4tific_daun5tede5cantdefor5edel5ler_an3ti34dem4issim4plyb4aniti_ant4icde4mons_an4t5osid5eri5timet4dens5er5ti5nadden5titdeposi4zin4c3i_aph5orshil5lider5minsfact5otin5tedtint5erde5scalmis4tindes5ponse5renedevol5u4tionemdiat5omti5plexseo5logsent5eemi5racu_ar4isedic5tat4scuras4scura__ar4isi5scopic3s4cope5t4istedi5vineti5t4ando5linesca5lendom5inodot4tins5atorydress5oaus4tedtiv5allsassem4dropho4duci5ansant5risan5garaun4dresan4ded_ar5sendust5erault5erdvoc5ataul5tedearth5iea4soni4ryngoleassem4eat5enieat4iturv5ers_rus4t5urus5ticrust5eeatric5urust5at_as5sibrup5licminth5oecad5enruncul5ru4moreecent5oa5tivizecon4sc_ateli4_au3g4uec5rean_aur4e5ect5atiec4t5usrtil5le4at4is__av5erar4theneedeter5edi4alsr5terered5icala4t1i4lediges4at5icizediv5idtori4asrswear4ati5citat5icisedu5cerrstrat4eer4ineefact5oming5li_ba5sicef5ereemin4ersath5eteath5eromin4er__be5r4ae5ignitr5salizmind5err5salisejudic44traistmil5iestrarch4tra5ven_blaz5o4m5iliee4lates_bos5omat5enatelch5errrin5getrend5irri4fy_rran5gie4lesteel3et3o_boun4d_bra5chtri5fli_burn5ieli4ers_ca4ginrou5sel_can5tamigh5tiros5tita5talisro5stattro4pharop4ineemarc5aem5atizemat5ole4m3eraron4tonro5nateem4icisnaffil4romant4emig5rarol5iteass5iblassa5giemon5ola4sonedem5orise4moticempara54empli_en3am3o_cen5sot5tereren4cileen4d5alen4dedlttitud45n4a3grend5ritrn5atine5nellee5nereor4mite_r4ming_en3ig3rmet5icirma5tocr4m3atinannot4en4tersen4tifyarp5ersent5rinr5kiesteol5ar_eologi4aro4mas_clem5eriv5eliri5vallris5ternan5teda5rishi3mesti4epolit5tup5lettup5lic_cop5roepres5erink5erme5si4aring5ie_co5terrim5an4equi5noment5or4tut4ivna5turiera4cierig5ant5rifugaar4donear5dinarif5tiear5chetrift5er4erati_4eratimrick4enrich5omrica5tuaran5teer5esteer5estieres5trre5termar4aged_dea5coaract4irest5erre5stalapu5lareri4ciduant5isuant5itres5ist5er5ickapo5strer4imet_de5lecuar4t5iua5terneri5staren4ter5ernaclmend5errem5atoreman4d_del5egerre5laer5sinere5galiert5er_ert5ersrec4t3rr4e1c2rreci5simelt5er_deli5ran4tone_de5nitan4tinges5idenesi5diur4d1an4rcriti4es3ol3urci5nogant5abludi4cinrch4ieru5dinisrch5ateu5ditiorch5ardes3per3mel5lerrcen5eres5piraanis5teesplen5uen4teres4s3anest5ifi_de5resues5trin4cept_rav5elianel5li4r4atom5ra5tolan4donirat4in_r4as5teand5istrass5in5meg2a1et3al5oand5eerrar5ia_an3d4atrant5inuicent55rantelran5teduild5erran4gennch5oloetell5irad4inencid5enra5culorac5ulaet3er3aet5eria3ra3binet5itivui5val5amphi5gam5peri_de5sirqua5tio4e4trala4mium_et5ressetrib5aaminos4am5inizamini4fp5u5tis5ulchrepush4ieev5eratev5eren4ulenciever4erpu5lar_puff5erevictu4evis5in_de5sisfall5inncip5ie_di4al_fend5erpros5trpropyl5proph5eul4l5ibp3roc3apris5inpring5imbival5nco5pat5pressiyllab5iulp5ingpre5matylin5dem4b3ingnct4ivife5veriffec4te_du4al_pprob5am5bererum4bar__echin5fi5anceal5tatipparat5pout5ern4curviumi5liaumin4aru4minedu4m3ingpoult5epor5tieal4orim4poratopon4i4eflo5rical4lish_ed4it_foment4_ed4itialli5anplum4befor4m3a_el3ev3fratch4pla5t4oma5turem4atizafrost5ipis5tilmat4itifuel5ligal5lerpill5ingang5ergariz4aunho5lial5ipotgass5inph5oriz4phonedgest5atg5gererphant5ipha5gedgiv5en_5glass_unk5eripet5allal5endepes5tilpert5isper5tinper4os_al5ance5p4er3nperem5indeleg4gna5turndepre4aint5eruodent4pend5er4gogram_en4dedpearl5indes5crgth5enimas4tinpat4richad4inepas4tinnd5is4ihak4inehal5anthan4crohar5dieha5rismhar4tedaet4or_aerody5pag4atihaught5_er5em5hearch44urantiheav5enurb5ingoxic5olowhith4ur5den_ur5deniowel5lih5erettovid5ennd5ism_her5ialh5erineout5ishoun5ginound5elhet4tedact5oryu5ri5cuheumat5ur5ifieact5ileought5ihi3c4anuri4os_h4i4ersh4manicurl5ingact5atemast4ichnocen5_men5taaci4erso5thermmar4shimantel5ot5estaurpen5tach5isma5chinihol4is_ot4atioot4anico5talito5stome5acanthost5icaosten5tost5ageh4op4te3house3hras5eoy4chosen5ectom4abolicht5eneror5tes_man4icay5chedei5a4g5oori5cidialect4or5este_escal5iatur4aorator5_wine5s_vo5lutich5ingo5quial_etern5us5ticiic4tedloplast4ophy5laid4ines4operag2i4d1itoost5eriff5leronvo5lui4ficaconti5fiman5dar_vic5to_fal4lemament4mal4is__ver4ieila5telonical4i5later_feoff5ili4arl_va5ledil4ificond5ent_ur5eth5ond5arut4toneil5ine_on5ativonast5i_under5ompt5eromot5ivi4matedi4matin_fi5liaimpar5a_fil5tro5lunte4inalit_tular5olon5el5neringinator5_tro4ph_fis4c5inc4tua_trin4aol4lopeoli4f3eol5ies_mal5ari_tran4c_tit4isnerv5inval4iseol5icizinfilt5olat5erin4itud_gam5etxter4m3ink4inein4sch5_tell5evas5el5insect5insec5uinsolv5int5essvat4inaoher4erint5res_tamar5xtens5o_tact4iinvol5ui4omani_gen4et_gen5iave5linei5pheriip5torivel5lerir4alinvel5opiir4alliirassi4nfortu5irl5ingirwo4meo4ducts4lut5arv5en5ue_stat4o_si5gnoverde5v4v4ere4o4duct_odu5cerodis5iaocus5siis5onerist5encxotrop4_ser4ie5vialitist5entochro4n_gnost4_sec5tovi5cariocess4iis4t3iclum4brio5calli4is4tom4itioneit5ress3vili4av5ilisev5ilizevil5linoast5eritu4als_han4de_hast5ii4vers__sa5linlsi4fiai5vilit5ivist_5ivistsnvoc5at_ho5rol_rol4lakinema4ni4cul4nultim5_re5strloth4ie5la5collos5sienight5ilor4ife_re5spolor5iatntup5li5lo5pen_re5sen_res5ci_re5linnt5ressn4trant_re5garloom5erxhort4a_ran5gilong5invol4ubi_ra5cem_put4ten5tition4tiparlo4cus__pos5si_lash4e_len5tint5ing_nit5res_le5vanxecut5o_plica4n4tify__plast45latini_phon4illow5er_li4onslligat4_peri5nntic4u4_pen5dewall5ern5ticizwan5gliwank5erwar5dedward5ern5ticisnth5ine_lo4giawar5thinmater4_pec3t4_pa4tiowav4ine_lous5i_para5t_par5af_lov5ernmor5ti_orner4nt5ativ_or5che_ma5lin_mar5ti_or4at4le5ation5tasiswel4izint4ariun4t3antntan5eon4t3ancleav5erl3eb5rannel5li_nucle5_no5ticlem5enclen5darwill5in_ni5tronsec4tewing5er4lentio5l4eriannerv5a_nas5tinres5tr5le5tu5lev5itano5blemnovel5el3ic3onwol5ver_mor5tilift5erlight5ilimet4e_mo5lec5lin3ealin4er_lin4erslin4gern5ocula_min5uenobser4_met4er_me5rin_me5ridmas4ted",8:"_musi5cobserv5anwith5erilect5icaweight5ica5laman_mal5ad5l5di5nestast5i4cntend5enntern5alnter5nat_perse5c_pe5titi_phe5nomxe5cutio5latiliz_librar5nt5ilati_les5son_po5lite_ac5tiva5latilisnis5tersnis5ter_tamorph5_pro5batvo5litiolan5tine_ref5eremophil5ila5melli_re5statca3r4i3c5lamandrcen5ter_5visecti5numentanvers5aniver5saliv5eling_salt5ercen5ters_ha5bilio4c5ativlunch5eois5terer_sev5era_glor5io_stra5tocham5perstor5ianstil5ler_ge5neti_sulph5a_tac5ticnform5eroin4t5erneuma5to_te5ra5tma5chinecine5mat_tri5bal_fran5ch_tri5sti_fi5n4it_troph5o_fin5essimparad5stant5iv_vent5il4o5nomicssor5ialight5ersight5er__evol5utm5ament_ont5ane_icotyle5orest5atiab5oliziab5olismod5ifiehrill5inothalam5oth5erinnduct5ivrth5ing_otherm5a5ot5inizov5elinghav5ersipass5ivessent5ermater5n4ain5dersuo5tatiopens5atipercent5slav5eriplant5er5sing5erfortu5naplumb5erpo5lemicpound5erffranch5ppress5oa5lumnia_domest5pref5ereprel5atea5marinepre5scina5m4aticpring5ertil4l5agmmand5er5sid5u4a_de5spoievol5utee5tometeetend5erting5ingmed5icatran5dishm5ed5ieset5allis_de5servsh5inessmlo5cutiuest5ratncent5rincarn5atdes5ignareact5ivr5ebratereced5ennbarric5sen5sorier5nalisuar5tersre4t4er3_custom5naugh5tirill5er_sen5sati5scripti_cotyle5e4p5rob5a5ri5netaun5chierin4t5errip5lica_art5icl5at5ressepend5entu4al5lir5ma5tolttitu5di_cent5ria5torianena5ture5na5geri_cas5ualromolec5elom5ateatitud5i_ca5pituround5ernac5tiva_at5omizrpass5intomat5oltrifu5gae4l3ica4rpret5erel5ativetrav5esttra5versat5ernisat5ernizefor5estath5erinef5initeto5talizto5talis_barri5c_authen5mass5ing",9:"_bap5tismna5cious_econstit5na5ciousl_at5omisena5culari_cen5tena_clima5toepe5titionar5tisti_cri5ticirill5ingserpent5inrcen5tenaest5igati_de5scrib_de5signe_determ5ifals5ifiefan5tasizplas5ticiundeter5msmu5tatiopa5triciaosclero5s_fec5unda_ulti5matindeterm5ipart5ite_string5i5lutionizltramont5_re5storeter5iorit_invest5imonolog5introl5ler_lam5enta_po5sitio_para5dis_ora5tori_me5lodio"}}; //# sourceMappingURL=en-gb.min.js.map
src/DetailsSection/Table/VirtualScrollTable.js
conferenceradar/list
import React, { Component } from 'react'; import Griddle, { plugins, RowDefinition, ColumnDefinition, } from 'griddle-react'; import UpdatePlugin from '../UpdatePlugin'; import Name from './Name'; import Empty from './Empty'; import Location from './Location'; import Industry from './Industry'; import Layout from './Layout'; import NoResults from '../NoResults'; import Filter from './Filter'; import { sortMethod, locationSortMethod, indusrySortMethod } from '../../utils/sort'; import EventDate from './EventDate'; import Status from './Status'; import FavoriteColumn from './FavoriteColumn'; import enhanceWithRowData from '../../utils/withRowData'; export default class VirtualScrollTable extends Component { render() { const { data } = this.props; return ( <Griddle data={data} plugins={[ UpdatePlugin, plugins.LocalPlugin, plugins.PositionPlugin({ tableHeight: 799, rowHeight: 92 }) ]} pageProperties={{ pageSize: 1000000 }} styleConfig={{ classNames: { Table: 'table' } }} components={{ Filter: Filter, SettingsToggle: Empty, Pagination: Empty, Layout: Layout, NoResults }} > <RowDefinition> <ColumnDefinition id='name' title="Name" order={1} customComponent={enhanceWithRowData(Name)} sortMethod={sortMethod} /> <ColumnDefinition id='city' title="Location" order={2} customComponent={enhanceWithRowData(Location)} sortMethod={locationSortMethod} /> <ColumnDefinition id='industry' title='Industry' order={3} customComponent={enhanceWithRowData(Industry)} sortMethod={indusrySortMethod} /> <ColumnDefinition id='eventStartDate' title='Event Date' order={4} customComponent={enhanceWithRowData(EventDate)} sortMethod={sortMethod} /> <ColumnDefinition id='status' title='Status' order={5} customComponent={enhanceWithRowData(Status)} sortMethod={sortMethod} /> </RowDefinition> </Griddle> ) } }
ajax/libs/pdf.js/2.0.106/pdf.js
extend1994/cdnjs
/* Copyright 2017 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define("pdfjs-dist/build/pdf", [], factory); else if(typeof exports === 'object') exports["pdfjs-dist/build/pdf"] = factory(); else root["pdfjs-dist/build/pdf"] = root.pdfjsDistBuildPdf = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __w_pdfjs_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __w_pdfjs_require__.m = modules; /******/ /******/ // expose the module cache /******/ __w_pdfjs_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __w_pdfjs_require__.d = function(exports, name, getter) { /******/ if(!__w_pdfjs_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __w_pdfjs_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __w_pdfjs_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __w_pdfjs_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __w_pdfjs_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __w_pdfjs_require__(__w_pdfjs_require__.s = 63); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.unreachable = exports.warn = exports.utf8StringToString = exports.stringToUTF8String = exports.stringToPDFString = exports.stringToBytes = exports.string32 = exports.shadow = exports.setVerbosityLevel = exports.ReadableStream = exports.removeNullCharacters = exports.readUint32 = exports.readUint16 = exports.readInt8 = exports.log2 = exports.loadJpegStream = exports.isEvalSupported = exports.isLittleEndian = exports.createValidAbsoluteUrl = exports.isSameOrigin = exports.isNodeJS = exports.isSpace = exports.isString = exports.isNum = exports.isEmptyObj = exports.isBool = exports.isArrayBuffer = exports.info = exports.getVerbosityLevel = exports.getLookupTableFactory = exports.deprecated = exports.createObjectURL = exports.createPromiseCapability = exports.createBlob = exports.bytesToString = exports.assert = exports.arraysToBytes = exports.arrayByteLength = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.StatTimer = exports.PasswordResponses = exports.PasswordException = exports.PageViewport = exports.NotImplementedException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.MessageHandler = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VERBOSITY_LEVELS = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = undefined; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; __w_pdfjs_require__(64); var _streams_polyfill = __w_pdfjs_require__(111); var FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0]; var NativeImageDecoding = { NONE: 'none', DECODE: 'decode', DISPLAY: 'display' }; var TextRenderingMode = { FILL: 0, STROKE: 1, FILL_STROKE: 2, INVISIBLE: 3, FILL_ADD_TO_PATH: 4, STROKE_ADD_TO_PATH: 5, FILL_STROKE_ADD_TO_PATH: 6, ADD_TO_PATH: 7, FILL_STROKE_MASK: 3, ADD_TO_PATH_FLAG: 4 }; var ImageKind = { GRAYSCALE_1BPP: 1, RGB_24BPP: 2, RGBA_32BPP: 3 }; var AnnotationType = { TEXT: 1, LINK: 2, FREETEXT: 3, LINE: 4, SQUARE: 5, CIRCLE: 6, POLYGON: 7, POLYLINE: 8, HIGHLIGHT: 9, UNDERLINE: 10, SQUIGGLY: 11, STRIKEOUT: 12, STAMP: 13, CARET: 14, INK: 15, POPUP: 16, FILEATTACHMENT: 17, SOUND: 18, MOVIE: 19, WIDGET: 20, SCREEN: 21, PRINTERMARK: 22, TRAPNET: 23, WATERMARK: 24, THREED: 25, REDACT: 26 }; var AnnotationFlag = { INVISIBLE: 0x01, HIDDEN: 0x02, PRINT: 0x04, NOZOOM: 0x08, NOROTATE: 0x10, NOVIEW: 0x20, READONLY: 0x40, LOCKED: 0x80, TOGGLENOVIEW: 0x100, LOCKEDCONTENTS: 0x200 }; var AnnotationFieldFlag = { READONLY: 0x0000001, REQUIRED: 0x0000002, NOEXPORT: 0x0000004, MULTILINE: 0x0001000, PASSWORD: 0x0002000, NOTOGGLETOOFF: 0x0004000, RADIO: 0x0008000, PUSHBUTTON: 0x0010000, COMBO: 0x0020000, EDIT: 0x0040000, SORT: 0x0080000, FILESELECT: 0x0100000, MULTISELECT: 0x0200000, DONOTSPELLCHECK: 0x0400000, DONOTSCROLL: 0x0800000, COMB: 0x1000000, RICHTEXT: 0x2000000, RADIOSINUNISON: 0x2000000, COMMITONSELCHANGE: 0x4000000 }; var AnnotationBorderStyleType = { SOLID: 1, DASHED: 2, BEVELED: 3, INSET: 4, UNDERLINE: 5 }; var StreamType = { UNKNOWN: 0, FLATE: 1, LZW: 2, DCT: 3, JPX: 4, JBIG: 5, A85: 6, AHX: 7, CCF: 8, RL: 9 }; var FontType = { UNKNOWN: 0, TYPE1: 1, TYPE1C: 2, CIDFONTTYPE0: 3, CIDFONTTYPE0C: 4, TRUETYPE: 5, CIDFONTTYPE2: 6, TYPE3: 7, OPENTYPE: 8, TYPE0: 9, MMTYPE1: 10 }; var VERBOSITY_LEVELS = { errors: 0, warnings: 1, infos: 5 }; var CMapCompressionType = { NONE: 0, BINARY: 1, STREAM: 2 }; var OPS = { dependency: 1, setLineWidth: 2, setLineCap: 3, setLineJoin: 4, setMiterLimit: 5, setDash: 6, setRenderingIntent: 7, setFlatness: 8, setGState: 9, save: 10, restore: 11, transform: 12, moveTo: 13, lineTo: 14, curveTo: 15, curveTo2: 16, curveTo3: 17, closePath: 18, rectangle: 19, stroke: 20, closeStroke: 21, fill: 22, eoFill: 23, fillStroke: 24, eoFillStroke: 25, closeFillStroke: 26, closeEOFillStroke: 27, endPath: 28, clip: 29, eoClip: 30, beginText: 31, endText: 32, setCharSpacing: 33, setWordSpacing: 34, setHScale: 35, setLeading: 36, setFont: 37, setTextRenderingMode: 38, setTextRise: 39, moveText: 40, setLeadingMoveText: 41, setTextMatrix: 42, nextLine: 43, showText: 44, showSpacedText: 45, nextLineShowText: 46, nextLineSetSpacingShowText: 47, setCharWidth: 48, setCharWidthAndBounds: 49, setStrokeColorSpace: 50, setFillColorSpace: 51, setStrokeColor: 52, setStrokeColorN: 53, setFillColor: 54, setFillColorN: 55, setStrokeGray: 56, setFillGray: 57, setStrokeRGBColor: 58, setFillRGBColor: 59, setStrokeCMYKColor: 60, setFillCMYKColor: 61, shadingFill: 62, beginInlineImage: 63, beginImageData: 64, endInlineImage: 65, paintXObject: 66, markPoint: 67, markPointProps: 68, beginMarkedContent: 69, beginMarkedContentProps: 70, endMarkedContent: 71, beginCompat: 72, endCompat: 73, paintFormXObjectBegin: 74, paintFormXObjectEnd: 75, beginGroup: 76, endGroup: 77, beginAnnotations: 78, endAnnotations: 79, beginAnnotation: 80, endAnnotation: 81, paintJpegXObject: 82, paintImageMaskXObject: 83, paintImageMaskXObjectGroup: 84, paintImageXObject: 85, paintInlineImageXObject: 86, paintInlineImageXObjectGroup: 87, paintImageXObjectRepeat: 88, paintImageMaskXObjectRepeat: 89, paintSolidColorImageMask: 90, constructPath: 91 }; var verbosity = VERBOSITY_LEVELS.warnings; function setVerbosityLevel(level) { verbosity = level; } function getVerbosityLevel() { return verbosity; } function info(msg) { if (verbosity >= VERBOSITY_LEVELS.infos) { console.log('Info: ' + msg); } } function warn(msg) { if (verbosity >= VERBOSITY_LEVELS.warnings) { console.log('Warning: ' + msg); } } function deprecated(details) { console.log('Deprecated API usage: ' + details); } function unreachable(msg) { throw new Error(msg); } function assert(cond, msg) { if (!cond) { unreachable(msg); } } var UNSUPPORTED_FEATURES = { unknown: 'unknown', forms: 'forms', javaScript: 'javaScript', smask: 'smask', shadingPattern: 'shadingPattern', font: 'font' }; function isSameOrigin(baseUrl, otherUrl) { try { var base = new URL(baseUrl); if (!base.origin || base.origin === 'null') { return false; } } catch (e) { return false; } var other = new URL(otherUrl, base); return base.origin === other.origin; } function isValidProtocol(url) { if (!url) { return false; } switch (url.protocol) { case 'http:': case 'https:': case 'ftp:': case 'mailto:': case 'tel:': return true; default: return false; } } function createValidAbsoluteUrl(url, baseUrl) { if (!url) { return null; } try { var absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url); if (isValidProtocol(absoluteUrl)) { return absoluteUrl; } } catch (ex) {} return null; } function shadow(obj, prop, value) { Object.defineProperty(obj, prop, { value: value, enumerable: true, configurable: true, writable: false }); return value; } function getLookupTableFactory(initializer) { var lookup; return function () { if (initializer) { lookup = Object.create(null); initializer(lookup); initializer = null; } return lookup; }; } var PasswordResponses = { NEED_PASSWORD: 1, INCORRECT_PASSWORD: 2 }; var PasswordException = function PasswordExceptionClosure() { function PasswordException(msg, code) { this.name = 'PasswordException'; this.message = msg; this.code = code; } PasswordException.prototype = new Error(); PasswordException.constructor = PasswordException; return PasswordException; }(); var UnknownErrorException = function UnknownErrorExceptionClosure() { function UnknownErrorException(msg, details) { this.name = 'UnknownErrorException'; this.message = msg; this.details = details; } UnknownErrorException.prototype = new Error(); UnknownErrorException.constructor = UnknownErrorException; return UnknownErrorException; }(); var InvalidPDFException = function InvalidPDFExceptionClosure() { function InvalidPDFException(msg) { this.name = 'InvalidPDFException'; this.message = msg; } InvalidPDFException.prototype = new Error(); InvalidPDFException.constructor = InvalidPDFException; return InvalidPDFException; }(); var MissingPDFException = function MissingPDFExceptionClosure() { function MissingPDFException(msg) { this.name = 'MissingPDFException'; this.message = msg; } MissingPDFException.prototype = new Error(); MissingPDFException.constructor = MissingPDFException; return MissingPDFException; }(); var UnexpectedResponseException = function UnexpectedResponseExceptionClosure() { function UnexpectedResponseException(msg, status) { this.name = 'UnexpectedResponseException'; this.message = msg; this.status = status; } UnexpectedResponseException.prototype = new Error(); UnexpectedResponseException.constructor = UnexpectedResponseException; return UnexpectedResponseException; }(); var NotImplementedException = function NotImplementedExceptionClosure() { function NotImplementedException(msg) { this.message = msg; } NotImplementedException.prototype = new Error(); NotImplementedException.prototype.name = 'NotImplementedException'; NotImplementedException.constructor = NotImplementedException; return NotImplementedException; }(); var MissingDataException = function MissingDataExceptionClosure() { function MissingDataException(begin, end) { this.begin = begin; this.end = end; this.message = 'Missing data [' + begin + ', ' + end + ')'; } MissingDataException.prototype = new Error(); MissingDataException.prototype.name = 'MissingDataException'; MissingDataException.constructor = MissingDataException; return MissingDataException; }(); var XRefParseException = function XRefParseExceptionClosure() { function XRefParseException(msg) { this.message = msg; } XRefParseException.prototype = new Error(); XRefParseException.prototype.name = 'XRefParseException'; XRefParseException.constructor = XRefParseException; return XRefParseException; }(); var FormatError = function FormatErrorClosure() { function FormatError(msg) { this.message = msg; } FormatError.prototype = new Error(); FormatError.prototype.name = 'FormatError'; FormatError.constructor = FormatError; return FormatError; }(); var AbortException = function AbortExceptionClosure() { function AbortException(msg) { this.name = 'AbortException'; this.message = msg; } AbortException.prototype = new Error(); AbortException.constructor = AbortException; return AbortException; }(); var NullCharactersRegExp = /\x00/g; function removeNullCharacters(str) { if (typeof str !== 'string') { warn('The argument for removeNullCharacters must be a string.'); return str; } return str.replace(NullCharactersRegExp, ''); } function bytesToString(bytes) { assert(bytes !== null && (typeof bytes === 'undefined' ? 'undefined' : _typeof(bytes)) === 'object' && bytes.length !== undefined, 'Invalid argument for bytesToString'); var length = bytes.length; var MAX_ARGUMENT_COUNT = 8192; if (length < MAX_ARGUMENT_COUNT) { return String.fromCharCode.apply(null, bytes); } var strBuf = []; for (var i = 0; i < length; i += MAX_ARGUMENT_COUNT) { var chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length); var chunk = bytes.subarray(i, chunkEnd); strBuf.push(String.fromCharCode.apply(null, chunk)); } return strBuf.join(''); } function stringToBytes(str) { assert(typeof str === 'string', 'Invalid argument for stringToBytes'); var length = str.length; var bytes = new Uint8Array(length); for (var i = 0; i < length; ++i) { bytes[i] = str.charCodeAt(i) & 0xFF; } return bytes; } function arrayByteLength(arr) { if (arr.length !== undefined) { return arr.length; } assert(arr.byteLength !== undefined); return arr.byteLength; } function arraysToBytes(arr) { if (arr.length === 1 && arr[0] instanceof Uint8Array) { return arr[0]; } var resultLength = 0; var i, ii = arr.length; var item, itemLength; for (i = 0; i < ii; i++) { item = arr[i]; itemLength = arrayByteLength(item); resultLength += itemLength; } var pos = 0; var data = new Uint8Array(resultLength); for (i = 0; i < ii; i++) { item = arr[i]; if (!(item instanceof Uint8Array)) { if (typeof item === 'string') { item = stringToBytes(item); } else { item = new Uint8Array(item); } } itemLength = item.byteLength; data.set(item, pos); pos += itemLength; } return data; } function string32(value) { return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff); } function log2(x) { var n = 1, i = 0; while (x > n) { n <<= 1; i++; } return i; } function readInt8(data, start) { return data[start] << 24 >> 24; } function readUint16(data, offset) { return data[offset] << 8 | data[offset + 1]; } function readUint32(data, offset) { return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0; } function isLittleEndian() { var buffer8 = new Uint8Array(4); buffer8[0] = 1; var view32 = new Uint32Array(buffer8.buffer, 0, 1); return view32[0] === 1; } function isEvalSupported() { try { new Function(''); return true; } catch (e) { return false; } } var IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0]; var Util = function UtilClosure() { function Util() {} var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')']; Util.makeCssRgb = function Util_makeCssRgb(r, g, b) { rgbBuf[1] = r; rgbBuf[3] = g; rgbBuf[5] = b; return rgbBuf.join(''); }; Util.transform = function Util_transform(m1, m2) { return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]]; }; Util.applyTransform = function Util_applyTransform(p, m) { var xt = p[0] * m[0] + p[1] * m[2] + m[4]; var yt = p[0] * m[1] + p[1] * m[3] + m[5]; return [xt, yt]; }; Util.applyInverseTransform = function Util_applyInverseTransform(p, m) { var d = m[0] * m[3] - m[1] * m[2]; var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d; var yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d; return [xt, yt]; }; Util.getAxialAlignedBoundingBox = function Util_getAxialAlignedBoundingBox(r, m) { var p1 = Util.applyTransform(r, m); var p2 = Util.applyTransform(r.slice(2, 4), m); var p3 = Util.applyTransform([r[0], r[3]], m); var p4 = Util.applyTransform([r[2], r[1]], m); return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])]; }; Util.inverseTransform = function Util_inverseTransform(m) { var d = m[0] * m[3] - m[1] * m[2]; return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d]; }; Util.apply3dTransform = function Util_apply3dTransform(m, v) { return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]]; }; Util.singularValueDecompose2dScale = function Util_singularValueDecompose2dScale(m) { var transpose = [m[0], m[2], m[1], m[3]]; var a = m[0] * transpose[0] + m[1] * transpose[2]; var b = m[0] * transpose[1] + m[1] * transpose[3]; var c = m[2] * transpose[0] + m[3] * transpose[2]; var d = m[2] * transpose[1] + m[3] * transpose[3]; var first = (a + d) / 2; var second = Math.sqrt((a + d) * (a + d) - 4 * (a * d - c * b)) / 2; var sx = first + second || 1; var sy = first - second || 1; return [Math.sqrt(sx), Math.sqrt(sy)]; }; Util.normalizeRect = function Util_normalizeRect(rect) { var r = rect.slice(0); if (rect[0] > rect[2]) { r[0] = rect[2]; r[2] = rect[0]; } if (rect[1] > rect[3]) { r[1] = rect[3]; r[3] = rect[1]; } return r; }; Util.intersect = function Util_intersect(rect1, rect2) { function compare(a, b) { return a - b; } var orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare), orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare), result = []; rect1 = Util.normalizeRect(rect1); rect2 = Util.normalizeRect(rect2); if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) { result[0] = orderedX[1]; result[2] = orderedX[2]; } else { return false; } if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) { result[1] = orderedY[1]; result[3] = orderedY[2]; } else { return false; } return result; }; var ROMAN_NUMBER_MAP = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX']; Util.toRoman = function Util_toRoman(number, lowerCase) { assert(Number.isInteger(number) && number > 0, 'The number should be a positive integer.'); var pos, romanBuf = []; while (number >= 1000) { number -= 1000; romanBuf.push('M'); } pos = number / 100 | 0; number %= 100; romanBuf.push(ROMAN_NUMBER_MAP[pos]); pos = number / 10 | 0; number %= 10; romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]); romanBuf.push(ROMAN_NUMBER_MAP[20 + number]); var romanStr = romanBuf.join(''); return lowerCase ? romanStr.toLowerCase() : romanStr; }; Util.appendToArray = function Util_appendToArray(arr1, arr2) { Array.prototype.push.apply(arr1, arr2); }; Util.prependToArray = function Util_prependToArray(arr1, arr2) { Array.prototype.unshift.apply(arr1, arr2); }; Util.extendObj = function extendObj(obj1, obj2) { for (var key in obj2) { obj1[key] = obj2[key]; } }; Util.getInheritableProperty = function Util_getInheritableProperty(dict, name, getArray) { while (dict && !dict.has(name)) { dict = dict.get('Parent'); } if (!dict) { return null; } return getArray ? dict.getArray(name) : dict.get(name); }; Util.inherit = function Util_inherit(sub, base, prototype) { sub.prototype = Object.create(base.prototype); sub.prototype.constructor = sub; for (var prop in prototype) { sub.prototype[prop] = prototype[prop]; } }; Util.loadScript = function Util_loadScript(src, callback) { var script = document.createElement('script'); var loaded = false; script.setAttribute('src', src); if (callback) { script.onload = function () { if (!loaded) { callback(); } loaded = true; }; } document.getElementsByTagName('head')[0].appendChild(script); }; return Util; }(); var PageViewport = function PageViewportClosure() { function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) { this.viewBox = viewBox; this.scale = scale; this.rotation = rotation; this.offsetX = offsetX; this.offsetY = offsetY; var centerX = (viewBox[2] + viewBox[0]) / 2; var centerY = (viewBox[3] + viewBox[1]) / 2; var rotateA, rotateB, rotateC, rotateD; rotation = rotation % 360; rotation = rotation < 0 ? rotation + 360 : rotation; switch (rotation) { case 180: rotateA = -1; rotateB = 0; rotateC = 0; rotateD = 1; break; case 90: rotateA = 0; rotateB = 1; rotateC = 1; rotateD = 0; break; case 270: rotateA = 0; rotateB = -1; rotateC = -1; rotateD = 0; break; default: rotateA = 1; rotateB = 0; rotateC = 0; rotateD = -1; break; } if (dontFlip) { rotateC = -rotateC; rotateD = -rotateD; } var offsetCanvasX, offsetCanvasY; var width, height; if (rotateA === 0) { offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX; offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY; width = Math.abs(viewBox[3] - viewBox[1]) * scale; height = Math.abs(viewBox[2] - viewBox[0]) * scale; } else { offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX; offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY; width = Math.abs(viewBox[2] - viewBox[0]) * scale; height = Math.abs(viewBox[3] - viewBox[1]) * scale; } this.transform = [rotateA * scale, rotateB * scale, rotateC * scale, rotateD * scale, offsetCanvasX - rotateA * scale * centerX - rotateC * scale * centerY, offsetCanvasY - rotateB * scale * centerX - rotateD * scale * centerY]; this.width = width; this.height = height; this.fontScale = scale; } PageViewport.prototype = { clone: function PageViewPort_clone(args) { args = args || {}; var scale = 'scale' in args ? args.scale : this.scale; var rotation = 'rotation' in args ? args.rotation : this.rotation; return new PageViewport(this.viewBox.slice(), scale, rotation, this.offsetX, this.offsetY, args.dontFlip); }, convertToViewportPoint: function PageViewport_convertToViewportPoint(x, y) { return Util.applyTransform([x, y], this.transform); }, convertToViewportRectangle: function PageViewport_convertToViewportRectangle(rect) { var tl = Util.applyTransform([rect[0], rect[1]], this.transform); var br = Util.applyTransform([rect[2], rect[3]], this.transform); return [tl[0], tl[1], br[0], br[1]]; }, convertToPdfPoint: function PageViewport_convertToPdfPoint(x, y) { return Util.applyInverseTransform([x, y], this.transform); } }; return PageViewport; }(); var PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2D8, 0x2C7, 0x2C6, 0x2D9, 0x2DD, 0x2DB, 0x2DA, 0x2DC, 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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203A, 0x2212, 0x2030, 0x201E, 0x201C, 0x201D, 0x2018, 0x2019, 0x201A, 0x2122, 0xFB01, 0xFB02, 0x141, 0x152, 0x160, 0x178, 0x17D, 0x131, 0x142, 0x153, 0x161, 0x17E, 0, 0x20AC]; function stringToPDFString(str) { var i, n = str.length, strBuf = []; if (str[0] === '\xFE' && str[1] === '\xFF') { for (i = 2; i < n; i += 2) { strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1))); } } else { for (i = 0; i < n; ++i) { var code = PDFStringTranslateTable[str.charCodeAt(i)]; strBuf.push(code ? String.fromCharCode(code) : str.charAt(i)); } } return strBuf.join(''); } function stringToUTF8String(str) { return decodeURIComponent(escape(str)); } function utf8StringToString(str) { return unescape(encodeURIComponent(str)); } function isEmptyObj(obj) { for (var key in obj) { return false; } return true; } function isBool(v) { return typeof v === 'boolean'; } function isNum(v) { return typeof v === 'number'; } function isString(v) { return typeof v === 'string'; } function isArrayBuffer(v) { return (typeof v === 'undefined' ? 'undefined' : _typeof(v)) === 'object' && v !== null && v.byteLength !== undefined; } function isSpace(ch) { return ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A; } function isNodeJS() { return (typeof process === 'undefined' ? 'undefined' : _typeof(process)) === 'object' && process + '' === '[object process]'; } function createPromiseCapability() { var capability = {}; capability.promise = new Promise(function (resolve, reject) { capability.resolve = resolve; capability.reject = reject; }); return capability; } var StatTimer = function StatTimerClosure() { function rpad(str, pad, length) { while (str.length < length) { str += pad; } return str; } function StatTimer() { this.started = Object.create(null); this.times = []; this.enabled = true; } StatTimer.prototype = { time: function StatTimer_time(name) { if (!this.enabled) { return; } if (name in this.started) { warn('Timer is already running for ' + name); } this.started[name] = Date.now(); }, timeEnd: function StatTimer_timeEnd(name) { if (!this.enabled) { return; } if (!(name in this.started)) { warn('Timer has not been started for ' + name); } this.times.push({ 'name': name, 'start': this.started[name], 'end': Date.now() }); delete this.started[name]; }, toString: function StatTimer_toString() { var i, ii; var times = this.times; var out = ''; var longest = 0; for (i = 0, ii = times.length; i < ii; ++i) { var name = times[i]['name']; if (name.length > longest) { longest = name.length; } } for (i = 0, ii = times.length; i < ii; ++i) { var span = times[i]; var duration = span.end - span.start; out += rpad(span['name'], ' ', longest) + ' ' + duration + 'ms\n'; } return out; } }; return StatTimer; }(); var createBlob = function createBlob(data, contentType) { if (typeof Blob !== 'undefined') { return new Blob([data], { type: contentType }); } throw new Error('The "Blob" constructor is not supported.'); }; var createObjectURL = function createObjectURLClosure() { var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; return function createObjectURL(data, contentType) { var forceDataSchema = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (!forceDataSchema && URL.createObjectURL) { var blob = createBlob(data, contentType); return URL.createObjectURL(blob); } var buffer = 'data:' + contentType + ';base64,'; for (var i = 0, ii = data.length; i < ii; i += 3) { var b1 = data[i] & 0xFF; var b2 = data[i + 1] & 0xFF; var b3 = data[i + 2] & 0xFF; var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4; var d3 = i + 1 < ii ? (b2 & 0xF) << 2 | b3 >> 6 : 64; var d4 = i + 2 < ii ? b3 & 0x3F : 64; buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4]; } return buffer; }; }(); function resolveCall(fn, args) { var thisArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; if (!fn) { return Promise.resolve(undefined); } return new Promise(function (resolve, reject) { resolve(fn.apply(thisArg, args)); }); } function wrapReason(reason) { if ((typeof reason === 'undefined' ? 'undefined' : _typeof(reason)) !== 'object') { return reason; } switch (reason.name) { case 'AbortException': return new AbortException(reason.message); case 'MissingPDFException': return new MissingPDFException(reason.message); case 'UnexpectedResponseException': return new UnexpectedResponseException(reason.message, reason.status); default: return new UnknownErrorException(reason.message, reason.details); } } function makeReasonSerializable(reason) { if (!(reason instanceof Error) || reason instanceof AbortException || reason instanceof MissingPDFException || reason instanceof UnexpectedResponseException || reason instanceof UnknownErrorException) { return reason; } return new UnknownErrorException(reason.message, reason.toString()); } function resolveOrReject(capability, success, reason) { if (success) { capability.resolve(); } else { capability.reject(reason); } } function finalize(promise) { return Promise.resolve(promise).catch(function () {}); } function MessageHandler(sourceName, targetName, comObj) { var _this = this; this.sourceName = sourceName; this.targetName = targetName; this.comObj = comObj; this.callbackId = 1; this.streamId = 1; this.postMessageTransfers = true; this.streamSinks = Object.create(null); this.streamControllers = Object.create(null); var callbacksCapabilities = this.callbacksCapabilities = Object.create(null); var ah = this.actionHandler = Object.create(null); this._onComObjOnMessage = function (event) { var data = event.data; if (data.targetName !== _this.sourceName) { return; } if (data.stream) { _this._processStreamMessage(data); } else if (data.isReply) { var callbackId = data.callbackId; if (data.callbackId in callbacksCapabilities) { var callback = callbacksCapabilities[callbackId]; delete callbacksCapabilities[callbackId]; if ('error' in data) { callback.reject(wrapReason(data.error)); } else { callback.resolve(data.data); } } else { throw new Error('Cannot resolve callback ' + callbackId); } } else if (data.action in ah) { var action = ah[data.action]; if (data.callbackId) { var _sourceName = _this.sourceName; var _targetName = data.sourceName; Promise.resolve().then(function () { return action[0].call(action[1], data.data); }).then(function (result) { comObj.postMessage({ sourceName: _sourceName, targetName: _targetName, isReply: true, callbackId: data.callbackId, data: result }); }, function (reason) { comObj.postMessage({ sourceName: _sourceName, targetName: _targetName, isReply: true, callbackId: data.callbackId, error: makeReasonSerializable(reason) }); }); } else if (data.streamId) { _this._createStreamSink(data); } else { action[0].call(action[1], data.data); } } else { throw new Error('Unknown action from worker: ' + data.action); } }; comObj.addEventListener('message', this._onComObjOnMessage); } MessageHandler.prototype = { on: function on(actionName, handler, scope) { var ah = this.actionHandler; if (ah[actionName]) { throw new Error('There is already an actionName called "' + actionName + '"'); } ah[actionName] = [handler, scope]; }, send: function send(actionName, data, transfers) { var message = { sourceName: this.sourceName, targetName: this.targetName, action: actionName, data: data }; this.postMessage(message, transfers); }, sendWithPromise: function sendWithPromise(actionName, data, transfers) { var callbackId = this.callbackId++; var message = { sourceName: this.sourceName, targetName: this.targetName, action: actionName, data: data, callbackId: callbackId }; var capability = createPromiseCapability(); this.callbacksCapabilities[callbackId] = capability; try { this.postMessage(message, transfers); } catch (e) { capability.reject(e); } return capability.promise; }, sendWithStream: function sendWithStream(actionName, data, queueingStrategy, transfers) { var _this2 = this; var streamId = this.streamId++; var sourceName = this.sourceName; var targetName = this.targetName; return new _streams_polyfill.ReadableStream({ start: function start(controller) { var startCapability = createPromiseCapability(); _this2.streamControllers[streamId] = { controller: controller, startCall: startCapability, isClosed: false }; _this2.postMessage({ sourceName: sourceName, targetName: targetName, action: actionName, streamId: streamId, data: data, desiredSize: controller.desiredSize }); return startCapability.promise; }, pull: function pull(controller) { var pullCapability = createPromiseCapability(); _this2.streamControllers[streamId].pullCall = pullCapability; _this2.postMessage({ sourceName: sourceName, targetName: targetName, stream: 'pull', streamId: streamId, desiredSize: controller.desiredSize }); return pullCapability.promise; }, cancel: function cancel(reason) { var cancelCapability = createPromiseCapability(); _this2.streamControllers[streamId].cancelCall = cancelCapability; _this2.streamControllers[streamId].isClosed = true; _this2.postMessage({ sourceName: sourceName, targetName: targetName, stream: 'cancel', reason: reason, streamId: streamId }); return cancelCapability.promise; } }, queueingStrategy); }, _createStreamSink: function _createStreamSink(data) { var _this3 = this; var self = this; var action = this.actionHandler[data.action]; var streamId = data.streamId; var desiredSize = data.desiredSize; var sourceName = this.sourceName; var targetName = data.sourceName; var capability = createPromiseCapability(); var sendStreamRequest = function sendStreamRequest(_ref) { var stream = _ref.stream, chunk = _ref.chunk, transfers = _ref.transfers, success = _ref.success, reason = _ref.reason; _this3.postMessage({ sourceName: sourceName, targetName: targetName, stream: stream, streamId: streamId, chunk: chunk, success: success, reason: reason }, transfers); }; var streamSink = { enqueue: function enqueue(chunk) { var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; var transfers = arguments[2]; if (this.isCancelled) { return; } var lastDesiredSize = this.desiredSize; this.desiredSize -= size; if (lastDesiredSize > 0 && this.desiredSize <= 0) { this.sinkCapability = createPromiseCapability(); this.ready = this.sinkCapability.promise; } sendStreamRequest({ stream: 'enqueue', chunk: chunk, transfers: transfers }); }, close: function close() { if (this.isCancelled) { return; } this.isCancelled = true; sendStreamRequest({ stream: 'close' }); delete self.streamSinks[streamId]; }, error: function error(reason) { if (this.isCancelled) { return; } this.isCancelled = true; sendStreamRequest({ stream: 'error', reason: reason }); }, sinkCapability: capability, onPull: null, onCancel: null, isCancelled: false, desiredSize: desiredSize, ready: null }; streamSink.sinkCapability.resolve(); streamSink.ready = streamSink.sinkCapability.promise; this.streamSinks[streamId] = streamSink; resolveCall(action[0], [data.data, streamSink], action[1]).then(function () { sendStreamRequest({ stream: 'start_complete', success: true }); }, function (reason) { sendStreamRequest({ stream: 'start_complete', success: false, reason: reason }); }); }, _processStreamMessage: function _processStreamMessage(data) { var _this4 = this; var sourceName = this.sourceName; var targetName = data.sourceName; var streamId = data.streamId; var sendStreamResponse = function sendStreamResponse(_ref2) { var stream = _ref2.stream, success = _ref2.success, reason = _ref2.reason; _this4.comObj.postMessage({ sourceName: sourceName, targetName: targetName, stream: stream, success: success, streamId: streamId, reason: reason }); }; var deleteStreamController = function deleteStreamController() { Promise.all([_this4.streamControllers[data.streamId].startCall, _this4.streamControllers[data.streamId].pullCall, _this4.streamControllers[data.streamId].cancelCall].map(function (capability) { return capability && finalize(capability.promise); })).then(function () { delete _this4.streamControllers[data.streamId]; }); }; switch (data.stream) { case 'start_complete': resolveOrReject(this.streamControllers[data.streamId].startCall, data.success, wrapReason(data.reason)); break; case 'pull_complete': resolveOrReject(this.streamControllers[data.streamId].pullCall, data.success, wrapReason(data.reason)); break; case 'pull': if (!this.streamSinks[data.streamId]) { sendStreamResponse({ stream: 'pull_complete', success: true }); break; } if (this.streamSinks[data.streamId].desiredSize <= 0 && data.desiredSize > 0) { this.streamSinks[data.streamId].sinkCapability.resolve(); } this.streamSinks[data.streamId].desiredSize = data.desiredSize; resolveCall(this.streamSinks[data.streamId].onPull).then(function () { sendStreamResponse({ stream: 'pull_complete', success: true }); }, function (reason) { sendStreamResponse({ stream: 'pull_complete', success: false, reason: reason }); }); break; case 'enqueue': assert(this.streamControllers[data.streamId], 'enqueue should have stream controller'); if (!this.streamControllers[data.streamId].isClosed) { this.streamControllers[data.streamId].controller.enqueue(data.chunk); } break; case 'close': assert(this.streamControllers[data.streamId], 'close should have stream controller'); if (this.streamControllers[data.streamId].isClosed) { break; } this.streamControllers[data.streamId].isClosed = true; this.streamControllers[data.streamId].controller.close(); deleteStreamController(); break; case 'error': assert(this.streamControllers[data.streamId], 'error should have stream controller'); this.streamControllers[data.streamId].controller.error(wrapReason(data.reason)); deleteStreamController(); break; case 'cancel_complete': resolveOrReject(this.streamControllers[data.streamId].cancelCall, data.success, wrapReason(data.reason)); deleteStreamController(); break; case 'cancel': if (!this.streamSinks[data.streamId]) { break; } resolveCall(this.streamSinks[data.streamId].onCancel, [wrapReason(data.reason)]).then(function () { sendStreamResponse({ stream: 'cancel_complete', success: true }); }, function (reason) { sendStreamResponse({ stream: 'cancel_complete', success: false, reason: reason }); }); this.streamSinks[data.streamId].sinkCapability.reject(wrapReason(data.reason)); this.streamSinks[data.streamId].isCancelled = true; delete this.streamSinks[data.streamId]; break; default: throw new Error('Unexpected stream case'); } }, postMessage: function postMessage(message, transfers) { if (transfers && this.postMessageTransfers) { this.comObj.postMessage(message, transfers); } else { this.comObj.postMessage(message); } }, destroy: function destroy() { this.comObj.removeEventListener('message', this._onComObjOnMessage); } }; function loadJpegStream(id, imageUrl, objs) { var img = new Image(); img.onload = function loadJpegStream_onloadClosure() { objs.resolve(id, img); }; img.onerror = function loadJpegStream_onerrorClosure() { objs.resolve(id, null); warn('Error during JPEG image loading'); }; img.src = imageUrl; } exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX; exports.IDENTITY_MATRIX = IDENTITY_MATRIX; exports.OPS = OPS; exports.VERBOSITY_LEVELS = VERBOSITY_LEVELS; exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES; exports.AnnotationBorderStyleType = AnnotationBorderStyleType; exports.AnnotationFieldFlag = AnnotationFieldFlag; exports.AnnotationFlag = AnnotationFlag; exports.AnnotationType = AnnotationType; exports.FontType = FontType; exports.ImageKind = ImageKind; exports.CMapCompressionType = CMapCompressionType; exports.AbortException = AbortException; exports.InvalidPDFException = InvalidPDFException; exports.MessageHandler = MessageHandler; exports.MissingDataException = MissingDataException; exports.MissingPDFException = MissingPDFException; exports.NativeImageDecoding = NativeImageDecoding; exports.NotImplementedException = NotImplementedException; exports.PageViewport = PageViewport; exports.PasswordException = PasswordException; exports.PasswordResponses = PasswordResponses; exports.StatTimer = StatTimer; exports.StreamType = StreamType; exports.TextRenderingMode = TextRenderingMode; exports.UnexpectedResponseException = UnexpectedResponseException; exports.UnknownErrorException = UnknownErrorException; exports.Util = Util; exports.XRefParseException = XRefParseException; exports.FormatError = FormatError; exports.arrayByteLength = arrayByteLength; exports.arraysToBytes = arraysToBytes; exports.assert = assert; exports.bytesToString = bytesToString; exports.createBlob = createBlob; exports.createPromiseCapability = createPromiseCapability; exports.createObjectURL = createObjectURL; exports.deprecated = deprecated; exports.getLookupTableFactory = getLookupTableFactory; exports.getVerbosityLevel = getVerbosityLevel; exports.info = info; exports.isArrayBuffer = isArrayBuffer; exports.isBool = isBool; exports.isEmptyObj = isEmptyObj; exports.isNum = isNum; exports.isString = isString; exports.isSpace = isSpace; exports.isNodeJS = isNodeJS; exports.isSameOrigin = isSameOrigin; exports.createValidAbsoluteUrl = createValidAbsoluteUrl; exports.isLittleEndian = isLittleEndian; exports.isEvalSupported = isEvalSupported; exports.loadJpegStream = loadJpegStream; exports.log2 = log2; exports.readInt8 = readInt8; exports.readUint16 = readUint16; exports.readUint32 = readUint32; exports.removeNullCharacters = removeNullCharacters; exports.ReadableStream = _streams_polyfill.ReadableStream; exports.setVerbosityLevel = setVerbosityLevel; exports.shadow = shadow; exports.string32 = string32; exports.stringToBytes = stringToBytes; exports.stringToPDFString = stringToPDFString; exports.stringToUTF8String = stringToUTF8String; exports.utf8StringToString = utf8StringToString; exports.warn = warn; exports.unreachable = unreachable; /***/ }), /* 1 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; module.exports = function (it) { return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) === 'object' ? it !== null : typeof it === 'function'; }; /***/ }), /* 2 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var store = __w_pdfjs_require__(42)('wks'); var uid = __w_pdfjs_require__(20); var _Symbol = __w_pdfjs_require__(3).Symbol; var USE_SYMBOL = typeof _Symbol == 'function'; var $exports = module.exports = function (name) { return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : uid)('Symbol.' + name)); }; $exports.store = store; /***/ }), /* 3 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); if (typeof __g == 'number') __g = global; /***/ }), /* 4 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var global = __w_pdfjs_require__(3); var core = __w_pdfjs_require__(5); var hide = __w_pdfjs_require__(11); var redefine = __w_pdfjs_require__(9); var ctx = __w_pdfjs_require__(10); var PROTOTYPE = 'prototype'; var $export = function $export(type, name, source) { var IS_FORCED = type & $export.F; var IS_GLOBAL = type & $export.G; var IS_STATIC = type & $export.S; var IS_PROTO = type & $export.P; var IS_BIND = type & $export.B; var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); var key, own, out, exp; if (IS_GLOBAL) source = name; for (key in source) { own = !IS_FORCED && target && target[key] !== undefined; out = (own ? target : source)[key]; exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; if (target) redefine(target, key, out, type & $export.U); if (exports[key] != out) hide(exports, key, exp); if (IS_PROTO && expProto[key] != out) expProto[key] = out; } }; global.core = core; $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; /***/ }), /* 5 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var core = module.exports = { version: '2.5.1' }; if (typeof __e == 'number') __e = core; /***/ }), /* 6 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var isObject = __w_pdfjs_require__(1); module.exports = function (it) { if (!isObject(it)) throw TypeError(it + ' is not an object!'); return it; }; /***/ }), /* 7 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var hasOwnProperty = {}.hasOwnProperty; module.exports = function (it, key) { return hasOwnProperty.call(it, key); }; /***/ }), /* 8 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SimpleXMLParser = exports.DOMSVGFactory = exports.DOMCMapReaderFactory = exports.DOMCanvasFactory = exports.DEFAULT_LINK_REL = exports.getDefaultSetting = exports.LinkTarget = exports.getFilenameFromUrl = exports.isExternalLinkTargetSet = exports.addLinkAttributes = exports.RenderingCancelledException = exports.CustomStyle = undefined; 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 _util = __w_pdfjs_require__(0); var _global_scope = __w_pdfjs_require__(14); var _global_scope2 = _interopRequireDefault(_global_scope); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var DEFAULT_LINK_REL = 'noopener noreferrer nofollow'; var SVG_NS = 'http://www.w3.org/2000/svg'; var DOMCanvasFactory = function () { function DOMCanvasFactory() { _classCallCheck(this, DOMCanvasFactory); } _createClass(DOMCanvasFactory, [{ key: 'create', value: function create(width, height) { if (width <= 0 || height <= 0) { throw new Error('invalid canvas size'); } var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); canvas.width = width; canvas.height = height; return { canvas: canvas, context: context }; } }, { key: 'reset', value: function reset(canvasAndContext, width, height) { if (!canvasAndContext.canvas) { throw new Error('canvas is not specified'); } if (width <= 0 || height <= 0) { throw new Error('invalid canvas size'); } canvasAndContext.canvas.width = width; canvasAndContext.canvas.height = height; } }, { key: 'destroy', value: function destroy(canvasAndContext) { if (!canvasAndContext.canvas) { throw new Error('canvas is not specified'); } canvasAndContext.canvas.width = 0; canvasAndContext.canvas.height = 0; canvasAndContext.canvas = null; canvasAndContext.context = null; } }]); return DOMCanvasFactory; }(); var DOMCMapReaderFactory = function () { function DOMCMapReaderFactory(_ref) { var _ref$baseUrl = _ref.baseUrl, baseUrl = _ref$baseUrl === undefined ? null : _ref$baseUrl, _ref$isCompressed = _ref.isCompressed, isCompressed = _ref$isCompressed === undefined ? false : _ref$isCompressed; _classCallCheck(this, DOMCMapReaderFactory); this.baseUrl = baseUrl; this.isCompressed = isCompressed; } _createClass(DOMCMapReaderFactory, [{ key: 'fetch', value: function fetch(_ref2) { var _this = this; var name = _ref2.name; if (!this.baseUrl) { return Promise.reject(new Error('CMap baseUrl must be specified, ' + 'see "PDFJS.cMapUrl" (and also "PDFJS.cMapPacked").')); } if (!name) { return Promise.reject(new Error('CMap name must be specified.')); } return new Promise(function (resolve, reject) { var url = _this.baseUrl + name + (_this.isCompressed ? '.bcmap' : ''); var request = new XMLHttpRequest(); request.open('GET', url, true); if (_this.isCompressed) { request.responseType = 'arraybuffer'; } request.onreadystatechange = function () { if (request.readyState !== XMLHttpRequest.DONE) { return; } if (request.status === 200 || request.status === 0) { var data = void 0; if (_this.isCompressed && request.response) { data = new Uint8Array(request.response); } else if (!_this.isCompressed && request.responseText) { data = (0, _util.stringToBytes)(request.responseText); } if (data) { resolve({ cMapData: data, compressionType: _this.isCompressed ? _util.CMapCompressionType.BINARY : _util.CMapCompressionType.NONE }); return; } } reject(new Error('Unable to load ' + (_this.isCompressed ? 'binary ' : '') + 'CMap at: ' + url)); }; request.send(null); }); } }]); return DOMCMapReaderFactory; }(); var DOMSVGFactory = function () { function DOMSVGFactory() { _classCallCheck(this, DOMSVGFactory); } _createClass(DOMSVGFactory, [{ key: 'create', value: function create(width, height) { (0, _util.assert)(width > 0 && height > 0, 'Invalid SVG dimensions'); var svg = document.createElementNS(SVG_NS, 'svg:svg'); svg.setAttribute('version', '1.1'); svg.setAttribute('width', width + 'px'); svg.setAttribute('height', height + 'px'); svg.setAttribute('preserveAspectRatio', 'none'); svg.setAttribute('viewBox', '0 0 ' + width + ' ' + height); return svg; } }, { key: 'createElement', value: function createElement(type) { (0, _util.assert)(typeof type === 'string', 'Invalid SVG element type'); return document.createElementNS(SVG_NS, type); } }]); return DOMSVGFactory; }(); var SimpleDOMNode = function () { function SimpleDOMNode(nodeName, nodeValue) { _classCallCheck(this, SimpleDOMNode); this.nodeName = nodeName; this.nodeValue = nodeValue; Object.defineProperty(this, 'parentNode', { value: null, writable: true }); } _createClass(SimpleDOMNode, [{ key: 'hasChildNodes', value: function hasChildNodes() { return this.childNodes && this.childNodes.length > 0; } }, { key: 'firstChild', get: function get() { return this.childNodes[0]; } }, { key: 'nextSibling', get: function get() { var index = this.parentNode.childNodes.indexOf(this); return this.parentNode.childNodes[index + 1]; } }, { key: 'textContent', get: function get() { if (!this.childNodes) { return this.nodeValue || ''; } return this.childNodes.map(function (child) { return child.textContent; }).join(''); } }]); return SimpleDOMNode; }(); var SimpleXMLParser = function () { function SimpleXMLParser() { _classCallCheck(this, SimpleXMLParser); } _createClass(SimpleXMLParser, [{ key: 'parseFromString', value: function parseFromString(data) { var _this2 = this; var nodes = []; data = data.replace(/<\?[\s\S]*?\?>|<!--[\s\S]*?-->/g, '').trim(); data = data.replace(/<!DOCTYPE[^>\[]+(\[[^\]]+)?[^>]+>/g, '').trim(); data = data.replace(/>([^<][\s\S]*?)</g, function (all, text) { var length = nodes.length; var node = new SimpleDOMNode('#text', _this2._decodeXML(text)); nodes.push(node); if (node.textContent.trim().length === 0) { return '><'; } return '>' + length + ',<'; }); data = data.replace(/<!\[CDATA\[([\s\S]*?)\]\]>/g, function (all, text) { var length = nodes.length; var node = new SimpleDOMNode('#text', text); nodes.push(node); return length + ','; }); var regex = /<([\w\:]+)((?:[\s\w:=]|'[^']*'|"[^"]*")*)(?:\/>|>([\d,]*)<\/[^>]+>)/g; var lastLength = void 0; do { lastLength = nodes.length; data = data.replace(regex, function (all, name, attrs, data) { var length = nodes.length; var node = new SimpleDOMNode(name); var children = []; if (data) { data = data.split(','); data.pop(); data.forEach(function (child) { var childNode = nodes[+child]; childNode.parentNode = node; children.push(childNode); }); } node.childNodes = children; nodes.push(node); return length + ','; }); } while (lastLength < nodes.length); return { documentElement: nodes.pop() }; } }, { key: '_decodeXML', value: function _decodeXML(text) { if (text.indexOf('&') < 0) { return text; } return text.replace(/&(#(x[0-9a-f]+|\d+)|\w+);/gi, function (all, entityName, number) { if (number) { if (number[0] === 'x') { number = parseInt(number.substring(1), 16); } else { number = +number; } return String.fromCharCode(number); } switch (entityName) { case 'amp': return '&'; case 'lt': return '<'; case 'gt': return '>'; case 'quot': return '\"'; case 'apos': return '\''; } return '&' + entityName + ';'; }); } }]); return SimpleXMLParser; }(); var CustomStyle = function CustomStyleClosure() { var prefixes = ['ms', 'Moz', 'Webkit', 'O']; var _cache = Object.create(null); function CustomStyle() {} CustomStyle.getProp = function get(propName, element) { if (arguments.length === 1 && typeof _cache[propName] === 'string') { return _cache[propName]; } element = element || document.documentElement; var style = element.style, prefixed, uPropName; if (typeof style[propName] === 'string') { return _cache[propName] = propName; } uPropName = propName.charAt(0).toUpperCase() + propName.slice(1); for (var i = 0, l = prefixes.length; i < l; i++) { prefixed = prefixes[i] + uPropName; if (typeof style[prefixed] === 'string') { return _cache[propName] = prefixed; } } return _cache[propName] = 'undefined'; }; CustomStyle.setProp = function set(propName, element, str) { var prop = this.getProp(propName); if (prop !== 'undefined') { element.style[prop] = str; } }; return CustomStyle; }(); var RenderingCancelledException = function RenderingCancelledException() { function RenderingCancelledException(msg, type) { this.message = msg; this.type = type; } RenderingCancelledException.prototype = new Error(); RenderingCancelledException.prototype.name = 'RenderingCancelledException'; RenderingCancelledException.constructor = RenderingCancelledException; return RenderingCancelledException; }(); var LinkTarget = { NONE: 0, SELF: 1, BLANK: 2, PARENT: 3, TOP: 4 }; var LinkTargetStringMap = ['', '_self', '_blank', '_parent', '_top']; function addLinkAttributes(link, params) { var url = params && params.url; link.href = link.title = url ? (0, _util.removeNullCharacters)(url) : ''; if (url) { var target = params.target; if (typeof target === 'undefined') { target = getDefaultSetting('externalLinkTarget'); } link.target = LinkTargetStringMap[target]; var rel = params.rel; if (typeof rel === 'undefined') { rel = getDefaultSetting('externalLinkRel'); } link.rel = rel; } } function getFilenameFromUrl(url) { var anchor = url.indexOf('#'); var query = url.indexOf('?'); var end = Math.min(anchor > 0 ? anchor : url.length, query > 0 ? query : url.length); return url.substring(url.lastIndexOf('/', end) + 1, end); } function getDefaultSetting(id) { var globalSettings = _global_scope2.default.PDFJS; switch (id) { case 'pdfBug': return globalSettings ? globalSettings.pdfBug : false; case 'disableAutoFetch': return globalSettings ? globalSettings.disableAutoFetch : false; case 'disableStream': return globalSettings ? globalSettings.disableStream : false; case 'disableRange': return globalSettings ? globalSettings.disableRange : false; case 'disableFontFace': return globalSettings ? globalSettings.disableFontFace : false; case 'disableCreateObjectURL': return globalSettings ? globalSettings.disableCreateObjectURL : false; case 'disableWebGL': return globalSettings ? globalSettings.disableWebGL : true; case 'cMapUrl': return globalSettings ? globalSettings.cMapUrl : null; case 'cMapPacked': return globalSettings ? globalSettings.cMapPacked : false; case 'postMessageTransfers': return globalSettings ? globalSettings.postMessageTransfers : true; case 'workerPort': return globalSettings ? globalSettings.workerPort : null; case 'workerSrc': return globalSettings ? globalSettings.workerSrc : null; case 'disableWorker': return globalSettings ? globalSettings.disableWorker : false; case 'maxImageSize': return globalSettings ? globalSettings.maxImageSize : -1; case 'imageResourcesPath': return globalSettings ? globalSettings.imageResourcesPath : ''; case 'isEvalSupported': return globalSettings ? globalSettings.isEvalSupported : true; case 'externalLinkTarget': if (!globalSettings) { return LinkTarget.NONE; } switch (globalSettings.externalLinkTarget) { case LinkTarget.NONE: case LinkTarget.SELF: case LinkTarget.BLANK: case LinkTarget.PARENT: case LinkTarget.TOP: return globalSettings.externalLinkTarget; } (0, _util.warn)('PDFJS.externalLinkTarget is invalid: ' + globalSettings.externalLinkTarget); globalSettings.externalLinkTarget = LinkTarget.NONE; return LinkTarget.NONE; case 'externalLinkRel': return globalSettings ? globalSettings.externalLinkRel : DEFAULT_LINK_REL; case 'enableStats': return !!(globalSettings && globalSettings.enableStats); default: throw new Error('Unknown default setting: ' + id); } } function isExternalLinkTargetSet() { var externalLinkTarget = getDefaultSetting('externalLinkTarget'); switch (externalLinkTarget) { case LinkTarget.NONE: return false; case LinkTarget.SELF: case LinkTarget.BLANK: case LinkTarget.PARENT: case LinkTarget.TOP: return true; } } exports.CustomStyle = CustomStyle; exports.RenderingCancelledException = RenderingCancelledException; exports.addLinkAttributes = addLinkAttributes; exports.isExternalLinkTargetSet = isExternalLinkTargetSet; exports.getFilenameFromUrl = getFilenameFromUrl; exports.LinkTarget = LinkTarget; exports.getDefaultSetting = getDefaultSetting; exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL; exports.DOMCanvasFactory = DOMCanvasFactory; exports.DOMCMapReaderFactory = DOMCMapReaderFactory; exports.DOMSVGFactory = DOMSVGFactory; exports.SimpleXMLParser = SimpleXMLParser; /***/ }), /* 9 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var global = __w_pdfjs_require__(3); var hide = __w_pdfjs_require__(11); var has = __w_pdfjs_require__(7); var SRC = __w_pdfjs_require__(20)('src'); var TO_STRING = 'toString'; var $toString = Function[TO_STRING]; var TPL = ('' + $toString).split(TO_STRING); __w_pdfjs_require__(5).inspectSource = function (it) { return $toString.call(it); }; (module.exports = function (O, key, val, safe) { var isFunction = typeof val == 'function'; if (isFunction) has(val, 'name') || hide(val, 'name', key); if (O[key] === val) return; if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); if (O === global) { O[key] = val; } else if (!safe) { delete O[key]; hide(O, key, val); } else if (O[key]) { O[key] = val; } else { hide(O, key, val); } })(Function.prototype, TO_STRING, function toString() { return typeof this == 'function' && this[SRC] || $toString.call(this); }); /***/ }), /* 10 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var aFunction = __w_pdfjs_require__(16); module.exports = function (fn, that, length) { aFunction(fn); if (that === undefined) 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); }; }; /***/ }), /* 11 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var dP = __w_pdfjs_require__(15); var createDesc = __w_pdfjs_require__(25); module.exports = __w_pdfjs_require__(12) ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function (object, key, value) { object[key] = value; return object; }; /***/ }), /* 12 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = !__w_pdfjs_require__(13)(function () { return Object.defineProperty({}, 'a', { get: function get() { return 7; } }).a != 7; }); /***/ }), /* 13 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = function (exec) { try { return !!exec(); } catch (e) { return true; } }; /***/ }), /* 14 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = typeof window !== 'undefined' && window.Math === Math ? window : typeof global !== 'undefined' && global.Math === Math ? global : typeof self !== 'undefined' && self.Math === Math ? self : {}; /***/ }), /* 15 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var anObject = __w_pdfjs_require__(6); var IE8_DOM_DEFINE = __w_pdfjs_require__(39); var toPrimitive = __w_pdfjs_require__(40); var dP = Object.defineProperty; exports.f = __w_pdfjs_require__(12) ? Object.defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (IE8_DOM_DEFINE) try { return dP(O, P, Attributes); } catch (e) {} if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; /***/ }), /* 16 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = function (it) { if (typeof it != 'function') throw TypeError(it + ' is not a function!'); return it; }; /***/ }), /* 17 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var IObject = __w_pdfjs_require__(26); var defined = __w_pdfjs_require__(27); module.exports = function (it) { return IObject(defined(it)); }; /***/ }), /* 18 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var toString = {}.toString; module.exports = function (it) { return toString.call(it).slice(8, -1); }; /***/ }), /* 19 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = {}; /***/ }), /* 20 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var id = 0; var px = Math.random(); module.exports = function (key) { return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; /***/ }), /* 21 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var $keys = __w_pdfjs_require__(68); var enumBugKeys = __w_pdfjs_require__(43); module.exports = Object.keys || function keys(O) { return $keys(O, enumBugKeys); }; /***/ }), /* 22 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var def = __w_pdfjs_require__(15).f; var has = __w_pdfjs_require__(7); var TAG = __w_pdfjs_require__(2)('toStringTag'); module.exports = function (it, tag, stat) { if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); }; /***/ }), /* 23 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var ctx = __w_pdfjs_require__(10); var call = __w_pdfjs_require__(87); var isArrayIter = __w_pdfjs_require__(88); var anObject = __w_pdfjs_require__(6); var toLength = __w_pdfjs_require__(28); var getIterFn = __w_pdfjs_require__(89); var BREAK = {}; var RETURN = {}; var _exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable); var f = ctx(fn, that, entries ? 2 : 1); var index = 0; var length, step, iterator, result; if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); if (result === BREAK || result === RETURN) return result; } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { result = call(iterator, f, step.value, entries); if (result === BREAK || result === RETURN) return result; } }; _exports.BREAK = BREAK; _exports.RETURN = RETURN; /***/ }), /* 24 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var isObject = __w_pdfjs_require__(1); var document = __w_pdfjs_require__(3).document; var is = isObject(document) && isObject(document.createElement); module.exports = function (it) { return is ? document.createElement(it) : {}; }; /***/ }), /* 25 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; /***/ }), /* 26 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var cof = __w_pdfjs_require__(18); module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { return cof(it) == 'String' ? it.split('') : Object(it); }; /***/ }), /* 27 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; /***/ }), /* 28 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var toInteger = __w_pdfjs_require__(29); var min = Math.min; module.exports = function (it) { return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; }; /***/ }), /* 29 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var ceil = Math.ceil; var floor = Math.floor; module.exports = function (it) { return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; /***/ }), /* 30 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var shared = __w_pdfjs_require__(42)('keys'); var uid = __w_pdfjs_require__(20); module.exports = function (key) { return shared[key] || (shared[key] = uid(key)); }; /***/ }), /* 31 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; exports.f = {}.propertyIsEnumerable; /***/ }), /* 32 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var cof = __w_pdfjs_require__(18); var TAG = __w_pdfjs_require__(2)('toStringTag'); var ARG = cof(function () { return arguments; }()) == 'Arguments'; var tryGet = function tryGet(it, key) { try { return it[key]; } catch (e) {} }; module.exports = function (it) { var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T : ARG ? cof(O) : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; /***/ }), /* 33 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var defined = __w_pdfjs_require__(27); module.exports = function (it) { return Object(defined(it)); }; /***/ }), /* 34 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = function (it, Constructor, name, forbiddenField) { if (!(it instanceof Constructor) || forbiddenField !== undefined && forbiddenField in it) { throw TypeError(name + ': incorrect invocation!'); } return it; }; /***/ }), /* 35 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var aFunction = __w_pdfjs_require__(16); function PromiseCapability(C) { var resolve, reject; this.promise = new C(function ($$resolve, $$reject) { if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); resolve = $$resolve; reject = $$reject; }); this.resolve = aFunction(resolve); this.reject = aFunction(reject); } module.exports.f = function (C) { return new PromiseCapability(C); }; /***/ }), /* 36 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var redefine = __w_pdfjs_require__(9); module.exports = function (target, src, safe) { for (var key in src) { redefine(target, key, src[key], safe); }return target; }; /***/ }), /* 37 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var META = __w_pdfjs_require__(20)('meta'); var isObject = __w_pdfjs_require__(1); var has = __w_pdfjs_require__(7); var setDesc = __w_pdfjs_require__(15).f; var id = 0; var isExtensible = Object.isExtensible || function () { return true; }; var FREEZE = !__w_pdfjs_require__(13)(function () { return isExtensible(Object.preventExtensions({})); }); var setMeta = function setMeta(it) { setDesc(it, META, { value: { i: 'O' + ++id, w: {} } }); }; var fastKey = function fastKey(it, create) { if (!isObject(it)) return (typeof it === 'undefined' ? 'undefined' : _typeof(it)) == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if (!has(it, META)) { if (!isExtensible(it)) return 'F'; if (!create) return 'E'; setMeta(it); } return it[META].i; }; var getWeak = function getWeak(it, create) { if (!has(it, META)) { if (!isExtensible(it)) return true; if (!create) return false; setMeta(it); } return it[META].w; }; var onFreeze = function onFreeze(it) { if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); return it; }; var meta = module.exports = { KEY: META, NEED: false, fastKey: fastKey, getWeak: getWeak, onFreeze: onFreeze }; /***/ }), /* 38 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateResponseStatus = exports.validateRangeRequestCapabilities = exports.createResponseStatusError = undefined; var _util = __w_pdfjs_require__(0); function validateRangeRequestCapabilities(_ref) { var getResponseHeader = _ref.getResponseHeader, isHttp = _ref.isHttp, rangeChunkSize = _ref.rangeChunkSize, disableRange = _ref.disableRange; (0, _util.assert)(rangeChunkSize > 0); var returnValues = { allowRangeRequests: false, suggestedLength: undefined }; if (disableRange || !isHttp) { return returnValues; } if (getResponseHeader('Accept-Ranges') !== 'bytes') { return returnValues; } var contentEncoding = getResponseHeader('Content-Encoding') || 'identity'; if (contentEncoding !== 'identity') { return returnValues; } var length = parseInt(getResponseHeader('Content-Length'), 10); if (!Number.isInteger(length)) { return returnValues; } returnValues.suggestedLength = length; if (length <= 2 * rangeChunkSize) { return returnValues; } returnValues.allowRangeRequests = true; return returnValues; } function createResponseStatusError(status, url) { if (status === 404 || status === 0 && /^file:/.test(url)) { return new _util.MissingPDFException('Missing PDF "' + url + '".'); } return new _util.UnexpectedResponseException('Unexpected server response (' + status + ') while retrieving PDF "' + url + '".', status); } function validateResponseStatus(status) { return status === 200 || status === 206; } exports.createResponseStatusError = createResponseStatusError; exports.validateRangeRequestCapabilities = validateRangeRequestCapabilities; exports.validateResponseStatus = validateResponseStatus; /***/ }), /* 39 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = !__w_pdfjs_require__(12) && !__w_pdfjs_require__(13)(function () { return Object.defineProperty(__w_pdfjs_require__(24)('div'), 'a', { get: function get() { return 7; } }).a != 7; }); /***/ }), /* 40 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var isObject = __w_pdfjs_require__(1); module.exports = function (it, S) { if (!isObject(it)) return it; var fn, val; if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; throw TypeError("Can't convert object to primitive value"); }; /***/ }), /* 41 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var toIObject = __w_pdfjs_require__(17); var toLength = __w_pdfjs_require__(28); var toAbsoluteIndex = __w_pdfjs_require__(69); module.exports = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIObject($this); var length = toLength(O.length); var index = toAbsoluteIndex(fromIndex, length); var value; if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; if (value != value) return true; } else for (; length > index; index++) { if (IS_INCLUDES || index in O) { if (O[index] === el) return IS_INCLUDES || index || 0; } }return !IS_INCLUDES && -1; }; }; /***/ }), /* 42 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var global = __w_pdfjs_require__(3); var SHARED = '__core-js_shared__'; var store = global[SHARED] || (global[SHARED] = {}); module.exports = function (key) { return store[key] || (store[key] = {}); }; /***/ }), /* 43 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(','); /***/ }), /* 44 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var UNSCOPABLES = __w_pdfjs_require__(2)('unscopables'); var ArrayProto = Array.prototype; if (ArrayProto[UNSCOPABLES] == undefined) __w_pdfjs_require__(11)(ArrayProto, UNSCOPABLES, {}); module.exports = function (key) { ArrayProto[UNSCOPABLES][key] = true; }; /***/ }), /* 45 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var classof = __w_pdfjs_require__(32); var test = {}; test[__w_pdfjs_require__(2)('toStringTag')] = 'z'; if (test + '' != '[object z]') { __w_pdfjs_require__(9)(Object.prototype, 'toString', function toString() { return '[object ' + classof(this) + ']'; }, true); } /***/ }), /* 46 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var LIBRARY = __w_pdfjs_require__(47); var $export = __w_pdfjs_require__(4); var redefine = __w_pdfjs_require__(9); var hide = __w_pdfjs_require__(11); var has = __w_pdfjs_require__(7); var Iterators = __w_pdfjs_require__(19); var $iterCreate = __w_pdfjs_require__(80); var setToStringTag = __w_pdfjs_require__(22); var getPrototypeOf = __w_pdfjs_require__(83); var ITERATOR = __w_pdfjs_require__(2)('iterator'); var BUGGY = !([].keys && 'next' in [].keys()); var FF_ITERATOR = '@@iterator'; var KEYS = 'keys'; var VALUES = 'values'; var returnThis = function returnThis() { return this; }; module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { $iterCreate(Constructor, NAME, next); var getMethod = function getMethod(kind) { if (!BUGGY && kind in proto) return proto[kind]; switch (kind) { case KEYS: return function keys() { return new Constructor(this, kind); }; case VALUES: return function values() { return new Constructor(this, kind); }; } return function entries() { return new Constructor(this, kind); }; }; var TAG = NAME + ' Iterator'; var DEF_VALUES = DEFAULT == VALUES; var VALUES_BUG = false; var proto = Base.prototype; var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; var $default = $native || getMethod(DEFAULT); var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; var methods, key, IteratorPrototype; if ($anyNative) { IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { setToStringTag(IteratorPrototype, TAG, true); if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis); } } if (DEF_VALUES && $native && $native.name !== VALUES) { VALUES_BUG = true; $default = function values() { return $native.call(this); }; } if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { hide(proto, ITERATOR, $default); } Iterators[NAME] = $default; Iterators[TAG] = returnThis; if (DEFAULT) { methods = { values: DEF_VALUES ? $default : getMethod(VALUES), keys: IS_SET ? $default : getMethod(KEYS), entries: $entries }; if (FORCED) for (key in methods) { if (!(key in proto)) redefine(proto, key, methods[key]); } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; }; /***/ }), /* 47 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = false; /***/ }), /* 48 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var document = __w_pdfjs_require__(3).document; module.exports = document && document.documentElement; /***/ }), /* 49 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var $iterators = __w_pdfjs_require__(84); var getKeys = __w_pdfjs_require__(21); var redefine = __w_pdfjs_require__(9); var global = __w_pdfjs_require__(3); var hide = __w_pdfjs_require__(11); var Iterators = __w_pdfjs_require__(19); var wks = __w_pdfjs_require__(2); var ITERATOR = wks('iterator'); var TO_STRING_TAG = wks('toStringTag'); var ArrayValues = Iterators.Array; var DOMIterables = { CSSRuleList: true, CSSStyleDeclaration: false, CSSValueList: false, ClientRectList: false, DOMRectList: false, DOMStringList: false, DOMTokenList: true, DataTransferItemList: false, FileList: false, HTMLAllCollection: false, HTMLCollection: false, HTMLFormElement: false, HTMLSelectElement: false, MediaList: true, MimeTypeArray: false, NamedNodeMap: false, NodeList: true, PaintRequestList: false, Plugin: false, PluginArray: false, SVGLengthList: false, SVGNumberList: false, SVGPathSegList: false, SVGPointList: false, SVGStringList: false, SVGTransformList: false, SourceBufferList: false, StyleSheetList: true, TextTrackCueList: false, TextTrackList: false, TouchList: false }; for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) { var NAME = collections[i]; var explicit = DOMIterables[NAME]; var Collection = global[NAME]; var proto = Collection && Collection.prototype; var key; if (proto) { if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues); if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); Iterators[NAME] = ArrayValues; if (explicit) for (key in $iterators) { if (!proto[key]) redefine(proto, key, $iterators[key], true); } } } /***/ }), /* 50 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var anObject = __w_pdfjs_require__(6); var aFunction = __w_pdfjs_require__(16); var SPECIES = __w_pdfjs_require__(2)('species'); module.exports = function (O, D) { var C = anObject(O).constructor; var S; return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); }; /***/ }), /* 51 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var ctx = __w_pdfjs_require__(10); var invoke = __w_pdfjs_require__(90); var html = __w_pdfjs_require__(48); var cel = __w_pdfjs_require__(24); var global = __w_pdfjs_require__(3); var process = global.process; var setTask = global.setImmediate; var clearTask = global.clearImmediate; var MessageChannel = global.MessageChannel; var Dispatch = global.Dispatch; var counter = 0; var queue = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; var defer, channel, port; var run = function run() { var id = +this; if (queue.hasOwnProperty(id)) { var fn = queue[id]; delete queue[id]; fn(); } }; var listener = function listener(event) { run.call(event.data); }; if (!setTask || !clearTask) { setTask = function setImmediate(fn) { var args = []; var i = 1; while (arguments.length > i) { args.push(arguments[i++]); }queue[++counter] = function () { invoke(typeof fn == 'function' ? fn : Function(fn), args); }; defer(counter); return counter; }; clearTask = function clearImmediate(id) { delete queue[id]; }; if (__w_pdfjs_require__(18)(process) == 'process') { defer = function defer(id) { process.nextTick(ctx(run, id, 1)); }; } else if (Dispatch && Dispatch.now) { defer = function defer(id) { Dispatch.now(ctx(run, id, 1)); }; } else if (MessageChannel) { channel = new MessageChannel(); port = channel.port2; channel.port1.onmessage = listener; defer = ctx(port.postMessage, port, 1); } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) { defer = function defer(id) { global.postMessage(id + '', '*'); }; global.addEventListener('message', listener, false); } else if (ONREADYSTATECHANGE in cel('script')) { defer = function defer(id) { html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () { html.removeChild(this); run.call(id); }; }; } else { defer = function defer(id) { setTimeout(ctx(run, id, 1), 0); }; } } module.exports = { set: setTask, clear: clearTask }; /***/ }), /* 52 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = function (exec) { try { return { e: false, v: exec() }; } catch (e) { return { e: true, v: e }; } }; /***/ }), /* 53 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var anObject = __w_pdfjs_require__(6); var isObject = __w_pdfjs_require__(1); var newPromiseCapability = __w_pdfjs_require__(35); module.exports = function (C, x) { anObject(C); if (isObject(x) && x.constructor === C) return x; var promiseCapability = newPromiseCapability.f(C); var resolve = promiseCapability.resolve; resolve(x); return promiseCapability.promise; }; /***/ }), /* 54 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var ITERATOR = __w_pdfjs_require__(2)('iterator'); var SAFE_CLOSING = false; try { var riter = [7][ITERATOR](); riter['return'] = function () { SAFE_CLOSING = true; }; Array.from(riter, function () { throw 2; }); } catch (e) {} module.exports = function (exec, skipClosing) { if (!skipClosing && !SAFE_CLOSING) return false; var safe = false; try { var arr = [7]; var iter = arr[ITERATOR](); iter.next = function () { return { done: safe = true }; }; arr[ITERATOR] = function () { return iter; }; exec(arr); } catch (e) {} return safe; }; /***/ }), /* 55 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var ctx = __w_pdfjs_require__(10); var IObject = __w_pdfjs_require__(26); var toObject = __w_pdfjs_require__(33); var toLength = __w_pdfjs_require__(28); var asc = __w_pdfjs_require__(97); module.exports = function (TYPE, $create) { var IS_MAP = TYPE == 1; var IS_FILTER = TYPE == 2; var IS_SOME = TYPE == 3; var IS_EVERY = TYPE == 4; var IS_FIND_INDEX = TYPE == 6; var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; var create = $create || asc; return function ($this, callbackfn, that) { var O = toObject($this); var self = IObject(O); var f = ctx(callbackfn, that, 3); var length = toLength(self.length); var index = 0; var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; var val, res; for (; length > index; index++) { if (NO_HOLES || index in self) { val = self[index]; res = f(val, index, O); if (TYPE) { if (IS_MAP) result[index] = res;else if (res) switch (TYPE) { case 3: return true; case 5: return val; case 6: return index; case 2: result.push(val); } else if (IS_EVERY) return false; } } }return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; }; }; /***/ }), /* 56 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var isObject = __w_pdfjs_require__(1); module.exports = function (it, TYPE) { if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!'); return it; }; /***/ }), /* 57 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.build = exports.version = exports.setPDFNetworkStreamClass = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFWorker = exports.PDFDataRangeTransport = exports.LoopbackPort = exports.getDocument = undefined; 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 _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _util = __w_pdfjs_require__(0); var _dom_utils = __w_pdfjs_require__(8); var _font_loader = __w_pdfjs_require__(114); var _canvas = __w_pdfjs_require__(115); var _global_scope = __w_pdfjs_require__(14); var _global_scope2 = _interopRequireDefault(_global_scope); var _metadata = __w_pdfjs_require__(59); var _transport_stream = __w_pdfjs_require__(117); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var DEFAULT_RANGE_CHUNK_SIZE = 65536; var isWorkerDisabled = false; var workerSrc; var isPostMessageTransfersDisabled = false; var pdfjsFilePath = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : null; var fakeWorkerFilesLoader = null; var useRequireEnsure = false; { if (typeof window === 'undefined') { isWorkerDisabled = true; if (typeof require.ensure === 'undefined') { require.ensure = require('node-ensure'); } useRequireEnsure = true; } else if (typeof require !== 'undefined' && typeof require.ensure === 'function') { useRequireEnsure = true; } if (typeof requirejs !== 'undefined' && requirejs.toUrl) { workerSrc = requirejs.toUrl('pdfjs-dist/build/pdf.worker.js'); } var dynamicLoaderSupported = typeof requirejs !== 'undefined' && requirejs.load; fakeWorkerFilesLoader = useRequireEnsure ? function (callback) { require.ensure([], function () { var worker; worker = require('./pdf.worker.js'); callback(worker.WorkerMessageHandler); }); } : dynamicLoaderSupported ? function (callback) { requirejs(['pdfjs-dist/build/pdf.worker'], function (worker) { callback(worker.WorkerMessageHandler); }); } : null; } var PDFNetworkStream; function setPDFNetworkStreamClass(cls) { PDFNetworkStream = cls; } function getDocument(src) { var task = new PDFDocumentLoadingTask(); var source; if (typeof src === 'string') { source = { url: src }; } else if ((0, _util.isArrayBuffer)(src)) { source = { data: src }; } else if (src instanceof PDFDataRangeTransport) { source = { range: src }; } else { if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) !== 'object') { throw new Error('Invalid parameter in getDocument, ' + 'need either Uint8Array, string or a parameter object'); } if (!src.url && !src.data && !src.range) { throw new Error('Invalid parameter object: need either .data, .range or .url'); } source = src; } var params = {}; var rangeTransport = null; var worker = null; var CMapReaderFactory = _dom_utils.DOMCMapReaderFactory; for (var key in source) { if (key === 'url' && typeof window !== 'undefined') { params[key] = new URL(source[key], window.location).href; continue; } else if (key === 'range') { rangeTransport = source[key]; continue; } else if (key === 'worker') { worker = source[key]; continue; } else if (key === 'data' && !(source[key] instanceof Uint8Array)) { var pdfBytes = source[key]; if (typeof pdfBytes === 'string') { params[key] = (0, _util.stringToBytes)(pdfBytes); } else if ((typeof pdfBytes === 'undefined' ? 'undefined' : _typeof(pdfBytes)) === 'object' && pdfBytes !== null && !isNaN(pdfBytes.length)) { params[key] = new Uint8Array(pdfBytes); } else if ((0, _util.isArrayBuffer)(pdfBytes)) { params[key] = new Uint8Array(pdfBytes); } else { throw new Error('Invalid PDF binary data: either typed array, ' + 'string or array-like object is expected in the ' + 'data property.'); } continue; } else if (key === 'CMapReaderFactory') { CMapReaderFactory = source[key]; continue; } params[key] = source[key]; } params.rangeChunkSize = params.rangeChunkSize || DEFAULT_RANGE_CHUNK_SIZE; params.ignoreErrors = params.stopAtErrors !== true; var nativeImageDecoderValues = Object.values(_util.NativeImageDecoding); if (params.nativeImageDecoderSupport === undefined || !nativeImageDecoderValues.includes(params.nativeImageDecoderSupport)) { params.nativeImageDecoderSupport = _util.NativeImageDecoding.DECODE; } if (!worker) { var workerPort = (0, _dom_utils.getDefaultSetting)('workerPort'); worker = workerPort ? PDFWorker.fromPort(workerPort) : new PDFWorker(); task._worker = worker; } var docId = task.docId; worker.promise.then(function () { if (task.destroyed) { throw new Error('Loading aborted'); } return _fetchDocument(worker, params, rangeTransport, docId).then(function (workerId) { if (task.destroyed) { throw new Error('Loading aborted'); } var networkStream = void 0; if (rangeTransport) { networkStream = new _transport_stream.PDFDataTransportStream(params, rangeTransport); } else if (!params.data) { networkStream = new PDFNetworkStream({ source: params, disableRange: (0, _dom_utils.getDefaultSetting)('disableRange') }); } var messageHandler = new _util.MessageHandler(docId, workerId, worker.port); messageHandler.postMessageTransfers = worker.postMessageTransfers; var transport = new WorkerTransport(messageHandler, task, networkStream, CMapReaderFactory); task._transport = transport; messageHandler.send('Ready', null); }); }).catch(task._capability.reject); return task; } function _fetchDocument(worker, source, pdfDataRangeTransport, docId) { if (worker.destroyed) { return Promise.reject(new Error('Worker was destroyed')); } var apiVersion = '2.0.106'; source.disableAutoFetch = (0, _dom_utils.getDefaultSetting)('disableAutoFetch'); source.disableStream = (0, _dom_utils.getDefaultSetting)('disableStream'); source.chunkedViewerLoading = !!pdfDataRangeTransport; if (pdfDataRangeTransport) { source.length = pdfDataRangeTransport.length; source.initialData = pdfDataRangeTransport.initialData; } return worker.messageHandler.sendWithPromise('GetDocRequest', { docId: docId, apiVersion: apiVersion, source: { data: source.data, url: source.url, password: source.password, disableAutoFetch: source.disableAutoFetch, rangeChunkSize: source.rangeChunkSize, length: source.length }, maxImageSize: (0, _dom_utils.getDefaultSetting)('maxImageSize'), disableFontFace: (0, _dom_utils.getDefaultSetting)('disableFontFace'), disableCreateObjectURL: (0, _dom_utils.getDefaultSetting)('disableCreateObjectURL'), postMessageTransfers: (0, _dom_utils.getDefaultSetting)('postMessageTransfers') && !isPostMessageTransfersDisabled, docBaseUrl: source.docBaseUrl, nativeImageDecoderSupport: source.nativeImageDecoderSupport, ignoreErrors: source.ignoreErrors, isEvalSupported: (0, _dom_utils.getDefaultSetting)('isEvalSupported') }).then(function (workerId) { if (worker.destroyed) { throw new Error('Worker was destroyed'); } return workerId; }); } var PDFDocumentLoadingTask = function PDFDocumentLoadingTaskClosure() { var nextDocumentId = 0; function PDFDocumentLoadingTask() { this._capability = (0, _util.createPromiseCapability)(); this._transport = null; this._worker = null; this.docId = 'd' + nextDocumentId++; this.destroyed = false; this.onPassword = null; this.onProgress = null; this.onUnsupportedFeature = null; } PDFDocumentLoadingTask.prototype = { get promise() { return this._capability.promise; }, destroy: function destroy() { var _this = this; this.destroyed = true; var transportDestroyed = !this._transport ? Promise.resolve() : this._transport.destroy(); return transportDestroyed.then(function () { _this._transport = null; if (_this._worker) { _this._worker.destroy(); _this._worker = null; } }); }, then: function PDFDocumentLoadingTask_then(onFulfilled, onRejected) { return this.promise.then.apply(this.promise, arguments); } }; return PDFDocumentLoadingTask; }(); var PDFDataRangeTransport = function pdfDataRangeTransportClosure() { function PDFDataRangeTransport(length, initialData) { this.length = length; this.initialData = initialData; this._rangeListeners = []; this._progressListeners = []; this._progressiveReadListeners = []; this._readyCapability = (0, _util.createPromiseCapability)(); } PDFDataRangeTransport.prototype = { addRangeListener: function PDFDataRangeTransport_addRangeListener(listener) { this._rangeListeners.push(listener); }, addProgressListener: function PDFDataRangeTransport_addProgressListener(listener) { this._progressListeners.push(listener); }, addProgressiveReadListener: function PDFDataRangeTransport_addProgressiveReadListener(listener) { this._progressiveReadListeners.push(listener); }, onDataRange: function PDFDataRangeTransport_onDataRange(begin, chunk) { var listeners = this._rangeListeners; for (var i = 0, n = listeners.length; i < n; ++i) { listeners[i](begin, chunk); } }, onDataProgress: function PDFDataRangeTransport_onDataProgress(loaded) { var _this2 = this; this._readyCapability.promise.then(function () { var listeners = _this2._progressListeners; for (var i = 0, n = listeners.length; i < n; ++i) { listeners[i](loaded); } }); }, onDataProgressiveRead: function PDFDataRangeTransport_onDataProgress(chunk) { var _this3 = this; this._readyCapability.promise.then(function () { var listeners = _this3._progressiveReadListeners; for (var i = 0, n = listeners.length; i < n; ++i) { listeners[i](chunk); } }); }, transportReady: function PDFDataRangeTransport_transportReady() { this._readyCapability.resolve(); }, requestDataRange: function PDFDataRangeTransport_requestDataRange(begin, end) { throw new Error('Abstract method PDFDataRangeTransport.requestDataRange'); }, abort: function PDFDataRangeTransport_abort() {} }; return PDFDataRangeTransport; }(); var PDFDocumentProxy = function PDFDocumentProxyClosure() { function PDFDocumentProxy(pdfInfo, transport, loadingTask) { this.pdfInfo = pdfInfo; this.transport = transport; this.loadingTask = loadingTask; } PDFDocumentProxy.prototype = { get numPages() { return this.pdfInfo.numPages; }, get fingerprint() { return this.pdfInfo.fingerprint; }, getPage: function PDFDocumentProxy_getPage(pageNumber) { return this.transport.getPage(pageNumber); }, getPageIndex: function PDFDocumentProxy_getPageIndex(ref) { return this.transport.getPageIndex(ref); }, getDestinations: function PDFDocumentProxy_getDestinations() { return this.transport.getDestinations(); }, getDestination: function PDFDocumentProxy_getDestination(id) { return this.transport.getDestination(id); }, getPageLabels: function PDFDocumentProxy_getPageLabels() { return this.transport.getPageLabels(); }, getPageMode: function getPageMode() { return this.transport.getPageMode(); }, getAttachments: function PDFDocumentProxy_getAttachments() { return this.transport.getAttachments(); }, getJavaScript: function getJavaScript() { return this.transport.getJavaScript(); }, getOutline: function PDFDocumentProxy_getOutline() { return this.transport.getOutline(); }, getMetadata: function PDFDocumentProxy_getMetadata() { return this.transport.getMetadata(); }, getData: function PDFDocumentProxy_getData() { return this.transport.getData(); }, getDownloadInfo: function PDFDocumentProxy_getDownloadInfo() { return this.transport.downloadInfoCapability.promise; }, getStats: function PDFDocumentProxy_getStats() { return this.transport.getStats(); }, cleanup: function PDFDocumentProxy_cleanup() { this.transport.startCleanup(); }, destroy: function PDFDocumentProxy_destroy() { return this.loadingTask.destroy(); } }; return PDFDocumentProxy; }(); var PDFPageProxy = function PDFPageProxyClosure() { function PDFPageProxy(pageIndex, pageInfo, transport) { this.pageIndex = pageIndex; this.pageInfo = pageInfo; this.transport = transport; this.stats = new _util.StatTimer(); this.stats.enabled = (0, _dom_utils.getDefaultSetting)('enableStats'); this.commonObjs = transport.commonObjs; this.objs = new PDFObjects(); this.cleanupAfterRender = false; this.pendingCleanup = false; this.intentStates = Object.create(null); this.destroyed = false; } PDFPageProxy.prototype = { get pageNumber() { return this.pageIndex + 1; }, get rotate() { return this.pageInfo.rotate; }, get ref() { return this.pageInfo.ref; }, get userUnit() { return this.pageInfo.userUnit; }, get view() { return this.pageInfo.view; }, getViewport: function PDFPageProxy_getViewport(scale, rotate) { if (arguments.length < 2) { rotate = this.rotate; } return new _util.PageViewport(this.view, scale, rotate, 0, 0); }, getAnnotations: function PDFPageProxy_getAnnotations(params) { var intent = params && params.intent || null; if (!this.annotationsPromise || this.annotationsIntent !== intent) { this.annotationsPromise = this.transport.getAnnotations(this.pageIndex, intent); this.annotationsIntent = intent; } return this.annotationsPromise; }, render: function PDFPageProxy_render(params) { var _this4 = this; var stats = this.stats; stats.time('Overall'); this.pendingCleanup = false; var renderingIntent = params.intent === 'print' ? 'print' : 'display'; var canvasFactory = params.canvasFactory || new _dom_utils.DOMCanvasFactory(); if (!this.intentStates[renderingIntent]) { this.intentStates[renderingIntent] = Object.create(null); } var intentState = this.intentStates[renderingIntent]; if (!intentState.displayReadyCapability) { intentState.receivingOperatorList = true; intentState.displayReadyCapability = (0, _util.createPromiseCapability)(); intentState.operatorList = { fnArray: [], argsArray: [], lastChunk: false }; this.stats.time('Page Request'); this.transport.messageHandler.send('RenderPageRequest', { pageIndex: this.pageNumber - 1, intent: renderingIntent, renderInteractiveForms: params.renderInteractiveForms === true }); } var complete = function complete(error) { var i = intentState.renderTasks.indexOf(internalRenderTask); if (i >= 0) { intentState.renderTasks.splice(i, 1); } if (_this4.cleanupAfterRender) { _this4.pendingCleanup = true; } _this4._tryCleanup(); if (error) { internalRenderTask.capability.reject(error); } else { internalRenderTask.capability.resolve(); } stats.timeEnd('Rendering'); stats.timeEnd('Overall'); }; var internalRenderTask = new InternalRenderTask(complete, params, this.objs, this.commonObjs, intentState.operatorList, this.pageNumber, canvasFactory); internalRenderTask.useRequestAnimationFrame = renderingIntent !== 'print'; if (!intentState.renderTasks) { intentState.renderTasks = []; } intentState.renderTasks.push(internalRenderTask); var renderTask = internalRenderTask.task; intentState.displayReadyCapability.promise.then(function (transparency) { if (_this4.pendingCleanup) { complete(); return; } stats.time('Rendering'); internalRenderTask.initializeGraphics(transparency); internalRenderTask.operatorListChanged(); }).catch(complete); return renderTask; }, getOperatorList: function PDFPageProxy_getOperatorList() { function operatorListChanged() { if (intentState.operatorList.lastChunk) { intentState.opListReadCapability.resolve(intentState.operatorList); var i = intentState.renderTasks.indexOf(opListTask); if (i >= 0) { intentState.renderTasks.splice(i, 1); } } } var renderingIntent = 'oplist'; if (!this.intentStates[renderingIntent]) { this.intentStates[renderingIntent] = Object.create(null); } var intentState = this.intentStates[renderingIntent]; var opListTask; if (!intentState.opListReadCapability) { opListTask = {}; opListTask.operatorListChanged = operatorListChanged; intentState.receivingOperatorList = true; intentState.opListReadCapability = (0, _util.createPromiseCapability)(); intentState.renderTasks = []; intentState.renderTasks.push(opListTask); intentState.operatorList = { fnArray: [], argsArray: [], lastChunk: false }; this.transport.messageHandler.send('RenderPageRequest', { pageIndex: this.pageIndex, intent: renderingIntent }); } return intentState.opListReadCapability.promise; }, streamTextContent: function streamTextContent() { var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var TEXT_CONTENT_CHUNK_SIZE = 100; return this.transport.messageHandler.sendWithStream('GetTextContent', { pageIndex: this.pageNumber - 1, normalizeWhitespace: params.normalizeWhitespace === true, combineTextItems: params.disableCombineTextItems !== true }, { highWaterMark: TEXT_CONTENT_CHUNK_SIZE, size: function size(textContent) { return textContent.items.length; } }); }, getTextContent: function PDFPageProxy_getTextContent(params) { params = params || {}; var readableStream = this.streamTextContent(params); return new Promise(function (resolve, reject) { function pump() { reader.read().then(function (_ref) { var value = _ref.value, done = _ref.done; if (done) { resolve(textContent); return; } _util.Util.extendObj(textContent.styles, value.styles); _util.Util.appendToArray(textContent.items, value.items); pump(); }, reject); } var reader = readableStream.getReader(); var textContent = { items: [], styles: Object.create(null) }; pump(); }); }, _destroy: function PDFPageProxy_destroy() { this.destroyed = true; this.transport.pageCache[this.pageIndex] = null; var waitOn = []; Object.keys(this.intentStates).forEach(function (intent) { if (intent === 'oplist') { return; } var intentState = this.intentStates[intent]; intentState.renderTasks.forEach(function (renderTask) { var renderCompleted = renderTask.capability.promise.catch(function () {}); waitOn.push(renderCompleted); renderTask.cancel(); }); }, this); this.objs.clear(); this.annotationsPromise = null; this.pendingCleanup = false; return Promise.all(waitOn); }, cleanup: function PDFPageProxy_cleanup() { this.pendingCleanup = true; this._tryCleanup(); }, _tryCleanup: function PDFPageProxy_tryCleanup() { if (!this.pendingCleanup || Object.keys(this.intentStates).some(function (intent) { var intentState = this.intentStates[intent]; return intentState.renderTasks.length !== 0 || intentState.receivingOperatorList; }, this)) { return; } Object.keys(this.intentStates).forEach(function (intent) { delete this.intentStates[intent]; }, this); this.objs.clear(); this.annotationsPromise = null; this.pendingCleanup = false; }, _startRenderPage: function PDFPageProxy_startRenderPage(transparency, intent) { var intentState = this.intentStates[intent]; if (intentState.displayReadyCapability) { intentState.displayReadyCapability.resolve(transparency); } }, _renderPageChunk: function PDFPageProxy_renderPageChunk(operatorListChunk, intent) { var intentState = this.intentStates[intent]; var i, ii; for (i = 0, ii = operatorListChunk.length; i < ii; i++) { intentState.operatorList.fnArray.push(operatorListChunk.fnArray[i]); intentState.operatorList.argsArray.push(operatorListChunk.argsArray[i]); } intentState.operatorList.lastChunk = operatorListChunk.lastChunk; for (i = 0; i < intentState.renderTasks.length; i++) { intentState.renderTasks[i].operatorListChanged(); } if (operatorListChunk.lastChunk) { intentState.receivingOperatorList = false; this._tryCleanup(); } } }; return PDFPageProxy; }(); var LoopbackPort = function () { function LoopbackPort(defer) { _classCallCheck(this, LoopbackPort); this._listeners = []; this._defer = defer; this._deferred = Promise.resolve(undefined); } _createClass(LoopbackPort, [{ key: 'postMessage', value: function postMessage(obj, transfers) { var _this5 = this; function cloneValue(value) { if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) !== 'object' || value === null) { return value; } if (cloned.has(value)) { return cloned.get(value); } var result; var buffer; if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) { var transferable = transfers && transfers.indexOf(buffer) >= 0; if (value === buffer) { result = value; } else if (transferable) { result = new value.constructor(buffer, value.byteOffset, value.byteLength); } else { result = new value.constructor(value); } cloned.set(value, result); return result; } result = Array.isArray(value) ? [] : {}; cloned.set(value, result); for (var i in value) { var desc, p = value; while (!(desc = Object.getOwnPropertyDescriptor(p, i))) { p = Object.getPrototypeOf(p); } if (typeof desc.value === 'undefined' || typeof desc.value === 'function') { continue; } result[i] = cloneValue(desc.value); } return result; } if (!this._defer) { this._listeners.forEach(function (listener) { listener.call(this, { data: obj }); }, this); return; } var cloned = new WeakMap(); var e = { data: cloneValue(obj) }; this._deferred.then(function () { _this5._listeners.forEach(function (listener) { listener.call(this, e); }, _this5); }); } }, { key: 'addEventListener', value: function addEventListener(name, listener) { this._listeners.push(listener); } }, { key: 'removeEventListener', value: function removeEventListener(name, listener) { var i = this._listeners.indexOf(listener); this._listeners.splice(i, 1); } }, { key: 'terminate', value: function terminate() { this._listeners = []; } }]); return LoopbackPort; }(); var PDFWorker = function PDFWorkerClosure() { var nextFakeWorkerId = 0; function getWorkerSrc() { if (typeof workerSrc !== 'undefined') { return workerSrc; } if ((0, _dom_utils.getDefaultSetting)('workerSrc')) { return (0, _dom_utils.getDefaultSetting)('workerSrc'); } if (pdfjsFilePath) { return pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i, '.worker$1$2'); } throw new Error('No PDFJS.workerSrc specified'); } var fakeWorkerFilesLoadedCapability = void 0; function setupFakeWorkerGlobal() { var WorkerMessageHandler; if (fakeWorkerFilesLoadedCapability) { return fakeWorkerFilesLoadedCapability.promise; } fakeWorkerFilesLoadedCapability = (0, _util.createPromiseCapability)(); var loader = fakeWorkerFilesLoader || function (callback) { _util.Util.loadScript(getWorkerSrc(), function () { callback(window.pdfjsDistBuildPdfWorker.WorkerMessageHandler); }); }; loader(fakeWorkerFilesLoadedCapability.resolve); return fakeWorkerFilesLoadedCapability.promise; } function createCDNWrapper(url) { var wrapper = 'importScripts(\'' + url + '\');'; return URL.createObjectURL(new Blob([wrapper])); } var pdfWorkerPorts = new WeakMap(); function PDFWorker(name, port) { if (port && pdfWorkerPorts.has(port)) { throw new Error('Cannot use more than one PDFWorker per port'); } this.name = name; this.destroyed = false; this.postMessageTransfers = true; this._readyCapability = (0, _util.createPromiseCapability)(); this._port = null; this._webWorker = null; this._messageHandler = null; if (port) { pdfWorkerPorts.set(port, this); this._initializeFromPort(port); return; } this._initialize(); } PDFWorker.prototype = { get promise() { return this._readyCapability.promise; }, get port() { return this._port; }, get messageHandler() { return this._messageHandler; }, _initializeFromPort: function PDFWorker_initializeFromPort(port) { this._port = port; this._messageHandler = new _util.MessageHandler('main', 'worker', port); this._messageHandler.on('ready', function () {}); this._readyCapability.resolve(); }, _initialize: function PDFWorker_initialize() { var _this6 = this; if (!isWorkerDisabled && !(0, _dom_utils.getDefaultSetting)('disableWorker') && typeof Worker !== 'undefined') { var workerSrc = getWorkerSrc(); try { if (!(0, _util.isSameOrigin)(window.location.href, workerSrc)) { workerSrc = createCDNWrapper(new URL(workerSrc, window.location).href); } var worker = new Worker(workerSrc); var messageHandler = new _util.MessageHandler('main', 'worker', worker); var terminateEarly = function terminateEarly() { worker.removeEventListener('error', onWorkerError); messageHandler.destroy(); worker.terminate(); if (_this6.destroyed) { _this6._readyCapability.reject(new Error('Worker was destroyed')); } else { _this6._setupFakeWorker(); } }; var onWorkerError = function onWorkerError() { if (!_this6._webWorker) { terminateEarly(); } }; worker.addEventListener('error', onWorkerError); messageHandler.on('test', function (data) { worker.removeEventListener('error', onWorkerError); if (_this6.destroyed) { terminateEarly(); return; } var supportTypedArray = data && data.supportTypedArray; if (supportTypedArray) { _this6._messageHandler = messageHandler; _this6._port = worker; _this6._webWorker = worker; if (!data.supportTransfers) { _this6.postMessageTransfers = false; isPostMessageTransfersDisabled = true; } _this6._readyCapability.resolve(); messageHandler.send('configure', { verbosity: (0, _util.getVerbosityLevel)() }); } else { _this6._setupFakeWorker(); messageHandler.destroy(); worker.terminate(); } }); messageHandler.on('console_log', function (data) { console.log.apply(console, data); }); messageHandler.on('console_error', function (data) { console.error.apply(console, data); }); messageHandler.on('ready', function (data) { worker.removeEventListener('error', onWorkerError); if (_this6.destroyed) { terminateEarly(); return; } try { sendTest(); } catch (e) { _this6._setupFakeWorker(); } }); var sendTest = function sendTest() { var postMessageTransfers = (0, _dom_utils.getDefaultSetting)('postMessageTransfers') && !isPostMessageTransfersDisabled; var testObj = new Uint8Array([postMessageTransfers ? 255 : 0]); try { messageHandler.send('test', testObj, [testObj.buffer]); } catch (ex) { (0, _util.info)('Cannot use postMessage transfers'); testObj[0] = 0; messageHandler.send('test', testObj); } }; sendTest(); return; } catch (e) { (0, _util.info)('The worker has been disabled.'); } } this._setupFakeWorker(); }, _setupFakeWorker: function PDFWorker_setupFakeWorker() { var _this7 = this; if (!isWorkerDisabled && !(0, _dom_utils.getDefaultSetting)('disableWorker')) { (0, _util.warn)('Setting up fake worker.'); isWorkerDisabled = true; } setupFakeWorkerGlobal().then(function (WorkerMessageHandler) { if (_this7.destroyed) { _this7._readyCapability.reject(new Error('Worker was destroyed')); return; } var isTypedArraysPresent = Uint8Array !== Float32Array; var port = new LoopbackPort(isTypedArraysPresent); _this7._port = port; var id = 'fake' + nextFakeWorkerId++; var workerHandler = new _util.MessageHandler(id + '_worker', id, port); WorkerMessageHandler.setup(workerHandler, port); var messageHandler = new _util.MessageHandler(id, id + '_worker', port); _this7._messageHandler = messageHandler; _this7._readyCapability.resolve(); }); }, destroy: function PDFWorker_destroy() { this.destroyed = true; if (this._webWorker) { this._webWorker.terminate(); this._webWorker = null; } pdfWorkerPorts.delete(this._port); this._port = null; if (this._messageHandler) { this._messageHandler.destroy(); this._messageHandler = null; } } }; PDFWorker.fromPort = function (port) { if (pdfWorkerPorts.has(port)) { return pdfWorkerPorts.get(port); } return new PDFWorker(null, port); }; return PDFWorker; }(); var WorkerTransport = function WorkerTransportClosure() { function WorkerTransport(messageHandler, loadingTask, networkStream, CMapReaderFactory) { this.messageHandler = messageHandler; this.loadingTask = loadingTask; this.commonObjs = new PDFObjects(); this.fontLoader = new _font_loader.FontLoader(loadingTask.docId); this.CMapReaderFactory = new CMapReaderFactory({ baseUrl: (0, _dom_utils.getDefaultSetting)('cMapUrl'), isCompressed: (0, _dom_utils.getDefaultSetting)('cMapPacked') }); this.destroyed = false; this.destroyCapability = null; this._passwordCapability = null; this._networkStream = networkStream; this._fullReader = null; this._lastProgress = null; this.pageCache = []; this.pagePromises = []; this.downloadInfoCapability = (0, _util.createPromiseCapability)(); this.setupMessageHandler(); } WorkerTransport.prototype = { destroy: function WorkerTransport_destroy() { var _this8 = this; if (this.destroyCapability) { return this.destroyCapability.promise; } this.destroyed = true; this.destroyCapability = (0, _util.createPromiseCapability)(); if (this._passwordCapability) { this._passwordCapability.reject(new Error('Worker was destroyed during onPassword callback')); } var waitOn = []; this.pageCache.forEach(function (page) { if (page) { waitOn.push(page._destroy()); } }); this.pageCache = []; this.pagePromises = []; var terminated = this.messageHandler.sendWithPromise('Terminate', null); waitOn.push(terminated); Promise.all(waitOn).then(function () { _this8.fontLoader.clear(); if (_this8._networkStream) { _this8._networkStream.cancelAllRequests(); } if (_this8.messageHandler) { _this8.messageHandler.destroy(); _this8.messageHandler = null; } _this8.destroyCapability.resolve(); }, this.destroyCapability.reject); return this.destroyCapability.promise; }, setupMessageHandler: function WorkerTransport_setupMessageHandler() { var messageHandler = this.messageHandler; var loadingTask = this.loadingTask; messageHandler.on('GetReader', function (data, sink) { var _this9 = this; (0, _util.assert)(this._networkStream); this._fullReader = this._networkStream.getFullReader(); this._fullReader.onProgress = function (evt) { _this9._lastProgress = { loaded: evt.loaded, total: evt.total }; }; sink.onPull = function () { _this9._fullReader.read().then(function (_ref2) { var value = _ref2.value, done = _ref2.done; if (done) { sink.close(); return; } (0, _util.assert)((0, _util.isArrayBuffer)(value)); sink.enqueue(new Uint8Array(value), 1, [value]); }).catch(function (reason) { sink.error(reason); }); }; sink.onCancel = function (reason) { _this9._fullReader.cancel(reason); }; }, this); messageHandler.on('ReaderHeadersReady', function (data) { var _this10 = this; var headersCapability = (0, _util.createPromiseCapability)(); var fullReader = this._fullReader; fullReader.headersReady.then(function () { if (!fullReader.isStreamingSupported || !fullReader.isRangeSupported) { if (_this10._lastProgress) { var _loadingTask = _this10.loadingTask; if (_loadingTask.onProgress) { _loadingTask.onProgress(_this10._lastProgress); } } fullReader.onProgress = function (evt) { var loadingTask = _this10.loadingTask; if (loadingTask.onProgress) { loadingTask.onProgress({ loaded: evt.loaded, total: evt.total }); } }; } headersCapability.resolve({ isStreamingSupported: fullReader.isStreamingSupported, isRangeSupported: fullReader.isRangeSupported, contentLength: fullReader.contentLength }); }, headersCapability.reject); return headersCapability.promise; }, this); messageHandler.on('GetRangeReader', function (data, sink) { (0, _util.assert)(this._networkStream); var _rangeReader = this._networkStream.getRangeReader(data.begin, data.end); sink.onPull = function () { _rangeReader.read().then(function (_ref3) { var value = _ref3.value, done = _ref3.done; if (done) { sink.close(); return; } (0, _util.assert)((0, _util.isArrayBuffer)(value)); sink.enqueue(new Uint8Array(value), 1, [value]); }).catch(function (reason) { sink.error(reason); }); }; sink.onCancel = function (reason) { _rangeReader.cancel(reason); }; }, this); messageHandler.on('GetDoc', function transportDoc(data) { var pdfInfo = data.pdfInfo; this.numPages = data.pdfInfo.numPages; var loadingTask = this.loadingTask; var pdfDocument = new PDFDocumentProxy(pdfInfo, this, loadingTask); this.pdfDocument = pdfDocument; loadingTask._capability.resolve(pdfDocument); }, this); messageHandler.on('PasswordRequest', function transportPasswordRequest(exception) { var _this11 = this; this._passwordCapability = (0, _util.createPromiseCapability)(); if (loadingTask.onPassword) { var updatePassword = function updatePassword(password) { _this11._passwordCapability.resolve({ password: password }); }; loadingTask.onPassword(updatePassword, exception.code); } else { this._passwordCapability.reject(new _util.PasswordException(exception.message, exception.code)); } return this._passwordCapability.promise; }, this); messageHandler.on('PasswordException', function transportPasswordException(exception) { loadingTask._capability.reject(new _util.PasswordException(exception.message, exception.code)); }, this); messageHandler.on('InvalidPDF', function transportInvalidPDF(exception) { this.loadingTask._capability.reject(new _util.InvalidPDFException(exception.message)); }, this); messageHandler.on('MissingPDF', function transportMissingPDF(exception) { this.loadingTask._capability.reject(new _util.MissingPDFException(exception.message)); }, this); messageHandler.on('UnexpectedResponse', function transportUnexpectedResponse(exception) { this.loadingTask._capability.reject(new _util.UnexpectedResponseException(exception.message, exception.status)); }, this); messageHandler.on('UnknownError', function transportUnknownError(exception) { this.loadingTask._capability.reject(new _util.UnknownErrorException(exception.message, exception.details)); }, this); messageHandler.on('DataLoaded', function transportPage(data) { this.downloadInfoCapability.resolve(data); }, this); messageHandler.on('PDFManagerReady', function transportPage(data) {}, this); messageHandler.on('StartRenderPage', function transportRender(data) { if (this.destroyed) { return; } var page = this.pageCache[data.pageIndex]; page.stats.timeEnd('Page Request'); page._startRenderPage(data.transparency, data.intent); }, this); messageHandler.on('RenderPageChunk', function transportRender(data) { if (this.destroyed) { return; } var page = this.pageCache[data.pageIndex]; page._renderPageChunk(data.operatorList, data.intent); }, this); messageHandler.on('commonobj', function transportObj(data) { var _this12 = this; if (this.destroyed) { return; } var id = data[0]; var type = data[1]; if (this.commonObjs.hasData(id)) { return; } switch (type) { case 'Font': var exportedData = data[2]; if ('error' in exportedData) { var exportedError = exportedData.error; (0, _util.warn)('Error during font loading: ' + exportedError); this.commonObjs.resolve(id, exportedError); break; } var fontRegistry = null; if ((0, _dom_utils.getDefaultSetting)('pdfBug') && _global_scope2.default.FontInspector && _global_scope2.default['FontInspector'].enabled) { fontRegistry = { registerFont: function registerFont(font, url) { _global_scope2.default['FontInspector'].fontAdded(font, url); } }; } var font = new _font_loader.FontFaceObject(exportedData, { isEvalSupported: (0, _dom_utils.getDefaultSetting)('isEvalSupported'), disableFontFace: (0, _dom_utils.getDefaultSetting)('disableFontFace'), fontRegistry: fontRegistry }); var fontReady = function fontReady(fontObjs) { _this12.commonObjs.resolve(id, font); }; this.fontLoader.bind([font], fontReady); break; case 'FontPath': this.commonObjs.resolve(id, data[2]); break; default: throw new Error('Got unknown common object type ' + type); } }, this); messageHandler.on('obj', function transportObj(data) { if (this.destroyed) { return; } var id = data[0]; var pageIndex = data[1]; var type = data[2]; var pageProxy = this.pageCache[pageIndex]; var imageData; if (pageProxy.objs.hasData(id)) { return; } switch (type) { case 'JpegStream': imageData = data[3]; (0, _util.loadJpegStream)(id, imageData, pageProxy.objs); break; case 'Image': imageData = data[3]; pageProxy.objs.resolve(id, imageData); var MAX_IMAGE_SIZE_TO_STORE = 8000000; if (imageData && 'data' in imageData && imageData.data.length > MAX_IMAGE_SIZE_TO_STORE) { pageProxy.cleanupAfterRender = true; } break; default: throw new Error('Got unknown object type ' + type); } }, this); messageHandler.on('DocProgress', function transportDocProgress(data) { if (this.destroyed) { return; } var loadingTask = this.loadingTask; if (loadingTask.onProgress) { loadingTask.onProgress({ loaded: data.loaded, total: data.total }); } }, this); messageHandler.on('PageError', function transportError(data) { if (this.destroyed) { return; } var page = this.pageCache[data.pageNum - 1]; var intentState = page.intentStates[data.intent]; if (intentState.displayReadyCapability) { intentState.displayReadyCapability.reject(data.error); } else { throw new Error(data.error); } if (intentState.operatorList) { intentState.operatorList.lastChunk = true; for (var i = 0; i < intentState.renderTasks.length; i++) { intentState.renderTasks[i].operatorListChanged(); } } }, this); messageHandler.on('UnsupportedFeature', function (data) { if (this.destroyed) { return; } var loadingTask = this.loadingTask; if (loadingTask.onUnsupportedFeature) { loadingTask.onUnsupportedFeature(data.featureId); } }, this); messageHandler.on('JpegDecode', function (data) { if (this.destroyed) { return Promise.reject(new Error('Worker was destroyed')); } if (typeof document === 'undefined') { return Promise.reject(new Error('"document" is not defined.')); } var imageUrl = data[0]; var components = data[1]; if (components !== 3 && components !== 1) { return Promise.reject(new Error('Only 3 components or 1 component can be returned')); } return new Promise(function (resolve, reject) { var img = new Image(); img.onload = function () { var width = img.width; var height = img.height; var size = width * height; var rgbaLength = size * 4; var buf = new Uint8Array(size * components); var tmpCanvas = document.createElement('canvas'); tmpCanvas.width = width; tmpCanvas.height = height; var tmpCtx = tmpCanvas.getContext('2d'); tmpCtx.drawImage(img, 0, 0); var data = tmpCtx.getImageData(0, 0, width, height).data; var i, j; if (components === 3) { for (i = 0, j = 0; i < rgbaLength; i += 4, j += 3) { buf[j] = data[i]; buf[j + 1] = data[i + 1]; buf[j + 2] = data[i + 2]; } } else if (components === 1) { for (i = 0, j = 0; i < rgbaLength; i += 4, j++) { buf[j] = data[i]; } } resolve({ data: buf, width: width, height: height }); }; img.onerror = function () { reject(new Error('JpegDecode failed to load image')); }; img.src = imageUrl; }); }, this); messageHandler.on('FetchBuiltInCMap', function (data) { if (this.destroyed) { return Promise.reject(new Error('Worker was destroyed')); } return this.CMapReaderFactory.fetch({ name: data.name }); }, this); }, getData: function WorkerTransport_getData() { return this.messageHandler.sendWithPromise('GetData', null); }, getPage: function WorkerTransport_getPage(pageNumber, capability) { var _this13 = this; if (!Number.isInteger(pageNumber) || pageNumber <= 0 || pageNumber > this.numPages) { return Promise.reject(new Error('Invalid page request')); } var pageIndex = pageNumber - 1; if (pageIndex in this.pagePromises) { return this.pagePromises[pageIndex]; } var promise = this.messageHandler.sendWithPromise('GetPage', { pageIndex: pageIndex }).then(function (pageInfo) { if (_this13.destroyed) { throw new Error('Transport destroyed'); } var page = new PDFPageProxy(pageIndex, pageInfo, _this13); _this13.pageCache[pageIndex] = page; return page; }); this.pagePromises[pageIndex] = promise; return promise; }, getPageIndex: function WorkerTransport_getPageIndexByRef(ref) { return this.messageHandler.sendWithPromise('GetPageIndex', { ref: ref }).catch(function (reason) { return Promise.reject(new Error(reason)); }); }, getAnnotations: function WorkerTransport_getAnnotations(pageIndex, intent) { return this.messageHandler.sendWithPromise('GetAnnotations', { pageIndex: pageIndex, intent: intent }); }, getDestinations: function WorkerTransport_getDestinations() { return this.messageHandler.sendWithPromise('GetDestinations', null); }, getDestination: function WorkerTransport_getDestination(id) { return this.messageHandler.sendWithPromise('GetDestination', { id: id }); }, getPageLabels: function WorkerTransport_getPageLabels() { return this.messageHandler.sendWithPromise('GetPageLabels', null); }, getPageMode: function getPageMode() { return this.messageHandler.sendWithPromise('GetPageMode', null); }, getAttachments: function WorkerTransport_getAttachments() { return this.messageHandler.sendWithPromise('GetAttachments', null); }, getJavaScript: function WorkerTransport_getJavaScript() { return this.messageHandler.sendWithPromise('GetJavaScript', null); }, getOutline: function WorkerTransport_getOutline() { return this.messageHandler.sendWithPromise('GetOutline', null); }, getMetadata: function WorkerTransport_getMetadata() { return this.messageHandler.sendWithPromise('GetMetadata', null).then(function transportMetadata(results) { return { info: results[0], metadata: results[1] ? new _metadata.Metadata(results[1]) : null }; }); }, getStats: function WorkerTransport_getStats() { return this.messageHandler.sendWithPromise('GetStats', null); }, startCleanup: function WorkerTransport_startCleanup() { var _this14 = this; this.messageHandler.sendWithPromise('Cleanup', null).then(function () { for (var i = 0, ii = _this14.pageCache.length; i < ii; i++) { var page = _this14.pageCache[i]; if (page) { page.cleanup(); } } _this14.commonObjs.clear(); _this14.fontLoader.clear(); }); } }; return WorkerTransport; }(); var PDFObjects = function PDFObjectsClosure() { function PDFObjects() { this.objs = Object.create(null); } PDFObjects.prototype = { ensureObj: function PDFObjects_ensureObj(objId) { if (this.objs[objId]) { return this.objs[objId]; } var obj = { capability: (0, _util.createPromiseCapability)(), data: null, resolved: false }; this.objs[objId] = obj; return obj; }, get: function PDFObjects_get(objId, callback) { if (callback) { this.ensureObj(objId).capability.promise.then(callback); return null; } var obj = this.objs[objId]; if (!obj || !obj.resolved) { throw new Error('Requesting object that isn\'t resolved yet ' + objId); } return obj.data; }, resolve: function PDFObjects_resolve(objId, data) { var obj = this.ensureObj(objId); obj.resolved = true; obj.data = data; obj.capability.resolve(data); }, isResolved: function PDFObjects_isResolved(objId) { var objs = this.objs; if (!objs[objId]) { return false; } return objs[objId].resolved; }, hasData: function PDFObjects_hasData(objId) { return this.isResolved(objId); }, getData: function PDFObjects_getData(objId) { var objs = this.objs; if (!objs[objId] || !objs[objId].resolved) { return null; } return objs[objId].data; }, clear: function PDFObjects_clear() { this.objs = Object.create(null); } }; return PDFObjects; }(); var RenderTask = function RenderTaskClosure() { function RenderTask(internalRenderTask) { this._internalRenderTask = internalRenderTask; this.onContinue = null; } RenderTask.prototype = { get promise() { return this._internalRenderTask.capability.promise; }, cancel: function RenderTask_cancel() { this._internalRenderTask.cancel(); }, then: function RenderTask_then(onFulfilled, onRejected) { return this.promise.then.apply(this.promise, arguments); } }; return RenderTask; }(); var InternalRenderTask = function InternalRenderTaskClosure() { var canvasInRendering = new WeakMap(); function InternalRenderTask(callback, params, objs, commonObjs, operatorList, pageNumber, canvasFactory) { this.callback = callback; this.params = params; this.objs = objs; this.commonObjs = commonObjs; this.operatorListIdx = null; this.operatorList = operatorList; this.pageNumber = pageNumber; this.canvasFactory = canvasFactory; this.running = false; this.graphicsReadyCallback = null; this.graphicsReady = false; this.useRequestAnimationFrame = false; this.cancelled = false; this.capability = (0, _util.createPromiseCapability)(); this.task = new RenderTask(this); this._continueBound = this._continue.bind(this); this._scheduleNextBound = this._scheduleNext.bind(this); this._nextBound = this._next.bind(this); this._canvas = params.canvasContext.canvas; } InternalRenderTask.prototype = { initializeGraphics: function InternalRenderTask_initializeGraphics(transparency) { if (this._canvas) { if (canvasInRendering.has(this._canvas)) { throw new Error('Cannot use the same canvas during multiple render() operations. ' + 'Use different canvas or ensure previous operations were ' + 'cancelled or completed.'); } canvasInRendering.set(this._canvas, this); } if (this.cancelled) { return; } if ((0, _dom_utils.getDefaultSetting)('pdfBug') && _global_scope2.default.StepperManager && _global_scope2.default.StepperManager.enabled) { this.stepper = _global_scope2.default.StepperManager.create(this.pageNumber - 1); this.stepper.init(this.operatorList); this.stepper.nextBreakPoint = this.stepper.getNextBreakPoint(); } var params = this.params; this.gfx = new _canvas.CanvasGraphics(params.canvasContext, this.commonObjs, this.objs, this.canvasFactory, params.imageLayer); this.gfx.beginDrawing({ transform: params.transform, viewport: params.viewport, transparency: transparency, background: params.background }); this.operatorListIdx = 0; this.graphicsReady = true; if (this.graphicsReadyCallback) { this.graphicsReadyCallback(); } }, cancel: function InternalRenderTask_cancel() { this.running = false; this.cancelled = true; if (this._canvas) { canvasInRendering.delete(this._canvas); } this.callback(new _dom_utils.RenderingCancelledException('Rendering cancelled, page ' + this.pageNumber, 'canvas')); }, operatorListChanged: function InternalRenderTask_operatorListChanged() { if (!this.graphicsReady) { if (!this.graphicsReadyCallback) { this.graphicsReadyCallback = this._continueBound; } return; } if (this.stepper) { this.stepper.updateOperatorList(this.operatorList); } if (this.running) { return; } this._continue(); }, _continue: function InternalRenderTask__continue() { this.running = true; if (this.cancelled) { return; } if (this.task.onContinue) { this.task.onContinue(this._scheduleNextBound); } else { this._scheduleNext(); } }, _scheduleNext: function InternalRenderTask__scheduleNext() { if (this.useRequestAnimationFrame && typeof window !== 'undefined') { window.requestAnimationFrame(this._nextBound); } else { Promise.resolve(undefined).then(this._nextBound); } }, _next: function InternalRenderTask__next() { if (this.cancelled) { return; } this.operatorListIdx = this.gfx.executeOperatorList(this.operatorList, this.operatorListIdx, this._continueBound, this.stepper); if (this.operatorListIdx === this.operatorList.argsArray.length) { this.running = false; if (this.operatorList.lastChunk) { this.gfx.endDrawing(); if (this._canvas) { canvasInRendering.delete(this._canvas); } this.callback(); } } } }; return InternalRenderTask; }(); var version, build; { exports.version = version = '2.0.106'; exports.build = build = '0052dc2b'; } exports.getDocument = getDocument; exports.LoopbackPort = LoopbackPort; exports.PDFDataRangeTransport = PDFDataRangeTransport; exports.PDFWorker = PDFWorker; exports.PDFDocumentProxy = PDFDocumentProxy; exports.PDFPageProxy = PDFPageProxy; exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass; exports.version = version; exports.build = build; /***/ }), /* 58 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WebGLUtils = undefined; var _dom_utils = __w_pdfjs_require__(8); var _util = __w_pdfjs_require__(0); var WebGLUtils = function WebGLUtilsClosure() { function loadShader(gl, code, shaderType) { var shader = gl.createShader(shaderType); gl.shaderSource(shader, code); gl.compileShader(shader); var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS); if (!compiled) { var errorMsg = gl.getShaderInfoLog(shader); throw new Error('Error during shader compilation: ' + errorMsg); } return shader; } function createVertexShader(gl, code) { return loadShader(gl, code, gl.VERTEX_SHADER); } function createFragmentShader(gl, code) { return loadShader(gl, code, gl.FRAGMENT_SHADER); } function createProgram(gl, shaders) { var program = gl.createProgram(); for (var i = 0, ii = shaders.length; i < ii; ++i) { gl.attachShader(program, shaders[i]); } gl.linkProgram(program); var linked = gl.getProgramParameter(program, gl.LINK_STATUS); if (!linked) { var errorMsg = gl.getProgramInfoLog(program); throw new Error('Error during program linking: ' + errorMsg); } return program; } function createTexture(gl, image, textureId) { gl.activeTexture(textureId); var texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, texture); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image); return texture; } var currentGL, currentCanvas; function generateGL() { if (currentGL) { return; } currentCanvas = document.createElement('canvas'); currentGL = currentCanvas.getContext('webgl', { premultipliedalpha: false }); } var smaskVertexShaderCode = '\ attribute vec2 a_position; \ attribute vec2 a_texCoord; \ \ uniform vec2 u_resolution; \ \ varying vec2 v_texCoord; \ \ void main() { \ vec2 clipSpace = (a_position / u_resolution) * 2.0 - 1.0; \ gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ \ v_texCoord = a_texCoord; \ } '; var smaskFragmentShaderCode = '\ precision mediump float; \ \ uniform vec4 u_backdrop; \ uniform int u_subtype; \ uniform sampler2D u_image; \ uniform sampler2D u_mask; \ \ varying vec2 v_texCoord; \ \ void main() { \ vec4 imageColor = texture2D(u_image, v_texCoord); \ vec4 maskColor = texture2D(u_mask, v_texCoord); \ if (u_backdrop.a > 0.0) { \ maskColor.rgb = maskColor.rgb * maskColor.a + \ u_backdrop.rgb * (1.0 - maskColor.a); \ } \ float lum; \ if (u_subtype == 0) { \ lum = maskColor.a; \ } else { \ lum = maskColor.r * 0.3 + maskColor.g * 0.59 + \ maskColor.b * 0.11; \ } \ imageColor.a *= lum; \ imageColor.rgb *= imageColor.a; \ gl_FragColor = imageColor; \ } '; var smaskCache = null; function initSmaskGL() { var canvas, gl; generateGL(); canvas = currentCanvas; currentCanvas = null; gl = currentGL; currentGL = null; var vertexShader = createVertexShader(gl, smaskVertexShaderCode); var fragmentShader = createFragmentShader(gl, smaskFragmentShaderCode); var program = createProgram(gl, [vertexShader, fragmentShader]); gl.useProgram(program); var cache = {}; cache.gl = gl; cache.canvas = canvas; cache.resolutionLocation = gl.getUniformLocation(program, 'u_resolution'); cache.positionLocation = gl.getAttribLocation(program, 'a_position'); cache.backdropLocation = gl.getUniformLocation(program, 'u_backdrop'); cache.subtypeLocation = gl.getUniformLocation(program, 'u_subtype'); var texCoordLocation = gl.getAttribLocation(program, 'a_texCoord'); var texLayerLocation = gl.getUniformLocation(program, 'u_image'); var texMaskLocation = gl.getUniformLocation(program, 'u_mask'); var texCoordBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 1.0]), gl.STATIC_DRAW); gl.enableVertexAttribArray(texCoordLocation); gl.vertexAttribPointer(texCoordLocation, 2, gl.FLOAT, false, 0, 0); gl.uniform1i(texLayerLocation, 0); gl.uniform1i(texMaskLocation, 1); smaskCache = cache; } function composeSMask(layer, mask, properties) { var width = layer.width, height = layer.height; if (!smaskCache) { initSmaskGL(); } var cache = smaskCache, canvas = cache.canvas, gl = cache.gl; canvas.width = width; canvas.height = height; gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); gl.uniform2f(cache.resolutionLocation, width, height); if (properties.backdrop) { gl.uniform4f(cache.resolutionLocation, properties.backdrop[0], properties.backdrop[1], properties.backdrop[2], 1); } else { gl.uniform4f(cache.resolutionLocation, 0, 0, 0, 0); } gl.uniform1i(cache.subtypeLocation, properties.subtype === 'Luminosity' ? 1 : 0); var texture = createTexture(gl, layer, gl.TEXTURE0); var maskTexture = createTexture(gl, mask, gl.TEXTURE1); var buffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, buffer); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0, 0, width, 0, 0, height, 0, height, width, 0, width, height]), gl.STATIC_DRAW); gl.enableVertexAttribArray(cache.positionLocation); gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); gl.clearColor(0, 0, 0, 0); gl.enable(gl.BLEND); gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA); gl.clear(gl.COLOR_BUFFER_BIT); gl.drawArrays(gl.TRIANGLES, 0, 6); gl.flush(); gl.deleteTexture(texture); gl.deleteTexture(maskTexture); gl.deleteBuffer(buffer); return canvas; } var figuresVertexShaderCode = '\ attribute vec2 a_position; \ attribute vec3 a_color; \ \ uniform vec2 u_resolution; \ uniform vec2 u_scale; \ uniform vec2 u_offset; \ \ varying vec4 v_color; \ \ void main() { \ vec2 position = (a_position + u_offset) * u_scale; \ vec2 clipSpace = (position / u_resolution) * 2.0 - 1.0; \ gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1); \ \ v_color = vec4(a_color / 255.0, 1.0); \ } '; var figuresFragmentShaderCode = '\ precision mediump float; \ \ varying vec4 v_color; \ \ void main() { \ gl_FragColor = v_color; \ } '; var figuresCache = null; function initFiguresGL() { var canvas, gl; generateGL(); canvas = currentCanvas; currentCanvas = null; gl = currentGL; currentGL = null; var vertexShader = createVertexShader(gl, figuresVertexShaderCode); var fragmentShader = createFragmentShader(gl, figuresFragmentShaderCode); var program = createProgram(gl, [vertexShader, fragmentShader]); gl.useProgram(program); var cache = {}; cache.gl = gl; cache.canvas = canvas; cache.resolutionLocation = gl.getUniformLocation(program, 'u_resolution'); cache.scaleLocation = gl.getUniformLocation(program, 'u_scale'); cache.offsetLocation = gl.getUniformLocation(program, 'u_offset'); cache.positionLocation = gl.getAttribLocation(program, 'a_position'); cache.colorLocation = gl.getAttribLocation(program, 'a_color'); figuresCache = cache; } function drawFigures(width, height, backgroundColor, figures, context) { if (!figuresCache) { initFiguresGL(); } var cache = figuresCache, canvas = cache.canvas, gl = cache.gl; canvas.width = width; canvas.height = height; gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); gl.uniform2f(cache.resolutionLocation, width, height); var count = 0; var i, ii, rows; for (i = 0, ii = figures.length; i < ii; i++) { switch (figures[i].type) { case 'lattice': rows = figures[i].coords.length / figures[i].verticesPerRow | 0; count += (rows - 1) * (figures[i].verticesPerRow - 1) * 6; break; case 'triangles': count += figures[i].coords.length; break; } } var coords = new Float32Array(count * 2); var colors = new Uint8Array(count * 3); var coordsMap = context.coords, colorsMap = context.colors; var pIndex = 0, cIndex = 0; for (i = 0, ii = figures.length; i < ii; i++) { var figure = figures[i], ps = figure.coords, cs = figure.colors; switch (figure.type) { case 'lattice': var cols = figure.verticesPerRow; rows = ps.length / cols | 0; for (var row = 1; row < rows; row++) { var offset = row * cols + 1; for (var col = 1; col < cols; col++, offset++) { coords[pIndex] = coordsMap[ps[offset - cols - 1]]; coords[pIndex + 1] = coordsMap[ps[offset - cols - 1] + 1]; coords[pIndex + 2] = coordsMap[ps[offset - cols]]; coords[pIndex + 3] = coordsMap[ps[offset - cols] + 1]; coords[pIndex + 4] = coordsMap[ps[offset - 1]]; coords[pIndex + 5] = coordsMap[ps[offset - 1] + 1]; colors[cIndex] = colorsMap[cs[offset - cols - 1]]; colors[cIndex + 1] = colorsMap[cs[offset - cols - 1] + 1]; colors[cIndex + 2] = colorsMap[cs[offset - cols - 1] + 2]; colors[cIndex + 3] = colorsMap[cs[offset - cols]]; colors[cIndex + 4] = colorsMap[cs[offset - cols] + 1]; colors[cIndex + 5] = colorsMap[cs[offset - cols] + 2]; colors[cIndex + 6] = colorsMap[cs[offset - 1]]; colors[cIndex + 7] = colorsMap[cs[offset - 1] + 1]; colors[cIndex + 8] = colorsMap[cs[offset - 1] + 2]; coords[pIndex + 6] = coords[pIndex + 2]; coords[pIndex + 7] = coords[pIndex + 3]; coords[pIndex + 8] = coords[pIndex + 4]; coords[pIndex + 9] = coords[pIndex + 5]; coords[pIndex + 10] = coordsMap[ps[offset]]; coords[pIndex + 11] = coordsMap[ps[offset] + 1]; colors[cIndex + 9] = colors[cIndex + 3]; colors[cIndex + 10] = colors[cIndex + 4]; colors[cIndex + 11] = colors[cIndex + 5]; colors[cIndex + 12] = colors[cIndex + 6]; colors[cIndex + 13] = colors[cIndex + 7]; colors[cIndex + 14] = colors[cIndex + 8]; colors[cIndex + 15] = colorsMap[cs[offset]]; colors[cIndex + 16] = colorsMap[cs[offset] + 1]; colors[cIndex + 17] = colorsMap[cs[offset] + 2]; pIndex += 12; cIndex += 18; } } break; case 'triangles': for (var j = 0, jj = ps.length; j < jj; j++) { coords[pIndex] = coordsMap[ps[j]]; coords[pIndex + 1] = coordsMap[ps[j] + 1]; colors[cIndex] = colorsMap[cs[j]]; colors[cIndex + 1] = colorsMap[cs[j] + 1]; colors[cIndex + 2] = colorsMap[cs[j] + 2]; pIndex += 2; cIndex += 3; } break; } } if (backgroundColor) { gl.clearColor(backgroundColor[0] / 255, backgroundColor[1] / 255, backgroundColor[2] / 255, 1.0); } else { gl.clearColor(0, 0, 0, 0); } gl.clear(gl.COLOR_BUFFER_BIT); var coordsBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, coordsBuffer); gl.bufferData(gl.ARRAY_BUFFER, coords, gl.STATIC_DRAW); gl.enableVertexAttribArray(cache.positionLocation); gl.vertexAttribPointer(cache.positionLocation, 2, gl.FLOAT, false, 0, 0); var colorsBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, colorsBuffer); gl.bufferData(gl.ARRAY_BUFFER, colors, gl.STATIC_DRAW); gl.enableVertexAttribArray(cache.colorLocation); gl.vertexAttribPointer(cache.colorLocation, 3, gl.UNSIGNED_BYTE, false, 0, 0); gl.uniform2f(cache.scaleLocation, context.scaleX, context.scaleY); gl.uniform2f(cache.offsetLocation, context.offsetX, context.offsetY); gl.drawArrays(gl.TRIANGLES, 0, count); gl.flush(); gl.deleteBuffer(coordsBuffer); gl.deleteBuffer(colorsBuffer); return canvas; } function cleanup() { if (smaskCache && smaskCache.canvas) { smaskCache.canvas.width = 0; smaskCache.canvas.height = 0; } if (figuresCache && figuresCache.canvas) { figuresCache.canvas.width = 0; figuresCache.canvas.height = 0; } smaskCache = null; figuresCache = null; } return { get isEnabled() { if ((0, _dom_utils.getDefaultSetting)('disableWebGL')) { return false; } var enabled = false; try { generateGL(); enabled = !!currentGL; } catch (e) {} return (0, _util.shadow)(this, 'isEnabled', enabled); }, composeSMask: composeSMask, drawFigures: drawFigures, clear: cleanup }; }(); exports.WebGLUtils = WebGLUtils; /***/ }), /* 59 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Metadata = undefined; 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 _util = __w_pdfjs_require__(0); var _dom_utils = __w_pdfjs_require__(8); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Metadata = function () { function Metadata(data) { _classCallCheck(this, Metadata); (0, _util.assert)(typeof data === 'string', 'Metadata: input is not a string'); data = this._repair(data); var parser = new _dom_utils.SimpleXMLParser(); data = parser.parseFromString(data); this._metadata = Object.create(null); this._parse(data); } _createClass(Metadata, [{ key: '_repair', value: function _repair(data) { return data.replace(/>\\376\\377([^<]+)/g, function (all, codes) { var bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) { return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1); }); var chars = ''; for (var i = 0, ii = bytes.length; i < ii; i += 2) { var code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1); if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) { chars += String.fromCharCode(code); } else { chars += '&#x' + (0x10000 + code).toString(16).substring(1) + ';'; } } return '>' + chars; }); } }, { key: '_parse', value: function _parse(domDocument) { var rdf = domDocument.documentElement; if (rdf.nodeName.toLowerCase() !== 'rdf:rdf') { rdf = rdf.firstChild; while (rdf && rdf.nodeName.toLowerCase() !== 'rdf:rdf') { rdf = rdf.nextSibling; } } var nodeName = rdf ? rdf.nodeName.toLowerCase() : null; if (!rdf || nodeName !== 'rdf:rdf' || !rdf.hasChildNodes()) { return; } var children = rdf.childNodes; for (var i = 0, ii = children.length; i < ii; i++) { var desc = children[i]; if (desc.nodeName.toLowerCase() !== 'rdf:description') { continue; } for (var j = 0, jj = desc.childNodes.length; j < jj; j++) { if (desc.childNodes[j].nodeName.toLowerCase() !== '#text') { var entry = desc.childNodes[j]; var name = entry.nodeName.toLowerCase(); this._metadata[name] = entry.textContent.trim(); } } } } }, { key: 'get', value: function get(name) { return this._metadata[name] || null; } }, { key: 'getAll', value: function getAll() { return this._metadata; } }, { key: 'has', value: function has(name) { return typeof this._metadata[name] !== 'undefined'; } }]); return Metadata; }(); exports.Metadata = Metadata; /***/ }), /* 60 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AnnotationLayer = undefined; 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 _dom_utils = __w_pdfjs_require__(8); var _util = __w_pdfjs_require__(0); function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var AnnotationElementFactory = function () { function AnnotationElementFactory() { _classCallCheck(this, AnnotationElementFactory); } _createClass(AnnotationElementFactory, null, [{ key: 'create', value: function create(parameters) { var subtype = parameters.data.annotationType; switch (subtype) { case _util.AnnotationType.LINK: return new LinkAnnotationElement(parameters); case _util.AnnotationType.TEXT: return new TextAnnotationElement(parameters); case _util.AnnotationType.WIDGET: var fieldType = parameters.data.fieldType; switch (fieldType) { case 'Tx': return new TextWidgetAnnotationElement(parameters); case 'Btn': if (parameters.data.radioButton) { return new RadioButtonWidgetAnnotationElement(parameters); } else if (parameters.data.checkBox) { return new CheckboxWidgetAnnotationElement(parameters); } (0, _util.warn)('Unimplemented button widget annotation: pushbutton'); break; case 'Ch': return new ChoiceWidgetAnnotationElement(parameters); } return new WidgetAnnotationElement(parameters); case _util.AnnotationType.POPUP: return new PopupAnnotationElement(parameters); case _util.AnnotationType.LINE: return new LineAnnotationElement(parameters); case _util.AnnotationType.SQUARE: return new SquareAnnotationElement(parameters); case _util.AnnotationType.CIRCLE: return new CircleAnnotationElement(parameters); case _util.AnnotationType.POLYLINE: return new PolylineAnnotationElement(parameters); case _util.AnnotationType.POLYGON: return new PolygonAnnotationElement(parameters); case _util.AnnotationType.HIGHLIGHT: return new HighlightAnnotationElement(parameters); case _util.AnnotationType.UNDERLINE: return new UnderlineAnnotationElement(parameters); case _util.AnnotationType.SQUIGGLY: return new SquigglyAnnotationElement(parameters); case _util.AnnotationType.STRIKEOUT: return new StrikeOutAnnotationElement(parameters); case _util.AnnotationType.STAMP: return new StampAnnotationElement(parameters); case _util.AnnotationType.FILEATTACHMENT: return new FileAttachmentAnnotationElement(parameters); default: return new AnnotationElement(parameters); } } }]); return AnnotationElementFactory; }(); var AnnotationElement = function () { function AnnotationElement(parameters) { var isRenderable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var ignoreBorder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; _classCallCheck(this, AnnotationElement); this.isRenderable = isRenderable; this.data = parameters.data; this.layer = parameters.layer; this.page = parameters.page; this.viewport = parameters.viewport; this.linkService = parameters.linkService; this.downloadManager = parameters.downloadManager; this.imageResourcesPath = parameters.imageResourcesPath; this.renderInteractiveForms = parameters.renderInteractiveForms; this.svgFactory = parameters.svgFactory; if (isRenderable) { this.container = this._createContainer(ignoreBorder); } } _createClass(AnnotationElement, [{ key: '_createContainer', value: function _createContainer() { var ignoreBorder = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var data = this.data, page = this.page, viewport = this.viewport; var container = document.createElement('section'); var width = data.rect[2] - data.rect[0]; var height = data.rect[3] - data.rect[1]; container.setAttribute('data-annotation-id', data.id); var rect = _util.Util.normalizeRect([data.rect[0], page.view[3] - data.rect[1] + page.view[1], data.rect[2], page.view[3] - data.rect[3] + page.view[1]]); _dom_utils.CustomStyle.setProp('transform', container, 'matrix(' + viewport.transform.join(',') + ')'); _dom_utils.CustomStyle.setProp('transformOrigin', container, -rect[0] + 'px ' + -rect[1] + 'px'); if (!ignoreBorder && data.borderStyle.width > 0) { container.style.borderWidth = data.borderStyle.width + 'px'; if (data.borderStyle.style !== _util.AnnotationBorderStyleType.UNDERLINE) { width = width - 2 * data.borderStyle.width; height = height - 2 * data.borderStyle.width; } var horizontalRadius = data.borderStyle.horizontalCornerRadius; var verticalRadius = data.borderStyle.verticalCornerRadius; if (horizontalRadius > 0 || verticalRadius > 0) { var radius = horizontalRadius + 'px / ' + verticalRadius + 'px'; _dom_utils.CustomStyle.setProp('borderRadius', container, radius); } switch (data.borderStyle.style) { case _util.AnnotationBorderStyleType.SOLID: container.style.borderStyle = 'solid'; break; case _util.AnnotationBorderStyleType.DASHED: container.style.borderStyle = 'dashed'; break; case _util.AnnotationBorderStyleType.BEVELED: (0, _util.warn)('Unimplemented border style: beveled'); break; case _util.AnnotationBorderStyleType.INSET: (0, _util.warn)('Unimplemented border style: inset'); break; case _util.AnnotationBorderStyleType.UNDERLINE: container.style.borderBottomStyle = 'solid'; break; default: break; } if (data.color) { container.style.borderColor = _util.Util.makeCssRgb(data.color[0] | 0, data.color[1] | 0, data.color[2] | 0); } else { container.style.borderWidth = 0; } } container.style.left = rect[0] + 'px'; container.style.top = rect[1] + 'px'; container.style.width = width + 'px'; container.style.height = height + 'px'; return container; } }, { key: '_createPopup', value: function _createPopup(container, trigger, data) { if (!trigger) { trigger = document.createElement('div'); trigger.style.height = container.style.height; trigger.style.width = container.style.width; container.appendChild(trigger); } var popupElement = new PopupElement({ container: container, trigger: trigger, color: data.color, title: data.title, contents: data.contents, hideWrapper: true }); var popup = popupElement.render(); popup.style.left = container.style.width; container.appendChild(popup); } }, { key: 'render', value: function render() { throw new Error('Abstract method `AnnotationElement.render` called'); } }]); return AnnotationElement; }(); var LinkAnnotationElement = function (_AnnotationElement) { _inherits(LinkAnnotationElement, _AnnotationElement); function LinkAnnotationElement(parameters) { _classCallCheck(this, LinkAnnotationElement); var isRenderable = !!(parameters.data.url || parameters.data.dest || parameters.data.action); return _possibleConstructorReturn(this, (LinkAnnotationElement.__proto__ || Object.getPrototypeOf(LinkAnnotationElement)).call(this, parameters, isRenderable)); } _createClass(LinkAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'linkAnnotation'; var link = document.createElement('a'); (0, _dom_utils.addLinkAttributes)(link, { url: this.data.url, target: this.data.newWindow ? _dom_utils.LinkTarget.BLANK : undefined }); if (!this.data.url) { if (this.data.action) { this._bindNamedAction(link, this.data.action); } else { this._bindLink(link, this.data.dest); } } this.container.appendChild(link); return this.container; } }, { key: '_bindLink', value: function _bindLink(link, destination) { var _this2 = this; link.href = this.linkService.getDestinationHash(destination); link.onclick = function () { if (destination) { _this2.linkService.navigateTo(destination); } return false; }; if (destination) { link.className = 'internalLink'; } } }, { key: '_bindNamedAction', value: function _bindNamedAction(link, action) { var _this3 = this; link.href = this.linkService.getAnchorUrl(''); link.onclick = function () { _this3.linkService.executeNamedAction(action); return false; }; link.className = 'internalLink'; } }]); return LinkAnnotationElement; }(AnnotationElement); var TextAnnotationElement = function (_AnnotationElement2) { _inherits(TextAnnotationElement, _AnnotationElement2); function TextAnnotationElement(parameters) { _classCallCheck(this, TextAnnotationElement); var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); return _possibleConstructorReturn(this, (TextAnnotationElement.__proto__ || Object.getPrototypeOf(TextAnnotationElement)).call(this, parameters, isRenderable)); } _createClass(TextAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'textAnnotation'; var image = document.createElement('img'); image.style.height = this.container.style.height; image.style.width = this.container.style.width; image.src = this.imageResourcesPath + 'annotation-' + this.data.name.toLowerCase() + '.svg'; image.alt = '[{{type}} Annotation]'; image.dataset.l10nId = 'text_annotation_type'; image.dataset.l10nArgs = JSON.stringify({ type: this.data.name }); if (!this.data.hasPopup) { this._createPopup(this.container, image, this.data); } this.container.appendChild(image); return this.container; } }]); return TextAnnotationElement; }(AnnotationElement); var WidgetAnnotationElement = function (_AnnotationElement3) { _inherits(WidgetAnnotationElement, _AnnotationElement3); function WidgetAnnotationElement() { _classCallCheck(this, WidgetAnnotationElement); return _possibleConstructorReturn(this, (WidgetAnnotationElement.__proto__ || Object.getPrototypeOf(WidgetAnnotationElement)).apply(this, arguments)); } _createClass(WidgetAnnotationElement, [{ key: 'render', value: function render() { return this.container; } }]); return WidgetAnnotationElement; }(AnnotationElement); var TextWidgetAnnotationElement = function (_WidgetAnnotationElem) { _inherits(TextWidgetAnnotationElement, _WidgetAnnotationElem); function TextWidgetAnnotationElement(parameters) { _classCallCheck(this, TextWidgetAnnotationElement); var isRenderable = parameters.renderInteractiveForms || !parameters.data.hasAppearance && !!parameters.data.fieldValue; return _possibleConstructorReturn(this, (TextWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(TextWidgetAnnotationElement)).call(this, parameters, isRenderable)); } _createClass(TextWidgetAnnotationElement, [{ key: 'render', value: function render() { var TEXT_ALIGNMENT = ['left', 'center', 'right']; this.container.className = 'textWidgetAnnotation'; var element = null; if (this.renderInteractiveForms) { if (this.data.multiLine) { element = document.createElement('textarea'); element.textContent = this.data.fieldValue; } else { element = document.createElement('input'); element.type = 'text'; element.setAttribute('value', this.data.fieldValue); } element.disabled = this.data.readOnly; if (this.data.maxLen !== null) { element.maxLength = this.data.maxLen; } if (this.data.comb) { var fieldWidth = this.data.rect[2] - this.data.rect[0]; var combWidth = fieldWidth / this.data.maxLen; element.classList.add('comb'); element.style.letterSpacing = 'calc(' + combWidth + 'px - 1ch)'; } } else { element = document.createElement('div'); element.textContent = this.data.fieldValue; element.style.verticalAlign = 'middle'; element.style.display = 'table-cell'; var font = null; if (this.data.fontRefName) { font = this.page.commonObjs.getData(this.data.fontRefName); } this._setTextStyle(element, font); } if (this.data.textAlignment !== null) { element.style.textAlign = TEXT_ALIGNMENT[this.data.textAlignment]; } this.container.appendChild(element); return this.container; } }, { key: '_setTextStyle', value: function _setTextStyle(element, font) { var style = element.style; style.fontSize = this.data.fontSize + 'px'; style.direction = this.data.fontDirection < 0 ? 'rtl' : 'ltr'; if (!font) { return; } style.fontWeight = font.black ? font.bold ? '900' : 'bold' : font.bold ? 'bold' : 'normal'; style.fontStyle = font.italic ? 'italic' : 'normal'; var fontFamily = font.loadedName ? '"' + font.loadedName + '", ' : ''; var fallbackName = font.fallbackName || 'Helvetica, sans-serif'; style.fontFamily = fontFamily + fallbackName; } }]); return TextWidgetAnnotationElement; }(WidgetAnnotationElement); var CheckboxWidgetAnnotationElement = function (_WidgetAnnotationElem2) { _inherits(CheckboxWidgetAnnotationElement, _WidgetAnnotationElem2); function CheckboxWidgetAnnotationElement(parameters) { _classCallCheck(this, CheckboxWidgetAnnotationElement); return _possibleConstructorReturn(this, (CheckboxWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(CheckboxWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms)); } _createClass(CheckboxWidgetAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'buttonWidgetAnnotation checkBox'; var element = document.createElement('input'); element.disabled = this.data.readOnly; element.type = 'checkbox'; if (this.data.fieldValue && this.data.fieldValue !== 'Off') { element.setAttribute('checked', true); } this.container.appendChild(element); return this.container; } }]); return CheckboxWidgetAnnotationElement; }(WidgetAnnotationElement); var RadioButtonWidgetAnnotationElement = function (_WidgetAnnotationElem3) { _inherits(RadioButtonWidgetAnnotationElement, _WidgetAnnotationElem3); function RadioButtonWidgetAnnotationElement(parameters) { _classCallCheck(this, RadioButtonWidgetAnnotationElement); return _possibleConstructorReturn(this, (RadioButtonWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(RadioButtonWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms)); } _createClass(RadioButtonWidgetAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'buttonWidgetAnnotation radioButton'; var element = document.createElement('input'); element.disabled = this.data.readOnly; element.type = 'radio'; element.name = this.data.fieldName; if (this.data.fieldValue === this.data.buttonValue) { element.setAttribute('checked', true); } this.container.appendChild(element); return this.container; } }]); return RadioButtonWidgetAnnotationElement; }(WidgetAnnotationElement); var ChoiceWidgetAnnotationElement = function (_WidgetAnnotationElem4) { _inherits(ChoiceWidgetAnnotationElement, _WidgetAnnotationElem4); function ChoiceWidgetAnnotationElement(parameters) { _classCallCheck(this, ChoiceWidgetAnnotationElement); return _possibleConstructorReturn(this, (ChoiceWidgetAnnotationElement.__proto__ || Object.getPrototypeOf(ChoiceWidgetAnnotationElement)).call(this, parameters, parameters.renderInteractiveForms)); } _createClass(ChoiceWidgetAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'choiceWidgetAnnotation'; var selectElement = document.createElement('select'); selectElement.disabled = this.data.readOnly; if (!this.data.combo) { selectElement.size = this.data.options.length; if (this.data.multiSelect) { selectElement.multiple = true; } } for (var i = 0, ii = this.data.options.length; i < ii; i++) { var option = this.data.options[i]; var optionElement = document.createElement('option'); optionElement.textContent = option.displayValue; optionElement.value = option.exportValue; if (this.data.fieldValue.indexOf(option.displayValue) >= 0) { optionElement.setAttribute('selected', true); } selectElement.appendChild(optionElement); } this.container.appendChild(selectElement); return this.container; } }]); return ChoiceWidgetAnnotationElement; }(WidgetAnnotationElement); var PopupAnnotationElement = function (_AnnotationElement4) { _inherits(PopupAnnotationElement, _AnnotationElement4); function PopupAnnotationElement(parameters) { _classCallCheck(this, PopupAnnotationElement); var isRenderable = !!(parameters.data.title || parameters.data.contents); return _possibleConstructorReturn(this, (PopupAnnotationElement.__proto__ || Object.getPrototypeOf(PopupAnnotationElement)).call(this, parameters, isRenderable)); } _createClass(PopupAnnotationElement, [{ key: 'render', value: function render() { var IGNORE_TYPES = ['Line', 'Square', 'Circle', 'PolyLine', 'Polygon']; this.container.className = 'popupAnnotation'; if (IGNORE_TYPES.indexOf(this.data.parentType) >= 0) { return this.container; } var selector = '[data-annotation-id="' + this.data.parentId + '"]'; var parentElement = this.layer.querySelector(selector); if (!parentElement) { return this.container; } var popup = new PopupElement({ container: this.container, trigger: parentElement, color: this.data.color, title: this.data.title, contents: this.data.contents }); var parentLeft = parseFloat(parentElement.style.left); var parentWidth = parseFloat(parentElement.style.width); _dom_utils.CustomStyle.setProp('transformOrigin', this.container, -(parentLeft + parentWidth) + 'px -' + parentElement.style.top); this.container.style.left = parentLeft + parentWidth + 'px'; this.container.appendChild(popup.render()); return this.container; } }]); return PopupAnnotationElement; }(AnnotationElement); var PopupElement = function () { function PopupElement(parameters) { _classCallCheck(this, PopupElement); this.container = parameters.container; this.trigger = parameters.trigger; this.color = parameters.color; this.title = parameters.title; this.contents = parameters.contents; this.hideWrapper = parameters.hideWrapper || false; this.pinned = false; } _createClass(PopupElement, [{ key: 'render', value: function render() { var BACKGROUND_ENLIGHT = 0.7; var wrapper = document.createElement('div'); wrapper.className = 'popupWrapper'; this.hideElement = this.hideWrapper ? wrapper : this.container; this.hideElement.setAttribute('hidden', true); var popup = document.createElement('div'); popup.className = 'popup'; var color = this.color; if (color) { var r = BACKGROUND_ENLIGHT * (255 - color[0]) + color[0]; var g = BACKGROUND_ENLIGHT * (255 - color[1]) + color[1]; var b = BACKGROUND_ENLIGHT * (255 - color[2]) + color[2]; popup.style.backgroundColor = _util.Util.makeCssRgb(r | 0, g | 0, b | 0); } var contents = this._formatContents(this.contents); var title = document.createElement('h1'); title.textContent = this.title; this.trigger.addEventListener('click', this._toggle.bind(this)); this.trigger.addEventListener('mouseover', this._show.bind(this, false)); this.trigger.addEventListener('mouseout', this._hide.bind(this, false)); popup.addEventListener('click', this._hide.bind(this, true)); popup.appendChild(title); popup.appendChild(contents); wrapper.appendChild(popup); return wrapper; } }, { key: '_formatContents', value: function _formatContents(contents) { var p = document.createElement('p'); var lines = contents.split(/(?:\r\n?|\n)/); for (var i = 0, ii = lines.length; i < ii; ++i) { var line = lines[i]; p.appendChild(document.createTextNode(line)); if (i < ii - 1) { p.appendChild(document.createElement('br')); } } return p; } }, { key: '_toggle', value: function _toggle() { if (this.pinned) { this._hide(true); } else { this._show(true); } } }, { key: '_show', value: function _show() { var pin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (pin) { this.pinned = true; } if (this.hideElement.hasAttribute('hidden')) { this.hideElement.removeAttribute('hidden'); this.container.style.zIndex += 1; } } }, { key: '_hide', value: function _hide() { var unpin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; if (unpin) { this.pinned = false; } if (!this.hideElement.hasAttribute('hidden') && !this.pinned) { this.hideElement.setAttribute('hidden', true); this.container.style.zIndex -= 1; } } }]); return PopupElement; }(); var LineAnnotationElement = function (_AnnotationElement5) { _inherits(LineAnnotationElement, _AnnotationElement5); function LineAnnotationElement(parameters) { _classCallCheck(this, LineAnnotationElement); var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); return _possibleConstructorReturn(this, (LineAnnotationElement.__proto__ || Object.getPrototypeOf(LineAnnotationElement)).call(this, parameters, isRenderable, true)); } _createClass(LineAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'lineAnnotation'; var data = this.data; var width = data.rect[2] - data.rect[0]; var height = data.rect[3] - data.rect[1]; var svg = this.svgFactory.create(width, height); var line = this.svgFactory.createElement('svg:line'); line.setAttribute('x1', data.rect[2] - data.lineCoordinates[0]); line.setAttribute('y1', data.rect[3] - data.lineCoordinates[1]); line.setAttribute('x2', data.rect[2] - data.lineCoordinates[2]); line.setAttribute('y2', data.rect[3] - data.lineCoordinates[3]); line.setAttribute('stroke-width', data.borderStyle.width); line.setAttribute('stroke', 'transparent'); svg.appendChild(line); this.container.append(svg); this._createPopup(this.container, line, data); return this.container; } }]); return LineAnnotationElement; }(AnnotationElement); var SquareAnnotationElement = function (_AnnotationElement6) { _inherits(SquareAnnotationElement, _AnnotationElement6); function SquareAnnotationElement(parameters) { _classCallCheck(this, SquareAnnotationElement); var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); return _possibleConstructorReturn(this, (SquareAnnotationElement.__proto__ || Object.getPrototypeOf(SquareAnnotationElement)).call(this, parameters, isRenderable, true)); } _createClass(SquareAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'squareAnnotation'; var data = this.data; var width = data.rect[2] - data.rect[0]; var height = data.rect[3] - data.rect[1]; var svg = this.svgFactory.create(width, height); var borderWidth = data.borderStyle.width; var square = this.svgFactory.createElement('svg:rect'); square.setAttribute('x', borderWidth / 2); square.setAttribute('y', borderWidth / 2); square.setAttribute('width', width - borderWidth); square.setAttribute('height', height - borderWidth); square.setAttribute('stroke-width', borderWidth); square.setAttribute('stroke', 'transparent'); square.setAttribute('fill', 'none'); svg.appendChild(square); this.container.append(svg); this._createPopup(this.container, square, data); return this.container; } }]); return SquareAnnotationElement; }(AnnotationElement); var CircleAnnotationElement = function (_AnnotationElement7) { _inherits(CircleAnnotationElement, _AnnotationElement7); function CircleAnnotationElement(parameters) { _classCallCheck(this, CircleAnnotationElement); var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); return _possibleConstructorReturn(this, (CircleAnnotationElement.__proto__ || Object.getPrototypeOf(CircleAnnotationElement)).call(this, parameters, isRenderable, true)); } _createClass(CircleAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'circleAnnotation'; var data = this.data; var width = data.rect[2] - data.rect[0]; var height = data.rect[3] - data.rect[1]; var svg = this.svgFactory.create(width, height); var borderWidth = data.borderStyle.width; var circle = this.svgFactory.createElement('svg:ellipse'); circle.setAttribute('cx', width / 2); circle.setAttribute('cy', height / 2); circle.setAttribute('rx', width / 2 - borderWidth / 2); circle.setAttribute('ry', height / 2 - borderWidth / 2); circle.setAttribute('stroke-width', borderWidth); circle.setAttribute('stroke', 'transparent'); circle.setAttribute('fill', 'none'); svg.appendChild(circle); this.container.append(svg); this._createPopup(this.container, circle, data); return this.container; } }]); return CircleAnnotationElement; }(AnnotationElement); var PolylineAnnotationElement = function (_AnnotationElement8) { _inherits(PolylineAnnotationElement, _AnnotationElement8); function PolylineAnnotationElement(parameters) { _classCallCheck(this, PolylineAnnotationElement); var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); var _this14 = _possibleConstructorReturn(this, (PolylineAnnotationElement.__proto__ || Object.getPrototypeOf(PolylineAnnotationElement)).call(this, parameters, isRenderable, true)); _this14.containerClassName = 'polylineAnnotation'; _this14.svgElementName = 'svg:polyline'; return _this14; } _createClass(PolylineAnnotationElement, [{ key: 'render', value: function render() { this.container.className = this.containerClassName; var data = this.data; var width = data.rect[2] - data.rect[0]; var height = data.rect[3] - data.rect[1]; var svg = this.svgFactory.create(width, height); var vertices = data.vertices; var points = []; for (var i = 0, ii = vertices.length; i < ii; i++) { var x = vertices[i].x - data.rect[0]; var y = data.rect[3] - vertices[i].y; points.push(x + ',' + y); } points = points.join(' '); var borderWidth = data.borderStyle.width; var polyline = this.svgFactory.createElement(this.svgElementName); polyline.setAttribute('points', points); polyline.setAttribute('stroke-width', borderWidth); polyline.setAttribute('stroke', 'transparent'); polyline.setAttribute('fill', 'none'); svg.appendChild(polyline); this.container.append(svg); this._createPopup(this.container, polyline, data); return this.container; } }]); return PolylineAnnotationElement; }(AnnotationElement); var PolygonAnnotationElement = function (_PolylineAnnotationEl) { _inherits(PolygonAnnotationElement, _PolylineAnnotationEl); function PolygonAnnotationElement(parameters) { _classCallCheck(this, PolygonAnnotationElement); var _this15 = _possibleConstructorReturn(this, (PolygonAnnotationElement.__proto__ || Object.getPrototypeOf(PolygonAnnotationElement)).call(this, parameters)); _this15.containerClassName = 'polygonAnnotation'; _this15.svgElementName = 'svg:polygon'; return _this15; } return PolygonAnnotationElement; }(PolylineAnnotationElement); var HighlightAnnotationElement = function (_AnnotationElement9) { _inherits(HighlightAnnotationElement, _AnnotationElement9); function HighlightAnnotationElement(parameters) { _classCallCheck(this, HighlightAnnotationElement); var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); return _possibleConstructorReturn(this, (HighlightAnnotationElement.__proto__ || Object.getPrototypeOf(HighlightAnnotationElement)).call(this, parameters, isRenderable, true)); } _createClass(HighlightAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'highlightAnnotation'; if (!this.data.hasPopup) { this._createPopup(this.container, null, this.data); } return this.container; } }]); return HighlightAnnotationElement; }(AnnotationElement); var UnderlineAnnotationElement = function (_AnnotationElement10) { _inherits(UnderlineAnnotationElement, _AnnotationElement10); function UnderlineAnnotationElement(parameters) { _classCallCheck(this, UnderlineAnnotationElement); var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); return _possibleConstructorReturn(this, (UnderlineAnnotationElement.__proto__ || Object.getPrototypeOf(UnderlineAnnotationElement)).call(this, parameters, isRenderable, true)); } _createClass(UnderlineAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'underlineAnnotation'; if (!this.data.hasPopup) { this._createPopup(this.container, null, this.data); } return this.container; } }]); return UnderlineAnnotationElement; }(AnnotationElement); var SquigglyAnnotationElement = function (_AnnotationElement11) { _inherits(SquigglyAnnotationElement, _AnnotationElement11); function SquigglyAnnotationElement(parameters) { _classCallCheck(this, SquigglyAnnotationElement); var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); return _possibleConstructorReturn(this, (SquigglyAnnotationElement.__proto__ || Object.getPrototypeOf(SquigglyAnnotationElement)).call(this, parameters, isRenderable, true)); } _createClass(SquigglyAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'squigglyAnnotation'; if (!this.data.hasPopup) { this._createPopup(this.container, null, this.data); } return this.container; } }]); return SquigglyAnnotationElement; }(AnnotationElement); var StrikeOutAnnotationElement = function (_AnnotationElement12) { _inherits(StrikeOutAnnotationElement, _AnnotationElement12); function StrikeOutAnnotationElement(parameters) { _classCallCheck(this, StrikeOutAnnotationElement); var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); return _possibleConstructorReturn(this, (StrikeOutAnnotationElement.__proto__ || Object.getPrototypeOf(StrikeOutAnnotationElement)).call(this, parameters, isRenderable, true)); } _createClass(StrikeOutAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'strikeoutAnnotation'; if (!this.data.hasPopup) { this._createPopup(this.container, null, this.data); } return this.container; } }]); return StrikeOutAnnotationElement; }(AnnotationElement); var StampAnnotationElement = function (_AnnotationElement13) { _inherits(StampAnnotationElement, _AnnotationElement13); function StampAnnotationElement(parameters) { _classCallCheck(this, StampAnnotationElement); var isRenderable = !!(parameters.data.hasPopup || parameters.data.title || parameters.data.contents); return _possibleConstructorReturn(this, (StampAnnotationElement.__proto__ || Object.getPrototypeOf(StampAnnotationElement)).call(this, parameters, isRenderable, true)); } _createClass(StampAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'stampAnnotation'; if (!this.data.hasPopup) { this._createPopup(this.container, null, this.data); } return this.container; } }]); return StampAnnotationElement; }(AnnotationElement); var FileAttachmentAnnotationElement = function (_AnnotationElement14) { _inherits(FileAttachmentAnnotationElement, _AnnotationElement14); function FileAttachmentAnnotationElement(parameters) { _classCallCheck(this, FileAttachmentAnnotationElement); var _this21 = _possibleConstructorReturn(this, (FileAttachmentAnnotationElement.__proto__ || Object.getPrototypeOf(FileAttachmentAnnotationElement)).call(this, parameters, true)); var file = _this21.data.file; _this21.filename = (0, _dom_utils.getFilenameFromUrl)(file.filename); _this21.content = file.content; _this21.linkService.onFileAttachmentAnnotation({ id: (0, _util.stringToPDFString)(file.filename), filename: file.filename, content: file.content }); return _this21; } _createClass(FileAttachmentAnnotationElement, [{ key: 'render', value: function render() { this.container.className = 'fileAttachmentAnnotation'; var trigger = document.createElement('div'); trigger.style.height = this.container.style.height; trigger.style.width = this.container.style.width; trigger.addEventListener('dblclick', this._download.bind(this)); if (!this.data.hasPopup && (this.data.title || this.data.contents)) { this._createPopup(this.container, trigger, this.data); } this.container.appendChild(trigger); return this.container; } }, { key: '_download', value: function _download() { if (!this.downloadManager) { (0, _util.warn)('Download cannot be started due to unavailable download manager'); return; } this.downloadManager.downloadData(this.content, this.filename, ''); } }]); return FileAttachmentAnnotationElement; }(AnnotationElement); var AnnotationLayer = function () { function AnnotationLayer() { _classCallCheck(this, AnnotationLayer); } _createClass(AnnotationLayer, null, [{ key: 'render', value: function render(parameters) { for (var i = 0, ii = parameters.annotations.length; i < ii; i++) { var data = parameters.annotations[i]; if (!data) { continue; } var element = AnnotationElementFactory.create({ data: data, layer: parameters.div, page: parameters.page, viewport: parameters.viewport, linkService: parameters.linkService, downloadManager: parameters.downloadManager, imageResourcesPath: parameters.imageResourcesPath || (0, _dom_utils.getDefaultSetting)('imageResourcesPath'), renderInteractiveForms: parameters.renderInteractiveForms || false, svgFactory: new _dom_utils.DOMSVGFactory() }); if (element.isRenderable) { parameters.div.appendChild(element.render()); } } } }, { key: 'update', value: function update(parameters) { for (var i = 0, ii = parameters.annotations.length; i < ii; i++) { var data = parameters.annotations[i]; var element = parameters.div.querySelector('[data-annotation-id="' + data.id + '"]'); if (element) { _dom_utils.CustomStyle.setProp('transform', element, 'matrix(' + parameters.viewport.transform.join(',') + ')'); } } parameters.div.removeAttribute('hidden'); } }]); return AnnotationLayer; }(); exports.AnnotationLayer = AnnotationLayer; /***/ }), /* 61 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.renderTextLayer = undefined; var _util = __w_pdfjs_require__(0); var _dom_utils = __w_pdfjs_require__(8); var renderTextLayer = function renderTextLayerClosure() { var MAX_TEXT_DIVS_TO_RENDER = 100000; var NonWhitespaceRegexp = /\S/; function isAllWhitespace(str) { return !NonWhitespaceRegexp.test(str); } var styleBuf = ['left: ', 0, 'px; top: ', 0, 'px; font-size: ', 0, 'px; font-family: ', '', ';']; function appendText(task, geom, styles) { var textDiv = document.createElement('div'); var textDivProperties = { style: null, angle: 0, canvasWidth: 0, isWhitespace: false, originalTransform: null, paddingBottom: 0, paddingLeft: 0, paddingRight: 0, paddingTop: 0, scale: 1 }; task._textDivs.push(textDiv); if (isAllWhitespace(geom.str)) { textDivProperties.isWhitespace = true; task._textDivProperties.set(textDiv, textDivProperties); return; } var tx = _util.Util.transform(task._viewport.transform, geom.transform); var angle = Math.atan2(tx[1], tx[0]); var style = styles[geom.fontName]; if (style.vertical) { angle += Math.PI / 2; } var fontHeight = Math.sqrt(tx[2] * tx[2] + tx[3] * tx[3]); var fontAscent = fontHeight; if (style.ascent) { fontAscent = style.ascent * fontAscent; } else if (style.descent) { fontAscent = (1 + style.descent) * fontAscent; } var left; var top; if (angle === 0) { left = tx[4]; top = tx[5] - fontAscent; } else { left = tx[4] + fontAscent * Math.sin(angle); top = tx[5] - fontAscent * Math.cos(angle); } styleBuf[1] = left; styleBuf[3] = top; styleBuf[5] = fontHeight; styleBuf[7] = style.fontFamily; textDivProperties.style = styleBuf.join(''); textDiv.setAttribute('style', textDivProperties.style); textDiv.textContent = geom.str; if ((0, _dom_utils.getDefaultSetting)('pdfBug')) { textDiv.dataset.fontName = geom.fontName; } if (angle !== 0) { textDivProperties.angle = angle * (180 / Math.PI); } if (geom.str.length > 1) { if (style.vertical) { textDivProperties.canvasWidth = geom.height * task._viewport.scale; } else { textDivProperties.canvasWidth = geom.width * task._viewport.scale; } } task._textDivProperties.set(textDiv, textDivProperties); if (task._textContentStream) { task._layoutText(textDiv); } if (task._enhanceTextSelection) { var angleCos = 1, angleSin = 0; if (angle !== 0) { angleCos = Math.cos(angle); angleSin = Math.sin(angle); } var divWidth = (style.vertical ? geom.height : geom.width) * task._viewport.scale; var divHeight = fontHeight; var m, b; if (angle !== 0) { m = [angleCos, angleSin, -angleSin, angleCos, left, top]; b = _util.Util.getAxialAlignedBoundingBox([0, 0, divWidth, divHeight], m); } else { b = [left, top, left + divWidth, top + divHeight]; } task._bounds.push({ left: b[0], top: b[1], right: b[2], bottom: b[3], div: textDiv, size: [divWidth, divHeight], m: m }); } } function render(task) { if (task._canceled) { return; } var textDivs = task._textDivs; var capability = task._capability; var textDivsLength = textDivs.length; if (textDivsLength > MAX_TEXT_DIVS_TO_RENDER) { task._renderingDone = true; capability.resolve(); return; } if (!task._textContentStream) { for (var i = 0; i < textDivsLength; i++) { task._layoutText(textDivs[i]); } } task._renderingDone = true; capability.resolve(); } function expand(task) { var bounds = task._bounds; var viewport = task._viewport; var expanded = expandBounds(viewport.width, viewport.height, bounds); for (var i = 0; i < expanded.length; i++) { var div = bounds[i].div; var divProperties = task._textDivProperties.get(div); if (divProperties.angle === 0) { divProperties.paddingLeft = bounds[i].left - expanded[i].left; divProperties.paddingTop = bounds[i].top - expanded[i].top; divProperties.paddingRight = expanded[i].right - bounds[i].right; divProperties.paddingBottom = expanded[i].bottom - bounds[i].bottom; task._textDivProperties.set(div, divProperties); continue; } var e = expanded[i], b = bounds[i]; var m = b.m, c = m[0], s = m[1]; var points = [[0, 0], [0, b.size[1]], [b.size[0], 0], b.size]; var ts = new Float64Array(64); points.forEach(function (p, i) { var t = _util.Util.applyTransform(p, m); ts[i + 0] = c && (e.left - t[0]) / c; ts[i + 4] = s && (e.top - t[1]) / s; ts[i + 8] = c && (e.right - t[0]) / c; ts[i + 12] = s && (e.bottom - t[1]) / s; ts[i + 16] = s && (e.left - t[0]) / -s; ts[i + 20] = c && (e.top - t[1]) / c; ts[i + 24] = s && (e.right - t[0]) / -s; ts[i + 28] = c && (e.bottom - t[1]) / c; ts[i + 32] = c && (e.left - t[0]) / -c; ts[i + 36] = s && (e.top - t[1]) / -s; ts[i + 40] = c && (e.right - t[0]) / -c; ts[i + 44] = s && (e.bottom - t[1]) / -s; ts[i + 48] = s && (e.left - t[0]) / s; ts[i + 52] = c && (e.top - t[1]) / -c; ts[i + 56] = s && (e.right - t[0]) / s; ts[i + 60] = c && (e.bottom - t[1]) / -c; }); var findPositiveMin = function findPositiveMin(ts, offset, count) { var result = 0; for (var i = 0; i < count; i++) { var t = ts[offset++]; if (t > 0) { result = result ? Math.min(t, result) : t; } } return result; }; var boxScale = 1 + Math.min(Math.abs(c), Math.abs(s)); divProperties.paddingLeft = findPositiveMin(ts, 32, 16) / boxScale; divProperties.paddingTop = findPositiveMin(ts, 48, 16) / boxScale; divProperties.paddingRight = findPositiveMin(ts, 0, 16) / boxScale; divProperties.paddingBottom = findPositiveMin(ts, 16, 16) / boxScale; task._textDivProperties.set(div, divProperties); } } function expandBounds(width, height, boxes) { var bounds = boxes.map(function (box, i) { return { x1: box.left, y1: box.top, x2: box.right, y2: box.bottom, index: i, x1New: undefined, x2New: undefined }; }); expandBoundsLTR(width, bounds); var expanded = new Array(boxes.length); bounds.forEach(function (b) { var i = b.index; expanded[i] = { left: b.x1New, top: 0, right: b.x2New, bottom: 0 }; }); boxes.map(function (box, i) { var e = expanded[i], b = bounds[i]; b.x1 = box.top; b.y1 = width - e.right; b.x2 = box.bottom; b.y2 = width - e.left; b.index = i; b.x1New = undefined; b.x2New = undefined; }); expandBoundsLTR(height, bounds); bounds.forEach(function (b) { var i = b.index; expanded[i].top = b.x1New; expanded[i].bottom = b.x2New; }); return expanded; } function expandBoundsLTR(width, bounds) { bounds.sort(function (a, b) { return a.x1 - b.x1 || a.index - b.index; }); var fakeBoundary = { x1: -Infinity, y1: -Infinity, x2: 0, y2: Infinity, index: -1, x1New: 0, x2New: 0 }; var horizon = [{ start: -Infinity, end: Infinity, boundary: fakeBoundary }]; bounds.forEach(function (boundary) { var i = 0; while (i < horizon.length && horizon[i].end <= boundary.y1) { i++; } var j = horizon.length - 1; while (j >= 0 && horizon[j].start >= boundary.y2) { j--; } var horizonPart, affectedBoundary; var q, k, maxXNew = -Infinity; for (q = i; q <= j; q++) { horizonPart = horizon[q]; affectedBoundary = horizonPart.boundary; var xNew; if (affectedBoundary.x2 > boundary.x1) { xNew = affectedBoundary.index > boundary.index ? affectedBoundary.x1New : boundary.x1; } else if (affectedBoundary.x2New === undefined) { xNew = (affectedBoundary.x2 + boundary.x1) / 2; } else { xNew = affectedBoundary.x2New; } if (xNew > maxXNew) { maxXNew = xNew; } } boundary.x1New = maxXNew; for (q = i; q <= j; q++) { horizonPart = horizon[q]; affectedBoundary = horizonPart.boundary; if (affectedBoundary.x2New === undefined) { if (affectedBoundary.x2 > boundary.x1) { if (affectedBoundary.index > boundary.index) { affectedBoundary.x2New = affectedBoundary.x2; } } else { affectedBoundary.x2New = maxXNew; } } else if (affectedBoundary.x2New > maxXNew) { affectedBoundary.x2New = Math.max(maxXNew, affectedBoundary.x2); } } var changedHorizon = [], lastBoundary = null; for (q = i; q <= j; q++) { horizonPart = horizon[q]; affectedBoundary = horizonPart.boundary; var useBoundary = affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary; if (lastBoundary === useBoundary) { changedHorizon[changedHorizon.length - 1].end = horizonPart.end; } else { changedHorizon.push({ start: horizonPart.start, end: horizonPart.end, boundary: useBoundary }); lastBoundary = useBoundary; } } if (horizon[i].start < boundary.y1) { changedHorizon[0].start = boundary.y1; changedHorizon.unshift({ start: horizon[i].start, end: boundary.y1, boundary: horizon[i].boundary }); } if (boundary.y2 < horizon[j].end) { changedHorizon[changedHorizon.length - 1].end = boundary.y2; changedHorizon.push({ start: boundary.y2, end: horizon[j].end, boundary: horizon[j].boundary }); } for (q = i; q <= j; q++) { horizonPart = horizon[q]; affectedBoundary = horizonPart.boundary; if (affectedBoundary.x2New !== undefined) { continue; } var used = false; for (k = i - 1; !used && k >= 0 && horizon[k].start >= affectedBoundary.y1; k--) { used = horizon[k].boundary === affectedBoundary; } for (k = j + 1; !used && k < horizon.length && horizon[k].end <= affectedBoundary.y2; k++) { used = horizon[k].boundary === affectedBoundary; } for (k = 0; !used && k < changedHorizon.length; k++) { used = changedHorizon[k].boundary === affectedBoundary; } if (!used) { affectedBoundary.x2New = maxXNew; } } Array.prototype.splice.apply(horizon, [i, j - i + 1].concat(changedHorizon)); }); horizon.forEach(function (horizonPart) { var affectedBoundary = horizonPart.boundary; if (affectedBoundary.x2New === undefined) { affectedBoundary.x2New = Math.max(width, affectedBoundary.x2); } }); } function TextLayerRenderTask(_ref) { var textContent = _ref.textContent, textContentStream = _ref.textContentStream, container = _ref.container, viewport = _ref.viewport, textDivs = _ref.textDivs, textContentItemsStr = _ref.textContentItemsStr, enhanceTextSelection = _ref.enhanceTextSelection; this._textContent = textContent; this._textContentStream = textContentStream; this._container = container; this._viewport = viewport; this._textDivs = textDivs || []; this._textContentItemsStr = textContentItemsStr || []; this._enhanceTextSelection = !!enhanceTextSelection; this._reader = null; this._layoutTextLastFontSize = null; this._layoutTextLastFontFamily = null; this._layoutTextCtx = null; this._textDivProperties = new WeakMap(); this._renderingDone = false; this._canceled = false; this._capability = (0, _util.createPromiseCapability)(); this._renderTimer = null; this._bounds = []; } TextLayerRenderTask.prototype = { get promise() { return this._capability.promise; }, cancel: function TextLayer_cancel() { if (this._reader) { this._reader.cancel(new _util.AbortException('text layer task cancelled')); this._reader = null; } this._canceled = true; if (this._renderTimer !== null) { clearTimeout(this._renderTimer); this._renderTimer = null; } this._capability.reject('canceled'); }, _processItems: function _processItems(items, styleCache) { for (var i = 0, len = items.length; i < len; i++) { this._textContentItemsStr.push(items[i].str); appendText(this, items[i], styleCache); } }, _layoutText: function _layoutText(textDiv) { var textLayerFrag = this._container; var textDivProperties = this._textDivProperties.get(textDiv); if (textDivProperties.isWhitespace) { return; } var fontSize = textDiv.style.fontSize; var fontFamily = textDiv.style.fontFamily; if (fontSize !== this._layoutTextLastFontSize || fontFamily !== this._layoutTextLastFontFamily) { this._layoutTextCtx.font = fontSize + ' ' + fontFamily; this._lastFontSize = fontSize; this._lastFontFamily = fontFamily; } var width = this._layoutTextCtx.measureText(textDiv.textContent).width; var transform = ''; if (textDivProperties.canvasWidth !== 0 && width > 0) { textDivProperties.scale = textDivProperties.canvasWidth / width; transform = 'scaleX(' + textDivProperties.scale + ')'; } if (textDivProperties.angle !== 0) { transform = 'rotate(' + textDivProperties.angle + 'deg) ' + transform; } if (transform !== '') { textDivProperties.originalTransform = transform; _dom_utils.CustomStyle.setProp('transform', textDiv, transform); } this._textDivProperties.set(textDiv, textDivProperties); textLayerFrag.appendChild(textDiv); }, _render: function TextLayer_render(timeout) { var _this = this; var capability = (0, _util.createPromiseCapability)(); var styleCache = Object.create(null); var canvas = document.createElement('canvas'); canvas.mozOpaque = true; this._layoutTextCtx = canvas.getContext('2d', { alpha: false }); if (this._textContent) { var textItems = this._textContent.items; var textStyles = this._textContent.styles; this._processItems(textItems, textStyles); capability.resolve(); } else if (this._textContentStream) { var pump = function pump() { _this._reader.read().then(function (_ref2) { var value = _ref2.value, done = _ref2.done; if (done) { capability.resolve(); return; } _util.Util.extendObj(styleCache, value.styles); _this._processItems(value.items, styleCache); pump(); }, capability.reject); }; this._reader = this._textContentStream.getReader(); pump(); } else { throw new Error('Neither "textContent" nor "textContentStream"' + ' parameters specified.'); } capability.promise.then(function () { styleCache = null; if (!timeout) { render(_this); } else { _this._renderTimer = setTimeout(function () { render(_this); _this._renderTimer = null; }, timeout); } }, this._capability.reject); }, expandTextDivs: function TextLayer_expandTextDivs(expandDivs) { if (!this._enhanceTextSelection || !this._renderingDone) { return; } if (this._bounds !== null) { expand(this); this._bounds = null; } for (var i = 0, ii = this._textDivs.length; i < ii; i++) { var div = this._textDivs[i]; var divProperties = this._textDivProperties.get(div); if (divProperties.isWhitespace) { continue; } if (expandDivs) { var transform = '', padding = ''; if (divProperties.scale !== 1) { transform = 'scaleX(' + divProperties.scale + ')'; } if (divProperties.angle !== 0) { transform = 'rotate(' + divProperties.angle + 'deg) ' + transform; } if (divProperties.paddingLeft !== 0) { padding += ' padding-left: ' + divProperties.paddingLeft / divProperties.scale + 'px;'; transform += ' translateX(' + -divProperties.paddingLeft / divProperties.scale + 'px)'; } if (divProperties.paddingTop !== 0) { padding += ' padding-top: ' + divProperties.paddingTop + 'px;'; transform += ' translateY(' + -divProperties.paddingTop + 'px)'; } if (divProperties.paddingRight !== 0) { padding += ' padding-right: ' + divProperties.paddingRight / divProperties.scale + 'px;'; } if (divProperties.paddingBottom !== 0) { padding += ' padding-bottom: ' + divProperties.paddingBottom + 'px;'; } if (padding !== '') { div.setAttribute('style', divProperties.style + padding); } if (transform !== '') { _dom_utils.CustomStyle.setProp('transform', div, transform); } } else { div.style.padding = 0; _dom_utils.CustomStyle.setProp('transform', div, divProperties.originalTransform || ''); } } } }; function renderTextLayer(renderParameters) { var task = new TextLayerRenderTask({ textContent: renderParameters.textContent, textContentStream: renderParameters.textContentStream, container: renderParameters.container, viewport: renderParameters.viewport, textDivs: renderParameters.textDivs, textContentItemsStr: renderParameters.textContentItemsStr, enhanceTextSelection: renderParameters.enhanceTextSelection }); task._render(renderParameters.timeout); return task; } return renderTextLayer; }(); exports.renderTextLayer = renderTextLayer; /***/ }), /* 62 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SVGGraphics = undefined; var _util = __w_pdfjs_require__(0); var _dom_utils = __w_pdfjs_require__(8); var SVGGraphics = function SVGGraphics() { throw new Error('Not implemented: SVGGraphics'); }; { var SVG_DEFAULTS = { fontStyle: 'normal', fontWeight: 'normal', fillColor: '#000000' }; var convertImgDataToPng = function convertImgDataToPngClosure() { var PNG_HEADER = new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]); var CHUNK_WRAPPER_SIZE = 12; var crcTable = new Int32Array(256); for (var i = 0; i < 256; i++) { var c = i; for (var h = 0; h < 8; h++) { if (c & 1) { c = 0xedB88320 ^ c >> 1 & 0x7fffffff; } else { c = c >> 1 & 0x7fffffff; } } crcTable[i] = c; } function crc32(data, start, end) { var crc = -1; for (var i = start; i < end; i++) { var a = (crc ^ data[i]) & 0xff; var b = crcTable[a]; crc = crc >>> 8 ^ b; } return crc ^ -1; } function writePngChunk(type, body, data, offset) { var p = offset; var len = body.length; data[p] = len >> 24 & 0xff; data[p + 1] = len >> 16 & 0xff; data[p + 2] = len >> 8 & 0xff; data[p + 3] = len & 0xff; p += 4; data[p] = type.charCodeAt(0) & 0xff; data[p + 1] = type.charCodeAt(1) & 0xff; data[p + 2] = type.charCodeAt(2) & 0xff; data[p + 3] = type.charCodeAt(3) & 0xff; p += 4; data.set(body, p); p += body.length; var crc = crc32(data, offset + 4, p); data[p] = crc >> 24 & 0xff; data[p + 1] = crc >> 16 & 0xff; data[p + 2] = crc >> 8 & 0xff; data[p + 3] = crc & 0xff; } function adler32(data, start, end) { var a = 1; var b = 0; for (var i = start; i < end; ++i) { a = (a + (data[i] & 0xff)) % 65521; b = (b + a) % 65521; } return b << 16 | a; } function deflateSync(literals) { if (!(0, _util.isNodeJS)()) { return deflateSyncUncompressed(literals); } try { var input; if (parseInt(process.versions.node) >= 8) { input = literals; } else { input = new Buffer(literals); } var output = require('zlib').deflateSync(input, { level: 9 }); return output instanceof Uint8Array ? output : new Uint8Array(output); } catch (e) { (0, _util.warn)('Not compressing PNG because zlib.deflateSync is unavailable: ' + e); } return deflateSyncUncompressed(literals); } function deflateSyncUncompressed(literals) { var len = literals.length; var maxBlockLength = 0xFFFF; var deflateBlocks = Math.ceil(len / maxBlockLength); var idat = new Uint8Array(2 + len + deflateBlocks * 5 + 4); var pi = 0; idat[pi++] = 0x78; idat[pi++] = 0x9c; var pos = 0; while (len > maxBlockLength) { idat[pi++] = 0x00; idat[pi++] = 0xff; idat[pi++] = 0xff; idat[pi++] = 0x00; idat[pi++] = 0x00; idat.set(literals.subarray(pos, pos + maxBlockLength), pi); pi += maxBlockLength; pos += maxBlockLength; len -= maxBlockLength; } idat[pi++] = 0x01; idat[pi++] = len & 0xff; idat[pi++] = len >> 8 & 0xff; idat[pi++] = ~len & 0xffff & 0xff; idat[pi++] = (~len & 0xffff) >> 8 & 0xff; idat.set(literals.subarray(pos), pi); pi += literals.length - pos; var adler = adler32(literals, 0, literals.length); idat[pi++] = adler >> 24 & 0xff; idat[pi++] = adler >> 16 & 0xff; idat[pi++] = adler >> 8 & 0xff; idat[pi++] = adler & 0xff; return idat; } function encode(imgData, kind, forceDataSchema) { var width = imgData.width; var height = imgData.height; var bitDepth, colorType, lineSize; var bytes = imgData.data; switch (kind) { case _util.ImageKind.GRAYSCALE_1BPP: colorType = 0; bitDepth = 1; lineSize = width + 7 >> 3; break; case _util.ImageKind.RGB_24BPP: colorType = 2; bitDepth = 8; lineSize = width * 3; break; case _util.ImageKind.RGBA_32BPP: colorType = 6; bitDepth = 8; lineSize = width * 4; break; default: throw new Error('invalid format'); } var literals = new Uint8Array((1 + lineSize) * height); var offsetLiterals = 0, offsetBytes = 0; var y, i; for (y = 0; y < height; ++y) { literals[offsetLiterals++] = 0; literals.set(bytes.subarray(offsetBytes, offsetBytes + lineSize), offsetLiterals); offsetBytes += lineSize; offsetLiterals += lineSize; } if (kind === _util.ImageKind.GRAYSCALE_1BPP) { offsetLiterals = 0; for (y = 0; y < height; y++) { offsetLiterals++; for (i = 0; i < lineSize; i++) { literals[offsetLiterals++] ^= 0xFF; } } } var ihdr = new Uint8Array([width >> 24 & 0xff, width >> 16 & 0xff, width >> 8 & 0xff, width & 0xff, height >> 24 & 0xff, height >> 16 & 0xff, height >> 8 & 0xff, height & 0xff, bitDepth, colorType, 0x00, 0x00, 0x00]); var idat = deflateSync(literals); var pngLength = PNG_HEADER.length + CHUNK_WRAPPER_SIZE * 3 + ihdr.length + idat.length; var data = new Uint8Array(pngLength); var offset = 0; data.set(PNG_HEADER, offset); offset += PNG_HEADER.length; writePngChunk('IHDR', ihdr, data, offset); offset += CHUNK_WRAPPER_SIZE + ihdr.length; writePngChunk('IDATA', idat, data, offset); offset += CHUNK_WRAPPER_SIZE + idat.length; writePngChunk('IEND', new Uint8Array(0), data, offset); return (0, _util.createObjectURL)(data, 'image/png', forceDataSchema); } return function convertImgDataToPng(imgData, forceDataSchema) { var kind = imgData.kind === undefined ? _util.ImageKind.GRAYSCALE_1BPP : imgData.kind; return encode(imgData, kind, forceDataSchema); }; }(); var SVGExtraState = function SVGExtraStateClosure() { function SVGExtraState() { this.fontSizeScale = 1; this.fontWeight = SVG_DEFAULTS.fontWeight; this.fontSize = 0; this.textMatrix = _util.IDENTITY_MATRIX; this.fontMatrix = _util.FONT_IDENTITY_MATRIX; this.leading = 0; this.x = 0; this.y = 0; this.lineX = 0; this.lineY = 0; this.charSpacing = 0; this.wordSpacing = 0; this.textHScale = 1; this.textRise = 0; this.fillColor = SVG_DEFAULTS.fillColor; this.strokeColor = '#000000'; this.fillAlpha = 1; this.strokeAlpha = 1; this.lineWidth = 1; this.lineJoin = ''; this.lineCap = ''; this.miterLimit = 0; this.dashArray = []; this.dashPhase = 0; this.dependencies = []; this.activeClipUrl = null; this.clipGroup = null; this.maskId = ''; } SVGExtraState.prototype = { clone: function SVGExtraState_clone() { return Object.create(this); }, setCurrentPoint: function SVGExtraState_setCurrentPoint(x, y) { this.x = x; this.y = y; } }; return SVGExtraState; }(); exports.SVGGraphics = SVGGraphics = function SVGGraphicsClosure() { function opListToTree(opList) { var opTree = []; var tmp = []; var opListLen = opList.length; for (var x = 0; x < opListLen; x++) { if (opList[x].fn === 'save') { opTree.push({ 'fnId': 92, 'fn': 'group', 'items': [] }); tmp.push(opTree); opTree = opTree[opTree.length - 1].items; continue; } if (opList[x].fn === 'restore') { opTree = tmp.pop(); } else { opTree.push(opList[x]); } } return opTree; } function pf(value) { if (Number.isInteger(value)) { return value.toString(); } var s = value.toFixed(10); var i = s.length - 1; if (s[i] !== '0') { return s; } do { i--; } while (s[i] === '0'); return s.substr(0, s[i] === '.' ? i : i + 1); } function pm(m) { if (m[4] === 0 && m[5] === 0) { if (m[1] === 0 && m[2] === 0) { if (m[0] === 1 && m[3] === 1) { return ''; } return 'scale(' + pf(m[0]) + ' ' + pf(m[3]) + ')'; } if (m[0] === m[3] && m[1] === -m[2]) { var a = Math.acos(m[0]) * 180 / Math.PI; return 'rotate(' + pf(a) + ')'; } } else { if (m[0] === 1 && m[1] === 0 && m[2] === 0 && m[3] === 1) { return 'translate(' + pf(m[4]) + ' ' + pf(m[5]) + ')'; } } return 'matrix(' + pf(m[0]) + ' ' + pf(m[1]) + ' ' + pf(m[2]) + ' ' + pf(m[3]) + ' ' + pf(m[4]) + ' ' + pf(m[5]) + ')'; } function SVGGraphics(commonObjs, objs, forceDataSchema) { this.svgFactory = new _dom_utils.DOMSVGFactory(); this.current = new SVGExtraState(); this.transformMatrix = _util.IDENTITY_MATRIX; this.transformStack = []; this.extraStack = []; this.commonObjs = commonObjs; this.objs = objs; this.pendingClip = null; this.pendingEOFill = false; this.embedFonts = false; this.embeddedFonts = Object.create(null); this.cssStyle = null; this.forceDataSchema = !!forceDataSchema; } var XML_NS = 'http://www.w3.org/XML/1998/namespace'; var XLINK_NS = 'http://www.w3.org/1999/xlink'; var LINE_CAP_STYLES = ['butt', 'round', 'square']; var LINE_JOIN_STYLES = ['miter', 'round', 'bevel']; var clipCount = 0; var maskCount = 0; SVGGraphics.prototype = { save: function SVGGraphics_save() { this.transformStack.push(this.transformMatrix); var old = this.current; this.extraStack.push(old); this.current = old.clone(); }, restore: function SVGGraphics_restore() { this.transformMatrix = this.transformStack.pop(); this.current = this.extraStack.pop(); this.pendingClip = null; this.tgrp = null; }, group: function SVGGraphics_group(items) { this.save(); this.executeOpTree(items); this.restore(); }, loadDependencies: function SVGGraphics_loadDependencies(operatorList) { var _this = this; var fnArray = operatorList.fnArray; var fnArrayLen = fnArray.length; var argsArray = operatorList.argsArray; for (var i = 0; i < fnArrayLen; i++) { if (_util.OPS.dependency === fnArray[i]) { var deps = argsArray[i]; for (var n = 0, nn = deps.length; n < nn; n++) { var obj = deps[n]; var common = obj.substring(0, 2) === 'g_'; var promise; if (common) { promise = new Promise(function (resolve) { _this.commonObjs.get(obj, resolve); }); } else { promise = new Promise(function (resolve) { _this.objs.get(obj, resolve); }); } this.current.dependencies.push(promise); } } } return Promise.all(this.current.dependencies); }, transform: function SVGGraphics_transform(a, b, c, d, e, f) { var transformMatrix = [a, b, c, d, e, f]; this.transformMatrix = _util.Util.transform(this.transformMatrix, transformMatrix); this.tgrp = null; }, getSVG: function SVGGraphics_getSVG(operatorList, viewport) { var _this2 = this; this.viewport = viewport; var svgElement = this._initialize(viewport); return this.loadDependencies(operatorList).then(function () { _this2.transformMatrix = _util.IDENTITY_MATRIX; var opTree = _this2.convertOpList(operatorList); _this2.executeOpTree(opTree); return svgElement; }); }, convertOpList: function SVGGraphics_convertOpList(operatorList) { var argsArray = operatorList.argsArray; var fnArray = operatorList.fnArray; var fnArrayLen = fnArray.length; var REVOPS = []; var opList = []; for (var op in _util.OPS) { REVOPS[_util.OPS[op]] = op; } for (var x = 0; x < fnArrayLen; x++) { var fnId = fnArray[x]; opList.push({ 'fnId': fnId, 'fn': REVOPS[fnId], 'args': argsArray[x] }); } return opListToTree(opList); }, executeOpTree: function SVGGraphics_executeOpTree(opTree) { var opTreeLen = opTree.length; for (var x = 0; x < opTreeLen; x++) { var fn = opTree[x].fn; var fnId = opTree[x].fnId; var args = opTree[x].args; switch (fnId | 0) { case _util.OPS.beginText: this.beginText(); break; case _util.OPS.setLeading: this.setLeading(args); break; case _util.OPS.setLeadingMoveText: this.setLeadingMoveText(args[0], args[1]); break; case _util.OPS.setFont: this.setFont(args); break; case _util.OPS.showText: this.showText(args[0]); break; case _util.OPS.showSpacedText: this.showText(args[0]); break; case _util.OPS.endText: this.endText(); break; case _util.OPS.moveText: this.moveText(args[0], args[1]); break; case _util.OPS.setCharSpacing: this.setCharSpacing(args[0]); break; case _util.OPS.setWordSpacing: this.setWordSpacing(args[0]); break; case _util.OPS.setHScale: this.setHScale(args[0]); break; case _util.OPS.setTextMatrix: this.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]); break; case _util.OPS.setTextRise: this.setTextRise(args[0]); break; case _util.OPS.setLineWidth: this.setLineWidth(args[0]); break; case _util.OPS.setLineJoin: this.setLineJoin(args[0]); break; case _util.OPS.setLineCap: this.setLineCap(args[0]); break; case _util.OPS.setMiterLimit: this.setMiterLimit(args[0]); break; case _util.OPS.setFillRGBColor: this.setFillRGBColor(args[0], args[1], args[2]); break; case _util.OPS.setStrokeRGBColor: this.setStrokeRGBColor(args[0], args[1], args[2]); break; case _util.OPS.setDash: this.setDash(args[0], args[1]); break; case _util.OPS.setGState: this.setGState(args[0]); break; case _util.OPS.fill: this.fill(); break; case _util.OPS.eoFill: this.eoFill(); break; case _util.OPS.stroke: this.stroke(); break; case _util.OPS.fillStroke: this.fillStroke(); break; case _util.OPS.eoFillStroke: this.eoFillStroke(); break; case _util.OPS.clip: this.clip('nonzero'); break; case _util.OPS.eoClip: this.clip('evenodd'); break; case _util.OPS.paintSolidColorImageMask: this.paintSolidColorImageMask(); break; case _util.OPS.paintJpegXObject: this.paintJpegXObject(args[0], args[1], args[2]); break; case _util.OPS.paintImageXObject: this.paintImageXObject(args[0]); break; case _util.OPS.paintInlineImageXObject: this.paintInlineImageXObject(args[0]); break; case _util.OPS.paintImageMaskXObject: this.paintImageMaskXObject(args[0]); break; case _util.OPS.paintFormXObjectBegin: this.paintFormXObjectBegin(args[0], args[1]); break; case _util.OPS.paintFormXObjectEnd: this.paintFormXObjectEnd(); break; case _util.OPS.closePath: this.closePath(); break; case _util.OPS.closeStroke: this.closeStroke(); break; case _util.OPS.closeFillStroke: this.closeFillStroke(); break; case _util.OPS.nextLine: this.nextLine(); break; case _util.OPS.transform: this.transform(args[0], args[1], args[2], args[3], args[4], args[5]); break; case _util.OPS.constructPath: this.constructPath(args[0], args[1]); break; case _util.OPS.endPath: this.endPath(); break; case 92: this.group(opTree[x].items); break; default: (0, _util.warn)('Unimplemented operator ' + fn); break; } } }, setWordSpacing: function SVGGraphics_setWordSpacing(wordSpacing) { this.current.wordSpacing = wordSpacing; }, setCharSpacing: function SVGGraphics_setCharSpacing(charSpacing) { this.current.charSpacing = charSpacing; }, nextLine: function SVGGraphics_nextLine() { this.moveText(0, this.current.leading); }, setTextMatrix: function SVGGraphics_setTextMatrix(a, b, c, d, e, f) { var current = this.current; this.current.textMatrix = this.current.lineMatrix = [a, b, c, d, e, f]; this.current.x = this.current.lineX = 0; this.current.y = this.current.lineY = 0; current.xcoords = []; current.tspan = this.svgFactory.createElement('svg:tspan'); current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); current.txtElement = this.svgFactory.createElement('svg:text'); current.txtElement.appendChild(current.tspan); }, beginText: function SVGGraphics_beginText() { this.current.x = this.current.lineX = 0; this.current.y = this.current.lineY = 0; this.current.textMatrix = _util.IDENTITY_MATRIX; this.current.lineMatrix = _util.IDENTITY_MATRIX; this.current.tspan = this.svgFactory.createElement('svg:tspan'); this.current.txtElement = this.svgFactory.createElement('svg:text'); this.current.txtgrp = this.svgFactory.createElement('svg:g'); this.current.xcoords = []; }, moveText: function SVGGraphics_moveText(x, y) { var current = this.current; this.current.x = this.current.lineX += x; this.current.y = this.current.lineY += y; current.xcoords = []; current.tspan = this.svgFactory.createElement('svg:tspan'); current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); }, showText: function SVGGraphics_showText(glyphs) { var current = this.current; var font = current.font; var fontSize = current.fontSize; if (fontSize === 0) { return; } var charSpacing = current.charSpacing; var wordSpacing = current.wordSpacing; var fontDirection = current.fontDirection; var textHScale = current.textHScale * fontDirection; var glyphsLength = glyphs.length; var vertical = font.vertical; var widthAdvanceScale = fontSize * current.fontMatrix[0]; var x = 0, i; for (i = 0; i < glyphsLength; ++i) { var glyph = glyphs[i]; if (glyph === null) { x += fontDirection * wordSpacing; continue; } else if ((0, _util.isNum)(glyph)) { x += -glyph * fontSize * 0.001; continue; } var width = glyph.width; var character = glyph.fontChar; var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; var charWidth = width * widthAdvanceScale + spacing * fontDirection; if (!glyph.isInFont && !font.missingFile) { x += charWidth; continue; } current.xcoords.push(current.x + x * textHScale); current.tspan.textContent += character; x += charWidth; } if (vertical) { current.y -= x * textHScale; } else { current.x += x * textHScale; } current.tspan.setAttributeNS(null, 'x', current.xcoords.map(pf).join(' ')); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); current.tspan.setAttributeNS(null, 'font-family', current.fontFamily); current.tspan.setAttributeNS(null, 'font-size', pf(current.fontSize) + 'px'); if (current.fontStyle !== SVG_DEFAULTS.fontStyle) { current.tspan.setAttributeNS(null, 'font-style', current.fontStyle); } if (current.fontWeight !== SVG_DEFAULTS.fontWeight) { current.tspan.setAttributeNS(null, 'font-weight', current.fontWeight); } if (current.fillColor !== SVG_DEFAULTS.fillColor) { current.tspan.setAttributeNS(null, 'fill', current.fillColor); } var textMatrix = current.textMatrix; if (current.textRise !== 0) { textMatrix = textMatrix.slice(); textMatrix[5] += current.textRise; } current.txtElement.setAttributeNS(null, 'transform', pm(textMatrix) + ' scale(1, -1)'); current.txtElement.setAttributeNS(XML_NS, 'xml:space', 'preserve'); current.txtElement.appendChild(current.tspan); current.txtgrp.appendChild(current.txtElement); this._ensureTransformGroup().appendChild(current.txtElement); }, setLeadingMoveText: function SVGGraphics_setLeadingMoveText(x, y) { this.setLeading(-y); this.moveText(x, y); }, addFontStyle: function SVGGraphics_addFontStyle(fontObj) { if (!this.cssStyle) { this.cssStyle = this.svgFactory.createElement('svg:style'); this.cssStyle.setAttributeNS(null, 'type', 'text/css'); this.defs.appendChild(this.cssStyle); } var url = (0, _util.createObjectURL)(fontObj.data, fontObj.mimetype, this.forceDataSchema); this.cssStyle.textContent += '@font-face { font-family: "' + fontObj.loadedName + '";' + ' src: url(' + url + '); }\n'; }, setFont: function SVGGraphics_setFont(details) { var current = this.current; var fontObj = this.commonObjs.get(details[0]); var size = details[1]; this.current.font = fontObj; if (this.embedFonts && fontObj.data && !this.embeddedFonts[fontObj.loadedName]) { this.addFontStyle(fontObj); this.embeddedFonts[fontObj.loadedName] = fontObj; } current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX; var bold = fontObj.black ? fontObj.bold ? 'bolder' : 'bold' : fontObj.bold ? 'bold' : 'normal'; var italic = fontObj.italic ? 'italic' : 'normal'; if (size < 0) { size = -size; current.fontDirection = -1; } else { current.fontDirection = 1; } current.fontSize = size; current.fontFamily = fontObj.loadedName; current.fontWeight = bold; current.fontStyle = italic; current.tspan = this.svgFactory.createElement('svg:tspan'); current.tspan.setAttributeNS(null, 'y', pf(-current.y)); current.xcoords = []; }, endText: function SVGGraphics_endText() {}, setLineWidth: function SVGGraphics_setLineWidth(width) { this.current.lineWidth = width; }, setLineCap: function SVGGraphics_setLineCap(style) { this.current.lineCap = LINE_CAP_STYLES[style]; }, setLineJoin: function SVGGraphics_setLineJoin(style) { this.current.lineJoin = LINE_JOIN_STYLES[style]; }, setMiterLimit: function SVGGraphics_setMiterLimit(limit) { this.current.miterLimit = limit; }, setStrokeAlpha: function SVGGraphics_setStrokeAlpha(strokeAlpha) { this.current.strokeAlpha = strokeAlpha; }, setStrokeRGBColor: function SVGGraphics_setStrokeRGBColor(r, g, b) { var color = _util.Util.makeCssRgb(r, g, b); this.current.strokeColor = color; }, setFillAlpha: function SVGGraphics_setFillAlpha(fillAlpha) { this.current.fillAlpha = fillAlpha; }, setFillRGBColor: function SVGGraphics_setFillRGBColor(r, g, b) { var color = _util.Util.makeCssRgb(r, g, b); this.current.fillColor = color; this.current.tspan = this.svgFactory.createElement('svg:tspan'); this.current.xcoords = []; }, setDash: function SVGGraphics_setDash(dashArray, dashPhase) { this.current.dashArray = dashArray; this.current.dashPhase = dashPhase; }, constructPath: function SVGGraphics_constructPath(ops, args) { var current = this.current; var x = current.x, y = current.y; current.path = this.svgFactory.createElement('svg:path'); var d = []; var opLength = ops.length; for (var i = 0, j = 0; i < opLength; i++) { switch (ops[i] | 0) { case _util.OPS.rectangle: x = args[j++]; y = args[j++]; var width = args[j++]; var height = args[j++]; var xw = x + width; var yh = y + height; d.push('M', pf(x), pf(y), 'L', pf(xw), pf(y), 'L', pf(xw), pf(yh), 'L', pf(x), pf(yh), 'Z'); break; case _util.OPS.moveTo: x = args[j++]; y = args[j++]; d.push('M', pf(x), pf(y)); break; case _util.OPS.lineTo: x = args[j++]; y = args[j++]; d.push('L', pf(x), pf(y)); break; case _util.OPS.curveTo: x = args[j + 4]; y = args[j + 5]; d.push('C', pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3]), pf(x), pf(y)); j += 6; break; case _util.OPS.curveTo2: x = args[j + 2]; y = args[j + 3]; d.push('C', pf(x), pf(y), pf(args[j]), pf(args[j + 1]), pf(args[j + 2]), pf(args[j + 3])); j += 4; break; case _util.OPS.curveTo3: x = args[j + 2]; y = args[j + 3]; d.push('C', pf(args[j]), pf(args[j + 1]), pf(x), pf(y), pf(x), pf(y)); j += 4; break; case _util.OPS.closePath: d.push('Z'); break; } } current.path.setAttributeNS(null, 'd', d.join(' ')); current.path.setAttributeNS(null, 'fill', 'none'); this._ensureTransformGroup().appendChild(current.path); current.element = current.path; current.setCurrentPoint(x, y); }, endPath: function SVGGraphics_endPath() { if (!this.pendingClip) { return; } var current = this.current; var clipId = 'clippath' + clipCount; clipCount++; var clipPath = this.svgFactory.createElement('svg:clipPath'); clipPath.setAttributeNS(null, 'id', clipId); clipPath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); var clipElement = current.element.cloneNode(); if (this.pendingClip === 'evenodd') { clipElement.setAttributeNS(null, 'clip-rule', 'evenodd'); } else { clipElement.setAttributeNS(null, 'clip-rule', 'nonzero'); } this.pendingClip = null; clipPath.appendChild(clipElement); this.defs.appendChild(clipPath); if (current.activeClipUrl) { current.clipGroup = null; this.extraStack.forEach(function (prev) { prev.clipGroup = null; }); } current.activeClipUrl = 'url(#' + clipId + ')'; this.tgrp = null; }, clip: function SVGGraphics_clip(type) { this.pendingClip = type; }, closePath: function SVGGraphics_closePath() { var current = this.current; var d = current.path.getAttributeNS(null, 'd'); d += 'Z'; current.path.setAttributeNS(null, 'd', d); }, setLeading: function SVGGraphics_setLeading(leading) { this.current.leading = -leading; }, setTextRise: function SVGGraphics_setTextRise(textRise) { this.current.textRise = textRise; }, setHScale: function SVGGraphics_setHScale(scale) { this.current.textHScale = scale / 100; }, setGState: function SVGGraphics_setGState(states) { for (var i = 0, ii = states.length; i < ii; i++) { var state = states[i]; var key = state[0]; var value = state[1]; switch (key) { case 'LW': this.setLineWidth(value); break; case 'LC': this.setLineCap(value); break; case 'LJ': this.setLineJoin(value); break; case 'ML': this.setMiterLimit(value); break; case 'D': this.setDash(value[0], value[1]); break; case 'Font': this.setFont(value); break; case 'CA': this.setStrokeAlpha(value); break; case 'ca': this.setFillAlpha(value); break; default: (0, _util.warn)('Unimplemented graphic state ' + key); break; } } }, fill: function SVGGraphics_fill() { var current = this.current; current.element.setAttributeNS(null, 'fill', current.fillColor); current.element.setAttributeNS(null, 'fill-opacity', current.fillAlpha); }, stroke: function SVGGraphics_stroke() { var current = this.current; current.element.setAttributeNS(null, 'stroke', current.strokeColor); current.element.setAttributeNS(null, 'stroke-opacity', current.strokeAlpha); current.element.setAttributeNS(null, 'stroke-miterlimit', pf(current.miterLimit)); current.element.setAttributeNS(null, 'stroke-linecap', current.lineCap); current.element.setAttributeNS(null, 'stroke-linejoin', current.lineJoin); current.element.setAttributeNS(null, 'stroke-width', pf(current.lineWidth) + 'px'); current.element.setAttributeNS(null, 'stroke-dasharray', current.dashArray.map(pf).join(' ')); current.element.setAttributeNS(null, 'stroke-dashoffset', pf(current.dashPhase) + 'px'); current.element.setAttributeNS(null, 'fill', 'none'); }, eoFill: function SVGGraphics_eoFill() { this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); this.fill(); }, fillStroke: function SVGGraphics_fillStroke() { this.stroke(); this.fill(); }, eoFillStroke: function SVGGraphics_eoFillStroke() { this.current.element.setAttributeNS(null, 'fill-rule', 'evenodd'); this.fillStroke(); }, closeStroke: function SVGGraphics_closeStroke() { this.closePath(); this.stroke(); }, closeFillStroke: function SVGGraphics_closeFillStroke() { this.closePath(); this.fillStroke(); }, paintSolidColorImageMask: function SVGGraphics_paintSolidColorImageMask() { var current = this.current; var rect = this.svgFactory.createElement('svg:rect'); rect.setAttributeNS(null, 'x', '0'); rect.setAttributeNS(null, 'y', '0'); rect.setAttributeNS(null, 'width', '1px'); rect.setAttributeNS(null, 'height', '1px'); rect.setAttributeNS(null, 'fill', current.fillColor); this._ensureTransformGroup().appendChild(rect); }, paintJpegXObject: function SVGGraphics_paintJpegXObject(objId, w, h) { var imgObj = this.objs.get(objId); var imgEl = this.svgFactory.createElement('svg:image'); imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgObj.src); imgEl.setAttributeNS(null, 'width', pf(w)); imgEl.setAttributeNS(null, 'height', pf(h)); imgEl.setAttributeNS(null, 'x', '0'); imgEl.setAttributeNS(null, 'y', pf(-h)); imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / w) + ' ' + pf(-1 / h) + ')'); this._ensureTransformGroup().appendChild(imgEl); }, paintImageXObject: function SVGGraphics_paintImageXObject(objId) { var imgData = this.objs.get(objId); if (!imgData) { (0, _util.warn)('Dependent image isn\'t ready yet'); return; } this.paintInlineImageXObject(imgData); }, paintInlineImageXObject: function SVGGraphics_paintInlineImageXObject(imgData, mask) { var width = imgData.width; var height = imgData.height; var imgSrc = convertImgDataToPng(imgData, this.forceDataSchema); var cliprect = this.svgFactory.createElement('svg:rect'); cliprect.setAttributeNS(null, 'x', '0'); cliprect.setAttributeNS(null, 'y', '0'); cliprect.setAttributeNS(null, 'width', pf(width)); cliprect.setAttributeNS(null, 'height', pf(height)); this.current.element = cliprect; this.clip('nonzero'); var imgEl = this.svgFactory.createElement('svg:image'); imgEl.setAttributeNS(XLINK_NS, 'xlink:href', imgSrc); imgEl.setAttributeNS(null, 'x', '0'); imgEl.setAttributeNS(null, 'y', pf(-height)); imgEl.setAttributeNS(null, 'width', pf(width) + 'px'); imgEl.setAttributeNS(null, 'height', pf(height) + 'px'); imgEl.setAttributeNS(null, 'transform', 'scale(' + pf(1 / width) + ' ' + pf(-1 / height) + ')'); if (mask) { mask.appendChild(imgEl); } else { this._ensureTransformGroup().appendChild(imgEl); } }, paintImageMaskXObject: function SVGGraphics_paintImageMaskXObject(imgData) { var current = this.current; var width = imgData.width; var height = imgData.height; var fillColor = current.fillColor; current.maskId = 'mask' + maskCount++; var mask = this.svgFactory.createElement('svg:mask'); mask.setAttributeNS(null, 'id', current.maskId); var rect = this.svgFactory.createElement('svg:rect'); rect.setAttributeNS(null, 'x', '0'); rect.setAttributeNS(null, 'y', '0'); rect.setAttributeNS(null, 'width', pf(width)); rect.setAttributeNS(null, 'height', pf(height)); rect.setAttributeNS(null, 'fill', fillColor); rect.setAttributeNS(null, 'mask', 'url(#' + current.maskId + ')'); this.defs.appendChild(mask); this._ensureTransformGroup().appendChild(rect); this.paintInlineImageXObject(imgData, mask); }, paintFormXObjectBegin: function SVGGraphics_paintFormXObjectBegin(matrix, bbox) { if (Array.isArray(matrix) && matrix.length === 6) { this.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); } if (Array.isArray(bbox) && bbox.length === 4) { var width = bbox[2] - bbox[0]; var height = bbox[3] - bbox[1]; var cliprect = this.svgFactory.createElement('svg:rect'); cliprect.setAttributeNS(null, 'x', bbox[0]); cliprect.setAttributeNS(null, 'y', bbox[1]); cliprect.setAttributeNS(null, 'width', pf(width)); cliprect.setAttributeNS(null, 'height', pf(height)); this.current.element = cliprect; this.clip('nonzero'); this.endPath(); } }, paintFormXObjectEnd: function SVGGraphics_paintFormXObjectEnd() {}, _initialize: function _initialize(viewport) { var svg = this.svgFactory.create(viewport.width, viewport.height); var definitions = this.svgFactory.createElement('svg:defs'); svg.appendChild(definitions); this.defs = definitions; var rootGroup = this.svgFactory.createElement('svg:g'); rootGroup.setAttributeNS(null, 'transform', pm(viewport.transform)); svg.appendChild(rootGroup); this.svg = rootGroup; return svg; }, _ensureClipGroup: function SVGGraphics_ensureClipGroup() { if (!this.current.clipGroup) { var clipGroup = this.svgFactory.createElement('svg:g'); clipGroup.setAttributeNS(null, 'clip-path', this.current.activeClipUrl); this.svg.appendChild(clipGroup); this.current.clipGroup = clipGroup; } return this.current.clipGroup; }, _ensureTransformGroup: function SVGGraphics_ensureTransformGroup() { if (!this.tgrp) { this.tgrp = this.svgFactory.createElement('svg:g'); this.tgrp.setAttributeNS(null, 'transform', pm(this.transformMatrix)); if (this.current.activeClipUrl) { this._ensureClipGroup().appendChild(this.tgrp); } else { this.svg.appendChild(this.tgrp); } } return this.tgrp; } }; return SVGGraphics; }(); } exports.SVGGraphics = SVGGraphics; /***/ }), /* 63 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var pdfjsVersion = '2.0.106'; var pdfjsBuild = '0052dc2b'; var pdfjsSharedUtil = __w_pdfjs_require__(0); var pdfjsDisplayGlobal = __w_pdfjs_require__(113); var pdfjsDisplayAPI = __w_pdfjs_require__(57); var pdfjsDisplayTextLayer = __w_pdfjs_require__(61); var pdfjsDisplayAnnotationLayer = __w_pdfjs_require__(60); var pdfjsDisplayDOMUtils = __w_pdfjs_require__(8); var pdfjsDisplaySVG = __w_pdfjs_require__(62); { if (pdfjsSharedUtil.isNodeJS()) { var PDFNodeStream = __w_pdfjs_require__(118).PDFNodeStream; pdfjsDisplayAPI.setPDFNetworkStreamClass(PDFNodeStream); } else if (typeof Response !== 'undefined' && 'body' in Response.prototype && typeof ReadableStream !== 'undefined') { var PDFFetchStream = __w_pdfjs_require__(119).PDFFetchStream; pdfjsDisplayAPI.setPDFNetworkStreamClass(PDFFetchStream); } else { var PDFNetworkStream = __w_pdfjs_require__(120).PDFNetworkStream; pdfjsDisplayAPI.setPDFNetworkStreamClass(PDFNetworkStream); } } exports.PDFJS = pdfjsDisplayGlobal.PDFJS; exports.build = pdfjsDisplayAPI.build; exports.version = pdfjsDisplayAPI.version; exports.getDocument = pdfjsDisplayAPI.getDocument; exports.LoopbackPort = pdfjsDisplayAPI.LoopbackPort; exports.PDFDataRangeTransport = pdfjsDisplayAPI.PDFDataRangeTransport; exports.PDFWorker = pdfjsDisplayAPI.PDFWorker; exports.renderTextLayer = pdfjsDisplayTextLayer.renderTextLayer; exports.AnnotationLayer = pdfjsDisplayAnnotationLayer.AnnotationLayer; exports.CustomStyle = pdfjsDisplayDOMUtils.CustomStyle; exports.createPromiseCapability = pdfjsSharedUtil.createPromiseCapability; exports.PasswordResponses = pdfjsSharedUtil.PasswordResponses; exports.InvalidPDFException = pdfjsSharedUtil.InvalidPDFException; exports.MissingPDFException = pdfjsSharedUtil.MissingPDFException; exports.SVGGraphics = pdfjsDisplaySVG.SVGGraphics; exports.NativeImageDecoding = pdfjsSharedUtil.NativeImageDecoding; exports.UnexpectedResponseException = pdfjsSharedUtil.UnexpectedResponseException; exports.OPS = pdfjsSharedUtil.OPS; exports.UNSUPPORTED_FEATURES = pdfjsSharedUtil.UNSUPPORTED_FEATURES; exports.createValidAbsoluteUrl = pdfjsSharedUtil.createValidAbsoluteUrl; exports.createObjectURL = pdfjsSharedUtil.createObjectURL; exports.removeNullCharacters = pdfjsSharedUtil.removeNullCharacters; exports.shadow = pdfjsSharedUtil.shadow; exports.createBlob = pdfjsSharedUtil.createBlob; exports.RenderingCancelledException = pdfjsDisplayDOMUtils.RenderingCancelledException; exports.getFilenameFromUrl = pdfjsDisplayDOMUtils.getFilenameFromUrl; exports.addLinkAttributes = pdfjsDisplayDOMUtils.addLinkAttributes; exports.StatTimer = pdfjsSharedUtil.StatTimer; /***/ }), /* 64 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; if (typeof PDFJS === 'undefined' || !PDFJS.compatibilityChecked) { var globalScope = __w_pdfjs_require__(14); var userAgent = typeof navigator !== 'undefined' && navigator.userAgent || ''; var isAndroid = /Android/.test(userAgent); var isAndroidPre3 = /Android\s[0-2][^\d]/.test(userAgent); var isAndroidPre5 = /Android\s[0-4][^\d]/.test(userAgent); var isChrome = userAgent.indexOf('Chrom') >= 0; var isChromeWithRangeBug = /Chrome\/(39|40)\./.test(userAgent); var isIOSChrome = userAgent.indexOf('CriOS') >= 0; var isIE = userAgent.indexOf('Trident') >= 0; var isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent); var isOpera = userAgent.indexOf('Opera') >= 0; var isSafari = /Safari\//.test(userAgent) && !/(Chrome\/|Android\s)/.test(userAgent); var hasDOM = (typeof window === 'undefined' ? 'undefined' : _typeof(window)) === 'object' && (typeof document === 'undefined' ? 'undefined' : _typeof(document)) === 'object'; if (typeof PDFJS === 'undefined') { globalScope.PDFJS = {}; } PDFJS.compatibilityChecked = true; (function normalizeURLObject() { if (!globalScope.URL) { globalScope.URL = globalScope.webkitURL; } })(); (function checkObjectDefinePropertyCompatibility() { if (typeof Object.defineProperty !== 'undefined') { var definePropertyPossible = true; try { if (hasDOM) { Object.defineProperty(new Image(), 'id', { value: 'test' }); } var Test = function Test() {}; Test.prototype = { get id() {} }; Object.defineProperty(new Test(), 'id', { value: '', configurable: true, enumerable: true, writable: false }); } catch (e) { definePropertyPossible = false; } if (definePropertyPossible) { return; } } Object.defineProperty = function objectDefineProperty(obj, name, def) { delete obj[name]; if ('get' in def) { obj.__defineGetter__(name, def['get']); } if ('set' in def) { obj.__defineSetter__(name, def['set']); } if ('value' in def) { obj.__defineSetter__(name, function objectDefinePropertySetter(value) { this.__defineGetter__(name, function objectDefinePropertyGetter() { return value; }); return value; }); obj[name] = def.value; } }; })(); (function checkXMLHttpRequestResponseCompatibility() { if (typeof XMLHttpRequest === 'undefined') { return; } var xhrPrototype = XMLHttpRequest.prototype; var xhr = new XMLHttpRequest(); if (!('overrideMimeType' in xhr)) { Object.defineProperty(xhrPrototype, 'overrideMimeType', { value: function xmlHttpRequestOverrideMimeType(mimeType) {} }); } if ('responseType' in xhr) { return; } Object.defineProperty(xhrPrototype, 'responseType', { get: function xmlHttpRequestGetResponseType() { return this._responseType || 'text'; }, set: function xmlHttpRequestSetResponseType(value) { if (value === 'text' || value === 'arraybuffer') { this._responseType = value; if (value === 'arraybuffer' && typeof this.overrideMimeType === 'function') { this.overrideMimeType('text/plain; charset=x-user-defined'); } } } }); if (typeof VBArray !== 'undefined') { Object.defineProperty(xhrPrototype, 'response', { get: function xmlHttpRequestResponseGet() { if (this.responseType === 'arraybuffer') { return new Uint8Array(new VBArray(this.responseBody).toArray()); } return this.responseText; } }); return; } Object.defineProperty(xhrPrototype, 'response', { get: function xmlHttpRequestResponseGet() { if (this.responseType !== 'arraybuffer') { return this.responseText; } var text = this.responseText; var i, n = text.length; var result = new Uint8Array(n); for (i = 0; i < n; ++i) { result[i] = text.charCodeAt(i) & 0xFF; } return result.buffer; } }); })(); (function checkWindowBtoaCompatibility() { if ('btoa' in globalScope) { return; } var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; globalScope.btoa = function (chars) { var buffer = ''; var i, n; for (i = 0, n = chars.length; i < n; i += 3) { var b1 = chars.charCodeAt(i) & 0xFF; var b2 = chars.charCodeAt(i + 1) & 0xFF; var b3 = chars.charCodeAt(i + 2) & 0xFF; var d1 = b1 >> 2, d2 = (b1 & 3) << 4 | b2 >> 4; var d3 = i + 1 < n ? (b2 & 0xF) << 2 | b3 >> 6 : 64; var d4 = i + 2 < n ? b3 & 0x3F : 64; buffer += digits.charAt(d1) + digits.charAt(d2) + digits.charAt(d3) + digits.charAt(d4); } return buffer; }; })(); (function checkWindowAtobCompatibility() { if ('atob' in globalScope) { return; } var digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; globalScope.atob = function (input) { input = input.replace(/=+$/, ''); if (input.length % 4 === 1) { throw new Error('bad atob input'); } for (var bc = 0, bs, buffer, idx = 0, output = ''; buffer = input.charAt(idx++); ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0) { buffer = digits.indexOf(buffer); } return output; }; })(); (function checkFunctionPrototypeBindCompatibility() { if (typeof Function.prototype.bind !== 'undefined') { return; } Function.prototype.bind = function functionPrototypeBind(obj) { var fn = this, headArgs = Array.prototype.slice.call(arguments, 1); var bound = function functionPrototypeBindBound() { var args = headArgs.concat(Array.prototype.slice.call(arguments)); return fn.apply(obj, args); }; return bound; }; })(); (function checkDatasetProperty() { if (!hasDOM) { return; } var div = document.createElement('div'); if ('dataset' in div) { return; } Object.defineProperty(HTMLElement.prototype, 'dataset', { get: function get() { if (this._dataset) { return this._dataset; } var dataset = {}; for (var j = 0, jj = this.attributes.length; j < jj; j++) { var attribute = this.attributes[j]; if (attribute.name.substring(0, 5) !== 'data-') { continue; } var key = attribute.name.substring(5).replace(/\-([a-z])/g, function (all, ch) { return ch.toUpperCase(); }); dataset[key] = attribute.value; } Object.defineProperty(this, '_dataset', { value: dataset, writable: false, enumerable: false }); return dataset; }, enumerable: true }); })(); (function checkClassListProperty() { function changeList(element, itemName, add, remove) { var s = element.className || ''; var list = s.split(/\s+/g); if (list[0] === '') { list.shift(); } var index = list.indexOf(itemName); if (index < 0 && add) { list.push(itemName); } if (index >= 0 && remove) { list.splice(index, 1); } element.className = list.join(' '); return index >= 0; } if (!hasDOM) { return; } var div = document.createElement('div'); if ('classList' in div) { return; } var classListPrototype = { add: function add(name) { changeList(this.element, name, true, false); }, contains: function contains(name) { return changeList(this.element, name, false, false); }, remove: function remove(name) { changeList(this.element, name, false, true); }, toggle: function toggle(name) { changeList(this.element, name, true, true); } }; Object.defineProperty(HTMLElement.prototype, 'classList', { get: function get() { if (this._classList) { return this._classList; } var classList = Object.create(classListPrototype, { element: { value: this, writable: false, enumerable: true } }); Object.defineProperty(this, '_classList', { value: classList, writable: false, enumerable: false }); return classList; }, enumerable: true }); })(); (function checkWorkerConsoleCompatibility() { if (typeof importScripts === 'undefined' || 'console' in globalScope) { return; } var consoleTimer = {}; var workerConsole = { log: function log() { var args = Array.prototype.slice.call(arguments); globalScope.postMessage({ targetName: 'main', action: 'console_log', data: args }); }, error: function error() { var args = Array.prototype.slice.call(arguments); globalScope.postMessage({ targetName: 'main', action: 'console_error', data: args }); }, time: function time(name) { consoleTimer[name] = Date.now(); }, timeEnd: function timeEnd(name) { var time = consoleTimer[name]; if (!time) { throw new Error('Unknown timer name ' + name); } this.log('Timer:', name, Date.now() - time); } }; globalScope.console = workerConsole; })(); (function checkConsoleCompatibility() { if (!hasDOM) { return; } if (!('console' in window)) { window.console = { log: function log() {}, error: function error() {}, warn: function warn() {} }; return; } if (!('bind' in console.log)) { console.log = function (fn) { return function (msg) { return fn(msg); }; }(console.log); console.error = function (fn) { return function (msg) { return fn(msg); }; }(console.error); console.warn = function (fn) { return function (msg) { return fn(msg); }; }(console.warn); return; } })(); (function checkOnClickCompatibility() { function ignoreIfTargetDisabled(event) { if (isDisabled(event.target)) { event.stopPropagation(); } } function isDisabled(node) { return node.disabled || node.parentNode && isDisabled(node.parentNode); } if (isOpera) { document.addEventListener('click', ignoreIfTargetDisabled, true); } })(); (function checkOnBlobSupport() { if (isIE || isIOSChrome) { PDFJS.disableCreateObjectURL = true; } })(); (function checkNavigatorLanguage() { if (typeof navigator === 'undefined') { return; } if ('language' in navigator) { return; } PDFJS.locale = navigator.userLanguage || 'en-US'; })(); (function checkRangeRequests() { if (isSafari || isAndroidPre3 || isChromeWithRangeBug || isIOS) { PDFJS.disableRange = true; PDFJS.disableStream = true; } })(); (function checkHistoryManipulation() { if (!hasDOM) { return; } if (!history.pushState || isAndroidPre3) { PDFJS.disableHistory = true; } })(); (function checkSetPresenceInImageData() { if (!hasDOM) { return; } if (window.CanvasPixelArray) { if (typeof window.CanvasPixelArray.prototype.set !== 'function') { window.CanvasPixelArray.prototype.set = function (arr) { for (var i = 0, ii = this.length; i < ii; i++) { this[i] = arr[i]; } }; } } else { var polyfill = false, versionMatch; if (isChrome) { versionMatch = userAgent.match(/Chrom(e|ium)\/([0-9]+)\./); polyfill = versionMatch && parseInt(versionMatch[2]) < 21; } else if (isAndroid) { polyfill = isAndroidPre5; } else if (isSafari) { versionMatch = userAgent.match(/Version\/([0-9]+)\.([0-9]+)\.([0-9]+) Safari\//); polyfill = versionMatch && parseInt(versionMatch[1]) < 6; } if (polyfill) { var contextPrototype = window.CanvasRenderingContext2D.prototype; var createImageData = contextPrototype.createImageData; contextPrototype.createImageData = function (w, h) { var imageData = createImageData.call(this, w, h); imageData.data.set = function (arr) { for (var i = 0, ii = this.length; i < ii; i++) { this[i] = arr[i]; } }; return imageData; }; contextPrototype = null; } } })(); (function checkRequestAnimationFrame() { function installFakeAnimationFrameFunctions() { window.requestAnimationFrame = function (callback) { return window.setTimeout(callback, 20); }; window.cancelAnimationFrame = function (timeoutID) { window.clearTimeout(timeoutID); }; } if (!hasDOM) { return; } if (isIOS) { installFakeAnimationFrameFunctions(); return; } if ('requestAnimationFrame' in window) { return; } window.requestAnimationFrame = window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame; if (window.requestAnimationFrame) { return; } installFakeAnimationFrameFunctions(); })(); (function checkCanvasSizeLimitation() { if (isIOS || isAndroid) { PDFJS.maxCanvasPixels = 5242880; } })(); (function checkFullscreenSupport() { if (!hasDOM) { return; } if (isIE && window.parent !== window) { PDFJS.disableFullscreen = true; } })(); (function checkCurrentScript() { if (!hasDOM) { return; } if ('currentScript' in document) { return; } Object.defineProperty(document, 'currentScript', { get: function get() { var scripts = document.getElementsByTagName('script'); return scripts[scripts.length - 1]; }, enumerable: true, configurable: true }); })(); (function checkInputTypeNumberAssign() { if (!hasDOM) { return; } var el = document.createElement('input'); try { el.type = 'number'; } catch (ex) { var inputProto = el.constructor.prototype; var typeProperty = Object.getOwnPropertyDescriptor(inputProto, 'type'); Object.defineProperty(inputProto, 'type', { get: function get() { return typeProperty.get.call(this); }, set: function set(value) { typeProperty.set.call(this, value === 'number' ? 'text' : value); }, enumerable: true, configurable: true }); } })(); (function checkDocumentReadyState() { if (!hasDOM) { return; } if (!document.attachEvent) { return; } var documentProto = document.constructor.prototype; var readyStateProto = Object.getOwnPropertyDescriptor(documentProto, 'readyState'); Object.defineProperty(documentProto, 'readyState', { get: function get() { var value = readyStateProto.get.call(this); return value === 'interactive' ? 'loading' : value; }, set: function set(value) { readyStateProto.set.call(this, value); }, enumerable: true, configurable: true }); })(); (function checkChildNodeRemove() { if (!hasDOM) { return; } if (typeof Element.prototype.remove !== 'undefined') { return; } Element.prototype.remove = function () { if (this.parentNode) { this.parentNode.removeChild(this); } }; })(); (function checkObjectValues() { if (Object.values) { return; } Object.values = __w_pdfjs_require__(65); })(); (function checkArrayIncludes() { if (Array.prototype.includes) { return; } Array.prototype.includes = __w_pdfjs_require__(70); })(); (function checkNumberIsNaN() { if (Number.isNaN) { return; } Number.isNaN = __w_pdfjs_require__(72); })(); (function checkNumberIsInteger() { if (Number.isInteger) { return; } Number.isInteger = __w_pdfjs_require__(74); })(); (function checkPromise() { if (globalScope.Promise) { return; } globalScope.Promise = __w_pdfjs_require__(77); })(); (function checkWeakMap() { if (globalScope.WeakMap) { return; } globalScope.WeakMap = __w_pdfjs_require__(95); })(); (function checkURLConstructor() { var hasWorkingUrl = false; try { if (typeof URL === 'function' && _typeof(URL.prototype) === 'object' && 'origin' in URL.prototype) { var u = new URL('b', 'http://a'); u.pathname = 'c%20d'; hasWorkingUrl = u.href === 'http://a/c%20d'; } } catch (e) {} if (hasWorkingUrl) { return; } var relative = Object.create(null); relative['ftp'] = 21; relative['file'] = 0; relative['gopher'] = 70; relative['http'] = 80; relative['https'] = 443; relative['ws'] = 80; relative['wss'] = 443; var relativePathDotMapping = Object.create(null); relativePathDotMapping['%2e'] = '.'; relativePathDotMapping['.%2e'] = '..'; relativePathDotMapping['%2e.'] = '..'; relativePathDotMapping['%2e%2e'] = '..'; function isRelativeScheme(scheme) { return relative[scheme] !== undefined; } function invalid() { clear.call(this); this._isInvalid = true; } function IDNAToASCII(h) { if (h === '') { invalid.call(this); } return h.toLowerCase(); } function percentEscape(c) { var unicode = c.charCodeAt(0); if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) === -1) { return c; } return encodeURIComponent(c); } function percentEscapeQuery(c) { var unicode = c.charCodeAt(0); if (unicode > 0x20 && unicode < 0x7F && [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) === -1) { return c; } return encodeURIComponent(c); } var EOF, ALPHA = /[a-zA-Z]/, ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/; function parse(input, stateOverride, base) { function err(message) { errors.push(message); } var state = stateOverride || 'scheme start', cursor = 0, buffer = '', seenAt = false, seenBracket = false, errors = []; loop: while ((input[cursor - 1] !== EOF || cursor === 0) && !this._isInvalid) { var c = input[cursor]; switch (state) { case 'scheme start': if (c && ALPHA.test(c)) { buffer += c.toLowerCase(); state = 'scheme'; } else if (!stateOverride) { buffer = ''; state = 'no scheme'; continue; } else { err('Invalid scheme.'); break loop; } break; case 'scheme': if (c && ALPHANUMERIC.test(c)) { buffer += c.toLowerCase(); } else if (c === ':') { this._scheme = buffer; buffer = ''; if (stateOverride) { break loop; } if (isRelativeScheme(this._scheme)) { this._isRelative = true; } if (this._scheme === 'file') { state = 'relative'; } else if (this._isRelative && base && base._scheme === this._scheme) { state = 'relative or authority'; } else if (this._isRelative) { state = 'authority first slash'; } else { state = 'scheme data'; } } else if (!stateOverride) { buffer = ''; cursor = 0; state = 'no scheme'; continue; } else if (c === EOF) { break loop; } else { err('Code point not allowed in scheme: ' + c); break loop; } break; case 'scheme data': if (c === '?') { this._query = '?'; state = 'query'; } else if (c === '#') { this._fragment = '#'; state = 'fragment'; } else { if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') { this._schemeData += percentEscape(c); } } break; case 'no scheme': if (!base || !isRelativeScheme(base._scheme)) { err('Missing scheme.'); invalid.call(this); } else { state = 'relative'; continue; } break; case 'relative or authority': if (c === '/' && input[cursor + 1] === '/') { state = 'authority ignore slashes'; } else { err('Expected /, got: ' + c); state = 'relative'; continue; } break; case 'relative': this._isRelative = true; if (this._scheme !== 'file') { this._scheme = base._scheme; } if (c === EOF) { this._host = base._host; this._port = base._port; this._path = base._path.slice(); this._query = base._query; this._username = base._username; this._password = base._password; break loop; } else if (c === '/' || c === '\\') { if (c === '\\') { err('\\ is an invalid code point.'); } state = 'relative slash'; } else if (c === '?') { this._host = base._host; this._port = base._port; this._path = base._path.slice(); this._query = '?'; this._username = base._username; this._password = base._password; state = 'query'; } else if (c === '#') { this._host = base._host; this._port = base._port; this._path = base._path.slice(); this._query = base._query; this._fragment = '#'; this._username = base._username; this._password = base._password; state = 'fragment'; } else { var nextC = input[cursor + 1]; var nextNextC = input[cursor + 2]; if (this._scheme !== 'file' || !ALPHA.test(c) || nextC !== ':' && nextC !== '|' || nextNextC !== EOF && nextNextC !== '/' && nextNextC !== '\\' && nextNextC !== '?' && nextNextC !== '#') { this._host = base._host; this._port = base._port; this._username = base._username; this._password = base._password; this._path = base._path.slice(); this._path.pop(); } state = 'relative path'; continue; } break; case 'relative slash': if (c === '/' || c === '\\') { if (c === '\\') { err('\\ is an invalid code point.'); } if (this._scheme === 'file') { state = 'file host'; } else { state = 'authority ignore slashes'; } } else { if (this._scheme !== 'file') { this._host = base._host; this._port = base._port; this._username = base._username; this._password = base._password; } state = 'relative path'; continue; } break; case 'authority first slash': if (c === '/') { state = 'authority second slash'; } else { err('Expected \'/\', got: ' + c); state = 'authority ignore slashes'; continue; } break; case 'authority second slash': state = 'authority ignore slashes'; if (c !== '/') { err('Expected \'/\', got: ' + c); continue; } break; case 'authority ignore slashes': if (c !== '/' && c !== '\\') { state = 'authority'; continue; } else { err('Expected authority, got: ' + c); } break; case 'authority': if (c === '@') { if (seenAt) { err('@ already seen.'); buffer += '%40'; } seenAt = true; for (var i = 0; i < buffer.length; i++) { var cp = buffer[i]; if (cp === '\t' || cp === '\n' || cp === '\r') { err('Invalid whitespace in authority.'); continue; } if (cp === ':' && this._password === null) { this._password = ''; continue; } var tempC = percentEscape(cp); if (this._password !== null) { this._password += tempC; } else { this._username += tempC; } } buffer = ''; } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') { cursor -= buffer.length; buffer = ''; state = 'host'; continue; } else { buffer += c; } break; case 'file host': if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') { if (buffer.length === 2 && ALPHA.test(buffer[0]) && (buffer[1] === ':' || buffer[1] === '|')) { state = 'relative path'; } else if (buffer.length === 0) { state = 'relative path start'; } else { this._host = IDNAToASCII.call(this, buffer); buffer = ''; state = 'relative path start'; } continue; } else if (c === '\t' || c === '\n' || c === '\r') { err('Invalid whitespace in file host.'); } else { buffer += c; } break; case 'host': case 'hostname': if (c === ':' && !seenBracket) { this._host = IDNAToASCII.call(this, buffer); buffer = ''; state = 'port'; if (stateOverride === 'hostname') { break loop; } } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#') { this._host = IDNAToASCII.call(this, buffer); buffer = ''; state = 'relative path start'; if (stateOverride) { break loop; } continue; } else if (c !== '\t' && c !== '\n' && c !== '\r') { if (c === '[') { seenBracket = true; } else if (c === ']') { seenBracket = false; } buffer += c; } else { err('Invalid code point in host/hostname: ' + c); } break; case 'port': if (/[0-9]/.test(c)) { buffer += c; } else if (c === EOF || c === '/' || c === '\\' || c === '?' || c === '#' || stateOverride) { if (buffer !== '') { var temp = parseInt(buffer, 10); if (temp !== relative[this._scheme]) { this._port = temp + ''; } buffer = ''; } if (stateOverride) { break loop; } state = 'relative path start'; continue; } else if (c === '\t' || c === '\n' || c === '\r') { err('Invalid code point in port: ' + c); } else { invalid.call(this); } break; case 'relative path start': if (c === '\\') { err('\'\\\' not allowed in path.'); } state = 'relative path'; if (c !== '/' && c !== '\\') { continue; } break; case 'relative path': if (c === EOF || c === '/' || c === '\\' || !stateOverride && (c === '?' || c === '#')) { if (c === '\\') { err('\\ not allowed in relative path.'); } var tmp; if (tmp = relativePathDotMapping[buffer.toLowerCase()]) { buffer = tmp; } if (buffer === '..') { this._path.pop(); if (c !== '/' && c !== '\\') { this._path.push(''); } } else if (buffer === '.' && c !== '/' && c !== '\\') { this._path.push(''); } else if (buffer !== '.') { if (this._scheme === 'file' && this._path.length === 0 && buffer.length === 2 && ALPHA.test(buffer[0]) && buffer[1] === '|') { buffer = buffer[0] + ':'; } this._path.push(buffer); } buffer = ''; if (c === '?') { this._query = '?'; state = 'query'; } else if (c === '#') { this._fragment = '#'; state = 'fragment'; } } else if (c !== '\t' && c !== '\n' && c !== '\r') { buffer += percentEscape(c); } break; case 'query': if (!stateOverride && c === '#') { this._fragment = '#'; state = 'fragment'; } else if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') { this._query += percentEscapeQuery(c); } break; case 'fragment': if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') { this._fragment += c; } break; } cursor++; } } function clear() { this._scheme = ''; this._schemeData = ''; this._username = ''; this._password = null; this._host = ''; this._port = ''; this._path = []; this._query = ''; this._fragment = ''; this._isInvalid = false; this._isRelative = false; } function JURL(url, base) { if (base !== undefined && !(base instanceof JURL)) { base = new JURL(String(base)); } this._url = url; clear.call(this); var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, ''); parse.call(this, input, null, base); } JURL.prototype = { toString: function toString() { return this.href; }, get href() { if (this._isInvalid) { return this._url; } var authority = ''; if (this._username !== '' || this._password !== null) { authority = this._username + (this._password !== null ? ':' + this._password : '') + '@'; } return this.protocol + (this._isRelative ? '//' + authority + this.host : '') + this.pathname + this._query + this._fragment; }, set href(value) { clear.call(this); parse.call(this, value); }, get protocol() { return this._scheme + ':'; }, set protocol(value) { if (this._isInvalid) { return; } parse.call(this, value + ':', 'scheme start'); }, get host() { return this._isInvalid ? '' : this._port ? this._host + ':' + this._port : this._host; }, set host(value) { if (this._isInvalid || !this._isRelative) { return; } parse.call(this, value, 'host'); }, get hostname() { return this._host; }, set hostname(value) { if (this._isInvalid || !this._isRelative) { return; } parse.call(this, value, 'hostname'); }, get port() { return this._port; }, set port(value) { if (this._isInvalid || !this._isRelative) { return; } parse.call(this, value, 'port'); }, get pathname() { return this._isInvalid ? '' : this._isRelative ? '/' + this._path.join('/') : this._schemeData; }, set pathname(value) { if (this._isInvalid || !this._isRelative) { return; } this._path = []; parse.call(this, value, 'relative path start'); }, get search() { return this._isInvalid || !this._query || this._query === '?' ? '' : this._query; }, set search(value) { if (this._isInvalid || !this._isRelative) { return; } this._query = '?'; if (value[0] === '?') { value = value.slice(1); } parse.call(this, value, 'query'); }, get hash() { return this._isInvalid || !this._fragment || this._fragment === '#' ? '' : this._fragment; }, set hash(value) { if (this._isInvalid) { return; } this._fragment = '#'; if (value[0] === '#') { value = value.slice(1); } parse.call(this, value, 'fragment'); }, get origin() { var host; if (this._isInvalid || !this._scheme) { return ''; } switch (this._scheme) { case 'data': case 'file': case 'javascript': case 'mailto': return 'null'; case 'blob': try { return new JURL(this._schemeData).origin || 'null'; } catch (_) {} return 'null'; } host = this.host; if (!host) { return ''; } return this._scheme + '://' + host; } }; var OriginalURL = globalScope.URL; if (OriginalURL) { JURL.createObjectURL = function (blob) { return OriginalURL.createObjectURL.apply(OriginalURL, arguments); }; JURL.revokeObjectURL = function (url) { OriginalURL.revokeObjectURL(url); }; } globalScope.URL = JURL; })(); } /***/ }), /* 65 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; __w_pdfjs_require__(66); module.exports = __w_pdfjs_require__(5).Object.values; /***/ }), /* 66 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var $export = __w_pdfjs_require__(4); var $values = __w_pdfjs_require__(67)(false); $export($export.S, 'Object', { values: function values(it) { return $values(it); } }); /***/ }), /* 67 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var getKeys = __w_pdfjs_require__(21); var toIObject = __w_pdfjs_require__(17); var isEnum = __w_pdfjs_require__(31).f; module.exports = function (isEntries) { return function (it) { var O = toIObject(it); var keys = getKeys(O); var length = keys.length; var i = 0; var result = []; var key; while (length > i) { if (isEnum.call(O, key = keys[i++])) { result.push(isEntries ? [key, O[key]] : O[key]); } }return result; }; }; /***/ }), /* 68 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var has = __w_pdfjs_require__(7); var toIObject = __w_pdfjs_require__(17); var arrayIndexOf = __w_pdfjs_require__(41)(false); var IE_PROTO = __w_pdfjs_require__(30)('IE_PROTO'); module.exports = function (object, names) { var O = toIObject(object); var i = 0; var result = []; var key; for (key in O) { if (key != IE_PROTO) has(O, key) && result.push(key); }while (names.length > i) { if (has(O, key = names[i++])) { ~arrayIndexOf(result, key) || result.push(key); } }return result; }; /***/ }), /* 69 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var toInteger = __w_pdfjs_require__(29); var max = Math.max; var min = Math.min; module.exports = function (index, length) { index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); }; /***/ }), /* 70 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; __w_pdfjs_require__(71); module.exports = __w_pdfjs_require__(5).Array.includes; /***/ }), /* 71 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var $export = __w_pdfjs_require__(4); var $includes = __w_pdfjs_require__(41)(true); $export($export.P, 'Array', { includes: function includes(el) { return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } }); __w_pdfjs_require__(44)('includes'); /***/ }), /* 72 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; __w_pdfjs_require__(73); module.exports = __w_pdfjs_require__(5).Number.isNaN; /***/ }), /* 73 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var $export = __w_pdfjs_require__(4); $export($export.S, 'Number', { isNaN: function isNaN(number) { return number != number; } }); /***/ }), /* 74 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; __w_pdfjs_require__(75); module.exports = __w_pdfjs_require__(5).Number.isInteger; /***/ }), /* 75 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var $export = __w_pdfjs_require__(4); $export($export.S, 'Number', { isInteger: __w_pdfjs_require__(76) }); /***/ }), /* 76 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var isObject = __w_pdfjs_require__(1); var floor = Math.floor; module.exports = function isInteger(it) { return !isObject(it) && isFinite(it) && floor(it) === it; }; /***/ }), /* 77 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; __w_pdfjs_require__(45); __w_pdfjs_require__(78); __w_pdfjs_require__(49); __w_pdfjs_require__(86); __w_pdfjs_require__(93); __w_pdfjs_require__(94); module.exports = __w_pdfjs_require__(5).Promise; /***/ }), /* 78 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var $at = __w_pdfjs_require__(79)(true); __w_pdfjs_require__(46)(String, 'String', function (iterated) { this._t = String(iterated); this._i = 0; }, function () { var O = this._t; var index = this._i; var point; if (index >= O.length) return { value: undefined, done: true }; point = $at(O, index); this._i += point.length; return { value: point, done: false }; }); /***/ }), /* 79 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var toInteger = __w_pdfjs_require__(29); var defined = __w_pdfjs_require__(27); module.exports = function (TO_STRING) { return function (that, pos) { var s = String(defined(that)); var i = toInteger(pos); var l = s.length; var a, b; if (i < 0 || i >= l) return TO_STRING ? '' : undefined; a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; /***/ }), /* 80 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var create = __w_pdfjs_require__(81); var descriptor = __w_pdfjs_require__(25); var setToStringTag = __w_pdfjs_require__(22); var IteratorPrototype = {}; __w_pdfjs_require__(11)(IteratorPrototype, __w_pdfjs_require__(2)('iterator'), function () { return this; }); module.exports = function (Constructor, NAME, next) { Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); setToStringTag(Constructor, NAME + ' Iterator'); }; /***/ }), /* 81 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var anObject = __w_pdfjs_require__(6); var dPs = __w_pdfjs_require__(82); var enumBugKeys = __w_pdfjs_require__(43); var IE_PROTO = __w_pdfjs_require__(30)('IE_PROTO'); var Empty = function Empty() {}; var PROTOTYPE = 'prototype'; var _createDict = function createDict() { var iframe = __w_pdfjs_require__(24)('iframe'); var i = enumBugKeys.length; var lt = '<'; var gt = '>'; var iframeDocument; iframe.style.display = 'none'; __w_pdfjs_require__(48).appendChild(iframe); iframe.src = 'javascript:'; iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); iframeDocument.close(); _createDict = iframeDocument.F; while (i--) { delete _createDict[PROTOTYPE][enumBugKeys[i]]; }return _createDict(); }; module.exports = Object.create || function create(O, Properties) { var result; if (O !== null) { Empty[PROTOTYPE] = anObject(O); result = new Empty(); Empty[PROTOTYPE] = null; result[IE_PROTO] = O; } else result = _createDict(); return Properties === undefined ? result : dPs(result, Properties); }; /***/ }), /* 82 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var dP = __w_pdfjs_require__(15); var anObject = __w_pdfjs_require__(6); var getKeys = __w_pdfjs_require__(21); module.exports = __w_pdfjs_require__(12) ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = getKeys(Properties); var length = keys.length; var i = 0; var P; while (length > i) { dP.f(O, P = keys[i++], Properties[P]); }return O; }; /***/ }), /* 83 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var has = __w_pdfjs_require__(7); var toObject = __w_pdfjs_require__(33); var IE_PROTO = __w_pdfjs_require__(30)('IE_PROTO'); var ObjectProto = Object.prototype; module.exports = Object.getPrototypeOf || function (O) { O = toObject(O); if (has(O, IE_PROTO)) return O[IE_PROTO]; if (typeof O.constructor == 'function' && O instanceof O.constructor) { return O.constructor.prototype; } return O instanceof Object ? ObjectProto : null; }; /***/ }), /* 84 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var addToUnscopables = __w_pdfjs_require__(44); var step = __w_pdfjs_require__(85); var Iterators = __w_pdfjs_require__(19); var toIObject = __w_pdfjs_require__(17); module.exports = __w_pdfjs_require__(46)(Array, 'Array', function (iterated, kind) { this._t = toIObject(iterated); this._i = 0; this._k = kind; }, function () { var O = this._t; var kind = this._k; var index = this._i++; if (!O || index >= O.length) { this._t = undefined; return step(1); } if (kind == 'keys') return step(0, index); if (kind == 'values') return step(0, O[index]); return step(0, [index, O[index]]); }, 'values'); Iterators.Arguments = Iterators.Array; addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); /***/ }), /* 85 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = function (done, value) { return { value: value, done: !!done }; }; /***/ }), /* 86 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var LIBRARY = __w_pdfjs_require__(47); var global = __w_pdfjs_require__(3); var ctx = __w_pdfjs_require__(10); var classof = __w_pdfjs_require__(32); var $export = __w_pdfjs_require__(4); var isObject = __w_pdfjs_require__(1); var aFunction = __w_pdfjs_require__(16); var anInstance = __w_pdfjs_require__(34); var forOf = __w_pdfjs_require__(23); var speciesConstructor = __w_pdfjs_require__(50); var task = __w_pdfjs_require__(51).set; var microtask = __w_pdfjs_require__(91)(); var newPromiseCapabilityModule = __w_pdfjs_require__(35); var perform = __w_pdfjs_require__(52); var promiseResolve = __w_pdfjs_require__(53); var PROMISE = 'Promise'; var TypeError = global.TypeError; var process = global.process; var $Promise = global[PROMISE]; var isNode = classof(process) == 'process'; var empty = function empty() {}; var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper; var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f; var USE_NATIVE = !!function () { try { var promise = $Promise.resolve(1); var FakePromise = (promise.constructor = {})[__w_pdfjs_require__(2)('species')] = function (exec) { exec(empty, empty); }; return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise; } catch (e) {} }(); var isThenable = function isThenable(it) { var then; return isObject(it) && typeof (then = it.then) == 'function' ? then : false; }; var notify = function notify(promise, isReject) { if (promise._n) return; promise._n = true; var chain = promise._c; microtask(function () { var value = promise._v; var ok = promise._s == 1; var i = 0; var run = function run(reaction) { var handler = ok ? reaction.ok : reaction.fail; var resolve = reaction.resolve; var reject = reaction.reject; var domain = reaction.domain; var result, then; try { if (handler) { if (!ok) { if (promise._h == 2) onHandleUnhandled(promise); promise._h = 1; } if (handler === true) result = value;else { if (domain) domain.enter(); result = handler(value); if (domain) domain.exit(); } if (result === reaction.promise) { reject(TypeError('Promise-chain cycle')); } else if (then = isThenable(result)) { then.call(result, resolve, reject); } else resolve(result); } else reject(value); } catch (e) { reject(e); } }; while (chain.length > i) { run(chain[i++]); }promise._c = []; promise._n = false; if (isReject && !promise._h) onUnhandled(promise); }); }; var onUnhandled = function onUnhandled(promise) { task.call(global, function () { var value = promise._v; var unhandled = isUnhandled(promise); var result, handler, console; if (unhandled) { result = perform(function () { if (isNode) { process.emit('unhandledRejection', value, promise); } else if (handler = global.onunhandledrejection) { handler({ promise: promise, reason: value }); } else if ((console = global.console) && console.error) { console.error('Unhandled promise rejection', value); } }); promise._h = isNode || isUnhandled(promise) ? 2 : 1; } promise._a = undefined; if (unhandled && result.e) throw result.v; }); }; var isUnhandled = function isUnhandled(promise) { if (promise._h == 1) return false; var chain = promise._a || promise._c; var i = 0; var reaction; while (chain.length > i) { reaction = chain[i++]; if (reaction.fail || !isUnhandled(reaction.promise)) return false; } return true; }; var onHandleUnhandled = function onHandleUnhandled(promise) { task.call(global, function () { var handler; if (isNode) { process.emit('rejectionHandled', promise); } else if (handler = global.onrejectionhandled) { handler({ promise: promise, reason: promise._v }); } }); }; var $reject = function $reject(value) { var promise = this; if (promise._d) return; promise._d = true; promise = promise._w || promise; promise._v = value; promise._s = 2; if (!promise._a) promise._a = promise._c.slice(); notify(promise, true); }; var $resolve = function $resolve(value) { var promise = this; var then; if (promise._d) return; promise._d = true; promise = promise._w || promise; try { if (promise === value) throw TypeError("Promise can't be resolved itself"); if (then = isThenable(value)) { microtask(function () { var wrapper = { _w: promise, _d: false }; try { then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); } catch (e) { $reject.call(wrapper, e); } }); } else { promise._v = value; promise._s = 1; notify(promise, false); } } catch (e) { $reject.call({ _w: promise, _d: false }, e); } }; if (!USE_NATIVE) { $Promise = function Promise(executor) { anInstance(this, $Promise, PROMISE, '_h'); aFunction(executor); Internal.call(this); try { executor(ctx($resolve, this, 1), ctx($reject, this, 1)); } catch (err) { $reject.call(this, err); } }; Internal = function Promise(executor) { this._c = []; this._a = undefined; this._s = 0; this._d = false; this._v = undefined; this._h = 0; this._n = false; }; Internal.prototype = __w_pdfjs_require__(36)($Promise.prototype, { then: function then(onFulfilled, onRejected) { var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; reaction.fail = typeof onRejected == 'function' && onRejected; reaction.domain = isNode ? process.domain : undefined; this._c.push(reaction); if (this._a) this._a.push(reaction); if (this._s) notify(this, false); return reaction.promise; }, 'catch': function _catch(onRejected) { return this.then(undefined, onRejected); } }); OwnPromiseCapability = function OwnPromiseCapability() { var promise = new Internal(); this.promise = promise; this.resolve = ctx($resolve, promise, 1); this.reject = ctx($reject, promise, 1); }; newPromiseCapabilityModule.f = newPromiseCapability = function newPromiseCapability(C) { return C === $Promise || C === Wrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); }; } $export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); __w_pdfjs_require__(22)($Promise, PROMISE); __w_pdfjs_require__(92)(PROMISE); Wrapper = __w_pdfjs_require__(5)[PROMISE]; $export($export.S + $export.F * !USE_NATIVE, PROMISE, { reject: function reject(r) { var capability = newPromiseCapability(this); var $$reject = capability.reject; $$reject(r); return capability.promise; } }); $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { resolve: function resolve(x) { return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x); } }); $export($export.S + $export.F * !(USE_NATIVE && __w_pdfjs_require__(54)(function (iter) { $Promise.all(iter)['catch'](empty); })), PROMISE, { all: function all(iterable) { var C = this; var capability = newPromiseCapability(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { var values = []; var index = 0; var remaining = 1; forOf(iterable, false, function (promise) { var $index = index++; var alreadyCalled = false; values.push(undefined); remaining++; C.resolve(promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[$index] = value; --remaining || resolve(values); }, reject); }); --remaining || resolve(values); }); if (result.e) reject(result.v); return capability.promise; }, race: function race(iterable) { var C = this; var capability = newPromiseCapability(C); var reject = capability.reject; var result = perform(function () { forOf(iterable, false, function (promise) { C.resolve(promise).then(capability.resolve, reject); }); }); if (result.e) reject(result.v); return capability.promise; } }); /***/ }), /* 87 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var anObject = __w_pdfjs_require__(6); module.exports = function (iterator, fn, value, entries) { try { return entries ? fn(anObject(value)[0], value[1]) : fn(value); } catch (e) { var ret = iterator['return']; if (ret !== undefined) anObject(ret.call(iterator)); throw e; } }; /***/ }), /* 88 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var Iterators = __w_pdfjs_require__(19); var ITERATOR = __w_pdfjs_require__(2)('iterator'); var ArrayProto = Array.prototype; module.exports = function (it) { return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); }; /***/ }), /* 89 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var classof = __w_pdfjs_require__(32); var ITERATOR = __w_pdfjs_require__(2)('iterator'); var Iterators = __w_pdfjs_require__(19); module.exports = __w_pdfjs_require__(5).getIteratorMethod = function (it) { if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; /***/ }), /* 90 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; module.exports = function (fn, args, that) { var un = that === undefined; switch (args.length) { case 0: return un ? fn() : fn.call(that); case 1: return un ? fn(args[0]) : fn.call(that, args[0]); case 2: return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]); case 3: return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]); case 4: return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]); } return fn.apply(that, args); }; /***/ }), /* 91 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var global = __w_pdfjs_require__(3); var macrotask = __w_pdfjs_require__(51).set; var Observer = global.MutationObserver || global.WebKitMutationObserver; var process = global.process; var Promise = global.Promise; var isNode = __w_pdfjs_require__(18)(process) == 'process'; module.exports = function () { var head, last, notify; var flush = function flush() { var parent, fn; if (isNode && (parent = process.domain)) parent.exit(); while (head) { fn = head.fn; head = head.next; try { fn(); } catch (e) { if (head) notify();else last = undefined; throw e; } } last = undefined; if (parent) parent.enter(); }; if (isNode) { notify = function notify() { process.nextTick(flush); }; } else if (Observer) { var toggle = true; var node = document.createTextNode(''); new Observer(flush).observe(node, { characterData: true }); notify = function notify() { node.data = toggle = !toggle; }; } else if (Promise && Promise.resolve) { var promise = Promise.resolve(); notify = function notify() { promise.then(flush); }; } else { notify = function notify() { macrotask.call(global, flush); }; } return function (fn) { var task = { fn: fn, next: undefined }; if (last) last.next = task; if (!head) { head = task; notify(); } last = task; }; }; /***/ }), /* 92 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var global = __w_pdfjs_require__(3); var dP = __w_pdfjs_require__(15); var DESCRIPTORS = __w_pdfjs_require__(12); var SPECIES = __w_pdfjs_require__(2)('species'); module.exports = function (KEY) { var C = global[KEY]; if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { configurable: true, get: function get() { return this; } }); }; /***/ }), /* 93 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var $export = __w_pdfjs_require__(4); var core = __w_pdfjs_require__(5); var global = __w_pdfjs_require__(3); var speciesConstructor = __w_pdfjs_require__(50); var promiseResolve = __w_pdfjs_require__(53); $export($export.P + $export.R, 'Promise', { 'finally': function _finally(onFinally) { var C = speciesConstructor(this, core.Promise || global.Promise); var isFunction = typeof onFinally == 'function'; return this.then(isFunction ? function (x) { return promiseResolve(C, onFinally()).then(function () { return x; }); } : onFinally, isFunction ? function (e) { return promiseResolve(C, onFinally()).then(function () { throw e; }); } : onFinally); } }); /***/ }), /* 94 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var $export = __w_pdfjs_require__(4); var newPromiseCapability = __w_pdfjs_require__(35); var perform = __w_pdfjs_require__(52); $export($export.S, 'Promise', { 'try': function _try(callbackfn) { var promiseCapability = newPromiseCapability.f(this); var result = perform(callbackfn); (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v); return promiseCapability.promise; } }); /***/ }), /* 95 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; __w_pdfjs_require__(45); __w_pdfjs_require__(49); __w_pdfjs_require__(96); __w_pdfjs_require__(107); __w_pdfjs_require__(109); module.exports = __w_pdfjs_require__(5).WeakMap; /***/ }), /* 96 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var each = __w_pdfjs_require__(55)(0); var redefine = __w_pdfjs_require__(9); var meta = __w_pdfjs_require__(37); var assign = __w_pdfjs_require__(100); var weak = __w_pdfjs_require__(102); var isObject = __w_pdfjs_require__(1); var fails = __w_pdfjs_require__(13); var validate = __w_pdfjs_require__(56); var WEAK_MAP = 'WeakMap'; var getWeak = meta.getWeak; var isExtensible = Object.isExtensible; var uncaughtFrozenStore = weak.ufstore; var tmp = {}; var InternalMap; var wrapper = function wrapper(get) { return function WeakMap() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }; var methods = { get: function get(key) { if (isObject(key)) { var data = getWeak(key); if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key); return data ? data[this._i] : undefined; } }, set: function set(key, value) { return weak.def(validate(this, WEAK_MAP), key, value); } }; var $WeakMap = module.exports = __w_pdfjs_require__(103)(WEAK_MAP, wrapper, methods, weak, true, true); if (fails(function () { return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7; })) { InternalMap = weak.getConstructor(wrapper, WEAK_MAP); assign(InternalMap.prototype, methods); meta.NEED = true; each(['delete', 'has', 'get', 'set'], function (key) { var proto = $WeakMap.prototype; var method = proto[key]; redefine(proto, key, function (a, b) { if (isObject(a) && !isExtensible(a)) { if (!this._f) this._f = new InternalMap(); var result = this._f[key](a, b); return key == 'set' ? this : result; } return method.call(this, a, b); }); }); } /***/ }), /* 97 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var speciesConstructor = __w_pdfjs_require__(98); module.exports = function (original, length) { return new (speciesConstructor(original))(length); }; /***/ }), /* 98 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var isObject = __w_pdfjs_require__(1); var isArray = __w_pdfjs_require__(99); var SPECIES = __w_pdfjs_require__(2)('species'); module.exports = function (original) { var C; if (isArray(original)) { C = original.constructor; if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; if (isObject(C)) { C = C[SPECIES]; if (C === null) C = undefined; } } return C === undefined ? Array : C; }; /***/ }), /* 99 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var cof = __w_pdfjs_require__(18); module.exports = Array.isArray || function isArray(arg) { return cof(arg) == 'Array'; }; /***/ }), /* 100 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var getKeys = __w_pdfjs_require__(21); var gOPS = __w_pdfjs_require__(101); var pIE = __w_pdfjs_require__(31); var toObject = __w_pdfjs_require__(33); var IObject = __w_pdfjs_require__(26); var $assign = Object.assign; module.exports = !$assign || __w_pdfjs_require__(13)(function () { var A = {}; var B = {}; var S = Symbol(); var K = 'abcdefghijklmnopqrst'; A[S] = 7; K.split('').forEach(function (k) { B[k] = k; }); return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; }) ? function assign(target, source) { var T = toObject(target); var aLen = arguments.length; var index = 1; var getSymbols = gOPS.f; var isEnum = pIE.f; while (aLen > index) { var S = IObject(arguments[index++]); var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S); var length = keys.length; var j = 0; var key; while (length > j) { if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; } } return T; } : $assign; /***/ }), /* 101 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; exports.f = Object.getOwnPropertySymbols; /***/ }), /* 102 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var redefineAll = __w_pdfjs_require__(36); var getWeak = __w_pdfjs_require__(37).getWeak; var anObject = __w_pdfjs_require__(6); var isObject = __w_pdfjs_require__(1); var anInstance = __w_pdfjs_require__(34); var forOf = __w_pdfjs_require__(23); var createArrayMethod = __w_pdfjs_require__(55); var $has = __w_pdfjs_require__(7); var validate = __w_pdfjs_require__(56); var arrayFind = createArrayMethod(5); var arrayFindIndex = createArrayMethod(6); var id = 0; var uncaughtFrozenStore = function uncaughtFrozenStore(that) { return that._l || (that._l = new UncaughtFrozenStore()); }; var UncaughtFrozenStore = function UncaughtFrozenStore() { this.a = []; }; var findUncaughtFrozen = function findUncaughtFrozen(store, key) { return arrayFind(store.a, function (it) { return it[0] === key; }); }; UncaughtFrozenStore.prototype = { get: function get(key) { var entry = findUncaughtFrozen(this, key); if (entry) return entry[1]; }, has: function has(key) { return !!findUncaughtFrozen(this, key); }, set: function set(key, value) { var entry = findUncaughtFrozen(this, key); if (entry) entry[1] = value;else this.a.push([key, value]); }, 'delete': function _delete(key) { var index = arrayFindIndex(this.a, function (it) { return it[0] === key; }); if (~index) this.a.splice(index, 1); return !!~index; } }; module.exports = { getConstructor: function getConstructor(wrapper, NAME, IS_MAP, ADDER) { var C = wrapper(function (that, iterable) { anInstance(that, C, NAME, '_i'); that._t = NAME; that._i = id++; that._l = undefined; if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); }); redefineAll(C.prototype, { 'delete': function _delete(key) { if (!isObject(key)) return false; var data = getWeak(key); if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key); return data && $has(data, this._i) && delete data[this._i]; }, has: function has(key) { if (!isObject(key)) return false; var data = getWeak(key); if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key); return data && $has(data, this._i); } }); return C; }, def: function def(that, key, value) { var data = getWeak(anObject(key), true); if (data === true) uncaughtFrozenStore(that).set(key, value);else data[that._i] = value; return that; }, ufstore: uncaughtFrozenStore }; /***/ }), /* 103 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var global = __w_pdfjs_require__(3); var $export = __w_pdfjs_require__(4); var redefine = __w_pdfjs_require__(9); var redefineAll = __w_pdfjs_require__(36); var meta = __w_pdfjs_require__(37); var forOf = __w_pdfjs_require__(23); var anInstance = __w_pdfjs_require__(34); var isObject = __w_pdfjs_require__(1); var fails = __w_pdfjs_require__(13); var $iterDetect = __w_pdfjs_require__(54); var setToStringTag = __w_pdfjs_require__(22); var inheritIfRequired = __w_pdfjs_require__(104); module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { var Base = global[NAME]; var C = Base; var ADDER = IS_MAP ? 'set' : 'add'; var proto = C && C.prototype; var O = {}; var fixMethod = function fixMethod(KEY) { var fn = proto[KEY]; redefine(proto, KEY, KEY == 'delete' ? function (a) { return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); } : KEY == 'has' ? function has(a) { return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); } : KEY == 'get' ? function get(a) { return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; } : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; }); }; if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () { new C().entries().next(); }))) { C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); redefineAll(C.prototype, methods); meta.NEED = true; } else { var instance = new C(); var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); }); var ACCEPT_ITERABLES = $iterDetect(function (iter) { new C(iter); }); var BUGGY_ZERO = !IS_WEAK && fails(function () { var $instance = new C(); var index = 5; while (index--) { $instance[ADDER](index, index); }return !$instance.has(-0); }); if (!ACCEPT_ITERABLES) { C = wrapper(function (target, iterable) { anInstance(target, C, NAME); var that = inheritIfRequired(new Base(), target, C); if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); return that; }); C.prototype = proto; proto.constructor = C; } if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { fixMethod('delete'); fixMethod('has'); IS_MAP && fixMethod('get'); } if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); if (IS_WEAK && proto.clear) delete proto.clear; } setToStringTag(C, NAME); O[NAME] = C; $export($export.G + $export.W + $export.F * (C != Base), O); if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); return C; }; /***/ }), /* 104 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var isObject = __w_pdfjs_require__(1); var setPrototypeOf = __w_pdfjs_require__(105).set; module.exports = function (that, target, C) { var S = target.constructor; var P; if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) { setPrototypeOf(that, P); } return that; }; /***/ }), /* 105 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var isObject = __w_pdfjs_require__(1); var anObject = __w_pdfjs_require__(6); var check = function check(O, proto) { anObject(O); if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); }; module.exports = { set: Object.setPrototypeOf || ('__proto__' in {} ? function (test, buggy, set) { try { set = __w_pdfjs_require__(10)(Function.call, __w_pdfjs_require__(106).f(Object.prototype, '__proto__').set, 2); set(test, []); buggy = !(test instanceof Array); } catch (e) { buggy = true; } return function setPrototypeOf(O, proto) { check(O, proto); if (buggy) O.__proto__ = proto;else set(O, proto); return O; }; }({}, false) : undefined), check: check }; /***/ }), /* 106 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var pIE = __w_pdfjs_require__(31); var createDesc = __w_pdfjs_require__(25); var toIObject = __w_pdfjs_require__(17); var toPrimitive = __w_pdfjs_require__(40); var has = __w_pdfjs_require__(7); var IE8_DOM_DEFINE = __w_pdfjs_require__(39); var gOPD = Object.getOwnPropertyDescriptor; exports.f = __w_pdfjs_require__(12) ? gOPD : function getOwnPropertyDescriptor(O, P) { O = toIObject(O); P = toPrimitive(P, true); if (IE8_DOM_DEFINE) try { return gOPD(O, P); } catch (e) {} if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); }; /***/ }), /* 107 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; __w_pdfjs_require__(108)('WeakMap'); /***/ }), /* 108 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var $export = __w_pdfjs_require__(4); module.exports = function (COLLECTION) { $export($export.S, COLLECTION, { of: function of() { var length = arguments.length; var A = Array(length); while (length--) { A[length] = arguments[length]; }return new this(A); } }); }; /***/ }), /* 109 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; __w_pdfjs_require__(110)('WeakMap'); /***/ }), /* 110 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var $export = __w_pdfjs_require__(4); var aFunction = __w_pdfjs_require__(16); var ctx = __w_pdfjs_require__(10); var forOf = __w_pdfjs_require__(23); module.exports = function (COLLECTION) { $export($export.S, COLLECTION, { from: function from(source) { var mapFn = arguments[1]; var mapping, A, n, cb; aFunction(this); mapping = mapFn !== undefined; if (mapping) aFunction(mapFn); if (source == undefined) return new this(); A = []; if (mapping) { n = 0; cb = ctx(mapFn, arguments[2], 2); forOf(source, false, function (nextItem) { A.push(cb(nextItem, n++)); }); } else { forOf(source, false, A.push, A); } return new this(A); } }); }; /***/ }), /* 111 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var isReadableStreamSupported = false; if (typeof ReadableStream !== 'undefined') { try { new ReadableStream({ start: function start(controller) { controller.close(); } }); isReadableStreamSupported = true; } catch (e) {} } if (isReadableStreamSupported) { exports.ReadableStream = ReadableStream; } else { exports.ReadableStream = __w_pdfjs_require__(112).ReadableStream; } /***/ }), /* 112 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; (function (e, a) { for (var i in a) { e[i] = a[i]; } })(exports, function (modules) { var installedModules = {}; function __w_pdfjs_require__(moduleId) { if (installedModules[moduleId]) return installedModules[moduleId].exports; var module = installedModules[moduleId] = { i: moduleId, l: false, exports: {} }; modules[moduleId].call(module.exports, module, module.exports, __w_pdfjs_require__); module.l = true; return module.exports; } __w_pdfjs_require__.m = modules; __w_pdfjs_require__.c = installedModules; __w_pdfjs_require__.i = function (value) { return value; }; __w_pdfjs_require__.d = function (exports, name, getter) { if (!__w_pdfjs_require__.o(exports, name)) { Object.defineProperty(exports, name, { configurable: false, enumerable: true, get: getter }); } }; __w_pdfjs_require__.n = function (module) { var getter = module && module.__esModule ? function getDefault() { return module['default']; } : function getModuleExports() { return module; }; __w_pdfjs_require__.d(getter, 'a', getter); return getter; }; __w_pdfjs_require__.o = function (object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; __w_pdfjs_require__.p = ""; return __w_pdfjs_require__(__w_pdfjs_require__.s = 7); }([function (module, exports, __w_pdfjs_require__) { "use strict"; var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) { return typeof obj === 'undefined' ? 'undefined' : _typeof2(obj); } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj); }; var _require = __w_pdfjs_require__(1), assert = _require.assert; function IsPropertyKey(argument) { return typeof argument === 'string' || (typeof argument === 'undefined' ? 'undefined' : _typeof(argument)) === 'symbol'; } exports.typeIsObject = function (x) { return (typeof x === 'undefined' ? 'undefined' : _typeof(x)) === 'object' && x !== null || typeof x === 'function'; }; exports.createDataProperty = function (o, p, v) { assert(exports.typeIsObject(o)); Object.defineProperty(o, p, { value: v, writable: true, enumerable: true, configurable: true }); }; exports.createArrayFromList = function (elements) { return elements.slice(); }; exports.ArrayBufferCopy = function (dest, destOffset, src, srcOffset, n) { new Uint8Array(dest).set(new Uint8Array(src, srcOffset, n), destOffset); }; exports.CreateIterResultObject = function (value, done) { assert(typeof done === 'boolean'); var obj = {}; Object.defineProperty(obj, 'value', { value: value, enumerable: true, writable: true, configurable: true }); Object.defineProperty(obj, 'done', { value: done, enumerable: true, writable: true, configurable: true }); return obj; }; exports.IsFiniteNonNegativeNumber = function (v) { if (Number.isNaN(v)) { return false; } if (v === Infinity) { return false; } if (v < 0) { return false; } return true; }; function Call(F, V, args) { if (typeof F !== 'function') { throw new TypeError('Argument is not a function'); } return Function.prototype.apply.call(F, V, args); } exports.InvokeOrNoop = function (O, P, args) { assert(O !== undefined); assert(IsPropertyKey(P)); assert(Array.isArray(args)); var method = O[P]; if (method === undefined) { return undefined; } return Call(method, O, args); }; exports.PromiseInvokeOrNoop = function (O, P, args) { assert(O !== undefined); assert(IsPropertyKey(P)); assert(Array.isArray(args)); try { return Promise.resolve(exports.InvokeOrNoop(O, P, args)); } catch (returnValueE) { return Promise.reject(returnValueE); } }; exports.PromiseInvokeOrPerformFallback = function (O, P, args, F, argsF) { assert(O !== undefined); assert(IsPropertyKey(P)); assert(Array.isArray(args)); assert(Array.isArray(argsF)); var method = void 0; try { method = O[P]; } catch (methodE) { return Promise.reject(methodE); } if (method === undefined) { return F.apply(null, argsF); } try { return Promise.resolve(Call(method, O, args)); } catch (e) { return Promise.reject(e); } }; exports.TransferArrayBuffer = function (O) { return O.slice(); }; exports.ValidateAndNormalizeHighWaterMark = function (highWaterMark) { highWaterMark = Number(highWaterMark); if (Number.isNaN(highWaterMark) || highWaterMark < 0) { throw new RangeError('highWaterMark property of a queuing strategy must be non-negative and non-NaN'); } return highWaterMark; }; exports.ValidateAndNormalizeQueuingStrategy = function (size, highWaterMark) { if (size !== undefined && typeof size !== 'function') { throw new TypeError('size property of a queuing strategy must be a function'); } highWaterMark = exports.ValidateAndNormalizeHighWaterMark(highWaterMark); return { size: size, highWaterMark: highWaterMark }; }; }, function (module, exports, __w_pdfjs_require__) { "use strict"; function rethrowAssertionErrorRejection(e) { if (e && e.constructor === AssertionError) { setTimeout(function () { throw e; }, 0); } } function AssertionError(message) { this.name = 'AssertionError'; this.message = message || ''; this.stack = new Error().stack; } AssertionError.prototype = Object.create(Error.prototype); AssertionError.prototype.constructor = AssertionError; function assert(value, message) { if (!value) { throw new AssertionError(message); } } module.exports = { rethrowAssertionErrorRejection: rethrowAssertionErrorRejection, AssertionError: AssertionError, assert: assert }; }, function (module, exports, __w_pdfjs_require__) { "use strict"; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var _require = __w_pdfjs_require__(0), InvokeOrNoop = _require.InvokeOrNoop, PromiseInvokeOrNoop = _require.PromiseInvokeOrNoop, ValidateAndNormalizeQueuingStrategy = _require.ValidateAndNormalizeQueuingStrategy, typeIsObject = _require.typeIsObject; var _require2 = __w_pdfjs_require__(1), assert = _require2.assert, rethrowAssertionErrorRejection = _require2.rethrowAssertionErrorRejection; var _require3 = __w_pdfjs_require__(3), DequeueValue = _require3.DequeueValue, EnqueueValueWithSize = _require3.EnqueueValueWithSize, PeekQueueValue = _require3.PeekQueueValue, ResetQueue = _require3.ResetQueue; var WritableStream = function () { function WritableStream() { var underlyingSink = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, size = _ref.size, _ref$highWaterMark = _ref.highWaterMark, highWaterMark = _ref$highWaterMark === undefined ? 1 : _ref$highWaterMark; _classCallCheck(this, WritableStream); this._state = 'writable'; this._storedError = undefined; this._writer = undefined; this._writableStreamController = undefined; this._writeRequests = []; this._inFlightWriteRequest = undefined; this._closeRequest = undefined; this._inFlightCloseRequest = undefined; this._pendingAbortRequest = undefined; this._backpressure = false; var type = underlyingSink.type; if (type !== undefined) { throw new RangeError('Invalid type is specified'); } this._writableStreamController = new WritableStreamDefaultController(this, underlyingSink, size, highWaterMark); this._writableStreamController.__startSteps(); } _createClass(WritableStream, [{ key: 'abort', value: function abort(reason) { if (IsWritableStream(this) === false) { return Promise.reject(streamBrandCheckException('abort')); } if (IsWritableStreamLocked(this) === true) { return Promise.reject(new TypeError('Cannot abort a stream that already has a writer')); } return WritableStreamAbort(this, reason); } }, { key: 'getWriter', value: function getWriter() { if (IsWritableStream(this) === false) { throw streamBrandCheckException('getWriter'); } return AcquireWritableStreamDefaultWriter(this); } }, { key: 'locked', get: function get() { if (IsWritableStream(this) === false) { throw streamBrandCheckException('locked'); } return IsWritableStreamLocked(this); } }]); return WritableStream; }(); module.exports = { AcquireWritableStreamDefaultWriter: AcquireWritableStreamDefaultWriter, IsWritableStream: IsWritableStream, IsWritableStreamLocked: IsWritableStreamLocked, WritableStream: WritableStream, WritableStreamAbort: WritableStreamAbort, WritableStreamDefaultControllerError: WritableStreamDefaultControllerError, WritableStreamDefaultWriterCloseWithErrorPropagation: WritableStreamDefaultWriterCloseWithErrorPropagation, WritableStreamDefaultWriterRelease: WritableStreamDefaultWriterRelease, WritableStreamDefaultWriterWrite: WritableStreamDefaultWriterWrite, WritableStreamCloseQueuedOrInFlight: WritableStreamCloseQueuedOrInFlight }; function AcquireWritableStreamDefaultWriter(stream) { return new WritableStreamDefaultWriter(stream); } function IsWritableStream(x) { if (!typeIsObject(x)) { return false; } if (!Object.prototype.hasOwnProperty.call(x, '_writableStreamController')) { return false; } return true; } function IsWritableStreamLocked(stream) { assert(IsWritableStream(stream) === true, 'IsWritableStreamLocked should only be used on known writable streams'); if (stream._writer === undefined) { return false; } return true; } function WritableStreamAbort(stream, reason) { var state = stream._state; if (state === 'closed') { return Promise.resolve(undefined); } if (state === 'errored') { return Promise.reject(stream._storedError); } var error = new TypeError('Requested to abort'); if (stream._pendingAbortRequest !== undefined) { return Promise.reject(error); } assert(state === 'writable' || state === 'erroring', 'state must be writable or erroring'); var wasAlreadyErroring = false; if (state === 'erroring') { wasAlreadyErroring = true; reason = undefined; } var promise = new Promise(function (resolve, reject) { stream._pendingAbortRequest = { _resolve: resolve, _reject: reject, _reason: reason, _wasAlreadyErroring: wasAlreadyErroring }; }); if (wasAlreadyErroring === false) { WritableStreamStartErroring(stream, error); } return promise; } function WritableStreamAddWriteRequest(stream) { assert(IsWritableStreamLocked(stream) === true); assert(stream._state === 'writable'); var promise = new Promise(function (resolve, reject) { var writeRequest = { _resolve: resolve, _reject: reject }; stream._writeRequests.push(writeRequest); }); return promise; } function WritableStreamDealWithRejection(stream, error) { var state = stream._state; if (state === 'writable') { WritableStreamStartErroring(stream, error); return; } assert(state === 'erroring'); WritableStreamFinishErroring(stream); } function WritableStreamStartErroring(stream, reason) { assert(stream._storedError === undefined, 'stream._storedError === undefined'); assert(stream._state === 'writable', 'state must be writable'); var controller = stream._writableStreamController; assert(controller !== undefined, 'controller must not be undefined'); stream._state = 'erroring'; stream._storedError = reason; var writer = stream._writer; if (writer !== undefined) { WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, reason); } if (WritableStreamHasOperationMarkedInFlight(stream) === false && controller._started === true) { WritableStreamFinishErroring(stream); } } function WritableStreamFinishErroring(stream) { assert(stream._state === 'erroring', 'stream._state === erroring'); assert(WritableStreamHasOperationMarkedInFlight(stream) === false, 'WritableStreamHasOperationMarkedInFlight(stream) === false'); stream._state = 'errored'; stream._writableStreamController.__errorSteps(); var storedError = stream._storedError; for (var i = 0; i < stream._writeRequests.length; i++) { var writeRequest = stream._writeRequests[i]; writeRequest._reject(storedError); } stream._writeRequests = []; if (stream._pendingAbortRequest === undefined) { WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream); return; } var abortRequest = stream._pendingAbortRequest; stream._pendingAbortRequest = undefined; if (abortRequest._wasAlreadyErroring === true) { abortRequest._reject(storedError); WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream); return; } var promise = stream._writableStreamController.__abortSteps(abortRequest._reason); promise.then(function () { abortRequest._resolve(); WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream); }, function (reason) { abortRequest._reject(reason); WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream); }); } function WritableStreamFinishInFlightWrite(stream) { assert(stream._inFlightWriteRequest !== undefined); stream._inFlightWriteRequest._resolve(undefined); stream._inFlightWriteRequest = undefined; } function WritableStreamFinishInFlightWriteWithError(stream, error) { assert(stream._inFlightWriteRequest !== undefined); stream._inFlightWriteRequest._reject(error); stream._inFlightWriteRequest = undefined; assert(stream._state === 'writable' || stream._state === 'erroring'); WritableStreamDealWithRejection(stream, error); } function WritableStreamFinishInFlightClose(stream) { assert(stream._inFlightCloseRequest !== undefined); stream._inFlightCloseRequest._resolve(undefined); stream._inFlightCloseRequest = undefined; var state = stream._state; assert(state === 'writable' || state === 'erroring'); if (state === 'erroring') { stream._storedError = undefined; if (stream._pendingAbortRequest !== undefined) { stream._pendingAbortRequest._resolve(); stream._pendingAbortRequest = undefined; } } stream._state = 'closed'; var writer = stream._writer; if (writer !== undefined) { defaultWriterClosedPromiseResolve(writer); } assert(stream._pendingAbortRequest === undefined, 'stream._pendingAbortRequest === undefined'); assert(stream._storedError === undefined, 'stream._storedError === undefined'); } function WritableStreamFinishInFlightCloseWithError(stream, error) { assert(stream._inFlightCloseRequest !== undefined); stream._inFlightCloseRequest._reject(error); stream._inFlightCloseRequest = undefined; assert(stream._state === 'writable' || stream._state === 'erroring'); if (stream._pendingAbortRequest !== undefined) { stream._pendingAbortRequest._reject(error); stream._pendingAbortRequest = undefined; } WritableStreamDealWithRejection(stream, error); } function WritableStreamCloseQueuedOrInFlight(stream) { if (stream._closeRequest === undefined && stream._inFlightCloseRequest === undefined) { return false; } return true; } function WritableStreamHasOperationMarkedInFlight(stream) { if (stream._inFlightWriteRequest === undefined && stream._inFlightCloseRequest === undefined) { return false; } return true; } function WritableStreamMarkCloseRequestInFlight(stream) { assert(stream._inFlightCloseRequest === undefined); assert(stream._closeRequest !== undefined); stream._inFlightCloseRequest = stream._closeRequest; stream._closeRequest = undefined; } function WritableStreamMarkFirstWriteRequestInFlight(stream) { assert(stream._inFlightWriteRequest === undefined, 'there must be no pending write request'); assert(stream._writeRequests.length !== 0, 'writeRequests must not be empty'); stream._inFlightWriteRequest = stream._writeRequests.shift(); } function WritableStreamRejectCloseAndClosedPromiseIfNeeded(stream) { assert(stream._state === 'errored', '_stream_.[[state]] is `"errored"`'); if (stream._closeRequest !== undefined) { assert(stream._inFlightCloseRequest === undefined); stream._closeRequest._reject(stream._storedError); stream._closeRequest = undefined; } var writer = stream._writer; if (writer !== undefined) { defaultWriterClosedPromiseReject(writer, stream._storedError); writer._closedPromise.catch(function () {}); } } function WritableStreamUpdateBackpressure(stream, backpressure) { assert(stream._state === 'writable'); assert(WritableStreamCloseQueuedOrInFlight(stream) === false); var writer = stream._writer; if (writer !== undefined && backpressure !== stream._backpressure) { if (backpressure === true) { defaultWriterReadyPromiseReset(writer); } else { assert(backpressure === false); defaultWriterReadyPromiseResolve(writer); } } stream._backpressure = backpressure; } var WritableStreamDefaultWriter = function () { function WritableStreamDefaultWriter(stream) { _classCallCheck(this, WritableStreamDefaultWriter); if (IsWritableStream(stream) === false) { throw new TypeError('WritableStreamDefaultWriter can only be constructed with a WritableStream instance'); } if (IsWritableStreamLocked(stream) === true) { throw new TypeError('This stream has already been locked for exclusive writing by another writer'); } this._ownerWritableStream = stream; stream._writer = this; var state = stream._state; if (state === 'writable') { if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._backpressure === true) { defaultWriterReadyPromiseInitialize(this); } else { defaultWriterReadyPromiseInitializeAsResolved(this); } defaultWriterClosedPromiseInitialize(this); } else if (state === 'erroring') { defaultWriterReadyPromiseInitializeAsRejected(this, stream._storedError); this._readyPromise.catch(function () {}); defaultWriterClosedPromiseInitialize(this); } else if (state === 'closed') { defaultWriterReadyPromiseInitializeAsResolved(this); defaultWriterClosedPromiseInitializeAsResolved(this); } else { assert(state === 'errored', 'state must be errored'); var storedError = stream._storedError; defaultWriterReadyPromiseInitializeAsRejected(this, storedError); this._readyPromise.catch(function () {}); defaultWriterClosedPromiseInitializeAsRejected(this, storedError); this._closedPromise.catch(function () {}); } } _createClass(WritableStreamDefaultWriter, [{ key: 'abort', value: function abort(reason) { if (IsWritableStreamDefaultWriter(this) === false) { return Promise.reject(defaultWriterBrandCheckException('abort')); } if (this._ownerWritableStream === undefined) { return Promise.reject(defaultWriterLockException('abort')); } return WritableStreamDefaultWriterAbort(this, reason); } }, { key: 'close', value: function close() { if (IsWritableStreamDefaultWriter(this) === false) { return Promise.reject(defaultWriterBrandCheckException('close')); } var stream = this._ownerWritableStream; if (stream === undefined) { return Promise.reject(defaultWriterLockException('close')); } if (WritableStreamCloseQueuedOrInFlight(stream) === true) { return Promise.reject(new TypeError('cannot close an already-closing stream')); } return WritableStreamDefaultWriterClose(this); } }, { key: 'releaseLock', value: function releaseLock() { if (IsWritableStreamDefaultWriter(this) === false) { throw defaultWriterBrandCheckException('releaseLock'); } var stream = this._ownerWritableStream; if (stream === undefined) { return; } assert(stream._writer !== undefined); WritableStreamDefaultWriterRelease(this); } }, { key: 'write', value: function write(chunk) { if (IsWritableStreamDefaultWriter(this) === false) { return Promise.reject(defaultWriterBrandCheckException('write')); } if (this._ownerWritableStream === undefined) { return Promise.reject(defaultWriterLockException('write to')); } return WritableStreamDefaultWriterWrite(this, chunk); } }, { key: 'closed', get: function get() { if (IsWritableStreamDefaultWriter(this) === false) { return Promise.reject(defaultWriterBrandCheckException('closed')); } return this._closedPromise; } }, { key: 'desiredSize', get: function get() { if (IsWritableStreamDefaultWriter(this) === false) { throw defaultWriterBrandCheckException('desiredSize'); } if (this._ownerWritableStream === undefined) { throw defaultWriterLockException('desiredSize'); } return WritableStreamDefaultWriterGetDesiredSize(this); } }, { key: 'ready', get: function get() { if (IsWritableStreamDefaultWriter(this) === false) { return Promise.reject(defaultWriterBrandCheckException('ready')); } return this._readyPromise; } }]); return WritableStreamDefaultWriter; }(); function IsWritableStreamDefaultWriter(x) { if (!typeIsObject(x)) { return false; } if (!Object.prototype.hasOwnProperty.call(x, '_ownerWritableStream')) { return false; } return true; } function WritableStreamDefaultWriterAbort(writer, reason) { var stream = writer._ownerWritableStream; assert(stream !== undefined); return WritableStreamAbort(stream, reason); } function WritableStreamDefaultWriterClose(writer) { var stream = writer._ownerWritableStream; assert(stream !== undefined); var state = stream._state; if (state === 'closed' || state === 'errored') { return Promise.reject(new TypeError('The stream (in ' + state + ' state) is not in the writable state and cannot be closed')); } assert(state === 'writable' || state === 'erroring'); assert(WritableStreamCloseQueuedOrInFlight(stream) === false); var promise = new Promise(function (resolve, reject) { var closeRequest = { _resolve: resolve, _reject: reject }; stream._closeRequest = closeRequest; }); if (stream._backpressure === true && state === 'writable') { defaultWriterReadyPromiseResolve(writer); } WritableStreamDefaultControllerClose(stream._writableStreamController); return promise; } function WritableStreamDefaultWriterCloseWithErrorPropagation(writer) { var stream = writer._ownerWritableStream; assert(stream !== undefined); var state = stream._state; if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') { return Promise.resolve(); } if (state === 'errored') { return Promise.reject(stream._storedError); } assert(state === 'writable' || state === 'erroring'); return WritableStreamDefaultWriterClose(writer); } function WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, error) { if (writer._closedPromiseState === 'pending') { defaultWriterClosedPromiseReject(writer, error); } else { defaultWriterClosedPromiseResetToRejected(writer, error); } writer._closedPromise.catch(function () {}); } function WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, error) { if (writer._readyPromiseState === 'pending') { defaultWriterReadyPromiseReject(writer, error); } else { defaultWriterReadyPromiseResetToRejected(writer, error); } writer._readyPromise.catch(function () {}); } function WritableStreamDefaultWriterGetDesiredSize(writer) { var stream = writer._ownerWritableStream; var state = stream._state; if (state === 'errored' || state === 'erroring') { return null; } if (state === 'closed') { return 0; } return WritableStreamDefaultControllerGetDesiredSize(stream._writableStreamController); } function WritableStreamDefaultWriterRelease(writer) { var stream = writer._ownerWritableStream; assert(stream !== undefined); assert(stream._writer === writer); var releasedError = new TypeError('Writer was released and can no longer be used to monitor the stream\'s closedness'); WritableStreamDefaultWriterEnsureReadyPromiseRejected(writer, releasedError); WritableStreamDefaultWriterEnsureClosedPromiseRejected(writer, releasedError); stream._writer = undefined; writer._ownerWritableStream = undefined; } function WritableStreamDefaultWriterWrite(writer, chunk) { var stream = writer._ownerWritableStream; assert(stream !== undefined); var controller = stream._writableStreamController; var chunkSize = WritableStreamDefaultControllerGetChunkSize(controller, chunk); if (stream !== writer._ownerWritableStream) { return Promise.reject(defaultWriterLockException('write to')); } var state = stream._state; if (state === 'errored') { return Promise.reject(stream._storedError); } if (WritableStreamCloseQueuedOrInFlight(stream) === true || state === 'closed') { return Promise.reject(new TypeError('The stream is closing or closed and cannot be written to')); } if (state === 'erroring') { return Promise.reject(stream._storedError); } assert(state === 'writable'); var promise = WritableStreamAddWriteRequest(stream); WritableStreamDefaultControllerWrite(controller, chunk, chunkSize); return promise; } var WritableStreamDefaultController = function () { function WritableStreamDefaultController(stream, underlyingSink, size, highWaterMark) { _classCallCheck(this, WritableStreamDefaultController); if (IsWritableStream(stream) === false) { throw new TypeError('WritableStreamDefaultController can only be constructed with a WritableStream instance'); } if (stream._writableStreamController !== undefined) { throw new TypeError('WritableStreamDefaultController instances can only be created by the WritableStream constructor'); } this._controlledWritableStream = stream; this._underlyingSink = underlyingSink; this._queue = undefined; this._queueTotalSize = undefined; ResetQueue(this); this._started = false; var normalizedStrategy = ValidateAndNormalizeQueuingStrategy(size, highWaterMark); this._strategySize = normalizedStrategy.size; this._strategyHWM = normalizedStrategy.highWaterMark; var backpressure = WritableStreamDefaultControllerGetBackpressure(this); WritableStreamUpdateBackpressure(stream, backpressure); } _createClass(WritableStreamDefaultController, [{ key: 'error', value: function error(e) { if (IsWritableStreamDefaultController(this) === false) { throw new TypeError('WritableStreamDefaultController.prototype.error can only be used on a WritableStreamDefaultController'); } var state = this._controlledWritableStream._state; if (state !== 'writable') { return; } WritableStreamDefaultControllerError(this, e); } }, { key: '__abortSteps', value: function __abortSteps(reason) { return PromiseInvokeOrNoop(this._underlyingSink, 'abort', [reason]); } }, { key: '__errorSteps', value: function __errorSteps() { ResetQueue(this); } }, { key: '__startSteps', value: function __startSteps() { var _this = this; var startResult = InvokeOrNoop(this._underlyingSink, 'start', [this]); var stream = this._controlledWritableStream; Promise.resolve(startResult).then(function () { assert(stream._state === 'writable' || stream._state === 'erroring'); _this._started = true; WritableStreamDefaultControllerAdvanceQueueIfNeeded(_this); }, function (r) { assert(stream._state === 'writable' || stream._state === 'erroring'); _this._started = true; WritableStreamDealWithRejection(stream, r); }).catch(rethrowAssertionErrorRejection); } }]); return WritableStreamDefaultController; }(); function WritableStreamDefaultControllerClose(controller) { EnqueueValueWithSize(controller, 'close', 0); WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller); } function WritableStreamDefaultControllerGetChunkSize(controller, chunk) { var strategySize = controller._strategySize; if (strategySize === undefined) { return 1; } try { return strategySize(chunk); } catch (chunkSizeE) { WritableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE); return 1; } } function WritableStreamDefaultControllerGetDesiredSize(controller) { return controller._strategyHWM - controller._queueTotalSize; } function WritableStreamDefaultControllerWrite(controller, chunk, chunkSize) { var writeRecord = { chunk: chunk }; try { EnqueueValueWithSize(controller, writeRecord, chunkSize); } catch (enqueueE) { WritableStreamDefaultControllerErrorIfNeeded(controller, enqueueE); return; } var stream = controller._controlledWritableStream; if (WritableStreamCloseQueuedOrInFlight(stream) === false && stream._state === 'writable') { var backpressure = WritableStreamDefaultControllerGetBackpressure(controller); WritableStreamUpdateBackpressure(stream, backpressure); } WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller); } function IsWritableStreamDefaultController(x) { if (!typeIsObject(x)) { return false; } if (!Object.prototype.hasOwnProperty.call(x, '_underlyingSink')) { return false; } return true; } function WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller) { var stream = controller._controlledWritableStream; if (controller._started === false) { return; } if (stream._inFlightWriteRequest !== undefined) { return; } var state = stream._state; if (state === 'closed' || state === 'errored') { return; } if (state === 'erroring') { WritableStreamFinishErroring(stream); return; } if (controller._queue.length === 0) { return; } var writeRecord = PeekQueueValue(controller); if (writeRecord === 'close') { WritableStreamDefaultControllerProcessClose(controller); } else { WritableStreamDefaultControllerProcessWrite(controller, writeRecord.chunk); } } function WritableStreamDefaultControllerErrorIfNeeded(controller, error) { if (controller._controlledWritableStream._state === 'writable') { WritableStreamDefaultControllerError(controller, error); } } function WritableStreamDefaultControllerProcessClose(controller) { var stream = controller._controlledWritableStream; WritableStreamMarkCloseRequestInFlight(stream); DequeueValue(controller); assert(controller._queue.length === 0, 'queue must be empty once the final write record is dequeued'); var sinkClosePromise = PromiseInvokeOrNoop(controller._underlyingSink, 'close', []); sinkClosePromise.then(function () { WritableStreamFinishInFlightClose(stream); }, function (reason) { WritableStreamFinishInFlightCloseWithError(stream, reason); }).catch(rethrowAssertionErrorRejection); } function WritableStreamDefaultControllerProcessWrite(controller, chunk) { var stream = controller._controlledWritableStream; WritableStreamMarkFirstWriteRequestInFlight(stream); var sinkWritePromise = PromiseInvokeOrNoop(controller._underlyingSink, 'write', [chunk, controller]); sinkWritePromise.then(function () { WritableStreamFinishInFlightWrite(stream); var state = stream._state; assert(state === 'writable' || state === 'erroring'); DequeueValue(controller); if (WritableStreamCloseQueuedOrInFlight(stream) === false && state === 'writable') { var backpressure = WritableStreamDefaultControllerGetBackpressure(controller); WritableStreamUpdateBackpressure(stream, backpressure); } WritableStreamDefaultControllerAdvanceQueueIfNeeded(controller); }, function (reason) { WritableStreamFinishInFlightWriteWithError(stream, reason); }).catch(rethrowAssertionErrorRejection); } function WritableStreamDefaultControllerGetBackpressure(controller) { var desiredSize = WritableStreamDefaultControllerGetDesiredSize(controller); return desiredSize <= 0; } function WritableStreamDefaultControllerError(controller, error) { var stream = controller._controlledWritableStream; assert(stream._state === 'writable'); WritableStreamStartErroring(stream, error); } function streamBrandCheckException(name) { return new TypeError('WritableStream.prototype.' + name + ' can only be used on a WritableStream'); } function defaultWriterBrandCheckException(name) { return new TypeError('WritableStreamDefaultWriter.prototype.' + name + ' can only be used on a WritableStreamDefaultWriter'); } function defaultWriterLockException(name) { return new TypeError('Cannot ' + name + ' a stream using a released writer'); } function defaultWriterClosedPromiseInitialize(writer) { writer._closedPromise = new Promise(function (resolve, reject) { writer._closedPromise_resolve = resolve; writer._closedPromise_reject = reject; writer._closedPromiseState = 'pending'; }); } function defaultWriterClosedPromiseInitializeAsRejected(writer, reason) { writer._closedPromise = Promise.reject(reason); writer._closedPromise_resolve = undefined; writer._closedPromise_reject = undefined; writer._closedPromiseState = 'rejected'; } function defaultWriterClosedPromiseInitializeAsResolved(writer) { writer._closedPromise = Promise.resolve(undefined); writer._closedPromise_resolve = undefined; writer._closedPromise_reject = undefined; writer._closedPromiseState = 'resolved'; } function defaultWriterClosedPromiseReject(writer, reason) { assert(writer._closedPromise_resolve !== undefined, 'writer._closedPromise_resolve !== undefined'); assert(writer._closedPromise_reject !== undefined, 'writer._closedPromise_reject !== undefined'); assert(writer._closedPromiseState === 'pending', 'writer._closedPromiseState is pending'); writer._closedPromise_reject(reason); writer._closedPromise_resolve = undefined; writer._closedPromise_reject = undefined; writer._closedPromiseState = 'rejected'; } function defaultWriterClosedPromiseResetToRejected(writer, reason) { assert(writer._closedPromise_resolve === undefined, 'writer._closedPromise_resolve === undefined'); assert(writer._closedPromise_reject === undefined, 'writer._closedPromise_reject === undefined'); assert(writer._closedPromiseState !== 'pending', 'writer._closedPromiseState is not pending'); writer._closedPromise = Promise.reject(reason); writer._closedPromiseState = 'rejected'; } function defaultWriterClosedPromiseResolve(writer) { assert(writer._closedPromise_resolve !== undefined, 'writer._closedPromise_resolve !== undefined'); assert(writer._closedPromise_reject !== undefined, 'writer._closedPromise_reject !== undefined'); assert(writer._closedPromiseState === 'pending', 'writer._closedPromiseState is pending'); writer._closedPromise_resolve(undefined); writer._closedPromise_resolve = undefined; writer._closedPromise_reject = undefined; writer._closedPromiseState = 'resolved'; } function defaultWriterReadyPromiseInitialize(writer) { writer._readyPromise = new Promise(function (resolve, reject) { writer._readyPromise_resolve = resolve; writer._readyPromise_reject = reject; }); writer._readyPromiseState = 'pending'; } function defaultWriterReadyPromiseInitializeAsRejected(writer, reason) { writer._readyPromise = Promise.reject(reason); writer._readyPromise_resolve = undefined; writer._readyPromise_reject = undefined; writer._readyPromiseState = 'rejected'; } function defaultWriterReadyPromiseInitializeAsResolved(writer) { writer._readyPromise = Promise.resolve(undefined); writer._readyPromise_resolve = undefined; writer._readyPromise_reject = undefined; writer._readyPromiseState = 'fulfilled'; } function defaultWriterReadyPromiseReject(writer, reason) { assert(writer._readyPromise_resolve !== undefined, 'writer._readyPromise_resolve !== undefined'); assert(writer._readyPromise_reject !== undefined, 'writer._readyPromise_reject !== undefined'); writer._readyPromise_reject(reason); writer._readyPromise_resolve = undefined; writer._readyPromise_reject = undefined; writer._readyPromiseState = 'rejected'; } function defaultWriterReadyPromiseReset(writer) { assert(writer._readyPromise_resolve === undefined, 'writer._readyPromise_resolve === undefined'); assert(writer._readyPromise_reject === undefined, 'writer._readyPromise_reject === undefined'); writer._readyPromise = new Promise(function (resolve, reject) { writer._readyPromise_resolve = resolve; writer._readyPromise_reject = reject; }); writer._readyPromiseState = 'pending'; } function defaultWriterReadyPromiseResetToRejected(writer, reason) { assert(writer._readyPromise_resolve === undefined, 'writer._readyPromise_resolve === undefined'); assert(writer._readyPromise_reject === undefined, 'writer._readyPromise_reject === undefined'); writer._readyPromise = Promise.reject(reason); writer._readyPromiseState = 'rejected'; } function defaultWriterReadyPromiseResolve(writer) { assert(writer._readyPromise_resolve !== undefined, 'writer._readyPromise_resolve !== undefined'); assert(writer._readyPromise_reject !== undefined, 'writer._readyPromise_reject !== undefined'); writer._readyPromise_resolve(undefined); writer._readyPromise_resolve = undefined; writer._readyPromise_reject = undefined; writer._readyPromiseState = 'fulfilled'; } }, function (module, exports, __w_pdfjs_require__) { "use strict"; var _require = __w_pdfjs_require__(0), IsFiniteNonNegativeNumber = _require.IsFiniteNonNegativeNumber; var _require2 = __w_pdfjs_require__(1), assert = _require2.assert; exports.DequeueValue = function (container) { assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: DequeueValue should only be used on containers with [[queue]] and [[queueTotalSize]].'); assert(container._queue.length > 0, 'Spec-level failure: should never dequeue from an empty queue.'); var pair = container._queue.shift(); container._queueTotalSize -= pair.size; if (container._queueTotalSize < 0) { container._queueTotalSize = 0; } return pair.value; }; exports.EnqueueValueWithSize = function (container, value, size) { assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: EnqueueValueWithSize should only be used on containers with [[queue]] and ' + '[[queueTotalSize]].'); size = Number(size); if (!IsFiniteNonNegativeNumber(size)) { throw new RangeError('Size must be a finite, non-NaN, non-negative number.'); } container._queue.push({ value: value, size: size }); container._queueTotalSize += size; }; exports.PeekQueueValue = function (container) { assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: PeekQueueValue should only be used on containers with [[queue]] and [[queueTotalSize]].'); assert(container._queue.length > 0, 'Spec-level failure: should never peek at an empty queue.'); var pair = container._queue[0]; return pair.value; }; exports.ResetQueue = function (container) { assert('_queue' in container && '_queueTotalSize' in container, 'Spec-level failure: ResetQueue should only be used on containers with [[queue]] and [[queueTotalSize]].'); container._queue = []; container._queueTotalSize = 0; }; }, function (module, exports, __w_pdfjs_require__) { "use strict"; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var _require = __w_pdfjs_require__(0), ArrayBufferCopy = _require.ArrayBufferCopy, CreateIterResultObject = _require.CreateIterResultObject, IsFiniteNonNegativeNumber = _require.IsFiniteNonNegativeNumber, InvokeOrNoop = _require.InvokeOrNoop, PromiseInvokeOrNoop = _require.PromiseInvokeOrNoop, TransferArrayBuffer = _require.TransferArrayBuffer, ValidateAndNormalizeQueuingStrategy = _require.ValidateAndNormalizeQueuingStrategy, ValidateAndNormalizeHighWaterMark = _require.ValidateAndNormalizeHighWaterMark; var _require2 = __w_pdfjs_require__(0), createArrayFromList = _require2.createArrayFromList, createDataProperty = _require2.createDataProperty, typeIsObject = _require2.typeIsObject; var _require3 = __w_pdfjs_require__(1), assert = _require3.assert, rethrowAssertionErrorRejection = _require3.rethrowAssertionErrorRejection; var _require4 = __w_pdfjs_require__(3), DequeueValue = _require4.DequeueValue, EnqueueValueWithSize = _require4.EnqueueValueWithSize, ResetQueue = _require4.ResetQueue; var _require5 = __w_pdfjs_require__(2), AcquireWritableStreamDefaultWriter = _require5.AcquireWritableStreamDefaultWriter, IsWritableStream = _require5.IsWritableStream, IsWritableStreamLocked = _require5.IsWritableStreamLocked, WritableStreamAbort = _require5.WritableStreamAbort, WritableStreamDefaultWriterCloseWithErrorPropagation = _require5.WritableStreamDefaultWriterCloseWithErrorPropagation, WritableStreamDefaultWriterRelease = _require5.WritableStreamDefaultWriterRelease, WritableStreamDefaultWriterWrite = _require5.WritableStreamDefaultWriterWrite, WritableStreamCloseQueuedOrInFlight = _require5.WritableStreamCloseQueuedOrInFlight; var ReadableStream = function () { function ReadableStream() { var underlyingSource = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, size = _ref.size, highWaterMark = _ref.highWaterMark; _classCallCheck(this, ReadableStream); this._state = 'readable'; this._reader = undefined; this._storedError = undefined; this._disturbed = false; this._readableStreamController = undefined; var type = underlyingSource.type; var typeString = String(type); if (typeString === 'bytes') { if (highWaterMark === undefined) { highWaterMark = 0; } this._readableStreamController = new ReadableByteStreamController(this, underlyingSource, highWaterMark); } else if (type === undefined) { if (highWaterMark === undefined) { highWaterMark = 1; } this._readableStreamController = new ReadableStreamDefaultController(this, underlyingSource, size, highWaterMark); } else { throw new RangeError('Invalid type is specified'); } } _createClass(ReadableStream, [{ key: 'cancel', value: function cancel(reason) { if (IsReadableStream(this) === false) { return Promise.reject(streamBrandCheckException('cancel')); } if (IsReadableStreamLocked(this) === true) { return Promise.reject(new TypeError('Cannot cancel a stream that already has a reader')); } return ReadableStreamCancel(this, reason); } }, { key: 'getReader', value: function getReader() { var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, mode = _ref2.mode; if (IsReadableStream(this) === false) { throw streamBrandCheckException('getReader'); } if (mode === undefined) { return AcquireReadableStreamDefaultReader(this); } mode = String(mode); if (mode === 'byob') { return AcquireReadableStreamBYOBReader(this); } throw new RangeError('Invalid mode is specified'); } }, { key: 'pipeThrough', value: function pipeThrough(_ref3, options) { var writable = _ref3.writable, readable = _ref3.readable; var promise = this.pipeTo(writable, options); ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue(promise); return readable; } }, { key: 'pipeTo', value: function pipeTo(dest) { var _this = this; var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, preventClose = _ref4.preventClose, preventAbort = _ref4.preventAbort, preventCancel = _ref4.preventCancel; if (IsReadableStream(this) === false) { return Promise.reject(streamBrandCheckException('pipeTo')); } if (IsWritableStream(dest) === false) { return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo\'s first argument must be a WritableStream')); } preventClose = Boolean(preventClose); preventAbort = Boolean(preventAbort); preventCancel = Boolean(preventCancel); if (IsReadableStreamLocked(this) === true) { return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream')); } if (IsWritableStreamLocked(dest) === true) { return Promise.reject(new TypeError('ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream')); } var reader = AcquireReadableStreamDefaultReader(this); var writer = AcquireWritableStreamDefaultWriter(dest); var shuttingDown = false; var currentWrite = Promise.resolve(); return new Promise(function (resolve, reject) { function pipeLoop() { currentWrite = Promise.resolve(); if (shuttingDown === true) { return Promise.resolve(); } return writer._readyPromise.then(function () { return ReadableStreamDefaultReaderRead(reader).then(function (_ref5) { var value = _ref5.value, done = _ref5.done; if (done === true) { return; } currentWrite = WritableStreamDefaultWriterWrite(writer, value).catch(function () {}); }); }).then(pipeLoop); } isOrBecomesErrored(_this, reader._closedPromise, function (storedError) { if (preventAbort === false) { shutdownWithAction(function () { return WritableStreamAbort(dest, storedError); }, true, storedError); } else { shutdown(true, storedError); } }); isOrBecomesErrored(dest, writer._closedPromise, function (storedError) { if (preventCancel === false) { shutdownWithAction(function () { return ReadableStreamCancel(_this, storedError); }, true, storedError); } else { shutdown(true, storedError); } }); isOrBecomesClosed(_this, reader._closedPromise, function () { if (preventClose === false) { shutdownWithAction(function () { return WritableStreamDefaultWriterCloseWithErrorPropagation(writer); }); } else { shutdown(); } }); if (WritableStreamCloseQueuedOrInFlight(dest) === true || dest._state === 'closed') { var destClosed = new TypeError('the destination writable stream closed before all data could be piped to it'); if (preventCancel === false) { shutdownWithAction(function () { return ReadableStreamCancel(_this, destClosed); }, true, destClosed); } else { shutdown(true, destClosed); } } pipeLoop().catch(function (err) { currentWrite = Promise.resolve(); rethrowAssertionErrorRejection(err); }); function waitForWritesToFinish() { var oldCurrentWrite = currentWrite; return currentWrite.then(function () { return oldCurrentWrite !== currentWrite ? waitForWritesToFinish() : undefined; }); } function isOrBecomesErrored(stream, promise, action) { if (stream._state === 'errored') { action(stream._storedError); } else { promise.catch(action).catch(rethrowAssertionErrorRejection); } } function isOrBecomesClosed(stream, promise, action) { if (stream._state === 'closed') { action(); } else { promise.then(action).catch(rethrowAssertionErrorRejection); } } function shutdownWithAction(action, originalIsError, originalError) { if (shuttingDown === true) { return; } shuttingDown = true; if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) { waitForWritesToFinish().then(doTheRest); } else { doTheRest(); } function doTheRest() { action().then(function () { return finalize(originalIsError, originalError); }, function (newError) { return finalize(true, newError); }).catch(rethrowAssertionErrorRejection); } } function shutdown(isError, error) { if (shuttingDown === true) { return; } shuttingDown = true; if (dest._state === 'writable' && WritableStreamCloseQueuedOrInFlight(dest) === false) { waitForWritesToFinish().then(function () { return finalize(isError, error); }).catch(rethrowAssertionErrorRejection); } else { finalize(isError, error); } } function finalize(isError, error) { WritableStreamDefaultWriterRelease(writer); ReadableStreamReaderGenericRelease(reader); if (isError) { reject(error); } else { resolve(undefined); } } }); } }, { key: 'tee', value: function tee() { if (IsReadableStream(this) === false) { throw streamBrandCheckException('tee'); } var branches = ReadableStreamTee(this, false); return createArrayFromList(branches); } }, { key: 'locked', get: function get() { if (IsReadableStream(this) === false) { throw streamBrandCheckException('locked'); } return IsReadableStreamLocked(this); } }]); return ReadableStream; }(); module.exports = { ReadableStream: ReadableStream, IsReadableStreamDisturbed: IsReadableStreamDisturbed, ReadableStreamDefaultControllerClose: ReadableStreamDefaultControllerClose, ReadableStreamDefaultControllerEnqueue: ReadableStreamDefaultControllerEnqueue, ReadableStreamDefaultControllerError: ReadableStreamDefaultControllerError, ReadableStreamDefaultControllerGetDesiredSize: ReadableStreamDefaultControllerGetDesiredSize }; function AcquireReadableStreamBYOBReader(stream) { return new ReadableStreamBYOBReader(stream); } function AcquireReadableStreamDefaultReader(stream) { return new ReadableStreamDefaultReader(stream); } function IsReadableStream(x) { if (!typeIsObject(x)) { return false; } if (!Object.prototype.hasOwnProperty.call(x, '_readableStreamController')) { return false; } return true; } function IsReadableStreamDisturbed(stream) { assert(IsReadableStream(stream) === true, 'IsReadableStreamDisturbed should only be used on known readable streams'); return stream._disturbed; } function IsReadableStreamLocked(stream) { assert(IsReadableStream(stream) === true, 'IsReadableStreamLocked should only be used on known readable streams'); if (stream._reader === undefined) { return false; } return true; } function ReadableStreamTee(stream, cloneForBranch2) { assert(IsReadableStream(stream) === true); assert(typeof cloneForBranch2 === 'boolean'); var reader = AcquireReadableStreamDefaultReader(stream); var teeState = { closedOrErrored: false, canceled1: false, canceled2: false, reason1: undefined, reason2: undefined }; teeState.promise = new Promise(function (resolve) { teeState._resolve = resolve; }); var pull = create_ReadableStreamTeePullFunction(); pull._reader = reader; pull._teeState = teeState; pull._cloneForBranch2 = cloneForBranch2; var cancel1 = create_ReadableStreamTeeBranch1CancelFunction(); cancel1._stream = stream; cancel1._teeState = teeState; var cancel2 = create_ReadableStreamTeeBranch2CancelFunction(); cancel2._stream = stream; cancel2._teeState = teeState; var underlyingSource1 = Object.create(Object.prototype); createDataProperty(underlyingSource1, 'pull', pull); createDataProperty(underlyingSource1, 'cancel', cancel1); var branch1Stream = new ReadableStream(underlyingSource1); var underlyingSource2 = Object.create(Object.prototype); createDataProperty(underlyingSource2, 'pull', pull); createDataProperty(underlyingSource2, 'cancel', cancel2); var branch2Stream = new ReadableStream(underlyingSource2); pull._branch1 = branch1Stream._readableStreamController; pull._branch2 = branch2Stream._readableStreamController; reader._closedPromise.catch(function (r) { if (teeState.closedOrErrored === true) { return; } ReadableStreamDefaultControllerError(pull._branch1, r); ReadableStreamDefaultControllerError(pull._branch2, r); teeState.closedOrErrored = true; }); return [branch1Stream, branch2Stream]; } function create_ReadableStreamTeePullFunction() { function f() { var reader = f._reader, branch1 = f._branch1, branch2 = f._branch2, teeState = f._teeState; return ReadableStreamDefaultReaderRead(reader).then(function (result) { assert(typeIsObject(result)); var value = result.value; var done = result.done; assert(typeof done === 'boolean'); if (done === true && teeState.closedOrErrored === false) { if (teeState.canceled1 === false) { ReadableStreamDefaultControllerClose(branch1); } if (teeState.canceled2 === false) { ReadableStreamDefaultControllerClose(branch2); } teeState.closedOrErrored = true; } if (teeState.closedOrErrored === true) { return; } var value1 = value; var value2 = value; if (teeState.canceled1 === false) { ReadableStreamDefaultControllerEnqueue(branch1, value1); } if (teeState.canceled2 === false) { ReadableStreamDefaultControllerEnqueue(branch2, value2); } }); } return f; } function create_ReadableStreamTeeBranch1CancelFunction() { function f(reason) { var stream = f._stream, teeState = f._teeState; teeState.canceled1 = true; teeState.reason1 = reason; if (teeState.canceled2 === true) { var compositeReason = createArrayFromList([teeState.reason1, teeState.reason2]); var cancelResult = ReadableStreamCancel(stream, compositeReason); teeState._resolve(cancelResult); } return teeState.promise; } return f; } function create_ReadableStreamTeeBranch2CancelFunction() { function f(reason) { var stream = f._stream, teeState = f._teeState; teeState.canceled2 = true; teeState.reason2 = reason; if (teeState.canceled1 === true) { var compositeReason = createArrayFromList([teeState.reason1, teeState.reason2]); var cancelResult = ReadableStreamCancel(stream, compositeReason); teeState._resolve(cancelResult); } return teeState.promise; } return f; } function ReadableStreamAddReadIntoRequest(stream) { assert(IsReadableStreamBYOBReader(stream._reader) === true); assert(stream._state === 'readable' || stream._state === 'closed'); var promise = new Promise(function (resolve, reject) { var readIntoRequest = { _resolve: resolve, _reject: reject }; stream._reader._readIntoRequests.push(readIntoRequest); }); return promise; } function ReadableStreamAddReadRequest(stream) { assert(IsReadableStreamDefaultReader(stream._reader) === true); assert(stream._state === 'readable'); var promise = new Promise(function (resolve, reject) { var readRequest = { _resolve: resolve, _reject: reject }; stream._reader._readRequests.push(readRequest); }); return promise; } function ReadableStreamCancel(stream, reason) { stream._disturbed = true; if (stream._state === 'closed') { return Promise.resolve(undefined); } if (stream._state === 'errored') { return Promise.reject(stream._storedError); } ReadableStreamClose(stream); var sourceCancelPromise = stream._readableStreamController.__cancelSteps(reason); return sourceCancelPromise.then(function () { return undefined; }); } function ReadableStreamClose(stream) { assert(stream._state === 'readable'); stream._state = 'closed'; var reader = stream._reader; if (reader === undefined) { return undefined; } if (IsReadableStreamDefaultReader(reader) === true) { for (var i = 0; i < reader._readRequests.length; i++) { var _resolve = reader._readRequests[i]._resolve; _resolve(CreateIterResultObject(undefined, true)); } reader._readRequests = []; } defaultReaderClosedPromiseResolve(reader); return undefined; } function ReadableStreamError(stream, e) { assert(IsReadableStream(stream) === true, 'stream must be ReadableStream'); assert(stream._state === 'readable', 'state must be readable'); stream._state = 'errored'; stream._storedError = e; var reader = stream._reader; if (reader === undefined) { return undefined; } if (IsReadableStreamDefaultReader(reader) === true) { for (var i = 0; i < reader._readRequests.length; i++) { var readRequest = reader._readRequests[i]; readRequest._reject(e); } reader._readRequests = []; } else { assert(IsReadableStreamBYOBReader(reader), 'reader must be ReadableStreamBYOBReader'); for (var _i = 0; _i < reader._readIntoRequests.length; _i++) { var readIntoRequest = reader._readIntoRequests[_i]; readIntoRequest._reject(e); } reader._readIntoRequests = []; } defaultReaderClosedPromiseReject(reader, e); reader._closedPromise.catch(function () {}); } function ReadableStreamFulfillReadIntoRequest(stream, chunk, done) { var reader = stream._reader; assert(reader._readIntoRequests.length > 0); var readIntoRequest = reader._readIntoRequests.shift(); readIntoRequest._resolve(CreateIterResultObject(chunk, done)); } function ReadableStreamFulfillReadRequest(stream, chunk, done) { var reader = stream._reader; assert(reader._readRequests.length > 0); var readRequest = reader._readRequests.shift(); readRequest._resolve(CreateIterResultObject(chunk, done)); } function ReadableStreamGetNumReadIntoRequests(stream) { return stream._reader._readIntoRequests.length; } function ReadableStreamGetNumReadRequests(stream) { return stream._reader._readRequests.length; } function ReadableStreamHasBYOBReader(stream) { var reader = stream._reader; if (reader === undefined) { return false; } if (IsReadableStreamBYOBReader(reader) === false) { return false; } return true; } function ReadableStreamHasDefaultReader(stream) { var reader = stream._reader; if (reader === undefined) { return false; } if (IsReadableStreamDefaultReader(reader) === false) { return false; } return true; } var ReadableStreamDefaultReader = function () { function ReadableStreamDefaultReader(stream) { _classCallCheck(this, ReadableStreamDefaultReader); if (IsReadableStream(stream) === false) { throw new TypeError('ReadableStreamDefaultReader can only be constructed with a ReadableStream instance'); } if (IsReadableStreamLocked(stream) === true) { throw new TypeError('This stream has already been locked for exclusive reading by another reader'); } ReadableStreamReaderGenericInitialize(this, stream); this._readRequests = []; } _createClass(ReadableStreamDefaultReader, [{ key: 'cancel', value: function cancel(reason) { if (IsReadableStreamDefaultReader(this) === false) { return Promise.reject(defaultReaderBrandCheckException('cancel')); } if (this._ownerReadableStream === undefined) { return Promise.reject(readerLockException('cancel')); } return ReadableStreamReaderGenericCancel(this, reason); } }, { key: 'read', value: function read() { if (IsReadableStreamDefaultReader(this) === false) { return Promise.reject(defaultReaderBrandCheckException('read')); } if (this._ownerReadableStream === undefined) { return Promise.reject(readerLockException('read from')); } return ReadableStreamDefaultReaderRead(this); } }, { key: 'releaseLock', value: function releaseLock() { if (IsReadableStreamDefaultReader(this) === false) { throw defaultReaderBrandCheckException('releaseLock'); } if (this._ownerReadableStream === undefined) { return; } if (this._readRequests.length > 0) { throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled'); } ReadableStreamReaderGenericRelease(this); } }, { key: 'closed', get: function get() { if (IsReadableStreamDefaultReader(this) === false) { return Promise.reject(defaultReaderBrandCheckException('closed')); } return this._closedPromise; } }]); return ReadableStreamDefaultReader; }(); var ReadableStreamBYOBReader = function () { function ReadableStreamBYOBReader(stream) { _classCallCheck(this, ReadableStreamBYOBReader); if (!IsReadableStream(stream)) { throw new TypeError('ReadableStreamBYOBReader can only be constructed with a ReadableStream instance given a ' + 'byte source'); } if (IsReadableByteStreamController(stream._readableStreamController) === false) { throw new TypeError('Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte ' + 'source'); } if (IsReadableStreamLocked(stream)) { throw new TypeError('This stream has already been locked for exclusive reading by another reader'); } ReadableStreamReaderGenericInitialize(this, stream); this._readIntoRequests = []; } _createClass(ReadableStreamBYOBReader, [{ key: 'cancel', value: function cancel(reason) { if (!IsReadableStreamBYOBReader(this)) { return Promise.reject(byobReaderBrandCheckException('cancel')); } if (this._ownerReadableStream === undefined) { return Promise.reject(readerLockException('cancel')); } return ReadableStreamReaderGenericCancel(this, reason); } }, { key: 'read', value: function read(view) { if (!IsReadableStreamBYOBReader(this)) { return Promise.reject(byobReaderBrandCheckException('read')); } if (this._ownerReadableStream === undefined) { return Promise.reject(readerLockException('read from')); } if (!ArrayBuffer.isView(view)) { return Promise.reject(new TypeError('view must be an array buffer view')); } if (view.byteLength === 0) { return Promise.reject(new TypeError('view must have non-zero byteLength')); } return ReadableStreamBYOBReaderRead(this, view); } }, { key: 'releaseLock', value: function releaseLock() { if (!IsReadableStreamBYOBReader(this)) { throw byobReaderBrandCheckException('releaseLock'); } if (this._ownerReadableStream === undefined) { return; } if (this._readIntoRequests.length > 0) { throw new TypeError('Tried to release a reader lock when that reader has pending read() calls un-settled'); } ReadableStreamReaderGenericRelease(this); } }, { key: 'closed', get: function get() { if (!IsReadableStreamBYOBReader(this)) { return Promise.reject(byobReaderBrandCheckException('closed')); } return this._closedPromise; } }]); return ReadableStreamBYOBReader; }(); function IsReadableStreamBYOBReader(x) { if (!typeIsObject(x)) { return false; } if (!Object.prototype.hasOwnProperty.call(x, '_readIntoRequests')) { return false; } return true; } function IsReadableStreamDefaultReader(x) { if (!typeIsObject(x)) { return false; } if (!Object.prototype.hasOwnProperty.call(x, '_readRequests')) { return false; } return true; } function ReadableStreamReaderGenericInitialize(reader, stream) { reader._ownerReadableStream = stream; stream._reader = reader; if (stream._state === 'readable') { defaultReaderClosedPromiseInitialize(reader); } else if (stream._state === 'closed') { defaultReaderClosedPromiseInitializeAsResolved(reader); } else { assert(stream._state === 'errored', 'state must be errored'); defaultReaderClosedPromiseInitializeAsRejected(reader, stream._storedError); reader._closedPromise.catch(function () {}); } } function ReadableStreamReaderGenericCancel(reader, reason) { var stream = reader._ownerReadableStream; assert(stream !== undefined); return ReadableStreamCancel(stream, reason); } function ReadableStreamReaderGenericRelease(reader) { assert(reader._ownerReadableStream !== undefined); assert(reader._ownerReadableStream._reader === reader); if (reader._ownerReadableStream._state === 'readable') { defaultReaderClosedPromiseReject(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness')); } else { defaultReaderClosedPromiseResetToRejected(reader, new TypeError('Reader was released and can no longer be used to monitor the stream\'s closedness')); } reader._closedPromise.catch(function () {}); reader._ownerReadableStream._reader = undefined; reader._ownerReadableStream = undefined; } function ReadableStreamBYOBReaderRead(reader, view) { var stream = reader._ownerReadableStream; assert(stream !== undefined); stream._disturbed = true; if (stream._state === 'errored') { return Promise.reject(stream._storedError); } return ReadableByteStreamControllerPullInto(stream._readableStreamController, view); } function ReadableStreamDefaultReaderRead(reader) { var stream = reader._ownerReadableStream; assert(stream !== undefined); stream._disturbed = true; if (stream._state === 'closed') { return Promise.resolve(CreateIterResultObject(undefined, true)); } if (stream._state === 'errored') { return Promise.reject(stream._storedError); } assert(stream._state === 'readable'); return stream._readableStreamController.__pullSteps(); } var ReadableStreamDefaultController = function () { function ReadableStreamDefaultController(stream, underlyingSource, size, highWaterMark) { _classCallCheck(this, ReadableStreamDefaultController); if (IsReadableStream(stream) === false) { throw new TypeError('ReadableStreamDefaultController can only be constructed with a ReadableStream instance'); } if (stream._readableStreamController !== undefined) { throw new TypeError('ReadableStreamDefaultController instances can only be created by the ReadableStream constructor'); } this._controlledReadableStream = stream; this._underlyingSource = underlyingSource; this._queue = undefined; this._queueTotalSize = undefined; ResetQueue(this); this._started = false; this._closeRequested = false; this._pullAgain = false; this._pulling = false; var normalizedStrategy = ValidateAndNormalizeQueuingStrategy(size, highWaterMark); this._strategySize = normalizedStrategy.size; this._strategyHWM = normalizedStrategy.highWaterMark; var controller = this; var startResult = InvokeOrNoop(underlyingSource, 'start', [this]); Promise.resolve(startResult).then(function () { controller._started = true; assert(controller._pulling === false); assert(controller._pullAgain === false); ReadableStreamDefaultControllerCallPullIfNeeded(controller); }, function (r) { ReadableStreamDefaultControllerErrorIfNeeded(controller, r); }).catch(rethrowAssertionErrorRejection); } _createClass(ReadableStreamDefaultController, [{ key: 'close', value: function close() { if (IsReadableStreamDefaultController(this) === false) { throw defaultControllerBrandCheckException('close'); } if (this._closeRequested === true) { throw new TypeError('The stream has already been closed; do not close it again!'); } var state = this._controlledReadableStream._state; if (state !== 'readable') { throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be closed'); } ReadableStreamDefaultControllerClose(this); } }, { key: 'enqueue', value: function enqueue(chunk) { if (IsReadableStreamDefaultController(this) === false) { throw defaultControllerBrandCheckException('enqueue'); } if (this._closeRequested === true) { throw new TypeError('stream is closed or draining'); } var state = this._controlledReadableStream._state; if (state !== 'readable') { throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be enqueued to'); } return ReadableStreamDefaultControllerEnqueue(this, chunk); } }, { key: 'error', value: function error(e) { if (IsReadableStreamDefaultController(this) === false) { throw defaultControllerBrandCheckException('error'); } var stream = this._controlledReadableStream; if (stream._state !== 'readable') { throw new TypeError('The stream is ' + stream._state + ' and so cannot be errored'); } ReadableStreamDefaultControllerError(this, e); } }, { key: '__cancelSteps', value: function __cancelSteps(reason) { ResetQueue(this); return PromiseInvokeOrNoop(this._underlyingSource, 'cancel', [reason]); } }, { key: '__pullSteps', value: function __pullSteps() { var stream = this._controlledReadableStream; if (this._queue.length > 0) { var chunk = DequeueValue(this); if (this._closeRequested === true && this._queue.length === 0) { ReadableStreamClose(stream); } else { ReadableStreamDefaultControllerCallPullIfNeeded(this); } return Promise.resolve(CreateIterResultObject(chunk, false)); } var pendingPromise = ReadableStreamAddReadRequest(stream); ReadableStreamDefaultControllerCallPullIfNeeded(this); return pendingPromise; } }, { key: 'desiredSize', get: function get() { if (IsReadableStreamDefaultController(this) === false) { throw defaultControllerBrandCheckException('desiredSize'); } return ReadableStreamDefaultControllerGetDesiredSize(this); } }]); return ReadableStreamDefaultController; }(); function IsReadableStreamDefaultController(x) { if (!typeIsObject(x)) { return false; } if (!Object.prototype.hasOwnProperty.call(x, '_underlyingSource')) { return false; } return true; } function ReadableStreamDefaultControllerCallPullIfNeeded(controller) { var shouldPull = ReadableStreamDefaultControllerShouldCallPull(controller); if (shouldPull === false) { return undefined; } if (controller._pulling === true) { controller._pullAgain = true; return undefined; } assert(controller._pullAgain === false); controller._pulling = true; var pullPromise = PromiseInvokeOrNoop(controller._underlyingSource, 'pull', [controller]); pullPromise.then(function () { controller._pulling = false; if (controller._pullAgain === true) { controller._pullAgain = false; return ReadableStreamDefaultControllerCallPullIfNeeded(controller); } return undefined; }, function (e) { ReadableStreamDefaultControllerErrorIfNeeded(controller, e); }).catch(rethrowAssertionErrorRejection); return undefined; } function ReadableStreamDefaultControllerShouldCallPull(controller) { var stream = controller._controlledReadableStream; if (stream._state === 'closed' || stream._state === 'errored') { return false; } if (controller._closeRequested === true) { return false; } if (controller._started === false) { return false; } if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) { return true; } var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller); if (desiredSize > 0) { return true; } return false; } function ReadableStreamDefaultControllerClose(controller) { var stream = controller._controlledReadableStream; assert(controller._closeRequested === false); assert(stream._state === 'readable'); controller._closeRequested = true; if (controller._queue.length === 0) { ReadableStreamClose(stream); } } function ReadableStreamDefaultControllerEnqueue(controller, chunk) { var stream = controller._controlledReadableStream; assert(controller._closeRequested === false); assert(stream._state === 'readable'); if (IsReadableStreamLocked(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) { ReadableStreamFulfillReadRequest(stream, chunk, false); } else { var chunkSize = 1; if (controller._strategySize !== undefined) { var strategySize = controller._strategySize; try { chunkSize = strategySize(chunk); } catch (chunkSizeE) { ReadableStreamDefaultControllerErrorIfNeeded(controller, chunkSizeE); throw chunkSizeE; } } try { EnqueueValueWithSize(controller, chunk, chunkSize); } catch (enqueueE) { ReadableStreamDefaultControllerErrorIfNeeded(controller, enqueueE); throw enqueueE; } } ReadableStreamDefaultControllerCallPullIfNeeded(controller); return undefined; } function ReadableStreamDefaultControllerError(controller, e) { var stream = controller._controlledReadableStream; assert(stream._state === 'readable'); ResetQueue(controller); ReadableStreamError(stream, e); } function ReadableStreamDefaultControllerErrorIfNeeded(controller, e) { if (controller._controlledReadableStream._state === 'readable') { ReadableStreamDefaultControllerError(controller, e); } } function ReadableStreamDefaultControllerGetDesiredSize(controller) { var stream = controller._controlledReadableStream; var state = stream._state; if (state === 'errored') { return null; } if (state === 'closed') { return 0; } return controller._strategyHWM - controller._queueTotalSize; } var ReadableStreamBYOBRequest = function () { function ReadableStreamBYOBRequest(controller, view) { _classCallCheck(this, ReadableStreamBYOBRequest); this._associatedReadableByteStreamController = controller; this._view = view; } _createClass(ReadableStreamBYOBRequest, [{ key: 'respond', value: function respond(bytesWritten) { if (IsReadableStreamBYOBRequest(this) === false) { throw byobRequestBrandCheckException('respond'); } if (this._associatedReadableByteStreamController === undefined) { throw new TypeError('This BYOB request has been invalidated'); } ReadableByteStreamControllerRespond(this._associatedReadableByteStreamController, bytesWritten); } }, { key: 'respondWithNewView', value: function respondWithNewView(view) { if (IsReadableStreamBYOBRequest(this) === false) { throw byobRequestBrandCheckException('respond'); } if (this._associatedReadableByteStreamController === undefined) { throw new TypeError('This BYOB request has been invalidated'); } if (!ArrayBuffer.isView(view)) { throw new TypeError('You can only respond with array buffer views'); } ReadableByteStreamControllerRespondWithNewView(this._associatedReadableByteStreamController, view); } }, { key: 'view', get: function get() { return this._view; } }]); return ReadableStreamBYOBRequest; }(); var ReadableByteStreamController = function () { function ReadableByteStreamController(stream, underlyingByteSource, highWaterMark) { _classCallCheck(this, ReadableByteStreamController); if (IsReadableStream(stream) === false) { throw new TypeError('ReadableByteStreamController can only be constructed with a ReadableStream instance given ' + 'a byte source'); } if (stream._readableStreamController !== undefined) { throw new TypeError('ReadableByteStreamController instances can only be created by the ReadableStream constructor given a byte ' + 'source'); } this._controlledReadableStream = stream; this._underlyingByteSource = underlyingByteSource; this._pullAgain = false; this._pulling = false; ReadableByteStreamControllerClearPendingPullIntos(this); this._queue = this._queueTotalSize = undefined; ResetQueue(this); this._closeRequested = false; this._started = false; this._strategyHWM = ValidateAndNormalizeHighWaterMark(highWaterMark); var autoAllocateChunkSize = underlyingByteSource.autoAllocateChunkSize; if (autoAllocateChunkSize !== undefined) { if (Number.isInteger(autoAllocateChunkSize) === false || autoAllocateChunkSize <= 0) { throw new RangeError('autoAllocateChunkSize must be a positive integer'); } } this._autoAllocateChunkSize = autoAllocateChunkSize; this._pendingPullIntos = []; var controller = this; var startResult = InvokeOrNoop(underlyingByteSource, 'start', [this]); Promise.resolve(startResult).then(function () { controller._started = true; assert(controller._pulling === false); assert(controller._pullAgain === false); ReadableByteStreamControllerCallPullIfNeeded(controller); }, function (r) { if (stream._state === 'readable') { ReadableByteStreamControllerError(controller, r); } }).catch(rethrowAssertionErrorRejection); } _createClass(ReadableByteStreamController, [{ key: 'close', value: function close() { if (IsReadableByteStreamController(this) === false) { throw byteStreamControllerBrandCheckException('close'); } if (this._closeRequested === true) { throw new TypeError('The stream has already been closed; do not close it again!'); } var state = this._controlledReadableStream._state; if (state !== 'readable') { throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be closed'); } ReadableByteStreamControllerClose(this); } }, { key: 'enqueue', value: function enqueue(chunk) { if (IsReadableByteStreamController(this) === false) { throw byteStreamControllerBrandCheckException('enqueue'); } if (this._closeRequested === true) { throw new TypeError('stream is closed or draining'); } var state = this._controlledReadableStream._state; if (state !== 'readable') { throw new TypeError('The stream (in ' + state + ' state) is not in the readable state and cannot be enqueued to'); } if (!ArrayBuffer.isView(chunk)) { throw new TypeError('You can only enqueue array buffer views when using a ReadableByteStreamController'); } ReadableByteStreamControllerEnqueue(this, chunk); } }, { key: 'error', value: function error(e) { if (IsReadableByteStreamController(this) === false) { throw byteStreamControllerBrandCheckException('error'); } var stream = this._controlledReadableStream; if (stream._state !== 'readable') { throw new TypeError('The stream is ' + stream._state + ' and so cannot be errored'); } ReadableByteStreamControllerError(this, e); } }, { key: '__cancelSteps', value: function __cancelSteps(reason) { if (this._pendingPullIntos.length > 0) { var firstDescriptor = this._pendingPullIntos[0]; firstDescriptor.bytesFilled = 0; } ResetQueue(this); return PromiseInvokeOrNoop(this._underlyingByteSource, 'cancel', [reason]); } }, { key: '__pullSteps', value: function __pullSteps() { var stream = this._controlledReadableStream; assert(ReadableStreamHasDefaultReader(stream) === true); if (this._queueTotalSize > 0) { assert(ReadableStreamGetNumReadRequests(stream) === 0); var entry = this._queue.shift(); this._queueTotalSize -= entry.byteLength; ReadableByteStreamControllerHandleQueueDrain(this); var view = void 0; try { view = new Uint8Array(entry.buffer, entry.byteOffset, entry.byteLength); } catch (viewE) { return Promise.reject(viewE); } return Promise.resolve(CreateIterResultObject(view, false)); } var autoAllocateChunkSize = this._autoAllocateChunkSize; if (autoAllocateChunkSize !== undefined) { var buffer = void 0; try { buffer = new ArrayBuffer(autoAllocateChunkSize); } catch (bufferE) { return Promise.reject(bufferE); } var pullIntoDescriptor = { buffer: buffer, byteOffset: 0, byteLength: autoAllocateChunkSize, bytesFilled: 0, elementSize: 1, ctor: Uint8Array, readerType: 'default' }; this._pendingPullIntos.push(pullIntoDescriptor); } var promise = ReadableStreamAddReadRequest(stream); ReadableByteStreamControllerCallPullIfNeeded(this); return promise; } }, { key: 'byobRequest', get: function get() { if (IsReadableByteStreamController(this) === false) { throw byteStreamControllerBrandCheckException('byobRequest'); } if (this._byobRequest === undefined && this._pendingPullIntos.length > 0) { var firstDescriptor = this._pendingPullIntos[0]; var view = new Uint8Array(firstDescriptor.buffer, firstDescriptor.byteOffset + firstDescriptor.bytesFilled, firstDescriptor.byteLength - firstDescriptor.bytesFilled); this._byobRequest = new ReadableStreamBYOBRequest(this, view); } return this._byobRequest; } }, { key: 'desiredSize', get: function get() { if (IsReadableByteStreamController(this) === false) { throw byteStreamControllerBrandCheckException('desiredSize'); } return ReadableByteStreamControllerGetDesiredSize(this); } }]); return ReadableByteStreamController; }(); function IsReadableByteStreamController(x) { if (!typeIsObject(x)) { return false; } if (!Object.prototype.hasOwnProperty.call(x, '_underlyingByteSource')) { return false; } return true; } function IsReadableStreamBYOBRequest(x) { if (!typeIsObject(x)) { return false; } if (!Object.prototype.hasOwnProperty.call(x, '_associatedReadableByteStreamController')) { return false; } return true; } function ReadableByteStreamControllerCallPullIfNeeded(controller) { var shouldPull = ReadableByteStreamControllerShouldCallPull(controller); if (shouldPull === false) { return undefined; } if (controller._pulling === true) { controller._pullAgain = true; return undefined; } assert(controller._pullAgain === false); controller._pulling = true; var pullPromise = PromiseInvokeOrNoop(controller._underlyingByteSource, 'pull', [controller]); pullPromise.then(function () { controller._pulling = false; if (controller._pullAgain === true) { controller._pullAgain = false; ReadableByteStreamControllerCallPullIfNeeded(controller); } }, function (e) { if (controller._controlledReadableStream._state === 'readable') { ReadableByteStreamControllerError(controller, e); } }).catch(rethrowAssertionErrorRejection); return undefined; } function ReadableByteStreamControllerClearPendingPullIntos(controller) { ReadableByteStreamControllerInvalidateBYOBRequest(controller); controller._pendingPullIntos = []; } function ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor) { assert(stream._state !== 'errored', 'state must not be errored'); var done = false; if (stream._state === 'closed') { assert(pullIntoDescriptor.bytesFilled === 0); done = true; } var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor); if (pullIntoDescriptor.readerType === 'default') { ReadableStreamFulfillReadRequest(stream, filledView, done); } else { assert(pullIntoDescriptor.readerType === 'byob'); ReadableStreamFulfillReadIntoRequest(stream, filledView, done); } } function ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor) { var bytesFilled = pullIntoDescriptor.bytesFilled; var elementSize = pullIntoDescriptor.elementSize; assert(bytesFilled <= pullIntoDescriptor.byteLength); assert(bytesFilled % elementSize === 0); return new pullIntoDescriptor.ctor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, bytesFilled / elementSize); } function ReadableByteStreamControllerEnqueueChunkToQueue(controller, buffer, byteOffset, byteLength) { controller._queue.push({ buffer: buffer, byteOffset: byteOffset, byteLength: byteLength }); controller._queueTotalSize += byteLength; } function ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) { var elementSize = pullIntoDescriptor.elementSize; var currentAlignedBytes = pullIntoDescriptor.bytesFilled - pullIntoDescriptor.bytesFilled % elementSize; var maxBytesToCopy = Math.min(controller._queueTotalSize, pullIntoDescriptor.byteLength - pullIntoDescriptor.bytesFilled); var maxBytesFilled = pullIntoDescriptor.bytesFilled + maxBytesToCopy; var maxAlignedBytes = maxBytesFilled - maxBytesFilled % elementSize; var totalBytesToCopyRemaining = maxBytesToCopy; var ready = false; if (maxAlignedBytes > currentAlignedBytes) { totalBytesToCopyRemaining = maxAlignedBytes - pullIntoDescriptor.bytesFilled; ready = true; } var queue = controller._queue; while (totalBytesToCopyRemaining > 0) { var headOfQueue = queue[0]; var bytesToCopy = Math.min(totalBytesToCopyRemaining, headOfQueue.byteLength); var destStart = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled; ArrayBufferCopy(pullIntoDescriptor.buffer, destStart, headOfQueue.buffer, headOfQueue.byteOffset, bytesToCopy); if (headOfQueue.byteLength === bytesToCopy) { queue.shift(); } else { headOfQueue.byteOffset += bytesToCopy; headOfQueue.byteLength -= bytesToCopy; } controller._queueTotalSize -= bytesToCopy; ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesToCopy, pullIntoDescriptor); totalBytesToCopyRemaining -= bytesToCopy; } if (ready === false) { assert(controller._queueTotalSize === 0, 'queue must be empty'); assert(pullIntoDescriptor.bytesFilled > 0); assert(pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize); } return ready; } function ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, size, pullIntoDescriptor) { assert(controller._pendingPullIntos.length === 0 || controller._pendingPullIntos[0] === pullIntoDescriptor); ReadableByteStreamControllerInvalidateBYOBRequest(controller); pullIntoDescriptor.bytesFilled += size; } function ReadableByteStreamControllerHandleQueueDrain(controller) { assert(controller._controlledReadableStream._state === 'readable'); if (controller._queueTotalSize === 0 && controller._closeRequested === true) { ReadableStreamClose(controller._controlledReadableStream); } else { ReadableByteStreamControllerCallPullIfNeeded(controller); } } function ReadableByteStreamControllerInvalidateBYOBRequest(controller) { if (controller._byobRequest === undefined) { return; } controller._byobRequest._associatedReadableByteStreamController = undefined; controller._byobRequest._view = undefined; controller._byobRequest = undefined; } function ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller) { assert(controller._closeRequested === false); while (controller._pendingPullIntos.length > 0) { if (controller._queueTotalSize === 0) { return; } var pullIntoDescriptor = controller._pendingPullIntos[0]; if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) { ReadableByteStreamControllerShiftPendingPullInto(controller); ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableStream, pullIntoDescriptor); } } } function ReadableByteStreamControllerPullInto(controller, view) { var stream = controller._controlledReadableStream; var elementSize = 1; if (view.constructor !== DataView) { elementSize = view.constructor.BYTES_PER_ELEMENT; } var ctor = view.constructor; var pullIntoDescriptor = { buffer: view.buffer, byteOffset: view.byteOffset, byteLength: view.byteLength, bytesFilled: 0, elementSize: elementSize, ctor: ctor, readerType: 'byob' }; if (controller._pendingPullIntos.length > 0) { pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer); controller._pendingPullIntos.push(pullIntoDescriptor); return ReadableStreamAddReadIntoRequest(stream); } if (stream._state === 'closed') { var emptyView = new view.constructor(pullIntoDescriptor.buffer, pullIntoDescriptor.byteOffset, 0); return Promise.resolve(CreateIterResultObject(emptyView, true)); } if (controller._queueTotalSize > 0) { if (ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(controller, pullIntoDescriptor) === true) { var filledView = ReadableByteStreamControllerConvertPullIntoDescriptor(pullIntoDescriptor); ReadableByteStreamControllerHandleQueueDrain(controller); return Promise.resolve(CreateIterResultObject(filledView, false)); } if (controller._closeRequested === true) { var e = new TypeError('Insufficient bytes to fill elements in the given buffer'); ReadableByteStreamControllerError(controller, e); return Promise.reject(e); } } pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer); controller._pendingPullIntos.push(pullIntoDescriptor); var promise = ReadableStreamAddReadIntoRequest(stream); ReadableByteStreamControllerCallPullIfNeeded(controller); return promise; } function ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor) { firstDescriptor.buffer = TransferArrayBuffer(firstDescriptor.buffer); assert(firstDescriptor.bytesFilled === 0, 'bytesFilled must be 0'); var stream = controller._controlledReadableStream; if (ReadableStreamHasBYOBReader(stream) === true) { while (ReadableStreamGetNumReadIntoRequests(stream) > 0) { var pullIntoDescriptor = ReadableByteStreamControllerShiftPendingPullInto(controller); ReadableByteStreamControllerCommitPullIntoDescriptor(stream, pullIntoDescriptor); } } } function ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, pullIntoDescriptor) { if (pullIntoDescriptor.bytesFilled + bytesWritten > pullIntoDescriptor.byteLength) { throw new RangeError('bytesWritten out of range'); } ReadableByteStreamControllerFillHeadPullIntoDescriptor(controller, bytesWritten, pullIntoDescriptor); if (pullIntoDescriptor.bytesFilled < pullIntoDescriptor.elementSize) { return; } ReadableByteStreamControllerShiftPendingPullInto(controller); var remainderSize = pullIntoDescriptor.bytesFilled % pullIntoDescriptor.elementSize; if (remainderSize > 0) { var end = pullIntoDescriptor.byteOffset + pullIntoDescriptor.bytesFilled; var remainder = pullIntoDescriptor.buffer.slice(end - remainderSize, end); ReadableByteStreamControllerEnqueueChunkToQueue(controller, remainder, 0, remainder.byteLength); } pullIntoDescriptor.buffer = TransferArrayBuffer(pullIntoDescriptor.buffer); pullIntoDescriptor.bytesFilled -= remainderSize; ReadableByteStreamControllerCommitPullIntoDescriptor(controller._controlledReadableStream, pullIntoDescriptor); ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller); } function ReadableByteStreamControllerRespondInternal(controller, bytesWritten) { var firstDescriptor = controller._pendingPullIntos[0]; var stream = controller._controlledReadableStream; if (stream._state === 'closed') { if (bytesWritten !== 0) { throw new TypeError('bytesWritten must be 0 when calling respond() on a closed stream'); } ReadableByteStreamControllerRespondInClosedState(controller, firstDescriptor); } else { assert(stream._state === 'readable'); ReadableByteStreamControllerRespondInReadableState(controller, bytesWritten, firstDescriptor); } } function ReadableByteStreamControllerShiftPendingPullInto(controller) { var descriptor = controller._pendingPullIntos.shift(); ReadableByteStreamControllerInvalidateBYOBRequest(controller); return descriptor; } function ReadableByteStreamControllerShouldCallPull(controller) { var stream = controller._controlledReadableStream; if (stream._state !== 'readable') { return false; } if (controller._closeRequested === true) { return false; } if (controller._started === false) { return false; } if (ReadableStreamHasDefaultReader(stream) === true && ReadableStreamGetNumReadRequests(stream) > 0) { return true; } if (ReadableStreamHasBYOBReader(stream) === true && ReadableStreamGetNumReadIntoRequests(stream) > 0) { return true; } if (ReadableByteStreamControllerGetDesiredSize(controller) > 0) { return true; } return false; } function ReadableByteStreamControllerClose(controller) { var stream = controller._controlledReadableStream; assert(controller._closeRequested === false); assert(stream._state === 'readable'); if (controller._queueTotalSize > 0) { controller._closeRequested = true; return; } if (controller._pendingPullIntos.length > 0) { var firstPendingPullInto = controller._pendingPullIntos[0]; if (firstPendingPullInto.bytesFilled > 0) { var e = new TypeError('Insufficient bytes to fill elements in the given buffer'); ReadableByteStreamControllerError(controller, e); throw e; } } ReadableStreamClose(stream); } function ReadableByteStreamControllerEnqueue(controller, chunk) { var stream = controller._controlledReadableStream; assert(controller._closeRequested === false); assert(stream._state === 'readable'); var buffer = chunk.buffer; var byteOffset = chunk.byteOffset; var byteLength = chunk.byteLength; var transferredBuffer = TransferArrayBuffer(buffer); if (ReadableStreamHasDefaultReader(stream) === true) { if (ReadableStreamGetNumReadRequests(stream) === 0) { ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength); } else { assert(controller._queue.length === 0); var transferredView = new Uint8Array(transferredBuffer, byteOffset, byteLength); ReadableStreamFulfillReadRequest(stream, transferredView, false); } } else if (ReadableStreamHasBYOBReader(stream) === true) { ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength); ReadableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(controller); } else { assert(IsReadableStreamLocked(stream) === false, 'stream must not be locked'); ReadableByteStreamControllerEnqueueChunkToQueue(controller, transferredBuffer, byteOffset, byteLength); } } function ReadableByteStreamControllerError(controller, e) { var stream = controller._controlledReadableStream; assert(stream._state === 'readable'); ReadableByteStreamControllerClearPendingPullIntos(controller); ResetQueue(controller); ReadableStreamError(stream, e); } function ReadableByteStreamControllerGetDesiredSize(controller) { var stream = controller._controlledReadableStream; var state = stream._state; if (state === 'errored') { return null; } if (state === 'closed') { return 0; } return controller._strategyHWM - controller._queueTotalSize; } function ReadableByteStreamControllerRespond(controller, bytesWritten) { bytesWritten = Number(bytesWritten); if (IsFiniteNonNegativeNumber(bytesWritten) === false) { throw new RangeError('bytesWritten must be a finite'); } assert(controller._pendingPullIntos.length > 0); ReadableByteStreamControllerRespondInternal(controller, bytesWritten); } function ReadableByteStreamControllerRespondWithNewView(controller, view) { assert(controller._pendingPullIntos.length > 0); var firstDescriptor = controller._pendingPullIntos[0]; if (firstDescriptor.byteOffset + firstDescriptor.bytesFilled !== view.byteOffset) { throw new RangeError('The region specified by view does not match byobRequest'); } if (firstDescriptor.byteLength !== view.byteLength) { throw new RangeError('The buffer of view has different capacity than byobRequest'); } firstDescriptor.buffer = view.buffer; ReadableByteStreamControllerRespondInternal(controller, view.byteLength); } function streamBrandCheckException(name) { return new TypeError('ReadableStream.prototype.' + name + ' can only be used on a ReadableStream'); } function readerLockException(name) { return new TypeError('Cannot ' + name + ' a stream using a released reader'); } function defaultReaderBrandCheckException(name) { return new TypeError('ReadableStreamDefaultReader.prototype.' + name + ' can only be used on a ReadableStreamDefaultReader'); } function defaultReaderClosedPromiseInitialize(reader) { reader._closedPromise = new Promise(function (resolve, reject) { reader._closedPromise_resolve = resolve; reader._closedPromise_reject = reject; }); } function defaultReaderClosedPromiseInitializeAsRejected(reader, reason) { reader._closedPromise = Promise.reject(reason); reader._closedPromise_resolve = undefined; reader._closedPromise_reject = undefined; } function defaultReaderClosedPromiseInitializeAsResolved(reader) { reader._closedPromise = Promise.resolve(undefined); reader._closedPromise_resolve = undefined; reader._closedPromise_reject = undefined; } function defaultReaderClosedPromiseReject(reader, reason) { assert(reader._closedPromise_resolve !== undefined); assert(reader._closedPromise_reject !== undefined); reader._closedPromise_reject(reason); reader._closedPromise_resolve = undefined; reader._closedPromise_reject = undefined; } function defaultReaderClosedPromiseResetToRejected(reader, reason) { assert(reader._closedPromise_resolve === undefined); assert(reader._closedPromise_reject === undefined); reader._closedPromise = Promise.reject(reason); } function defaultReaderClosedPromiseResolve(reader) { assert(reader._closedPromise_resolve !== undefined); assert(reader._closedPromise_reject !== undefined); reader._closedPromise_resolve(undefined); reader._closedPromise_resolve = undefined; reader._closedPromise_reject = undefined; } function byobReaderBrandCheckException(name) { return new TypeError('ReadableStreamBYOBReader.prototype.' + name + ' can only be used on a ReadableStreamBYOBReader'); } function defaultControllerBrandCheckException(name) { return new TypeError('ReadableStreamDefaultController.prototype.' + name + ' can only be used on a ReadableStreamDefaultController'); } function byobRequestBrandCheckException(name) { return new TypeError('ReadableStreamBYOBRequest.prototype.' + name + ' can only be used on a ReadableStreamBYOBRequest'); } function byteStreamControllerBrandCheckException(name) { return new TypeError('ReadableByteStreamController.prototype.' + name + ' can only be used on a ReadableByteStreamController'); } function ifIsObjectAndHasAPromiseIsHandledInternalSlotSetPromiseIsHandledToTrue(promise) { try { Promise.prototype.then.call(promise, undefined, function () {}); } catch (e) {} } }, function (module, exports, __w_pdfjs_require__) { "use strict"; var transformStream = __w_pdfjs_require__(6); var readableStream = __w_pdfjs_require__(4); var writableStream = __w_pdfjs_require__(2); exports.TransformStream = transformStream.TransformStream; exports.ReadableStream = readableStream.ReadableStream; exports.IsReadableStreamDisturbed = readableStream.IsReadableStreamDisturbed; exports.ReadableStreamDefaultControllerClose = readableStream.ReadableStreamDefaultControllerClose; exports.ReadableStreamDefaultControllerEnqueue = readableStream.ReadableStreamDefaultControllerEnqueue; exports.ReadableStreamDefaultControllerError = readableStream.ReadableStreamDefaultControllerError; exports.ReadableStreamDefaultControllerGetDesiredSize = readableStream.ReadableStreamDefaultControllerGetDesiredSize; exports.AcquireWritableStreamDefaultWriter = writableStream.AcquireWritableStreamDefaultWriter; exports.IsWritableStream = writableStream.IsWritableStream; exports.IsWritableStreamLocked = writableStream.IsWritableStreamLocked; exports.WritableStream = writableStream.WritableStream; exports.WritableStreamAbort = writableStream.WritableStreamAbort; exports.WritableStreamDefaultControllerError = writableStream.WritableStreamDefaultControllerError; exports.WritableStreamDefaultWriterCloseWithErrorPropagation = writableStream.WritableStreamDefaultWriterCloseWithErrorPropagation; exports.WritableStreamDefaultWriterRelease = writableStream.WritableStreamDefaultWriterRelease; exports.WritableStreamDefaultWriterWrite = writableStream.WritableStreamDefaultWriterWrite; }, function (module, exports, __w_pdfjs_require__) { "use strict"; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var _require = __w_pdfjs_require__(1), assert = _require.assert; var _require2 = __w_pdfjs_require__(0), InvokeOrNoop = _require2.InvokeOrNoop, PromiseInvokeOrPerformFallback = _require2.PromiseInvokeOrPerformFallback, PromiseInvokeOrNoop = _require2.PromiseInvokeOrNoop, typeIsObject = _require2.typeIsObject; var _require3 = __w_pdfjs_require__(4), ReadableStream = _require3.ReadableStream, ReadableStreamDefaultControllerClose = _require3.ReadableStreamDefaultControllerClose, ReadableStreamDefaultControllerEnqueue = _require3.ReadableStreamDefaultControllerEnqueue, ReadableStreamDefaultControllerError = _require3.ReadableStreamDefaultControllerError, ReadableStreamDefaultControllerGetDesiredSize = _require3.ReadableStreamDefaultControllerGetDesiredSize; var _require4 = __w_pdfjs_require__(2), WritableStream = _require4.WritableStream, WritableStreamDefaultControllerError = _require4.WritableStreamDefaultControllerError; function TransformStreamCloseReadable(transformStream) { if (transformStream._errored === true) { throw new TypeError('TransformStream is already errored'); } if (transformStream._readableClosed === true) { throw new TypeError('Readable side is already closed'); } TransformStreamCloseReadableInternal(transformStream); } function TransformStreamEnqueueToReadable(transformStream, chunk) { if (transformStream._errored === true) { throw new TypeError('TransformStream is already errored'); } if (transformStream._readableClosed === true) { throw new TypeError('Readable side is already closed'); } var controller = transformStream._readableController; try { ReadableStreamDefaultControllerEnqueue(controller, chunk); } catch (e) { transformStream._readableClosed = true; TransformStreamErrorIfNeeded(transformStream, e); throw transformStream._storedError; } var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(controller); var maybeBackpressure = desiredSize <= 0; if (maybeBackpressure === true && transformStream._backpressure === false) { TransformStreamSetBackpressure(transformStream, true); } } function TransformStreamError(transformStream, e) { if (transformStream._errored === true) { throw new TypeError('TransformStream is already errored'); } TransformStreamErrorInternal(transformStream, e); } function TransformStreamCloseReadableInternal(transformStream) { assert(transformStream._errored === false); assert(transformStream._readableClosed === false); try { ReadableStreamDefaultControllerClose(transformStream._readableController); } catch (e) { assert(false); } transformStream._readableClosed = true; } function TransformStreamErrorIfNeeded(transformStream, e) { if (transformStream._errored === false) { TransformStreamErrorInternal(transformStream, e); } } function TransformStreamErrorInternal(transformStream, e) { assert(transformStream._errored === false); transformStream._errored = true; transformStream._storedError = e; if (transformStream._writableDone === false) { WritableStreamDefaultControllerError(transformStream._writableController, e); } if (transformStream._readableClosed === false) { ReadableStreamDefaultControllerError(transformStream._readableController, e); } } function TransformStreamReadableReadyPromise(transformStream) { assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized'); if (transformStream._backpressure === false) { return Promise.resolve(); } assert(transformStream._backpressure === true, '_backpressure should have been initialized'); return transformStream._backpressureChangePromise; } function TransformStreamSetBackpressure(transformStream, backpressure) { assert(transformStream._backpressure !== backpressure, 'TransformStreamSetBackpressure() should be called only when backpressure is changed'); if (transformStream._backpressureChangePromise !== undefined) { transformStream._backpressureChangePromise_resolve(backpressure); } transformStream._backpressureChangePromise = new Promise(function (resolve) { transformStream._backpressureChangePromise_resolve = resolve; }); transformStream._backpressureChangePromise.then(function (resolution) { assert(resolution !== backpressure, '_backpressureChangePromise should be fulfilled only when backpressure is changed'); }); transformStream._backpressure = backpressure; } function TransformStreamDefaultTransform(chunk, transformStreamController) { var transformStream = transformStreamController._controlledTransformStream; TransformStreamEnqueueToReadable(transformStream, chunk); return Promise.resolve(); } function TransformStreamTransform(transformStream, chunk) { assert(transformStream._errored === false); assert(transformStream._transforming === false); assert(transformStream._backpressure === false); transformStream._transforming = true; var transformer = transformStream._transformer; var controller = transformStream._transformStreamController; var transformPromise = PromiseInvokeOrPerformFallback(transformer, 'transform', [chunk, controller], TransformStreamDefaultTransform, [chunk, controller]); return transformPromise.then(function () { transformStream._transforming = false; return TransformStreamReadableReadyPromise(transformStream); }, function (e) { TransformStreamErrorIfNeeded(transformStream, e); return Promise.reject(e); }); } function IsTransformStreamDefaultController(x) { if (!typeIsObject(x)) { return false; } if (!Object.prototype.hasOwnProperty.call(x, '_controlledTransformStream')) { return false; } return true; } function IsTransformStream(x) { if (!typeIsObject(x)) { return false; } if (!Object.prototype.hasOwnProperty.call(x, '_transformStreamController')) { return false; } return true; } var TransformStreamSink = function () { function TransformStreamSink(transformStream, startPromise) { _classCallCheck(this, TransformStreamSink); this._transformStream = transformStream; this._startPromise = startPromise; } _createClass(TransformStreamSink, [{ key: 'start', value: function start(c) { var transformStream = this._transformStream; transformStream._writableController = c; return this._startPromise.then(function () { return TransformStreamReadableReadyPromise(transformStream); }); } }, { key: 'write', value: function write(chunk) { var transformStream = this._transformStream; return TransformStreamTransform(transformStream, chunk); } }, { key: 'abort', value: function abort() { var transformStream = this._transformStream; transformStream._writableDone = true; TransformStreamErrorInternal(transformStream, new TypeError('Writable side aborted')); } }, { key: 'close', value: function close() { var transformStream = this._transformStream; assert(transformStream._transforming === false); transformStream._writableDone = true; var flushPromise = PromiseInvokeOrNoop(transformStream._transformer, 'flush', [transformStream._transformStreamController]); return flushPromise.then(function () { if (transformStream._errored === true) { return Promise.reject(transformStream._storedError); } if (transformStream._readableClosed === false) { TransformStreamCloseReadableInternal(transformStream); } return Promise.resolve(); }).catch(function (r) { TransformStreamErrorIfNeeded(transformStream, r); return Promise.reject(transformStream._storedError); }); } }]); return TransformStreamSink; }(); var TransformStreamSource = function () { function TransformStreamSource(transformStream, startPromise) { _classCallCheck(this, TransformStreamSource); this._transformStream = transformStream; this._startPromise = startPromise; } _createClass(TransformStreamSource, [{ key: 'start', value: function start(c) { var transformStream = this._transformStream; transformStream._readableController = c; return this._startPromise.then(function () { assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized'); if (transformStream._backpressure === true) { return Promise.resolve(); } assert(transformStream._backpressure === false, '_backpressure should have been initialized'); return transformStream._backpressureChangePromise; }); } }, { key: 'pull', value: function pull() { var transformStream = this._transformStream; assert(transformStream._backpressure === true, 'pull() should be never called while _backpressure is false'); assert(transformStream._backpressureChangePromise !== undefined, '_backpressureChangePromise should have been initialized'); TransformStreamSetBackpressure(transformStream, false); return transformStream._backpressureChangePromise; } }, { key: 'cancel', value: function cancel() { var transformStream = this._transformStream; transformStream._readableClosed = true; TransformStreamErrorInternal(transformStream, new TypeError('Readable side canceled')); } }]); return TransformStreamSource; }(); var TransformStreamDefaultController = function () { function TransformStreamDefaultController(transformStream) { _classCallCheck(this, TransformStreamDefaultController); if (IsTransformStream(transformStream) === false) { throw new TypeError('TransformStreamDefaultController can only be ' + 'constructed with a TransformStream instance'); } if (transformStream._transformStreamController !== undefined) { throw new TypeError('TransformStreamDefaultController instances can ' + 'only be created by the TransformStream constructor'); } this._controlledTransformStream = transformStream; } _createClass(TransformStreamDefaultController, [{ key: 'enqueue', value: function enqueue(chunk) { if (IsTransformStreamDefaultController(this) === false) { throw defaultControllerBrandCheckException('enqueue'); } TransformStreamEnqueueToReadable(this._controlledTransformStream, chunk); } }, { key: 'close', value: function close() { if (IsTransformStreamDefaultController(this) === false) { throw defaultControllerBrandCheckException('close'); } TransformStreamCloseReadable(this._controlledTransformStream); } }, { key: 'error', value: function error(reason) { if (IsTransformStreamDefaultController(this) === false) { throw defaultControllerBrandCheckException('error'); } TransformStreamError(this._controlledTransformStream, reason); } }, { key: 'desiredSize', get: function get() { if (IsTransformStreamDefaultController(this) === false) { throw defaultControllerBrandCheckException('desiredSize'); } var transformStream = this._controlledTransformStream; var readableController = transformStream._readableController; return ReadableStreamDefaultControllerGetDesiredSize(readableController); } }]); return TransformStreamDefaultController; }(); var TransformStream = function () { function TransformStream() { var transformer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, TransformStream); this._transformer = transformer; var readableStrategy = transformer.readableStrategy, writableStrategy = transformer.writableStrategy; this._transforming = false; this._errored = false; this._storedError = undefined; this._writableController = undefined; this._readableController = undefined; this._transformStreamController = undefined; this._writableDone = false; this._readableClosed = false; this._backpressure = undefined; this._backpressureChangePromise = undefined; this._backpressureChangePromise_resolve = undefined; this._transformStreamController = new TransformStreamDefaultController(this); var startPromise_resolve = void 0; var startPromise = new Promise(function (resolve) { startPromise_resolve = resolve; }); var source = new TransformStreamSource(this, startPromise); this._readable = new ReadableStream(source, readableStrategy); var sink = new TransformStreamSink(this, startPromise); this._writable = new WritableStream(sink, writableStrategy); assert(this._writableController !== undefined); assert(this._readableController !== undefined); var desiredSize = ReadableStreamDefaultControllerGetDesiredSize(this._readableController); TransformStreamSetBackpressure(this, desiredSize <= 0); var transformStream = this; var startResult = InvokeOrNoop(transformer, 'start', [transformStream._transformStreamController]); startPromise_resolve(startResult); startPromise.catch(function (e) { if (transformStream._errored === false) { transformStream._errored = true; transformStream._storedError = e; } }); } _createClass(TransformStream, [{ key: 'readable', get: function get() { if (IsTransformStream(this) === false) { throw streamBrandCheckException('readable'); } return this._readable; } }, { key: 'writable', get: function get() { if (IsTransformStream(this) === false) { throw streamBrandCheckException('writable'); } return this._writable; } }]); return TransformStream; }(); module.exports = { TransformStream: TransformStream }; function defaultControllerBrandCheckException(name) { return new TypeError('TransformStreamDefaultController.prototype.' + name + ' can only be used on a TransformStreamDefaultController'); } function streamBrandCheckException(name) { return new TypeError('TransformStream.prototype.' + name + ' can only be used on a TransformStream'); } }, function (module, exports, __w_pdfjs_require__) { module.exports = __w_pdfjs_require__(5); }])); /***/ }), /* 113 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PDFJS = exports.globalScope = undefined; var _dom_utils = __w_pdfjs_require__(8); var _util = __w_pdfjs_require__(0); var _api = __w_pdfjs_require__(57); var _annotation_layer = __w_pdfjs_require__(60); var _global_scope = __w_pdfjs_require__(14); var _global_scope2 = _interopRequireDefault(_global_scope); var _metadata = __w_pdfjs_require__(59); var _text_layer = __w_pdfjs_require__(61); var _svg = __w_pdfjs_require__(62); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } if (!_global_scope2.default.PDFJS) { _global_scope2.default.PDFJS = {}; } var PDFJS = _global_scope2.default.PDFJS; { PDFJS.version = '2.0.106'; PDFJS.build = '0052dc2b'; } PDFJS.pdfBug = false; if (PDFJS.verbosity !== undefined) { (0, _util.setVerbosityLevel)(PDFJS.verbosity); } delete PDFJS.verbosity; Object.defineProperty(PDFJS, 'verbosity', { get: function get() { return (0, _util.getVerbosityLevel)(); }, set: function set(level) { (0, _util.setVerbosityLevel)(level); }, enumerable: true, configurable: true }); PDFJS.VERBOSITY_LEVELS = _util.VERBOSITY_LEVELS; PDFJS.OPS = _util.OPS; PDFJS.UNSUPPORTED_FEATURES = _util.UNSUPPORTED_FEATURES; PDFJS.isValidUrl = _dom_utils.isValidUrl; PDFJS.shadow = _util.shadow; PDFJS.createBlob = _util.createBlob; PDFJS.createObjectURL = function PDFJS_createObjectURL(data, contentType) { return (0, _util.createObjectURL)(data, contentType, PDFJS.disableCreateObjectURL); }; Object.defineProperty(PDFJS, 'isLittleEndian', { configurable: true, get: function PDFJS_isLittleEndian() { return (0, _util.shadow)(PDFJS, 'isLittleEndian', (0, _util.isLittleEndian)()); } }); PDFJS.removeNullCharacters = _util.removeNullCharacters; PDFJS.PasswordResponses = _util.PasswordResponses; PDFJS.PasswordException = _util.PasswordException; PDFJS.UnknownErrorException = _util.UnknownErrorException; PDFJS.InvalidPDFException = _util.InvalidPDFException; PDFJS.MissingPDFException = _util.MissingPDFException; PDFJS.UnexpectedResponseException = _util.UnexpectedResponseException; PDFJS.Util = _util.Util; PDFJS.PageViewport = _util.PageViewport; PDFJS.createPromiseCapability = _util.createPromiseCapability; PDFJS.maxImageSize = PDFJS.maxImageSize === undefined ? -1 : PDFJS.maxImageSize; PDFJS.cMapUrl = PDFJS.cMapUrl === undefined ? null : PDFJS.cMapUrl; PDFJS.cMapPacked = PDFJS.cMapPacked === undefined ? false : PDFJS.cMapPacked; PDFJS.disableFontFace = PDFJS.disableFontFace === undefined ? false : PDFJS.disableFontFace; PDFJS.imageResourcesPath = PDFJS.imageResourcesPath === undefined ? '' : PDFJS.imageResourcesPath; PDFJS.disableWorker = PDFJS.disableWorker === undefined ? false : PDFJS.disableWorker; PDFJS.workerSrc = PDFJS.workerSrc === undefined ? null : PDFJS.workerSrc; PDFJS.workerPort = PDFJS.workerPort === undefined ? null : PDFJS.workerPort; PDFJS.disableRange = PDFJS.disableRange === undefined ? false : PDFJS.disableRange; PDFJS.disableStream = PDFJS.disableStream === undefined ? false : PDFJS.disableStream; PDFJS.disableAutoFetch = PDFJS.disableAutoFetch === undefined ? false : PDFJS.disableAutoFetch; PDFJS.pdfBug = PDFJS.pdfBug === undefined ? false : PDFJS.pdfBug; PDFJS.postMessageTransfers = PDFJS.postMessageTransfers === undefined ? true : PDFJS.postMessageTransfers; PDFJS.disableCreateObjectURL = PDFJS.disableCreateObjectURL === undefined ? false : PDFJS.disableCreateObjectURL; PDFJS.disableWebGL = PDFJS.disableWebGL === undefined ? true : PDFJS.disableWebGL; PDFJS.externalLinkTarget = PDFJS.externalLinkTarget === undefined ? _dom_utils.LinkTarget.NONE : PDFJS.externalLinkTarget; PDFJS.externalLinkRel = PDFJS.externalLinkRel === undefined ? _dom_utils.DEFAULT_LINK_REL : PDFJS.externalLinkRel; PDFJS.isEvalSupported = PDFJS.isEvalSupported === undefined ? true : PDFJS.isEvalSupported; PDFJS.getDocument = _api.getDocument; PDFJS.LoopbackPort = _api.LoopbackPort; PDFJS.PDFDataRangeTransport = _api.PDFDataRangeTransport; PDFJS.PDFWorker = _api.PDFWorker; PDFJS.CustomStyle = _dom_utils.CustomStyle; PDFJS.LinkTarget = _dom_utils.LinkTarget; PDFJS.addLinkAttributes = _dom_utils.addLinkAttributes; PDFJS.getFilenameFromUrl = _dom_utils.getFilenameFromUrl; PDFJS.isExternalLinkTargetSet = _dom_utils.isExternalLinkTargetSet; PDFJS.AnnotationLayer = _annotation_layer.AnnotationLayer; PDFJS.renderTextLayer = _text_layer.renderTextLayer; PDFJS.Metadata = _metadata.Metadata; PDFJS.SVGGraphics = _svg.SVGGraphics; exports.globalScope = _global_scope2.default; exports.PDFJS = PDFJS; /***/ }), /* 114 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FontLoader = exports.FontFaceObject = undefined; var _util = __w_pdfjs_require__(0); function FontLoader(docId) { this.docId = docId; this.styleElement = null; this.nativeFontFaces = []; this.loadTestFontId = 0; this.loadingContext = { requests: [], nextRequestId: 0 }; } FontLoader.prototype = { insertRule: function fontLoaderInsertRule(rule) { var styleElement = this.styleElement; if (!styleElement) { styleElement = this.styleElement = document.createElement('style'); styleElement.id = 'PDFJS_FONT_STYLE_TAG_' + this.docId; document.documentElement.getElementsByTagName('head')[0].appendChild(styleElement); } var styleSheet = styleElement.sheet; styleSheet.insertRule(rule, styleSheet.cssRules.length); }, clear: function fontLoaderClear() { if (this.styleElement) { this.styleElement.remove(); this.styleElement = null; } this.nativeFontFaces.forEach(function (nativeFontFace) { document.fonts.delete(nativeFontFace); }); this.nativeFontFaces.length = 0; } }; { var getLoadTestFont = function getLoadTestFont() { return atob('T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQ' + 'AABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwA' + 'AAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbm' + 'FtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAA' + 'AADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6A' + 'ABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAA' + 'MQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAA' + 'AAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAA' + 'AAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQ' + 'AAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMA' + 'AQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAA' + 'EAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAA' + 'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAA' + 'AAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgc' + 'A/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWF' + 'hYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQA' + 'AAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAg' + 'ABAAAAAAAAAAAD6AAAAAAAAA=='); }; Object.defineProperty(FontLoader.prototype, 'loadTestFont', { get: function get() { return (0, _util.shadow)(this, 'loadTestFont', getLoadTestFont()); }, configurable: true }); FontLoader.prototype.addNativeFontFace = function fontLoader_addNativeFontFace(nativeFontFace) { this.nativeFontFaces.push(nativeFontFace); document.fonts.add(nativeFontFace); }; FontLoader.prototype.bind = function fontLoaderBind(fonts, callback) { var rules = []; var fontsToLoad = []; var fontLoadPromises = []; var getNativeFontPromise = function getNativeFontPromise(nativeFontFace) { return nativeFontFace.loaded.catch(function (e) { (0, _util.warn)('Failed to load font "' + nativeFontFace.family + '": ' + e); }); }; var isFontLoadingAPISupported = FontLoader.isFontLoadingAPISupported && !FontLoader.isSyncFontLoadingSupported; for (var i = 0, ii = fonts.length; i < ii; i++) { var font = fonts[i]; if (font.attached || font.loading === false) { continue; } font.attached = true; if (isFontLoadingAPISupported) { var nativeFontFace = font.createNativeFontFace(); if (nativeFontFace) { this.addNativeFontFace(nativeFontFace); fontLoadPromises.push(getNativeFontPromise(nativeFontFace)); } } else { var rule = font.createFontFaceRule(); if (rule) { this.insertRule(rule); rules.push(rule); fontsToLoad.push(font); } } } var request = this.queueLoadingCallback(callback); if (isFontLoadingAPISupported) { Promise.all(fontLoadPromises).then(function () { request.complete(); }); } else if (rules.length > 0 && !FontLoader.isSyncFontLoadingSupported) { this.prepareFontLoadEvent(rules, fontsToLoad, request); } else { request.complete(); } }; FontLoader.prototype.queueLoadingCallback = function FontLoader_queueLoadingCallback(callback) { function LoadLoader_completeRequest() { (0, _util.assert)(!request.end, 'completeRequest() cannot be called twice'); request.end = Date.now(); while (context.requests.length > 0 && context.requests[0].end) { var otherRequest = context.requests.shift(); setTimeout(otherRequest.callback, 0); } } var context = this.loadingContext; var requestId = 'pdfjs-font-loading-' + context.nextRequestId++; var request = { id: requestId, complete: LoadLoader_completeRequest, callback: callback, started: Date.now() }; context.requests.push(request); return request; }; FontLoader.prototype.prepareFontLoadEvent = function fontLoaderPrepareFontLoadEvent(rules, fonts, request) { function int32(data, offset) { return data.charCodeAt(offset) << 24 | data.charCodeAt(offset + 1) << 16 | data.charCodeAt(offset + 2) << 8 | data.charCodeAt(offset + 3) & 0xff; } function spliceString(s, offset, remove, insert) { var chunk1 = s.substr(0, offset); var chunk2 = s.substr(offset + remove); return chunk1 + insert + chunk2; } var i, ii; var canvas = document.createElement('canvas'); canvas.width = 1; canvas.height = 1; var ctx = canvas.getContext('2d'); var called = 0; function isFontReady(name, callback) { called++; if (called > 30) { (0, _util.warn)('Load test font never loaded.'); callback(); return; } ctx.font = '30px ' + name; ctx.fillText('.', 0, 20); var imageData = ctx.getImageData(0, 0, 1, 1); if (imageData.data[3] > 0) { callback(); return; } setTimeout(isFontReady.bind(null, name, callback)); } var loadTestFontId = 'lt' + Date.now() + this.loadTestFontId++; var data = this.loadTestFont; var COMMENT_OFFSET = 976; data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, loadTestFontId); var CFF_CHECKSUM_OFFSET = 16; var XXXX_VALUE = 0x58585858; var checksum = int32(data, CFF_CHECKSUM_OFFSET); for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) { checksum = checksum - XXXX_VALUE + int32(loadTestFontId, i) | 0; } if (i < loadTestFontId.length) { checksum = checksum - XXXX_VALUE + int32(loadTestFontId + 'XXX', i) | 0; } data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, (0, _util.string32)(checksum)); var url = 'url(data:font/opentype;base64,' + btoa(data) + ');'; var rule = '@font-face { font-family:"' + loadTestFontId + '";src:' + url + '}'; this.insertRule(rule); var names = []; for (i = 0, ii = fonts.length; i < ii; i++) { names.push(fonts[i].loadedName); } names.push(loadTestFontId); var div = document.createElement('div'); div.setAttribute('style', 'visibility: hidden;' + 'width: 10px; height: 10px;' + 'position: absolute; top: 0px; left: 0px;'); for (i = 0, ii = names.length; i < ii; ++i) { var span = document.createElement('span'); span.textContent = 'Hi'; span.style.fontFamily = names[i]; div.appendChild(span); } document.body.appendChild(div); isFontReady(loadTestFontId, function () { document.body.removeChild(div); request.complete(); }); }; } { FontLoader.isFontLoadingAPISupported = typeof document !== 'undefined' && !!document.fonts; } { var isSyncFontLoadingSupported = function isSyncFontLoadingSupported() { if (typeof navigator === 'undefined') { return true; } var supported = false; var m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent); if (m && m[1] >= 14) { supported = true; } return supported; }; Object.defineProperty(FontLoader, 'isSyncFontLoadingSupported', { get: function get() { return (0, _util.shadow)(FontLoader, 'isSyncFontLoadingSupported', isSyncFontLoadingSupported()); }, enumerable: true, configurable: true }); } var IsEvalSupportedCached = { get value() { return (0, _util.shadow)(this, 'value', (0, _util.isEvalSupported)()); } }; var FontFaceObject = function FontFaceObjectClosure() { function FontFaceObject(translatedData, options) { this.compiledGlyphs = Object.create(null); for (var i in translatedData) { this[i] = translatedData[i]; } this.options = options; } FontFaceObject.prototype = { createNativeFontFace: function FontFaceObject_createNativeFontFace() { if (!this.data) { return null; } if (this.options.disableFontFace) { this.disableFontFace = true; return null; } var nativeFontFace = new FontFace(this.loadedName, this.data, {}); if (this.options.fontRegistry) { this.options.fontRegistry.registerFont(this); } return nativeFontFace; }, createFontFaceRule: function FontFaceObject_createFontFaceRule() { if (!this.data) { return null; } if (this.options.disableFontFace) { this.disableFontFace = true; return null; } var data = (0, _util.bytesToString)(new Uint8Array(this.data)); var fontName = this.loadedName; var url = 'url(data:' + this.mimetype + ';base64,' + btoa(data) + ');'; var rule = '@font-face { font-family:"' + fontName + '";src:' + url + '}'; if (this.options.fontRegistry) { this.options.fontRegistry.registerFont(this, url); } return rule; }, getPathGenerator: function FontFaceObject_getPathGenerator(objs, character) { if (!(character in this.compiledGlyphs)) { var cmds = objs.get(this.loadedName + '_path_' + character); var current, i, len; if (this.options.isEvalSupported && IsEvalSupportedCached.value) { var args, js = ''; for (i = 0, len = cmds.length; i < len; i++) { current = cmds[i]; if (current.args !== undefined) { args = current.args.join(','); } else { args = ''; } js += 'c.' + current.cmd + '(' + args + ');\n'; } this.compiledGlyphs[character] = new Function('c', 'size', js); } else { this.compiledGlyphs[character] = function (c, size) { for (i = 0, len = cmds.length; i < len; i++) { current = cmds[i]; if (current.cmd === 'scale') { current.args = [size, -size]; } c[current.cmd].apply(c, current.args); } }; } } return this.compiledGlyphs[character]; } }; return FontFaceObject; }(); exports.FontFaceObject = FontFaceObject; exports.FontLoader = FontLoader; /***/ }), /* 115 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CanvasGraphics = undefined; var _util = __w_pdfjs_require__(0); var _pattern_helper = __w_pdfjs_require__(116); var _webgl = __w_pdfjs_require__(58); var MIN_FONT_SIZE = 16; var MAX_FONT_SIZE = 100; var MAX_GROUP_SIZE = 4096; var MIN_WIDTH_FACTOR = 0.65; var COMPILE_TYPE3_GLYPHS = true; var MAX_SIZE_TO_COMPILE = 1000; var FULL_CHUNK_HEIGHT = 16; var IsLittleEndianCached = { get value() { return (0, _util.shadow)(IsLittleEndianCached, 'value', (0, _util.isLittleEndian)()); } }; function addContextCurrentTransform(ctx) { if (!ctx.mozCurrentTransform) { ctx._originalSave = ctx.save; ctx._originalRestore = ctx.restore; ctx._originalRotate = ctx.rotate; ctx._originalScale = ctx.scale; ctx._originalTranslate = ctx.translate; ctx._originalTransform = ctx.transform; ctx._originalSetTransform = ctx.setTransform; ctx._transformMatrix = ctx._transformMatrix || [1, 0, 0, 1, 0, 0]; ctx._transformStack = []; Object.defineProperty(ctx, 'mozCurrentTransform', { get: function getCurrentTransform() { return this._transformMatrix; } }); Object.defineProperty(ctx, 'mozCurrentTransformInverse', { get: function getCurrentTransformInverse() { var m = this._transformMatrix; var a = m[0], b = m[1], c = m[2], d = m[3], e = m[4], f = m[5]; var ad_bc = a * d - b * c; var bc_ad = b * c - a * d; return [d / ad_bc, b / bc_ad, c / bc_ad, a / ad_bc, (d * e - c * f) / bc_ad, (b * e - a * f) / ad_bc]; } }); ctx.save = function ctxSave() { var old = this._transformMatrix; this._transformStack.push(old); this._transformMatrix = old.slice(0, 6); this._originalSave(); }; ctx.restore = function ctxRestore() { var prev = this._transformStack.pop(); if (prev) { this._transformMatrix = prev; this._originalRestore(); } }; ctx.translate = function ctxTranslate(x, y) { var m = this._transformMatrix; m[4] = m[0] * x + m[2] * y + m[4]; m[5] = m[1] * x + m[3] * y + m[5]; this._originalTranslate(x, y); }; ctx.scale = function ctxScale(x, y) { var m = this._transformMatrix; m[0] = m[0] * x; m[1] = m[1] * x; m[2] = m[2] * y; m[3] = m[3] * y; this._originalScale(x, y); }; ctx.transform = function ctxTransform(a, b, c, d, e, f) { var m = this._transformMatrix; this._transformMatrix = [m[0] * a + m[2] * b, m[1] * a + m[3] * b, m[0] * c + m[2] * d, m[1] * c + m[3] * d, m[0] * e + m[2] * f + m[4], m[1] * e + m[3] * f + m[5]]; ctx._originalTransform(a, b, c, d, e, f); }; ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) { this._transformMatrix = [a, b, c, d, e, f]; ctx._originalSetTransform(a, b, c, d, e, f); }; ctx.rotate = function ctxRotate(angle) { var cosValue = Math.cos(angle); var sinValue = Math.sin(angle); var m = this._transformMatrix; this._transformMatrix = [m[0] * cosValue + m[2] * sinValue, m[1] * cosValue + m[3] * sinValue, m[0] * -sinValue + m[2] * cosValue, m[1] * -sinValue + m[3] * cosValue, m[4], m[5]]; this._originalRotate(angle); }; } } var CachedCanvases = function CachedCanvasesClosure() { function CachedCanvases(canvasFactory) { this.canvasFactory = canvasFactory; this.cache = Object.create(null); } CachedCanvases.prototype = { getCanvas: function CachedCanvases_getCanvas(id, width, height, trackTransform) { var canvasEntry; if (this.cache[id] !== undefined) { canvasEntry = this.cache[id]; this.canvasFactory.reset(canvasEntry, width, height); canvasEntry.context.setTransform(1, 0, 0, 1, 0, 0); } else { canvasEntry = this.canvasFactory.create(width, height); this.cache[id] = canvasEntry; } if (trackTransform) { addContextCurrentTransform(canvasEntry.context); } return canvasEntry; }, clear: function clear() { for (var id in this.cache) { var canvasEntry = this.cache[id]; this.canvasFactory.destroy(canvasEntry); delete this.cache[id]; } } }; return CachedCanvases; }(); function compileType3Glyph(imgData) { var POINT_TO_PROCESS_LIMIT = 1000; var width = imgData.width, height = imgData.height; var i, j, j0, width1 = width + 1; var points = new Uint8Array(width1 * (height + 1)); var POINT_TYPES = new Uint8Array([0, 2, 4, 0, 1, 0, 5, 4, 8, 10, 0, 8, 0, 2, 1, 0]); var lineSize = width + 7 & ~7, data0 = imgData.data; var data = new Uint8Array(lineSize * height), pos = 0, ii; for (i = 0, ii = data0.length; i < ii; i++) { var mask = 128, elem = data0[i]; while (mask > 0) { data[pos++] = elem & mask ? 0 : 255; mask >>= 1; } } var count = 0; pos = 0; if (data[pos] !== 0) { points[0] = 1; ++count; } for (j = 1; j < width; j++) { if (data[pos] !== data[pos + 1]) { points[j] = data[pos] ? 2 : 1; ++count; } pos++; } if (data[pos] !== 0) { points[j] = 2; ++count; } for (i = 1; i < height; i++) { pos = i * lineSize; j0 = i * width1; if (data[pos - lineSize] !== data[pos]) { points[j0] = data[pos] ? 1 : 8; ++count; } var sum = (data[pos] ? 4 : 0) + (data[pos - lineSize] ? 8 : 0); for (j = 1; j < width; j++) { sum = (sum >> 2) + (data[pos + 1] ? 4 : 0) + (data[pos - lineSize + 1] ? 8 : 0); if (POINT_TYPES[sum]) { points[j0 + j] = POINT_TYPES[sum]; ++count; } pos++; } if (data[pos - lineSize] !== data[pos]) { points[j0 + j] = data[pos] ? 2 : 4; ++count; } if (count > POINT_TO_PROCESS_LIMIT) { return null; } } pos = lineSize * (height - 1); j0 = i * width1; if (data[pos] !== 0) { points[j0] = 8; ++count; } for (j = 1; j < width; j++) { if (data[pos] !== data[pos + 1]) { points[j0 + j] = data[pos] ? 4 : 8; ++count; } pos++; } if (data[pos] !== 0) { points[j0 + j] = 4; ++count; } if (count > POINT_TO_PROCESS_LIMIT) { return null; } var steps = new Int32Array([0, width1, -1, 0, -width1, 0, 0, 0, 1]); var outlines = []; for (i = 0; count && i <= height; i++) { var p = i * width1; var end = p + width; while (p < end && !points[p]) { p++; } if (p === end) { continue; } var coords = [p % width1, i]; var type = points[p], p0 = p, pp; do { var step = steps[type]; do { p += step; } while (!points[p]); pp = points[p]; if (pp !== 5 && pp !== 10) { type = pp; points[p] = 0; } else { type = pp & 0x33 * type >> 4; points[p] &= type >> 2 | type << 2; } coords.push(p % width1); coords.push(p / width1 | 0); --count; } while (p0 !== p); outlines.push(coords); --i; } var drawOutline = function drawOutline(c) { c.save(); c.scale(1 / width, -1 / height); c.translate(0, -height); c.beginPath(); for (var i = 0, ii = outlines.length; i < ii; i++) { var o = outlines[i]; c.moveTo(o[0], o[1]); for (var j = 2, jj = o.length; j < jj; j += 2) { c.lineTo(o[j], o[j + 1]); } } c.fill(); c.beginPath(); c.restore(); }; return drawOutline; } var CanvasExtraState = function CanvasExtraStateClosure() { function CanvasExtraState() { this.alphaIsShape = false; this.fontSize = 0; this.fontSizeScale = 1; this.textMatrix = _util.IDENTITY_MATRIX; this.textMatrixScale = 1; this.fontMatrix = _util.FONT_IDENTITY_MATRIX; this.leading = 0; this.x = 0; this.y = 0; this.lineX = 0; this.lineY = 0; this.charSpacing = 0; this.wordSpacing = 0; this.textHScale = 1; this.textRenderingMode = _util.TextRenderingMode.FILL; this.textRise = 0; this.fillColor = '#000000'; this.strokeColor = '#000000'; this.patternFill = false; this.fillAlpha = 1; this.strokeAlpha = 1; this.lineWidth = 1; this.activeSMask = null; this.resumeSMaskCtx = null; } CanvasExtraState.prototype = { clone: function CanvasExtraState_clone() { return Object.create(this); }, setCurrentPoint: function CanvasExtraState_setCurrentPoint(x, y) { this.x = x; this.y = y; } }; return CanvasExtraState; }(); var CanvasGraphics = function CanvasGraphicsClosure() { var EXECUTION_TIME = 15; var EXECUTION_STEPS = 10; function CanvasGraphics(canvasCtx, commonObjs, objs, canvasFactory, imageLayer) { this.ctx = canvasCtx; this.current = new CanvasExtraState(); this.stateStack = []; this.pendingClip = null; this.pendingEOFill = false; this.res = null; this.xobjs = null; this.commonObjs = commonObjs; this.objs = objs; this.canvasFactory = canvasFactory; this.imageLayer = imageLayer; this.groupStack = []; this.processingType3 = null; this.baseTransform = null; this.baseTransformStack = []; this.groupLevel = 0; this.smaskStack = []; this.smaskCounter = 0; this.tempSMask = null; this.cachedCanvases = new CachedCanvases(this.canvasFactory); if (canvasCtx) { addContextCurrentTransform(canvasCtx); } this.cachedGetSinglePixelWidth = null; } function putBinaryImageData(ctx, imgData) { if (typeof ImageData !== 'undefined' && imgData instanceof ImageData) { ctx.putImageData(imgData, 0, 0); return; } var height = imgData.height, width = imgData.width; var partialChunkHeight = height % FULL_CHUNK_HEIGHT; var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); var srcPos = 0, destPos; var src = imgData.data; var dest = chunkImgData.data; var i, j, thisChunkHeight, elemsInThisChunk; if (imgData.kind === _util.ImageKind.GRAYSCALE_1BPP) { var srcLength = src.byteLength; var dest32 = new Uint32Array(dest.buffer, 0, dest.byteLength >> 2); var dest32DataLength = dest32.length; var fullSrcDiff = width + 7 >> 3; var white = 0xFFFFFFFF; var black = IsLittleEndianCached.value ? 0xFF000000 : 0x000000FF; for (i = 0; i < totalChunks; i++) { thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight; destPos = 0; for (j = 0; j < thisChunkHeight; j++) { var srcDiff = srcLength - srcPos; var k = 0; var kEnd = srcDiff > fullSrcDiff ? width : srcDiff * 8 - 7; var kEndUnrolled = kEnd & ~7; var mask = 0; var srcByte = 0; for (; k < kEndUnrolled; k += 8) { srcByte = src[srcPos++]; dest32[destPos++] = srcByte & 128 ? white : black; dest32[destPos++] = srcByte & 64 ? white : black; dest32[destPos++] = srcByte & 32 ? white : black; dest32[destPos++] = srcByte & 16 ? white : black; dest32[destPos++] = srcByte & 8 ? white : black; dest32[destPos++] = srcByte & 4 ? white : black; dest32[destPos++] = srcByte & 2 ? white : black; dest32[destPos++] = srcByte & 1 ? white : black; } for (; k < kEnd; k++) { if (mask === 0) { srcByte = src[srcPos++]; mask = 128; } dest32[destPos++] = srcByte & mask ? white : black; mask >>= 1; } } while (destPos < dest32DataLength) { dest32[destPos++] = 0; } ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); } } else if (imgData.kind === _util.ImageKind.RGBA_32BPP) { j = 0; elemsInThisChunk = width * FULL_CHUNK_HEIGHT * 4; for (i = 0; i < fullChunks; i++) { dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk)); srcPos += elemsInThisChunk; ctx.putImageData(chunkImgData, 0, j); j += FULL_CHUNK_HEIGHT; } if (i < totalChunks) { elemsInThisChunk = width * partialChunkHeight * 4; dest.set(src.subarray(srcPos, srcPos + elemsInThisChunk)); ctx.putImageData(chunkImgData, 0, j); } } else if (imgData.kind === _util.ImageKind.RGB_24BPP) { thisChunkHeight = FULL_CHUNK_HEIGHT; elemsInThisChunk = width * thisChunkHeight; for (i = 0; i < totalChunks; i++) { if (i >= fullChunks) { thisChunkHeight = partialChunkHeight; elemsInThisChunk = width * thisChunkHeight; } destPos = 0; for (j = elemsInThisChunk; j--;) { dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++]; dest[destPos++] = src[srcPos++]; dest[destPos++] = 255; } ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); } } else { throw new Error('bad image kind: ' + imgData.kind); } } function putBinaryImageMask(ctx, imgData) { var height = imgData.height, width = imgData.width; var partialChunkHeight = height % FULL_CHUNK_HEIGHT; var fullChunks = (height - partialChunkHeight) / FULL_CHUNK_HEIGHT; var totalChunks = partialChunkHeight === 0 ? fullChunks : fullChunks + 1; var chunkImgData = ctx.createImageData(width, FULL_CHUNK_HEIGHT); var srcPos = 0; var src = imgData.data; var dest = chunkImgData.data; for (var i = 0; i < totalChunks; i++) { var thisChunkHeight = i < fullChunks ? FULL_CHUNK_HEIGHT : partialChunkHeight; var destPos = 3; for (var j = 0; j < thisChunkHeight; j++) { var mask = 0; for (var k = 0; k < width; k++) { if (!mask) { var elem = src[srcPos++]; mask = 128; } dest[destPos] = elem & mask ? 0 : 255; destPos += 4; mask >>= 1; } } ctx.putImageData(chunkImgData, 0, i * FULL_CHUNK_HEIGHT); } } function copyCtxState(sourceCtx, destCtx) { var properties = ['strokeStyle', 'fillStyle', 'fillRule', 'globalAlpha', 'lineWidth', 'lineCap', 'lineJoin', 'miterLimit', 'globalCompositeOperation', 'font']; for (var i = 0, ii = properties.length; i < ii; i++) { var property = properties[i]; if (sourceCtx[property] !== undefined) { destCtx[property] = sourceCtx[property]; } } if (sourceCtx.setLineDash !== undefined) { destCtx.setLineDash(sourceCtx.getLineDash()); destCtx.lineDashOffset = sourceCtx.lineDashOffset; } } function resetCtxToDefault(ctx) { ctx.strokeStyle = '#000000'; ctx.fillStyle = '#000000'; ctx.fillRule = 'nonzero'; ctx.globalAlpha = 1; ctx.lineWidth = 1; ctx.lineCap = 'butt'; ctx.lineJoin = 'miter'; ctx.miterLimit = 10; ctx.globalCompositeOperation = 'source-over'; ctx.font = '10px sans-serif'; if (ctx.setLineDash !== undefined) { ctx.setLineDash([]); ctx.lineDashOffset = 0; } } function composeSMaskBackdrop(bytes, r0, g0, b0) { var length = bytes.length; for (var i = 3; i < length; i += 4) { var alpha = bytes[i]; if (alpha === 0) { bytes[i - 3] = r0; bytes[i - 2] = g0; bytes[i - 1] = b0; } else if (alpha < 255) { var alpha_ = 255 - alpha; bytes[i - 3] = bytes[i - 3] * alpha + r0 * alpha_ >> 8; bytes[i - 2] = bytes[i - 2] * alpha + g0 * alpha_ >> 8; bytes[i - 1] = bytes[i - 1] * alpha + b0 * alpha_ >> 8; } } } function composeSMaskAlpha(maskData, layerData, transferMap) { var length = maskData.length; var scale = 1 / 255; for (var i = 3; i < length; i += 4) { var alpha = transferMap ? transferMap[maskData[i]] : maskData[i]; layerData[i] = layerData[i] * alpha * scale | 0; } } function composeSMaskLuminosity(maskData, layerData, transferMap) { var length = maskData.length; for (var i = 3; i < length; i += 4) { var y = maskData[i - 3] * 77 + maskData[i - 2] * 152 + maskData[i - 1] * 28; layerData[i] = transferMap ? layerData[i] * transferMap[y >> 8] >> 8 : layerData[i] * y >> 16; } } function genericComposeSMask(maskCtx, layerCtx, width, height, subtype, backdrop, transferMap) { var hasBackdrop = !!backdrop; var r0 = hasBackdrop ? backdrop[0] : 0; var g0 = hasBackdrop ? backdrop[1] : 0; var b0 = hasBackdrop ? backdrop[2] : 0; var composeFn; if (subtype === 'Luminosity') { composeFn = composeSMaskLuminosity; } else { composeFn = composeSMaskAlpha; } var PIXELS_TO_PROCESS = 1048576; var chunkSize = Math.min(height, Math.ceil(PIXELS_TO_PROCESS / width)); for (var row = 0; row < height; row += chunkSize) { var chunkHeight = Math.min(chunkSize, height - row); var maskData = maskCtx.getImageData(0, row, width, chunkHeight); var layerData = layerCtx.getImageData(0, row, width, chunkHeight); if (hasBackdrop) { composeSMaskBackdrop(maskData.data, r0, g0, b0); } composeFn(maskData.data, layerData.data, transferMap); maskCtx.putImageData(layerData, 0, row); } } function composeSMask(ctx, smask, layerCtx) { var mask = smask.canvas; var maskCtx = smask.context; ctx.setTransform(smask.scaleX, 0, 0, smask.scaleY, smask.offsetX, smask.offsetY); var backdrop = smask.backdrop || null; if (!smask.transferMap && _webgl.WebGLUtils.isEnabled) { var composed = _webgl.WebGLUtils.composeSMask(layerCtx.canvas, mask, { subtype: smask.subtype, backdrop: backdrop }); ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.drawImage(composed, smask.offsetX, smask.offsetY); return; } genericComposeSMask(maskCtx, layerCtx, mask.width, mask.height, smask.subtype, backdrop, smask.transferMap); ctx.drawImage(mask, 0, 0); } var LINE_CAP_STYLES = ['butt', 'round', 'square']; var LINE_JOIN_STYLES = ['miter', 'round', 'bevel']; var NORMAL_CLIP = {}; var EO_CLIP = {}; CanvasGraphics.prototype = { beginDrawing: function beginDrawing(_ref) { var transform = _ref.transform, viewport = _ref.viewport, transparency = _ref.transparency, _ref$background = _ref.background, background = _ref$background === undefined ? null : _ref$background; var width = this.ctx.canvas.width; var height = this.ctx.canvas.height; this.ctx.save(); this.ctx.fillStyle = background || 'rgb(255, 255, 255)'; this.ctx.fillRect(0, 0, width, height); this.ctx.restore(); if (transparency) { var transparentCanvas = this.cachedCanvases.getCanvas('transparent', width, height, true); this.compositeCtx = this.ctx; this.transparentCanvas = transparentCanvas.canvas; this.ctx = transparentCanvas.context; this.ctx.save(); this.ctx.transform.apply(this.ctx, this.compositeCtx.mozCurrentTransform); } this.ctx.save(); resetCtxToDefault(this.ctx); if (transform) { this.ctx.transform.apply(this.ctx, transform); } this.ctx.transform.apply(this.ctx, viewport.transform); this.baseTransform = this.ctx.mozCurrentTransform.slice(); if (this.imageLayer) { this.imageLayer.beginLayout(); } }, executeOperatorList: function CanvasGraphics_executeOperatorList(operatorList, executionStartIdx, continueCallback, stepper) { var argsArray = operatorList.argsArray; var fnArray = operatorList.fnArray; var i = executionStartIdx || 0; var argsArrayLen = argsArray.length; if (argsArrayLen === i) { return i; } var chunkOperations = argsArrayLen - i > EXECUTION_STEPS && typeof continueCallback === 'function'; var endTime = chunkOperations ? Date.now() + EXECUTION_TIME : 0; var steps = 0; var commonObjs = this.commonObjs; var objs = this.objs; var fnId; while (true) { if (stepper !== undefined && i === stepper.nextBreakPoint) { stepper.breakIt(i, continueCallback); return i; } fnId = fnArray[i]; if (fnId !== _util.OPS.dependency) { this[fnId].apply(this, argsArray[i]); } else { var deps = argsArray[i]; for (var n = 0, nn = deps.length; n < nn; n++) { var depObjId = deps[n]; var common = depObjId[0] === 'g' && depObjId[1] === '_'; var objsPool = common ? commonObjs : objs; if (!objsPool.isResolved(depObjId)) { objsPool.get(depObjId, continueCallback); return i; } } } i++; if (i === argsArrayLen) { return i; } if (chunkOperations && ++steps > EXECUTION_STEPS) { if (Date.now() > endTime) { continueCallback(); return i; } steps = 0; } } }, endDrawing: function CanvasGraphics_endDrawing() { if (this.current.activeSMask !== null) { this.endSMaskGroup(); } this.ctx.restore(); if (this.transparentCanvas) { this.ctx = this.compositeCtx; this.ctx.save(); this.ctx.setTransform(1, 0, 0, 1, 0, 0); this.ctx.drawImage(this.transparentCanvas, 0, 0); this.ctx.restore(); this.transparentCanvas = null; } this.cachedCanvases.clear(); _webgl.WebGLUtils.clear(); if (this.imageLayer) { this.imageLayer.endLayout(); } }, setLineWidth: function CanvasGraphics_setLineWidth(width) { this.current.lineWidth = width; this.ctx.lineWidth = width; }, setLineCap: function CanvasGraphics_setLineCap(style) { this.ctx.lineCap = LINE_CAP_STYLES[style]; }, setLineJoin: function CanvasGraphics_setLineJoin(style) { this.ctx.lineJoin = LINE_JOIN_STYLES[style]; }, setMiterLimit: function CanvasGraphics_setMiterLimit(limit) { this.ctx.miterLimit = limit; }, setDash: function CanvasGraphics_setDash(dashArray, dashPhase) { var ctx = this.ctx; if (ctx.setLineDash !== undefined) { ctx.setLineDash(dashArray); ctx.lineDashOffset = dashPhase; } }, setRenderingIntent: function CanvasGraphics_setRenderingIntent(intent) {}, setFlatness: function CanvasGraphics_setFlatness(flatness) {}, setGState: function CanvasGraphics_setGState(states) { for (var i = 0, ii = states.length; i < ii; i++) { var state = states[i]; var key = state[0]; var value = state[1]; switch (key) { case 'LW': this.setLineWidth(value); break; case 'LC': this.setLineCap(value); break; case 'LJ': this.setLineJoin(value); break; case 'ML': this.setMiterLimit(value); break; case 'D': this.setDash(value[0], value[1]); break; case 'RI': this.setRenderingIntent(value); break; case 'FL': this.setFlatness(value); break; case 'Font': this.setFont(value[0], value[1]); break; case 'CA': this.current.strokeAlpha = state[1]; break; case 'ca': this.current.fillAlpha = state[1]; this.ctx.globalAlpha = state[1]; break; case 'BM': this.ctx.globalCompositeOperation = value; break; case 'SMask': if (this.current.activeSMask) { if (this.stateStack.length > 0 && this.stateStack[this.stateStack.length - 1].activeSMask === this.current.activeSMask) { this.suspendSMaskGroup(); } else { this.endSMaskGroup(); } } this.current.activeSMask = value ? this.tempSMask : null; if (this.current.activeSMask) { this.beginSMaskGroup(); } this.tempSMask = null; break; } } }, beginSMaskGroup: function CanvasGraphics_beginSMaskGroup() { var activeSMask = this.current.activeSMask; var drawnWidth = activeSMask.canvas.width; var drawnHeight = activeSMask.canvas.height; var cacheId = 'smaskGroupAt' + this.groupLevel; var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true); var currentCtx = this.ctx; var currentTransform = currentCtx.mozCurrentTransform; this.ctx.save(); var groupCtx = scratchCanvas.context; groupCtx.scale(1 / activeSMask.scaleX, 1 / activeSMask.scaleY); groupCtx.translate(-activeSMask.offsetX, -activeSMask.offsetY); groupCtx.transform.apply(groupCtx, currentTransform); activeSMask.startTransformInverse = groupCtx.mozCurrentTransformInverse; copyCtxState(currentCtx, groupCtx); this.ctx = groupCtx; this.setGState([['BM', 'source-over'], ['ca', 1], ['CA', 1]]); this.groupStack.push(currentCtx); this.groupLevel++; }, suspendSMaskGroup: function CanvasGraphics_endSMaskGroup() { var groupCtx = this.ctx; this.groupLevel--; this.ctx = this.groupStack.pop(); composeSMask(this.ctx, this.current.activeSMask, groupCtx); this.ctx.restore(); this.ctx.save(); copyCtxState(groupCtx, this.ctx); this.current.resumeSMaskCtx = groupCtx; var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform); this.ctx.transform.apply(this.ctx, deltaTransform); groupCtx.save(); groupCtx.setTransform(1, 0, 0, 1, 0, 0); groupCtx.clearRect(0, 0, groupCtx.canvas.width, groupCtx.canvas.height); groupCtx.restore(); }, resumeSMaskGroup: function CanvasGraphics_endSMaskGroup() { var groupCtx = this.current.resumeSMaskCtx; var currentCtx = this.ctx; this.ctx = groupCtx; this.groupStack.push(currentCtx); this.groupLevel++; }, endSMaskGroup: function CanvasGraphics_endSMaskGroup() { var groupCtx = this.ctx; this.groupLevel--; this.ctx = this.groupStack.pop(); composeSMask(this.ctx, this.current.activeSMask, groupCtx); this.ctx.restore(); copyCtxState(groupCtx, this.ctx); var deltaTransform = _util.Util.transform(this.current.activeSMask.startTransformInverse, groupCtx.mozCurrentTransform); this.ctx.transform.apply(this.ctx, deltaTransform); }, save: function CanvasGraphics_save() { this.ctx.save(); var old = this.current; this.stateStack.push(old); this.current = old.clone(); this.current.resumeSMaskCtx = null; }, restore: function CanvasGraphics_restore() { if (this.current.resumeSMaskCtx) { this.resumeSMaskGroup(); } if (this.current.activeSMask !== null && (this.stateStack.length === 0 || this.stateStack[this.stateStack.length - 1].activeSMask !== this.current.activeSMask)) { this.endSMaskGroup(); } if (this.stateStack.length !== 0) { this.current = this.stateStack.pop(); this.ctx.restore(); this.pendingClip = null; this.cachedGetSinglePixelWidth = null; } }, transform: function CanvasGraphics_transform(a, b, c, d, e, f) { this.ctx.transform(a, b, c, d, e, f); this.cachedGetSinglePixelWidth = null; }, constructPath: function CanvasGraphics_constructPath(ops, args) { var ctx = this.ctx; var current = this.current; var x = current.x, y = current.y; for (var i = 0, j = 0, ii = ops.length; i < ii; i++) { switch (ops[i] | 0) { case _util.OPS.rectangle: x = args[j++]; y = args[j++]; var width = args[j++]; var height = args[j++]; if (width === 0) { width = this.getSinglePixelWidth(); } if (height === 0) { height = this.getSinglePixelWidth(); } var xw = x + width; var yh = y + height; this.ctx.moveTo(x, y); this.ctx.lineTo(xw, y); this.ctx.lineTo(xw, yh); this.ctx.lineTo(x, yh); this.ctx.lineTo(x, y); this.ctx.closePath(); break; case _util.OPS.moveTo: x = args[j++]; y = args[j++]; ctx.moveTo(x, y); break; case _util.OPS.lineTo: x = args[j++]; y = args[j++]; ctx.lineTo(x, y); break; case _util.OPS.curveTo: x = args[j + 4]; y = args[j + 5]; ctx.bezierCurveTo(args[j], args[j + 1], args[j + 2], args[j + 3], x, y); j += 6; break; case _util.OPS.curveTo2: ctx.bezierCurveTo(x, y, args[j], args[j + 1], args[j + 2], args[j + 3]); x = args[j + 2]; y = args[j + 3]; j += 4; break; case _util.OPS.curveTo3: x = args[j + 2]; y = args[j + 3]; ctx.bezierCurveTo(args[j], args[j + 1], x, y, x, y); j += 4; break; case _util.OPS.closePath: ctx.closePath(); break; } } current.setCurrentPoint(x, y); }, closePath: function CanvasGraphics_closePath() { this.ctx.closePath(); }, stroke: function CanvasGraphics_stroke(consumePath) { consumePath = typeof consumePath !== 'undefined' ? consumePath : true; var ctx = this.ctx; var strokeColor = this.current.strokeColor; ctx.lineWidth = Math.max(this.getSinglePixelWidth() * MIN_WIDTH_FACTOR, this.current.lineWidth); ctx.globalAlpha = this.current.strokeAlpha; if (strokeColor && strokeColor.hasOwnProperty('type') && strokeColor.type === 'Pattern') { ctx.save(); ctx.strokeStyle = strokeColor.getPattern(ctx, this); ctx.stroke(); ctx.restore(); } else { ctx.stroke(); } if (consumePath) { this.consumePath(); } ctx.globalAlpha = this.current.fillAlpha; }, closeStroke: function CanvasGraphics_closeStroke() { this.closePath(); this.stroke(); }, fill: function CanvasGraphics_fill(consumePath) { consumePath = typeof consumePath !== 'undefined' ? consumePath : true; var ctx = this.ctx; var fillColor = this.current.fillColor; var isPatternFill = this.current.patternFill; var needRestore = false; if (isPatternFill) { ctx.save(); if (this.baseTransform) { ctx.setTransform.apply(ctx, this.baseTransform); } ctx.fillStyle = fillColor.getPattern(ctx, this); needRestore = true; } if (this.pendingEOFill) { ctx.fill('evenodd'); this.pendingEOFill = false; } else { ctx.fill(); } if (needRestore) { ctx.restore(); } if (consumePath) { this.consumePath(); } }, eoFill: function CanvasGraphics_eoFill() { this.pendingEOFill = true; this.fill(); }, fillStroke: function CanvasGraphics_fillStroke() { this.fill(false); this.stroke(false); this.consumePath(); }, eoFillStroke: function CanvasGraphics_eoFillStroke() { this.pendingEOFill = true; this.fillStroke(); }, closeFillStroke: function CanvasGraphics_closeFillStroke() { this.closePath(); this.fillStroke(); }, closeEOFillStroke: function CanvasGraphics_closeEOFillStroke() { this.pendingEOFill = true; this.closePath(); this.fillStroke(); }, endPath: function CanvasGraphics_endPath() { this.consumePath(); }, clip: function CanvasGraphics_clip() { this.pendingClip = NORMAL_CLIP; }, eoClip: function CanvasGraphics_eoClip() { this.pendingClip = EO_CLIP; }, beginText: function CanvasGraphics_beginText() { this.current.textMatrix = _util.IDENTITY_MATRIX; this.current.textMatrixScale = 1; this.current.x = this.current.lineX = 0; this.current.y = this.current.lineY = 0; }, endText: function CanvasGraphics_endText() { var paths = this.pendingTextPaths; var ctx = this.ctx; if (paths === undefined) { ctx.beginPath(); return; } ctx.save(); ctx.beginPath(); for (var i = 0; i < paths.length; i++) { var path = paths[i]; ctx.setTransform.apply(ctx, path.transform); ctx.translate(path.x, path.y); path.addToPath(ctx, path.fontSize); } ctx.restore(); ctx.clip(); ctx.beginPath(); delete this.pendingTextPaths; }, setCharSpacing: function CanvasGraphics_setCharSpacing(spacing) { this.current.charSpacing = spacing; }, setWordSpacing: function CanvasGraphics_setWordSpacing(spacing) { this.current.wordSpacing = spacing; }, setHScale: function CanvasGraphics_setHScale(scale) { this.current.textHScale = scale / 100; }, setLeading: function CanvasGraphics_setLeading(leading) { this.current.leading = -leading; }, setFont: function CanvasGraphics_setFont(fontRefName, size) { var fontObj = this.commonObjs.get(fontRefName); var current = this.current; if (!fontObj) { throw new Error('Can\'t find font for ' + fontRefName); } current.fontMatrix = fontObj.fontMatrix ? fontObj.fontMatrix : _util.FONT_IDENTITY_MATRIX; if (current.fontMatrix[0] === 0 || current.fontMatrix[3] === 0) { (0, _util.warn)('Invalid font matrix for font ' + fontRefName); } if (size < 0) { size = -size; current.fontDirection = -1; } else { current.fontDirection = 1; } this.current.font = fontObj; this.current.fontSize = size; if (fontObj.isType3Font) { return; } var name = fontObj.loadedName || 'sans-serif'; var bold = fontObj.black ? '900' : fontObj.bold ? 'bold' : 'normal'; var italic = fontObj.italic ? 'italic' : 'normal'; var typeface = '"' + name + '", ' + fontObj.fallbackName; var browserFontSize = size < MIN_FONT_SIZE ? MIN_FONT_SIZE : size > MAX_FONT_SIZE ? MAX_FONT_SIZE : size; this.current.fontSizeScale = size / browserFontSize; var rule = italic + ' ' + bold + ' ' + browserFontSize + 'px ' + typeface; this.ctx.font = rule; }, setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) { this.current.textRenderingMode = mode; }, setTextRise: function CanvasGraphics_setTextRise(rise) { this.current.textRise = rise; }, moveText: function CanvasGraphics_moveText(x, y) { this.current.x = this.current.lineX += x; this.current.y = this.current.lineY += y; }, setLeadingMoveText: function CanvasGraphics_setLeadingMoveText(x, y) { this.setLeading(-y); this.moveText(x, y); }, setTextMatrix: function CanvasGraphics_setTextMatrix(a, b, c, d, e, f) { this.current.textMatrix = [a, b, c, d, e, f]; this.current.textMatrixScale = Math.sqrt(a * a + b * b); this.current.x = this.current.lineX = 0; this.current.y = this.current.lineY = 0; }, nextLine: function CanvasGraphics_nextLine() { this.moveText(0, this.current.leading); }, paintChar: function CanvasGraphics_paintChar(character, x, y) { var ctx = this.ctx; var current = this.current; var font = current.font; var textRenderingMode = current.textRenderingMode; var fontSize = current.fontSize / current.fontSizeScale; var fillStrokeMode = textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; var isAddToPathSet = !!(textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG); var addToPath; if (font.disableFontFace || isAddToPathSet) { addToPath = font.getPathGenerator(this.commonObjs, character); } if (font.disableFontFace) { ctx.save(); ctx.translate(x, y); ctx.beginPath(); addToPath(ctx, fontSize); if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { ctx.fill(); } if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { ctx.stroke(); } ctx.restore(); } else { if (fillStrokeMode === _util.TextRenderingMode.FILL || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { ctx.fillText(character, x, y); } if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { ctx.strokeText(character, x, y); } } if (isAddToPathSet) { var paths = this.pendingTextPaths || (this.pendingTextPaths = []); paths.push({ transform: ctx.mozCurrentTransform, x: x, y: y, fontSize: fontSize, addToPath: addToPath }); } }, get isFontSubpixelAAEnabled() { var ctx = this.canvasFactory.create(10, 10).context; ctx.scale(1.5, 1); ctx.fillText('I', 0, 10); var data = ctx.getImageData(0, 0, 10, 10).data; var enabled = false; for (var i = 3; i < data.length; i += 4) { if (data[i] > 0 && data[i] < 255) { enabled = true; break; } } return (0, _util.shadow)(this, 'isFontSubpixelAAEnabled', enabled); }, showText: function CanvasGraphics_showText(glyphs) { var current = this.current; var font = current.font; if (font.isType3Font) { return this.showType3Text(glyphs); } var fontSize = current.fontSize; if (fontSize === 0) { return; } var ctx = this.ctx; var fontSizeScale = current.fontSizeScale; var charSpacing = current.charSpacing; var wordSpacing = current.wordSpacing; var fontDirection = current.fontDirection; var textHScale = current.textHScale * fontDirection; var glyphsLength = glyphs.length; var vertical = font.vertical; var spacingDir = vertical ? 1 : -1; var defaultVMetrics = font.defaultVMetrics; var widthAdvanceScale = fontSize * current.fontMatrix[0]; var simpleFillText = current.textRenderingMode === _util.TextRenderingMode.FILL && !font.disableFontFace; ctx.save(); ctx.transform.apply(ctx, current.textMatrix); ctx.translate(current.x, current.y + current.textRise); if (current.patternFill) { ctx.fillStyle = current.fillColor.getPattern(ctx, this); } if (fontDirection > 0) { ctx.scale(textHScale, -1); } else { ctx.scale(textHScale, 1); } var lineWidth = current.lineWidth; var scale = current.textMatrixScale; if (scale === 0 || lineWidth === 0) { var fillStrokeMode = current.textRenderingMode & _util.TextRenderingMode.FILL_STROKE_MASK; if (fillStrokeMode === _util.TextRenderingMode.STROKE || fillStrokeMode === _util.TextRenderingMode.FILL_STROKE) { this.cachedGetSinglePixelWidth = null; lineWidth = this.getSinglePixelWidth() * MIN_WIDTH_FACTOR; } } else { lineWidth /= scale; } if (fontSizeScale !== 1.0) { ctx.scale(fontSizeScale, fontSizeScale); lineWidth /= fontSizeScale; } ctx.lineWidth = lineWidth; var x = 0, i; for (i = 0; i < glyphsLength; ++i) { var glyph = glyphs[i]; if ((0, _util.isNum)(glyph)) { x += spacingDir * glyph * fontSize / 1000; continue; } var restoreNeeded = false; var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; var character = glyph.fontChar; var accent = glyph.accent; var scaledX, scaledY, scaledAccentX, scaledAccentY; var width = glyph.width; if (vertical) { var vmetric, vx, vy; vmetric = glyph.vmetric || defaultVMetrics; vx = glyph.vmetric ? vmetric[1] : width * 0.5; vx = -vx * widthAdvanceScale; vy = vmetric[2] * widthAdvanceScale; width = vmetric ? -vmetric[0] : width; scaledX = vx / fontSizeScale; scaledY = (x + vy) / fontSizeScale; } else { scaledX = x / fontSizeScale; scaledY = 0; } if (font.remeasure && width > 0) { var measuredWidth = ctx.measureText(character).width * 1000 / fontSize * fontSizeScale; if (width < measuredWidth && this.isFontSubpixelAAEnabled) { var characterScaleX = width / measuredWidth; restoreNeeded = true; ctx.save(); ctx.scale(characterScaleX, 1); scaledX /= characterScaleX; } else if (width !== measuredWidth) { scaledX += (width - measuredWidth) / 2000 * fontSize / fontSizeScale; } } if (glyph.isInFont || font.missingFile) { if (simpleFillText && !accent) { ctx.fillText(character, scaledX, scaledY); } else { this.paintChar(character, scaledX, scaledY); if (accent) { scaledAccentX = scaledX + accent.offset.x / fontSizeScale; scaledAccentY = scaledY - accent.offset.y / fontSizeScale; this.paintChar(accent.fontChar, scaledAccentX, scaledAccentY); } } } var charWidth = width * widthAdvanceScale + spacing * fontDirection; x += charWidth; if (restoreNeeded) { ctx.restore(); } } if (vertical) { current.y -= x * textHScale; } else { current.x += x * textHScale; } ctx.restore(); }, showType3Text: function CanvasGraphics_showType3Text(glyphs) { var ctx = this.ctx; var current = this.current; var font = current.font; var fontSize = current.fontSize; var fontDirection = current.fontDirection; var spacingDir = font.vertical ? 1 : -1; var charSpacing = current.charSpacing; var wordSpacing = current.wordSpacing; var textHScale = current.textHScale * fontDirection; var fontMatrix = current.fontMatrix || _util.FONT_IDENTITY_MATRIX; var glyphsLength = glyphs.length; var isTextInvisible = current.textRenderingMode === _util.TextRenderingMode.INVISIBLE; var i, glyph, width, spacingLength; if (isTextInvisible || fontSize === 0) { return; } this.cachedGetSinglePixelWidth = null; ctx.save(); ctx.transform.apply(ctx, current.textMatrix); ctx.translate(current.x, current.y); ctx.scale(textHScale, fontDirection); for (i = 0; i < glyphsLength; ++i) { glyph = glyphs[i]; if ((0, _util.isNum)(glyph)) { spacingLength = spacingDir * glyph * fontSize / 1000; this.ctx.translate(spacingLength, 0); current.x += spacingLength * textHScale; continue; } var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing; var operatorList = font.charProcOperatorList[glyph.operatorListId]; if (!operatorList) { (0, _util.warn)('Type3 character "' + glyph.operatorListId + '" is not available.'); continue; } this.processingType3 = glyph; this.save(); ctx.scale(fontSize, fontSize); ctx.transform.apply(ctx, fontMatrix); this.executeOperatorList(operatorList); this.restore(); var transformed = _util.Util.applyTransform([glyph.width, 0], fontMatrix); width = transformed[0] * fontSize + spacing; ctx.translate(width, 0); current.x += width * textHScale; } ctx.restore(); this.processingType3 = null; }, setCharWidth: function CanvasGraphics_setCharWidth(xWidth, yWidth) {}, setCharWidthAndBounds: function CanvasGraphics_setCharWidthAndBounds(xWidth, yWidth, llx, lly, urx, ury) { this.ctx.rect(llx, lly, urx - llx, ury - lly); this.clip(); this.endPath(); }, getColorN_Pattern: function CanvasGraphics_getColorN_Pattern(IR) { var _this = this; var pattern; if (IR[0] === 'TilingPattern') { var color = IR[1]; var baseTransform = this.baseTransform || this.ctx.mozCurrentTransform.slice(); var canvasGraphicsFactory = { createCanvasGraphics: function createCanvasGraphics(ctx) { return new CanvasGraphics(ctx, _this.commonObjs, _this.objs, _this.canvasFactory); } }; pattern = new _pattern_helper.TilingPattern(IR, color, this.ctx, canvasGraphicsFactory, baseTransform); } else { pattern = (0, _pattern_helper.getShadingPatternFromIR)(IR); } return pattern; }, setStrokeColorN: function CanvasGraphics_setStrokeColorN() { this.current.strokeColor = this.getColorN_Pattern(arguments); }, setFillColorN: function CanvasGraphics_setFillColorN() { this.current.fillColor = this.getColorN_Pattern(arguments); this.current.patternFill = true; }, setStrokeRGBColor: function CanvasGraphics_setStrokeRGBColor(r, g, b) { var color = _util.Util.makeCssRgb(r, g, b); this.ctx.strokeStyle = color; this.current.strokeColor = color; }, setFillRGBColor: function CanvasGraphics_setFillRGBColor(r, g, b) { var color = _util.Util.makeCssRgb(r, g, b); this.ctx.fillStyle = color; this.current.fillColor = color; this.current.patternFill = false; }, shadingFill: function CanvasGraphics_shadingFill(patternIR) { var ctx = this.ctx; this.save(); var pattern = (0, _pattern_helper.getShadingPatternFromIR)(patternIR); ctx.fillStyle = pattern.getPattern(ctx, this, true); var inv = ctx.mozCurrentTransformInverse; if (inv) { var canvas = ctx.canvas; var width = canvas.width; var height = canvas.height; var bl = _util.Util.applyTransform([0, 0], inv); var br = _util.Util.applyTransform([0, height], inv); var ul = _util.Util.applyTransform([width, 0], inv); var ur = _util.Util.applyTransform([width, height], inv); var x0 = Math.min(bl[0], br[0], ul[0], ur[0]); var y0 = Math.min(bl[1], br[1], ul[1], ur[1]); var x1 = Math.max(bl[0], br[0], ul[0], ur[0]); var y1 = Math.max(bl[1], br[1], ul[1], ur[1]); this.ctx.fillRect(x0, y0, x1 - x0, y1 - y0); } else { this.ctx.fillRect(-1e10, -1e10, 2e10, 2e10); } this.restore(); }, beginInlineImage: function CanvasGraphics_beginInlineImage() { throw new Error('Should not call beginInlineImage'); }, beginImageData: function CanvasGraphics_beginImageData() { throw new Error('Should not call beginImageData'); }, paintFormXObjectBegin: function CanvasGraphics_paintFormXObjectBegin(matrix, bbox) { this.save(); this.baseTransformStack.push(this.baseTransform); if (Array.isArray(matrix) && matrix.length === 6) { this.transform.apply(this, matrix); } this.baseTransform = this.ctx.mozCurrentTransform; if (Array.isArray(bbox) && bbox.length === 4) { var width = bbox[2] - bbox[0]; var height = bbox[3] - bbox[1]; this.ctx.rect(bbox[0], bbox[1], width, height); this.clip(); this.endPath(); } }, paintFormXObjectEnd: function CanvasGraphics_paintFormXObjectEnd() { this.restore(); this.baseTransform = this.baseTransformStack.pop(); }, beginGroup: function CanvasGraphics_beginGroup(group) { this.save(); var currentCtx = this.ctx; if (!group.isolated) { (0, _util.info)('TODO: Support non-isolated groups.'); } if (group.knockout) { (0, _util.warn)('Knockout groups not supported.'); } var currentTransform = currentCtx.mozCurrentTransform; if (group.matrix) { currentCtx.transform.apply(currentCtx, group.matrix); } if (!group.bbox) { throw new Error('Bounding box is required.'); } var bounds = _util.Util.getAxialAlignedBoundingBox(group.bbox, currentCtx.mozCurrentTransform); var canvasBounds = [0, 0, currentCtx.canvas.width, currentCtx.canvas.height]; bounds = _util.Util.intersect(bounds, canvasBounds) || [0, 0, 0, 0]; var offsetX = Math.floor(bounds[0]); var offsetY = Math.floor(bounds[1]); var drawnWidth = Math.max(Math.ceil(bounds[2]) - offsetX, 1); var drawnHeight = Math.max(Math.ceil(bounds[3]) - offsetY, 1); var scaleX = 1, scaleY = 1; if (drawnWidth > MAX_GROUP_SIZE) { scaleX = drawnWidth / MAX_GROUP_SIZE; drawnWidth = MAX_GROUP_SIZE; } if (drawnHeight > MAX_GROUP_SIZE) { scaleY = drawnHeight / MAX_GROUP_SIZE; drawnHeight = MAX_GROUP_SIZE; } var cacheId = 'groupAt' + this.groupLevel; if (group.smask) { cacheId += '_smask_' + this.smaskCounter++ % 2; } var scratchCanvas = this.cachedCanvases.getCanvas(cacheId, drawnWidth, drawnHeight, true); var groupCtx = scratchCanvas.context; groupCtx.scale(1 / scaleX, 1 / scaleY); groupCtx.translate(-offsetX, -offsetY); groupCtx.transform.apply(groupCtx, currentTransform); if (group.smask) { this.smaskStack.push({ canvas: scratchCanvas.canvas, context: groupCtx, offsetX: offsetX, offsetY: offsetY, scaleX: scaleX, scaleY: scaleY, subtype: group.smask.subtype, backdrop: group.smask.backdrop, transferMap: group.smask.transferMap || null, startTransformInverse: null }); } else { currentCtx.setTransform(1, 0, 0, 1, 0, 0); currentCtx.translate(offsetX, offsetY); currentCtx.scale(scaleX, scaleY); } copyCtxState(currentCtx, groupCtx); this.ctx = groupCtx; this.setGState([['BM', 'source-over'], ['ca', 1], ['CA', 1]]); this.groupStack.push(currentCtx); this.groupLevel++; this.current.activeSMask = null; }, endGroup: function CanvasGraphics_endGroup(group) { this.groupLevel--; var groupCtx = this.ctx; this.ctx = this.groupStack.pop(); if (this.ctx.imageSmoothingEnabled !== undefined) { this.ctx.imageSmoothingEnabled = false; } else { this.ctx.mozImageSmoothingEnabled = false; } if (group.smask) { this.tempSMask = this.smaskStack.pop(); } else { this.ctx.drawImage(groupCtx.canvas, 0, 0); } this.restore(); }, beginAnnotations: function CanvasGraphics_beginAnnotations() { this.save(); if (this.baseTransform) { this.ctx.setTransform.apply(this.ctx, this.baseTransform); } }, endAnnotations: function CanvasGraphics_endAnnotations() { this.restore(); }, beginAnnotation: function CanvasGraphics_beginAnnotation(rect, transform, matrix) { this.save(); resetCtxToDefault(this.ctx); this.current = new CanvasExtraState(); if (Array.isArray(rect) && rect.length === 4) { var width = rect[2] - rect[0]; var height = rect[3] - rect[1]; this.ctx.rect(rect[0], rect[1], width, height); this.clip(); this.endPath(); } this.transform.apply(this, transform); this.transform.apply(this, matrix); }, endAnnotation: function CanvasGraphics_endAnnotation() { this.restore(); }, paintJpegXObject: function CanvasGraphics_paintJpegXObject(objId, w, h) { var domImage = this.objs.get(objId); if (!domImage) { (0, _util.warn)('Dependent image isn\'t ready yet'); return; } this.save(); var ctx = this.ctx; ctx.scale(1 / w, -1 / h); ctx.drawImage(domImage, 0, 0, domImage.width, domImage.height, 0, -h, w, h); if (this.imageLayer) { var currentTransform = ctx.mozCurrentTransformInverse; var position = this.getCanvasPosition(0, 0); this.imageLayer.appendImage({ objId: objId, left: position[0], top: position[1], width: w / currentTransform[0], height: h / currentTransform[3] }); } this.restore(); }, paintImageMaskXObject: function CanvasGraphics_paintImageMaskXObject(img) { var ctx = this.ctx; var width = img.width, height = img.height; var fillColor = this.current.fillColor; var isPatternFill = this.current.patternFill; var glyph = this.processingType3; if (COMPILE_TYPE3_GLYPHS && glyph && glyph.compiled === undefined) { if (width <= MAX_SIZE_TO_COMPILE && height <= MAX_SIZE_TO_COMPILE) { glyph.compiled = compileType3Glyph({ data: img.data, width: width, height: height }); } else { glyph.compiled = null; } } if (glyph && glyph.compiled) { glyph.compiled(ctx); return; } var maskCanvas = this.cachedCanvases.getCanvas('maskCanvas', width, height); var maskCtx = maskCanvas.context; maskCtx.save(); putBinaryImageMask(maskCtx, img); maskCtx.globalCompositeOperation = 'source-in'; maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; maskCtx.fillRect(0, 0, width, height); maskCtx.restore(); this.paintInlineImageXObject(maskCanvas.canvas); }, paintImageMaskXObjectRepeat: function CanvasGraphics_paintImageMaskXObjectRepeat(imgData, scaleX, scaleY, positions) { var width = imgData.width; var height = imgData.height; var fillColor = this.current.fillColor; var isPatternFill = this.current.patternFill; var maskCanvas = this.cachedCanvases.getCanvas('maskCanvas', width, height); var maskCtx = maskCanvas.context; maskCtx.save(); putBinaryImageMask(maskCtx, imgData); maskCtx.globalCompositeOperation = 'source-in'; maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; maskCtx.fillRect(0, 0, width, height); maskCtx.restore(); var ctx = this.ctx; for (var i = 0, ii = positions.length; i < ii; i += 2) { ctx.save(); ctx.transform(scaleX, 0, 0, scaleY, positions[i], positions[i + 1]); ctx.scale(1, -1); ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1); ctx.restore(); } }, paintImageMaskXObjectGroup: function CanvasGraphics_paintImageMaskXObjectGroup(images) { var ctx = this.ctx; var fillColor = this.current.fillColor; var isPatternFill = this.current.patternFill; for (var i = 0, ii = images.length; i < ii; i++) { var image = images[i]; var width = image.width, height = image.height; var maskCanvas = this.cachedCanvases.getCanvas('maskCanvas', width, height); var maskCtx = maskCanvas.context; maskCtx.save(); putBinaryImageMask(maskCtx, image); maskCtx.globalCompositeOperation = 'source-in'; maskCtx.fillStyle = isPatternFill ? fillColor.getPattern(maskCtx, this) : fillColor; maskCtx.fillRect(0, 0, width, height); maskCtx.restore(); ctx.save(); ctx.transform.apply(ctx, image.transform); ctx.scale(1, -1); ctx.drawImage(maskCanvas.canvas, 0, 0, width, height, 0, -1, 1, 1); ctx.restore(); } }, paintImageXObject: function CanvasGraphics_paintImageXObject(objId) { var imgData = this.objs.get(objId); if (!imgData) { (0, _util.warn)('Dependent image isn\'t ready yet'); return; } this.paintInlineImageXObject(imgData); }, paintImageXObjectRepeat: function CanvasGraphics_paintImageXObjectRepeat(objId, scaleX, scaleY, positions) { var imgData = this.objs.get(objId); if (!imgData) { (0, _util.warn)('Dependent image isn\'t ready yet'); return; } var width = imgData.width; var height = imgData.height; var map = []; for (var i = 0, ii = positions.length; i < ii; i += 2) { map.push({ transform: [scaleX, 0, 0, scaleY, positions[i], positions[i + 1]], x: 0, y: 0, w: width, h: height }); } this.paintInlineImageXObjectGroup(imgData, map); }, paintInlineImageXObject: function CanvasGraphics_paintInlineImageXObject(imgData) { var width = imgData.width; var height = imgData.height; var ctx = this.ctx; this.save(); ctx.scale(1 / width, -1 / height); var currentTransform = ctx.mozCurrentTransformInverse; var a = currentTransform[0], b = currentTransform[1]; var widthScale = Math.max(Math.sqrt(a * a + b * b), 1); var c = currentTransform[2], d = currentTransform[3]; var heightScale = Math.max(Math.sqrt(c * c + d * d), 1); var imgToPaint, tmpCanvas; if (imgData instanceof HTMLElement || !imgData.data) { imgToPaint = imgData; } else { tmpCanvas = this.cachedCanvases.getCanvas('inlineImage', width, height); var tmpCtx = tmpCanvas.context; putBinaryImageData(tmpCtx, imgData); imgToPaint = tmpCanvas.canvas; } var paintWidth = width, paintHeight = height; var tmpCanvasId = 'prescale1'; while (widthScale > 2 && paintWidth > 1 || heightScale > 2 && paintHeight > 1) { var newWidth = paintWidth, newHeight = paintHeight; if (widthScale > 2 && paintWidth > 1) { newWidth = Math.ceil(paintWidth / 2); widthScale /= paintWidth / newWidth; } if (heightScale > 2 && paintHeight > 1) { newHeight = Math.ceil(paintHeight / 2); heightScale /= paintHeight / newHeight; } tmpCanvas = this.cachedCanvases.getCanvas(tmpCanvasId, newWidth, newHeight); tmpCtx = tmpCanvas.context; tmpCtx.clearRect(0, 0, newWidth, newHeight); tmpCtx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, 0, 0, newWidth, newHeight); imgToPaint = tmpCanvas.canvas; paintWidth = newWidth; paintHeight = newHeight; tmpCanvasId = tmpCanvasId === 'prescale1' ? 'prescale2' : 'prescale1'; } ctx.drawImage(imgToPaint, 0, 0, paintWidth, paintHeight, 0, -height, width, height); if (this.imageLayer) { var position = this.getCanvasPosition(0, -height); this.imageLayer.appendImage({ imgData: imgData, left: position[0], top: position[1], width: width / currentTransform[0], height: height / currentTransform[3] }); } this.restore(); }, paintInlineImageXObjectGroup: function CanvasGraphics_paintInlineImageXObjectGroup(imgData, map) { var ctx = this.ctx; var w = imgData.width; var h = imgData.height; var tmpCanvas = this.cachedCanvases.getCanvas('inlineImage', w, h); var tmpCtx = tmpCanvas.context; putBinaryImageData(tmpCtx, imgData); for (var i = 0, ii = map.length; i < ii; i++) { var entry = map[i]; ctx.save(); ctx.transform.apply(ctx, entry.transform); ctx.scale(1, -1); ctx.drawImage(tmpCanvas.canvas, entry.x, entry.y, entry.w, entry.h, 0, -1, 1, 1); if (this.imageLayer) { var position = this.getCanvasPosition(entry.x, entry.y); this.imageLayer.appendImage({ imgData: imgData, left: position[0], top: position[1], width: w, height: h }); } ctx.restore(); } }, paintSolidColorImageMask: function CanvasGraphics_paintSolidColorImageMask() { this.ctx.fillRect(0, 0, 1, 1); }, paintXObject: function CanvasGraphics_paintXObject() { (0, _util.warn)('Unsupported \'paintXObject\' command.'); }, markPoint: function CanvasGraphics_markPoint(tag) {}, markPointProps: function CanvasGraphics_markPointProps(tag, properties) {}, beginMarkedContent: function CanvasGraphics_beginMarkedContent(tag) {}, beginMarkedContentProps: function CanvasGraphics_beginMarkedContentProps(tag, properties) {}, endMarkedContent: function CanvasGraphics_endMarkedContent() {}, beginCompat: function CanvasGraphics_beginCompat() {}, endCompat: function CanvasGraphics_endCompat() {}, consumePath: function CanvasGraphics_consumePath() { var ctx = this.ctx; if (this.pendingClip) { if (this.pendingClip === EO_CLIP) { ctx.clip('evenodd'); } else { ctx.clip(); } this.pendingClip = null; } ctx.beginPath(); }, getSinglePixelWidth: function CanvasGraphics_getSinglePixelWidth(scale) { if (this.cachedGetSinglePixelWidth === null) { this.ctx.save(); var inverse = this.ctx.mozCurrentTransformInverse; this.ctx.restore(); this.cachedGetSinglePixelWidth = Math.sqrt(Math.max(inverse[0] * inverse[0] + inverse[1] * inverse[1], inverse[2] * inverse[2] + inverse[3] * inverse[3])); } return this.cachedGetSinglePixelWidth; }, getCanvasPosition: function CanvasGraphics_getCanvasPosition(x, y) { var transform = this.ctx.mozCurrentTransform; return [transform[0] * x + transform[2] * y + transform[4], transform[1] * x + transform[3] * y + transform[5]]; } }; for (var op in _util.OPS) { CanvasGraphics.prototype[_util.OPS[op]] = CanvasGraphics.prototype[op]; } return CanvasGraphics; }(); exports.CanvasGraphics = CanvasGraphics; /***/ }), /* 116 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TilingPattern = exports.getShadingPatternFromIR = undefined; var _util = __w_pdfjs_require__(0); var _webgl = __w_pdfjs_require__(58); var ShadingIRs = {}; ShadingIRs.RadialAxial = { fromIR: function RadialAxial_fromIR(raw) { var type = raw[1]; var colorStops = raw[2]; var p0 = raw[3]; var p1 = raw[4]; var r0 = raw[5]; var r1 = raw[6]; return { type: 'Pattern', getPattern: function RadialAxial_getPattern(ctx) { var grad; if (type === 'axial') { grad = ctx.createLinearGradient(p0[0], p0[1], p1[0], p1[1]); } else if (type === 'radial') { grad = ctx.createRadialGradient(p0[0], p0[1], r0, p1[0], p1[1], r1); } for (var i = 0, ii = colorStops.length; i < ii; ++i) { var c = colorStops[i]; grad.addColorStop(c[0], c[1]); } return grad; } }; } }; var createMeshCanvas = function createMeshCanvasClosure() { function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) { var coords = context.coords, colors = context.colors; var bytes = data.data, rowSize = data.width * 4; var tmp; if (coords[p1 + 1] > coords[p2 + 1]) { tmp = p1; p1 = p2; p2 = tmp; tmp = c1; c1 = c2; c2 = tmp; } if (coords[p2 + 1] > coords[p3 + 1]) { tmp = p2; p2 = p3; p3 = tmp; tmp = c2; c2 = c3; c3 = tmp; } if (coords[p1 + 1] > coords[p2 + 1]) { tmp = p1; p1 = p2; p2 = tmp; tmp = c1; c1 = c2; c2 = tmp; } var x1 = (coords[p1] + context.offsetX) * context.scaleX; var y1 = (coords[p1 + 1] + context.offsetY) * context.scaleY; var x2 = (coords[p2] + context.offsetX) * context.scaleX; var y2 = (coords[p2 + 1] + context.offsetY) * context.scaleY; var x3 = (coords[p3] + context.offsetX) * context.scaleX; var y3 = (coords[p3 + 1] + context.offsetY) * context.scaleY; if (y1 >= y3) { return; } var c1r = colors[c1], c1g = colors[c1 + 1], c1b = colors[c1 + 2]; var c2r = colors[c2], c2g = colors[c2 + 1], c2b = colors[c2 + 2]; var c3r = colors[c3], c3g = colors[c3 + 1], c3b = colors[c3 + 2]; var minY = Math.round(y1), maxY = Math.round(y3); var xa, car, cag, cab; var xb, cbr, cbg, cbb; var k; for (var y = minY; y <= maxY; y++) { if (y < y2) { k = y < y1 ? 0 : y1 === y2 ? 1 : (y1 - y) / (y1 - y2); xa = x1 - (x1 - x2) * k; car = c1r - (c1r - c2r) * k; cag = c1g - (c1g - c2g) * k; cab = c1b - (c1b - c2b) * k; } else { k = y > y3 ? 1 : y2 === y3 ? 0 : (y2 - y) / (y2 - y3); xa = x2 - (x2 - x3) * k; car = c2r - (c2r - c3r) * k; cag = c2g - (c2g - c3g) * k; cab = c2b - (c2b - c3b) * k; } k = y < y1 ? 0 : y > y3 ? 1 : (y1 - y) / (y1 - y3); xb = x1 - (x1 - x3) * k; cbr = c1r - (c1r - c3r) * k; cbg = c1g - (c1g - c3g) * k; cbb = c1b - (c1b - c3b) * k; var x1_ = Math.round(Math.min(xa, xb)); var x2_ = Math.round(Math.max(xa, xb)); var j = rowSize * y + x1_ * 4; for (var x = x1_; x <= x2_; x++) { k = (xa - x) / (xa - xb); k = k < 0 ? 0 : k > 1 ? 1 : k; bytes[j++] = car - (car - cbr) * k | 0; bytes[j++] = cag - (cag - cbg) * k | 0; bytes[j++] = cab - (cab - cbb) * k | 0; bytes[j++] = 255; } } } function drawFigure(data, figure, context) { var ps = figure.coords; var cs = figure.colors; var i, ii; switch (figure.type) { case 'lattice': var verticesPerRow = figure.verticesPerRow; var rows = Math.floor(ps.length / verticesPerRow) - 1; var cols = verticesPerRow - 1; for (i = 0; i < rows; i++) { var q = i * verticesPerRow; for (var j = 0; j < cols; j++, q++) { drawTriangle(data, context, ps[q], ps[q + 1], ps[q + verticesPerRow], cs[q], cs[q + 1], cs[q + verticesPerRow]); drawTriangle(data, context, ps[q + verticesPerRow + 1], ps[q + 1], ps[q + verticesPerRow], cs[q + verticesPerRow + 1], cs[q + 1], cs[q + verticesPerRow]); } } break; case 'triangles': for (i = 0, ii = ps.length; i < ii; i += 3) { drawTriangle(data, context, ps[i], ps[i + 1], ps[i + 2], cs[i], cs[i + 1], cs[i + 2]); } break; default: throw new Error('illegal figure'); } } function createMeshCanvas(bounds, combinesScale, coords, colors, figures, backgroundColor, cachedCanvases) { var EXPECTED_SCALE = 1.1; var MAX_PATTERN_SIZE = 3000; var BORDER_SIZE = 2; var offsetX = Math.floor(bounds[0]); var offsetY = Math.floor(bounds[1]); var boundsWidth = Math.ceil(bounds[2]) - offsetX; var boundsHeight = Math.ceil(bounds[3]) - offsetY; var width = Math.min(Math.ceil(Math.abs(boundsWidth * combinesScale[0] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); var height = Math.min(Math.ceil(Math.abs(boundsHeight * combinesScale[1] * EXPECTED_SCALE)), MAX_PATTERN_SIZE); var scaleX = boundsWidth / width; var scaleY = boundsHeight / height; var context = { coords: coords, colors: colors, offsetX: -offsetX, offsetY: -offsetY, scaleX: 1 / scaleX, scaleY: 1 / scaleY }; var paddedWidth = width + BORDER_SIZE * 2; var paddedHeight = height + BORDER_SIZE * 2; var canvas, tmpCanvas, i, ii; if (_webgl.WebGLUtils.isEnabled) { canvas = _webgl.WebGLUtils.drawFigures(width, height, backgroundColor, figures, context); tmpCanvas = cachedCanvases.getCanvas('mesh', paddedWidth, paddedHeight, false); tmpCanvas.context.drawImage(canvas, BORDER_SIZE, BORDER_SIZE); canvas = tmpCanvas.canvas; } else { tmpCanvas = cachedCanvases.getCanvas('mesh', paddedWidth, paddedHeight, false); var tmpCtx = tmpCanvas.context; var data = tmpCtx.createImageData(width, height); if (backgroundColor) { var bytes = data.data; for (i = 0, ii = bytes.length; i < ii; i += 4) { bytes[i] = backgroundColor[0]; bytes[i + 1] = backgroundColor[1]; bytes[i + 2] = backgroundColor[2]; bytes[i + 3] = 255; } } for (i = 0; i < figures.length; i++) { drawFigure(data, figures[i], context); } tmpCtx.putImageData(data, BORDER_SIZE, BORDER_SIZE); canvas = tmpCanvas.canvas; } return { canvas: canvas, offsetX: offsetX - BORDER_SIZE * scaleX, offsetY: offsetY - BORDER_SIZE * scaleY, scaleX: scaleX, scaleY: scaleY }; } return createMeshCanvas; }(); ShadingIRs.Mesh = { fromIR: function Mesh_fromIR(raw) { var coords = raw[2]; var colors = raw[3]; var figures = raw[4]; var bounds = raw[5]; var matrix = raw[6]; var background = raw[8]; return { type: 'Pattern', getPattern: function Mesh_getPattern(ctx, owner, shadingFill) { var scale; if (shadingFill) { scale = _util.Util.singularValueDecompose2dScale(ctx.mozCurrentTransform); } else { scale = _util.Util.singularValueDecompose2dScale(owner.baseTransform); if (matrix) { var matrixScale = _util.Util.singularValueDecompose2dScale(matrix); scale = [scale[0] * matrixScale[0], scale[1] * matrixScale[1]]; } } var temporaryPatternCanvas = createMeshCanvas(bounds, scale, coords, colors, figures, shadingFill ? null : background, owner.cachedCanvases); if (!shadingFill) { ctx.setTransform.apply(ctx, owner.baseTransform); if (matrix) { ctx.transform.apply(ctx, matrix); } } ctx.translate(temporaryPatternCanvas.offsetX, temporaryPatternCanvas.offsetY); ctx.scale(temporaryPatternCanvas.scaleX, temporaryPatternCanvas.scaleY); return ctx.createPattern(temporaryPatternCanvas.canvas, 'no-repeat'); } }; } }; ShadingIRs.Dummy = { fromIR: function Dummy_fromIR() { return { type: 'Pattern', getPattern: function Dummy_fromIR_getPattern() { return 'hotpink'; } }; } }; function getShadingPatternFromIR(raw) { var shadingIR = ShadingIRs[raw[0]]; if (!shadingIR) { throw new Error('Unknown IR type: ' + raw[0]); } return shadingIR.fromIR(raw); } var TilingPattern = function TilingPatternClosure() { var PaintType = { COLORED: 1, UNCOLORED: 2 }; var MAX_PATTERN_SIZE = 3000; function TilingPattern(IR, color, ctx, canvasGraphicsFactory, baseTransform) { this.operatorList = IR[2]; this.matrix = IR[3] || [1, 0, 0, 1, 0, 0]; this.bbox = IR[4]; this.xstep = IR[5]; this.ystep = IR[6]; this.paintType = IR[7]; this.tilingType = IR[8]; this.color = color; this.canvasGraphicsFactory = canvasGraphicsFactory; this.baseTransform = baseTransform; this.type = 'Pattern'; this.ctx = ctx; } TilingPattern.prototype = { createPatternCanvas: function TilinPattern_createPatternCanvas(owner) { var operatorList = this.operatorList; var bbox = this.bbox; var xstep = this.xstep; var ystep = this.ystep; var paintType = this.paintType; var tilingType = this.tilingType; var color = this.color; var canvasGraphicsFactory = this.canvasGraphicsFactory; (0, _util.info)('TilingType: ' + tilingType); var x0 = bbox[0], y0 = bbox[1], x1 = bbox[2], y1 = bbox[3]; var topLeft = [x0, y0]; var botRight = [x0 + xstep, y0 + ystep]; var width = botRight[0] - topLeft[0]; var height = botRight[1] - topLeft[1]; var matrixScale = _util.Util.singularValueDecompose2dScale(this.matrix); var curMatrixScale = _util.Util.singularValueDecompose2dScale(this.baseTransform); var combinedScale = [matrixScale[0] * curMatrixScale[0], matrixScale[1] * curMatrixScale[1]]; width = Math.min(Math.ceil(Math.abs(width * combinedScale[0])), MAX_PATTERN_SIZE); height = Math.min(Math.ceil(Math.abs(height * combinedScale[1])), MAX_PATTERN_SIZE); var tmpCanvas = owner.cachedCanvases.getCanvas('pattern', width, height, true); var tmpCtx = tmpCanvas.context; var graphics = canvasGraphicsFactory.createCanvasGraphics(tmpCtx); graphics.groupLevel = owner.groupLevel; this.setFillAndStrokeStyleToContext(graphics, paintType, color); this.setScale(width, height, xstep, ystep); this.transformToScale(graphics); var tmpTranslate = [1, 0, 0, 1, -topLeft[0], -topLeft[1]]; graphics.transform.apply(graphics, tmpTranslate); this.clipBbox(graphics, bbox, x0, y0, x1, y1); graphics.executeOperatorList(operatorList); return tmpCanvas.canvas; }, setScale: function TilingPattern_setScale(width, height, xstep, ystep) { this.scale = [width / xstep, height / ystep]; }, transformToScale: function TilingPattern_transformToScale(graphics) { var scale = this.scale; var tmpScale = [scale[0], 0, 0, scale[1], 0, 0]; graphics.transform.apply(graphics, tmpScale); }, scaleToContext: function TilingPattern_scaleToContext() { var scale = this.scale; this.ctx.scale(1 / scale[0], 1 / scale[1]); }, clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) { if (Array.isArray(bbox) && bbox.length === 4) { var bboxWidth = x1 - x0; var bboxHeight = y1 - y0; graphics.ctx.rect(x0, y0, bboxWidth, bboxHeight); graphics.clip(); graphics.endPath(); } }, setFillAndStrokeStyleToContext: function setFillAndStrokeStyleToContext(graphics, paintType, color) { var context = graphics.ctx, current = graphics.current; switch (paintType) { case PaintType.COLORED: var ctx = this.ctx; context.fillStyle = ctx.fillStyle; context.strokeStyle = ctx.strokeStyle; current.fillColor = ctx.fillStyle; current.strokeColor = ctx.strokeStyle; break; case PaintType.UNCOLORED: var cssColor = _util.Util.makeCssRgb(color[0], color[1], color[2]); context.fillStyle = cssColor; context.strokeStyle = cssColor; current.fillColor = cssColor; current.strokeColor = cssColor; break; default: throw new _util.FormatError('Unsupported paint type: ' + paintType); } }, getPattern: function TilingPattern_getPattern(ctx, owner) { var temporaryPatternCanvas = this.createPatternCanvas(owner); ctx = this.ctx; ctx.setTransform.apply(ctx, this.baseTransform); ctx.transform.apply(ctx, this.matrix); this.scaleToContext(); return ctx.createPattern(temporaryPatternCanvas, 'repeat'); } }; return TilingPattern; }(); exports.getShadingPatternFromIR = getShadingPatternFromIR; exports.TilingPattern = TilingPattern; /***/ }), /* 117 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PDFDataTransportStream = undefined; var _util = __w_pdfjs_require__(0); var PDFDataTransportStream = function PDFDataTransportStreamClosure() { function PDFDataTransportStream(params, pdfDataRangeTransport) { var _this = this; (0, _util.assert)(pdfDataRangeTransport); this._queuedChunks = []; var initialData = params.initialData; if (initialData && initialData.length > 0) { var buffer = new Uint8Array(initialData).buffer; this._queuedChunks.push(buffer); } this._pdfDataRangeTransport = pdfDataRangeTransport; this._isRangeSupported = !params.disableRange; this._isStreamingSupported = !params.disableStream; this._contentLength = params.length; this._fullRequestReader = null; this._rangeReaders = []; this._pdfDataRangeTransport.addRangeListener(function (begin, chunk) { _this._onReceiveData({ begin: begin, chunk: chunk }); }); this._pdfDataRangeTransport.addProgressListener(function (loaded) { _this._onProgress({ loaded: loaded }); }); this._pdfDataRangeTransport.addProgressiveReadListener(function (chunk) { _this._onReceiveData({ chunk: chunk }); }); this._pdfDataRangeTransport.transportReady(); } PDFDataTransportStream.prototype = { _onReceiveData: function PDFDataTransportStream_onReceiveData(args) { var buffer = new Uint8Array(args.chunk).buffer; if (args.begin === undefined) { if (this._fullRequestReader) { this._fullRequestReader._enqueue(buffer); } else { this._queuedChunks.push(buffer); } } else { var found = this._rangeReaders.some(function (rangeReader) { if (rangeReader._begin !== args.begin) { return false; } rangeReader._enqueue(buffer); return true; }); (0, _util.assert)(found); } }, _onProgress: function PDFDataTransportStream_onDataProgress(evt) { if (this._rangeReaders.length > 0) { var firstReader = this._rangeReaders[0]; if (firstReader.onProgress) { firstReader.onProgress({ loaded: evt.loaded }); } } }, _removeRangeReader: function PDFDataTransportStream_removeRangeReader(reader) { var i = this._rangeReaders.indexOf(reader); if (i >= 0) { this._rangeReaders.splice(i, 1); } }, getFullReader: function PDFDataTransportStream_getFullReader() { (0, _util.assert)(!this._fullRequestReader); var queuedChunks = this._queuedChunks; this._queuedChunks = null; return new PDFDataTransportStreamReader(this, queuedChunks); }, getRangeReader: function PDFDataTransportStream_getRangeReader(begin, end) { var reader = new PDFDataTransportStreamRangeReader(this, begin, end); this._pdfDataRangeTransport.requestDataRange(begin, end); this._rangeReaders.push(reader); return reader; }, cancelAllRequests: function PDFDataTransportStream_cancelAllRequests(reason) { if (this._fullRequestReader) { this._fullRequestReader.cancel(reason); } var readers = this._rangeReaders.slice(0); readers.forEach(function (rangeReader) { rangeReader.cancel(reason); }); this._pdfDataRangeTransport.abort(); } }; function PDFDataTransportStreamReader(stream, queuedChunks) { this._stream = stream; this._done = false; this._queuedChunks = queuedChunks || []; this._requests = []; this._headersReady = Promise.resolve(); stream._fullRequestReader = this; this.onProgress = null; } PDFDataTransportStreamReader.prototype = { _enqueue: function PDFDataTransportStreamReader_enqueue(chunk) { if (this._done) { return; } if (this._requests.length > 0) { var requestCapability = this._requests.shift(); requestCapability.resolve({ value: chunk, done: false }); return; } this._queuedChunks.push(chunk); }, get headersReady() { return this._headersReady; }, get isRangeSupported() { return this._stream._isRangeSupported; }, get isStreamingSupported() { return this._stream._isStreamingSupported; }, get contentLength() { return this._stream._contentLength; }, read: function PDFDataTransportStreamReader_read() { if (this._queuedChunks.length > 0) { var chunk = this._queuedChunks.shift(); return Promise.resolve({ value: chunk, done: false }); } if (this._done) { return Promise.resolve({ value: undefined, done: true }); } var requestCapability = (0, _util.createPromiseCapability)(); this._requests.push(requestCapability); return requestCapability.promise; }, cancel: function PDFDataTransportStreamReader_cancel(reason) { this._done = true; this._requests.forEach(function (requestCapability) { requestCapability.resolve({ value: undefined, done: true }); }); this._requests = []; } }; function PDFDataTransportStreamRangeReader(stream, begin, end) { this._stream = stream; this._begin = begin; this._end = end; this._queuedChunk = null; this._requests = []; this._done = false; this.onProgress = null; } PDFDataTransportStreamRangeReader.prototype = { _enqueue: function PDFDataTransportStreamRangeReader_enqueue(chunk) { if (this._done) { return; } if (this._requests.length === 0) { this._queuedChunk = chunk; } else { var requestsCapability = this._requests.shift(); requestsCapability.resolve({ value: chunk, done: false }); this._requests.forEach(function (requestCapability) { requestCapability.resolve({ value: undefined, done: true }); }); this._requests = []; } this._done = true; this._stream._removeRangeReader(this); }, get isStreamingSupported() { return false; }, read: function PDFDataTransportStreamRangeReader_read() { if (this._queuedChunk) { var chunk = this._queuedChunk; this._queuedChunk = null; return Promise.resolve({ value: chunk, done: false }); } if (this._done) { return Promise.resolve({ value: undefined, done: true }); } var requestCapability = (0, _util.createPromiseCapability)(); this._requests.push(requestCapability); return requestCapability.promise; }, cancel: function PDFDataTransportStreamRangeReader_cancel(reason) { this._done = true; this._requests.forEach(function (requestCapability) { requestCapability.resolve({ value: undefined, done: true }); }); this._requests = []; this._stream._removeRangeReader(this); } }; return PDFDataTransportStream; }(); exports.PDFDataTransportStream = PDFDataTransportStream; /***/ }), /* 118 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PDFNodeStream = undefined; 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 _util = __w_pdfjs_require__(0); var _network_utils = __w_pdfjs_require__(38); function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var fs = require('fs'); var http = require('http'); var https = require('https'); var url = require('url'); var PDFNodeStream = function () { function PDFNodeStream(options) { _classCallCheck(this, PDFNodeStream); this.options = options; this.source = options.source; this.url = url.parse(this.source.url); this.isHttp = this.url.protocol === 'http:' || this.url.protocol === 'https:'; this.isFsUrl = this.url.protocol === 'file:' || !this.url.host; this.httpHeaders = this.isHttp && this.source.httpHeaders || {}; this._fullRequest = null; this._rangeRequestReaders = []; } _createClass(PDFNodeStream, [{ key: 'getFullReader', value: function getFullReader() { (0, _util.assert)(!this._fullRequest); this._fullRequest = this.isFsUrl ? new PDFNodeStreamFsFullReader(this) : new PDFNodeStreamFullReader(this); return this._fullRequest; } }, { key: 'getRangeReader', value: function getRangeReader(start, end) { var rangeReader = this.isFsUrl ? new PDFNodeStreamFsRangeReader(this, start, end) : new PDFNodeStreamRangeReader(this, start, end); this._rangeRequestReaders.push(rangeReader); return rangeReader; } }, { key: 'cancelAllRequests', value: function cancelAllRequests(reason) { if (this._fullRequest) { this._fullRequest.cancel(reason); } var readers = this._rangeRequestReaders.slice(0); readers.forEach(function (reader) { reader.cancel(reason); }); } }]); return PDFNodeStream; }(); var BaseFullReader = function () { function BaseFullReader(stream) { _classCallCheck(this, BaseFullReader); this._url = stream.url; this._done = false; this._errored = false; this._reason = null; this.onProgress = null; this._contentLength = stream.source.length; this._loaded = 0; this._disableRange = stream.options.disableRange || false; this._rangeChunkSize = stream.source.rangeChunkSize; if (!this._rangeChunkSize && !this._disableRange) { this._disableRange = true; } this._isStreamingSupported = !stream.source.disableStream; this._isRangeSupported = !stream.options.disableRange; this._readableStream = null; this._readCapability = (0, _util.createPromiseCapability)(); this._headersCapability = (0, _util.createPromiseCapability)(); } _createClass(BaseFullReader, [{ key: 'read', value: function read() { var _this = this; return this._readCapability.promise.then(function () { if (_this._done) { return Promise.resolve({ value: undefined, done: true }); } if (_this._errored) { return Promise.reject(_this._reason); } var chunk = _this._readableStream.read(); if (chunk === null) { _this._readCapability = (0, _util.createPromiseCapability)(); return _this.read(); } _this._loaded += chunk.length; if (_this.onProgress) { _this.onProgress({ loaded: _this._loaded, total: _this._contentLength }); } var buffer = new Uint8Array(chunk).buffer; return Promise.resolve({ value: buffer, done: false }); }); } }, { key: 'cancel', value: function cancel(reason) { if (!this._readableStream) { this._error(reason); return; } this._readableStream.destroy(reason); } }, { key: '_error', value: function _error(reason) { this._errored = true; this._reason = reason; this._readCapability.resolve(); } }, { key: '_setReadableStream', value: function _setReadableStream(readableStream) { var _this2 = this; this._readableStream = readableStream; readableStream.on('readable', function () { _this2._readCapability.resolve(); }); readableStream.on('end', function () { readableStream.destroy(); _this2._done = true; _this2._readCapability.resolve(); }); readableStream.on('error', function (reason) { _this2._error(reason); }); if (!this._isStreamingSupported && this._isRangeSupported) { this._error(new _util.AbortException('streaming is disabled')); } if (this._errored) { this._readableStream.destroy(this._reason); } } }, { key: 'headersReady', get: function get() { return this._headersCapability.promise; } }, { key: 'contentLength', get: function get() { return this._contentLength; } }, { key: 'isRangeSupported', get: function get() { return this._isRangeSupported; } }, { key: 'isStreamingSupported', get: function get() { return this._isStreamingSupported; } }]); return BaseFullReader; }(); var BaseRangeReader = function () { function BaseRangeReader(stream) { _classCallCheck(this, BaseRangeReader); this._url = stream.url; this._done = false; this._errored = false; this._reason = null; this.onProgress = null; this._loaded = 0; this._readableStream = null; this._readCapability = (0, _util.createPromiseCapability)(); this._isStreamingSupported = !stream.source.disableStream; } _createClass(BaseRangeReader, [{ key: 'read', value: function read() { var _this3 = this; return this._readCapability.promise.then(function () { if (_this3._done) { return Promise.resolve({ value: undefined, done: true }); } if (_this3._errored) { return Promise.reject(_this3._reason); } var chunk = _this3._readableStream.read(); if (chunk === null) { _this3._readCapability = (0, _util.createPromiseCapability)(); return _this3.read(); } _this3._loaded += chunk.length; if (_this3.onProgress) { _this3.onProgress({ loaded: _this3._loaded }); } var buffer = new Uint8Array(chunk).buffer; return Promise.resolve({ value: buffer, done: false }); }); } }, { key: 'cancel', value: function cancel(reason) { if (!this._readableStream) { this._error(reason); return; } this._readableStream.destroy(reason); } }, { key: '_error', value: function _error(reason) { this._errored = true; this._reason = reason; this._readCapability.resolve(); } }, { key: '_setReadableStream', value: function _setReadableStream(readableStream) { var _this4 = this; this._readableStream = readableStream; readableStream.on('readable', function () { _this4._readCapability.resolve(); }); readableStream.on('end', function () { readableStream.destroy(); _this4._done = true; _this4._readCapability.resolve(); }); readableStream.on('error', function (reason) { _this4._error(reason); }); if (this._errored) { this._readableStream.destroy(this._reason); } } }, { key: 'isStreamingSupported', get: function get() { return this._isStreamingSupported; } }]); return BaseRangeReader; }(); function createRequestOptions(url, headers) { return { protocol: url.protocol, auth: url.auth, host: url.hostname, port: url.port, path: url.path, method: 'GET', headers: headers }; } var PDFNodeStreamFullReader = function (_BaseFullReader) { _inherits(PDFNodeStreamFullReader, _BaseFullReader); function PDFNodeStreamFullReader(stream) { _classCallCheck(this, PDFNodeStreamFullReader); var _this5 = _possibleConstructorReturn(this, (PDFNodeStreamFullReader.__proto__ || Object.getPrototypeOf(PDFNodeStreamFullReader)).call(this, stream)); var handleResponse = function handleResponse(response) { _this5._headersCapability.resolve(); _this5._setReadableStream(response); var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({ getResponseHeader: function getResponseHeader(name) { return _this5._readableStream.headers[name.toLowerCase()]; }, isHttp: stream.isHttp, rangeChunkSize: _this5._rangeChunkSize, disableRange: _this5._disableRange }), allowRangeRequests = _validateRangeRequest.allowRangeRequests, suggestedLength = _validateRangeRequest.suggestedLength; if (allowRangeRequests) { _this5._isRangeSupported = true; } _this5._contentLength = suggestedLength; }; _this5._request = null; if (_this5._url.protocol === 'http:') { _this5._request = http.request(createRequestOptions(_this5._url, stream.httpHeaders), handleResponse); } else { _this5._request = https.request(createRequestOptions(_this5._url, stream.httpHeaders), handleResponse); } _this5._request.on('error', function (reason) { _this5._errored = true; _this5._reason = reason; _this5._headersCapability.reject(reason); }); _this5._request.end(); return _this5; } return PDFNodeStreamFullReader; }(BaseFullReader); var PDFNodeStreamRangeReader = function (_BaseRangeReader) { _inherits(PDFNodeStreamRangeReader, _BaseRangeReader); function PDFNodeStreamRangeReader(stream, start, end) { _classCallCheck(this, PDFNodeStreamRangeReader); var _this6 = _possibleConstructorReturn(this, (PDFNodeStreamRangeReader.__proto__ || Object.getPrototypeOf(PDFNodeStreamRangeReader)).call(this, stream)); _this6._httpHeaders = {}; for (var property in stream.httpHeaders) { var value = stream.httpHeaders[property]; if (typeof value === 'undefined') { continue; } _this6._httpHeaders[property] = value; } _this6._httpHeaders['Range'] = 'bytes=' + start + '-' + (end - 1); _this6._request = null; if (_this6._url.protocol === 'http:') { _this6._request = http.request(createRequestOptions(_this6._url, _this6._httpHeaders), function (response) { _this6._setReadableStream(response); }); } else { _this6._request = https.request(createRequestOptions(_this6._url, _this6._httpHeaders), function (response) { _this6._setReadableStream(response); }); } _this6._request.on('error', function (reason) { _this6._errored = true; _this6._reason = reason; }); _this6._request.end(); return _this6; } return PDFNodeStreamRangeReader; }(BaseRangeReader); var PDFNodeStreamFsFullReader = function (_BaseFullReader2) { _inherits(PDFNodeStreamFsFullReader, _BaseFullReader2); function PDFNodeStreamFsFullReader(stream) { _classCallCheck(this, PDFNodeStreamFsFullReader); var _this7 = _possibleConstructorReturn(this, (PDFNodeStreamFsFullReader.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsFullReader)).call(this, stream)); var path = decodeURI(_this7._url.path); fs.lstat(path, function (error, stat) { if (error) { _this7._errored = true; _this7._reason = error; _this7._headersCapability.reject(error); return; } _this7._contentLength = stat.size; _this7._setReadableStream(fs.createReadStream(path)); _this7._headersCapability.resolve(); }); return _this7; } return PDFNodeStreamFsFullReader; }(BaseFullReader); var PDFNodeStreamFsRangeReader = function (_BaseRangeReader2) { _inherits(PDFNodeStreamFsRangeReader, _BaseRangeReader2); function PDFNodeStreamFsRangeReader(stream, start, end) { _classCallCheck(this, PDFNodeStreamFsRangeReader); var _this8 = _possibleConstructorReturn(this, (PDFNodeStreamFsRangeReader.__proto__ || Object.getPrototypeOf(PDFNodeStreamFsRangeReader)).call(this, stream)); _this8._setReadableStream(fs.createReadStream(decodeURI(_this8._url.path), { start: start, end: end - 1 })); return _this8; } return PDFNodeStreamFsRangeReader; }(BaseRangeReader); exports.PDFNodeStream = PDFNodeStream; /***/ }), /* 119 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PDFFetchStream = undefined; 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 _util = __w_pdfjs_require__(0); var _network_utils = __w_pdfjs_require__(38); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function createFetchOptions(headers, withCredentials) { return { method: 'GET', headers: headers, mode: 'cors', credentials: withCredentials ? 'include' : 'same-origin', redirect: 'follow' }; } var PDFFetchStream = function () { function PDFFetchStream(options) { _classCallCheck(this, PDFFetchStream); this.options = options; this.source = options.source; this.isHttp = /^https?:/i.test(this.source.url); this.httpHeaders = this.isHttp && this.source.httpHeaders || {}; this._fullRequestReader = null; this._rangeRequestReaders = []; } _createClass(PDFFetchStream, [{ key: 'getFullReader', value: function getFullReader() { (0, _util.assert)(!this._fullRequestReader); this._fullRequestReader = new PDFFetchStreamReader(this); return this._fullRequestReader; } }, { key: 'getRangeReader', value: function getRangeReader(begin, end) { var reader = new PDFFetchStreamRangeReader(this, begin, end); this._rangeRequestReaders.push(reader); return reader; } }, { key: 'cancelAllRequests', value: function cancelAllRequests(reason) { if (this._fullRequestReader) { this._fullRequestReader.cancel(reason); } var readers = this._rangeRequestReaders.slice(0); readers.forEach(function (reader) { reader.cancel(reason); }); } }]); return PDFFetchStream; }(); var PDFFetchStreamReader = function () { function PDFFetchStreamReader(stream) { var _this = this; _classCallCheck(this, PDFFetchStreamReader); this._stream = stream; this._reader = null; this._loaded = 0; this._withCredentials = stream.source.withCredentials; this._contentLength = this._stream.source.length; this._headersCapability = (0, _util.createPromiseCapability)(); this._disableRange = this._stream.options.disableRange; this._rangeChunkSize = this._stream.source.rangeChunkSize; if (!this._rangeChunkSize && !this._disableRange) { this._disableRange = true; } this._isRangeSupported = !this._stream.options.disableRange; this._isStreamingSupported = !this._stream.source.disableStream; this._headers = new Headers(); for (var property in this._stream.httpHeaders) { var value = this._stream.httpHeaders[property]; if (typeof value === 'undefined') { continue; } this._headers.append(property, value); } var url = this._stream.source.url; fetch(url, createFetchOptions(this._headers, this._withCredentials)).then(function (response) { if (!(0, _network_utils.validateResponseStatus)(response.status)) { throw (0, _network_utils.createResponseStatusError)(response.status, url); } _this._reader = response.body.getReader(); _this._headersCapability.resolve(); var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({ getResponseHeader: function getResponseHeader(name) { return response.headers.get(name); }, isHttp: _this._stream.isHttp, rangeChunkSize: _this._rangeChunkSize, disableRange: _this._disableRange }), allowRangeRequests = _validateRangeRequest.allowRangeRequests, suggestedLength = _validateRangeRequest.suggestedLength; _this._contentLength = suggestedLength; _this._isRangeSupported = allowRangeRequests; if (!_this._isStreamingSupported && _this._isRangeSupported) { _this.cancel(new _util.AbortException('streaming is disabled')); } }).catch(this._headersCapability.reject); this.onProgress = null; } _createClass(PDFFetchStreamReader, [{ key: 'read', value: function read() { var _this2 = this; return this._headersCapability.promise.then(function () { return _this2._reader.read().then(function (_ref) { var value = _ref.value, done = _ref.done; if (done) { return Promise.resolve({ value: value, done: done }); } _this2._loaded += value.byteLength; if (_this2.onProgress) { _this2.onProgress({ loaded: _this2._loaded, total: _this2._contentLength }); } var buffer = new Uint8Array(value).buffer; return Promise.resolve({ value: buffer, done: false }); }); }); } }, { key: 'cancel', value: function cancel(reason) { if (this._reader) { this._reader.cancel(reason); } } }, { key: 'headersReady', get: function get() { return this._headersCapability.promise; } }, { key: 'contentLength', get: function get() { return this._contentLength; } }, { key: 'isRangeSupported', get: function get() { return this._isRangeSupported; } }, { key: 'isStreamingSupported', get: function get() { return this._isStreamingSupported; } }]); return PDFFetchStreamReader; }(); var PDFFetchStreamRangeReader = function () { function PDFFetchStreamRangeReader(stream, begin, end) { var _this3 = this; _classCallCheck(this, PDFFetchStreamRangeReader); this._stream = stream; this._reader = null; this._loaded = 0; this._withCredentials = stream.source.withCredentials; this._readCapability = (0, _util.createPromiseCapability)(); this._isStreamingSupported = !stream.source.disableStream; this._headers = new Headers(); for (var property in this._stream.httpHeaders) { var value = this._stream.httpHeaders[property]; if (typeof value === 'undefined') { continue; } this._headers.append(property, value); } var rangeStr = begin + '-' + (end - 1); this._headers.append('Range', 'bytes=' + rangeStr); var url = this._stream.source.url; fetch(url, createFetchOptions(this._headers, this._withCredentials)).then(function (response) { if (!(0, _network_utils.validateResponseStatus)(response.status)) { throw (0, _network_utils.createResponseStatusError)(response.status, url); } _this3._readCapability.resolve(); _this3._reader = response.body.getReader(); }); this.onProgress = null; } _createClass(PDFFetchStreamRangeReader, [{ key: 'read', value: function read() { var _this4 = this; return this._readCapability.promise.then(function () { return _this4._reader.read().then(function (_ref2) { var value = _ref2.value, done = _ref2.done; if (done) { return Promise.resolve({ value: value, done: done }); } _this4._loaded += value.byteLength; if (_this4.onProgress) { _this4.onProgress({ loaded: _this4._loaded }); } var buffer = new Uint8Array(value).buffer; return Promise.resolve({ value: buffer, done: false }); }); }); } }, { key: 'cancel', value: function cancel(reason) { if (this._reader) { this._reader.cancel(reason); } } }, { key: 'isStreamingSupported', get: function get() { return this._isStreamingSupported; } }]); return PDFFetchStreamRangeReader; }(); exports.PDFFetchStream = PDFFetchStream; /***/ }), /* 120 */ /***/ (function(module, exports, __w_pdfjs_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NetworkManager = exports.PDFNetworkStream = undefined; var _util = __w_pdfjs_require__(0); var _network_utils = __w_pdfjs_require__(38); var _global_scope = __w_pdfjs_require__(14); var _global_scope2 = _interopRequireDefault(_global_scope); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } ; var OK_RESPONSE = 200; var PARTIAL_CONTENT_RESPONSE = 206; function NetworkManager(url, args) { this.url = url; args = args || {}; this.isHttp = /^https?:/i.test(url); this.httpHeaders = this.isHttp && args.httpHeaders || {}; this.withCredentials = args.withCredentials || false; this.getXhr = args.getXhr || function NetworkManager_getXhr() { return new XMLHttpRequest(); }; this.currXhrId = 0; this.pendingRequests = Object.create(null); this.loadedRequests = Object.create(null); } function getArrayBuffer(xhr) { var data = xhr.response; if (typeof data !== 'string') { return data; } var array = (0, _util.stringToBytes)(data); return array.buffer; } var supportsMozChunked = function supportsMozChunkedClosure() { try { var x = new XMLHttpRequest(); x.open('GET', _global_scope2.default.location.href); x.responseType = 'moz-chunked-arraybuffer'; return x.responseType === 'moz-chunked-arraybuffer'; } catch (e) { return false; } }(); NetworkManager.prototype = { requestRange: function NetworkManager_requestRange(begin, end, listeners) { var args = { begin: begin, end: end }; for (var prop in listeners) { args[prop] = listeners[prop]; } return this.request(args); }, requestFull: function NetworkManager_requestFull(listeners) { return this.request(listeners); }, request: function NetworkManager_request(args) { var xhr = this.getXhr(); var xhrId = this.currXhrId++; var pendingRequest = this.pendingRequests[xhrId] = { xhr: xhr }; xhr.open('GET', this.url); xhr.withCredentials = this.withCredentials; for (var property in this.httpHeaders) { var value = this.httpHeaders[property]; if (typeof value === 'undefined') { continue; } xhr.setRequestHeader(property, value); } if (this.isHttp && 'begin' in args && 'end' in args) { var rangeStr = args.begin + '-' + (args.end - 1); xhr.setRequestHeader('Range', 'bytes=' + rangeStr); pendingRequest.expectedStatus = 206; } else { pendingRequest.expectedStatus = 200; } var useMozChunkedLoading = supportsMozChunked && !!args.onProgressiveData; if (useMozChunkedLoading) { xhr.responseType = 'moz-chunked-arraybuffer'; pendingRequest.onProgressiveData = args.onProgressiveData; pendingRequest.mozChunked = true; } else { xhr.responseType = 'arraybuffer'; } if (args.onError) { xhr.onerror = function (evt) { args.onError(xhr.status); }; } xhr.onreadystatechange = this.onStateChange.bind(this, xhrId); xhr.onprogress = this.onProgress.bind(this, xhrId); pendingRequest.onHeadersReceived = args.onHeadersReceived; pendingRequest.onDone = args.onDone; pendingRequest.onError = args.onError; pendingRequest.onProgress = args.onProgress; xhr.send(null); return xhrId; }, onProgress: function NetworkManager_onProgress(xhrId, evt) { var pendingRequest = this.pendingRequests[xhrId]; if (!pendingRequest) { return; } if (pendingRequest.mozChunked) { var chunk = getArrayBuffer(pendingRequest.xhr); pendingRequest.onProgressiveData(chunk); } var onProgress = pendingRequest.onProgress; if (onProgress) { onProgress(evt); } }, onStateChange: function NetworkManager_onStateChange(xhrId, evt) { var pendingRequest = this.pendingRequests[xhrId]; if (!pendingRequest) { return; } var xhr = pendingRequest.xhr; if (xhr.readyState >= 2 && pendingRequest.onHeadersReceived) { pendingRequest.onHeadersReceived(); delete pendingRequest.onHeadersReceived; } if (xhr.readyState !== 4) { return; } if (!(xhrId in this.pendingRequests)) { return; } delete this.pendingRequests[xhrId]; if (xhr.status === 0 && this.isHttp) { if (pendingRequest.onError) { pendingRequest.onError(xhr.status); } return; } var xhrStatus = xhr.status || OK_RESPONSE; var ok_response_on_range_request = xhrStatus === OK_RESPONSE && pendingRequest.expectedStatus === PARTIAL_CONTENT_RESPONSE; if (!ok_response_on_range_request && xhrStatus !== pendingRequest.expectedStatus) { if (pendingRequest.onError) { pendingRequest.onError(xhr.status); } return; } this.loadedRequests[xhrId] = true; var chunk = getArrayBuffer(xhr); if (xhrStatus === PARTIAL_CONTENT_RESPONSE) { var rangeHeader = xhr.getResponseHeader('Content-Range'); var matches = /bytes (\d+)-(\d+)\/(\d+)/.exec(rangeHeader); var begin = parseInt(matches[1], 10); pendingRequest.onDone({ begin: begin, chunk: chunk }); } else if (pendingRequest.onProgressiveData) { pendingRequest.onDone(null); } else if (chunk) { pendingRequest.onDone({ begin: 0, chunk: chunk }); } else if (pendingRequest.onError) { pendingRequest.onError(xhr.status); } }, hasPendingRequests: function NetworkManager_hasPendingRequests() { for (var xhrId in this.pendingRequests) { return true; } return false; }, getRequestXhr: function NetworkManager_getXhr(xhrId) { return this.pendingRequests[xhrId].xhr; }, isStreamingRequest: function NetworkManager_isStreamingRequest(xhrId) { return !!this.pendingRequests[xhrId].onProgressiveData; }, isPendingRequest: function NetworkManager_isPendingRequest(xhrId) { return xhrId in this.pendingRequests; }, isLoadedRequest: function NetworkManager_isLoadedRequest(xhrId) { return xhrId in this.loadedRequests; }, abortAllRequests: function NetworkManager_abortAllRequests() { for (var xhrId in this.pendingRequests) { this.abortRequest(xhrId | 0); } }, abortRequest: function NetworkManager_abortRequest(xhrId) { var xhr = this.pendingRequests[xhrId].xhr; delete this.pendingRequests[xhrId]; xhr.abort(); } }; function PDFNetworkStream(options) { this._options = options; var source = options.source; this._manager = new NetworkManager(source.url, { httpHeaders: source.httpHeaders, withCredentials: source.withCredentials }); this._rangeChunkSize = source.rangeChunkSize; this._fullRequestReader = null; this._rangeRequestReaders = []; } PDFNetworkStream.prototype = { _onRangeRequestReaderClosed: function PDFNetworkStream_onRangeRequestReaderClosed(reader) { var i = this._rangeRequestReaders.indexOf(reader); if (i >= 0) { this._rangeRequestReaders.splice(i, 1); } }, getFullReader: function PDFNetworkStream_getFullReader() { (0, _util.assert)(!this._fullRequestReader); this._fullRequestReader = new PDFNetworkStreamFullRequestReader(this._manager, this._options); return this._fullRequestReader; }, getRangeReader: function PDFNetworkStream_getRangeReader(begin, end) { var reader = new PDFNetworkStreamRangeRequestReader(this._manager, begin, end); reader.onClosed = this._onRangeRequestReaderClosed.bind(this); this._rangeRequestReaders.push(reader); return reader; }, cancelAllRequests: function PDFNetworkStream_cancelAllRequests(reason) { if (this._fullRequestReader) { this._fullRequestReader.cancel(reason); } var readers = this._rangeRequestReaders.slice(0); readers.forEach(function (reader) { reader.cancel(reason); }); } }; function PDFNetworkStreamFullRequestReader(manager, options) { this._manager = manager; var source = options.source; var args = { onHeadersReceived: this._onHeadersReceived.bind(this), onProgressiveData: source.disableStream ? null : this._onProgressiveData.bind(this), onDone: this._onDone.bind(this), onError: this._onError.bind(this), onProgress: this._onProgress.bind(this) }; this._url = source.url; this._fullRequestId = manager.requestFull(args); this._headersReceivedCapability = (0, _util.createPromiseCapability)(); this._disableRange = options.disableRange || false; this._contentLength = source.length; this._rangeChunkSize = source.rangeChunkSize; if (!this._rangeChunkSize && !this._disableRange) { this._disableRange = true; } this._isStreamingSupported = false; this._isRangeSupported = false; this._cachedChunks = []; this._requests = []; this._done = false; this._storedError = undefined; this.onProgress = null; } PDFNetworkStreamFullRequestReader.prototype = { _onHeadersReceived: function PDFNetworkStreamFullRequestReader_onHeadersReceived() { var fullRequestXhrId = this._fullRequestId; var fullRequestXhr = this._manager.getRequestXhr(fullRequestXhrId); var _validateRangeRequest = (0, _network_utils.validateRangeRequestCapabilities)({ getResponseHeader: function getResponseHeader(name) { return fullRequestXhr.getResponseHeader(name); }, isHttp: this._manager.isHttp, rangeChunkSize: this._rangeChunkSize, disableRange: this._disableRange }), allowRangeRequests = _validateRangeRequest.allowRangeRequests, suggestedLength = _validateRangeRequest.suggestedLength; this._contentLength = suggestedLength || this._contentLength; if (allowRangeRequests) { this._isRangeSupported = true; } var networkManager = this._manager; if (networkManager.isStreamingRequest(fullRequestXhrId)) { this._isStreamingSupported = true; } else if (this._isRangeSupported) { networkManager.abortRequest(fullRequestXhrId); } this._headersReceivedCapability.resolve(); }, _onProgressiveData: function PDFNetworkStreamFullRequestReader_onProgressiveData(chunk) { if (this._requests.length > 0) { var requestCapability = this._requests.shift(); requestCapability.resolve({ value: chunk, done: false }); } else { this._cachedChunks.push(chunk); } }, _onDone: function PDFNetworkStreamFullRequestReader_onDone(args) { if (args) { this._onProgressiveData(args.chunk); } this._done = true; if (this._cachedChunks.length > 0) { return; } this._requests.forEach(function (requestCapability) { requestCapability.resolve({ value: undefined, done: true }); }); this._requests = []; }, _onError: function PDFNetworkStreamFullRequestReader_onError(status) { var url = this._url; var exception = (0, _network_utils.createResponseStatusError)(status, url); this._storedError = exception; this._headersReceivedCapability.reject(exception); this._requests.forEach(function (requestCapability) { requestCapability.reject(exception); }); this._requests = []; this._cachedChunks = []; }, _onProgress: function PDFNetworkStreamFullRequestReader_onProgress(data) { if (this.onProgress) { this.onProgress({ loaded: data.loaded, total: data.lengthComputable ? data.total : this._contentLength }); } }, get isRangeSupported() { return this._isRangeSupported; }, get isStreamingSupported() { return this._isStreamingSupported; }, get contentLength() { return this._contentLength; }, get headersReady() { return this._headersReceivedCapability.promise; }, read: function PDFNetworkStreamFullRequestReader_read() { if (this._storedError) { return Promise.reject(this._storedError); } if (this._cachedChunks.length > 0) { var chunk = this._cachedChunks.shift(); return Promise.resolve({ value: chunk, done: false }); } if (this._done) { return Promise.resolve({ value: undefined, done: true }); } var requestCapability = (0, _util.createPromiseCapability)(); this._requests.push(requestCapability); return requestCapability.promise; }, cancel: function PDFNetworkStreamFullRequestReader_cancel(reason) { this._done = true; this._headersReceivedCapability.reject(reason); this._requests.forEach(function (requestCapability) { requestCapability.resolve({ value: undefined, done: true }); }); this._requests = []; if (this._manager.isPendingRequest(this._fullRequestId)) { this._manager.abortRequest(this._fullRequestId); } this._fullRequestReader = null; } }; function PDFNetworkStreamRangeRequestReader(manager, begin, end) { this._manager = manager; var args = { onDone: this._onDone.bind(this), onProgress: this._onProgress.bind(this) }; this._requestId = manager.requestRange(begin, end, args); this._requests = []; this._queuedChunk = null; this._done = false; this.onProgress = null; this.onClosed = null; } PDFNetworkStreamRangeRequestReader.prototype = { _close: function PDFNetworkStreamRangeRequestReader_close() { if (this.onClosed) { this.onClosed(this); } }, _onDone: function PDFNetworkStreamRangeRequestReader_onDone(data) { var chunk = data.chunk; if (this._requests.length > 0) { var requestCapability = this._requests.shift(); requestCapability.resolve({ value: chunk, done: false }); } else { this._queuedChunk = chunk; } this._done = true; this._requests.forEach(function (requestCapability) { requestCapability.resolve({ value: undefined, done: true }); }); this._requests = []; this._close(); }, _onProgress: function PDFNetworkStreamRangeRequestReader_onProgress(evt) { if (!this.isStreamingSupported && this.onProgress) { this.onProgress({ loaded: evt.loaded }); } }, get isStreamingSupported() { return false; }, read: function PDFNetworkStreamRangeRequestReader_read() { if (this._queuedChunk !== null) { var chunk = this._queuedChunk; this._queuedChunk = null; return Promise.resolve({ value: chunk, done: false }); } if (this._done) { return Promise.resolve({ value: undefined, done: true }); } var requestCapability = (0, _util.createPromiseCapability)(); this._requests.push(requestCapability); return requestCapability.promise; }, cancel: function PDFNetworkStreamRangeRequestReader_cancel(reason) { this._done = true; this._requests.forEach(function (requestCapability) { requestCapability.resolve({ value: undefined, done: true }); }); this._requests = []; if (this._manager.isPendingRequest(this._requestId)) { this._manager.abortRequest(this._requestId); } this._close(); } }; exports.PDFNetworkStream = PDFNetworkStream; exports.NetworkManager = NetworkManager; /***/ }) /******/ ]); }); //# sourceMappingURL=pdf.js.map
src/components/Index.js
ntwcklng/react-dilutioncalc
import React from 'react'; import Bottle from './Bottle'; import Dilution from './Dilution'; import { Bottles, Dilutions } from './Data'; import calculateDilution from './Calculate'; let calc = [0,0]; export default class Index extends React.Component { constructor(props) { super(props); this.updateDilution = this.updateDilution.bind(this); this.updateBottle = this.updateBottle.bind(this); this.updateDilInput = this.updateDilInput.bind(this); this.updateBottleInput = this.updateBottleInput.bind(this); this.state = { dilution1: 0, dilution2: 0, bottle: 0, calc: 0 } } updateDilution(part1, part2) { this.setState({ dilution1: part1, dilution2: part2 }); } updateBottle(bottleSize) { this.setState({ bottle: bottleSize }); } updateDilInput(e) { if(e.target.name == 1) { this.setState({ dilution1: e.target.value }); } else { this.setState({ dilution2: e.target.value }); } } updateBottleInput(e) { this.setState({ bottle: e.target.value }); } render() { let self = this; if(this.state.dilution1 !== 0 && this.state.dilution2 !== 0 && this.state.bottle !== 0) { calc = calculateDilution(this.state.dilution1, this.state.dilution2, this.state.bottle); } let renderBottles = Bottles.map(function(bottle) { return <Bottle name={bottle.name} size={bottle.size} updateBottle={self.updateBottle} key={bottle.name} /> }); let renderDilutions = Dilutions.map(function(dil) { return <Dilution name={dil.name} part1={dil.part1} part2={dil.part2} updateDil={self.updateDilution} key={dil.name} /> }); return ( <div> <form className="form-inline"> <div className="form-group"> <legend>Enter Dilution</legend> <input type="number" placeholder="1" name="1" onChange={this.updateDilInput} value={this.state.dilution1} /> : <input type="number" placeholder="2" name="2" onChange={this.updateDilInput} value={this.state.dilution2} /> <legend>Enter Bottlesize</legend> <input type="number" placeholder="5000" name="3" onChange={this.updateBottleInput} value={this.state.bottle} /> </div> </form> <h5>Popular Dilutions:</h5> <div className="btn-group" role="group"> {renderDilutions} </div> <h5>Bottlesize:</h5> <div className="btn-group" role="group"> {renderBottles} </div> {calc[0] != 0 ? ( <div> <h2> Your Dilution: {calc[0]} </h2> <div className="progress"> <div className="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style={{width: calc[1] + '%'}}> </div> </div> </div> ) : ''} </div> ) } } Index.propTypes = { dilution1: React.PropTypes.number, dilution2: React.PropTypes.number, bottle: React.PropTypes.number, calc: React.PropTypes.number }
packages/example-phone/src/scripts/components/call/dialer.js
glhewett/spark-js-sdk
import React, {Component} from 'react'; import {Button, ButtonGroup, FormControl, FormGroup} from 'react-bootstrap'; import Form from '../form'; export default class Dialer extends Component { static propTypes = { onDial: React.PropTypes.func.isRequired, spark: React.PropTypes.object.isRequired }; handleSubmit(values) { const {onDial, spark} = this.props; onDial(spark, values.address); } handleAudioOnlyClicked(event) { event.preventDefault(); const {onDial, spark} = this.props; onDial(spark, this.form.state.address, { video: false }); } handleVideoOnlyClicked(event) { event.preventDefault(); const {onDial, spark} = this.props; onDial(spark, this.form.state.address, { audio: false }); } render() { return ( <Form className="form-inline" onSubmit={this.handleSubmit.bind(this)} ref={(f) => {this.form = f;}}> <FormGroup controlId="Address"> <FormControl name="address" placeholder="Enter email address" required title="Enter email address" type="text" /> </FormGroup> <ButtonGroup> <Button title="Dial" type="submit">Dial</Button> <Button onClick={this.handleAudioOnlyClicked.bind(this)} title="Dial (Audio Only)" type="submit">Dial (Audio Only)</Button> <Button onClick={this.handleVideoOnlyClicked.bind(this)} title="Dial (Video Only)" type="submit">Dial (Video Only)</Button> </ButtonGroup> </Form> ); } }
ajax/libs/forerunnerdb/1.3.309/fdb-legacy.js
kiwi89/cdnjs
(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){ var Core = _dereq_('../lib/Core'), CollectionGroup = _dereq_('../lib/CollectionGroup'), View = _dereq_('../lib/View'), Highchart = _dereq_('../lib/Highchart'), Persist = _dereq_('../lib/Persist'), Document = _dereq_('../lib/Document'), Overview = _dereq_('../lib/Overview'), OldView = _dereq_('../lib/OldView'), OldViewBind = _dereq_('../lib/OldView.Bind'), Grid = _dereq_('../lib/Grid'); if (typeof window !== 'undefined') { window.ForerunnerDB = Core; } module.exports = Core; },{"../lib/CollectionGroup":5,"../lib/Core":6,"../lib/Document":9,"../lib/Grid":10,"../lib/Highchart":11,"../lib/OldView":26,"../lib/OldView.Bind":25,"../lib/Overview":29,"../lib/Persist":31,"../lib/View":36}],2:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'); /** * Creates an always-sorted multi-key bucket that allows ForerunnerDB to * know the index that a document will occupy in an array with minimal * processing, speeding up things like sorted views. * @param {object} orderBy An order object. * @constructor */ var ActiveBucket = function (orderBy) { var sortKey; this._primaryKey = '_id'; this._keyArr = []; this._data = []; this._objLookup = {}; this._count = 0; for (sortKey in orderBy) { if (orderBy.hasOwnProperty(sortKey)) { this._keyArr.push({ key: sortKey, dir: orderBy[sortKey] }); } } }; Shared.addModule('ActiveBucket', ActiveBucket); Shared.mixin(ActiveBucket.prototype, 'Mixin.Sorting'); /** * Gets / sets the primary key used by the active bucket. * @returns {String} The current primary key. */ Shared.synthesize(ActiveBucket.prototype, 'primaryKey'); /** * Quicksorts a single document into the passed array and * returns the index that the document should occupy. * @param {object} obj The document to calculate index for. * @param {array} arr The array the document index will be * calculated for. * @param {string} item The string key representation of the * document whose index is being calculated. * @param {function} fn The comparison function that is used * to determine if a document is sorted below or above the * document we are calculating the index for. * @returns {number} The index the document should occupy. */ ActiveBucket.prototype.qs = function (obj, arr, item, fn) { // If the array is empty then return index zero if (!arr.length) { return 0; } var lastMidwayIndex = -1, midwayIndex, lookupItem, result, start = 0, end = arr.length - 1; // Loop the data until our range overlaps while (end >= start) { // Calculate the midway point (divide and conquer) midwayIndex = Math.floor((start + end) / 2); if (lastMidwayIndex === midwayIndex) { // No more items to scan break; } // Get the item to compare against lookupItem = arr[midwayIndex]; if (lookupItem !== undefined) { // Compare items result = fn(this, obj, item, lookupItem); if (result > 0) { start = midwayIndex + 1; } if (result < 0) { end = midwayIndex - 1; } } lastMidwayIndex = midwayIndex; } if (result > 0) { return midwayIndex + 1; } else { return midwayIndex; } }; /** * Calculates the sort position of an item against another item. * @param {object} sorter An object or instance that contains * sortAsc and sortDesc methods. * @param {object} obj The document to compare. * @param {string} a The first key to compare. * @param {string} b The second key to compare. * @returns {number} Either 1 for sort a after b or -1 to sort * a before b. * @private */ ActiveBucket.prototype._sortFunc = function (sorter, obj, a, b) { var aVals = a.split('.:.'), bVals = b.split('.:.'), arr = sorter._keyArr, count = arr.length, index, sortType, castType; for (index = 0; index < count; index++) { sortType = arr[index]; castType = typeof obj[sortType.key]; if (castType === 'number') { aVals[index] = Number(aVals[index]); bVals[index] = Number(bVals[index]); } // Check for non-equal items if (aVals[index] !== bVals[index]) { // Return the sorted items if (sortType.dir === 1) { return sorter.sortAsc(aVals[index], bVals[index]); } if (sortType.dir === -1) { return sorter.sortDesc(aVals[index], bVals[index]); } } } }; /** * Inserts a document into the active bucket. * @param {object} obj The document to insert. * @returns {number} The index the document now occupies. */ ActiveBucket.prototype.insert = function (obj) { var key, keyIndex; key = this.documentKey(obj); keyIndex = this._data.indexOf(key); if (keyIndex === -1) { // Insert key keyIndex = this.qs(obj, this._data, key, this._sortFunc); this._data.splice(keyIndex, 0, key); } else { this._data.splice(keyIndex, 0, key); } this._objLookup[obj[this._primaryKey]] = key; this._count++; return keyIndex; }; /** * Removes a document from the active bucket. * @param {object} obj The document to remove. * @returns {boolean} True if the document was removed * successfully or false if it wasn't found in the active * bucket. */ ActiveBucket.prototype.remove = function (obj) { var key, keyIndex; key = this._objLookup[obj[this._primaryKey]]; if (key) { keyIndex = this._data.indexOf(key); if (keyIndex > -1) { this._data.splice(keyIndex, 1); delete this._objLookup[obj[this._primaryKey]]; this._count--; return true; } else { return false; } } return false; }; /** * Get the index that the passed document currently occupies * or the index it will occupy if added to the active bucket. * @param {object} obj The document to get the index for. * @returns {number} The index. */ ActiveBucket.prototype.index = function (obj) { var key, keyIndex; key = this.documentKey(obj); keyIndex = this._data.indexOf(key); if (keyIndex === -1) { // Get key index keyIndex = this.qs(obj, this._data, key, this._sortFunc); } return keyIndex; }; /** * The key that represents the passed document. * @param {object} obj The document to get the key for. * @returns {string} The document key. */ ActiveBucket.prototype.documentKey = function (obj) { var key = '', arr = this._keyArr, count = arr.length, index, sortType; for (index = 0; index < count; index++) { sortType = arr[index]; if (key) { key += '.:.'; } key += obj[sortType.key]; } // Add the unique identifier on the end of the key key += '.:.' + obj[this._primaryKey]; return key; }; /** * Get the number of documents currently indexed in the active * bucket instance. * @returns {number} The number of documents. */ ActiveBucket.prototype.count = function () { return this._count; }; Shared.finishModule('ActiveBucket'); module.exports = ActiveBucket; },{"./Shared":35}],3:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'); var BinaryTree = function (data, compareFunc, hashFunc) { this.init.apply(this, arguments); }; BinaryTree.prototype.init = function (data, index, compareFunc, hashFunc) { this._store = []; if (index !== undefined) { this.index(index); } if (compareFunc !== undefined) { this.compareFunc(compareFunc); } if (hashFunc !== undefined) { this.hashFunc(hashFunc); } if (data !== undefined) { this.data(data); } }; Shared.addModule('BinaryTree', BinaryTree); Shared.mixin(BinaryTree.prototype, 'Mixin.ChainReactor'); Shared.mixin(BinaryTree.prototype, 'Mixin.Sorting'); Shared.mixin(BinaryTree.prototype, 'Mixin.Common'); Shared.synthesize(BinaryTree.prototype, 'compareFunc'); Shared.synthesize(BinaryTree.prototype, 'hashFunc'); Shared.synthesize(BinaryTree.prototype, 'indexDir'); Shared.synthesize(BinaryTree.prototype, 'index', function (index) { if (index !== undefined) { if (!(index instanceof Array)) { // Convert the index object to an array of key val objects index = this.keys(index); } } return this.$super.call(this, index); }); BinaryTree.prototype.keys = function (obj) { var i, keys = []; for (i in obj) { if (obj.hasOwnProperty(i)) { keys.push({ key: i, val: obj[i] }); } } return keys; }; BinaryTree.prototype.data = function (val) { if (val !== undefined) { this._data = val; if (this._hashFunc) { this._hash = this._hashFunc(val); } return this; } return this._data; }; BinaryTree.prototype.push = function (val) { if (val !== undefined) { this._store.push(val); return this; } return false; }; BinaryTree.prototype.pull = function (val) { if (val !== undefined) { var index = this._store.indexOf(val); if (index > -1) { this._store.splice(index, 1); return true; } } return false; }; /** * Default compare method. Can be overridden. * @param a * @param b * @returns {number} * @private */ BinaryTree.prototype._compareFunc = function (a, b) { // Loop the index array var i, indexData, result = 0; for (i = 0; i < this._index.length; i++) { indexData = this._index[i]; if (indexData.val === 1) { result = this.sortAsc(a[indexData.key], b[indexData.key]); } else if (indexData.val === -1) { result = this.sortDesc(a[indexData.key], b[indexData.key]); } if (result !== 0) { return result; } } return result; }; /** * Default hash function. Can be overridden. * @param obj * @private */ BinaryTree.prototype._hashFunc = function (obj) { /*var i, indexData, hash = ''; for (i = 0; i < this._index.length; i++) { indexData = this._index[i]; if (hash) { hash += '_'; } hash += obj[indexData.key]; } return hash;*/ return obj[this._index[0].key]; }; BinaryTree.prototype.insert = function (data) { var result, inserted, failed, i; if (data instanceof Array) { // Insert array of data inserted = []; failed = []; for (i = 0; i < data.length; i++) { if (this.insert(data[i])) { inserted.push(data[i]); } else { failed.push(data[i]); } } return { inserted: inserted, failed: failed }; } if (!this._data) { // Insert into this node (overwrite) as there is no data this.data(data); //this.push(data); return true; } result = this._compareFunc(this._data, data); if (result === 0) { this.push(data); // Less than this node if (this._left) { // Propagate down the left branch this._left.insert(data); } else { // Assign to left branch this._left = new BinaryTree(data, this._index, this._compareFunc, this._hashFunc); } return true; } if (result === -1) { // Greater than this node if (this._right) { // Propagate down the right branch this._right.insert(data); } else { // Assign to right branch this._right = new BinaryTree(data, this._index, this._compareFunc, this._hashFunc); } return true; } if (result === 1) { // Less than this node if (this._left) { // Propagate down the left branch this._left.insert(data); } else { // Assign to left branch this._left = new BinaryTree(data, this._index, this._compareFunc, this._hashFunc); } return true; } return false; }; BinaryTree.prototype.lookup = function (data, resultArr) { var result = this._compareFunc(this._data, data); resultArr = resultArr || []; if (result === 0) { if (this._left) { this._left.lookup(data, resultArr); } resultArr.push(this._data); if (this._right) { this._right.lookup(data, resultArr); } } if (result === -1) { if (this._right) { this._right.lookup(data, resultArr); } } if (result === 1) { if (this._left) { this._left.lookup(data, resultArr); } } return resultArr; }; BinaryTree.prototype.inOrder = function (type, resultArr) { resultArr = resultArr || []; if (this._left) { this._left.inOrder(type, resultArr); } switch (type) { case 'hash': resultArr.push(this._hash); break; case 'key': resultArr.push(this._data); break; default: resultArr.push({ key: this._key, arr: this._store }); break; } if (this._right) { this._right.inOrder(type, resultArr); } return resultArr; }; Shared.finishModule('BinaryTree'); module.exports = BinaryTree; },{"./Shared":35}],4:[function(_dereq_,module,exports){ "use strict"; var Shared, Db, Metrics, KeyValueStore, Path, IndexHashMap, IndexBinaryTree, Crc, Overload, ReactorIO; Shared = _dereq_('./Shared'); /** * Creates a new collection. Collections store multiple documents and * handle CRUD against those documents. * @constructor */ var Collection = function (name) { this.init.apply(this, arguments); }; Collection.prototype.init = function (name, options) { this._primaryKey = '_id'; this._primaryIndex = new KeyValueStore('primary'); this._primaryCrc = new KeyValueStore('primaryCrc'); this._crcLookup = new KeyValueStore('crcLookup'); this._name = name; this._data = []; this._metrics = new Metrics(); this._options = options || { changeTimestamp: false }; // Create an object to store internal protected data this._metaData = {}; this._deferQueue = { insert: [], update: [], remove: [], upsert: [] }; this._deferThreshold = { insert: 100, update: 100, remove: 100, upsert: 100 }; this._deferTime = { insert: 1, update: 1, remove: 1, upsert: 1 }; // Set the subset to itself since it is the root collection this.subsetOf(this); }; Shared.addModule('Collection', Collection); Shared.mixin(Collection.prototype, 'Mixin.Common'); Shared.mixin(Collection.prototype, 'Mixin.Events'); Shared.mixin(Collection.prototype, 'Mixin.ChainReactor'); Shared.mixin(Collection.prototype, 'Mixin.CRUD'); Shared.mixin(Collection.prototype, 'Mixin.Constants'); Shared.mixin(Collection.prototype, 'Mixin.Triggers'); Shared.mixin(Collection.prototype, 'Mixin.Sorting'); Shared.mixin(Collection.prototype, 'Mixin.Matching'); Shared.mixin(Collection.prototype, 'Mixin.Updating'); Metrics = _dereq_('./Metrics'); KeyValueStore = _dereq_('./KeyValueStore'); Path = _dereq_('./Path'); IndexHashMap = _dereq_('./IndexHashMap'); IndexBinaryTree = _dereq_('./IndexBinaryTree'); Crc = _dereq_('./Crc'); Db = Shared.modules.Db; Overload = _dereq_('./Overload'); ReactorIO = _dereq_('./ReactorIO'); /** * Returns a checksum of a string. * @param {String} string The string to checksum. * @return {String} The checksum generated. */ Collection.prototype.crc = Crc; /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(Collection.prototype, 'state'); /** * Gets / sets the name of the collection. * @param {String=} val The name of the collection to set. * @returns {*} */ Shared.synthesize(Collection.prototype, 'name'); /** * Gets / sets the metadata stored in the collection. */ Shared.synthesize(Collection.prototype, 'metaData'); /** * Get the data array that represents the collection's data. * This data is returned by reference and should not be altered outside * of the provided CRUD functionality of the collection as doing so * may cause unstable index behaviour within the collection. * @returns {Array} */ Collection.prototype.data = function () { return this._data; }; /** * Drops a collection and all it's stored data from the database. * @returns {boolean} True on success, false on failure. */ Collection.prototype.drop = function (callback) { var key; if (!this.isDropped()) { if (this._db && this._db._collection && this._name) { if (this.debug()) { console.log(this.logIdentifier() + ' Dropping'); } this._state = 'dropped'; this.emit('drop', this); delete this._db._collection[this._name]; // Remove any reactor IO chain links if (this._collate) { for (key in this._collate) { if (this._collate.hasOwnProperty(key)) { this.collateRemove(key); } } } delete this._primaryKey; delete this._primaryIndex; delete this._primaryCrc; delete this._crcLookup; delete this._name; delete this._data; delete this._metrics; if (callback) { callback(false, true); } return true; } } else { if (callback) { callback(false, true); } return true; } if (callback) { callback(false, true); } return false; }; /** * Gets / sets the primary key for this collection. * @param {String=} keyName The name of the primary key. * @returns {*} */ Collection.prototype.primaryKey = function (keyName) { if (keyName !== undefined) { if (this._primaryKey !== keyName) { this._primaryKey = keyName; // Set the primary key index primary key this._primaryIndex.primaryKey(keyName); // Rebuild the primary key index this.rebuildPrimaryKeyIndex(); } return this; } return this._primaryKey; }; /** * Handles insert events and routes changes to binds and views as required. * @param {Array} inserted An array of inserted documents. * @param {Array} failed An array of documents that failed to insert. * @private */ Collection.prototype._onInsert = function (inserted, failed) { this.emit('insert', inserted, failed); }; /** * Handles update events and routes changes to binds and views as required. * @param {Array} items An array of updated documents. * @private */ Collection.prototype._onUpdate = function (items) { this.emit('update', items); }; /** * Handles remove events and routes changes to binds and views as required. * @param {Array} items An array of removed documents. * @private */ Collection.prototype._onRemove = function (items) { this.emit('remove', items); }; /** * Handles any change to the collection. * @private */ Collection.prototype._onChange = function () { if (this._options.changeTimestamp) { // Record the last change timestamp this._metaData.lastChange = new Date(); } }; /** * Gets / sets the db instance this class instance belongs to. * @param {Db=} db The db instance. * @returns {*} */ Shared.synthesize(Collection.prototype, 'db', function (db) { if (db) { if (this.primaryKey() === '_id') { // Set primary key to the db's key by default this.primaryKey(db.primaryKey()); // Apply the same debug settings this.debug(db.debug()); } } return this.$super.apply(this, arguments); }); /** * Gets / sets mongodb emulation mode. * @param {Boolean=} val True to enable, false to disable. * @returns {*} */ Shared.synthesize(Collection.prototype, 'mongoEmulation'); /** * Sets the collection's data to the array / documents passed. If any * data already exists in the collection it will be removed before the * new data is set. * @param {Array|Object} data The array of documents or a single document * that will be set as the collections data. * @param options Optional options object. * @param callback Optional callback function. */ Collection.prototype.setData = function (data, options, callback) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } if (data) { var op = this._metrics.create('setData'); op.start(); options = this.options(options); this.preSetData(data, options, callback); if (options.$decouple) { data = this.decouple(data); } if (!(data instanceof Array)) { data = [data]; } op.time('transformIn'); data = this.transformIn(data); op.time('transformIn'); var oldData = [].concat(this._data); this._dataReplace(data); // Update the primary key index op.time('Rebuild Primary Key Index'); this.rebuildPrimaryKeyIndex(options); op.time('Rebuild Primary Key Index'); // Rebuild all other indexes op.time('Rebuild All Other Indexes'); this._rebuildIndexes(); op.time('Rebuild All Other Indexes'); op.time('Resolve chains'); this.chainSend('setData', data, {oldData: oldData}); op.time('Resolve chains'); op.stop(); this._onChange(); this.emit('setData', this._data, oldData); } if (callback) { callback(false); } return this; }; /** * Drops and rebuilds the primary key index for all documents in the collection. * @param {Object=} options An optional options object. * @private */ Collection.prototype.rebuildPrimaryKeyIndex = function (options) { options = options || { $ensureKeys: undefined, $violationCheck: undefined }; var ensureKeys = options && options.$ensureKeys !== undefined ? options.$ensureKeys : true, violationCheck = options && options.$violationCheck !== undefined ? options.$violationCheck : true, arr, arrCount, arrItem, pIndex = this._primaryIndex, crcIndex = this._primaryCrc, crcLookup = this._crcLookup, pKey = this._primaryKey, jString; // Drop the existing primary index pIndex.truncate(); crcIndex.truncate(); crcLookup.truncate(); // Loop the data and check for a primary key in each object arr = this._data; arrCount = arr.length; while (arrCount--) { arrItem = arr[arrCount]; if (ensureKeys) { // Make sure the item has a primary key this.ensurePrimaryKey(arrItem); } if (violationCheck) { // Check for primary key violation if (!pIndex.uniqueSet(arrItem[pKey], arrItem)) { // Primary key violation throw(this.logIdentifier() + ' Call to setData on collection failed because your data violates the primary key unique constraint. One or more documents are using the same primary key: ' + arrItem[this._primaryKey]); } } else { pIndex.set(arrItem[pKey], arrItem); } // Generate a CRC string jString = JSON.stringify(arrItem); crcIndex.set(arrItem[pKey], jString); crcLookup.set(jString, arrItem); } }; /** * Checks for a primary key on the document and assigns one if none * currently exists. * @param {Object} obj The object to check a primary key against. * @private */ Collection.prototype.ensurePrimaryKey = function (obj) { if (obj[this._primaryKey] === undefined) { // Assign a primary key automatically obj[this._primaryKey] = this.objectId(); } }; /** * Clears all data from the collection. * @returns {Collection} */ Collection.prototype.truncate = function () { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } this.emit('truncate', this._data); // Clear all the data from the collection this._data.length = 0; // Re-create the primary index data this._primaryIndex = new KeyValueStore('primary'); this._primaryCrc = new KeyValueStore('primaryCrc'); this._crcLookup = new KeyValueStore('crcLookup'); this._onChange(); this.deferEmit('change', {type: 'truncate'}); return this; }; /** * Modifies an existing document or documents in a collection. This will update * all matches for 'query' with the data held in 'update'. It will not overwrite * the matched documents with the update document. * * @param {Object} obj The document object to upsert or an array containing * documents to upsert. * * If the document contains a primary key field (based on the collections's primary * key) then the database will search for an existing document with a matching id. * If a matching document is found, the document will be updated. Any keys that * match keys on the existing document will be overwritten with new data. Any keys * that do not currently exist on the document will be added to the document. * * If the document does not contain an id or the id passed does not match an existing * document, an insert is performed instead. If no id is present a new primary key * id is provided for the item. * * @param {Function=} callback Optional callback method. * @returns {Object} An object containing two keys, "op" contains either "insert" or * "update" depending on the type of operation that was performed and "result" * contains the return data from the operation used. */ Collection.prototype.upsert = function (obj, callback) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } if (obj) { var queue = this._deferQueue.upsert, deferThreshold = this._deferThreshold.upsert; var returnData = {}, query, i; // Determine if the object passed is an array or not if (obj instanceof Array) { if (obj.length > deferThreshold) { // Break up upsert into blocks this._deferQueue.upsert = queue.concat(obj); // Fire off the insert queue handler this.processQueue('upsert', callback); return {}; } else { // Loop the array and upsert each item returnData = []; for (i = 0; i < obj.length; i++) { returnData.push(this.upsert(obj[i])); } if (callback) { callback(); } return returnData; } } // Determine if the operation is an insert or an update if (obj[this._primaryKey]) { // Check if an object with this primary key already exists query = {}; query[this._primaryKey] = obj[this._primaryKey]; if (this._primaryIndex.lookup(query)[0]) { // The document already exists with this id, this operation is an update returnData.op = 'update'; } else { // No document with this id exists, this operation is an insert returnData.op = 'insert'; } } else { // The document passed does not contain an id, this operation is an insert returnData.op = 'insert'; } switch (returnData.op) { case 'insert': returnData.result = this.insert(obj); break; case 'update': returnData.result = this.update(query, obj); break; default: break; } return returnData; } else { if (callback) { callback(); } } return {}; }; /** * Executes a method against each document that matches query and returns an * array of documents that may have been modified by the method. * @param {Object} query The query object. * @param {Function} func The method that each document is passed to. If this method * returns false for a particular document it is excluded from the results. * @param {Object=} options Optional options object. * @returns {Array} */ Collection.prototype.filter = function (query, func, options) { return (this.find(query, options)).filter(func); }; /** * Executes a method against each document that matches query and then executes * an update based on the return data of the method. * @param {Object} query The query object. * @param {Function} func The method that each document is passed to. If this method * returns false for a particular document it is excluded from the update. * @param {Object=} options Optional options object passed to the initial find call. * @returns {Array} */ Collection.prototype.filterUpdate = function (query, func, options) { var items = this.find(query, options), results = [], singleItem, singleQuery, singleUpdate, pk = this.primaryKey(), i; for (i = 0; i < items.length; i++) { singleItem = items[i]; singleUpdate = func(singleItem); if (singleUpdate) { singleQuery = {}; singleQuery[pk] = singleItem[pk]; results.push(this.update(singleQuery, singleUpdate)); } } return results; }; /** * Modifies an existing document or documents in a collection. This will update * all matches for 'query' with the data held in 'update'. It will not overwrite * the matched documents with the update document. * * @param {Object} query The query that must be matched for a document to be * operated on. * @param {Object} update The object containing updated key/values. Any keys that * match keys on the existing document will be overwritten with this data. Any * keys that do not currently exist on the document will be added to the document. * @param {Object=} options An options object. * @returns {Array} The items that were updated. */ Collection.prototype.update = function (query, update, options) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } // Decouple the update data update = this.decouple(update); // Convert queries from mongo dot notation to forerunner queries if (this.mongoEmulation()) { this.convertToFdb(query); this.convertToFdb(update); } // Handle transform update = this.transformIn(update); if (this.debug()) { console.log(this.logIdentifier() + ' Updating some data'); } var self = this, op = this._metrics.create('update'), dataSet, updated, updateCall = function (referencedDoc) { var oldDoc = self.decouple(referencedDoc), newDoc, triggerOperation, result; if (self.willTrigger(self.TYPE_UPDATE, self.PHASE_BEFORE) || self.willTrigger(self.TYPE_UPDATE, self.PHASE_AFTER)) { newDoc = self.decouple(referencedDoc); triggerOperation = { type: 'update', query: self.decouple(query), update: self.decouple(update), options: self.decouple(options), op: op }; // Update newDoc with the update criteria so we know what the data will look // like AFTER the update is processed result = self.updateObject(newDoc, triggerOperation.update, triggerOperation.query, triggerOperation.options, ''); if (self.processTrigger(triggerOperation, self.TYPE_UPDATE, self.PHASE_BEFORE, referencedDoc, newDoc) !== false) { // No triggers complained so let's execute the replacement of the existing // object with the new one result = self.updateObject(referencedDoc, newDoc, triggerOperation.query, triggerOperation.options, ''); // NOTE: If for some reason we would only like to fire this event if changes are actually going // to occur on the object from the proposed update then we can add "result &&" to the if self.processTrigger(triggerOperation, self.TYPE_UPDATE, self.PHASE_AFTER, oldDoc, newDoc); } else { // Trigger cancelled operation so tell result that it was not updated result = false; } } else { // No triggers complained so let's execute the replacement of the existing // object with the new one result = self.updateObject(referencedDoc, update, query, options, ''); } // Inform indexes of the change self._updateIndexes(oldDoc, referencedDoc); return result; }; op.start(); op.time('Retrieve documents to update'); dataSet = this.find(query, {$decouple: false}); op.time('Retrieve documents to update'); if (dataSet.length) { op.time('Update documents'); updated = dataSet.filter(updateCall); op.time('Update documents'); if (updated.length) { op.time('Resolve chains'); this.chainSend('update', { query: query, update: update, dataSet: dataSet }, options); op.time('Resolve chains'); this._onUpdate(updated); this._onChange(); this.deferEmit('change', {type: 'update', data: updated}); } } op.stop(); // TODO: Should we decouple the updated array before return by default? return updated || []; }; /** * Replaces an existing object with data from the new object without * breaking data references. * @param {Object} currentObj The object to alter. * @param {Object} newObj The new object to overwrite the existing one with. * @returns {*} Chain. * @private */ Collection.prototype._replaceObj = function (currentObj, newObj) { var i; // Check if the new document has a different primary key value from the existing one // Remove item from indexes this._removeFromIndexes(currentObj); // Remove existing keys from current object for (i in currentObj) { if (currentObj.hasOwnProperty(i)) { delete currentObj[i]; } } // Add new keys to current object for (i in newObj) { if (newObj.hasOwnProperty(i)) { currentObj[i] = newObj[i]; } } // Update the item in the primary index if (!this._insertIntoIndexes(currentObj)) { throw(this.logIdentifier() + ' Primary key violation in update! Key violated: ' + currentObj[this._primaryKey]); } // Update the object in the collection data //this._data.splice(this._data.indexOf(currentObj), 1, newObj); return this; }; /** * Helper method to update a document from it's id. * @param {String} id The id of the document. * @param {Object} update The object containing the key/values to update to. * @returns {Array} The items that were updated. */ Collection.prototype.updateById = function (id, update) { var searchObj = {}; searchObj[this._primaryKey] = id; return this.update(searchObj, update); }; /** * Internal method for document updating. * @param {Object} doc The document to update. * @param {Object} update The object with key/value pairs to update the document with. * @param {Object} query The query object that we need to match to perform an update. * @param {Object} options An options object. * @param {String} path The current recursive path. * @param {String} opType The type of update operation to perform, if none is specified * default is to set new data against matching fields. * @returns {Boolean} True if the document was updated with new / changed data or * false if it was not updated because the data was the same. * @private */ Collection.prototype.updateObject = function (doc, update, query, options, path, opType) { // TODO: This method is long, try to break it into smaller pieces update = this.decouple(update); // Clear leading dots from path path = path || ''; if (path.substr(0, 1) === '.') { path = path.substr(1, path.length -1); } //var oldDoc = this.decouple(doc), var updated = false, recurseUpdated = false, operation, tmpArray, tmpIndex, tmpCount, tempIndex, pathInstance, sourceIsArray, updateIsArray, i; // Loop each key in the update object for (i in update) { if (update.hasOwnProperty(i)) { // Reset operation flag operation = false; // Check if the property starts with a dollar (function) if (i.substr(0, 1) === '$') { // Check for commands switch (i) { case '$key': case '$index': case '$data': case '$min': case '$max': // Ignore some operators operation = true; break; case '$each': operation = true; // Loop over the array of updates and run each one tmpCount = update.$each.length; for (tmpIndex = 0; tmpIndex < tmpCount; tmpIndex++) { recurseUpdated = this.updateObject(doc, update.$each[tmpIndex], query, options, path); if (recurseUpdated) { updated = true; } } updated = updated || recurseUpdated; break; default: operation = true; // Now run the operation recurseUpdated = this.updateObject(doc, update[i], query, options, path, i); updated = updated || recurseUpdated; break; } } // Check if the key has a .$ at the end, denoting an array lookup if (this._isPositionalKey(i)) { operation = true; // Modify i to be the name of the field i = i.substr(0, i.length - 2); pathInstance = new Path(path + '.' + i); // Check if the key is an array and has items if (doc[i] && doc[i] instanceof Array && doc[i].length) { tmpArray = []; // Loop the array and find matches to our search for (tmpIndex = 0; tmpIndex < doc[i].length; tmpIndex++) { if (this._match(doc[i][tmpIndex], pathInstance.value(query)[0], options, '', {})) { tmpArray.push(tmpIndex); } } // Loop the items that matched and update them for (tmpIndex = 0; tmpIndex < tmpArray.length; tmpIndex++) { recurseUpdated = this.updateObject(doc[i][tmpArray[tmpIndex]], update[i + '.$'], query, options, path + '.' + i, opType); updated = updated || recurseUpdated; } } } if (!operation) { if (!opType && typeof(update[i]) === 'object') { if (doc[i] !== null && typeof(doc[i]) === 'object') { // Check if we are dealing with arrays sourceIsArray = doc[i] instanceof Array; updateIsArray = update[i] instanceof Array; if (sourceIsArray || updateIsArray) { // Check if the update is an object and the doc is an array if (!updateIsArray && sourceIsArray) { // Update is an object, source is an array so match the array items // with our query object to find the one to update inside this array // Loop the array and find matches to our search for (tmpIndex = 0; tmpIndex < doc[i].length; tmpIndex++) { recurseUpdated = this.updateObject(doc[i][tmpIndex], update[i], query, options, path + '.' + i, opType); updated = updated || recurseUpdated; } } else { // Either both source and update are arrays or the update is // an array and the source is not, so set source to update if (doc[i] !== update[i]) { this._updateProperty(doc, i, update[i]); updated = true; } } } else { // The doc key is an object so traverse the // update further recurseUpdated = this.updateObject(doc[i], update[i], query, options, path + '.' + i, opType); updated = updated || recurseUpdated; } } else { if (doc[i] !== update[i]) { this._updateProperty(doc, i, update[i]); updated = true; } } } else { switch (opType) { case '$inc': var doUpdate = true; // Check for a $min / $max operator if (update[i] > 0) { if (update.$max) { // Check current value if (doc[i] >= update.$max) { // Don't update doUpdate = false; } } } else if (update[i] < 0) { if (update.$min) { // Check current value if (doc[i] <= update.$min) { // Don't update doUpdate = false; } } } if (doUpdate) { this._updateIncrement(doc, i, update[i]); updated = true; } break; case '$cast': // Casts a property to the type specified if it is not already // that type. If the cast is an array or an object and the property // is not already that type a new array or object is created and // set to the property, overwriting the previous value switch (update[i]) { case 'array': if (!(doc[i] instanceof Array)) { // Cast to an array this._updateProperty(doc, i, update.$data || []); updated = true; } break; case 'object': if (!(doc[i] instanceof Object) || (doc[i] instanceof Array)) { // Cast to an object this._updateProperty(doc, i, update.$data || {}); updated = true; } break; case 'number': if (typeof doc[i] !== 'number') { // Cast to a number this._updateProperty(doc, i, Number(doc[i])); updated = true; } break; case 'string': if (typeof doc[i] !== 'string') { // Cast to a string this._updateProperty(doc, i, String(doc[i])); updated = true; } break; default: throw(this.logIdentifier() + ' Cannot update cast to unknown type: ' + update[i]); } break; case '$push': // Check if the target key is undefined and if so, create an array if (doc[i] === undefined) { // Initialise a new array this._updateProperty(doc, i, []); } // Check that the target key is an array if (doc[i] instanceof Array) { // Check for a $position modifier with an $each if (update[i].$position !== undefined && update[i].$each instanceof Array) { // Grab the position to insert at tempIndex = update[i].$position; // Loop the each array and push each item tmpCount = update[i].$each.length; for (tmpIndex = 0; tmpIndex < tmpCount; tmpIndex++) { this._updateSplicePush(doc[i], tempIndex + tmpIndex, update[i].$each[tmpIndex]); } } else if (update[i].$each instanceof Array) { // Do a loop over the each to push multiple items tmpCount = update[i].$each.length; for (tmpIndex = 0; tmpIndex < tmpCount; tmpIndex++) { this._updatePush(doc[i], update[i].$each[tmpIndex]); } } else { // Do a standard push this._updatePush(doc[i], update[i]); } updated = true; } else { throw(this.logIdentifier() + ' Cannot push to a key that is not an array! (' + i + ')'); } break; case '$pull': if (doc[i] instanceof Array) { tmpArray = []; // Loop the array and find matches to our search for (tmpIndex = 0; tmpIndex < doc[i].length; tmpIndex++) { if (this._match(doc[i][tmpIndex], update[i], options, '', {})) { tmpArray.push(tmpIndex); } } tmpCount = tmpArray.length; // Now loop the pull array and remove items to be pulled while (tmpCount--) { this._updatePull(doc[i], tmpArray[tmpCount]); updated = true; } } break; case '$pullAll': if (doc[i] instanceof Array) { if (update[i] instanceof Array) { tmpArray = doc[i]; tmpCount = tmpArray.length; if (tmpCount > 0) { // Now loop the pull array and remove items to be pulled while (tmpCount--) { for (tempIndex = 0; tempIndex < update[i].length; tempIndex++) { if (tmpArray[tmpCount] === update[i][tempIndex]) { this._updatePull(doc[i], tmpCount); tmpCount--; updated = true; } } if (tmpCount < 0) { break; } } } } else { throw(this.logIdentifier() + ' Cannot pullAll without being given an array of values to pull! (' + i + ')'); } } break; case '$addToSet': // Check if the target key is undefined and if so, create an array if (doc[i] === undefined) { // Initialise a new array this._updateProperty(doc, i, []); } // Check that the target key is an array if (doc[i] instanceof Array) { // Loop the target array and check for existence of item var targetArr = doc[i], targetArrIndex, targetArrCount = targetArr.length, objHash, addObj = true, optionObj = (options && options.$addToSet), hashMode, pathSolver; // Check if we have an options object for our operation if (update[i].$key) { hashMode = false; pathSolver = new Path(update[i].$key); objHash = pathSolver.value(update[i])[0]; // Remove the key from the object before we add it delete update[i].$key; } else if (optionObj && optionObj.key) { hashMode = false; pathSolver = new Path(optionObj.key); objHash = pathSolver.value(update[i])[0]; } else { objHash = JSON.stringify(update[i]); hashMode = true; } for (targetArrIndex = 0; targetArrIndex < targetArrCount; targetArrIndex++) { if (hashMode) { // Check if objects match via a string hash (JSON) if (JSON.stringify(targetArr[targetArrIndex]) === objHash) { // The object already exists, don't add it addObj = false; break; } } else { // Check if objects match based on the path if (objHash === pathSolver.value(targetArr[targetArrIndex])[0]) { // The object already exists, don't add it addObj = false; break; } } } if (addObj) { this._updatePush(doc[i], update[i]); updated = true; } } else { throw(this.logIdentifier() + ' Cannot addToSet on a key that is not an array! (' + i + ')'); } break; case '$splicePush': // Check if the target key is undefined and if so, create an array if (doc[i] === undefined) { // Initialise a new array this._updateProperty(doc, i, []); } // Check that the target key is an array if (doc[i] instanceof Array) { tempIndex = update.$index; if (tempIndex !== undefined) { delete update.$index; // Check for out of bounds index if (tempIndex > doc[i].length) { tempIndex = doc[i].length; } this._updateSplicePush(doc[i], tempIndex, update[i]); updated = true; } else { throw(this.logIdentifier() + ' Cannot splicePush without a $index integer value!'); } } else { throw(this.logIdentifier() + ' Cannot splicePush with a key that is not an array! (' + i + ')'); } break; case '$move': if (doc[i] instanceof Array) { // Loop the array and find matches to our search for (tmpIndex = 0; tmpIndex < doc[i].length; tmpIndex++) { if (this._match(doc[i][tmpIndex], update[i], options, '', {})) { var moveToIndex = update.$index; if (moveToIndex !== undefined) { delete update.$index; this._updateSpliceMove(doc[i], tmpIndex, moveToIndex); updated = true; } else { throw(this.logIdentifier() + ' Cannot move without a $index integer value!'); } break; } } } else { throw(this.logIdentifier() + ' Cannot move on a key that is not an array! (' + i + ')'); } break; case '$mul': this._updateMultiply(doc, i, update[i]); updated = true; break; case '$rename': this._updateRename(doc, i, update[i]); updated = true; break; case '$overwrite': this._updateOverwrite(doc, i, update[i]); updated = true; break; case '$unset': this._updateUnset(doc, i); updated = true; break; case '$clear': this._updateClear(doc, i); updated = true; break; case '$pop': if (doc[i] instanceof Array) { if (this._updatePop(doc[i], update[i])) { updated = true; } } else { throw(this.logIdentifier() + ' Cannot pop from a key that is not an array! (' + i + ')'); } break; case '$toggle': // Toggle the boolean property between true and false this._updateProperty(doc, i, !doc[i]); updated = true; break; default: if (doc[i] !== update[i]) { this._updateProperty(doc, i, update[i]); updated = true; } break; } } } } } return updated; }; /** * Determines if the passed key has an array positional mark (a dollar at the end * of its name). * @param {String} key The key to check. * @returns {Boolean} True if it is a positional or false if not. * @private */ Collection.prototype._isPositionalKey = function (key) { return key.substr(key.length - 2, 2) === '.$'; }; /** * Removes any documents from the collection that match the search query * key/values. * @param {Object} query The query object. * @param {Object=} options An options object. * @param {Function=} callback A callback method. * @returns {Array} An array of the documents that were removed. */ Collection.prototype.remove = function (query, options, callback) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } var self = this, dataSet, index, arrIndex, returnArr, removeMethod, triggerOperation, doc, newDoc; if (typeof(options) === 'function') { callback = options; options = {}; } // Convert queries from mongo dot notation to forerunner queries if (this.mongoEmulation()) { this.convertToFdb(query); } if (query instanceof Array) { returnArr = []; for (arrIndex = 0; arrIndex < query.length; arrIndex++) { returnArr.push(this.remove(query[arrIndex], {noEmit: true})); } if (!options || (options && !options.noEmit)) { this._onRemove(returnArr); } if (callback) { callback(false, returnArr); } return returnArr; } else { dataSet = this.find(query, {$decouple: false}); if (dataSet.length) { removeMethod = function (dataItem) { // Remove the item from the collection's indexes self._removeFromIndexes(dataItem); // Remove data from internal stores index = self._data.indexOf(dataItem); self._dataRemoveAtIndex(index); }; // Remove the data from the collection for (var i = 0; i < dataSet.length; i++) { doc = dataSet[i]; if (self.willTrigger(self.TYPE_REMOVE, self.PHASE_BEFORE) || self.willTrigger(self.TYPE_REMOVE, self.PHASE_AFTER)) { triggerOperation = { type: 'remove' }; newDoc = self.decouple(doc); if (self.processTrigger(triggerOperation, self.TYPE_REMOVE, self.PHASE_BEFORE, newDoc, newDoc) !== false) { // The trigger didn't ask to cancel so execute the removal method removeMethod(doc); self.processTrigger(triggerOperation, self.TYPE_REMOVE, self.PHASE_AFTER, newDoc, newDoc); } } else { // No triggers to execute removeMethod(doc); } } //op.time('Resolve chains'); this.chainSend('remove', { query: query, dataSet: dataSet }, options); //op.time('Resolve chains'); if (!options || (options && !options.noEmit)) { this._onRemove(dataSet); } this._onChange(); this.deferEmit('change', {type: 'remove', data: dataSet}); } if (callback) { callback(false, dataSet); } return dataSet; } }; /** * Helper method that removes a document that matches the given id. * @param {String} id The id of the document to remove. * @returns {Array} An array of documents that were removed. */ Collection.prototype.removeById = function (id) { var searchObj = {}; searchObj[this._primaryKey] = id; return this.remove(searchObj); }; /** * Queues an event to be fired. This has automatic de-bouncing so that any * events of the same type that occur within 100 milliseconds of a previous * one will all be wrapped into a single emit rather than emitting tons of * events for lots of chained inserts etc. Only the data from the last * de-bounced event will be emitted. * @param {String} eventName The name of the event to emit. * @param {*=} data Optional data to emit with the event. * @private */ Collection.prototype.deferEmit = function (eventName, data) { var self = this, args; if (!this._noEmitDefer && (!this._db || (this._db && !this._db._noEmitDefer))) { args = arguments; // Check for an existing timeout this._deferTimeout = this._deferTimeout || {}; if (this._deferTimeout[eventName]) { clearTimeout(this._deferTimeout[eventName]); } // Set a timeout this._deferTimeout[eventName] = setTimeout(function () { if (self.debug()) { console.log(self.logIdentifier() + ' Emitting ' + args[0]); } self.emit.apply(self, args); }, 1); } else { this.emit.apply(this, arguments); } }; /** * Processes a deferred action queue. * @param {String} type The queue name to process. * @param {Function} callback A method to call when the queue has processed. * @param {Object=} resultObj A temp object to hold results in. */ Collection.prototype.processQueue = function (type, callback, resultObj) { var self = this, queue = this._deferQueue[type], deferThreshold = this._deferThreshold[type], deferTime = this._deferTime[type], dataArr, result; resultObj = resultObj || { deferred: true }; if (queue.length) { // Process items up to the threshold if (queue.length) { if (queue.length > deferThreshold) { // Grab items up to the threshold value dataArr = queue.splice(0, deferThreshold); } else { // Grab all the remaining items dataArr = queue.splice(0, queue.length); } result = self[type](dataArr); switch (type) { case 'insert': resultObj.inserted = resultObj.inserted || []; resultObj.failed = resultObj.failed || []; resultObj.inserted = resultObj.inserted.concat(result.inserted); resultObj.failed = resultObj.failed.concat(result.failed); break; } } // Queue another process setTimeout(function () { self.processQueue.call(self, type, callback, resultObj); }, deferTime); } else { if (callback) { callback(resultObj); } } // Check if all queues are complete if (!this.isProcessingQueue()) { this.emit('queuesComplete'); } }; /** * Checks if any CRUD operations have been deferred and are still waiting to * be processed. * @returns {Boolean} True if there are still deferred CRUD operations to process * or false if all queues are clear. */ Collection.prototype.isProcessingQueue = function () { var i; for (i in this._deferQueue) { if (this._deferQueue.hasOwnProperty(i)) { if (this._deferQueue[i].length) { return true; } } } return false; }; /** * Inserts a document or array of documents into the collection. * @param {Object|Array} data Either a document object or array of document * @param {Number=} index Optional index to insert the record at. * @param {Function=} callback Optional callback called once action is complete. * objects to insert into the collection. */ Collection.prototype.insert = function (data, index, callback) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } if (typeof(index) === 'function') { callback = index; index = this._data.length; } else if (index === undefined) { index = this._data.length; } data = this.transformIn(data); return this._insertHandle(data, index, callback); }; /** * Inserts a document or array of documents into the collection. * @param {Object|Array} data Either a document object or array of document * @param {Number=} index Optional index to insert the record at. * @param {Function=} callback Optional callback called once action is complete. * objects to insert into the collection. */ Collection.prototype._insertHandle = function (data, index, callback) { var //self = this, queue = this._deferQueue.insert, deferThreshold = this._deferThreshold.insert, //deferTime = this._deferTime.insert, inserted = [], failed = [], insertResult, resultObj, i; if (data instanceof Array) { // Check if there are more insert items than the insert defer // threshold, if so, break up inserts so we don't tie up the // ui or thread if (data.length > deferThreshold) { // Break up insert into blocks this._deferQueue.insert = queue.concat(data); // Fire off the insert queue handler this.processQueue('insert', callback); return; } else { // Loop the array and add items for (i = 0; i < data.length; i++) { insertResult = this._insert(data[i], index + i); if (insertResult === true) { inserted.push(data[i]); } else { failed.push({ doc: data[i], reason: insertResult }); } } } } else { // Store the data item insertResult = this._insert(data, index); if (insertResult === true) { inserted.push(data); } else { failed.push({ doc: data, reason: insertResult }); } } //op.time('Resolve chains'); this.chainSend('insert', data, {index: index}); //op.time('Resolve chains'); resultObj = { deferred: false, inserted: inserted, failed: failed }; this._onInsert(inserted, failed); if (callback) { callback(resultObj); } this._onChange(); this.deferEmit('change', {type: 'insert', data: inserted}); return resultObj; }; /** * Internal method to insert a document into the collection. Will * check for index violations before allowing the document to be inserted. * @param {Object} doc The document to insert after passing index violation * tests. * @param {Number=} index Optional index to insert the document at. * @returns {Boolean|Object} True on success, false if no document passed, * or an object containing details about an index violation if one occurred. * @private */ Collection.prototype._insert = function (doc, index) { if (doc) { var self = this, indexViolation, triggerOperation, insertMethod, newDoc; this.ensurePrimaryKey(doc); // Check indexes are not going to be broken by the document indexViolation = this.insertIndexViolation(doc); insertMethod = function (doc) { // Add the item to the collection's indexes self._insertIntoIndexes(doc); // Check index overflow if (index > self._data.length) { index = self._data.length; } // Insert the document self._dataInsertAtIndex(index, doc); }; if (!indexViolation) { if (self.willTrigger(self.TYPE_INSERT, self.PHASE_BEFORE) || self.willTrigger(self.TYPE_INSERT, self.PHASE_AFTER)) { triggerOperation = { type: 'insert' }; if (self.processTrigger(triggerOperation, self.TYPE_INSERT, self.PHASE_BEFORE, {}, doc) !== false) { insertMethod(doc); if (self.willTrigger(self.TYPE_INSERT, self.PHASE_AFTER)) { // Clone the doc so that the programmer cannot update the internal document // on the "after" phase trigger newDoc = self.decouple(doc); self.processTrigger(triggerOperation, self.TYPE_INSERT, self.PHASE_AFTER, {}, newDoc); } } else { // The trigger just wants to cancel the operation return false; } } else { // No triggers to execute insertMethod(doc); } return true; } else { return 'Index violation in index: ' + indexViolation; } } return 'No document passed to insert'; }; /** * Inserts a document into the internal collection data array at * Inserts a document into the internal collection data array at * the specified index. * @param {number} index The index to insert at. * @param {object} doc The document to insert. * @private */ Collection.prototype._dataInsertAtIndex = function (index, doc) { this._data.splice(index, 0, doc); }; /** * Removes a document from the internal collection data array at * the specified index. * @param {number} index The index to remove from. * @private */ Collection.prototype._dataRemoveAtIndex = function (index) { this._data.splice(index, 1); }; /** * Replaces all data in the collection's internal data array with * the passed array of data. * @param {array} data The array of data to replace existing data with. * @private */ Collection.prototype._dataReplace = function (data) { // Clear the array - using a while loop with pop is by far the // fastest way to clear an array currently while (this._data.length) { this._data.pop(); } // Append new items to the array this._data = this._data.concat(data); }; /** * Inserts a document into the collection indexes. * @param {Object} doc The document to insert. * @private */ Collection.prototype._insertIntoIndexes = function (doc) { var arr = this._indexByName, arrIndex, violated, jString = JSON.stringify(doc); // Insert to primary key index violated = this._primaryIndex.uniqueSet(doc[this._primaryKey], doc); this._primaryCrc.uniqueSet(doc[this._primaryKey], jString); this._crcLookup.uniqueSet(jString, doc); // Insert into other indexes for (arrIndex in arr) { if (arr.hasOwnProperty(arrIndex)) { arr[arrIndex].insert(doc); } } return violated; }; /** * Removes a document from the collection indexes. * @param {Object} doc The document to remove. * @private */ Collection.prototype._removeFromIndexes = function (doc) { var arr = this._indexByName, arrIndex, jString = JSON.stringify(doc); // Remove from primary key index this._primaryIndex.unSet(doc[this._primaryKey]); this._primaryCrc.unSet(doc[this._primaryKey]); this._crcLookup.unSet(jString); // Remove from other indexes for (arrIndex in arr) { if (arr.hasOwnProperty(arrIndex)) { arr[arrIndex].remove(doc); } } }; /** * Updates collection index data for the passed document. * @param {Object} oldDoc The old document as it was before the update. * @param {Object} newDoc The document as it now is after the update. * @private */ Collection.prototype._updateIndexes = function (oldDoc, newDoc) { this._removeFromIndexes(oldDoc); this._insertIntoIndexes(newDoc); }; /** * Rebuild collection indexes. * @private */ Collection.prototype._rebuildIndexes = function () { var arr = this._indexByName, arrIndex; // Remove from other indexes for (arrIndex in arr) { if (arr.hasOwnProperty(arrIndex)) { arr[arrIndex].rebuild(); } } }; /** * Uses the passed query to generate a new collection with results * matching the query parameters. * * @param {Object} query The query object to generate the subset with. * @param {Object=} options An options object. * @returns {*} */ Collection.prototype.subset = function (query, options) { var result = this.find(query, options); return new Collection() .subsetOf(this) .primaryKey(this._primaryKey) .setData(result); }; /** * Gets / sets the collection that this collection is a subset of. * @param {Collection=} collection The collection to set as the parent of this subset. * @returns {Collection} */ Shared.synthesize(Collection.prototype, 'subsetOf'); /** * Checks if the collection is a subset of the passed collection. * @param {Collection} collection The collection to test against. * @returns {Boolean} True if the passed collection is the parent of * the current collection. */ Collection.prototype.isSubsetOf = function (collection) { return this._subsetOf === collection; }; /** * Find the distinct values for a specified field across a single collection and * returns the results in an array. * @param {String} key The field path to return distinct values for e.g. "person.name". * @param {Object=} query The query to use to filter the documents used to return values from. * @param {Object=} options The query options to use when running the query. * @returns {Array} */ Collection.prototype.distinct = function (key, query, options) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } var data = this.find(query, options), pathSolver = new Path(key), valueUsed = {}, distinctValues = [], value, i; // Loop the data and build array of distinct values for (i = 0; i < data.length; i++) { value = pathSolver.value(data[i])[0]; if (value && !valueUsed[value]) { valueUsed[value] = true; distinctValues.push(value); } } return distinctValues; }; /** * Helper method to find a document by it's id. * @param {String} id The id of the document. * @param {Object=} options The options object, allowed keys are sort and limit. * @returns {Array} The items that were updated. */ Collection.prototype.findById = function (id, options) { var searchObj = {}; searchObj[this._primaryKey] = id; return this.find(searchObj, options)[0]; }; /** * Finds all documents that contain the passed string or search object * regardless of where the string might occur within the document. This * will match strings from the start, middle or end of the document's * string (partial match). * @param search The string to search for. Case sensitive. * @param options A standard find() options object. * @returns {Array} An array of documents that matched the search string. */ Collection.prototype.peek = function (search, options) { // Loop all items var arr = this._data, arrCount = arr.length, arrIndex, arrItem, tempColl = new Collection(), typeOfSearch = typeof search; if (typeOfSearch === 'string') { for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { // Get json representation of object arrItem = JSON.stringify(arr[arrIndex]); // Check if string exists in object json if (arrItem.indexOf(search) > -1) { // Add this item to the temp collection tempColl.insert(arr[arrIndex]); } } return tempColl.find({}, options); } else { return this.find(search, options); } }; /** * Provides a query plan / operations log for a query. * @param {Object} query The query to execute. * @param {Object=} options Optional options object. * @returns {Object} The query plan. */ Collection.prototype.explain = function (query, options) { var result = this.find(query, options); return result.__fdbOp._data; }; /** * Generates an options object with default values or adds default * values to a passed object if those values are not currently set * to anything. * @param {object=} obj Optional options object to modify. * @returns {object} The options object. */ Collection.prototype.options = function (obj) { obj = obj || {}; obj.$decouple = obj.$decouple !== undefined ? obj.$decouple : true; obj.$explain = obj.$explain !== undefined ? obj.$explain : false; return obj; }; /** * Queries the collection based on the query object passed. * @param {Object} query The query key/values that a document must match in * order for it to be returned in the result array. * @param {Object=} options An optional options object. * @param {Function=} callback !! DO NOT USE, THIS IS NON-OPERATIONAL !! * Optional callback. If specified the find process * will not return a value and will assume that you wish to operate under an * async mode. This will break up large find requests into smaller chunks and * process them in a non-blocking fashion allowing large datasets to be queried * without causing the browser UI to pause. Results from this type of operation * will be passed back to the callback once completed. * * @returns {Array} The results array from the find operation, containing all * documents that matched the query. */ Collection.prototype.find = function (query, options, callback) { // Convert queries from mongo dot notation to forerunner queries if (this.mongoEmulation()) { this.convertToFdb(query); } if (callback) { // Check the size of the collection's data array // Split operation into smaller tasks and callback when complete callback('Callbacks for the find() operation are not yet implemented!', []); return []; } return this._find.apply(this, arguments); }; Collection.prototype._find = function (query, options) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } // TODO: This method is quite long, break into smaller pieces query = query || {}; options = this.options(options); var op = this._metrics.create('find'), pk = this.primaryKey(), self = this, analysis, scanLength, requiresTableScan = true, resultArr, joinCollectionIndex, joinIndex, joinCollection = {}, joinQuery, joinPath, joinCollectionName, joinCollectionInstance, joinMatch, joinMatchIndex, joinSearchQuery, joinSearchOptions, joinMulti, joinRequire, joinFindResults, joinFindResult, joinItem, joinPrefix, resultCollectionName, resultIndex, resultRemove = [], index, i, j, k, l, fieldListOn = [], fieldListOff = [], elemMatchPathSolver, elemMatchSubArr, elemMatchSpliceArr, matcherTmpOptions = {}, result, cursor = {}, matcher = function (doc) { return self._match(doc, query, options, 'and', matcherTmpOptions); }; op.start(); if (query) { // Get query analysis to execute best optimised code path op.time('analyseQuery'); analysis = this._analyseQuery(self.decouple(query), options, op); op.time('analyseQuery'); op.data('analysis', analysis); if (analysis.hasJoin && analysis.queriesJoin) { // The query has a join and tries to limit by it's joined data // Get an instance reference to the join collections op.time('joinReferences'); for (joinIndex = 0; joinIndex < analysis.joinsOn.length; joinIndex++) { joinCollectionName = analysis.joinsOn[joinIndex]; joinPath = new Path(analysis.joinQueries[joinCollectionName]); joinQuery = joinPath.value(query)[0]; joinCollection[analysis.joinsOn[joinIndex]] = this._db.collection(analysis.joinsOn[joinIndex]).subset(joinQuery); // Remove join clause from main query delete query[analysis.joinQueries[joinCollectionName]]; } op.time('joinReferences'); } // Check if an index lookup can be used to return this result if (analysis.indexMatch.length && (!options || (options && !options.$skipIndex))) { op.data('index.potential', analysis.indexMatch); op.data('index.used', analysis.indexMatch[0].index); // Get the data from the index op.time('indexLookup'); resultArr = analysis.indexMatch[0].lookup || []; op.time('indexLookup'); // Check if the index coverage is all keys, if not we still need to table scan it if (analysis.indexMatch[0].keyData.totalKeyCount === analysis.indexMatch[0].keyData.score) { // Don't require a table scan to find relevant documents requiresTableScan = false; } } else { op.flag('usedIndex', false); } if (requiresTableScan) { if (resultArr && resultArr.length) { scanLength = resultArr.length; op.time('tableScan: ' + scanLength); // Filter the source data and return the result resultArr = resultArr.filter(matcher); } else { // Filter the source data and return the result scanLength = this._data.length; op.time('tableScan: ' + scanLength); resultArr = this._data.filter(matcher); } op.time('tableScan: ' + scanLength); } // Order the array if we were passed a sort clause if (options.$orderBy) { op.time('sort'); resultArr = this.sort(options.$orderBy, resultArr); op.time('sort'); } if (options.$page !== undefined && options.$limit !== undefined) { // Record paging data cursor.page = options.$page; cursor.pages = Math.ceil(resultArr.length / options.$limit); cursor.records = resultArr.length; // Check if we actually need to apply the paging logic if (options.$page && options.$limit > 0) { op.data('cursor', cursor); // Skip to the page specified based on limit resultArr.splice(0, options.$page * options.$limit); } } if (options.$skip) { cursor.skip = options.$skip; // Skip past the number of records specified resultArr.splice(0, options.$skip); op.data('skip', options.$skip); } if (options.$limit && resultArr && resultArr.length > options.$limit) { cursor.limit = options.$limit; resultArr.length = options.$limit; op.data('limit', options.$limit); } if (options.$decouple) { // Now decouple the data from the original objects op.time('decouple'); resultArr = this.decouple(resultArr); op.time('decouple'); op.data('flag.decouple', true); } // Now process any joins on the final data if (options.$join) { for (joinCollectionIndex = 0; joinCollectionIndex < options.$join.length; joinCollectionIndex++) { for (joinCollectionName in options.$join[joinCollectionIndex]) { if (options.$join[joinCollectionIndex].hasOwnProperty(joinCollectionName)) { // Set the key to store the join result in to the collection name by default resultCollectionName = joinCollectionName; // Get the join collection instance from the DB if (joinCollection[joinCollectionName]) { joinCollectionInstance = joinCollection[joinCollectionName]; } else { joinCollectionInstance = this._db.collection(joinCollectionName); } // Get the match data for the join joinMatch = options.$join[joinCollectionIndex][joinCollectionName]; // Loop our result data array for (resultIndex = 0; resultIndex < resultArr.length; resultIndex++) { // Loop the join conditions and build a search object from them joinSearchQuery = {}; joinMulti = false; joinRequire = false; joinPrefix = ''; for (joinMatchIndex in joinMatch) { if (joinMatch.hasOwnProperty(joinMatchIndex)) { // Check the join condition name for a special command operator if (joinMatchIndex.substr(0, 1) === '$') { // Special command switch (joinMatchIndex) { case '$where': if (joinMatch[joinMatchIndex].query) { joinSearchQuery = joinMatch[joinMatchIndex].query; } if (joinMatch[joinMatchIndex].options) { joinSearchOptions = joinMatch[joinMatchIndex].options; } break; case '$as': // Rename the collection when stored in the result document resultCollectionName = joinMatch[joinMatchIndex]; break; case '$multi': // Return an array of documents instead of a single matching document joinMulti = joinMatch[joinMatchIndex]; break; case '$require': // Remove the result item if no matching join data is found joinRequire = joinMatch[joinMatchIndex]; break; case '$prefix': // Add a prefix to properties mixed in joinPrefix = joinMatch[joinMatchIndex]; break; default: break; } } else { // Get the data to match against and store in the search object // Resolve complex referenced query joinSearchQuery[joinMatchIndex] = self._resolveDynamicQuery(joinMatch[joinMatchIndex], resultArr[resultIndex]); } } } // Do a find on the target collection against the match data joinFindResults = joinCollectionInstance.find(joinSearchQuery, joinSearchOptions); // Check if we require a joined row to allow the result item if (!joinRequire || (joinRequire && joinFindResults[0])) { // Join is not required or condition is met if (resultCollectionName === '$root') { // The property name to store the join results in is $root // which means we need to mixin the results but this only // works if joinMulti is disabled if (joinMulti !== false) { // Throw an exception here as this join is not physically possible! throw(this.logIdentifier() + ' Cannot combine [$as: "$root"] with [$joinMulti: true] in $join clause!'); } // Mixin the result joinFindResult = joinFindResults[0]; joinItem = resultArr[resultIndex]; for (l in joinFindResult) { if (joinFindResult.hasOwnProperty(l) && joinItem[joinPrefix + l] === undefined) { // Properties are only mixed in if they do not already exist // in the target item (are undefined). Using a prefix denoted via // $prefix is a good way to prevent property name conflicts joinItem[joinPrefix + l] = joinFindResult[l]; } } } else { resultArr[resultIndex][resultCollectionName] = joinMulti === false ? joinFindResults[0] : joinFindResults; } } else { // Join required but condition not met, add item to removal queue resultRemove.push(resultArr[resultIndex]); } } } } } op.data('flag.join', true); } // Process removal queue if (resultRemove.length) { op.time('removalQueue'); for (i = 0; i < resultRemove.length; i++) { index = resultArr.indexOf(resultRemove[i]); if (index > -1) { resultArr.splice(index, 1); } } op.time('removalQueue'); } if (options.$transform) { op.time('transform'); for (i = 0; i < resultArr.length; i++) { resultArr.splice(i, 1, options.$transform(resultArr[i])); } op.time('transform'); op.data('flag.transform', true); } // Process transforms if (this._transformEnabled && this._transformOut) { op.time('transformOut'); resultArr = this.transformOut(resultArr); op.time('transformOut'); } op.data('results', resultArr.length); } else { resultArr = []; } // Generate a list of fields to limit data by // Each property starts off being enabled by default (= 1) then // if any property is explicitly specified as 1 then all switch to // zero except _id. // // Any that are explicitly set to zero are switched off. op.time('scanFields'); for (i in options) { if (options.hasOwnProperty(i) && i.indexOf('$') !== 0) { if (options[i] === 1) { fieldListOn.push(i); } else if (options[i] === 0) { fieldListOff.push(i); } } } op.time('scanFields'); // Limit returned fields by the options data if (fieldListOn.length || fieldListOff.length) { op.data('flag.limitFields', true); op.data('limitFields.on', fieldListOn); op.data('limitFields.off', fieldListOff); op.time('limitFields'); // We have explicit fields switched on or off for (i = 0; i < resultArr.length; i++) { result = resultArr[i]; for (j in result) { if (result.hasOwnProperty(j)) { if (fieldListOn.length) { // We have explicit fields switched on so remove all fields // that are not explicitly switched on // Check if the field name is not the primary key if (j !== pk) { if (fieldListOn.indexOf(j) === -1) { // This field is not in the on list, remove it delete result[j]; } } } if (fieldListOff.length) { // We have explicit fields switched off so remove fields // that are explicitly switched off if (fieldListOff.indexOf(j) > -1) { // This field is in the off list, remove it delete result[j]; } } } } } op.time('limitFields'); } // Now run any projections on the data required if (options.$elemMatch) { op.data('flag.elemMatch', true); op.time('projection-elemMatch'); for (i in options.$elemMatch) { if (options.$elemMatch.hasOwnProperty(i)) { elemMatchPathSolver = new Path(i); // Loop the results array for (j = 0; j < resultArr.length; j++) { elemMatchSubArr = elemMatchPathSolver.value(resultArr[j])[0]; // Check we have a sub-array to loop if (elemMatchSubArr && elemMatchSubArr.length) { // Loop the sub-array and check for projection query matches for (k = 0; k < elemMatchSubArr.length; k++) { // Check if the current item in the sub-array matches the projection query if (self._match(elemMatchSubArr[k], options.$elemMatch[i], options, '', {})) { // The item matches the projection query so set the sub-array // to an array that ONLY contains the matching item and then // exit the loop since we only want to match the first item elemMatchPathSolver.set(resultArr[j], i, [elemMatchSubArr[k]]); break; } } } } } } op.time('projection-elemMatch'); } if (options.$elemsMatch) { op.data('flag.elemsMatch', true); op.time('projection-elemsMatch'); for (i in options.$elemsMatch) { if (options.$elemsMatch.hasOwnProperty(i)) { elemMatchPathSolver = new Path(i); // Loop the results array for (j = 0; j < resultArr.length; j++) { elemMatchSubArr = elemMatchPathSolver.value(resultArr[j])[0]; // Check we have a sub-array to loop if (elemMatchSubArr && elemMatchSubArr.length) { elemMatchSpliceArr = []; // Loop the sub-array and check for projection query matches for (k = 0; k < elemMatchSubArr.length; k++) { // Check if the current item in the sub-array matches the projection query if (self._match(elemMatchSubArr[k], options.$elemsMatch[i], options, '', {})) { // The item matches the projection query so add it to the final array elemMatchSpliceArr.push(elemMatchSubArr[k]); } } // Now set the final sub-array to the matched items elemMatchPathSolver.set(resultArr[j], i, elemMatchSpliceArr); } } } } op.time('projection-elemsMatch'); } op.stop(); resultArr.__fdbOp = op; resultArr.$cursor = cursor; return resultArr; }; Collection.prototype._resolveDynamicQuery = function (query, item) { var self = this, newQuery, propType, propVal, i; if (typeof query === 'string') { // Check if the property name starts with a back-reference if (query.substr(0, 3) === '$$.') { // Fill the query with a back-referenced value return new Path(query.substr(3, query.length - 3)).value(item)[0]; } return new Path(query).value(item)[0]; } newQuery = {}; for (i in query) { if (query.hasOwnProperty(i)) { propType = typeof query[i]; propVal = query[i]; switch (propType) { case 'string': // Check if the property name starts with a back-reference if (propVal.substr(0, 3) === '$$.') { // Fill the query with a back-referenced value newQuery[i] = new Path(propVal.substr(3, propVal.length - 3)).value(item)[0]; } else { newQuery[i] = propVal; } break; case 'object': newQuery[i] = self._resolveDynamicQuery(propVal, item); break; default: newQuery[i] = propVal; break; } } } return newQuery; }; /** * Returns one document that satisfies the specified query criteria. If multiple * documents satisfy the query, this method returns the first document to match * the query. * @returns {*} */ Collection.prototype.findOne = function () { return (this.find.apply(this, arguments))[0]; }; /** * Gets the index in the collection data array of the first item matched by * the passed query object. * @param {Object} query The query to run to find the item to return the index of. * @param {Object=} options An options object. * @returns {Number} */ Collection.prototype.indexOf = function (query, options) { var item = this.find(query, {$decouple: false})[0], sortedData; if (item) { if (!options || options && !options.$orderBy) { // Basic lookup from order of insert return this._data.indexOf(item); } else { // Trying to locate index based on query with sort order options.$decouple = false; sortedData = this.find(query, options); return sortedData.indexOf(item); } } return -1; }; /** * Returns the index of the document identified by the passed item's primary key. * @param {*} itemLookup The document whose primary key should be used to lookup * or the id to lookup. * @param {Object=} options An options object. * @returns {Number} The index the item with the matching primary key is occupying. */ Collection.prototype.indexOfDocById = function (itemLookup, options) { var item, sortedData; if (typeof itemLookup !== 'object') { item = this._primaryIndex.get(itemLookup); } else { item = this._primaryIndex.get(itemLookup[this._primaryKey]); } if (item) { if (!options || options && !options.$orderBy) { // Basic lookup return this._data.indexOf(item); } else { // Sorted lookup options.$decouple = false; sortedData = this.find({}, options); return sortedData.indexOf(item); } } return -1; }; /** * Removes a document from the collection by it's index in the collection's * data array. * @param {Number} index The index of the document to remove. * @returns {Object} The document that has been removed or false if none was * removed. */ Collection.prototype.removeByIndex = function (index) { var doc, docId; doc = this._data[index]; if (doc !== undefined) { doc = this.decouple(doc); docId = doc[this.primaryKey()]; return this.removeById(docId); } return false; }; /** * Gets / sets the collection transform options. * @param {Object} obj A collection transform options object. * @returns {*} */ Collection.prototype.transform = function (obj) { if (obj !== undefined) { if (typeof obj === "object") { if (obj.enabled !== undefined) { this._transformEnabled = obj.enabled; } if (obj.dataIn !== undefined) { this._transformIn = obj.dataIn; } if (obj.dataOut !== undefined) { this._transformOut = obj.dataOut; } } else { this._transformEnabled = obj !== false; } return this; } return { enabled: this._transformEnabled, dataIn: this._transformIn, dataOut: this._transformOut }; }; /** * Transforms data using the set transformIn method. * @param {Object} data The data to transform. * @returns {*} */ Collection.prototype.transformIn = function (data) { if (this._transformEnabled && this._transformIn) { if (data instanceof Array) { var finalArr = [], i; for (i = 0; i < data.length; i++) { finalArr[i] = this._transformIn(data[i]); } return finalArr; } else { return this._transformIn(data); } } return data; }; /** * Transforms data using the set transformOut method. * @param {Object} data The data to transform. * @returns {*} */ Collection.prototype.transformOut = function (data) { if (this._transformEnabled && this._transformOut) { if (data instanceof Array) { var finalArr = [], i; for (i = 0; i < data.length; i++) { finalArr[i] = this._transformOut(data[i]); } return finalArr; } else { return this._transformOut(data); } } return data; }; /** * Sorts an array of documents by the given sort path. * @param {*} sortObj The keys and orders the array objects should be sorted by. * @param {Array} arr The array of documents to sort. * @returns {Array} */ Collection.prototype.sort = function (sortObj, arr) { // Make sure we have an array object arr = arr || []; var sortArr = [], sortKey, sortSingleObj; for (sortKey in sortObj) { if (sortObj.hasOwnProperty(sortKey)) { sortSingleObj = {}; sortSingleObj[sortKey] = sortObj[sortKey]; sortSingleObj.___fdbKey = String(sortKey); sortArr.push(sortSingleObj); } } if (sortArr.length < 2) { // There is only one sort criteria, do a simple sort and return it return this._sort(sortObj, arr); } else { return this._bucketSort(sortArr, arr); } }; /** * Takes array of sort paths and sorts them into buckets before returning final * array fully sorted by multi-keys. * @param keyArr * @param arr * @returns {*} * @private */ Collection.prototype._bucketSort = function (keyArr, arr) { var keyObj = keyArr.shift(), arrCopy, bucketData, bucketOrder, bucketKey, buckets, i, finalArr = []; if (keyArr.length > 0) { // Sort array by bucket key arr = this._sort(keyObj, arr); // Split items into buckets bucketData = this.bucket(keyObj.___fdbKey, arr); bucketOrder = bucketData.order; buckets = bucketData.buckets; // Loop buckets and sort contents for (i = 0; i < bucketOrder.length; i++) { bucketKey = bucketOrder[i]; arrCopy = [].concat(keyArr); finalArr = finalArr.concat(this._bucketSort(arrCopy, buckets[bucketKey])); } return finalArr; } else { return this._sort(keyObj, arr); } }; /** * Sorts array by individual sort path. * @param key * @param arr * @returns {Array|*} * @private */ Collection.prototype._sort = function (key, arr) { var self = this, sorterMethod, pathSolver = new Path(), dataPath = pathSolver.parse(key, true)[0]; pathSolver.path(dataPath.path); if (dataPath.value === 1) { // Sort ascending sorterMethod = function (a, b) { var valA = pathSolver.value(a)[0], valB = pathSolver.value(b)[0]; return self.sortAsc(valA, valB); }; } else if (dataPath.value === -1) { // Sort descending sorterMethod = function (a, b) { var valA = pathSolver.value(a)[0], valB = pathSolver.value(b)[0]; return self.sortDesc(valA, valB); }; } else { throw(this.logIdentifier() + ' $orderBy clause has invalid direction: ' + dataPath.value + ', accepted values are 1 or -1 for ascending or descending!'); } return arr.sort(sorterMethod); }; /** * Takes an array of objects and returns a new object with the array items * split into buckets by the passed key. * @param {String} key The key to split the array into buckets by. * @param {Array} arr An array of objects. * @returns {Object} */ Collection.prototype.bucket = function (key, arr) { var i, oldField, field, fieldArr = [], buckets = {}; for (i = 0; i < arr.length; i++) { field = String(arr[i][key]); if (oldField !== field) { fieldArr.push(field); oldField = field; } buckets[field] = buckets[field] || []; buckets[field].push(arr[i]); } return { buckets: buckets, order: fieldArr }; }; /** * Internal method that takes a search query and options and returns an object * containing details about the query which can be used to optimise the search. * * @param query * @param options * @param op * @returns {Object} * @private */ Collection.prototype._analyseQuery = function (query, options, op) { var analysis = { queriesOn: [this._name], indexMatch: [], hasJoin: false, queriesJoin: false, joinQueries: {}, query: query, options: options }, joinCollectionIndex, joinCollectionName, joinCollections = [], joinCollectionReferences = [], queryPath, index, indexMatchData, indexRef, indexRefName, indexLookup, pathSolver, queryKeyCount, i; // Check if the query is a primary key lookup op.time('checkIndexes'); pathSolver = new Path(); queryKeyCount = pathSolver.countKeys(query); if (queryKeyCount) { if (query[this._primaryKey] !== undefined) { // Return item via primary key possible op.time('checkIndexMatch: Primary Key'); analysis.indexMatch.push({ lookup: this._primaryIndex.lookup(query, options), keyData: { matchedKeys: [this._primaryKey], totalKeyCount: queryKeyCount, score: 1 }, index: this._primaryIndex }); op.time('checkIndexMatch: Primary Key'); } // Check if an index can speed up the query for (i in this._indexById) { if (this._indexById.hasOwnProperty(i)) { indexRef = this._indexById[i]; indexRefName = indexRef.name(); op.time('checkIndexMatch: ' + indexRefName); indexMatchData = indexRef.match(query, options); if (indexMatchData.score > 0) { // This index can be used, store it indexLookup = indexRef.lookup(query, options); analysis.indexMatch.push({ lookup: indexLookup, keyData: indexMatchData, index: indexRef }); } op.time('checkIndexMatch: ' + indexRefName); if (indexMatchData.score === queryKeyCount) { // Found an optimal index, do not check for any more break; } } } op.time('checkIndexes'); // Sort array descending on index key count (effectively a measure of relevance to the query) if (analysis.indexMatch.length > 1) { op.time('findOptimalIndex'); analysis.indexMatch.sort(function (a, b) { if (a.keyData.score > b.keyData.score) { // This index has a higher score than the other return -1; } if (a.keyData.score < b.keyData.score) { // This index has a lower score than the other return 1; } // The indexes have the same score but can still be compared by the number of records // they return from the query. The fewer records they return the better so order by // record count if (a.keyData.score === b.keyData.score) { return a.lookup.length - b.lookup.length; } }); op.time('findOptimalIndex'); } } // Check for join data if (options.$join) { analysis.hasJoin = true; // Loop all join operations for (joinCollectionIndex = 0; joinCollectionIndex < options.$join.length; joinCollectionIndex++) { // Loop the join collections and keep a reference to them for (joinCollectionName in options.$join[joinCollectionIndex]) { if (options.$join[joinCollectionIndex].hasOwnProperty(joinCollectionName)) { joinCollections.push(joinCollectionName); // Check if the join uses an $as operator if ('$as' in options.$join[joinCollectionIndex][joinCollectionName]) { joinCollectionReferences.push(options.$join[joinCollectionIndex][joinCollectionName].$as); } else { joinCollectionReferences.push(joinCollectionName); } } } } // Loop the join collection references and determine if the query references // any of the collections that are used in the join. If there no queries against // joined collections the find method can use a code path optimised for this. // Queries against joined collections requires the joined collections to be filtered // first and then joined so requires a little more work. for (index = 0; index < joinCollectionReferences.length; index++) { // Check if the query references any collection data that the join will create queryPath = this._queryReferencesCollection(query, joinCollectionReferences[index], ''); if (queryPath) { analysis.joinQueries[joinCollections[index]] = queryPath; analysis.queriesJoin = true; } } analysis.joinsOn = joinCollections; analysis.queriesOn = analysis.queriesOn.concat(joinCollections); } return analysis; }; /** * Checks if the passed query references this collection. * @param query * @param collection * @param path * @returns {*} * @private */ Collection.prototype._queryReferencesCollection = function (query, collection, path) { var i; for (i in query) { if (query.hasOwnProperty(i)) { // Check if this key is a reference match if (i === collection) { if (path) { path += '.'; } return path + i; } else { if (typeof(query[i]) === 'object') { // Recurse if (path) { path += '.'; } path += i; return this._queryReferencesCollection(query[i], collection, path); } } } } return false; }; /** * Returns the number of documents currently in the collection. * @returns {Number} */ Collection.prototype.count = function (query, options) { if (!query) { return this._data.length; } else { // Run query and return count return this.find(query, options).length; } }; /** * Finds sub-documents from the collection's documents. * @param {Object} match The query object to use when matching parent documents * from which the sub-documents are queried. * @param {String} path The path string used to identify the key in which * sub-documents are stored in parent documents. * @param {Object=} subDocQuery The query to use when matching which sub-documents * to return. * @param {Object=} subDocOptions The options object to use when querying for * sub-documents. * @returns {*} */ Collection.prototype.findSub = function (match, path, subDocQuery, subDocOptions) { var pathHandler = new Path(path), docArr = this.find(match), docCount = docArr.length, docIndex, subDocArr, subDocCollection = this._db.collection('__FDB_temp_' + this.objectId()), subDocResults, resultObj = { parents: docCount, subDocTotal: 0, subDocs: [], pathFound: false, err: '' }; subDocOptions = subDocOptions || {}; for (docIndex = 0; docIndex < docCount; docIndex++) { subDocArr = pathHandler.value(docArr[docIndex])[0]; if (subDocArr) { subDocCollection.setData(subDocArr); subDocResults = subDocCollection.find(subDocQuery, subDocOptions); if (subDocOptions.returnFirst && subDocResults.length) { return subDocResults[0]; } if (subDocOptions.$split) { resultObj.subDocs.push(subDocResults); } else { resultObj.subDocs = resultObj.subDocs.concat(subDocResults); } resultObj.subDocTotal += subDocResults.length; resultObj.pathFound = true; } } // Drop the sub-document collection subDocCollection.drop(); // Check if the call should not return stats, if so return only subDocs array if (subDocOptions.$stats) { return resultObj; } else { return resultObj.subDocs; } if (!resultObj.pathFound) { resultObj.err = 'No objects found in the parent documents with a matching path of: ' + path; } return resultObj; }; /** * Checks that the passed document will not violate any index rules if * inserted into the collection. * @param {Object} doc The document to check indexes against. * @returns {Boolean} Either false (no violation occurred) or true if * a violation was detected. */ Collection.prototype.insertIndexViolation = function (doc) { var indexViolated, arr = this._indexByName, arrIndex, arrItem; // Check the item's primary key is not already in use if (this._primaryIndex.get(doc[this._primaryKey])) { indexViolated = this._primaryIndex; } else { // Check violations of other indexes for (arrIndex in arr) { if (arr.hasOwnProperty(arrIndex)) { arrItem = arr[arrIndex]; if (arrItem.unique()) { if (arrItem.violation(doc)) { indexViolated = arrItem; break; } } } } } return indexViolated ? indexViolated.name() : false; }; /** * Creates an index on the specified keys. * @param {Object} keys The object containing keys to index. * @param {Object} options An options object. * @returns {*} */ Collection.prototype.ensureIndex = function (keys, options) { if (this.isDropped()) { throw(this.logIdentifier() + ' Cannot operate in a dropped state!'); } this._indexByName = this._indexByName || {}; this._indexById = this._indexById || {}; var index, time = { start: new Date().getTime() }; if (options) { switch (options.type) { case 'hashed': index = new IndexHashMap(keys, options, this); break; case 'btree': index = new IndexBinaryTree(keys, options, this); break; default: // Default index = new IndexHashMap(keys, options, this); break; } } else { // Default index = new IndexHashMap(keys, options, this); } // Check the index does not already exist if (this._indexByName[index.name()]) { // Index already exists return { err: 'Index with that name already exists' }; } if (this._indexById[index.id()]) { // Index already exists return { err: 'Index with those keys already exists' }; } // Create the index index.rebuild(); // Add the index this._indexByName[index.name()] = index; this._indexById[index.id()] = index; time.end = new Date().getTime(); time.total = time.end - time.start; this._lastOp = { type: 'ensureIndex', stats: { time: time } }; return { index: index, id: index.id(), name: index.name(), state: index.state() }; }; /** * Gets an index by it's name. * @param {String} name The name of the index to retreive. * @returns {*} */ Collection.prototype.index = function (name) { if (this._indexByName) { return this._indexByName[name]; } }; /** * Gets the last reporting operation's details such as run time. * @returns {Object} */ Collection.prototype.lastOp = function () { return this._metrics.list(); }; /** * Generates a difference object that contains insert, update and remove arrays * representing the operations to execute to make this collection have the same * data as the one passed. * @param {Collection} collection The collection to diff against. * @returns {{}} */ Collection.prototype.diff = function (collection) { var diff = { insert: [], update: [], remove: [] }; var pm = this.primaryKey(), arr, arrIndex, arrItem, arrCount; // Check if the primary key index of each collection can be utilised if (pm !== collection.primaryKey()) { throw(this.logIdentifier() + ' Diffing requires that both collections have the same primary key!'); } // Use the collection primary key index to do the diff (super-fast) arr = collection._data; // Check if we have an array or another collection while (arr && !(arr instanceof Array)) { // We don't have an array, assign collection and get data collection = arr; arr = collection._data; } arrCount = arr.length; // Loop the collection's data array and check for matching items for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { arrItem = arr[arrIndex]; // Check for a matching item in this collection if (this._primaryIndex.get(arrItem[pm])) { // Matching item exists, check if the data is the same if (this._primaryCrc.get(arrItem[pm]) !== collection._primaryCrc.get(arrItem[pm])) { // The documents exist in both collections but data differs, update required diff.update.push(arrItem); } } else { // The document is missing from this collection, insert required diff.insert.push(arrItem); } } // Now loop this collection's data and check for matching items arr = this._data; arrCount = arr.length; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { arrItem = arr[arrIndex]; if (!collection._primaryIndex.get(arrItem[pm])) { // The document does not exist in the other collection, remove required diff.remove.push(arrItem); } } return diff; }; Collection.prototype.collateAdd = new Overload({ /** * Adds a data source to collate data from and specifies the * key name to collate data to. * @func collateAdd * @memberof Collection * @param {Collection} collection The collection to collate data from. * @param {String=} keyName Optional name of the key to collate data to. * If none is provided the record CRUD is operated on the root collection * data. */ 'object, string': function (collection, keyName) { var self = this; self.collateAdd(collection, function (packet) { var obj1, obj2; switch (packet.type) { case 'insert': if (keyName) { obj1 = { $push: {} }; obj1.$push[keyName] = self.decouple(packet.data); self.update({}, obj1); } else { self.insert(packet.data); } break; case 'update': if (keyName) { obj1 = {}; obj2 = {}; obj1[keyName] = packet.data.query; obj2[keyName + '.$'] = packet.data.update; self.update(obj1, obj2); } else { self.update(packet.data.query, packet.data.update); } break; case 'remove': if (keyName) { obj1 = { $pull: {} }; obj1.$pull[keyName] = {}; obj1.$pull[keyName][self.primaryKey()] = packet.data.dataSet[0][collection.primaryKey()]; self.update({}, obj1); } else { self.remove(packet.data); } break; default: } }); }, /** * Adds a data source to collate data from and specifies a process * method that will handle the collation functionality (for custom * collation). * @func collateAdd * @memberof Collection * @param {Collection} collection The collection to collate data from. * @param {Function} process The process method. */ 'object, function': function (collection, process) { if (typeof collection === 'string') { // The collection passed is a name, not a reference so get // the reference from the name collection = this._db.collection(collection, { autoCreate: false, throwError: false }); } if (collection) { this._collate = this._collate || {}; this._collate[collection.name()] = new ReactorIO(collection, this, process); return this; } else { throw('Cannot collate from a non-existent collection!'); } } }); Collection.prototype.collateRemove = function (collection) { if (typeof collection === 'object') { // We need to have the name of the collection to remove it collection = collection.name(); } if (collection) { // Drop the reactor IO chain node this._collate[collection].drop(); // Remove the collection data from the collate object delete this._collate[collection]; return this; } else { throw('No collection name passed to collateRemove() or collection not found!'); } }; Db.prototype.collection = new Overload({ /** * Get a collection by name. If the collection does not already exist * then one is created for that name automatically. * @func collection * @memberof Db * @param {Object} data An options object or a collection instance. * @returns {Collection} */ 'object': function (data) { // Handle being passed an instance if (data instanceof Collection) { if (data.state() !== 'droppped') { return data; } else { return this.$main.call(this, { name: data.name() }); } } return this.$main.call(this, data); }, /** * Get a collection by name. If the collection does not already exist * then one is created for that name automatically. * @func collection * @memberof Db * @param {String} collectionName The name of the collection. * @returns {Collection} */ 'string': function (collectionName) { return this.$main.call(this, { name: collectionName }); }, /** * Get a collection by name. If the collection does not already exist * then one is created for that name automatically. * @func collection * @memberof Db * @param {String} collectionName The name of the collection. * @param {String} primaryKey Optional primary key to specify the primary key field on the collection * objects. Defaults to "_id". * @returns {Collection} */ 'string, string': function (collectionName, primaryKey) { return this.$main.call(this, { name: collectionName, primaryKey: primaryKey }); }, /** * Get a collection by name. If the collection does not already exist * then one is created for that name automatically. * @func collection * @memberof Db * @param {String} collectionName The name of the collection. * @param {Object} options An options object. * @returns {Collection} */ 'string, object': function (collectionName, options) { options.name = collectionName; return this.$main.call(this, options); }, /** * Get a collection by name. If the collection does not already exist * then one is created for that name automatically. * @func collection * @memberof Db * @param {String} collectionName The name of the collection. * @param {String} primaryKey Optional primary key to specify the primary key field on the collection * objects. Defaults to "_id". * @param {Object} options An options object. * @returns {Collection} */ 'string, string, object': function (collectionName, primaryKey, options) { options.name = collectionName; options.primaryKey = primaryKey; return this.$main.call(this, options); }, /** * The main handler method. This gets called by all the other variants and * handles the actual logic of the overloaded method. * @func collection * @memberof Db * @param {Object} options An options object. * @returns {*} */ '$main': function (options) { var name = options.name; if (name) { if (!this._collection[name]) { if (options && options.autoCreate === false) { if (options && options.throwError !== false) { throw(this.logIdentifier() + ' Cannot get collection ' + name + ' because it does not exist and auto-create has been disabled!'); } } if (this.debug()) { console.log(this.logIdentifier() + ' Creating collection ' + name); } } this._collection[name] = this._collection[name] || new Collection(name, options).db(this); this._collection[name].mongoEmulation(this.mongoEmulation()); if (options.primaryKey !== undefined) { this._collection[name].primaryKey(options.primaryKey); } return this._collection[name]; } else { if (!options || (options && options.throwError !== false)) { throw(this.logIdentifier() + ' Cannot get collection with undefined name!'); } } } }); /** * Determine if a collection with the passed name already exists. * @memberof Db * @param {String} viewName The name of the collection to check for. * @returns {boolean} */ Db.prototype.collectionExists = function (viewName) { return Boolean(this._collection[viewName]); }; /** * Returns an array of collections the DB currently has. * @memberof Db * @param {String|RegExp=} search The optional search string or regular expression to use * to match collection names against. * @returns {Array} An array of objects containing details of each collection * the database is currently managing. */ Db.prototype.collections = function (search) { var arr = [], collections = this._collection, collection, i; if (search) { if (!(search instanceof RegExp)) { // Turn the search into a regular expression search = new RegExp(search); } } for (i in collections) { if (collections.hasOwnProperty(i)) { collection = collections[i]; if (search) { if (search.exec(i)) { arr.push({ name: i, count: collection.count(), linked: collection.isLinked !== undefined ? collection.isLinked() : false }); } } else { arr.push({ name: i, count: collection.count(), linked: collection.isLinked !== undefined ? collection.isLinked() : false }); } } } arr.sort(function (a, b) { return a.name.localeCompare(b.name); }); return arr; }; Shared.finishModule('Collection'); module.exports = Collection; },{"./Crc":7,"./IndexBinaryTree":12,"./IndexHashMap":13,"./KeyValueStore":14,"./Metrics":15,"./Overload":28,"./Path":30,"./ReactorIO":34,"./Shared":35}],5:[function(_dereq_,module,exports){ "use strict"; // Import external names locally var Shared, Db, DbInit, Collection; Shared = _dereq_('./Shared'); /** * Creates a new collection group. Collection groups allow single operations to be * propagated to multiple collections at once. CRUD operations against a collection * group are in fed to the group's collections. Useful when separating out slightly * different data into multiple collections but querying as one collection. * @constructor */ var CollectionGroup = function () { this.init.apply(this, arguments); }; CollectionGroup.prototype.init = function (name) { var self = this; self._name = name; self._data = new Collection('__FDB__cg_data_' + self._name); self._collections = []; self._view = []; }; Shared.addModule('CollectionGroup', CollectionGroup); Shared.mixin(CollectionGroup.prototype, 'Mixin.Common'); Shared.mixin(CollectionGroup.prototype, 'Mixin.ChainReactor'); Shared.mixin(CollectionGroup.prototype, 'Mixin.Constants'); Shared.mixin(CollectionGroup.prototype, 'Mixin.Triggers'); Collection = _dereq_('./Collection'); Db = Shared.modules.Db; DbInit = Shared.modules.Db.prototype.init; CollectionGroup.prototype.on = function () { this._data.on.apply(this._data, arguments); }; CollectionGroup.prototype.off = function () { this._data.off.apply(this._data, arguments); }; CollectionGroup.prototype.emit = function () { this._data.emit.apply(this._data, arguments); }; /** * Gets / sets the primary key for this collection group. * @param {String=} keyName The name of the primary key. * @returns {*} */ CollectionGroup.prototype.primaryKey = function (keyName) { if (keyName !== undefined) { this._primaryKey = keyName; return this; } return this._primaryKey; }; /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(CollectionGroup.prototype, 'state'); /** * Gets / sets the db instance the collection group belongs to. * @param {Db=} db The db instance. * @returns {*} */ Shared.synthesize(CollectionGroup.prototype, 'db'); /** * Gets / sets the instance name. * @param {Name=} name The new name to set. * @returns {*} */ Shared.synthesize(CollectionGroup.prototype, 'name'); CollectionGroup.prototype.addCollection = function (collection) { if (collection) { if (this._collections.indexOf(collection) === -1) { //var self = this; // Check for compatible primary keys if (this._collections.length) { if (this._primaryKey !== collection.primaryKey()) { throw(this.logIdentifier() + ' All collections in a collection group must have the same primary key!'); } } else { // Set the primary key to the first collection added this.primaryKey(collection.primaryKey()); } // Add the collection this._collections.push(collection); collection._groups = collection._groups || []; collection._groups.push(this); collection.chain(this); // Hook the collection's drop event to destroy group data collection.on('drop', function () { // Remove collection from any group associations if (collection._groups && collection._groups.length) { var groupArr = [], i; // Copy the group array because if we call removeCollection on a group // it will alter the groups array of this collection mid-loop! for (i = 0; i < collection._groups.length; i++) { groupArr.push(collection._groups[i]); } // Loop any groups we are part of and remove ourselves from them for (i = 0; i < groupArr.length; i++) { collection._groups[i].removeCollection(collection); } } delete collection._groups; }); // Add collection's data this._data.insert(collection.find()); } } return this; }; CollectionGroup.prototype.removeCollection = function (collection) { if (collection) { var collectionIndex = this._collections.indexOf(collection), groupIndex; if (collectionIndex !== -1) { collection.unChain(this); this._collections.splice(collectionIndex, 1); collection._groups = collection._groups || []; groupIndex = collection._groups.indexOf(this); if (groupIndex !== -1) { collection._groups.splice(groupIndex, 1); } collection.off('drop'); } if (this._collections.length === 0) { // Wipe the primary key delete this._primaryKey; } } return this; }; CollectionGroup.prototype._chainHandler = function (chainPacket) { //sender = chainPacket.sender; switch (chainPacket.type) { case 'setData': // Decouple the data to ensure we are working with our own copy chainPacket.data = this.decouple(chainPacket.data); // Remove old data this._data.remove(chainPacket.options.oldData); // Add new data this._data.insert(chainPacket.data); break; case 'insert': // Decouple the data to ensure we are working with our own copy chainPacket.data = this.decouple(chainPacket.data); // Add new data this._data.insert(chainPacket.data); break; case 'update': // Update data this._data.update(chainPacket.data.query, chainPacket.data.update, chainPacket.options); break; case 'remove': this._data.remove(chainPacket.data.query, chainPacket.options); break; default: break; } }; CollectionGroup.prototype.insert = function () { this._collectionsRun('insert', arguments); }; CollectionGroup.prototype.update = function () { this._collectionsRun('update', arguments); }; CollectionGroup.prototype.updateById = function () { this._collectionsRun('updateById', arguments); }; CollectionGroup.prototype.remove = function () { this._collectionsRun('remove', arguments); }; CollectionGroup.prototype._collectionsRun = function (type, args) { for (var i = 0; i < this._collections.length; i++) { this._collections[i][type].apply(this._collections[i], args); } }; CollectionGroup.prototype.find = function (query, options) { return this._data.find(query, options); }; /** * Helper method that removes a document that matches the given id. * @param {String} id The id of the document to remove. */ CollectionGroup.prototype.removeById = function (id) { // Loop the collections in this group and apply the remove for (var i = 0; i < this._collections.length; i++) { this._collections[i].removeById(id); } }; /** * Uses the passed query to generate a new collection with results * matching the query parameters. * * @param query * @param options * @returns {*} */ CollectionGroup.prototype.subset = function (query, options) { var result = this.find(query, options); return new Collection() .subsetOf(this) .primaryKey(this._primaryKey) .setData(result); }; /** * Drops a collection group from the database. * @returns {boolean} True on success, false on failure. */ CollectionGroup.prototype.drop = function () { if (!this.isDropped()) { var i, collArr, viewArr; if (this._debug) { console.log(this.logIdentifier() + ' Dropping'); } this._state = 'dropped'; if (this._collections && this._collections.length) { collArr = [].concat(this._collections); for (i = 0; i < collArr.length; i++) { this.removeCollection(collArr[i]); } } if (this._view && this._view.length) { viewArr = [].concat(this._view); for (i = 0; i < viewArr.length; i++) { this._removeView(viewArr[i]); } } this.emit('drop', this); } return true; }; // Extend DB to include collection groups Db.prototype.init = function () { this._collectionGroup = {}; DbInit.apply(this, arguments); }; Db.prototype.collectionGroup = function (collectionGroupName) { if (collectionGroupName) { // Handle being passed an instance if (collectionGroupName instanceof CollectionGroup) { return collectionGroupName; } this._collectionGroup[collectionGroupName] = this._collectionGroup[collectionGroupName] || new CollectionGroup(collectionGroupName).db(this); return this._collectionGroup[collectionGroupName]; } else { // Return an object of collection data return this._collectionGroup; } }; /** * Returns an array of collection groups the DB currently has. * @returns {Array} An array of objects containing details of each collection group * the database is currently managing. */ Db.prototype.collectionGroups = function () { var arr = [], i; for (i in this._collectionGroup) { if (this._collectionGroup.hasOwnProperty(i)) { arr.push({ name: i }); } } return arr; }; module.exports = CollectionGroup; },{"./Collection":4,"./Shared":35}],6:[function(_dereq_,module,exports){ /* License Copyright (c) 2015 Irrelon Software Limited http://www.irrelon.com http://www.forerunnerdb.com Please visit the license page to see latest license information: http://www.forerunnerdb.com/licensing.html */ "use strict"; var Shared, Db, Metrics, Overload, _instances = []; Shared = _dereq_('./Shared'); Overload = _dereq_('./Overload'); /** * Creates a new ForerunnerDB instance. Core instances handle the lifecycle of * multiple database instances. * @constructor */ var Core = function (name) { this.init.apply(this, arguments); }; Core.prototype.init = function (name) { this._db = {}; this._debug = {}; this._name = name || 'ForerunnerDB'; _instances.push(this); }; /** * Returns the number of instantiated ForerunnerDB objects. * @returns {Number} The number of instantiated instances. */ Core.prototype.instantiatedCount = function () { return _instances.length; }; /** * Get all instances as an array or a single ForerunnerDB instance * by it's array index. * @param {Number=} index Optional index of instance to get. * @returns {Array|Object} Array of instances or a single instance. */ Core.prototype.instances = function (index) { if (index !== undefined) { return _instances[index]; } return _instances; }; /** * Get all instances as an array of instance names or a single ForerunnerDB * instance by it's name. * @param {String=} name Optional name of instance to get. * @returns {Array|Object} Array of instance names or a single instance. */ Core.prototype.namedInstances = function (name) { var i, instArr; if (name !== undefined) { for (i = 0; i < _instances.length; i++) { if (_instances[i].name === name) { return _instances[i]; } } return undefined; } instArr = []; for (i = 0; i < _instances.length; i++) { instArr.push(_instances[i].name); } return instArr; }; Core.prototype.moduleLoaded = new Overload({ /** * Checks if a module has been loaded into the database. * @func moduleLoaded * @memberof Core * @param {String} moduleName The name of the module to check for. * @returns {Boolean} True if the module is loaded, false if not. */ 'string': function (moduleName) { if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { return false; } } return true; } return false; }, /** * Checks if a module is loaded and if so calls the passed * callback method. * @func moduleLoaded * @memberof Core * @param {String} moduleName The name of the module to check for. * @param {Function} callback The callback method to call if module is loaded. */ 'string, function': function (moduleName, callback) { if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { return false; } } callback(); } }, /** * Checks if an array of named modules are loaded and if so * calls the passed callback method. * @func moduleLoaded * @memberof Core * @param {Array} moduleName The array of module names to check for. * @param {Function} callback The callback method to call if modules are loaded. */ 'array, function': function (moduleNameArr, callback) { var moduleName, i; for (i = 0; i < moduleNameArr.length; i++) { moduleName = moduleNameArr[i]; if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { return false; } } } } callback(); }, /** * Checks if a module is loaded and if so calls the passed * success method, otherwise calls the failure method. * @func moduleLoaded * @memberof Core * @param {String} moduleName The name of the module to check for. * @param {Function} success The callback method to call if module is loaded. * @param {Function} failure The callback method to call if module not loaded. */ 'string, function, function': function (moduleName, success, failure) { if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { failure(); return false; } } success(); } } }); /** * Checks version against the string passed and if it matches (or partially matches) * then the callback is called. * @param {String} val The version to check against. * @param {Function} callback The callback to call if match is true. * @returns {Boolean} */ Core.prototype.version = function (val, callback) { if (val !== undefined) { if (Shared.version.indexOf(val) === 0) { if (callback) { callback(); } return true; } return false; } return Shared.version; }; // Expose moduleLoaded() method to non-instantiated object ForerunnerDB Core.moduleLoaded = Core.prototype.moduleLoaded; // Expose version() method to non-instantiated object ForerunnerDB Core.version = Core.prototype.version; // Expose instances() method to non-instantiated object ForerunnerDB Core.instances = Core.prototype.instances; // Expose instantiatedCount() method to non-instantiated object ForerunnerDB Core.instantiatedCount = Core.prototype.instantiatedCount; // Provide public access to the Shared object Core.shared = Shared; Core.prototype.shared = Shared; Shared.addModule('Core', Core); Shared.mixin(Core.prototype, 'Mixin.Common'); Shared.mixin(Core.prototype, 'Mixin.Constants'); Db = _dereq_('./Db.js'); Metrics = _dereq_('./Metrics.js'); /** * Gets / sets the name of the instance. This is primarily used for * name-spacing persistent storage. * @param {String=} val The name of the instance to set. * @returns {*} */ Shared.synthesize(Core.prototype, 'name'); /** * Gets / sets mongodb emulation mode. * @param {Boolean=} val True to enable, false to disable. * @returns {*} */ Shared.synthesize(Core.prototype, 'mongoEmulation'); // Set a flag to determine environment Core.prototype._isServer = false; /** * Returns true if ForerunnerDB is running on a client browser. * @returns {boolean} */ Core.prototype.isClient = function () { return !this._isServer; }; /** * Returns true if ForerunnerDB is running on a server. * @returns {boolean} */ Core.prototype.isServer = function () { return this._isServer; }; /** * Checks if the database is running on a client (browser) or * a server (node.js). * @returns {Boolean} Returns true if running on a browser. */ Core.prototype.isClient = function () { return !this._isServer; }; /** * Checks if the database is running on a client (browser) or * a server (node.js). * @returns {Boolean} Returns true if running on a server. */ Core.prototype.isServer = function () { return this._isServer; }; /** * Added to provide an error message for users who have not seen * the new instantiation breaking change warning and try to get * a collection directly from the core instance. */ Core.prototype.collection = function () { throw("ForerunnerDB's instantiation has changed since version 1.3.36 to support multiple database instances. Please see the readme.md file for the minor change you have to make to get your project back up and running, or see the issue related to this change at https://github.com/Irrelon/ForerunnerDB/issues/44"); }; module.exports = Core; },{"./Db.js":8,"./Metrics.js":15,"./Overload":28,"./Shared":35}],7:[function(_dereq_,module,exports){ "use strict"; /** * @mixin */ var crcTable = (function () { var crcTable = [], c, n, k; for (n = 0; n < 256; n++) { c = n; for (k = 0; k < 8; k++) { c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); // jshint ignore:line } crcTable[n] = c; } return crcTable; }()); module.exports = function(str) { var crc = 0 ^ (-1), // jshint ignore:line i; for (i = 0; i < str.length; i++) { crc = (crc >>> 8) ^ crcTable[(crc ^ str.charCodeAt(i)) & 0xFF]; // jshint ignore:line } return (crc ^ (-1)) >>> 0; // jshint ignore:line }; },{}],8:[function(_dereq_,module,exports){ "use strict"; var Shared, Core, Collection, Metrics, Crc, Overload; Shared = _dereq_('./Shared'); Overload = _dereq_('./Overload'); /** * Creates a new ForerunnerDB database instance. * @constructor */ var Db = function (name, core) { this.init.apply(this, arguments); }; Db.prototype.init = function (name, core) { this.core(core); this._primaryKey = '_id'; this._name = name; this._collection = {}; this._debug = {}; }; Shared.addModule('Db', Db); Db.prototype.moduleLoaded = new Overload({ /** * Checks if a module has been loaded into the database. * @func moduleLoaded * @memberof Db * @param {String} moduleName The name of the module to check for. * @returns {Boolean} True if the module is loaded, false if not. */ 'string': function (moduleName) { if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { return false; } } return true; } return false; }, /** * Checks if a module is loaded and if so calls the passed * callback method. * @func moduleLoaded * @memberof Db * @param {String} moduleName The name of the module to check for. * @param {Function} callback The callback method to call if module is loaded. */ 'string, function': function (moduleName, callback) { if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { return false; } } callback(); } }, /** * Checks if a module is loaded and if so calls the passed * success method, otherwise calls the failure method. * @func moduleLoaded * @memberof Db * @param {String} moduleName The name of the module to check for. * @param {Function} success The callback method to call if module is loaded. * @param {Function} failure The callback method to call if module not loaded. */ 'string, function, function': function (moduleName, success, failure) { if (moduleName !== undefined) { moduleName = moduleName.replace(/ /g, ''); var modules = moduleName.split(','), index; for (index = 0; index < modules.length; index++) { if (!Shared.modules[modules[index]]) { failure(); return false; } } success(); } } }); /** * Checks version against the string passed and if it matches (or partially matches) * then the callback is called. * @param {String} val The version to check against. * @param {Function} callback The callback to call if match is true. * @returns {Boolean} */ Db.prototype.version = function (val, callback) { if (val !== undefined) { if (Shared.version.indexOf(val) === 0) { if (callback) { callback(); } return true; } return false; } return Shared.version; }; // Expose moduleLoaded method to non-instantiated object ForerunnerDB Db.moduleLoaded = Db.prototype.moduleLoaded; // Expose version method to non-instantiated object ForerunnerDB Db.version = Db.prototype.version; // Provide public access to the Shared object Db.shared = Shared; Db.prototype.shared = Shared; Shared.addModule('Db', Db); Shared.mixin(Db.prototype, 'Mixin.Common'); Shared.mixin(Db.prototype, 'Mixin.ChainReactor'); Shared.mixin(Db.prototype, 'Mixin.Constants'); Core = Shared.modules.Core; Collection = _dereq_('./Collection.js'); Metrics = _dereq_('./Metrics.js'); Crc = _dereq_('./Crc.js'); Db.prototype._isServer = false; /** * Gets / sets the core object this database belongs to. */ Shared.synthesize(Db.prototype, 'core'); /** * Gets / sets the default primary key for new collections. * @param {String=} val The name of the primary key to set. * @returns {*} */ Shared.synthesize(Db.prototype, 'primaryKey'); /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(Db.prototype, 'state'); /** * Gets / sets the name of the database. * @param {String=} val The name of the database to set. * @returns {*} */ Shared.synthesize(Db.prototype, 'name'); /** * Gets / sets mongodb emulation mode. * @param {Boolean=} val True to enable, false to disable. * @returns {*} */ Shared.synthesize(Db.prototype, 'mongoEmulation'); /** * Returns true if ForerunnerDB is running on a client browser. * @returns {boolean} */ Db.prototype.isClient = function () { return !this._isServer; }; /** * Returns true if ForerunnerDB is running on a server. * @returns {boolean} */ Db.prototype.isServer = function () { return this._isServer; }; /** * Returns a checksum of a string. * @param {String} string The string to checksum. * @return {String} The checksum generated. */ Db.prototype.crc = Crc; /** * Checks if the database is running on a client (browser) or * a server (node.js). * @returns {Boolean} Returns true if running on a browser. */ Db.prototype.isClient = function () { return !this._isServer; }; /** * Checks if the database is running on a client (browser) or * a server (node.js). * @returns {Boolean} Returns true if running on a server. */ Db.prototype.isServer = function () { return this._isServer; }; /** * Converts a normal javascript array of objects into a DB collection. * @param {Array} arr An array of objects. * @returns {Collection} A new collection instance with the data set to the * array passed. */ Db.prototype.arrayToCollection = function (arr) { return new Collection().setData(arr); }; /** * Registers an event listener against an event name. * @param {String} event The name of the event to listen for. * @param {Function} listener The listener method to call when * the event is fired. * @returns {*} */ Db.prototype.on = function(event, listener) { this._listeners = this._listeners || {}; this._listeners[event] = this._listeners[event] || []; this._listeners[event].push(listener); return this; }; /** * De-registers an event listener from an event name. * @param {String} event The name of the event to stop listening for. * @param {Function} listener The listener method passed to on() when * registering the event listener. * @returns {*} */ Db.prototype.off = function(event, listener) { if (event in this._listeners) { var arr = this._listeners[event], index = arr.indexOf(listener); if (index > -1) { arr.splice(index, 1); } } return this; }; /** * Emits an event by name with the given data. * @param {String} event The name of the event to emit. * @param {*=} data The data to emit with the event. * @returns {*} */ Db.prototype.emit = function(event, data) { this._listeners = this._listeners || {}; if (event in this._listeners) { var arr = this._listeners[event], arrCount = arr.length, arrIndex; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { arr[arrIndex].apply(this, Array.prototype.slice.call(arguments, 1)); } } return this; }; /** * Find all documents across all collections in the database that match the passed * string or search object. * @param search String or search object. * @returns {Array} */ Db.prototype.peek = function (search) { var i, coll, arr = [], typeOfSearch = typeof search; // Loop collections for (i in this._collection) { if (this._collection.hasOwnProperty(i)) { coll = this._collection[i]; if (typeOfSearch === 'string') { arr = arr.concat(coll.peek(search)); } else { arr = arr.concat(coll.find(search)); } } } return arr; }; /** * Find all documents across all collections in the database that match the passed * string or search object and return them in an object where each key is the name * of the collection that the document was matched in. * @param search String or search object. * @returns {object} */ Db.prototype.peekCat = function (search) { var i, coll, cat = {}, arr, typeOfSearch = typeof search; // Loop collections for (i in this._collection) { if (this._collection.hasOwnProperty(i)) { coll = this._collection[i]; if (typeOfSearch === 'string') { arr = coll.peek(search); if (arr && arr.length) { cat[coll.name()] = arr; } } else { arr = coll.find(search); if (arr && arr.length) { cat[coll.name()] = arr; } } } } return cat; }; Db.prototype.drop = new Overload({ /** * Drops the database. * @func drop * @memberof Db */ '': function () { if (!this.isDropped()) { var arr = this.collections(), arrCount = arr.length, arrIndex; this._state = 'dropped'; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { this.collection(arr[arrIndex].name).drop(); delete this._collection[arr[arrIndex].name]; } this.emit('drop', this); delete this._core._db[this._name]; } return true; }, /** * Drops the database with optional callback method. * @func drop * @memberof Db * @param {Function} callback Optional callback method. */ 'function': function (callback) { if (!this.isDropped()) { var arr = this.collections(), arrCount = arr.length, arrIndex, finishCount = 0, afterDrop = function () { finishCount++; if (finishCount === arrCount) { if (callback) { callback(); } } }; this._state = 'dropped'; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { this.collection(arr[arrIndex].name).drop(afterDrop); delete this._collection[arr[arrIndex].name]; } this.emit('drop', this); delete this._core._db[this._name]; } return true; }, /** * Drops the database with optional persistent storage drop. Persistent * storage is dropped by default if no preference is provided. * @func drop * @memberof Db * @param {Boolean} removePersist Drop persistent storage for this database. */ 'boolean': function (removePersist) { if (!this.isDropped()) { var arr = this.collections(), arrCount = arr.length, arrIndex; this._state = 'dropped'; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { this.collection(arr[arrIndex].name).drop(removePersist); delete this._collection[arr[arrIndex].name]; } this.emit('drop', this); delete this._core._db[this._name]; } return true; }, /** * Drops the database and optionally controls dropping persistent storage * and callback method. * @func drop * @memberof Db * @param {Boolean} removePersist Drop persistent storage for this database. * @param {Function} callback Optional callback method. */ 'boolean, function': function (removePersist, callback) { if (!this.isDropped()) { var arr = this.collections(), arrCount = arr.length, arrIndex, finishCount = 0, afterDrop = function () { finishCount++; if (finishCount === arrCount) { if (callback) { callback(); } } }; this._state = 'dropped'; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { this.collection(arr[arrIndex].name).drop(removePersist, afterDrop); delete this._collection[arr[arrIndex].name]; } this.emit('drop', this); delete this._core._db[this._name]; } return true; } }); /** * Gets a database instance by name. * @memberof Core * @param {String=} name Optional name of the database. If none is provided * a random name is assigned. * @returns {Db} */ Core.prototype.db = function (name) { // Handle being passed an instance if (name instanceof Db) { return name; } if (!name) { name = this.objectId(); } this._db[name] = this._db[name] || new Db(name, this); this._db[name].mongoEmulation(this.mongoEmulation()); return this._db[name]; }; /** * Returns an array of databases that ForerunnerDB currently has. * @memberof Core * @param {String|RegExp=} search The optional search string or regular expression to use * to match collection names against. * @returns {Array} An array of objects containing details of each database * that ForerunnerDB is currently managing and it's child entities. */ Core.prototype.databases = function (search) { var arr = [], tmpObj, addDb, i; if (search) { if (!(search instanceof RegExp)) { // Turn the search into a regular expression search = new RegExp(search); } } for (i in this._db) { if (this._db.hasOwnProperty(i)) { addDb = true; if (search) { if (!search.exec(i)) { addDb = false; } } if (addDb) { tmpObj = { name: i, children: [] }; if (this.shared.moduleExists('Collection')) { tmpObj.children.push({ module: 'collection', moduleName: 'Collections', count: this._db[i].collections().length }); } if (this.shared.moduleExists('CollectionGroup')) { tmpObj.children.push({ module: 'collectionGroup', moduleName: 'Collection Groups', count: this._db[i].collectionGroups().length }); } if (this.shared.moduleExists('Document')) { tmpObj.children.push({ module: 'document', moduleName: 'Documents', count: this._db[i].documents().length }); } if (this.shared.moduleExists('Grid')) { tmpObj.children.push({ module: 'grid', moduleName: 'Grids', count: this._db[i].grids().length }); } if (this.shared.moduleExists('Overview')) { tmpObj.children.push({ module: 'overview', moduleName: 'Overviews', count: this._db[i].overviews().length }); } if (this.shared.moduleExists('View')) { tmpObj.children.push({ module: 'view', moduleName: 'Views', count: this._db[i].views().length }); } arr.push(tmpObj); } } } arr.sort(function (a, b) { return a.name.localeCompare(b.name); }); return arr; }; Shared.finishModule('Db'); module.exports = Db; },{"./Collection.js":4,"./Crc.js":7,"./Metrics.js":15,"./Overload":28,"./Shared":35}],9:[function(_dereq_,module,exports){ "use strict"; // TODO: Remove the _update* methods because we are already mixing them // TODO: in now via Mixin.Updating and update autobind to extend the _update* // TODO: methods like we already do with collection var Shared, Collection, Db; Shared = _dereq_('./Shared'); /** * Creates a new Document instance. Documents allow you to create individual * objects that can have standard ForerunnerDB CRUD operations run against * them, as well as data-binding if the AutoBind module is included in your * project. * @name Document * @class Document * @constructor */ var FdbDocument = function () { this.init.apply(this, arguments); }; FdbDocument.prototype.init = function (name) { this._name = name; this._data = {}; }; Shared.addModule('Document', FdbDocument); Shared.mixin(FdbDocument.prototype, 'Mixin.Common'); Shared.mixin(FdbDocument.prototype, 'Mixin.Events'); Shared.mixin(FdbDocument.prototype, 'Mixin.ChainReactor'); Shared.mixin(FdbDocument.prototype, 'Mixin.Constants'); Shared.mixin(FdbDocument.prototype, 'Mixin.Triggers'); Shared.mixin(FdbDocument.prototype, 'Mixin.Matching'); Shared.mixin(FdbDocument.prototype, 'Mixin.Updating'); Collection = _dereq_('./Collection'); Db = Shared.modules.Db; /** * Gets / sets the current state. * @func state * @memberof Document * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(FdbDocument.prototype, 'state'); /** * Gets / sets the db instance this class instance belongs to. * @func db * @memberof Document * @param {Db=} db The db instance. * @returns {*} */ Shared.synthesize(FdbDocument.prototype, 'db'); /** * Gets / sets the document name. * @func name * @memberof Document * @param {String=} val The name to assign * @returns {*} */ Shared.synthesize(FdbDocument.prototype, 'name'); /** * Sets the data for the document. * @func setData * @memberof Document * @param data * @param options * @returns {Document} */ FdbDocument.prototype.setData = function (data, options) { var i, $unset; if (data) { options = options || { $decouple: true }; if (options && options.$decouple === true) { data = this.decouple(data); } if (this._linked) { $unset = {}; // Remove keys that don't exist in the new data from the current object for (i in this._data) { if (i.substr(0, 6) !== 'jQuery' && this._data.hasOwnProperty(i)) { // Check if existing data has key if (data[i] === undefined) { // Add property name to those to unset $unset[i] = 1; } } } data.$unset = $unset; // Now update the object with new data this.updateObject(this._data, data, {}); } else { // Straight data assignment this._data = data; } } return this; }; /** * Gets the document's data returned as a single object. * @func find * @memberof Document * @param {Object} query The query object - currently unused, just * provide a blank object e.g. {} * @param {Object=} options An options object. * @returns {Object} The document's data object. */ FdbDocument.prototype.find = function (query, options) { var result; if (options && options.$decouple === false) { result = this._data; } else { result = this.decouple(this._data); } return result; }; /** * Modifies the document. This will update the document with the data held in 'update'. * @func update * @memberof Document * @param {Object} query The query that must be matched for a document to be * operated on. * @param {Object} update The object containing updated key/values. Any keys that * match keys on the existing document will be overwritten with this data. Any * keys that do not currently exist on the document will be added to the document. * @param {Object=} options An options object. * @returns {Array} The items that were updated. */ FdbDocument.prototype.update = function (query, update, options) { this.updateObject(this._data, update, query, options); }; /** * Internal method for document updating. * @func updateObject * @memberof Document * @param {Object} doc The document to update. * @param {Object} update The object with key/value pairs to update the document with. * @param {Object} query The query object that we need to match to perform an update. * @param {Object} options An options object. * @param {String} path The current recursive path. * @param {String} opType The type of update operation to perform, if none is specified * default is to set new data against matching fields. * @returns {Boolean} True if the document was updated with new / changed data or * false if it was not updated because the data was the same. * @private */ FdbDocument.prototype.updateObject = Collection.prototype.updateObject; /** * Determines if the passed key has an array positional mark (a dollar at the end * of its name). * @func _isPositionalKey * @memberof Document * @param {String} key The key to check. * @returns {Boolean} True if it is a positional or false if not. * @private */ FdbDocument.prototype._isPositionalKey = function (key) { return key.substr(key.length - 2, 2) === '.$'; }; /** * Updates a property on an object depending on if the collection is * currently running data-binding or not. * @func _updateProperty * @memberof Document * @param {Object} doc The object whose property is to be updated. * @param {String} prop The property to update. * @param {*} val The new value of the property. * @private */ FdbDocument.prototype._updateProperty = function (doc, prop, val) { if (this._linked) { window.jQuery.observable(doc).setProperty(prop, val); if (this.debug()) { console.log(this.logIdentifier() + ' Setting data-bound document property "' + prop + '"'); } } else { doc[prop] = val; if (this.debug()) { console.log(this.logIdentifier() + ' Setting non-data-bound document property "' + prop + '"'); } } }; /** * Increments a value for a property on a document by the passed number. * @func _updateIncrement * @memberof Document * @param {Object} doc The document to modify. * @param {String} prop The property to modify. * @param {Number} val The amount to increment by. * @private */ FdbDocument.prototype._updateIncrement = function (doc, prop, val) { if (this._linked) { window.jQuery.observable(doc).setProperty(prop, doc[prop] + val); } else { doc[prop] += val; } }; /** * Changes the index of an item in the passed array. * @func _updateSpliceMove * @memberof Document * @param {Array} arr The array to modify. * @param {Number} indexFrom The index to move the item from. * @param {Number} indexTo The index to move the item to. * @private */ FdbDocument.prototype._updateSpliceMove = function (arr, indexFrom, indexTo) { if (this._linked) { window.jQuery.observable(arr).move(indexFrom, indexTo); if (this.debug()) { console.log(this.logIdentifier() + ' Moving data-bound document array index from "' + indexFrom + '" to "' + indexTo + '"'); } } else { arr.splice(indexTo, 0, arr.splice(indexFrom, 1)[0]); if (this.debug()) { console.log(this.logIdentifier() + ' Moving non-data-bound document array index from "' + indexFrom + '" to "' + indexTo + '"'); } } }; /** * Inserts an item into the passed array at the specified index. * @func _updateSplicePush * @memberof Document * @param {Array} arr The array to insert into. * @param {Number} index The index to insert at. * @param {Object} doc The document to insert. * @private */ FdbDocument.prototype._updateSplicePush = function (arr, index, doc) { if (arr.length > index) { if (this._linked) { window.jQuery.observable(arr).insert(index, doc); } else { arr.splice(index, 0, doc); } } else { if (this._linked) { window.jQuery.observable(arr).insert(doc); } else { arr.push(doc); } } }; /** * Inserts an item at the end of an array. * @func _updatePush * @memberof Document * @param {Array} arr The array to insert the item into. * @param {Object} doc The document to insert. * @private */ FdbDocument.prototype._updatePush = function (arr, doc) { if (this._linked) { window.jQuery.observable(arr).insert(doc); } else { arr.push(doc); } }; /** * Removes an item from the passed array. * @func _updatePull * @memberof Document * @param {Array} arr The array to modify. * @param {Number} index The index of the item in the array to remove. * @private */ FdbDocument.prototype._updatePull = function (arr, index) { if (this._linked) { window.jQuery.observable(arr).remove(index); } else { arr.splice(index, 1); } }; /** * Multiplies a value for a property on a document by the passed number. * @func _updateMultiply * @memberof Document * @param {Object} doc The document to modify. * @param {String} prop The property to modify. * @param {Number} val The amount to multiply by. * @private */ FdbDocument.prototype._updateMultiply = function (doc, prop, val) { if (this._linked) { window.jQuery.observable(doc).setProperty(prop, doc[prop] * val); } else { doc[prop] *= val; } }; /** * Renames a property on a document to the passed property. * @func _updateRename * @memberof Document * @param {Object} doc The document to modify. * @param {String} prop The property to rename. * @param {Number} val The new property name. * @private */ FdbDocument.prototype._updateRename = function (doc, prop, val) { var existingVal = doc[prop]; if (this._linked) { window.jQuery.observable(doc).setProperty(val, existingVal); window.jQuery.observable(doc).removeProperty(prop); } else { doc[val] = existingVal; delete doc[prop]; } }; /** * Deletes a property on a document. * @func _updateUnset * @memberof Document * @param {Object} doc The document to modify. * @param {String} prop The property to delete. * @private */ FdbDocument.prototype._updateUnset = function (doc, prop) { if (this._linked) { window.jQuery.observable(doc).removeProperty(prop); } else { delete doc[prop]; } }; /** * Drops the document. * @func drop * @memberof Document * @returns {boolean} True if successful, false if not. */ FdbDocument.prototype.drop = function () { if (!this.isDropped()) { if (this._db && this._name) { if (this._db && this._db._document && this._db._document[this._name]) { this._state = 'dropped'; delete this._db._document[this._name]; delete this._data; this.emit('drop', this); return true; } } } else { return true; } return false; }; /** * Creates a new document instance. * @func document * @memberof Db * @param {String} documentName The name of the document to create. * @returns {*} */ Db.prototype.document = function (documentName) { if (documentName) { // Handle being passed an instance if (documentName instanceof FdbDocument) { if (documentName.state() !== 'droppped') { return documentName; } else { documentName = documentName.name(); } } this._document = this._document || {}; this._document[documentName] = this._document[documentName] || new FdbDocument(documentName).db(this); return this._document[documentName]; } else { // Return an object of document data return this._document; } }; /** * Returns an array of documents the DB currently has. * @func documents * @memberof Db * @returns {Array} An array of objects containing details of each document * the database is currently managing. */ Db.prototype.documents = function () { var arr = [], item, i; for (i in this._document) { if (this._document.hasOwnProperty(i)) { item = this._document[i]; arr.push({ name: i, linked: item.isLinked !== undefined ? item.isLinked() : false }); } } return arr; }; Shared.finishModule('Document'); module.exports = FdbDocument; },{"./Collection":4,"./Shared":35}],10:[function(_dereq_,module,exports){ "use strict"; // Import external names locally var Shared, Db, Collection, CollectionGroup, View, CollectionInit, DbInit, ReactorIO; //Shared = ForerunnerDB.shared; Shared = _dereq_('./Shared'); /** * Creates a new grid instance. * @name Grid * @class Grid * @param {String} selector jQuery selector. * @param {String} template The template selector. * @param {Object=} options The options object to apply to the grid. * @constructor */ var Grid = function (selector, template, options) { this.init.apply(this, arguments); }; Grid.prototype.init = function (selector, template, options) { var self = this; this._selector = selector; this._template = template; this._options = options || {}; this._debug = {}; this._id = this.objectId(); this._collectionDroppedWrap = function () { self._collectionDropped.apply(self, arguments); }; }; Shared.addModule('Grid', Grid); Shared.mixin(Grid.prototype, 'Mixin.Common'); Shared.mixin(Grid.prototype, 'Mixin.ChainReactor'); Shared.mixin(Grid.prototype, 'Mixin.Constants'); Shared.mixin(Grid.prototype, 'Mixin.Triggers'); Shared.mixin(Grid.prototype, 'Mixin.Events'); Collection = _dereq_('./Collection'); CollectionGroup = _dereq_('./CollectionGroup'); View = _dereq_('./View'); ReactorIO = _dereq_('./ReactorIO'); CollectionInit = Collection.prototype.init; Db = Shared.modules.Db; DbInit = Db.prototype.init; /** * Gets / sets the current state. * @func state * @memberof Grid * @param {String=} val The name of the state to set. * @returns {Grid} */ Shared.synthesize(Grid.prototype, 'state'); /** * Gets / sets the current name. * @func name * @memberof Grid * @param {String=} val The name to set. * @returns {Grid} */ Shared.synthesize(Grid.prototype, 'name'); /** * Executes an insert against the grid's underlying data-source. * @func insert * @memberof Grid */ Grid.prototype.insert = function () { this._from.insert.apply(this._from, arguments); }; /** * Executes an update against the grid's underlying data-source. * @func update * @memberof Grid */ Grid.prototype.update = function () { this._from.update.apply(this._from, arguments); }; /** * Executes an updateById against the grid's underlying data-source. * @func updateById * @memberof Grid */ Grid.prototype.updateById = function () { this._from.updateById.apply(this._from, arguments); }; /** * Executes a remove against the grid's underlying data-source. * @func remove * @memberof Grid */ Grid.prototype.remove = function () { this._from.remove.apply(this._from, arguments); }; /** * Sets the collection from which the grid will assemble its data. * @func from * @memberof Grid * @param {Collection} collection The collection to use to assemble grid data. * @returns {Grid} */ Grid.prototype.from = function (collection) { //var self = this; if (collection !== undefined) { // Check if we have an existing from if (this._from) { // Remove the listener to the drop event this._from.off('drop', this._collectionDroppedWrap); this._from._removeGrid(this); } if (typeof(collection) === 'string') { collection = this._db.collection(collection); } this._from = collection; this._from.on('drop', this._collectionDroppedWrap); this.refresh(); } return this; }; /** * Gets / sets the db instance this class instance belongs to. * @func db * @memberof Grid * @param {Db=} db The db instance. * @returns {*} */ Shared.synthesize(Grid.prototype, 'db', function (db) { if (db) { // Apply the same debug settings this.debug(db.debug()); } return this.$super.apply(this, arguments); }); Grid.prototype._collectionDropped = function (collection) { if (collection) { // Collection was dropped, remove from grid delete this._from; } }; /** * Drops a grid and all it's stored data from the database. * @func drop * @memberof Grid * @returns {boolean} True on success, false on failure. */ Grid.prototype.drop = function () { if (!this.isDropped()) { if (this._from) { // Remove data-binding this._from.unlink(this._selector, this.template()); // Kill listeners and references this._from.off('drop', this._collectionDroppedWrap); this._from._removeGrid(this); if (this.debug() || (this._db && this._db.debug())) { console.log(this.logIdentifier() + ' Dropping grid ' + this._selector); } this._state = 'dropped'; if (this._db && this._selector) { delete this._db._grid[this._selector]; } this.emit('drop', this); delete this._selector; delete this._template; delete this._from; delete this._db; return true; } } else { return true; } return false; }; /** * Gets / sets the grid's HTML template to use when rendering. * @func template * @memberof Grid * @param {Selector} template The template's jQuery selector. * @returns {*} */ Grid.prototype.template = function (template) { if (template !== undefined) { this._template = template; return this; } return this._template; }; Grid.prototype._sortGridClick = function (e) { var elem = window.jQuery(e.currentTarget), sortColText = elem.attr('data-grid-sort') || '', sortColDir = parseInt((elem.attr('data-grid-dir') || "-1"), 10) === -1 ? 1 : -1, sortCols = sortColText.split(','), sortObj = {}, i; // Remove all grid sort tags from the grid window.jQuery(this._selector).find('[data-grid-dir]').removeAttr('data-grid-dir'); // Flip the sort direction elem.attr('data-grid-dir', sortColDir); for (i = 0; i < sortCols.length; i++) { sortObj[sortCols] = sortColDir; } Shared.mixin(sortObj, this._options.$orderBy); this._from.orderBy(sortObj); this.emit('sort', sortObj); }; /** * Refreshes the grid data such as ordering etc. * @func refresh * @memberof Grid */ Grid.prototype.refresh = function () { if (this._from) { if (this._from.link) { var self = this, elem = window.jQuery(this._selector), sortClickListener = function () { self._sortGridClick.apply(self, arguments); }; // Clear the container elem.html(''); if (self._from.orderBy) { // Remove listeners elem.off('click', '[data-grid-sort]', sortClickListener); } if (self._from.query) { // Remove listeners elem.off('click', '[data-grid-filter]', sortClickListener ); } // Set wrap name if none is provided self._options.$wrap = self._options.$wrap || 'gridRow'; // Auto-bind the data to the grid template self._from.link(self._selector, self.template(), self._options); // Check if the data source (collection or view) has an // orderBy method (usually only views) and if so activate // the sorting system if (self._from.orderBy) { // Listen for sort requests elem.on('click', '[data-grid-sort]', sortClickListener); } if (self._from.query) { // Listen for filter requests var queryObj = {}; elem.find('[data-grid-filter]').each(function (index, filterElem) { filterElem = window.jQuery(filterElem); var filterField = filterElem.attr('data-grid-filter'), filterVarType = filterElem.attr('data-grid-vartype'), filterSort = {}, title = filterElem.html(), dropDownButton, dropDownMenu, template, filterQuery, filterView = self._db.view('tmpGridFilter_' + self._id + '_' + filterField); filterSort[filterField] = 1; filterQuery = { $distinct: filterSort }; filterView .query(filterQuery) .orderBy(filterSort) .from(self._from._from); template = [ '<div class="dropdown" id="' + self._id + '_' + filterField + '">', '<button class="btn btn-default dropdown-toggle" type="button" id="' + self._id + '_' + filterField + '_dropdownButton" data-toggle="dropdown" aria-expanded="true">', title + ' <span class="caret"></span>', '</button>', '</div>' ]; dropDownButton = window.jQuery(template.join('')); dropDownMenu = window.jQuery('<ul class="dropdown-menu" role="menu" id="' + self._id + '_' + filterField + '_dropdownMenu"></ul>'); dropDownButton.append(dropDownMenu); filterElem.html(dropDownButton); // Data-link the underlying data to the grid filter drop-down filterView.link(dropDownMenu, { template: [ '<li role="presentation" class="input-group" style="width: 240px; padding-left: 10px; padding-right: 10px; padding-top: 5px;">', '<input type="search" class="form-control gridFilterSearch" placeholder="Search...">', '<span class="input-group-btn">', '<button class="btn btn-default gridFilterClearSearch" type="button"><span class="glyphicon glyphicon-remove-circle glyphicons glyphicons-remove"></span></button>', '</span>', '</li>', '<li role="presentation" class="divider"></li>', '<li role="presentation" data-val="$all">', '<a role="menuitem" tabindex="-1">', '<input type="checkbox" checked>&nbsp;All', '</a>', '</li>', '<li role="presentation" class="divider"></li>', '{^{for options}}', '<li role="presentation" data-link="data-val{:' + filterField + '}">', '<a role="menuitem" tabindex="-1">', '<input type="checkbox">&nbsp;{^{:' + filterField + '}}', '</a>', '</li>', '{{/for}}' ].join('') }, { $wrap: 'options' }); elem.on('keyup', '#' + self._id + '_' + filterField + '_dropdownMenu .gridFilterSearch', function (e) { var elem = window.jQuery(this), query = filterView.query(), search = elem.val(); if (search) { query[filterField] = new RegExp(search, 'gi'); } else { delete query[filterField]; } filterView.query(query); }); elem.on('click', '#' + self._id + '_' + filterField + '_dropdownMenu .gridFilterClearSearch', function (e) { // Clear search text box window.jQuery(this).parents('li').find('.gridFilterSearch').val(''); // Clear view query var query = filterView.query(); delete query[filterField]; filterView.query(query); }); elem.on('click', '#' + self._id + '_' + filterField + '_dropdownMenu li', function (e) { e.stopPropagation(); var fieldValue, elem = $(this), checkbox = elem.find('input[type="checkbox"]'), checked, addMode = true, fieldInArr, liElem, i; // If the checkbox is not the one clicked on if (!window.jQuery(e.target).is('input')) { // Set checkbox to opposite of current value checkbox.prop('checked', !checkbox.prop('checked')); checked = checkbox.is(':checked'); } else { checkbox.prop('checked', checkbox.prop('checked')); checked = checkbox.is(':checked'); } liElem = window.jQuery(this); fieldValue = liElem.attr('data-val'); // Check if the selection is the "all" option if (fieldValue === '$all') { // Remove the field from the query delete queryObj[filterField]; // Clear all other checkboxes liElem.parent().find('li[data-val!="$all"]').find('input[type="checkbox"]').prop('checked', false); } else { // Clear the "all" checkbox liElem.parent().find('[data-val="$all"]').find('input[type="checkbox"]').prop('checked', false); // Check if the type needs casting switch (filterVarType) { case 'integer': fieldValue = parseInt(fieldValue, 10); break; case 'float': fieldValue = parseFloat(fieldValue); break; default: } // Check if the item exists already queryObj[filterField] = queryObj[filterField] || { $in: [] }; fieldInArr = queryObj[filterField].$in; for (i = 0; i < fieldInArr.length; i++) { if (fieldInArr[i] === fieldValue) { // Item already exists if (checked === false) { // Remove the item fieldInArr.splice(i, 1); } addMode = false; break; } } if (addMode && checked) { fieldInArr.push(fieldValue); } if (!fieldInArr.length) { // Remove the field from the query delete queryObj[filterField]; } } // Set the view query self._from.queryData(queryObj); if (self._from.pageFirst) { self._from.pageFirst(); } }); }); } self.emit('refresh'); } else { throw('Grid requires the AutoBind module in order to operate!'); } } return this; }; /** * Returns the number of documents currently in the grid. * @func count * @memberof Grid * @returns {Number} */ Grid.prototype.count = function () { return this._from.count(); }; /** * Creates a grid and assigns the collection as its data source. * @func grid * @memberof Collection * @param {String} selector jQuery selector of grid output target. * @param {String} template The table template to use when rendering the grid. * @param {Object=} options The options object to apply to the grid. * @returns {*} */ Collection.prototype.grid = View.prototype.grid = function (selector, template, options) { if (this._db && this._db._grid ) { if (selector !== undefined) { if (template !== undefined) { if (!this._db._grid[selector]) { var grid = new Grid(selector, template, options) .db(this._db) .from(this); this._grid = this._grid || []; this._grid.push(grid); this._db._grid[selector] = grid; return grid; } else { throw(this.logIdentifier() + ' Cannot create a grid because a grid with this name already exists: ' + selector); } } return this._db._grid[selector]; } return this._db._grid; } }; /** * Removes a grid safely from the DOM. Must be called when grid is * no longer required / is being removed from DOM otherwise references * will stick around and cause memory leaks. * @func unGrid * @memberof Collection * @param {String} selector jQuery selector of grid output target. * @param {String} template The table template to use when rendering the grid. * @param {Object=} options The options object to apply to the grid. * @returns {*} */ Collection.prototype.unGrid = View.prototype.unGrid = function (selector, template, options) { var i, grid; if (this._db && this._db._grid ) { if (selector && template) { if (this._db._grid[selector]) { grid = this._db._grid[selector]; delete this._db._grid[selector]; return grid.drop(); } else { throw(this.logIdentifier() + ' Cannot remove grid because a grid with this name does not exist: ' + name); } } else { // No parameters passed, remove all grids from this module for (i in this._db._grid) { if (this._db._grid.hasOwnProperty(i)) { grid = this._db._grid[i]; delete this._db._grid[i]; grid.drop(); if (this.debug()) { console.log(this.logIdentifier() + ' Removed grid binding "' + i + '"'); } } } this._db._grid = {}; } } }; /** * Adds a grid to the internal grid lookup. * @func _addGrid * @memberof Collection * @param {Grid} grid The grid to add. * @returns {Collection} * @private */ Collection.prototype._addGrid = CollectionGroup.prototype._addGrid = View.prototype._addGrid = function (grid) { if (grid !== undefined) { this._grid = this._grid || []; this._grid.push(grid); } return this; }; /** * Removes a grid from the internal grid lookup. * @func _removeGrid * @memberof Collection * @param {Grid} grid The grid to remove. * @returns {Collection} * @private */ Collection.prototype._removeGrid = CollectionGroup.prototype._removeGrid = View.prototype._removeGrid = function (grid) { if (grid !== undefined && this._grid) { var index = this._grid.indexOf(grid); if (index > -1) { this._grid.splice(index, 1); } } return this; }; // Extend DB with grids init Db.prototype.init = function () { this._grid = {}; DbInit.apply(this, arguments); }; /** * Determine if a grid with the passed name already exists. * @func gridExists * @memberof Db * @param {String} selector The jQuery selector to bind the grid to. * @returns {boolean} */ Db.prototype.gridExists = function (selector) { return Boolean(this._grid[selector]); }; /** * Creates a grid based on the passed arguments. * @func grid * @memberof Db * @param {String} selector The jQuery selector of the grid to retrieve. * @param {String} template The table template to use when rendering the grid. * @param {Object=} options The options object to apply to the grid. * @returns {*} */ Db.prototype.grid = function (selector, template, options) { if (!this._grid[selector]) { if (this.debug() || (this._db && this._db.debug())) { console.log(this.logIdentifier() + ' Creating grid ' + selector); } } this._grid[selector] = this._grid[selector] || new Grid(selector, template, options).db(this); return this._grid[selector]; }; /** * Removes a grid based on the passed arguments. * @func unGrid * @memberof Db * @param {String} selector The jQuery selector of the grid to retrieve. * @param {String} template The table template to use when rendering the grid. * @param {Object=} options The options object to apply to the grid. * @returns {*} */ Db.prototype.unGrid = function (selector, template, options) { if (!this._grid[selector]) { if (this.debug() || (this._db && this._db.debug())) { console.log(this.logIdentifier() + ' Creating grid ' + selector); } } this._grid[selector] = this._grid[selector] || new Grid(selector, template, options).db(this); return this._grid[selector]; }; /** * Returns an array of grids the DB currently has. * @func grids * @memberof Db * @returns {Array} An array of objects containing details of each grid * the database is currently managing. */ Db.prototype.grids = function () { var arr = [], item, i; for (i in this._grid) { if (this._grid.hasOwnProperty(i)) { item = this._grid[i]; arr.push({ name: i, count: item.count(), linked: item.isLinked !== undefined ? item.isLinked() : false }); } } return arr; }; Shared.finishModule('Grid'); module.exports = Grid; },{"./Collection":4,"./CollectionGroup":5,"./ReactorIO":34,"./Shared":35,"./View":36}],11:[function(_dereq_,module,exports){ "use strict"; // Import external names locally var Shared, Collection, CollectionInit, Overload; Shared = _dereq_('./Shared'); Overload = _dereq_('./Overload'); /** * The constructor. * * @constructor */ var Highchart = function (collection, options) { this.init.apply(this, arguments); }; Highchart.prototype.init = function (collection, options) { this._options = options; this._selector = window.jQuery(this._options.selector); if (!this._selector[0]) { throw(this.classIdentifier() + ' "' + collection.name() + '": Chart target element does not exist via selector: ' + this._options.selector); } this._listeners = {}; this._collection = collection; // Setup the chart this._options.series = []; // Disable attribution on highcharts options.chartOptions = options.chartOptions || {}; options.chartOptions.credits = false; // Set the data for the chart var data, seriesObj, chartData; switch (this._options.type) { case 'pie': // Create chart from data this._selector.highcharts(this._options.chartOptions); this._chart = this._selector.highcharts(); // Generate graph data from collection data data = this._collection.find(); seriesObj = { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, format: '<b>{point.name}</b>: {y} ({point.percentage:.0f}%)', style: { color: (window.Highcharts.theme && window.Highcharts.theme.contrastTextColor) || 'black' } } }; chartData = this.pieDataFromCollectionData(data, this._options.keyField, this._options.valField); window.jQuery.extend(seriesObj, this._options.seriesOptions); window.jQuery.extend(seriesObj, { name: this._options.seriesName, data: chartData }); this._chart.addSeries(seriesObj, true, true); break; case 'line': case 'area': case 'column': case 'bar': // Generate graph data from collection data chartData = this.seriesDataFromCollectionData( this._options.seriesField, this._options.keyField, this._options.valField, this._options.orderBy ); this._options.chartOptions.xAxis = chartData.xAxis; this._options.chartOptions.series = chartData.series; this._selector.highcharts(this._options.chartOptions); this._chart = this._selector.highcharts(); break; default: throw(this.classIdentifier() + ' "' + collection.name() + '": Chart type specified is not currently supported by ForerunnerDB: ' + this._options.type); } // Hook the collection events to auto-update the chart this._hookEvents(); }; Shared.addModule('Highchart', Highchart); Collection = Shared.modules.Collection; CollectionInit = Collection.prototype.init; Shared.mixin(Highchart.prototype, 'Mixin.Common'); Shared.mixin(Highchart.prototype, 'Mixin.Events'); /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(Highchart.prototype, 'state'); /** * Generate pie-chart series data from the given collection data array. * @param data * @param keyField * @param valField * @returns {Array} */ Highchart.prototype.pieDataFromCollectionData = function (data, keyField, valField) { var graphData = [], i; for (i = 0; i < data.length; i++) { graphData.push([data[i][keyField], data[i][valField]]); } return graphData; }; /** * Generate line-chart series data from the given collection data array. * @param seriesField * @param keyField * @param valField * @param orderBy */ Highchart.prototype.seriesDataFromCollectionData = function (seriesField, keyField, valField, orderBy) { var data = this._collection.distinct(seriesField), seriesData = [], xAxis = { categories: [] }, seriesName, query, dataSearch, seriesValues, i, k; // What we WANT to output: /*series: [{ name: 'Responses', data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6] }]*/ // Loop keys for (i = 0; i < data.length; i++) { seriesName = data[i]; query = {}; query[seriesField] = seriesName; seriesValues = []; dataSearch = this._collection.find(query, { orderBy: orderBy }); // Loop the keySearch data and grab the value for each item for (k = 0; k < dataSearch.length; k++) { xAxis.categories.push(dataSearch[k][keyField]); seriesValues.push(dataSearch[k][valField]); } seriesData.push({ name: seriesName, data: seriesValues }); } return { xAxis: xAxis, series: seriesData }; }; /** * Hook the events the chart needs to know about from the internal collection. * @private */ Highchart.prototype._hookEvents = function () { var self = this; self._collection.on('change', function () { self._changeListener.apply(self, arguments); }); // If the collection is dropped, clean up after ourselves self._collection.on('drop', function () { self.drop.apply(self, arguments); }); }; /** * Handles changes to the collection data that the chart is reading from and then * updates the data in the chart display. * @private */ Highchart.prototype._changeListener = function () { var self = this; // Update the series data on the chart if(typeof self._collection !== 'undefined' && self._chart) { var data = self._collection.find(), i; switch (self._options.type) { case 'pie': self._chart.series[0].setData( self.pieDataFromCollectionData( data, self._options.keyField, self._options.valField ), true, true ); break; case 'bar': case 'line': case 'area': case 'column': var seriesData = self.seriesDataFromCollectionData( self._options.seriesField, self._options.keyField, self._options.valField, self._options.orderBy ); self._chart.xAxis[0].setCategories( seriesData.xAxis.categories ); for (i = 0; i < seriesData.series.length; i++) { if (self._chart.series[i]) { // Series exists, set it's data self._chart.series[i].setData( seriesData.series[i].data, true, true ); } else { // Series data does not yet exist, add a new series self._chart.addSeries( seriesData.series[i], true, true ); } } break; default: break; } } }; /** * Destroys the chart and all internal references. * @returns {Boolean} */ Highchart.prototype.drop = function () { if (!this.isDropped()) { this._state = 'dropped'; if (this._chart) { this._chart.destroy(); } if (this._collection) { this._collection.off('change', this._changeListener); this._collection.off('drop', this.drop); if (this._collection._highcharts) { delete this._collection._highcharts[this._options.selector]; } } delete this._chart; delete this._options; delete this._collection; this.emit('drop', this); return true; } else { return true; } }; // Extend collection with highchart init Collection.prototype.init = function () { this._highcharts = {}; CollectionInit.apply(this, arguments); }; /** * Creates a pie chart from the collection. * @type {Overload} */ Collection.prototype.pieChart = new Overload({ /** * Chart via options object. * @func pieChart * @memberof Highchart * @param {Object} options The options object. * @returns {*} */ 'object': function (options) { options.type = 'pie'; options.chartOptions = options.chartOptions || {}; options.chartOptions.chart = options.chartOptions.chart || {}; options.chartOptions.chart.type = 'pie'; if (!this._highcharts[options.selector]) { // Store new chart in charts array this._highcharts[options.selector] = new Highchart(this, options); } return this._highcharts[options.selector]; }, /** * Chart via defined params and an options object. * @func pieChart * @memberof Highchart * @param {String|jQuery} selector The element to render the chart to. * @param {String} keyField The field to use as the data key. * @param {String} valField The field to use as the data value. * @param {String} seriesName The name of the series to display on the chart. * @param {Object} options The options object. */ '*, string, string, string, ...': function (selector, keyField, valField, seriesName, options) { options = options || {}; options.selector = selector; options.keyField = keyField; options.valField = valField; options.seriesName = seriesName; // Call the main chart method this.pieChart(options); } }); /** * Creates a line chart from the collection. * @type {Overload} */ Collection.prototype.lineChart = new Overload({ /** * Chart via options object. * @func lineChart * @memberof Highchart * @param {Object} options The options object. * @returns {*} */ 'object': function (options) { options.type = 'line'; options.chartOptions = options.chartOptions || {}; options.chartOptions.chart = options.chartOptions.chart || {}; options.chartOptions.chart.type = 'line'; if (!this._highcharts[options.selector]) { // Store new chart in charts array this._highcharts[options.selector] = new Highchart(this, options); } return this._highcharts[options.selector]; }, /** * Chart via defined params and an options object. * @func lineChart * @memberof Highchart * @param {String|jQuery} selector The element to render the chart to. * @param {String} seriesField The name of the series to plot. * @param {String} keyField The field to use as the data key. * @param {String} valField The field to use as the data value. * @param {Object} options The options object. */ '*, string, string, string, ...': function (selector, seriesField, keyField, valField, options) { options = options || {}; options.seriesField = seriesField; options.selector = selector; options.keyField = keyField; options.valField = valField; // Call the main chart method this.lineChart(options); } }); /** * Creates an area chart from the collection. * @type {Overload} */ Collection.prototype.areaChart = new Overload({ /** * Chart via options object. * @func areaChart * @memberof Highchart * @param {Object} options The options object. * @returns {*} */ 'object': function (options) { options.type = 'area'; options.chartOptions = options.chartOptions || {}; options.chartOptions.chart = options.chartOptions.chart || {}; options.chartOptions.chart.type = 'area'; if (!this._highcharts[options.selector]) { // Store new chart in charts array this._highcharts[options.selector] = new Highchart(this, options); } return this._highcharts[options.selector]; }, /** * Chart via defined params and an options object. * @func areaChart * @memberof Highchart * @param {String|jQuery} selector The element to render the chart to. * @param {String} seriesField The name of the series to plot. * @param {String} keyField The field to use as the data key. * @param {String} valField The field to use as the data value. * @param {Object} options The options object. */ '*, string, string, string, ...': function (selector, seriesField, keyField, valField, options) { options = options || {}; options.seriesField = seriesField; options.selector = selector; options.keyField = keyField; options.valField = valField; // Call the main chart method this.areaChart(options); } }); /** * Creates a column chart from the collection. * @type {Overload} */ Collection.prototype.columnChart = new Overload({ /** * Chart via options object. * @func columnChart * @memberof Highchart * @param {Object} options The options object. * @returns {*} */ 'object': function (options) { options.type = 'column'; options.chartOptions = options.chartOptions || {}; options.chartOptions.chart = options.chartOptions.chart || {}; options.chartOptions.chart.type = 'column'; if (!this._highcharts[options.selector]) { // Store new chart in charts array this._highcharts[options.selector] = new Highchart(this, options); } return this._highcharts[options.selector]; }, /** * Chart via defined params and an options object. * @func columnChart * @memberof Highchart * @param {String|jQuery} selector The element to render the chart to. * @param {String} seriesField The name of the series to plot. * @param {String} keyField The field to use as the data key. * @param {String} valField The field to use as the data value. * @param {Object} options The options object. */ '*, string, string, string, ...': function (selector, seriesField, keyField, valField, options) { options = options || {}; options.seriesField = seriesField; options.selector = selector; options.keyField = keyField; options.valField = valField; // Call the main chart method this.columnChart(options); } }); /** * Creates a bar chart from the collection. * @type {Overload} */ Collection.prototype.barChart = new Overload({ /** * Chart via options object. * @func barChart * @memberof Highchart * @param {Object} options The options object. * @returns {*} */ 'object': function (options) { options.type = 'bar'; options.chartOptions = options.chartOptions || {}; options.chartOptions.chart = options.chartOptions.chart || {}; options.chartOptions.chart.type = 'bar'; if (!this._highcharts[options.selector]) { // Store new chart in charts array this._highcharts[options.selector] = new Highchart(this, options); } return this._highcharts[options.selector]; }, /** * Chart via defined params and an options object. * @func barChart * @memberof Highchart * @param {String|jQuery} selector The element to render the chart to. * @param {String} seriesField The name of the series to plot. * @param {String} keyField The field to use as the data key. * @param {String} valField The field to use as the data value. * @param {Object} options The options object. */ '*, string, string, string, ...': function (selector, seriesField, keyField, valField, options) { options = options || {}; options.seriesField = seriesField; options.selector = selector; options.keyField = keyField; options.valField = valField; // Call the main chart method this.barChart(options); } }); /** * Creates a stacked bar chart from the collection. * @type {Overload} */ Collection.prototype.stackedBarChart = new Overload({ /** * Chart via options object. * @func stackedBarChart * @memberof Highchart * @param {Object} options The options object. * @returns {*} */ 'object': function (options) { options.type = 'bar'; options.chartOptions = options.chartOptions || {}; options.chartOptions.chart = options.chartOptions.chart || {}; options.chartOptions.chart.type = 'bar'; options.plotOptions = options.plotOptions || {}; options.plotOptions.series = options.plotOptions.series || {}; options.plotOptions.series.stacking = options.plotOptions.series.stacking || 'normal'; if (!this._highcharts[options.selector]) { // Store new chart in charts array this._highcharts[options.selector] = new Highchart(this, options); } return this._highcharts[options.selector]; }, /** * Chart via defined params and an options object. * @func stackedBarChart * @memberof Highchart * @param {String|jQuery} selector The element to render the chart to. * @param {String} seriesField The name of the series to plot. * @param {String} keyField The field to use as the data key. * @param {String} valField The field to use as the data value. * @param {Object} options The options object. */ '*, string, string, string, ...': function (selector, seriesField, keyField, valField, options) { options = options || {}; options.seriesField = seriesField; options.selector = selector; options.keyField = keyField; options.valField = valField; // Call the main chart method this.stackedBarChart(options); } }); /** * Removes a chart from the page by it's selector. * @memberof Collection * @param {String} selector The chart selector. */ Collection.prototype.dropChart = function (selector) { if (this._highcharts && this._highcharts[selector]) { this._highcharts[selector].drop(); } }; Shared.finishModule('Highchart'); module.exports = Highchart; },{"./Overload":28,"./Shared":35}],12:[function(_dereq_,module,exports){ "use strict"; /* name id rebuild state match lookup */ var Shared = _dereq_('./Shared'), Path = _dereq_('./Path'), BinaryTree = _dereq_('./BinaryTree'), treeInstance = new BinaryTree(), btree = function () {}; treeInstance.inOrder('hash'); /** * The index class used to instantiate hash map indexes that the database can * use to speed up queries on collections and views. * @constructor */ var IndexBinaryTree = function () { this.init.apply(this, arguments); }; IndexBinaryTree.prototype.init = function (keys, options, collection) { this._btree = new (btree.create(2, this.sortAsc))(); this._size = 0; this._id = this._itemKeyHash(keys, keys); this.unique(options && options.unique ? options.unique : false); if (keys !== undefined) { this.keys(keys); } if (collection !== undefined) { this.collection(collection); } this.name(options && options.name ? options.name : this._id); }; Shared.addModule('IndexBinaryTree', IndexBinaryTree); Shared.mixin(IndexBinaryTree.prototype, 'Mixin.ChainReactor'); Shared.mixin(IndexBinaryTree.prototype, 'Mixin.Sorting'); IndexBinaryTree.prototype.id = function () { return this._id; }; IndexBinaryTree.prototype.state = function () { return this._state; }; IndexBinaryTree.prototype.size = function () { return this._size; }; Shared.synthesize(IndexBinaryTree.prototype, 'data'); Shared.synthesize(IndexBinaryTree.prototype, 'name'); Shared.synthesize(IndexBinaryTree.prototype, 'collection'); Shared.synthesize(IndexBinaryTree.prototype, 'type'); Shared.synthesize(IndexBinaryTree.prototype, 'unique'); IndexBinaryTree.prototype.keys = function (val) { if (val !== undefined) { this._keys = val; // Count the keys this._keyCount = (new Path()).parse(this._keys).length; return this; } return this._keys; }; IndexBinaryTree.prototype.rebuild = function () { // Do we have a collection? if (this._collection) { // Get sorted data var collection = this._collection.subset({}, { $decouple: false, $orderBy: this._keys }), collectionData = collection.find(), dataIndex, dataCount = collectionData.length; // Clear the index data for the index this._btree = new (btree.create(2, this.sortAsc))(); if (this._unique) { this._uniqueLookup = {}; } // Loop the collection data for (dataIndex = 0; dataIndex < dataCount; dataIndex++) { this.insert(collectionData[dataIndex]); } } this._state = { name: this._name, keys: this._keys, indexSize: this._size, built: new Date(), updated: new Date(), ok: true }; }; IndexBinaryTree.prototype.insert = function (dataItem, options) { var uniqueFlag = this._unique, uniqueHash, dataItemHash = this._itemKeyHash(dataItem, this._keys), keyArr; if (uniqueFlag) { uniqueHash = this._itemHash(dataItem, this._keys); this._uniqueLookup[uniqueHash] = dataItem; } // We store multiple items that match a key inside an array // that is then stored against that key in the tree... // Check if item exists for this key already keyArr = this._btree.get(dataItemHash); // Check if the array exists if (keyArr === undefined) { // Generate an array for this key first keyArr = []; // Put the new array into the tree under the key this._btree.put(dataItemHash, keyArr); } // Push the item into the array keyArr.push(dataItem); this._size++; }; IndexBinaryTree.prototype.remove = function (dataItem, options) { var uniqueFlag = this._unique, uniqueHash, dataItemHash = this._itemKeyHash(dataItem, this._keys), keyArr, itemIndex; if (uniqueFlag) { uniqueHash = this._itemHash(dataItem, this._keys); delete this._uniqueLookup[uniqueHash]; } // Try and get the array for the item hash key keyArr = this._btree.get(dataItemHash); if (keyArr !== undefined) { // The key array exits, remove the item from the key array itemIndex = keyArr.indexOf(dataItem); if (itemIndex > -1) { // Check the length of the array if (keyArr.length === 1) { // This item is the last in the array, just kill the tree entry this._btree.del(dataItemHash); } else { // Remove the item keyArr.splice(itemIndex, 1); } this._size--; } } }; IndexBinaryTree.prototype.violation = function (dataItem) { // Generate item hash var uniqueHash = this._itemHash(dataItem, this._keys); // Check if the item breaks the unique constraint return Boolean(this._uniqueLookup[uniqueHash]); }; IndexBinaryTree.prototype.hashViolation = function (uniqueHash) { // Check if the item breaks the unique constraint return Boolean(this._uniqueLookup[uniqueHash]); }; IndexBinaryTree.prototype.lookup = function (query) { return this._data[this._itemHash(query, this._keys)] || []; }; IndexBinaryTree.prototype.match = function (query, options) { // Check if the passed query has data in the keys our index // operates on and if so, is the query sort matching our order var pathSolver = new Path(); var indexKeyArr = pathSolver.parseArr(this._keys), queryArr = pathSolver.parseArr(query), matchedKeys = [], matchedKeyCount = 0, i; // Loop the query array and check the order of keys against the // index key array to see if this index can be used for (i = 0; i < indexKeyArr.length; i++) { if (queryArr[i] === indexKeyArr[i]) { matchedKeyCount++; matchedKeys.push(queryArr[i]); } else { // Query match failed - this is a hash map index so partial key match won't work return { matchedKeys: [], totalKeyCount: queryArr.length, score: 0 }; } } return { matchedKeys: matchedKeys, totalKeyCount: queryArr.length, score: matchedKeyCount }; //return pathSolver.countObjectPaths(this._keys, query); }; IndexBinaryTree.prototype._itemHash = function (item, keys) { var path = new Path(), pathData, hash = '', k; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { if (hash) { hash += '_'; } hash += path.value(item, pathData[k].path).join(':'); } return hash; }; IndexBinaryTree.prototype._itemKeyHash = function (item, keys) { var path = new Path(), pathData, hash = '', k; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { if (hash) { hash += '_'; } hash += path.keyValue(item, pathData[k].path); } return hash; }; IndexBinaryTree.prototype._itemHashArr = function (item, keys) { var path = new Path(), pathData, //hash = '', hashArr = [], valArr, i, k, j; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { valArr = path.value(item, pathData[k].path); for (i = 0; i < valArr.length; i++) { if (k === 0) { // Setup the initial hash array hashArr.push(valArr[i]); } else { // Loop the hash array and concat the value to it for (j = 0; j < hashArr.length; j++) { hashArr[j] = hashArr[j] + '_' + valArr[i]; } } } } return hashArr; }; Shared.finishModule('IndexBinaryTree'); module.exports = IndexBinaryTree; },{"./BinaryTree":3,"./Path":30,"./Shared":35}],13:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'), Path = _dereq_('./Path'); /** * The index class used to instantiate hash map indexes that the database can * use to speed up queries on collections and views. * @constructor */ var IndexHashMap = function () { this.init.apply(this, arguments); }; IndexHashMap.prototype.init = function (keys, options, collection) { this._crossRef = {}; this._size = 0; this._id = this._itemKeyHash(keys, keys); this.data({}); this.unique(options && options.unique ? options.unique : false); if (keys !== undefined) { this.keys(keys); } if (collection !== undefined) { this.collection(collection); } this.name(options && options.name ? options.name : this._id); }; Shared.addModule('IndexHashMap', IndexHashMap); Shared.mixin(IndexHashMap.prototype, 'Mixin.ChainReactor'); IndexHashMap.prototype.id = function () { return this._id; }; IndexHashMap.prototype.state = function () { return this._state; }; IndexHashMap.prototype.size = function () { return this._size; }; Shared.synthesize(IndexHashMap.prototype, 'data'); Shared.synthesize(IndexHashMap.prototype, 'name'); Shared.synthesize(IndexHashMap.prototype, 'collection'); Shared.synthesize(IndexHashMap.prototype, 'type'); Shared.synthesize(IndexHashMap.prototype, 'unique'); IndexHashMap.prototype.keys = function (val) { if (val !== undefined) { this._keys = val; // Count the keys this._keyCount = (new Path()).parse(this._keys).length; return this; } return this._keys; }; IndexHashMap.prototype.rebuild = function () { // Do we have a collection? if (this._collection) { // Get sorted data var collection = this._collection.subset({}, { $decouple: false, $orderBy: this._keys }), collectionData = collection.find(), dataIndex, dataCount = collectionData.length; // Clear the index data for the index this._data = {}; if (this._unique) { this._uniqueLookup = {}; } // Loop the collection data for (dataIndex = 0; dataIndex < dataCount; dataIndex++) { this.insert(collectionData[dataIndex]); } } this._state = { name: this._name, keys: this._keys, indexSize: this._size, built: new Date(), updated: new Date(), ok: true }; }; IndexHashMap.prototype.insert = function (dataItem, options) { var uniqueFlag = this._unique, uniqueHash, itemHashArr, hashIndex; if (uniqueFlag) { uniqueHash = this._itemHash(dataItem, this._keys); this._uniqueLookup[uniqueHash] = dataItem; } // Generate item hash itemHashArr = this._itemHashArr(dataItem, this._keys); // Get the path search results and store them for (hashIndex = 0; hashIndex < itemHashArr.length; hashIndex++) { this.pushToPathValue(itemHashArr[hashIndex], dataItem); } }; IndexHashMap.prototype.update = function (dataItem, options) { // TODO: Write updates to work // 1: Get uniqueHash for the dataItem primary key value (may need to generate a store for this) // 2: Remove the uniqueHash as it currently stands // 3: Generate a new uniqueHash for dataItem // 4: Insert the new uniqueHash }; IndexHashMap.prototype.remove = function (dataItem, options) { var uniqueFlag = this._unique, uniqueHash, itemHashArr, hashIndex; if (uniqueFlag) { uniqueHash = this._itemHash(dataItem, this._keys); delete this._uniqueLookup[uniqueHash]; } // Generate item hash itemHashArr = this._itemHashArr(dataItem, this._keys); // Get the path search results and store them for (hashIndex = 0; hashIndex < itemHashArr.length; hashIndex++) { this.pullFromPathValue(itemHashArr[hashIndex], dataItem); } }; IndexHashMap.prototype.violation = function (dataItem) { // Generate item hash var uniqueHash = this._itemHash(dataItem, this._keys); // Check if the item breaks the unique constraint return Boolean(this._uniqueLookup[uniqueHash]); }; IndexHashMap.prototype.hashViolation = function (uniqueHash) { // Check if the item breaks the unique constraint return Boolean(this._uniqueLookup[uniqueHash]); }; IndexHashMap.prototype.pushToPathValue = function (hash, obj) { var pathValArr = this._data[hash] = this._data[hash] || []; // Make sure we have not already indexed this object at this path/value if (pathValArr.indexOf(obj) === -1) { // Index the object pathValArr.push(obj); // Record the reference to this object in our index size this._size++; // Cross-reference this association for later lookup this.pushToCrossRef(obj, pathValArr); } }; IndexHashMap.prototype.pullFromPathValue = function (hash, obj) { var pathValArr = this._data[hash], indexOfObject; // Make sure we have already indexed this object at this path/value indexOfObject = pathValArr.indexOf(obj); if (indexOfObject > -1) { // Un-index the object pathValArr.splice(indexOfObject, 1); // Record the reference to this object in our index size this._size--; // Remove object cross-reference this.pullFromCrossRef(obj, pathValArr); } // Check if we should remove the path value array if (!pathValArr.length) { // Remove the array delete this._data[hash]; } }; IndexHashMap.prototype.pull = function (obj) { // Get all places the object has been used and remove them var id = obj[this._collection.primaryKey()], crossRefArr = this._crossRef[id], arrIndex, arrCount = crossRefArr.length, arrItem; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { arrItem = crossRefArr[arrIndex]; // Remove item from this index lookup array this._pullFromArray(arrItem, obj); } // Record the reference to this object in our index size this._size--; // Now remove the cross-reference entry for this object delete this._crossRef[id]; }; IndexHashMap.prototype._pullFromArray = function (arr, obj) { var arrCount = arr.length; while (arrCount--) { if (arr[arrCount] === obj) { arr.splice(arrCount, 1); } } }; IndexHashMap.prototype.pushToCrossRef = function (obj, pathValArr) { var id = obj[this._collection.primaryKey()], crObj; this._crossRef[id] = this._crossRef[id] || []; // Check if the cross-reference to the pathVal array already exists crObj = this._crossRef[id]; if (crObj.indexOf(pathValArr) === -1) { // Add the cross-reference crObj.push(pathValArr); } }; IndexHashMap.prototype.pullFromCrossRef = function (obj, pathValArr) { var id = obj[this._collection.primaryKey()]; delete this._crossRef[id]; }; IndexHashMap.prototype.lookup = function (query) { return this._data[this._itemHash(query, this._keys)] || []; }; IndexHashMap.prototype.match = function (query, options) { // Check if the passed query has data in the keys our index // operates on and if so, is the query sort matching our order var pathSolver = new Path(); var indexKeyArr = pathSolver.parseArr(this._keys), queryArr = pathSolver.parseArr(query), matchedKeys = [], matchedKeyCount = 0, i; // Loop the query array and check the order of keys against the // index key array to see if this index can be used for (i = 0; i < indexKeyArr.length; i++) { if (queryArr[i] === indexKeyArr[i]) { matchedKeyCount++; matchedKeys.push(queryArr[i]); } else { // Query match failed - this is a hash map index so partial key match won't work return { matchedKeys: [], totalKeyCount: queryArr.length, score: 0 }; } } return { matchedKeys: matchedKeys, totalKeyCount: queryArr.length, score: matchedKeyCount }; //return pathSolver.countObjectPaths(this._keys, query); }; IndexHashMap.prototype._itemHash = function (item, keys) { var path = new Path(), pathData, hash = '', k; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { if (hash) { hash += '_'; } hash += path.value(item, pathData[k].path).join(':'); } return hash; }; IndexHashMap.prototype._itemKeyHash = function (item, keys) { var path = new Path(), pathData, hash = '', k; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { if (hash) { hash += '_'; } hash += path.keyValue(item, pathData[k].path); } return hash; }; IndexHashMap.prototype._itemHashArr = function (item, keys) { var path = new Path(), pathData, //hash = '', hashArr = [], valArr, i, k, j; pathData = path.parse(keys); for (k = 0; k < pathData.length; k++) { valArr = path.value(item, pathData[k].path); for (i = 0; i < valArr.length; i++) { if (k === 0) { // Setup the initial hash array hashArr.push(valArr[i]); } else { // Loop the hash array and concat the value to it for (j = 0; j < hashArr.length; j++) { hashArr[j] = hashArr[j] + '_' + valArr[i]; } } } } return hashArr; }; Shared.finishModule('IndexHashMap'); module.exports = IndexHashMap; },{"./Path":30,"./Shared":35}],14:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'); /** * The key value store class used when storing basic in-memory KV data, * and can be queried for quick retrieval. Mostly used for collection * primary key indexes and lookups. * @param {String=} name Optional KV store name. * @constructor */ var KeyValueStore = function (name) { this.init.apply(this, arguments); }; KeyValueStore.prototype.init = function (name) { this._name = name; this._data = {}; this._primaryKey = '_id'; }; Shared.addModule('KeyValueStore', KeyValueStore); Shared.mixin(KeyValueStore.prototype, 'Mixin.ChainReactor'); /** * Get / set the name of the key/value store. * @param {String} val The name to set. * @returns {*} */ Shared.synthesize(KeyValueStore.prototype, 'name'); /** * Get / set the primary key. * @param {String} key The key to set. * @returns {*} */ KeyValueStore.prototype.primaryKey = function (key) { if (key !== undefined) { this._primaryKey = key; return this; } return this._primaryKey; }; /** * Removes all data from the store. * @returns {*} */ KeyValueStore.prototype.truncate = function () { this._data = {}; return this; }; /** * Sets data against a key in the store. * @param {String} key The key to set data for. * @param {*} value The value to assign to the key. * @returns {*} */ KeyValueStore.prototype.set = function (key, value) { this._data[key] = value ? value : true; return this; }; /** * Gets data stored for the passed key. * @param {String} key The key to get data for. * @returns {*} */ KeyValueStore.prototype.get = function (key) { return this._data[key]; }; /** * Get / set the primary key. * @param {*} obj A lookup query, can be a string key, an array of string keys, * an object with further query clauses or a regular expression that should be * run against all keys. * @returns {*} */ KeyValueStore.prototype.lookup = function (obj) { var pKeyVal = obj[this._primaryKey], arrIndex, arrCount, lookupItem, result; if (pKeyVal instanceof Array) { // An array of primary keys, find all matches arrCount = pKeyVal.length; result = []; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { lookupItem = this._data[pKeyVal[arrIndex]]; if (lookupItem) { result.push(lookupItem); } } return result; } else if (pKeyVal instanceof RegExp) { // Create new data result = []; for (arrIndex in this._data) { if (this._data.hasOwnProperty(arrIndex)) { if (pKeyVal.test(arrIndex)) { result.push(this._data[arrIndex]); } } } return result; } else if (typeof pKeyVal === 'object') { // The primary key clause is an object, now we have to do some // more extensive searching if (pKeyVal.$ne) { // Create new data result = []; for (arrIndex in this._data) { if (this._data.hasOwnProperty(arrIndex)) { if (arrIndex !== pKeyVal.$ne) { result.push(this._data[arrIndex]); } } } return result; } if (pKeyVal.$in && (pKeyVal.$in instanceof Array)) { // Create new data result = []; for (arrIndex in this._data) { if (this._data.hasOwnProperty(arrIndex)) { if (pKeyVal.$in.indexOf(arrIndex) > -1) { result.push(this._data[arrIndex]); } } } return result; } if (pKeyVal.$nin && (pKeyVal.$nin instanceof Array)) { // Create new data result = []; for (arrIndex in this._data) { if (this._data.hasOwnProperty(arrIndex)) { if (pKeyVal.$nin.indexOf(arrIndex) === -1) { result.push(this._data[arrIndex]); } } } return result; } if (pKeyVal.$or && (pKeyVal.$or instanceof Array)) { // Create new data result = []; for (arrIndex = 0; arrIndex < pKeyVal.$or.length; arrIndex++) { result = result.concat(this.lookup(pKeyVal.$or[arrIndex])); } return result; } } else { // Key is a basic lookup from string lookupItem = this._data[pKeyVal]; if (lookupItem !== undefined) { return [lookupItem]; } else { return []; } } }; /** * Removes data for the given key from the store. * @param {String} key The key to un-set. * @returns {*} */ KeyValueStore.prototype.unSet = function (key) { delete this._data[key]; return this; }; /** * Sets data for the give key in the store only where the given key * does not already have a value in the store. * @param {String} key The key to set data for. * @param {*} value The value to assign to the key. * @returns {Boolean} True if data was set or false if data already * exists for the key. */ KeyValueStore.prototype.uniqueSet = function (key, value) { if (this._data[key] === undefined) { this._data[key] = value; return true; } return false; }; Shared.finishModule('KeyValueStore'); module.exports = KeyValueStore; },{"./Shared":35}],15:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'), Operation = _dereq_('./Operation'); /** * The metrics class used to store details about operations. * @constructor */ var Metrics = function () { this.init.apply(this, arguments); }; Metrics.prototype.init = function () { this._data = []; }; Shared.addModule('Metrics', Metrics); Shared.mixin(Metrics.prototype, 'Mixin.ChainReactor'); /** * Creates an operation within the metrics instance and if metrics * are currently enabled (by calling the start() method) the operation * is also stored in the metrics log. * @param {String} name The name of the operation. * @returns {Operation} */ Metrics.prototype.create = function (name) { var op = new Operation(name); if (this._enabled) { this._data.push(op); } return op; }; /** * Starts logging operations. * @returns {Metrics} */ Metrics.prototype.start = function () { this._enabled = true; return this; }; /** * Stops logging operations. * @returns {Metrics} */ Metrics.prototype.stop = function () { this._enabled = false; return this; }; /** * Clears all logged operations. * @returns {Metrics} */ Metrics.prototype.clear = function () { this._data = []; return this; }; /** * Returns an array of all logged operations. * @returns {Array} */ Metrics.prototype.list = function () { return this._data; }; Shared.finishModule('Metrics'); module.exports = Metrics; },{"./Operation":27,"./Shared":35}],16:[function(_dereq_,module,exports){ "use strict"; var CRUD = { preSetData: function () { }, postSetData: function () { } }; module.exports = CRUD; },{}],17:[function(_dereq_,module,exports){ "use strict"; /** * The chain reactor mixin, provides methods to the target object that allow chain * reaction events to propagate to the target and be handled, processed and passed * on down the chain. * @mixin */ var ChainReactor = { /** * * @param obj */ chain: function (obj) { if (this.debug && this.debug()) { if (obj._reactorIn && obj._reactorOut) { console.log(obj._reactorIn.logIdentifier() + ' Adding target "' + obj._reactorOut.instanceIdentifier() + '" to the chain reactor target list'); } else { console.log(this.logIdentifier() + ' Adding target "' + obj.instanceIdentifier() + '" to the chain reactor target list'); } } this._chain = this._chain || []; var index = this._chain.indexOf(obj); if (index === -1) { this._chain.push(obj); } }, unChain: function (obj) { if (this.debug && this.debug()) { if (obj._reactorIn && obj._reactorOut) { console.log(obj._reactorIn.logIdentifier() + ' Removing target "' + obj._reactorOut.instanceIdentifier() + '" from the chain reactor target list'); } else { console.log(this.logIdentifier() + ' Removing target "' + obj.instanceIdentifier() + '" from the chain reactor target list'); } } if (this._chain) { var index = this._chain.indexOf(obj); if (index > -1) { this._chain.splice(index, 1); } } }, chainSend: function (type, data, options) { if (this._chain) { var arr = this._chain, arrItem, count = arr.length, index; for (index = 0; index < count; index++) { arrItem = arr[index]; if (!arrItem._state || (arrItem._state && !arrItem.isDropped())) { if (this.debug && this.debug()) { if (arrItem._reactorIn && arrItem._reactorOut) { console.log(arrItem._reactorIn.logIdentifier() + ' Sending data down the chain reactor pipe to "' + arrItem._reactorOut.instanceIdentifier() + '"'); } else { console.log(this.logIdentifier() + ' Sending data down the chain reactor pipe to "' + arrItem.instanceIdentifier() + '"'); } } arrItem.chainReceive(this, type, data, options); } else { console.log('Reactor Data:', type, data, options); console.log('Reactor Node:', arrItem); throw('Chain reactor attempting to send data to target reactor node that is in a dropped state!'); } } } }, chainReceive: function (sender, type, data, options) { var chainPacket = { sender: sender, type: type, data: data, options: options }; if (this.debug && this.debug()) { console.log(this.logIdentifier() + 'Received data from parent reactor node'); } // Fire our internal handler if (!this._chainHandler || (this._chainHandler && !this._chainHandler(chainPacket))) { // Propagate the message down the chain this.chainSend(chainPacket.type, chainPacket.data, chainPacket.options); } } }; module.exports = ChainReactor; },{}],18:[function(_dereq_,module,exports){ "use strict"; var idCounter = 0, Overload = _dereq_('./Overload'), Common; Common = { /** * Gets / sets data in the item store. The store can be used to set and * retrieve data against a key. Useful for adding arbitrary key/value data * to a collection / view etc and retrieving it later. * @param {String|*} key The key under which to store the passed value or * retrieve the existing stored value. * @param {*=} val Optional value. If passed will overwrite the existing value * stored against the specified key if one currently exists. * @returns {*} */ store: function (key, val) { if (key !== undefined) { if (val !== undefined) { // Store the data this._store = this._store || {}; this._store[key] = val; return this; } if (this._store) { return this._store[key]; } } return undefined; }, /** * Removes a previously stored key/value pair from the item store, set previously * by using the store() method. * @param {String|*} key The key of the key/value pair to remove; * @returns {Common} Returns this for chaining. */ unStore: function (key) { if (key !== undefined) { delete this._store[key]; } return this; }, /** * Returns a non-referenced version of the passed object / array. * @param {Object} data The object or array to return as a non-referenced version. * @param {Number=} copies Optional number of copies to produce. If specified, the return * value will be an array of decoupled objects, each distinct from the other. * @returns {*} */ decouple: function (data, copies) { if (data !== undefined) { if (!copies) { return JSON.parse(JSON.stringify(data)); } else { var i, json = JSON.stringify(data), copyArr = []; for (i = 0; i < copies; i++) { copyArr.push(JSON.parse(json)); } return copyArr; } } return undefined; }, /** * Generates a new 16-character hexadecimal unique ID or * generates a new 16-character hexadecimal ID based on * the passed string. Will always generate the same ID * for the same string. * @param {String=} str A string to generate the ID from. * @return {String} */ objectId: function (str) { var id, pow = Math.pow(10, 17); if (!str) { idCounter++; id = (idCounter + ( Math.random() * pow + Math.random() * pow + Math.random() * pow + Math.random() * pow )).toString(16); } else { var val = 0, count = str.length, i; for (i = 0; i < count; i++) { val += str.charCodeAt(i) * pow; } id = val.toString(16); } return id; }, /** * Gets / sets debug flag that can enable debug message output to the * console if required. * @param {Boolean} val The value to set debug flag to. * @return {Boolean} True if enabled, false otherwise. */ /** * Sets debug flag for a particular type that can enable debug message * output to the console if required. * @param {String} type The name of the debug type to set flag for. * @param {Boolean} val The value to set debug flag to. * @return {Boolean} True if enabled, false otherwise. */ debug: new Overload([ function () { return this._debug && this._debug.all; }, function (val) { if (val !== undefined) { if (typeof val === 'boolean') { this._debug = this._debug || {}; this._debug.all = val; this.chainSend('debug', this._debug); return this; } else { return (this._debug && this._debug[val]) || (this._db && this._db._debug && this._db._debug[val]) || (this._debug && this._debug.all); } } return this._debug && this._debug.all; }, function (type, val) { if (type !== undefined) { if (val !== undefined) { this._debug = this._debug || {}; this._debug[type] = val; this.chainSend('debug', this._debug); return this; } return (this._debug && this._debug[val]) || (this._db && this._db._debug && this._db._debug[type]); } return this._debug && this._debug.all; } ]), /** * Returns a string describing the class this instance is derived from. * @returns {string} */ classIdentifier: function () { return 'ForerunnerDB.' + this.className; }, /** * Returns a string describing the instance by it's class name and instance * object name. * @returns {String} The instance identifier. */ instanceIdentifier: function () { return '[' + this.className + ']' + this.name(); }, /** * Returns a string used to denote a console log against this instance, * consisting of the class identifier and instance identifier. * @returns {string} The log identifier. */ logIdentifier: function () { return this.classIdentifier() + ': ' + this.instanceIdentifier(); }, /** * Converts a query object with MongoDB dot notation syntax * to Forerunner's object notation syntax. * @param {Object} obj The object to convert. */ convertToFdb: function (obj) { var varName, splitArr, objCopy, i; for (i in obj) { if (obj.hasOwnProperty(i)) { objCopy = obj; if (i.indexOf('.') > -1) { // Replace .$ with a placeholder before splitting by . char i = i.replace('.$', '[|$|]'); splitArr = i.split('.'); while ((varName = splitArr.shift())) { // Replace placeholder back to original .$ varName = varName.replace('[|$|]', '.$'); if (splitArr.length) { objCopy[varName] = {}; } else { objCopy[varName] = obj[i]; } objCopy = objCopy[varName]; } delete obj[i]; } } } }, /** * Checks if the state is dropped. * @returns {boolean} True when dropped, false otherwise. */ isDropped: function () { return this._state === 'dropped'; } }; module.exports = Common; },{"./Overload":28}],19:[function(_dereq_,module,exports){ "use strict"; var Constants = { TYPE_INSERT: 0, TYPE_UPDATE: 1, TYPE_REMOVE: 2, PHASE_BEFORE: 0, PHASE_AFTER: 1 }; module.exports = Constants; },{}],20:[function(_dereq_,module,exports){ "use strict"; var Overload = _dereq_('./Overload'); var Events = { on: new Overload({ /** * Attach an event listener to the passed event. * @param {String} event The name of the event to listen for. * @param {Function} listener The method to call when the event is fired. */ 'string, function': function (event, listener) { this._listeners = this._listeners || {}; this._listeners[event] = this._listeners[event] || {}; this._listeners[event]['*'] = this._listeners[event]['*'] || []; this._listeners[event]['*'].push(listener); return this; }, /** * Attach an event listener to the passed event only if the passed * id matches the document id for the event being fired. * @param {String} event The name of the event to listen for. * @param {*} id The document id to match against. * @param {Function} listener The method to call when the event is fired. */ 'string, *, function': function (event, id, listener) { this._listeners = this._listeners || {}; this._listeners[event] = this._listeners[event] || {}; this._listeners[event][id] = this._listeners[event][id] || []; this._listeners[event][id].push(listener); return this; } }), once: new Overload({ 'string, function': function (eventName, callback) { var self = this, internalCallback = function () { self.off(eventName, internalCallback); callback.apply(self, arguments); }; return this.on(eventName, internalCallback); }, 'string, *, function': function (eventName, id, callback) { var self = this, internalCallback = function () { self.off(eventName, id, internalCallback); callback.apply(self, arguments); }; return this.on(eventName, id, internalCallback); } }), off: new Overload({ 'string': function (event) { if (this._listeners && this._listeners[event] && event in this._listeners) { delete this._listeners[event]; } return this; }, 'string, function': function (event, listener) { var arr, index; if (typeof(listener) === 'string') { if (this._listeners && this._listeners[event] && this._listeners[event][listener]) { delete this._listeners[event][listener]; } } else { if (this._listeners && event in this._listeners) { arr = this._listeners[event]['*']; index = arr.indexOf(listener); if (index > -1) { arr.splice(index, 1); } } } return this; }, 'string, *, function': function (event, id, listener) { if (this._listeners && event in this._listeners && id in this.listeners[event]) { var arr = this._listeners[event][id], index = arr.indexOf(listener); if (index > -1) { arr.splice(index, 1); } } }, 'string, *': function (event, id) { if (this._listeners && event in this._listeners && id in this._listeners[event]) { // Kill all listeners for this event id delete this._listeners[event][id]; } } }), emit: function (event, data) { this._listeners = this._listeners || {}; if (event in this._listeners) { var arrIndex, arrCount, tmpFunc, arr, listenerIdArr, listenerIdCount, listenerIdIndex; // Handle global emit if (this._listeners[event]['*']) { arr = this._listeners[event]['*']; arrCount = arr.length; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { // Check we have a function to execute tmpFunc = arr[arrIndex]; if (typeof tmpFunc === 'function') { tmpFunc.apply(this, Array.prototype.slice.call(arguments, 1)); } } } // Handle individual emit if (data instanceof Array) { // Check if the array is an array of objects in the collection if (data[0] && data[0][this._primaryKey]) { // Loop the array and check for listeners against the primary key listenerIdArr = this._listeners[event]; arrCount = data.length; for (arrIndex = 0; arrIndex < arrCount; arrIndex++) { if (listenerIdArr[data[arrIndex][this._primaryKey]]) { // Emit for this id listenerIdCount = listenerIdArr[data[arrIndex][this._primaryKey]].length; for (listenerIdIndex = 0; listenerIdIndex < listenerIdCount; listenerIdIndex++) { tmpFunc = listenerIdArr[data[arrIndex][this._primaryKey]][listenerIdIndex]; if (typeof tmpFunc === 'function') { listenerIdArr[data[arrIndex][this._primaryKey]][listenerIdIndex].apply(this, Array.prototype.slice.call(arguments, 1)); } } } } } } } return this; } }; module.exports = Events; },{"./Overload":28}],21:[function(_dereq_,module,exports){ "use strict"; var Matching = { /** * Internal method that checks a document against a test object. * @param {*} source The source object or value to test against. * @param {*} test The test object or value to test with. * @param {Object} queryOptions The options the query was passed with. * @param {String=} opToApply The special operation to apply to the test such * as 'and' or an 'or' operator. * @param {Object=} options An object containing options to apply to the * operation such as limiting the fields returned etc. * @returns {Boolean} True if the test was positive, false on negative. * @private */ _match: function (source, test, queryOptions, opToApply, options) { // TODO: This method is quite long, break into smaller pieces var operation, applyOp, recurseVal, tmpIndex, sourceType = typeof source, testType = typeof test, matchedAll = true, opResult, substringCache, i; options = options || {}; queryOptions = queryOptions || {}; // Check if options currently holds a root query object if (!options.$rootQuery) { // Root query not assigned, hold the root query options.$rootQuery = test; } options.$rootData = options.$rootData || {}; // Check if the comparison data are both strings or numbers if ((sourceType === 'string' || sourceType === 'number') && (testType === 'string' || testType === 'number')) { // The source and test data are flat types that do not require recursive searches, // so just compare them and return the result if (sourceType === 'number') { // Number comparison if (source !== test) { matchedAll = false; } } else { // String comparison // TODO: We can probably use a queryOptions.$locale as a second parameter here // TODO: to satisfy https://github.com/Irrelon/ForerunnerDB/issues/35 if (source.localeCompare(test)) { matchedAll = false; } } } else { for (i in test) { if (test.hasOwnProperty(i)) { // Reset operation flag operation = false; substringCache = i.substr(0, 2); // Check if the property is a comment (ignorable) if (substringCache === '//') { // Skip this property continue; } // Check if the property starts with a dollar (function) if (substringCache.indexOf('$') === 0) { // Ask the _matchOp method to handle the operation opResult = this._matchOp(i, source, test[i], queryOptions, options); // Check the result of the matchOp operation // If the result is -1 then no operation took place, otherwise the result // will be a boolean denoting a match (true) or no match (false) if (opResult > -1) { if (opResult) { if (opToApply === 'or') { return true; } } else { // Set the matchedAll flag to the result of the operation // because the operation did not return true matchedAll = opResult; } // Record that an operation was handled operation = true; } } // Check for regex if (!operation && test[i] instanceof RegExp) { operation = true; if (sourceType === 'object' && source[i] !== undefined && test[i].test(source[i])) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } if (!operation) { // Check if our query is an object if (typeof(test[i]) === 'object') { // Because test[i] is an object, source must also be an object // Check if our source data we are checking the test query against // is an object or an array if (source[i] !== undefined) { if (source[i] instanceof Array && !(test[i] instanceof Array)) { // The source data is an array, so check each item until a // match is found recurseVal = false; for (tmpIndex = 0; tmpIndex < source[i].length; tmpIndex++) { recurseVal = this._match(source[i][tmpIndex], test[i], queryOptions, applyOp, options); if (recurseVal) { // One of the array items matched the query so we can // include this item in the results, so break now break; } } if (recurseVal) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } else if (!(source[i] instanceof Array) && test[i] instanceof Array) { // The test key data is an array and the source key data is not so check // each item in the test key data to see if the source item matches one // of them. This is effectively an $in search. recurseVal = false; for (tmpIndex = 0; tmpIndex < test[i].length; tmpIndex++) { recurseVal = this._match(source[i], test[i][tmpIndex], queryOptions, applyOp, options); if (recurseVal) { // One of the array items matched the query so we can // include this item in the results, so break now break; } } if (recurseVal) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } else if (typeof(source) === 'object') { // Recurse down the object tree recurseVal = this._match(source[i], test[i], queryOptions, applyOp, options); if (recurseVal) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } else { recurseVal = this._match(undefined, test[i], queryOptions, applyOp, options); if (recurseVal) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } } else { // First check if the test match is an $exists if (test[i] && test[i].$exists !== undefined) { // Push the item through another match recurse recurseVal = this._match(undefined, test[i], queryOptions, applyOp, options); if (recurseVal) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } else { matchedAll = false; } } } else { // Check if the prop matches our test value if (source && source[i] === test[i]) { if (opToApply === 'or') { return true; } } else if (source && source[i] && source[i] instanceof Array && test[i] && typeof(test[i]) !== "object") { // We are looking for a value inside an array // The source data is an array, so check each item until a // match is found recurseVal = false; for (tmpIndex = 0; tmpIndex < source[i].length; tmpIndex++) { recurseVal = this._match(source[i][tmpIndex], test[i], queryOptions, applyOp, options); if (recurseVal) { // One of the array items matched the query so we can // include this item in the results, so break now break; } } if (recurseVal) { if (opToApply === 'or') { return true; } } else { matchedAll = false; } } else { matchedAll = false; } } } if (opToApply === 'and' && !matchedAll) { return false; } } } } return matchedAll; }, /** * Internal method, performs a matching process against a query operator such as $gt or $nin. * @param {String} key The property name in the test that matches the operator to perform * matching against. * @param {*} source The source data to match the query against. * @param {*} test The query to match the source against. * @param {Object=} options An options object. * @returns {*} * @private */ _matchOp: function (key, source, test, queryOptions, options) { // Check for commands switch (key) { case '$gt': // Greater than return source > test; case '$gte': // Greater than or equal return source >= test; case '$lt': // Less than return source < test; case '$lte': // Less than or equal return source <= test; case '$exists': // Property exists return (source === undefined) !== test; case '$ne': // Not equals return source != test; // jshint ignore:line case '$nee': // Not equals equals return source !== test; case '$or': // Match true on ANY check to pass for (var orIndex = 0; orIndex < test.length; orIndex++) { if (this._match(source, test[orIndex], queryOptions, 'and', options)) { return true; } } return false; case '$and': // Match true on ALL checks to pass for (var andIndex = 0; andIndex < test.length; andIndex++) { if (!this._match(source, test[andIndex], queryOptions, 'and', options)) { return false; } } return true; case '$in': // In // Check that the in test is an array if (test instanceof Array) { var inArr = test, inArrCount = inArr.length, inArrIndex; for (inArrIndex = 0; inArrIndex < inArrCount; inArrIndex++) { if (inArr[inArrIndex] instanceof RegExp && inArr[inArrIndex].test(source)) { return true; } else if (inArr[inArrIndex] === source) { return true; } } return false; } else { throw(this.logIdentifier() + ' Cannot use an $in operator on a non-array key: ' + key); } break; case '$nin': // Not in // Check that the not-in test is an array if (test instanceof Array) { var notInArr = test, notInArrCount = notInArr.length, notInArrIndex; for (notInArrIndex = 0; notInArrIndex < notInArrCount; notInArrIndex++) { if (notInArr[notInArrIndex] === source) { return false; } } return true; } else { throw(this.logIdentifier() + ' Cannot use a $nin operator on a non-array key: ' + key); } break; case '$distinct': // Ensure options holds a distinct lookup options.$rootData['//distinctLookup'] = options.$rootData['//distinctLookup'] || {}; for (var distinctProp in test) { if (test.hasOwnProperty(distinctProp)) { options.$rootData['//distinctLookup'][distinctProp] = options.$rootData['//distinctLookup'][distinctProp] || {}; // Check if the options distinct lookup has this field's value if (options.$rootData['//distinctLookup'][distinctProp][source[distinctProp]]) { // Value is already in use return false; } else { // Set the value in the lookup options.$rootData['//distinctLookup'][distinctProp][source[distinctProp]] = true; // Allow the item in the results return true; } } } break; } return -1; } }; module.exports = Matching; },{}],22:[function(_dereq_,module,exports){ "use strict"; var Sorting = { /** * Sorts the passed value a against the passed value b ascending. * @param {*} a The first value to compare. * @param {*} b The second value to compare. * @returns {*} 1 if a is sorted after b, -1 if a is sorted before b. */ sortAsc: function (a, b) { if (typeof(a) === 'string' && typeof(b) === 'string') { return a.localeCompare(b); } else { if (a > b) { return 1; } else if (a < b) { return -1; } } return 0; }, /** * Sorts the passed value a against the passed value b descending. * @param {*} a The first value to compare. * @param {*} b The second value to compare. * @returns {*} 1 if a is sorted after b, -1 if a is sorted before b. */ sortDesc: function (a, b) { if (typeof(a) === 'string' && typeof(b) === 'string') { return b.localeCompare(a); } else { if (a > b) { return -1; } else if (a < b) { return 1; } } return 0; } }; module.exports = Sorting; },{}],23:[function(_dereq_,module,exports){ "use strict"; var Overload = _dereq_('./Overload'); var Triggers = { /** * Add a trigger by id. * @param {String} id The id of the trigger. This must be unique to the type and * phase of the trigger. Only one trigger may be added with this id per type and * phase. * @param {Number} type The type of operation to apply the trigger to. See * Mixin.Constants for constants to use. * @param {Number} phase The phase of an operation to fire the trigger on. See * Mixin.Constants for constants to use. * @param {Function} method The method to call when the trigger is fired. * @returns {boolean} True if the trigger was added successfully, false if not. */ addTrigger: function (id, type, phase, method) { var self = this, triggerIndex; // Check if the trigger already exists triggerIndex = self._triggerIndexOf(id, type, phase); if (triggerIndex === -1) { // The trigger does not exist, create it self._trigger = self._trigger || {}; self._trigger[type] = self._trigger[type] || {}; self._trigger[type][phase] = self._trigger[type][phase] || []; self._trigger[type][phase].push({ id: id, method: method, enabled: true }); return true; } return false; }, /** * * @param {String} id The id of the trigger to remove. * @param {Number} type The type of operation to remove the trigger from. See * Mixin.Constants for constants to use. * @param {Number} phase The phase of the operation to remove the trigger from. * See Mixin.Constants for constants to use. * @returns {boolean} True if removed successfully, false if not. */ removeTrigger: function (id, type, phase) { var self = this, triggerIndex; // Check if the trigger already exists triggerIndex = self._triggerIndexOf(id, type, phase); if (triggerIndex > -1) { // The trigger exists, remove it self._trigger[type][phase].splice(triggerIndex, 1); } return false; }, enableTrigger: new Overload({ 'string': function (id) { // Alter all triggers of this type var self = this, types = self._trigger, phases, triggers, result = false, i, k, j; if (types) { for (j in types) { if (types.hasOwnProperty(j)) { phases = types[j]; if (phases) { for (i in phases) { if (phases.hasOwnProperty(i)) { triggers = phases[i]; // Loop triggers and set enabled flag for (k = 0; k < triggers.length; k++) { if (triggers[k].id === id) { triggers[k].enabled = true; result = true; } } } } } } } } return result; }, 'number': function (type) { // Alter all triggers of this type var self = this, phases = self._trigger[type], triggers, result = false, i, k; if (phases) { for (i in phases) { if (phases.hasOwnProperty(i)) { triggers = phases[i]; // Loop triggers and set to enabled for (k = 0; k < triggers.length; k++) { triggers[k].enabled = true; result = true; } } } } return result; }, 'number, number': function (type, phase) { // Alter all triggers of this type and phase var self = this, phases = self._trigger[type], triggers, result = false, k; if (phases) { triggers = phases[phase]; if (triggers) { // Loop triggers and set to enabled for (k = 0; k < triggers.length; k++) { triggers[k].enabled = true; result = true; } } } return result; }, 'string, number, number': function (id, type, phase) { // Check if the trigger already exists var self = this, triggerIndex = self._triggerIndexOf(id, type, phase); if (triggerIndex > -1) { // Update the trigger self._trigger[type][phase][triggerIndex].enabled = true; return true; } return false; } }), disableTrigger: new Overload({ 'string': function (id) { // Alter all triggers of this type var self = this, types = self._trigger, phases, triggers, result = false, i, k, j; if (types) { for (j in types) { if (types.hasOwnProperty(j)) { phases = types[j]; if (phases) { for (i in phases) { if (phases.hasOwnProperty(i)) { triggers = phases[i]; // Loop triggers and set enabled flag for (k = 0; k < triggers.length; k++) { if (triggers[k].id === id) { triggers[k].enabled = false; result = true; } } } } } } } } return result; }, 'number': function (type) { // Alter all triggers of this type var self = this, phases = self._trigger[type], triggers, result = false, i, k; if (phases) { for (i in phases) { if (phases.hasOwnProperty(i)) { triggers = phases[i]; // Loop triggers and set to disabled for (k = 0; k < triggers.length; k++) { triggers[k].enabled = false; result = true; } } } } return result; }, 'number, number': function (type, phase) { // Alter all triggers of this type and phase var self = this, phases = self._trigger[type], triggers, result = false, k; if (phases) { triggers = phases[phase]; if (triggers) { // Loop triggers and set to disabled for (k = 0; k < triggers.length; k++) { triggers[k].enabled = false; result = true; } } } return result; }, 'string, number, number': function (id, type, phase) { // Check if the trigger already exists var self = this, triggerIndex = self._triggerIndexOf(id, type, phase); if (triggerIndex > -1) { // Update the trigger self._trigger[type][phase][triggerIndex].enabled = false; return true; } return false; } }), /** * Checks if a trigger will fire based on the type and phase provided. * @param {Number} type The type of operation. See Mixin.Constants for * constants to use. * @param {Number} phase The phase of the operation. See Mixin.Constants * for constants to use. * @returns {Boolean} True if the trigger will fire, false otherwise. */ willTrigger: function (type, phase) { if (this._trigger && this._trigger[type] && this._trigger[type][phase] && this._trigger[type][phase].length) { // Check if a trigger in this array is enabled var arr = this._trigger[type][phase], i; for (i = 0; i < arr.length; i++) { if (arr[i].enabled) { return true; } } } return false; }, /** * Processes trigger actions based on the operation, type and phase. * @param {Object} operation Operation data to pass to the trigger. * @param {Number} type The type of operation. See Mixin.Constants for * constants to use. * @param {Number} phase The phase of the operation. See Mixin.Constants * for constants to use. * @param {Object} oldDoc The document snapshot before operations are * carried out against the data. * @param {Object} newDoc The document snapshot after operations are * carried out against the data. * @returns {boolean} */ processTrigger: function (operation, type, phase, oldDoc, newDoc) { var self = this, triggerArr, triggerIndex, triggerCount, triggerItem, response; if (self._trigger && self._trigger[type] && self._trigger[type][phase]) { triggerArr = self._trigger[type][phase]; triggerCount = triggerArr.length; for (triggerIndex = 0; triggerIndex < triggerCount; triggerIndex++) { triggerItem = triggerArr[triggerIndex]; // Check if the trigger is enabled if (triggerItem.enabled) { if (this.debug()) { var typeName, phaseName; switch (type) { case this.TYPE_INSERT: typeName = 'insert'; break; case this.TYPE_UPDATE: typeName = 'update'; break; case this.TYPE_REMOVE: typeName = 'remove'; break; default: typeName = ''; break; } switch (phase) { case this.PHASE_BEFORE: phaseName = 'before'; break; case this.PHASE_AFTER: phaseName = 'after'; break; default: phaseName = ''; break; } //console.log('Triggers: Processing trigger "' + id + '" for ' + typeName + ' in phase "' + phaseName + '"'); } // Run the trigger's method and store the response response = triggerItem.method.call(self, operation, oldDoc, newDoc); // Check the response for a non-expected result (anything other than // undefined, true or false is considered a throwable error) if (response === false) { // The trigger wants us to cancel operations return false; } if (response !== undefined && response !== true && response !== false) { // Trigger responded with error, throw the error throw('ForerunnerDB.Mixin.Triggers: Trigger error: ' + response); } } } // Triggers all ran without issue, return a success (true) return true; } }, /** * Returns the index of a trigger by id based on type and phase. * @param {String} id The id of the trigger to find the index of. * @param {Number} type The type of operation. See Mixin.Constants for * constants to use. * @param {Number} phase The phase of the operation. See Mixin.Constants * for constants to use. * @returns {number} * @private */ _triggerIndexOf: function (id, type, phase) { var self = this, triggerArr, triggerCount, triggerIndex; if (self._trigger && self._trigger[type] && self._trigger[type][phase]) { triggerArr = self._trigger[type][phase]; triggerCount = triggerArr.length; for (triggerIndex = 0; triggerIndex < triggerCount; triggerIndex++) { if (triggerArr[triggerIndex].id === id) { return triggerIndex; } } } return -1; } }; module.exports = Triggers; },{"./Overload":28}],24:[function(_dereq_,module,exports){ "use strict"; var Updating = { /** * Updates a property on an object. * @param {Object} doc The object whose property is to be updated. * @param {String} prop The property to update. * @param {*} val The new value of the property. * @private */ _updateProperty: function (doc, prop, val) { doc[prop] = val; if (this.debug()) { console.log(this.logIdentifier() + ' Setting non-data-bound document property "' + prop + '"'); } }, /** * Increments a value for a property on a document by the passed number. * @param {Object} doc The document to modify. * @param {String} prop The property to modify. * @param {Number} val The amount to increment by. * @private */ _updateIncrement: function (doc, prop, val) { doc[prop] += val; }, /** * Changes the index of an item in the passed array. * @param {Array} arr The array to modify. * @param {Number} indexFrom The index to move the item from. * @param {Number} indexTo The index to move the item to. * @private */ _updateSpliceMove: function (arr, indexFrom, indexTo) { arr.splice(indexTo, 0, arr.splice(indexFrom, 1)[0]); if (this.debug()) { console.log(this.logIdentifier() + ' Moving non-data-bound document array index from "' + indexFrom + '" to "' + indexTo + '"'); } }, /** * Inserts an item into the passed array at the specified index. * @param {Array} arr The array to insert into. * @param {Number} index The index to insert at. * @param {Object} doc The document to insert. * @private */ _updateSplicePush: function (arr, index, doc) { if (arr.length > index) { arr.splice(index, 0, doc); } else { arr.push(doc); } }, /** * Inserts an item at the end of an array. * @param {Array} arr The array to insert the item into. * @param {Object} doc The document to insert. * @private */ _updatePush: function (arr, doc) { arr.push(doc); }, /** * Removes an item from the passed array. * @param {Array} arr The array to modify. * @param {Number} index The index of the item in the array to remove. * @private */ _updatePull: function (arr, index) { arr.splice(index, 1); }, /** * Multiplies a value for a property on a document by the passed number. * @param {Object} doc The document to modify. * @param {String} prop The property to modify. * @param {Number} val The amount to multiply by. * @private */ _updateMultiply: function (doc, prop, val) { doc[prop] *= val; }, /** * Renames a property on a document to the passed property. * @param {Object} doc The document to modify. * @param {String} prop The property to rename. * @param {Number} val The new property name. * @private */ _updateRename: function (doc, prop, val) { doc[val] = doc[prop]; delete doc[prop]; }, /** * Sets a property on a document to the passed value. * @param {Object} doc The document to modify. * @param {String} prop The property to delete. * @param {*} val The new property value. * @private */ _updateOverwrite: function (doc, prop, val) { doc[prop] = val; }, /** * Deletes a property on a document. * @param {Object} doc The document to modify. * @param {String} prop The property to delete. * @private */ _updateUnset: function (doc, prop) { delete doc[prop]; }, /** * Removes all properties from an object without destroying * the object instance, thereby maintaining data-bound linking. * @param {Object} doc The parent object to modify. * @param {String} prop The name of the child object to clear. * @private */ _updateClear: function (doc, prop) { var obj = doc[prop], i; if (obj && typeof obj === 'object') { for (i in obj) { if (obj.hasOwnProperty(i)) { this._updateUnset(obj, i); } } } }, /** * Pops an item or items from the array stack. * @param {Object} doc The document to modify. * @param {Number} val If set to a positive integer, will pop the number specified * from the stack, if set to a negative integer will shift the number specified * from the stack. * @return {Boolean} * @private */ _updatePop: function (doc, val) { var updated = false, i; if (doc.length > 0) { if (val > 0) { for (i = 0; i < val; i++) { doc.pop(); } updated = true; } else if (val < 0) { for (i = 0; i > val; i--) { doc.shift(); } updated = true; } } return updated; } }; module.exports = Updating; },{}],25:[function(_dereq_,module,exports){ "use strict"; // Grab the view class var Shared, Core, OldView, OldViewInit; Shared = _dereq_('./Shared'); Core = Shared.modules.Core; OldView = Shared.modules.OldView; OldViewInit = OldView.prototype.init; OldView.prototype.init = function () { var self = this; this._binds = []; this._renderStart = 0; this._renderEnd = 0; this._deferQueue = { insert: [], update: [], remove: [], upsert: [], _bindInsert: [], _bindUpdate: [], _bindRemove: [], _bindUpsert: [] }; this._deferThreshold = { insert: 100, update: 100, remove: 100, upsert: 100, _bindInsert: 100, _bindUpdate: 100, _bindRemove: 100, _bindUpsert: 100 }; this._deferTime = { insert: 100, update: 1, remove: 1, upsert: 1, _bindInsert: 100, _bindUpdate: 1, _bindRemove: 1, _bindUpsert: 1 }; OldViewInit.apply(this, arguments); // Hook view events to update binds this.on('insert', function (successArr, failArr) { self._bindEvent('insert', successArr, failArr); }); this.on('update', function (successArr, failArr) { self._bindEvent('update', successArr, failArr); }); this.on('remove', function (successArr, failArr) { self._bindEvent('remove', successArr, failArr); }); this.on('change', self._bindChange); }; /** * Binds a selector to the insert, update and delete events of a particular * view and keeps the selector in sync so that updates are reflected on the * web page in real-time. * * @param {String} selector The jQuery selector string to get target elements. * @param {Object} options The options object. */ OldView.prototype.bind = function (selector, options) { if (options && options.template) { this._binds[selector] = options; } else { throw('ForerunnerDB.OldView "' + this.name() + '": Cannot bind data to element, missing options information!'); } return this; }; /** * Un-binds a selector from the view changes. * @param {String} selector The jQuery selector string to identify the bind to remove. * @returns {Collection} */ OldView.prototype.unBind = function (selector) { delete this._binds[selector]; return this; }; /** * Returns true if the selector is bound to the view. * @param {String} selector The jQuery selector string to identify the bind to check for. * @returns {boolean} */ OldView.prototype.isBound = function (selector) { return Boolean(this._binds[selector]); }; /** * Sorts items in the DOM based on the bind settings and the passed item array. * @param {String} selector The jQuery selector of the bind container. * @param {Array} itemArr The array of items used to determine the order the DOM * elements should be in based on the order they are in, in the array. */ OldView.prototype.bindSortDom = function (selector, itemArr) { var container = window.jQuery(selector), arrIndex, arrItem, domItem; if (this.debug()) { console.log('ForerunnerDB.OldView.Bind: Sorting data in DOM...', itemArr); } for (arrIndex = 0; arrIndex < itemArr.length; arrIndex++) { arrItem = itemArr[arrIndex]; // Now we've done our inserts into the DOM, let's ensure // they are still ordered correctly domItem = container.find('#' + arrItem[this._primaryKey]); if (domItem.length) { if (arrIndex === 0) { if (this.debug()) { console.log('ForerunnerDB.OldView.Bind: Sort, moving to index 0...', domItem); } container.prepend(domItem); } else { if (this.debug()) { console.log('ForerunnerDB.OldView.Bind: Sort, moving to index ' + arrIndex + '...', domItem); } domItem.insertAfter(container.children(':eq(' + (arrIndex - 1) + ')')); } } else { if (this.debug()) { console.log('ForerunnerDB.OldView.Bind: Warning, element for array item not found!', arrItem); } } } }; OldView.prototype.bindRefresh = function (obj) { var binds = this._binds, bindKey, bind; if (!obj) { // Grab current data obj = { data: this.find() }; } for (bindKey in binds) { if (binds.hasOwnProperty(bindKey)) { bind = binds[bindKey]; if (this.debug()) { console.log('ForerunnerDB.OldView.Bind: Sorting DOM...'); } this.bindSortDom(bindKey, obj.data); if (bind.afterOperation) { bind.afterOperation(); } if (bind.refresh) { bind.refresh(); } } } }; /** * Renders a bind view data to the DOM. * @param {String} bindSelector The jQuery selector string to use to identify * the bind target. Must match the selector used when defining the original bind. * @param {Function=} domHandler If specified, this handler method will be called * with the final HTML for the view instead of the DB handling the DOM insertion. */ OldView.prototype.bindRender = function (bindSelector, domHandler) { // Check the bind exists var bind = this._binds[bindSelector], domTarget = window.jQuery(bindSelector), allData, dataItem, itemHtml, finalHtml = window.jQuery('<ul></ul>'), bindCallback, i; if (bind) { allData = this._data.find(); bindCallback = function (itemHtml) { finalHtml.append(itemHtml); }; // Loop all items and add them to the screen for (i = 0; i < allData.length; i++) { dataItem = allData[i]; itemHtml = bind.template(dataItem, bindCallback); } if (!domHandler) { domTarget.append(finalHtml.html()); } else { domHandler(bindSelector, finalHtml.html()); } } }; OldView.prototype.processQueue = function (type, callback) { var queue = this._deferQueue[type], deferThreshold = this._deferThreshold[type], deferTime = this._deferTime[type]; if (queue.length) { var self = this, dataArr; // Process items up to the threshold if (queue.length) { if (queue.length > deferThreshold) { // Grab items up to the threshold value dataArr = queue.splice(0, deferThreshold); } else { // Grab all the remaining items dataArr = queue.splice(0, queue.length); } this._bindEvent(type, dataArr, []); } // Queue another process setTimeout(function () { self.processQueue(type, callback); }, deferTime); } else { if (callback) { callback(); } this.emit('bindQueueComplete'); } }; OldView.prototype._bindEvent = function (type, successArr, failArr) { /*var queue = this._deferQueue[type], deferThreshold = this._deferThreshold[type], deferTime = this._deferTime[type];*/ var binds = this._binds, unfilteredDataSet = this.find({}), filteredDataSet, bindKey; // Check if the number of inserts is greater than the defer threshold /*if (successArr && successArr.length > deferThreshold) { // Break up upsert into blocks this._deferQueue[type] = queue.concat(successArr); // Fire off the insert queue handler this.processQueue(type); return; } else {*/ for (bindKey in binds) { if (binds.hasOwnProperty(bindKey)) { if (binds[bindKey].reduce) { filteredDataSet = this.find(binds[bindKey].reduce.query, binds[bindKey].reduce.options); } else { filteredDataSet = unfilteredDataSet; } switch (type) { case 'insert': this._bindInsert(bindKey, binds[bindKey], successArr, failArr, filteredDataSet); break; case 'update': this._bindUpdate(bindKey, binds[bindKey], successArr, failArr, filteredDataSet); break; case 'remove': this._bindRemove(bindKey, binds[bindKey], successArr, failArr, filteredDataSet); break; } } } //} }; OldView.prototype._bindChange = function (newDataArr) { if (this.debug()) { console.log('ForerunnerDB.OldView.Bind: Bind data change, refreshing bind...', newDataArr); } this.bindRefresh(newDataArr); }; OldView.prototype._bindInsert = function (selector, options, successArr, failArr, all) { var container = window.jQuery(selector), itemElem, itemHtml, makeCallback, i; makeCallback = function (itemElem, insertedItem, failArr, all) { return function (itemHtml) { // Check if there is custom DOM insert method if (options.insert) { options.insert(itemHtml, insertedItem, failArr, all); } else { // Handle the insert automatically // Add the item to the container if (options.prependInsert) { container.prepend(itemHtml); } else { container.append(itemHtml); } } if (options.afterInsert) { options.afterInsert(itemHtml, insertedItem, failArr, all); } }; }; // Loop the inserted items for (i = 0; i < successArr.length; i++) { // Check for existing item in the container itemElem = container.find('#' + successArr[i][this._primaryKey]); if (!itemElem.length) { itemHtml = options.template(successArr[i], makeCallback(itemElem, successArr[i], failArr, all)); } } }; OldView.prototype._bindUpdate = function (selector, options, successArr, failArr, all) { var container = window.jQuery(selector), itemElem, makeCallback, i; makeCallback = function (itemElem, itemData) { return function (itemHtml) { // Check if there is custom DOM insert method if (options.update) { options.update(itemHtml, itemData, all, itemElem.length ? 'update' : 'append'); } else { if (itemElem.length) { // An existing item is in the container, replace it with the // new rendered item from the updated data itemElem.replaceWith(itemHtml); } else { // The item element does not already exist, append it if (options.prependUpdate) { container.prepend(itemHtml); } else { container.append(itemHtml); } } } if (options.afterUpdate) { options.afterUpdate(itemHtml, itemData, all); } }; }; // Loop the updated items for (i = 0; i < successArr.length; i++) { // Check for existing item in the container itemElem = container.find('#' + successArr[i][this._primaryKey]); options.template(successArr[i], makeCallback(itemElem, successArr[i])); } }; OldView.prototype._bindRemove = function (selector, options, successArr, failArr, all) { var container = window.jQuery(selector), itemElem, makeCallback, i; makeCallback = function (itemElem, data, all) { return function () { if (options.remove) { options.remove(itemElem, data, all); } else { itemElem.remove(); if (options.afterRemove) { options.afterRemove(itemElem, data, all); } } }; }; // Loop the removed items for (i = 0; i < successArr.length; i++) { // Check for existing item in the container itemElem = container.find('#' + successArr[i][this._primaryKey]); if (itemElem.length) { if (options.beforeRemove) { options.beforeRemove(itemElem, successArr[i], all, makeCallback(itemElem, successArr[i], all)); } else { if (options.remove) { options.remove(itemElem, successArr[i], all); } else { itemElem.remove(); if (options.afterRemove) { options.afterRemove(itemElem, successArr[i], all); } } } } } }; },{"./Shared":35}],26:[function(_dereq_,module,exports){ "use strict"; // Import external names locally var Shared, Db, CollectionGroup, Collection, CollectionInit, CollectionGroupInit, DbInit; Shared = _dereq_('./Shared'); /** * The view constructor. * @param viewName * @constructor */ var OldView = function (viewName) { this.init.apply(this, arguments); }; OldView.prototype.init = function (viewName) { var self = this; this._name = viewName; this._listeners = {}; this._query = { query: {}, options: {} }; // Register listeners for the CRUD events this._onFromSetData = function () { self._onSetData.apply(self, arguments); }; this._onFromInsert = function () { self._onInsert.apply(self, arguments); }; this._onFromUpdate = function () { self._onUpdate.apply(self, arguments); }; this._onFromRemove = function () { self._onRemove.apply(self, arguments); }; this._onFromChange = function () { if (self.debug()) { console.log('ForerunnerDB.OldView: Received change'); } self._onChange.apply(self, arguments); }; }; Shared.addModule('OldView', OldView); CollectionGroup = _dereq_('./CollectionGroup'); Collection = _dereq_('./Collection'); CollectionInit = Collection.prototype.init; CollectionGroupInit = CollectionGroup.prototype.init; Db = Shared.modules.Db; DbInit = Db.prototype.init; Shared.mixin(OldView.prototype, 'Mixin.Events'); /** * Drops a view and all it's stored data from the database. * @returns {boolean} True on success, false on failure. */ OldView.prototype.drop = function () { if ((this._db || this._from) && this._name) { if (this.debug()) { console.log('ForerunnerDB.OldView: Dropping view ' + this._name); } this._state = 'dropped'; this.emit('drop', this); if (this._db && this._db._oldViews) { delete this._db._oldViews[this._name]; } if (this._from && this._from._oldViews) { delete this._from._oldViews[this._name]; } return true; } return false; }; OldView.prototype.debug = function () { // TODO: Make this function work return false; }; /** * Gets / sets the DB the view is bound against. Automatically set * when the db.oldView(viewName) method is called. * @param db * @returns {*} */ OldView.prototype.db = function (db) { if (db !== undefined) { this._db = db; return this; } return this._db; }; /** * Gets / sets the collection that the view derives it's data from. * @param {*} collection A collection instance or the name of a collection * to use as the data set to derive view data from. * @returns {*} */ OldView.prototype.from = function (collection) { if (collection !== undefined) { // Check if this is a collection name or a collection instance if (typeof(collection) === 'string') { if (this._db.collectionExists(collection)) { collection = this._db.collection(collection); } else { throw('ForerunnerDB.OldView "' + this.name() + '": Invalid collection in view.from() call.'); } } // Check if the existing from matches the passed one if (this._from !== collection) { // Check if we already have a collection assigned if (this._from) { // Remove ourselves from the collection view lookup this.removeFrom(); } this.addFrom(collection); } return this; } return this._from; }; OldView.prototype.addFrom = function (collection) { //var self = this; this._from = collection; if (this._from) { this._from.on('setData', this._onFromSetData); //this._from.on('insert', this._onFromInsert); //this._from.on('update', this._onFromUpdate); //this._from.on('remove', this._onFromRemove); this._from.on('change', this._onFromChange); // Add this view to the collection's view lookup this._from._addOldView(this); this._primaryKey = this._from._primaryKey; this.refresh(); return this; } else { throw('ForerunnerDB.OldView "' + this.name() + '": Cannot determine collection type in view.from()'); } }; OldView.prototype.removeFrom = function () { // Unsubscribe from events on this "from" this._from.off('setData', this._onFromSetData); //this._from.off('insert', this._onFromInsert); //this._from.off('update', this._onFromUpdate); //this._from.off('remove', this._onFromRemove); this._from.off('change', this._onFromChange); this._from._removeOldView(this); }; /** * Gets the primary key for this view from the assigned collection. * @returns {String} */ OldView.prototype.primaryKey = function () { if (this._from) { return this._from.primaryKey(); } return undefined; }; /** * Gets / sets the query that the view uses to build it's data set. * @param {Object=} query * @param {Boolean=} options An options object. * @param {Boolean=} refresh Whether to refresh the view data after * this operation. Defaults to true. * @returns {*} */ OldView.prototype.queryData = function (query, options, refresh) { if (query !== undefined) { this._query.query = query; } if (options !== undefined) { this._query.options = options; } if (query !== undefined || options !== undefined) { if (refresh === undefined || refresh === true) { this.refresh(); } return this; } return this._query; }; /** * Add data to the existing query. * @param {Object} obj The data whose keys will be added to the existing * query object. * @param {Boolean} overwrite Whether or not to overwrite data that already * exists in the query object. Defaults to true. * @param {Boolean=} refresh Whether or not to refresh the view data set * once the operation is complete. Defaults to true. */ OldView.prototype.queryAdd = function (obj, overwrite, refresh) { var query = this._query.query, i; if (obj !== undefined) { // Loop object properties and add to existing query for (i in obj) { if (obj.hasOwnProperty(i)) { if (query[i] === undefined || (query[i] !== undefined && overwrite)) { query[i] = obj[i]; } } } } if (refresh === undefined || refresh === true) { this.refresh(); } }; /** * Remove data from the existing query. * @param {Object} obj The data whose keys will be removed from the existing * query object. * @param {Boolean=} refresh Whether or not to refresh the view data set * once the operation is complete. Defaults to true. */ OldView.prototype.queryRemove = function (obj, refresh) { var query = this._query.query, i; if (obj !== undefined) { // Loop object properties and add to existing query for (i in obj) { if (obj.hasOwnProperty(i)) { delete query[i]; } } } if (refresh === undefined || refresh === true) { this.refresh(); } }; /** * Gets / sets the query being used to generate the view data. * @param {Object=} query The query to set. * @param {Boolean=} refresh Whether to refresh the view data after * this operation. Defaults to true. * @returns {*} */ OldView.prototype.query = function (query, refresh) { if (query !== undefined) { this._query.query = query; if (refresh === undefined || refresh === true) { this.refresh(); } return this; } return this._query.query; }; /** * Gets / sets the query options used when applying sorting etc to the * view data set. * @param {Object=} options An options object. * @param {Boolean=} refresh Whether to refresh the view data after * this operation. Defaults to true. * @returns {*} */ OldView.prototype.queryOptions = function (options, refresh) { if (options !== undefined) { this._query.options = options; if (refresh === undefined || refresh === true) { this.refresh(); } return this; } return this._query.options; }; /** * Refreshes the view data and diffs between previous and new data to * determine if any events need to be triggered or DOM binds updated. */ OldView.prototype.refresh = function (force) { if (this._from) { // Take a copy of the data before updating it, we will use this to // "diff" between the old and new data and handle DOM bind updates var oldData = this._data, oldDataArr, oldDataItem, newData, newDataArr, query, primaryKey, dataItem, inserted = [], updated = [], removed = [], operated = false, i; if (this.debug()) { console.log('ForerunnerDB.OldView: Refreshing view ' + this._name); console.log('ForerunnerDB.OldView: Existing data: ' + (typeof(this._data) !== "undefined")); if (typeof(this._data) !== "undefined") { console.log('ForerunnerDB.OldView: Current data rows: ' + this._data.find().length); } //console.log(OldView.prototype.refresh.caller); } // Query the collection and update the data if (this._query) { if (this.debug()) { console.log('ForerunnerDB.OldView: View has query and options, getting subset...'); } // Run query against collection //console.log('refresh with query and options', this._query.options); this._data = this._from.subset(this._query.query, this._query.options); //console.log(this._data); } else { // No query, return whole collection if (this._query.options) { if (this.debug()) { console.log('ForerunnerDB.OldView: View has options, getting subset...'); } this._data = this._from.subset({}, this._query.options); } else { if (this.debug()) { console.log('ForerunnerDB.OldView: View has no query or options, getting subset...'); } this._data = this._from.subset({}); } } // Check if there was old data if (!force && oldData) { if (this.debug()) { console.log('ForerunnerDB.OldView: Refresh not forced, old data detected...'); } // Now determine the difference newData = this._data; if (oldData.subsetOf() === newData.subsetOf()) { if (this.debug()) { console.log('ForerunnerDB.OldView: Old and new data are from same collection...'); } newDataArr = newData.find(); oldDataArr = oldData.find(); primaryKey = newData._primaryKey; // The old data and new data were derived from the same parent collection // so scan the data to determine changes for (i = 0; i < newDataArr.length; i++) { dataItem = newDataArr[i]; query = {}; query[primaryKey] = dataItem[primaryKey]; // Check if this item exists in the old data oldDataItem = oldData.find(query)[0]; if (!oldDataItem) { // New item detected inserted.push(dataItem); } else { // Check if an update has occurred if (JSON.stringify(oldDataItem) !== JSON.stringify(dataItem)) { // Updated / already included item detected updated.push(dataItem); } } } // Now loop the old data and check if any records were removed for (i = 0; i < oldDataArr.length; i++) { dataItem = oldDataArr[i]; query = {}; query[primaryKey] = dataItem[primaryKey]; // Check if this item exists in the old data if (!newData.find(query)[0]) { // Removed item detected removed.push(dataItem); } } if (this.debug()) { console.log('ForerunnerDB.OldView: Removed ' + removed.length + ' rows'); console.log('ForerunnerDB.OldView: Inserted ' + inserted.length + ' rows'); console.log('ForerunnerDB.OldView: Updated ' + updated.length + ' rows'); } // Now we have a diff of the two data sets, we need to get the DOM updated if (inserted.length) { this._onInsert(inserted, []); operated = true; } if (updated.length) { this._onUpdate(updated, []); operated = true; } if (removed.length) { this._onRemove(removed, []); operated = true; } } else { // The previous data and the new data are derived from different collections // and can therefore not be compared, all data is therefore effectively "new" // so first perform a remove of all existing data then do an insert on all new data if (this.debug()) { console.log('ForerunnerDB.OldView: Old and new data are from different collections...'); } removed = oldData.find(); if (removed.length) { this._onRemove(removed); operated = true; } inserted = newData.find(); if (inserted.length) { this._onInsert(inserted); operated = true; } } } else { // Force an update as if the view never got created by padding all elements // to the insert if (this.debug()) { console.log('ForerunnerDB.OldView: Forcing data update', newDataArr); } this._data = this._from.subset(this._query.query, this._query.options); newDataArr = this._data.find(); if (this.debug()) { console.log('ForerunnerDB.OldView: Emitting change event with data', newDataArr); } this._onInsert(newDataArr, []); } if (this.debug()) { console.log('ForerunnerDB.OldView: Emitting change'); } this.emit('change'); } return this; }; /** * Returns the number of documents currently in the view. * @returns {Number} */ OldView.prototype.count = function () { return this._data && this._data._data ? this._data._data.length : 0; }; /** * Queries the view data. See Collection.find() for more information. * @returns {*} */ OldView.prototype.find = function () { if (this._data) { if (this.debug()) { console.log('ForerunnerDB.OldView: Finding data in view collection...', this._data); } return this._data.find.apply(this._data, arguments); } else { return []; } }; /** * Inserts into view data via the view collection. See Collection.insert() for more information. * @returns {*} */ OldView.prototype.insert = function () { if (this._from) { // Pass the args through to the from object return this._from.insert.apply(this._from, arguments); } else { return []; } }; /** * Updates into view data via the view collection. See Collection.update() for more information. * @returns {*} */ OldView.prototype.update = function () { if (this._from) { // Pass the args through to the from object return this._from.update.apply(this._from, arguments); } else { return []; } }; /** * Removed from view data via the view collection. See Collection.remove() for more information. * @returns {*} */ OldView.prototype.remove = function () { if (this._from) { // Pass the args through to the from object return this._from.remove.apply(this._from, arguments); } else { return []; } }; OldView.prototype._onSetData = function (newDataArr, oldDataArr) { this.emit('remove', oldDataArr, []); this.emit('insert', newDataArr, []); //this.refresh(); }; OldView.prototype._onInsert = function (successArr, failArr) { this.emit('insert', successArr, failArr); //this.refresh(); }; OldView.prototype._onUpdate = function (successArr, failArr) { this.emit('update', successArr, failArr); //this.refresh(); }; OldView.prototype._onRemove = function (successArr, failArr) { this.emit('remove', successArr, failArr); //this.refresh(); }; OldView.prototype._onChange = function () { if (this.debug()) { console.log('ForerunnerDB.OldView: Refreshing data'); } this.refresh(); }; // Extend collection with view init Collection.prototype.init = function () { this._oldViews = []; CollectionInit.apply(this, arguments); }; /** * Adds a view to the internal view lookup. * @param {View} view The view to add. * @returns {Collection} * @private */ Collection.prototype._addOldView = function (view) { if (view !== undefined) { this._oldViews[view._name] = view; } return this; }; /** * Removes a view from the internal view lookup. * @param {View} view The view to remove. * @returns {Collection} * @private */ Collection.prototype._removeOldView = function (view) { if (view !== undefined) { delete this._oldViews[view._name]; } return this; }; // Extend collection with view init CollectionGroup.prototype.init = function () { this._oldViews = []; CollectionGroupInit.apply(this, arguments); }; /** * Adds a view to the internal view lookup. * @param {View} view The view to add. * @returns {Collection} * @private */ CollectionGroup.prototype._addOldView = function (view) { if (view !== undefined) { this._oldViews[view._name] = view; } return this; }; /** * Removes a view from the internal view lookup. * @param {View} view The view to remove. * @returns {Collection} * @private */ CollectionGroup.prototype._removeOldView = function (view) { if (view !== undefined) { delete this._oldViews[view._name]; } return this; }; // Extend DB with views init Db.prototype.init = function () { this._oldViews = {}; DbInit.apply(this, arguments); }; /** * Gets a view by it's name. * @param {String} viewName The name of the view to retrieve. * @returns {*} */ Db.prototype.oldView = function (viewName) { if (!this._oldViews[viewName]) { if (this.debug()) { console.log('ForerunnerDB.OldView: Creating view ' + viewName); } } this._oldViews[viewName] = this._oldViews[viewName] || new OldView(viewName).db(this); return this._oldViews[viewName]; }; /** * Determine if a view with the passed name already exists. * @param {String} viewName The name of the view to check for. * @returns {boolean} */ Db.prototype.oldViewExists = function (viewName) { return Boolean(this._oldViews[viewName]); }; /** * Returns an array of views the DB currently has. * @returns {Array} An array of objects containing details of each view * the database is currently managing. */ Db.prototype.oldViews = function () { var arr = [], i; for (i in this._oldViews) { if (this._oldViews.hasOwnProperty(i)) { arr.push({ name: i, count: this._oldViews[i].count() }); } } return arr; }; Shared.finishModule('OldView'); module.exports = OldView; },{"./Collection":4,"./CollectionGroup":5,"./Shared":35}],27:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'), Path = _dereq_('./Path'); /** * The operation class, used to store details about an operation being * performed by the database. * @param {String} name The name of the operation. * @constructor */ var Operation = function (name) { this.pathSolver = new Path(); this.counter = 0; this.init.apply(this, arguments); }; Operation.prototype.init = function (name) { this._data = { operation: name, // The name of the operation executed such as "find", "update" etc index: { potential: [], // Indexes that could have potentially been used used: false // The index that was picked to use }, steps: [], // The steps taken to generate the query results, time: { startMs: 0, stopMs: 0, totalMs: 0, process: {} }, flag: {}, // An object with flags that denote certain execution paths log: [] // Any extra data that might be useful such as warnings or helpful hints }; }; Shared.addModule('Operation', Operation); Shared.mixin(Operation.prototype, 'Mixin.ChainReactor'); /** * Starts the operation timer. */ Operation.prototype.start = function () { this._data.time.startMs = new Date().getTime(); }; /** * Adds an item to the operation log. * @param {String} event The item to log. * @returns {*} */ Operation.prototype.log = function (event) { if (event) { var lastLogTime = this._log.length > 0 ? this._data.log[this._data.log.length - 1].time : 0, logObj = { event: event, time: new Date().getTime(), delta: 0 }; this._data.log.push(logObj); if (lastLogTime) { logObj.delta = logObj.time - lastLogTime; } return this; } return this._data.log; }; /** * Called when starting and ending a timed operation, used to time * internal calls within an operation's execution. * @param {String} section An operation name. * @returns {*} */ Operation.prototype.time = function (section) { if (section !== undefined) { var process = this._data.time.process, processObj = process[section] = process[section] || {}; if (!processObj.startMs) { // Timer started processObj.startMs = new Date().getTime(); processObj.stepObj = { name: section }; this._data.steps.push(processObj.stepObj); } else { processObj.stopMs = new Date().getTime(); processObj.totalMs = processObj.stopMs - processObj.startMs; processObj.stepObj.totalMs = processObj.totalMs; delete processObj.stepObj; } return this; } return this._data.time; }; /** * Used to set key/value flags during operation execution. * @param {String} key * @param {String} val * @returns {*} */ Operation.prototype.flag = function (key, val) { if (key !== undefined && val !== undefined) { this._data.flag[key] = val; } else if (key !== undefined) { return this._data.flag[key]; } else { return this._data.flag; } }; Operation.prototype.data = function (path, val, noTime) { if (val !== undefined) { // Assign value to object path this.pathSolver.set(this._data, path, val); return this; } return this.pathSolver.get(this._data, path); }; Operation.prototype.pushData = function (path, val, noTime) { // Assign value to object path this.pathSolver.push(this._data, path, val); }; /** * Stops the operation timer. */ Operation.prototype.stop = function () { this._data.time.stopMs = new Date().getTime(); this._data.time.totalMs = this._data.time.stopMs - this._data.time.startMs; }; Shared.finishModule('Operation'); module.exports = Operation; },{"./Path":30,"./Shared":35}],28:[function(_dereq_,module,exports){ "use strict"; /** * Allows a method to accept overloaded calls with different parameters controlling * which passed overload function is called. * @param {Object} def * @returns {Function} * @constructor */ var Overload = function (def) { if (def) { var self = this, index, count, tmpDef, defNewKey, sigIndex, signatures; if (!(def instanceof Array)) { tmpDef = {}; // Def is an object, make sure all prop names are devoid of spaces for (index in def) { if (def.hasOwnProperty(index)) { defNewKey = index.replace(/ /g, ''); // Check if the definition array has a * string in it if (defNewKey.indexOf('*') === -1) { // No * found tmpDef[defNewKey] = def[index]; } else { // A * was found, generate the different signatures that this // definition could represent signatures = this.generateSignaturePermutations(defNewKey); for (sigIndex = 0; sigIndex < signatures.length; sigIndex++) { if (!tmpDef[signatures[sigIndex]]) { tmpDef[signatures[sigIndex]] = def[index]; } } } } } def = tmpDef; } return function () { var arr = [], lookup, type, name; // Check if we are being passed a key/function object or an array of functions if (def instanceof Array) { // We were passed an array of functions count = def.length; for (index = 0; index < count; index++) { if (def[index].length === arguments.length) { return self.callExtend(this, '$main', def, def[index], arguments); } } } else { // Generate lookup key from arguments // Copy arguments to an array for (index = 0; index < arguments.length; index++) { type = typeof arguments[index]; // Handle detecting arrays if (type === 'object' && arguments[index] instanceof Array) { type = 'array'; } // Handle been presented with a single undefined argument if (arguments.length === 1 && type === 'undefined') { break; } // Add the type to the argument types array arr.push(type); } lookup = arr.join(','); // Check for an exact lookup match if (def[lookup]) { return self.callExtend(this, '$main', def, def[lookup], arguments); } else { for (index = arr.length; index >= 0; index--) { // Get the closest match lookup = arr.slice(0, index).join(','); if (def[lookup + ',...']) { // Matched against arguments + "any other" return self.callExtend(this, '$main', def, def[lookup + ',...'], arguments); } } } } name = typeof this.name === 'function' ? this.name() : 'Unknown'; throw('ForerunnerDB.Overload "' + name + '": Overloaded method does not have a matching signature for the passed arguments: ' + JSON.stringify(arr)); }; } return function () {}; }; /** * Generates an array of all the different definition signatures that can be * created from the passed string with a catch-all wildcard *. E.g. it will * convert the signature: string,*,string to all potentials: * string,string,string * string,number,string * string,object,string, * string,function,string, * string,undefined,string * * @param {String} str Signature string with a wildcard in it. * @returns {Array} An array of signature strings that are generated. */ Overload.prototype.generateSignaturePermutations = function (str) { var signatures = [], newSignature, types = ['string', 'object', 'number', 'function', 'undefined'], index; if (str.indexOf('*') > -1) { // There is at least one "any" type, break out into multiple keys // We could do this at query time with regular expressions but // would be significantly slower for (index = 0; index < types.length; index++) { newSignature = str.replace('*', types[index]); signatures = signatures.concat(this.generateSignaturePermutations(newSignature)); } } else { signatures.push(str); } return signatures; }; Overload.prototype.callExtend = function (context, prop, propContext, func, args) { var tmp, ret; if (context && propContext[prop]) { tmp = context[prop]; context[prop] = propContext[prop]; ret = func.apply(context, args); context[prop] = tmp; return ret; } else { return func.apply(context, args); } }; module.exports = Overload; },{}],29:[function(_dereq_,module,exports){ "use strict"; // Import external names locally var Shared, Db, Collection, DbDocument; Shared = _dereq_('./Shared'); var Overview = function () { this.init.apply(this, arguments); }; Overview.prototype.init = function (name) { var self = this; this._name = name; this._data = new DbDocument('__FDB__dc_data_' + this._name); this._collData = new Collection(); this._sources = []; this._sourceDroppedWrap = function () { self._sourceDropped.apply(self, arguments); }; }; Shared.addModule('Overview', Overview); Shared.mixin(Overview.prototype, 'Mixin.Common'); Shared.mixin(Overview.prototype, 'Mixin.ChainReactor'); Shared.mixin(Overview.prototype, 'Mixin.Constants'); Shared.mixin(Overview.prototype, 'Mixin.Triggers'); Shared.mixin(Overview.prototype, 'Mixin.Events'); Collection = _dereq_('./Collection'); DbDocument = _dereq_('./Document'); Db = Shared.modules.Db; /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(Overview.prototype, 'state'); Shared.synthesize(Overview.prototype, 'db'); Shared.synthesize(Overview.prototype, 'name'); Shared.synthesize(Overview.prototype, 'query', function (val) { var ret = this.$super(val); if (val !== undefined) { this._refresh(); } return ret; }); Shared.synthesize(Overview.prototype, 'queryOptions', function (val) { var ret = this.$super(val); if (val !== undefined) { this._refresh(); } return ret; }); Shared.synthesize(Overview.prototype, 'reduce', function (val) { var ret = this.$super(val); if (val !== undefined) { this._refresh(); } return ret; }); Overview.prototype.from = function (source) { if (source !== undefined) { if (typeof(source) === 'string') { source = this._db.collection(source); } this._setFrom(source); return this; } return this._sources; }; Overview.prototype.find = function () { return this._collData.find.apply(this._collData, arguments); }; /** * Executes and returns the response from the current reduce method * assigned to the overview. * @returns {*} */ Overview.prototype.exec = function () { var reduceFunc = this.reduce(); return reduceFunc ? reduceFunc.apply(this) : undefined; }; Overview.prototype.count = function () { return this._collData.count.apply(this._collData, arguments); }; Overview.prototype._setFrom = function (source) { // Remove all source references while (this._sources.length) { this._removeSource(this._sources[0]); } this._addSource(source); return this; }; Overview.prototype._addSource = function (source) { if (source && source.className === 'View') { // The source is a view so IO to the internal data collection // instead of the view proper source = source.privateData(); if (this.debug()) { console.log(this.logIdentifier() + ' Using internal private data "' + source.instanceIdentifier() + '" for IO graph linking'); } } if (this._sources.indexOf(source) === -1) { this._sources.push(source); source.chain(this); source.on('drop', this._sourceDroppedWrap); this._refresh(); } return this; }; Overview.prototype._removeSource = function (source) { if (source && source.className === 'View') { // The source is a view so IO to the internal data collection // instead of the view proper source = source.privateData(); if (this.debug()) { console.log(this.logIdentifier() + ' Using internal private data "' + source.instanceIdentifier() + '" for IO graph linking'); } } var sourceIndex = this._sources.indexOf(source); if (sourceIndex > -1) { this._sources.splice(source, 1); source.unChain(this); source.off('drop', this._sourceDroppedWrap); this._refresh(); } return this; }; Overview.prototype._sourceDropped = function (source) { if (source) { // Source was dropped, remove from overview this._removeSource(source); } }; Overview.prototype._refresh = function () { if (!this.isDropped()) { if (this._sources && this._sources[0]) { this._collData.primaryKey(this._sources[0].primaryKey()); var tempArr = [], i; for (i = 0; i < this._sources.length; i++) { tempArr = tempArr.concat(this._sources[i].find(this._query, this._queryOptions)); } this._collData.setData(tempArr); } // Now execute the reduce method if (this._reduce) { var reducedData = this._reduce.apply(this); // Update the document with the newly returned data this._data.setData(reducedData); } } }; Overview.prototype._chainHandler = function (chainPacket) { switch (chainPacket.type) { case 'setData': case 'insert': case 'update': case 'remove': this._refresh(); break; default: break; } }; /** * Gets the module's internal data collection. * @returns {Collection} */ Overview.prototype.data = function () { return this._data; }; Overview.prototype.drop = function () { if (!this.isDropped()) { this._state = 'dropped'; delete this._data; delete this._collData; // Remove all source references while (this._sources.length) { this._removeSource(this._sources[0]); } delete this._sources; if (this._db && this._name) { delete this._db._overview[this._name]; } delete this._name; this.emit('drop', this); } return true; }; Db.prototype.overview = function (overviewName) { if (overviewName) { // Handle being passed an instance if (overviewName instanceof Overview) { return overviewName; } this._overview = this._overview || {}; this._overview[overviewName] = this._overview[overviewName] || new Overview(overviewName).db(this); return this._overview[overviewName]; } else { // Return an object of collection data return this._overview || {}; } }; /** * Returns an array of overviews the DB currently has. * @returns {Array} An array of objects containing details of each overview * the database is currently managing. */ Db.prototype.overviews = function () { var arr = [], item, i; for (i in this._overview) { if (this._overview.hasOwnProperty(i)) { item = this._overview[i]; arr.push({ name: i, count: item.count(), linked: item.isLinked !== undefined ? item.isLinked() : false }); } } return arr; }; Shared.finishModule('Overview'); module.exports = Overview; },{"./Collection":4,"./Document":9,"./Shared":35}],30:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'); /** * Path object used to resolve object paths and retrieve data from * objects by using paths. * @param {String=} path The path to assign. * @constructor */ var Path = function (path) { this.init.apply(this, arguments); }; Path.prototype.init = function (path) { if (path) { this.path(path); } }; Shared.addModule('Path', Path); Shared.mixin(Path.prototype, 'Mixin.ChainReactor'); /** * Gets / sets the given path for the Path instance. * @param {String=} path The path to assign. */ Path.prototype.path = function (path) { if (path !== undefined) { this._path = this.clean(path); this._pathParts = this._path.split('.'); return this; } return this._path; }; /** * Tests if the passed object has the paths that are specified and that * a value exists in those paths. * @param {Object} testKeys The object describing the paths to test for. * @param {Object} testObj The object to test paths against. * @returns {Boolean} True if the object paths exist. */ Path.prototype.hasObjectPaths = function (testKeys, testObj) { var result = true, i; for (i in testKeys) { if (testKeys.hasOwnProperty(i)) { if (testObj[i] === undefined) { return false; } if (typeof testKeys[i] === 'object') { // Recurse object result = this.hasObjectPaths(testKeys[i], testObj[i]); // Should we exit early? if (!result) { return false; } } } } return result; }; /** * Counts the total number of key endpoints in the passed object. * @param {Object} testObj The object to count key endpoints for. * @returns {Number} The number of endpoints. */ Path.prototype.countKeys = function (testObj) { var totalKeys = 0, i; for (i in testObj) { if (testObj.hasOwnProperty(i)) { if (testObj[i] !== undefined) { if (typeof testObj[i] !== 'object') { totalKeys++; } else { totalKeys += this.countKeys(testObj[i]); } } } } return totalKeys; }; /** * Tests if the passed object has the paths that are specified and that * a value exists in those paths and if so returns the number matched. * @param {Object} testKeys The object describing the paths to test for. * @param {Object} testObj The object to test paths against. * @returns {Object} Stats on the matched keys */ Path.prototype.countObjectPaths = function (testKeys, testObj) { var matchData, matchedKeys = {}, matchedKeyCount = 0, totalKeyCount = 0, i; for (i in testObj) { if (testObj.hasOwnProperty(i)) { if (typeof testObj[i] === 'object') { // The test / query object key is an object, recurse matchData = this.countObjectPaths(testKeys[i], testObj[i]); matchedKeys[i] = matchData.matchedKeys; totalKeyCount += matchData.totalKeyCount; matchedKeyCount += matchData.matchedKeyCount; } else { // The test / query object has a property that is not an object so add it as a key totalKeyCount++; // Check if the test keys also have this key and it is also not an object if (testKeys && testKeys[i] && typeof testKeys[i] !== 'object') { matchedKeys[i] = true; matchedKeyCount++; } else { matchedKeys[i] = false; } } } } return { matchedKeys: matchedKeys, matchedKeyCount: matchedKeyCount, totalKeyCount: totalKeyCount }; }; /** * Takes a non-recursive object and converts the object hierarchy into * a path string. * @param {Object} obj The object to parse. * @param {Boolean=} withValue If true will include a 'value' key in the returned * object that represents the value the object path points to. * @returns {Object} */ Path.prototype.parse = function (obj, withValue) { var paths = [], path = '', resultData, i, k; for (i in obj) { if (obj.hasOwnProperty(i)) { // Set the path to the key path = i; if (typeof(obj[i]) === 'object') { if (withValue) { resultData = this.parse(obj[i], withValue); for (k = 0; k < resultData.length; k++) { paths.push({ path: path + '.' + resultData[k].path, value: resultData[k].value }); } } else { resultData = this.parse(obj[i]); for (k = 0; k < resultData.length; k++) { paths.push({ path: path + '.' + resultData[k].path }); } } } else { if (withValue) { paths.push({ path: path, value: obj[i] }); } else { paths.push({ path: path }); } } } } return paths; }; /** * Takes a non-recursive object and converts the object hierarchy into * an array of path strings that allow you to target all possible paths * in an object. * * @returns {Array} */ Path.prototype.parseArr = function (obj, options) { options = options || {}; return this._parseArr(obj, '', [], options); }; Path.prototype._parseArr = function (obj, path, paths, options) { var i, newPath = ''; path = path || ''; paths = paths || []; for (i in obj) { if (obj.hasOwnProperty(i)) { if (!options.ignore || (options.ignore && !options.ignore.test(i))) { if (path) { newPath = path + '.' + i; } else { newPath = i; } if (typeof(obj[i]) === 'object') { this._parseArr(obj[i], newPath, paths, options); } else { paths.push(newPath); } } } } return paths; }; /** * Gets the value(s) that the object contains for the currently assigned path string. * @param {Object} obj The object to evaluate the path against. * @param {String=} path A path to use instead of the existing one passed in path(). * @returns {Array} An array of values for the given path. */ Path.prototype.value = function (obj, path) { if (obj !== undefined && typeof obj === 'object') { var pathParts, arr, arrCount, objPart, objPartParent, valuesArr = [], i, k; if (path !== undefined) { path = this.clean(path); pathParts = path.split('.'); } arr = pathParts || this._pathParts; arrCount = arr.length; objPart = obj; for (i = 0; i < arrCount; i++) { objPart = objPart[arr[i]]; if (objPartParent instanceof Array) { // Search inside the array for the next key for (k = 0; k < objPartParent.length; k++) { valuesArr = valuesArr.concat(this.value(objPartParent, k + '.' + arr[i])); } return valuesArr; } else { if (!objPart || typeof(objPart) !== 'object') { break; } } objPartParent = objPart; } return [objPart]; } else { return []; } }; /** * Sets a value on an object for the specified path. * @param {Object} obj The object to update. * @param {String} path The path to update. * @param {*} val The value to set the object path to. * @returns {*} */ Path.prototype.set = function (obj, path, val) { if (obj !== undefined && path !== undefined) { var pathParts, part; path = this.clean(path); pathParts = path.split('.'); part = pathParts.shift(); if (pathParts.length) { // Generate the path part in the object if it does not already exist obj[part] = obj[part] || {}; // Recurse this.set(obj[part], pathParts.join('.'), val); } else { // Set the value obj[part] = val; } } return obj; }; Path.prototype.get = function (obj, path) { return this.value(obj, path)[0]; }; /** * Push a value to an array on an object for the specified path. * @param {Object} obj The object to update. * @param {String} path The path to the array to push to. * @param {*} val The value to push to the array at the object path. * @returns {*} */ Path.prototype.push = function (obj, path, val) { if (obj !== undefined && path !== undefined) { var pathParts, part; path = this.clean(path); pathParts = path.split('.'); part = pathParts.shift(); if (pathParts.length) { // Generate the path part in the object if it does not already exist obj[part] = obj[part] || {}; // Recurse this.set(obj[part], pathParts.join('.'), val); } else { // Set the value obj[part] = obj[part] || []; if (obj[part] instanceof Array) { obj[part].push(val); } else { throw('ForerunnerDB.Path: Cannot push to a path whose endpoint is not an array!'); } } } return obj; }; /** * Gets the value(s) that the object contains for the currently assigned path string * with their associated keys. * @param {Object} obj The object to evaluate the path against. * @param {String=} path A path to use instead of the existing one passed in path(). * @returns {Array} An array of values for the given path with the associated key. */ Path.prototype.keyValue = function (obj, path) { var pathParts, arr, arrCount, objPart, objPartParent, objPartHash, i; if (path !== undefined) { path = this.clean(path); pathParts = path.split('.'); } arr = pathParts || this._pathParts; arrCount = arr.length; objPart = obj; for (i = 0; i < arrCount; i++) { objPart = objPart[arr[i]]; if (!objPart || typeof(objPart) !== 'object') { objPartHash = arr[i] + ':' + objPart; break; } objPartParent = objPart; } return objPartHash; }; /** * Removes leading period (.) from string and returns it. * @param {String} str The string to clean. * @returns {*} */ Path.prototype.clean = function (str) { if (str.substr(0, 1) === '.') { str = str.substr(1, str.length -1); } return str; }; Shared.finishModule('Path'); module.exports = Path; },{"./Shared":35}],31:[function(_dereq_,module,exports){ "use strict"; // Import external names locally var Shared = _dereq_('./Shared'), async = _dereq_('async'), localforage = _dereq_('localforage'), FdbCompress = _dereq_('./PersistCompress'),// jshint ignore:line FdbCrypto = _dereq_('./PersistCrypto'),// jshint ignore:line Db, Collection, CollectionDrop, CollectionGroup, CollectionInit, DbInit, DbDrop, Persist, Overload; /** * The persistent storage class handles loading and saving data to browser * storage. * @constructor */ Persist = function () { this.init.apply(this, arguments); }; /** * The local forage library. */ Persist.prototype.localforage = localforage; /** * The init method that can be overridden or extended. * @param {Db} db The ForerunnerDB database instance. */ Persist.prototype.init = function (db) { this._encodeSteps = [ this._encode ]; this._decodeSteps = [ this._decode ]; // Check environment if (db.isClient()) { if (window.Storage !== undefined) { this.mode('localforage'); localforage.config({ driver: [ localforage.INDEXEDDB, localforage.WEBSQL, localforage.LOCALSTORAGE ], name: String(db.core().name()), storeName: 'FDB' }); } } }; Shared.addModule('Persist', Persist); Shared.mixin(Persist.prototype, 'Mixin.ChainReactor'); Db = Shared.modules.Db; Collection = _dereq_('./Collection'); CollectionDrop = Collection.prototype.drop; CollectionGroup = _dereq_('./CollectionGroup'); CollectionInit = Collection.prototype.init; DbInit = Db.prototype.init; DbDrop = Db.prototype.drop; Overload = Shared.overload; /** * Gets / sets the persistent storage mode (the library used * to persist data to the browser - defaults to localForage). * @param {String} type The library to use for storage. Defaults * to localForage. * @returns {*} */ Persist.prototype.mode = function (type) { if (type !== undefined) { this._mode = type; return this; } return this._mode; }; /** * Gets / sets the driver used when persisting data. * @param {String} val Specify the driver type (LOCALSTORAGE, * WEBSQL or INDEXEDDB) * @returns {*} */ Persist.prototype.driver = function (val) { if (val !== undefined) { switch (val.toUpperCase()) { case 'LOCALSTORAGE': localforage.setDriver(localforage.LOCALSTORAGE); break; case 'WEBSQL': localforage.setDriver(localforage.WEBSQL); break; case 'INDEXEDDB': localforage.setDriver(localforage.INDEXEDDB); break; default: throw('ForerunnerDB.Persist: The persistence driver you have specified is not found. Please use either IndexedDB, WebSQL or LocalStorage!'); } return this; } return localforage.driver(); }; /** * Starts a decode waterfall process. * @param {*} val The data to be decoded. * @param {Function} finished The callback to pass final data to. */ Persist.prototype.decode = function (val, finished) { async.waterfall([function (callback) { callback(false, val, {}); }].concat(this._decodeSteps), finished); }; /** * Starts an encode waterfall process. * @param {*} val The data to be encoded. * @param {Function} finished The callback to pass final data to. */ Persist.prototype.encode = function (val, finished) { async.waterfall([function (callback) { callback(false, val, {}); }].concat(this._encodeSteps), finished); }; Shared.synthesize(Persist.prototype, 'encodeSteps'); Shared.synthesize(Persist.prototype, 'decodeSteps'); /** * Adds an encode/decode step to the persistent storage system so * that you can add custom functionality. * @param {Function} encode The encode method called with the data from the * previous encode step. When your method is complete it MUST call the * callback method. If you provide anything other than false to the err * parameter the encoder will fail and throw an error. * @param {Function} decode The decode method called with the data from the * previous decode step. When your method is complete it MUST call the * callback method. If you provide anything other than false to the err * parameter the decoder will fail and throw an error. * @param {Number=} index Optional index to add the encoder step to. This * allows you to place a step before or after other existing steps. If not * provided your step is placed last in the list of steps. For instance if * you are providing an encryption step it makes sense to place this last * since all previous steps will then have their data encrypted by your * final step. */ Persist.prototype.addStep = new Overload({ 'object': function (obj) { this.$main.call(this, function objEncode () { obj.encode.apply(obj, arguments); }, function objDecode () { obj.decode.apply(obj, arguments); }, 0); }, 'function, function': function (encode, decode) { this.$main.call(this, encode, decode, 0); }, 'function, function, number': function (encode, decode, index) { this.$main.call(this, encode, decode, index); }, $main: function (encode, decode, index) { if (index === 0 || index === undefined) { this._encodeSteps.push(encode); this._decodeSteps.unshift(decode); } else { // Place encoder step at index then work out correct // index to place decoder step this._encodeSteps.splice(index, 0, encode); this._decodeSteps.splice(this._decodeSteps.length - index, 0, decode); } } }); Persist.prototype.unwrap = function (dataStr) { var parts = dataStr.split('::fdb::'), data; switch (parts[0]) { case 'json': data = JSON.parse(parts[1]); break; case 'raw': data = parts[1]; break; default: break; } }; /** * Takes encoded data and decodes it for use as JS native objects and arrays. * @param {String} val The currently encoded string data. * @param {Object} meta Meta data object that can be used to pass back useful * supplementary data. * @param {Function} finished The callback method to call when decoding is * completed. * @private */ Persist.prototype._decode = function (val, meta, finished) { var parts, data; if (val) { parts = val.split('::fdb::'); switch (parts[0]) { case 'json': data = JSON.parse(parts[1]); break; case 'raw': data = parts[1]; break; default: break; } if (data) { meta.foundData = true; meta.rowCount = data.length; } else { meta.foundData = false; } if (finished) { finished(false, data, meta); } } else { meta.foundData = false; meta.rowCount = 0; if (finished) { finished(false, val, meta); } } }; /** * Takes native JS data and encodes it for for storage as a string. * @param {Object} val The current un-encoded data. * @param {Object} meta Meta data object that can be used to pass back useful * supplementary data. * @param {Function} finished The callback method to call when encoding is * completed. * @private */ Persist.prototype._encode = function (val, meta, finished) { var data = val; if (typeof val === 'object') { val = 'json::fdb::' + JSON.stringify(val); } else { val = 'raw::fdb::' + val; } if (data) { meta.foundData = true; meta.rowCount = data.length; } else { meta.foundData = false; } if (finished) { finished(false, val, meta); } }; /** * Encodes passed data and then stores it in the browser's persistent * storage layer. * @param {String} key The key to store the data under in the persistent * storage. * @param {Object} data The data to store under the key. * @param {Function=} callback The method to call when the save process * has completed. */ Persist.prototype.save = function (key, data, callback) { switch (this.mode()) { case 'localforage': this.encode(data, function (err, data, tableStats) { localforage.setItem(key, data).then(function (data) { if (callback) { callback(false, data, tableStats); } }, function (err) { if (callback) { callback(err); } }); }); break; default: if (callback) { callback('No data handler.'); } break; } }; /** * Loads and decodes data from the passed key. * @param {String} key The key to retrieve data from in the persistent * storage. * @param {Function=} callback The method to call when the load process * has completed. */ Persist.prototype.load = function (key, callback) { var self = this; switch (this.mode()) { case 'localforage': localforage.getItem(key).then(function (val) { self.decode(val, callback); }, function (err) { if (callback) { callback(err); } }); break; default: if (callback) { callback('No data handler or unrecognised data type.'); } break; } }; /** * Deletes data in persistent storage stored under the passed key. * @param {String} key The key to drop data for in the storage. * @param {Function=} callback The method to call when the data is dropped. */ Persist.prototype.drop = function (key, callback) { switch (this.mode()) { case 'localforage': localforage.removeItem(key).then(function () { if (callback) { callback(false); } }, function (err) { if (callback) { callback(err); } }); break; default: if (callback) { callback('No data handler or unrecognised data type.'); } break; } }; // Extend the Collection prototype with persist methods Collection.prototype.drop = new Overload({ /** * Drop collection and persistent storage. */ '': function () { if (!this.isDropped()) { this.drop(true); } }, /** * Drop collection and persistent storage with callback. * @param {Function} callback Callback method. */ 'function': function (callback) { if (!this.isDropped()) { this.drop(true, callback); } }, /** * Drop collection and optionally drop persistent storage. * @param {Boolean} removePersistent True to drop persistent storage, false to keep it. */ 'boolean': function (removePersistent) { if (!this.isDropped()) { // Remove persistent storage if (removePersistent) { if (this._name) { if (this._db) { // Drop the collection data from storage this._db.persist.drop(this._db._name + '::' + this._name); this._db.persist.drop(this._db._name + '::' + this._name + '::metaData'); } } else { throw('ForerunnerDB.Persist: Cannot drop a collection\'s persistent storage when no name assigned to collection!'); } } // Call the original method CollectionDrop.apply(this); } }, /** * Drop collections and optionally drop persistent storage with callback. * @param {Boolean} removePersistent True to drop persistent storage, false to keep it. * @param {Function} callback Callback method. */ 'boolean, function': function (removePersistent, callback) { var self = this; if (!this.isDropped()) { // Remove persistent storage if (removePersistent) { if (this._name) { if (this._db) { // Drop the collection data from storage this._db.persist.drop(this._db._name + '::' + this._name, function () { self._db.persist.drop(self._db._name + '::' + self._name + '::metaData', callback); }); } else { if (callback) { callback('Cannot drop a collection\'s persistent storage when the collection is not attached to a database!'); } } } else { if (callback) { callback('Cannot drop a collection\'s persistent storage when no name assigned to collection!'); } } } // Call the original method CollectionDrop.apply(this, callback); } } }); /** * Saves an entire collection's data to persistent storage. * @param {Function=} callback The method to call when the save function * has completed. */ Collection.prototype.save = function (callback) { var self = this, processSave; if (self._name) { if (self._db) { processSave = function () { // Save the collection data self._db.persist.save(self._db._name + '::' + self._name, self._data, function (err, data, tableStats) { if (!err) { self._db.persist.save(self._db._name + '::' + self._name + '::metaData', self.metaData(), function (err, data, metaStats) { if (callback) { callback(err, data, tableStats, metaStats); } }); } else { if (callback) { callback(err); } } }); }; // Check for processing queues if (self.isProcessingQueue()) { // Hook queue complete to process save self.on('queuesComplete', function () { processSave(); }); } else { // Process save immediately processSave(); } } else { if (callback) { callback('Cannot save a collection that is not attached to a database!'); } } } else { if (callback) { callback('Cannot save a collection with no assigned name!'); } } }; /** * Loads an entire collection's data from persistent storage. * @param {Function=} callback The method to call when the load function * has completed. */ Collection.prototype.load = function (callback) { var self = this; if (self._name) { if (self._db) { // Load the collection data self._db.persist.load(self._db._name + '::' + self._name, function (err, data, tableStats) { if (!err) { if (data) { self.setData(data); } // Now load the collection's metadata self._db.persist.load(self._db._name + '::' + self._name + '::metaData', function (err, data, metaStats) { if (!err) { if (data) { self.metaData(data); } } if (callback) { callback(err, tableStats, metaStats); } }); } else { if (callback) { callback(err); } } }); } else { if (callback) { callback('Cannot load a collection that is not attached to a database!'); } } } else { if (callback) { callback('Cannot load a collection with no assigned name!'); } } }; // Override the DB init to instantiate the plugin Db.prototype.init = function () { DbInit.apply(this, arguments); this.persist = new Persist(this); }; /** * Loads an entire database's data from persistent storage. * @param {Function=} callback The method to call when the load function * has completed. */ Db.prototype.load = function (callback) { // Loop the collections in the database var obj = this._collection, keys = obj.keys(), keyCount = keys.length, loadCallback, index; loadCallback = function (err) { if (!err) { keyCount--; if (keyCount === 0) { if (callback) { callback(false); } } } else { if (callback) { callback(err); } } }; for (index in obj) { if (obj.hasOwnProperty(index)) { // Call the collection load method obj[index].load(loadCallback); } } }; /** * Saves an entire database's data to persistent storage. * @param {Function=} callback The method to call when the save function * has completed. */ Db.prototype.save = function (callback) { // Loop the collections in the database var obj = this._collection, keys = obj.keys(), keyCount = keys.length, saveCallback, index; saveCallback = function (err) { if (!err) { keyCount--; if (keyCount === 0) { if (callback) { callback(false); } } } else { if (callback) { callback(err); } } }; for (index in obj) { if (obj.hasOwnProperty(index)) { // Call the collection save method obj[index].save(saveCallback); } } }; Shared.finishModule('Persist'); module.exports = Persist; },{"./Collection":4,"./CollectionGroup":5,"./PersistCompress":32,"./PersistCrypto":33,"./Shared":35,"async":37,"localforage":79}],32:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'), pako = _dereq_('pako'); var Plugin = function () { this.init.apply(this, arguments); }; Plugin.prototype.init = function (options) { }; Plugin.prototype.encode = function (val, meta, finished) { var wrapper = { data: val, type: 'fdbCompress', enabled: false }, before, after, compressedVal; // Compress the data before = val.length; compressedVal = pako.deflate(val, {to: 'string'}); after = compressedVal.length; // If the compressed version is smaller than the original, use it! if (after < before) { wrapper.data = compressedVal; wrapper.enabled = true; } meta.compression = { enabled: wrapper.enabled, compressedBytes: after, uncompressedBytes: before, effect: Math.round((100 / before) * after) + '%' }; finished(false, JSON.stringify(wrapper), meta); }; Plugin.prototype.decode = function (wrapper, meta, finished) { var compressionEnabled = false, data; if (wrapper) { wrapper = JSON.parse(wrapper); // Check if we need to decompress the string if (wrapper.enabled) { data = pako.inflate(wrapper.data, {to: 'string'}); compressionEnabled = true; } else { data = wrapper.data; compressionEnabled = false; } meta.compression = { enabled: compressionEnabled }; if (finished) { finished(false, data, meta); } } else { if (finished) { finished(false, data, meta); } } }; // Register this plugin with the persistent storage class Shared.plugins.FdbCompress = Plugin; module.exports = Plugin; },{"./Shared":35,"pako":81}],33:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'), CryptoJS = _dereq_('crypto-js'); var Plugin = function () { this.init.apply(this, arguments); }; Plugin.prototype.init = function (options) { // Ensure at least a password is passed in options if (!options || !options.pass) { throw('Cannot initialise persistent storage encryption without a passphrase provided in the passed options object as the "pass" field.'); } this._algo = options.algo || 'AES'; this._pass = options.pass; }; /** * Gets / sets the current pass-phrase being used to encrypt / decrypt * data with the plugin. */ Shared.synthesize(Plugin.prototype, 'pass'); Plugin.prototype._jsonFormatter = { stringify: function (cipherParams) { // create json object with ciphertext var jsonObj = { ct: cipherParams.ciphertext.toString(CryptoJS.enc.Base64) }; // optionally add iv and salt if (cipherParams.iv) { jsonObj.iv = cipherParams.iv.toString(); } if (cipherParams.salt) { jsonObj.s = cipherParams.salt.toString(); } // stringify json object return JSON.stringify(jsonObj); }, parse: function (jsonStr) { // parse json string var jsonObj = JSON.parse(jsonStr); // extract ciphertext from json object, and create cipher params object var cipherParams = CryptoJS.lib.CipherParams.create({ ciphertext: CryptoJS.enc.Base64.parse(jsonObj.ct) }); // optionally extract iv and salt if (jsonObj.iv) { cipherParams.iv = CryptoJS.enc.Hex.parse(jsonObj.iv); } if (jsonObj.s) { cipherParams.salt = CryptoJS.enc.Hex.parse(jsonObj.s); } return cipherParams; } }; Plugin.prototype.encode = function (val, meta, finished) { var wrapper = { type: 'fdbCrypto' }, encryptedVal; // Encrypt the data encryptedVal = CryptoJS[this._algo].encrypt(val, this._pass, { format: this._jsonFormatter }); wrapper.data = encryptedVal.toString(); wrapper.enabled = true; meta.encryption = { enabled: wrapper.enabled }; if (finished) { finished(false, JSON.stringify(wrapper), meta); } }; Plugin.prototype.decode = function (wrapper, meta, finished) { var data; if (wrapper) { wrapper = JSON.parse(wrapper); data = CryptoJS[this._algo].decrypt(wrapper.data, this._pass, { format: this._jsonFormatter }).toString(CryptoJS.enc.Utf8); if (finished) { finished(false, data, meta); } } else { if (finished) { finished(false, wrapper, meta); } } }; // Register this plugin with the persistent storage class Shared.plugins.FdbCrypto = Plugin; module.exports = Plugin; },{"./Shared":35,"crypto-js":46}],34:[function(_dereq_,module,exports){ "use strict"; var Shared = _dereq_('./Shared'); /** * Provides chain reactor node linking so that a chain reaction can propagate * down a node tree. * @param {*} reactorIn An object that has the Mixin.ChainReactor methods mixed * in to it. Chain reactions that occur inside this object will be passed through * to the reactoreOut object. * @param {*} reactorOut An object that has the Mixin.ChainReactor methods mixed * in to it. Chain reactions that occur in the reactorIn object will be passed * through to this object. * @param {Function} reactorProcess The processing method to use when chain * reactions occur * @constructor */ var ReactorIO = function (reactorIn, reactorOut, reactorProcess) { if (reactorIn && reactorOut && reactorProcess) { this._reactorIn = reactorIn; this._reactorOut = reactorOut; this._chainHandler = reactorProcess; if (!reactorIn.chain || !reactorOut.chainReceive) { throw('ForerunnerDB.ReactorIO: ReactorIO requires passed in and out objects to implement the ChainReactor mixin!'); } // Register the reactorIO with the input reactorIn.chain(this); // Register the output with the reactorIO this.chain(reactorOut); } else { throw('ForerunnerDB.ReactorIO: ReactorIO requires in, out and process arguments to instantiate!'); } }; Shared.addModule('ReactorIO', ReactorIO); /** * Drop a reactor IO object, breaking the reactor link between the in and out * reactor nodes. * @returns {boolean} */ ReactorIO.prototype.drop = function () { if (!this.isDropped()) { this._state = 'dropped'; // Remove links if (this._reactorIn) { this._reactorIn.unChain(this); } if (this._reactorOut) { this.unChain(this._reactorOut); } delete this._reactorIn; delete this._reactorOut; delete this._chainHandler; this.emit('drop', this); } return true; }; /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(ReactorIO.prototype, 'state'); Shared.mixin(ReactorIO.prototype, 'Mixin.Common'); Shared.mixin(ReactorIO.prototype, 'Mixin.ChainReactor'); Shared.mixin(ReactorIO.prototype, 'Mixin.Events'); Shared.finishModule('ReactorIO'); module.exports = ReactorIO; },{"./Shared":35}],35:[function(_dereq_,module,exports){ "use strict"; var Overload = _dereq_('./Overload'); /** * A shared object that can be used to store arbitrary data between class * instances, and access helper methods. * @mixin */ var Shared = { version: '1.3.309', modules: {}, plugins: {}, _synth: {}, /** * Adds a module to ForerunnerDB. * @memberof Shared * @param {String} name The name of the module. * @param {Function} module The module class. */ addModule: function (name, module) { // Store the module in the module registry this.modules[name] = module; // Tell the universe we are loading this module this.emit('moduleLoad', [name, module]); }, /** * Called by the module once all processing has been completed. Used to determine * if the module is ready for use by other modules. * @memberof Shared * @param {String} name The name of the module. */ finishModule: function (name) { if (this.modules[name]) { // Set the finished loading flag to true this.modules[name]._fdbFinished = true; // Assign the module name to itself so it knows what it // is called if (this.modules[name].prototype) { this.modules[name].prototype.className = name; } else { this.modules[name].className = name; } this.emit('moduleFinished', [name, this.modules[name]]); } else { throw('ForerunnerDB.Shared: finishModule called on a module that has not been registered with addModule(): ' + name); } }, /** * Will call your callback method when the specified module has loaded. If the module * is already loaded the callback is called immediately. * @memberof Shared * @param {String} name The name of the module. * @param {Function} callback The callback method to call when the module is loaded. */ moduleFinished: function (name, callback) { if (this.modules[name] && this.modules[name]._fdbFinished) { if (callback) { callback(name, this.modules[name]); } } else { this.on('moduleFinished', callback); } }, /** * Determines if a module has been added to ForerunnerDB or not. * @memberof Shared * @param {String} name The name of the module. * @returns {Boolean} True if the module exists or false if not. */ moduleExists: function (name) { return Boolean(this.modules[name]); }, /** * Adds the properties and methods defined in the mixin to the passed object. * @memberof Shared * @param {Object} obj The target object to add mixin key/values to. * @param {String} mixinName The name of the mixin to add to the object. */ mixin: new Overload({ 'object, string': function (obj, mixinName) { var mixinObj; if (typeof mixinName === 'string') { mixinObj = this.mixins[mixinName]; if (!mixinObj) { throw('ForerunnerDB.Shared: Cannot find mixin named: ' + mixinName); } } return this.$main.call(this, obj, mixinObj); }, 'object, *': function (obj, mixinObj) { return this.$main.call(this, obj, mixinObj); }, '$main': function (obj, mixinObj) { if (mixinObj && typeof mixinObj === 'object') { for (var i in mixinObj) { if (mixinObj.hasOwnProperty(i)) { obj[i] = mixinObj[i]; } } } return obj; } }), /** * Generates a generic getter/setter method for the passed method name. * @memberof Shared * @param {Object} obj The object to add the getter/setter to. * @param {String} name The name of the getter/setter to generate. * @param {Function=} extend A method to call before executing the getter/setter. * The existing getter/setter can be accessed from the extend method via the * $super e.g. this.$super(); */ synthesize: function (obj, name, extend) { this._synth[name] = this._synth[name] || function (val) { if (val !== undefined) { this['_' + name] = val; return this; } return this['_' + name]; }; if (extend) { var self = this; obj[name] = function () { var tmp = this.$super, ret; this.$super = self._synth[name]; ret = extend.apply(this, arguments); this.$super = tmp; return ret; }; } else { obj[name] = this._synth[name]; } }, /** * Allows a method to be overloaded. * @memberof Shared * @param arr * @returns {Function} * @constructor */ overload: Overload, /** * Define the mixins that other modules can use as required. * @memberof Shared */ mixins: { 'Mixin.Common': _dereq_('./Mixin.Common'), 'Mixin.Events': _dereq_('./Mixin.Events'), 'Mixin.ChainReactor': _dereq_('./Mixin.ChainReactor'), 'Mixin.CRUD': _dereq_('./Mixin.CRUD'), 'Mixin.Constants': _dereq_('./Mixin.Constants'), 'Mixin.Triggers': _dereq_('./Mixin.Triggers'), 'Mixin.Sorting': _dereq_('./Mixin.Sorting'), 'Mixin.Matching': _dereq_('./Mixin.Matching'), 'Mixin.Updating': _dereq_('./Mixin.Updating') } }; // Add event handling to shared Shared.mixin(Shared, 'Mixin.Events'); module.exports = Shared; },{"./Mixin.CRUD":16,"./Mixin.ChainReactor":17,"./Mixin.Common":18,"./Mixin.Constants":19,"./Mixin.Events":20,"./Mixin.Matching":21,"./Mixin.Sorting":22,"./Mixin.Triggers":23,"./Mixin.Updating":24,"./Overload":28}],36:[function(_dereq_,module,exports){ "use strict"; // Import external names locally var Shared, Db, Collection, CollectionGroup, CollectionInit, DbInit, ReactorIO, ActiveBucket; Shared = _dereq_('./Shared'); /** * Creates a new view instance. * @param {String} name The name of the view. * @param {Object=} query The view's query. * @param {Object=} options An options object. * @constructor */ var View = function (name, query, options) { this.init.apply(this, arguments); }; View.prototype.init = function (name, query, options) { var self = this; this._name = name; this._listeners = {}; this._querySettings = {}; this._debug = {}; this.query(query, false); this.queryOptions(options, false); this._collectionDroppedWrap = function () { self._collectionDropped.apply(self, arguments); }; this._privateData = new Collection(this.name() + '_internalPrivate'); }; Shared.addModule('View', View); Shared.mixin(View.prototype, 'Mixin.Common'); Shared.mixin(View.prototype, 'Mixin.ChainReactor'); Shared.mixin(View.prototype, 'Mixin.Constants'); Shared.mixin(View.prototype, 'Mixin.Triggers'); Collection = _dereq_('./Collection'); CollectionGroup = _dereq_('./CollectionGroup'); ActiveBucket = _dereq_('./ActiveBucket'); ReactorIO = _dereq_('./ReactorIO'); CollectionInit = Collection.prototype.init; Db = Shared.modules.Db; DbInit = Db.prototype.init; /** * Gets / sets the current state. * @param {String=} val The name of the state to set. * @returns {*} */ Shared.synthesize(View.prototype, 'state'); /** * Gets / sets the current name. * @param {String=} val The new name to set. * @returns {*} */ Shared.synthesize(View.prototype, 'name'); /** * Gets / sets the current cursor. * @param {String=} val The new cursor to set. * @returns {*} */ Shared.synthesize(View.prototype, 'cursor', function (val) { if (val === undefined) { return this._cursor || {}; } this.$super.apply(this, arguments); }); /** * Executes an insert against the view's underlying data-source. * @see Collection::insert() */ View.prototype.insert = function () { this._from.insert.apply(this._from, arguments); }; /** * Executes an update against the view's underlying data-source. * @see Collection::update() */ View.prototype.update = function () { this._from.update.apply(this._from, arguments); }; /** * Executes an updateById against the view's underlying data-source. * @see Collection::updateById() */ View.prototype.updateById = function () { this._from.updateById.apply(this._from, arguments); }; /** * Executes a remove against the view's underlying data-source. * @see Collection::remove() */ View.prototype.remove = function () { this._from.remove.apply(this._from, arguments); }; /** * Queries the view data. * @see Collection::find() * @returns {Array} The result of the find query. */ View.prototype.find = function (query, options) { return this.publicData().find(query, options); }; /** * Queries the view data by specific id. * @see Collection::findById() * @returns {Array} The result of the find query. */ View.prototype.findById = function (id, options) { return this.publicData().findById(id, options); }; /** * Gets the module's internal data collection. * @returns {Collection} */ View.prototype.data = function () { return this._privateData; }; /** * Sets the source from which the view will assemble its data. * @param {Collection|View} source The source to use to assemble view data. * @returns {*} If no argument is passed, returns the current value of from, * otherwise returns itself for chaining. */ View.prototype.from = function (source) { var self = this; if (source !== undefined) { // Check if we have an existing from if (this._from) { // Remove the listener to the drop event this._from.off('drop', this._collectionDroppedWrap); delete this._from; } if (typeof(source) === 'string') { source = this._db.collection(source); } if (source.className === 'View') { // The source is a view so IO to the internal data collection // instead of the view proper source = source.privateData(); if (this.debug()) { console.log(this.logIdentifier() + ' Using internal private data "' + source.instanceIdentifier() + '" for IO graph linking'); } } this._from = source; this._from.on('drop', this._collectionDroppedWrap); // Create a new reactor IO graph node that intercepts chain packets from the // view's "from" source and determines how they should be interpreted by // this view. If the view does not have a query then this reactor IO will // simply pass along the chain packet without modifying it. this._io = new ReactorIO(source, this, function (chainPacket) { var data, diff, query, filteredData, doSend, pk, i; // Check that the state of the "self" object is not dropped if (self && !self.isDropped()) { // Check if we have a constraining query if (self._querySettings.query) { if (chainPacket.type === 'insert') { data = chainPacket.data; // Check if the data matches our query if (data instanceof Array) { filteredData = []; for (i = 0; i < data.length; i++) { if (self._privateData._match(data[i], self._querySettings.query, self._querySettings.options, 'and', {})) { filteredData.push(data[i]); doSend = true; } } } else { if (self._privateData._match(data, self._querySettings.query, self._querySettings.options, 'and', {})) { filteredData = data; doSend = true; } } if (doSend) { this.chainSend('insert', filteredData); } return true; } if (chainPacket.type === 'update') { // Do a DB diff between this view's data and the underlying collection it reads from // to see if something has changed diff = self._privateData.diff(self._from.subset(self._querySettings.query, self._querySettings.options)); if (diff.insert.length || diff.remove.length) { // Now send out new chain packets for each operation if (diff.insert.length) { this.chainSend('insert', diff.insert); } if (diff.update.length) { pk = self._privateData.primaryKey(); for (i = 0; i < diff.update.length; i++) { query = {}; query[pk] = diff.update[i][pk]; this.chainSend('update', { query: query, update: diff.update[i] }); } } if (diff.remove.length) { pk = self._privateData.primaryKey(); var $or = [], removeQuery = { query: { $or: $or } }; for (i = 0; i < diff.remove.length; i++) { $or.push({_id: diff.remove[i][pk]}); } this.chainSend('remove', removeQuery); } // Return true to stop further propagation of the chain packet return true; } else { // Returning false informs the chain reactor to continue propagation // of the chain packet down the graph tree return false; } } } } // Returning false informs the chain reactor to continue propagation // of the chain packet down the graph tree return false; }); var collData = source.find(this._querySettings.query, this._querySettings.options); this._transformPrimaryKey(source.primaryKey()); this._transformSetData(collData); this._privateData.primaryKey(source.primaryKey()); this._privateData.setData(collData); if (this._querySettings.options && this._querySettings.options.$orderBy) { this.rebuildActiveBucket(this._querySettings.options.$orderBy); } else { this.rebuildActiveBucket(); } return this; } return this._from; }; /** * Handles when an underlying collection the view is using as a data * source is dropped. * @param {Collection} collection The collection that has been dropped. * @private */ View.prototype._collectionDropped = function (collection) { if (collection) { // Collection was dropped, remove from view delete this._from; } }; /** * Creates an index on the view. * @see Collection::ensureIndex() * @returns {*} */ View.prototype.ensureIndex = function () { return this._privateData.ensureIndex.apply(this._privateData, arguments); }; /** * The chain reaction handler method for the view. * @param {Object} chainPacket The chain reaction packet to handle. * @private */ View.prototype._chainHandler = function (chainPacket) { var //self = this, arr, count, index, insertIndex, //tempData, //dataIsArray, updates, //finalUpdates, primaryKey, tQuery, item, currentIndex, i; if (this.debug()) { console.log(this.logIdentifier() + ' Received chain reactor data'); } switch (chainPacket.type) { case 'setData': if (this.debug()) { console.log(this.logIdentifier() + ' Setting data in underlying (internal) view collection "' + this._privateData.name() + '"'); } // Get the new data from our underlying data source sorted as we want var collData = this._from.find(this._querySettings.query, this._querySettings.options); // Modify transform data this._transformSetData(collData); this._privateData.setData(collData); break; case 'insert': if (this.debug()) { console.log(this.logIdentifier() + ' Inserting some data into underlying (internal) view collection "' + this._privateData.name() + '"'); } // Decouple the data to ensure we are working with our own copy chainPacket.data = this.decouple(chainPacket.data); // Make sure we are working with an array if (!(chainPacket.data instanceof Array)) { chainPacket.data = [chainPacket.data]; } if (this._querySettings.options && this._querySettings.options.$orderBy) { // Loop the insert data and find each item's index arr = chainPacket.data; count = arr.length; for (index = 0; index < count; index++) { insertIndex = this._activeBucket.insert(arr[index]); // Modify transform data this._transformInsert(chainPacket.data, insertIndex); this._privateData._insertHandle(chainPacket.data, insertIndex); } } else { // Set the insert index to the passed index, or if none, the end of the view data array insertIndex = this._privateData._data.length; // Modify transform data this._transformInsert(chainPacket.data, insertIndex); this._privateData._insertHandle(chainPacket.data, insertIndex); } break; case 'update': if (this.debug()) { console.log(this.logIdentifier() + ' Updating some data in underlying (internal) view collection "' + this._privateData.name() + '"'); } primaryKey = this._privateData.primaryKey(); // Do the update updates = this._privateData.update( chainPacket.data.query, chainPacket.data.update, chainPacket.data.options ); if (this._querySettings.options && this._querySettings.options.$orderBy) { // TODO: This would be a good place to improve performance by somehow // TODO: inspecting the change that occurred when update was performed // TODO: above and determining if it affected the order clause keys // TODO: and if not, skipping the active bucket updates here // Loop the updated items and work out their new sort locations count = updates.length; for (index = 0; index < count; index++) { item = updates[index]; // Remove the item from the active bucket (via it's id) this._activeBucket.remove(item); // Get the current location of the item currentIndex = this._privateData._data.indexOf(item); // Add the item back in to the active bucket insertIndex = this._activeBucket.insert(item); if (currentIndex !== insertIndex) { // Move the updated item to the new index this._privateData._updateSpliceMove(this._privateData._data, currentIndex, insertIndex); } } } if (this._transformEnabled && this._transformIn) { primaryKey = this._publicData.primaryKey(); for (i = 0; i < updates.length; i++) { tQuery = {}; item = updates[i]; tQuery[primaryKey] = item[primaryKey]; this._transformUpdate(tQuery, item); } } break; case 'remove': if (this.debug()) { console.log(this.logIdentifier() + ' Removing some data from underlying (internal) view collection "' + this._privateData.name() + '"'); } // Modify transform data this._transformRemove(chainPacket.data.query, chainPacket.options); this._privateData.remove(chainPacket.data.query, chainPacket.options); break; default: break; } }; /** * Listens for an event. * @see Mixin.Events::on() */ View.prototype.on = function () { return this._privateData.on.apply(this._privateData, arguments); }; /** * Cancels an event listener. * @see Mixin.Events::off() */ View.prototype.off = function () { return this._privateData.off.apply(this._privateData, arguments); }; /** * Emits an event. * @see Mixin.Events::emit() */ View.prototype.emit = function () { return this._privateData.emit.apply(this._privateData, arguments); }; /** * Find the distinct values for a specified field across a single collection and * returns the results in an array. * @param {String} key The field path to return distinct values for e.g. "person.name". * @param {Object=} query The query to use to filter the documents used to return values from. * @param {Object=} options The query options to use when running the query. * @returns {Array} */ View.prototype.distinct = function (key, query, options) { return this._privateData.distinct.apply(this._privateData, arguments); }; /** * Gets the primary key for this view from the assigned collection. * @see Collection::primaryKey() * @returns {String} */ View.prototype.primaryKey = function () { return this._privateData.primaryKey(); }; /** * Drops a view and all it's stored data from the database. * @returns {boolean} True on success, false on failure. */ View.prototype.drop = function () { if (!this.isDropped()) { if (this._from) { this._from.off('drop', this._collectionDroppedWrap); this._from._removeView(this); if (this.debug() || (this._db && this._db.debug())) { console.log(this.logIdentifier() + ' Dropping'); } this._state = 'dropped'; // Clear io and chains if (this._io) { this._io.drop(); } // Drop the view's internal collection if (this._privateData) { this._privateData.drop(); } if (this._db && this._name) { delete this._db._view[this._name]; } this.emit('drop', this); delete this._chain; delete this._from; delete this._privateData; delete this._io; delete this._listeners; delete this._querySettings; delete this._db; return true; } } else { return true; } return false; }; /** * Gets / sets the db instance this class instance belongs to. * @param {Db=} db The db instance. * @memberof View * @returns {*} */ Shared.synthesize(View.prototype, 'db', function (db) { if (db) { this.privateData().db(db); this.publicData().db(db); // Apply the same debug settings this.debug(db.debug()); this.privateData().debug(db.debug()); this.publicData().debug(db.debug()); } return this.$super.apply(this, arguments); }); /** * Gets / sets the query object and query options that the view uses * to build it's data set. This call modifies both the query and * query options at the same time. * @param {Object=} query The query to set. * @param {Boolean=} options The query options object. * @param {Boolean=} refresh Whether to refresh the view data after * this operation. Defaults to true. * @returns {*} */ View.prototype.queryData = function (query, options, refresh) { if (query !== undefined) { this._querySettings.query = query; } if (options !== undefined) { this._querySettings.options = options; } if (query !== undefined || options !== undefined) { if (refresh === undefined || refresh === true) { this.refresh(); } return this; } return this._querySettings; }; /** * Add data to the existing query. * @param {Object} obj The data whose keys will be added to the existing * query object. * @param {Boolean} overwrite Whether or not to overwrite data that already * exists in the query object. Defaults to true. * @param {Boolean=} refresh Whether or not to refresh the view data set * once the operation is complete. Defaults to true. */ View.prototype.queryAdd = function (obj, overwrite, refresh) { this._querySettings.query = this._querySettings.query || {}; var query = this._querySettings.query, i; if (obj !== undefined) { // Loop object properties and add to existing query for (i in obj) { if (obj.hasOwnProperty(i)) { if (query[i] === undefined || (query[i] !== undefined && overwrite !== false)) { query[i] = obj[i]; } } } } if (refresh === undefined || refresh === true) { this.refresh(); } }; /** * Remove data from the existing query. * @param {Object} obj The data whose keys will be removed from the existing * query object. * @param {Boolean=} refresh Whether or not to refresh the view data set * once the operation is complete. Defaults to true. */ View.prototype.queryRemove = function (obj, refresh) { var query = this._querySettings.query, i; if (query) { if (obj !== undefined) { // Loop object properties and add to existing query for (i in obj) { if (obj.hasOwnProperty(i)) { delete query[i]; } } } if (refresh === undefined || refresh === true) { this.refresh(); } } }; /** * Gets / sets the query being used to generate the view data. It * does not change or modify the view's query options. * @param {Object=} query The query to set. * @param {Boolean=} refresh Whether to refresh the view data after * this operation. Defaults to true. * @returns {*} */ View.prototype.query = function (query, refresh) { if (query !== undefined) { this._querySettings.query = query; if (refresh === undefined || refresh === true) { this.refresh(); } return this; } return this._querySettings.query; }; /** * Gets / sets the orderBy clause in the query options for the view. * @param {Object=} val The order object. * @returns {*} */ View.prototype.orderBy = function (val) { if (val !== undefined) { var queryOptions = this.queryOptions() || {}; queryOptions.$orderBy = val; this.queryOptions(queryOptions); return this; } return (this.queryOptions() || {}).$orderBy; }; /** * Gets / sets the page clause in the query options for the view. * @param {Number=} val The page number to change to (zero index). * @returns {*} */ View.prototype.page = function (val) { if (val !== undefined) { var queryOptions = this.queryOptions() || {}; // Only execute a query options update if page has changed if (val !== queryOptions.$page) { queryOptions.$page = val; this.queryOptions(queryOptions); } return this; } return (this.queryOptions() || {}).$page; }; /** * Jump to the first page in the data set. * @returns {*} */ View.prototype.pageFirst = function () { return this.page(0); }; /** * Jump to the last page in the data set. * @returns {*} */ View.prototype.pageLast = function () { var pages = this.cursor().pages, lastPage = pages !== undefined ? pages : 0; return this.page(lastPage - 1); }; /** * Move forward or backwards in the data set pages by passing a positive * or negative integer of the number of pages to move. * @param {Number} val The number of pages to move. * @returns {*} */ View.prototype.pageScan = function (val) { if (val !== undefined) { var pages = this.cursor().pages, queryOptions = this.queryOptions() || {}, currentPage = queryOptions.$page !== undefined ? queryOptions.$page : 0; currentPage += val; if (currentPage < 0) { currentPage = 0; } if (currentPage >= pages) { currentPage = pages - 1; } return this.page(currentPage); } }; /** * Gets / sets the query options used when applying sorting etc to the * view data set. * @param {Object=} options An options object. * @param {Boolean=} refresh Whether to refresh the view data after * this operation. Defaults to true. * @returns {*} */ View.prototype.queryOptions = function (options, refresh) { if (options !== undefined) { this._querySettings.options = options; if (options.$decouple === undefined) { options.$decouple = true; } if (refresh === undefined || refresh === true) { this.refresh(); } else { this.rebuildActiveBucket(options.$orderBy); } return this; } return this._querySettings.options; }; View.prototype.rebuildActiveBucket = function (orderBy) { if (orderBy) { var arr = this._privateData._data, arrCount = arr.length; // Build a new active bucket this._activeBucket = new ActiveBucket(orderBy); this._activeBucket.primaryKey(this._privateData.primaryKey()); // Loop the current view data and add each item for (var i = 0; i < arrCount; i++) { this._activeBucket.insert(arr[i]); } } else { // Remove any existing active bucket delete this._activeBucket; } }; /** * Refreshes the view data such as ordering etc. */ View.prototype.refresh = function () { if (this._from) { var pubData = this.publicData(), refreshResults; // Re-grab all the data for the view from the collection this._privateData.remove(); pubData.remove(); refreshResults = this._from.find(this._querySettings.query, this._querySettings.options); this.cursor(refreshResults.$cursor); this._privateData.insert(refreshResults); this._privateData._data.$cursor = refreshResults.$cursor; pubData._data.$cursor = refreshResults.$cursor; /*if (pubData._linked) { // Update data and observers //var transformedData = this._privateData.find(); // TODO: Shouldn't this data get passed into a transformIn first? // TODO: This breaks linking because its passing decoupled data and overwriting non-decoupled data // TODO: Is this even required anymore? After commenting it all seems to work // TODO: Might be worth setting up a test to check transforms and linking then remove this if working? //jQuery.observable(pubData._data).refresh(transformedData); }*/ } if (this._querySettings.options && this._querySettings.options.$orderBy) { this.rebuildActiveBucket(this._querySettings.options.$orderBy); } else { this.rebuildActiveBucket(); } return this; }; /** * Returns the number of documents currently in the view. * @returns {Number} */ View.prototype.count = function () { if (this.publicData()) { return this.publicData().count.apply(this.publicData(), arguments); } return 0; }; // Call underlying View.prototype.subset = function () { return this.publicData().subset.apply(this._privateData, arguments); }; /** * Takes the passed data and uses it to set transform methods and globally * enable or disable the transform system for the view. * @param {Object} obj The new transform system settings "enabled", "dataIn" and "dataOut": * { * "enabled": true, * "dataIn": function (data) { return data; }, * "dataOut": function (data) { return data; } * } * @returns {*} */ View.prototype.transform = function (obj) { if (obj !== undefined) { if (typeof obj === "object") { if (obj.enabled !== undefined) { this._transformEnabled = obj.enabled; } if (obj.dataIn !== undefined) { this._transformIn = obj.dataIn; } if (obj.dataOut !== undefined) { this._transformOut = obj.dataOut; } } else { this._transformEnabled = obj !== false; } // Update the transformed data object this._transformPrimaryKey(this.privateData().primaryKey()); this._transformSetData(this.privateData().find()); return this; } return { enabled: this._transformEnabled, dataIn: this._transformIn, dataOut: this._transformOut }; }; /** * Executes a method against each document that matches query and returns an * array of documents that may have been modified by the method. * @param {Object} query The query object. * @param {Function} func The method that each document is passed to. If this method * returns false for a particular document it is excluded from the results. * @param {Object=} options Optional options object. * @returns {Array} */ View.prototype.filter = function (query, func, options) { return (this.publicData()).filter(query, func, options); }; /** * Returns the non-transformed data the view holds as a collection * reference. * @return {Collection} The non-transformed collection reference. */ View.prototype.privateData = function () { return this._privateData; }; /** * Returns a data object representing the public data this view * contains. This can change depending on if transforms are being * applied to the view or not. * * If no transforms are applied then the public data will be the * same as the private data the view holds. If transforms are * applied then the public data will contain the transformed version * of the private data. * * The public data collection is also used by data binding to only * changes to the publicData will show in a data-bound element. */ View.prototype.publicData = function () { if (this._transformEnabled) { return this._publicData; } else { return this._privateData; } }; /** * Updates the public data object to match data from the private data object * by running private data through the dataIn method provided in * the transform() call. * @private */ View.prototype._transformSetData = function (data) { if (this._transformEnabled) { // Clear existing data this._publicData = new Collection('__FDB__view_publicData_' + this._name); this._publicData.db(this._privateData._db); this._publicData.transform({ enabled: true, dataIn: this._transformIn, dataOut: this._transformOut }); this._publicData.setData(data); } }; View.prototype._transformInsert = function (data, index) { if (this._transformEnabled && this._publicData) { this._publicData.insert(data, index); } }; View.prototype._transformUpdate = function (query, update, options) { if (this._transformEnabled && this._publicData) { this._publicData.update(query, update, options); } }; View.prototype._transformRemove = function (query, options) { if (this._transformEnabled && this._publicData) { this._publicData.remove(query, options); } }; View.prototype._transformPrimaryKey = function (key) { if (this._transformEnabled && this._publicData) { this._publicData.primaryKey(key); } }; // Extend collection with view init Collection.prototype.init = function () { this._view = []; CollectionInit.apply(this, arguments); }; /** * Creates a view and assigns the collection as its data source. * @param {String} name The name of the new view. * @param {Object} query The query to apply to the new view. * @param {Object} options The options object to apply to the view. * @returns {*} */ Collection.prototype.view = function (name, query, options) { if (this._db && this._db._view ) { if (!this._db._view[name]) { var view = new View(name, query, options) .db(this._db) .from(this); this._view = this._view || []; this._view.push(view); return view; } else { throw(this.logIdentifier() + ' Cannot create a view using this collection because a view with this name already exists: ' + name); } } }; /** * Adds a view to the internal view lookup. * @param {View} view The view to add. * @returns {Collection} * @private */ Collection.prototype._addView = CollectionGroup.prototype._addView = function (view) { if (view !== undefined) { this._view.push(view); } return this; }; /** * Removes a view from the internal view lookup. * @param {View} view The view to remove. * @returns {Collection} * @private */ Collection.prototype._removeView = CollectionGroup.prototype._removeView = function (view) { if (view !== undefined) { var index = this._view.indexOf(view); if (index > -1) { this._view.splice(index, 1); } } return this; }; // Extend DB with views init Db.prototype.init = function () { this._view = {}; DbInit.apply(this, arguments); }; /** * Gets a view by it's name. * @param {String} viewName The name of the view to retrieve. * @returns {*} */ Db.prototype.view = function (viewName) { // Handle being passed an instance if (viewName instanceof View) { return viewName; } if (!this._view[viewName]) { if (this.debug() || (this._db && this._db.debug())) { console.log(this.logIdentifier() + ' Creating view ' + viewName); } } this._view[viewName] = this._view[viewName] || new View(viewName).db(this); return this._view[viewName]; }; /** * Determine if a view with the passed name already exists. * @param {String} viewName The name of the view to check for. * @returns {boolean} */ Db.prototype.viewExists = function (viewName) { return Boolean(this._view[viewName]); }; /** * Returns an array of views the DB currently has. * @returns {Array} An array of objects containing details of each view * the database is currently managing. */ Db.prototype.views = function () { var arr = [], view, i; for (i in this._view) { if (this._view.hasOwnProperty(i)) { view = this._view[i]; arr.push({ name: i, count: view.count(), linked: view.isLinked !== undefined ? view.isLinked() : false }); } } return arr; }; Shared.finishModule('View'); module.exports = View; },{"./ActiveBucket":2,"./Collection":4,"./CollectionGroup":5,"./ReactorIO":34,"./Shared":35}],37:[function(_dereq_,module,exports){ (function (process){ /*! * async * https://github.com/caolan/async * * Copyright 2010-2014 Caolan McMahon * Released under the MIT license */ /*jshint onevar: false, indent:4 */ /*global setImmediate: false, setTimeout: false, console: false */ (function () { var async = {}; // global on the server, window in the browser var root, previous_async; root = this; if (root != null) { previous_async = root.async; } async.noConflict = function () { root.async = previous_async; return async; }; function only_once(fn) { var called = false; return function() { if (called) throw new Error("Callback was already called."); called = true; fn.apply(root, arguments); } } //// cross-browser compatiblity functions //// var _toString = Object.prototype.toString; var _isArray = Array.isArray || function (obj) { return _toString.call(obj) === '[object Array]'; }; var _each = function (arr, iterator) { for (var i = 0; i < arr.length; i += 1) { iterator(arr[i], i, arr); } }; var _map = function (arr, iterator) { if (arr.map) { return arr.map(iterator); } var results = []; _each(arr, function (x, i, a) { results.push(iterator(x, i, a)); }); return results; }; var _reduce = function (arr, iterator, memo) { if (arr.reduce) { return arr.reduce(iterator, memo); } _each(arr, function (x, i, a) { memo = iterator(memo, x, i, a); }); return memo; }; var _keys = function (obj) { if (Object.keys) { return Object.keys(obj); } var keys = []; for (var k in obj) { if (obj.hasOwnProperty(k)) { keys.push(k); } } return keys; }; //// exported async module functions //// //// nextTick implementation with browser-compatible fallback //// if (typeof process === 'undefined' || !(process.nextTick)) { if (typeof setImmediate === 'function') { async.nextTick = function (fn) { // not a direct alias for IE10 compatibility setImmediate(fn); }; async.setImmediate = async.nextTick; } else { async.nextTick = function (fn) { setTimeout(fn, 0); }; async.setImmediate = async.nextTick; } } else { async.nextTick = process.nextTick; if (typeof setImmediate !== 'undefined') { async.setImmediate = function (fn) { // not a direct alias for IE10 compatibility setImmediate(fn); }; } else { async.setImmediate = async.nextTick; } } async.each = function (arr, iterator, callback) { callback = callback || function () {}; if (!arr.length) { return callback(); } var completed = 0; _each(arr, function (x) { iterator(x, only_once(done) ); }); function done(err) { if (err) { callback(err); callback = function () {}; } else { completed += 1; if (completed >= arr.length) { callback(); } } } }; async.forEach = async.each; async.eachSeries = function (arr, iterator, callback) { callback = callback || function () {}; if (!arr.length) { return callback(); } var completed = 0; var iterate = function () { iterator(arr[completed], function (err) { if (err) { callback(err); callback = function () {}; } else { completed += 1; if (completed >= arr.length) { callback(); } else { iterate(); } } }); }; iterate(); }; async.forEachSeries = async.eachSeries; async.eachLimit = function (arr, limit, iterator, callback) { var fn = _eachLimit(limit); fn.apply(null, [arr, iterator, callback]); }; async.forEachLimit = async.eachLimit; var _eachLimit = function (limit) { return function (arr, iterator, callback) { callback = callback || function () {}; if (!arr.length || limit <= 0) { return callback(); } var completed = 0; var started = 0; var running = 0; (function replenish () { if (completed >= arr.length) { return callback(); } while (running < limit && started < arr.length) { started += 1; running += 1; iterator(arr[started - 1], function (err) { if (err) { callback(err); callback = function () {}; } else { completed += 1; running -= 1; if (completed >= arr.length) { callback(); } else { replenish(); } } }); } })(); }; }; var doParallel = function (fn) { return function () { var args = Array.prototype.slice.call(arguments); return fn.apply(null, [async.each].concat(args)); }; }; var doParallelLimit = function(limit, fn) { return function () { var args = Array.prototype.slice.call(arguments); return fn.apply(null, [_eachLimit(limit)].concat(args)); }; }; var doSeries = function (fn) { return function () { var args = Array.prototype.slice.call(arguments); return fn.apply(null, [async.eachSeries].concat(args)); }; }; var _asyncMap = function (eachfn, arr, iterator, callback) { arr = _map(arr, function (x, i) { return {index: i, value: x}; }); if (!callback) { eachfn(arr, function (x, callback) { iterator(x.value, function (err) { callback(err); }); }); } else { var results = []; eachfn(arr, function (x, callback) { iterator(x.value, function (err, v) { results[x.index] = v; callback(err); }); }, function (err) { callback(err, results); }); } }; async.map = doParallel(_asyncMap); async.mapSeries = doSeries(_asyncMap); async.mapLimit = function (arr, limit, iterator, callback) { return _mapLimit(limit)(arr, iterator, callback); }; var _mapLimit = function(limit) { return doParallelLimit(limit, _asyncMap); }; // reduce only has a series version, as doing reduce in parallel won't // work in many situations. async.reduce = function (arr, memo, iterator, callback) { async.eachSeries(arr, function (x, callback) { iterator(memo, x, function (err, v) { memo = v; callback(err); }); }, function (err) { callback(err, memo); }); }; // inject alias async.inject = async.reduce; // foldl alias async.foldl = async.reduce; async.reduceRight = function (arr, memo, iterator, callback) { var reversed = _map(arr, function (x) { return x; }).reverse(); async.reduce(reversed, memo, iterator, callback); }; // foldr alias async.foldr = async.reduceRight; var _filter = function (eachfn, arr, iterator, callback) { var results = []; arr = _map(arr, function (x, i) { return {index: i, value: x}; }); eachfn(arr, function (x, callback) { iterator(x.value, function (v) { if (v) { results.push(x); } callback(); }); }, function (err) { callback(_map(results.sort(function (a, b) { return a.index - b.index; }), function (x) { return x.value; })); }); }; async.filter = doParallel(_filter); async.filterSeries = doSeries(_filter); // select alias async.select = async.filter; async.selectSeries = async.filterSeries; var _reject = function (eachfn, arr, iterator, callback) { var results = []; arr = _map(arr, function (x, i) { return {index: i, value: x}; }); eachfn(arr, function (x, callback) { iterator(x.value, function (v) { if (!v) { results.push(x); } callback(); }); }, function (err) { callback(_map(results.sort(function (a, b) { return a.index - b.index; }), function (x) { return x.value; })); }); }; async.reject = doParallel(_reject); async.rejectSeries = doSeries(_reject); var _detect = function (eachfn, arr, iterator, main_callback) { eachfn(arr, function (x, callback) { iterator(x, function (result) { if (result) { main_callback(x); main_callback = function () {}; } else { callback(); } }); }, function (err) { main_callback(); }); }; async.detect = doParallel(_detect); async.detectSeries = doSeries(_detect); async.some = function (arr, iterator, main_callback) { async.each(arr, function (x, callback) { iterator(x, function (v) { if (v) { main_callback(true); main_callback = function () {}; } callback(); }); }, function (err) { main_callback(false); }); }; // any alias async.any = async.some; async.every = function (arr, iterator, main_callback) { async.each(arr, function (x, callback) { iterator(x, function (v) { if (!v) { main_callback(false); main_callback = function () {}; } callback(); }); }, function (err) { main_callback(true); }); }; // all alias async.all = async.every; async.sortBy = function (arr, iterator, callback) { async.map(arr, function (x, callback) { iterator(x, function (err, criteria) { if (err) { callback(err); } else { callback(null, {value: x, criteria: criteria}); } }); }, function (err, results) { if (err) { return callback(err); } else { var fn = function (left, right) { var a = left.criteria, b = right.criteria; return a < b ? -1 : a > b ? 1 : 0; }; callback(null, _map(results.sort(fn), function (x) { return x.value; })); } }); }; async.auto = function (tasks, callback) { callback = callback || function () {}; var keys = _keys(tasks); var remainingTasks = keys.length if (!remainingTasks) { return callback(); } var results = {}; var listeners = []; var addListener = function (fn) { listeners.unshift(fn); }; var removeListener = function (fn) { for (var i = 0; i < listeners.length; i += 1) { if (listeners[i] === fn) { listeners.splice(i, 1); return; } } }; var taskComplete = function () { remainingTasks-- _each(listeners.slice(0), function (fn) { fn(); }); }; addListener(function () { if (!remainingTasks) { var theCallback = callback; // prevent final callback from calling itself if it errors callback = function () {}; theCallback(null, results); } }); _each(keys, function (k) { var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]]; var taskCallback = function (err) { var args = Array.prototype.slice.call(arguments, 1); if (args.length <= 1) { args = args[0]; } if (err) { var safeResults = {}; _each(_keys(results), function(rkey) { safeResults[rkey] = results[rkey]; }); safeResults[k] = args; callback(err, safeResults); // stop subsequent errors hitting callback multiple times callback = function () {}; } else { results[k] = args; async.setImmediate(taskComplete); } }; var requires = task.slice(0, Math.abs(task.length - 1)) || []; var ready = function () { return _reduce(requires, function (a, x) { return (a && results.hasOwnProperty(x)); }, true) && !results.hasOwnProperty(k); }; if (ready()) { task[task.length - 1](taskCallback, results); } else { var listener = function () { if (ready()) { removeListener(listener); task[task.length - 1](taskCallback, results); } }; addListener(listener); } }); }; async.retry = function(times, task, callback) { var DEFAULT_TIMES = 5; var attempts = []; // Use defaults if times not passed if (typeof times === 'function') { callback = task; task = times; times = DEFAULT_TIMES; } // Make sure times is a number times = parseInt(times, 10) || DEFAULT_TIMES; var wrappedTask = function(wrappedCallback, wrappedResults) { var retryAttempt = function(task, finalAttempt) { return function(seriesCallback) { task(function(err, result){ seriesCallback(!err || finalAttempt, {err: err, result: result}); }, wrappedResults); }; }; while (times) { attempts.push(retryAttempt(task, !(times-=1))); } async.series(attempts, function(done, data){ data = data[data.length - 1]; (wrappedCallback || callback)(data.err, data.result); }); } // If a callback is passed, run this as a controll flow return callback ? wrappedTask() : wrappedTask }; async.waterfall = function (tasks, callback) { callback = callback || function () {}; if (!_isArray(tasks)) { var err = new Error('First argument to waterfall must be an array of functions'); return callback(err); } if (!tasks.length) { return callback(); } var wrapIterator = function (iterator) { return function (err) { if (err) { callback.apply(null, arguments); callback = function () {}; } else { var args = Array.prototype.slice.call(arguments, 1); var next = iterator.next(); if (next) { args.push(wrapIterator(next)); } else { args.push(callback); } async.setImmediate(function () { iterator.apply(null, args); }); } }; }; wrapIterator(async.iterator(tasks))(); }; var _parallel = function(eachfn, tasks, callback) { callback = callback || function () {}; if (_isArray(tasks)) { eachfn.map(tasks, function (fn, callback) { if (fn) { fn(function (err) { var args = Array.prototype.slice.call(arguments, 1); if (args.length <= 1) { args = args[0]; } callback.call(null, err, args); }); } }, callback); } else { var results = {}; eachfn.each(_keys(tasks), function (k, callback) { tasks[k](function (err) { var args = Array.prototype.slice.call(arguments, 1); if (args.length <= 1) { args = args[0]; } results[k] = args; callback(err); }); }, function (err) { callback(err, results); }); } }; async.parallel = function (tasks, callback) { _parallel({ map: async.map, each: async.each }, tasks, callback); }; async.parallelLimit = function(tasks, limit, callback) { _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback); }; async.series = function (tasks, callback) { callback = callback || function () {}; if (_isArray(tasks)) { async.mapSeries(tasks, function (fn, callback) { if (fn) { fn(function (err) { var args = Array.prototype.slice.call(arguments, 1); if (args.length <= 1) { args = args[0]; } callback.call(null, err, args); }); } }, callback); } else { var results = {}; async.eachSeries(_keys(tasks), function (k, callback) { tasks[k](function (err) { var args = Array.prototype.slice.call(arguments, 1); if (args.length <= 1) { args = args[0]; } results[k] = args; callback(err); }); }, function (err) { callback(err, results); }); } }; async.iterator = function (tasks) { var makeCallback = function (index) { var fn = function () { if (tasks.length) { tasks[index].apply(null, arguments); } return fn.next(); }; fn.next = function () { return (index < tasks.length - 1) ? makeCallback(index + 1): null; }; return fn; }; return makeCallback(0); }; async.apply = function (fn) { var args = Array.prototype.slice.call(arguments, 1); return function () { return fn.apply( null, args.concat(Array.prototype.slice.call(arguments)) ); }; }; var _concat = function (eachfn, arr, fn, callback) { var r = []; eachfn(arr, function (x, cb) { fn(x, function (err, y) { r = r.concat(y || []); cb(err); }); }, function (err) { callback(err, r); }); }; async.concat = doParallel(_concat); async.concatSeries = doSeries(_concat); async.whilst = function (test, iterator, callback) { if (test()) { iterator(function (err) { if (err) { return callback(err); } async.whilst(test, iterator, callback); }); } else { callback(); } }; async.doWhilst = function (iterator, test, callback) { iterator(function (err) { if (err) { return callback(err); } var args = Array.prototype.slice.call(arguments, 1); if (test.apply(null, args)) { async.doWhilst(iterator, test, callback); } else { callback(); } }); }; async.until = function (test, iterator, callback) { if (!test()) { iterator(function (err) { if (err) { return callback(err); } async.until(test, iterator, callback); }); } else { callback(); } }; async.doUntil = function (iterator, test, callback) { iterator(function (err) { if (err) { return callback(err); } var args = Array.prototype.slice.call(arguments, 1); if (!test.apply(null, args)) { async.doUntil(iterator, test, callback); } else { callback(); } }); }; async.queue = function (worker, concurrency) { if (concurrency === undefined) { concurrency = 1; } function _insert(q, data, pos, callback) { if (!q.started){ q.started = true; } if (!_isArray(data)) { data = [data]; } if(data.length == 0) { // call drain immediately if there are no tasks return async.setImmediate(function() { if (q.drain) { q.drain(); } }); } _each(data, function(task) { var item = { data: task, callback: typeof callback === 'function' ? callback : null }; if (pos) { q.tasks.unshift(item); } else { q.tasks.push(item); } if (q.saturated && q.tasks.length === q.concurrency) { q.saturated(); } async.setImmediate(q.process); }); } var workers = 0; var q = { tasks: [], concurrency: concurrency, saturated: null, empty: null, drain: null, started: false, paused: false, push: function (data, callback) { _insert(q, data, false, callback); }, kill: function () { q.drain = null; q.tasks = []; }, unshift: function (data, callback) { _insert(q, data, true, callback); }, process: function () { if (!q.paused && workers < q.concurrency && q.tasks.length) { var task = q.tasks.shift(); if (q.empty && q.tasks.length === 0) { q.empty(); } workers += 1; var next = function () { workers -= 1; if (task.callback) { task.callback.apply(task, arguments); } if (q.drain && q.tasks.length + workers === 0) { q.drain(); } q.process(); }; var cb = only_once(next); worker(task.data, cb); } }, length: function () { return q.tasks.length; }, running: function () { return workers; }, idle: function() { return q.tasks.length + workers === 0; }, pause: function () { if (q.paused === true) { return; } q.paused = true; }, resume: function () { if (q.paused === false) { return; } q.paused = false; // Need to call q.process once per concurrent // worker to preserve full concurrency after pause for (var w = 1; w <= q.concurrency; w++) { async.setImmediate(q.process); } } }; return q; }; async.priorityQueue = function (worker, concurrency) { function _compareTasks(a, b){ return a.priority - b.priority; }; function _binarySearch(sequence, item, compare) { var beg = -1, end = sequence.length - 1; while (beg < end) { var mid = beg + ((end - beg + 1) >>> 1); if (compare(item, sequence[mid]) >= 0) { beg = mid; } else { end = mid - 1; } } return beg; } function _insert(q, data, priority, callback) { if (!q.started){ q.started = true; } if (!_isArray(data)) { data = [data]; } if(data.length == 0) { // call drain immediately if there are no tasks return async.setImmediate(function() { if (q.drain) { q.drain(); } }); } _each(data, function(task) { var item = { data: task, priority: priority, callback: typeof callback === 'function' ? callback : null }; q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item); if (q.saturated && q.tasks.length === q.concurrency) { q.saturated(); } async.setImmediate(q.process); }); } // Start with a normal queue var q = async.queue(worker, concurrency); // Override push to accept second parameter representing priority q.push = function (data, priority, callback) { _insert(q, data, priority, callback); }; // Remove unshift function delete q.unshift; return q; }; async.cargo = function (worker, payload) { var working = false, tasks = []; var cargo = { tasks: tasks, payload: payload, saturated: null, empty: null, drain: null, drained: true, push: function (data, callback) { if (!_isArray(data)) { data = [data]; } _each(data, function(task) { tasks.push({ data: task, callback: typeof callback === 'function' ? callback : null }); cargo.drained = false; if (cargo.saturated && tasks.length === payload) { cargo.saturated(); } }); async.setImmediate(cargo.process); }, process: function process() { if (working) return; if (tasks.length === 0) { if(cargo.drain && !cargo.drained) cargo.drain(); cargo.drained = true; return; } var ts = typeof payload === 'number' ? tasks.splice(0, payload) : tasks.splice(0, tasks.length); var ds = _map(ts, function (task) { return task.data; }); if(cargo.empty) cargo.empty(); working = true; worker(ds, function () { working = false; var args = arguments; _each(ts, function (data) { if (data.callback) { data.callback.apply(null, args); } }); process(); }); }, length: function () { return tasks.length; }, running: function () { return working; } }; return cargo; }; var _console_fn = function (name) { return function (fn) { var args = Array.prototype.slice.call(arguments, 1); fn.apply(null, args.concat([function (err) { var args = Array.prototype.slice.call(arguments, 1); if (typeof console !== 'undefined') { if (err) { if (console.error) { console.error(err); } } else if (console[name]) { _each(args, function (x) { console[name](x); }); } } }])); }; }; async.log = _console_fn('log'); async.dir = _console_fn('dir'); /*async.info = _console_fn('info'); async.warn = _console_fn('warn'); async.error = _console_fn('error');*/ async.memoize = function (fn, hasher) { var memo = {}; var queues = {}; hasher = hasher || function (x) { return x; }; var memoized = function () { var args = Array.prototype.slice.call(arguments); var callback = args.pop(); var key = hasher.apply(null, args); if (key in memo) { async.nextTick(function () { callback.apply(null, memo[key]); }); } else if (key in queues) { queues[key].push(callback); } else { queues[key] = [callback]; fn.apply(null, args.concat([function () { memo[key] = arguments; var q = queues[key]; delete queues[key]; for (var i = 0, l = q.length; i < l; i++) { q[i].apply(null, arguments); } }])); } }; memoized.memo = memo; memoized.unmemoized = fn; return memoized; }; async.unmemoize = function (fn) { return function () { return (fn.unmemoized || fn).apply(null, arguments); }; }; async.times = function (count, iterator, callback) { var counter = []; for (var i = 0; i < count; i++) { counter.push(i); } return async.map(counter, iterator, callback); }; async.timesSeries = function (count, iterator, callback) { var counter = []; for (var i = 0; i < count; i++) { counter.push(i); } return async.mapSeries(counter, iterator, callback); }; async.seq = function (/* functions... */) { var fns = arguments; return function () { var that = this; var args = Array.prototype.slice.call(arguments); var callback = args.pop(); async.reduce(fns, args, function (newargs, fn, cb) { fn.apply(that, newargs.concat([function () { var err = arguments[0]; var nextargs = Array.prototype.slice.call(arguments, 1); cb(err, nextargs); }])) }, function (err, results) { callback.apply(that, [err].concat(results)); }); }; }; async.compose = function (/* functions... */) { return async.seq.apply(null, Array.prototype.reverse.call(arguments)); }; var _applyEach = function (eachfn, fns /*args...*/) { var go = function () { var that = this; var args = Array.prototype.slice.call(arguments); var callback = args.pop(); return eachfn(fns, function (fn, cb) { fn.apply(that, args.concat([cb])); }, callback); }; if (arguments.length > 2) { var args = Array.prototype.slice.call(arguments, 2); return go.apply(this, args); } else { return go; } }; async.applyEach = doParallel(_applyEach); async.applyEachSeries = doSeries(_applyEach); async.forever = function (fn, callback) { function next(err) { if (err) { if (callback) { return callback(err); } throw err; } fn(next); } next(); }; // Node.js if (typeof module !== 'undefined' && module.exports) { module.exports = async; } // AMD / RequireJS else if (typeof define !== 'undefined' && define.amd) { define([], function () { return async; }); } // included directly via <script> tag else { root.async = async; } }()); }).call(this,_dereq_('_process')) },{"_process":72}],38:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var BlockCipher = C_lib.BlockCipher; var C_algo = C.algo; // Lookup tables var SBOX = []; var INV_SBOX = []; var SUB_MIX_0 = []; var SUB_MIX_1 = []; var SUB_MIX_2 = []; var SUB_MIX_3 = []; var INV_SUB_MIX_0 = []; var INV_SUB_MIX_1 = []; var INV_SUB_MIX_2 = []; var INV_SUB_MIX_3 = []; // Compute lookup tables (function () { // Compute double table var d = []; for (var i = 0; i < 256; i++) { if (i < 128) { d[i] = i << 1; } else { d[i] = (i << 1) ^ 0x11b; } } // Walk GF(2^8) var x = 0; var xi = 0; for (var i = 0; i < 256; i++) { // Compute sbox var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; SBOX[x] = sx; INV_SBOX[sx] = x; // Compute multiplication var x2 = d[x]; var x4 = d[x2]; var x8 = d[x4]; // Compute sub bytes, mix columns tables var t = (d[sx] * 0x101) ^ (sx * 0x1010100); SUB_MIX_0[x] = (t << 24) | (t >>> 8); SUB_MIX_1[x] = (t << 16) | (t >>> 16); SUB_MIX_2[x] = (t << 8) | (t >>> 24); SUB_MIX_3[x] = t; // Compute inv sub bytes, inv mix columns tables var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); INV_SUB_MIX_3[sx] = t; // Compute next counter if (!x) { x = xi = 1; } else { x = x2 ^ d[d[d[x8 ^ x2]]]; xi ^= d[d[xi]]; } } }()); // Precomputed Rcon lookup var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; /** * AES block cipher algorithm. */ var AES = C_algo.AES = BlockCipher.extend({ _doReset: function () { // Shortcuts var key = this._key; var keyWords = key.words; var keySize = key.sigBytes / 4; // Compute number of rounds var nRounds = this._nRounds = keySize + 6 // Compute number of key schedule rows var ksRows = (nRounds + 1) * 4; // Compute key schedule var keySchedule = this._keySchedule = []; for (var ksRow = 0; ksRow < ksRows; ksRow++) { if (ksRow < keySize) { keySchedule[ksRow] = keyWords[ksRow]; } else { var t = keySchedule[ksRow - 1]; if (!(ksRow % keySize)) { // Rot word t = (t << 8) | (t >>> 24); // Sub word t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; // Mix Rcon t ^= RCON[(ksRow / keySize) | 0] << 24; } else if (keySize > 6 && ksRow % keySize == 4) { // Sub word t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; } keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; } } // Compute inv key schedule var invKeySchedule = this._invKeySchedule = []; for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { var ksRow = ksRows - invKsRow; if (invKsRow % 4) { var t = keySchedule[ksRow]; } else { var t = keySchedule[ksRow - 4]; } if (invKsRow < 4 || ksRow <= 4) { invKeySchedule[invKsRow] = t; } else { invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; } } }, encryptBlock: function (M, offset) { this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); }, decryptBlock: function (M, offset) { // Swap 2nd and 4th rows var t = M[offset + 1]; M[offset + 1] = M[offset + 3]; M[offset + 3] = t; this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); // Inv swap 2nd and 4th rows var t = M[offset + 1]; M[offset + 1] = M[offset + 3]; M[offset + 3] = t; }, _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { // Shortcut var nRounds = this._nRounds; // Get input, add round key var s0 = M[offset] ^ keySchedule[0]; var s1 = M[offset + 1] ^ keySchedule[1]; var s2 = M[offset + 2] ^ keySchedule[2]; var s3 = M[offset + 3] ^ keySchedule[3]; // Key schedule row counter var ksRow = 4; // Rounds for (var round = 1; round < nRounds; round++) { // Shift rows, sub bytes, mix columns, add round key var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; // Update state s0 = t0; s1 = t1; s2 = t2; s3 = t3; } // Shift rows, sub bytes, add round key var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; // Set output M[offset] = t0; M[offset + 1] = t1; M[offset + 2] = t2; M[offset + 3] = t3; }, keySize: 256/32 }); /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); */ C.AES = BlockCipher._createHelper(AES); }()); return CryptoJS.AES; })); },{"./cipher-core":39,"./core":40,"./enc-base64":41,"./evpkdf":43,"./md5":48}],39:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * Cipher core components. */ CryptoJS.lib.Cipher || (function (undefined) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var WordArray = C_lib.WordArray; var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; var C_enc = C.enc; var Utf8 = C_enc.Utf8; var Base64 = C_enc.Base64; var C_algo = C.algo; var EvpKDF = C_algo.EvpKDF; /** * Abstract base cipher template. * * @property {number} keySize This cipher's key size. Default: 4 (128 bits) * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. */ var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ /** * Configuration options. * * @property {WordArray} iv The IV to use for this operation. */ cfg: Base.extend(), /** * Creates this cipher in encryption mode. * * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {Cipher} A cipher instance. * * @static * * @example * * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); */ createEncryptor: function (key, cfg) { return this.create(this._ENC_XFORM_MODE, key, cfg); }, /** * Creates this cipher in decryption mode. * * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {Cipher} A cipher instance. * * @static * * @example * * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); */ createDecryptor: function (key, cfg) { return this.create(this._DEC_XFORM_MODE, key, cfg); }, /** * Initializes a newly created cipher. * * @param {number} xformMode Either the encryption or decryption transormation mode constant. * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @example * * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); */ init: function (xformMode, key, cfg) { // Apply config defaults this.cfg = this.cfg.extend(cfg); // Store transform mode and key this._xformMode = xformMode; this._key = key; // Set initial values this.reset(); }, /** * Resets this cipher to its initial state. * * @example * * cipher.reset(); */ reset: function () { // Reset data buffer BufferedBlockAlgorithm.reset.call(this); // Perform concrete-cipher logic this._doReset(); }, /** * Adds data to be encrypted or decrypted. * * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. * * @return {WordArray} The data after processing. * * @example * * var encrypted = cipher.process('data'); * var encrypted = cipher.process(wordArray); */ process: function (dataUpdate) { // Append this._append(dataUpdate); // Process available blocks return this._process(); }, /** * Finalizes the encryption or decryption process. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. * * @return {WordArray} The data after final processing. * * @example * * var encrypted = cipher.finalize(); * var encrypted = cipher.finalize('data'); * var encrypted = cipher.finalize(wordArray); */ finalize: function (dataUpdate) { // Final data update if (dataUpdate) { this._append(dataUpdate); } // Perform concrete-cipher logic var finalProcessedData = this._doFinalize(); return finalProcessedData; }, keySize: 128/32, ivSize: 128/32, _ENC_XFORM_MODE: 1, _DEC_XFORM_MODE: 2, /** * Creates shortcut functions to a cipher's object interface. * * @param {Cipher} cipher The cipher to create a helper for. * * @return {Object} An object with encrypt and decrypt shortcut functions. * * @static * * @example * * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); */ _createHelper: (function () { function selectCipherStrategy(key) { if (typeof key == 'string') { return PasswordBasedCipher; } else { return SerializableCipher; } } return function (cipher) { return { encrypt: function (message, key, cfg) { return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); }, decrypt: function (ciphertext, key, cfg) { return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); } }; }; }()) }); /** * Abstract base stream cipher template. * * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) */ var StreamCipher = C_lib.StreamCipher = Cipher.extend({ _doFinalize: function () { // Process partial blocks var finalProcessedBlocks = this._process(!!'flush'); return finalProcessedBlocks; }, blockSize: 1 }); /** * Mode namespace. */ var C_mode = C.mode = {}; /** * Abstract base block cipher mode template. */ var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ /** * Creates this mode for encryption. * * @param {Cipher} cipher A block cipher instance. * @param {Array} iv The IV words. * * @static * * @example * * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); */ createEncryptor: function (cipher, iv) { return this.Encryptor.create(cipher, iv); }, /** * Creates this mode for decryption. * * @param {Cipher} cipher A block cipher instance. * @param {Array} iv The IV words. * * @static * * @example * * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); */ createDecryptor: function (cipher, iv) { return this.Decryptor.create(cipher, iv); }, /** * Initializes a newly created mode. * * @param {Cipher} cipher A block cipher instance. * @param {Array} iv The IV words. * * @example * * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); */ init: function (cipher, iv) { this._cipher = cipher; this._iv = iv; } }); /** * Cipher Block Chaining mode. */ var CBC = C_mode.CBC = (function () { /** * Abstract base CBC mode. */ var CBC = BlockCipherMode.extend(); /** * CBC encryptor. */ CBC.Encryptor = CBC.extend({ /** * Processes the data block at offset. * * @param {Array} words The data words to operate on. * @param {number} offset The offset where the block starts. * * @example * * mode.processBlock(data.words, offset); */ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; // XOR and encrypt xorBlock.call(this, words, offset, blockSize); cipher.encryptBlock(words, offset); // Remember this block to use with next block this._prevBlock = words.slice(offset, offset + blockSize); } }); /** * CBC decryptor. */ CBC.Decryptor = CBC.extend({ /** * Processes the data block at offset. * * @param {Array} words The data words to operate on. * @param {number} offset The offset where the block starts. * * @example * * mode.processBlock(data.words, offset); */ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; // Remember this block to use with next block var thisBlock = words.slice(offset, offset + blockSize); // Decrypt and XOR cipher.decryptBlock(words, offset); xorBlock.call(this, words, offset, blockSize); // This block becomes the previous block this._prevBlock = thisBlock; } }); function xorBlock(words, offset, blockSize) { // Shortcut var iv = this._iv; // Choose mixing block if (iv) { var block = iv; // Remove IV for subsequent blocks this._iv = undefined; } else { var block = this._prevBlock; } // XOR blocks for (var i = 0; i < blockSize; i++) { words[offset + i] ^= block[i]; } } return CBC; }()); /** * Padding namespace. */ var C_pad = C.pad = {}; /** * PKCS #5/7 padding strategy. */ var Pkcs7 = C_pad.Pkcs7 = { /** * Pads data using the algorithm defined in PKCS #5/7. * * @param {WordArray} data The data to pad. * @param {number} blockSize The multiple that the data should be padded to. * * @static * * @example * * CryptoJS.pad.Pkcs7.pad(wordArray, 4); */ pad: function (data, blockSize) { // Shortcut var blockSizeBytes = blockSize * 4; // Count padding bytes var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Create padding word var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes; // Create padding var paddingWords = []; for (var i = 0; i < nPaddingBytes; i += 4) { paddingWords.push(paddingWord); } var padding = WordArray.create(paddingWords, nPaddingBytes); // Add padding data.concat(padding); }, /** * Unpads data that had been padded using the algorithm defined in PKCS #5/7. * * @param {WordArray} data The data to unpad. * * @static * * @example * * CryptoJS.pad.Pkcs7.unpad(wordArray); */ unpad: function (data) { // Get number of padding bytes from last byte var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; // Remove padding data.sigBytes -= nPaddingBytes; } }; /** * Abstract base block cipher template. * * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) */ var BlockCipher = C_lib.BlockCipher = Cipher.extend({ /** * Configuration options. * * @property {Mode} mode The block mode to use. Default: CBC * @property {Padding} padding The padding strategy to use. Default: Pkcs7 */ cfg: Cipher.cfg.extend({ mode: CBC, padding: Pkcs7 }), reset: function () { // Reset cipher Cipher.reset.call(this); // Shortcuts var cfg = this.cfg; var iv = cfg.iv; var mode = cfg.mode; // Reset block mode if (this._xformMode == this._ENC_XFORM_MODE) { var modeCreator = mode.createEncryptor; } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { var modeCreator = mode.createDecryptor; // Keep at least one block in the buffer for unpadding this._minBufferSize = 1; } this._mode = modeCreator.call(mode, this, iv && iv.words); }, _doProcessBlock: function (words, offset) { this._mode.processBlock(words, offset); }, _doFinalize: function () { // Shortcut var padding = this.cfg.padding; // Finalize if (this._xformMode == this._ENC_XFORM_MODE) { // Pad data padding.pad(this._data, this.blockSize); // Process final blocks var finalProcessedBlocks = this._process(!!'flush'); } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { // Process final blocks var finalProcessedBlocks = this._process(!!'flush'); // Unpad data padding.unpad(finalProcessedBlocks); } return finalProcessedBlocks; }, blockSize: 128/32 }); /** * A collection of cipher parameters. * * @property {WordArray} ciphertext The raw ciphertext. * @property {WordArray} key The key to this ciphertext. * @property {WordArray} iv The IV used in the ciphering operation. * @property {WordArray} salt The salt used with a key derivation function. * @property {Cipher} algorithm The cipher algorithm. * @property {Mode} mode The block mode used in the ciphering operation. * @property {Padding} padding The padding scheme used in the ciphering operation. * @property {number} blockSize The block size of the cipher. * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. */ var CipherParams = C_lib.CipherParams = Base.extend({ /** * Initializes a newly created cipher params object. * * @param {Object} cipherParams An object with any of the possible cipher parameters. * * @example * * var cipherParams = CryptoJS.lib.CipherParams.create({ * ciphertext: ciphertextWordArray, * key: keyWordArray, * iv: ivWordArray, * salt: saltWordArray, * algorithm: CryptoJS.algo.AES, * mode: CryptoJS.mode.CBC, * padding: CryptoJS.pad.PKCS7, * blockSize: 4, * formatter: CryptoJS.format.OpenSSL * }); */ init: function (cipherParams) { this.mixIn(cipherParams); }, /** * Converts this cipher params object to a string. * * @param {Format} formatter (Optional) The formatting strategy to use. * * @return {string} The stringified cipher params. * * @throws Error If neither the formatter nor the default formatter is set. * * @example * * var string = cipherParams + ''; * var string = cipherParams.toString(); * var string = cipherParams.toString(CryptoJS.format.OpenSSL); */ toString: function (formatter) { return (formatter || this.formatter).stringify(this); } }); /** * Format namespace. */ var C_format = C.format = {}; /** * OpenSSL formatting strategy. */ var OpenSSLFormatter = C_format.OpenSSL = { /** * Converts a cipher params object to an OpenSSL-compatible string. * * @param {CipherParams} cipherParams The cipher params object. * * @return {string} The OpenSSL-compatible string. * * @static * * @example * * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); */ stringify: function (cipherParams) { // Shortcuts var ciphertext = cipherParams.ciphertext; var salt = cipherParams.salt; // Format if (salt) { var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); } else { var wordArray = ciphertext; } return wordArray.toString(Base64); }, /** * Converts an OpenSSL-compatible string to a cipher params object. * * @param {string} openSSLStr The OpenSSL-compatible string. * * @return {CipherParams} The cipher params object. * * @static * * @example * * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); */ parse: function (openSSLStr) { // Parse base64 var ciphertext = Base64.parse(openSSLStr); // Shortcut var ciphertextWords = ciphertext.words; // Test for salt if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { // Extract salt var salt = WordArray.create(ciphertextWords.slice(2, 4)); // Remove salt from ciphertext ciphertextWords.splice(0, 4); ciphertext.sigBytes -= 16; } return CipherParams.create({ ciphertext: ciphertext, salt: salt }); } }; /** * A cipher wrapper that returns ciphertext as a serializable cipher params object. */ var SerializableCipher = C_lib.SerializableCipher = Base.extend({ /** * Configuration options. * * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL */ cfg: Base.extend({ format: OpenSSLFormatter }), /** * Encrypts a message. * * @param {Cipher} cipher The cipher algorithm to use. * @param {WordArray|string} message The message to encrypt. * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {CipherParams} A cipher params object. * * @static * * @example * * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); */ encrypt: function (cipher, message, key, cfg) { // Apply config defaults cfg = this.cfg.extend(cfg); // Encrypt var encryptor = cipher.createEncryptor(key, cfg); var ciphertext = encryptor.finalize(message); // Shortcut var cipherCfg = encryptor.cfg; // Create and return serializable cipher params return CipherParams.create({ ciphertext: ciphertext, key: key, iv: cipherCfg.iv, algorithm: cipher, mode: cipherCfg.mode, padding: cipherCfg.padding, blockSize: cipher.blockSize, formatter: cfg.format }); }, /** * Decrypts serialized ciphertext. * * @param {Cipher} cipher The cipher algorithm to use. * @param {CipherParams|string} ciphertext The ciphertext to decrypt. * @param {WordArray} key The key. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {WordArray} The plaintext. * * @static * * @example * * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); */ decrypt: function (cipher, ciphertext, key, cfg) { // Apply config defaults cfg = this.cfg.extend(cfg); // Convert string to CipherParams ciphertext = this._parse(ciphertext, cfg.format); // Decrypt var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); return plaintext; }, /** * Converts serialized ciphertext to CipherParams, * else assumed CipherParams already and returns ciphertext unchanged. * * @param {CipherParams|string} ciphertext The ciphertext. * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. * * @return {CipherParams} The unserialized ciphertext. * * @static * * @example * * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); */ _parse: function (ciphertext, format) { if (typeof ciphertext == 'string') { return format.parse(ciphertext, this); } else { return ciphertext; } } }); /** * Key derivation function namespace. */ var C_kdf = C.kdf = {}; /** * OpenSSL key derivation function. */ var OpenSSLKdf = C_kdf.OpenSSL = { /** * Derives a key and IV from a password. * * @param {string} password The password to derive from. * @param {number} keySize The size in words of the key to generate. * @param {number} ivSize The size in words of the IV to generate. * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. * * @return {CipherParams} A cipher params object with the key, IV, and salt. * * @static * * @example * * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); */ execute: function (password, keySize, ivSize, salt) { // Generate random salt if (!salt) { salt = WordArray.random(64/8); } // Derive key and IV var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); // Separate key and IV var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); key.sigBytes = keySize * 4; // Return params return CipherParams.create({ key: key, iv: iv, salt: salt }); } }; /** * A serializable cipher wrapper that derives the key from a password, * and returns ciphertext as a serializable cipher params object. */ var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ /** * Configuration options. * * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL */ cfg: SerializableCipher.cfg.extend({ kdf: OpenSSLKdf }), /** * Encrypts a message using a password. * * @param {Cipher} cipher The cipher algorithm to use. * @param {WordArray|string} message The message to encrypt. * @param {string} password The password. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {CipherParams} A cipher params object. * * @static * * @example * * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); */ encrypt: function (cipher, message, password, cfg) { // Apply config defaults cfg = this.cfg.extend(cfg); // Derive key and other params var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); // Add IV to config cfg.iv = derivedParams.iv; // Encrypt var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); // Mix in derived params ciphertext.mixIn(derivedParams); return ciphertext; }, /** * Decrypts serialized ciphertext using a password. * * @param {Cipher} cipher The cipher algorithm to use. * @param {CipherParams|string} ciphertext The ciphertext to decrypt. * @param {string} password The password. * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @return {WordArray} The plaintext. * * @static * * @example * * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); */ decrypt: function (cipher, ciphertext, password, cfg) { // Apply config defaults cfg = this.cfg.extend(cfg); // Convert string to CipherParams ciphertext = this._parse(ciphertext, cfg.format); // Derive key and other params var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); // Add IV to config cfg.iv = derivedParams.iv; // Decrypt var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); return plaintext; } }); }()); })); },{"./core":40}],40:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(); } else if (typeof define === "function" && define.amd) { // AMD define([], factory); } else { // Global (browser) root.CryptoJS = factory(); } }(this, function () { /** * CryptoJS core components. */ var CryptoJS = CryptoJS || (function (Math, undefined) { /** * CryptoJS namespace. */ var C = {}; /** * Library namespace. */ var C_lib = C.lib = {}; /** * Base object for prototypal inheritance. */ var Base = C_lib.Base = (function () { function F() {} return { /** * Creates a new object that inherits from this object. * * @param {Object} overrides Properties to copy into the new object. * * @return {Object} The new object. * * @static * * @example * * var MyType = CryptoJS.lib.Base.extend({ * field: 'value', * * method: function () { * } * }); */ extend: function (overrides) { // Spawn F.prototype = this; var subtype = new F(); // Augment if (overrides) { subtype.mixIn(overrides); } // Create default initializer if (!subtype.hasOwnProperty('init')) { subtype.init = function () { subtype.$super.init.apply(this, arguments); }; } // Initializer's prototype is the subtype object subtype.init.prototype = subtype; // Reference supertype subtype.$super = this; return subtype; }, /** * Extends this object and runs the init method. * Arguments to create() will be passed to init(). * * @return {Object} The new object. * * @static * * @example * * var instance = MyType.create(); */ create: function () { var instance = this.extend(); instance.init.apply(instance, arguments); return instance; }, /** * Initializes a newly created object. * Override this method to add some logic when your objects are created. * * @example * * var MyType = CryptoJS.lib.Base.extend({ * init: function () { * // ... * } * }); */ init: function () { }, /** * Copies properties into this object. * * @param {Object} properties The properties to mix in. * * @example * * MyType.mixIn({ * field: 'value' * }); */ mixIn: function (properties) { for (var propertyName in properties) { if (properties.hasOwnProperty(propertyName)) { this[propertyName] = properties[propertyName]; } } // IE won't copy toString using the loop above if (properties.hasOwnProperty('toString')) { this.toString = properties.toString; } }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = instance.clone(); */ clone: function () { return this.init.prototype.extend(this); } }; }()); /** * An array of 32-bit words. * * @property {Array} words The array of 32-bit words. * @property {number} sigBytes The number of significant bytes in this word array. */ var WordArray = C_lib.WordArray = Base.extend({ /** * Initializes a newly created word array. * * @param {Array} words (Optional) An array of 32-bit words. * @param {number} sigBytes (Optional) The number of significant bytes in the words. * * @example * * var wordArray = CryptoJS.lib.WordArray.create(); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); */ init: function (words, sigBytes) { words = this.words = words || []; if (sigBytes != undefined) { this.sigBytes = sigBytes; } else { this.sigBytes = words.length * 4; } }, /** * Converts this word array to a string. * * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex * * @return {string} The stringified word array. * * @example * * var string = wordArray + ''; * var string = wordArray.toString(); * var string = wordArray.toString(CryptoJS.enc.Utf8); */ toString: function (encoder) { return (encoder || Hex).stringify(this); }, /** * Concatenates a word array to this word array. * * @param {WordArray} wordArray The word array to append. * * @return {WordArray} This word array. * * @example * * wordArray1.concat(wordArray2); */ concat: function (wordArray) { // Shortcuts var thisWords = this.words; var thatWords = wordArray.words; var thisSigBytes = this.sigBytes; var thatSigBytes = wordArray.sigBytes; // Clamp excess bits this.clamp(); // Concat if (thisSigBytes % 4) { // Copy one byte at a time for (var i = 0; i < thatSigBytes; i++) { var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); } } else { // Copy one word at a time for (var i = 0; i < thatSigBytes; i += 4) { thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2]; } } this.sigBytes += thatSigBytes; // Chainable return this; }, /** * Removes insignificant bits. * * @example * * wordArray.clamp(); */ clamp: function () { // Shortcuts var words = this.words; var sigBytes = this.sigBytes; // Clamp words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); words.length = Math.ceil(sigBytes / 4); }, /** * Creates a copy of this word array. * * @return {WordArray} The clone. * * @example * * var clone = wordArray.clone(); */ clone: function () { var clone = Base.clone.call(this); clone.words = this.words.slice(0); return clone; }, /** * Creates a word array filled with random bytes. * * @param {number} nBytes The number of random bytes to generate. * * @return {WordArray} The random word array. * * @static * * @example * * var wordArray = CryptoJS.lib.WordArray.random(16); */ random: function (nBytes) { var words = []; var r = (function (m_w) { var m_w = m_w; var m_z = 0x3ade68b1; var mask = 0xffffffff; return function () { m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask; m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask; var result = ((m_z << 0x10) + m_w) & mask; result /= 0x100000000; result += 0.5; return result * (Math.random() > .5 ? 1 : -1); } }); for (var i = 0, rcache; i < nBytes; i += 4) { var _r = r((rcache || Math.random()) * 0x100000000); rcache = _r() * 0x3ade67b7; words.push((_r() * 0x100000000) | 0); } return new WordArray.init(words, nBytes); } }); /** * Encoder namespace. */ var C_enc = C.enc = {}; /** * Hex encoding strategy. */ var Hex = C_enc.Hex = { /** * Converts a word array to a hex string. * * @param {WordArray} wordArray The word array. * * @return {string} The hex string. * * @static * * @example * * var hexString = CryptoJS.enc.Hex.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; // Convert var hexChars = []; for (var i = 0; i < sigBytes; i++) { var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; hexChars.push((bite >>> 4).toString(16)); hexChars.push((bite & 0x0f).toString(16)); } return hexChars.join(''); }, /** * Converts a hex string to a word array. * * @param {string} hexStr The hex string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Hex.parse(hexString); */ parse: function (hexStr) { // Shortcut var hexStrLength = hexStr.length; // Convert var words = []; for (var i = 0; i < hexStrLength; i += 2) { words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); } return new WordArray.init(words, hexStrLength / 2); } }; /** * Latin1 encoding strategy. */ var Latin1 = C_enc.Latin1 = { /** * Converts a word array to a Latin1 string. * * @param {WordArray} wordArray The word array. * * @return {string} The Latin1 string. * * @static * * @example * * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; // Convert var latin1Chars = []; for (var i = 0; i < sigBytes; i++) { var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; latin1Chars.push(String.fromCharCode(bite)); } return latin1Chars.join(''); }, /** * Converts a Latin1 string to a word array. * * @param {string} latin1Str The Latin1 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); */ parse: function (latin1Str) { // Shortcut var latin1StrLength = latin1Str.length; // Convert var words = []; for (var i = 0; i < latin1StrLength; i++) { words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); } return new WordArray.init(words, latin1StrLength); } }; /** * UTF-8 encoding strategy. */ var Utf8 = C_enc.Utf8 = { /** * Converts a word array to a UTF-8 string. * * @param {WordArray} wordArray The word array. * * @return {string} The UTF-8 string. * * @static * * @example * * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); */ stringify: function (wordArray) { try { return decodeURIComponent(escape(Latin1.stringify(wordArray))); } catch (e) { throw new Error('Malformed UTF-8 data'); } }, /** * Converts a UTF-8 string to a word array. * * @param {string} utf8Str The UTF-8 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); */ parse: function (utf8Str) { return Latin1.parse(unescape(encodeURIComponent(utf8Str))); } }; /** * Abstract buffered block algorithm template. * * The property blockSize must be implemented in a concrete subtype. * * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 */ var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ /** * Resets this block algorithm's data buffer to its initial state. * * @example * * bufferedBlockAlgorithm.reset(); */ reset: function () { // Initial values this._data = new WordArray.init(); this._nDataBytes = 0; }, /** * Adds new data to this block algorithm's buffer. * * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. * * @example * * bufferedBlockAlgorithm._append('data'); * bufferedBlockAlgorithm._append(wordArray); */ _append: function (data) { // Convert string to WordArray, else assume WordArray already if (typeof data == 'string') { data = Utf8.parse(data); } // Append this._data.concat(data); this._nDataBytes += data.sigBytes; }, /** * Processes available data blocks. * * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. * * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. * * @return {WordArray} The processed data. * * @example * * var processedData = bufferedBlockAlgorithm._process(); * var processedData = bufferedBlockAlgorithm._process(!!'flush'); */ _process: function (doFlush) { // Shortcuts var data = this._data; var dataWords = data.words; var dataSigBytes = data.sigBytes; var blockSize = this.blockSize; var blockSizeBytes = blockSize * 4; // Count blocks ready var nBlocksReady = dataSigBytes / blockSizeBytes; if (doFlush) { // Round up to include partial blocks nBlocksReady = Math.ceil(nBlocksReady); } else { // Round down to include only full blocks, // less the number of blocks that must remain in the buffer nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); } // Count words ready var nWordsReady = nBlocksReady * blockSize; // Count bytes ready var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); // Process blocks if (nWordsReady) { for (var offset = 0; offset < nWordsReady; offset += blockSize) { // Perform concrete-algorithm logic this._doProcessBlock(dataWords, offset); } // Remove processed words var processedWords = dataWords.splice(0, nWordsReady); data.sigBytes -= nBytesReady; } // Return processed words return new WordArray.init(processedWords, nBytesReady); }, /** * Creates a copy of this object. * * @return {Object} The clone. * * @example * * var clone = bufferedBlockAlgorithm.clone(); */ clone: function () { var clone = Base.clone.call(this); clone._data = this._data.clone(); return clone; }, _minBufferSize: 0 }); /** * Abstract hasher template. * * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) */ var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ /** * Configuration options. */ cfg: Base.extend(), /** * Initializes a newly created hasher. * * @param {Object} cfg (Optional) The configuration options to use for this hash computation. * * @example * * var hasher = CryptoJS.algo.SHA256.create(); */ init: function (cfg) { // Apply config defaults this.cfg = this.cfg.extend(cfg); // Set initial values this.reset(); }, /** * Resets this hasher to its initial state. * * @example * * hasher.reset(); */ reset: function () { // Reset data buffer BufferedBlockAlgorithm.reset.call(this); // Perform concrete-hasher logic this._doReset(); }, /** * Updates this hasher with a message. * * @param {WordArray|string} messageUpdate The message to append. * * @return {Hasher} This hasher. * * @example * * hasher.update('message'); * hasher.update(wordArray); */ update: function (messageUpdate) { // Append this._append(messageUpdate); // Update the hash this._process(); // Chainable return this; }, /** * Finalizes the hash computation. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} messageUpdate (Optional) A final message update. * * @return {WordArray} The hash. * * @example * * var hash = hasher.finalize(); * var hash = hasher.finalize('message'); * var hash = hasher.finalize(wordArray); */ finalize: function (messageUpdate) { // Final message update if (messageUpdate) { this._append(messageUpdate); } // Perform concrete-hasher logic var hash = this._doFinalize(); return hash; }, blockSize: 512/32, /** * Creates a shortcut function to a hasher's object interface. * * @param {Hasher} hasher The hasher to create a helper for. * * @return {Function} The shortcut function. * * @static * * @example * * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); */ _createHelper: function (hasher) { return function (message, cfg) { return new hasher.init(cfg).finalize(message); }; }, /** * Creates a shortcut function to the HMAC's object interface. * * @param {Hasher} hasher The hasher to use in this HMAC helper. * * @return {Function} The shortcut function. * * @static * * @example * * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); */ _createHmacHelper: function (hasher) { return function (message, key) { return new C_algo.HMAC.init(hasher, key).finalize(message); }; } }); /** * Algorithm namespace. */ var C_algo = C.algo = {}; return C; }(Math)); return CryptoJS; })); },{}],41:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var C_enc = C.enc; /** * Base64 encoding strategy. */ var Base64 = C_enc.Base64 = { /** * Converts a word array to a Base64 string. * * @param {WordArray} wordArray The word array. * * @return {string} The Base64 string. * * @static * * @example * * var base64String = CryptoJS.enc.Base64.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; var map = this._map; // Clamp excess bits wordArray.clamp(); // Convert var base64Chars = []; for (var i = 0; i < sigBytes; i += 3) { var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; var triplet = (byte1 << 16) | (byte2 << 8) | byte3; for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); } } // Add padding var paddingChar = map.charAt(64); if (paddingChar) { while (base64Chars.length % 4) { base64Chars.push(paddingChar); } } return base64Chars.join(''); }, /** * Converts a Base64 string to a word array. * * @param {string} base64Str The Base64 string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Base64.parse(base64String); */ parse: function (base64Str) { // Shortcuts var base64StrLength = base64Str.length; var map = this._map; // Ignore padding var paddingChar = map.charAt(64); if (paddingChar) { var paddingIndex = base64Str.indexOf(paddingChar); if (paddingIndex != -1) { base64StrLength = paddingIndex; } } // Convert var words = []; var nBytes = 0; for (var i = 0; i < base64StrLength; i++) { if (i % 4) { var bits1 = map.indexOf(base64Str.charAt(i - 1)) << ((i % 4) * 2); var bits2 = map.indexOf(base64Str.charAt(i)) >>> (6 - (i % 4) * 2); words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8); nBytes++; } } return WordArray.create(words, nBytes); }, _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' }; }()); return CryptoJS.enc.Base64; })); },{"./core":40}],42:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var C_enc = C.enc; /** * UTF-16 BE encoding strategy. */ var Utf16BE = C_enc.Utf16 = C_enc.Utf16BE = { /** * Converts a word array to a UTF-16 BE string. * * @param {WordArray} wordArray The word array. * * @return {string} The UTF-16 BE string. * * @static * * @example * * var utf16String = CryptoJS.enc.Utf16.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; // Convert var utf16Chars = []; for (var i = 0; i < sigBytes; i += 2) { var codePoint = (words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff; utf16Chars.push(String.fromCharCode(codePoint)); } return utf16Chars.join(''); }, /** * Converts a UTF-16 BE string to a word array. * * @param {string} utf16Str The UTF-16 BE string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Utf16.parse(utf16String); */ parse: function (utf16Str) { // Shortcut var utf16StrLength = utf16Str.length; // Convert var words = []; for (var i = 0; i < utf16StrLength; i++) { words[i >>> 1] |= utf16Str.charCodeAt(i) << (16 - (i % 2) * 16); } return WordArray.create(words, utf16StrLength * 2); } }; /** * UTF-16 LE encoding strategy. */ C_enc.Utf16LE = { /** * Converts a word array to a UTF-16 LE string. * * @param {WordArray} wordArray The word array. * * @return {string} The UTF-16 LE string. * * @static * * @example * * var utf16Str = CryptoJS.enc.Utf16LE.stringify(wordArray); */ stringify: function (wordArray) { // Shortcuts var words = wordArray.words; var sigBytes = wordArray.sigBytes; // Convert var utf16Chars = []; for (var i = 0; i < sigBytes; i += 2) { var codePoint = swapEndian((words[i >>> 2] >>> (16 - (i % 4) * 8)) & 0xffff); utf16Chars.push(String.fromCharCode(codePoint)); } return utf16Chars.join(''); }, /** * Converts a UTF-16 LE string to a word array. * * @param {string} utf16Str The UTF-16 LE string. * * @return {WordArray} The word array. * * @static * * @example * * var wordArray = CryptoJS.enc.Utf16LE.parse(utf16Str); */ parse: function (utf16Str) { // Shortcut var utf16StrLength = utf16Str.length; // Convert var words = []; for (var i = 0; i < utf16StrLength; i++) { words[i >>> 1] |= swapEndian(utf16Str.charCodeAt(i) << (16 - (i % 2) * 16)); } return WordArray.create(words, utf16StrLength * 2); } }; function swapEndian(word) { return ((word << 8) & 0xff00ff00) | ((word >>> 8) & 0x00ff00ff); } }()); return CryptoJS.enc.Utf16; })); },{"./core":40}],43:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha1"), _dereq_("./hmac")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./sha1", "./hmac"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var WordArray = C_lib.WordArray; var C_algo = C.algo; var MD5 = C_algo.MD5; /** * This key derivation function is meant to conform with EVP_BytesToKey. * www.openssl.org/docs/crypto/EVP_BytesToKey.html */ var EvpKDF = C_algo.EvpKDF = Base.extend({ /** * Configuration options. * * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) * @property {Hasher} hasher The hash algorithm to use. Default: MD5 * @property {number} iterations The number of iterations to perform. Default: 1 */ cfg: Base.extend({ keySize: 128/32, hasher: MD5, iterations: 1 }), /** * Initializes a newly created key derivation function. * * @param {Object} cfg (Optional) The configuration options to use for the derivation. * * @example * * var kdf = CryptoJS.algo.EvpKDF.create(); * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); */ init: function (cfg) { this.cfg = this.cfg.extend(cfg); }, /** * Derives a key from a password. * * @param {WordArray|string} password The password. * @param {WordArray|string} salt A salt. * * @return {WordArray} The derived key. * * @example * * var key = kdf.compute(password, salt); */ compute: function (password, salt) { // Shortcut var cfg = this.cfg; // Init hasher var hasher = cfg.hasher.create(); // Initial values var derivedKey = WordArray.create(); // Shortcuts var derivedKeyWords = derivedKey.words; var keySize = cfg.keySize; var iterations = cfg.iterations; // Generate key while (derivedKeyWords.length < keySize) { if (block) { hasher.update(block); } var block = hasher.update(password).finalize(salt); hasher.reset(); // Iterations for (var i = 1; i < iterations; i++) { block = hasher.finalize(block); hasher.reset(); } derivedKey.concat(block); } derivedKey.sigBytes = keySize * 4; return derivedKey; } }); /** * Derives a key from a password. * * @param {WordArray|string} password The password. * @param {WordArray|string} salt A salt. * @param {Object} cfg (Optional) The configuration options to use for this computation. * * @return {WordArray} The derived key. * * @static * * @example * * var key = CryptoJS.EvpKDF(password, salt); * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); */ C.EvpKDF = function (password, salt, cfg) { return EvpKDF.create(cfg).compute(password, salt); }; }()); return CryptoJS.EvpKDF; })); },{"./core":40,"./hmac":45,"./sha1":64}],44:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function (undefined) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var CipherParams = C_lib.CipherParams; var C_enc = C.enc; var Hex = C_enc.Hex; var C_format = C.format; var HexFormatter = C_format.Hex = { /** * Converts the ciphertext of a cipher params object to a hexadecimally encoded string. * * @param {CipherParams} cipherParams The cipher params object. * * @return {string} The hexadecimally encoded string. * * @static * * @example * * var hexString = CryptoJS.format.Hex.stringify(cipherParams); */ stringify: function (cipherParams) { return cipherParams.ciphertext.toString(Hex); }, /** * Converts a hexadecimally encoded ciphertext string to a cipher params object. * * @param {string} input The hexadecimally encoded string. * * @return {CipherParams} The cipher params object. * * @static * * @example * * var cipherParams = CryptoJS.format.Hex.parse(hexString); */ parse: function (input) { var ciphertext = Hex.parse(input); return CipherParams.create({ ciphertext: ciphertext }); } }; }()); return CryptoJS.format.Hex; })); },{"./cipher-core":39,"./core":40}],45:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var C_enc = C.enc; var Utf8 = C_enc.Utf8; var C_algo = C.algo; /** * HMAC algorithm. */ var HMAC = C_algo.HMAC = Base.extend({ /** * Initializes a newly created HMAC. * * @param {Hasher} hasher The hash algorithm to use. * @param {WordArray|string} key The secret key. * * @example * * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); */ init: function (hasher, key) { // Init hasher hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already if (typeof key == 'string') { key = Utf8.parse(key); } // Shortcuts var hasherBlockSize = hasher.blockSize; var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys if (key.sigBytes > hasherBlockSizeBytes) { key = hasher.finalize(key); } // Clamp excess bits key.clamp(); // Clone key for inner and outer pads var oKey = this._oKey = key.clone(); var iKey = this._iKey = key.clone(); // Shortcuts var oKeyWords = oKey.words; var iKeyWords = iKey.words; // XOR keys with pad constants for (var i = 0; i < hasherBlockSize; i++) { oKeyWords[i] ^= 0x5c5c5c5c; iKeyWords[i] ^= 0x36363636; } oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values this.reset(); }, /** * Resets this HMAC to its initial state. * * @example * * hmacHasher.reset(); */ reset: function () { // Shortcut var hasher = this._hasher; // Reset hasher.reset(); hasher.update(this._iKey); }, /** * Updates this HMAC with a message. * * @param {WordArray|string} messageUpdate The message to append. * * @return {HMAC} This HMAC instance. * * @example * * hmacHasher.update('message'); * hmacHasher.update(wordArray); */ update: function (messageUpdate) { this._hasher.update(messageUpdate); // Chainable return this; }, /** * Finalizes the HMAC computation. * Note that the finalize operation is effectively a destructive, read-once operation. * * @param {WordArray|string} messageUpdate (Optional) A final message update. * * @return {WordArray} The HMAC. * * @example * * var hmac = hmacHasher.finalize(); * var hmac = hmacHasher.finalize('message'); * var hmac = hmacHasher.finalize(wordArray); */ finalize: function (messageUpdate) { // Shortcut var hasher = this._hasher; // Compute HMAC var innerHash = hasher.finalize(messageUpdate); hasher.reset(); var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); return hmac; } }); }()); })); },{"./core":40}],46:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core"), _dereq_("./lib-typedarrays"), _dereq_("./enc-utf16"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./sha1"), _dereq_("./sha256"), _dereq_("./sha224"), _dereq_("./sha512"), _dereq_("./sha384"), _dereq_("./sha3"), _dereq_("./ripemd160"), _dereq_("./hmac"), _dereq_("./pbkdf2"), _dereq_("./evpkdf"), _dereq_("./cipher-core"), _dereq_("./mode-cfb"), _dereq_("./mode-ctr"), _dereq_("./mode-ctr-gladman"), _dereq_("./mode-ofb"), _dereq_("./mode-ecb"), _dereq_("./pad-ansix923"), _dereq_("./pad-iso10126"), _dereq_("./pad-iso97971"), _dereq_("./pad-zeropadding"), _dereq_("./pad-nopadding"), _dereq_("./format-hex"), _dereq_("./aes"), _dereq_("./tripledes"), _dereq_("./rc4"), _dereq_("./rabbit"), _dereq_("./rabbit-legacy")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./x64-core", "./lib-typedarrays", "./enc-utf16", "./enc-base64", "./md5", "./sha1", "./sha256", "./sha224", "./sha512", "./sha384", "./sha3", "./ripemd160", "./hmac", "./pbkdf2", "./evpkdf", "./cipher-core", "./mode-cfb", "./mode-ctr", "./mode-ctr-gladman", "./mode-ofb", "./mode-ecb", "./pad-ansix923", "./pad-iso10126", "./pad-iso97971", "./pad-zeropadding", "./pad-nopadding", "./format-hex", "./aes", "./tripledes", "./rc4", "./rabbit", "./rabbit-legacy"], factory); } else { // Global (browser) root.CryptoJS = factory(root.CryptoJS); } }(this, function (CryptoJS) { return CryptoJS; })); },{"./aes":38,"./cipher-core":39,"./core":40,"./enc-base64":41,"./enc-utf16":42,"./evpkdf":43,"./format-hex":44,"./hmac":45,"./lib-typedarrays":47,"./md5":48,"./mode-cfb":49,"./mode-ctr":51,"./mode-ctr-gladman":50,"./mode-ecb":52,"./mode-ofb":53,"./pad-ansix923":54,"./pad-iso10126":55,"./pad-iso97971":56,"./pad-nopadding":57,"./pad-zeropadding":58,"./pbkdf2":59,"./rabbit":61,"./rabbit-legacy":60,"./rc4":62,"./ripemd160":63,"./sha1":64,"./sha224":65,"./sha256":66,"./sha3":67,"./sha384":68,"./sha512":69,"./tripledes":70,"./x64-core":71}],47:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Check if typed arrays are supported if (typeof ArrayBuffer != 'function') { return; } // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; // Reference original init var superInit = WordArray.init; // Augment WordArray.init to handle typed arrays var subInit = WordArray.init = function (typedArray) { // Convert buffers to uint8 if (typedArray instanceof ArrayBuffer) { typedArray = new Uint8Array(typedArray); } // Convert other array views to uint8 if ( typedArray instanceof Int8Array || (typeof Uint8ClampedArray !== "undefined" && typedArray instanceof Uint8ClampedArray) || typedArray instanceof Int16Array || typedArray instanceof Uint16Array || typedArray instanceof Int32Array || typedArray instanceof Uint32Array || typedArray instanceof Float32Array || typedArray instanceof Float64Array ) { typedArray = new Uint8Array(typedArray.buffer, typedArray.byteOffset, typedArray.byteLength); } // Handle Uint8Array if (typedArray instanceof Uint8Array) { // Shortcut var typedArrayByteLength = typedArray.byteLength; // Extract bytes var words = []; for (var i = 0; i < typedArrayByteLength; i++) { words[i >>> 2] |= typedArray[i] << (24 - (i % 4) * 8); } // Initialize this word array superInit.call(this, words, typedArrayByteLength); } else { // Else call normal init superInit.apply(this, arguments); } }; subInit.prototype = WordArray; }()); return CryptoJS.lib.WordArray; })); },{"./core":40}],48:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function (Math) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C.algo; // Constants table var T = []; // Compute constants (function () { for (var i = 0; i < 64; i++) { T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; } }()); /** * MD5 hash algorithm. */ var MD5 = C_algo.MD5 = Hasher.extend({ _doReset: function () { this._hash = new WordArray.init([ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 ]); }, _doProcessBlock: function (M, offset) { // Swap endian for (var i = 0; i < 16; i++) { // Shortcuts var offset_i = offset + i; var M_offset_i = M[offset_i]; M[offset_i] = ( (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) ); } // Shortcuts var H = this._hash.words; var M_offset_0 = M[offset + 0]; var M_offset_1 = M[offset + 1]; var M_offset_2 = M[offset + 2]; var M_offset_3 = M[offset + 3]; var M_offset_4 = M[offset + 4]; var M_offset_5 = M[offset + 5]; var M_offset_6 = M[offset + 6]; var M_offset_7 = M[offset + 7]; var M_offset_8 = M[offset + 8]; var M_offset_9 = M[offset + 9]; var M_offset_10 = M[offset + 10]; var M_offset_11 = M[offset + 11]; var M_offset_12 = M[offset + 12]; var M_offset_13 = M[offset + 13]; var M_offset_14 = M[offset + 14]; var M_offset_15 = M[offset + 15]; // Working varialbes var a = H[0]; var b = H[1]; var c = H[2]; var d = H[3]; // Computation a = FF(a, b, c, d, M_offset_0, 7, T[0]); d = FF(d, a, b, c, M_offset_1, 12, T[1]); c = FF(c, d, a, b, M_offset_2, 17, T[2]); b = FF(b, c, d, a, M_offset_3, 22, T[3]); a = FF(a, b, c, d, M_offset_4, 7, T[4]); d = FF(d, a, b, c, M_offset_5, 12, T[5]); c = FF(c, d, a, b, M_offset_6, 17, T[6]); b = FF(b, c, d, a, M_offset_7, 22, T[7]); a = FF(a, b, c, d, M_offset_8, 7, T[8]); d = FF(d, a, b, c, M_offset_9, 12, T[9]); c = FF(c, d, a, b, M_offset_10, 17, T[10]); b = FF(b, c, d, a, M_offset_11, 22, T[11]); a = FF(a, b, c, d, M_offset_12, 7, T[12]); d = FF(d, a, b, c, M_offset_13, 12, T[13]); c = FF(c, d, a, b, M_offset_14, 17, T[14]); b = FF(b, c, d, a, M_offset_15, 22, T[15]); a = GG(a, b, c, d, M_offset_1, 5, T[16]); d = GG(d, a, b, c, M_offset_6, 9, T[17]); c = GG(c, d, a, b, M_offset_11, 14, T[18]); b = GG(b, c, d, a, M_offset_0, 20, T[19]); a = GG(a, b, c, d, M_offset_5, 5, T[20]); d = GG(d, a, b, c, M_offset_10, 9, T[21]); c = GG(c, d, a, b, M_offset_15, 14, T[22]); b = GG(b, c, d, a, M_offset_4, 20, T[23]); a = GG(a, b, c, d, M_offset_9, 5, T[24]); d = GG(d, a, b, c, M_offset_14, 9, T[25]); c = GG(c, d, a, b, M_offset_3, 14, T[26]); b = GG(b, c, d, a, M_offset_8, 20, T[27]); a = GG(a, b, c, d, M_offset_13, 5, T[28]); d = GG(d, a, b, c, M_offset_2, 9, T[29]); c = GG(c, d, a, b, M_offset_7, 14, T[30]); b = GG(b, c, d, a, M_offset_12, 20, T[31]); a = HH(a, b, c, d, M_offset_5, 4, T[32]); d = HH(d, a, b, c, M_offset_8, 11, T[33]); c = HH(c, d, a, b, M_offset_11, 16, T[34]); b = HH(b, c, d, a, M_offset_14, 23, T[35]); a = HH(a, b, c, d, M_offset_1, 4, T[36]); d = HH(d, a, b, c, M_offset_4, 11, T[37]); c = HH(c, d, a, b, M_offset_7, 16, T[38]); b = HH(b, c, d, a, M_offset_10, 23, T[39]); a = HH(a, b, c, d, M_offset_13, 4, T[40]); d = HH(d, a, b, c, M_offset_0, 11, T[41]); c = HH(c, d, a, b, M_offset_3, 16, T[42]); b = HH(b, c, d, a, M_offset_6, 23, T[43]); a = HH(a, b, c, d, M_offset_9, 4, T[44]); d = HH(d, a, b, c, M_offset_12, 11, T[45]); c = HH(c, d, a, b, M_offset_15, 16, T[46]); b = HH(b, c, d, a, M_offset_2, 23, T[47]); a = II(a, b, c, d, M_offset_0, 6, T[48]); d = II(d, a, b, c, M_offset_7, 10, T[49]); c = II(c, d, a, b, M_offset_14, 15, T[50]); b = II(b, c, d, a, M_offset_5, 21, T[51]); a = II(a, b, c, d, M_offset_12, 6, T[52]); d = II(d, a, b, c, M_offset_3, 10, T[53]); c = II(c, d, a, b, M_offset_10, 15, T[54]); b = II(b, c, d, a, M_offset_1, 21, T[55]); a = II(a, b, c, d, M_offset_8, 6, T[56]); d = II(d, a, b, c, M_offset_15, 10, T[57]); c = II(c, d, a, b, M_offset_6, 15, T[58]); b = II(b, c, d, a, M_offset_13, 21, T[59]); a = II(a, b, c, d, M_offset_4, 6, T[60]); d = II(d, a, b, c, M_offset_11, 10, T[61]); c = II(c, d, a, b, M_offset_2, 15, T[62]); b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value H[0] = (H[0] + a) | 0; H[1] = (H[1] + b) | 0; H[2] = (H[2] + c) | 0; H[3] = (H[3] + d) | 0; }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); var nBitsTotalL = nBitsTotal; dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) ); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) ); data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks this._process(); // Shortcuts var hash = this._hash; var H = hash.words; // Swap endian for (var i = 0; i < 4; i++) { // Shortcut var H_i = H[i]; H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); } // Return final computed hash return hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; } }); function FF(a, b, c, d, x, s, t) { var n = a + ((b & c) | (~b & d)) + x + t; return ((n << s) | (n >>> (32 - s))) + b; } function GG(a, b, c, d, x, s, t) { var n = a + ((b & d) | (c & ~d)) + x + t; return ((n << s) | (n >>> (32 - s))) + b; } function HH(a, b, c, d, x, s, t) { var n = a + (b ^ c ^ d) + x + t; return ((n << s) | (n >>> (32 - s))) + b; } function II(a, b, c, d, x, s, t) { var n = a + (c ^ (b | ~d)) + x + t; return ((n << s) | (n >>> (32 - s))) + b; } /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.MD5('message'); * var hash = CryptoJS.MD5(wordArray); */ C.MD5 = Hasher._createHelper(MD5); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacMD5(message, key); */ C.HmacMD5 = Hasher._createHmacHelper(MD5); }(Math)); return CryptoJS.MD5; })); },{"./core":40}],49:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * Cipher Feedback block mode. */ CryptoJS.mode.CFB = (function () { var CFB = CryptoJS.lib.BlockCipherMode.extend(); CFB.Encryptor = CFB.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); // Remember this block to use with next block this._prevBlock = words.slice(offset, offset + blockSize); } }); CFB.Decryptor = CFB.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher; var blockSize = cipher.blockSize; // Remember this block to use with next block var thisBlock = words.slice(offset, offset + blockSize); generateKeystreamAndEncrypt.call(this, words, offset, blockSize, cipher); // This block becomes the previous block this._prevBlock = thisBlock; } }); function generateKeystreamAndEncrypt(words, offset, blockSize, cipher) { // Shortcut var iv = this._iv; // Generate keystream if (iv) { var keystream = iv.slice(0); // Remove IV for subsequent blocks this._iv = undefined; } else { var keystream = this._prevBlock; } cipher.encryptBlock(keystream, 0); // Encrypt for (var i = 0; i < blockSize; i++) { words[offset + i] ^= keystream[i]; } } return CFB; }()); return CryptoJS.mode.CFB; })); },{"./cipher-core":39,"./core":40}],50:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** @preserve * Counter block mode compatible with Dr Brian Gladman fileenc.c * derived from CryptoJS.mode.CTR * Jan Hruby [email protected] */ CryptoJS.mode.CTRGladman = (function () { var CTRGladman = CryptoJS.lib.BlockCipherMode.extend(); function incWord(word) { if (((word >> 24) & 0xff) === 0xff) { //overflow var b1 = (word >> 16)&0xff; var b2 = (word >> 8)&0xff; var b3 = word & 0xff; if (b1 === 0xff) // overflow b1 { b1 = 0; if (b2 === 0xff) { b2 = 0; if (b3 === 0xff) { b3 = 0; } else { ++b3; } } else { ++b2; } } else { ++b1; } word = 0; word += (b1 << 16); word += (b2 << 8); word += b3; } else { word += (0x01 << 24); } return word; } function incCounter(counter) { if ((counter[0] = incWord(counter[0])) === 0) { // encr_data in fileenc.c from Dr Brian Gladman's counts only with DWORD j < 8 counter[1] = incWord(counter[1]); } return counter; } var Encryptor = CTRGladman.Encryptor = CTRGladman.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher var blockSize = cipher.blockSize; var iv = this._iv; var counter = this._counter; // Generate keystream if (iv) { counter = this._counter = iv.slice(0); // Remove IV for subsequent blocks this._iv = undefined; } incCounter(counter); var keystream = counter.slice(0); cipher.encryptBlock(keystream, 0); // Encrypt for (var i = 0; i < blockSize; i++) { words[offset + i] ^= keystream[i]; } } }); CTRGladman.Decryptor = Encryptor; return CTRGladman; }()); return CryptoJS.mode.CTRGladman; })); },{"./cipher-core":39,"./core":40}],51:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * Counter block mode. */ CryptoJS.mode.CTR = (function () { var CTR = CryptoJS.lib.BlockCipherMode.extend(); var Encryptor = CTR.Encryptor = CTR.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher var blockSize = cipher.blockSize; var iv = this._iv; var counter = this._counter; // Generate keystream if (iv) { counter = this._counter = iv.slice(0); // Remove IV for subsequent blocks this._iv = undefined; } var keystream = counter.slice(0); cipher.encryptBlock(keystream, 0); // Increment counter counter[blockSize - 1] = (counter[blockSize - 1] + 1) | 0 // Encrypt for (var i = 0; i < blockSize; i++) { words[offset + i] ^= keystream[i]; } } }); CTR.Decryptor = Encryptor; return CTR; }()); return CryptoJS.mode.CTR; })); },{"./cipher-core":39,"./core":40}],52:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * Electronic Codebook block mode. */ CryptoJS.mode.ECB = (function () { var ECB = CryptoJS.lib.BlockCipherMode.extend(); ECB.Encryptor = ECB.extend({ processBlock: function (words, offset) { this._cipher.encryptBlock(words, offset); } }); ECB.Decryptor = ECB.extend({ processBlock: function (words, offset) { this._cipher.decryptBlock(words, offset); } }); return ECB; }()); return CryptoJS.mode.ECB; })); },{"./cipher-core":39,"./core":40}],53:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * Output Feedback block mode. */ CryptoJS.mode.OFB = (function () { var OFB = CryptoJS.lib.BlockCipherMode.extend(); var Encryptor = OFB.Encryptor = OFB.extend({ processBlock: function (words, offset) { // Shortcuts var cipher = this._cipher var blockSize = cipher.blockSize; var iv = this._iv; var keystream = this._keystream; // Generate keystream if (iv) { keystream = this._keystream = iv.slice(0); // Remove IV for subsequent blocks this._iv = undefined; } cipher.encryptBlock(keystream, 0); // Encrypt for (var i = 0; i < blockSize; i++) { words[offset + i] ^= keystream[i]; } } }); OFB.Decryptor = Encryptor; return OFB; }()); return CryptoJS.mode.OFB; })); },{"./cipher-core":39,"./core":40}],54:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * ANSI X.923 padding strategy. */ CryptoJS.pad.AnsiX923 = { pad: function (data, blockSize) { // Shortcuts var dataSigBytes = data.sigBytes; var blockSizeBytes = blockSize * 4; // Count padding bytes var nPaddingBytes = blockSizeBytes - dataSigBytes % blockSizeBytes; // Compute last byte position var lastBytePos = dataSigBytes + nPaddingBytes - 1; // Pad data.clamp(); data.words[lastBytePos >>> 2] |= nPaddingBytes << (24 - (lastBytePos % 4) * 8); data.sigBytes += nPaddingBytes; }, unpad: function (data) { // Get number of padding bytes from last byte var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; // Remove padding data.sigBytes -= nPaddingBytes; } }; return CryptoJS.pad.Ansix923; })); },{"./cipher-core":39,"./core":40}],55:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * ISO 10126 padding strategy. */ CryptoJS.pad.Iso10126 = { pad: function (data, blockSize) { // Shortcut var blockSizeBytes = blockSize * 4; // Count padding bytes var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Pad data.concat(CryptoJS.lib.WordArray.random(nPaddingBytes - 1)). concat(CryptoJS.lib.WordArray.create([nPaddingBytes << 24], 1)); }, unpad: function (data) { // Get number of padding bytes from last byte var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; // Remove padding data.sigBytes -= nPaddingBytes; } }; return CryptoJS.pad.Iso10126; })); },{"./cipher-core":39,"./core":40}],56:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * ISO/IEC 9797-1 Padding Method 2. */ CryptoJS.pad.Iso97971 = { pad: function (data, blockSize) { // Add 0x80 byte data.concat(CryptoJS.lib.WordArray.create([0x80000000], 1)); // Zero pad the rest CryptoJS.pad.ZeroPadding.pad(data, blockSize); }, unpad: function (data) { // Remove zero padding CryptoJS.pad.ZeroPadding.unpad(data); // Remove one more byte -- the 0x80 byte data.sigBytes--; } }; return CryptoJS.pad.Iso97971; })); },{"./cipher-core":39,"./core":40}],57:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * A noop padding strategy. */ CryptoJS.pad.NoPadding = { pad: function () { }, unpad: function () { } }; return CryptoJS.pad.NoPadding; })); },{"./cipher-core":39,"./core":40}],58:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** * Zero padding strategy. */ CryptoJS.pad.ZeroPadding = { pad: function (data, blockSize) { // Shortcut var blockSizeBytes = blockSize * 4; // Pad data.clamp(); data.sigBytes += blockSizeBytes - ((data.sigBytes % blockSizeBytes) || blockSizeBytes); }, unpad: function (data) { // Shortcut var dataWords = data.words; // Unpad var i = data.sigBytes - 1; while (!((dataWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff)) { i--; } data.sigBytes = i + 1; } }; return CryptoJS.pad.ZeroPadding; })); },{"./cipher-core":39,"./core":40}],59:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha1"), _dereq_("./hmac")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./sha1", "./hmac"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var WordArray = C_lib.WordArray; var C_algo = C.algo; var SHA1 = C_algo.SHA1; var HMAC = C_algo.HMAC; /** * Password-Based Key Derivation Function 2 algorithm. */ var PBKDF2 = C_algo.PBKDF2 = Base.extend({ /** * Configuration options. * * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) * @property {Hasher} hasher The hasher to use. Default: SHA1 * @property {number} iterations The number of iterations to perform. Default: 1 */ cfg: Base.extend({ keySize: 128/32, hasher: SHA1, iterations: 1 }), /** * Initializes a newly created key derivation function. * * @param {Object} cfg (Optional) The configuration options to use for the derivation. * * @example * * var kdf = CryptoJS.algo.PBKDF2.create(); * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8 }); * var kdf = CryptoJS.algo.PBKDF2.create({ keySize: 8, iterations: 1000 }); */ init: function (cfg) { this.cfg = this.cfg.extend(cfg); }, /** * Computes the Password-Based Key Derivation Function 2. * * @param {WordArray|string} password The password. * @param {WordArray|string} salt A salt. * * @return {WordArray} The derived key. * * @example * * var key = kdf.compute(password, salt); */ compute: function (password, salt) { // Shortcut var cfg = this.cfg; // Init HMAC var hmac = HMAC.create(cfg.hasher, password); // Initial values var derivedKey = WordArray.create(); var blockIndex = WordArray.create([0x00000001]); // Shortcuts var derivedKeyWords = derivedKey.words; var blockIndexWords = blockIndex.words; var keySize = cfg.keySize; var iterations = cfg.iterations; // Generate key while (derivedKeyWords.length < keySize) { var block = hmac.update(salt).finalize(blockIndex); hmac.reset(); // Shortcuts var blockWords = block.words; var blockWordsLength = blockWords.length; // Iterations var intermediate = block; for (var i = 1; i < iterations; i++) { intermediate = hmac.finalize(intermediate); hmac.reset(); // Shortcut var intermediateWords = intermediate.words; // XOR intermediate with block for (var j = 0; j < blockWordsLength; j++) { blockWords[j] ^= intermediateWords[j]; } } derivedKey.concat(block); blockIndexWords[0]++; } derivedKey.sigBytes = keySize * 4; return derivedKey; } }); /** * Computes the Password-Based Key Derivation Function 2. * * @param {WordArray|string} password The password. * @param {WordArray|string} salt A salt. * @param {Object} cfg (Optional) The configuration options to use for this computation. * * @return {WordArray} The derived key. * * @static * * @example * * var key = CryptoJS.PBKDF2(password, salt); * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8 }); * var key = CryptoJS.PBKDF2(password, salt, { keySize: 8, iterations: 1000 }); */ C.PBKDF2 = function (password, salt, cfg) { return PBKDF2.create(cfg).compute(password, salt); }; }()); return CryptoJS.PBKDF2; })); },{"./core":40,"./hmac":45,"./sha1":64}],60:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var StreamCipher = C_lib.StreamCipher; var C_algo = C.algo; // Reusable objects var S = []; var C_ = []; var G = []; /** * Rabbit stream cipher algorithm. * * This is a legacy version that neglected to convert the key to little-endian. * This error doesn't affect the cipher's security, * but it does affect its compatibility with other implementations. */ var RabbitLegacy = C_algo.RabbitLegacy = StreamCipher.extend({ _doReset: function () { // Shortcuts var K = this._key.words; var iv = this.cfg.iv; // Generate initial state values var X = this._X = [ K[0], (K[3] << 16) | (K[2] >>> 16), K[1], (K[0] << 16) | (K[3] >>> 16), K[2], (K[1] << 16) | (K[0] >>> 16), K[3], (K[2] << 16) | (K[1] >>> 16) ]; // Generate initial counter values var C = this._C = [ (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) ]; // Carry bit this._b = 0; // Iterate the system four times for (var i = 0; i < 4; i++) { nextState.call(this); } // Modify the counters for (var i = 0; i < 8; i++) { C[i] ^= X[(i + 4) & 7]; } // IV setup if (iv) { // Shortcuts var IV = iv.words; var IV_0 = IV[0]; var IV_1 = IV[1]; // Generate four subvectors var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); var i1 = (i0 >>> 16) | (i2 & 0xffff0000); var i3 = (i2 << 16) | (i0 & 0x0000ffff); // Modify counter values C[0] ^= i0; C[1] ^= i1; C[2] ^= i2; C[3] ^= i3; C[4] ^= i0; C[5] ^= i1; C[6] ^= i2; C[7] ^= i3; // Iterate the system four times for (var i = 0; i < 4; i++) { nextState.call(this); } } }, _doProcessBlock: function (M, offset) { // Shortcut var X = this._X; // Iterate the system nextState.call(this); // Generate four keystream words S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); for (var i = 0; i < 4; i++) { // Swap endian S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); // Encrypt M[offset + i] ^= S[i]; } }, blockSize: 128/32, ivSize: 64/32 }); function nextState() { // Shortcuts var X = this._X; var C = this._C; // Save old counter values for (var i = 0; i < 8; i++) { C_[i] = C[i]; } // Calculate new counter values C[0] = (C[0] + 0x4d34d34d + this._b) | 0; C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; // Calculate the g-values for (var i = 0; i < 8; i++) { var gx = X[i] + C[i]; // Construct high and low argument for squaring var ga = gx & 0xffff; var gb = gx >>> 16; // Calculate high and low result of squaring var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); // High XOR low G[i] = gh ^ gl; } // Calculate new state values X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; } /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.RabbitLegacy.encrypt(message, key, cfg); * var plaintext = CryptoJS.RabbitLegacy.decrypt(ciphertext, key, cfg); */ C.RabbitLegacy = StreamCipher._createHelper(RabbitLegacy); }()); return CryptoJS.RabbitLegacy; })); },{"./cipher-core":39,"./core":40,"./enc-base64":41,"./evpkdf":43,"./md5":48}],61:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var StreamCipher = C_lib.StreamCipher; var C_algo = C.algo; // Reusable objects var S = []; var C_ = []; var G = []; /** * Rabbit stream cipher algorithm */ var Rabbit = C_algo.Rabbit = StreamCipher.extend({ _doReset: function () { // Shortcuts var K = this._key.words; var iv = this.cfg.iv; // Swap endian for (var i = 0; i < 4; i++) { K[i] = (((K[i] << 8) | (K[i] >>> 24)) & 0x00ff00ff) | (((K[i] << 24) | (K[i] >>> 8)) & 0xff00ff00); } // Generate initial state values var X = this._X = [ K[0], (K[3] << 16) | (K[2] >>> 16), K[1], (K[0] << 16) | (K[3] >>> 16), K[2], (K[1] << 16) | (K[0] >>> 16), K[3], (K[2] << 16) | (K[1] >>> 16) ]; // Generate initial counter values var C = this._C = [ (K[2] << 16) | (K[2] >>> 16), (K[0] & 0xffff0000) | (K[1] & 0x0000ffff), (K[3] << 16) | (K[3] >>> 16), (K[1] & 0xffff0000) | (K[2] & 0x0000ffff), (K[0] << 16) | (K[0] >>> 16), (K[2] & 0xffff0000) | (K[3] & 0x0000ffff), (K[1] << 16) | (K[1] >>> 16), (K[3] & 0xffff0000) | (K[0] & 0x0000ffff) ]; // Carry bit this._b = 0; // Iterate the system four times for (var i = 0; i < 4; i++) { nextState.call(this); } // Modify the counters for (var i = 0; i < 8; i++) { C[i] ^= X[(i + 4) & 7]; } // IV setup if (iv) { // Shortcuts var IV = iv.words; var IV_0 = IV[0]; var IV_1 = IV[1]; // Generate four subvectors var i0 = (((IV_0 << 8) | (IV_0 >>> 24)) & 0x00ff00ff) | (((IV_0 << 24) | (IV_0 >>> 8)) & 0xff00ff00); var i2 = (((IV_1 << 8) | (IV_1 >>> 24)) & 0x00ff00ff) | (((IV_1 << 24) | (IV_1 >>> 8)) & 0xff00ff00); var i1 = (i0 >>> 16) | (i2 & 0xffff0000); var i3 = (i2 << 16) | (i0 & 0x0000ffff); // Modify counter values C[0] ^= i0; C[1] ^= i1; C[2] ^= i2; C[3] ^= i3; C[4] ^= i0; C[5] ^= i1; C[6] ^= i2; C[7] ^= i3; // Iterate the system four times for (var i = 0; i < 4; i++) { nextState.call(this); } } }, _doProcessBlock: function (M, offset) { // Shortcut var X = this._X; // Iterate the system nextState.call(this); // Generate four keystream words S[0] = X[0] ^ (X[5] >>> 16) ^ (X[3] << 16); S[1] = X[2] ^ (X[7] >>> 16) ^ (X[5] << 16); S[2] = X[4] ^ (X[1] >>> 16) ^ (X[7] << 16); S[3] = X[6] ^ (X[3] >>> 16) ^ (X[1] << 16); for (var i = 0; i < 4; i++) { // Swap endian S[i] = (((S[i] << 8) | (S[i] >>> 24)) & 0x00ff00ff) | (((S[i] << 24) | (S[i] >>> 8)) & 0xff00ff00); // Encrypt M[offset + i] ^= S[i]; } }, blockSize: 128/32, ivSize: 64/32 }); function nextState() { // Shortcuts var X = this._X; var C = this._C; // Save old counter values for (var i = 0; i < 8; i++) { C_[i] = C[i]; } // Calculate new counter values C[0] = (C[0] + 0x4d34d34d + this._b) | 0; C[1] = (C[1] + 0xd34d34d3 + ((C[0] >>> 0) < (C_[0] >>> 0) ? 1 : 0)) | 0; C[2] = (C[2] + 0x34d34d34 + ((C[1] >>> 0) < (C_[1] >>> 0) ? 1 : 0)) | 0; C[3] = (C[3] + 0x4d34d34d + ((C[2] >>> 0) < (C_[2] >>> 0) ? 1 : 0)) | 0; C[4] = (C[4] + 0xd34d34d3 + ((C[3] >>> 0) < (C_[3] >>> 0) ? 1 : 0)) | 0; C[5] = (C[5] + 0x34d34d34 + ((C[4] >>> 0) < (C_[4] >>> 0) ? 1 : 0)) | 0; C[6] = (C[6] + 0x4d34d34d + ((C[5] >>> 0) < (C_[5] >>> 0) ? 1 : 0)) | 0; C[7] = (C[7] + 0xd34d34d3 + ((C[6] >>> 0) < (C_[6] >>> 0) ? 1 : 0)) | 0; this._b = (C[7] >>> 0) < (C_[7] >>> 0) ? 1 : 0; // Calculate the g-values for (var i = 0; i < 8; i++) { var gx = X[i] + C[i]; // Construct high and low argument for squaring var ga = gx & 0xffff; var gb = gx >>> 16; // Calculate high and low result of squaring var gh = ((((ga * ga) >>> 17) + ga * gb) >>> 15) + gb * gb; var gl = (((gx & 0xffff0000) * gx) | 0) + (((gx & 0x0000ffff) * gx) | 0); // High XOR low G[i] = gh ^ gl; } // Calculate new state values X[0] = (G[0] + ((G[7] << 16) | (G[7] >>> 16)) + ((G[6] << 16) | (G[6] >>> 16))) | 0; X[1] = (G[1] + ((G[0] << 8) | (G[0] >>> 24)) + G[7]) | 0; X[2] = (G[2] + ((G[1] << 16) | (G[1] >>> 16)) + ((G[0] << 16) | (G[0] >>> 16))) | 0; X[3] = (G[3] + ((G[2] << 8) | (G[2] >>> 24)) + G[1]) | 0; X[4] = (G[4] + ((G[3] << 16) | (G[3] >>> 16)) + ((G[2] << 16) | (G[2] >>> 16))) | 0; X[5] = (G[5] + ((G[4] << 8) | (G[4] >>> 24)) + G[3]) | 0; X[6] = (G[6] + ((G[5] << 16) | (G[5] >>> 16)) + ((G[4] << 16) | (G[4] >>> 16))) | 0; X[7] = (G[7] + ((G[6] << 8) | (G[6] >>> 24)) + G[5]) | 0; } /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.Rabbit.encrypt(message, key, cfg); * var plaintext = CryptoJS.Rabbit.decrypt(ciphertext, key, cfg); */ C.Rabbit = StreamCipher._createHelper(Rabbit); }()); return CryptoJS.Rabbit; })); },{"./cipher-core":39,"./core":40,"./enc-base64":41,"./evpkdf":43,"./md5":48}],62:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var StreamCipher = C_lib.StreamCipher; var C_algo = C.algo; /** * RC4 stream cipher algorithm. */ var RC4 = C_algo.RC4 = StreamCipher.extend({ _doReset: function () { // Shortcuts var key = this._key; var keyWords = key.words; var keySigBytes = key.sigBytes; // Init sbox var S = this._S = []; for (var i = 0; i < 256; i++) { S[i] = i; } // Key setup for (var i = 0, j = 0; i < 256; i++) { var keyByteIndex = i % keySigBytes; var keyByte = (keyWords[keyByteIndex >>> 2] >>> (24 - (keyByteIndex % 4) * 8)) & 0xff; j = (j + S[i] + keyByte) % 256; // Swap var t = S[i]; S[i] = S[j]; S[j] = t; } // Counters this._i = this._j = 0; }, _doProcessBlock: function (M, offset) { M[offset] ^= generateKeystreamWord.call(this); }, keySize: 256/32, ivSize: 0 }); function generateKeystreamWord() { // Shortcuts var S = this._S; var i = this._i; var j = this._j; // Generate keystream word var keystreamWord = 0; for (var n = 0; n < 4; n++) { i = (i + 1) % 256; j = (j + S[i]) % 256; // Swap var t = S[i]; S[i] = S[j]; S[j] = t; keystreamWord |= S[(S[i] + S[j]) % 256] << (24 - n * 8); } // Update counters this._i = i; this._j = j; return keystreamWord; } /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.RC4.encrypt(message, key, cfg); * var plaintext = CryptoJS.RC4.decrypt(ciphertext, key, cfg); */ C.RC4 = StreamCipher._createHelper(RC4); /** * Modified RC4 stream cipher algorithm. */ var RC4Drop = C_algo.RC4Drop = RC4.extend({ /** * Configuration options. * * @property {number} drop The number of keystream words to drop. Default 192 */ cfg: RC4.cfg.extend({ drop: 192 }), _doReset: function () { RC4._doReset.call(this); // Drop for (var i = this.cfg.drop; i > 0; i--) { generateKeystreamWord.call(this); } } }); /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.RC4Drop.encrypt(message, key, cfg); * var plaintext = CryptoJS.RC4Drop.decrypt(ciphertext, key, cfg); */ C.RC4Drop = StreamCipher._createHelper(RC4Drop); }()); return CryptoJS.RC4; })); },{"./cipher-core":39,"./core":40,"./enc-base64":41,"./evpkdf":43,"./md5":48}],63:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { /** @preserve (c) 2012 by Cédric Mesnil. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ (function (Math) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C.algo; // Constants table var _zl = WordArray.create([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]); var _zr = WordArray.create([ 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]); var _sl = WordArray.create([ 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]); var _sr = WordArray.create([ 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]); var _hl = WordArray.create([ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]); var _hr = WordArray.create([ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]); /** * RIPEMD160 hash algorithm. */ var RIPEMD160 = C_algo.RIPEMD160 = Hasher.extend({ _doReset: function () { this._hash = WordArray.create([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]); }, _doProcessBlock: function (M, offset) { // Swap endian for (var i = 0; i < 16; i++) { // Shortcuts var offset_i = offset + i; var M_offset_i = M[offset_i]; // Swap M[offset_i] = ( (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) ); } // Shortcut var H = this._hash.words; var hl = _hl.words; var hr = _hr.words; var zl = _zl.words; var zr = _zr.words; var sl = _sl.words; var sr = _sr.words; // Working variables var al, bl, cl, dl, el; var ar, br, cr, dr, er; ar = al = H[0]; br = bl = H[1]; cr = cl = H[2]; dr = dl = H[3]; er = el = H[4]; // Computation var t; for (var i = 0; i < 80; i += 1) { t = (al + M[offset+zl[i]])|0; if (i<16){ t += f1(bl,cl,dl) + hl[0]; } else if (i<32) { t += f2(bl,cl,dl) + hl[1]; } else if (i<48) { t += f3(bl,cl,dl) + hl[2]; } else if (i<64) { t += f4(bl,cl,dl) + hl[3]; } else {// if (i<80) { t += f5(bl,cl,dl) + hl[4]; } t = t|0; t = rotl(t,sl[i]); t = (t+el)|0; al = el; el = dl; dl = rotl(cl, 10); cl = bl; bl = t; t = (ar + M[offset+zr[i]])|0; if (i<16){ t += f5(br,cr,dr) + hr[0]; } else if (i<32) { t += f4(br,cr,dr) + hr[1]; } else if (i<48) { t += f3(br,cr,dr) + hr[2]; } else if (i<64) { t += f2(br,cr,dr) + hr[3]; } else {// if (i<80) { t += f1(br,cr,dr) + hr[4]; } t = t|0; t = rotl(t,sr[i]) ; t = (t+er)|0; ar = er; er = dr; dr = rotl(cr, 10); cr = br; br = t; } // Intermediate hash value t = (H[1] + cl + dr)|0; H[1] = (H[2] + dl + er)|0; H[2] = (H[3] + el + ar)|0; H[3] = (H[4] + al + br)|0; H[4] = (H[0] + bl + cr)|0; H[0] = t; }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) ); data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks this._process(); // Shortcuts var hash = this._hash; var H = hash.words; // Swap endian for (var i = 0; i < 5; i++) { // Shortcut var H_i = H[i]; // Swap H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); } // Return final computed hash return hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; } }); function f1(x, y, z) { return ((x) ^ (y) ^ (z)); } function f2(x, y, z) { return (((x)&(y)) | ((~x)&(z))); } function f3(x, y, z) { return (((x) | (~(y))) ^ (z)); } function f4(x, y, z) { return (((x) & (z)) | ((y)&(~(z)))); } function f5(x, y, z) { return ((x) ^ ((y) |(~(z)))); } function rotl(x,n) { return (x<<n) | (x>>>(32-n)); } /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.RIPEMD160('message'); * var hash = CryptoJS.RIPEMD160(wordArray); */ C.RIPEMD160 = Hasher._createHelper(RIPEMD160); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacRIPEMD160(message, key); */ C.HmacRIPEMD160 = Hasher._createHmacHelper(RIPEMD160); }(Math)); return CryptoJS.RIPEMD160; })); },{"./core":40}],64:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C.algo; // Reusable object var W = []; /** * SHA-1 hash algorithm. */ var SHA1 = C_algo.SHA1 = Hasher.extend({ _doReset: function () { this._hash = new WordArray.init([ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]); }, _doProcessBlock: function (M, offset) { // Shortcut var H = this._hash.words; // Working variables var a = H[0]; var b = H[1]; var c = H[2]; var d = H[3]; var e = H[4]; // Computation for (var i = 0; i < 80; i++) { if (i < 16) { W[i] = M[offset + i] | 0; } else { var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; W[i] = (n << 1) | (n >>> 31); } var t = ((a << 5) | (a >>> 27)) + e + W[i]; if (i < 20) { t += ((b & c) | (~b & d)) + 0x5a827999; } else if (i < 40) { t += (b ^ c ^ d) + 0x6ed9eba1; } else if (i < 60) { t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; } else /* if (i < 80) */ { t += (b ^ c ^ d) - 0x359d3e2a; } e = d; d = c; c = (b << 30) | (b >>> 2); b = a; a = t; } // Intermediate hash value H[0] = (H[0] + a) | 0; H[1] = (H[1] + b) | 0; H[2] = (H[2] + c) | 0; H[3] = (H[3] + d) | 0; H[4] = (H[4] + e) | 0; }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; data.sigBytes = dataWords.length * 4; // Hash final blocks this._process(); // Return final computed hash return this._hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA1('message'); * var hash = CryptoJS.SHA1(wordArray); */ C.SHA1 = Hasher._createHelper(SHA1); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA1(message, key); */ C.HmacSHA1 = Hasher._createHmacHelper(SHA1); }()); return CryptoJS.SHA1; })); },{"./core":40}],65:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./sha256")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./sha256"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var C_algo = C.algo; var SHA256 = C_algo.SHA256; /** * SHA-224 hash algorithm. */ var SHA224 = C_algo.SHA224 = SHA256.extend({ _doReset: function () { this._hash = new WordArray.init([ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ]); }, _doFinalize: function () { var hash = SHA256._doFinalize.call(this); hash.sigBytes -= 4; return hash; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA224('message'); * var hash = CryptoJS.SHA224(wordArray); */ C.SHA224 = SHA256._createHelper(SHA224); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA224(message, key); */ C.HmacSHA224 = SHA256._createHmacHelper(SHA224); }()); return CryptoJS.SHA224; })); },{"./core":40,"./sha256":66}],66:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function (Math) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_algo = C.algo; // Initialization and round constants tables var H = []; var K = []; // Compute constants (function () { function isPrime(n) { var sqrtN = Math.sqrt(n); for (var factor = 2; factor <= sqrtN; factor++) { if (!(n % factor)) { return false; } } return true; } function getFractionalBits(n) { return ((n - (n | 0)) * 0x100000000) | 0; } var n = 2; var nPrime = 0; while (nPrime < 64) { if (isPrime(n)) { if (nPrime < 8) { H[nPrime] = getFractionalBits(Math.pow(n, 1 / 2)); } K[nPrime] = getFractionalBits(Math.pow(n, 1 / 3)); nPrime++; } n++; } }()); // Reusable object var W = []; /** * SHA-256 hash algorithm. */ var SHA256 = C_algo.SHA256 = Hasher.extend({ _doReset: function () { this._hash = new WordArray.init(H.slice(0)); }, _doProcessBlock: function (M, offset) { // Shortcut var H = this._hash.words; // Working variables var a = H[0]; var b = H[1]; var c = H[2]; var d = H[3]; var e = H[4]; var f = H[5]; var g = H[6]; var h = H[7]; // Computation for (var i = 0; i < 64; i++) { if (i < 16) { W[i] = M[offset + i] | 0; } else { var gamma0x = W[i - 15]; var gamma0 = ((gamma0x << 25) | (gamma0x >>> 7)) ^ ((gamma0x << 14) | (gamma0x >>> 18)) ^ (gamma0x >>> 3); var gamma1x = W[i - 2]; var gamma1 = ((gamma1x << 15) | (gamma1x >>> 17)) ^ ((gamma1x << 13) | (gamma1x >>> 19)) ^ (gamma1x >>> 10); W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]; } var ch = (e & f) ^ (~e & g); var maj = (a & b) ^ (a & c) ^ (b & c); var sigma0 = ((a << 30) | (a >>> 2)) ^ ((a << 19) | (a >>> 13)) ^ ((a << 10) | (a >>> 22)); var sigma1 = ((e << 26) | (e >>> 6)) ^ ((e << 21) | (e >>> 11)) ^ ((e << 7) | (e >>> 25)); var t1 = h + sigma1 + ch + K[i] + W[i]; var t2 = sigma0 + maj; h = g; g = f; f = e; e = (d + t1) | 0; d = c; c = b; b = a; a = (t1 + t2) | 0; } // Intermediate hash value H[0] = (H[0] + a) | 0; H[1] = (H[1] + b) | 0; H[2] = (H[2] + c) | 0; H[3] = (H[3] + d) | 0; H[4] = (H[4] + e) | 0; H[5] = (H[5] + f) | 0; H[6] = (H[6] + g) | 0; H[7] = (H[7] + h) | 0; }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; data.sigBytes = dataWords.length * 4; // Hash final blocks this._process(); // Return final computed hash return this._hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA256('message'); * var hash = CryptoJS.SHA256(wordArray); */ C.SHA256 = Hasher._createHelper(SHA256); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA256(message, key); */ C.HmacSHA256 = Hasher._createHmacHelper(SHA256); }(Math)); return CryptoJS.SHA256; })); },{"./core":40}],67:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./x64-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function (Math) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var Hasher = C_lib.Hasher; var C_x64 = C.x64; var X64Word = C_x64.Word; var C_algo = C.algo; // Constants tables var RHO_OFFSETS = []; var PI_INDEXES = []; var ROUND_CONSTANTS = []; // Compute Constants (function () { // Compute rho offset constants var x = 1, y = 0; for (var t = 0; t < 24; t++) { RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64; var newX = y % 5; var newY = (2 * x + 3 * y) % 5; x = newX; y = newY; } // Compute pi index constants for (var x = 0; x < 5; x++) { for (var y = 0; y < 5; y++) { PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5; } } // Compute round constants var LFSR = 0x01; for (var i = 0; i < 24; i++) { var roundConstantMsw = 0; var roundConstantLsw = 0; for (var j = 0; j < 7; j++) { if (LFSR & 0x01) { var bitPosition = (1 << j) - 1; if (bitPosition < 32) { roundConstantLsw ^= 1 << bitPosition; } else /* if (bitPosition >= 32) */ { roundConstantMsw ^= 1 << (bitPosition - 32); } } // Compute next LFSR if (LFSR & 0x80) { // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1 LFSR = (LFSR << 1) ^ 0x71; } else { LFSR <<= 1; } } ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw); } }()); // Reusable objects for temporary values var T = []; (function () { for (var i = 0; i < 25; i++) { T[i] = X64Word.create(); } }()); /** * SHA-3 hash algorithm. */ var SHA3 = C_algo.SHA3 = Hasher.extend({ /** * Configuration options. * * @property {number} outputLength * The desired number of bits in the output hash. * Only values permitted are: 224, 256, 384, 512. * Default: 512 */ cfg: Hasher.cfg.extend({ outputLength: 512 }), _doReset: function () { var state = this._state = [] for (var i = 0; i < 25; i++) { state[i] = new X64Word.init(); } this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32; }, _doProcessBlock: function (M, offset) { // Shortcuts var state = this._state; var nBlockSizeLanes = this.blockSize / 2; // Absorb for (var i = 0; i < nBlockSizeLanes; i++) { // Shortcuts var M2i = M[offset + 2 * i]; var M2i1 = M[offset + 2 * i + 1]; // Swap endian M2i = ( (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) | (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00) ); M2i1 = ( (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) | (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00) ); // Absorb message into state var lane = state[i]; lane.high ^= M2i1; lane.low ^= M2i; } // Rounds for (var round = 0; round < 24; round++) { // Theta for (var x = 0; x < 5; x++) { // Mix column lanes var tMsw = 0, tLsw = 0; for (var y = 0; y < 5; y++) { var lane = state[x + 5 * y]; tMsw ^= lane.high; tLsw ^= lane.low; } // Temporary values var Tx = T[x]; Tx.high = tMsw; Tx.low = tLsw; } for (var x = 0; x < 5; x++) { // Shortcuts var Tx4 = T[(x + 4) % 5]; var Tx1 = T[(x + 1) % 5]; var Tx1Msw = Tx1.high; var Tx1Lsw = Tx1.low; // Mix surrounding columns var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31)); var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31)); for (var y = 0; y < 5; y++) { var lane = state[x + 5 * y]; lane.high ^= tMsw; lane.low ^= tLsw; } } // Rho Pi for (var laneIndex = 1; laneIndex < 25; laneIndex++) { // Shortcuts var lane = state[laneIndex]; var laneMsw = lane.high; var laneLsw = lane.low; var rhoOffset = RHO_OFFSETS[laneIndex]; // Rotate lanes if (rhoOffset < 32) { var tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset)); var tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset)); } else /* if (rhoOffset >= 32) */ { var tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset)); var tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset)); } // Transpose lanes var TPiLane = T[PI_INDEXES[laneIndex]]; TPiLane.high = tMsw; TPiLane.low = tLsw; } // Rho pi at x = y = 0 var T0 = T[0]; var state0 = state[0]; T0.high = state0.high; T0.low = state0.low; // Chi for (var x = 0; x < 5; x++) { for (var y = 0; y < 5; y++) { // Shortcuts var laneIndex = x + 5 * y; var lane = state[laneIndex]; var TLane = T[laneIndex]; var Tx1Lane = T[((x + 1) % 5) + 5 * y]; var Tx2Lane = T[((x + 2) % 5) + 5 * y]; // Mix rows lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high); lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low); } } // Iota var lane = state[0]; var roundConstant = ROUND_CONSTANTS[round]; lane.high ^= roundConstant.high; lane.low ^= roundConstant.low;; } }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; var blockSizeBits = this.blockSize * 32; // Add padding dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32); dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80; data.sigBytes = dataWords.length * 4; // Hash final blocks this._process(); // Shortcuts var state = this._state; var outputLengthBytes = this.cfg.outputLength / 8; var outputLengthLanes = outputLengthBytes / 8; // Squeeze var hashWords = []; for (var i = 0; i < outputLengthLanes; i++) { // Shortcuts var lane = state[i]; var laneMsw = lane.high; var laneLsw = lane.low; // Swap endian laneMsw = ( (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) | (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00) ); laneLsw = ( (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) | (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00) ); // Squeeze state to retrieve hash hashWords.push(laneLsw); hashWords.push(laneMsw); } // Return final computed hash return new WordArray.init(hashWords, outputLengthBytes); }, clone: function () { var clone = Hasher.clone.call(this); var state = clone._state = this._state.slice(0); for (var i = 0; i < 25; i++) { state[i] = state[i].clone(); } return clone; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA3('message'); * var hash = CryptoJS.SHA3(wordArray); */ C.SHA3 = Hasher._createHelper(SHA3); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA3(message, key); */ C.HmacSHA3 = Hasher._createHmacHelper(SHA3); }(Math)); return CryptoJS.SHA3; })); },{"./core":40,"./x64-core":71}],68:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core"), _dereq_("./sha512")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./x64-core", "./sha512"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_x64 = C.x64; var X64Word = C_x64.Word; var X64WordArray = C_x64.WordArray; var C_algo = C.algo; var SHA512 = C_algo.SHA512; /** * SHA-384 hash algorithm. */ var SHA384 = C_algo.SHA384 = SHA512.extend({ _doReset: function () { this._hash = new X64WordArray.init([ new X64Word.init(0xcbbb9d5d, 0xc1059ed8), new X64Word.init(0x629a292a, 0x367cd507), new X64Word.init(0x9159015a, 0x3070dd17), new X64Word.init(0x152fecd8, 0xf70e5939), new X64Word.init(0x67332667, 0xffc00b31), new X64Word.init(0x8eb44a87, 0x68581511), new X64Word.init(0xdb0c2e0d, 0x64f98fa7), new X64Word.init(0x47b5481d, 0xbefa4fa4) ]); }, _doFinalize: function () { var hash = SHA512._doFinalize.call(this); hash.sigBytes -= 16; return hash; } }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA384('message'); * var hash = CryptoJS.SHA384(wordArray); */ C.SHA384 = SHA512._createHelper(SHA384); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA384(message, key); */ C.HmacSHA384 = SHA512._createHmacHelper(SHA384); }()); return CryptoJS.SHA384; })); },{"./core":40,"./sha512":69,"./x64-core":71}],69:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./x64-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./x64-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Hasher = C_lib.Hasher; var C_x64 = C.x64; var X64Word = C_x64.Word; var X64WordArray = C_x64.WordArray; var C_algo = C.algo; function X64Word_create() { return X64Word.create.apply(X64Word, arguments); } // Constants var K = [ X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd), X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc), X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019), X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118), X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe), X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2), X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1), X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694), X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3), X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65), X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483), X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5), X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210), X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4), X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725), X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70), X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926), X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df), X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8), X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b), X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001), X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30), X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910), X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8), X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53), X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8), X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb), X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3), X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60), X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec), X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9), X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b), X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207), X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178), X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6), X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b), X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493), X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c), X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a), X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817) ]; // Reusable objects var W = []; (function () { for (var i = 0; i < 80; i++) { W[i] = X64Word_create(); } }()); /** * SHA-512 hash algorithm. */ var SHA512 = C_algo.SHA512 = Hasher.extend({ _doReset: function () { this._hash = new X64WordArray.init([ new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b), new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1), new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f), new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179) ]); }, _doProcessBlock: function (M, offset) { // Shortcuts var H = this._hash.words; var H0 = H[0]; var H1 = H[1]; var H2 = H[2]; var H3 = H[3]; var H4 = H[4]; var H5 = H[5]; var H6 = H[6]; var H7 = H[7]; var H0h = H0.high; var H0l = H0.low; var H1h = H1.high; var H1l = H1.low; var H2h = H2.high; var H2l = H2.low; var H3h = H3.high; var H3l = H3.low; var H4h = H4.high; var H4l = H4.low; var H5h = H5.high; var H5l = H5.low; var H6h = H6.high; var H6l = H6.low; var H7h = H7.high; var H7l = H7.low; // Working variables var ah = H0h; var al = H0l; var bh = H1h; var bl = H1l; var ch = H2h; var cl = H2l; var dh = H3h; var dl = H3l; var eh = H4h; var el = H4l; var fh = H5h; var fl = H5l; var gh = H6h; var gl = H6l; var hh = H7h; var hl = H7l; // Rounds for (var i = 0; i < 80; i++) { // Shortcut var Wi = W[i]; // Extend message if (i < 16) { var Wih = Wi.high = M[offset + i * 2] | 0; var Wil = Wi.low = M[offset + i * 2 + 1] | 0; } else { // Gamma0 var gamma0x = W[i - 15]; var gamma0xh = gamma0x.high; var gamma0xl = gamma0x.low; var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7); var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25)); // Gamma1 var gamma1x = W[i - 2]; var gamma1xh = gamma1x.high; var gamma1xl = gamma1x.low; var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6); var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26)); // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] var Wi7 = W[i - 7]; var Wi7h = Wi7.high; var Wi7l = Wi7.low; var Wi16 = W[i - 16]; var Wi16h = Wi16.high; var Wi16l = Wi16.low; var Wil = gamma0l + Wi7l; var Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0); var Wil = Wil + gamma1l; var Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0); var Wil = Wil + Wi16l; var Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0); Wi.high = Wih; Wi.low = Wil; } var chh = (eh & fh) ^ (~eh & gh); var chl = (el & fl) ^ (~el & gl); var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch); var majl = (al & bl) ^ (al & cl) ^ (bl & cl); var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7)); var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7)); var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9)); var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9)); // t1 = h + sigma1 + ch + K[i] + W[i] var Ki = K[i]; var Kih = Ki.high; var Kil = Ki.low; var t1l = hl + sigma1l; var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0); var t1l = t1l + chl; var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0); var t1l = t1l + Kil; var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0); var t1l = t1l + Wil; var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0); // t2 = sigma0 + maj var t2l = sigma0l + majl; var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0); // Update working variables hh = gh; hl = gl; gh = fh; gl = fl; fh = eh; fl = el; el = (dl + t1l) | 0; eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0; dh = ch; dl = cl; ch = bh; cl = bl; bh = ah; bl = al; al = (t1l + t2l) | 0; ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0; } // Intermediate hash value H0l = H0.low = (H0l + al); H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0)); H1l = H1.low = (H1l + bl); H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0)); H2l = H2.low = (H2l + cl); H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0)); H3l = H3.low = (H3l + dl); H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0)); H4l = H4.low = (H4l + el); H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0)); H5l = H5.low = (H5l + fl); H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0)); H6l = H6.low = (H6l + gl); H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0)); H7l = H7.low = (H7l + hl); H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0)); }, _doFinalize: function () { // Shortcuts var data = this._data; var dataWords = data.words; var nBitsTotal = this._nDataBytes * 8; var nBitsLeft = data.sigBytes * 8; // Add padding dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000); dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal; data.sigBytes = dataWords.length * 4; // Hash final blocks this._process(); // Convert hash to 32-bit word array before returning var hash = this._hash.toX32(); // Return final computed hash return hash; }, clone: function () { var clone = Hasher.clone.call(this); clone._hash = this._hash.clone(); return clone; }, blockSize: 1024/32 }); /** * Shortcut function to the hasher's object interface. * * @param {WordArray|string} message The message to hash. * * @return {WordArray} The hash. * * @static * * @example * * var hash = CryptoJS.SHA512('message'); * var hash = CryptoJS.SHA512(wordArray); */ C.SHA512 = Hasher._createHelper(SHA512); /** * Shortcut function to the HMAC's object interface. * * @param {WordArray|string} message The message to hash. * @param {WordArray|string} key The secret key. * * @return {WordArray} The HMAC. * * @static * * @example * * var hmac = CryptoJS.HmacSHA512(message, key); */ C.HmacSHA512 = Hasher._createHmacHelper(SHA512); }()); return CryptoJS.SHA512; })); },{"./core":40,"./x64-core":71}],70:[function(_dereq_,module,exports){ ;(function (root, factory, undef) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core"), _dereq_("./enc-base64"), _dereq_("./md5"), _dereq_("./evpkdf"), _dereq_("./cipher-core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var WordArray = C_lib.WordArray; var BlockCipher = C_lib.BlockCipher; var C_algo = C.algo; // Permuted Choice 1 constants var PC1 = [ 57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4 ]; // Permuted Choice 2 constants var PC2 = [ 14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32 ]; // Cumulative bit shift constants var BIT_SHIFTS = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28]; // SBOXes and round permutation constants var SBOX_P = [ { 0x0: 0x808200, 0x10000000: 0x8000, 0x20000000: 0x808002, 0x30000000: 0x2, 0x40000000: 0x200, 0x50000000: 0x808202, 0x60000000: 0x800202, 0x70000000: 0x800000, 0x80000000: 0x202, 0x90000000: 0x800200, 0xa0000000: 0x8200, 0xb0000000: 0x808000, 0xc0000000: 0x8002, 0xd0000000: 0x800002, 0xe0000000: 0x0, 0xf0000000: 0x8202, 0x8000000: 0x0, 0x18000000: 0x808202, 0x28000000: 0x8202, 0x38000000: 0x8000, 0x48000000: 0x808200, 0x58000000: 0x200, 0x68000000: 0x808002, 0x78000000: 0x2, 0x88000000: 0x800200, 0x98000000: 0x8200, 0xa8000000: 0x808000, 0xb8000000: 0x800202, 0xc8000000: 0x800002, 0xd8000000: 0x8002, 0xe8000000: 0x202, 0xf8000000: 0x800000, 0x1: 0x8000, 0x10000001: 0x2, 0x20000001: 0x808200, 0x30000001: 0x800000, 0x40000001: 0x808002, 0x50000001: 0x8200, 0x60000001: 0x200, 0x70000001: 0x800202, 0x80000001: 0x808202, 0x90000001: 0x808000, 0xa0000001: 0x800002, 0xb0000001: 0x8202, 0xc0000001: 0x202, 0xd0000001: 0x800200, 0xe0000001: 0x8002, 0xf0000001: 0x0, 0x8000001: 0x808202, 0x18000001: 0x808000, 0x28000001: 0x800000, 0x38000001: 0x200, 0x48000001: 0x8000, 0x58000001: 0x800002, 0x68000001: 0x2, 0x78000001: 0x8202, 0x88000001: 0x8002, 0x98000001: 0x800202, 0xa8000001: 0x202, 0xb8000001: 0x808200, 0xc8000001: 0x800200, 0xd8000001: 0x0, 0xe8000001: 0x8200, 0xf8000001: 0x808002 }, { 0x0: 0x40084010, 0x1000000: 0x4000, 0x2000000: 0x80000, 0x3000000: 0x40080010, 0x4000000: 0x40000010, 0x5000000: 0x40084000, 0x6000000: 0x40004000, 0x7000000: 0x10, 0x8000000: 0x84000, 0x9000000: 0x40004010, 0xa000000: 0x40000000, 0xb000000: 0x84010, 0xc000000: 0x80010, 0xd000000: 0x0, 0xe000000: 0x4010, 0xf000000: 0x40080000, 0x800000: 0x40004000, 0x1800000: 0x84010, 0x2800000: 0x10, 0x3800000: 0x40004010, 0x4800000: 0x40084010, 0x5800000: 0x40000000, 0x6800000: 0x80000, 0x7800000: 0x40080010, 0x8800000: 0x80010, 0x9800000: 0x0, 0xa800000: 0x4000, 0xb800000: 0x40080000, 0xc800000: 0x40000010, 0xd800000: 0x84000, 0xe800000: 0x40084000, 0xf800000: 0x4010, 0x10000000: 0x0, 0x11000000: 0x40080010, 0x12000000: 0x40004010, 0x13000000: 0x40084000, 0x14000000: 0x40080000, 0x15000000: 0x10, 0x16000000: 0x84010, 0x17000000: 0x4000, 0x18000000: 0x4010, 0x19000000: 0x80000, 0x1a000000: 0x80010, 0x1b000000: 0x40000010, 0x1c000000: 0x84000, 0x1d000000: 0x40004000, 0x1e000000: 0x40000000, 0x1f000000: 0x40084010, 0x10800000: 0x84010, 0x11800000: 0x80000, 0x12800000: 0x40080000, 0x13800000: 0x4000, 0x14800000: 0x40004000, 0x15800000: 0x40084010, 0x16800000: 0x10, 0x17800000: 0x40000000, 0x18800000: 0x40084000, 0x19800000: 0x40000010, 0x1a800000: 0x40004010, 0x1b800000: 0x80010, 0x1c800000: 0x0, 0x1d800000: 0x4010, 0x1e800000: 0x40080010, 0x1f800000: 0x84000 }, { 0x0: 0x104, 0x100000: 0x0, 0x200000: 0x4000100, 0x300000: 0x10104, 0x400000: 0x10004, 0x500000: 0x4000004, 0x600000: 0x4010104, 0x700000: 0x4010000, 0x800000: 0x4000000, 0x900000: 0x4010100, 0xa00000: 0x10100, 0xb00000: 0x4010004, 0xc00000: 0x4000104, 0xd00000: 0x10000, 0xe00000: 0x4, 0xf00000: 0x100, 0x80000: 0x4010100, 0x180000: 0x4010004, 0x280000: 0x0, 0x380000: 0x4000100, 0x480000: 0x4000004, 0x580000: 0x10000, 0x680000: 0x10004, 0x780000: 0x104, 0x880000: 0x4, 0x980000: 0x100, 0xa80000: 0x4010000, 0xb80000: 0x10104, 0xc80000: 0x10100, 0xd80000: 0x4000104, 0xe80000: 0x4010104, 0xf80000: 0x4000000, 0x1000000: 0x4010100, 0x1100000: 0x10004, 0x1200000: 0x10000, 0x1300000: 0x4000100, 0x1400000: 0x100, 0x1500000: 0x4010104, 0x1600000: 0x4000004, 0x1700000: 0x0, 0x1800000: 0x4000104, 0x1900000: 0x4000000, 0x1a00000: 0x4, 0x1b00000: 0x10100, 0x1c00000: 0x4010000, 0x1d00000: 0x104, 0x1e00000: 0x10104, 0x1f00000: 0x4010004, 0x1080000: 0x4000000, 0x1180000: 0x104, 0x1280000: 0x4010100, 0x1380000: 0x0, 0x1480000: 0x10004, 0x1580000: 0x4000100, 0x1680000: 0x100, 0x1780000: 0x4010004, 0x1880000: 0x10000, 0x1980000: 0x4010104, 0x1a80000: 0x10104, 0x1b80000: 0x4000004, 0x1c80000: 0x4000104, 0x1d80000: 0x4010000, 0x1e80000: 0x4, 0x1f80000: 0x10100 }, { 0x0: 0x80401000, 0x10000: 0x80001040, 0x20000: 0x401040, 0x30000: 0x80400000, 0x40000: 0x0, 0x50000: 0x401000, 0x60000: 0x80000040, 0x70000: 0x400040, 0x80000: 0x80000000, 0x90000: 0x400000, 0xa0000: 0x40, 0xb0000: 0x80001000, 0xc0000: 0x80400040, 0xd0000: 0x1040, 0xe0000: 0x1000, 0xf0000: 0x80401040, 0x8000: 0x80001040, 0x18000: 0x40, 0x28000: 0x80400040, 0x38000: 0x80001000, 0x48000: 0x401000, 0x58000: 0x80401040, 0x68000: 0x0, 0x78000: 0x80400000, 0x88000: 0x1000, 0x98000: 0x80401000, 0xa8000: 0x400000, 0xb8000: 0x1040, 0xc8000: 0x80000000, 0xd8000: 0x400040, 0xe8000: 0x401040, 0xf8000: 0x80000040, 0x100000: 0x400040, 0x110000: 0x401000, 0x120000: 0x80000040, 0x130000: 0x0, 0x140000: 0x1040, 0x150000: 0x80400040, 0x160000: 0x80401000, 0x170000: 0x80001040, 0x180000: 0x80401040, 0x190000: 0x80000000, 0x1a0000: 0x80400000, 0x1b0000: 0x401040, 0x1c0000: 0x80001000, 0x1d0000: 0x400000, 0x1e0000: 0x40, 0x1f0000: 0x1000, 0x108000: 0x80400000, 0x118000: 0x80401040, 0x128000: 0x0, 0x138000: 0x401000, 0x148000: 0x400040, 0x158000: 0x80000000, 0x168000: 0x80001040, 0x178000: 0x40, 0x188000: 0x80000040, 0x198000: 0x1000, 0x1a8000: 0x80001000, 0x1b8000: 0x80400040, 0x1c8000: 0x1040, 0x1d8000: 0x80401000, 0x1e8000: 0x400000, 0x1f8000: 0x401040 }, { 0x0: 0x80, 0x1000: 0x1040000, 0x2000: 0x40000, 0x3000: 0x20000000, 0x4000: 0x20040080, 0x5000: 0x1000080, 0x6000: 0x21000080, 0x7000: 0x40080, 0x8000: 0x1000000, 0x9000: 0x20040000, 0xa000: 0x20000080, 0xb000: 0x21040080, 0xc000: 0x21040000, 0xd000: 0x0, 0xe000: 0x1040080, 0xf000: 0x21000000, 0x800: 0x1040080, 0x1800: 0x21000080, 0x2800: 0x80, 0x3800: 0x1040000, 0x4800: 0x40000, 0x5800: 0x20040080, 0x6800: 0x21040000, 0x7800: 0x20000000, 0x8800: 0x20040000, 0x9800: 0x0, 0xa800: 0x21040080, 0xb800: 0x1000080, 0xc800: 0x20000080, 0xd800: 0x21000000, 0xe800: 0x1000000, 0xf800: 0x40080, 0x10000: 0x40000, 0x11000: 0x80, 0x12000: 0x20000000, 0x13000: 0x21000080, 0x14000: 0x1000080, 0x15000: 0x21040000, 0x16000: 0x20040080, 0x17000: 0x1000000, 0x18000: 0x21040080, 0x19000: 0x21000000, 0x1a000: 0x1040000, 0x1b000: 0x20040000, 0x1c000: 0x40080, 0x1d000: 0x20000080, 0x1e000: 0x0, 0x1f000: 0x1040080, 0x10800: 0x21000080, 0x11800: 0x1000000, 0x12800: 0x1040000, 0x13800: 0x20040080, 0x14800: 0x20000000, 0x15800: 0x1040080, 0x16800: 0x80, 0x17800: 0x21040000, 0x18800: 0x40080, 0x19800: 0x21040080, 0x1a800: 0x0, 0x1b800: 0x21000000, 0x1c800: 0x1000080, 0x1d800: 0x40000, 0x1e800: 0x20040000, 0x1f800: 0x20000080 }, { 0x0: 0x10000008, 0x100: 0x2000, 0x200: 0x10200000, 0x300: 0x10202008, 0x400: 0x10002000, 0x500: 0x200000, 0x600: 0x200008, 0x700: 0x10000000, 0x800: 0x0, 0x900: 0x10002008, 0xa00: 0x202000, 0xb00: 0x8, 0xc00: 0x10200008, 0xd00: 0x202008, 0xe00: 0x2008, 0xf00: 0x10202000, 0x80: 0x10200000, 0x180: 0x10202008, 0x280: 0x8, 0x380: 0x200000, 0x480: 0x202008, 0x580: 0x10000008, 0x680: 0x10002000, 0x780: 0x2008, 0x880: 0x200008, 0x980: 0x2000, 0xa80: 0x10002008, 0xb80: 0x10200008, 0xc80: 0x0, 0xd80: 0x10202000, 0xe80: 0x202000, 0xf80: 0x10000000, 0x1000: 0x10002000, 0x1100: 0x10200008, 0x1200: 0x10202008, 0x1300: 0x2008, 0x1400: 0x200000, 0x1500: 0x10000000, 0x1600: 0x10000008, 0x1700: 0x202000, 0x1800: 0x202008, 0x1900: 0x0, 0x1a00: 0x8, 0x1b00: 0x10200000, 0x1c00: 0x2000, 0x1d00: 0x10002008, 0x1e00: 0x10202000, 0x1f00: 0x200008, 0x1080: 0x8, 0x1180: 0x202000, 0x1280: 0x200000, 0x1380: 0x10000008, 0x1480: 0x10002000, 0x1580: 0x2008, 0x1680: 0x10202008, 0x1780: 0x10200000, 0x1880: 0x10202000, 0x1980: 0x10200008, 0x1a80: 0x2000, 0x1b80: 0x202008, 0x1c80: 0x200008, 0x1d80: 0x0, 0x1e80: 0x10000000, 0x1f80: 0x10002008 }, { 0x0: 0x100000, 0x10: 0x2000401, 0x20: 0x400, 0x30: 0x100401, 0x40: 0x2100401, 0x50: 0x0, 0x60: 0x1, 0x70: 0x2100001, 0x80: 0x2000400, 0x90: 0x100001, 0xa0: 0x2000001, 0xb0: 0x2100400, 0xc0: 0x2100000, 0xd0: 0x401, 0xe0: 0x100400, 0xf0: 0x2000000, 0x8: 0x2100001, 0x18: 0x0, 0x28: 0x2000401, 0x38: 0x2100400, 0x48: 0x100000, 0x58: 0x2000001, 0x68: 0x2000000, 0x78: 0x401, 0x88: 0x100401, 0x98: 0x2000400, 0xa8: 0x2100000, 0xb8: 0x100001, 0xc8: 0x400, 0xd8: 0x2100401, 0xe8: 0x1, 0xf8: 0x100400, 0x100: 0x2000000, 0x110: 0x100000, 0x120: 0x2000401, 0x130: 0x2100001, 0x140: 0x100001, 0x150: 0x2000400, 0x160: 0x2100400, 0x170: 0x100401, 0x180: 0x401, 0x190: 0x2100401, 0x1a0: 0x100400, 0x1b0: 0x1, 0x1c0: 0x0, 0x1d0: 0x2100000, 0x1e0: 0x2000001, 0x1f0: 0x400, 0x108: 0x100400, 0x118: 0x2000401, 0x128: 0x2100001, 0x138: 0x1, 0x148: 0x2000000, 0x158: 0x100000, 0x168: 0x401, 0x178: 0x2100400, 0x188: 0x2000001, 0x198: 0x2100000, 0x1a8: 0x0, 0x1b8: 0x2100401, 0x1c8: 0x100401, 0x1d8: 0x400, 0x1e8: 0x2000400, 0x1f8: 0x100001 }, { 0x0: 0x8000820, 0x1: 0x20000, 0x2: 0x8000000, 0x3: 0x20, 0x4: 0x20020, 0x5: 0x8020820, 0x6: 0x8020800, 0x7: 0x800, 0x8: 0x8020000, 0x9: 0x8000800, 0xa: 0x20800, 0xb: 0x8020020, 0xc: 0x820, 0xd: 0x0, 0xe: 0x8000020, 0xf: 0x20820, 0x80000000: 0x800, 0x80000001: 0x8020820, 0x80000002: 0x8000820, 0x80000003: 0x8000000, 0x80000004: 0x8020000, 0x80000005: 0x20800, 0x80000006: 0x20820, 0x80000007: 0x20, 0x80000008: 0x8000020, 0x80000009: 0x820, 0x8000000a: 0x20020, 0x8000000b: 0x8020800, 0x8000000c: 0x0, 0x8000000d: 0x8020020, 0x8000000e: 0x8000800, 0x8000000f: 0x20000, 0x10: 0x20820, 0x11: 0x8020800, 0x12: 0x20, 0x13: 0x800, 0x14: 0x8000800, 0x15: 0x8000020, 0x16: 0x8020020, 0x17: 0x20000, 0x18: 0x0, 0x19: 0x20020, 0x1a: 0x8020000, 0x1b: 0x8000820, 0x1c: 0x8020820, 0x1d: 0x20800, 0x1e: 0x820, 0x1f: 0x8000000, 0x80000010: 0x20000, 0x80000011: 0x800, 0x80000012: 0x8020020, 0x80000013: 0x20820, 0x80000014: 0x20, 0x80000015: 0x8020000, 0x80000016: 0x8000000, 0x80000017: 0x8000820, 0x80000018: 0x8020820, 0x80000019: 0x8000020, 0x8000001a: 0x8000800, 0x8000001b: 0x0, 0x8000001c: 0x20800, 0x8000001d: 0x820, 0x8000001e: 0x20020, 0x8000001f: 0x8020800 } ]; // Masks that select the SBOX input var SBOX_MASK = [ 0xf8000001, 0x1f800000, 0x01f80000, 0x001f8000, 0x0001f800, 0x00001f80, 0x000001f8, 0x8000001f ]; /** * DES block cipher algorithm. */ var DES = C_algo.DES = BlockCipher.extend({ _doReset: function () { // Shortcuts var key = this._key; var keyWords = key.words; // Select 56 bits according to PC1 var keyBits = []; for (var i = 0; i < 56; i++) { var keyBitPos = PC1[i] - 1; keyBits[i] = (keyWords[keyBitPos >>> 5] >>> (31 - keyBitPos % 32)) & 1; } // Assemble 16 subkeys var subKeys = this._subKeys = []; for (var nSubKey = 0; nSubKey < 16; nSubKey++) { // Create subkey var subKey = subKeys[nSubKey] = []; // Shortcut var bitShift = BIT_SHIFTS[nSubKey]; // Select 48 bits according to PC2 for (var i = 0; i < 24; i++) { // Select from the left 28 key bits subKey[(i / 6) | 0] |= keyBits[((PC2[i] - 1) + bitShift) % 28] << (31 - i % 6); // Select from the right 28 key bits subKey[4 + ((i / 6) | 0)] |= keyBits[28 + (((PC2[i + 24] - 1) + bitShift) % 28)] << (31 - i % 6); } // Since each subkey is applied to an expanded 32-bit input, // the subkey can be broken into 8 values scaled to 32-bits, // which allows the key to be used without expansion subKey[0] = (subKey[0] << 1) | (subKey[0] >>> 31); for (var i = 1; i < 7; i++) { subKey[i] = subKey[i] >>> ((i - 1) * 4 + 3); } subKey[7] = (subKey[7] << 5) | (subKey[7] >>> 27); } // Compute inverse subkeys var invSubKeys = this._invSubKeys = []; for (var i = 0; i < 16; i++) { invSubKeys[i] = subKeys[15 - i]; } }, encryptBlock: function (M, offset) { this._doCryptBlock(M, offset, this._subKeys); }, decryptBlock: function (M, offset) { this._doCryptBlock(M, offset, this._invSubKeys); }, _doCryptBlock: function (M, offset, subKeys) { // Get input this._lBlock = M[offset]; this._rBlock = M[offset + 1]; // Initial permutation exchangeLR.call(this, 4, 0x0f0f0f0f); exchangeLR.call(this, 16, 0x0000ffff); exchangeRL.call(this, 2, 0x33333333); exchangeRL.call(this, 8, 0x00ff00ff); exchangeLR.call(this, 1, 0x55555555); // Rounds for (var round = 0; round < 16; round++) { // Shortcuts var subKey = subKeys[round]; var lBlock = this._lBlock; var rBlock = this._rBlock; // Feistel function var f = 0; for (var i = 0; i < 8; i++) { f |= SBOX_P[i][((rBlock ^ subKey[i]) & SBOX_MASK[i]) >>> 0]; } this._lBlock = rBlock; this._rBlock = lBlock ^ f; } // Undo swap from last round var t = this._lBlock; this._lBlock = this._rBlock; this._rBlock = t; // Final permutation exchangeLR.call(this, 1, 0x55555555); exchangeRL.call(this, 8, 0x00ff00ff); exchangeRL.call(this, 2, 0x33333333); exchangeLR.call(this, 16, 0x0000ffff); exchangeLR.call(this, 4, 0x0f0f0f0f); // Set output M[offset] = this._lBlock; M[offset + 1] = this._rBlock; }, keySize: 64/32, ivSize: 64/32, blockSize: 64/32 }); // Swap bits across the left and right words function exchangeLR(offset, mask) { var t = ((this._lBlock >>> offset) ^ this._rBlock) & mask; this._rBlock ^= t; this._lBlock ^= t << offset; } function exchangeRL(offset, mask) { var t = ((this._rBlock >>> offset) ^ this._lBlock) & mask; this._lBlock ^= t; this._rBlock ^= t << offset; } /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.DES.encrypt(message, key, cfg); * var plaintext = CryptoJS.DES.decrypt(ciphertext, key, cfg); */ C.DES = BlockCipher._createHelper(DES); /** * Triple-DES block cipher algorithm. */ var TripleDES = C_algo.TripleDES = BlockCipher.extend({ _doReset: function () { // Shortcuts var key = this._key; var keyWords = key.words; // Create DES instances this._des1 = DES.createEncryptor(WordArray.create(keyWords.slice(0, 2))); this._des2 = DES.createEncryptor(WordArray.create(keyWords.slice(2, 4))); this._des3 = DES.createEncryptor(WordArray.create(keyWords.slice(4, 6))); }, encryptBlock: function (M, offset) { this._des1.encryptBlock(M, offset); this._des2.decryptBlock(M, offset); this._des3.encryptBlock(M, offset); }, decryptBlock: function (M, offset) { this._des3.decryptBlock(M, offset); this._des2.encryptBlock(M, offset); this._des1.decryptBlock(M, offset); }, keySize: 192/32, ivSize: 64/32, blockSize: 64/32 }); /** * Shortcut functions to the cipher's object interface. * * @example * * var ciphertext = CryptoJS.TripleDES.encrypt(message, key, cfg); * var plaintext = CryptoJS.TripleDES.decrypt(ciphertext, key, cfg); */ C.TripleDES = BlockCipher._createHelper(TripleDES); }()); return CryptoJS.TripleDES; })); },{"./cipher-core":39,"./core":40,"./enc-base64":41,"./evpkdf":43,"./md5":48}],71:[function(_dereq_,module,exports){ ;(function (root, factory) { if (typeof exports === "object") { // CommonJS module.exports = exports = factory(_dereq_("./core")); } else if (typeof define === "function" && define.amd) { // AMD define(["./core"], factory); } else { // Global (browser) factory(root.CryptoJS); } }(this, function (CryptoJS) { (function (undefined) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; var Base = C_lib.Base; var X32WordArray = C_lib.WordArray; /** * x64 namespace. */ var C_x64 = C.x64 = {}; /** * A 64-bit word. */ var X64Word = C_x64.Word = Base.extend({ /** * Initializes a newly created 64-bit word. * * @param {number} high The high 32 bits. * @param {number} low The low 32 bits. * * @example * * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607); */ init: function (high, low) { this.high = high; this.low = low; } /** * Bitwise NOTs this word. * * @return {X64Word} A new x64-Word object after negating. * * @example * * var negated = x64Word.not(); */ // not: function () { // var high = ~this.high; // var low = ~this.low; // return X64Word.create(high, low); // }, /** * Bitwise ANDs this word with the passed word. * * @param {X64Word} word The x64-Word to AND with this word. * * @return {X64Word} A new x64-Word object after ANDing. * * @example * * var anded = x64Word.and(anotherX64Word); */ // and: function (word) { // var high = this.high & word.high; // var low = this.low & word.low; // return X64Word.create(high, low); // }, /** * Bitwise ORs this word with the passed word. * * @param {X64Word} word The x64-Word to OR with this word. * * @return {X64Word} A new x64-Word object after ORing. * * @example * * var ored = x64Word.or(anotherX64Word); */ // or: function (word) { // var high = this.high | word.high; // var low = this.low | word.low; // return X64Word.create(high, low); // }, /** * Bitwise XORs this word with the passed word. * * @param {X64Word} word The x64-Word to XOR with this word. * * @return {X64Word} A new x64-Word object after XORing. * * @example * * var xored = x64Word.xor(anotherX64Word); */ // xor: function (word) { // var high = this.high ^ word.high; // var low = this.low ^ word.low; // return X64Word.create(high, low); // }, /** * Shifts this word n bits to the left. * * @param {number} n The number of bits to shift. * * @return {X64Word} A new x64-Word object after shifting. * * @example * * var shifted = x64Word.shiftL(25); */ // shiftL: function (n) { // if (n < 32) { // var high = (this.high << n) | (this.low >>> (32 - n)); // var low = this.low << n; // } else { // var high = this.low << (n - 32); // var low = 0; // } // return X64Word.create(high, low); // }, /** * Shifts this word n bits to the right. * * @param {number} n The number of bits to shift. * * @return {X64Word} A new x64-Word object after shifting. * * @example * * var shifted = x64Word.shiftR(7); */ // shiftR: function (n) { // if (n < 32) { // var low = (this.low >>> n) | (this.high << (32 - n)); // var high = this.high >>> n; // } else { // var low = this.high >>> (n - 32); // var high = 0; // } // return X64Word.create(high, low); // }, /** * Rotates this word n bits to the left. * * @param {number} n The number of bits to rotate. * * @return {X64Word} A new x64-Word object after rotating. * * @example * * var rotated = x64Word.rotL(25); */ // rotL: function (n) { // return this.shiftL(n).or(this.shiftR(64 - n)); // }, /** * Rotates this word n bits to the right. * * @param {number} n The number of bits to rotate. * * @return {X64Word} A new x64-Word object after rotating. * * @example * * var rotated = x64Word.rotR(7); */ // rotR: function (n) { // return this.shiftR(n).or(this.shiftL(64 - n)); // }, /** * Adds this word with the passed word. * * @param {X64Word} word The x64-Word to add with this word. * * @return {X64Word} A new x64-Word object after adding. * * @example * * var added = x64Word.add(anotherX64Word); */ // add: function (word) { // var low = (this.low + word.low) | 0; // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0; // var high = (this.high + word.high + carry) | 0; // return X64Word.create(high, low); // } }); /** * An array of 64-bit words. * * @property {Array} words The array of CryptoJS.x64.Word objects. * @property {number} sigBytes The number of significant bytes in this word array. */ var X64WordArray = C_x64.WordArray = Base.extend({ /** * Initializes a newly created word array. * * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects. * @param {number} sigBytes (Optional) The number of significant bytes in the words. * * @example * * var wordArray = CryptoJS.x64.WordArray.create(); * * var wordArray = CryptoJS.x64.WordArray.create([ * CryptoJS.x64.Word.create(0x00010203, 0x04050607), * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) * ]); * * var wordArray = CryptoJS.x64.WordArray.create([ * CryptoJS.x64.Word.create(0x00010203, 0x04050607), * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f) * ], 10); */ init: function (words, sigBytes) { words = this.words = words || []; if (sigBytes != undefined) { this.sigBytes = sigBytes; } else { this.sigBytes = words.length * 8; } }, /** * Converts this 64-bit word array to a 32-bit word array. * * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array. * * @example * * var x32WordArray = x64WordArray.toX32(); */ toX32: function () { // Shortcuts var x64Words = this.words; var x64WordsLength = x64Words.length; // Convert var x32Words = []; for (var i = 0; i < x64WordsLength; i++) { var x64Word = x64Words[i]; x32Words.push(x64Word.high); x32Words.push(x64Word.low); } return X32WordArray.create(x32Words, this.sigBytes); }, /** * Creates a copy of this word array. * * @return {X64WordArray} The clone. * * @example * * var clone = x64WordArray.clone(); */ clone: function () { var clone = Base.clone.call(this); // Clone "words" array var words = clone.words = this.words.slice(0); // Clone each X64Word object var wordsLength = words.length; for (var i = 0; i < wordsLength; i++) { words[i] = words[i].clone(); } return clone; } }); }()); return CryptoJS; })); },{"./core":40}],72:[function(_dereq_,module,exports){ // shim for using process in browser var process = module.exports = {}; var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = setTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { currentQueue[queueIndex].run(); } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; clearTimeout(timeout); } 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)); if (queue.length === 1 && !draining) { setTimeout(drainQueue, 0); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} 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'); }; // TODO(shtylman) process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; },{}],73:[function(_dereq_,module,exports){ 'use strict'; var asap = _dereq_('asap') module.exports = Promise function Promise(fn) { if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new') if (typeof fn !== 'function') throw new TypeError('not a function') var state = null var value = null var deferreds = [] var self = this this.then = function(onFulfilled, onRejected) { return new Promise(function(resolve, reject) { handle(new Handler(onFulfilled, onRejected, resolve, reject)) }) } function handle(deferred) { if (state === null) { deferreds.push(deferred) return } asap(function() { var cb = state ? deferred.onFulfilled : deferred.onRejected if (cb === null) { (state ? deferred.resolve : deferred.reject)(value) return } var ret try { ret = cb(value) } catch (e) { deferred.reject(e) return } deferred.resolve(ret) }) } function resolve(newValue) { try { //Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure if (newValue === self) throw new TypeError('A promise cannot be resolved with itself.') if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) { var then = newValue.then if (typeof then === 'function') { doResolve(then.bind(newValue), resolve, reject) return } } state = true value = newValue finale() } catch (e) { reject(e) } } function reject(newValue) { state = false value = newValue finale() } function finale() { for (var i = 0, len = deferreds.length; i < len; i++) handle(deferreds[i]) deferreds = null } doResolve(fn, resolve, reject) } function Handler(onFulfilled, onRejected, resolve, reject){ this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null this.onRejected = typeof onRejected === 'function' ? onRejected : null this.resolve = resolve this.reject = reject } /** * Take a potentially misbehaving resolver function and make sure * onFulfilled and onRejected are only called once. * * Makes no guarantees about asynchrony. */ function doResolve(fn, onFulfilled, onRejected) { var done = false; try { fn(function (value) { if (done) return done = true onFulfilled(value) }, function (reason) { if (done) return done = true onRejected(reason) }) } catch (ex) { if (done) return done = true onRejected(ex) } } },{"asap":75}],74:[function(_dereq_,module,exports){ 'use strict'; //This file contains then/promise specific extensions to the core promise API var Promise = _dereq_('./core.js') var asap = _dereq_('asap') module.exports = Promise /* Static Functions */ function ValuePromise(value) { this.then = function (onFulfilled) { if (typeof onFulfilled !== 'function') return this return new Promise(function (resolve, reject) { asap(function () { try { resolve(onFulfilled(value)) } catch (ex) { reject(ex); } }) }) } } ValuePromise.prototype = Object.create(Promise.prototype) var TRUE = new ValuePromise(true) var FALSE = new ValuePromise(false) var NULL = new ValuePromise(null) var UNDEFINED = new ValuePromise(undefined) var ZERO = new ValuePromise(0) var EMPTYSTRING = new ValuePromise('') Promise.resolve = function (value) { if (value instanceof Promise) return value if (value === null) return NULL if (value === undefined) return UNDEFINED if (value === true) return TRUE if (value === false) return FALSE if (value === 0) return ZERO if (value === '') return EMPTYSTRING if (typeof value === 'object' || typeof value === 'function') { try { var then = value.then if (typeof then === 'function') { return new Promise(then.bind(value)) } } catch (ex) { return new Promise(function (resolve, reject) { reject(ex) }) } } return new ValuePromise(value) } Promise.from = Promise.cast = function (value) { var err = new Error('Promise.from and Promise.cast are deprecated, use Promise.resolve instead') err.name = 'Warning' console.warn(err.stack) return Promise.resolve(value) } Promise.denodeify = function (fn, argumentCount) { argumentCount = argumentCount || Infinity return function () { var self = this var args = Array.prototype.slice.call(arguments) return new Promise(function (resolve, reject) { while (args.length && args.length > argumentCount) { args.pop() } args.push(function (err, res) { if (err) reject(err) else resolve(res) }) fn.apply(self, args) }) } } Promise.nodeify = function (fn) { return function () { var args = Array.prototype.slice.call(arguments) var callback = typeof args[args.length - 1] === 'function' ? args.pop() : null try { return fn.apply(this, arguments).nodeify(callback) } catch (ex) { if (callback === null || typeof callback == 'undefined') { return new Promise(function (resolve, reject) { reject(ex) }) } else { asap(function () { callback(ex) }) } } } } Promise.all = function () { var calledWithArray = arguments.length === 1 && Array.isArray(arguments[0]) var args = Array.prototype.slice.call(calledWithArray ? arguments[0] : arguments) if (!calledWithArray) { var err = new Error('Promise.all should be called with a single array, calling it with multiple arguments is deprecated') err.name = 'Warning' console.warn(err.stack) } return new Promise(function (resolve, reject) { if (args.length === 0) return resolve([]) var remaining = args.length function res(i, val) { try { if (val && (typeof val === 'object' || typeof val === 'function')) { var then = val.then if (typeof then === 'function') { then.call(val, function (val) { res(i, val) }, reject) return } } args[i] = val if (--remaining === 0) { resolve(args); } } catch (ex) { reject(ex) } } for (var i = 0; i < args.length; i++) { res(i, args[i]) } }) } Promise.reject = function (value) { return new Promise(function (resolve, reject) { reject(value); }); } Promise.race = function (values) { return new Promise(function (resolve, reject) { values.forEach(function(value){ Promise.resolve(value).then(resolve, reject); }) }); } /* Prototype Methods */ Promise.prototype.done = function (onFulfilled, onRejected) { var self = arguments.length ? this.then.apply(this, arguments) : this self.then(null, function (err) { asap(function () { throw err }) }) } Promise.prototype.nodeify = function (callback) { if (typeof callback != 'function') return this this.then(function (value) { asap(function () { callback(null, value) }) }, function (err) { asap(function () { callback(err) }) }) } Promise.prototype['catch'] = function (onRejected) { return this.then(null, onRejected); } },{"./core.js":73,"asap":75}],75:[function(_dereq_,module,exports){ (function (process){ // Use the fastest possible means to execute a task in a future turn // of the event loop. // linked list of tasks (single, with head node) var head = {task: void 0, next: null}; var tail = head; var flushing = false; var requestFlush = void 0; var isNodeJS = false; function flush() { /* jshint loopfunc: true */ while (head.next) { head = head.next; var task = head.task; head.task = void 0; var domain = head.domain; if (domain) { head.domain = void 0; domain.enter(); } try { task(); } catch (e) { if (isNodeJS) { // In node, uncaught exceptions are considered fatal errors. // Re-throw them synchronously to interrupt flushing! // Ensure continuation if the uncaught exception is suppressed // listening "uncaughtException" events (as domains does). // Continue in next event to avoid tick recursion. if (domain) { domain.exit(); } setTimeout(flush, 0); if (domain) { domain.enter(); } throw e; } else { // In browsers, uncaught exceptions are not fatal. // Re-throw them asynchronously to avoid slow-downs. setTimeout(function() { throw e; }, 0); } } if (domain) { domain.exit(); } } flushing = false; } if (typeof process !== "undefined" && process.nextTick) { // Node.js before 0.9. Note that some fake-Node environments, like the // Mocha test runner, introduce a `process` global without a `nextTick`. isNodeJS = true; requestFlush = function () { process.nextTick(flush); }; } else if (typeof setImmediate === "function") { // In IE10, Node.js 0.9+, or https://github.com/NobleJS/setImmediate if (typeof window !== "undefined") { requestFlush = setImmediate.bind(window, flush); } else { requestFlush = function () { setImmediate(flush); }; } } else if (typeof MessageChannel !== "undefined") { // modern browsers // http://www.nonblocking.io/2011/06/windownexttick.html var channel = new MessageChannel(); channel.port1.onmessage = flush; requestFlush = function () { channel.port2.postMessage(0); }; } else { // old browsers requestFlush = function () { setTimeout(flush, 0); }; } function asap(task) { tail = tail.next = { task: task, domain: isNodeJS && process.domain, next: null }; if (!flushing) { flushing = true; requestFlush(); } }; module.exports = asap; }).call(this,_dereq_('_process')) },{"_process":72}],76:[function(_dereq_,module,exports){ // Some code originally from async_storage.js in // [Gaia](https://github.com/mozilla-b2g/gaia). (function() { 'use strict'; // Originally found in https://github.com/mozilla-b2g/gaia/blob/e8f624e4cc9ea945727278039b3bc9bcb9f8667a/shared/js/async_storage.js // Promises! var Promise = (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') ? _dereq_('promise') : this.Promise; // Initialize IndexedDB; fall back to vendor-prefixed versions if needed. var indexedDB = indexedDB || this.indexedDB || this.webkitIndexedDB || this.mozIndexedDB || this.OIndexedDB || this.msIndexedDB; // If IndexedDB isn't available, we get outta here! if (!indexedDB) { return; } var DETECT_BLOB_SUPPORT_STORE = 'local-forage-detect-blob-support'; var supportsBlobs; // Abstracts constructing a Blob object, so it also works in older // browsers that don't support the native Blob constructor. (i.e. // old QtWebKit versions, at least). function _createBlob(parts, properties) { parts = parts || []; properties = properties || {}; try { return new Blob(parts, properties); } catch (e) { if (e.name !== 'TypeError') { throw e; } var BlobBuilder = window.BlobBuilder || window.MSBlobBuilder || window.MozBlobBuilder || window.WebKitBlobBuilder; var builder = new BlobBuilder(); for (var i = 0; i < parts.length; i += 1) { builder.append(parts[i]); } return builder.getBlob(properties.type); } } // Transform a binary string to an array buffer, because otherwise // weird stuff happens when you try to work with the binary string directly. // It is known. // From http://stackoverflow.com/questions/14967647/ (continues on next line) // encode-decode-image-with-base64-breaks-image (2013-04-21) function _binStringToArrayBuffer(bin) { var length = bin.length; var buf = new ArrayBuffer(length); var arr = new Uint8Array(buf); for (var i = 0; i < length; i++) { arr[i] = bin.charCodeAt(i); } return buf; } // Fetch a blob using ajax. This reveals bugs in Chrome < 43. // For details on all this junk: // https://github.com/nolanlawson/state-of-binary-data-in-the-browser#readme function _blobAjax(url) { return new Promise(function(resolve, reject) { var xhr = new XMLHttpRequest(); xhr.open('GET', url); xhr.withCredentials = true; xhr.responseType = 'arraybuffer'; xhr.onreadystatechange = function() { if (xhr.readyState !== 4) { return; } if (xhr.status === 200) { return resolve({ response: xhr.response, type: xhr.getResponseHeader('Content-Type') }); } reject({status: xhr.status, response: xhr.response}); }; xhr.send(); }); } // // Detect blob support. Chrome didn't support it until version 38. // In version 37 they had a broken version where PNGs (and possibly // other binary types) aren't stored correctly, because when you fetch // them, the content type is always null. // // Furthermore, they have some outstanding bugs where blobs occasionally // are read by FileReader as null, or by ajax as 404s. // // Sadly we use the 404 bug to detect the FileReader bug, so if they // get fixed independently and released in different versions of Chrome, // then the bug could come back. So it's worthwhile to watch these issues: // 404 bug: https://code.google.com/p/chromium/issues/detail?id=447916 // FileReader bug: https://code.google.com/p/chromium/issues/detail?id=447836 // function _checkBlobSupportWithoutCaching(idb) { return new Promise(function(resolve, reject) { var blob = _createBlob([''], {type: 'image/png'}); var txn = idb.transaction([DETECT_BLOB_SUPPORT_STORE], 'readwrite'); txn.objectStore(DETECT_BLOB_SUPPORT_STORE).put(blob, 'key'); txn.oncomplete = function() { // have to do it in a separate transaction, else the correct // content type is always returned var blobTxn = idb.transaction([DETECT_BLOB_SUPPORT_STORE], 'readwrite'); var getBlobReq = blobTxn.objectStore( DETECT_BLOB_SUPPORT_STORE).get('key'); getBlobReq.onerror = reject; getBlobReq.onsuccess = function(e) { var storedBlob = e.target.result; var url = URL.createObjectURL(storedBlob); _blobAjax(url).then(function(res) { resolve(!!(res && res.type === 'image/png')); }, function() { resolve(false); }).then(function() { URL.revokeObjectURL(url); }); }; }; })['catch'](function() { return false; // error, so assume unsupported }); } function _checkBlobSupport(idb) { if (typeof supportsBlobs === 'boolean') { return Promise.resolve(supportsBlobs); } return _checkBlobSupportWithoutCaching(idb).then(function(value) { supportsBlobs = value; return supportsBlobs; }); } // encode a blob for indexeddb engines that don't support blobs function _encodeBlob(blob) { return new Promise(function(resolve, reject) { var reader = new FileReader(); reader.onerror = reject; reader.onloadend = function(e) { var base64 = btoa(e.target.result || ''); resolve({ __local_forage_encoded_blob: true, data: base64, type: blob.type }); }; reader.readAsBinaryString(blob); }); } // decode an encoded blob function _decodeBlob(encodedBlob) { var arrayBuff = _binStringToArrayBuffer(atob(encodedBlob.data)); return _createBlob([arrayBuff], { type: encodedBlob.type}); } // is this one of our fancy encoded blobs? function _isEncodedBlob(value) { return value && value.__local_forage_encoded_blob; } // Open the IndexedDB database (automatically creates one if one didn't // previously exist), using any options set in the config. function _initStorage(options) { var self = this; var dbInfo = { db: null }; if (options) { for (var i in options) { dbInfo[i] = options[i]; } } return new Promise(function(resolve, reject) { var openreq = indexedDB.open(dbInfo.name, dbInfo.version); openreq.onerror = function() { reject(openreq.error); }; openreq.onupgradeneeded = function(e) { // First time setup: create an empty object store openreq.result.createObjectStore(dbInfo.storeName); if (e.oldVersion <= 1) { // added when support for blob shims was added openreq.result.createObjectStore(DETECT_BLOB_SUPPORT_STORE); } }; openreq.onsuccess = function() { dbInfo.db = openreq.result; self._dbInfo = dbInfo; resolve(); }; }); } function getItem(key, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') .objectStore(dbInfo.storeName); var req = store.get(key); req.onsuccess = function() { var value = req.result; if (value === undefined) { value = null; } if (_isEncodedBlob(value)) { value = _decodeBlob(value); } resolve(value); }; req.onerror = function() { reject(req.error); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } // Iterate over all items stored in database. function iterate(iterator, callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') .objectStore(dbInfo.storeName); var req = store.openCursor(); var iterationNumber = 1; req.onsuccess = function() { var cursor = req.result; if (cursor) { var value = cursor.value; if (_isEncodedBlob(value)) { value = _decodeBlob(value); } var result = iterator(value, cursor.key, iterationNumber++); if (result !== void(0)) { resolve(result); } else { cursor['continue'](); } } else { resolve(); } }; req.onerror = function() { reject(req.error); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function setItem(key, value, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = new Promise(function(resolve, reject) { var dbInfo; self.ready().then(function() { dbInfo = self._dbInfo; return _checkBlobSupport(dbInfo.db); }).then(function(blobSupport) { if (!blobSupport && value instanceof Blob) { return _encodeBlob(value); } return value; }).then(function(value) { var transaction = dbInfo.db.transaction(dbInfo.storeName, 'readwrite'); var store = transaction.objectStore(dbInfo.storeName); // The reason we don't _save_ null is because IE 10 does // not support saving the `null` type in IndexedDB. How // ironic, given the bug below! // See: https://github.com/mozilla/localForage/issues/161 if (value === null) { value = undefined; } var req = store.put(value, key); transaction.oncomplete = function() { // Cast to undefined so the value passed to // callback/promise is the same as what one would get out // of `getItem()` later. This leads to some weirdness // (setItem('foo', undefined) will return `null`), but // it's not my fault localStorage is our baseline and that // it's weird. if (value === undefined) { value = null; } resolve(value); }; transaction.onabort = transaction.onerror = function() { var err = req.error ? req.error : req.transaction.error; reject(err); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function removeItem(key, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; var transaction = dbInfo.db.transaction(dbInfo.storeName, 'readwrite'); var store = transaction.objectStore(dbInfo.storeName); // We use a Grunt task to make this safe for IE and some // versions of Android (including those used by Cordova). // Normally IE won't like `['delete']()` and will insist on // using `['delete']()`, but we have a build step that // fixes this for us now. var req = store['delete'](key); transaction.oncomplete = function() { resolve(); }; transaction.onerror = function() { reject(req.error); }; // The request will be also be aborted if we've exceeded our storage // space. transaction.onabort = function() { var err = req.error ? req.error : req.transaction.error; reject(err); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function clear(callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; var transaction = dbInfo.db.transaction(dbInfo.storeName, 'readwrite'); var store = transaction.objectStore(dbInfo.storeName); var req = store.clear(); transaction.oncomplete = function() { resolve(); }; transaction.onabort = transaction.onerror = function() { var err = req.error ? req.error : req.transaction.error; reject(err); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function length(callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') .objectStore(dbInfo.storeName); var req = store.count(); req.onsuccess = function() { resolve(req.result); }; req.onerror = function() { reject(req.error); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function key(n, callback) { var self = this; var promise = new Promise(function(resolve, reject) { if (n < 0) { resolve(null); return; } self.ready().then(function() { var dbInfo = self._dbInfo; var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') .objectStore(dbInfo.storeName); var advanced = false; var req = store.openCursor(); req.onsuccess = function() { var cursor = req.result; if (!cursor) { // this means there weren't enough keys resolve(null); return; } if (n === 0) { // We have the first key, return it if that's what they // wanted. resolve(cursor.key); } else { if (!advanced) { // Otherwise, ask the cursor to skip ahead n // records. advanced = true; cursor.advance(n); } else { // When we get here, we've got the nth key. resolve(cursor.key); } } }; req.onerror = function() { reject(req.error); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function keys(callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly') .objectStore(dbInfo.storeName); var req = store.openCursor(); var keys = []; req.onsuccess = function() { var cursor = req.result; if (!cursor) { resolve(keys); return; } keys.push(cursor.key); cursor['continue'](); }; req.onerror = function() { reject(req.error); }; })['catch'](reject); }); executeCallback(promise, callback); return promise; } function executeCallback(promise, callback) { if (callback) { promise.then(function(result) { callback(null, result); }, function(error) { callback(error); }); } } var asyncStorage = { _driver: 'asyncStorage', _initStorage: _initStorage, iterate: iterate, getItem: getItem, setItem: setItem, removeItem: removeItem, clear: clear, length: length, key: key, keys: keys }; if (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') { module.exports = asyncStorage; } else if (typeof define === 'function' && define.amd) { define('asyncStorage', function() { return asyncStorage; }); } else { this.asyncStorage = asyncStorage; } }).call(window); },{"promise":74}],77:[function(_dereq_,module,exports){ // If IndexedDB isn't available, we'll fall back to localStorage. // Note that this will have considerable performance and storage // side-effects (all data will be serialized on save and only data that // can be converted to a string via `JSON.stringify()` will be saved). (function() { 'use strict'; // Promises! var Promise = (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') ? _dereq_('promise') : this.Promise; var globalObject = this; var serializer = null; var localStorage = null; // If the app is running inside a Google Chrome packaged webapp, or some // other context where localStorage isn't available, we don't use // localStorage. This feature detection is preferred over the old // `if (window.chrome && window.chrome.runtime)` code. // See: https://github.com/mozilla/localForage/issues/68 try { // If localStorage isn't available, we get outta here! // This should be inside a try catch if (!this.localStorage || !('setItem' in this.localStorage)) { return; } // Initialize localStorage and create a variable to use throughout // the code. localStorage = this.localStorage; } catch (e) { return; } var ModuleType = { DEFINE: 1, EXPORT: 2, WINDOW: 3 }; // Attaching to window (i.e. no module loader) is the assumed, // simple default. var moduleType = ModuleType.WINDOW; // Find out what kind of module setup we have; if none, we'll just attach // localForage to the main window. if (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') { moduleType = ModuleType.EXPORT; } else if (typeof define === 'function' && define.amd) { moduleType = ModuleType.DEFINE; } // Config the localStorage backend, using options set in the config. function _initStorage(options) { var self = this; var dbInfo = {}; if (options) { for (var i in options) { dbInfo[i] = options[i]; } } dbInfo.keyPrefix = dbInfo.name + '/'; self._dbInfo = dbInfo; var serializerPromise = new Promise(function(resolve/*, reject*/) { // We allow localForage to be declared as a module or as a // library available without AMD/require.js. if (moduleType === ModuleType.DEFINE) { _dereq_(['localforageSerializer'], resolve); } else if (moduleType === ModuleType.EXPORT) { // Making it browserify friendly resolve(_dereq_('./../utils/serializer')); } else { resolve(globalObject.localforageSerializer); } }); return serializerPromise.then(function(lib) { serializer = lib; return Promise.resolve(); }); } // Remove all keys from the datastore, effectively destroying all data in // the app's key/value store! function clear(callback) { var self = this; var promise = self.ready().then(function() { var keyPrefix = self._dbInfo.keyPrefix; for (var i = localStorage.length - 1; i >= 0; i--) { var key = localStorage.key(i); if (key.indexOf(keyPrefix) === 0) { localStorage.removeItem(key); } } }); executeCallback(promise, callback); return promise; } // Retrieve an item from the store. Unlike the original async_storage // library in Gaia, we don't modify return values at all. If a key's value // is `undefined`, we pass that value to the callback function. function getItem(key, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = self.ready().then(function() { var dbInfo = self._dbInfo; var result = localStorage.getItem(dbInfo.keyPrefix + key); // If a result was found, parse it from the serialized // string into a JS object. If result isn't truthy, the key // is likely undefined and we'll pass it straight to the // callback. if (result) { result = serializer.deserialize(result); } return result; }); executeCallback(promise, callback); return promise; } // Iterate over all items in the store. function iterate(iterator, callback) { var self = this; var promise = self.ready().then(function() { var keyPrefix = self._dbInfo.keyPrefix; var keyPrefixLength = keyPrefix.length; var length = localStorage.length; for (var i = 0; i < length; i++) { var key = localStorage.key(i); var value = localStorage.getItem(key); // If a result was found, parse it from the serialized // string into a JS object. If result isn't truthy, the // key is likely undefined and we'll pass it straight // to the iterator. if (value) { value = serializer.deserialize(value); } value = iterator(value, key.substring(keyPrefixLength), i + 1); if (value !== void(0)) { return value; } } }); executeCallback(promise, callback); return promise; } // Same as localStorage's key() method, except takes a callback. function key(n, callback) { var self = this; var promise = self.ready().then(function() { var dbInfo = self._dbInfo; var result; try { result = localStorage.key(n); } catch (error) { result = null; } // Remove the prefix from the key, if a key is found. if (result) { result = result.substring(dbInfo.keyPrefix.length); } return result; }); executeCallback(promise, callback); return promise; } function keys(callback) { var self = this; var promise = self.ready().then(function() { var dbInfo = self._dbInfo; var length = localStorage.length; var keys = []; for (var i = 0; i < length; i++) { if (localStorage.key(i).indexOf(dbInfo.keyPrefix) === 0) { keys.push(localStorage.key(i).substring(dbInfo.keyPrefix.length)); } } return keys; }); executeCallback(promise, callback); return promise; } // Supply the number of keys in the datastore to the callback function. function length(callback) { var self = this; var promise = self.keys().then(function(keys) { return keys.length; }); executeCallback(promise, callback); return promise; } // Remove an item from the store, nice and simple. function removeItem(key, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = self.ready().then(function() { var dbInfo = self._dbInfo; localStorage.removeItem(dbInfo.keyPrefix + key); }); executeCallback(promise, callback); return promise; } // Set a key's value and run an optional callback once the value is set. // Unlike Gaia's implementation, the callback function is passed the value, // in case you want to operate on that value only after you're sure it // saved, or something like that. function setItem(key, value, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = self.ready().then(function() { // Convert undefined values to null. // https://github.com/mozilla/localForage/pull/42 if (value === undefined) { value = null; } // Save the original value to pass to the callback. var originalValue = value; return new Promise(function(resolve, reject) { serializer.serialize(value, function(value, error) { if (error) { reject(error); } else { try { var dbInfo = self._dbInfo; localStorage.setItem(dbInfo.keyPrefix + key, value); resolve(originalValue); } catch (e) { // localStorage capacity exceeded. // TODO: Make this a specific error/event. if (e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') { reject(e); } reject(e); } } }); }); }); executeCallback(promise, callback); return promise; } function executeCallback(promise, callback) { if (callback) { promise.then(function(result) { callback(null, result); }, function(error) { callback(error); }); } } var localStorageWrapper = { _driver: 'localStorageWrapper', _initStorage: _initStorage, // Default API, from Gaia/localStorage. iterate: iterate, getItem: getItem, setItem: setItem, removeItem: removeItem, clear: clear, length: length, key: key, keys: keys }; if (moduleType === ModuleType.EXPORT) { module.exports = localStorageWrapper; } else if (moduleType === ModuleType.DEFINE) { define('localStorageWrapper', function() { return localStorageWrapper; }); } else { this.localStorageWrapper = localStorageWrapper; } }).call(window); },{"./../utils/serializer":80,"promise":74}],78:[function(_dereq_,module,exports){ /* * Includes code from: * * base64-arraybuffer * https://github.com/niklasvh/base64-arraybuffer * * Copyright (c) 2012 Niklas von Hertzen * Licensed under the MIT license. */ (function() { 'use strict'; // Promises! var Promise = (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') ? _dereq_('promise') : this.Promise; var globalObject = this; var serializer = null; var openDatabase = this.openDatabase; // If WebSQL methods aren't available, we can stop now. if (!openDatabase) { return; } var ModuleType = { DEFINE: 1, EXPORT: 2, WINDOW: 3 }; // Attaching to window (i.e. no module loader) is the assumed, // simple default. var moduleType = ModuleType.WINDOW; // Find out what kind of module setup we have; if none, we'll just attach // localForage to the main window. if (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') { moduleType = ModuleType.EXPORT; } else if (typeof define === 'function' && define.amd) { moduleType = ModuleType.DEFINE; } // Open the WebSQL database (automatically creates one if one didn't // previously exist), using any options set in the config. function _initStorage(options) { var self = this; var dbInfo = { db: null }; if (options) { for (var i in options) { dbInfo[i] = typeof(options[i]) !== 'string' ? options[i].toString() : options[i]; } } var serializerPromise = new Promise(function(resolve/*, reject*/) { // We allow localForage to be declared as a module or as a // library available without AMD/require.js. if (moduleType === ModuleType.DEFINE) { _dereq_(['localforageSerializer'], resolve); } else if (moduleType === ModuleType.EXPORT) { // Making it browserify friendly resolve(_dereq_('./../utils/serializer')); } else { resolve(globalObject.localforageSerializer); } }); var dbInfoPromise = new Promise(function(resolve, reject) { // Open the database; the openDatabase API will automatically // create it for us if it doesn't exist. try { dbInfo.db = openDatabase(dbInfo.name, String(dbInfo.version), dbInfo.description, dbInfo.size); } catch (e) { return self.setDriver(self.LOCALSTORAGE).then(function() { return self._initStorage(options); }).then(resolve)['catch'](reject); } // Create our key/value table if it doesn't exist. dbInfo.db.transaction(function(t) { t.executeSql('CREATE TABLE IF NOT EXISTS ' + dbInfo.storeName + ' (id INTEGER PRIMARY KEY, key unique, value)', [], function() { self._dbInfo = dbInfo; resolve(); }, function(t, error) { reject(error); }); }); }); return serializerPromise.then(function(lib) { serializer = lib; return dbInfoPromise; }); } function getItem(key, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('SELECT * FROM ' + dbInfo.storeName + ' WHERE key = ? LIMIT 1', [key], function(t, results) { var result = results.rows.length ? results.rows.item(0).value : null; // Check to see if this is serialized content we need to // unpack. if (result) { result = serializer.deserialize(result); } resolve(result); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } function iterate(iterator, callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('SELECT * FROM ' + dbInfo.storeName, [], function(t, results) { var rows = results.rows; var length = rows.length; for (var i = 0; i < length; i++) { var item = rows.item(i); var result = item.value; // Check to see if this is serialized content // we need to unpack. if (result) { result = serializer.deserialize(result); } result = iterator(result, item.key, i + 1); // void(0) prevents problems with redefinition // of `undefined`. if (result !== void(0)) { resolve(result); return; } } resolve(); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } function setItem(key, value, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = new Promise(function(resolve, reject) { self.ready().then(function() { // The localStorage API doesn't return undefined values in an // "expected" way, so undefined is always cast to null in all // drivers. See: https://github.com/mozilla/localForage/pull/42 if (value === undefined) { value = null; } // Save the original value to pass to the callback. var originalValue = value; serializer.serialize(value, function(value, error) { if (error) { reject(error); } else { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('INSERT OR REPLACE INTO ' + dbInfo.storeName + ' (key, value) VALUES (?, ?)', [key, value], function() { resolve(originalValue); }, function(t, error) { reject(error); }); }, function(sqlError) { // The transaction failed; check // to see if it's a quota error. if (sqlError.code === sqlError.QUOTA_ERR) { // We reject the callback outright for now, but // it's worth trying to re-run the transaction. // Even if the user accepts the prompt to use // more storage on Safari, this error will // be called. // // TODO: Try to re-run the transaction. reject(sqlError); } }); } }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } function removeItem(key, callback) { var self = this; // Cast the key to a string, as that's all we can set as a key. if (typeof key !== 'string') { window.console.warn(key + ' used as a key, but it is not a string.'); key = String(key); } var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('DELETE FROM ' + dbInfo.storeName + ' WHERE key = ?', [key], function() { resolve(); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } // Deletes every item in the table. // TODO: Find out if this resets the AUTO_INCREMENT number. function clear(callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('DELETE FROM ' + dbInfo.storeName, [], function() { resolve(); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } // Does a simple `COUNT(key)` to get the number of items stored in // localForage. function length(callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { // Ahhh, SQL makes this one soooooo easy. t.executeSql('SELECT COUNT(key) as c FROM ' + dbInfo.storeName, [], function(t, results) { var result = results.rows.item(0).c; resolve(result); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } // Return the key located at key index X; essentially gets the key from a // `WHERE id = ?`. This is the most efficient way I can think to implement // this rarely-used (in my experience) part of the API, but it can seem // inconsistent, because we do `INSERT OR REPLACE INTO` on `setItem()`, so // the ID of each key will change every time it's updated. Perhaps a stored // procedure for the `setItem()` SQL would solve this problem? // TODO: Don't change ID on `setItem()`. function key(n, callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('SELECT key FROM ' + dbInfo.storeName + ' WHERE id = ? LIMIT 1', [n + 1], function(t, results) { var result = results.rows.length ? results.rows.item(0).key : null; resolve(result); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } function keys(callback) { var self = this; var promise = new Promise(function(resolve, reject) { self.ready().then(function() { var dbInfo = self._dbInfo; dbInfo.db.transaction(function(t) { t.executeSql('SELECT key FROM ' + dbInfo.storeName, [], function(t, results) { var keys = []; for (var i = 0; i < results.rows.length; i++) { keys.push(results.rows.item(i).key); } resolve(keys); }, function(t, error) { reject(error); }); }); })['catch'](reject); }); executeCallback(promise, callback); return promise; } function executeCallback(promise, callback) { if (callback) { promise.then(function(result) { callback(null, result); }, function(error) { callback(error); }); } } var webSQLStorage = { _driver: 'webSQLStorage', _initStorage: _initStorage, iterate: iterate, getItem: getItem, setItem: setItem, removeItem: removeItem, clear: clear, length: length, key: key, keys: keys }; if (moduleType === ModuleType.DEFINE) { define('webSQLStorage', function() { return webSQLStorage; }); } else if (moduleType === ModuleType.EXPORT) { module.exports = webSQLStorage; } else { this.webSQLStorage = webSQLStorage; } }).call(window); },{"./../utils/serializer":80,"promise":74}],79:[function(_dereq_,module,exports){ (function() { 'use strict'; // Promises! var Promise = (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') ? _dereq_('promise') : this.Promise; // Custom drivers are stored here when `defineDriver()` is called. // They are shared across all instances of localForage. var CustomDrivers = {}; var DriverType = { INDEXEDDB: 'asyncStorage', LOCALSTORAGE: 'localStorageWrapper', WEBSQL: 'webSQLStorage' }; var DefaultDriverOrder = [ DriverType.INDEXEDDB, DriverType.WEBSQL, DriverType.LOCALSTORAGE ]; var LibraryMethods = [ 'clear', 'getItem', 'iterate', 'key', 'keys', 'length', 'removeItem', 'setItem' ]; var ModuleType = { DEFINE: 1, EXPORT: 2, WINDOW: 3 }; var DefaultConfig = { description: '', driver: DefaultDriverOrder.slice(), name: 'localforage', // Default DB size is _JUST UNDER_ 5MB, as it's the highest size // we can use without a prompt. size: 4980736, storeName: 'keyvaluepairs', version: 1.0 }; // Attaching to window (i.e. no module loader) is the assumed, // simple default. var moduleType = ModuleType.WINDOW; // Find out what kind of module setup we have; if none, we'll just attach // localForage to the main window. if (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') { moduleType = ModuleType.EXPORT; } else if (typeof define === 'function' && define.amd) { moduleType = ModuleType.DEFINE; } // Check to see if IndexedDB is available and if it is the latest // implementation; it's our preferred backend library. We use "_spec_test" // as the name of the database because it's not the one we'll operate on, // but it's useful to make sure its using the right spec. // See: https://github.com/mozilla/localForage/issues/128 var driverSupport = (function(self) { // Initialize IndexedDB; fall back to vendor-prefixed versions // if needed. var indexedDB = indexedDB || self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.OIndexedDB || self.msIndexedDB; var result = {}; result[DriverType.WEBSQL] = !!self.openDatabase; result[DriverType.INDEXEDDB] = !!(function() { // We mimic PouchDB here; just UA test for Safari (which, as of // iOS 8/Yosemite, doesn't properly support IndexedDB). // IndexedDB support is broken and different from Blink's. // This is faster than the test case (and it's sync), so we just // do this. *SIGH* // http://bl.ocks.org/nolanlawson/raw/c83e9039edf2278047e9/ // // We test for openDatabase because IE Mobile identifies itself // as Safari. Oh the lulz... if (typeof self.openDatabase !== 'undefined' && self.navigator && self.navigator.userAgent && /Safari/.test(self.navigator.userAgent) && !/Chrome/.test(self.navigator.userAgent)) { return false; } try { return indexedDB && typeof indexedDB.open === 'function' && // Some Samsung/HTC Android 4.0-4.3 devices // have older IndexedDB specs; if this isn't available // their IndexedDB is too old for us to use. // (Replaces the onupgradeneeded test.) typeof self.IDBKeyRange !== 'undefined'; } catch (e) { return false; } })(); result[DriverType.LOCALSTORAGE] = !!(function() { try { return (self.localStorage && ('setItem' in self.localStorage) && (self.localStorage.setItem)); } catch (e) { return false; } })(); return result; })(this); var isArray = Array.isArray || function(arg) { return Object.prototype.toString.call(arg) === '[object Array]'; }; function callWhenReady(localForageInstance, libraryMethod) { localForageInstance[libraryMethod] = function() { var _args = arguments; return localForageInstance.ready().then(function() { return localForageInstance[libraryMethod].apply(localForageInstance, _args); }); }; } function extend() { for (var i = 1; i < arguments.length; i++) { var arg = arguments[i]; if (arg) { for (var key in arg) { if (arg.hasOwnProperty(key)) { if (isArray(arg[key])) { arguments[0][key] = arg[key].slice(); } else { arguments[0][key] = arg[key]; } } } } } return arguments[0]; } function isLibraryDriver(driverName) { for (var driver in DriverType) { if (DriverType.hasOwnProperty(driver) && DriverType[driver] === driverName) { return true; } } return false; } var globalObject = this; function LocalForage(options) { this._config = extend({}, DefaultConfig, options); this._driverSet = null; this._ready = false; this._dbInfo = null; // Add a stub for each driver API method that delays the call to the // corresponding driver method until localForage is ready. These stubs // will be replaced by the driver methods as soon as the driver is // loaded, so there is no performance impact. for (var i = 0; i < LibraryMethods.length; i++) { callWhenReady(this, LibraryMethods[i]); } this.setDriver(this._config.driver); } LocalForage.prototype.INDEXEDDB = DriverType.INDEXEDDB; LocalForage.prototype.LOCALSTORAGE = DriverType.LOCALSTORAGE; LocalForage.prototype.WEBSQL = DriverType.WEBSQL; // Set any config values for localForage; can be called anytime before // the first API call (e.g. `getItem`, `setItem`). // We loop through options so we don't overwrite existing config // values. LocalForage.prototype.config = function(options) { // If the options argument is an object, we use it to set values. // Otherwise, we return either a specified config value or all // config values. if (typeof(options) === 'object') { // If localforage is ready and fully initialized, we can't set // any new configuration values. Instead, we return an error. if (this._ready) { return new Error("Can't call config() after localforage " + 'has been used.'); } for (var i in options) { if (i === 'storeName') { options[i] = options[i].replace(/\W/g, '_'); } this._config[i] = options[i]; } // after all config options are set and // the driver option is used, try setting it if ('driver' in options && options.driver) { this.setDriver(this._config.driver); } return true; } else if (typeof(options) === 'string') { return this._config[options]; } else { return this._config; } }; // Used to define a custom driver, shared across all instances of // localForage. LocalForage.prototype.defineDriver = function(driverObject, callback, errorCallback) { var defineDriver = new Promise(function(resolve, reject) { try { var driverName = driverObject._driver; var complianceError = new Error( 'Custom driver not compliant; see ' + 'https://mozilla.github.io/localForage/#definedriver' ); var namingError = new Error( 'Custom driver name already in use: ' + driverObject._driver ); // A driver name should be defined and not overlap with the // library-defined, default drivers. if (!driverObject._driver) { reject(complianceError); return; } if (isLibraryDriver(driverObject._driver)) { reject(namingError); return; } var customDriverMethods = LibraryMethods.concat('_initStorage'); for (var i = 0; i < customDriverMethods.length; i++) { var customDriverMethod = customDriverMethods[i]; if (!customDriverMethod || !driverObject[customDriverMethod] || typeof driverObject[customDriverMethod] !== 'function') { reject(complianceError); return; } } var supportPromise = Promise.resolve(true); if ('_support' in driverObject) { if (driverObject._support && typeof driverObject._support === 'function') { supportPromise = driverObject._support(); } else { supportPromise = Promise.resolve(!!driverObject._support); } } supportPromise.then(function(supportResult) { driverSupport[driverName] = supportResult; CustomDrivers[driverName] = driverObject; resolve(); }, reject); } catch (e) { reject(e); } }); defineDriver.then(callback, errorCallback); return defineDriver; }; LocalForage.prototype.driver = function() { return this._driver || null; }; LocalForage.prototype.ready = function(callback) { var self = this; var ready = new Promise(function(resolve, reject) { self._driverSet.then(function() { if (self._ready === null) { self._ready = self._initStorage(self._config); } self._ready.then(resolve, reject); })['catch'](reject); }); ready.then(callback, callback); return ready; }; LocalForage.prototype.setDriver = function(drivers, callback, errorCallback) { var self = this; if (typeof drivers === 'string') { drivers = [drivers]; } this._driverSet = new Promise(function(resolve, reject) { var driverName = self._getFirstSupportedDriver(drivers); var error = new Error('No available storage method found.'); if (!driverName) { self._driverSet = Promise.reject(error); reject(error); return; } self._dbInfo = null; self._ready = null; if (isLibraryDriver(driverName)) { var driverPromise = new Promise(function(resolve/*, reject*/) { // We allow localForage to be declared as a module or as a // library available without AMD/require.js. if (moduleType === ModuleType.DEFINE) { _dereq_([driverName], resolve); } else if (moduleType === ModuleType.EXPORT) { // Making it browserify friendly switch (driverName) { case self.INDEXEDDB: resolve(_dereq_('./drivers/indexeddb')); break; case self.LOCALSTORAGE: resolve(_dereq_('./drivers/localstorage')); break; case self.WEBSQL: resolve(_dereq_('./drivers/websql')); break; } } else { resolve(globalObject[driverName]); } }); driverPromise.then(function(driver) { self._extend(driver); resolve(); }); } else if (CustomDrivers[driverName]) { self._extend(CustomDrivers[driverName]); resolve(); } else { self._driverSet = Promise.reject(error); reject(error); } }); function setDriverToConfig() { self._config.driver = self.driver(); } this._driverSet.then(setDriverToConfig, setDriverToConfig); this._driverSet.then(callback, errorCallback); return this._driverSet; }; LocalForage.prototype.supports = function(driverName) { return !!driverSupport[driverName]; }; LocalForage.prototype._extend = function(libraryMethodsAndProperties) { extend(this, libraryMethodsAndProperties); }; // Used to determine which driver we should use as the backend for this // instance of localForage. LocalForage.prototype._getFirstSupportedDriver = function(drivers) { if (drivers && isArray(drivers)) { for (var i = 0; i < drivers.length; i++) { var driver = drivers[i]; if (this.supports(driver)) { return driver; } } } return null; }; LocalForage.prototype.createInstance = function(options) { return new LocalForage(options); }; // The actual localForage object that we expose as a module or via a // global. It's extended by pulling in one of our other libraries. var localForage = new LocalForage(); // We allow localForage to be declared as a module or as a library // available without AMD/require.js. if (moduleType === ModuleType.DEFINE) { define('localforage', function() { return localForage; }); } else if (moduleType === ModuleType.EXPORT) { module.exports = localForage; } else { this.localforage = localForage; } }).call(window); },{"./drivers/indexeddb":76,"./drivers/localstorage":77,"./drivers/websql":78,"promise":74}],80:[function(_dereq_,module,exports){ (function() { 'use strict'; // Sadly, the best way to save binary data in WebSQL/localStorage is serializing // it to Base64, so this is how we store it to prevent very strange errors with less // verbose ways of binary <-> string data storage. var BASE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; var BLOB_TYPE_PREFIX = '~~local_forage_type~'; var BLOB_TYPE_PREFIX_REGEX = /^~~local_forage_type~([^~]+)~/; var SERIALIZED_MARKER = '__lfsc__:'; var SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER.length; // OMG the serializations! var TYPE_ARRAYBUFFER = 'arbf'; var TYPE_BLOB = 'blob'; var TYPE_INT8ARRAY = 'si08'; var TYPE_UINT8ARRAY = 'ui08'; var TYPE_UINT8CLAMPEDARRAY = 'uic8'; var TYPE_INT16ARRAY = 'si16'; var TYPE_INT32ARRAY = 'si32'; var TYPE_UINT16ARRAY = 'ur16'; var TYPE_UINT32ARRAY = 'ui32'; var TYPE_FLOAT32ARRAY = 'fl32'; var TYPE_FLOAT64ARRAY = 'fl64'; var TYPE_SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER_LENGTH + TYPE_ARRAYBUFFER.length; // Get out of our habit of using `window` inline, at least. var globalObject = this; // Abstracts constructing a Blob object, so it also works in older // browsers that don't support the native Blob constructor. (i.e. // old QtWebKit versions, at least). function _createBlob(parts, properties) { parts = parts || []; properties = properties || {}; try { return new Blob(parts, properties); } catch (err) { if (err.name !== 'TypeError') { throw err; } var BlobBuilder = globalObject.BlobBuilder || globalObject.MSBlobBuilder || globalObject.MozBlobBuilder || globalObject.WebKitBlobBuilder; var builder = new BlobBuilder(); for (var i = 0; i < parts.length; i += 1) { builder.append(parts[i]); } return builder.getBlob(properties.type); } } // Serialize a value, afterwards executing a callback (which usually // instructs the `setItem()` callback/promise to be executed). This is how // we store binary data with localStorage. function serialize(value, callback) { var valueString = ''; if (value) { valueString = value.toString(); } // Cannot use `value instanceof ArrayBuffer` or such here, as these // checks fail when running the tests using casper.js... // // TODO: See why those tests fail and use a better solution. if (value && (value.toString() === '[object ArrayBuffer]' || value.buffer && value.buffer.toString() === '[object ArrayBuffer]')) { // Convert binary arrays to a string and prefix the string with // a special marker. var buffer; var marker = SERIALIZED_MARKER; if (value instanceof ArrayBuffer) { buffer = value; marker += TYPE_ARRAYBUFFER; } else { buffer = value.buffer; if (valueString === '[object Int8Array]') { marker += TYPE_INT8ARRAY; } else if (valueString === '[object Uint8Array]') { marker += TYPE_UINT8ARRAY; } else if (valueString === '[object Uint8ClampedArray]') { marker += TYPE_UINT8CLAMPEDARRAY; } else if (valueString === '[object Int16Array]') { marker += TYPE_INT16ARRAY; } else if (valueString === '[object Uint16Array]') { marker += TYPE_UINT16ARRAY; } else if (valueString === '[object Int32Array]') { marker += TYPE_INT32ARRAY; } else if (valueString === '[object Uint32Array]') { marker += TYPE_UINT32ARRAY; } else if (valueString === '[object Float32Array]') { marker += TYPE_FLOAT32ARRAY; } else if (valueString === '[object Float64Array]') { marker += TYPE_FLOAT64ARRAY; } else { callback(new Error('Failed to get type for BinaryArray')); } } callback(marker + bufferToString(buffer)); } else if (valueString === '[object Blob]') { // Conver the blob to a binaryArray and then to a string. var fileReader = new FileReader(); fileReader.onload = function() { // Backwards-compatible prefix for the blob type. var str = BLOB_TYPE_PREFIX + value.type + '~' + bufferToString(this.result); callback(SERIALIZED_MARKER + TYPE_BLOB + str); }; fileReader.readAsArrayBuffer(value); } else { try { callback(JSON.stringify(value)); } catch (e) { console.error("Couldn't convert value into a JSON string: ", value); callback(null, e); } } } // Deserialize data we've inserted into a value column/field. We place // special markers into our strings to mark them as encoded; this isn't // as nice as a meta field, but it's the only sane thing we can do whilst // keeping localStorage support intact. // // Oftentimes this will just deserialize JSON content, but if we have a // special marker (SERIALIZED_MARKER, defined above), we will extract // some kind of arraybuffer/binary data/typed array out of the string. function deserialize(value) { // If we haven't marked this string as being specially serialized (i.e. // something other than serialized JSON), we can just return it and be // done with it. if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) { return JSON.parse(value); } // The following code deals with deserializing some kind of Blob or // TypedArray. First we separate out the type of data we're dealing // with from the data itself. var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH); var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH); var blobType; // Backwards-compatible blob type serialization strategy. // DBs created with older versions of localForage will simply not have the blob type. if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) { var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX); blobType = matcher[1]; serializedString = serializedString.substring(matcher[0].length); } var buffer = stringToBuffer(serializedString); // Return the right type based on the code/type set during // serialization. switch (type) { case TYPE_ARRAYBUFFER: return buffer; case TYPE_BLOB: return _createBlob([buffer], {type: blobType}); case TYPE_INT8ARRAY: return new Int8Array(buffer); case TYPE_UINT8ARRAY: return new Uint8Array(buffer); case TYPE_UINT8CLAMPEDARRAY: return new Uint8ClampedArray(buffer); case TYPE_INT16ARRAY: return new Int16Array(buffer); case TYPE_UINT16ARRAY: return new Uint16Array(buffer); case TYPE_INT32ARRAY: return new Int32Array(buffer); case TYPE_UINT32ARRAY: return new Uint32Array(buffer); case TYPE_FLOAT32ARRAY: return new Float32Array(buffer); case TYPE_FLOAT64ARRAY: return new Float64Array(buffer); default: throw new Error('Unkown type: ' + type); } } function stringToBuffer(serializedString) { // Fill the string into a ArrayBuffer. var bufferLength = serializedString.length * 0.75; var len = serializedString.length; var i; var p = 0; var encoded1, encoded2, encoded3, encoded4; if (serializedString[serializedString.length - 1] === '=') { bufferLength--; if (serializedString[serializedString.length - 2] === '=') { bufferLength--; } } var buffer = new ArrayBuffer(bufferLength); var bytes = new Uint8Array(buffer); for (i = 0; i < len; i+=4) { encoded1 = BASE_CHARS.indexOf(serializedString[i]); encoded2 = BASE_CHARS.indexOf(serializedString[i+1]); encoded3 = BASE_CHARS.indexOf(serializedString[i+2]); encoded4 = BASE_CHARS.indexOf(serializedString[i+3]); /*jslint bitwise: true */ bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); } return buffer; } // Converts a buffer to a string to store, serialized, in the backend // storage library. function bufferToString(buffer) { // base64-arraybuffer var bytes = new Uint8Array(buffer); var base64String = ''; var i; for (i = 0; i < bytes.length; i += 3) { /*jslint bitwise: true */ base64String += BASE_CHARS[bytes[i] >> 2]; base64String += BASE_CHARS[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; base64String += BASE_CHARS[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; base64String += BASE_CHARS[bytes[i + 2] & 63]; } if ((bytes.length % 3) === 2) { base64String = base64String.substring(0, base64String.length - 1) + '='; } else if (bytes.length % 3 === 1) { base64String = base64String.substring(0, base64String.length - 2) + '=='; } return base64String; } var localforageSerializer = { serialize: serialize, deserialize: deserialize, stringToBuffer: stringToBuffer, bufferToString: bufferToString }; if (typeof module !== 'undefined' && module.exports && typeof _dereq_ !== 'undefined') { module.exports = localforageSerializer; } else if (typeof define === 'function' && define.amd) { define('localforageSerializer', function() { return localforageSerializer; }); } else { this.localforageSerializer = localforageSerializer; } }).call(window); },{}],81:[function(_dereq_,module,exports){ // Top level file is just a mixin of submodules & constants 'use strict'; var assign = _dereq_('./lib/utils/common').assign; var deflate = _dereq_('./lib/deflate'); var inflate = _dereq_('./lib/inflate'); var constants = _dereq_('./lib/zlib/constants'); var pako = {}; assign(pako, deflate, inflate, constants); module.exports = pako; },{"./lib/deflate":82,"./lib/inflate":83,"./lib/utils/common":84,"./lib/zlib/constants":87}],82:[function(_dereq_,module,exports){ 'use strict'; var zlib_deflate = _dereq_('./zlib/deflate.js'); var utils = _dereq_('./utils/common'); var strings = _dereq_('./utils/strings'); var msg = _dereq_('./zlib/messages'); var zstream = _dereq_('./zlib/zstream'); var toString = Object.prototype.toString; /* Public constants ==========================================================*/ /* ===========================================================================*/ var Z_NO_FLUSH = 0; var Z_FINISH = 4; var Z_OK = 0; var Z_STREAM_END = 1; var Z_SYNC_FLUSH = 2; var Z_DEFAULT_COMPRESSION = -1; var Z_DEFAULT_STRATEGY = 0; var Z_DEFLATED = 8; /* ===========================================================================*/ /** * class Deflate * * Generic JS-style wrapper for zlib calls. If you don't need * streaming behaviour - use more simple functions: [[deflate]], * [[deflateRaw]] and [[gzip]]. **/ /* internal * Deflate.chunks -> Array * * Chunks of output data, if [[Deflate#onData]] not overriden. **/ /** * Deflate.result -> Uint8Array|Array * * Compressed result, generated by default [[Deflate#onData]] * and [[Deflate#onEnd]] handlers. Filled after you push last chunk * (call [[Deflate#push]] with `Z_FINISH` / `true` param) or if you * push a chunk with explicit flush (call [[Deflate#push]] with * `Z_SYNC_FLUSH` param). **/ /** * Deflate.err -> Number * * Error code after deflate finished. 0 (Z_OK) on success. * You will not need it in real life, because deflate errors * are possible only on wrong options or bad `onData` / `onEnd` * custom handlers. **/ /** * Deflate.msg -> String * * Error message, if [[Deflate.err]] != 0 **/ /** * new Deflate(options) * - options (Object): zlib deflate options. * * Creates new deflator instance with specified params. Throws exception * on bad params. Supported options: * * - `level` * - `windowBits` * - `memLevel` * - `strategy` * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information on these. * * Additional options, for internal needs: * * - `chunkSize` - size of generated data chunks (16K by default) * - `raw` (Boolean) - do raw deflate * - `gzip` (Boolean) - create gzip wrapper * - `to` (String) - if equal to 'string', then result will be "binary string" * (each char code [0..255]) * - `header` (Object) - custom header for gzip * - `text` (Boolean) - true if compressed data believed to be text * - `time` (Number) - modification time, unix timestamp * - `os` (Number) - operation system code * - `extra` (Array) - array of bytes with extra data (max 65536) * - `name` (String) - file name (binary string) * - `comment` (String) - comment (binary string) * - `hcrc` (Boolean) - true if header crc should be added * * ##### Example: * * ```javascript * var pako = require('pako') * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); * * var deflate = new pako.Deflate({ level: 3}); * * deflate.push(chunk1, false); * deflate.push(chunk2, true); // true -> last chunk * * if (deflate.err) { throw new Error(deflate.err); } * * console.log(deflate.result); * ``` **/ var Deflate = function(options) { this.options = utils.assign({ level: Z_DEFAULT_COMPRESSION, method: Z_DEFLATED, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: Z_DEFAULT_STRATEGY, to: '' }, options || {}); var opt = this.options; if (opt.raw && (opt.windowBits > 0)) { opt.windowBits = -opt.windowBits; } else if (opt.gzip && (opt.windowBits > 0) && (opt.windowBits < 16)) { opt.windowBits += 16; } this.err = 0; // error code, if happens (0 = Z_OK) this.msg = ''; // error message this.ended = false; // used to avoid multiple onEnd() calls this.chunks = []; // chunks of compressed data this.strm = new zstream(); this.strm.avail_out = 0; var status = zlib_deflate.deflateInit2( this.strm, opt.level, opt.method, opt.windowBits, opt.memLevel, opt.strategy ); if (status !== Z_OK) { throw new Error(msg[status]); } if (opt.header) { zlib_deflate.deflateSetHeader(this.strm, opt.header); } }; /** * Deflate#push(data[, mode]) -> Boolean * - data (Uint8Array|Array|ArrayBuffer|String): input data. Strings will be * converted to utf8 byte sequence. * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. * See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH. * * Sends input data to deflate pipe, generating [[Deflate#onData]] calls with * new compressed chunks. Returns `true` on success. The last data block must have * mode Z_FINISH (or `true`). That will flush internal pending buffers and call * [[Deflate#onEnd]]. For interim explicit flushes (without ending the stream) you * can use mode Z_SYNC_FLUSH, keeping the compression context. * * On fail call [[Deflate#onEnd]] with error code and return false. * * We strongly recommend to use `Uint8Array` on input for best speed (output * array format is detected automatically). Also, don't skip last param and always * use the same type in your code (boolean or number). That will improve JS speed. * * For regular `Array`-s make sure all elements are [0..255]. * * ##### Example * * ```javascript * push(chunk, false); // push one of data chunks * ... * push(chunk, true); // push last chunk * ``` **/ Deflate.prototype.push = function(data, mode) { var strm = this.strm; var chunkSize = this.options.chunkSize; var status, _mode; if (this.ended) { return false; } _mode = (mode === ~~mode) ? mode : ((mode === true) ? Z_FINISH : Z_NO_FLUSH); // Convert data if needed if (typeof data === 'string') { // If we need to compress text, change encoding to utf8. strm.input = strings.string2buf(data); } else if (toString.call(data) === '[object ArrayBuffer]') { strm.input = new Uint8Array(data); } else { strm.input = data; } strm.next_in = 0; strm.avail_in = strm.input.length; do { if (strm.avail_out === 0) { strm.output = new utils.Buf8(chunkSize); strm.next_out = 0; strm.avail_out = chunkSize; } status = zlib_deflate.deflate(strm, _mode); /* no bad return value */ if (status !== Z_STREAM_END && status !== Z_OK) { this.onEnd(status); this.ended = true; return false; } if (strm.avail_out === 0 || (strm.avail_in === 0 && (_mode === Z_FINISH || _mode === Z_SYNC_FLUSH))) { if (this.options.to === 'string') { this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))); } else { this.onData(utils.shrinkBuf(strm.output, strm.next_out)); } } } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== Z_STREAM_END); // Finalize on the last chunk. if (_mode === Z_FINISH) { status = zlib_deflate.deflateEnd(this.strm); this.onEnd(status); this.ended = true; return status === Z_OK; } // callback interim results if Z_SYNC_FLUSH. if (_mode === Z_SYNC_FLUSH) { this.onEnd(Z_OK); strm.avail_out = 0; return true; } return true; }; /** * Deflate#onData(chunk) -> Void * - chunk (Uint8Array|Array|String): ouput data. Type of array depends * on js engine support. When string output requested, each chunk * will be string. * * By default, stores data blocks in `chunks[]` property and glue * those in `onEnd`. Override this handler, if you need another behaviour. **/ Deflate.prototype.onData = function(chunk) { this.chunks.push(chunk); }; /** * Deflate#onEnd(status) -> Void * - status (Number): deflate status. 0 (Z_OK) on success, * other if not. * * Called once after you tell deflate that the input stream is * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) * or if an error happened. By default - join collected chunks, * free memory and fill `results` / `err` properties. **/ Deflate.prototype.onEnd = function(status) { // On success - join if (status === Z_OK) { if (this.options.to === 'string') { this.result = this.chunks.join(''); } else { this.result = utils.flattenChunks(this.chunks); } } this.chunks = []; this.err = status; this.msg = this.strm.msg; }; /** * deflate(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to compress. * - options (Object): zlib deflate options. * * Compress `data` with deflate alrorythm and `options`. * * Supported options are: * * - level * - windowBits * - memLevel * - strategy * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information on these. * * Sugar (options): * * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify * negative windowBits implicitly. * - `to` (String) - if equal to 'string', then result will be "binary string" * (each char code [0..255]) * * ##### Example: * * ```javascript * var pako = require('pako') * , data = Uint8Array([1,2,3,4,5,6,7,8,9]); * * console.log(pako.deflate(data)); * ``` **/ function deflate(input, options) { var deflator = new Deflate(options); deflator.push(input, true); // That will never happens, if you don't cheat with options :) if (deflator.err) { throw deflator.msg; } return deflator.result; } /** * deflateRaw(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to compress. * - options (Object): zlib deflate options. * * The same as [[deflate]], but creates raw data, without wrapper * (header and adler32 crc). **/ function deflateRaw(input, options) { options = options || {}; options.raw = true; return deflate(input, options); } /** * gzip(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to compress. * - options (Object): zlib deflate options. * * The same as [[deflate]], but create gzip wrapper instead of * deflate one. **/ function gzip(input, options) { options = options || {}; options.gzip = true; return deflate(input, options); } exports.Deflate = Deflate; exports.deflate = deflate; exports.deflateRaw = deflateRaw; exports.gzip = gzip; },{"./utils/common":84,"./utils/strings":85,"./zlib/deflate.js":89,"./zlib/messages":94,"./zlib/zstream":96}],83:[function(_dereq_,module,exports){ 'use strict'; var zlib_inflate = _dereq_('./zlib/inflate.js'); var utils = _dereq_('./utils/common'); var strings = _dereq_('./utils/strings'); var c = _dereq_('./zlib/constants'); var msg = _dereq_('./zlib/messages'); var zstream = _dereq_('./zlib/zstream'); var gzheader = _dereq_('./zlib/gzheader'); var toString = Object.prototype.toString; /** * class Inflate * * Generic JS-style wrapper for zlib calls. If you don't need * streaming behaviour - use more simple functions: [[inflate]] * and [[inflateRaw]]. **/ /* internal * inflate.chunks -> Array * * Chunks of output data, if [[Inflate#onData]] not overriden. **/ /** * Inflate.result -> Uint8Array|Array|String * * Uncompressed result, generated by default [[Inflate#onData]] * and [[Inflate#onEnd]] handlers. Filled after you push last chunk * (call [[Inflate#push]] with `Z_FINISH` / `true` param) or if you * push a chunk with explicit flush (call [[Inflate#push]] with * `Z_SYNC_FLUSH` param). **/ /** * Inflate.err -> Number * * Error code after inflate finished. 0 (Z_OK) on success. * Should be checked if broken data possible. **/ /** * Inflate.msg -> String * * Error message, if [[Inflate.err]] != 0 **/ /** * new Inflate(options) * - options (Object): zlib inflate options. * * Creates new inflator instance with specified params. Throws exception * on bad params. Supported options: * * - `windowBits` * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information on these. * * Additional options, for internal needs: * * - `chunkSize` - size of generated data chunks (16K by default) * - `raw` (Boolean) - do raw inflate * - `to` (String) - if equal to 'string', then result will be converted * from utf8 to utf16 (javascript) string. When string output requested, * chunk length can differ from `chunkSize`, depending on content. * * By default, when no options set, autodetect deflate/gzip data format via * wrapper header. * * ##### Example: * * ```javascript * var pako = require('pako') * , chunk1 = Uint8Array([1,2,3,4,5,6,7,8,9]) * , chunk2 = Uint8Array([10,11,12,13,14,15,16,17,18,19]); * * var inflate = new pako.Inflate({ level: 3}); * * inflate.push(chunk1, false); * inflate.push(chunk2, true); // true -> last chunk * * if (inflate.err) { throw new Error(inflate.err); } * * console.log(inflate.result); * ``` **/ var Inflate = function(options) { this.options = utils.assign({ chunkSize: 16384, windowBits: 0, to: '' }, options || {}); var opt = this.options; // Force sWindow size for `raw` data, if not set directly, // because we have no header for autodetect. if (opt.raw && (opt.windowBits >= 0) && (opt.windowBits < 16)) { opt.windowBits = -opt.windowBits; if (opt.windowBits === 0) { opt.windowBits = -15; } } // If `windowBits` not defined (and mode not raw) - set autodetect flag for gzip/deflate if ((opt.windowBits >= 0) && (opt.windowBits < 16) && !(options && options.windowBits)) { opt.windowBits += 32; } // Gzip header has no info about windows size, we can do autodetect only // for deflate. So, if sWindow size not set, force it to max when gzip possible if ((opt.windowBits > 15) && (opt.windowBits < 48)) { // bit 3 (16) -> gzipped data // bit 4 (32) -> autodetect gzip/deflate if ((opt.windowBits & 15) === 0) { opt.windowBits |= 15; } } this.err = 0; // error code, if happens (0 = Z_OK) this.msg = ''; // error message this.ended = false; // used to avoid multiple onEnd() calls this.chunks = []; // chunks of compressed data this.strm = new zstream(); this.strm.avail_out = 0; var status = zlib_inflate.inflateInit2( this.strm, opt.windowBits ); if (status !== c.Z_OK) { throw new Error(msg[status]); } this.header = new gzheader(); zlib_inflate.inflateGetHeader(this.strm, this.header); }; /** * Inflate#push(data[, mode]) -> Boolean * - data (Uint8Array|Array|ArrayBuffer|String): input data * - mode (Number|Boolean): 0..6 for corresponding Z_NO_FLUSH..Z_TREE modes. * See constants. Skipped or `false` means Z_NO_FLUSH, `true` meansh Z_FINISH. * * Sends input data to inflate pipe, generating [[Inflate#onData]] calls with * new output chunks. Returns `true` on success. The last data block must have * mode Z_FINISH (or `true`). That will flush internal pending buffers and call * [[Inflate#onEnd]]. For interim explicit flushes (without ending the stream) you * can use mode Z_SYNC_FLUSH, keeping the decompression context. * * On fail call [[Inflate#onEnd]] with error code and return false. * * We strongly recommend to use `Uint8Array` on input for best speed (output * format is detected automatically). Also, don't skip last param and always * use the same type in your code (boolean or number). That will improve JS speed. * * For regular `Array`-s make sure all elements are [0..255]. * * ##### Example * * ```javascript * push(chunk, false); // push one of data chunks * ... * push(chunk, true); // push last chunk * ``` **/ Inflate.prototype.push = function(data, mode) { var strm = this.strm; var chunkSize = this.options.chunkSize; var status, _mode; var next_out_utf8, tail, utf8str; if (this.ended) { return false; } _mode = (mode === ~~mode) ? mode : ((mode === true) ? c.Z_FINISH : c.Z_NO_FLUSH); // Convert data if needed if (typeof data === 'string') { // Only binary strings can be decompressed on practice strm.input = strings.binstring2buf(data); } else if (toString.call(data) === '[object ArrayBuffer]') { strm.input = new Uint8Array(data); } else { strm.input = data; } strm.next_in = 0; strm.avail_in = strm.input.length; do { if (strm.avail_out === 0) { strm.output = new utils.Buf8(chunkSize); strm.next_out = 0; strm.avail_out = chunkSize; } status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH); /* no bad return value */ if (status !== c.Z_STREAM_END && status !== c.Z_OK) { this.onEnd(status); this.ended = true; return false; } if (strm.next_out) { if (strm.avail_out === 0 || status === c.Z_STREAM_END || (strm.avail_in === 0 && (_mode === c.Z_FINISH || _mode === c.Z_SYNC_FLUSH))) { if (this.options.to === 'string') { next_out_utf8 = strings.utf8border(strm.output, strm.next_out); tail = strm.next_out - next_out_utf8; utf8str = strings.buf2string(strm.output, next_out_utf8); // move tail strm.next_out = tail; strm.avail_out = chunkSize - tail; if (tail) { utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0); } this.onData(utf8str); } else { this.onData(utils.shrinkBuf(strm.output, strm.next_out)); } } } } while ((strm.avail_in > 0) && status !== c.Z_STREAM_END); if (status === c.Z_STREAM_END) { _mode = c.Z_FINISH; } // Finalize on the last chunk. if (_mode === c.Z_FINISH) { status = zlib_inflate.inflateEnd(this.strm); this.onEnd(status); this.ended = true; return status === c.Z_OK; } // callback interim results if Z_SYNC_FLUSH. if (_mode === c.Z_SYNC_FLUSH) { this.onEnd(c.Z_OK); strm.avail_out = 0; return true; } return true; }; /** * Inflate#onData(chunk) -> Void * - chunk (Uint8Array|Array|String): ouput data. Type of array depends * on js engine support. When string output requested, each chunk * will be string. * * By default, stores data blocks in `chunks[]` property and glue * those in `onEnd`. Override this handler, if you need another behaviour. **/ Inflate.prototype.onData = function(chunk) { this.chunks.push(chunk); }; /** * Inflate#onEnd(status) -> Void * - status (Number): inflate status. 0 (Z_OK) on success, * other if not. * * Called either after you tell inflate that the input stream is * complete (Z_FINISH) or should be flushed (Z_SYNC_FLUSH) * or if an error happened. By default - join collected chunks, * free memory and fill `results` / `err` properties. **/ Inflate.prototype.onEnd = function(status) { // On success - join if (status === c.Z_OK) { if (this.options.to === 'string') { // Glue & convert here, until we teach pako to send // utf8 alligned strings to onData this.result = this.chunks.join(''); } else { this.result = utils.flattenChunks(this.chunks); } } this.chunks = []; this.err = status; this.msg = this.strm.msg; }; /** * inflate(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * Decompress `data` with inflate/ungzip and `options`. Autodetect * format via wrapper header by default. That's why we don't provide * separate `ungzip` method. * * Supported options are: * * - windowBits * * [http://zlib.net/manual.html#Advanced](http://zlib.net/manual.html#Advanced) * for more information. * * Sugar (options): * * - `raw` (Boolean) - say that we work with raw stream, if you don't wish to specify * negative windowBits implicitly. * - `to` (String) - if equal to 'string', then result will be converted * from utf8 to utf16 (javascript) string. When string output requested, * chunk length can differ from `chunkSize`, depending on content. * * * ##### Example: * * ```javascript * var pako = require('pako') * , input = pako.deflate([1,2,3,4,5,6,7,8,9]) * , output; * * try { * output = pako.inflate(input); * } catch (err) * console.log(err); * } * ``` **/ function inflate(input, options) { var inflator = new Inflate(options); inflator.push(input, true); // That will never happens, if you don't cheat with options :) if (inflator.err) { throw inflator.msg; } return inflator.result; } /** * inflateRaw(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * The same as [[inflate]], but creates raw data, without wrapper * (header and adler32 crc). **/ function inflateRaw(input, options) { options = options || {}; options.raw = true; return inflate(input, options); } /** * ungzip(data[, options]) -> Uint8Array|Array|String * - data (Uint8Array|Array|String): input data to decompress. * - options (Object): zlib inflate options. * * Just shortcut to [[inflate]], because it autodetects format * by header.content. Done for convenience. **/ exports.Inflate = Inflate; exports.inflate = inflate; exports.inflateRaw = inflateRaw; exports.ungzip = inflate; },{"./utils/common":84,"./utils/strings":85,"./zlib/constants":87,"./zlib/gzheader":90,"./zlib/inflate.js":92,"./zlib/messages":94,"./zlib/zstream":96}],84:[function(_dereq_,module,exports){ 'use strict'; var TYPED_OK = (typeof Uint8Array !== 'undefined') && (typeof Uint16Array !== 'undefined') && (typeof Int32Array !== 'undefined'); exports.assign = function (obj /*from1, from2, from3, ...*/) { var sources = Array.prototype.slice.call(arguments, 1); while (sources.length) { var source = sources.shift(); if (!source) { continue; } if (typeof source !== 'object') { throw new TypeError(source + 'must be non-object'); } for (var p in source) { if (source.hasOwnProperty(p)) { obj[p] = source[p]; } } } return obj; }; // reduce buffer size, avoiding mem copy exports.shrinkBuf = function (buf, size) { if (buf.length === size) { return buf; } if (buf.subarray) { return buf.subarray(0, size); } buf.length = size; return buf; }; var fnTyped = { arraySet: function (dest, src, src_offs, len, dest_offs) { if (src.subarray && dest.subarray) { dest.set(src.subarray(src_offs, src_offs+len), dest_offs); return; } // Fallback to ordinary array for (var i=0; i<len; i++) { dest[dest_offs + i] = src[src_offs + i]; } }, // Join array of chunks to single array. flattenChunks: function(chunks) { var i, l, len, pos, chunk, result; // calculate data length len = 0; for (i=0, l=chunks.length; i<l; i++) { len += chunks[i].length; } // join chunks result = new Uint8Array(len); pos = 0; for (i=0, l=chunks.length; i<l; i++) { chunk = chunks[i]; result.set(chunk, pos); pos += chunk.length; } return result; } }; var fnUntyped = { arraySet: function (dest, src, src_offs, len, dest_offs) { for (var i=0; i<len; i++) { dest[dest_offs + i] = src[src_offs + i]; } }, // Join array of chunks to single array. flattenChunks: function(chunks) { return [].concat.apply([], chunks); } }; // Enable/Disable typed arrays use, for testing // exports.setTyped = function (on) { if (on) { exports.Buf8 = Uint8Array; exports.Buf16 = Uint16Array; exports.Buf32 = Int32Array; exports.assign(exports, fnTyped); } else { exports.Buf8 = Array; exports.Buf16 = Array; exports.Buf32 = Array; exports.assign(exports, fnUntyped); } }; exports.setTyped(TYPED_OK); },{}],85:[function(_dereq_,module,exports){ // String encode/decode helpers 'use strict'; var utils = _dereq_('./common'); // Quick check if we can use fast array to bin string conversion // // - apply(Array) can fail on Android 2.2 // - apply(Uint8Array) can fail on iOS 5.1 Safary // var STR_APPLY_OK = true; var STR_APPLY_UIA_OK = true; try { String.fromCharCode.apply(null, [0]); } catch(__) { STR_APPLY_OK = false; } try { String.fromCharCode.apply(null, new Uint8Array(1)); } catch(__) { STR_APPLY_UIA_OK = false; } // Table with utf8 lengths (calculated by first byte of sequence) // Note, that 5 & 6-byte values and some 4-byte values can not be represented in JS, // because max possible codepoint is 0x10ffff var _utf8len = new utils.Buf8(256); for (var q=0; q<256; q++) { _utf8len[q] = (q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1); } _utf8len[254]=_utf8len[254]=1; // Invalid sequence start // convert string to array (typed, when possible) exports.string2buf = function (str) { var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0; // count binary size for (m_pos = 0; m_pos < str_len; m_pos++) { c = str.charCodeAt(m_pos); if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { c2 = str.charCodeAt(m_pos+1); if ((c2 & 0xfc00) === 0xdc00) { c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); m_pos++; } } buf_len += c < 0x80 ? 1 : c < 0x800 ? 2 : c < 0x10000 ? 3 : 4; } // allocate buffer buf = new utils.Buf8(buf_len); // convert for (i=0, m_pos = 0; i < buf_len; m_pos++) { c = str.charCodeAt(m_pos); if ((c & 0xfc00) === 0xd800 && (m_pos+1 < str_len)) { c2 = str.charCodeAt(m_pos+1); if ((c2 & 0xfc00) === 0xdc00) { c = 0x10000 + ((c - 0xd800) << 10) + (c2 - 0xdc00); m_pos++; } } if (c < 0x80) { /* one byte */ buf[i++] = c; } else if (c < 0x800) { /* two bytes */ buf[i++] = 0xC0 | (c >>> 6); buf[i++] = 0x80 | (c & 0x3f); } else if (c < 0x10000) { /* three bytes */ buf[i++] = 0xE0 | (c >>> 12); buf[i++] = 0x80 | (c >>> 6 & 0x3f); buf[i++] = 0x80 | (c & 0x3f); } else { /* four bytes */ buf[i++] = 0xf0 | (c >>> 18); buf[i++] = 0x80 | (c >>> 12 & 0x3f); buf[i++] = 0x80 | (c >>> 6 & 0x3f); buf[i++] = 0x80 | (c & 0x3f); } } return buf; }; // Helper (used in 2 places) function buf2binstring(buf, len) { // use fallback for big arrays to avoid stack overflow if (len < 65537) { if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); } } var result = ''; for (var i=0; i < len; i++) { result += String.fromCharCode(buf[i]); } return result; } // Convert byte array to binary string exports.buf2binstring = function(buf) { return buf2binstring(buf, buf.length); }; // Convert binary string (typed, when possible) exports.binstring2buf = function(str) { var buf = new utils.Buf8(str.length); for (var i=0, len=buf.length; i < len; i++) { buf[i] = str.charCodeAt(i); } return buf; }; // convert array to string exports.buf2string = function (buf, max) { var i, out, c, c_len; var len = max || buf.length; // Reserve max possible length (2 words per char) // NB: by unknown reasons, Array is significantly faster for // String.fromCharCode.apply than Uint16Array. var utf16buf = new Array(len*2); for (out=0, i=0; i<len;) { c = buf[i++]; // quick process ascii if (c < 0x80) { utf16buf[out++] = c; continue; } c_len = _utf8len[c]; // skip 5 & 6 byte codes if (c_len > 4) { utf16buf[out++] = 0xfffd; i += c_len-1; continue; } // apply mask on first byte c &= c_len === 2 ? 0x1f : c_len === 3 ? 0x0f : 0x07; // join the rest while (c_len > 1 && i < len) { c = (c << 6) | (buf[i++] & 0x3f); c_len--; } // terminated by end of string? if (c_len > 1) { utf16buf[out++] = 0xfffd; continue; } if (c < 0x10000) { utf16buf[out++] = c; } else { c -= 0x10000; utf16buf[out++] = 0xd800 | ((c >> 10) & 0x3ff); utf16buf[out++] = 0xdc00 | (c & 0x3ff); } } return buf2binstring(utf16buf, out); }; // Calculate max possible position in utf8 buffer, // that will not break sequence. If that's not possible // - (very small limits) return max size as is. // // buf[] - utf8 bytes array // max - length limit (mandatory); exports.utf8border = function(buf, max) { var pos; max = max || buf.length; if (max > buf.length) { max = buf.length; } // go back from last position, until start of sequence found pos = max-1; while (pos >= 0 && (buf[pos] & 0xC0) === 0x80) { pos--; } // Fuckup - very small and broken sequence, // return max, because we should return something anyway. if (pos < 0) { return max; } // If we came to start of buffer - that means vuffer is too small, // return max too. if (pos === 0) { return max; } return (pos + _utf8len[buf[pos]] > max) ? pos : max; }; },{"./common":84}],86:[function(_dereq_,module,exports){ 'use strict'; // Note: adler32 takes 12% for level 0 and 2% for level 6. // It doesn't worth to make additional optimizationa as in original. // Small size is preferable. function adler32(adler, buf, len, pos) { var s1 = (adler & 0xffff) |0, s2 = ((adler >>> 16) & 0xffff) |0, n = 0; while (len !== 0) { // Set limit ~ twice less than 5552, to keep // s2 in 31-bits, because we force signed ints. // in other case %= will fail. n = len > 2000 ? 2000 : len; len -= n; do { s1 = (s1 + buf[pos++]) |0; s2 = (s2 + s1) |0; } while (--n); s1 %= 65521; s2 %= 65521; } return (s1 | (s2 << 16)) |0; } module.exports = adler32; },{}],87:[function(_dereq_,module,exports){ module.exports = { /* Allowed flush values; see deflate() and inflate() below for details */ Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, //Z_MEM_ERROR: -4, Z_BUF_ERROR: -5, //Z_VERSION_ERROR: -6, /* compression levels */ Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, /* Possible values of the data_type field (though see inflate()) */ Z_BINARY: 0, Z_TEXT: 1, //Z_ASCII: 1, // = Z_TEXT (deprecated) Z_UNKNOWN: 2, /* The deflate compression method */ Z_DEFLATED: 8 //Z_NULL: null // Use -1 or null inline, depending on var type }; },{}],88:[function(_dereq_,module,exports){ 'use strict'; // Note: we can't get significant speed boost here. // So write code to minimize size - no pregenerated tables // and array tools dependencies. // Use ordinary array, since untyped makes no boost here function makeTable() { var c, table = []; for (var n =0; n < 256; n++) { c = n; for (var k =0; k < 8; k++) { c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); } table[n] = c; } return table; } // Create table on load. Just 255 signed longs. Not a problem. var crcTable = makeTable(); function crc32(crc, buf, len, pos) { var t = crcTable, end = pos + len; crc = crc ^ (-1); for (var i = pos; i < end; i++) { crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; } return (crc ^ (-1)); // >>> 0; } module.exports = crc32; },{}],89:[function(_dereq_,module,exports){ 'use strict'; var utils = _dereq_('../utils/common'); var trees = _dereq_('./trees'); var adler32 = _dereq_('./adler32'); var crc32 = _dereq_('./crc32'); var msg = _dereq_('./messages'); /* Public constants ==========================================================*/ /* ===========================================================================*/ /* Allowed flush values; see deflate() and inflate() below for details */ var Z_NO_FLUSH = 0; var Z_PARTIAL_FLUSH = 1; //var Z_SYNC_FLUSH = 2; var Z_FULL_FLUSH = 3; var Z_FINISH = 4; var Z_BLOCK = 5; //var Z_TREES = 6; /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ var Z_OK = 0; var Z_STREAM_END = 1; //var Z_NEED_DICT = 2; //var Z_ERRNO = -1; var Z_STREAM_ERROR = -2; var Z_DATA_ERROR = -3; //var Z_MEM_ERROR = -4; var Z_BUF_ERROR = -5; //var Z_VERSION_ERROR = -6; /* compression levels */ //var Z_NO_COMPRESSION = 0; //var Z_BEST_SPEED = 1; //var Z_BEST_COMPRESSION = 9; var Z_DEFAULT_COMPRESSION = -1; var Z_FILTERED = 1; var Z_HUFFMAN_ONLY = 2; var Z_RLE = 3; var Z_FIXED = 4; var Z_DEFAULT_STRATEGY = 0; /* Possible values of the data_type field (though see inflate()) */ //var Z_BINARY = 0; //var Z_TEXT = 1; //var Z_ASCII = 1; // = Z_TEXT var Z_UNKNOWN = 2; /* The deflate compression method */ var Z_DEFLATED = 8; /*============================================================================*/ var MAX_MEM_LEVEL = 9; /* Maximum value for memLevel in deflateInit2 */ var MAX_WBITS = 15; /* 32K LZ77 sWindow */ var DEF_MEM_LEVEL = 8; var LENGTH_CODES = 29; /* number of length codes, not counting the special END_BLOCK code */ var LITERALS = 256; /* number of literal bytes 0..255 */ var L_CODES = LITERALS + 1 + LENGTH_CODES; /* number of Literal or Length codes, including the END_BLOCK code */ var D_CODES = 30; /* number of distance codes */ var BL_CODES = 19; /* number of codes used to transfer the bit lengths */ var HEAP_SIZE = 2*L_CODES + 1; /* maximum heap size */ var MAX_BITS = 15; /* All codes must not exceed MAX_BITS bits */ var MIN_MATCH = 3; var MAX_MATCH = 258; var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); var PRESET_DICT = 0x20; var INIT_STATE = 42; var EXTRA_STATE = 69; var NAME_STATE = 73; var COMMENT_STATE = 91; var HCRC_STATE = 103; var BUSY_STATE = 113; var FINISH_STATE = 666; var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ var BS_BLOCK_DONE = 2; /* block flush performed */ var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. function err(strm, errorCode) { strm.msg = msg[errorCode]; return errorCode; } function rank(f) { return ((f) << 1) - ((f) > 4 ? 9 : 0); } function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } /* ========================================================================= * Flush as much pending output as possible. All deflate() output goes * through this function so some applications may wish to modify it * to avoid allocating a large strm->output buffer and copying into it. * (See also read_buf()). */ function flush_pending(strm) { var s = strm.state; //_tr_flush_bits(s); var len = s.pending; if (len > strm.avail_out) { len = strm.avail_out; } if (len === 0) { return; } utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); strm.next_out += len; s.pending_out += len; strm.total_out += len; strm.avail_out -= len; s.pending -= len; if (s.pending === 0) { s.pending_out = 0; } } function flush_block_only (s, last) { trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); s.block_start = s.strstart; flush_pending(s.strm); } function put_byte(s, b) { s.pending_buf[s.pending++] = b; } /* ========================================================================= * Put a short in the pending buffer. The 16-bit value is put in MSB order. * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ function putShortMSB(s, b) { // put_byte(s, (Byte)(b >> 8)); // put_byte(s, (Byte)(b & 0xff)); s.pending_buf[s.pending++] = (b >>> 8) & 0xff; s.pending_buf[s.pending++] = b & 0xff; } /* =========================================================================== * Read a new buffer from the current input stream, update the adler32 * and total number of bytes read. All deflate() input goes through * this function so some applications may wish to modify it to avoid * allocating a large strm->input buffer and copying from it. * (See also flush_pending()). */ function read_buf(strm, buf, start, size) { var len = strm.avail_in; if (len > size) { len = size; } if (len === 0) { return 0; } strm.avail_in -= len; utils.arraySet(buf, strm.input, strm.next_in, len, start); if (strm.state.wrap === 1) { strm.adler = adler32(strm.adler, buf, len, start); } else if (strm.state.wrap === 2) { strm.adler = crc32(strm.adler, buf, len, start); } strm.next_in += len; strm.total_in += len; return len; } /* =========================================================================== * Set match_start to the longest match starting at the given string and * return its length. Matches shorter or equal to prev_length are discarded, * in which case the result is equal to prev_length and match_start is * garbage. * IN assertions: cur_match is the head of the hash chain for the current * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * OUT assertion: the match length is not greater than s->lookahead. */ function longest_match(s, cur_match) { var chain_length = s.max_chain_length; /* max hash chain length */ var scan = s.strstart; /* current string */ var match; /* matched string */ var len; /* length of current match */ var best_len = s.prev_length; /* best match length so far */ var nice_match = s.nice_match; /* stop if match long enough */ var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; var _win = s.sWindow; // shortcut var wmask = s.w_mask; var prev = s.prev; /* Stop when cur_match becomes <= limit. To simplify the code, * we prevent matches with the string of sWindow index 0. */ var strend = s.strstart + MAX_MATCH; var scan_end1 = _win[scan + best_len - 1]; var scan_end = _win[scan + best_len]; /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. * It is easy to get rid of this optimization if necessary. */ // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); /* Do not waste too much time if we already have a good match: */ if (s.prev_length >= s.good_match) { chain_length >>= 2; } /* Do not look for matches beyond the end of the input. This is necessary * to make deflate deterministic. */ if (nice_match > s.lookahead) { nice_match = s.lookahead; } // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); do { // Assert(cur_match < s->strstart, "no future"); match = cur_match; /* Skip to next match if the match length cannot increase * or if the match length is less than 2. Note that the checks below * for insufficient lookahead only occur occasionally for performance * reasons. Therefore uninitialized memory will be accessed, and * conditional jumps will be made that depend on those values. * However the length of the match is limited to the lookahead, so * the output of deflate is not affected by the uninitialized values. */ if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) { continue; } /* The check at best_len-1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += 2; match++; // Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart+258. */ do { /*jshint noempty:false*/ } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend); // Assert(scan <= s->sWindow+(unsigned)(s->window_size-1), "wild scan"); len = MAX_MATCH - (strend - scan); scan = strend - MAX_MATCH; if (len > best_len) { s.match_start = cur_match; best_len = len; if (len >= nice_match) { break; } scan_end1 = _win[scan + best_len - 1]; scan_end = _win[scan + best_len]; } } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); if (best_len <= s.lookahead) { return best_len; } return s.lookahead; } /* =========================================================================== * Fill the sWindow when the lookahead becomes insufficient. * Updates strstart and lookahead. * * IN assertion: lookahead < MIN_LOOKAHEAD * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD * At least one byte has been read, or avail_in == 0; reads are * performed for at least two bytes (required for the zip translate_eol * option -- not supported here). */ function fill_window(s) { var _w_size = s.w_size; var p, n, m, more, str; //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); do { more = s.window_size - s.lookahead - s.strstart; // JS ints have 32 bit, block below not needed /* Deal with !@#$% 64K limit: */ //if (sizeof(int) <= 2) { // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { // more = wsize; // // } else if (more == (unsigned)(-1)) { // /* Very unlikely, but possible on 16 bit machine if // * strstart == 0 && lookahead == 1 (input done a byte at time) // */ // more--; // } //} /* If the sWindow is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { utils.arraySet(s.sWindow, s.sWindow, _w_size, _w_size, 0); s.match_start -= _w_size; s.strstart -= _w_size; /* we now have strstart >= MAX_DIST */ s.block_start -= _w_size; /* Slide the hash table (could be avoided with 32 bit values at the expense of memory usage). We slide even when level == 0 to keep the hash table consistent if we switch back to level > 0 later. (Using level 0 permanently is not an optimal usage of zlib, so we don't care about this pathological case.) */ n = s.hash_size; p = n; do { m = s.head[--p]; s.head[p] = (m >= _w_size ? m - _w_size : 0); } while (--n); n = _w_size; p = n; do { m = s.prev[--p]; s.prev[p] = (m >= _w_size ? m - _w_size : 0); /* If n is not on any hash chain, prev[n] is garbage but * its value will never be used. */ } while (--n); more += _w_size; } if (s.strm.avail_in === 0) { break; } /* If there was no sliding: * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && * more == window_size - lookahead - strstart * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) * => more >= window_size - 2*WSIZE + 2 * In the BIG_MEM or MMAP case (not yet supported), * window_size == input_size + MIN_LOOKAHEAD && * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. * Otherwise, window_size == 2*WSIZE so more >= 2. * If there was sliding, more >= WSIZE. So in all cases, more >= 2. */ //Assert(more >= 2, "more < 2"); n = read_buf(s.strm, s.sWindow, s.strstart + s.lookahead, more); s.lookahead += n; /* Initialize the hash value now that we have some input: */ if (s.lookahead + s.insert >= MIN_MATCH) { str = s.strstart - s.insert; s.ins_h = s.sWindow[str]; /* UPDATE_HASH(s, s->ins_h, s->sWindow[str + 1]); */ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.sWindow[str + 1]) & s.hash_mask; //#if MIN_MATCH != 3 // Call update_hash() MIN_MATCH-3 more times //#endif while (s.insert) { /* UPDATE_HASH(s, s->ins_h, s->sWindow[str + MIN_MATCH-1]); */ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.sWindow[str + MIN_MATCH-1]) & s.hash_mask; s.prev[str & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = str; str++; s.insert--; if (s.lookahead + s.insert < MIN_MATCH) { break; } } } /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, * but this is not important since only literal bytes will be emitted. */ } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); /* If the WIN_INIT bytes after the end of the current data have never been * written, then zero those bytes in order to avoid memory check reports of * the use of uninitialized (or uninitialised as Julian writes) bytes by * the longest match routines. Update the high water mark for the next * time through here. WIN_INIT is set to MAX_MATCH since the longest match * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. */ // if (s.high_water < s.window_size) { // var curr = s.strstart + s.lookahead; // var init = 0; // // if (s.high_water < curr) { // /* Previous high water mark below current data -- zero WIN_INIT // * bytes or up to end of sWindow, whichever is less. // */ // init = s.window_size - curr; // if (init > WIN_INIT) // init = WIN_INIT; // zmemzero(s->sWindow + curr, (unsigned)init); // s->high_water = curr + init; // } // else if (s->high_water < (ulg)curr + WIN_INIT) { // /* High water mark at or above current data, but below current data // * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up // * to end of sWindow, whichever is less. // */ // init = (ulg)curr + WIN_INIT - s->high_water; // if (init > s->window_size - s->high_water) // init = s->window_size - s->high_water; // zmemzero(s->sWindow + s->high_water, (unsigned)init); // s->high_water += init; // } // } // // Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, // "not enough room for search"); } /* =========================================================================== * Copy without compression as much as possible from the input stream, return * the current block state. * This function does not insert new strings in the dictionary since * uncompressible data is probably not useful. This function is used * only for the level=0 compression option. * NOTE: this function should be optimized to avoid extra copying from * sWindow to pending_buf. */ function deflate_stored(s, flush) { /* Stored blocks are limited to 0xffff bytes, pending_buf is limited * to pending_buf_size, and each stored block has a 5 byte header: */ var max_block_size = 0xffff; if (max_block_size > s.pending_buf_size - 5) { max_block_size = s.pending_buf_size - 5; } /* Copy as much as possible from input to output: */ for (;;) { /* Fill the sWindow as much as possible: */ if (s.lookahead <= 1) { //Assert(s->strstart < s->w_size+MAX_DIST(s) || // s->block_start >= (long)s->w_size, "slide too late"); // if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || // s.block_start >= s.w_size)) { // throw new Error("slide too late"); // } fill_window(s); if (s.lookahead === 0 && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; } /* flush the current block */ } //Assert(s->block_start >= 0L, "block gone"); // if (s.block_start < 0) throw new Error("block gone"); s.strstart += s.lookahead; s.lookahead = 0; /* Emit a stored block if pending_buf will be full: */ var max_start = s.block_start + max_block_size; if (s.strstart === 0 || s.strstart >= max_start) { /* strstart == 0 is possible when wraparound on 16-bit machine */ s.lookahead = s.strstart - max_start; s.strstart = max_start; /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } /* Flush if we may have to slide, otherwise block_start may become * negative and the data will be gone: */ if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = 0; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.strstart > s.block_start) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_NEED_MORE; } /* =========================================================================== * Compress as much as possible from the input stream, return the current * block state. * This function does not perform lazy evaluation of matches and inserts * new strings in the dictionary only for unmatched strings or for short * matches. It is used only for the fast compression options. */ function deflate_fast(s, flush) { var hash_head; /* head of the hash chain */ var bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s.lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; /* flush the current block */ } } /* Insert the string sWindow[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = 0/*NIL*/; if (s.lookahead >= MIN_MATCH) { /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.sWindow[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ } /* Find the longest match, discarding those <= prev_length. * At this point we have always match_length < MIN_MATCH */ if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { /* To simplify the code, we prevent matches with the string * of sWindow index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ s.match_length = longest_match(s, hash_head); /* longest_match() sets match_start */ } if (s.match_length >= MIN_MATCH) { // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only /*** _tr_tally_dist(s, s.strstart - s.match_start, s.match_length - MIN_MATCH, bflush); ***/ bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); s.lookahead -= s.match_length; /* Insert new strings in the hash table only if the match length * is not too large. This saves time but degrades compression. */ if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { s.match_length--; /* string at strstart already in table */ do { s.strstart++; /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.sWindow[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ /* strstart never exceeds WSIZE-MAX_MATCH, so there are * always MIN_MATCH bytes ahead. */ } while (--s.match_length !== 0); s.strstart++; } else { s.strstart += s.match_length; s.match_length = 0; s.ins_h = s.sWindow[s.strstart]; /* UPDATE_HASH(s, s.ins_h, s.sWindow[s.strstart+1]); */ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.sWindow[s.strstart + 1]) & s.hash_mask; //#if MIN_MATCH != 3 // Call UPDATE_HASH() MIN_MATCH-3 more times //#endif /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not * matter since it will be recomputed at next deflate call. */ } } else { /* No match, output a literal byte */ //Tracevv((stderr,"%c", s.sWindow[s.strstart])); /*** _tr_tally_lit(s, s.sWindow[s.strstart], bflush); ***/ bflush = trees._tr_tally(s, 0, s.sWindow[s.strstart]); s.lookahead--; s.strstart++; } if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = ((s.strstart < (MIN_MATCH-1)) ? s.strstart : MIN_MATCH-1); if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; } /* =========================================================================== * Same as above, but achieves better compression. We use a lazy * evaluation for matches: a match is finally adopted only if there is * no better match at the next sWindow position. */ function deflate_slow(s, flush) { var hash_head; /* head of hash chain */ var bflush; /* set if current block must be flushed */ var max_insert; /* Process the input block. */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s.lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; } /* flush the current block */ } /* Insert the string sWindow[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = 0/*NIL*/; if (s.lookahead >= MIN_MATCH) { /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.sWindow[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ } /* Find the longest match, discarding those <= prev_length. */ s.prev_length = s.match_length; s.prev_match = s.match_start; s.match_length = MIN_MATCH-1; if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= (s.w_size-MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { /* To simplify the code, we prevent matches with the string * of sWindow index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ s.match_length = longest_match(s, hash_head); /* longest_match() sets match_start */ if (s.match_length <= 5 && (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { /* If prev_match is also MIN_MATCH, match_start is garbage * but we will ignore the current match anyway. */ s.match_length = MIN_MATCH-1; } } /* If there was a match at the previous step and the current * match is not better, output the previous match: */ if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { max_insert = s.strstart + s.lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ //check_match(s, s.strstart-1, s.prev_match, s.prev_length); /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH, bflush);***/ bflush = trees._tr_tally(s, s.strstart - 1- s.prev_match, s.prev_length - MIN_MATCH); /* Insert in hash table all strings up to the end of the match. * strstart-1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ s.lookahead -= s.prev_length-1; s.prev_length -= 2; do { if (++s.strstart <= max_insert) { /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.sWindow[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ } } while (--s.prev_length !== 0); s.match_available = 0; s.match_length = MIN_MATCH-1; s.strstart++; if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } else if (s.match_available) { /* If there was no match at the previous position, output a * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ //Tracevv((stderr,"%c", s->sWindow[s->strstart-1])); /*** _tr_tally_lit(s, s.sWindow[s.strstart-1], bflush); ***/ bflush = trees._tr_tally(s, 0, s.sWindow[s.strstart-1]); if (bflush) { /*** FLUSH_BLOCK_ONLY(s, 0) ***/ flush_block_only(s, false); /***/ } s.strstart++; s.lookahead--; if (s.strm.avail_out === 0) { return BS_NEED_MORE; } } else { /* There is no previous match to compare with, wait for * the next step to decide. */ s.match_available = 1; s.strstart++; s.lookahead--; } } //Assert (flush != Z_NO_FLUSH, "no flush?"); if (s.match_available) { //Tracevv((stderr,"%c", s->sWindow[s->strstart-1])); /*** _tr_tally_lit(s, s.sWindow[s.strstart-1], bflush); ***/ bflush = trees._tr_tally(s, 0, s.sWindow[s.strstart-1]); s.match_available = 0; } s.insert = s.strstart < MIN_MATCH-1 ? s.strstart : MIN_MATCH-1; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; } /* =========================================================================== * For Z_RLE, simply look for runs of bytes, generate matches only of distance * one. Do not maintain a hash table. (It will be regenerated if this run of * deflate switches away from Z_RLE.) */ function deflate_rle(s, flush) { var bflush; /* set if current block must be flushed */ var prev; /* byte at distance one to match */ var scan, strend; /* scan goes up to strend for length of run */ var _win = s.sWindow; for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the longest run, plus one for the unrolled loop. */ if (s.lookahead <= MAX_MATCH) { fill_window(s); if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; } /* flush the current block */ } /* See how many times the previous byte repeats */ s.match_length = 0; if (s.lookahead >= MIN_MATCH && s.strstart > 0) { scan = s.strstart - 1; prev = _win[scan]; if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { strend = s.strstart + MAX_MATCH; do { /*jshint noempty:false*/ } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend); s.match_length = MAX_MATCH - (strend - scan); if (s.match_length > s.lookahead) { s.match_length = s.lookahead; } } //Assert(scan <= s->sWindow+(uInt)(s->window_size-1), "wild scan"); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ if (s.match_length >= MIN_MATCH) { //check_match(s, s.strstart, s.strstart - 1, s.match_length); /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); s.lookahead -= s.match_length; s.strstart += s.match_length; s.match_length = 0; } else { /* No match, output a literal byte */ //Tracevv((stderr,"%c", s->sWindow[s->strstart])); /*** _tr_tally_lit(s, s.sWindow[s.strstart], bflush); ***/ bflush = trees._tr_tally(s, 0, s.sWindow[s.strstart]); s.lookahead--; s.strstart++; } if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = 0; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; } /* =========================================================================== * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. * (It will be regenerated if this run of deflate switches away from Huffman.) */ function deflate_huff(s, flush) { var bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we have a literal to write. */ if (s.lookahead === 0) { fill_window(s); if (s.lookahead === 0) { if (flush === Z_NO_FLUSH) { return BS_NEED_MORE; } break; /* flush the current block */ } } /* Output a literal byte */ s.match_length = 0; //Tracevv((stderr,"%c", s->sWindow[s->strstart])); /*** _tr_tally_lit(s, s.sWindow[s.strstart], bflush); ***/ bflush = trees._tr_tally(s, 0, s.sWindow[s.strstart]); s.lookahead--; s.strstart++; if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = 0; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; } /* Values for max_lazy_match, good_match and max_chain_length, depending on * the desired pack level (0..9). The values given below have been tuned to * exclude worst case performance for pathological files. Better values may be * found for specific files. */ var Config = function (good_length, max_lazy, nice_length, max_chain, func) { this.good_length = good_length; this.max_lazy = max_lazy; this.nice_length = nice_length; this.max_chain = max_chain; this.func = func; }; var configuration_table; configuration_table = [ /* good lazy nice chain */ new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ new Config(4, 5, 16, 8, deflate_fast), /* 2 */ new Config(4, 6, 32, 32, deflate_fast), /* 3 */ new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ new Config(8, 16, 32, 32, deflate_slow), /* 5 */ new Config(8, 16, 128, 128, deflate_slow), /* 6 */ new Config(8, 32, 128, 256, deflate_slow), /* 7 */ new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ ]; /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ function lm_init(s) { s.window_size = 2 * s.w_size; /*** CLEAR_HASH(s); ***/ zero(s.head); // Fill with NIL (= 0); /* Set the default configuration parameters: */ s.max_lazy_match = configuration_table[s.level].max_lazy; s.good_match = configuration_table[s.level].good_length; s.nice_match = configuration_table[s.level].nice_length; s.max_chain_length = configuration_table[s.level].max_chain; s.strstart = 0; s.block_start = 0; s.lookahead = 0; s.insert = 0; s.match_length = s.prev_length = MIN_MATCH - 1; s.match_available = 0; s.ins_h = 0; } function DeflateState() { this.strm = null; /* pointer back to this zlib stream */ this.status = 0; /* as the name implies */ this.pending_buf = null; /* output still pending */ this.pending_buf_size = 0; /* size of pending_buf */ this.pending_out = 0; /* next pending byte to output to the stream */ this.pending = 0; /* nb of bytes in the pending buffer */ this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ this.gzhead = null; /* gzip header information to write */ this.gzindex = 0; /* where in extra, name, or comment */ this.method = Z_DEFLATED; /* can only be DEFLATED */ this.last_flush = -1; /* value of flush param for previous deflate call */ this.w_size = 0; /* LZ77 sWindow size (32K by default) */ this.w_bits = 0; /* log2(w_size) (8..16) */ this.w_mask = 0; /* w_size - 1 */ this.sWindow = null; /* Sliding sWindow. Input bytes are read into the second half of the sWindow, * and move to the first half later to keep a dictionary of at least wSize * bytes. With this organization, matches are limited to a distance of * wSize-MAX_MATCH bytes, but this ensures that IO is always * performed with a length multiple of the block size. */ this.window_size = 0; /* Actual size of sWindow: 2*wSize, except when the user input buffer * is directly used as sliding sWindow. */ this.prev = null; /* Link to older string with same hash index. To limit the size of this * array to 64K, this link is maintained only for the last 32K strings. * An index in this array is thus a sWindow index modulo 32K. */ this.head = null; /* Heads of the hash chains or NIL. */ this.ins_h = 0; /* hash index of string to be inserted */ this.hash_size = 0; /* number of elements in hash table */ this.hash_bits = 0; /* log2(hash_size) */ this.hash_mask = 0; /* hash_size-1 */ this.hash_shift = 0; /* Number of bits by which ins_h must be shifted at each input * step. It must be such that after MIN_MATCH steps, the oldest * byte no longer takes part in the hash key, that is: * hash_shift * MIN_MATCH >= hash_bits */ this.block_start = 0; /* sWindow position at the beginning of the current output block. Gets * negative when the sWindow is moved backwards. */ this.match_length = 0; /* length of best match */ this.prev_match = 0; /* previous match */ this.match_available = 0; /* set if previous match exists */ this.strstart = 0; /* start of string to insert */ this.match_start = 0; /* start of matching string */ this.lookahead = 0; /* number of valid bytes ahead in sWindow */ this.prev_length = 0; /* Length of the best match at previous step. Matches not greater than this * are discarded. This is used in the lazy match evaluation. */ this.max_chain_length = 0; /* To speed up deflation, hash chains are never searched beyond this * length. A higher limit improves compression ratio but degrades the * speed. */ this.max_lazy_match = 0; /* Attempt to find a better match only when the current match is strictly * smaller than this value. This mechanism is used only for compression * levels >= 4. */ // That's alias to max_lazy_match, don't use directly //this.max_insert_length = 0; /* Insert new strings in the hash table only if the match length is not * greater than this length. This saves time but degrades compression. * max_insert_length is used only for compression levels <= 3. */ this.level = 0; /* compression level (1..9) */ this.strategy = 0; /* favor or force Huffman coding*/ this.good_match = 0; /* Use a faster search when the previous match is longer than this */ this.nice_match = 0; /* Stop searching when current match exceeds this */ /* used by trees.c: */ /* Didn't use ct_data typedef below to suppress compiler warning */ // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ // Use flat array of DOUBLE size, with interleaved fata, // because JS does not support effective this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); this.dyn_dtree = new utils.Buf16((2*D_CODES+1) * 2); this.bl_tree = new utils.Buf16((2*BL_CODES+1) * 2); zero(this.dyn_ltree); zero(this.dyn_dtree); zero(this.bl_tree); this.l_desc = null; /* desc. for literal tree */ this.d_desc = null; /* desc. for distance tree */ this.bl_desc = null; /* desc. for bit length tree */ //ush bl_count[MAX_BITS+1]; this.bl_count = new utils.Buf16(MAX_BITS+1); /* number of codes at each bit length for an optimal tree */ //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ this.heap = new utils.Buf16(2*L_CODES+1); /* heap used to build the Huffman trees */ zero(this.heap); this.heap_len = 0; /* number of elements in the heap */ this.heap_max = 0; /* element of largest frequency */ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. * The same heap array is used to build all trees. */ this.depth = new utils.Buf16(2*L_CODES+1); //uch depth[2*L_CODES+1]; zero(this.depth); /* Depth of each subtree used as tie breaker for trees of equal frequency */ this.l_buf = 0; /* buffer index for literals or lengths */ this.lit_bufsize = 0; /* Size of match buffer for literals/lengths. There are 4 reasons for * limiting lit_bufsize to 64K: * - frequencies can be kept in 16 bit counters * - if compression is not successful for the first block, all input * data is still in the sWindow so we can still emit a stored block even * when input comes from standard input. (This can also be done for * all blocks if lit_bufsize is not greater than 32K.) * - if compression is not successful for a file smaller than 64K, we can * even emit a stored file instead of a stored block (saving 5 bytes). * This is applicable only for zip (not gzip or zlib). * - creating new Huffman trees less frequently may not provide fast * adaptation to changes in the input data statistics. (Take for * example a binary file with poorly compressible code followed by * a highly compressible string table.) Smaller buffer sizes give * fast adaptation but have of course the overhead of transmitting * trees more frequently. * - I can't count above 4 */ this.last_lit = 0; /* running index in l_buf */ this.d_buf = 0; /* Buffer index for distances. To simplify the code, d_buf and l_buf have * the same number of elements. To use different lengths, an extra flag * array would be necessary. */ this.opt_len = 0; /* bit length of current block with optimal trees */ this.static_len = 0; /* bit length of current block with static trees */ this.matches = 0; /* number of string matches in current block */ this.insert = 0; /* bytes at end of sWindow left to insert */ this.bi_buf = 0; /* Output buffer. bits are inserted starting at the bottom (least * significant bits). */ this.bi_valid = 0; /* Number of valid bits in bi_buf. All bits above the last valid bit * are always zero. */ // Used for sWindow memory init. We safely ignore it for JS. That makes // sense only for pointers and memory check tools. //this.high_water = 0; /* High water mark offset in sWindow for initialized bytes -- bytes above * this are set to zero in order to avoid memory check warnings when * longest match routines access bytes past the input. This is then * updated to the new high water mark. */ } function deflateResetKeep(strm) { var s; if (!strm || !strm.state) { return err(strm, Z_STREAM_ERROR); } strm.total_in = strm.total_out = 0; strm.data_type = Z_UNKNOWN; s = strm.state; s.pending = 0; s.pending_out = 0; if (s.wrap < 0) { s.wrap = -s.wrap; /* was made negative by deflate(..., Z_FINISH); */ } s.status = (s.wrap ? INIT_STATE : BUSY_STATE); strm.adler = (s.wrap === 2) ? 0 // crc32(0, Z_NULL, 0) : 1; // adler32(0, Z_NULL, 0) s.last_flush = Z_NO_FLUSH; trees._tr_init(s); return Z_OK; } function deflateReset(strm) { var ret = deflateResetKeep(strm); if (ret === Z_OK) { lm_init(strm.state); } return ret; } function deflateSetHeader(strm, head) { if (!strm || !strm.state) { return Z_STREAM_ERROR; } if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } strm.state.gzhead = head; return Z_OK; } function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { if (!strm) { // === Z_NULL return Z_STREAM_ERROR; } var wrap = 1; if (level === Z_DEFAULT_COMPRESSION) { level = 6; } if (windowBits < 0) { /* suppress zlib wrapper */ wrap = 0; windowBits = -windowBits; } else if (windowBits > 15) { wrap = 2; /* write gzip wrapper instead */ windowBits -= 16; } if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { return err(strm, Z_STREAM_ERROR); } if (windowBits === 8) { windowBits = 9; } /* until 256-byte sWindow bug fixed */ var s = new DeflateState(); strm.state = s; s.strm = strm; s.wrap = wrap; s.gzhead = null; s.w_bits = windowBits; s.w_size = 1 << s.w_bits; s.w_mask = s.w_size - 1; s.hash_bits = memLevel + 7; s.hash_size = 1 << s.hash_bits; s.hash_mask = s.hash_size - 1; s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); s.sWindow = new utils.Buf8(s.w_size * 2); s.head = new utils.Buf16(s.hash_size); s.prev = new utils.Buf16(s.w_size); // Don't need mem init magic for JS. //s.high_water = 0; /* nothing written to s->sWindow yet */ s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ s.pending_buf_size = s.lit_bufsize * 4; s.pending_buf = new utils.Buf8(s.pending_buf_size); s.d_buf = s.lit_bufsize >> 1; s.l_buf = (1 + 2) * s.lit_bufsize; s.level = level; s.strategy = strategy; s.method = method; return deflateReset(strm); } function deflateInit(strm, level) { return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); } function deflate(strm, flush) { var old_flush, s; var beg, val; // for gzip header write only if (!strm || !strm.state || flush > Z_BLOCK || flush < 0) { return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; } s = strm.state; if (!strm.output || (!strm.input && strm.avail_in !== 0) || (s.status === FINISH_STATE && flush !== Z_FINISH)) { return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); } s.strm = strm; /* just in case */ old_flush = s.last_flush; s.last_flush = flush; /* Write the header */ if (s.status === INIT_STATE) { if (s.wrap === 2) { // GZIP header strm.adler = 0; //crc32(0L, Z_NULL, 0); put_byte(s, 31); put_byte(s, 139); put_byte(s, 8); if (!s.gzhead) { // s->gzhead == Z_NULL put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, 0); put_byte(s, s.level === 9 ? 2 : (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0)); put_byte(s, OS_CODE); s.status = BUSY_STATE; } else { put_byte(s, (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (!s.gzhead.extra ? 0 : 4) + (!s.gzhead.name ? 0 : 8) + (!s.gzhead.comment ? 0 : 16) ); put_byte(s, s.gzhead.time & 0xff); put_byte(s, (s.gzhead.time >> 8) & 0xff); put_byte(s, (s.gzhead.time >> 16) & 0xff); put_byte(s, (s.gzhead.time >> 24) & 0xff); put_byte(s, s.level === 9 ? 2 : (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0)); put_byte(s, s.gzhead.os & 0xff); if (s.gzhead.extra && s.gzhead.extra.length) { put_byte(s, s.gzhead.extra.length & 0xff); put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); } if (s.gzhead.hcrc) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); } s.gzindex = 0; s.status = EXTRA_STATE; } } else // DEFLATE header { var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; var level_flags = -1; if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { level_flags = 0; } else if (s.level < 6) { level_flags = 1; } else if (s.level === 6) { level_flags = 2; } else { level_flags = 3; } header |= (level_flags << 6); if (s.strstart !== 0) { header |= PRESET_DICT; } header += 31 - (header % 31); s.status = BUSY_STATE; putShortMSB(s, header); /* Save the adler32 of the preset dictionary: */ if (s.strstart !== 0) { putShortMSB(s, strm.adler >>> 16); putShortMSB(s, strm.adler & 0xffff); } strm.adler = 1; // adler32(0L, Z_NULL, 0); } } //#ifdef GZIP if (s.status === EXTRA_STATE) { if (s.gzhead.extra/* != Z_NULL*/) { beg = s.pending; /* start of bytes to update crc */ while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { if (s.pending === s.pending_buf_size) { if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } flush_pending(strm); beg = s.pending; if (s.pending === s.pending_buf_size) { break; } } put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); s.gzindex++; } if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } if (s.gzindex === s.gzhead.extra.length) { s.gzindex = 0; s.status = NAME_STATE; } } else { s.status = NAME_STATE; } } if (s.status === NAME_STATE) { if (s.gzhead.name/* != Z_NULL*/) { beg = s.pending; /* start of bytes to update crc */ //int val; do { if (s.pending === s.pending_buf_size) { if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } flush_pending(strm); beg = s.pending; if (s.pending === s.pending_buf_size) { val = 1; break; } } // JS specific: little magic to add zero terminator to end of string if (s.gzindex < s.gzhead.name.length) { val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; } else { val = 0; } put_byte(s, val); } while (val !== 0); if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } if (val === 0) { s.gzindex = 0; s.status = COMMENT_STATE; } } else { s.status = COMMENT_STATE; } } if (s.status === COMMENT_STATE) { if (s.gzhead.comment/* != Z_NULL*/) { beg = s.pending; /* start of bytes to update crc */ //int val; do { if (s.pending === s.pending_buf_size) { if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } flush_pending(strm); beg = s.pending; if (s.pending === s.pending_buf_size) { val = 1; break; } } // JS specific: little magic to add zero terminator to end of string if (s.gzindex < s.gzhead.comment.length) { val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; } else { val = 0; } put_byte(s, val); } while (val !== 0); if (s.gzhead.hcrc && s.pending > beg) { strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); } if (val === 0) { s.status = HCRC_STATE; } } else { s.status = HCRC_STATE; } } if (s.status === HCRC_STATE) { if (s.gzhead.hcrc) { if (s.pending + 2 > s.pending_buf_size) { flush_pending(strm); } if (s.pending + 2 <= s.pending_buf_size) { put_byte(s, strm.adler & 0xff); put_byte(s, (strm.adler >> 8) & 0xff); strm.adler = 0; //crc32(0L, Z_NULL, 0); s.status = BUSY_STATE; } } else { s.status = BUSY_STATE; } } //#endif /* Flush as much pending output as possible */ if (s.pending !== 0) { flush_pending(strm); if (strm.avail_out === 0) { /* Since avail_out is 0, deflate will be called again with * more output space, but possibly with both pending and * avail_in equal to zero. There won't be anything to do, * but this is not an error situation so make sure we * return OK instead of BUF_ERROR at next call of deflate: */ s.last_flush = -1; return Z_OK; } /* Make sure there is something to do and avoid duplicate consecutive * flushes. For repeated and useless calls with Z_FINISH, we keep * returning Z_STREAM_END instead of Z_BUF_ERROR. */ } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && flush !== Z_FINISH) { return err(strm, Z_BUF_ERROR); } /* User must not provide more input after the first FINISH: */ if (s.status === FINISH_STATE && strm.avail_in !== 0) { return err(strm, Z_BUF_ERROR); } /* Start a new block or continue the current one. */ if (strm.avail_in !== 0 || s.lookahead !== 0 || (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : (s.strategy === Z_RLE ? deflate_rle(s, flush) : configuration_table[s.level].func(s, flush)); if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { s.status = FINISH_STATE; } if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { if (strm.avail_out === 0) { s.last_flush = -1; /* avoid BUF_ERROR next call, see above */ } return Z_OK; /* If flush != Z_NO_FLUSH && avail_out == 0, the next call * of deflate should use the same flush parameter to make sure * that the flush is complete. So we don't have to output an * empty block here, this will be done at next call. This also * ensures that for a very small output buffer, we emit at most * one empty block. */ } if (bstate === BS_BLOCK_DONE) { if (flush === Z_PARTIAL_FLUSH) { trees._tr_align(s); } else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ trees._tr_stored_block(s, 0, 0, false); /* For a full flush, this empty block will be recognized * as a special marker by inflate_sync(). */ if (flush === Z_FULL_FLUSH) { /*** CLEAR_HASH(s); ***/ /* forget history */ zero(s.head); // Fill with NIL (= 0); if (s.lookahead === 0) { s.strstart = 0; s.block_start = 0; s.insert = 0; } } } flush_pending(strm); if (strm.avail_out === 0) { s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ return Z_OK; } } } //Assert(strm->avail_out > 0, "bug2"); //if (strm.avail_out <= 0) { throw new Error("bug2");} if (flush !== Z_FINISH) { return Z_OK; } if (s.wrap <= 0) { return Z_STREAM_END; } /* Write the trailer */ if (s.wrap === 2) { put_byte(s, strm.adler & 0xff); put_byte(s, (strm.adler >> 8) & 0xff); put_byte(s, (strm.adler >> 16) & 0xff); put_byte(s, (strm.adler >> 24) & 0xff); put_byte(s, strm.total_in & 0xff); put_byte(s, (strm.total_in >> 8) & 0xff); put_byte(s, (strm.total_in >> 16) & 0xff); put_byte(s, (strm.total_in >> 24) & 0xff); } else { putShortMSB(s, strm.adler >>> 16); putShortMSB(s, strm.adler & 0xffff); } flush_pending(strm); /* If avail_out is zero, the application will call deflate again * to flush the rest. */ if (s.wrap > 0) { s.wrap = -s.wrap; } /* write the trailer only once! */ return s.pending !== 0 ? Z_OK : Z_STREAM_END; } function deflateEnd(strm) { var status; if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { return Z_STREAM_ERROR; } status = strm.state.status; if (status !== INIT_STATE && status !== EXTRA_STATE && status !== NAME_STATE && status !== COMMENT_STATE && status !== HCRC_STATE && status !== BUSY_STATE && status !== FINISH_STATE ) { return err(strm, Z_STREAM_ERROR); } strm.state = null; return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; } /* ========================================================================= * Copy the source state to the destination state */ //function deflateCopy(dest, source) { // //} exports.deflateInit = deflateInit; exports.deflateInit2 = deflateInit2; exports.deflateReset = deflateReset; exports.deflateResetKeep = deflateResetKeep; exports.deflateSetHeader = deflateSetHeader; exports.deflate = deflate; exports.deflateEnd = deflateEnd; exports.deflateInfo = 'pako deflate (from Nodeca project)'; /* Not implemented exports.deflateBound = deflateBound; exports.deflateCopy = deflateCopy; exports.deflateSetDictionary = deflateSetDictionary; exports.deflateParams = deflateParams; exports.deflatePending = deflatePending; exports.deflatePrime = deflatePrime; exports.deflateTune = deflateTune; */ },{"../utils/common":84,"./adler32":86,"./crc32":88,"./messages":94,"./trees":95}],90:[function(_dereq_,module,exports){ 'use strict'; function GZheader() { /* true if compressed data believed to be text */ this.text = 0; /* modification time */ this.time = 0; /* extra flags (not used when writing a gzip file) */ this.xflags = 0; /* operating system */ this.os = 0; /* pointer to extra field or Z_NULL if none */ this.extra = null; /* extra field length (valid if extra != Z_NULL) */ this.extra_len = 0; // Actually, we don't need it in JS, // but leave for few code modifications // // Setup limits is not necessary because in js we should not preallocate memory // for inflate use constant limit in 65536 bytes // /* space at extra (only when reading header) */ // this.extra_max = 0; /* pointer to zero-terminated file name or Z_NULL */ this.name = ''; /* space at name (only when reading header) */ // this.name_max = 0; /* pointer to zero-terminated comment or Z_NULL */ this.comment = ''; /* space at comment (only when reading header) */ // this.comm_max = 0; /* true if there was or will be a header crc */ this.hcrc = 0; /* true when done reading gzip header (not used when writing a gzip file) */ this.done = false; } module.exports = GZheader; },{}],91:[function(_dereq_,module,exports){ 'use strict'; // See state defs from inflate.js var BAD = 30; /* got a data error -- remain here until reset */ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ /* Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is available, an end-of-block is encountered, or a data error is encountered. When large enough input and output buffers are supplied to inflate(), for example, a 16K input buffer and a 64K output buffer, more than 95% of the inflate execution time is spent in this routine. Entry assumptions: state.mode === LEN strm.avail_in >= 6 strm.avail_out >= 258 start >= strm.avail_out state.bits < 8 On return, state.mode is one of: LEN -- ran out of enough output space or enough available input TYPE -- reached end of block code, inflate() to interpret next block BAD -- error in block data Notes: - The maximum input bits used by a length/distance pair is 15 bits for the length code, 5 bits for the length extra, 15 bits for the distance code, and 13 bits for the distance extra. This totals 48 bits, or six bytes. Therefore if strm.avail_in >= 6, then there is enough input to avoid checking for available input while decoding. - The maximum bytes that a single length/distance pair can output is 258 bytes, which is the maximum length that can be coded. inflate_fast() requires strm.avail_out >= 258 for each loop to avoid checking for output space. */ module.exports = function inflate_fast(strm, start) { var state; var _in; /* local strm.input */ var last; /* have enough input while in < last */ var _out; /* local strm.output */ var beg; /* inflate()'s initial strm.output */ var end; /* while out < end, enough space available */ //#ifdef INFLATE_STRICT var dmax; /* maximum distance from zlib header */ //#endif var wsize; /* sWindow size or zero if not using sWindow */ var whave; /* valid bytes in the sWindow */ var wnext; /* sWindow write index */ var sWindow; /* allocated sliding sWindow, if wsize != 0 */ var hold; /* local strm.hold */ var bits; /* local strm.bits */ var lcode; /* local strm.lencode */ var dcode; /* local strm.distcode */ var lmask; /* mask for first level of length codes */ var dmask; /* mask for first level of distance codes */ var here; /* retrieved table entry */ var op; /* code bits, operation, extra bits, or */ /* sWindow position, sWindow bytes to copy */ var len; /* match length, unused bytes */ var dist; /* match distance */ var from; /* where to copy match from */ var from_source; var input, output; // JS specific, because we have no pointers /* copy state to local variables */ state = strm.state; //here = state.here; _in = strm.next_in; input = strm.input; last = _in + (strm.avail_in - 5); _out = strm.next_out; output = strm.output; beg = _out - (start - strm.avail_out); end = _out + (strm.avail_out - 257); //#ifdef INFLATE_STRICT dmax = state.dmax; //#endif wsize = state.wsize; whave = state.whave; wnext = state.wnext; sWindow = state.sWindow; hold = state.hold; bits = state.bits; lcode = state.lencode; dcode = state.distcode; lmask = (1 << state.lenbits) - 1; dmask = (1 << state.distbits) - 1; /* decode literals and length/distances until end-of-block or not enough input data or output space */ top: do { if (bits < 15) { hold += input[_in++] << bits; bits += 8; hold += input[_in++] << bits; bits += 8; } here = lcode[hold & lmask]; dolen: for (;;) { // Goto emulation op = here >>> 24/*here.bits*/; hold >>>= op; bits -= op; op = (here >>> 16) & 0xff/*here.op*/; if (op === 0) { /* literal */ //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? // "inflate: literal '%c'\n" : // "inflate: literal 0x%02x\n", here.val)); output[_out++] = here & 0xffff/*here.val*/; } else if (op & 16) { /* length base */ len = here & 0xffff/*here.val*/; op &= 15; /* number of extra bits */ if (op) { if (bits < op) { hold += input[_in++] << bits; bits += 8; } len += hold & ((1 << op) - 1); hold >>>= op; bits -= op; } //Tracevv((stderr, "inflate: length %u\n", len)); if (bits < 15) { hold += input[_in++] << bits; bits += 8; hold += input[_in++] << bits; bits += 8; } here = dcode[hold & dmask]; dodist: for (;;) { // goto emulation op = here >>> 24/*here.bits*/; hold >>>= op; bits -= op; op = (here >>> 16) & 0xff/*here.op*/; if (op & 16) { /* distance base */ dist = here & 0xffff/*here.val*/; op &= 15; /* number of extra bits */ if (bits < op) { hold += input[_in++] << bits; bits += 8; if (bits < op) { hold += input[_in++] << bits; bits += 8; } } dist += hold & ((1 << op) - 1); //#ifdef INFLATE_STRICT if (dist > dmax) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break top; } //#endif hold >>>= op; bits -= op; //Tracevv((stderr, "inflate: distance %u\n", dist)); op = _out - beg; /* max distance in output */ if (dist > op) { /* see if copy from sWindow */ op = dist - op; /* distance back in sWindow */ if (op > whave) { if (state.sane) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break top; } // (!) This block is disabled in zlib defailts, // don't enable it for binary compatibility //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR // if (len <= op - whave) { // do { // output[_out++] = 0; // } while (--len); // continue top; // } // len -= op - whave; // do { // output[_out++] = 0; // } while (--op > whave); // if (op === 0) { // from = _out - dist; // do { // output[_out++] = output[from++]; // } while (--len); // continue top; // } //#endif } from = 0; // sWindow index from_source = sWindow; if (wnext === 0) { /* very common case */ from += wsize - op; if (op < len) { /* some from sWindow */ len -= op; do { output[_out++] = sWindow[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } else if (wnext < op) { /* wrap around sWindow */ from += wsize + wnext - op; op -= wnext; if (op < len) { /* some from end of sWindow */ len -= op; do { output[_out++] = sWindow[from++]; } while (--op); from = 0; if (wnext < len) { /* some from start of sWindow */ op = wnext; len -= op; do { output[_out++] = sWindow[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } } else { /* contiguous in sWindow */ from += wnext - op; if (op < len) { /* some from sWindow */ len -= op; do { output[_out++] = sWindow[from++]; } while (--op); from = _out - dist; /* rest from output */ from_source = output; } } while (len > 2) { output[_out++] = from_source[from++]; output[_out++] = from_source[from++]; output[_out++] = from_source[from++]; len -= 3; } if (len) { output[_out++] = from_source[from++]; if (len > 1) { output[_out++] = from_source[from++]; } } } else { from = _out - dist; /* copy direct from output */ do { /* minimum length is three */ output[_out++] = output[from++]; output[_out++] = output[from++]; output[_out++] = output[from++]; len -= 3; } while (len > 2); if (len) { output[_out++] = output[from++]; if (len > 1) { output[_out++] = output[from++]; } } } } else if ((op & 64) === 0) { /* 2nd level distance code */ here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; continue dodist; } else { strm.msg = 'invalid distance code'; state.mode = BAD; break top; } break; // need to emulate goto via "continue" } } else if ((op & 64) === 0) { /* 2nd level length code */ here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; continue dolen; } else if (op & 32) { /* end-of-block */ //Tracevv((stderr, "inflate: end of block\n")); state.mode = TYPE; break top; } else { strm.msg = 'invalid literal/length code'; state.mode = BAD; break top; } break; // need to emulate goto via "continue" } } while (_in < last && _out < end); /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ len = bits >> 3; _in -= len; bits -= len << 3; hold &= (1 << bits) - 1; /* update state and return */ strm.next_in = _in; strm.next_out = _out; strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); state.hold = hold; state.bits = bits; return; }; },{}],92:[function(_dereq_,module,exports){ 'use strict'; var utils = _dereq_('../utils/common'); var adler32 = _dereq_('./adler32'); var crc32 = _dereq_('./crc32'); var inflate_fast = _dereq_('./inffast'); var inflate_table = _dereq_('./inftrees'); var CODES = 0; var LENS = 1; var DISTS = 2; /* Public constants ==========================================================*/ /* ===========================================================================*/ /* Allowed flush values; see deflate() and inflate() below for details */ //var Z_NO_FLUSH = 0; //var Z_PARTIAL_FLUSH = 1; //var Z_SYNC_FLUSH = 2; //var Z_FULL_FLUSH = 3; var Z_FINISH = 4; var Z_BLOCK = 5; var Z_TREES = 6; /* Return codes for the compression/decompression functions. Negative values * are errors, positive values are used for special but normal events. */ var Z_OK = 0; var Z_STREAM_END = 1; var Z_NEED_DICT = 2; //var Z_ERRNO = -1; var Z_STREAM_ERROR = -2; var Z_DATA_ERROR = -3; var Z_MEM_ERROR = -4; var Z_BUF_ERROR = -5; //var Z_VERSION_ERROR = -6; /* The deflate compression method */ var Z_DEFLATED = 8; /* STATES ====================================================================*/ /* ===========================================================================*/ var HEAD = 1; /* i: waiting for magic header */ var FLAGS = 2; /* i: waiting for method and flags (gzip) */ var TIME = 3; /* i: waiting for modification time (gzip) */ var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ var EXLEN = 5; /* i: waiting for extra length (gzip) */ var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ var NAME = 7; /* i: waiting for end of file name (gzip) */ var COMMENT = 8; /* i: waiting for end of comment (gzip) */ var HCRC = 9; /* i: waiting for header crc (gzip) */ var DICTID = 10; /* i: waiting for dictionary check value */ var DICT = 11; /* waiting for inflateSetDictionary() call */ var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ var STORED = 14; /* i: waiting for stored size (length and complement) */ var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ var COPY = 16; /* i/o: waiting for input or output to copy stored block */ var TABLE = 17; /* i: waiting for dynamic block table lengths */ var LENLENS = 18; /* i: waiting for code length code lengths */ var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ var LEN_ = 20; /* i: same as LEN below, but only first time in */ var LEN = 21; /* i: waiting for length/lit/eob code */ var LENEXT = 22; /* i: waiting for length extra bits */ var DIST = 23; /* i: waiting for distance code */ var DISTEXT = 24; /* i: waiting for distance extra bits */ var MATCH = 25; /* o: waiting for output space to copy string */ var LIT = 26; /* o: waiting for output space to write literal */ var CHECK = 27; /* i: waiting for 32-bit check value */ var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ var DONE = 29; /* finished check, done -- remain here until reset */ var BAD = 30; /* got a data error -- remain here until reset */ var MEM = 31; /* got an inflate() memory error -- remain here until reset */ var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ /* ===========================================================================*/ var ENOUGH_LENS = 852; var ENOUGH_DISTS = 592; //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); var MAX_WBITS = 15; /* 32K LZ77 sWindow */ var DEF_WBITS = MAX_WBITS; function ZSWAP32(q) { return (((q >>> 24) & 0xff) + ((q >>> 8) & 0xff00) + ((q & 0xff00) << 8) + ((q & 0xff) << 24)); } function InflateState() { this.mode = 0; /* current inflate mode */ this.last = false; /* true if processing last block */ this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ this.havedict = false; /* true if dictionary provided */ this.flags = 0; /* gzip header method and flags (0 if zlib) */ this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ this.check = 0; /* protected copy of check value */ this.total = 0; /* protected copy of output count */ // TODO: may be {} this.head = null; /* where to save gzip header information */ /* sliding sWindow */ this.wbits = 0; /* log base 2 of requested sWindow size */ this.wsize = 0; /* sWindow size or zero if not using sWindow */ this.whave = 0; /* valid bytes in the sWindow */ this.wnext = 0; /* sWindow write index */ this.sWindow = null; /* allocated sliding sWindow, if needed */ /* bit accumulator */ this.hold = 0; /* input bit accumulator */ this.bits = 0; /* number of bits in "in" */ /* for string and stored block copying */ this.length = 0; /* literal or length of data to copy */ this.offset = 0; /* distance back to copy string from */ /* for table and code decoding */ this.extra = 0; /* extra bits needed */ /* fixed and dynamic code tables */ this.lencode = null; /* starting table for length/literal codes */ this.distcode = null; /* starting table for distance codes */ this.lenbits = 0; /* index bits for lencode */ this.distbits = 0; /* index bits for distcode */ /* dynamic table building */ this.ncode = 0; /* number of code length code lengths */ this.nlen = 0; /* number of length code lengths */ this.ndist = 0; /* number of distance code lengths */ this.have = 0; /* number of code lengths in lens[] */ this.next = null; /* next available space in codes[] */ this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ this.work = new utils.Buf16(288); /* work area for code table building */ /* because we don't have pointers in js, we use lencode and distcode directly as buffers so we don't need codes */ //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ this.distdyn = null; /* dynamic table for distance codes (JS specific) */ this.sane = 0; /* if false, allow invalid distance too far */ this.back = 0; /* bits back of last unprocessed length/lit */ this.was = 0; /* initial length of match */ } function inflateResetKeep(strm) { var state; if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; strm.total_in = strm.total_out = state.total = 0; strm.msg = ''; /*Z_NULL*/ if (state.wrap) { /* to support ill-conceived Java test suite */ strm.adler = state.wrap & 1; } state.mode = HEAD; state.last = 0; state.havedict = 0; state.dmax = 32768; state.head = null/*Z_NULL*/; state.hold = 0; state.bits = 0; //state.lencode = state.distcode = state.next = state.codes; state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); state.sane = 1; state.back = -1; //Tracev((stderr, "inflate: reset\n")); return Z_OK; } function inflateReset(strm) { var state; if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; state.wsize = 0; state.whave = 0; state.wnext = 0; return inflateResetKeep(strm); } function inflateReset2(strm, windowBits) { var wrap; var state; /* get the state */ if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; /* extract wrap request from windowBits parameter */ if (windowBits < 0) { wrap = 0; windowBits = -windowBits; } else { wrap = (windowBits >> 4) + 1; if (windowBits < 48) { windowBits &= 15; } } /* set number of sWindow bits, free sWindow if different */ if (windowBits && (windowBits < 8 || windowBits > 15)) { return Z_STREAM_ERROR; } if (state.sWindow !== null && state.wbits !== windowBits) { state.sWindow = null; } /* update state and reset the rest of it */ state.wrap = wrap; state.wbits = windowBits; return inflateReset(strm); } function inflateInit2(strm, windowBits) { var ret; var state; if (!strm) { return Z_STREAM_ERROR; } //strm.msg = Z_NULL; /* in case we return an error */ state = new InflateState(); //if (state === Z_NULL) return Z_MEM_ERROR; //Tracev((stderr, "inflate: allocated\n")); strm.state = state; state.sWindow = null/*Z_NULL*/; ret = inflateReset2(strm, windowBits); if (ret !== Z_OK) { strm.state = null/*Z_NULL*/; } return ret; } function inflateInit(strm) { return inflateInit2(strm, DEF_WBITS); } /* Return state with length and distance decoding tables and index sizes set to fixed code decoding. Normally this returns fixed tables from inffixed.h. If BUILDFIXED is defined, then instead this routine builds the tables the first time it's called, and returns those tables the first time and thereafter. This reduces the size of the code by about 2K bytes, in exchange for a little execution time. However, BUILDFIXED should not be used for threaded applications, since the rewriting of the tables and virgin may not be thread-safe. */ var virgin = true; var lenfix, distfix; // We have no pointers in JS, so keep tables separate function fixedtables(state) { /* build fixed huffman tables if first call (may not be thread safe) */ if (virgin) { var sym; lenfix = new utils.Buf32(512); distfix = new utils.Buf32(32); /* literal/length table */ sym = 0; while (sym < 144) { state.lens[sym++] = 8; } while (sym < 256) { state.lens[sym++] = 9; } while (sym < 280) { state.lens[sym++] = 7; } while (sym < 288) { state.lens[sym++] = 8; } inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, {bits: 9}); /* distance table */ sym = 0; while (sym < 32) { state.lens[sym++] = 5; } inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, {bits: 5}); /* do this just once */ virgin = false; } state.lencode = lenfix; state.lenbits = 9; state.distcode = distfix; state.distbits = 5; } /* Update the sWindow with the last wsize (normally 32K) bytes written before returning. If sWindow does not exist yet, create it. This is only called when a sWindow is already in use, or when output has been written during this inflate call, but the end of the deflate stream has not been reached yet. It is also called to create a sWindow for dictionary data when a dictionary is loaded. Providing output buffers larger than 32K to inflate() should provide a speed advantage, since only the last 32K of output is copied to the sliding sWindow upon return from inflate(), and since all distances after the first 32K of output will fall in the output data, making match copies simpler and faster. The advantage may be dependent on the size of the processor's data caches. */ function updatewindow(strm, src, end, copy) { var dist; var state = strm.state; /* if it hasn't been done already, allocate space for the sWindow */ if (state.sWindow === null) { state.wsize = 1 << state.wbits; state.wnext = 0; state.whave = 0; state.sWindow = new utils.Buf8(state.wsize); } /* copy state->wsize or less output bytes into the circular sWindow */ if (copy >= state.wsize) { utils.arraySet(state.sWindow,src, end - state.wsize, state.wsize, 0); state.wnext = 0; state.whave = state.wsize; } else { dist = state.wsize - state.wnext; if (dist > copy) { dist = copy; } //zmemcpy(state->sWindow + state->wnext, end - copy, dist); utils.arraySet(state.sWindow,src, end - copy, dist, state.wnext); copy -= dist; if (copy) { //zmemcpy(state->sWindow, end - copy, copy); utils.arraySet(state.sWindow,src, end - copy, copy, 0); state.wnext = copy; state.whave = state.wsize; } else { state.wnext += dist; if (state.wnext === state.wsize) { state.wnext = 0; } if (state.whave < state.wsize) { state.whave += dist; } } } return 0; } function inflate(strm, flush) { var state; var input, output; // input/output buffers var next; /* next input INDEX */ var put; /* next output INDEX */ var have, left; /* available input and output */ var hold; /* bit buffer */ var bits; /* bits in bit buffer */ var _in, _out; /* save starting available input and output */ var copy; /* number of stored or match bytes to copy */ var from; /* where to copy match bytes from */ var from_source; var here = 0; /* current decoding table entry */ var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) //var last; /* parent table entry */ var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) var len; /* length to copy for repeats, bits to drop */ var ret; /* return code */ var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ var opts; var n; // temporary var for NEED_BITS var order = /* permutation of code lengths */ [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; if (!strm || !strm.state || !strm.output || (!strm.input && strm.avail_in !== 0)) { return Z_STREAM_ERROR; } state = strm.state; if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ //--- LOAD() --- put = strm.next_out; output = strm.output; left = strm.avail_out; next = strm.next_in; input = strm.input; have = strm.avail_in; hold = state.hold; bits = state.bits; //--- _in = have; _out = left; ret = Z_OK; inf_leave: // goto emulation for (;;) { switch (state.mode) { case HEAD: if (state.wrap === 0) { state.mode = TYPEDO; break; } //=== NEEDBITS(16); while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ state.check = 0/*crc32(0L, Z_NULL, 0)*/; //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = FLAGS; break; } state.flags = 0; /* expect zlib header */ if (state.head) { state.head.done = false; } if (!(state.wrap & 1) || /* check if zlib header allowed */ (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { strm.msg = 'incorrect header check'; state.mode = BAD; break; } if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { strm.msg = 'unknown compression method'; state.mode = BAD; break; } //--- DROPBITS(4) ---// hold >>>= 4; bits -= 4; //---// len = (hold & 0x0f)/*BITS(4)*/ + 8; if (state.wbits === 0) { state.wbits = len; } else if (len > state.wbits) { strm.msg = 'invalid sWindow size'; state.mode = BAD; break; } state.dmax = 1 << len; //Tracev((stderr, "inflate: zlib header ok\n")); strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; state.mode = hold & 0x200 ? DICTID : TYPE; //=== INITBITS(); hold = 0; bits = 0; //===// break; case FLAGS: //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.flags = hold; if ((state.flags & 0xff) !== Z_DEFLATED) { strm.msg = 'unknown compression method'; state.mode = BAD; break; } if (state.flags & 0xe000) { strm.msg = 'unknown header flags set'; state.mode = BAD; break; } if (state.head) { state.head.text = ((hold >> 8) & 1); } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = TIME; /* falls through */ case TIME: //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (state.head) { state.head.time = hold; } if (state.flags & 0x0200) { //=== CRC4(state.check, hold) hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; hbuf[2] = (hold >>> 16) & 0xff; hbuf[3] = (hold >>> 24) & 0xff; state.check = crc32(state.check, hbuf, 4, 0); //=== } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = OS; /* falls through */ case OS: //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (state.head) { state.head.xflags = (hold & 0xff); state.head.os = (hold >> 8); } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = EXLEN; /* falls through */ case EXLEN: if (state.flags & 0x0400) { //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.length = hold; if (state.head) { state.head.extra_len = hold; } if (state.flags & 0x0200) { //=== CRC2(state.check, hold); hbuf[0] = hold & 0xff; hbuf[1] = (hold >>> 8) & 0xff; state.check = crc32(state.check, hbuf, 2, 0); //===// } //=== INITBITS(); hold = 0; bits = 0; //===// } else if (state.head) { state.head.extra = null/*Z_NULL*/; } state.mode = EXTRA; /* falls through */ case EXTRA: if (state.flags & 0x0400) { copy = state.length; if (copy > have) { copy = have; } if (copy) { if (state.head) { len = state.head.extra_len - state.length; if (!state.head.extra) { // Use untyped array for more conveniend processing later state.head.extra = new Array(state.head.extra_len); } utils.arraySet( state.head.extra, input, next, // extra field is limited to 65536 bytes // - no need for additional size check copy, /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ len ); //zmemcpy(state.head.extra + len, next, // len + copy > state.head.extra_max ? // state.head.extra_max - len : copy); } if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; state.length -= copy; } if (state.length) { break inf_leave; } } state.length = 0; state.mode = NAME; /* falls through */ case NAME: if (state.flags & 0x0800) { if (have === 0) { break inf_leave; } copy = 0; do { // TODO: 2 or 1 bytes? len = input[next + copy++]; /* use constant limit because in js we should not preallocate memory */ if (state.head && len && (state.length < 65536 /*state.head.name_max*/)) { state.head.name += String.fromCharCode(len); } } while (len && copy < have); if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; if (len) { break inf_leave; } } else if (state.head) { state.head.name = null; } state.length = 0; state.mode = COMMENT; /* falls through */ case COMMENT: if (state.flags & 0x1000) { if (have === 0) { break inf_leave; } copy = 0; do { len = input[next + copy++]; /* use constant limit because in js we should not preallocate memory */ if (state.head && len && (state.length < 65536 /*state.head.comm_max*/)) { state.head.comment += String.fromCharCode(len); } } while (len && copy < have); if (state.flags & 0x0200) { state.check = crc32(state.check, input, copy, next); } have -= copy; next += copy; if (len) { break inf_leave; } } else if (state.head) { state.head.comment = null; } state.mode = HCRC; /* falls through */ case HCRC: if (state.flags & 0x0200) { //=== NEEDBITS(16); */ while (bits < 16) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (hold !== (state.check & 0xffff)) { strm.msg = 'header crc mismatch'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// } if (state.head) { state.head.hcrc = ((state.flags >> 9) & 1); state.head.done = true; } strm.adler = state.check = 0 /*crc32(0L, Z_NULL, 0)*/; state.mode = TYPE; break; case DICTID: //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// strm.adler = state.check = ZSWAP32(hold); //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = DICT; /* falls through */ case DICT: if (state.havedict === 0) { //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- return Z_NEED_DICT; } strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; state.mode = TYPE; /* falls through */ case TYPE: if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } /* falls through */ case TYPEDO: if (state.last) { //--- BYTEBITS() ---// hold >>>= bits & 7; bits -= bits & 7; //---// state.mode = CHECK; break; } //=== NEEDBITS(3); */ while (bits < 3) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.last = (hold & 0x01)/*BITS(1)*/; //--- DROPBITS(1) ---// hold >>>= 1; bits -= 1; //---// switch ((hold & 0x03)/*BITS(2)*/) { case 0: /* stored block */ //Tracev((stderr, "inflate: stored block%s\n", // state.last ? " (last)" : "")); state.mode = STORED; break; case 1: /* fixed block */ fixedtables(state); //Tracev((stderr, "inflate: fixed codes block%s\n", // state.last ? " (last)" : "")); state.mode = LEN_; /* decode codes */ if (flush === Z_TREES) { //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// break inf_leave; } break; case 2: /* dynamic block */ //Tracev((stderr, "inflate: dynamic codes block%s\n", // state.last ? " (last)" : "")); state.mode = TABLE; break; case 3: strm.msg = 'invalid block type'; state.mode = BAD; } //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// break; case STORED: //--- BYTEBITS() ---// /* go to byte boundary */ hold >>>= bits & 7; bits -= bits & 7; //---// //=== NEEDBITS(32); */ while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { strm.msg = 'invalid stored block lengths'; state.mode = BAD; break; } state.length = hold & 0xffff; //Tracev((stderr, "inflate: stored length %u\n", // state.length)); //=== INITBITS(); hold = 0; bits = 0; //===// state.mode = COPY_; if (flush === Z_TREES) { break inf_leave; } /* falls through */ case COPY_: state.mode = COPY; /* falls through */ case COPY: copy = state.length; if (copy) { if (copy > have) { copy = have; } if (copy > left) { copy = left; } if (copy === 0) { break inf_leave; } //--- zmemcpy(put, next, copy); --- utils.arraySet(output, input, next, copy, put); //---// have -= copy; next += copy; left -= copy; put += copy; state.length -= copy; break; } //Tracev((stderr, "inflate: stored end\n")); state.mode = TYPE; break; case TABLE: //=== NEEDBITS(14); */ while (bits < 14) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; //--- DROPBITS(5) ---// hold >>>= 5; bits -= 5; //---// state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; //--- DROPBITS(5) ---// hold >>>= 5; bits -= 5; //---// state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; //--- DROPBITS(4) ---// hold >>>= 4; bits -= 4; //---// //#ifndef PKZIP_BUG_WORKAROUND if (state.nlen > 286 || state.ndist > 30) { strm.msg = 'too many length or distance symbols'; state.mode = BAD; break; } //#endif //Tracev((stderr, "inflate: table sizes ok\n")); state.have = 0; state.mode = LENLENS; /* falls through */ case LENLENS: while (state.have < state.ncode) { //=== NEEDBITS(3); while (bits < 3) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); //--- DROPBITS(3) ---// hold >>>= 3; bits -= 3; //---// } while (state.have < 19) { state.lens[order[state.have++]] = 0; } // We have separate tables & no pointers. 2 commented lines below not needed. //state.next = state.codes; //state.lencode = state.next; // Switch to use dynamic table state.lencode = state.lendyn; state.lenbits = 7; opts = {bits: state.lenbits}; ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); state.lenbits = opts.bits; if (ret) { strm.msg = 'invalid code lengths set'; state.mode = BAD; break; } //Tracev((stderr, "inflate: code lengths ok\n")); state.have = 0; state.mode = CODELENS; /* falls through */ case CODELENS: while (state.have < state.nlen + state.ndist) { for (;;) { here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if (here_val < 16) { //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.lens[state.have++] = here_val; } else { if (here_val === 16) { //=== NEEDBITS(here.bits + 2); n = here_bits + 2; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// if (state.have === 0) { strm.msg = 'invalid bit length repeat'; state.mode = BAD; break; } len = state.lens[state.have - 1]; copy = 3 + (hold & 0x03);//BITS(2); //--- DROPBITS(2) ---// hold >>>= 2; bits -= 2; //---// } else if (here_val === 17) { //=== NEEDBITS(here.bits + 3); n = here_bits + 3; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// len = 0; copy = 3 + (hold & 0x07);//BITS(3); //--- DROPBITS(3) ---// hold >>>= 3; bits -= 3; //---// } else { //=== NEEDBITS(here.bits + 7); n = here_bits + 7; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// len = 0; copy = 11 + (hold & 0x7f);//BITS(7); //--- DROPBITS(7) ---// hold >>>= 7; bits -= 7; //---// } if (state.have + copy > state.nlen + state.ndist) { strm.msg = 'invalid bit length repeat'; state.mode = BAD; break; } while (copy--) { state.lens[state.have++] = len; } } } /* handle error breaks in while */ if (state.mode === BAD) { break; } /* check for end-of-block code (better have one) */ if (state.lens[256] === 0) { strm.msg = 'invalid code -- missing end-of-block'; state.mode = BAD; break; } /* build code tables -- note: do not change the lenbits or distbits values here (9 and 6) without reading the comments in inftrees.h concerning the ENOUGH constants, which depend on those values */ state.lenbits = 9; opts = {bits: state.lenbits}; ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed. // state.next_index = opts.table_index; state.lenbits = opts.bits; // state.lencode = state.next; if (ret) { strm.msg = 'invalid literal/lengths set'; state.mode = BAD; break; } state.distbits = 6; //state.distcode.copy(state.codes); // Switch to use dynamic table state.distcode = state.distdyn; opts = {bits: state.distbits}; ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); // We have separate tables & no pointers. 2 commented lines below not needed. // state.next_index = opts.table_index; state.distbits = opts.bits; // state.distcode = state.next; if (ret) { strm.msg = 'invalid distances set'; state.mode = BAD; break; } //Tracev((stderr, 'inflate: codes ok\n')); state.mode = LEN_; if (flush === Z_TREES) { break inf_leave; } /* falls through */ case LEN_: state.mode = LEN; /* falls through */ case LEN: if (have >= 6 && left >= 258) { //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- inflate_fast(strm, _out); //--- LOAD() --- put = strm.next_out; output = strm.output; left = strm.avail_out; next = strm.next_in; input = strm.input; have = strm.avail_in; hold = state.hold; bits = state.bits; //--- if (state.mode === TYPE) { state.back = -1; } break; } state.back = 0; for (;;) { here = state.lencode[hold & ((1 << state.lenbits) -1)]; /*BITS(state.lenbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if (here_bits <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if (here_op && (here_op & 0xf0) === 0) { last_bits = here_bits; last_op = here_op; last_val = here_val; for (;;) { here = state.lencode[last_val + ((hold & ((1 << (last_bits + last_op)) -1))/*BITS(last.bits + last.op)*/ >> last_bits)]; here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((last_bits + here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } //--- DROPBITS(last.bits) ---// hold >>>= last_bits; bits -= last_bits; //---// state.back += last_bits; } //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.back += here_bits; state.length = here_val; if (here_op === 0) { //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? // "inflate: literal '%c'\n" : // "inflate: literal 0x%02x\n", here.val)); state.mode = LIT; break; } if (here_op & 32) { //Tracevv((stderr, "inflate: end of block\n")); state.back = -1; state.mode = TYPE; break; } if (here_op & 64) { strm.msg = 'invalid literal/length code'; state.mode = BAD; break; } state.extra = here_op & 15; state.mode = LENEXT; /* falls through */ case LENEXT: if (state.extra) { //=== NEEDBITS(state.extra); n = state.extra; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.length += hold & ((1 << state.extra) -1)/*BITS(state.extra)*/; //--- DROPBITS(state.extra) ---// hold >>>= state.extra; bits -= state.extra; //---// state.back += state.extra; } //Tracevv((stderr, "inflate: length %u\n", state.length)); state.was = state.length; state.mode = DIST; /* falls through */ case DIST: for (;;) { here = state.distcode[hold & ((1 << state.distbits) -1)];/*BITS(state.distbits)*/ here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } if ((here_op & 0xf0) === 0) { last_bits = here_bits; last_op = here_op; last_val = here_val; for (;;) { here = state.distcode[last_val + ((hold & ((1 << (last_bits + last_op)) -1))/*BITS(last.bits + last.op)*/ >> last_bits)]; here_bits = here >>> 24; here_op = (here >>> 16) & 0xff; here_val = here & 0xffff; if ((last_bits + here_bits) <= bits) { break; } //--- PULLBYTE() ---// if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; //---// } //--- DROPBITS(last.bits) ---// hold >>>= last_bits; bits -= last_bits; //---// state.back += last_bits; } //--- DROPBITS(here.bits) ---// hold >>>= here_bits; bits -= here_bits; //---// state.back += here_bits; if (here_op & 64) { strm.msg = 'invalid distance code'; state.mode = BAD; break; } state.offset = here_val; state.extra = (here_op) & 15; state.mode = DISTEXT; /* falls through */ case DISTEXT: if (state.extra) { //=== NEEDBITS(state.extra); n = state.extra; while (bits < n) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// state.offset += hold & ((1 << state.extra) -1)/*BITS(state.extra)*/; //--- DROPBITS(state.extra) ---// hold >>>= state.extra; bits -= state.extra; //---// state.back += state.extra; } //#ifdef INFLATE_STRICT if (state.offset > state.dmax) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break; } //#endif //Tracevv((stderr, "inflate: distance %u\n", state.offset)); state.mode = MATCH; /* falls through */ case MATCH: if (left === 0) { break inf_leave; } copy = _out - left; if (state.offset > copy) { /* copy from sWindow */ copy = state.offset - copy; if (copy > state.whave) { if (state.sane) { strm.msg = 'invalid distance too far back'; state.mode = BAD; break; } // (!) This block is disabled in zlib defailts, // don't enable it for binary compatibility //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR // Trace((stderr, "inflate.c too far\n")); // copy -= state.whave; // if (copy > state.length) { copy = state.length; } // if (copy > left) { copy = left; } // left -= copy; // state.length -= copy; // do { // output[put++] = 0; // } while (--copy); // if (state.length === 0) { state.mode = LEN; } // break; //#endif } if (copy > state.wnext) { copy -= state.wnext; from = state.wsize - copy; } else { from = state.wnext - copy; } if (copy > state.length) { copy = state.length; } from_source = state.sWindow; } else { /* copy from output */ from_source = output; from = put - state.offset; copy = state.length; } if (copy > left) { copy = left; } left -= copy; state.length -= copy; do { output[put++] = from_source[from++]; } while (--copy); if (state.length === 0) { state.mode = LEN; } break; case LIT: if (left === 0) { break inf_leave; } output[put++] = state.length; left--; state.mode = LEN; break; case CHECK: if (state.wrap) { //=== NEEDBITS(32); while (bits < 32) { if (have === 0) { break inf_leave; } have--; // Use '|' insdead of '+' to make sure that result is signed hold |= input[next++] << bits; bits += 8; } //===// _out -= left; strm.total_out += _out; state.total += _out; if (_out) { strm.adler = state.check = /*UPDATE(state.check, put - _out, _out);*/ (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); } _out = left; // NB: crc32 stored as signed 32-bit int, ZSWAP32 returns signed too if ((state.flags ? hold : ZSWAP32(hold)) !== state.check) { strm.msg = 'incorrect data check'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// //Tracev((stderr, "inflate: check matches trailer\n")); } state.mode = LENGTH; /* falls through */ case LENGTH: if (state.wrap && state.flags) { //=== NEEDBITS(32); while (bits < 32) { if (have === 0) { break inf_leave; } have--; hold += input[next++] << bits; bits += 8; } //===// if (hold !== (state.total & 0xffffffff)) { strm.msg = 'incorrect length check'; state.mode = BAD; break; } //=== INITBITS(); hold = 0; bits = 0; //===// //Tracev((stderr, "inflate: length matches trailer\n")); } state.mode = DONE; /* falls through */ case DONE: ret = Z_STREAM_END; break inf_leave; case BAD: ret = Z_DATA_ERROR; break inf_leave; case MEM: return Z_MEM_ERROR; case SYNC: /* falls through */ default: return Z_STREAM_ERROR; } } // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" /* Return from inflate(), updating the total counts and the check value. If there was no progress during the inflate() call, return a buffer error. Call updatewindow() to create and/or update the sWindow state. Note: a memory error from inflate() is non-recoverable. */ //--- RESTORE() --- strm.next_out = put; strm.avail_out = left; strm.next_in = next; strm.avail_in = have; state.hold = hold; state.bits = bits; //--- if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH))) { if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { state.mode = MEM; return Z_MEM_ERROR; } } _in -= strm.avail_in; _out -= strm.avail_out; strm.total_in += _in; strm.total_out += _out; state.total += _out; if (state.wrap && _out) { strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); } strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { ret = Z_BUF_ERROR; } return ret; } function inflateEnd(strm) { if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { return Z_STREAM_ERROR; } var state = strm.state; if (state.sWindow) { state.sWindow = null; } strm.state = null; return Z_OK; } function inflateGetHeader(strm, head) { var state; /* check state */ if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } /* save header structure */ state.head = head; head.done = false; return Z_OK; } exports.inflateReset = inflateReset; exports.inflateReset2 = inflateReset2; exports.inflateResetKeep = inflateResetKeep; exports.inflateInit = inflateInit; exports.inflateInit2 = inflateInit2; exports.inflate = inflate; exports.inflateEnd = inflateEnd; exports.inflateGetHeader = inflateGetHeader; exports.inflateInfo = 'pako inflate (from Nodeca project)'; /* Not implemented exports.inflateCopy = inflateCopy; exports.inflateGetDictionary = inflateGetDictionary; exports.inflateMark = inflateMark; exports.inflatePrime = inflatePrime; exports.inflateSetDictionary = inflateSetDictionary; exports.inflateSync = inflateSync; exports.inflateSyncPoint = inflateSyncPoint; exports.inflateUndermine = inflateUndermine; */ },{"../utils/common":84,"./adler32":86,"./crc32":88,"./inffast":91,"./inftrees":93}],93:[function(_dereq_,module,exports){ 'use strict'; var utils = _dereq_('../utils/common'); var MAXBITS = 15; var ENOUGH_LENS = 852; var ENOUGH_DISTS = 592; //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); var CODES = 0; var LENS = 1; var DISTS = 2; var lbase = [ /* Length codes 257..285 base */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 ]; var lext = [ /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 ]; var dbase = [ /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0 ]; var dext = [ /* Distance codes 0..29 extra */ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64 ]; module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) { var bits = opts.bits; //here = opts.here; /* table entry for duplication */ var len = 0; /* a code's length in bits */ var sym = 0; /* index of code symbols */ var min = 0, max = 0; /* minimum and maximum code lengths */ var root = 0; /* number of index bits for root table */ var curr = 0; /* number of index bits for current table */ var drop = 0; /* code bits to drop for sub-table */ var left = 0; /* number of prefix codes available */ var used = 0; /* code entries in table used */ var huff = 0; /* Huffman code */ var incr; /* for incrementing code, index */ var fill; /* index for replicating entries */ var low; /* low bits for current root entry */ var mask; /* mask for low root bits */ var next; /* next available space in table */ var base = null; /* base value table to use */ var base_index = 0; // var shoextra; /* extra bits table to use */ var end; /* use base and extra for symbol > end */ var count = new utils.Buf16(MAXBITS+1); //[MAXBITS+1]; /* number of codes of each length */ var offs = new utils.Buf16(MAXBITS+1); //[MAXBITS+1]; /* offsets in table for each length */ var extra = null; var extra_index = 0; var here_bits, here_op, here_val; /* Process a set of code lengths to create a canonical Huffman code. The code lengths are lens[0..codes-1]. Each length corresponds to the symbols 0..codes-1. The Huffman code is generated by first sorting the symbols by length from short to long, and retaining the symbol order for codes with equal lengths. Then the code starts with all zero bits for the first code of the shortest length, and the codes are integer increments for the same length, and zeros are appended as the length increases. For the deflate format, these bits are stored backwards from their more natural integer increment ordering, and so when the decoding tables are built in the large loop below, the integer codes are incremented backwards. This routine assumes, but does not check, that all of the entries in lens[] are in the range 0..MAXBITS. The caller must assure this. 1..MAXBITS is interpreted as that code length. zero means that that symbol does not occur in this code. The codes are sorted by computing a count of codes for each length, creating from that a table of starting indices for each length in the sorted table, and then entering the symbols in order in the sorted table. The sorted table is work[], with that space being provided by the caller. The length counts are used for other purposes as well, i.e. finding the minimum and maximum length codes, determining if there are any codes at all, checking for a valid set of lengths, and looking ahead at length counts to determine sub-table sizes when building the decoding tables. */ /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ for (len = 0; len <= MAXBITS; len++) { count[len] = 0; } for (sym = 0; sym < codes; sym++) { count[lens[lens_index + sym]]++; } /* bound code lengths, force root to be within code lengths */ root = bits; for (max = MAXBITS; max >= 1; max--) { if (count[max] !== 0) { break; } } if (root > max) { root = max; } if (max === 0) { /* no symbols to code at all */ //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ //table.bits[opts.table_index] = 1; //here.bits = (var char)1; //table.val[opts.table_index++] = 0; //here.val = (var short)0; table[table_index++] = (1 << 24) | (64 << 16) | 0; //table.op[opts.table_index] = 64; //table.bits[opts.table_index] = 1; //table.val[opts.table_index++] = 0; table[table_index++] = (1 << 24) | (64 << 16) | 0; opts.bits = 1; return 0; /* no symbols, but wait for decoding to report error */ } for (min = 1; min < max; min++) { if (count[min] !== 0) { break; } } if (root < min) { root = min; } /* check for an over-subscribed or incomplete set of lengths */ left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= count[len]; if (left < 0) { return -1; } /* over-subscribed */ } if (left > 0 && (type === CODES || max !== 1)) { return -1; /* incomplete set */ } /* generate offsets into symbol table for each length for sorting */ offs[1] = 0; for (len = 1; len < MAXBITS; len++) { offs[len + 1] = offs[len] + count[len]; } /* sort symbols by length, by symbol order within each length */ for (sym = 0; sym < codes; sym++) { if (lens[lens_index + sym] !== 0) { work[offs[lens[lens_index + sym]]++] = sym; } } /* Create and fill in decoding tables. In this loop, the table being filled is at next and has curr index bits. The code being used is huff with length len. That code is converted to an index by dropping drop bits off of the bottom. For codes where len is less than drop + curr, those top drop + curr - len bits are incremented through all values to fill the table with replicated entries. root is the number of index bits for the root table. When len exceeds root, sub-tables are created pointed to by the root entry with an index of the low root bits of huff. This is saved in low to check for when a new sub-table should be started. drop is zero when the root table is being filled, and drop is root when sub-tables are being filled. When a new sub-table is needed, it is necessary to look ahead in the code lengths to determine what size sub-table is needed. The length counts are used for this, and so count[] is decremented as codes are entered in the tables. used keeps track of how many table entries have been allocated from the provided *table space. It is checked for LENS and DIST tables against the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in the initial root table size constants. See the comments in inftrees.h for more information. sym increments through all symbols, and the loop terminates when all codes of length max, i.e. all codes, have been processed. This routine permits incomplete codes, so another loop after this one fills in the rest of the decoding tables with invalid code markers. */ /* set up for code type */ // poor man optimization - use if-else instead of switch, // to avoid deopts in old v8 if (type === CODES) { base = extra = work; /* dummy value--not used */ end = 19; } else if (type === LENS) { base = lbase; base_index -= 257; extra = lext; extra_index -= 257; end = 256; } else { /* DISTS */ base = dbase; extra = dext; end = -1; } /* initialize opts for loop */ huff = 0; /* starting code */ sym = 0; /* starting code symbol */ len = min; /* starting code length */ next = table_index; /* current table to fill in */ curr = root; /* current table index bits */ drop = 0; /* current bits to drop from code for index */ low = -1; /* trigger new sub-table when len > root */ used = 1 << root; /* use root table entries */ mask = used - 1; /* mask for comparing low */ /* check available table space */ if ((type === LENS && used > ENOUGH_LENS) || (type === DISTS && used > ENOUGH_DISTS)) { return 1; } var i=0; /* process all codes and make table entries */ for (;;) { i++; /* create table entry */ here_bits = len - drop; if (work[sym] < end) { here_op = 0; here_val = work[sym]; } else if (work[sym] > end) { here_op = extra[extra_index + work[sym]]; here_val = base[base_index + work[sym]]; } else { here_op = 32 + 64; /* end of block */ here_val = 0; } /* replicate for those indices with low len bits equal to huff */ incr = 1 << (len - drop); fill = 1 << curr; min = fill; /* save offset to next table */ do { fill -= incr; table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; } while (fill !== 0); /* backwards increment the len-bit code huff */ incr = 1 << (len - 1); while (huff & incr) { incr >>= 1; } if (incr !== 0) { huff &= incr - 1; huff += incr; } else { huff = 0; } /* go to next symbol, update count, len */ sym++; if (--count[len] === 0) { if (len === max) { break; } len = lens[lens_index + work[sym]]; } /* create new sub-table if needed */ if (len > root && (huff & mask) !== low) { /* if first time, transition to sub-tables */ if (drop === 0) { drop = root; } /* increment past last table */ next += min; /* here min is 1 << curr */ /* determine length of next table */ curr = len - drop; left = 1 << curr; while (curr + drop < max) { left -= count[curr + drop]; if (left <= 0) { break; } curr++; left <<= 1; } /* check for enough space */ used += 1 << curr; if ((type === LENS && used > ENOUGH_LENS) || (type === DISTS && used > ENOUGH_DISTS)) { return 1; } /* point entry in root table to sub-table */ low = huff & mask; /*table.op[low] = curr; table.bits[low] = root; table.val[low] = next - opts.table_index;*/ table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; } } /* fill in remaining table entry if code is incomplete (guaranteed to have at most one remaining entry, since if the code is incomplete, the maximum code length that was allowed to get this far is one bit) */ if (huff !== 0) { //table.op[next + huff] = 64; /* invalid code marker */ //table.bits[next + huff] = len - drop; //table.val[next + huff] = 0; table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; } /* set return parameters */ //opts.table_index += used; opts.bits = root; return 0; }; },{"../utils/common":84}],94:[function(_dereq_,module,exports){ 'use strict'; module.exports = { '2': 'need dictionary', /* Z_NEED_DICT 2 */ '1': 'stream end', /* Z_STREAM_END 1 */ '0': '', /* Z_OK 0 */ '-1': 'file error', /* Z_ERRNO (-1) */ '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ '-3': 'data error', /* Z_DATA_ERROR (-3) */ '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ }; },{}],95:[function(_dereq_,module,exports){ 'use strict'; var utils = _dereq_('../utils/common'); /* Public constants ==========================================================*/ /* ===========================================================================*/ //var Z_FILTERED = 1; //var Z_HUFFMAN_ONLY = 2; //var Z_RLE = 3; var Z_FIXED = 4; //var Z_DEFAULT_STRATEGY = 0; /* Possible values of the data_type field (though see inflate()) */ var Z_BINARY = 0; var Z_TEXT = 1; //var Z_ASCII = 1; // = Z_TEXT var Z_UNKNOWN = 2; /*============================================================================*/ function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } // From zutil.h var STORED_BLOCK = 0; var STATIC_TREES = 1; var DYN_TREES = 2; /* The three kinds of block type */ var MIN_MATCH = 3; var MAX_MATCH = 258; /* The minimum and maximum match lengths */ // From deflate.h /* =========================================================================== * Internal compression state. */ var LENGTH_CODES = 29; /* number of length codes, not counting the special END_BLOCK code */ var LITERALS = 256; /* number of literal bytes 0..255 */ var L_CODES = LITERALS + 1 + LENGTH_CODES; /* number of Literal or Length codes, including the END_BLOCK code */ var D_CODES = 30; /* number of distance codes */ var BL_CODES = 19; /* number of codes used to transfer the bit lengths */ var HEAP_SIZE = 2*L_CODES + 1; /* maximum heap size */ var MAX_BITS = 15; /* All codes must not exceed MAX_BITS bits */ var Buf_size = 16; /* size of bit buffer in bi_buf */ /* =========================================================================== * Constants */ var MAX_BL_BITS = 7; /* Bit length codes must not exceed MAX_BL_BITS bits */ var END_BLOCK = 256; /* end of block literal code */ var REP_3_6 = 16; /* repeat previous bit length 3-6 times (2 bits of repeat count) */ var REPZ_3_10 = 17; /* repeat a zero length 3-10 times (3 bits of repeat count) */ var REPZ_11_138 = 18; /* repeat a zero length 11-138 times (7 bits of repeat count) */ var extra_lbits = /* extra bits for each length code */ [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; var extra_dbits = /* extra bits for each distance code */ [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; var extra_blbits = /* extra bits for each bit length code */ [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; var bl_order = [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; /* The lengths of the bit length codes are sent in order of decreasing * probability, to avoid transmitting the lengths for unused bit length codes. */ /* =========================================================================== * Local data. These are initialized only once. */ // We pre-fill arrays with 0 to avoid uninitialized gaps var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ // !!!! Use flat array insdead of structure, Freq = i*2, Len = i*2+1 var static_ltree = new Array((L_CODES+2) * 2); zero(static_ltree); /* The static literal tree. Since the bit lengths are imposed, there is no * need for the L_CODES extra codes used during heap construction. However * The codes 286 and 287 are needed to build a canonical tree (see _tr_init * below). */ var static_dtree = new Array(D_CODES * 2); zero(static_dtree); /* The static distance tree. (Actually a trivial tree since all codes use * 5 bits.) */ var _dist_code = new Array(DIST_CODE_LEN); zero(_dist_code); /* Distance codes. The first 256 values correspond to the distances * 3 .. 258, the last 256 values correspond to the top 8 bits of * the 15 bit distances. */ var _length_code = new Array(MAX_MATCH-MIN_MATCH+1); zero(_length_code); /* length code for each normalized match length (0 == MIN_MATCH) */ var base_length = new Array(LENGTH_CODES); zero(base_length); /* First normalized length for each code (0 = MIN_MATCH) */ var base_dist = new Array(D_CODES); zero(base_dist); /* First normalized distance for each code (0 = distance of 1) */ var StaticTreeDesc = function (static_tree, extra_bits, extra_base, elems, max_length) { this.static_tree = static_tree; /* static tree or NULL */ this.extra_bits = extra_bits; /* extra bits for each code or NULL */ this.extra_base = extra_base; /* base index for extra_bits */ this.elems = elems; /* max number of elements in the tree */ this.max_length = max_length; /* max bit length for the codes */ // show if `static_tree` has data or dummy - needed for monomorphic objects this.has_stree = static_tree && static_tree.length; }; var static_l_desc; var static_d_desc; var static_bl_desc; var TreeDesc = function(dyn_tree, stat_desc) { this.dyn_tree = dyn_tree; /* the dynamic tree */ this.max_code = 0; /* largest code with non zero frequency */ this.stat_desc = stat_desc; /* the corresponding static tree */ }; function d_code(dist) { return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; } /* =========================================================================== * Output a short LSB first on the stream. * IN assertion: there is enough room in pendingBuf. */ function put_short (s, w) { // put_byte(s, (uch)((w) & 0xff)); // put_byte(s, (uch)((ush)(w) >> 8)); s.pending_buf[s.pending++] = (w) & 0xff; s.pending_buf[s.pending++] = (w >>> 8) & 0xff; } /* =========================================================================== * Send a value on a given number of bits. * IN assertion: length <= 16 and value fits in length bits. */ function send_bits(s, value, length) { if (s.bi_valid > (Buf_size - length)) { s.bi_buf |= (value << s.bi_valid) & 0xffff; put_short(s, s.bi_buf); s.bi_buf = value >> (Buf_size - s.bi_valid); s.bi_valid += length - Buf_size; } else { s.bi_buf |= (value << s.bi_valid) & 0xffff; s.bi_valid += length; } } function send_code(s, c, tree) { send_bits(s, tree[c*2]/*.Code*/, tree[c*2 + 1]/*.Len*/); } /* =========================================================================== * Reverse the first len bits of a code, using straightforward code (a faster * method would use a table) * IN assertion: 1 <= len <= 15 */ function bi_reverse(code, len) { var res = 0; do { res |= code & 1; code >>>= 1; res <<= 1; } while (--len > 0); return res >>> 1; } /* =========================================================================== * Flush the bit buffer, keeping at most 7 bits in it. */ function bi_flush(s) { if (s.bi_valid === 16) { put_short(s, s.bi_buf); s.bi_buf = 0; s.bi_valid = 0; } else if (s.bi_valid >= 8) { s.pending_buf[s.pending++] = s.bi_buf & 0xff; s.bi_buf >>= 8; s.bi_valid -= 8; } } /* =========================================================================== * Compute the optimal bit lengths for a tree and update the total bit length * for the current block. * IN assertion: the fields freq and dad are set, heap[heap_max] and * above are the tree nodes sorted by increasing frequency. * OUT assertions: the field len is set to the optimal bit length, the * array bl_count contains the frequencies for each bit length. * The length opt_len is updated; static_len is also updated if stree is * not null. */ function gen_bitlen(s, desc) // deflate_state *s; // tree_desc *desc; /* the tree descriptor */ { var tree = desc.dyn_tree; var max_code = desc.max_code; var stree = desc.stat_desc.static_tree; var has_stree = desc.stat_desc.has_stree; var extra = desc.stat_desc.extra_bits; var base = desc.stat_desc.extra_base; var max_length = desc.stat_desc.max_length; var h; /* heap index */ var n, m; /* iterate over the tree elements */ var bits; /* bit length */ var xbits; /* extra bits */ var f; /* frequency */ var overflow = 0; /* number of elements with bit length too large */ for (bits = 0; bits <= MAX_BITS; bits++) { s.bl_count[bits] = 0; } /* In a first pass, compute the optimal bit lengths (which may * overflow in the case of the bit length tree). */ tree[s.heap[s.heap_max]*2 + 1]/*.Len*/ = 0; /* root of the heap */ for (h = s.heap_max+1; h < HEAP_SIZE; h++) { n = s.heap[h]; bits = tree[tree[n*2 +1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; if (bits > max_length) { bits = max_length; overflow++; } tree[n*2 + 1]/*.Len*/ = bits; /* We overwrite tree[n].Dad which is no longer needed */ if (n > max_code) { continue; } /* not a leaf node */ s.bl_count[bits]++; xbits = 0; if (n >= base) { xbits = extra[n-base]; } f = tree[n * 2]/*.Freq*/; s.opt_len += f * (bits + xbits); if (has_stree) { s.static_len += f * (stree[n*2 + 1]/*.Len*/ + xbits); } } if (overflow === 0) { return; } // Trace((stderr,"\nbit length overflow\n")); /* This happens for example on obj2 and pic of the Calgary corpus */ /* Find the first bit length which could increase: */ do { bits = max_length-1; while (s.bl_count[bits] === 0) { bits--; } s.bl_count[bits]--; /* move one leaf down the tree */ s.bl_count[bits+1] += 2; /* move one overflow item as its brother */ s.bl_count[max_length]--; /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] */ overflow -= 2; } while (overflow > 0); /* Now recompute all bit lengths, scanning in increasing frequency. * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all * lengths instead of fixing only the wrong ones. This idea is taken * from 'ar' written by Haruhiko Okumura.) */ for (bits = max_length; bits !== 0; bits--) { n = s.bl_count[bits]; while (n !== 0) { m = s.heap[--h]; if (m > max_code) { continue; } if (tree[m*2 + 1]/*.Len*/ !== bits) { // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); s.opt_len += (bits - tree[m*2 + 1]/*.Len*/)*tree[m*2]/*.Freq*/; tree[m*2 + 1]/*.Len*/ = bits; } n--; } } } /* =========================================================================== * Generate the codes for a given tree and bit counts (which need not be * optimal). * IN assertion: the array bl_count contains the bit length statistics for * the given tree and the field len is set for all tree elements. * OUT assertion: the field code is set for all tree elements of non * zero code length. */ function gen_codes(tree, max_code, bl_count) // ct_data *tree; /* the tree to decorate */ // int max_code; /* largest code with non zero frequency */ // ushf *bl_count; /* number of codes at each bit length */ { var next_code = new Array(MAX_BITS+1); /* next code value for each bit length */ var code = 0; /* running code value */ var bits; /* bit index */ var n; /* code index */ /* The distribution counts are first used to generate the code values * without bit reversal. */ for (bits = 1; bits <= MAX_BITS; bits++) { next_code[bits] = code = (code + bl_count[bits-1]) << 1; } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1, // "inconsistent bit counts"); //Tracev((stderr,"\ngen_codes: max_code %d ", max_code)); for (n = 0; n <= max_code; n++) { var len = tree[n*2 + 1]/*.Len*/; if (len === 0) { continue; } /* Now reverse the bits */ tree[n*2]/*.Code*/ = bi_reverse(next_code[len]++, len); //Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", // n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1)); } } /* =========================================================================== * Initialize the various 'constant' tables. */ function tr_static_init() { var n; /* iterates over tree elements */ var bits; /* bit counter */ var length; /* length value */ var code; /* code value */ var dist; /* distance index */ var bl_count = new Array(MAX_BITS+1); /* number of codes at each bit length for an optimal tree */ // do check in _tr_init() //if (static_init_done) return; /* For some embedded targets, global variables are not initialized: */ /*#ifdef NO_INIT_GLOBAL_POINTERS static_l_desc.static_tree = static_ltree; static_l_desc.extra_bits = extra_lbits; static_d_desc.static_tree = static_dtree; static_d_desc.extra_bits = extra_dbits; static_bl_desc.extra_bits = extra_blbits; #endif*/ /* Initialize the mapping length (0..255) -> length code (0..28) */ length = 0; for (code = 0; code < LENGTH_CODES-1; code++) { base_length[code] = length; for (n = 0; n < (1<<extra_lbits[code]); n++) { _length_code[length++] = code; } } //Assert (length == 256, "tr_static_init: length != 256"); /* Note that the length 255 (match length 258) can be represented * in two different ways: code 284 + 5 bits or code 285, so we * overwrite length_code[255] to use the best encoding: */ _length_code[length-1] = code; /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ dist = 0; for (code = 0 ; code < 16; code++) { base_dist[code] = dist; for (n = 0; n < (1<<extra_dbits[code]); n++) { _dist_code[dist++] = code; } } //Assert (dist == 256, "tr_static_init: dist != 256"); dist >>= 7; /* from now on, all distances are divided by 128 */ for (; code < D_CODES; code++) { base_dist[code] = dist << 7; for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { _dist_code[256 + dist++] = code; } } //Assert (dist == 256, "tr_static_init: 256+dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) { bl_count[bits] = 0; } n = 0; while (n <= 143) { static_ltree[n*2 + 1]/*.Len*/ = 8; n++; bl_count[8]++; } while (n <= 255) { static_ltree[n*2 + 1]/*.Len*/ = 9; n++; bl_count[9]++; } while (n <= 279) { static_ltree[n*2 + 1]/*.Len*/ = 7; n++; bl_count[7]++; } while (n <= 287) { static_ltree[n*2 + 1]/*.Len*/ = 8; n++; bl_count[8]++; } /* Codes 286 and 287 do not exist, but we must include them in the * tree construction to get a canonical Huffman tree (longest code * all ones) */ gen_codes(static_ltree, L_CODES+1, bl_count); /* The static distance tree is trivial: */ for (n = 0; n < D_CODES; n++) { static_dtree[n*2 + 1]/*.Len*/ = 5; static_dtree[n*2]/*.Code*/ = bi_reverse(n, 5); } // Now data ready and we can init static trees static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS); static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); static_bl_desc =new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); //static_init_done = true; } /* =========================================================================== * Initialize a new block. */ function init_block(s) { var n; /* iterates over tree elements */ /* Initialize the trees. */ for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n*2]/*.Freq*/ = 0; } for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n*2]/*.Freq*/ = 0; } for (n = 0; n < BL_CODES; n++) { s.bl_tree[n*2]/*.Freq*/ = 0; } s.dyn_ltree[END_BLOCK*2]/*.Freq*/ = 1; s.opt_len = s.static_len = 0; s.last_lit = s.matches = 0; } /* =========================================================================== * Flush the bit buffer and align the output on a byte boundary */ function bi_windup(s) { if (s.bi_valid > 8) { put_short(s, s.bi_buf); } else if (s.bi_valid > 0) { //put_byte(s, (Byte)s->bi_buf); s.pending_buf[s.pending++] = s.bi_buf; } s.bi_buf = 0; s.bi_valid = 0; } /* =========================================================================== * Copy a stored block, storing first the length and its * one's complement if requested. */ function copy_block(s, buf, len, header) //DeflateState *s; //charf *buf; /* the input data */ //unsigned len; /* its length */ //int header; /* true if block header must be written */ { bi_windup(s); /* align on byte boundary */ if (header) { put_short(s, len); put_short(s, ~len); } // while (len--) { // put_byte(s, *buf++); // } utils.arraySet(s.pending_buf, s.sWindow, buf, len, s.pending); s.pending += len; } /* =========================================================================== * Compares to subtrees, using the tree depth as tie breaker when * the subtrees have equal frequency. This minimizes the worst case length. */ function smaller(tree, n, m, depth) { var _n2 = n*2; var _m2 = m*2; return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); } /* =========================================================================== * Restore the heap property by moving down the tree starting at node k, * exchanging a node with the smallest of its two sons if necessary, stopping * when the heap property is re-established (each father smaller than its * two sons). */ function pqdownheap(s, tree, k) // deflate_state *s; // ct_data *tree; /* the tree to restore */ // int k; /* node to move down */ { var v = s.heap[k]; var j = k << 1; /* left son of k */ while (j <= s.heap_len) { /* Set j to the smallest of the two sons: */ if (j < s.heap_len && smaller(tree, s.heap[j+1], s.heap[j], s.depth)) { j++; } /* Exit if v is smaller than both sons */ if (smaller(tree, v, s.heap[j], s.depth)) { break; } /* Exchange v with the smallest son */ s.heap[k] = s.heap[j]; k = j; /* And continue down the tree, setting j to the left son of k */ j <<= 1; } s.heap[k] = v; } // inlined manually // var SMALLEST = 1; /* =========================================================================== * Send the block data compressed using the given Huffman trees */ function compress_block(s, ltree, dtree) // deflate_state *s; // const ct_data *ltree; /* literal tree */ // const ct_data *dtree; /* distance tree */ { var dist; /* distance of matched string */ var lc; /* match length or unmatched char (if dist == 0) */ var lx = 0; /* running index in l_buf */ var code; /* the code to send */ var extra; /* number of extra bits to send */ if (s.last_lit !== 0) { do { dist = (s.pending_buf[s.d_buf + lx*2] << 8) | (s.pending_buf[s.d_buf + lx*2 + 1]); lc = s.pending_buf[s.l_buf + lx]; lx++; if (dist === 0) { send_code(s, lc, ltree); /* send a literal byte */ //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); } else { /* Here, lc is the match length - MIN_MATCH */ code = _length_code[lc]; send_code(s, code+LITERALS+1, ltree); /* send the length code */ extra = extra_lbits[code]; if (extra !== 0) { lc -= base_length[code]; send_bits(s, lc, extra); /* send the extra length bits */ } dist--; /* dist is now the match distance - 1 */ code = d_code(dist); //Assert (code < D_CODES, "bad d_code"); send_code(s, code, dtree); /* send the distance code */ extra = extra_dbits[code]; if (extra !== 0) { dist -= base_dist[code]; send_bits(s, dist, extra); /* send the extra distance bits */ } } /* literal or match pair ? */ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, // "pendingBuf overflow"); } while (lx < s.last_lit); } send_code(s, END_BLOCK, ltree); } /* =========================================================================== * Construct one Huffman tree and assigns the code bit strings and lengths. * Update the total bit length for the current block. * IN assertion: the field freq is set for all tree elements. * OUT assertions: the fields len and code are set to the optimal bit length * and corresponding code. The length opt_len is updated; static_len is * also updated if stree is not null. The field max_code is set. */ function build_tree(s, desc) // deflate_state *s; // tree_desc *desc; /* the tree descriptor */ { var tree = desc.dyn_tree; var stree = desc.stat_desc.static_tree; var has_stree = desc.stat_desc.has_stree; var elems = desc.stat_desc.elems; var n, m; /* iterate over heap elements */ var max_code = -1; /* largest code with non zero frequency */ var node; /* new node being created */ /* Construct the initial heap, with least frequent element in * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. * heap[0] is not used. */ s.heap_len = 0; s.heap_max = HEAP_SIZE; for (n = 0; n < elems; n++) { if (tree[n * 2]/*.Freq*/ !== 0) { s.heap[++s.heap_len] = max_code = n; s.depth[n] = 0; } else { tree[n*2 + 1]/*.Len*/ = 0; } } /* The pkzip format requires that at least one distance code exists, * and that at least one bit should be sent even if there is only one * possible code. So to avoid special checks later on we force at least * two codes of non zero frequency. */ while (s.heap_len < 2) { node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); tree[node * 2]/*.Freq*/ = 1; s.depth[node] = 0; s.opt_len--; if (has_stree) { s.static_len -= stree[node*2 + 1]/*.Len*/; } /* node is 0 or 1 so it does not have extra bits */ } desc.max_code = max_code; /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } /* Construct the Huffman tree by repeatedly combining the least two * frequent nodes. */ node = elems; /* next internal node of the tree */ do { //pqremove(s, tree, n); /* n = node of least frequency */ /*** pqremove ***/ n = s.heap[1/*SMALLEST*/]; s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; pqdownheap(s, tree, 1/*SMALLEST*/); /***/ m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ s.heap[--s.heap_max] = m; /* Create a new node father of n and m */ tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; tree[n*2 + 1]/*.Dad*/ = tree[m*2 + 1]/*.Dad*/ = node; /* and insert the new node in the heap */ s.heap[1/*SMALLEST*/] = node++; pqdownheap(s, tree, 1/*SMALLEST*/); } while (s.heap_len >= 2); s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; /* At this point, the fields freq and dad are set. We can now * generate the bit lengths. */ gen_bitlen(s, desc); /* The field len is now set, we can generate the bit codes */ gen_codes(tree, max_code, s.bl_count); } /* =========================================================================== * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. */ function scan_tree(s, tree, max_code) // deflate_state *s; // ct_data *tree; /* the tree to be scanned */ // int max_code; /* and its largest code of non zero frequency */ { var n; /* iterates over all tree elements */ var prevlen = -1; /* last emitted length */ var curlen; /* length of current code */ var nextlen = tree[0*2 + 1]/*.Len*/; /* length of next code */ var count = 0; /* repeat count of the current code */ var max_count = 7; /* max repeat count */ var min_count = 4; /* min repeat count */ if (nextlen === 0) { max_count = 138; min_count = 3; } tree[(max_code+1)*2 + 1]/*.Len*/ = 0xffff; /* guard */ for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[(n+1)*2 + 1]/*.Len*/; if (++count < max_count && curlen === nextlen) { continue; } else if (count < min_count) { s.bl_tree[curlen * 2]/*.Freq*/ += count; } else if (curlen !== 0) { if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } s.bl_tree[REP_3_6*2]/*.Freq*/++; } else if (count <= 10) { s.bl_tree[REPZ_3_10*2]/*.Freq*/++; } else { s.bl_tree[REPZ_11_138*2]/*.Freq*/++; } count = 0; prevlen = curlen; if (nextlen === 0) { max_count = 138; min_count = 3; } else if (curlen === nextlen) { max_count = 6; min_count = 3; } else { max_count = 7; min_count = 4; } } } /* =========================================================================== * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ function send_tree(s, tree, max_code) // deflate_state *s; // ct_data *tree; /* the tree to be scanned */ // int max_code; /* and its largest code of non zero frequency */ { var n; /* iterates over all tree elements */ var prevlen = -1; /* last emitted length */ var curlen; /* length of current code */ var nextlen = tree[0*2 + 1]/*.Len*/; /* length of next code */ var count = 0; /* repeat count of the current code */ var max_count = 7; /* max repeat count */ var min_count = 4; /* min repeat count */ /* tree[max_code+1].Len = -1; */ /* guard already set */ if (nextlen === 0) { max_count = 138; min_count = 3; } for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[(n+1)*2 + 1]/*.Len*/; if (++count < max_count && curlen === nextlen) { continue; } else if (count < min_count) { do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); } else if (curlen !== 0) { if (curlen !== prevlen) { send_code(s, curlen, s.bl_tree); count--; } //Assert(count >= 3 && count <= 6, " 3_6?"); send_code(s, REP_3_6, s.bl_tree); send_bits(s, count-3, 2); } else if (count <= 10) { send_code(s, REPZ_3_10, s.bl_tree); send_bits(s, count-3, 3); } else { send_code(s, REPZ_11_138, s.bl_tree); send_bits(s, count-11, 7); } count = 0; prevlen = curlen; if (nextlen === 0) { max_count = 138; min_count = 3; } else if (curlen === nextlen) { max_count = 6; min_count = 3; } else { max_count = 7; min_count = 4; } } } /* =========================================================================== * Construct the Huffman tree for the bit lengths and return the index in * bl_order of the last bit length code to send. */ function build_bl_tree(s) { var max_blindex; /* index of last bit length code of non zero freq */ /* Determine the bit length frequencies for literal and distance trees */ scan_tree(s, s.dyn_ltree, s.l_desc.max_code); scan_tree(s, s.dyn_dtree, s.d_desc.max_code); /* Build the bit length tree: */ build_tree(s, s.bl_desc); /* opt_len now includes the length of the tree representations, except * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format * requires that at least 4 bit length codes be sent. (appnote.txt says * 3 but the actual value used is 4.) */ for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { if (s.bl_tree[bl_order[max_blindex]*2 + 1]/*.Len*/ !== 0) { break; } } /* Update opt_len to include the bit length tree and counts */ s.opt_len += 3*(max_blindex+1) + 5+5+4; //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", // s->opt_len, s->static_len)); return max_blindex; } /* =========================================================================== * Send the header for a block using dynamic Huffman trees: the counts, the * lengths of the bit length codes, the literal tree and the distance tree. * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. */ function send_all_trees(s, lcodes, dcodes, blcodes) // deflate_state *s; // int lcodes, dcodes, blcodes; /* number of codes for each tree */ { var rank; /* index in bl_order */ //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, // "too many codes"); //Tracev((stderr, "\nbl counts: ")); send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ send_bits(s, dcodes-1, 5); send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ for (rank = 0; rank < blcodes; rank++) { //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(s, s.bl_tree[bl_order[rank]*2 + 1]/*.Len*/, 3); } //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); send_tree(s, s.dyn_ltree, lcodes-1); /* literal tree */ //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); send_tree(s, s.dyn_dtree, dcodes-1); /* distance tree */ //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); } /* =========================================================================== * Check if the data type is TEXT or BINARY, using the following algorithm: * - TEXT if the two conditions below are satisfied: * a) There are no non-portable control characters belonging to the * "black list" (0..6, 14..25, 28..31). * b) There is at least one printable character belonging to the * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). * - BINARY otherwise. * - The following partially-portable control characters form a * "gray list" that is ignored in this detection algorithm: * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). * IN assertion: the fields Freq of dyn_ltree are set. */ function detect_data_type(s) { /* black_mask is the bit mask of black-listed bytes * set bits 0..6, 14..25, and 28..31 * 0xf3ffc07f = binary 11110011111111111100000001111111 */ var black_mask = 0xf3ffc07f; var n; /* Check for non-textual ("black-listed") bytes. */ for (n = 0; n <= 31; n++, black_mask >>>= 1) { if ((black_mask & 1) && (s.dyn_ltree[n*2]/*.Freq*/ !== 0)) { return Z_BINARY; } } /* Check for textual ("white-listed") bytes. */ if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { return Z_TEXT; } for (n = 32; n < LITERALS; n++) { if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { return Z_TEXT; } } /* There are no "black-listed" or "white-listed" bytes: * this stream either is empty or has tolerated ("gray-listed") bytes only. */ return Z_BINARY; } var static_init_done = false; /* =========================================================================== * Initialize the tree data structures for a new zlib stream. */ function _tr_init(s) { if (!static_init_done) { tr_static_init(); static_init_done = true; } s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); s.bi_buf = 0; s.bi_valid = 0; /* Initialize the first block of the first file: */ init_block(s); } /* =========================================================================== * Send a stored block */ function _tr_stored_block(s, buf, stored_len, last) //DeflateState *s; //charf *buf; /* input block */ //ulg stored_len; /* length of input block */ //int last; /* one if this is the last block for a file */ { send_bits(s, (STORED_BLOCK<<1)+(last ? 1 : 0), 3); /* send block type */ copy_block(s, buf, stored_len, true); /* with header */ } /* =========================================================================== * Send one empty static block to give enough lookahead for inflate. * This takes 10 bits, of which 7 may remain in the bit buffer. */ function _tr_align(s) { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); bi_flush(s); } /* =========================================================================== * Determine the best encoding for the current block: dynamic trees, static * trees or store, and output the encoded block to the zip file. */ function _tr_flush_block(s, buf, stored_len, last) //DeflateState *s; //charf *buf; /* input block, or NULL if too old */ //ulg stored_len; /* length of input block */ //int last; /* one if this is the last block for a file */ { var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ var max_blindex = 0; /* index of last bit length code of non zero freq */ /* Build the Huffman trees unless a stored block is forced */ if (s.level > 0) { /* Check if the file is binary or text */ if (s.strm.data_type === Z_UNKNOWN) { s.strm.data_type = detect_data_type(s); } /* Construct the literal and distance trees */ build_tree(s, s.l_desc); // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, // s->static_len)); build_tree(s, s.d_desc); // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, // s->static_len)); /* At this point, opt_len and static_len are the total bit lengths of * the compressed block data, excluding the tree representations. */ /* Build the bit length tree for the above two trees, and get the index * in bl_order of the last bit length code to send. */ max_blindex = build_bl_tree(s); /* Determine the best encoding. Compute the block lengths in bytes. */ opt_lenb = (s.opt_len+3+7) >>> 3; static_lenb = (s.static_len+3+7) >>> 3; // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, // s->last_lit)); if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } } else { // Assert(buf != (char*)0, "lost buf"); opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ } if ((stored_len+4 <= opt_lenb) && (buf !== -1)) { /* 4: two words for the lengths */ /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. * Otherwise we can't have processed more than WSIZE input bytes since * the last block flush, because compression would have been * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to * transform a block into a stored block. */ _tr_stored_block(s, buf, stored_len, last); } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { send_bits(s, (STATIC_TREES<<1) + (last ? 1 : 0), 3); compress_block(s, static_ltree, static_dtree); } else { send_bits(s, (DYN_TREES<<1) + (last ? 1 : 0), 3); send_all_trees(s, s.l_desc.max_code+1, s.d_desc.max_code+1, max_blindex+1); compress_block(s, s.dyn_ltree, s.dyn_dtree); } // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); /* The above check is made mod 2^32, for files larger than 512 MB * and uLong implemented on 32 bits. */ init_block(s); if (last) { bi_windup(s); } // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, // s->compressed_len-7*last)); } /* =========================================================================== * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ function _tr_tally(s, dist, lc) // deflate_state *s; // unsigned dist; /* distance of matched string */ // unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ { //var out_length, in_length, dcode; s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; s.last_lit++; if (dist === 0) { /* lc is the unmatched char */ s.dyn_ltree[lc*2]/*.Freq*/++; } else { s.matches++; /* Here, lc is the match length - MIN_MATCH */ dist--; /* dist = match distance - 1 */ //Assert((ush)dist < (ush)MAX_DIST(s) && // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); s.dyn_ltree[(_length_code[lc]+LITERALS+1) * 2]/*.Freq*/++; s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; } // (!) This block is disabled in zlib defailts, // don't enable it for binary compatibility //#ifdef TRUNCATE_BLOCK // /* Try to guess if it is profitable to stop the current block here */ // if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { // /* Compute an upper bound for the compressed length */ // out_length = s.last_lit*8; // in_length = s.strstart - s.block_start; // // for (dcode = 0; dcode < D_CODES; dcode++) { // out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); // } // out_length >>>= 3; // //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", // // s->last_lit, in_length, out_length, // // 100L - out_length*100L/in_length)); // if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { // return true; // } // } //#endif return (s.last_lit === s.lit_bufsize-1); /* We avoid equality with lit_bufsize because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. */ } exports._tr_init = _tr_init; exports._tr_stored_block = _tr_stored_block; exports._tr_flush_block = _tr_flush_block; exports._tr_tally = _tr_tally; exports._tr_align = _tr_align; },{"../utils/common":84}],96:[function(_dereq_,module,exports){ 'use strict'; function ZStream() { /* next input byte */ this.input = null; // JS specific, because we have no pointers this.next_in = 0; /* number of bytes available at input */ this.avail_in = 0; /* total number of input bytes read so far */ this.total_in = 0; /* next output byte should be put there */ this.output = null; // JS specific, because we have no pointers this.next_out = 0; /* remaining free space at output */ this.avail_out = 0; /* total number of bytes output so far */ this.total_out = 0; /* last error message, NULL if no error */ this.msg = ''/*Z_NULL*/; /* not visible by applications */ this.state = null; /* best guess about the data type: binary or text */ this.data_type = 2/*Z_UNKNOWN*/; /* adler32 value of the uncompressed data */ this.adler = 0; } module.exports = ZStream; },{}]},{},[1]);
docs/static/js/26.3660ebd1.chunk.js
yurizhang/ishow
webpackJsonp([26],{198:function(n,e,t){"use strict";function o(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function i(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function r(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}var a=t(0),s=t.n(a),l=t(8),c=t.n(l),p=t(1),d=t.n(p),u=t(237),h=t.n(u),A=t(230),m=(t.n(A),function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}()),f=function(n){function e(n){o(this,e);var t=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,n)),r=n.children;return t.state={children:r&&t.enhanceChildren(r)},t.didEnter=t.didEnter.bind(t),t.didLeave=t.didLeave.bind(t),t}return r(e,n),m(e,[{key:"componentWillReceiveProps",value:function(n){var e=s.a.isValidElement(this.props.children)&&s.a.Children.only(this.props.children),t=s.a.isValidElement(n.children)&&s.a.Children.only(n.children);if(!n.name)return void this.setState({children:t});this.isViewComponent(t)?this.setState({children:this.enhanceChildren(t,{show:!e||e.props.show})}):t&&this.setState({children:this.enhanceChildren(t)})}},{key:"componentDidUpdate",value:function(n){if(this.props.name){var e=s.a.isValidElement(this.props.children)&&s.a.Children.only(this.props.children),t=s.a.isValidElement(n.children)&&s.a.Children.only(n.children);this.isViewComponent(e)?t&&t.props.show||!e.props.show?t&&t.props.show&&!e.props.show&&this.toggleHidden():this.toggleVisible():!t&&e?this.toggleVisible():t&&!e&&this.toggleHidden()}}},{key:"enhanceChildren",value:function(n,e){var t=this;return s.a.cloneElement(n,Object.assign({ref:function(n){t.el=n}},e))}},{key:"isViewComponent",value:function(n){return n&&"View"===n.type._typeName}},{key:"animateElement",value:function(n,e,t,o){n.classList.add(t);var i=getComputedStyle(n),r=parseFloat(i.animationDuration)||parseFloat(i.transitionDuration);if(n.classList.add(e),0===r){var a=getComputedStyle(n),s=parseFloat(a.animationDuration)||parseFloat(a.transitionDuration);clearTimeout(this.timeout),this.timeout=setTimeout(function(){o()},1e3*s)}n.classList.remove(e,t)}},{key:"didEnter",value:function(n){var e=c.a.findDOMNode(this.el);if(n&&n.target===e){var t=this.props.onAfterEnter,o=this.transitionClass,i=o.enterActive,r=o.enterTo;e.classList.remove(i,r),e.removeEventListener("transitionend",this.didEnter),e.removeEventListener("animationend",this.didEnter),t&&t()}}},{key:"didLeave",value:function(n){var e=this,t=c.a.findDOMNode(this.el);if(n&&n.target===t){var o=this.props,i=o.onAfterLeave,r=o.children,a=this.transitionClass,s=a.leaveActive,l=a.leaveTo;new Promise(function(n){e.isViewComponent(r)?(t.removeEventListener("transitionend",e.didLeave),t.removeEventListener("animationend",e.didLeave),h()(function(){t.style.display="none",t.classList.remove(s,l),h()(n)})):e.setState({children:null},n)}).then(function(){i&&i()})}}},{key:"toggleVisible",value:function(){var n=this,e=this.props.onEnter,t=this.transitionClass,o=t.enter,i=t.enterActive,r=t.enterTo,a=t.leaveActive,s=t.leaveTo,l=c.a.findDOMNode(this.el);l.addEventListener("transitionend",this.didEnter),l.addEventListener("animationend",this.didEnter),h()(function(){l.classList.contains(a)&&(l.classList.remove(a,s),l.removeEventListener("transitionend",n.didLeave),l.removeEventListener("animationend",n.didLeave)),l.style.display="",l.classList.add(o,i),e&&e(),h()(function(){l.classList.remove(o),l.classList.add(r)})})}},{key:"toggleHidden",value:function(){var n=this,e=this.props.onLeave,t=this.transitionClass,o=t.leave,i=t.leaveActive,r=t.leaveTo,a=t.enterActive,s=t.enterTo,l=c.a.findDOMNode(this.el);l.addEventListener("transitionend",this.didLeave),l.addEventListener("animationend",this.didLeave),h()(function(){l.classList.contains(a)&&(l.classList.remove(a,s),l.removeEventListener("transitionend",n.didEnter),l.removeEventListener("animationend",n.didEnter)),l.classList.add(o,i),e&&e(),h()(function(){l.classList.remove(o),l.classList.add(r)})})}},{key:"render",value:function(){return this.state.children||null}},{key:"transitionClass",get:function(){var n=this.props.name;return{enter:n+"-enter",enterActive:n+"-enter-active",enterTo:n+"-enter-to",leave:n+"-leave",leaveActive:n+"-leave-active",leaveTo:n+"-leave-to"}}}]),e}(a.Component);e.a=f,f.propTypes={name:d.a.string,onEnter:d.a.func,onAfterEnter:d.a.func,onLeave:d.a.func,onAfterLeave:d.a.func}},201:function(n,e,t){var o=t(215);"string"===typeof o&&(o=[[n.i,o,""]]);var i={hmr:!1};i.transform=void 0;t(193)(o,i);o.locals&&(n.exports=o.locals)},202:function(n,e,t){"use strict";function o(n){c=n}function i(n,e){for(var t=n.split("."),o=c,i=0,r=t.length;i<r;i++){var a=t[i],l=o[a];if(i===r-1)return s(l,e);if(!l)return"";o=l}return""}var r="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"===typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},a=/(%|)\{([0-9a-zA-Z_]+)\}/g,s=function(n){for(var e=arguments.length,t=Array(e>1?e-1:0),o=1;o<e;o++)t[o-1]=arguments[o];return 1===t.length&&"object"===r(t[0])&&(t=t[0]),t&&t.hasOwnProperty||(t={}),n.replace(a,function(e,o,i,r){var a=void 0;return"{"===n[r-1]&&"}"===n[r+e.length]?i:(a=Object.prototype.hasOwnProperty.call(t,i)?t[i]:null,null===a||void 0===a?"":a)})},l={ishow:{colorpicker:{confirm:"\u786e\u5b9a",clear:"\u6e05\u7a7a"},datepicker:{now:"\u6b64\u523b",today:"\u4eca\u5929",cancel:"\u53d6\u6d88",clear:"\u6e05\u7a7a",confirm:"\u786e\u5b9a",selectDate:"\u9009\u62e9\u65e5\u671f",selectTime:"\u9009\u62e9\u65f6\u95f4",startDate:"\u5f00\u59cb\u65e5\u671f",startTime:"\u5f00\u59cb\u65f6\u95f4",endDate:"\u7ed3\u675f\u65e5\u671f",endTime:"\u7ed3\u675f\u65f6\u95f4",year:"\u5e74",month1:"1 \u6708",month2:"2 \u6708",month3:"3 \u6708",month4:"4 \u6708",month5:"5 \u6708",month6:"6 \u6708",month7:"7 \u6708",month8:"8 \u6708",month9:"9 \u6708",month10:"10 \u6708",month11:"11 \u6708",month12:"12 \u6708",weeks:{sun:"\u65e5",mon:"\u4e00",tue:"\u4e8c",wed:"\u4e09",thu:"\u56db",fri:"\u4e94",sat:"\u516d"},months:{jan:"\u4e00\u6708",feb:"\u4e8c\u6708",mar:"\u4e09\u6708",apr:"\u56db\u6708",may:"\u4e94\u6708",jun:"\u516d\u6708",jul:"\u4e03\u6708",aug:"\u516b\u6708",sep:"\u4e5d\u6708",oct:"\u5341\u6708",nov:"\u5341\u4e00\u6708",dec:"\u5341\u4e8c\u6708"}},select:{loading:"\u52a0\u8f7d\u4e2d",noMatch:"\u65e0\u5339\u914d\u6570\u636e",noData:"\u65e0\u6570\u636e",placeholder:"\u8bf7\u9009\u62e9"},cascader:{noMatch:"\u65e0\u5339\u914d\u6570\u636e",loading:"\u52a0\u8f7d\u4e2d",placeholder:"\u8bf7\u9009\u62e9"},pagination:{goto:"\u524d\u5f80",pagesize:"\u6761/\u9875",total:"\u5171 {total} \u6761",pageClassifier:"\u9875"},messagebox:{title:"\u63d0\u793a",confirm:"\u786e\u5b9a",cancel:"\u53d6\u6d88",error:"\u8f93\u5165\u7684\u6570\u636e\u4e0d\u5408\u6cd5!"},upload:{delete:"\u5220\u9664",preview:"\u67e5\u770b\u56fe\u7247",continue:"\u7ee7\u7eed\u4e0a\u4f20"},table:{emptyText:"\u6682\u65e0\u6570\u636e",confirmFilter:"\u7b5b\u9009",resetFilter:"\u91cd\u7f6e",clearFilter:"\u5168\u90e8",sumText:"\u5408\u8ba1"},tree:{emptyText:"\u6682\u65e0\u6570\u636e"},transfer:{noMatch:"\u65e0\u5339\u914d\u6570\u636e",noData:"\u65e0\u6570\u636e",titles:["\u5217\u8868 1","\u5217\u8868 2"],filterPlaceholder:"\u8bf7\u8f93\u5165\u641c\u7d22\u5185\u5bb9",noCheckedFormat:"\u5171 {total} \u9879",hasCheckedFormat:"\u5df2\u9009 {checked}/{total} \u9879"}}},c=l;e.a={use:o,t:i}},208:function(n,e,t){n.exports=t.p+"static/media/ishow-icons.d2f69a92.woff"},209:function(n,e,t){n.exports=t.p+"static/media/ishow-icons.b02bdc1b.ttf"},212:function(n,e,t){"use strict";function o(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function i(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function r(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}var a=t(0),s=t.n(a),l=t(50),c=function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}(),p=function(n){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return r(e,n),c(e,[{key:"componentDidMount",value:function(){this.beforeEnter(),this.props.isShow&&this.enter()}},{key:"componentWillUnmount",value:function(){this.beforeLeave(),this.leave()}},{key:"componentWillReceiveProps",value:function(n){this.props.isShow!==n.isShow&&this.triggerChange(n.isShow)}},{key:"triggerChange",value:function(n){clearTimeout(this.enterTimer),clearTimeout(this.leaveTimer),n?(this.beforeEnter(),this.enter()):(this.beforeLeave(),this.leave())}},{key:"beforeEnter",value:function(){var n=this.selfRef;n.dataset.oldPaddingTop=n.style.paddingTop,n.dataset.oldPaddingBottom=n.style.paddingBottom,n.dataset.oldOverflow=n.style.overflow,n.style.height="0",n.style.paddingTop=0,n.style.paddingBottom=0}},{key:"enter",value:function(){var n=this,e=this.selfRef;e.style.display="block",0!==e.scrollHeight?(e.style.height=e.scrollHeight+"px",e.style.paddingTop=e.dataset.oldPaddingTop,e.style.paddingBottom=e.dataset.oldPaddingBottom):(e.style.height="",e.style.paddingTop=e.dataset.oldPaddingTop,e.style.paddingBottom=e.dataset.oldPaddingBottom),e.style.overflow="hidden",this.enterTimer=setTimeout(function(){return n.afterEnter()},300)}},{key:"afterEnter",value:function(){var n=this.selfRef;n&&void 0!==n.style&&(n.style.display="block",n.style.height="",n.style.overflow=n.dataset.oldOverflow)}},{key:"beforeLeave",value:function(){var n=this.selfRef;n.dataset.oldPaddingTop=n.style.paddingTop,n.dataset.oldPaddingBottom=n.style.paddingBottom,n.dataset.oldOverflow=n.style.overflow,n.style.display="block",0!==n.scrollHeight&&(n.style.height=n.scrollHeight+"px"),n.style.overflow="hidden"}},{key:"leave",value:function(){var n=this,e=this.selfRef;0!==e.scrollHeight&&(e.style.height=0,e.style.paddingTop=0,e.style.paddingBottom=0),this.leaveTimer=setTimeout(function(){return n.afterLeave()},300)}},{key:"afterLeave",value:function(){var n=this.selfRef;n&&(n.style.display="none",n.style.height="",n.style.overflow=n.dataset.oldOverflow,n.style.paddingTop=n.dataset.oldPaddingTop,n.style.paddingBottom=n.dataset.oldPaddingBottom)}},{key:"render",value:function(){var n=this;return s.a.createElement("div",{className:"collapse-transition",style:{overflow:"hidden"},ref:function(e){return n.selfRef=e}},this.props.children)}}]),e}(l.b);e.a=p},213:function(n,e,t){"use strict";var o=t(216),i=t(217);o.a.Item=i.a,e.a=o.a},215:function(n,e,t){e=n.exports=t(192)(!0),e.push([n.i,'body{font-family:Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,\\\\5FAE\\8F6F\\96C5\\9ED1,Arial,sans-serif}.App-logo{-webkit-animation:App-logo-spin infinite 20s linear;animation:App-logo-spin infinite 20s linear;height:80px}.App-header{background-color:#222;padding:20px;color:#fff}.App-intro{font-size:large}table.grid{border-collapse:collapse;width:90%;background-color:#fff;color:#5e6d82;font-size:14px;margin-bottom:45px;line-height:1.5em}table.grid td:first-child,table.grid th:first-child{padding-left:10px}table.grid td,table.grid th{border-bottom:1px solid #eaeefb;padding:10px;max-width:250px}.table-smallSize{font-size:12px}.table-smallSize td{height:28px!important}.icon-list{overflow:hidden;list-style:none;padding:0;border-radius:4px;width:100%;margin:0 auto}.icon-list li{float:left;width:10%;text-align:center;height:120px;line-height:120px;color:#333;font-size:13px;-webkit-transition:color .15s linear;-o-transition:color .15s linear;transition:color .15s linear;border:1px solid #eaeefb;margin-right:-1px;margin-bottom:-1px}.icon-list li span{display:inline-block;line-height:normal;vertical-align:middle;font-family:Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,SimSun,sans-serif;color:#99a9bf}.icon-list li span i{color:#333;font-size:20px;width:100%;padding:5px 0;margin-bottom:10px}.bg-blue{background-color:#409eff}.bg-success{background-color:#13ce66}.bg-warning{background-color:#f7ba2a}.bg-info{background-color:#20a0ff}.bg-danger{background-color:#ff4949}.bg-text-primary{background-color:#1f2d3d}.bg-text-regular{background-color:#324057}.bg-text-secondary{background-color:#475669}.bg-text-placeholder{background-color:#c0c4cc}.bg-border-base{background-color:#8492a6}.bg-border-light{background-color:#99a9bf}.bg-border-lighter{background-color:#c0ccda}.bg-border-extra-light{background-color:#f2f6fc}.bg-border-gray{background-color:#d3dce6}.bg-border-lightgray{background-color:#e5e9f2}.bg-border-lightergray{background-color:#eff2f7}.demo-color-box{width:120px;display:inline-block;margin-right:20px}.demo-color-box,.demo-color-box-vertical{border-radius:4px;padding:20px;height:74px;-webkit-box-sizing:border-box;box-sizing:border-box;color:#fff;font-size:14px}.demo-color-box-vertical{width:200px}.demo-color-box .value{font-size:12px;opacity:.69;line-height:24px}.demo-color-box-group .demo-color-box:first-child{border-radius:4px 4px 0 0}.demo-color-box-group{display:inline-block;margin-right:30px}@-webkit-keyframes App-logo-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes App-logo-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.dialog{text-align:left}.codeCollapse .ishow-collapse-item__content{background:#000;font-size:16px}.lost-404-title{color:#2d8cf0;font-size:100px;text-align:center;margin-bottom:0}.lost-404-content{color:#999;text-align:center;top:80px}.login-form{width:500px;height:auto;border-radius:10px;border:1px solid #ccc;padding:50px 100px 50px 0;background:#fff}.login-btn{width:100%}.codeCollapse .ishow-collapse-item__content{overflow-x:auto!important}.QueryCriteriaModule{margin-top:20px}.QueryCriteriaModule_ShowPart{position:relative;overflow:hidden}.QueryCriteriaModule .QueryCriteriaModule_Row{margin-bottom:20px}.QueryCriteriaModule .QueryCriteriaModule_Row>.QueryCriteriaModule_Col{text-align:center}.QueryCriteriaModule_Col>label{display:inline-block;width:16%;text-align:left;vertical-align:middle}.QueryCriteriaModule_Col>.QueryCriteriaModule_Input{width:70%;margin-left:2%}.QueryCriteriaModule_Expend{border-bottom:1px dashed #ddd;margin:35px 0;position:relative;width:100%}.QueryCriteriaModule_Expend>.QueryCriteriaModule_Expend_Button{position:absolute;text-align:center;right:0;top:-16px;width:80px;display:inline-block;margin:0 auto}.QueryCriteriaModule_CollapsePart{display:none}.QueryCriteriaModule_Button{text-align:center;margin:30px 0}.QueryCriteriaModule_DatePicker{display:inline-block;width:70%;margin-left:10px}.QueryCriteriaModule_DatePicker .ishow-date-editor.ishow-input{width:auto!important}.QueryCriteriaModule_DatePicker .ishow-date-editor{width:45%}.QueryCriteriaModule_rangeSpliter{display:inline-block;width:10%}.my-autocomplete-poi li{line-height:normal!important}.ishow-customItem-detail{overflow:hidden;-o-text-overflow:ellipsis;text-overflow:ellipsis;display:block}div.aniInput div{width:200px;margin:15px 10px 0 0}.box{width:400px}.box .top{text-align:center}.box .ishow-tooltip{margin-left:0}.box .item{margin:4px}.ishow-tooltip{display:inline-block}.box .left{float:left;width:60px}.box .right{float:right;width:60px}.box .bottom{clear:both;text-align:center}.grade{font-size:28px}.intro-block h3{font-size:22px;margin:45px 0 15px}.block{padding:54px 0;display:inline-block;width:50%;text-align:center}.block,.halfBlock{border:1px solid #eff2f6}.halfBlock{padding:24px}.contentFont{display:inline-block;vertical-align:top}#typography{font-size:28px;color:typography}.contentFont p{margin:8px 0;font-size:14px;color:#5e6d82}.contentFont h3{font-size:22px;margin:45px 0 15px}.demo_box{border:1px solid #eaeefb;height:200px;width:200px;position:relative;margin-top:20px;display:inline-block;margin-right:17px}.pingfang .hchf{font-family:PingFang SC}.hiragino .hchf{font-family:Hiragino Sans GB}.microsoft .hchf{font-family:Microsoft YaHei}.helveticaN .hchf{font-family:Helvetica Neue}.helvetica .hchf{font-family:Helvetica}.arial .hchf{font-family:Arial}.hchf{font-size:40px;color:#1f2d3d;text-align:center;line-height:160px;padding-bottom:36px}.little_box{width:100%;height:35px;line-height:35px;position:absolute;bottom:0;font-size:14px;color:#8492a6;text-align:left;text-indent:10px;border-top:1px solid #eaeefb}.language_style{font-size:12px;padding:18px 24px;line-height:1.8}.font-family{color:#c08b30}.token.string{color:#22a2c9}.token1.string{color:#5e6687}.demo-size1 p{color:#1f2f3d;font-family:Microsoft YaHei,\\ \\5FAE\\8F6F\\96C5\\9ED1}.demo-size2 p{color:#1f2f3d;font-family:\\\\5B8B\\4F53}.demo-size3 p{color:#1f2f3d;font-family:Helvetica Neue}.demo-size4 p{color:#1f2f3d;font-family:Helvetica}.demo-size5 p{color:#1f2f3d;font-family:PingFang SC}.demo-size6 p{color:#1f2f3d;font-family:Hiragino Sans GB}.demo-size7 p{color:#1f2f3d;font-family:Arial}.demo-size8 p{color:#1f2f3d;font-family:"sans-serif"}.demo-size1,.demo-size2,.demo-size3,.demo-size4,.demo-size5,.demo-size6,.demo-size7,.demo-size8,caption{color:#22a2c9;font-size:18px;caption-side:top}.demo-size1,.demo-size2,.demo-size3,.demo-size4,.demo-size5,.demo-size6,.demo-size7,.demo-size8,.h1 p{font-size:20px}.demo-size1,.demo-size2,.demo-size3,.demo-size4,.demo-size5,.demo-size6,.demo-size7,.demo-size8,.h2 p{font-size:18px}.demo-size1,.demo-size2,.demo-size3,.demo-size4,.demo-size5,.demo-size6,.demo-size7,.demo-size8,.h3 p{font-size:16px}.demo-size1,.demo-size2,.demo-size3,.demo-size4,.demo-size5,.demo-size6,.demo-size7,.demo-size8,.text-regular p{font-size:14px}.demo-size1,.demo-size2,.demo-size3,.demo-size4,.demo-size5,.demo-size6,.demo-size7,.demo-size8,.text-smaller p{font-size:12px}.color-dark,.demo-size1,.demo-size2,.demo-size3,.demo-size4,.demo-size5,.demo-size6,.demo-size7,.demo-size8{color:#99a9bf;font-size:16px}.thomas{font-family:thomas!important}.songti{font-family:\\\\5B8B\\4F53}.yahei{font-family:Microsoft YaHei,\\\\5FAE\\8F6F\\96C5\\9ED1}.numbers{font-size:24px;color:#1f2d3d;text-align:center;line-height:160px;padding-bottom:36px}.demo-box .demonstration{font-size:14px;color:#8492a6;line-height:44px}.demo-box .demonstration+.el-slider{float:right;width:70%;margin-right:20px}.demo-form .ishow-input{width:33.3%}.demo-form .ishow-textarea__inner{width:33%}.demo-form .ishow-input-group{width:33%!important;margin-top:15px}.ishow-input-for-select .ishow-input{width:100%}.ishow-tabs__active-bar{height:2px!important}.ishow-tabs--card>.ishow-tabs__header .ishow-tabs__item.is-active{background-color:#20a0ff;color:#fff;border-bottom-color:#20a0ff!important}.QueryCriteriaModule .QueryCriteriaModule_Row>.QueryCriteriaModule_Col,.QueryCriteriaModule_Button{text-align:left!important}.ishow_dialog--small{min-width:600px}.ishow-select-dropdown__list{min-height:10px}.allInOneBreadCrumbs{position:relative;display:block!important;line-height:30px;border-bottom:1px solid #f0f0f0}table{border-collapse:separate!important}.ishow-table .cell,.ishow-table th>div{padding-left:4px!important}.ishow-table{font-size:12px!important;text-align:left!important;margin-top:30px;margin-bottom:30px}.ishow-table td,.ishow-table th{height:28px!important;line-height:28px!important}.ishow-table th>.cell,.ishow-table th>.cell span{line-height:28px!important}.ishow-table_2_column_4{border-right:none!important}.checkbox_margin .ishow-checkbox{margin-bottom:15px!important}.checkbox_margin .ishow-table{margin-top:0!important}.block{display:block!important;text-align:left;border:none;padding-top:20px;padding-bottom:20px}.ishow-button--large,.QueryCriteriaModule_Expend_Button{font-size:12px!important}.ishow-tabs__header{border-bottom:1px solid #20a0ff!important}.search-tabs .ishow-tabs__header,.tabs_border_bottom .ishow-tabs__header{border-bottom:1px solid #d1dbe5!important}.ishow-select-dropdown__list{height:200px!important;overflow-y:visible!important;overflow-x:hidden!important}.ishow-select-dropdown__wrap ::-webkit-scrollbar{width:10px;height:0;background-color:#fff}.ishow-select-dropdown__wrap ::-webkit-scrollbar-thumb{background-color:#eee}.ishow-autocomplete-suggestion__list{height:250px;overflow:scroll}.my-autocomplete.ishow-scrollbar__wrap{height:250px}.ishow-popper{top:38px!important;left:0!important}#cascaderTips{font-size:12px;margin:14px 0}#floating-panel{position:absolute;top:10px;left:25%;z-index:5;background-color:#fff;padding:5px;border:1px solid #999;text-align:center;font-family:Roboto,"sans-serif";line-height:30px;padding-left:10px}.popup-tip-anchor{height:0;position:absolute;width:200px}.popup-bubble-anchor{position:absolute;width:100%;bottom:8px;left:0}.popup-bubble-anchor:after{content:"";position:absolute;top:0;left:0;-webkit-transform:translate(-50%);-ms-transform:translate(-50%);transform:translate(-50%);width:0;height:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:8px solid #fff}.popup-bubble-content{position:absolute;top:0;left:0;-webkit-transform:translate(-50%,-100%);-ms-transform:translate(-50%,-100%);transform:translate(-50%,-100%);background-color:#fff;padding:5px;border-radius:5px;font-family:sans-serif;overflow-y:auto;max-height:60px;-webkit-box-shadow:0 2px 10px 1px rgba(0,0,0,.5);box-shadow:0 2px 10px 1px rgba(0,0,0,.5)}.context-contain{width:280px;height:50px;position:absolute;margin:0;outline:0;vertical-align:baseline;background:#fff;border:0;-webkit-box-shadow:0 10px 40px rgba(0,0,0,.2);box-shadow:0 10px 40px rgba(0,0,0,.2);border-radius:8px;white-space:nowrap}.context-contain:before{content:"";position:absolute;bottom:-6px;left:50%;margin-left:-5px;width:0;height:0;border-left:5px solid transparent;border-right:5px solid transparent;border-top:6px solid #fff}.context-img{position:absolute;top:0;left:0;width:50px;border-top-left-radius:8px;border-bottom-left-radius:8px;height:50px;background:#ebebeb}.context-text{position:absolute;left:65px;right:60px;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%)}.context-text span{width:100%;line-height:20px;overflow:hidden;height:20px;white-space:nowrap;font-weight:700;-o-text-overflow:ellipsis;text-overflow:ellipsis;display:block}.context-text .subtext{font-weight:400;font-size:12px;line-height:16px;height:16px}.context-link{position:absolute;right:0;top:0;width:60px;font-size:14px;color:#3cc;text-align:center;line-height:50px}',"",{version:3,sources:["E:/demo/demo/src/components/ui/App.css"],names:[],mappings:"AAAA,KAEI,wHAA0H,CAC7H,AAED,UACI,oDAAqD,AAC7C,4CAA6C,AACrD,WAAa,CAChB,AAED,YACI,sBAAuB,AACvB,aAAc,AACd,UAAa,CAChB,AAED,WACI,eAAiB,CACpB,AAED,WACI,yBAA0B,AAC1B,UAAW,AACX,sBAAuB,AACvB,cAAe,AACf,eAAgB,AAChB,mBAAoB,AACpB,iBAAmB,CACtB,AAED,oDAEI,iBAAmB,CACtB,AAED,4BAEI,gCAAiC,AACjC,aAAc,AACd,eAAiB,CACpB,AAED,iBACI,cAAe,CAClB,AAED,oBACI,qBAAuB,CAC1B,AAID,WACI,gBAAiB,AACjB,gBAAiB,AACjB,UAAW,AACX,kBAAmB,AACnB,WAAY,AACZ,aAAe,CAClB,AAED,cACI,WAAY,AACZ,UAAW,AACX,kBAAmB,AACnB,aAAc,AACd,kBAAmB,AACnB,WAAY,AACZ,eAAgB,AAChB,qCAAsC,AACtC,gCAAiC,AACjC,6BAA8B,AAC9B,yBAA0B,AAC1B,kBAAmB,AACnB,kBAAoB,CACvB,AAED,mBACI,qBAAsB,AACtB,mBAAoB,AACpB,sBAAuB,AACvB,oGAAmH,AACnH,aAAe,CAClB,AAED,qBACI,WAAY,AACZ,eAAgB,AAChB,WAAY,AACZ,cAAe,AACf,kBAAoB,CACvB,AAID,SACI,wBAA0B,CAC7B,AAED,YACI,wBAA0B,CAC7B,AAED,YACI,wBAA0B,CAC7B,AAED,SACI,wBAA0B,CAC7B,AAED,WACI,wBAA0B,CAC7B,AAED,iBACI,wBAA0B,CAC7B,AAED,iBACI,wBAA0B,CAC7B,AAED,mBACI,wBAA0B,CAC7B,AAED,qBACI,wBAA0B,CAC7B,AAED,gBACI,wBAA0B,CAC7B,AAED,iBACI,wBAA0B,CAC7B,AAED,mBACI,wBAA0B,CAC7B,AAED,uBACI,wBAA0B,CAC7B,AAED,gBACI,wBAA0B,CAC7B,AAED,qBACI,wBAA0B,CAC7B,AAED,uBACI,wBAA0B,CAC7B,AAED,gBAQI,YAAa,AACb,qBAAsB,AACtB,iBAAmB,CACtB,AAED,yCAZI,kBAAmB,AACnB,aAAc,AACd,YAAa,AACb,8BAA+B,AACvB,sBAAuB,AAC/B,WAAY,AACZ,cAAgB,CAenB,AATD,yBAQI,WAAa,CAChB,AAED,uBACI,eAAgB,AAChB,YAAa,AACb,gBAAkB,CACrB,AAED,kDACI,yBAA2B,CAC9B,AAED,sBACI,qBAAsB,AACtB,iBAAmB,CACtB,AAID,iCACI,GACI,+BAAgC,AACxB,sBAAwB,CACnC,AACD,GACI,gCAAkC,AAC1B,uBAA0B,CACrC,CACJ,AAED,yBACI,GACI,+BAAgC,AACxB,sBAAwB,CACnC,AACD,GACI,gCAAkC,AAC1B,uBAA0B,CACrC,CACJ,AAID,QACI,eAAiB,CACpB,AAED,4CACI,gBAAiB,AACjB,cAAgB,CACnB,AAID,gBACI,cAAe,AACf,gBAAiB,AACjB,kBAAmB,AACnB,eAAgB,CACnB,AAED,kBACI,WAAY,AACZ,kBAAmB,AACnB,QAAU,CACb,AAID,YACI,YAAa,AACb,YAAa,AACb,mBAAoB,AACpB,sBAAuB,AACvB,0BAA2B,AAC3B,eAAiB,CACpB,AAID,WACI,UAAY,CACf,AAED,4CACI,yBAA4B,CAC/B,AAID,qBACI,eAAiB,CACpB,AAED,8BACI,kBAAmB,AACnB,eAAiB,CACpB,AAED,8CACI,kBAAoB,CACvB,AAED,uEACI,iBAAmB,CACtB,AAED,+BACI,qBAAsB,AACtB,UAAW,AACX,gBAAiB,AACjB,qBAAuB,CAC1B,AAED,oDACI,UAAW,AACX,cAAgB,CACnB,AAED,4BACI,8BAA+B,AAC/B,cAAiB,AACjB,kBAAmB,AACnB,UAAY,CACf,AAED,+DACI,kBAAmB,AACnB,kBAAmB,AACnB,QAAS,AACT,UAAW,AACX,WAAY,AACZ,qBAAsB,AACtB,aAAe,CAClB,AAED,kCACI,YAAc,CACjB,AAED,4BACI,kBAAmB,AACnB,aAAe,CAClB,AAED,gCACI,qBAAsB,AACtB,UAAW,AACX,gBAAkB,CACrB,AAED,+DACI,oBAAuB,CAC1B,AAED,mDACI,SAAW,CACd,AAED,kCACI,qBAAsB,AACtB,SAAW,CACd,AAID,wBACI,4BAA+B,CAClC,AAED,yBACI,gBAAiB,AACjB,0BAA2B,AACxB,uBAAwB,AAC3B,aAAe,CAClB,AAED,iBACI,YAAa,AACb,oBAAsB,CACzB,AAID,KACE,WAAa,CACd,AACD,UACE,iBAAmB,CACpB,AACD,oBACE,aAAe,CAChB,AAED,WACE,UAAY,CACb,AACD,eACE,oBAAsB,CACvB,AACD,WACE,WAAY,AACZ,UAAY,CACb,AACD,YACE,YAAa,AACb,UAAY,CACb,AACD,aACE,WAAY,AACZ,iBAAmB,CACpB,AAGD,OACE,cAAgB,CACjB,AACD,gBACE,eAAgB,AAChB,kBAAmB,CACpB,AACD,OACE,eAAgB,AAChB,qBAAqB,AACrB,UAAU,AAEV,iBAAmB,CACpB,AAED,kBAJE,wBAAyB,CAO1B,AAHD,WAEE,YAAc,CACf,AASD,aAEE,qBAAsB,AACtB,kBAAoB,CACnB,AACH,YACE,eAAgB,AAChB,gBAAkB,CACnB,AACD,eACE,aAAa,AACb,eAAgB,AAChB,aAAc,CACf,AACD,gBACE,eAAgB,AAEhB,kBAAmB,CACpB,AACD,UACE,yBAA0B,AAC1B,aAAc,AACd,YAAY,AACZ,kBAAmB,AACnB,gBAAgB,AAGhB,qBAAsB,AACtB,iBAAmB,CACpB,AAED,gBACE,uBAAyB,CAC1B,AACD,gBACE,4BAA8B,CAC/B,AACD,iBACE,2BAA6B,CAC9B,AAED,kBACE,0BAA4B,CAC7B,AACD,iBACE,qBAAuB,CACxB,AACD,aACE,iBAAmB,CACpB,AAED,MACE,eAAe,AACf,cAAc,AACd,kBAAmB,AACnB,kBAAmB,AACnB,mBAAqB,CACtB,AACD,YACE,WAAW,AACX,YAAa,AACb,iBAAkB,AAClB,kBAAkB,AAClB,SAAU,AACV,eAAgB,AAChB,cAAc,AACd,gBAAiB,AACjB,iBAAiB,AACjB,4BAA6B,CAC9B,AAED,gBACE,eAAe,AACf,kBAAmB,AACnB,eAAiB,CAClB,AACD,aACE,aAAe,CAChB,AACD,cACE,aAAe,CAChB,AACD,eACE,aAAc,CACf,AAED,cACE,cAAc,AACd,kDAAoC,CACrC,AACD,cACE,cAAc,AACd,uBAAmB,CACpB,AACD,cACE,cAAc,AACd,0BAA+B,CAChC,AAED,cACE,cAAc,AACd,qBAA0B,CAC3B,AACD,cACE,cAAc,AACd,uBAA4B,CAC7B,AACD,cACE,cAAc,AACd,4BAAiC,CAClC,AACD,cACE,cAAc,AACd,iBAAsB,CACvB,AACD,cACE,cAAc,AACd,wBAA2B,CAC5B,AAGD,wGACE,cAAc,AACd,eAAgB,AAChB,gBAAgB,CACjB,AACD,sGACE,cAAgB,CAEjB,AACD,sGACE,cAAe,CAChB,AACD,sGACE,cAAgB,CACjB,AACD,gHACE,cAAe,CAChB,AACD,gHACE,cAAe,CAChB,AACD,4GACE,cAAc,AACd,cAAe,CAChB,AAED,QACE,4BAA+B,CAChC,AAED,QACE,uBAAkB,CACnB,AACD,OACE,iDAAuC,CACxC,AACD,SACE,eAAgB,AAChB,cAAe,AACf,kBAAmB,AACnB,kBAAmB,AACnB,mBAAqB,CACtB,AAED,yBACE,eAAgB,AAChB,cAAe,AACf,gBAAkB,CACnB,AACD,oCACE,YAAa,AACb,UAAW,AACX,iBAAmB,CACpB,AACD,wBACI,WAAa,CAChB,AACD,kCACI,SAAY,CACf,AACD,8BACI,oBAAsB,AACtB,eAAiB,CACpB,AAED,qCACI,UAAW,CACd,AAUD,wBACI,oBAAuB,CAE1B,AACD,kEACI,yBAA0B,AAC1B,WAAY,AACZ,qCAAwC,CAC3C,AAQD,mGACI,yBAA4B,CAC/B,AAGD,qBACI,eAAiB,CACpB,AACD,6BACI,eAAiB,CACpB,AACD,qBACI,kBAAmB,AACnB,wBAA0B,AAC1B,iBAAkB,AAClB,+BAAiC,CACpC,AACD,MACI,kCAAqC,CACxC,AACD,uCAEI,0BAA4B,CAC/B,AACD,aACI,yBAA0B,AAC1B,0BAA2B,AAC3B,gBAAgB,AAChB,kBAAmB,CACtB,AACD,gCAEI,sBAAuB,AACvB,0BAA6B,CAChC,AAID,iDACI,0BAA6B,CAChC,AACD,wBACI,2BAA8B,CACjC,AAED,iCACI,4BAA+B,CAClC,AAED,8BACI,sBAAwB,CAC3B,AAED,OACI,wBAA0B,AAC1B,gBAAgB,AAChB,YAAa,AACb,iBAAkB,AAClB,mBAAqB,CACxB,AAMD,wDACI,wBAA2B,CAC9B,AACD,oBACI,yCAA4C,CAC/C,AAID,yEACI,yCAA4C,CAC/C,AACD,6BACI,uBAAyB,AACzB,6BAA+B,AAC/B,2BAA8B,CAEjC,AAID,iDACI,WAAY,AACZ,SAAY,AACZ,qBAAuB,CAC1B,AAeD,uDAII,qBAAuB,CAC1B,AAID,qCACI,aAAc,AACd,eAAiB,CACpB,AACD,uCACI,YAAc,CACjB,AACD,cACI,mBAAqB,AACrB,gBAAoB,CACvB,AACD,cACG,eAAgB,AAChB,aAAiB,CACnB,AAED,gBACI,kBAAmB,AACnB,SAAU,AACV,SAAU,AACV,UAAW,AACX,sBAAuB,AACvB,YAAa,AACb,sBAAuB,AACvB,kBAAmB,AACnB,gCAAmC,AACnC,iBAAkB,AAClB,iBAAmB,CACtB,AAGD,kBACI,SAAU,AACV,kBAAmB,AAEnB,WAAa,CACd,AAED,qBACE,kBAAmB,AACnB,WAAY,AACZ,WAA8B,AAC9B,MAAQ,CACT,AAED,2BACE,WAAY,AACZ,kBAAmB,AACnB,MAAO,AACP,OAAQ,AAER,kCAAsC,AAClC,8BAAkC,AAC9B,0BAA8B,AAEtC,QAAS,AACT,SAAU,AAEV,kCAAmC,AACnC,mCAAoC,AACpC,yBAA8C,CAC/C,AAED,sBACE,kBAAmB,AACnB,MAAO,AACP,OAAQ,AACR,wCAA0C,AACtC,oCAAsC,AAClC,gCAAkC,AAE1C,sBAAwB,AACxB,YAAa,AACb,kBAAmB,AACnB,uBAAwB,AACxB,gBAAiB,AACjB,gBAAiB,AACjB,iDAAqD,AAC7C,wCAA6C,CACtD,AAED,iBACE,YAAa,AACb,YAAa,AACb,kBAAmB,AACnB,SAAU,AACV,UAAW,AACX,wBAAyB,AAEzB,gBAAiB,AACjB,SAAU,AACV,8CAA+C,AACvC,sCAAuC,AAC/C,kBAAmB,AAGnB,kBAAoB,CACrB,AACH,wBACQ,WAAY,AACZ,kBAAmB,AACnB,YAAa,AACb,SAAU,AACV,iBAAkB,AAClB,QAAS,AACT,SAAU,AACV,kCAAmC,AACnC,mCAAoC,AACpC,yBAA2B,CAChC,AACD,aACE,kBAAmB,AACnB,MAAO,AACP,OAAQ,AACR,WAAY,AACZ,2BAA4B,AAC5B,8BAA+B,AAC/B,YAAa,AACb,kBAAoB,CACrB,AACD,cACE,kBAAmB,AACnB,UAAW,AACX,WAAY,AACZ,QAAS,AACT,mCAAoC,AACpC,+BAAgC,AAChC,0BAA4B,CAC7B,AACD,mBACQ,WAAY,AACV,iBAAkB,AAClB,gBAAiB,AACjB,YAAa,AACb,mBAAoB,AACpB,gBAAiB,AACjB,0BAA2B,AACxB,uBAAwB,AAC3B,aAAe,CACxB,AACD,uBACE,gBAAiB,AACjB,eAAgB,AAChB,iBAAkB,AAClB,WAAa,CACd,AACD,cACE,kBAAmB,AACnB,QAAS,AACT,MAAO,AACP,WAAY,AACZ,eAAgB,AAChB,WAAY,AACZ,kBAAmB,AACnB,gBAAkB,CACnB",file:"App.css",sourcesContent:['body {\n /* \u5b57\u4f53 */\n font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "\u5fae\u8f6f\u96c5\u9ed1", Arial, sans-serif;\n}\n\n.App-logo {\n -webkit-animation: App-logo-spin infinite 20s linear;\n animation: App-logo-spin infinite 20s linear;\n height: 80px;\n}\n\n.App-header {\n background-color: #222;\n padding: 20px;\n color: white;\n}\n\n.App-intro {\n font-size: large;\n}\n\ntable.grid {\n border-collapse: collapse;\n width: 90%;\n background-color: #fff;\n color: #5e6d82;\n font-size: 14px;\n margin-bottom: 45px;\n line-height: 1.5em;\n}\n\ntable.grid th:first-child,\ntable.grid td:first-child {\n padding-left: 10px;\n}\n\ntable.grid td,\ntable.grid th {\n border-bottom: 1px solid #eaeefb;\n padding: 10px;\n max-width: 250px;\n}\n\n.table-smallSize {\n font-size: 12px\n}\n\n.table-smallSize td {\n height: 28px !important\n}\n\n/* \u56fe\u6807 */\n\n.icon-list {\n overflow: hidden;\n list-style: none;\n padding: 0;\n border-radius: 4px;\n width: 100%;\n margin: 0 auto;\n}\n\n.icon-list li {\n float: left;\n width: 10%;\n text-align: center;\n height: 120px;\n line-height: 120px;\n color: #333;\n font-size: 13px;\n -webkit-transition: color .15s linear;\n -o-transition: color .15s linear;\n transition: color .15s linear;\n border: 1px solid #eaeefb;\n margin-right: -1px;\n margin-bottom: -1px;\n}\n\n.icon-list li span {\n display: inline-block;\n line-height: normal;\n vertical-align: middle;\n font-family: \'Helvetica Neue\', Helvetica, \'PingFang SC\', \'Hiragino Sans GB\', \'Microsoft YaHei\', SimSun, sans-serif;\n color: #99a9bf;\n}\n\n.icon-list li span i {\n color: #333;\n font-size: 20px;\n width: 100%;\n padding: 5px 0;\n margin-bottom: 10px;\n}\n\n/* for Color.jsx */\n\n.bg-blue {\n background-color: #409eff;\n}\n\n.bg-success {\n background-color: #13CE66;\n}\n\n.bg-warning {\n background-color: #F7BA2A;\n}\n\n.bg-info {\n background-color: #20A0FF;\n}\n\n.bg-danger {\n background-color: #FF4949;\n}\n\n.bg-text-primary {\n background-color: #1F2D3D;\n}\n\n.bg-text-regular {\n background-color: #324057;\n}\n\n.bg-text-secondary {\n background-color: #475669;\n}\n\n.bg-text-placeholder {\n background-color: #c0c4cc;\n}\n\n.bg-border-base {\n background-color: #8492A6;\n}\n\n.bg-border-light {\n background-color: #99A9BF;\n}\n\n.bg-border-lighter {\n background-color: #C0CCDA;\n}\n\n.bg-border-extra-light {\n background-color: #f2f6fc;\n}\n\n.bg-border-gray {\n background-color: #D3DCE6;\n}\n\n.bg-border-lightgray {\n background-color: #E5E9F2;\n}\n\n.bg-border-lightergray {\n background-color: #EFF2F7;\n}\n\n.demo-color-box {\n border-radius: 4px;\n padding: 20px;\n height: 74px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n color: #fff;\n font-size: 14px;\n width: 120px;\n display: inline-block;\n margin-right: 20px;\n}\n\n.demo-color-box-vertical {\n border-radius: 4px;\n padding: 20px;\n height: 74px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n color: #fff;\n font-size: 14px;\n width: 200px;\n}\n\n.demo-color-box .value {\n font-size: 12px;\n opacity: .69;\n line-height: 24px;\n}\n\n.demo-color-box-group .demo-color-box:first-child {\n border-radius: 4px 4px 0 0;\n}\n\n.demo-color-box-group {\n display: inline-block;\n margin-right: 30px;\n}\n\n/* for Color.jsx */\n\n@-webkit-keyframes App-logo-spin {\n from {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n to {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes App-logo-spin {\n from {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n to {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n/* \u5f39\u51fa\u7a97\u53e3 */\n\n.dialog {\n text-align: left;\n}\n\n.codeCollapse .ishow-collapse-item__content {\n background: #000;\n font-size: 16px;\n}\n\n/* 404\u9875\u9762\u6837\u5f0f */\n\n.lost-404-title {\n color: #2d8cf0;\n font-size: 100px;\n text-align: center;\n margin-bottom: 0\n}\n\n.lost-404-content {\n color: #999;\n text-align: center;\n top: 80px;\n}\n\n/*\u767b\u5f55\u8868\u5355\u6837\u5f0f*/\n\n.login-form {\n width: 500px;\n height: auto;\n border-radius: 10px;\n border: 1px solid #ccc;\n padding: 50px 100px 50px 0;\n background: #fff;\n}\n\n\n\n.login-btn {\n width: 100%;\n}\n\n.codeCollapse .ishow-collapse-item__content {\n overflow-x: auto !important;\n}\n\n/* QueryCriteriaModule START*/\n\n.QueryCriteriaModule {\n margin-top: 20px;\n}\n\n.QueryCriteriaModule_ShowPart {\n position: relative;\n overflow: hidden;\n}\n\n.QueryCriteriaModule .QueryCriteriaModule_Row {\n margin-bottom: 20px;\n}\n\n.QueryCriteriaModule .QueryCriteriaModule_Row>.QueryCriteriaModule_Col {\n text-align: center;\n}\n\n.QueryCriteriaModule_Col>label {\n display: inline-block;\n width: 16%;\n text-align: left;\n vertical-align: middle;\n}\n\n.QueryCriteriaModule_Col>.QueryCriteriaModule_Input {\n width: 70%;\n margin-left: 2%;\n}\n\n.QueryCriteriaModule_Expend {\n border-bottom: 1px dashed #ddd;\n margin: 35px 0px;\n position: relative;\n width: 100%;\n}\n\n.QueryCriteriaModule_Expend>.QueryCriteriaModule_Expend_Button {\n position: absolute;\n text-align: center;\n right: 0;\n top: -16px;\n width: 80px;\n display: inline-block;\n margin: 0 auto;\n}\n\n.QueryCriteriaModule_CollapsePart {\n display: none;\n}\n\n.QueryCriteriaModule_Button {\n text-align: center;\n margin: 30px 0;\n}\n\n.QueryCriteriaModule_DatePicker {\n display: inline-block;\n width: 70%;\n margin-left: 10px;\n}\n\n.QueryCriteriaModule_DatePicker .ishow-date-editor.ishow-input {\n width: auto !important;\n}\n\n.QueryCriteriaModule_DatePicker .ishow-date-editor {\n width: 45%;\n}\n\n.QueryCriteriaModule_rangeSpliter {\n display: inline-block;\n width: 10%;\n}\n\n/* QueryCriteriaModule END */\n\n.my-autocomplete-poi li {\n line-height: normal !important;\n}\n\n.ishow-customItem-detail {\n overflow: hidden;\n -o-text-overflow: ellipsis;\n text-overflow: ellipsis;\n display: block;\n}\n\ndiv.aniInput div {\n width: 200px;\n margin: 15px 10px 0 0;\n}\n\n\n\n.box {\n width: 400px;\n}\n.box .top {\n text-align: center;\n}\n.box .ishow-tooltip {\n margin-left: 0;\n}\n\n.box .item {\n margin: 4px;\n}\n.ishow-tooltip {\n display: inline-block;\n}\n.box .left {\n float: left;\n width: 60px;\n}\n.box .right {\n float: right;\n width: 60px;\n}\n.box .bottom {\n clear: both;\n text-align: center;\n}\n\n\n.grade {\n font-size: 28px;\n}\n.intro-block h3{\n font-size: 22px;\n margin:45px 0 15px;\n}\n.block{\n padding: 54px 0;\n display:inline-block;\n width:50%;\n border:1px solid #eff2f6;\n text-align: center;\n}\n\n.halfBlock{\n border:1px solid #eff2f6;\n padding: 24px;\n}\n\n\n/* .container{\n width: 1140px;\n padding: 60px 30px;\n margin: 0 auto;\n box-sizing: border-box;\n} */\n.contentFont{\n /* padding:60px,189px,95px,219px; */\n display: inline-block;\n vertical-align: top;\n }\n#typography{\n font-size: 28px;\n color: typography;\n}\n.contentFont p{\n margin:8px 0;\n font-size: 14px;\n color:#5e6d82;\n}\n.contentFont h3{\n font-size: 22px;\n /* margin-top: 22px; */\n margin:45px 0 15px;\n}\n.demo_box{\n border: 1px solid #eaeefb;\n height: 200px;\n width:200px;\n position: relative;\n margin-top:20px;\n /* font-size:40px; */\n /* color:#1f2d3d; */\n display: inline-block;\n margin-right: 17px;\n}\n\n.pingfang .hchf{\n font-family: PingFang SC;\n} \n.hiragino .hchf{\n font-family: Hiragino Sans GB;\n}\n.microsoft .hchf{\n font-family: Microsoft YaHei;\n}\n\n.helveticaN .hchf{\n font-family: Helvetica Neue;\n}\n.helvetica .hchf{\n font-family: Helvetica;\n}\n.arial .hchf{\n font-family: Arial;\n}\n\n.hchf{\n font-size:40px;\n color:#1f2d3d;\n text-align: center;\n line-height: 160px;\n padding-bottom: 36px;\n}\n.little_box{\n width:100%;\n height: 35px;\n line-height: 35px;\n position:absolute;\n bottom: 0;\n font-size: 14px;\n color:#8492a6;\n text-align: left;\n text-indent:10px;\n border-top:1px solid #eaeefb;\n}\n\n.language_style{\n font-size:12px;\n padding: 18px 24px;\n line-height: 1.8;\n}\n.font-family{\n color:#c08b30 ;\n}\n.token.string{\n color: #22a2c9;\n}\n.token1.string{\n color:#5e6687;\n}\n\n.demo-size1 p{\n color:#1f2f3d;\n font-family:"Microsoft YaHei, \u5fae\u8f6f\u96c5\u9ed1";\n}\n.demo-size2 p{\n color:#1f2f3d;\n font-family: "\u5b8b\u4f53";\n}\n.demo-size3 p{\n color:#1f2f3d;\n font-family: "Helvetica Neue";\n}\n\n.demo-size4 p{\n color:#1f2f3d;\n font-family: "Helvetica";\n}\n.demo-size5 p{\n color:#1f2f3d;\n font-family: "PingFang SC";\n}\n.demo-size6 p{\n color:#1f2f3d;\n font-family: "Hiragino Sans GB";\n}\n.demo-size7 p{\n color:#1f2f3d;\n font-family: "Arial";\n}\n.demo-size8 p{\n color:#1f2f3d;\n font-family: "sans-serif";\n}\n\n\n.demo-size1, .demo-size2, .demo-size3, .demo-size4, .demo-size5, .demo-size6, .demo-size7, .demo-size8, caption{\n color:#22a2c9;\n font-size: 18px;\n caption-side:top\n}\n.demo-size1, .demo-size2, .demo-size3, .demo-size4, .demo-size5, .demo-size6, .demo-size7, .demo-size8, .h1 p{\n font-size: 20px;\n /* color:#1f2f3d; */\n}\n.demo-size1, .demo-size2, .demo-size3, .demo-size4, .demo-size5, .demo-size6, .demo-size7, .demo-size8, .h2 p{\n font-size:18px;\n}\n.demo-size1, .demo-size2, .demo-size3, .demo-size4, .demo-size5, .demo-size6, .demo-size7, .demo-size8, .h3 p{\n font-size: 16px;\n}\n.demo-size1, .demo-size2, .demo-size3, .demo-size4, .demo-size5, .demo-size6, .demo-size7, .demo-size8, .text-regular p{\n font-size:14px;\n}\n.demo-size1, .demo-size2, .demo-size3, .demo-size4, .demo-size5, .demo-size6, .demo-size7, .demo-size8, .text-smaller p{\n font-size:12px;\n}\n.demo-size1, .demo-size2, .demo-size3, .demo-size4, .demo-size5, .demo-size6, .demo-size7, .demo-size8, .color-dark {\n color:#99a9bf;\n font-size:16px;\n}\n\n.thomas{\n font-family: thomas !important;\n}\n\n.songti{\n font-family: \'\u5b8b\u4f53\';\n}\n.yahei{\n font-family: "Microsoft YaHei", "\u5fae\u8f6f\u96c5\u9ed1"\n}\n.numbers{\n font-size: 24px;\n color: #1f2d3d;\n text-align: center;\n line-height: 160px;\n padding-bottom: 36px;\n}\n/*slider*/\n.demo-box .demonstration {\n font-size: 14px;\n color: #8492a6;\n line-height: 44px;\n}\n.demo-box .demonstration + .el-slider {\n float: right;\n width: 70%;\n margin-right: 20px;\n}\n.demo-form .ishow-input{\n width: 33.3%;\n}\n.demo-form .ishow-textarea__inner{\n width: 33% ;\n}\n.demo-form .ishow-input-group{\n width: 33% !important;\n margin-top: 15px;\n}\n\n.ishow-input-for-select .ishow-input {\n width: 100%\n}\n\n\n/* .demo-form .ishow-icon-time{\n left: 379px !important;\n} */\n/* .mine */\n/* .ishow-table {\n font-size: 12px !important;\n} */\n.ishow-tabs__active-bar{\n height: 2px !important;\n \n}\n.ishow-tabs--card>.ishow-tabs__header .ishow-tabs__item.is-active{\n background-color:#20a0ff ;\n color: #fff;\n border-bottom-color: #20a0ff !important;\n}\n/* .jilin .ishow-tabs__header{\n border-bottom: 1px solid #20a0ff;\n\n} */\n.QueryCriteriaModule_Button{\n text-align: left !important;\n}\n.QueryCriteriaModule .QueryCriteriaModule_Row>.QueryCriteriaModule_Col{\n text-align: left !important;\n}\n\n\n.ishow_dialog--small{\n min-width: 600px;\n}\n.ishow-select-dropdown__list{\n min-height: 10px;\n}\n.allInOneBreadCrumbs{\n position: relative;\n display: block !important;\n line-height: 30px;\n border-bottom: 1px solid #f0f0f0;\n}\ntable{\n border-collapse: separate !important;\n}\n.ishow-table .cell,\n.ishow-table th>div {\n padding-left:4px !important;\n}\n.ishow-table{\n font-size:12px !important;\n text-align:left !important;\n margin-top:30px;\n margin-bottom:30px;\n}\n.ishow-table td,\n.ishow-table th{\n height:28px !important;\n line-height: 28px !important;\n}\n.ishow-table th>.cell{\n line-height: 28px !important;\n}\n.ishow-table th>.cell span{\n line-height: 28px !important;\n}\n.ishow-table_2_column_4{\n border-right: none !important;\n}\n\n.checkbox_margin .ishow-checkbox {\n margin-bottom: 15px !important;\n}\n\n.checkbox_margin .ishow-table {\n margin-top:0 !important;\n}\n\n.block{\n display: block !important;\n text-align:left;\n border: none; \n padding-top: 20px;\n padding-bottom: 20px;\n}\n\n\n.ishow-button--large{\n font-size: 12px !important;\n}\n.QueryCriteriaModule_Expend_Button {\n font-size: 12px !important;\n}\n.ishow-tabs__header{\n border-bottom: 1px solid #20a0ff !important;\n}\n.tabs_border_bottom .ishow-tabs__header {\n border-bottom: 1px solid #d1dbe5 !important;\n}\n.search-tabs .ishow-tabs__header {\n border-bottom: 1px solid #d1dbe5 !important;\n}\n.ishow-select-dropdown__list {\n height: 200px !important;\n overflow-y: visible !important;\n overflow-x: hidden !important;\n /* -webkit-scrollbar-base-color:#FEFAF1 !important; */\n}\n\n/*\u5b9a\u4e49\u6eda\u52a8\u6761\u9ad8\u5bbd\u53ca\u80cc\u666f \u9ad8\u5bbd\u5206\u522b\u5bf9\u5e94\u6a2a\u7ad6\u6eda\u52a8\u6761\u7684\u5c3a\u5bf8*/\n\n.ishow-select-dropdown__wrap ::-webkit-scrollbar {\n width: 10px;\n height: 0px;\n background-color: #fff;\n}\n\n/*\u5b9a\u4e49\u6eda\u52a8\u6761\u8f68\u9053 \u5185\u9634\u5f71+\u5706\u89d2*/\n\n/* ::-webkit-scrollbar-track {\n box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);\n -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);\n border-radius: 10px;\n display: none;\n background-color: #F5F5F5;\n\n} */\n\n/*\u5b9a\u4e49\u6ed1\u5757 \u5185\u9634\u5f71+\u5706\u89d2*/\n\n.ishow-select-dropdown__wrap ::-webkit-scrollbar-thumb {\n /* border-radius: 10px; */\n /* box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);\n -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3); */\n background-color: #eee;\n}\n\n\n/* POI\u9009\u62e9\u57fa\u672c\u7528\u6cd5\u52a0\u6eda\u52a8\u6761*/\n.ishow-autocomplete-suggestion__list{\n height: 250px;\n overflow: scroll;\n}\n.my-autocomplete.ishow-scrollbar__wrap {\n height: 250px;\n}\n.ishow-popper{\n top: 38px !important;\n left:0px !important;\n}\n#cascaderTips{\n font-size: 12px;\n margin: 14px 0px; \n}\n\n#floating-panel {\n position: absolute;\n top: 10px;\n left: 25%;\n z-index: 5;\n background-color: #fff;\n padding: 5px;\n border: 1px solid #999;\n text-align: center;\n font-family: \'Roboto\',\'sans-serif\';\n line-height: 30px;\n padding-left: 10px;\n}\n\n/* The location pointed to by the popup tip. */\n.popup-tip-anchor {\n height: 0;\n position: absolute;\n /* The max width of the info window. */\n width: 200px;\n }\n /* The bubble is anchored above the tip. */\n .popup-bubble-anchor {\n position: absolute;\n width: 100%;\n bottom: /* TIP_HEIGHT= */ 8px;\n left: 0;\n }\n /* Draw the tip. */\n .popup-bubble-anchor::after {\n content: "";\n position: absolute;\n top: 0;\n left: 0;\n /* Center the tip horizontally. */\n -webkit-transform: translate(-50%, 0);\n -ms-transform: translate(-50%, 0);\n transform: translate(-50%, 0);\n /* The tip is a https://css-tricks.com/snippets/css/css-triangle/ */\n width: 0;\n height: 0;\n /* The tip is 8px high, and 12px wide. */\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-top: /* TIP_HEIGHT= */ 8px solid white;\n }\n /* The popup bubble itself. */\n .popup-bubble-content {\n position: absolute;\n top: 0;\n left: 0;\n -webkit-transform: translate(-50%, -100%);\n -ms-transform: translate(-50%, -100%);\n transform: translate(-50%, -100%);\n /* Style the info window. */\n background-color: white;\n padding: 5px;\n border-radius: 5px;\n font-family: sans-serif;\n overflow-y: auto;\n max-height: 60px;\n -webkit-box-shadow: 0px 2px 10px 1px rgba(0,0,0,0.5);\n box-shadow: 0px 2px 10px 1px rgba(0,0,0,0.5);\n }\n\n .context-contain{\n width: 280px;\n height: 50px;\n position: absolute;\n margin: 0;\n outline: 0;\n vertical-align: baseline;\n /* color: #333; */\n background: #fff;\n border: 0;\n -webkit-box-shadow: 0 10px 40px rgba(0,0,0,.2);\n box-shadow: 0 10px 40px rgba(0,0,0,.2);\n border-radius: 8px;\n /* line-height: 20px; */\n /* font-size: 14px !important; */\n white-space: nowrap;\n }\n.context-contain:before{\n content: "";\n position: absolute;\n bottom: -6px;\n left: 50%;\n margin-left: -5px;\n width: 0;\n height: 0;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 6px solid #fff;\n }\n .context-img{\n position: absolute;\n top: 0;\n left: 0;\n width: 50px;\n border-top-left-radius: 8px;\n border-bottom-left-radius: 8px;\n height: 50px;\n background: #ebebeb;\n }\n .context-text{\n position: absolute;\n left: 65px;\n right: 60px;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n }\n .context-text span{\n width: 100%;\n line-height: 20px;\n overflow: hidden;\n height: 20px;\n white-space: nowrap;\n font-weight: 700;\n -o-text-overflow: ellipsis;\n text-overflow: ellipsis;\n display: block;\n }\n .context-text .subtext{\n font-weight: 400;\n font-size: 12px;\n line-height: 16px;\n height: 16px; \n }\n .context-link{\n position: absolute;\n right: 0;\n top: 0;\n width: 60px;\n font-size: 14px;\n color: #3cc;\n text-align: center;\n line-height: 50px;\n }'],sourceRoot:""}])},216:function(n,e,t){"use strict";function o(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function i(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function r(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}var a=t(0),s=t.n(a),l=t(1),c=t.n(l),p=t(50),d=t(218),u=(t.n(d),function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}()),h=function(n){function e(n){o(this,e);var t=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,n));return t.state={activeNames:[].concat(t.props.value)},t}return r(e,n),u(e,[{key:"componentWillReceiveProps",value:function(n){this.setActiveNames(n.value)}},{key:"setActiveNames",value:function(n){var e=this;n=[].concat(n),this.setState({activeNames:n},function(){return e.props.onChange(n)})}},{key:"handleItemClick",value:function(n){var e=this.state.activeNames;this.props.accordion?this.setActiveNames(e[0]&&e[0]===n?"":n):e.includes(n)?this.setActiveNames(e.filter(function(e){return e!==n})):this.setActiveNames(e.concat(n))}},{key:"render",value:function(){var n=this,e=s.a.Children.map(this.props.children,function(e,t){var o=e.props.name||t.toString();return s.a.cloneElement(e,{isActive:n.state.activeNames.includes(o),key:t,name:o,onClick:function(e){return n.handleItemClick(e)}})});return s.a.createElement("div",{className:"ishow-collapse"},e)}}]),e}(p.b);e.a=h,h.propTypes={accordion:c.a.bool,value:c.a.oneOfType([c.a.array,c.a.string]),onChange:c.a.func},h.defaultProps={value:[],onChange:function(){}}},217:function(n,e,t){"use strict";function o(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function i(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function r(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}var a=t(0),s=t.n(a),l=t(1),c=t.n(l),p=t(50),d=t(220),u=(t.n(d),t(212)),h=function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}(),A=function(n){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return r(e,n),h(e,[{key:"render",value:function(){var n=this.props,e=n.title,t=n.isActive,o=n.onClick,i=n.name;return s.a.createElement("div",{className:this.classNames({"ishow-collapse-item":!0,"is-active":t})},s.a.createElement("div",{className:"ishow-collapse-item__header",onClick:function(){return o(i)}},s.a.createElement("i",{className:"ishow-collapse-item__header__arrow ishow-icon-arrow-right"}),e),s.a.createElement(u.a,{isShow:t},s.a.createElement("div",{className:"ishow-collapse-item__wrap"},s.a.createElement("div",{className:"ishow-collapse-item__content"},this.props.children))))}}]),e}(p.b);e.a=A,A.propTypes={onClick:c.a.func,isActive:c.a.bool,title:c.a.node,name:c.a.string}},218:function(n,e,t){var o=t(219);"string"===typeof o&&(o=[[n.i,o,""]]);var i={hmr:!1};i.transform=void 0;t(193)(o,i);o.locals&&(n.exports=o.locals)},219:function(n,e,t){e=n.exports=t(192)(!0),e.push([n.i,".ishow-collapse{border:1px solid #dfe6ec;border-radius:0}.ishow-collapse-item:last-child{margin-bottom:-1px}.ishow-collapse-item.is-active>.ishow-collapse-item__header .ishow-collapse-item__header__arrow{-ms-transform:rotate(90deg);-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ishow-collapse-item__header{height:43px;line-height:43px;padding-left:15px;background-color:#fff;color:#48576a;cursor:pointer;border-bottom:1px solid #dfe6ec;font-size:13px}.ishow-collapse-item__header__arrow{margin-right:8px;-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;-o-transition:transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}.ishow-collapse-item__wrap{will-change:height;background-color:#fbfdff;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;border-bottom:1px solid #dfe6ec}.ishow-collapse-item__content{padding:10px 15px;font-size:13px;color:#1f2d3d;line-height:1.769230769230769}","",{version:3,sources:["E:/demo/demo/src/ishow/Common/css/Collapse.css"],names:[],mappings:"AACA,gBACE,yBAA0B,AAC1B,eAAgB,CACjB,AAED,gCACE,kBAAmB,CACpB,AAED,gGACE,4BAA6B,AAC7B,gCAAiC,AACzB,uBAAwB,CACjC,AAED,6BACE,YAAa,AACb,iBAAkB,AAClB,kBAAmB,AACnB,sBAAuB,AACvB,cAAe,AACf,eAAgB,AAChB,gCAAiC,AACjC,cAAe,CAChB,AAED,oCACE,iBAAkB,AAClB,yCAA0C,AAC1C,iCAAkC,AAClC,4BAA6B,AAC7B,yBAA0B,AAC1B,8CAAgD,CACjD,AAED,2BACE,mBAAoB,AACpB,yBAA0B,AAC1B,gBAAiB,AACjB,8BAA+B,AACvB,sBAAuB,AAC/B,+BAAgC,CACjC,AAED,8BACE,kBAAmB,AACnB,eAAgB,AAChB,cAAe,AACf,6BAA8B,CAC/B",file:"Collapse.css",sourcesContent:['@charset "UTF-8";\r\n.ishow-collapse {\r\n border: 1px solid #dfe6ec;\r\n border-radius: 0\r\n}\r\n\r\n.ishow-collapse-item:last-child {\r\n margin-bottom: -1px\r\n}\r\n\r\n.ishow-collapse-item.is-active>.ishow-collapse-item__header .ishow-collapse-item__header__arrow {\r\n -ms-transform: rotate(90deg);\r\n -webkit-transform: rotate(90deg);\r\n transform: rotate(90deg)\r\n}\r\n\r\n.ishow-collapse-item__header {\r\n height: 43px;\r\n line-height: 43px;\r\n padding-left: 15px;\r\n background-color: #fff;\r\n color: #48576a;\r\n cursor: pointer;\r\n border-bottom: 1px solid #dfe6ec;\r\n font-size: 13px\r\n}\r\n\r\n.ishow-collapse-item__header__arrow {\r\n margin-right: 8px;\r\n -webkit-transition: -webkit-transform .3s;\r\n transition: -webkit-transform .3s;\r\n -o-transition: transform .3s;\r\n transition: transform .3s;\r\n transition: transform .3s, -webkit-transform .3s\r\n}\r\n\r\n.ishow-collapse-item__wrap {\r\n will-change: height;\r\n background-color: #fbfdff;\r\n overflow: hidden;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n border-bottom: 1px solid #dfe6ec\r\n}\r\n\r\n.ishow-collapse-item__content {\r\n padding: 10px 15px;\r\n font-size: 13px;\r\n color: #1f2d3d;\r\n line-height: 1.769230769230769\r\n}\r\n'],sourceRoot:""}])},220:function(n,e,t){var o=t(221);"string"===typeof o&&(o=[[n.i,o,""]]);var i={hmr:!1};i.transform=void 0;t(193)(o,i);o.locals&&(n.exports=o.locals)},221:function(n,e,t){e=n.exports=t(192)(!0),e.push([n.i,".ishow-collapse{border:1px solid #dfe6ec;border-radius:0}.ishow-collapse-item:last-child{margin-bottom:-1px}.ishow-collapse-item.is-active>.ishow-collapse-item__header .ishow-collapse-item__header__arrow{-ms-transform:rotate(90deg);-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ishow-collapse-item__header{height:43px;line-height:43px;padding-left:15px;background-color:#fff;color:#48576a;cursor:pointer;border-bottom:1px solid #dfe6ec;font-size:13px}.ishow-collapse-item__header__arrow{margin-right:8px;-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;-o-transition:transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}.ishow-collapse-item__wrap{will-change:height;background-color:#fbfdff;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;border-bottom:1px solid #dfe6ec}.ishow-collapse-item__content{padding:10px 15px;font-size:13px;color:#1f2d3d;line-height:1.769230769230769}","",{version:3,sources:["E:/demo/demo/src/ishow/Common/css/Collapse-item.css"],names:[],mappings:"AACA,gBACE,yBAA0B,AAC1B,eAAgB,CACjB,AAED,gCACE,kBAAmB,CACpB,AAED,gGACE,4BAA6B,AAC7B,gCAAiC,AACzB,uBAAwB,CACjC,AAED,6BACE,YAAa,AACb,iBAAkB,AAClB,kBAAmB,AACnB,sBAAuB,AACvB,cAAe,AACf,eAAgB,AAChB,gCAAiC,AACjC,cAAe,CAChB,AAED,oCACE,iBAAkB,AAClB,yCAA0C,AAC1C,iCAAkC,AAClC,4BAA6B,AAC7B,yBAA0B,AAC1B,8CAAgD,CACjD,AAED,2BACE,mBAAoB,AACpB,yBAA0B,AAC1B,gBAAiB,AACjB,8BAA+B,AACvB,sBAAuB,AAC/B,+BAAgC,CACjC,AAED,8BACE,kBAAmB,AACnB,eAAgB,AAChB,cAAe,AACf,6BAA8B,CAC/B",file:"Collapse-item.css",sourcesContent:['@charset "UTF-8";\r\n.ishow-collapse {\r\n border: 1px solid #dfe6ec;\r\n border-radius: 0\r\n}\r\n\r\n.ishow-collapse-item:last-child {\r\n margin-bottom: -1px\r\n}\r\n\r\n.ishow-collapse-item.is-active>.ishow-collapse-item__header .ishow-collapse-item__header__arrow {\r\n -ms-transform: rotate(90deg);\r\n -webkit-transform: rotate(90deg);\r\n transform: rotate(90deg)\r\n}\r\n\r\n.ishow-collapse-item__header {\r\n height: 43px;\r\n line-height: 43px;\r\n padding-left: 15px;\r\n background-color: #fff;\r\n color: #48576a;\r\n cursor: pointer;\r\n border-bottom: 1px solid #dfe6ec;\r\n font-size: 13px\r\n}\r\n\r\n.ishow-collapse-item__header__arrow {\r\n margin-right: 8px;\r\n -webkit-transition: -webkit-transform .3s;\r\n transition: -webkit-transform .3s;\r\n -o-transition: transform .3s;\r\n transition: transform .3s;\r\n transition: transform .3s, -webkit-transform .3s\r\n}\r\n\r\n.ishow-collapse-item__wrap {\r\n will-change: height;\r\n background-color: #fbfdff;\r\n overflow: hidden;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n border-bottom: 1px solid #dfe6ec\r\n}\r\n\r\n.ishow-collapse-item__content {\r\n padding: 10px 15px;\r\n font-size: 13px;\r\n color: #1f2d3d;\r\n line-height: 1.769230769230769\r\n}\r\n'],sourceRoot:""}])},222:function(n,e,t){"use strict";function o(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function i(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function r(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}var a=t(0),s=t.n(a),l=(t(201),{Tree:{Code:["\n import Tree from \"../../ishow/Tree/index\"\n\n constructor(props) {\n super(props);\n \n this.state = {\n data: [{\n label: '\u4e00\u7ea7 1',\n children: [{\n label: '\u4e8c\u7ea7 1-1',\n children: [{\n label: '\u4e09\u7ea7 1-1-1'\n }]\n }]\n }, {\n label: '\u4e00\u7ea7 2',\n children: [{\n label: '\u4e8c\u7ea7 2-1',\n children: [{\n label: '\u4e09\u7ea7 2-1-1'\n }]\n }, {\n label: '\u4e8c\u7ea7 2-2',\n children: [{\n label: '\u4e09\u7ea7 2-2-1'\n }]\n }]\n }, {\n label: '\u4e00\u7ea7 3',\n children: [{\n label: '\u4e8c\u7ea7 3-1',\n children: [{\n label: '\u4e09\u7ea7 3-1-1'\n }]\n }, {\n label: '\u4e8c\u7ea7 3-2',\n children: [{\n label: '\u4e09\u7ea7 3-2-1'\n }]\n }]\n }],\n options: {\n children: 'children',\n label: 'label'\n }\n }\n }\n \n render() {\n return (\n <Tree\n data={this.state.data}\n options={this.state.options}\n highlightCurrent={true}\n onCheckChange={(data, checked, indeterminate)=>{\n console.debug('onCheckChange: ', data, checked, indeterminate)}\n }\n onNodeClicked={(data, reactElement,)=>{\n console.debug('onNodeClicked: ', data, reactElement)\n }}\n />\n )\n }\n ","\n import Tree from \"../../ishow/Tree/index\"\n\n constructor(props) {\n super(props)\n this.state = {\n regions: [{\n 'name': 'region1'\n }, {\n 'name': 'region2'\n }]\n }\n \n this.options = {\n label: 'name',\n children: 'zones'\n }\n this.count = 1\n \n }\n \n handleCheckChange(data, checked, indeterminate) {\n console.log(data, checked, indeterminate);\n }\n \n loadNode(node, resolve) {\n \n if (node.level === 0) {\n return resolve([{ name: 'region1' }, { name: 'region2' }]);\n }\n if (node.level > 3) return resolve([]);\n \n var hasChild;\n if (node.data.name === 'region1') {\n hasChild = true;\n } else if (node.data.name === 'region2') {\n hasChild = false;\n } else {\n hasChild = Math.random() > 0.5;\n }\n \n setTimeout(() => {\n var data;\n if (hasChild) {\n data = [{\n name: 'zone' + this.count++\n }, {\n name: 'zone' + this.count++\n }];\n } else {\n data = [];\n }\n \n resolve(data);\n }, 500);\n }\n \n render() {\n const { regions } = this.state\n \n return (\n <Tree\n data={regions}\n options={this.options}\n isShowCheckbox={true}\n lazy={true}\n load={this.loadNode.bind(this)}\n onCheckChange={this.handleCheckChange.bind(this)}\n onNodeClicked={(data, nodeModel, reactElement, treeNode)=>{\n console.debug('onNodeClicked: ', data, nodeModel, reactElement)\n }}\n />\n )\n }\n ","\n import Tree from \"../../ishow/Tree/index\"\n\n constructor(props) {\n super(props);\n \n this.state = {\n data: [{\n id: 1,\n label: '\u4e00\u7ea7 1',\n children: [{\n id: 4,\n label: '\u4e8c\u7ea7 1-1',\n children: [{\n id: 9,\n label: '\u4e09\u7ea7 1-1-1'\n }, {\n id: 10,\n label: '\u4e09\u7ea7 1-1-2'\n }]\n }]\n }, {\n id: 2,\n label: '\u4e00\u7ea7 2',\n children: [{\n id: 5,\n label: '\u4e8c\u7ea7 2-1'\n }, {\n id: 6,\n label: '\u4e8c\u7ea7 2-2'\n }]\n }, {\n id: 3,\n label: '\u4e00\u7ea7 3',\n children: [{\n id: 7,\n label: '\u4e8c\u7ea7 3-1'\n }, {\n id: 8,\n label: '\u4e8c\u7ea7 3-2'\n }]\n }],\n options: {\n children: 'children',\n label: 'label'\n }\n }\n }\n \n render() {\n const { data, options } = this.state\n \n return (\n <Tree\n data={data}\n options={options}\n isShowCheckbox={true}\n nodeKey=\"id\"\n defaultExpandedKeys={[2, 3]}\n defaultCheckedKeys={[5]}\n />\n )\n } \n ","\n import Tree from \"../../ishow/Tree/index\"\n import Button from '../../ishow/Button/index'\n\n constructor(props) {\n super(props);\n \n this.state = {\n data: [{\n id: 1,\n label: '\u4e00\u7ea7 1',\n children: [{\n id: 4,\n label: '\u4e8c\u7ea7 1-1',\n children: [{\n id: 9,\n label: '\u4e09\u7ea7 1-1-1'\n }, {\n id: 10,\n label: '\u4e09\u7ea7 1-1-2'\n }]\n }]\n }, {\n id: 2,\n label: '\u4e00\u7ea7 2',\n children: [{\n id: 5,\n label: '\u4e8c\u7ea7 2-1'\n }, {\n id: 6,\n label: '\u4e8c\u7ea7 2-2'\n }]\n }, {\n id: 3,\n label: '\u4e00\u7ea7 3',\n children: [{\n id: 7,\n label: '\u4e8c\u7ea7 3-1'\n }, {\n id: 8,\n label: '\u4e8c\u7ea7 3-2'\n }]\n }],\n options: {\n children: 'children',\n label: 'label'\n }\n }\n }\n \n getCheckedNodes() {\n console.log(this.tree.getCheckedNodes());\n }\n getCheckedKeys() {\n console.log(this.tree.getCheckedKeys());\n }\n setCheckedNodes() {\n this.tree.setCheckedNodes([{\n id: 5,\n label: '\u4e8c\u7ea7 2-1'\n }, {\n id: 9,\n label: '\u4e09\u7ea7 1-1-1'\n }]);\n }\n setCheckedKeys() {\n this.tree.setCheckedKeys([3]);\n }\n resetChecked() {\n this.tree.setCheckedKeys([]);\n }\n \n render() {\n const { data, options } = this.state\n \n return (\n <div>\n <Tree\n ref={e=>this.tree = e}\n data={data}\n options={options}\n isShowCheckbox={true}\n highlightCurrent={true}\n nodeKey=\"id\"\n defaultExpandedKeys={[2, 3]}\n defaultCheckedKeys={[5]}\n />\n <div className=\"buttons\">\n <Button onClick={()=>this.getCheckedNodes()}>\u901a\u8fc7 node \u83b7\u53d6</Button>\n <Button onClick={()=>this.getCheckedKeys()}>\u901a\u8fc7 key \u83b7\u53d6</Button>\n <Button onClick={()=>this.setCheckedNodes()}>\u901a\u8fc7 node \u8bbe\u7f6e</Button>\n <Button onClick={()=>this.setCheckedKeys()}>\u901a\u8fc7 key \u8bbe\u7f6e</Button>\n <Button onClick={()=>this.resetChecked()}>\u6e05\u7a7a</Button>\n </div>\n </div>\n )\n }\n ","\n import Tree from \"../../ishow/Tree/index\"\n\n constructor(props) {\n super(props);\n \n this.state = {\n data: [{\n id: 1,\n label: '\u4e00\u7ea7 1',\n children: [{\n id: 4,\n label: '\u4e8c\u7ea7 1-1',\n children: [{\n id: 9,\n label: '\u4e09\u7ea7 1-1-1'\n }, {\n id: 10,\n label: '\u4e09\u7ea7 1-1-2'\n }]\n }]\n }, {\n id: 2,\n label: '\u4e00\u7ea7 2',\n children: [{\n id: 5,\n label: '\u4e8c\u7ea7 2-1'\n }, {\n id: 6,\n label: '\u4e8c\u7ea7 2-2'\n }]\n }, {\n id: 3,\n label: '\u4e00\u7ea7 3',\n children: [{\n id: 7,\n label: '\u4e8c\u7ea7 3-1'\n }, {\n id: 8,\n label: '\u4e8c\u7ea7 3-2'\n }]\n }],\n options: {\n children: 'children',\n label: 'label'\n }\n }\n this.id = 100;\n }\n \n append(store, data) {\n store.append({ id: this.id++, label: `testtest_${this.id}`, children: [] }, data);\n }\n \n remove(store, data) {\n store.remove(data);\n }\n \n renderContent(nodeModel, data, store) {\n return (\n <span>\n <span>\n <span>{data.label}</span>\n </span>\n <span style={{float: 'right', marginRight: '20px'}}>\n <Button size=\"mini\" onClick={ () => this.append(store, data) }>Append</Button>\n <Button size=\"mini\" onClick={ () => this.remove(store, data) }>Delete</Button>\n </span>\n </span>);\n }\n \n render() {\n const { data, options } = this.state\n \n return (\n <Tree\n data={data}\n options={options}\n isShowCheckbox={true}\n nodeKey=\"id\"\n defaultExpandAll={true}\n expandOnClickNode={false}\n renderContent={(...args)=>this.renderContent(...args)}\n />\n )\n }\n ","\n import Tree from \"../../ishow/Tree/index\"\n import Input from \"../../ishow/Input/index\"\n\n constructor(props) {\n super(props);\n \n this.state = {\n data: [{\n id: 1,\n label: '\u4e00\u7ea7 1',\n children: [{\n id: 4,\n label: '\u4e8c\u7ea7 1-1',\n children: [{\n id: 9,\n label: '\u4e09\u7ea7 1-1-1'\n }, {\n id: 10,\n label: '\u4e09\u7ea7 1-1-2'\n }]\n }]\n }, {\n id: 2,\n label: '\u4e00\u7ea7 2',\n children: [{\n id: 5,\n label: '\u4e8c\u7ea7 2-1'\n }, {\n id: 6,\n label: '\u4e8c\u7ea7 2-2'\n }]\n }, {\n id: 3,\n label: '\u4e00\u7ea7 3',\n children: [{\n id: 7,\n label: '\u4e8c\u7ea7 3-1'\n }, {\n id: 8,\n label: '\u4e8c\u7ea7 3-2'\n }]\n }],\n options: {\n children: 'children',\n label: 'label'\n }\n }\n }\n \n render() {\n const { data, options } = this.state\n \n return (\n <div>\n <Input placeholder=\"\u8f93\u5165\u5173\u952e\u5b57\u8fdb\u884c\u8fc7\u6ee4\" onChange={text=> this.tree.filter(text)} />\n <Tree\n ref={e=> this.tree = e}\n className=\"filter-tree\"\n data={data}\n options={options}\n nodeKey=\"id\"\n defaultExpandAll={true}\n filterNodeMethod={(value, data)=>{\n if (!value) return true;\n return data.label.indexOf(value) !== -1;\n }}\n />\n </div>\n \n )\n }\n ","\n import Tree from \"../../ishow/Tree/index\"\n\n constructor(props) {\n super(props);\n \n this.state = {\n data: [{\n label: '\u4e00\u7ea7 1',\n children: [{\n label: '\u4e8c\u7ea7 1-1',\n children: [{\n label: '\u4e09\u7ea7 1-1-1'\n }]\n }]\n }, {\n label: '\u4e00\u7ea7 2',\n children: [{\n label: '\u4e8c\u7ea7 2-1',\n children: [{\n label: '\u4e09\u7ea7 2-1-1'\n }]\n }, {\n label: '\u4e8c\u7ea7 2-2',\n children: [{\n label: '\u4e09\u7ea7 2-2-1'\n }]\n }]\n }, {\n label: '\u4e00\u7ea7 3',\n children: [{\n label: '\u4e8c\u7ea7 3-1',\n children: [{\n label: '\u4e09\u7ea7 3-1-1'\n }]\n }, {\n label: '\u4e8c\u7ea7 3-2',\n children: [{\n label: '\u4e09\u7ea7 3-2-1'\n }]\n }]\n }],\n options: {\n children: 'children',\n label: 'label'\n }\n }\n }\n \n render() {\n const { data, options } = this.state\n \n return (\n <Tree\n ref={e=> this.tree = e}\n data={data}\n options={options}\n accordion={true}\n onNodeClicked={node=>console.log(node)}\n />\n )\n } \n "]},Tooltip:{Code:['\n import Tooltip from \'../../ishow/Tooltip/index\'\n import Button from \'../../ishow/Button/index\'\n \n render(){\n return (\n <div className="box" style={{ width: \'400\' }}>\n <div className="top" style={{ textAlign: \'center\' }}>\n <Tooltip className="item" effect="dark" content="Top Left \u63d0\u793a\u6587\u5b57" placement="top-start">\n <Button>\u4e0a\u5de6</Button>\n </Tooltip>\n <Tooltip className="item" effect="dark" content="Top Center \u63d0\u793a\u6587\u5b57" placement="top">\n <Button>\u4e0a\u8fb9</Button>\n </Tooltip>\n <Tooltip className="item" effect="dark" content="Top Right \u63d0\u793a\u6587\u5b57" placement="top-end">\n <Button>\u4e0a\u53f3</Button>\n </Tooltip>\n </div>\n <div className="left">\n <Tooltip className="item" effect="dark" content="Left Top \u63d0\u793a\u6587\u5b57" placement="left-start">\n <Button>\u5de6\u4e0a</Button>\n </Tooltip>\n <Tooltip className="item" effect="dark" content="Left Center \u63d0\u793a\u6587\u5b57" placement="left">\n <Button>\u5de6\u8fb9</Button>\n </Tooltip>\n <Tooltip className="item" effect="dark" content="Left Bottom \u63d0\u793a\u6587\u5b57" placement="left-end">\n <Button>\u5de6\u4e0b</Button>\n </Tooltip>\n </div>\n\n <div className="right">\n <Tooltip className="item" effect="dark" content="Right Top \u63d0\u793a\u6587\u5b57" placement="right-start">\n <Button>\u53f3\u4e0a</Button>\n </Tooltip>\n <Tooltip className="item" effect="dark" content="Right Center \u63d0\u793a\u6587\u5b57" placement="right">\n <Button>\u53f3\u8fb9</Button>\n </Tooltip>\n <Tooltip className="item" effect="dark" content="Right Bottom \u63d0\u793a\u6587\u5b57" placement="right-end">\n <Button>\u53f3\u4e0b</Button>\n </Tooltip>\n </div>\n <div className="bottom">\n <Tooltip className="item" effect="dark" content="Bottom Left \u63d0\u793a\u6587\u5b57" placement="bottom-start">\n <Button>\u4e0b\u5de6</Button>\n </Tooltip>\n <Tooltip className="item" effect="dark" content="Bottom Center \u63d0\u793a\u6587\u5b57" placement="bottom">\n <Button>\u4e0b\u8fb9</Button>\n </Tooltip>\n <Tooltip className="item" effect="dark" content="Bottom Right \u63d0\u793a\u6587\u5b57" placement="bottom-end">\n <Button>\u4e0b\u53f3</Button>\n </Tooltip>\n </div>\n </div>\n )\n }\n ','\n import Tooltip from \'../../ishow/Tooltip/index\'\n import Button from \'../../ishow/Button/index\'\n\n render() {\n return (\n <div>\n <Tooltip content="Top center" placement="top">\n <Button>Dark</Button>\n </Tooltip>\n <Tooltip content="Bottom center" placement="bottom" effect="light" style={{ marginLeft: 10 }}>\n <Button>Light</Button>\n </Tooltip>\n </div>\n )\n }\n ',"\n import Tooltip from '../../ishow/Tooltip/index'\n import Button from '../../ishow/Button/index'\n\n render() {\n return (\n <Tooltip\n placement=\"top\"\n content={\n <div>\u591a\u884c\u4fe1\u606f<br/>\u7b2c\u4e8c\u884c\u4fe1\u606f</div>\n }\n >\n <Button>Top center</Button>\n </Tooltip>\n )\n }\n ",'\n constructor(props){\n super(props);\n \n this.state = {\n disabled: false\n }\n }\n \n render() {\n return (\n <Tooltip disabled={ this.state.disabled } content="\u70b9\u51fb\u5173\u95ed tooltip \u529f\u80fd" placement="bottom" effect="light">\n <Button onClick={ e => this.setState({ disabled: true}) }>\u70b9\u51fb\u5173\u95ed tooltip \u529f\u80fd</Button>\n </Tooltip>\n )\n }\n ']},RichTextEditor:{Code:["\n \u4f7f\u7528\u5bcc\u6587\u672c\u7ec4\u4ef6\u7684\u65f6\u5019\uff0c\u9700\u8981\u5b89\u88c5\u5982\u4e0b\u4f9d\u8d56:yarn add wangeditor\n import E from 'wangeditor';\n import Card from \"../../ishow/Card/index\";\n import Row from '../../ishow/LayoutComponent/row/index';\n import Col from '../../ishow/LayoutComponent/col/index';\n import Breadcrumb from '../../ishow/Breadcrumb/index';\n \n class App extends Component {\n constructor(props, context) {\n super(props, context);\n this.state = {\n editorContent: '',\n editorContentJson:''\n }\n }\n \n componentDidMount() {\n const elem = this.refs.editorElem\n const editor = new E(elem)\n const text1=document.getElementById('text1')\n const text2=document.getElementById('text2')\n const onUploadFile = (url, name, folder, type, style) => {\n return url + '?name=' + name + '&folder=' + folder + '&type=' + type + '&style=' + style;\n };\n \n editor.customConfig.uploadImgServer = 'http://10.10.33.144/filebroker/upload'\n \n editor.customConfig.customUploadImg = function (files, insert) {\n // files \u662f input \u4e2d\u9009\u4e2d\u7684\u6587\u4ef6\u5217\u8868\n // insert \u662f\u83b7\u53d6\u56fe\u7247 url \u540e\uff0c\u63d2\u5165\u5230\u7f16\u8f91\u5668\u7684\u65b9\u6cd5\n let file;\n if (files && files.length) {\n file = files[0];\n } else {\n return\n }\n \n const uploadImgServer = \"http://10.10.33.144/filebroker/upload\";\n const xhr = new XMLHttpRequest();\n const test = onUploadFile(uploadImgServer, 'image.jpg','local', 0, 1);\n //\u4e0a\u4f20\u670d\u52a1\u8bf7\u67e5\u770bhttp://wiki.iShow.org/pages/viewpage.action?pageId=50078411#id-%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F2.0%E6%8E%A5%E5%8F%A3%E6%96%87%E6%A1%A3%E5%8F%8A%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E-2.1%E4%B8%8A%E4%BC%A0%E6%8E%A5%E5%8F%A3%E8%AF%B4%E6%98%8E%E5%8F%8A%E7%A4%BA%E4%BE%8B\n xhr.open('POST', test);\n const data = new FormData();\n data.append('image', file);\n xhr.send(data);\n xhr.addEventListener('load', () => {\n const response = JSON.parse(xhr.responseText);\n const imgUrl = response.data[0].local;\n insert(imgUrl)\n });\n xhr.addEventListener('error', () => {\n const error = JSON.parse(xhr.responseText);\n alert('\u4e0a\u4f20\u5931\u8d25');\n });\n }\n \n // \u4f7f\u7528 onchange \u51fd\u6570\u76d1\u542c\u5185\u5bb9\u7684\u53d8\u5316\uff0c\u5e76\u5b9e\u65f6\u66f4\u65b0\u5230 state \u4e2d\n editor.customConfig.onchange =(html, getJSON) => {\n var json = editor.txt.getJSON()\n this.setState({\n editorContent: html,\n editorContentJson: json\n })\n document.getElementById('text1').value=html\n document.getElementById('text2').value=JSON.stringify(json)//\u8f6c\u6362\u4e3aJSON\u5b57\u7b26\u4e32\n }\n editor.create()//\u5c06\u751f\u6210\u7f16\u8f91\u5668\n }\n \n render() {\n const { editorContent } = this.state;\n return (\n <div className=\"App\">\n <h2>\u5bcc\u6587\u672c\u7f16\u8f91\u5668</h2>\n <Breadcrumb first=\"UI\" second=\"\u5bcc\u6587\u672c\" />\n <div ref=\"editorElem\" style={{ textAlign: 'left' }}>\n <div className='div1'>\n </div>\n </div>\n <Row>\n <Col className=\"gutter-row\" md={12} >\n <Card style={{ borderStyle: 'none', boxShadow: '0px 0px 0px #888888' }}\n header={\n <div>\n <span style={{ lineHeight: '20px', fontSize: '16px', fontWeight: '600' }}>\u540c\u6b65\u8f6c\u6362HTML</span>\n </div>\n }\n >\n <textarea id=\"text1\" style={{width:'100%', height:'100px',borderStyle:'none'}}></textarea>\n </Card>\n </Col>\n <Col className=\"gutter-row\" md={12}>\n <Card style={{ borderStyle: 'none', boxShadow: '0px 0px 0px #888888' }}\n header={\n <div>\n <span style={{ lineHeight: '20px', fontSize: '16px', fontWeight: '600' }}>\u540c\u6b65\u8f6c\u6362JSON</span>\n </div>\n }>\n <textarea id=\"text2\" style={{width:'100%', height:'100px',borderStyle:'none'}}></textarea>\n </Card>\n </Col>\n </Row>\n </div>\n );\n }\n \n export default App;\n\n "]},Form:{Code:['\n import Form from "../../ishow/Form/index";\n import Input from "../../ishow/Input/index";\n import Col from \'../../ishow/LayoutComponent/col/index\';\n import Select from \'../../ishow/Select/index\';\n import DatePicker from \'../../ishow/DatePicker/DatePicker\';\n import TimePicker from \'../../ishow/DatePicker/TimePicker\';\n import Checkbox from \'../../ishow/Checkbox/index\';\n import Button from \'../../ishow/Button/index\';\n import Switch from \'../../ishow/Switch/index\';\n import Radio from \'../../ishow/Radio/index\';\n import Tabs from "../../ishow/Tab/index";\n\n constructor(props) {\n super(props);\n \n this.state = {\n form: {\n name: \'\',\n region: \'\',\n date1: null,\n date2: null,\n delivery: false,\n type: [],\n resource: \'\',\n desc: \'\'\n }\n };\n }\n \n onSubmit(e) {\n e.preventDefault();\n }\n \n onChange(key, value) {\n this.state.form[key] = value;\n this.forceUpdate();\n }\n \n render() {\n return (\n <Form model={this.state.form} labelWidth="80" onSubmit={this.onSubmit.bind(this)}>\n <Form.Item label="\u6d3b\u52a8\u540d\u79f0">\n <Input value={this.state.form.name} onChange={this.onChange.bind(this, \'name\')}></Input>\n </Form.Item>\n <Form.Item label="\u6d3b\u52a8\u533a\u57df">\n <Select value={this.state.form.region} placeholder="\u8bf7\u9009\u62e9\u6d3b\u52a8\u533a\u57df">\n <Select.Option label="\u533a\u57df\u4e00" value="shanghai"></Select.Option>\n <Select.Option label="\u533a\u57df\u4e8c" value="beijing"></Select.Option>\n </Select>\n </Form.Item>\n <Form.Item label="\u6d3b\u52a8\u65f6\u95f4">\n <Col span="11">\n <Form.Item prop="date1" labelWidth="0px">\n <DatePicker\n value={this.state.form.date1}\n placeholder="\u9009\u62e9\u65e5\u671f"\n onChange={this.onChange.bind(this, \'date1\')}\n />\n </Form.Item>\n </Col>\n <Col className="line" span="2">-</Col>\n <Col span="11">\n <Form.Item prop="date2" labelWidth="0px">\n <TimePicker\n value={this.state.form.date2}\n selectableRange="18:30:00 - 20:30:00"\n placeholder="\u9009\u62e9\u65f6\u95f4"\n onChange={this.onChange.bind(this, \'date2\')}\n />\n </Form.Item>\n </Col>\n </Form.Item>\n <Form.Item label="\u5373\u65f6\u914d\u9001">\n <Switch\n onText=""\n offText=""\n value={this.state.form.delivery}\n onChange={this.onChange.bind(this, \'delivery\')}\n />\n </Form.Item>\n <Form.Item label="\u6d3b\u52a8\u6027\u8d28">\n <Checkbox.Group value={this.state.form.type} onChange={this.onChange.bind(this, \'type\')}>\n <Checkbox label="\u7f8e\u98df/\u9910\u5385\u7ebf\u4e0a\u6d3b\u52a8" name="type"></Checkbox>\n <Checkbox label="\u5730\u63a8\u6d3b\u52a8" name="type"></Checkbox>\n <Checkbox label="\u7ebf\u4e0b\u4e3b\u9898\u6d3b\u52a8" name="type"></Checkbox>\n <Checkbox label="\u5355\u7eaf\u54c1\u724c\u66dd\u5149" name="type"></Checkbox>\n </Checkbox.Group>\n </Form.Item>\n <Form.Item label="\u7279\u6b8a\u8d44\u6e90">\n <Radio.Group value={this.state.form.resource}>\n <Radio value="\u7ebf\u4e0a\u54c1\u724c\u5546\u8d5e\u52a9"></Radio>\n <Radio value="\u7ebf\u4e0b\u573a\u5730\u514d\u8d39"></Radio>\n </Radio.Group>\n </Form.Item>\n <Form.Item label="\u6d3b\u52a8\u5f62\u5f0f">\n <Input type="textarea" value={this.state.form.desc} onChange={this.onChange.bind(this, \'desc\')}></Input>\n </Form.Item>\n <Form.Item>\n <Button type="primary" nativeType="submit">\u7acb\u5373\u521b\u5efa</Button>\n <Button>\u53d6\u6d88</Button>\n </Form.Item>\n </Form>\n )\n }\n \n ','\n import Form from "../../ishow/Form/index";\n import Select from \'../../ishow/Select/index\';\n import Button from \'../../ishow/Button/index\';\n\n constructor(props) {\n super(props);\n \n this.state = {\n form: {\n user: \'\',\n region: \'\'\n }\n };\n }\n \n onSubmit(e) {\n e.preventDefault();\n \n console.log(\'submit!\');\n }\n \n onChange(key, value) {\n this.setState({\n form: Object.assign(this.state.form, { [key]: value })\n });\n }\n \n render() {\n return (\n <Form inline={true} model={this.state.form} onSubmit={this.onSubmit.bind(this)} className="demo-form-inline">\n <Form.Item>\n <Input value={this.state.form.user} placeholder="\u5ba1\u6279\u4eba" onChange={this.onChange.bind(this, \'user\')}></Input>\n </Form.Item>\n <Form.Item>\n <Select value={this.state.form.region} placeholder="\u6d3b\u52a8\u533a\u57df">\n <Select.Option label="\u533a\u57df\u4e00" value="shanghai"></Select.Option>\n <Select.Option label="\u533a\u57df\u4e8c" value="beijing"></Select.Option>\n </Select>\n </Form.Item>\n <Form.Item>\n <Button nativeType="submit" type="primary">\u67e5\u8be2</Button>\n </Form.Item>\n </Form>\n )\n }\n \n ','\n import Form from "../../ishow/Form/index";\n import Input from "../../ishow/Input/index";\n import Radio from \'../../ishow/Radio/index\';\n\n constructor(props) {\n super(props);\n \n this.state = {\n labelPosition: \'right\',\n form: {\n name: \'\',\n region: \'\',\n type: \'\'\n }\n };\n }\n \n onPositionChange(value) {\n this.setState({ labelPosition: value });\n }\n \n onChange(key, value) {\n this.setState({\n form: Object.assign(this.state.form, { [key]: value })\n });\n }\n \n render() {\n return (\n <div>\n <Radio.Group size="small" value={this.state.labelPosition} onChange={this.onPositionChange.bind(this)}>\n <Radio.Button value="left">\u5de6\u5bf9\u9f50</Radio.Button>\n <Radio.Button value="right">\u53f3\u5bf9\u9f50</Radio.Button>\n <Radio.Button value="top">\u9876\u90e8\u5bf9\u9f50</Radio.Button>\n </Radio.Group>\n <div style={{ margin: 20 }}></div>\n <Form labelPosition={this.state.labelPosition} labelWidth="100" model={this.state.form} className="demo-form-stacked">\n <Form.Item label="\u540d\u79f0">\n <Input value={this.state.form.name} onChange={this.onChange.bind(this, \'name\')}></Input>\n </Form.Item>\n <Form.Item label="\u6d3b\u52a8\u533a\u57df">\n <Input value={this.state.form.region} onChange={this.onChange.bind(this, \'region\')}></Input>\n </Form.Item>\n <Form.Item label="\u6d3b\u52a8\u5c55\u5f00\u5f62\u5f0f">\n <Input value={this.state.form.type} onChange={this.onChange.bind(this, \'type\')}></Input>\n </Form.Item>\n </Form>\n </div>\n )\n }\n \n ','\n import Form from "../../ishow/Form/index";\n import Input from "../../ishow/Input/index";\n import Col from \'../../ishow/LayoutComponent/col/index\';\n import Select from \'../../ishow/Select/index\';\n import DatePicker from \'../../ishow/DatePicker/DatePicker\';\n import TimePicker from \'../../ishow/DatePicker/TimePicker\';\n import Checkbox from \'../../ishow/Checkbox/index\';\n import Button from \'../../ishow/Button/index\';\n import Switch from \'../../ishow/Switch/index\';\n import Radio from \'../../ishow/Radio/index\';\n import Tabs from "../../ishow/Tab/index";\n\n constructor(props) {\n super(props);\n \n this.state = {\n form: {\n name: \'\',\n region: \'\',\n date1: null,\n date2: null,\n delivery: false,\n type: [],\n resource: \'\',\n desc: \'\'\n },\n rules: {\n name: [\n { required: true, message: \'\u8bf7\u8f93\u5165\u6d3b\u52a8\u540d\u79f0\', trigger: \'blur\' }\n ],\n region: [\n { required: true, message: \'\u8bf7\u9009\u62e9\u6d3b\u52a8\u533a\u57df\', trigger: \'change\' }\n ],\n date1: [\n { type: \'date\', required: true, message: \'\u8bf7\u9009\u62e9\u65e5\u671f\', trigger: \'change\' }\n ],\n date2: [\n { type: \'date\', required: true, message: \'\u8bf7\u9009\u62e9\u65f6\u95f4\', trigger: \'change\' }\n ],\n type: [\n { type: \'array\', required: true, message: \'\u8bf7\u81f3\u5c11\u9009\u62e9\u4e00\u4e2a\u6d3b\u52a8\u6027\u8d28\', trigger: \'change\' }\n ],\n resource: [\n { required: true, message: \'\u8bf7\u9009\u62e9\u6d3b\u52a8\u8d44\u6e90\', trigger: \'change\' }\n ],\n desc: [\n { required: true, message: \'\u8bf7\u586b\u5199\u6d3b\u52a8\u5f62\u5f0f\', trigger: \'blur\' }\n ]\n }\n };\n }\n \n handleSubmit(e) {\n e.preventDefault();\n \n this.refs.form.validate((valid) => {\n if (valid) {\n alert(\'submit!\');\n } else {\n console.log(\'error submit!!\');\n return false;\n }\n });\n }\n \n handleReset(e) {\n e.preventDefault();\n \n this.refs.form.resetFields();\n }\n \n onChange(key, value) {\n this.setState({\n form: Object.assign({}, this.state.form, { [key]: value })\n });\n }\n \n render() {\n return (\n <Form ref="form" model={this.state.form} rules={this.state.rules} labelWidth="80" className="demo-ruleForm">\n <Form.Item label="\u6d3b\u52a8\u540d\u79f0" prop="name">\n <Input value={this.state.form.name} onChange={this.onChange.bind(this, \'name\')}></Input>\n </Form.Item>\n <Form.Item label="\u6d3b\u52a8\u533a\u57df" prop="region">\n <Select value={this.state.form.region} placeholder="\u8bf7\u9009\u62e9\u6d3b\u52a8\u533a\u57df" onChange={this.onChange.bind(this, \'region\')}>\n <Select.Option label="\u533a\u57df\u4e00" value="shanghai"></Select.Option>\n <Select.Option label="\u533a\u57df\u4e8c" value="beijing"></Select.Option>\n </Select>\n </Form.Item>\n <Form.Item label="\u6d3b\u52a8\u65f6\u95f4" required={true}>\n <Col span="11">\n <Form.Item prop="date1" labelWidth="0px">\n <DatePicker\n value={this.state.form.date1}\n placeholder="\u9009\u62e9\u65e5\u671f"\n onChange={this.onChange.bind(this, \'date1\')}\n />\n </Form.Item>\n </Col>\n <Col className="line" span="2">-</Col>\n <Col span="11">\n <Form.Item prop="date2" labelWidth="0px">\n <TimePicker\n value={this.state.form.date2}\n selectableRange="18:30:00 - 20:30:00"\n placeholder="\u9009\u62e9\u65f6\u95f4"\n onChange={this.onChange.bind(this, \'date2\')}\n />\n </Form.Item>\n </Col>\n </Form.Item>\n <Form.Item label="\u5373\u65f6\u914d\u9001" prop="delivery">\n <Switch value={this.state.form.delivery} onChange={this.onChange.bind(this, \'delivery\')}></Switch>\n </Form.Item>\n <Form.Item label="\u6d3b\u52a8\u6027\u8d28" prop="type">\n <Checkbox.Group value={this.state.form.type} onChange={this.onChange.bind(this, \'type\')}>\n <Checkbox label="\u7f8e\u98df/\u9910\u5385\u7ebf\u4e0a\u6d3b\u52a8" name="type"></Checkbox>\n <Checkbox label="\u5730\u63a8\u6d3b\u52a8" name="type"></Checkbox>\n <Checkbox label="\u7ebf\u4e0b\u4e3b\u9898\u6d3b\u52a8" name="type"></Checkbox>\n <Checkbox label="\u5355\u7eaf\u54c1\u724c\u66dd\u5149" name="type"></Checkbox>\n </Checkbox.Group>\n </Form.Item>\n <Form.Item label="\u7279\u6b8a\u8d44\u6e90" prop="resource">\n <Radio.Group value={this.state.form.resource} onChange={this.onChange.bind(this, \'resource\')}>\n <Radio value="\u7ebf\u4e0a\u54c1\u724c\u5546\u8d5e\u52a9"></Radio>\n <Radio value="\u7ebf\u4e0b\u573a\u5730\u514d\u8d39"></Radio>\n </Radio.Group>\n </Form.Item>\n <Form.Item label="\u6d3b\u52a8\u5f62\u5f0f" prop="desc">\n <Input type="textarea" value={this.state.form.desc} onChange={this.onChange.bind(this, \'desc\')}></Input>\n </Form.Item>\n <Form.Item>\n <Button type="primary" onClick={this.handleSubmit.bind(this)}>\u7acb\u5373\u521b\u5efa</Button>\n <Button onClick={this.handleReset.bind(this)}>\u91cd\u7f6e</Button>\n </Form.Item>\n </Form>\n )\n }\n \n ',"\n import Form from \"../../ishow/Form/index\";\n import Input from \"../../ishow/Input/index\";\n import Button from '../../ishow/Button/index';\n\n constructor(props) {\n super(props);\n \n this.state = {\n form: {\n pass: '',\n checkPass: '',\n age: ''\n },\n rules: {\n pass: [\n { required: true, message: '\u8bf7\u8f93\u5165\u5bc6\u7801', trigger: 'blur' },\n { validator: (rule, value, callback) => {\n if (value === '') {\n callback(new Error('\u8bf7\u8f93\u5165\u5bc6\u7801'));\n } else {\n if (this.state.form.checkPass !== '') {\n this.refs.form.validateField('checkPass');\n }\n callback();\n }\n } }\n ],\n checkPass: [\n { required: true, message: '\u8bf7\u518d\u6b21\u8f93\u5165\u5bc6\u7801', trigger: 'blur' },\n { validator: (rule, value, callback) => {\n if (value === '') {\n callback(new Error('\u8bf7\u518d\u6b21\u8f93\u5165\u5bc6\u7801'));\n } else if (value !== this.state.form.pass) {\n callback(new Error('\u4e24\u6b21\u8f93\u5165\u5bc6\u7801\u4e0d\u4e00\u81f4!'));\n } else {\n callback();\n }\n } }\n ],\n age: [\n { required: true, message: '\u8bf7\u586b\u5199\u5e74\u9f84', trigger: 'blur' },\n { validator: (rule, value, callback) => {\n var age = parseInt(value, 10);\n \n setTimeout(() => {\n if (!Number.isInteger(age)) {\n callback(new Error('\u8bf7\u8f93\u5165\u6570\u5b57\u503c'));\n } else{\n if (age < 18) {\n callback(new Error('\u5fc5\u987b\u5e74\u6ee118\u5c81'));\n } else {\n callback();\n }\n }\n }, 1000);\n }, trigger: 'change' }\n ]\n }\n };\n }\n \n handleSubmit(e) {\n e.preventDefault();\n \n this.refs.form.validate((valid) => {\n if (valid) {\n alert('submit!');\n } else {\n console.log('error submit!!');\n return false;\n }\n });\n }\n \n handleReset(e) {\n e.preventDefault();\n \n this.refs.form.resetFields();\n }\n \n onChange(key, value) {\n this.setState({\n form: Object.assign({}, this.state.form, { [key]: value })\n });\n }\n \n render() {\n return (\n <Form ref=\"form\" model={this.state.form} rules={this.state.rules} labelWidth=\"100\" className=\"demo-ruleForm\">\n <Form.Item label=\"\u5bc6\u7801\" prop=\"pass\">\n <Input type=\"password\" value={this.state.form.pass} onChange={this.onChange.bind(this, 'pass')} autoComplete=\"off\" />\n </Form.Item>\n <Form.Item label=\"\u786e\u8ba4\u5bc6\u7801\" prop=\"checkPass\">\n <Input type=\"password\" value={this.state.form.checkPass} onChange={this.onChange.bind(this, 'checkPass')} autoComplete=\"off\" />\n </Form.Item>\n <Form.Item label=\"\u5e74\u9f84\" prop=\"age\">\n <Input value={this.state.form.age} onChange={this.onChange.bind(this, 'age')}></Input>\n </Form.Item>\n <Form.Item>\n <Button type=\"primary\" onClick={this.handleSubmit.bind(this)}>\u63d0\u4ea4</Button>\n <Button onClick={this.handleReset.bind(this)}>\u91cd\u7f6e</Button>\n </Form.Item>\n </Form>\n )\n }\n ","\n import Form from \"../../ishow/Form/index\";\n import Input from \"../../ishow/Input/index\";\n import Button from '../../ishow/Button/index';\n\n constructor(props) {\n super(props);\n \n this.state = {\n form: {\n domains: [{\n key: 1,\n value: ''\n }],\n email: ''\n },\n rules: {\n email: [\n { required: true, message: '\u8bf7\u8f93\u5165\u90ae\u7bb1\u5730\u5740', trigger: 'blur' },\n { type: 'email', message: '\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u90ae\u7bb1\u5730\u5740', trigger: 'blur,change' }\n ]\n }\n };\n }\n \n handleSubmit(e) {\n e.preventDefault();\n \n this.refs.form.validate((valid) => {\n if (valid) {\n alert('submit!');\n } else {\n console.log('error submit!!');\n return false;\n }\n });\n }\n \n removeDomain(item, e) {\n var index = this.state.form.domains.indexOf(item);\n \n if (index !== -1) {\n this.state.form.domains.splice(index, 1);\n this.forceUpdate();\n }\n \n e.preventDefault();\n }\n \n addDomain(e) {\n e.preventDefault();\n \n this.state.form.domains.push({\n key: this.state.form.domains.length,\n value: ''\n });\n \n this.forceUpdate();\n }\n \n onEmailChange(value) {\n this.setState({\n form: Object.assign({}, this.state.form, { email: value})\n });\n }\n \n onDomainChange(index, value) {\n this.state.form.domains[index].value = value;\n this.forceUpdate();\n }\n \n render() {\n return (\n <Form ref=\"form\" model={this.state.form} rules={this.state.rules} labelWidth=\"100\" className=\"demo-dynamic\">\n <Form.Item prop=\"email\" label=\"\u90ae\u7bb1\">\n <Input value={this.state.form.email} onChange={this.onEmailChange.bind(this)}></Input>\n </Form.Item>\n {\n this.state.form.domains.map((domain, index) => {\n return (\n <Form.Item\n key={index}\n label={`\u57df\u540dindex`}\n prop={`domains:index`}\n rules={{\n type: 'object', required: true,\n fields: {\n value: { required: true, message: '\u57df\u540d\u4e0d\u80fd\u4e3a\u7a7a', trigger: 'blur' }\n }\n }}\n >\n <Input value={domain.value} onChange={this.onDomainChange.bind(this, index)}></Input>\n <Button onClick={this.removeDomain.bind(this, domain)}>\u5220\u9664</Button>\n </Form.Item>\n )\n })\n }\n <Form.Item>\n <Button type=\"primary\" onClick={this.handleSubmit.bind(this)}>\u63d0\u4ea4</Button>\n <Button onClick={this.addDomain.bind(this)}>\u65b0\u589e\u57df\u540d</Button>\n </Form.Item>\n </Form>\n )\n }\n \n "]},Transfer:{Code:['\n import Transfer from "../../ishow/Transfer/index";\n\n constructor(props) {\n super(props);\n this.state = {\n value: [1, 4]\n }\n this._handleChange = this.handleChange.bind(this);\n }\n \n get data() {\n const data = [];\n for (let i = 1; i <= 15; i++) {\n data.push({\n key: i,\n label: `\u5907\u9009\u9879 i`,\n disabled: i % 4 === 0\n });\n }\n return data;\n }\n \n handleChange(value) {\n this.setState({ value })\n }\n \n render() {\n const { value } = this.state;\n return <Transfer value={value} data={this.data} onChange={this._handleChange}></Transfer>\n }\n ',"\n import Transfer from \"../../ishow/Transfer/index\";\n\n constructor(props) {\n super(props);\n this.state = {\n value: []\n }\n \n this._handleChange = this.handleChange.bind(this);\n this._filterMethod = this.filterMethod.bind(this);\n }\n \n get data() {\n const data = [];\n const cities = ['\u4e0a\u6d77', '\u5317\u4eac', '\u5e7f\u5dde', '\u6df1\u5733', '\u5357\u4eac', '\u897f\u5b89', '\u6210\u90fd'];\n const pinyin = ['shanghai', 'beijing', 'guangzhou', 'shenzhen', 'nanjing', 'xian', 'chengdu'];\n cities.forEach((city, index) => {\n data.push({\n label: city,\n key: index,\n pinyin: pinyin[index]\n });\n });\n return data;\n }\n \n filterMethod(query, item) {\n return item.pinyin.indexOf(query) > -1;\n }\n \n handleChange(value) {\n this.setState({ value })\n }\n \n render() {\n const { value } = this.state;\n return (\n <Transfer\n filterable\n filterMethod={this._filterMethod}\n filterPlaceholder=\"\u8bf7\u8f93\u5165\u57ce\u5e02\u62fc\u97f3\"\n value={value}\n onChange={this._handleChange}\n data={this.data}>\n </Transfer>\n )\n } \n ","\n import Transfer from \"../../ishow/Transfer/index\";\n\n constructor(props) {\n super(props);\n this.state = {\n value: []\n }\n \n this._handleChange = this.handleChange.bind(this);\n this._filterMethod = this.filterMethod.bind(this);\n }\n \n get data() {\n const data = [];\n const cities = ['\u4e0a\u6d77', '\u5317\u4eac', '\u5e7f\u5dde', '\u6df1\u5733', '\u5357\u4eac', '\u897f\u5b89', '\u6210\u90fd'];\n const pinyin = ['shanghai', 'beijing', 'guangzhou', 'shenzhen', 'nanjing', 'xian', 'chengdu'];\n cities.forEach((city, index) => {\n data.push({\n label: city,\n key: index,\n pinyin: pinyin[index]\n });\n });\n return data;\n }\n \n filterMethod(query, item) {\n return item.pinyin.indexOf(query) > -1;\n }\n \n handleChange(value) {\n this.setState({ value })\n }\n \n render() {\n const { value } = this.state;\n return (\n <Transfer\n filterable\n filterMethod={this._filterMethod}\n filterPlaceholder=\"\u8bf7\u8f93\u5165\u57ce\u5e02\u62fc\u97f3\"\n value={value}\n onChange={this._handleChange}\n data={this.data}>\n </Transfer>\n )\n } \n ","\n import Transfer from \"../../ishow/Transfer/index\";\n\n constructor(props) {\n super(props);\n this.state = {\n value: []\n }\n \n this._handleChange = this.handleChange.bind(this);\n }\n \n get data() {\n const data = [];\n for (let i = 1; i <= 15; i++) {\n data.push({\n value: i,\n desc: `\u5907\u9009\u9879 i`,\n disabled: i % 4 === 0\n });\n }\n return data;\n }\n \n handleChange(value, direction, movedKeys) {\n console.log(value, direction, movedKeys);\n this.setState({ value })\n }\n \n render() {\n const { value } = this.state;\n return (\n <Transfer\n value={value}\n propsAlias={{\n key: 'value',\n label: 'desc'\n }}\n data={this.data}\n onChange={this._handleChange}\n >\n </Transfer>\n )\n }\n "]},Carousel:{Code:['\n import Carousel from "../../ishow/Carousel/Index";\n\n render(){\n return(\n <div>\n <span className="demonstration">\u9ed8\u8ba4 Hover \u6307\u793a\u5668\u89e6\u53d1</span>\n <Carousel height="200px">\n {\n [1, 2, 3, 4].map((item, index) => {\n return (\n <Carousel.Item key={index}>\n <h3>{item}</h3>\n </Carousel.Item>\n )\n })\n }\n </Carousel>\n <span className="demonstration">Click \u6307\u793a\u5668\u89e6\u53d1</span>\n <Carousel trigger="click" height="200px">\n {\n [1, 2, 3, 4].map((item, index) => {\n return (\n <Carousel.Item key={index}>\n <h3>{item}</h3>\n </Carousel.Item>\n )\n })\n }\n </Carousel>\n </div>\n )\n }\n ','\n import Carousel from "../../ishow/Carousel/Index";\n\n render(){\n return(\n <div>\n <Carousel interval="5000" arrow="always" height="200px">\n {\n [1, 2, 3, 4].map((item, index) => {\n return (\n <Carousel.Item key={index}>\n <h3>{item}</h3>\n </Carousel.Item>\n )\n })\n }\n </Carousel>\n </div>\n )\n }\n ','\n import Carousel from "../../ishow/Carousel/Index";\n\n render(){\n return(\n <div>\n <Carousel interval="4000" type="card" height="200px">\n {\n [1, 2, 3, 4, 5, 6].map((item, index) => {\n return (\n <Carousel.Item key={index}>\n <h3>{item}</h3>\n </Carousel.Item>\n )\n })\n }\n </Carousel>\n </div>\n )\n }\n ','\n import Carousel from "../../ishow/Carousel/Index";\n\n render(){\n return(\n <div>\n <Carousel interval="4000" type="flatcard" height="200px">\n {\n [1, 2, 3, 4, 5, 6].map((item, index) => {\n return (\n <Carousel.Item key={index}>\n <h3>{item}</h3>\n </Carousel.Item>\n )\n })\n }\n </Carousel>\n </div>\n )\n }\n ']},Collapse:{Code:['\n import Collapse from \'../../ishow/Collapse/index\';\n\n render() {\n const activeName = "1";\n return (\n <Collapse value={activeName}>\n <Collapse.Item title="\u4e00\u81f4\u6027 Consistency" name="1">\n <div>\u4e0e\u73b0\u5b9e\u751f\u6d3b\u4e00\u81f4\uff1a\u4e0e\u73b0\u5b9e\u751f\u6d3b\u7684\u6d41\u7a0b\u3001\u903b\u8f91\u4fdd\u6301\u4e00\u81f4\uff0c\u9075\u5faa\u7528\u6237\u4e60\u60ef\u7684\u8bed\u8a00\u548c\u6982\u5ff5\uff1b</div>\n <div>\u5728\u754c\u9762\u4e2d\u4e00\u81f4\uff1a\u6240\u6709\u7684\u5143\u7d20\u548c\u7ed3\u6784\u9700\u4fdd\u6301\u4e00\u81f4\uff0c\u6bd4\u5982\uff1a\u8bbe\u8ba1\u6837\u5f0f\u3001\u56fe\u6807\u548c\u6587\u672c\u3001\u5143\u7d20\u7684\u4f4d\u7f6e\u7b49\u3002</div>\n </Collapse.Item>\n <Collapse.Item title="\u53cd\u9988 Feedback" name="2">\n <div>\u63a7\u5236\u53cd\u9988\uff1a\u901a\u8fc7\u754c\u9762\u6837\u5f0f\u548c\u4ea4\u4e92\u52a8\u6548\u8ba9\u7528\u6237\u53ef\u4ee5\u6e05\u6670\u7684\u611f\u77e5\u81ea\u5df1\u7684\u64cd\u4f5c\uff1b</div>\n <div>\u9875\u9762\u53cd\u9988\uff1a\u64cd\u4f5c\u540e\uff0c\u901a\u8fc7\u9875\u9762\u5143\u7d20\u7684\u53d8\u5316\u6e05\u6670\u5730\u5c55\u73b0\u5f53\u524d\u72b6\u6001\u3002</div>\n </Collapse.Item>\n <Collapse.Item title="\u6548\u7387 Efficiency" name="3">\n <div>\u7b80\u5316\u6d41\u7a0b\uff1a\u8bbe\u8ba1\u7b80\u6d01\u76f4\u89c2\u7684\u64cd\u4f5c\u6d41\u7a0b\uff1b</div>\n <div>\u6e05\u6670\u660e\u786e\uff1a\u8bed\u8a00\u8868\u8fbe\u6e05\u6670\u4e14\u8868\u610f\u660e\u786e\uff0c\u8ba9\u7528\u6237\u5feb\u901f\u7406\u89e3\u8fdb\u800c\u4f5c\u51fa\u51b3\u7b56\uff1b</div>\n <div>\u5e2e\u52a9\u7528\u6237\u8bc6\u522b\uff1a\u754c\u9762\u7b80\u5355\u76f4\u767d\uff0c\u8ba9\u7528\u6237\u5feb\u901f\u8bc6\u522b\u800c\u975e\u56de\u5fc6\uff0c\u51cf\u5c11\u7528\u6237\u8bb0\u5fc6\u8d1f\u62c5\u3002</div>\n </Collapse.Item>\n <Collapse.Item title="\u53ef\u63a7 Controllability" name="4">\n <div>\u7528\u6237\u51b3\u7b56\uff1a\u6839\u636e\u573a\u666f\u53ef\u7ed9\u4e88\u7528\u6237\u64cd\u4f5c\u5efa\u8bae\u6216\u5b89\u5168\u63d0\u793a\uff0c\u4f46\u4e0d\u80fd\u4ee3\u66ff\u7528\u6237\u8fdb\u884c\u51b3\u7b56\uff1b</div>\n <div>\u7ed3\u679c\u53ef\u63a7\uff1a\u7528\u6237\u53ef\u4ee5\u81ea\u7531\u7684\u8fdb\u884c\u64cd\u4f5c\uff0c\u5305\u62ec\u64a4\u9500\u3001\u56de\u9000\u548c\u7ec8\u6b62\u5f53\u524d\u64cd\u4f5c\u7b49\u3002</div>\n </Collapse.Item>\n </Collapse>\n )\n }\n ','\n import Collapse from \'../../ishow/Collapse/index\';\n import Button from \'../../ishow/Button/Button\';\n\n constructor(props) {\n super(props)\n \n this.state = {\n activeName: \'1\'\n }\n }\n \n render() {\n return (\n <div>\n <Button\n type="primary"\n style={{marginBottom: \'15px\'}}\n onClick={() => this.setState({ activeName: \'3\' })}\n >\n \u6253\u5f00\u7b2c\u4e09\u4e2a\n </Button>\n <Collapse value={this.state.activeName} accordion>\n <Collapse.Item title="\u4e00\u81f4\u6027 Consistency" name="1">\n <div>\u4e0e\u73b0\u5b9e\u751f\u6d3b\u4e00\u81f4\uff1a\u4e0e\u73b0\u5b9e\u751f\u6d3b\u7684\u6d41\u7a0b\u3001\u903b\u8f91\u4fdd\u6301\u4e00\u81f4\uff0c\u9075\u5faa\u7528\u6237\u4e60\u60ef\u7684\u8bed\u8a00\u548c\u6982\u5ff5\uff1b</div>\n <div>\u5728\u754c\u9762\u4e2d\u4e00\u81f4\uff1a\u6240\u6709\u7684\u5143\u7d20\u548c\u7ed3\u6784\u9700\u4fdd\u6301\u4e00\u81f4\uff0c\u6bd4\u5982\uff1a\u8bbe\u8ba1\u6837\u5f0f\u3001\u56fe\u6807\u548c\u6587\u672c\u3001\u5143\u7d20\u7684\u4f4d\u7f6e\u7b49\u3002</div>\n </Collapse.Item>\n <Collapse.Item title="\u53cd\u9988 Feedback" name="2">\n <div>\u63a7\u5236\u53cd\u9988\uff1a\u901a\u8fc7\u754c\u9762\u6837\u5f0f\u548c\u4ea4\u4e92\u52a8\u6548\u8ba9\u7528\u6237\u53ef\u4ee5\u6e05\u6670\u7684\u611f\u77e5\u81ea\u5df1\u7684\u64cd\u4f5c\uff1b</div>\n <div>\u9875\u9762\u53cd\u9988\uff1a\u64cd\u4f5c\u540e\uff0c\u901a\u8fc7\u9875\u9762\u5143\u7d20\u7684\u53d8\u5316\u6e05\u6670\u5730\u5c55\u73b0\u5f53\u524d\u72b6\u6001\u3002</div>\n </Collapse.Item>\n <Collapse.Item title="\u6548\u7387 Efficiency" name="3">\n <div>\u7b80\u5316\u6d41\u7a0b\uff1a\u8bbe\u8ba1\u7b80\u6d01\u76f4\u89c2\u7684\u64cd\u4f5c\u6d41\u7a0b\uff1b</div>\n <div>\u6e05\u6670\u660e\u786e\uff1a\u8bed\u8a00\u8868\u8fbe\u6e05\u6670\u4e14\u8868\u610f\u660e\u786e\uff0c\u8ba9\u7528\u6237\u5feb\u901f\u7406\u89e3\u8fdb\u800c\u4f5c\u51fa\u51b3\u7b56\uff1b</div>\n <div>\u5e2e\u52a9\u7528\u6237\u8bc6\u522b\uff1a\u754c\u9762\u7b80\u5355\u76f4\u767d\uff0c\u8ba9\u7528\u6237\u5feb\u901f\u8bc6\u522b\u800c\u975e\u56de\u5fc6\uff0c\u51cf\u5c11\u7528\u6237\u8bb0\u5fc6\u8d1f\u62c5\u3002</div>\n </Collapse.Item>\n <Collapse.Item title="\u53ef\u63a7 Controllability" name="4">\n <div>\u7528\u6237\u51b3\u7b56\uff1a\u6839\u636e\u573a\u666f\u53ef\u7ed9\u4e88\u7528\u6237\u64cd\u4f5c\u5efa\u8bae\u6216\u5b89\u5168\u63d0\u793a\uff0c\u4f46\u4e0d\u80fd\u4ee3\u66ff\u7528\u6237\u8fdb\u884c\u51b3\u7b56\uff1b</div>\n <div>\u7ed3\u679c\u53ef\u63a7\uff1a\u7528\u6237\u53ef\u4ee5\u81ea\u7531\u7684\u8fdb\u884c\u64cd\u4f5c\uff0c\u5305\u62ec\u64a4\u9500\u3001\u56de\u9000\u548c\u7ec8\u6b62\u5f53\u524d\u64cd\u4f5c\u7b49\u3002</div>\n </Collapse.Item>\n </Collapse>\n </div>\n )\n }\n ','\n import Collapse from \'../../ishow/Collapse/index\';\n\n render() {\n return (\n <Collapse accordion>\n <Collapse.Item title={<span>\u4e00\u81f4\u6027 Consistency<i className="header-icon el-icon-information"></i></span>}>\n <div>\u4e0e\u73b0\u5b9e\u751f\u6d3b\u4e00\u81f4\uff1a\u4e0e\u73b0\u5b9e\u751f\u6d3b\u7684\u6d41\u7a0b\u3001\u903b\u8f91\u4fdd\u6301\u4e00\u81f4\uff0c\u9075\u5faa\u7528\u6237\u4e60\u60ef\u7684\u8bed\u8a00\u548c\u6982\u5ff5\uff1b</div>\n <div>\u5728\u754c\u9762\u4e2d\u4e00\u81f4\uff1a\u6240\u6709\u7684\u5143\u7d20\u548c\u7ed3\u6784\u9700\u4fdd\u6301\u4e00\u81f4\uff0c\u6bd4\u5982\uff1a\u8bbe\u8ba1\u6837\u5f0f\u3001\u56fe\u6807\u548c\u6587\u672c\u3001\u5143\u7d20\u7684\u4f4d\u7f6e\u7b49\u3002</div>\n </Collapse.Item>\n <Collapse.Item title="\u53cd\u9988 Feedback">\n <div>\u63a7\u5236\u53cd\u9988\uff1a\u901a\u8fc7\u754c\u9762\u6837\u5f0f\u548c\u4ea4\u4e92\u52a8\u6548\u8ba9\u7528\u6237\u53ef\u4ee5\u6e05\u6670\u7684\u611f\u77e5\u81ea\u5df1\u7684\u64cd\u4f5c\uff1b</div>\n <div>\u9875\u9762\u53cd\u9988\uff1a\u64cd\u4f5c\u540e\uff0c\u901a\u8fc7\u9875\u9762\u5143\u7d20\u7684\u53d8\u5316\u6e05\u6670\u5730\u5c55\u73b0\u5f53\u524d\u72b6\u6001\u3002</div>\n </Collapse.Item>\n <Collapse.Item title="\u6548\u7387 Efficiency">\n <div>\u7b80\u5316\u6d41\u7a0b\uff1a\u8bbe\u8ba1\u7b80\u6d01\u76f4\u89c2\u7684\u64cd\u4f5c\u6d41\u7a0b\uff1b</div>\n <div>\u6e05\u6670\u660e\u786e\uff1a\u8bed\u8a00\u8868\u8fbe\u6e05\u6670\u4e14\u8868\u610f\u660e\u786e\uff0c\u8ba9\u7528\u6237\u5feb\u901f\u7406\u89e3\u8fdb\u800c\u4f5c\u51fa\u51b3\u7b56\uff1b</div>\n <div>\u5e2e\u52a9\u7528\u6237\u8bc6\u522b\uff1a\u754c\u9762\u7b80\u5355\u76f4\u767d\uff0c\u8ba9\u7528\u6237\u5feb\u901f\u8bc6\u522b\u800c\u975e\u56de\u5fc6\uff0c\u51cf\u5c11\u7528\u6237\u8bb0\u5fc6\u8d1f\u62c5\u3002</div>\n </Collapse.Item>\n <Collapse.Item title="\u53ef\u63a7 Controllability">\n <div>\u7528\u6237\u51b3\u7b56\uff1a\u6839\u636e\u573a\u666f\u53ef\u7ed9\u4e88\u7528\u6237\u64cd\u4f5c\u5efa\u8bae\u6216\u5b89\u5168\u63d0\u793a\uff0c\u4f46\u4e0d\u80fd\u4ee3\u66ff\u7528\u6237\u8fdb\u884c\u51b3\u7b56\uff1b</div>\n <div>\u7ed3\u679c\u53ef\u63a7\uff1a\u7528\u6237\u53ef\u4ee5\u81ea\u7531\u7684\u8fdb\u884c\u64cd\u4f5c\uff0c\u5305\u62ec\u64a4\u9500\u3001\u56de\u9000\u548c\u7ec8\u6b62\u5f53\u524d\u64cd\u4f5c\u7b49\u3002</div>\n </Collapse.Item>\n </Collapse>\n )\n } \n ']},Rate:{Code:['\n import Rate from "../../ishow/Rate/Rate";\n\n render(){\n return(\n <div className="block">\n <span className="demonstration">\u9ed8\u8ba4\u4e0d\u533a\u5206\u989c\u8272</span>\n <span className="wrapper">\n <Rate onChange = {(val) => alert(val)}/>\n </span>\n </div>\n <div className ="block">\n <span className="demonstration">\u533a\u5206\u989c\u8272</span>\n <span className="wrapper">\n <Rate colors = {[\'#99A9BF\', \'#F7BA2A\', \'#FF9900\']}/> \n </span>\n </div> \n )\n }\n ','\n import Rate from "../../ishow/Rate/Rate";\n render(){\n return(\n <div className = "halfBlock">\n <div>\n <Rate allowHalf={true} onChange={(val) => console.log(val)} />\n </div>\n </div>\n )\n }\n ','import Rate from "../../ishow/Rate/Rate";\n render(){\n return(\n <div className = "readOnly">\n <div>\n <Rate disabled={true} value={3.9} showText={true} />\n </div>\n </div>\n )\n }\n ','\n import Rate from "../../ishow/Rate/Rate";\n render(){\n return(\n <div className = "readOnly">\n <div>\n <Rate disabled={true} value={3.9} showText={true} />\n </div>\n </div>\n )\n }\n ']},Card:{Code:['\n import Card from "../../ishow/Card/Card";\n import {Button} from "../../ishow";\n\n handleClickOnButton1(){\n Message({\n message: \'\u606d\u559c\u4f60\uff0c\u4f60\u6210\u529f\u5b9a\u5236\u4e86\u4e00\u5f20\u7b80\u5355\u5361\u7247\',\n type: \'success\',\n showClose: true\n });\n }\n \n render() {\n return (\n <Card className="simple-card" style={{ "lineHeight": "36px", width: 400, marginBottom: 40}}\n header={\n <div className="clearfix">\n <span style={{ "lineHeight": "36px" }}>\u5361\u7247\u540d\u79f0</span>\n <span style={{ "float": "right" }}>\n <Button type="primary" onClick={this.handleClickOnButton1.bind(this)}>\u64cd\u4f5c\u6309\u94ae</Button>\n </span>\n </div>\n }\n >\n <div className="text item">\u5217\u8868\u5185\u5bb9 1</div>\n <div className="text item">\u5217\u8868\u5185\u5bb9 2</div>\n <div className="text item">\u5217\u8868\u5185\u5bb9 3</div>\n <div className="text item">\u5217\u8868\u5185\u5bb9 4</div>\n </Card>\n )\n }\n ','\n import Card from \'../../ishow/Card/Card";\n\n render() {\n return (\n <Card className="simple-card" style={{ "lineHeight": "36px", width: 400, marginBottom: 40 }}>\n <div className="text item">\u5217\u8868\u5185\u5bb9 0</div>\n <div className="text item">\u5217\u8868\u5185\u5bb9 1</div>\n <div className="text item">\u5217\u8868\u5185\u5bb9 2</div>\n <div className="text item">\u5217\u8868\u5185\u5bb9 3</div>\n </Card>\n )\n }\n ','\n import Card from "../../ishow/Card/Card";\n import {Button} from "../../ishow";\n import Row from \'../../ishow/LayoutComponent/row/index\';\n import Col from \'../../ishow/LayoutComponent/col/index\';\n\n handleClickOnButton2(){\n Message({\n message: \'\u606d\u559c\u4f60\uff0c\u4f60\u6210\u529f\u5b9a\u5236\u4e86\u4e00\u5f20\u5e26\u56fe\u7247\u7684\u5361\u7247\',\n type: \'success\',\n showClose: true\n });\n }\n \n render() {\n return (\n <Row>\n <Col span={5} offset={0}>\n <Card bodyStyle={{ padding: 0 }} style={{ "lineHeight": "36px", width: 270, \'text-align\': \'center\', marginBottom: 40 }}>\n <img src=\'../src/components/ui/image/image.jpg\' alt=\'iShow UI\' className="image" />\n <div style={{ padding: 14 }}>\n <span style={{ float: \'left\' }}>iShow UI</span>\n <br />\n <div className="bottom clearfix">\n <time className="time" style={{ float: \'left\' }}>2018-04-08 09:21</time>\n <Button type="text" className="button" style={{ "float": "right" }} onClick={this.handleClickOnButton2.bind(this)}>\u64cd\u4f5c\u6309\u94ae</Button>\n </div>\n </div>\n </Card>\n </Col>\n <Col span={5}>\n <Card bodyStyle={{ padding: 0 }} style={{ "lineHeight": "36px", width: 270, \'text-align\': \'center\' }}>\n <img src=\'../src/components/ui/image/image.jpg\' alt=\'iShow UI\' className="image" />\n <div style={{ padding: 14 }}>\n <span style={{ float: \'left\' }}>iShow UI</span>\n <br />\n <div className="bottom clearfix" >\n <time className="time" style={{ float: \'left\' }}>2018-04-08 09:21</time>\n <Button type="text" className="button" style={{ float: \'right\' }} onClick={this.handleClickOnButton2.bind(this)}>\u64cd\u4f5c\u6309\u94ae</Button>\n </div>\n </div>\n </Card>\n </Col>\n </Row> \n )\n }\n ']},Slider:{Code:['\n import Slider from "../../ishow/Slider/index";\n \n constructor(props) {\n super(props);\n \n this.state = {\n value1: 0,\n value2: 50,\n value3: 36,\n value4: 48,\n value5: 42\n }\n }\n \n formatTooltip(val) {\n return val / 100;\n }\n \n render() {\n return (\n <div>\n <div className="block">\n <span className="demonstration">\u9ed8\u8ba4</span>\n <Slider value={this.state.value1} />\n </div>\n <div className="block">\n <span className="demonstration">\u81ea\u5b9a\u4e49\u521d\u59cb\u503c</span>\n <Slider value={this.state.value2} />\n </div>\n <div className="block">\n <span className="demonstration">\u9690\u85cf Tooltip</span>\n <Slider value={this.state.value3} showTooltip={false} />\n </div>\n <div className="block">\n <span className="demonstration">\u683c\u5f0f\u5316 Tooltip</span>\n <Slider value={this.state.value4} formatTooltip={this.formatTooltip.bind(this)} />\n </div>\n <div className="block">\n <span className="demonstration">\u7981\u7528</span>\n <Slider value={this.state.value3} disabled={true} />\n </div>\n </div>\n )\n }\n ','\n import Slider from "../../ishow/Slider/index";\n\n constructor(props) {\n super(props);\n \n this.state = {\n value4: 0,\n value5: 0\n }\n }\n \n render() {\n return (\n <div>\n <div className="block">\n <span className="demonstration">\u4e0d\u663e\u793a\u95f4\u65ad\u70b9</span>\n <Slider value={this.state.value4} step="10" />\n </div>\n <div className="block">\n <span className="demonstration">\u663e\u793a\u95f4\u65ad\u70b9</span>\n <Slider value={this.state.value5} step="10" showStops={true} />\n </div>\n </div>\n )\n } \n ','\n import Slider from "../../ishow/Slider/index";\n\n constructor(props) {\n super(props);\n \n this.state = {\n value: 0\n }\n }\n \n render() {\n return (\n <div className="block">\n <Slider value={this.state.value} showInput={true} />\n </div>\n )\n }\n ','\n import Slider from "../../ishow/Slider/index";\n\n constructor(props) {\n super(props);\n \n this.state = {\n value: [4, 8]\n }\n }\n \n render() {\n return (\n <div className="block">\n <Slider value={this.state.value} max={10} range={true} showStops={true} />\n </div>\n )\n }\n ','\n import Slider from "../../ishow/Slider/index";\n\n constructor(props) {\n super(props);\n \n this.state = {\n value: 0\n }\n }\n \n render() {\n return (\n <div className="block">\n <Slider value={this.state.value} vertical={true} height="200px" />\n </div>\n )\n }\n ']},Layout:{Code:["\n import Layout from '../../ishow/LayoutComponent/layout/index';\n const { Header, Content, Footer} = Layout;\n\n render() {\n return ( \n <Layout style={{marginBottom:50}}>\n <Header style={{ background: '#20A0FF', padding: 0 ,textAlign:'center',color:'#fff'}}>Header</Header>\n <Content style={{ background: '#58B7FF', padding:50 ,textAlign:'center',color:'#fff'}}>Content</Content>\n <Footer style={{ background: '#20A0FF',textAlign:'center',color:'#fff'}}>Footer</Footer>\n </Layout>\n )\n }","\n import Layout from '../../ishow/LayoutComponent/layout/index';\n const { Header, Content, Footer, Sider} = Layout;\n\n render() {\n return ( \n <Layout style={{marginBottom:50}}>\n <Header style={{ background: '#20A0FF', padding: 0 ,textAlign:'center',color:'#fff'}}>Header</Header>\n <Layout>\n <Sider style={{ background: '#1D8CE0', padding:50 ,textAlign:'center',color:'#fff'}}>Sider</Sider>\n <Content style={{ background: '#58B7FF', padding:50 ,textAlign:'center',color:'#fff'}}>Content</Content>\n </Layout>\n <Footer style={{ background: '#20A0FF',textAlign:'center',color:'#fff'}}>Footer</Footer>\n </Layout>\n )\n }","\n import Layout from '../../ishow/LayoutComponent/layout/index';\n const { Header, Content, Footer, Sider} = Layout;\n\n render() {\n return ( \n <Layout style={{marginBottom:50}}>\n <Sider style={{ background: '#1D8CE0', padding:50 ,textAlign:'center',color:'#fff'}}>Sider</Sider>\n <Layout>\n <Header style={{ background: '#20A0FF', padding: 0 ,textAlign:'center',color:'#fff'}}>Header</Header>\n <Content style={{ background: '#58B7FF', padding:50 ,textAlign:'center',color:'#fff'}}>Content</Content>\n <Footer style={{ background: '#20A0FF',textAlign:'center',color:'#fff'}}>Footer</Footer>\n </Layout>\n </Layout>\n )\n }"]},Grid:{Code:["\n import Row from '../../ishow/LayoutComponent/row/index';\n import Col from '../../ishow/LayoutComponent/col/index';\n\n render(){\n return(\n <div>\n <Row>\n <Col span={12}>col-12</Col>\n <Col span={12}>col-12</Col>\n </Row>\n <Row>\n <Col span={8}>col-8</Col>\n <Col span={8}>col-8</Col>\n <Col span={8}>col-8</Col>\n </Row>\n <Row>\n <Col span={6}>col-6</Col>\n <Col span={6}>col-6</Col>\n <Col span={6}>col-6</Col>\n <Col span={6}>col-6</Col>\n </Row>\n </div>,\n )\n }"]},Button:{Code:['\n import {Button} from "../../ishow";\n\n render() {\n return (\n <div>\n <Button>\u666e\u901a\u6309\u94ae</Button>\n <Button type="primary">\u4e3b\u8981\u6309\u94ae</Button>\n <Button type="text">\u6587\u5b57\u6309\u94ae</Button>\n </div>\n )\n }','\n import {Button} from "../../ishow";\n\n render() {\n return (\n <div>\n <Button plain={true} disabled={true}>\u666e\u901a\u6309\u94ae</Button>\n <Button type="primary" disabled={true}>\u4e3b\u8981\u6309\u94ae</Button>\n <Button type="text" disabled={true}>\u6587\u5b57\u6309\u94ae</Button>\n </div>\n )\n }','\n import {Button} from "../../ishow";\n\n render() {\n return <Button type="primary" loading={true}>\u52a0\u8f7d\u4e2d</Button>\n }','\n import {Button} from "../../ishow";\n\n render() {\n return (\n <div >\n <Button type="success">\u6210\u529f\u6309\u94ae</Button>\n <Button type="warning">\u8b66\u544a\u6309\u94ae</Button>\n <Button type="danger">\u5371\u9669\u6309\u94ae</Button>\n <Button type="info">\u4fe1\u606f\u6309\u94ae</Button>\n <Button plain={true} type="success">\u6210\u529f\u6309\u94ae</Button>\n <Button plain={true} type="warning">\u8b66\u544a\u6309\u94ae</Button>\n <Button plain={true} type="danger">\u5371\u9669\u6309\u94ae</Button>\n <Button plain={true} type="info">\u4fe1\u606f\u6309\u94ae</Button>\n </div>\n )\n }','\n import {Button} from "../../ishow";\n\n render() {\n return (\n <div>\n <Button type="primary" icon="edit"></Button>\n <Button type="primary" icon="share"></Button>\n <Button type="primary" icon="delete"></Button>\n <Button type="primary" icon="search">\u641c\u7d22</Button>\n <Button type="primary">\u4e0a\u4f20<i className="ishow-icon-upload ishow-icon-right"></i></Button>\n </div>\n )\n }\n ','\n import {Button} from "../../ishow";\n\n render() {\n return (\n <div>\n <Button.Group>\n <Button type="primary" icon="arrow-left">\u4e0a\u4e00\u9875</Button>\n <Button type="primary">\u4e0b\u4e00\u9875<i className="ishow-icon-arrow-right ishow-icon-right"></i></Button>\n </Button.Group>\n <Button.Group>\n <Button type="primary" icon="edit"></Button>\n <Button type="primary" icon="share"></Button>\n <Button type="primary" icon="delete"></Button>\n </Button.Group>\n </div>\n )\n }\n ','\n import {Button} from "../../ishow";\n\n render() {\n return (\n <div>\n <Button type="primary" size="large">\u5927\u578b\u6309\u94ae</Button>\n <Button type="primary">\u6b63\u5e38\u6309\u94ae</Button>\n <Button type="primary" size="small">\u5c0f\u578b\u6309\u94ae</Button>\n <Button type="primary" size="mini">\u8d85\u5c0f\u6309\u94ae</Button>\n </div>\n )\n }\n ']},Icon:{Code:['\n import Button from \'../../ishow/Button/Button\';\n\n render() {\n return (\n <div>\n <i className="ishow-icon-edit"></i>\n <i className="ishow-icon-share"></i>\n <i className="ishow-icon-delete"></i>\n <Button type="primary" icon="search">\u641c\u7d22</Button>\n </div>\n )\n }\n ']},Radio:{Code:['\n import Radio from \'../../ishow/Radio/index\';\n\n constructor(props) {\n super(props);\n \n this.state = {\n value: 1\n }\n }\n \n onChange(value) {\n this.setState({ value });\n }\n \n render() {\n return (\n <div>\n <Radio value="1" checked={this.state.value === 1} onChange={this.onChange.bind(this)}>ELF-zhangyong</Radio>\n <Radio value="2" checked={this.state.value === 2} onChange={this.onChange.bind(this)}>ELF-chenyuting</Radio>\n </div>\n )\n }\n ','\n import Radio from \'../../ishow/Radio/index\';\n\n render() {\n return (\n <div>\n <Radio value="1" disabled={true}>ELF-zhangyong</Radio>\n <Radio value="2" disabled={true}>ELF-chenyuting</Radio>\n </div>\n )\n }\n ','\n import Radio from \'../../ishow/Radio/index\';\n\n constructor(props) {\n super(props);\n \n this.state = {\n value: 3\n }\n }\n \n onChange(value) {\n this.setState({ value });\n }\n \n render() {\n return (\n <Radio.Group value={this.state.value} onChange={this.onChange.bind(this)}>\n <Radio value="zy">Yuri</Radio>\n <Radio value="tyy">\u5510\u5a9b\u5a9b</Radio>\n <Radio value="cyt">\u9648\u745c\u5a77</Radio>\n <Radio value="zph">\u8d75\u6590\u660a</Radio>\n <Radio value="sy">\u76db\u745c</Radio>\n <Radio value="hj">\u9ec4\u6770</Radio>\n <Radio value="lx">\u5218\u5174</Radio>\n <Radio value="lzq">\u5218\u6cfd\u743c</Radio>\n </Radio.Group>\n )\n }\n ']},Checkbox:{Code:["\n import Checkbox from '../../ishow/Checkbox/index';\n\n render() {\n return <Checkbox checked>\u5907\u9009\u9879</Checkbox>\n }\n ",'\n import CheckBox from \'../../ishow/Checkbox/index\';\n\n constructor(props) {\n super(props);\n \n this.state = {\n checkList: [\'\u590d\u9009\u6846 A\', \'\u9009\u4e2d\u4e14\u7981\u7528\']\n }\n }\n render() {\n return (\n <Checkbox.Group value={this.state.checkList}>\n <Checkbox label="\u590d\u9009\u6846 A"></Checkbox>\n <Checkbox label="\u590d\u9009\u6846 B"></Checkbox>\n <Checkbox label="\u590d\u9009\u6846 C"></Checkbox>\n <Checkbox label="\u7981\u7528" disabled></Checkbox>\n <Checkbox label="\u9009\u4e2d\u4e14\u7981\u7528" disabled></Checkbox>\n </Checkbox.Group>\n )\n }\n ',"\n import CheckBox from '../../ishow/Checkbox/index';\n\n constructor(props) {\n super(props);\n \n this.state = {\n checkAll: false,\n cities: ['\u6c5f\u82cf', '\u5317\u4eac', '\u5e7f\u5dde', '\u6df1\u5733'],\n checkedCities: ['\u6c5f\u82cf', '\u5317\u4eac'],\n isIndeterminate: true,\n }\n }\n \n handleCheckAllChange(checked) {\n const checkedCities = checked ? ['\u6c5f\u82cf', '\u5317\u4eac', '\u5e7f\u5dde', '\u6df1\u5733'] : [];\n \n this.setState({\n isIndeterminate: false,\n checkAll: checked,\n checkedCities: checkedCities,\n });\n }\n \n handleCheckedCitiesChange(value) {\n const checkedCount = value.length;\n const citiesLength = this.state.cities.length;\n \n this.setState({\n checkedCities: value,\n checkAll: checkedCount === citiesLength,\n isIndeterminate: checkedCount > 0 && checkedCount < citiesLength,\n });\n }\n \n render() {\n return (\n <div>\n <Checkbox\n checked={this.state.checkAll}\n indeterminate={this.state.isIndeterminate}\n onChange={this.handleCheckAllChange.bind(this)}>\u5168\u9009</Checkbox>\n <div style={{margin: '15px 0'}}></div>\n <Checkbox.Group\n value={this.state.checkedCities}\n onChange={this.handleCheckedCitiesChange.bind(this)}>\n {\n this.state.cities.map((city, index) =>\n <Checkbox key={index} label={city}></Checkbox>\n )\n }\n </Checkbox.Group>\n </div>\n )\n }\n ","\n import CheckBox from '../../ishow/Checkbox/index';\n\n constructor(props) {\n super(props);\n \n this.state = {\n checkAll: false,\n cities: ['\u6c5f\u82cf', '\u5317\u4eac', '\u5e7f\u5dde', '\u6df1\u5733'],\n checkedCities: ['\u6c5f\u82cf', '\u5317\u4eac'],\n isIndeterminate: true,\n }\n }\n \n handleCheckAllChange(checked) {\n const checkedCities = checked ? ['\u6c5f\u82cf', '\u5317\u4eac', '\u5e7f\u5dde', '\u6df1\u5733'] : [];\n \n this.setState({\n isIndeterminate: false,\n checkAll: checked,\n checkedCities: checkedCities,\n });\n }\n \n handleCheckedCitiesChange(value) {\n const checkedCount = value.length;\n const citiesLength = this.state.cities.length;\n \n this.setState({\n checkedCities: value,\n checkAll: checkedCount === citiesLength,\n isIndeterminate: checkedCount > 0 && checkedCount < citiesLength,\n });\n }\n \n render() {\n return (\n <div>\n <Checkbox\n checked={this.state.checkAll}\n indeterminate={this.state.isIndeterminate}\n onChange={this.handleCheckAllChange.bind(this)}>\u5168\u9009</Checkbox>\n <div style={{margin: '15px 0'}}></div>\n <Checkbox.Group\n min=\"1\"\n max=\"2\"\n value={this.state.checkedCities}\n onChange={this.handleCheckedCitiesChange.bind(this)}>\n {\n this.state.cities.map((city, index) =>\n <Checkbox key={index} label={city}></Checkbox>\n )\n }\n </Checkbox.Group>\n </div>\n )\n }\n "]},Input:{Code:["\n import Input from '../../ishow/Input/Input';\n\n render() {\n return <Input placeholder=\"\u8bf7\u8f93\u5165\u5185\u5bb9\" />\n }\n ","\n import Input from '../../ishow/Input/Input';\n\n render() {\n return <Input disabled placeholder=\"\u8bf7\u8f93\u5165\u5185\u5bb9\" />\n }\n ",'\n import Input from \'../../ishow/Input/Input\';\n\n handleIconClick(ev) {\n\n }\n \n render() {\n return (\n <Input\n icon="time"\n placeholder="\u8bf7\u9009\u62e9\u65e5\u671f"\n onIconClick={this.handleIconClick.bind(this)}\n />\n )\n }\n ','\n import Input from \'../../ishow/Input/Input\';\n\n render() {\n return (\n <div>\n <Input\n type="textarea"\n autosize={true}\n placeholder="\u8bf7\u8f93\u5165\u5185\u5bb9"\n />\n <div style={{ margin: \'20px 0\' }}></div>\n <Input\n type="textarea"\n autosize={{ minRows: 2, maxRows: 4}}\n placeholder="\u8bf7\u8f93\u5165\u5185\u5bb9"\n />\n </div>\n )\n }\n ','\n import Input from \'../../ishow/Input/Input\';\n import Select from \'../../ishow/Select/index\';\n\n render() {\n return (\n <div>\n <Input placeholder="\u8bf7\u8f93\u5165\u5185\u5bb9" prepend="Http://" />\n <Input placeholder="\u8bf7\u8f93\u5165\u5185\u5bb9" append=".com" />\n <Input placeholder="\u8bf7\u8f93\u5165\u5185\u5bb9" prepend={\n <Select value="">\n {\n [\'\u9910\u5385\u540d\', \'\u8ba2\u5355\u53f7\', \'\u7528\u6237\u7535\u8bdd\'].map((item, index) => <Select.Option key={index} label={item} value={index} />)\n }\n </Select>\n } append={<Button type="primary" icon="search">\u641c\u7d22</Button>} />\n </div>\n )\n }\n ','\n import React, { Component } from \'react\';\n import \'./App.css\';\n import AutoComplete from \'../../ishow/auto-complete\';\n\n\n const customItem = (props) => {\n let item = props.item;\n return (\n <div><div className="ishow-customItem-key">{item.value}</div><span className="ishow-customItem-detail">{item.address}</span></div>\n )\n }\n class App extends Component {\n\n constructor(props) {\n super(props);\n this.state = {\n scenery: [\n { "value": "\u7384\u6b66\u6e56\u516c\u56ed", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u7384\u6b66\u533a/\u7384\u6b66\u5df71\u53f7" },\n { "value": "\u4e2d\u5c71\u9675", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u7384\u6b66\u533a/\u77f3\u8c61\u8def7\u53f7" },\n { "value": "\u4e2d\u592e\u516c\u56ed", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u516d\u5408\u533a/\u53e4\u68e0\u5927\u9053" },\n { "value": "\u5357\u4eac\u5927\u5c60\u6740\u7eaa\u5ff5\u9986", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u5efa\u90ba\u533a/\u6c34\u897f\u95e8\u5927\u8857418\u53f7" },\n { "value": "\u8001\u95e8\u4e1c", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u79e6\u6dee\u533a/\u526a\u5b50\u5df754\u53f7" },\n { "value": "\u7d2b\u5cf0\u5927\u53a6", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u9f13\u697c\u533a/\u4e2d\u5c71\u5317\u8def1\u53f7" },\n { "value": "\u9e21\u9e23\u5bfa", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u7384\u6b66\u533a/\u9e21\u9e23\u5bfa\u8def1\u53f7" }\n ],\n value1: \'\',\n }\n }\n querySearch(queryString, cb) {\n const { scenery } = this.state;\n const results = queryString ? scenery.filter(this.createFilter(queryString)) : scenery;\n // \u8c03\u7528 callback \u8fd4\u56de\u5efa\u8bae\u5217\u8868\u7684\u6570\u636e\n cb(results);\n }\n\n createFilter(queryString) {\n return (scenery) => {\n return (scenery.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);\n };\n }\n\n handleSelect(item) {\n\n }\n\n render() {\n return (\n <div >\n <h3 className="text">\u5e26\u8f93\u5165\u5efa\u8bae</h3>\n <AutoComplete\n className="my-autocomplete my-autocomplete-poi"\n placeholder="\u8bf7\u8f93\u5165\u5185\u5bb9"\n value={this.state.value1}\n fetchSuggestions={this.querySearch.bind(this)}\n customItem={customItem}\n onSelect={this.handleSelect.bind(this)}\n style={{width:"100%"}}\n ></AutoComplete>\n </div>\n )\n }\n ','\n import Input from \'../../ishow/Input/Input\';\n \n render() {\n return (\n <div className="inline-input">\n <Input placeholder="\u8bf7\u8f93\u5165\u5185\u5bb9" size="large" />\n <Input placeholder="\u8bf7\u8f93\u5165\u5185\u5bb9" />\n <Input placeholder="\u8bf7\u8f93\u5165\u5185\u5bb9" size="small" />\n <Input placeholder="\u8bf7\u8f93\u5165\u5185\u5bb9" size="mini" />\n </div>\n )\n }\n ']},Select:{Code:["\n import Select from '../../ishow/Select/index';\n\n constructor(props) {\n super(props);\n \n this.state = {\n options: [{\n value: '\u9009\u98791',\n label: 'ELF-Yuri'\n }, {\n value: '\u9009\u98792',\n label: 'ELF-\u9648\u745c\u5a77'\n }, {\n value: '\u9009\u98793',\n label: 'ELF-\u76db\u745c'\n }, {\n value: '\u9009\u98794',\n label: 'ELF-\u5218\u5174'\n }, {\n value: '\u9009\u98795',\n label: 'ELF-\u9ec4\u6770'\n },\n {\n value: '\u9009\u98796',\n label: 'ELF-\u5218\u6cfd\u743c'\n },\n {\n value: '\u9009\u98797',\n label: 'ELF-\u8d75\u6590\u660a'\n }],\n value: ''\n };\n }\n \n render() {\n return (\n <Select value={this.state.value}>\n {\n this.state.options.map(el => {\n return <Select.Option key={el.value} label={el.label} value={el.value} />\n })\n }\n </Select>\n )\n }\n "]},Switch:{Code:['\n import Switch from \'../../ishow/Switch/Switch\';\n\n render() {\n return (\n <div>\n <Switch\n value={true}\n onText=""\n offText="">\n </Switch>\n <Switch\n value={true}\n onColor="#13ce66"\n offColor="#ff4949">\n </Switch>\n </div>\n )\n }\n ','\n import Switch from \'../../ishow/Switch/Switch\';\n import Tooltip from \'../../ishow/Tooltip/Tooltip\';\n\n constructor(props) {\n super(props);\n \n this.state = {\n value: 100,\n }\n }\n \n render() {\n return (\n <Tooltip\n placement="top"\n content={\n <div>Switch value: {this.state.value}</div>\n }\n >\n <Switch\n value={this.state.value}\n onColor="#13ce66"\n offColor="#ff4949"\n onValue={100}\n offValue={0}\n onChange={(value)=>{this.setState({value: value})}}\n >\n </Switch>\n </Tooltip>\n )\n }\n ']},DatePicker:{Code:["\n import DatePicker from '../../ishow/DatePicker/DatePicker';\n\n constructor(props) {\n super(props)\n this.state = {}\n }\n \n render() {\n const {value1, value2} = this.state\n \n return (\n <div>\n <div>\n <DatePicker\n value={value1}\n placeholder=\"\u9009\u62e9\u65e5\u671f\"\n onChange={date=>{\n console.debug('DatePicker1 changed: ', date)\n this.setState({value1: date})\n }}\n disabledDate={time=>time.getTime() < Date.now() - 8.64e7}\n />\n </div>\n <div>\n <span className=\"demonstration\">\u5e26\u5feb\u6377\u9009\u9879</span>\n <DatePicker\n ref={e=>this.datepicker2 = e}\n value={value2}\n align=\"right\"\n placeholder=\"\u9009\u62e9\u65e5\u671f\"\n onChange={date=>{\n console.debug('DatePicker2 changed: ', date)\n this.setState({value2: date})\n \n }}\n shortcuts={[{\n text: '\u4eca\u5929',\n onClick: (picker)=> {\n this.setState({value2: new Date()})\n this.datepicker2.togglePickerVisible()\n }\n }, {\n text: '\u6628\u5929',\n onClick: (picker)=> {\n const date = new Date();\n date.setTime(date.getTime() - 3600 * 1000 * 24);\n this.setState({value2: date})\n this.datepicker2.togglePickerVisible()\n }\n }, {\n text: '\u4e00\u5468\u524d',\n onClick: (picker)=> {\n const date = new Date();\n date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);\n this.setState({value2: date})\n this.datepicker2.togglePickerVisible()\n }\n }]}\n />\n </div>\n </div>\n )\n }\n \n ","\n import DateRangePicker from '../../ishow/DatePicker/DateRangePicker';\n\n constructor(props) {\n super(props)\n this.state = {value1: null, value2: null}\n }\n \n render() {\n const {value1, value2} = this.state\n \n return (\n <div>\n <div>\n <DateRangePicker\n value={value1}\n placeholder=\"\u9009\u62e9\u65e5\u671f\u8303\u56f4\"\n onChange={date=>{\n console.debug('DateRangePicker1 changed: ', date)\n this.setState({value1: date})\n }}\n />\n </div>\n <div>\n <DateRangePicker\n value={value2}\n placeholder=\"\u9009\u62e9\u65e5\u671f\u8303\u56f4\"\n align=\"right\"\n ref={e=>this.daterangepicker2 = e}\n onChange={date=>{\n console.debug('DateRangePicker2 changed: ', date)\n this.setState({value2: date})\n }}\n shortcuts={[{\n text: '\u6700\u8fd1\u4e00\u5468',\n onClick: ()=> {\n const end = new Date();\n const start = new Date();\n start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);\n \n this.setState({value2: [start, end]})\n this.daterangepicker2.togglePickerVisible()\n }\n }, {\n text: '\u6700\u8fd1\u4e00\u4e2a\u6708',\n onClick: ()=> {\n const end = new Date();\n const start = new Date();\n start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);\n \n this.setState({value2: [start, end]})\n this.daterangepicker2.togglePickerVisible()\n }\n }, {\n text: '\u6700\u8fd1\u4e09\u4e2a\u6708',\n onClick: ()=> {\n const end = new Date();\n const start = new Date();\n start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);\n this.setState({value2: [start, end]})\n this.daterangepicker2.togglePickerVisible()\n }\n }]}\n />\n </div>\n </div>\n )\n }\n \n "]},Upload:{Code:["\n import Upload from '../../ishow/Upload/Upload';\n import Button from '../../ishow/Button/Button';\n\n render() {\n const fileList = [\n {name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg'}\n ];\n return (\n <Upload\n className=\"upload-demo\"\n action=\"//jsonplaceholder.typicode.com/posts/\"\n onPreview={file => this.handlePreview(file)}\n onRemove={(file, fileList) => this.handleRemove(file, fileList)}\n fileList={fileList}\n tip={<div className=\"ishow-upload__tip\">\u53ea\u80fd\u4e0a\u4f20jpg/png\u6587\u4ef6\uff0c\u4e14\u4e0d\u8d85\u8fc7500kb</div>}\n >\n <Button size=\"small\" type=\"primary\">\u70b9\u51fb\u4e0a\u4f20</Button>\n </Upload>\n )\n }\n \n handlePreview(file) {\n console.log('preview');\n }\n \n handleRemove(file, fileList) {\n console.log('remove');\n }\n ",'\n import Upload from \'../../ishow/Upload/Upload\';\n import Dialog from \'../../ishow/Dialog/Dialog\';\n\n constructor(props) {\n super(props);\n \n this.state = {\n dialogImageUrl: \'\',\n dialogVisible: false,\n };\n }\n \n render() {\n const { dialogImageUrl, dialogVisible } = this.state;\n return (\n <div>\n <Upload\n action="//jsonplaceholder.typicode.com/posts/"\n listType="picture-card"\n onPreview={file => this.handlePictureCardPreview(file)}\n onRemove={(file, fileList) => this.handleRemove(file, fileList)}\n >\n <i className="ishow-icon-plus"></i>\n </Upload>\n <Dialog\n visible={dialogVisible}\n size="tiny"\n onCancel={() => this.setState({ dialogVisible: false })}\n >\n <img width="100%" src={dialogImageUrl} alt="" />\n </Dialog>\n </div>\n )\n }\n \n handleRemove(file, fileList) {\n console.log(file, fileList);\n }\n \n handlePictureCardPreview(file) {\n this.setState({\n dialogImageUrl: file.url,\n dialogVisible: true,\n })\n }\n \n ',"\n import Upload from '../../ishow/Upload/Upload';\n import Button from '../../ishow/Button/Button';\n\n render() {\n const fileList2 = [\n {name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg'}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg'}\n ]\n return (\n <Upload\n className=\"upload-demo\"\n action=\"//jsonplaceholder.typicode.com/posts/\"\n onPreview={file => this.handlePreview(file)}\n onRemove={(file, fileList) => this.handleRemove(file, fileList)}\n fileList={fileList2}\n listType=\"picture\"\n tip={<div className=\"ishow-upload__tip\">\u53ea\u80fd\u4e0a\u4f20jpg/png\u6587\u4ef6\uff0c\u4e14\u4e0d\u8d85\u8fc7500kb</div>}\n >\n <Button size=\"small\" type=\"primary\">\u70b9\u51fb\u4e0a\u4f20</Button>\n </Upload>\n )\n }\n \n handleRemove(file, fileList) {\n console.log(file, fileList);\n }\n \n handlePreview(file) {\n console.log(file);\n }\n \n "]},Table:{Code:["\n import Table from '../../ishow/Table/TableStore';\n\n constructor(props) {\n super(props);\n \n this.state = {\n columns: [\n {\n label: \"\u65e5\u671f\",\n prop: \"date\",\n width: 180, \n resizable: false\n },\n {\n label: \"\u59d3\u540d\",\n prop: \"name\",\n width: 180,\n resizable: false\n },\n {\n label: \"\u5730\u5740\",\n prop: \"address\",\n resizable: false\n }\n ],\n data: [{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }, {\n date: '2018-03-04',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }, {\n date: '2018-03-01',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }, {\n date: '2018-03-03',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n },{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }, {\n date: '2018-03-04',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }, {\n date: '2018-03-01',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }, {\n date: '2018-03-03',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }]\n }\n }\n \n render() {\n return (\n <Table\n style={{width: '100%'}}\n columns={this.state.columns}\n maxHeight={200}\n data={this.state.data}\n stripe={true}\n border={true}\n />\n )\n }\n "," \n import Table from '../../ishow/Table/TableStore';\n \n constructor(props){\n super(props);\n this.state = {\n columns2: [\n {\n label: \"\u65e5\u671f\",\n prop: \"date\",\n width: 150,\n fixed: 'left',\n resizable: false\n },\n {\n label: \"\u59d3\u540d\",\n prop: \"name\",\n width: 160,\n resizable: false\n },\n {\n label: \"\u7701\u4efd\",\n prop: \"province\",\n width: 160,\n resizable: false\n },\n {\n label: \"\u5730\u5740\",\n prop: \"address\",\n width: 400,\n resizable: false\n },\n {\n label: \"\u90ae\u7f16\",\n prop: \"zip\",\n width: 120,\n resizable: false\n },\n {\n label: \"\u64cd\u4f5c\",\n prop: \"zip\",\n fixed: 'right',\n width: 100,\n resizable: false,\n render: ()=>{\n return <span><Button type=\"text\" size=\"small\">\u67e5\u770b</Button><Button type=\"text\" size=\"small\">\u7f16\u8f91</Button></span>\n }\n }\n ],\n data2: [{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u666e\u9640\u533a',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n },{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u666e\u9640\u533a',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n },{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u666e\u9640\u533a',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n },{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u666e\u9640\u533a',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n },{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u666e\u9640\u533a',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }],\n }\n }\n render() {\n return (\n <Table\n style={{width: '60%'}}\n columns={this.state.columns2}\n data={this.state.data2}\n border={true}\n height={200}\n />\n )\n }","\n import Table from '../../ishow/Table/TableStore';\n\n constructor(props) {\n super(props);\n \n this.state = {\n columns: [\n {\n label: \"\u65e5\u671f\",\n prop: \"date\",\n width: 150,\n resizable: false\n },\n {\n label: \"\u914d\u9001\u4fe1\u606f\",\n subColumns: [\n {\n label: \"\u59d3\u540d\",\n prop: \"name\",\n width: 160,\n resizable: false\n },\n {\n label: \"\u5730\u5740\",\n resizable: false,\n subColumns: [\n {\n label: \"\u7701\u4efd\",\n prop: \"province\",\n width: 160,\n resizable: false\n },\n {\n label: \"\u57ce\u5e02\",\n prop: \"address\",\n width: 400,\n resizable: false\n },\n {\n label: \"\u90ae\u7f16\",\n prop: \"zip\",\n width: 120,\n resizable: false\n }\n ]\n }\n ]\n }\n ],\n data: [{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }]\n }\n }\n \n \n render() {\n return (\n <Table\n style={{width: '100%'}}\n columns={this.state.columns}\n data={this.state.data}\n border={true}\n />\n )\n }\n ","\n import Table from '../../ishow/Table/TableStore';\n import Button from \"../../ishow/Button/index\";\n import Icon from \"../../ishow/Icon/Icon\";\n import Tag from \"../../ishow/Tag/Tag\";\n\n constructor(props) {\n super(props);\n \n this.state = {\n columns: [\n {\n type: 'index',\n resizable: false\n },\n {\n label: \"\u65e5\u671f\",\n prop: \"date\",\n width: 150,\n resizable: false,\n render: function(data){\n return (\n <span>\n <Icon name=\"time\"/>\n <span style={{marginLeft: '10px'}}>{data.date}</span>\n </span>)\n }\n },\n {\n label: \"\u59d3\u540d\",\n prop: \"name\",\n width: 160,\n resizable: false,\n render: function(data){\n return <Tag>{data.name}</Tag>\n }\n },\n {\n label: \"\u64cd\u4f5c\",\n prop: \"address\",\n resizable: false,\n render: function(){\n return (\n <span>\n <Button plain={true} type=\"info\" size=\"small\">\u7f16\u8f91</Button>\n <Button type=\"danger\" size=\"small\">\u5220\u9664</Button>\n </span>\n )\n }\n }\n ],\n data: [{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }]\n }\n }\n \n render() {\n return (\n <Table\n style={{width: '100%'}}\n columns={this.state.columns}\n data={this.state.data}\n border={true}\n height={250}\n highlightCurrentRow={true}\n onCurrentChange={item=>{console.log(item)}}\n />\n )\n }\n ","\n import Table from '../../ishow/Table/TableStore';\n import Form from '../../ishow/Form/index';\n\n constructor(props) {\n super(props);\n \n this.state = {\n columns: [\n {\n type: 'expand',\n resizable:false,\n expandPannel: function(data){\n return (\n <Form labelPosition=\"left\" inline={true} className=\"demo-table-expand\">\n <Form.Item label=\"\u5546\u54c1\u540d\u79f0\"><span>\u53cc\u4eba\u62a5\u4ef7\u5957\u9910-\u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed\u81ea\u9a7e2\u65e5\u6e38</span></Form.Item>\n <Form.Item label=\"\u6240\u5c5e\u5e97\u94fa\"><span>iShow UI -- Yuri\u592b\u59bb\u5e97</span></Form.Item>\n <Form.Item label=\"\u5546\u54c1 ID\"><span>12987122</span></Form.Item>\n <Form.Item label=\"\u5e97\u94fa ID\"><span>10333</span></Form.Item>\n <Form.Item label=\"\u5546\u54c1\u5206\u7c7b\"><span>\u5bbf\u73a9\u5177\u603b\u52a8\u5458\u9152\u5e97</span></Form.Item>\n <Form.Item label=\"\u5e97\u94fa\u5730\u5740\"><span>\u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed</span></Form.Item>\n <Form.Item label=\"\u5546\u54c1\u63cf\u8ff0\"><span>3\u67085\u53f7\u81f37\u53f7\u9884\u5b9a\u6307\u5b9a\u56e2\u671f\u8fea\u58eb\u5c3c\u95e8\u7968\u4eab\u4e03\u4e94\u6298\u7279\u60e0\u540d\u989d\u6709\u9650</span></Form.Item>\n </Form>\n )\n }\n },\n {\n label: \"\u5546\u54c1 ID\",\n prop: \"id\",\n width: 150,\n resizable: false\n },\n {\n label: \"\u5546\u54c1\u540d\u79f0\",\n prop: \"name\",\n width: 160,\n resizable: false\n },\n {\n label: \"\u63cf\u8ff0\",\n prop: \"desc\",\n resizable: false\n }\n ],\n data: [{\n id: '12987122',\n name: '\u53cc\u4eba\u62a5\u4ef7\u5957\u9910-\u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed\u81ea\u9a7e2\u65e5\u6e38',\n category: '\u5bbf\u73a9\u5177\u603b\u52a8\u5458\u9152\u5e97',\n desc: '3\u67085\u53f7\u81f37\u53f7\u9884\u5b9a\u6307\u5b9a\u56e2\u671f\u8fea\u58eb\u5c3c\u95e8\u7968\u4eab\u4e03\u4e94\u6298\u7279\u60e0\u540d\u989d\u6709\u9650',\n address: '\u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed',\n shop: 'iShow UI -- Yuri\u592b\u59bb\u5e97',\n shopId: '10333'\n }, {\n id: '12987123',\n name: '\u53cc\u4eba\u62a5\u4ef7\u5957\u9910-\u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed\u81ea\u9a7e2\u65e5\u6e38',\n category: '\u5bbf\u73a9\u5177\u603b\u52a8\u5458\u9152\u5e97',\n desc: '3\u67085\u53f7\u81f37\u53f7\u9884\u5b9a\u6307\u5b9a\u56e2\u671f\u8fea\u58eb\u5c3c\u95e8\u7968\u4eab\u4e03\u4e94\u6298\u7279\u60e0\u540d\u989d\u6709\u9650',\n address: '\u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed',\n shop: 'iShow UI -- Yuri\u592b\u59bb\u5e97',\n shopId: '10333'\n }, {\n id: '12987125',\n name: '\u53cc\u4eba\u62a5\u4ef7\u5957\u9910-\u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed\u81ea\u9a7e2\u65e5\u6e38',\n category: '\u5bbf\u73a9\u5177\u603b\u52a8\u5458\u9152\u5e97',\n desc: '3\u67085\u53f7\u81f37\u53f7\u9884\u5b9a\u6307\u5b9a\u56e2\u671f\u8fea\u58eb\u5c3c\u95e8\u7968\u4eab\u4e03\u4e94\u6298\u7279\u60e0\u540d\u989d\u6709\u9650',\n address: '\u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed',\n shop: 'iShow UI -- Yuri\u592b\u59bb\u5e97',\n shopId: '10333'\n }, {\n id: '12987126',\n name: '\u53cc\u4eba\u62a5\u4ef7\u5957\u9910-\u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed\u81ea\u9a7e2\u65e5\u6e38',\n category: '\u5bbf\u73a9\u5177\u603b\u52a8\u5458\u9152\u5e97',\n desc: '3\u67085\u53f7\u81f37\u53f7\u9884\u5b9a\u6307\u5b9a\u56e2\u671f\u8fea\u58eb\u5c3c\u95e8\u7968\u4eab\u4e03\u4e94\u6298\u7279\u60e0\u540d\u989d\u6709\u9650',\n address: '\u4e0a\u6d77\u8fea\u58eb\u5c3c\u4e50\u56ed',\n shop: 'iShow UI -- Yuri\u592b\u59bb\u5e97',\n shopId: '10333'\n }]\n }\n }\n \n render() {\n return (\n <Table\n style={{width: '100%'}}\n columns={this.state.columns}\n data={this.state.data}\n border={false}\n onCurrentChange={item=>{console.log(item)}}\n />\n )\n }\n ","\n import Table from '../../ishow/Table/TableStore';\n\n constructor(props) {\n super(props);\n \n this.state = {\n columns: [\n {\n type: 'selection',\n resizable: false\n },\n {\n label: \"\u65e5\u671f\",\n prop: \"date\",\n width: 150,\n resizable: false\n },\n {\n label: \"\u59d3\u540d\",\n prop: \"name\",\n width: 160,\n resizable: false\n },\n {\n label: \"\u5730\u5740\",\n prop: \"address\",\n resizable: false\n }\n ],\n data: [{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n zip: 200333\n }]\n }\n }\n \n render() {\n return (\n <Table\n style={{width: '100%'}}\n columns={this.state.columns}\n data={this.state.data}\n border={true}\n height={250}\n onSelectChange={(selection) => { console.log(selection) }}\n onSelectAll={(selection) => { console.log(selection) }}\n />\n )\n }\n ","\n import Table from '../../ishow/Table/TableStore';\n\n constructor(props) {\n super(props);\n \n this.state = {\n columns: [\n {\n label: \"\u65e5\u671f\",\n prop: \"date\",\n width: 180,\n sortable: true,\n resizable: false\n },\n {\n label: \"\u59d3\u540d\",\n prop: \"name\",\n width: 180,\n sortable: true,\n resizable: false\n },\n {\n label: \"\u5730\u5740\",\n prop: \"address\",\n resizable: false\n }\n ],\n data: [{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }, {\n date: '2018-03-04',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }, {\n date: '2018-03-01',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }, {\n date: '2018-03-03',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }]\n }\n }\n \n render() {\n return (\n <Table\n style={{width: '100%'}}\n columns={this.state.columns}\n data={this.state.data}\n border={true}\n />\n )\n }\n ","\n import Table from '../../ishow/Table/TableStore';\n import Tag from \"../../ishow/Tag/Tag\";\n\n constructor(props) {\n super(props);\n \n this.state = {\n columns: [\n {\n label: \"\u65e5\u671f\",\n prop: \"date\",\n width: 180,\n resizable: false\n },\n {\n label: \"\u59d3\u540d\",\n prop: \"name\",\n width: 180,\n resizable: false\n },\n {\n label: \"\u5730\u5740\",\n prop: \"address\",\n resizable: false\n },\n {\n label: '\u6807\u7b7e',\n prop: 'tag',\n width: 100,\n resizable: false,\n filters: [{text: '\u5bb6', value: '\u5bb6'}, {text: '\u516c\u53f8', value: '\u516c\u53f8'}],\n filterMethod(value, row) {\n return row.tag === value;\n },\n render: (data, column)=>{\n if(data['tag'] == '\u5bb6'){\n return <Tag type=\"primary\">{data['tag']}</Tag>\n }else if(data['tag'] == '\u516c\u53f8'){\n return <Tag type=\"success\">{data['tag']}</Tag>\n }\n }\n }\n ],\n data: [{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n tag: '\u5bb6'\n }, {\n date: '2018-03-04',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n tag: '\u516c\u53f8'\n }, {\n date: '2018-03-01',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n tag: '\u516c\u53f8'\n }, {\n date: '2018-03-03',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n tag: '\u5bb6'\n }]\n }\n }\n \n render() {\n return (\n <Table\n style={{width: '100%'}}\n columns={this.state.columns}\n data={this.state.data}\n border={true}\n />\n )\n }\n "]},Tag:{Code:['\n import Tag from \'../../ishow/Tag/Tag\';\n\n render() {\n return (\n <div>\n <Tag>\u6807\u7b7e\u4e00</Tag>\n <Tag type="gray">\u6807\u7b7e\u4e8c</Tag>\n <Tag type="primary">\u6807\u7b7e\u4e09</Tag>\n <Tag type="success">\u6807\u7b7e\u56db</Tag>\n <Tag type="warning">\u6807\u7b7e\u4e94</Tag>\n <Tag type="danger">\u6807\u7b7e\u516d</Tag>\n </div>\n )\n }',"\n import Tag from '../../ishow/Tag/Tag';\n\n constructor(props) {\n super(props);\n \n this.state = {\n tags: [\n { key: 1, name: '\u6807\u7b7e\u4e00', type: '' },\n { key: 2, name: '\u6807\u7b7e\u4e8c', type: 'gray' },\n { key: 5, name: '\u6807\u7b7e\u4e09', type: 'primary' },\n { key: 3, name: '\u6807\u7b7e\u56db', type: 'success' },\n { key: 4, name: '\u6807\u7b7e\u4e94', type: 'warning' },\n { key: 6, name: '\u6807\u7b7e\u516d', type: 'danger' }\n ]\n }\n }\n \n handleClose(tag) {\n const { tags } = this.state;\n \n tags.splice(tags.map(el => el.key).indexOf(tag.key), 1);\n \n this.setState({ tag });\n }\n \n render() {\n return (\n <div>\n {\n this.state.tags.map(tag => {\n return (\n <Tag\n key={tag.key}\n closable={true}\n type={tag.type}\n closeTransition={false}\n onClose={this.handleClose.bind(this, tag)}>{tag.name}</Tag>\n )\n })\n }\n </div>\n )\n }\n ","\n import Tag from '../../ishow/Tag/Tag';\n import Button from '../../ishow/Button/Button';\n import Input from '../../ishow/Input/Input';\n\n constructor(props) {\n super(props);\n \n this.state = {\n dynamicTags: ['\u6807\u7b7e\u4e00', '\u6807\u7b7e\u4e8c', '\u6807\u7b7e\u4e09'],\n inputVisible: false,\n inputValue: ''\n }\n }\n \n onKeyUp(e) {\n if (e.keyCode === 13) {\n this.handleInputConfirm();\n }\n }\n \n onChange(value) {\n this.setState({ inputValue: value });\n }\n \n handleClose(index) {\n this.state.dynamicTags.splice(index, 1);\n this.forceUpdate();\n }\n \n showInput() {\n this.setState({ inputVisible: true }, () => {\n this.refs.saveTagInput.focus();\n });\n }\n \n handleInputConfirm() {\n let inputValue = this.state.inputValue;\n \n if (inputValue) {\n this.state.dynamicTags.push(inputValue);\n }\n \n this.state.inputVisible = false;\n this.state.inputValue = '';\n \n this.forceUpdate();\n }\n \n render() {\n return (\n <div>\n {\n this.state.dynamicTags.map((tag, index) => {\n return (\n <Tag\n key={Math.random()}\n closable={true}\n closeTransition={false}\n onClose={this.handleClose.bind(this, index)}>{tag}</Tag>\n )\n })\n }\n {\n this.state.inputVisible ? (\n <Input\n className=\"input-new-tag\"\n value={this.state.inputValue}\n ref=\"saveTagInput\"\n size=\"mini\"\n onChange={this.onChange.bind(this)}\n onKeyUp={this.onKeyUp.bind(this)}\n onBlur={this.handleInputConfirm.bind(this)}\n />\n ) : <Button className=\"button-new-tag\" size=\"small\" onClick={this.showInput.bind(this)}>+ New Tag</Button>\n }\n </div>\n )\n }\n "]},Progress:{Code:['\n import Progress from \'../../ishow/Progress/Progress\';\n\n render() {\n return (\n <div>\n <Progress percentage={0} />\n <Progress percentage={70} />\n <Progress percentage={100} status="success" />\n <Progress percentage={50} status="exception" />\n </div>\n )\n }\n ','\n import Progress from \'../../ishow/Progress/Progress\';\n\n render() {\n return (\n <div>\n <Progress strokeWidth={18} percentage={0} textInside />\n <Progress strokeWidth={18} percentage={70} textInside />\n <Progress strokeWidth={18} percentage={100} status="success" textInside />\n <Progress strokeWidth={18} percentage={50} status="exception" textInside />\n </div>\n )\n }\n ','\n import Progress from \'../../ishow/Progress/Progress\';\n\n render() {\n return (\n <div>\n <Progress type="circle" percentage={0} />\n <Progress type="circle" percentage={25} />\n <Progress type="circle" percentage={100} status="success" />\n <Progress type="circle" percentage={50} status="exception" />\n </div>\n )\n }']},Pagination:{Code:['\n import Pagination from \'../../ishow/Pagination/Pagination\';\n\n render() {\n return (\n <div>\n <Pagination layout="prev, pager, next" total={50}/>\n <Pagination layout="prev, pager, next" total={1000}/>\n </div>\n )\n }','render() {\n return <Pagination layout="prev, pager, next" total={50} small={true}/>\n }','\n render() {\n return (\n <div>\n <Pagination layout="total, sizes, prev, pager, next, jumper" total={400} pageSizes={[100, 200, 300, 400]} pageSize={100} currentPage={5}/>\n </div>\n )\n }']},Loading:{Code:["\n import Loading from '../../ishow/Loading/Loading';\n import Table from '../../ishow/Table/TableStore';\n\n constructor(props) {\n super(props);\n \n this.table = {\n columns: [\n {\n label: \"\u65e5\u671f\",\n prop: \"date\",\n width: 180\n },\n {\n label: \"\u59d3\u540d\",\n prop: \"name\",\n width: 180\n },\n {\n label: \"\u5730\u5740\",\n prop: \"address\"\n }\n ],\n data: [{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }, {\n date: '2018-03-04',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }, {\n date: '2018-03-01',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }, {\n date: '2018-03-03',\n name: 'iShow UI -- Yuri',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6'\n }]\n }\n }\n \n render() {\n return (\n <div className=\"ishow-loading-demo\">\n <Loading text=\"\u8ba2\u5355\u8d44\u6e90\u786e\u8ba4\u4e2d\">\n <Table\n style={{width: '100%'}}\n columns={this.table.columns}\n data={this.table.data}\n />\n </Loading>\n </div>\n )\n }\n "]},Message:{Code:["\n import Message from '../../ishow/Message/Message';\n import Button from \"../../ishow/Button/Button\";\n\n open5() {\n Message({\n showClose: true,\n message: '\u606d\u559c\u4f60\uff0c\u8fd9\u662f\u4e00\u6761\u6210\u529f\u6d88\u606f',\n type: 'success'\n });\n }\n \n open6() {\n Message({\n showClose: true,\n message: '\u8b66\u544a\u54e6\uff0c\u8fd9\u662f\u4e00\u6761\u8b66\u544a\u6d88\u606f',\n type: 'warning'\n });\n }\n \n open7() {\n Message({\n showClose: true,\n message: '\u8fd9\u662f\u4e00\u6761\u6d88\u606f\u63d0\u793a',\n type: 'info'\n });\n }\n \n open8() {\n Message({\n showClose: true,\n message: '\u9519\u4e86\u54e6\uff0c\u8fd9\u662f\u4e00\u6761\u9519\u8bef\u6d88\u606f',\n type: 'error'\n });\n }\n \n render() {\n return (\n <div>\n <Button plain={true} onClick={this.open5.bind(this)}>\u6210\u529f</Button>\n <Button plain={true} onClick={this.open6.bind(this)}>\u8b66\u544a</Button>\n <Button plain={true} onClick={this.open7.bind(this)}>\u6d88\u606f</Button>\n <Button plain={true} onClick={this.open8.bind(this)}>\u9519\u8bef</Button>\n </div>\n )\n }\n "]},MessageBox:{Code:["\n import MessageBox from '../../ishow/MessageBox/index';\n import Button from \"../../ishow/Button/Button\";\n import Message from '../../ishow/Message/Message';\n\n render() {\n return <Button type=\"text\" onClick={this.onClick.bind(this)}>\u70b9\u6211\u67e5\u770b\u6d88\u606f\u63d0\u793a</Button>\n }\n \n onClick() {\n MessageBox.alert('\u8fd9\u662f\u4e00\u6bb5\u5185\u5bb9', '\u6807\u9898\u540d\u79f0');\n }","\n import MessageBox from '../../ishow/MessageBox/index';\n import Button from \"../../ishow/Button/Button\";\n import Message from '../../ishow/Message/Message';\n\n render() {\n return <Button type=\"text\" onClick={this.onClick.bind(this)}>\u70b9\u6211\u786e\u8ba4\u6d88\u606f</Button>\n }\n \n onClick() {\n MessageBox.confirm('\u6b64\u64cd\u4f5c\u5c06\u6c38\u4e45\u5220\u9664\u8be5\u6587\u4ef6, \u662f\u5426\u7ee7\u7eed?', '\u63d0\u793a', {\n type: 'warning'\n }).then(() => {\n Message({\n type: 'success',\n message: '\u5220\u9664\u6210\u529f!'\n });\n }).catch(() => {\n Message({\n type: 'info',\n message: '\u5df2\u53d6\u6d88\u5220\u9664'\n });\n });\n }\n ","\n import MessageBox from '../../ishow/MessageBox/index';\n import Button from \"../../ishow/Button/Button\";\n import Message from '../../ishow/Message/Message';\n\n render() {\n return <Button type=\"text\" onClick={this.onClick.bind(this)}>\u70b9\u6211\u63d0\u4ea4\u5185\u5bb9</Button>\n }\n \n onClick() {\n MessageBox.prompt('\u8bf7\u8f93\u5165\u90ae\u7bb1', '\u63d0\u793a', {\n inputPattern: /[\\/w!#$%&'*+/=?^_`{|}~-]+(?:.[w!#$%&'*+/=?^_`{|}~-]+)*@(?:[w](?:[w-]*[w])?.)+[w](?:[w-]*[w])?\\/,\n inputErrorMessage: '\u90ae\u7bb1\u683c\u5f0f\u4e0d\u6b63\u786e'\n }).then(({ value }) => {\n Message({\n type: 'success',\n message: '\u4f60\u7684\u90ae\u7bb1\u662f: ' + value\n });\n }).catch(() => {\n Message({\n type: 'info',\n message: '\u53d6\u6d88\u8f93\u5165'\n });\n });\n }\n ","\n import MessageBox from '../../ishow/MessageBox/index';\n import Button from \"../../ishow/Button/Button\";\n import Message from '../../ishow/Message/Message';\n\n render() {\n return <Button type=\"text\" onClick={this.onClick.bind(this)}>\u70b9\u51fb\u6253\u5f00 Message Box</Button>\n }\n \n onClick() {\n MessageBox.msgbox({\n title: '\u6d88\u606f',\n message: '\u8fd9\u662f\u4e00\u6bb5\u5185\u5bb9, \u8fd9\u662f\u4e00\u6bb5\u5185\u5bb9, \u8fd9\u662f\u4e00\u6bb5\u5185\u5bb9, \u8fd9\u662f\u4e00\u6bb5\u5185\u5bb9, \u8fd9\u662f\u4e00\u6bb5\u5185\u5bb9, \u8fd9\u662f\u4e00\u6bb5\u5185\u5bb9, \u8fd9\u662f\u4e00\u6bb5\u5185\u5bb9',\n showCancelButton: true\n }).then(action => {\n Message({\n type: 'info',\n message: 'action: ' + action\n });\n })\n }"]},Notification:{Code:["\n import Notification from '../../ishow/Notification/NotificationCenter';\n import Button from \"../../ishow/Button/Button\";\n\n render() {\n return (\n <div>\n <Button onClick={this.open3.bind(this)}>\u6210\u529f</Button>\n <Button onClick={this.open4.bind(this)}>\u8b66\u544a</Button>\n <Button onClick={this.open5.bind(this)}>\u6d88\u606f</Button>\n <Button onClick={this.open6.bind(this)}>\u9519\u8bef\u6d88\u606f\u5e76\u4e14\u4e0d\u4f1a\u81ea\u52a8\u5173\u95ed</Button>\n </div>\n )\n }\n \n open3() {\n Notification({\n title: '\u6210\u529f',\n message: '\u8fd9\u662f\u4e00\u6761\u6210\u529f\u7684\u63d0\u793a\u6d88\u606f',\n type: 'success'\n });\n }\n \n open4() {\n Notification({\n title: '\u8b66\u544a',\n message: '\u8fd9\u662f\u4e00\u6761\u8b66\u544a\u7684\u63d0\u793a\u6d88\u606f',\n type: 'warning'\n });\n }\n \n open5() {\n Notification.info({\n title: '\u6d88\u606f',\n message: '\u8fd9\u662f\u4e00\u6761\u6d88\u606f\u7684\u63d0\u793a\u6d88\u606f'\n });\n }\n \n open6() {\n Notification.error({\n title: '\u9519\u8bef',\n message: '\u8fd9\u662f\u4e00\u6761\u9519\u8bef\u7684\u63d0\u793a\u6d88\u606f\uff0c\u5e76\u4e14\u4e0d\u4f1a\u81ea\u52a8\u5173\u95ed',\n duration: 0\n });\n }\n "]},Menu:{Code:['\n import Menu from \'../../ishow/Menu/index.js\';\n\n render() {\n return (\n <div>\n <Menu theme="dark" defaultActive="1" className="ishow-menu-demo" mode="horizontal" onSelect={this.onSelect.bind(this)}>\n <Menu.Item index="1">\u5904\u7406\u4e2d\u5fc3</Menu.Item>\n <Menu.SubMenu index="2" title="\u6211\u7684\u5de5\u4f5c\u53f0">\n <Menu.Item index="2-1">\u9009\u98791</Menu.Item>\n <Menu.Item index="2-2">\u9009\u98792</Menu.Item>\n <Menu.Item index="2-3">\u9009\u98793</Menu.Item>\n </Menu.SubMenu>\n <Menu.Item index="3">\u8ba2\u5355\u7ba1\u7406</Menu.Item>\n </Menu>\n <div className="line"></div>\n <Menu defaultActive="1" className="ishow-menu-demo" mode="horizontal" onSelect={this.onSelect.bind(this)}>\n <Menu.Item index="1">\u5904\u7406\u4e2d\u5fc3</Menu.Item>\n <Menu.SubMenu index="2" title="\u6211\u7684\u5de5\u4f5c\u53f0">\n <Menu.Item index="2-1">\u9009\u98791</Menu.Item>\n <Menu.Item index="2-2">\u9009\u98792</Menu.Item>\n <Menu.Item index="2-3">\u9009\u98793</Menu.Item>\n </Menu.SubMenu>\n <Menu.Item index="3">\u8ba2\u5355\u7ba1\u7406</Menu.Item>\n </Menu>\n </div>\n )\n }\n \n onSelect() {\n \n }\n ']},Tab:{Code:['\n import Tabs from "../../ishow/Tab/index";\n\n render() {\n return (\n <Tabs activeName="2" onTabClick={ (tab) => console.log(tab.props.name) }>\n <Tabs.Pane label="\u9996\u9875" name="1">\u9996\u9875</Tabs.Pane>\n <Tabs.Pane label="\u4ee3\u5ba2\u6ce8\u518c" name="2">\u4ee3\u5ba2\u6ce8\u518c</Tabs.Pane>\n <Tabs.Pane label="\u4e3b\u63a8\u7ba1\u7406" name="3">\u4e3b\u63a8\u7ba1\u7406</Tabs.Pane>\n <Tabs.Pane label="\u4efb\u52a1\u5185\u5bb9\u7ba1\u7406" name="4">\u4efb\u52a1\u5185\u5bb9\u7ba1\u7406</Tabs.Pane>\n </Tabs>\n )\n }\n ','\n import Tabs from "../../ishow/Tab/index";\n\n render() {\n return (\n <Tabs type="card" value="1">\n <Tabs.Pane label="\u9996\u9875" name="1">\u9996\u9875</Tabs.Pane>\n <Tabs.Pane label="\u4ee3\u5ba2\u6ce8\u518c" name="2">\u4ee3\u5ba2\u6ce8\u518c</Tabs.Pane>\n <Tabs.Pane label="\u4e3b\u63a8\u7ba1\u7406" name="3">\u4e3b\u63a8\u7ba1\u7406</Tabs.Pane>\n <Tabs.Pane label="\u4efb\u52a1\u5185\u5bb9\u7ba1\u7406" name="4">\u4efb\u52a1\u5185\u5bb9\u7ba1\u7406</Tabs.Pane>\n </Tabs>\n )\n }','\n import Tabs from "../../ishow/Tab/index";\n\n render() {\n return (\n <Tabs type="card" closable activeName="1" onTabRemove={ (tab) => console.log(tab.props.name) }>\n <Tabs.Pane label="\u9996\u9875" name="1">\u9996\u9875</Tabs.Pane>\n <Tabs.Pane label="\u4ee3\u5ba2\u6ce8\u518c" name="2">\u4ee3\u5ba2\u6ce8\u518c</Tabs.Pane>\n <Tabs.Pane label="\u4e3b\u63a8\u7ba1\u7406" name="3">\u4e3b\u63a8\u7ba1\u7406</Tabs.Pane>\n <Tabs.Pane label="\u4efb\u52a1\u5185\u5bb9\u7ba1\u7406" name="4">\u4efb\u52a1\u5185\u5bb9\u7ba1\u7406</Tabs.Pane>\n </Tabs>\n )\n }','\n import Tabs from "../../ishow/Tab/index";\n\n render() {\n return (\n <Tabs type="border-card" activeName="1">\n <Tabs.Pane label="\u9996\u9875" name="1">\u9996\u9875</Tabs.Pane>\n <Tabs.Pane label="\u4ee3\u5ba2\u6ce8\u518c" name="2">\u4ee3\u5ba2\u6ce8\u518c</Tabs.Pane>\n <Tabs.Pane label="\u4e3b\u63a8\u7ba1\u7406" name="3">\u4e3b\u63a8\u7ba1\u7406</Tabs.Pane>\n <Tabs.Pane label="\u4efb\u52a1\u5185\u5bb9\u7ba1\u7406" name="4">\u4efb\u52a1\u5185\u5bb9\u7ba1\u7406</Tabs.Pane>\n </Tabs>\n )\n }\n ',"\n import Tabs from \"../../ishow/Tab/index\";\n import Button from \"../../ishow/Button/index\";\n\n constructor() {\n super();\n this.state = {\n tabs: [{\n title: 'Tab 1',\n name: 'Tab 1',\n content: 'Tab 1 content',\n }, {\n title: 'Tab 2',\n name: 'Tab 2',\n content: 'Tab 2 content',\n }],\n tabIndex: 2,\n }\n }\n \n addTab() {\n const { tabs, tabIndex } = this.state;\n const index = tabIndex + 1;\n \n tabs.push({\n title: 'new Tab',\n name: 'Tab ' + index,\n content: 'new Tab content',\n });\n this.setState({\n tabs,\n tabIndex: index,\n });\n }\n \n removeTab(tab) {\n const { tabs, tabIndex } = this.state;\n \n tabs.splice(tab.key.replace(/^.$/, ''), 1);\n this.setState({\n tabs,\n });\n }\n \n render() {\n return (\n <div>\n <div style={{marginBottom: '20px'}}>\n <Button size=\"small\" onClick={() => this.addTab()}>add tab</Button>\n </div>\n <Tabs type=\"card\" value=\"Tab 2\" onTabRemove={(tab) => this.removeTab(tab)}>\n {\n this.state.tabs.map((item, index) => {\n return <Tabs.Pane key={index} closable label={item.title} name={item.name}>{item.content}</Tabs.Pane>\n })\n }\n </Tabs>\n </div>\n )\n }\n "]},Breadcrumb:{Code:["\n import Breadcrumb from '../../ishow/Breadcrumb/index.js';\n\n render() {\n return (\n <Breadcrumb separator=\"/\">\n <Breadcrumb.Item>\u9996\u9875</Breadcrumb.Item>\n <Breadcrumb.Item>\u6d3b\u52a8\u7ba1\u7406</Breadcrumb.Item>\n <Breadcrumb.Item>\u6d3b\u52a8\u5217\u8868</Breadcrumb.Item>\n <Breadcrumb.Item>\u6d3b\u52a8\u8be6\u60c5</Breadcrumb.Item>\n </Breadcrumb>\n )\n }",'\n import Breadcrumb from \'../../ishow/Breadcrumb/index.js\';\n\n render() {\n return (\n <div className="allInOneBreadCrumbs" style={{ position: "relative", marginBottom: 20 }}>\n <Breadcrumb separator="/" style={{ display: \'inline-block\' }}>\n <Breadcrumb.Item>\u6295\u8bc9\u7ba1\u7406\u7cfb\u7edf</Breadcrumb.Item>\n <Breadcrumb.Item>\u6295\u8bc9\u5355{this.props.complaintSheetID}</Breadcrumb.Item>\n </Breadcrumb>\n <span style={{ position: "absolute", cursor: \'pointer\', right: 0 }}>\n <IconPlus type="reload" title="\u5237\u65b0" onClick={() => window.location.reload()} /> \n <IconPlus type="copy" title="\u590d\u5236url" onClick={() => this.copyUrl()} /></span>\n </div>\n )\n }']},Dropdown:{Code:["\n import Button from '../../ishow/Button/Button';\n import Dropdown from '../../ishow/Dropdown/index.js';\n\n render() {\n return (\n <div>\n <Dropdown menu={(\n <Dropdown.Menu>\n <Dropdown.Item>Yuri</Dropdown.Item>\n <Dropdown.Item>\u9648\u745c\u5a77</Dropdown.Item>\n <Dropdown.Item>\u76db\u745c</Dropdown.Item>\n <Dropdown.Item>\u5218\u5174</Dropdown.Item>\n <Dropdown.Item>\u8d75\u6590\u660a</Dropdown.Item>\n <Dropdown.Item>\u9ec4\u6770</Dropdown.Item>\n <Dropdown.Item>\u5218\u6cfd\u743c</Dropdown.Item>\n <Dropdown.Item>\u5510\u5a9b\u5a9b</Dropdown.Item>\n </Dropdown.Menu>\n )}>\n <Button type=\"primary\">\n iShow UIELF-Team\u6210\u5458<i className=\"ishow-icon-caret-bottom ishow-icon--right\"></i>\n </Button>\n </Dropdown>\n </div>\n )\n }\n "]},Steps:{Code:['\n import Steps from \'../../ishow/Steps/index.js\';\n\n render() {\n return (\n <Steps space={100} active={1} finishStatus="success">\n <Steps.Step title="\u5df2\u5b8c\u6210"></Steps.Step>\n <Steps.Step title="\u8fdb\u884c\u4e2d"></Steps.Step>\n <Steps.Step title="\u6b65\u9aa4 3"></Steps.Step>\n </Steps>\n )\n }\n ','\n import Steps from \'../../ishow/Steps/index.js\';\n\n render() {\n return (\n <Steps space={200} active={1}>\n <Steps.Step title="\u6b65\u9aa4 1" description="\u8fd9\u662f\u4e00\u6bb5\u5f88\u957f\u5f88\u957f\u5f88\u957f\u7684\u63cf\u8ff0\u6027\u6587\u5b57"></Steps.Step>\n <Steps.Step title="\u6b65\u9aa4 2" description="\u8fd9\u662f\u4e00\u6bb5\u5f88\u957f\u5f88\u957f\u5f88\u957f\u7684\u63cf\u8ff0\u6027\u6587\u5b57"></Steps.Step>\n <Steps.Step title="\u6b65\u9aa4 3" description="\u8fd9\u662f\u4e00\u6bb5\u5f88\u957f\u5f88\u957f\u5f88\u957f\u7684\u63cf\u8ff0\u6027\u6587\u5b57"></Steps.Step>\n </Steps>\n )\n }','\n import Steps from \'../../ishow/Steps/index.js\';\n\n render() {\n return (\n <Steps space={100} active={1}>\n <Steps.Step title="\u6b65\u9aa4 1" icon="edit"></Steps.Step>\n <Steps.Step title="\u6b65\u9aa4 2" icon="upload"></Steps.Step>\n <Steps.Step title="\u6b65\u9aa4 3" icon="picture"></Steps.Step>\n </Steps>\n )\n }','\n import Button from \'../../ishow/Button/Button\';\n import Steps from \'../../ishow/Steps/index.js\';\n\n constructor(props) {\n super(props);\n \n this.state = {\n active: 0\n };\n }\n \n next() {\n let active = this.state.active + 1;\n if (active > 3) {\n active = 0;\n }\n this.setState({ active });\n }\n \n render() {\n return (\n <div>\n <Steps space={200} active={this.state.active} finishStatus="success">\n <Steps.Step title="\u6b65\u9aa4 1"></Steps.Step>\n <Steps.Step title="\u6b65\u9aa4 2"></Steps.Step>\n <Steps.Step title="\u6b65\u9aa4 3"></Steps.Step>\n </Steps>\n <Button onClick={() => this.next()}>\u4e0b\u4e00\u6b65</Button>\n </div>\n )\n }\n ']},Dialog:{Code:['\n import Dialog from \'../../ishow/Dialog/Dialog\';\n import Button from \'../../ishow/Button/Button\';\n\n constructor(props) {\n super(props);\n \n this.state = {\n dialogVisible: false\n };\n }\n \n render() {\n return (\n <div>\n <Button type="text" onClick={ () => this.setState({ dialogVisible: true }) }>\u70b9\u51fb\u6253\u5f00 Dialog</Button>\n <Dialog\n title="\u63d0\u793a"\n size="tiny"\n visible={ this.state.dialogVisible }\n onCancel={ () => this.setState({ dialogVisible: false }) }\n lockScroll={ false }\n >\n <Dialog.Body>\n <span>\u8fd9\u662f\u4e00\u6bb5\u4fe1\u606f</span>\n </Dialog.Body>\n <Dialog.Footer className="dialog-footer">\n <Button type="primary" onClick={ () => this.setState({ dialogVisible: false }) }>\u786e\u5b9a</Button>\n <Button onClick={ () => this.setState({ dialogVisible: false }) }>\u53d6\u6d88</Button> \n </Dialog.Footer>\n </Dialog>\n </div>\n )\n }\n ','\n import Dialog from \'../../ishow/Dialog/Dialog\';\n import Button from \'../../ishow/Button/Button\';\n import Table from \'../../ishow/Table/TableStore\';\n import Form from \'../../ishow/Form/Form\';\n import Select from \'../../ishow/Select/index\';\n\n constructor(props) {\n super(props);\n \n this.state = {\n dialogVisible2: false,\n dialogVisible3: false,\n form: {\n name: \'\',\n region: \'\'\n }\n };\n \n this.table = {\n columns: [\n {\n label: "\u65e5\u671f",\n prop: "date",\n width: 150\n },\n {\n label: "\u59d3\u540d",\n prop: "name",\n width: 100\n },\n {\n label: "\u5730\u5740",\n prop: "address"\n }\n ],\n data: [{\n date: \'2018-03-02\',\n name: \'iShow UI -- Yuri\',\n address: \'\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6\'\n }, {\n date: \'2018-03-04\',\n name: \'iShow UI -- Yuri\',\n address: \'\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6\'\n }, {\n date: \'2018-03-01\',\n name: \'iShow UI -- Yuri\',\n address: \'\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6\'\n }, {\n date: \'2018-03-03\',\n name: \'iShow UI -- Yuri\',\n address: \'\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6\'\n }]\n };\n }\n \n render() {\n return (\n <div>\n <Button type="text" onClick={ () => this.setState({ dialogVisible2: true }) } type="text">\u6253\u5f00\u5d4c\u5957\u8868\u683c\u7684 Dialog</Button>\n <Dialog\n title="\u6536\u8d27\u5730\u5740"\n visible={ this.state.dialogVisible2 }\n onCancel={ () => this.setState({ dialogVisible2: false }) }\n >\n <Dialog.Body>\n {this.state.dialogVisible2 && (\n <Table\n style={{width: \'100%\'}}\n stripe={true}\n columns={this.table.columns}\n data={this.table.data} />\n )}\n </Dialog.Body>\n </Dialog>\n <Button type="text" onClick={ () => this.setState({ dialogVisible3: true }) } type="text">\u6253\u5f00\u5d4c\u5957\u8868\u5355\u7684 Dialog</Button>\n <Dialog\n title="\u6536\u8d27\u5730\u5740"\n visible={ this.state.dialogVisible3 }\n onCancel={ () => this.setState({ dialogVisible3: false }) }\n >\n <Dialog.Body>\n <Form model={this.state.form}>\n <Form.Item label="\u6d3b\u52a8\u540d\u79f0" labelWidth="120">\n <Input value={this.state.form.name}></Input>\n </Form.Item>\n <Form.Item label="\u6d3b\u52a8\u533a\u57df" labelWidth="120">\n <Select value={this.state.form.region} placeholder="\u8bf7\u9009\u62e9\u6d3b\u52a8\u533a\u57df">\n <Select.Option label="\u533a\u57df\u4e00" value="shanghai"></Select.Option>\n <Select.Option label="\u533a\u57df\u4e8c" value="beijing"></Select.Option>\n </Select>\n </Form.Item>\n </Form>\n </Dialog.Body>\n \n <Dialog.Footer className="dialog-footer">\n <Button onClick={ () => this.setState({ dialogVisible3: false }) }>\u53d6 \u6d88</Button>\n <Button type="primary" onClick={ () => this.setState({ dialogVisible3: false }) }>\u786e \u5b9a</Button>\n </Dialog.Footer>\n </Dialog>\n </div>\n )\n }\n ']},BarChart:{Code:["\n import React from 'react'\n import ReactEcharts from 'echarts-for-react'\n\n class App extends React.Component {\n getOption = () => {\n return {\n xAxis: {\n type: 'category',\n data: ['1\u6708', '2\u6708', '3\u6708', '4\u6708', '5\u6708', '6\u6708', '7\u6708', '8\u6708', '9\u6708', '10\u6708', '11\u6708', '12\u6708']\n },\n yAxis: {\n type: 'value'\n },\n series: [{\n data: [120, 100, 150, 80, 70, 110, 130, 80, 70, 110, 130, 120],\n type: 'bar',\n color: \"#2da0ff\"\n }]\n };\n };\n\n render() {\n return (\n <ReactEcharts\n option={this.getOption()}\n style={{ height: '300px', width: '65%' }}\n className='react_for_echarts' />\n )\n }\n }\n\n export default App\n "]},PieChart:{Code:[" \n import React from 'react'\n import ReactEcharts from 'echarts-for-react'\n\n class App extends React.Component {\n getOption = () => {\n return {\n title: {\n show: true\n },\n tooltip: {\n trigger: 'item',\n formatter: \"{a} <br/>{b}: {c} ({d}%)\"\n },\n legend: {\n orient: 'vertical',\n right: 0,\n top: 100,\n data: ['\u8ddf\u56e2\u6e38', '\u81ea\u7531\u884c', '\u90ae\u8f6e', '\u673a\u7968', '\u9152\u5e97', \"\u706b\u8f66\u7968\"]\n },\n series: [\n {\n name: '\u8bbf\u95ee\u6765\u6e90',\n hoverAnimation: false,\n type: 'pie',\n radius: ['50%', '70%'],\n avoidLabelOverlap: false,\n label: {\n normal: {\n show: false,\n position: 'center'\n },\n emphasis: {\n show: true,\n textStyle: {\n fontSize: '30',\n fontWeight: 'bold'\n }\n }\n },\n labelLine: {\n normal: {\n show: false\n }\n },\n data: [\n { value: 335, name: '\u8ddf\u56e2\u6e38' },\n { value: 310, name: '\u81ea\u7531\u884c' },\n { value: 234, name: '\u90ae\u8f6e' },\n { value: 135, name: '\u673a\u7968' },\n { value: 1548, name: '\u9152\u5e97' },\n { value: 1324, name: '\u706b\u8f66\u7968' }\n ]\n }\n ]\n };\n };\n\n render() {\n return (\n <ReactEcharts\n option={this.getOption()}\n style={{ height: '300px', width: '500px' }}\n className='react_for_echarts' />\n )\n }\n }\n\n export default App","\n import React from 'react'\n import ReactEcharts from 'echarts-for-react'\n import { Tabs } from '../../ishow'\n\n class App extends React.Component {\n getOption = () => {\n return {\n tooltip: {\n trigger: 'item',\n formatter: \"{a} <br/>{b} : {c} ({d}%)\"\n },\n legend: {\n orient: 'vertical',\n right: 0,\n top: 100,\n data: ['\u8ddf\u56e2\u6e38', '\u81ea\u7531\u884c', '\u90ae\u8f6e', '\u673a\u7968', '\u9152\u5e97', \"\u706b\u8f66\u7968\"]\n },\n series: [\n {\n name: '\u8ba2\u5355\u6765\u6e90',\n hoverAnimation: false,\n type: 'pie',\n radius: '55%',\n center: ['40%', '50%'],\n data: [\n { value: 335, name: '\u8ddf\u56e2\u6e38' },\n { value: 310, name: '\u81ea\u7531\u884c' },\n { value: 234, name: '\u90ae\u8f6e' },\n { value: 135, name: '\u673a\u7968' },\n { value: 1548, name: '\u9152\u5e97' },\n { value: 1324, name: '\u706b\u8f66\u7968' }\n ],\n itemStyle: {\n emphasis: {\n shadowBlur: 10,\n shadowOffsetX: 0,\n shadowColor: 'rgba(0, 0, 0, 0.5)'\n }\n }\n }\n ]\n };\n };\n\n render() {\n return (\n <div className=\"App\">\n <div>\n <ReactEcharts\n option={this.getOption()}\n style={{ height: '300px', width: '500px' }}\n className='react_for_echarts' />\n </div>\n </div>\n )\n }\n }\n\n export default App\n "]},LineChart:{Code:["\n import React from 'react'\n import ReactEcharts from 'echarts-for-react'\n\n class App extends React.Component {\n getOption = () => {\n return {\n tooltip: {\n trigger: 'axis'\n },\n legend: {\n data: ['\u5ba2\u6d41\u91cf', '\u652f\u4ed8\u7b14\u6570']\n },\n grid: {\n left: '3%',\n right: '4%',\n bottom: '3%',\n containLabel: true\n },\n xAxis: {\n type: 'category',\n boundaryGap: false,\n data: ['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00']\n },\n yAxis: {\n type: 'value'\n },\n dataZoom: {\n type: 'slider',\n show: true,\n xAxisIndex: [0],\n start: 0,\n end: 100,\n bottom: \"0px\"\n },\n series: [\n {\n name: '\u652f\u4ed8\u7b14\u6570',\n type: 'line',\n stack: '\u603b\u91cf',\n data: [120, 132, 101, 134, 90, 230, 210, 132, 101, 134, 90, 230, 210, 132, 101, 134, 90, 230, 210, 190, 132, 101, 120, 132, 123]\n },\n {\n name: '\u5ba2\u6d41\u91cf',\n type: 'line',\n stack: '\u603b\u91cf',\n data: [220, 182, 191, 234, 290, 330, 310, 220, 182, 191, 234, 290, 330, 310, 220, 182, 191, 234, 290, 300, 310, 123, 232, 231]\n }\n ]\n };\n };\n\n render() {\n return (\n <ReactEcharts\n option={this.getOption()}\n style={{ height: '300px', width: '1000px' }}\n className='react_for_echarts' />\n )\n }\n }\n\n export default App\n "]},Animate:{Code:['\n import "animate.css/animate.min.css";\n\n <div class="animated bounceInLeft" style="animation-duration: 1s;"> \u7531\u5de6\u5f39\u5165\u6548\u679c</div>\n <div class="animated flipOutY" style="animation-delay: 1s;"> \u7eb5\u5411\u7ffb\u51fa\u6548\u679c</div>\n <div class="animated slideInRight" style="animation-duration: 1s;animation-iteration-count:3"> \u81ea\u53f3\u6ed1\u5165\u6548\u679c</div>\n\n animationend() {\n this.setState({\n eventToggle: !this.state.eventToggle,\n });\n }\n\n <Button type="primary" type="info" onClick={this.animationend.bind(this)} >Toggle\u52a8\u753b\u56de\u8c03</Button>\n\n ']},LoginForm:{Code:['\n import React from "react";\n import { Form, Input, Button, Tabs} from "../../ishow";\n\n class Login extends React.Component {\n constructor(props) {\n super(props);\n this.state = {\n form: {\n pass: "",\n name:"",\n },\n rules: {\n pass: [\n { required: true, message: \'\u8bf7\u8f93\u5165\u5bc6\u7801\', trigger: \'blur\' }\n ],\n name: [\n { required: true, message: "\u8bf7\u586b\u5199\u7528\u6237\u540d", trigger: "blur" }\n ]\n }\n };\n }\n\n handleSubmit(e) {\n e.preventDefault();\n\n this.refs.form.validate(valid => {\n if (valid) {\n alert("submit!");\n } else {\n console.log("error submit!!");\n return false;\n }\n });\n }\n\n onChange(key, value) {\n this.setState({\n form: Object.assign({}, this.state.form, { [key]: value })\n });\n }\n\n render() {\n return (\n <Form\n ref="form"\n model={this.state.form}\n rules={this.state.rules}\n labelWidth="100"\n className="demo-ruleForm login-form"\n >\n <Form.Item label="\u7528\u6237\u540d" prop="name">\n <Input\n value={this.state.form.name}\n onChange={this.onChange.bind(this, "name")}\n />\n </Form.Item>\n <Form.Item label="\u5bc6\u7801" prop="pass">\n <Input\n type="password"\n value={this.state.form.pass}\n onChange={this.onChange.bind(this, "pass")}\n autoComplete="off"\n />\n </Form.Item>\n <Form.Item>\n <Button type="primary" onClick={this.handleSubmit.bind(this)} className="login-btn">\n \u767b\u5f55\n </Button>\n </Form.Item>\n </Form>\n )\n }\n }\n\n //\u4e0b\u9762\u6837\u5f0f\u53ef\u81ea\u884c\u8c03\u6574\uff0c\u987b\u5355\u72ec\u5f15\u5165\u6837\u5f0f\u6587\u4ef6\n <style>\n .login-form {\n width: 500 px;\n height: auto;\n border - radius: 10 px;\n border: 1 px solid# ccc;\n padding: 50 px 100 px 50 px 0;\n background: #fff;\n }\n\n .login - btn {\n width: 100 % ;\n }\n </style>\n ','\n import React from "react";\n import { Form, Input, Button, Tabs } from "../../ishow";\n\n class Register extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n form: {\n pass: "",\n name:"",\n email:"",\n checkPass:""\n },\n rules: {\n pass: [\n { required: true, message: \'\u8bf7\u8f93\u5165\u5bc6\u7801\', trigger: \'blur\' },\n {\n validator: (rule, value, callback) => {\n if (value === \'\') {\n callback(new Error(\'\u8bf7\u8f93\u5165\u5bc6\u7801\'));\n } else {\n if (this.state.form.checkPass !== \'\') {\n this.refs.form.validateField(\'checkPass\');\n }\n callback();\n }\n }\n }\n ],\n checkPass: [\n { required: true, message: \'\u8bf7\u518d\u6b21\u8f93\u5165\u5bc6\u7801\', trigger: \'blur\' },\n {\n validator: (rule, value, callback) => {\n if (value === \'\') {\n callback(new Error(\'\u8bf7\u518d\u6b21\u8f93\u5165\u5bc6\u7801\'));\n } else if (value !== this.state.form.pass) {\n callback(new Error(\'\u4e24\u6b21\u8f93\u5165\u5bc6\u7801\u4e0d\u4e00\u81f4!\'));\n } else {\n callback();\n }\n }\n }\n ],\n name: [\n { required: true, message: "\u8bf7\u586b\u5199\u7528\u6237\u540d", trigger: "blur" }\n ],\n email: [\n { required: true, message: \'\u8bf7\u8f93\u5165\u90ae\u7bb1\u5730\u5740\', trigger: \'blur\' },\n { type: \'email\', message: \'\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u90ae\u7bb1\u5730\u5740\', trigger: \'blur,change\' }\n ]\n }\n };\n }\n\n handleSubmit(e) {\n e.preventDefault();\n\n this.refs.form.validate(valid => {\n if (valid) {\n alert("submit!");\n } else {\n console.log("error submit!!");\n return false;\n }\n });\n }\n\n onChange(key, value) {\n this.setState({\n form: Object.assign({}, this.state.form, { [key]: value })\n });\n }\n\n onEmailChange(value) {\n this.setState({\n form: Object.assign({}, this.state.form, { email: value })\n });\n }\n\n handleReset(e) {\n e.preventDefault();\n\n this.refs.form.resetFields();\n }\n\n render() {\n return (\n <Form\n ref="form"\n model={this.state.form}\n rules={this.state.rules}\n labelWidth="100"\n className="demo-ruleForm login-form"\n >\n <Form.Item prop="email" label="\u90ae\u7bb1">\n <Input value={this.state.form.email} onChange={this.onEmailChange.bind(this)}></Input>\n </Form.Item>\n <Form.Item label="\u7528\u6237\u540d" prop="name">\n <Input\n value={this.state.form.name}\n onChange={this.onChange.bind(this, "name")}\n />\n </Form.Item>\n <Form.Item label="\u5bc6\u7801" prop="pass">\n <Input\n type="password"\n value={this.state.form.pass}\n onChange={this.onChange.bind(this, "pass")}\n autoComplete="off"\n />\n </Form.Item>\n <Form.Item label="\u786e\u8ba4\u5bc6\u7801" prop="checkPass">\n <Input type="password" value={this.state.form.checkPass} onChange={this.onChange.bind(this, \'checkPass\')} autoComplete="off" />\n </Form.Item>\n <Form.Item>\n <Button type="primary" onClick={this.handleSubmit.bind(this)}>\n \u6ce8\u518c\n </Button>\n <Button onClick={this.handleReset.bind(this)}>\u91cd\u7f6e</Button>\n </Form.Item>\n </Form>\n )\n }\n }\n //\u4e0b\u9762\u6837\u5f0f\u53ef\u81ea\u884c\u8c03\u6574\uff0c\u987b\u5355\u72ec\u5f15\u5165\u6837\u5f0f\u6587\u4ef6\n <style>\n .login-form {\n width: 500 px;\n height: auto;\n border-radius: 10 px;\n border: 1 px solid# ccc;\n padding: 50px 100px 50px 0;\n background: #fff;\n }\n </style>\n ']},NotFound:{Code:['\n import React from "react";\n\n class NotFound extends React.Component {\n render(){\n return (\n <div className="lost-404">\n <h1 className="lost-404-title">404</h1>\n <p className="lost-404-content">YOUR PAGE SEEMS LOST :(</p>\n </div>\n )\n }\n }\n\n //\u6837\u5f0f\u5355\u72ec\u5199\u518d\u5f15\u5165\n <style>\n .lost-404-title {\n color: #2d8cf0;\n font-size: 100px;\n text-align: center;\n margin-bottom: 0\n }\n\n .lost-404-content {\n color: #999;\n text-align: center;\n top: 80px;\n }\n </style>\n ']},FuzzySearch:{Code:['\n import React from \'react\';\n import \'./App.css\';\n import AutoComplete from \'../../ishow/auto-complete\';\n\n const customItem=(props)=>{\n let item = props.item;\n //console.log(props)\n return (\n <div><div className="ishow-customItem-key">{item.value}</div><span className="ishow-customItem-detail">{item.address}</span></div>\n )\n }\n\n class FuzzySearch extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n scenery: [\n { "value": "\u7384\u6b66\u6e56\u516c\u56ed", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u7384\u6b66\u533a/\u7384\u6b66\u5df71\u53f7" },\n { "value": "\u4e2d\u5c71\u9675", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u7384\u6b66\u533a/\u77f3\u8c61\u8def7\u53f7" },\n { "value": "\u4e2d\u592e\u516c\u56ed", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u516d\u5408\u533a/\u53e4\u68e0\u5927\u9053" },\n { "value": "\u5357\u4eac\u5927\u5c60\u6740\u7eaa\u5ff5\u9986", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u5efa\u90ba\u533a/\u6c34\u897f\u95e8\u5927\u8857418\u53f7" },\n { "value": "\u8001\u95e8\u4e1c", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u79e6\u6dee\u533a/\u526a\u5b50\u5df754\u53f7" },\n { "value": "\u7d2b\u5cf0\u5927\u53a6", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u9f13\u697c\u533a/\u4e2d\u5c71\u5317\u8def1\u53f7" },\n { "value": "\u9e21\u9e23\u5bfa", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u7384\u6b66\u533a/\u9e21\u9e23\u5bfa\u8def1\u53f7" }\n ],\n value1: \'\'\n }\n }\n\n querySearch(queryString, cb) {\n const { scenery } = this.state;\n const results = queryString ? scenery.filter(this.createFilter(queryString)) : scenery;\n // \u8c03\u7528 callback \u8fd4\u56de\u5efa\u8bae\u5217\u8868\u7684\u6570\u636e\n cb(results);\n }\n\n createFilter(queryString) {\n return (scenery) => {\n return (scenery.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);\n };\n }\n\n handleSelect(item) {\n \n }\n\n handleInputChange(event){\n this.setState({\n value:event.target.value\n })\n }\n \n render() {\n return (\n <div>\n <AutoComplete\n className="my-autocomplete"\n placeholder="\u8bf7\u8f93\u5165\u5185\u5bb9"\n value={this.state.value1}\n fetchSuggestions={this.querySearch.bind(this)}\n customItem={customItem}\n onSelect={this.handleSelect.bind(this)}\n ></AutoComplete>\n </div>\n )\n }\n }\n ','\n import React from \'react\';\n import \'./App.css\';\n import AutoComplete from \'../../ishow/auto-complete\';\n\n class FuzzySearch extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n scenery: [\n { "value": "\u7384\u6b66\u6e56\u516c\u56ed", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u7384\u6b66\u533a/\u7384\u6b66\u5df71\u53f7" },\n { "value": "\u4e2d\u5c71\u9675", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u7384\u6b66\u533a/\u77f3\u8c61\u8def7\u53f7" },\n { "value": "\u4e2d\u592e\u516c\u56ed", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u516d\u5408\u533a/\u53e4\u68e0\u5927\u9053" },\n { "value": "\u5357\u4eac\u5927\u5c60\u6740\u7eaa\u5ff5\u9986", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u5efa\u90ba\u533a/\u6c34\u897f\u95e8\u5927\u8857418\u53f7" },\n { "value": "\u8001\u95e8\u4e1c", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u79e6\u6dee\u533a/\u526a\u5b50\u5df754\u53f7" },\n { "value": "\u7d2b\u5cf0\u5927\u53a6", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u9f13\u697c\u533a/\u4e2d\u5c71\u5317\u8def1\u53f7" },\n { "value": "\u9e21\u9e23\u5bfa", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u7384\u6b66\u533a/\u9e21\u9e23\u5bfa\u8def1\u53f7" }\n ],\n value1: \'\'\n }\n }\n\n querySearch(queryString, cb) {\n const { scenery } = this.state;\n const results = queryString ? scenery.filter(this.createFilter(queryString)) : scenery;\n // \u8c03\u7528 callback \u8fd4\u56de\u5efa\u8bae\u5217\u8868\u7684\u6570\u636e\n cb(results);\n }\n\n createFilter(queryString) {\n return (scenery) => {\n return (scenery.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);\n };\n }\n\n handleSelect(item) {\n \n }\n\n handleInputChange(event){\n this.setState({\n value:event.target.value\n })\n }\n \n render() {\n return (\n <div>\n <AutoComplete\n className="my-autocomplete"\n placeholder="\u8bf7\u8f93\u5165\u5185\u5bb9"\n value={this.state.value1}\n onFocus={e=>console.log(e, \'onFocus\')}\n onBlur={e=>console.log(e, \'onblur\')}\n fetchSuggestions={this.querySearch.bind(this)}\n onSelect={this.handleSelect.bind(this)}\n ></AutoComplete>\n </div>\n )\n }\n }\n ','\n import React from \'react\';\n import \'./App.css\';\n import AutoComplete from \'../../ishow/auto-complete\';\n\n class FuzzySearch extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n scenery: [\n { "value": "\u7384\u6b66\u6e56\u516c\u56ed", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u7384\u6b66\u533a/\u7384\u6b66\u5df71\u53f7" },\n { "value": "\u4e2d\u5c71\u9675", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u7384\u6b66\u533a/\u77f3\u8c61\u8def7\u53f7" },\n { "value": "\u4e2d\u592e\u516c\u56ed", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u516d\u5408\u533a/\u53e4\u68e0\u5927\u9053" },\n { "value": "\u5357\u4eac\u5927\u5c60\u6740\u7eaa\u5ff5\u9986", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u5efa\u90ba\u533a/\u6c34\u897f\u95e8\u5927\u8857418\u53f7" },\n { "value": "\u8001\u95e8\u4e1c", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u79e6\u6dee\u533a/\u526a\u5b50\u5df754\u53f7" },\n { "value": "\u7d2b\u5cf0\u5927\u53a6", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u9f13\u697c\u533a/\u4e2d\u5c71\u5317\u8def1\u53f7" },\n { "value": "\u9e21\u9e23\u5bfa", "address": "\u4e2d\u56fd/\u6c5f\u82cf/\u5357\u4eac/\u7384\u6b66\u533a/\u9e21\u9e23\u5bfa\u8def1\u53f7" }\n ],\n value2: \'\'\n }\n }\n\n querySearch(queryString, cb) {\n const { scenery } = this.state;\n const results = queryString ? scenery.filter(this.createFilter(queryString)) : scenery;\n // \u8c03\u7528 callback \u8fd4\u56de\u5efa\u8bae\u5217\u8868\u7684\u6570\u636e\n cb(results);\n }\n\n createFilter(queryString) {\n return (scenery) => {\n return (scenery.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);\n };\n }\n\n handleSelect(item) {\n \n }\n\n handleInputChange(event){\n this.setState({\n value:event.target.value\n })\n }\n \n render() {\n return (\n <div>\n <AutoComplete\n className="my-autocomplete"\n placeholder="\u8bf7\u8f93\u5165\u5185\u5bb9"\n value={this.state.value2}\n fetchSuggestions={this.querySearch.bind(this)}\n onSelect={this.handleSelect.bind(this)}\n triggerOnFocus={false}\n ></AutoComplete>\n </div>\n )\n }\n }\n ',"\n import React from 'react';\n import AutoComplete from '../../ishow/auto-complete';\n \n class CrmAutoComplete extends React.Component {\n constructor(props){\n super(props);\n this.state = {\n prefix: [\n '\u8ba2\u5355\u53f7',\n '\u624b\u673a\u53f7',\n '\u4f1a\u5458ID',\n ],\n value: ''\n }\n }\n appendPrefix(queryString, cb) {\n if (queryString.indexOf('@') !== -1) {\n return cb([])\n }\n let triggerList = []\n for (let i = 0; i < this.state.prefix.length; i++) {\n triggerList.push({ value: this.state.prefix[i]+ \" \" + queryString })\n }\n cb(triggerList)\n }\n\n formatInput(item){\n //\u8f93\u5165\u6846\u4e2d\u53bb\u6389\u63d0\u793a\u6761\u4ef6\u4e2d\u7684\u5b57\u7b26\n this.setState({\n value:item.value.slice(item.value.indexOf(\" \")+1)\n })\n }\n\n render(){\n return(\n <div>\n <AutoComplete\n value={this.state.value}\n placeholder=\"\u8ba2\u5355\u53f7/\u624b\u673a\u53f7/\u4f1a\u5458ID\"\n className=\"my-autocomplete\"\n triggerOnFocus={true}\n onSelect={this.formatInput.bind(this)}\n fetchSuggestions={this.appendPrefix.bind(this)} />\n </div>\n )\n }\n ","\n import React from 'react';\n import Cascader from \"../../ishow/Cascader\";\n import './App.css';\n\n class App extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n options: [{\n value: 'zhoubian',\n label: '\u5357\u4eac\u5468\u8fb9\u65c5\u6e38',\n children: [{\n value: 'antianshufen',\n label: '\u6309\u5929\u6570\u5206',\n children: [{\n value: 'yitian',\n label: '\u4e00\u5929'\n }, {\n value: 'liangtian',\n label: '\u4e24\u5929'\n }, {\n value: 'santian',\n label: '\u4e09\u5929'\n }]\n }, {\n value: 'chengshi',\n label: '\u6309\u57ce\u5e02\u5206',\n children: [{\n value: 'nanjing',\n label: '\u5357\u4eac'\n }, {\n value: 'wuxi',\n label: '\u65e0\u9521'\n }, {\n value: 'xuzhou',\n label: '\u5f90\u5dde'\n }, {\n value: 'changzhou',\n label: '\u5e38\u5dde'\n }]\n }]\n }, {\n value: 'guonei',\n label: '\u56fd\u5185\u65c5\u6e38',\n children: [{\n value: 'hainan',\n label: '\u6d77\u5357',\n children: [{\n value: 'sanya',\n label: '\u4e09\u4e9a'\n }, {\n value: 'haikou',\n label: '\u6d77\u53e3'\n }, {\n value: 'yalongwan',\n label: '\u4e9a\u9f99\u6e7e'\n }, {\n value: 'tianyahaijiao',\n label: '\u5929\u6daf\u6d77\u89d2'\n }]\n }, {\n value: 'yunnan',\n label: '\u4e91\u5357',\n children: [{\n value: 'dali',\n label: '\u5927\u7406'\n }, {\n value: 'lijiang',\n label: '\u4e3d\u6c5f'\n }, {\n value: 'kunming',\n label: '\u6606\u660e'\n }, {\n value: 'yuxi',\n label: '\u7389\u6eaa'\n }]\n }, {\n value: 'neimeng',\n label: '\u5185\u8499\u53e4',\n children: [{\n value: 'chifeng',\n label: '\u8d64\u5cf0'\n }, {\n value: 'huhe',\n label: '\u547c\u548c\u6d69\u7279'\n }, {\n value: 'baotou',\n label: '\u5305\u5934'\n }, {\n value: 'erdos',\n label: '\u9102\u5c14\u591a\u65af'\n }]\n }]\n }, {\n value: 'oumei',\n label: '\u6b27\u7f8e',\n children: [{\n value: 'ruishi',\n label: '\u745e\u58eb'\n }, {\n value: 'faguo',\n label: '\u6cd5\u56fd'\n }, {\n value: 'meiguo',\n label: '\u7f8e\u56fd'\n }]\n }],\n selectedOptions: [],\n }\n }\n\n handleChange(key, value) {\n this.setState({ [key]: value });\n }\n handleCascaderChange = () => {\n setTimeout(() => {\n let s = '';\n let tmp = document.querySelector(\".myCascader\").querySelector(\".ishow-cascader__label\").querySelectorAll(\"label\");\n tmp.forEach((item) => s += item.innerText)\n document.querySelector(\"#cascaderTips\").innerHTML = s\n }, 300);\n\n render(){\n return (\n <Cascader\n className=\"myCascader\"\n options={this.state.options}\n filterable={true}\n changeOnSelect={true}\n onChange={()=>this.handleCascaderChange()}\n />\n <p id=\"cascaderTips\"></p>\n )\n }\n }\n\n "]},DynamicTable:{Code:["\n import React, { Component } from 'react';\n import Table from '../../ishow/Table/TableStore';\n import Button from \"../../ishow/Button/index\";\n import Checkbox from '../../ishow/Checkbox/index';\n import Switch from '../../ishow/Switch/Switch'\n import './App.css'\n\n class App extends Component {\n constructor(props){\n super(props);\n this.state = {\n columns: [\n {\n label: \"\u65e5\u671f\",\n prop: \"date\",\n width: 200,\n mustShow:true,\n fixed:'left'\n },\n {\n label: \"\u59d3\u540d\",\n prop: \"name\",\n minWidth: '200',\n mustShow: false\n },\n {\n label: \"\u7701\u4efd\",\n prop: \"province\",\n minWidth: '200',\n mustShow: false\n },\n {\n label:\"\u57ce\u5e02\",\n prop:\"city\",\n minWidth: '200',\n mustShow:false\n },\n {\n label: \"\u5730\u5740\",\n prop: \"address\",\n minWidth:'400',\n mustShow: false\n },\n {\n label: \"\u516c\u53f8\",\n prop: \"firm\",\n minWidth: '200',\n mustShow: false\n },\n {\n label: \"\u7535\u8bdd\",\n prop: \"tel\",\n minWidth: '200',\n mustShow: false\n },\n {\n label: \"\u90ae\u7bb1\",\n prop: \"email\",\n minWidth: '200',\n mustShow: false\n },\n {\n label: \"\u90ae\u7f16\",\n prop: \"zip\",\n minWidth: '200',\n mustShow: false\n },\n {\n label: \"\u5907\u6ce8\",\n prop: \"note\",\n \n mustShow: false\n },\n {\n label: \"\u5176\u4ed6\",\n prop: \"other\",\n \n mustShow: false\n },\n {\n label: \"\u64cd\u4f5c\",\n prop: \"handle\",\n width: 200,\n render: () => {\n return <span><Button type=\"text\" size=\"small\">\u67e5\u770b</Button><Button type=\"text\" size=\"small\">\u7f16\u8f91</Button></span>\n },\n fixed:'right',\n mustShow: true\n }\n ],\n data: [{\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u82cf\u5dde\u5e02',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n firm:'iShow UI',\n tel:'13155556666',\n email:'[email protected]',\n zip: 200333,\n note:'\u65e0',\n other:'\u6682\u65e0'\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u65e0\u9521\u5e02',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n firm:'iShow UI',\n tel:'13155556666',\n email: '[email protected]',\n zip: 200333,\n note:'\u65e0',\n other:'\u6682\u65e0'\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5e38\u5dde\u5e02',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n firm:'iShow UI',\n tel:'13155556666',\n email: '[email protected]',\n zip: 200333,\n note:'\u65e0',\n other:'\u6682\u65e0'\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u5357\u4eac\u5e02',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n firm:'iShow UI',\n tel:'13155556666',\n email:'[email protected]',\n zip: 200333,\n note:'\u65e0',\n other:'\u6682\u65e0'\n }, {\n date: '2018-03-02',\n name: 'iShow UI -- Yuri',\n province: '\u6c5f\u82cf',\n city: '\u626c\u5dde\u5e02',\n address: '\u5357\u4eac\u5e02\u7384\u6b66\u533a\u8f6f\u4ef6\u5927\u9053XX\u5927\u53a6',\n firm:'iShow UI',\n tel:'13155556666',\n email:'[email protected]',\n zip: 200333,\n note:'\u65e0',\n other:'\u6682\u65e0'\n }],\n checkedList:[\"\u65e5\u671f\",\"\u59d3\u540d\",\"\u7701\u4efd\",\"\u5730\u5740\",\"\u90ae\u7f16\",\"\u64cd\u4f5c\"],//\u521d\u59cb\u5316\u9ed8\u8ba4\u88ab\u9009\u4e2d\u7684\u5217\n checkAll: false,\n isIndeterminate: true,\n klass: '',\n switchValue: false\n }\n }\n\n handleCheckboxChange(value){\n const checkedCount = value.length;\n const columnsLength = this.state.columns.length;\n\n this.setState({\n checkedList:value,//\u8bbe\u7f6e\u5f53\u524d\u9009\u4e2d\u7684\u9879\n // \u4e0b\u9762\u7528\u6765\u8bbe\u7f6e\u63a7\u5236\u5f53\u524d\u662f\u5426\u4e3a\u5168\u9009\u72b6\u6001\n checkAll: checkedCount === columnsLength,\n isIndeterminate: checkedCount > 0 && checkedCount < columnsLength,\n })\n }\n\n handleCheckAllChange(checked) {\n const checkedList = checked ? this.state.columns.map((item)=>item.label) : [];\n\n this.setState({\n isIndeterminate: false,\n checkAll: checked,\n checkedList: checkedList,\n });\n }\n\n handleSwitchChange(value) {\n this.setState({ switchValue: value })\n if (value) {\n this.setState({ klass: 'table-smallSize' })\n } else {\n this.setState({ klass: '' })\n }\n }\n\n render(){\n return(\n <div>\n <div style={{ marginBottom: 20 }}>\n <span style={{ fontSize:16,marginRight: 10 }}>\u7f29\u653e</span>\n <Switch value={this.state.switchValue} onText=\"on\" offText=\"off\" onChange={this.handleSwitchChange.bind(this)}></Switch>\n </div>\n <Checkbox\n checked={this.state.checkAll}\n indeterminate={this.state.isIndeterminate}\n onChange={this.handleCheckAllChange.bind(this)}\n style={{display:\"inlineBlock\"}}>\u5168\u9009</Checkbox>\n <Checkbox.Group value={this.state.checkedList} style={{ marginBottom: 20, display: \"inline-block\",marginLeft:10 }} onChange={this.handleCheckboxChange.bind(this)}>\n {this.state.columns.map((item,index)=>{\n return <Checkbox checked={this.state.checkedList.indexOf(item.label) !== -1} label={item.label} key={Math.random()}></Checkbox>\n })}\n </Checkbox.Group>\n <Table\n style={{ width: '100%' }}\n columns={this.state.columns.filter(\n (item)=>{return this.state.checkedList.indexOf(item.label) !== -1}\n )}\n data={this.state.data}\n border={true}\n className={this.state.klass}\n />\n </div>\n )\n }\n }\n\n export default App\n "]},Cascader:{Code:["\n import React, { Component } from 'react';\n import Cascader from \"../../ishow/Cascader\";\n\n class App extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n options: [{\n value: 'zhoubian',\n label: '\u5357\u4eac\u5468\u8fb9\u65c5\u6e38',\n children: [{\n value: 'antianshufen',\n label: '\u6309\u5929\u6570\u5206',\n children: [{\n value: 'yitian',\n label: '\u4e00\u5929'\n }, {\n value: 'liangtian',\n label: '\u4e24\u5929'\n }, {\n value: 'santian',\n label: '\u4e09\u5929'\n }]\n }, {\n value: 'taqing',\n label: '\u8e0f\u9752\u8d4f\u82b1',\n children: [{\n value: 'wuxi',\n label: '\u65e0\u9521'\n }, {\n value: 'yangzhou',\n label: '\u626c\u5dde'\n }]\n }]\n }, {\n value: 'guonei',\n label: '\u56fd\u5185\u65c5\u6e38',\n children: [{\n value: 'hainan',\n label: '\u6d77\u5357',\n children: [{\n value: 'sanya',\n label: '\u4e09\u4e9a'\n }, {\n value: 'haikou',\n label: '\u6d77\u53e3'\n }, {\n value: 'yalongwan',\n label: '\u4e9a\u9f99\u6e7e'\n }, {\n value: 'tianyahaijiao',\n label: '\u5929\u6daf\u6d77\u89d2'\n }]\n }, {\n value: 'yunnan',\n label: '\u4e91\u5357',\n children: [{\n value: 'dali',\n label: '\u5927\u7406'\n }, {\n value: 'lijiang',\n label: '\u4e3d\u6c5f'\n }, {\n value: 'kunming',\n label: '\u6606\u660e'\n }, {\n value: 'yuxi',\n label: '\u7389\u6eaa'\n }]\n }, {\n value: 'neimeng',\n label: '\u5185\u8499\u53e4',\n children: [{\n value: 'chifeng',\n label: '\u8d64\u5cf0'\n }, {\n value: 'huhe',\n label: '\u547c\u548c\u6d69\u7279'\n }, {\n value: 'baotou',\n label: '\u5305\u5934'\n }, {\n value: 'erdos',\n label: '\u9102\u5c14\u591a\u65af'\n }]\n }]\n }, {\n value: 'oumei',\n label: '\u6b27\u7f8e',\n children: [{\n value: 'ruishi',\n label: '\u745e\u58eb'\n }, {\n value: 'faguo',\n label: '\u6cd5\u56fd'\n }, {\n value: 'meiguo',\n label: '\u7f8e\u56fd'\n }]\n }],\n selectedOptions: [],\n selectedOptions2: []\n }\n }\n\n handleChange(key, value) {\n this.setState({ [key]: value });\n }\n\n render(){\n return (\n <div>\n <div className=\"block\">\n <span className=\"demonstration\" style={{display:'block'}}>\u9ed8\u8ba4 click \u89e6\u53d1\u5b50\u83dc\u5355</span>\n <Cascader\n options={this.state.options}\n value={this.state.selectedOptions}\n onChange={this.handleChange.bind(this, 'selectedOptions')} />\n </div>\n <div className=\"block\">\n <span className=\"demonstration\" style={{ display: 'block' }}>hover \u89e6\u53d1\u5b50\u83dc\u5355</span>\n <Cascader\n options={this.state.options}\n expandTrigger=\"hover\"\n value={this.state.selectedOptions2}\n onChange={this.handleChange.bind(this, 'selectedOptions2')} />\n </div>\n </div>\n )\n }\n }\n\n export default App\n ","\n import React, { Component } from 'react';\n import Cascader from \"../../ishow/Cascader\";\n\n class App extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n optionsWithDisabled: [{\n value: 'zhoubian',\n label: '\u5357\u4eac\u5468\u8fb9\u65c5\u6e38',\n disabled: true,\n children: [{\n value: 'antianshufen',\n label: '\u6309\u5929\u6570\u5206',\n children: [{\n value: 'yitian',\n label: '\u4e00\u5929'\n }, {\n value: 'liangtian',\n label: '\u4e24\u5929'\n }, {\n value: 'santian',\n label: '\u4e09\u5929'\n }]\n }, {\n value: 'taqing',\n label: '\u8e0f\u9752\u8d4f\u82b1',\n children: [{\n value: 'wuxi',\n label: '\u65e0\u9521'\n }, {\n value: 'yangzhou',\n label: '\u626c\u5dde'\n }]\n }]\n }, {\n value: 'guonei',\n label: '\u56fd\u5185\u65c5\u6e38',\n children: [{\n value: 'hainan',\n label: '\u6d77\u5357',\n children: [{\n value: 'sanya',\n label: '\u4e09\u4e9a'\n }, {\n value: 'haikou',\n label: '\u6d77\u53e3'\n }, {\n value: 'yalongwan',\n label: '\u4e9a\u9f99\u6e7e'\n }, {\n value: 'tianyahaijiao',\n label: '\u5929\u6daf\u6d77\u89d2'\n }]\n }, {\n value: 'yunnan',\n label: '\u4e91\u5357',\n children: [{\n value: 'dali',\n label: '\u5927\u7406'\n }, {\n value: 'lijiang',\n label: '\u4e3d\u6c5f'\n }, {\n value: 'kunming',\n label: '\u6606\u660e'\n }, {\n value: 'yuxi',\n label: '\u7389\u6eaa'\n }]\n }, {\n value: 'neimeng',\n label: '\u5185\u8499\u53e4',\n children: [{\n value: 'chifeng',\n label: '\u8d64\u5cf0'\n }, {\n value: 'huhe',\n label: '\u547c\u548c\u6d69\u7279'\n }, {\n value: 'baotou',\n label: '\u5305\u5934'\n }, {\n value: 'erdos',\n label: '\u9102\u5c14\u591a\u65af'\n }]\n }]\n }, {\n value: 'oumei',\n label: '\u6b27\u7f8e',\n children: [{\n value: 'ruishi',\n label: '\u745e\u58eb'\n }, {\n value: 'faguo',\n label: '\u6cd5\u56fd'\n }, {\n value: 'meiguo',\n label: '\u7f8e\u56fd'\n }]\n }],\n selectedOptions: [],\n selectedOptions2: []\n }\n }\n\n handleChange(key, value) {\n this.setState({ [key]: value });\n }\n\n render(){\n return (\n <div>\n <Cascader\n options={this.state.optionsWithDisabled}\n />\n </div>\n )\n }\n }\n\n export default App\n ","\n import React, { Component } from 'react';\n import Cascader from \"../../ishow/Cascader\";\n\n class App extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n options: [{\n value: 'zhoubian',\n label: '\u5357\u4eac\u5468\u8fb9\u65c5\u6e38',\n children: [{\n value: 'antianshufen',\n label: '\u6309\u5929\u6570\u5206',\n children: [{\n value: 'yitian',\n label: '\u4e00\u5929'\n }, {\n value: 'liangtian',\n label: '\u4e24\u5929'\n }, {\n value: 'santian',\n label: '\u4e09\u5929'\n }]\n }, {\n value: 'taqing',\n label: '\u8e0f\u9752\u8d4f\u82b1',\n children: [{\n value: 'wuxi',\n label: '\u65e0\u9521'\n }, {\n value: 'yangzhou',\n label: '\u626c\u5dde'\n }]\n }]\n }, {\n value: 'guonei',\n label: '\u56fd\u5185\u65c5\u6e38',\n children: [{\n value: 'hainan',\n label: '\u6d77\u5357',\n children: [{\n value: 'sanya',\n label: '\u4e09\u4e9a'\n }, {\n value: 'haikou',\n label: '\u6d77\u53e3'\n }, {\n value: 'yalongwan',\n label: '\u4e9a\u9f99\u6e7e'\n }, {\n value: 'tianyahaijiao',\n label: '\u5929\u6daf\u6d77\u89d2'\n }]\n }, {\n value: 'yunnan',\n label: '\u4e91\u5357',\n children: [{\n value: 'dali',\n label: '\u5927\u7406'\n }, {\n value: 'lijiang',\n label: '\u4e3d\u6c5f'\n }, {\n value: 'kunming',\n label: '\u6606\u660e'\n }, {\n value: 'yuxi',\n label: '\u7389\u6eaa'\n }]\n }, {\n value: 'neimeng',\n label: '\u5185\u8499\u53e4',\n children: [{\n value: 'chifeng',\n label: '\u8d64\u5cf0'\n }, {\n value: 'huhe',\n label: '\u547c\u548c\u6d69\u7279'\n }, {\n value: 'baotou',\n label: '\u5305\u5934'\n }, {\n value: 'erdos',\n label: '\u9102\u5c14\u591a\u65af'\n }]\n }]\n }, {\n value: 'oumei',\n label: '\u6b27\u7f8e',\n children: [{\n value: 'ruishi',\n label: '\u745e\u58eb'\n }, {\n value: 'faguo',\n label: '\u6cd5\u56fd'\n }, {\n value: 'meiguo',\n label: '\u7f8e\u56fd'\n }]\n }],\n selectedOptions: [],\n selectedOptions2: []\n }\n }\n\n handleChange(key, value) {\n this.setState({ [key]: value });\n }\n\n render(){\n return (\n <div>\n <Cascader\n options={this.state.options}\n showAllLevels={false}\n />\n </div>\n )\n }\n }\n\n export default App\n ","\n import React, { Component } from 'react';\n import Cascader from \"../../ishow/Cascader\";\n\n class App extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n options: [{\n value: 'zhoubian',\n label: '\u5357\u4eac\u5468\u8fb9\u65c5\u6e38',\n children: [{\n value: 'antianshufen',\n label: '\u6309\u5929\u6570\u5206',\n children: [{\n value: 'yitian',\n label: '\u4e00\u5929'\n }, {\n value: 'liangtian',\n label: '\u4e24\u5929'\n }, {\n value: 'santian',\n label: '\u4e09\u5929'\n }]\n }, {\n value: 'taqing',\n label: '\u8e0f\u9752\u8d4f\u82b1',\n children: [{\n value: 'wuxi',\n label: '\u65e0\u9521'\n }, {\n value: 'yangzhou',\n label: '\u626c\u5dde'\n }]\n }]\n }, {\n value: 'guonei',\n label: '\u56fd\u5185\u65c5\u6e38',\n children: [{\n value: 'hainan',\n label: '\u6d77\u5357',\n children: [{\n value: 'sanya',\n label: '\u4e09\u4e9a'\n }, {\n value: 'haikou',\n label: '\u6d77\u53e3'\n }, {\n value: 'yalongwan',\n label: '\u4e9a\u9f99\u6e7e'\n }, {\n value: 'tianyahaijiao',\n label: '\u5929\u6daf\u6d77\u89d2'\n }]\n }, {\n value: 'yunnan',\n label: '\u4e91\u5357',\n children: [{\n value: 'dali',\n label: '\u5927\u7406'\n }, {\n value: 'lijiang',\n label: '\u4e3d\u6c5f'\n }, {\n value: 'kunming',\n label: '\u6606\u660e'\n }, {\n value: 'yuxi',\n label: '\u7389\u6eaa'\n }]\n }, {\n value: 'neimeng',\n label: '\u5185\u8499\u53e4',\n children: [{\n value: 'chifeng',\n label: '\u8d64\u5cf0'\n }, {\n value: 'huhe',\n label: '\u547c\u548c\u6d69\u7279'\n }, {\n value: 'baotou',\n label: '\u5305\u5934'\n }, {\n value: 'erdos',\n label: '\u9102\u5c14\u591a\u65af'\n }]\n }]\n }, {\n value: 'oumei',\n label: '\u6b27\u7f8e',\n children: [{\n value: 'ruishi',\n label: '\u745e\u58eb'\n }, {\n value: 'faguo',\n label: '\u6cd5\u56fd'\n }, {\n value: 'meiguo',\n label: '\u7f8e\u56fd'\n }]\n }],\n selectedOptions: [],\n selectedOptions2: [],\n selectedOptions3: ['oumei', 'ruishi', ]\n }\n }\n\n handleChange(key, value) {\n this.setState({ [key]: value });\n }\n\n render(){\n return (\n <div>\n <Cascader\n options={this.state.options}\n value={this.state.selectedOptions3}\n />\n </div>\n )\n }\n }\n\n export default App\n ","\n import React, { Component } from 'react';\n import Cascader from \"../../ishow/Cascader\";\n\n class App extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n options: [{\n value: 'zhoubian',\n label: '\u5357\u4eac\u5468\u8fb9\u65c5\u6e38',\n children: [{\n value: 'antianshufen',\n label: '\u6309\u5929\u6570\u5206',\n children: [{\n value: 'yitian',\n label: '\u4e00\u5929'\n }, {\n value: 'liangtian',\n label: '\u4e24\u5929'\n }, {\n value: 'santian',\n label: '\u4e09\u5929'\n }]\n }, {\n value: 'taqing',\n label: '\u8e0f\u9752\u8d4f\u82b1',\n children: [{\n value: 'wuxi',\n label: '\u65e0\u9521'\n }, {\n value: 'yangzhou',\n label: '\u626c\u5dde'\n }]\n }]\n }, {\n value: 'guonei',\n label: '\u56fd\u5185\u65c5\u6e38',\n children: [{\n value: 'hainan',\n label: '\u6d77\u5357',\n children: [{\n value: 'sanya',\n label: '\u4e09\u4e9a'\n }, {\n value: 'haikou',\n label: '\u6d77\u53e3'\n }, {\n value: 'yalongwan',\n label: '\u4e9a\u9f99\u6e7e'\n }, {\n value: 'tianyahaijiao',\n label: '\u5929\u6daf\u6d77\u89d2'\n }]\n }, {\n value: 'yunnan',\n label: '\u4e91\u5357',\n children: [{\n value: 'dali',\n label: '\u5927\u7406'\n }, {\n value: 'lijiang',\n label: '\u4e3d\u6c5f'\n }, {\n value: 'kunming',\n label: '\u6606\u660e'\n }, {\n value: 'yuxi',\n label: '\u7389\u6eaa'\n }]\n }, {\n value: 'neimeng',\n label: '\u5185\u8499\u53e4',\n children: [{\n value: 'chifeng',\n label: '\u8d64\u5cf0'\n }, {\n value: 'huhe',\n label: '\u547c\u548c\u6d69\u7279'\n }, {\n value: 'baotou',\n label: '\u5305\u5934'\n }, {\n value: 'erdos',\n label: '\u9102\u5c14\u591a\u65af'\n }]\n }]\n }, {\n value: 'oumei',\n label: '\u6b27\u7f8e',\n children: [{\n value: 'ruishi',\n label: '\u745e\u58eb'\n }, {\n value: 'faguo',\n label: '\u6cd5\u56fd'\n }, {\n value: 'meiguo',\n label: '\u7f8e\u56fd'\n }]\n }]\n }\n }\n\n render(){\n return (\n <div>\n <Cascader\n options={this.state.options}\n changeOnSelect={true}\n />\n </div>\n )\n }\n }\n\n export default App\n ","\n import React, { Component } from 'react';\n import Cascader from \"../../ishow/Cascader\";\n\n class App extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n options2: [{\n label: '\u6c5f\u82cf',\n cities: []\n }, {\n label: '\u6d59\u6c5f',\n cities: []\n }],\n props: {\n value: 'label',\n children: 'cities'\n }\n }\n }\n\n handleItemChange(val) {\n console.log('active item:', val);\n\n setTimeout(() => {\n if (val.indexOf('\u6c5f\u82cf') > -1 && !this.state.options2[0].cities.length) {\n this.state.options2[0].cities = [{\n label: '\u5357\u4eac'\n }];\n } else if (val.indexOf('\u6d59\u6c5f') > -1 && !this.state.options2[1].cities.length) {\n this.state.options2[1].cities = [{\n label: '\u676d\u5dde'\n }];\n }\n\n this.forceUpdate();\n }, 300);\n }\n\n render(){\n return (\n <div>\n <Cascader\n props={this.state.props}\n options={this.state.options2}\n activeItemChange={this.handleItemChange.bind(this)}\n />\n </div>\n )\n }\n }\n\n export default App\n ","\n import React, { Component } from 'react';\n import Cascader from \"../../ishow/Cascader\";\n\n class App extends Component {\n constructor(props) {\n super(props);\n\n this.state = {\n options: [{\n value: 'zhoubian',\n label: '\u5357\u4eac\u5468\u8fb9\u65c5\u6e38',\n children: [{\n value: 'antianshufen',\n label: '\u6309\u5929\u6570\u5206',\n children: [{\n value: 'yitian',\n label: '\u4e00\u5929'\n }, {\n value: 'liangtian',\n label: '\u4e24\u5929'\n }, {\n value: 'santian',\n label: '\u4e09\u5929'\n }]\n }, {\n value: 'taqing',\n label: '\u8e0f\u9752\u8d4f\u82b1',\n children: [{\n value: 'wuxi',\n label: '\u65e0\u9521'\n }, {\n value: 'yangzhou',\n label: '\u626c\u5dde'\n }]\n }]\n }, {\n value: 'guonei',\n label: '\u56fd\u5185\u65c5\u6e38',\n children: [{\n value: 'hainan',\n label: '\u6d77\u5357',\n children: [{\n value: 'sanya',\n label: '\u4e09\u4e9a'\n }, {\n value: 'haikou',\n label: '\u6d77\u53e3'\n }, {\n value: 'yalongwan',\n label: '\u4e9a\u9f99\u6e7e'\n }, {\n value: 'tianyahaijiao',\n label: '\u5929\u6daf\u6d77\u89d2'\n }]\n }, {\n value: 'yunnan',\n label: '\u4e91\u5357',\n children: [{\n value: 'dali',\n label: '\u5927\u7406'\n }, {\n value: 'lijiang',\n label: '\u4e3d\u6c5f'\n }, {\n value: 'kunming',\n label: '\u6606\u660e'\n }, {\n value: 'yuxi',\n label: '\u7389\u6eaa'\n }]\n }, {\n value: 'neimeng',\n label: '\u5185\u8499\u53e4',\n children: [{\n value: 'chifeng',\n label: '\u8d64\u5cf0'\n }, {\n value: 'huhe',\n label: '\u547c\u548c\u6d69\u7279'\n }, {\n value: 'baotou',\n label: '\u5305\u5934'\n }, {\n value: 'erdos',\n label: '\u9102\u5c14\u591a\u65af'\n }]\n }]\n }\n }\n\n render(){\n return (\n <div>\n <Cascader\n placeholder=\"\u8bd5\u8bd5\u641c\u7d22\uff1a\u4e3d\u6c5f\"\n options={this.state.options}\n filterable={true}\n />\n <Cascader\n placeholder=\"\u8bd5\u8bd5\u641c\u7d22\uff1a\u4e91\u5357\"\n options={this.state.options}\n filterable={true}\n changeOnSelect={true}\n />\n </div>\n )\n }\n }\n\n export default App\n "]},Badge:{Code:['\n import React, { Component } from \'react\';\n import Badge from \'../../ishow/Badge/index\';\n import Button from "../../ishow/Button/index";\n import Dropdown from \'../../ishow/Dropdown/index.js\';\n\n class App extends React.Component {\n render(){\n return(\n <div>\n <Badge value={ 12 } style={{marginRight:40}}>\n <Button size="small">\u8bc4\u8bba</Button>\n </Badge>\n\n <Badge value={ 3 } style={{marginRight:40}}>\n <Button size="small">\u56de\u590d</Button>\n </Badge>\n\n <Dropdown trigger="click" menu={(\n <Dropdown.Menu>\n <Dropdown.Item className="clearfix">\n <span>\u8bc4\u8bba</span><Badge className="mark" value={ 12 } />\n </Dropdown.Item>\n <Dropdown.Item className="clearfix">\n <span>\u56de\u590d</span><Badge className="mark" value={ 3 } />\n </Dropdown.Item>\n </Dropdown.Menu>\n )}\n >\n <span className="ishow-dropdown-link">\u70b9\u6211\u67e5\u770b<i className="ishow-icon-caret-bottom ishow-icon--right"></i></span>\n </Dropdown>\n </div>\n )\n }\n }\n\n export default App\n ','\n import React, { Component } from \'react\';\n import Badge from \'../../ishow/Badge/index\';\n import Button from "../../ishow/Button/index";\n\n class App extends React.Component {\n render(){\n return(\n <div>\n <Badge value={ 200 } max={ 99 } style={{marginRight:40}}>\n <Button size="small">\u8bc4\u8bba</Button>\n </Badge>\n <Badge value={ 100 } max={ 10 }>\n <Button size="small">\u56de\u590d</Button>\n </Badge>\n </div>\n )\n }\n }\n\n export default App\n ',"\n import React, { Component } from 'react';\n import Badge from '../../ishow/Badge/index';\n import Button from \"../../ishow/Button/index\";\n\n class App extends React.Component {\n render(){\n return(\n <div>\n <Badge value={ 'new' } style={{marginRight:40}}>\n <Button size=\"small\">\u8bc4\u8bba</Button>\n </Badge>\n <Badge value={ 'hot' }>\n <Button size=\"small\">\u56de\u590d</Button>\n </Badge>\n </div>\n )\n }\n }\n\n export default App\n ",'\n import React, { Component } from \'react\';\n import Badge from \'../../ishow/Badge/index\';\n import Button from "../../ishow/Button/index";\n\n class App extends React.Component {\n render(){\n return(\n <div>\n <Badge isDot style={{marginRight:40}}>\n \u6570\u636e\u67e5\u8be2\n </Badge>\n <Badge isDot>\n <Button className="share-button" icon="share" type="primary"></Button>\n </Badge>\n </div>\n )\n }\n }\n\n export default App\n ']},QueryCriteriaModule:{Code:["\n import React, { Component } from 'react';\n //\u6309\u9700\u52a0\u8f7d\n import Button from \"../../ishow/Button/index\";\n import Row from '../../ishow/LayoutComponent/row';\n import Col from '../../ishow/LayoutComponent/col';\n import Input from '../../ishow/Input';\n import {DatePicker} from '../../ishow/DatePicker';\n import Select from '../../ishow/Select';\n\n class QueryCriteriaModule extends Component {\n constructor(props){\n super(props);\n this.state = {\n expendCollapse:true,\n paginationVisible:false,\n page: 100,\n pageSize: 10,\n currentPage: 1,\n initDateStart:'',\n initDateEnd:'',\n assignDateStart:'',\n assignDateEnd:'',\n finishDateStart:'',\n finishDateEnd:'',\n addData:[],\n addColumns:[\n {\n label:'\u6295\u8bc9\u4e8b\u5b9c\u8bb0\u5f55',\n subColumns:[\n {\n label:\"\u65e5\u671f\",\n prop:'date'\n },\n {\n label:'\u5185\u5bb9',\n prop:'content'\n },\n {\n label:'\u8be6\u60c5',\n prop:'detail'\n }\n ]\n }\n ],\n options: [{\n value: '\u9009\u98791',\n label: '\u95ee\u98981'\n }, {\n value: '\u9009\u98792',\n label: '\u95ee\u98982'\n }, {\n value: '\u9009\u98793',\n label: '\u95ee\u98983'\n }, {\n value: '\u9009\u98794',\n label: '\u95ee\u98984'\n }, {\n value: '\u9009\u98795',\n label: '\u95ee\u98985'\n }],\n selectValue: ''\n };\n }\n\n toggleExpend(){\n this.setState({expendCollapse:!this.state.expendCollapse})\n }\n\n render() {\n let expendCollapse = this.state.expendCollapse;\n let arrowDirection = expendCollapse ? 'arrow-down' : 'arrow-up';\n let isCollapsePartHidden = expendCollapse ? 'QueryCriteriaModule_CollapsePart':'';\n let ButtonText = expendCollapse ? '\u5c55\u5f00' : '\u6536\u8d77';\n let initDateStart = this.state.initDateStart;\n let initDateEnd = this.state.initDateEnd;\n let assignDateStart = this.state.assignDateStart;\n let assignDateEnd = this.state.assignDateEnd;\n let finishDateStart = this.state.finishDateStart;\n let finishDateEnd = this.state.finishDateEnd;\n //for Collapse\n return (\n <div>\n <div className=\"QueryCriteriaModule\">\n <div>\n <Row className='QueryCriteriaModule_Row' >\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u6295\u8bc9\u5355ID</label><Input className='QueryCriteriaModule_Input'/></Col>\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u8ba2\u5355ID</label><Input className='QueryCriteriaModule_Input'/></Col>\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u7ebf\u8def\u53f7</label><Input className='QueryCriteriaModule_Input'/></Col>\n </Row>\n <Row className='QueryCriteriaModule_Row' >\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u6295\u8bc9\u4eba\u7535\u8bdd</label><Input className='QueryCriteriaModule_Input'/></Col>\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u53d1\u8d77\u4eba</label><Input className='QueryCriteriaModule_Input' append={<Button type=\"primary\" icon=\"search\">\u7531\u6211\u53d1\u8d77</Button>}/></Col>\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u5904\u7406\u4eba</label><Input className='QueryCriteriaModule_Input'/></Col>\n </Row>\n <Row className='QueryCriteriaModule_Row' >\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u5904\u7406\u5c97</label>\n <Select className='QueryCriteriaModule_Input' value={this.state.selectValue}> \n {\n this.state.options.map(el => {\n return <Select.Option key={el.value} label={el.label} value={el.value} />\n })\n }\n </Select>\n </Col>\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u6295\u8bc9\u5355\u72b6\u6001</label>\n <Select className='QueryCriteriaModule_Input' value={this.state.selectValue}>\n {\n this.state.options.map(el => {\n return <Select.Option key={el.value} label={el.label} value={el.value} />\n })\n }\n </Select>\n </Col>\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u4f9b\u5e94\u5546\u540d\u79f0</label><Input className='QueryCriteriaModule_Input'/></Col>\n </Row>\n </div>\n <div className='QueryCriteriaModule_Expend'><Button onClick={this.toggleExpend.bind(this)} className='QueryCriteriaModule_Expend_Button' plain={true} icon={arrowDirection}>{ButtonText}</Button></div>\n <div className={isCollapsePartHidden}>\n <Row className='QueryCriteriaModule_Row'>\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u5ba2\u670d\u7ecf\u7406</label><Input className='QueryCriteriaModule_Input'/></Col>\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u4ea7\u54c1\u7ecf\u7406</label><Input className='QueryCriteriaModule_Input'/></Col>\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u662f\u5426\u4e3a\u8d54\u6b3e\u5355</label>\n <Select className='QueryCriteriaModule_Input' value={this.state.selectValue}> \n {\n this.state.options.map(el => {\n return <Select.Option key={el.value} label={el.label} value={el.value} />\n })\n }\n </Select>\n </Col>\n </Row>\n <Row className='QueryCriteriaModule_Row' >\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u53d1\u8d77\u65f6\u95f4</label>\n {/* <Input className='QueryCriteriaModule_Input'/> */}\n <div className='QueryCriteriaModule_DatePicker'>\n <DatePicker\n // style={{width:'41%',display:'inline'}}\n value={initDateStart}\n isShowTime={true}\n placeholder=\"\u9009\u62e9\u65e5\u671f\"\n format='yyyy-MM-dd HH:mm:ss'\n onChange={date=>{\n console.debug('DatePicker1 changed: ', date)\n this.setState({initDateStart: date})\n }}\n disabledDate={time=>time.getTime() < Date.now() - 8.64e7}\n /><span className='QueryCriteriaModule_rangeSpliter'>\u81f3</span>\n <DatePicker\n // style={{width:'41%',display:'inline'}}\n value={initDateEnd}\n isShowTime={true}\n placeholder=\"\u9009\u62e9\u65e5\u671f\"\n format='yyyy-MM-dd HH:mm:ss'\n onChange={date=>{\n console.debug('DatePicker1 changed: ', date)\n this.setState({initDateEnd: date})\n }}\n disabledDate={time=>time.getTime() < Date.now() - 8.64e7}\n />\n </div>\n </Col>\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u5206\u914d\u65f6\u95f4</label>\n <div className='QueryCriteriaModule_DatePicker'>\n <DatePicker\n // style={{width:'41%',display:'inline'}}\n value={assignDateStart}\n isShowTime={true}\n placeholder=\"\u9009\u62e9\u65e5\u671f\"\n format='yyyy-MM-dd HH:mm:ss'\n onChange={date=>{\n console.debug('DatePicker1 changed: ', date)\n this.setState({assignDateStart: date})\n }}\n disabledDate={time=>time.getTime() < Date.now() - 8.64e7}\n /><span className='QueryCriteriaModule_rangeSpliter'>\u81f3</span>\n <DatePicker\n // style={{width:'41%',display:'inline'}}\n value={assignDateEnd}\n isShowTime={true}\n placeholder=\"\u9009\u62e9\u65e5\u671f\"\n format='yyyy-MM-dd HH:mm:ss'\n onChange={date=>{\n console.debug('DatePicker1 changed: ', date)\n this.setState({assignDateEnd: date})\n }}\n disabledDate={time=>time.getTime() < Date.now() - 8.64e7}\n />\n </div>\n </Col>\n <Col className='QueryCriteriaModule_Col' span={8} ><label>\u5b8c\u6210\u65f6\u95f4</label>\n <div className='QueryCriteriaModule_DatePicker'>\n <DatePicker\n // style={{width:'41%',display:'inline'}}\n value={finishDateStart}\n isShowTime={true}\n placeholder=\"\u9009\u62e9\u65e5\u671f\"\n format='yyyy-MM-dd HH:mm:ss'\n onChange={date=>{\n console.debug('DatePicker1 changed: ', date)\n this.setState({finishDateStart: date})\n }}\n disabledDate={time=>time.getTime() < Date.now() - 8.64e7}\n /><span className='QueryCriteriaModule_rangeSpliter'>\u81f3</span>\n <DatePicker\n // style={{width:'41%',display:'inline'}}\n value={finishDateEnd}\n isShowTime={true}\n placeholder=\"\u9009\u62e9\u65e5\u671f\"\n format='yyyy-MM-dd HH:mm:ss'\n onChange={date=>{\n console.debug('DatePicker1 changed: ', date)\n this.setState({finishDateEnd: date})\n }}\n disabledDate={time=>time.getTime() < Date.now() - 8.64e7}\n />\n </div>\n </Col>\n </Row>\n </div>\n </div>\n <div className='QueryCriteriaModule_Button'>\n <Button type=\"primary\" size=\"large\">\u67e5\u8be2</Button>\n <Button plain={true} type=\"primary\" size=\"large\">\u91cd\u7f6e</Button>\n </div>\n </div>\n );\n }\n }\n\n export default QueryCriteriaModule;\n\n //\u4e0b\u9762\u4e3a\u7ec4\u4ef6\u4e2d\u6d89\u53ca\u7684\u6837\u5f0f\uff0c\u53ef\u590d\u5236\u5230\u6587\u4ef6\u4e2d\u5f15\u7528\n .QueryCriteriaModule {\n margin-top: 20px;\n }\n\n .QueryCriteriaModule_ShowPart {\n position: relative;\n overflow: hidden;\n }\n\n .QueryCriteriaModule .QueryCriteriaModule_Row {\n margin-bottom: 20px;\n }\n\n .QueryCriteriaModule .QueryCriteriaModule_Row>.QueryCriteriaModule_Col {\n text-align: center;\n }\n\n .QueryCriteriaModule_Col>label {\n display: inline-block;\n width: 16%;\n text-align: left;\n vertical-align: middle;\n }\n\n .QueryCriteriaModule_Col>.QueryCriteriaModule_Input {\n width: 70%;\n margin-left: 2%;\n }\n\n .QueryCriteriaModule_Expend {\n border-bottom: 1px dashed #ddd;\n margin: 35px auto;\n position: relative;\n width: 96%;\n }\n\n .QueryCriteriaModule_Expend>.QueryCriteriaModule_Expend_Button {\n position: absolute;\n text-align: center;\n right: 0;\n top: -16px;\n width: 80px;\n display: inline-block;\n margin: 0 auto;\n }\n\n .QueryCriteriaModule_CollapsePart {\n display: none;\n }\n\n .QueryCriteriaModule_Button {\n text-align: center;\n margin: 30px 0;\n }\n\n .QueryCriteriaModule_DatePicker {\n display: inline-block;\n width: 70%;\n margin-left: 10px;\n }\n\n .QueryCriteriaModule_DatePicker .ishow-date-editor.ishow-input {\n width: auto !important;\n }\n\n .QueryCriteriaModule_DatePicker .ishow-date-editor {\n width: 45%;\n }\n\n .QueryCriteriaModule_rangeSpliter {\n display: inline-block;\n width: 10%;\n }\n "]},CopyUrlAndRefresh:{Code:["\n import React from 'react';\n import './App.css';\n import MessageBox from '../../ishow/MessageBox/index';\n import IconPlus from '../../ishow/LayoutComponent/icon/index';\n\n export default class App extends React.Component {\n \n //\u590d\u5236\u7f51\u5740\u5230\u526a\u5207\u677f ===start\n fallbackCopyTextToClipboard = (text)=> {\n var textArea = document.createElement(\"textarea\");\n textArea.value = text;\n document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n \n try {\n var successful = document.execCommand('copy');\n var msg = successful ? 'successful' : 'unsuccessful';\n console.log('Fallback: Copying text command was ' + msg);\n } catch (err) {\n console.error('Fallback: Oops, unable to copy', err);\n }\n \n document.body.removeChild(textArea);\n }\n //\u53c2\u6570text\u4e3a\u8981\u590d\u5236\u5230\u526a\u5207\u677f\u7684\u5185\u5bb9\uff0c\u6b64\u5904\u4e3a\u5f53\u524d\u9875\u7684URL\u5730\u5740\n copyTextToClipboard = (text)=> {\n if (!navigator.clipboard) {\n this.fallbackCopyTextToClipboard(text);\n return;\n }\n navigator.clipboard.writeText(text).then(()=> {\n MessageBox.msgbox({\n message:'URL\u6210\u529f\u590d\u5236\u5230\u526a\u5207\u677f',\n type:\"success\"\n })\n }, (err)=> {\n console.error('Async: Could not copy text: ', err);\n });\n }\n //\u590d\u5236\u7f51\u5740\u5230\u526a\u5207\u677f === end\n\n render(){\n return (\n <div>\n <span style={{cursor:'pointer'}}>\n <IconPlus type=\"reload\" title=\"\u5237\u65b0\" onClick={()=>window.location.reload()}/> <IconPlus type=\"copy\" title=\"\u590d\u5236url\" onClick={()=>this.copyTextToClipboard(window.location.href)}/>\n </span> \n </div>\n )\n }\n }\n "]},GoogleMap:{Code:['\n /**\n * \u4f7f\u7528\u8c37\u6b4c\u5730\u56fe\u524d\u9700\u8981\u5728\u5f15\u5165\u5730\u56fe\u7684jssdk\n * <script type="text/javascript" src="http://ditu.google.cn/maps/api/js?v=3&sensor=false&key=\u4f60\u7684\u8c37\u6b4c\u5730\u56feAPI_KEY&hl=zh-CN"><\/script>\n */\n // react \u4e2d\u4f7f\u7528\n import React from "react";\n import \'./App.css\'\n \n let map ;\n class App extends React.Component{\n constructor(props){\n super(props);\n this.state = {\n \n };\n }\n\n componentDidMount(){\n if(!map) this.__initMap();\n }\n\n componentWillUnmount(){\n map = null;\n }\n\n // \u521d\u59cb\u5316\u5730\u56fe\n __initMap(){\n // \u521d\u59cb\u5316\u5730\u56fe \u5730\u56fe\u4e2d\u5fc3\u70b9\u5750\u6807\u4e0e\u6bd4\u4f8b\u5c3a\u5927\u5c0f\u5fc5\u586b\n map = new window.google.maps.Map(this.refs.map, {\n center: { lat: 32.07226, lng: 118.79357 }, //\u4ee5\u5357\u4eac\u7684\u5750\u6807\u4e3a\u6f14\u793a\n zoom: 13,\n mapTypeId:window.google.maps.MapTypeId.ROADMAP\n });\n this.__renderMarker();\n }\n\n // \u57fa\u7840\u6253\u70b9\u5e76\u521b\u5efa\u4e00\u4e2a\u70b9\u51fb\u6253\u5f00\u5f39\u7a97\n __renderMarker(){\n var marker2= new window.google.maps.Marker({labelContent: "\u8fd9\u662f\u7384\u6b66\u6e56", position:{lat:32.07226,lng: 118.79357},map:map});\n var iw3 = new window.google.maps.InfoWindow({\n content: "\u8fd9\u662f\u7384\u6b66\u6e56"\n });\n iw3.open(map, marker2);\n // \u4e3a\u6807\u8bb0\u70b9\u6dfb\u52a0\u70b9\u51fb\u6253\u5f00\u5f39\u7a97\u4e8b\u4ef6\n window.google.maps.event.addListener(marker2, "click", (e)=> { iw3.open(map, marker2); });\n }\n\n render(){\n return (\n <div>\n <div id=\'map\' ref=\'map\' style={{width: \'100%\',height:\'540px\'}}></div>\n </div>\n )\n }\n }\n\n export default App;\n\n ','\n // \u666e\u901a\u9875\u9762\u4e2d\u4f7f\u7528\n var map;\n // \u521d\u59cb\u5316\u5730\u56fe \u5730\u56fe\u4e2d\u5fc3\u70b9\u5750\u6807\u4e0e\u6bd4\u4f8b\u5c3a\u5927\u5c0f\u5fc5\u586b\n function initMap() {\n map = new window.google.maps.Map(document.getElementById(\'map\'), {\n center: { lat: 32.07226, lng: 118.79357 }, //\u4ee5\u5357\u4eac\u7684\u5750\u6807\u4e3a\u6f14\u793a\n zoom: 13,\n mapTypeId:window.google.maps.MapTypeId.ROADMAP\n });\n renderMarker();\n }\n\n // \u57fa\u7840\u6253\u70b9\u5e76\u521b\u5efa\u4e00\u4e2a\u70b9\u51fb\u6253\u5f00\u5f39\u7a97\n function renderMarker(){\n var marker2= new window.google.maps.Marker({labelContent: "\u8fd9\u662f\u7384\u6b66\u6e56", position:{lat:32.07226,lng: 118.79357},map:map});\n var iw3 = new window.google.maps.InfoWindow({\n content: "\u8fd9\u662f\u7384\u6b66\u6e56"\n });\n iw3.open(map, marker2);\n // \u4e3a\u6807\u8bb0\u70b9\u6dfb\u52a0\u70b9\u51fb\u6253\u5f00\u5f39\u7a97\u4e8b\u4ef6\n window.google.maps.event.addListener(marker2, "click", (e)=> { iw3.open(map, marker2); });\n }\n\n initMap();\n ',"\n // react\u4e2d\u4f7f\u7528\n import React from \"react\";\n import './App.css'\n \n let map ;\n \n // \u81ea\u5b9a\u4e49\u7a97\u53e3\u6807\u7b7e\u7c7b \n class Popup extends window.google.maps.OverlayView{\n constructor(position,content1){\n super();\n this.position = position;\n let content=document.createElement('div');\n content.innerHTML=\"<b>\"+content1+\"</b>\";\n \n content.classList.add('popup-bubble-content');\n \n var pixelOffset = document.createElement('div');\n pixelOffset.classList.add('popup-bubble-anchor');\n pixelOffset.appendChild(content);\n \n this.anchor = document.createElement('div');\n this.anchor.classList.add('popup-tip-anchor');\n this.anchor.appendChild(pixelOffset);\n this.stopEventPropagation();\n }\n \n // \u6302\u5728\u5230\u5730\u56fe\u65f6\u8c03\u7528\n onAdd(){\n this.getPanes().floatPane.appendChild(this.anchor);\n };\n \n // \u4ece\u5730\u56fe\u79fb\u9664\u65f6\u8c03\u7528\n onRemove(){\n if (this.anchor.parentElement) {\n this.anchor.parentElement.removeChild(this.anchor);\n }\n };\n \n // \u7ed8\u5236\u65b9\u6cd5\n draw(){\n var divPosition = this.getProjection().fromLatLngToDivPixel(this.position);\n // \u89c6\u56fe\u5916\u65f6\u81ea\u52a8\u9690\u85cf\n var display =\n Math.abs(divPosition.x) < 4000 && Math.abs(divPosition.y) < 4000 ?\n 'block' :\n 'none';\n \n if (display === 'block') {\n this.anchor.style.left = divPosition.x + 'px';\n this.anchor.style.top = divPosition.y + 'px';\n }\n if (this.anchor.style.display !== display) {\n this.anchor.style.display = display;\n }\n };\n \n // \u963b\u6b62\u4e8b\u4ef6\u4f20\u64ad\n stopEventPropagation(){\n var anchor = this.anchor;\n anchor.style.cursor = 'auto';\n \n ['click', 'dblclick', 'contextmenu', 'wheel', 'mousedown', 'touchstart',\n 'pointerdown']\n .forEach(function(event) {\n anchor.addEventListener(event, function(e) {\n e.stopPropagation();\n });\n });\n };\n \n }\n \n class App extends React.Component{\n constructor(props){\n super(props);\n this.state = {\n \n };\n }\n \n componentDidMount(){\n if(!map) this.__initMap();\n }\n\n componentWillUnmount(){\n map = null;\n }\n \n // \u521d\u59cb\u5316\u5730\u56fe\n __initMap(){\n \n // \u521d\u59cb\u5316\u5730\u56fe ,\u7531\u4e8e\u793a\u4f8b\u4e2d\u5730\u56fejs\u6587\u4ef6\u662f\u5168\u5c40\u5f15\u5165\u7684\uff0c\u6240\u4ee5googlemap\u7684api\u662f\u5728window\u4e0b\n map = new window.google.maps.Map(this.refs.map, {\n center: {lat: 32.07226, lng: 118.78173},\n zoom: 10,\n mapTypeId:window.google.maps.MapTypeId.ROADMAP\n });\n\n // \u521b\u5efa\u4e24\u4e2a\u81ea\u5b9a\u4e49\u5f39\u51fa\u7a97\u53e3\uff0c\u4f20\u5165\u5750\u6807\u4e0e\u5c55\u793a\u6587\u5b57\n new Popup(new window.google.maps.LatLng(32.01923,118.78972),\"\u57ce\u5e021\").setMap(map);\n new Popup(new window.google.maps.LatLng(32.05911,118.78173),\"\u57ce\u5e022\").setMap(map);\n }\n \n render(){\n return (\n <div>\n <div id='map' ref='map' style={{width: '100%',height:'540px'}}></div>\n </div>\n )\n }\n }\n \n export default App;\n ","\n // \u666e\u901a\u9875\u9762\u4e2d\u4f7f\u7528\n <style>\n .popup-tip-anchor {\n height: 0;\n position: absolute;\n /* The max width of the info window. */\n width: 200px;\n }\n \n .popup-bubble-anchor {\n position: absolute;\n width: 100%;\n bottom: /* TIP_HEIGHT= */ 8px;\n left: 0;\n }\n \n .popup-bubble-anchor::after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n /* Center the tip horizontally. */\n transform: translate(-50%, 0);\n /* The tip is a https://css-tricks.com/snippets/css/css-triangle/ */\n width: 0;\n height: 0;\n /* The tip is 8px high, and 12px wide. */\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-top: /* TIP_HEIGHT= */ 8px solid white;\n }\n \n .popup-bubble-content {\n position: absolute;\n top: 0;\n left: 0;\n transform: translate(-50%, -100%);\n /* Style the info window. */\n background-color: white;\n padding: 5px;\n border-radius: 5px;\n font-family: sans-serif;\n overflow-y: auto;\n max-height: 60px;\n box-shadow: 0px 2px 10px 1px rgba(0,0,0,0.5);\n }\n </style>\n\n var map;\n // \u521d\u59cb\u5316\u5730\u56fe\n function initMap() {\n definePopupClass();\n \n map = new google.maps.Map(document.getElementById('map'), {\n center: {lat: 32.07226, lng: 118.78173},\n zoom: 10,\n });\n \n new Popup(new google.maps.LatLng(32.01923,118.78972),\"\u57ce\u5e021\").setMap(map);\n new Popup(new google.maps.LatLng(32.05911,118.78173),\"\u57ce\u5e022\").setMap(map);\n \n }\n \n // \u5b9a\u4e49\u7a97\u53e3\u7c7b\n function definePopupClass() {\n /**\n * @param {!google.maps.LatLng} position\n * @param {!Element} content1\n * @constructor\n * @extends {google.maps.OverlayView}\n */\n Popup = function(position, content1) {\n this.position = position;\n let content=document.createElement('div');\n content.innerHTML=\"<b>\"+content1+\"</b>\";\n \n content.classList.add('popup-bubble-content');\n \n var pixelOffset = document.createElement('div');\n pixelOffset.classList.add('popup-bubble-anchor');\n pixelOffset.appendChild(content);\n \n this.anchor = document.createElement('div');\n this.anchor.classList.add('popup-tip-anchor');\n this.anchor.appendChild(pixelOffset);\n \n this.stopEventPropagation();\n };\n\n Popup.prototype = Object.create(google.maps.OverlayView.prototype);\n \n // \u6302\u8f7d\u65f6\u8c03\u7528\n Popup.prototype.onAdd = function() {\n this.getPanes().floatPane.appendChild(this.anchor);\n };\n \n // \u4ece\u5730\u56fe\u79fb\u9664\u65f6\u8c03\u7528\n Popup.prototype.onRemove = function() {\n if (this.anchor.parentElement) {\n this.anchor.parentElement.removeChild(this.anchor);\n }\n };\n \n // \u7ed8\u5236\u65b9\u6cd5\n Popup.prototype.draw = function() {\n var divPosition = this.getProjection().fromLatLngToDivPixel(this.position);\n // Hide the popup when it is far out of view.\n var display =\n Math.abs(divPosition.x) < 4000 && Math.abs(divPosition.y) < 4000 ?\n 'block' :\n 'none';\n \n if (display === 'block') {\n this.anchor.style.left = divPosition.x + 'px';\n this.anchor.style.top = divPosition.y + 'px';\n }\n if (this.anchor.style.display !== display) {\n this.anchor.style.display = display;\n }\n };\n \n // \u963b\u6b62\u4e8b\u4ef6\u4f20\u9012\n Popup.prototype.stopEventPropagation = function() {\n var anchor = this.anchor;\n anchor.style.cursor = 'auto';\n \n ['click', 'dblclick', 'contextmenu', 'wheel', 'mousedown', 'touchstart',\n 'pointerdown']\n .forEach(function(event) {\n anchor.addEventListener(event, function(e) {\n e.stopPropagation();\n });\n });\n };\n }\n \n initMap();\n "]},GoogleMapDrawing:{Code:['\n // react \u4e2d\u4f7f\u7528\n import React from "react";\n \n let map;\n class App extends React.Component{\n constructor(props){\n super(props);\n this.state = {\n };\n }\n \n componentDidMount(){\n if(!map) this.__initMap();\n }\n \n componentWillUnmount(){\n map = null;\n }\n \n // \u521d\u59cb\u5316\u5730\u56fe\n __initMap(){\n // \u521d\u59cb\u5316\u5730\u56fe ,\u7531\u4e8e\u793a\u4f8b\u4e2d\u5730\u56fejs\u6587\u4ef6\u662f\u5168\u5c40\u5f15\u5165\u7684\uff0c\u6240\u4ee5googlemap\u7684api\u662f\u5728window\u4e0b\n map = new window.google.maps.Map(this.refs.map, {\n center: { lat: 32.07226, lng: 118.79357 },\n zoom: 13,\n mapTypeId:window.google.maps.MapTypeId.ROADMAP\n });\n this.__renderMarker();\n this.__renderPolyline();\n }\n \n // \u7ed8\u5236\u6807\u8bb0\u70b9\n __renderMarker(){\n var marker= new window.google.maps.Marker({labelContent: "\u592b\u5b50\u5e99\u51fa\u53d1", position:{lat:32.01923,lng: 118.78972},map:map});\n var marker2= new window.google.maps.Marker({labelContent: "\u8001\u95e8\u4e1c\u7ed3\u675f", position:{lat:32.07226,lng: 118.79357},map:map});\n \n var iw2 = new window.google.maps.InfoWindow({\n content: "\u592b\u5b50\u5e99\u51fa\u53d1"\n });\n var iw3 = new window.google.maps.InfoWindow({\n content: "\u7384\u6b66\u6e56\u559d\u8336"\n });\n iw2.open(map, marker);\n iw3.open(map, marker2);\n // \u4e3a\u6807\u8bb0\u70b9\u6dfb\u52a0\u70b9\u51fb\u6253\u5f00\u5f39\u7a97\u4e8b\u4ef6\n window.google.maps.event.addListener(marker, "click", (e)=> { iw2.open(map, marker); });\n window.google.maps.event.addListener(marker2, "click", (e)=> { iw3.open(map, marker2); });\n }\n \n // \u7ed8\u5236\u6298\u7ebf\n __renderPolyline(){\n var locations = new Array(\n "32.01923,118.78972", "32.046154,118.84542",\n "32.0838,118.822","32.07226,118.79357",\n "32.044544,118.79761", "32.05911,118.78173",\n "32.012722,118.7876"\n );\n \n // \u7ebf\u6761\u8bbe\u7f6e\n var polyOptions = {\n strokeColor: \'#ff9900\', // \u989c\u8272\n strokeOpacity: 1.0, // \u900f\u660e\u5ea6\n strokeWeight: 8 // \u5bbd\u5ea6\n }\n var poly = new window.google.maps.Polyline(polyOptions);\n \n /* \u5faa\u73af\u6807\u51fa\u6240\u6709\u5750\u6807 */\n for (var i = 0; i < locations.length; i++) {\n var loc = locations[i].split(\',\');\n var path = poly.getPath(); //\u83b7\u53d6\u7ebf\u6761\u7684\u5750\u6807\n path.push(new window.google.maps.LatLng(loc[0], loc[1])); //\u4e3a\u7ebf\u6761\u6dfb\u52a0\u6807\u8bb0\u5750\u6807 \n }\n poly.setMap(map); // \u88c5\u8f7d\n }\n \n render(){\n return (\n <div>\n <div id=\'map\' ref=\'map\' style={{width: \'100%\',height:\'540px\'}}></div>\n </div>\n )\n }\n }\n \n export default App;\n ','\n // \u666e\u901a\u9875\u9762\u4e2d\u4f7f\u7528\n var map;\n\n // \u5730\u56fe\u7ed8\u5236\n function initialize(){\n changeSize();\n var mapProp = {\n center:new google.maps.LatLng(32.07226,118.79357), \n zoom:13,\n mapTypeId:google.maps.MapTypeId.ROADMAP\n };\n map=new google.maps.Map(document.getElementById("googleMap"), mapProp);\n\n var marker= new google.maps.Marker({labelContent: "\u592b\u5b50\u5e99\u51fa\u53d1", position:{lat:32.01923,lng: 118.78972},map:map});\n var marker2= new google.maps.Marker({labelContent: "\u8001\u95e8\u4e1c\u7ed3\u675f", position:{lat:32.07226,lng: 118.79357},map:map});\n \n var iw2 = new google.maps.InfoWindow({\n content: "\u592b\u5b50\u5e99\u51fa\u53d1"\n });\n var iw3 = new google.maps.InfoWindow({\n content: "\u7384\u6b66\u6e56\u559d\u8336"\n });\n iw2.open(map, marker);\n iw3.open(map, marker2);\n google.maps.event.addListener(marker, "click", function (e) { iw2.open(map, this); });\n\n //http://maps.google.cn/maps/api/geocode/json?address=\u5357\u4eac \u5f97\u5230\u5750\u6807\n var locations = new Array(\n "32.01923,118.78972", "32.046154,118.84542",\n "32.0838,118.822","32.07226,118.79357",\n "32.044544,118.79761", "32.05911,118.78173",\n "32.012722,118.7876");\n \n // \u7ebf\u6761\u8bbe\u7f6e\n var polyOptions = {\n strokeColor: \'#ff9900\', // \u989c\u8272\n strokeOpacity: 1.0, // \u900f\u660e\u5ea6\n strokeWeight: 8 // \u5bbd\u5ea6\n }\n poly = new google.maps.Polyline(polyOptions);\n\n /* \u5faa\u73af\u6807\u51fa\u6240\u6709\u5750\u6807 */\n for (var i = 0; i < locations.length; i++) {\n var loc = locations[i].split(\',\');\n var path = poly.getPath(); //\u83b7\u53d6\u7ebf\u6761\u7684\u5750\u6807\n path.push(new google.maps.LatLng(loc[0], loc[1])); //\u4e3a\u7ebf\u6761\u6dfb\u52a0\u6807\u8bb0\u5750\u6807 \n }\n poly.setMap(map); // \u88c5\u8f7d\n \n }\n //\u52a0\u8f7d\u5730\u56fe\n google.maps.event.addDomListener(window, \'load\', initialize);\n function changeSize() { \n var showMap = document.getElementById("googleMap"); \n showMap.style.width = (document.documentElement.clientWidth-20) + "px"; \n showMap.style.height = (document.documentElement.clientHeight-20) + "px"; \n }\n window.onresize = changeSize;\n ','\n /**\n * \u4f7f\u7528\u8c37\u6b4c\u5730\u56fe\u524d\u9700\u8981\u5728\u5f15\u5165\u5730\u56fe\u7684jssdk\n * <script type="text/javascript" src="http://ditu.google.cn/maps/api/js?v=3&sensor=false&key=\u4f60\u7684\u8c37\u6b4c\u5730\u56feAPI_KEY&hl=zh-CN"><\/script>\n */\n // react \u4e2d\u4f7f\u7528\n import React from "react";\n import \'./App.css\'\n \n let map ;\n class App extends React.Component{\n constructor(props){\n super(props);\n this.state = {\n \n };\n }\n\n componentDidMount(){\n if(!map) this.__initMap();\n }\n\n componentWillUnmount(){\n map = null;\n }\n\n __initMap(){\n // \u521d\u59cb\u5316\u5730\u56fe \u5730\u56fe\u4e2d\u5fc3\u70b9\u5750\u6807\u4e0e\u6bd4\u4f8b\u5c3a\u5927\u5c0f\u5fc5\u586b\n map = new window.google.maps.Map(this.refs.map, {\n center: { lat: 32.07226, lng: 118.79357 }, //\u4ee5\u5357\u4eac\u7684\u5750\u6807\u4e3a\u6f14\u793a\n zoom: 13,\n mapTypeId:window.google.maps.MapTypeId.ROADMAP\n });\n this.__drawMarkerAndLine();\n }\n\n // \u7ed8\u5236\u5750\u6807\u70b9\u5e76\u8fde\u7ebf\n __drawMarkerAndLine(){\n var marker= new window.google.maps.Marker({labelContent: "\u592b\u5b50\u5e99\u51fa\u53d1", position:{lat:32.01923,lng: 118.78972},map:map});\n var marker2= new window.google.maps.Marker({labelContent: "\u8001\u95e8\u4e1c\u7ed3\u675f", position:{lat:32.07226,lng: 118.79357},map:map});\n \n var iw2 = new window.google.maps.InfoWindow({\n content: "\u592b\u5b50\u5e99\u51fa\u53d1"\n });\n var iw3 = new window.google.maps.InfoWindow({\n content: "\u7384\u6b66\u6e56\u559d\u8336"\n });\n iw2.open(map, marker);\n iw3.open(map, marker2);\n // \u4e3a\u6807\u8bb0\u70b9\u6dfb\u52a0\u70b9\u51fb\u6253\u5f00\u5f39\u7a97\u4e8b\u4ef6\n window.google.maps.event.addListener(marker, "click", (e)=> { iw2.open(map, marker); });\n window.google.maps.event.addListener(marker2, "click", (e)=> { iw3.open(map, marker2); });\n \n // \u7ebf\u6761\u8bbe\u7f6e\n var patharr = [];\n patharr.push(marker.getPosition());\n patharr.push(marker2.getPosition());\n var polyOptions = {\n path:patharr,\n strokeColor: \'#ff9900\', // \u989c\u8272\n strokeOpacity: 1.0, // \u900f\u660e\u5ea6\n strokeWeight: 8 // \u5bbd\u5ea6\n }\n var poly = new window.google.maps.Polyline(polyOptions);\n poly.setMap(map); // \u88c5\u8f7d\n }\n\n render(){\n return (\n <div>\n <div id=\'map\' ref=\'map\' style={{width: \'100%\',height:\'540px\'}}></div>\n </div>\n )\n }\n }\n\n export default App;\n ','\n // \u666e\u901a\u9875\u9762\u4e2d\u4f7f\u7528\n // \u521d\u59cb\u5316\u5730\u56fe \u5730\u56fe\u4e2d\u5fc3\u70b9\u5750\u6807\u4e0e\u6bd4\u4f8b\u5c3a\u5927\u5c0f\u5fc5\u586b\n var map;\n function initMap() {\n map = new window.google.maps.Map(document.getElementById(\'map\'), {\n center: { lat: 32.07226, lng: 118.79357 }, //\u4ee5\u5357\u4eac\u7684\u5750\u6807\u4e3a\u6f14\u793a\n zoom: 13,\n mapTypeId:window.google.maps.MapTypeId.ROADMAP\n });\n renderMarker();\n }\n\n // \u7ed8\u5236\u5750\u6807\u70b9\u5e76\u8fde\u7ebf\n function drawMarkerAndLine(){\n var marker= new window.google.maps.Marker({labelContent: "\u592b\u5b50\u5e99\u51fa\u53d1", position:{lat:32.01923,lng: 118.78972},map:map});\n var marker2= new window.google.maps.Marker({labelContent: "\u8001\u95e8\u4e1c\u7ed3\u675f", position:{lat:32.07226,lng: 118.79357},map:map});\n \n var iw2 = new window.google.maps.InfoWindow({\n content: "\u592b\u5b50\u5e99\u51fa\u53d1"\n });\n var iw3 = new window.google.maps.InfoWindow({\n content: "\u7384\u6b66\u6e56\u559d\u8336"\n });\n iw2.open(map, marker);\n iw3.open(map, marker2);\n // \u4e3a\u6807\u8bb0\u70b9\u6dfb\u52a0\u70b9\u51fb\u6253\u5f00\u5f39\u7a97\u4e8b\u4ef6\n window.google.maps.event.addListener(marker, "click", (e)=> { iw2.open(map, marker); });\n window.google.maps.event.addListener(marker2, "click", (e)=> { iw3.open(map, marker2); });\n \n // \u7ebf\u6761\u8bbe\u7f6e\n var patharr = [];\n patharr.push(marker.getPosition());\n patharr.push(marker2.getPosition());\n var polyOptions = {\n path:patharr,\n strokeColor: \'#ff9900\', // \u989c\u8272\n strokeOpacity: 1.0, // \u900f\u660e\u5ea6\n strokeWeight: 8 // \u5bbd\u5ea6\n }\n var poly = new window.google.maps.Polyline(polyOptions);\n poly.setMap(map); // \u88c5\u8f7d\n }\n initMap();\n \n ']},GoogleMapRoute:{Code:["\n // react \u4e2d\u4f7f\u7528 \u8c03\u7528jssdk\u67e5\u8be2\u7ebf\u8def\u670d\u52a1\n import React from \"react\";\n import './App.css'\n \n let map,directionsDisplay,directionsService ;\n \n class App extends React.Component{\n constructor(props){\n super(props);\n this.state = {};\n }\n \n componentDidMount(){\n if(!map) this.__initMap();\n }\n \n componentWillUnmount(){\n map = null;\n }\n \n // \u521d\u59cb\u5316\u5730\u56fe\n __initMap(){\n // \u521d\u59cb\u5316\u5730\u56fe ,\u7531\u4e8e\u793a\u4f8b\u4e2d\u5730\u56fejs\u6587\u4ef6\u662f\u5168\u5c40\u5f15\u5165\u7684\uff0c\u6240\u4ee5googlemap\u7684api\u662f\u5728window\u4e0b\n map = new window.google.maps.Map(this.refs.map, {\n center: {lat: 32.01923, lng: 118.78972}, //\u521d\u59cb\u8bbe\u7f6e\u5357\u4eac\u4e3a\u5730\u56fe\u4e2d\u5fc3\n zoom: 14,\n mapTypeId:window.google.maps.MapTypeId.ROADMAP\n });\n \n // \u521d\u59cb\u5316\u67e5\u8be2\u670d\u52a1\n directionsDisplay = new window.google.maps.DirectionsRenderer;\n directionsService = new window.google.maps.DirectionsService;\n directionsDisplay.setMap(map);\n \n // \u7b2c\u4e00\u6b21\u8fdb\u5165\u67e5\u8be2\u8def\u7ebf\n this.__calculateAndDisplayRoute(directionsService, directionsDisplay);\n }\n \n // \u8ba1\u7b97\u8def\u7ebf\u5e76\u5c06\u7ed3\u679c\u7ed8\u5236\u5728\u5730\u56fe\u4e0a\n __calculateAndDisplayRoute(directionsService, directionsDisplay) {\n var selectedMode = this.refs.mode.value;\n // \u6b64\u5904 origin\u548cdestination\u4e3a\u67e5\u8be2\u7684\u8d77\u70b9\u4e0e\u7ec8\u70b9\n directionsService.route({\n origin: {lat: 32.01923, lng: 118.78972}, // \u592b\u5b50\u5e99.\n destination: {lat: 32.046154, lng: 118.84542}, // \u7f8e\u9f84\u5bab\n travelMode: window.google.maps.TravelMode[selectedMode]\n }, function(response, status) {\n //console.log(response,status)\n if (status == 'OK') {\n directionsDisplay.setDirections(response);\n } else {\n window.alert('Directions request failed due to ' + status);\n }\n });\n }\n \n // \u5207\u6362\u4ea4\u901a\u65b9\u5f0f\n onSelectChange(){\n this.__calculateAndDisplayRoute(directionsService, directionsDisplay);\n }\n \n render(){\n return (\n <div>\n <div id=\"floating-panel\">\n <b>\u592b\u5b50\u5e99\u5230\u7f8e\u9f84\u5bab: </b>\n <select id=\"mode\" ref='mode' onChange={this.onSelectChange.bind(this)}>\n <option value=\"DRIVING\">\u5f00\u8f66</option>\n <option value=\"WALKING\">\u8d70\u8def</option>\n <option value=\"BICYCLING\">\u9a91\u8f66</option>\n <option value=\"TRANSIT\">\u5730\u94c1\u516c\u4ea4</option>\n </select>\n </div>\n <div id='map' ref='map' style={{width: '100%',height:'540px'}}></div>\n </div>\n )\n }\n }\n \n export default App;\n ","\n // \u666e\u901a\u9875\u9762\u4e2d\u4f7f\u7528\n\n // \u521d\u59cb\u5316\u5730\u56fe\n function initMap() {\n var directionsDisplay = new google.maps.DirectionsRenderer;\n var directionsService = new google.maps.DirectionsService;\n var map = new google.maps.Map(document.getElementById('map'), {\n zoom: 14,\n center: {lat: 32.01923, lng: 118.78972}\n });\n directionsDisplay.setMap(map);\n\n calculateAndDisplayRoute(directionsService, directionsDisplay);\n document.getElementById('mode').addEventListener('change', function() {\n calculateAndDisplayRoute(directionsService, directionsDisplay);\n });\n }y\n\n // \u67e5\u8be2\u8def\u7ebf\u5e76\u5c06\u7ed3\u679c\u7ed8\u5236\u5230\u5730\u56fe\u4e0a\n function calculateAndDisplayRoute(directionsService, directionsDisplay,ajaxresponse) {\n var selectedMode = document.getElementById('mode').value;\n directionsService.route({\n origin: {lat: 32.01923, lng: 118.78972}, // \u592b\u5b50\u5e99.\n destination: {lat: 32.046154, lng: 118.84542}, // \u7f8e\u9f84\u5bab\n // Note that Javascript allows us to access the constant\n // using square brackets and a string value as its\n // \"property.\"\n travelMode: google.maps.TravelMode[selectedMode]\n }, function(response, status) {\n console.log(response)\n if (status == 'OK') {\n directionsDisplay.setDirections(response);\n } else {\n window.alert('Directions request failed due to ' + status);\n }\n });\n }\n\n initMap()\n ",'\n // react \u4e2d\u4f7f\u7528 \u540e\u53f0\u8c03\u7528\u8c37\u6b4c\u63a5\u53e3\u67e5\u8be2\u8def\u7ebf\uff0c\u524d\u7aef\u7684\u5230\u6570\u636e\u540e\u5b8c\u6210\u6e32\u67d3(\u8c37\u6b4c\u67e5\u8be2\u5230\u7684\u8def\u7ebf\u7ed3\u679c\u6709\u8f6c\u7801\uff0c\u6240\u4ee5\u9700\u89e3\u7801\u540e\u4f7f\u7528)\n /*\n *\u89e3\u7801\u8def\u5f84 \u4f7f\u7528\u8c37\u6b4c\u7684\u8f6c\u7801\u6a21\u5757\u5728\u5f15\u5165\u6587\u4ef6\u65f6\u9700\u8981\u5728\u5c3e\u90e8\u52a0\u4e0a&libraries=geometry\n *<script type="text/javascript" src="http://ditu.google.cn/maps/api/js?v=3&sensor=false&key=\u4f60\u7684\u8c37\u6b4c\u5730\u56feAPI_KEY&hl=zh-CN&libraries=geometry"><\/script>\n */\n import React from "react";\n import \'./App.css\'\n \n let map ;\n \n class App extends React.Component{\n constructor(props){\n super(props);\n this.state = {};\n }\n \n componentDidMount(){\n if(!map) this.__initMap();\n }\n \n componentWillUnmount(){\n map = null;\n }\n \n // \u521d\u59cb\u5316\u5730\u56fe\n __initMap(){\n // \u540e\u53f0\u8bf7\u6c42\u8c37\u6b4c\u63a5\u53e3\u5f97\u5230\u7c7b\u4f3c\u6570\u636e\u683c\u5f0f \u5176\u4e2dpoints\u4e3a\u6211\u4eec\u7ed8\u5236\u4f7f\u7528\u7684\u4e3b\u8981\u6570\u636e\n let backendData = {\n "success": true,\n "msg": "string",\n "errorCode": 0,\n "count": 0,\n "rows": [\n {\n "distance": "8.0 \u516c\u91cc",\n "duration": "49\u5206\u949f",\n "modeName": "transit",\n "summary": [\n {\n "type": "transit",\n "name": "\u516c\u4ea416\u8def"\n },\n {\n "type": "transit",\n "name": "\u5730\u94c1\u4e00\u53f7\u7ebf"\n },\n {\n "type": "transit",\n "name": "\u5730\u94c1\u56db\u53f7\u7ebf"\n },\n {\n "type": "walking",\n "name": "\u6b65\u884c"\n }\n ],\n "points": "avlbE{c`tUgC_EyBgEqBgEa@TkBxAaBnA}AnAgEtACq@a@Bk@bA_B\\oCXkCHaECwHOYC}H}AkS{EcE{@aKaCeWaG{A]YEaDAlBCLwC?uH~Ccp@TyIdDwpAN_GkEgdAOeM?yDa@[jAEC_AUmBqBgBcDuCm@i@gTqRcDwCc@u@Sg@QaAC]Bw@`@qCDeAIeBKa@Ui@eAaBrA}@\\\\B",\n "walkLength": 0,\n "selectFlag": true\n }\n ]\n }\n map = new window.google.maps.Map(this.refs.map, {\n center: {lat: 32.01923, lng: 118.78972},\n zoom: 14,\n mapTypeId:window.google.maps.MapTypeId.ROADMAP\n });\n \n this.__renderBackendRoute(map,backendData.rows[0]);\n }\n \n \n /**\n * @name: \u63a5\u6536\u540e\u7aef\u8c03\u7528\u8c37\u6b4c\u63a5\u53e3\u67e5\u8be2\u7684\u8def\u7ebf\u6570\u636e\u5728\u5730\u56fe\u4e0a\u6e32\u67d3\u8def\u7ebf\n * @test: \n * @msg: \n * @param {type} map \uff1a\u5730\u56fe\u5bf9\u8c61\uff0cdata :\u67e5\u8be2\u5230\u7684rows\u4e0b\u9762\u7684\u8def\u7ebf\u5bf9\u8c61\n * @return: \n */\n __renderBackendRoute(map,data){\n const decodeFn=window.google.maps.geometry.encoding.decodePath;\n // \u89e3\u7801\u8def\u5f84\u83b7\u5f97\u8def\u7ebf\u70b9\u4f4d\u96c6\u5408\n let routeArr = decodeFn(data.points);\n let arrLength = routeArr.length;\n let startLatLng = routeArr[0];\n let endLatLng = routeArr[arrLength-1];\n // \u7ed8\u5236\u8def\u5f84\u53ca\u8d77\u59cb\u70b9\n let flightPath = new window.google.maps.Polyline({\n path: routeArr,\n geodesic: true,\n strokeColor: \'#00B3FD\',\n strokeOpacity: .8,\n strokeWeight: 8\n });\n flightPath.setMap(map);\n new window.google.maps.Marker({\n position: startLatLng,\n animation: window.google.maps.Animation.DROP,\n map: map,\n label:"\u8d77\u70b9"\n });\n new window.google.maps.Marker({\n position: endLatLng,\n animation: window.google.maps.Animation.DROP,\n map: map,\n label:"\u7ec8\u70b9"\n })\n // \u8c03\u6574\u89c6\u56fe\u83b7\u5f97\u6700\u4f73\u89c6\u91ce\n let bounds = new window.google.maps.LatLngBounds();\n for(let i=0,len=routeArr.length;i<len;i++){\n bounds.extend(routeArr[i]);\n }\n map.fitBounds(bounds);\n }\n \n render(){\n return (\n <div>\n <div id=\'map\' ref=\'map\' style={{width: \'100%\',height:\'540px\'}}></div>\n </div>\n )\n }\n }\n \n export default App;\n ','\n // \u666e\u901a\u9875\u9762\u4e2d\u4f7f\u7528\n var map = new window.google.maps.Map(document.getElementById(\'map\'), {\n center: {lat: 32.01923, lng: 118.78972}, //\u521d\u59cb\u4e2d\u5fc3\u70b9\u548c\u6bd4\u4f8b\u5c3a\u6309\u5b9e\u9645\u60c5\u51b5\u800c\u5b9a\n zoom: 14,\n mapTypeId:window.google.maps.MapTypeId.ROADMAP\n });\n // \u540e\u53f0\u8bf7\u6c42\u8c37\u6b4c\u63a5\u53e3\u5f97\u5230\u7c7b\u4f3c\u6570\u636e\u683c\u5f0f\n let backendData = {\n "success": true,\n "msg": "string",\n "errorCode": 0,\n "count": 0,\n "rows": [\n {\n "distance": "8.0 \u516c\u91cc",\n "duration": "49\u5206\u949f",\n "modeName": "transit",\n "summary": [\n {\n "type": "transit",\n "name": "\u516c\u4ea416\u8def"\n },\n {\n "type": "transit",\n "name": "\u5730\u94c1\u4e00\u53f7\u7ebf"\n },\n {\n "type": "transit",\n "name": "\u5730\u94c1\u56db\u53f7\u7ebf"\n },\n {\n "type": "walking",\n "name": "\u6b65\u884c"\n }\n ],\n "points": "avlbE{c`tUgC_EyBgEqBgEa@TkBxAaBnA}AnAgEtACq@a@Bk@bA_B\\oCXkCHaECwHOYC}H}AkS{EcE{@aKaCeWaG{A]YEaDAlBCLwC?uH~Ccp@TyIdDwpAN_GkEgdAOeM?yDa@[jAEC_AUmBqBgBcDuCm@i@gTqRcDwCc@u@Sg@QaAC]Bw@`@qCDeAIeBKa@Ui@eAaBrA}@\\\\B",\n "walkLength": 0,\n "selectFlag": true\n }\n ]\n }\n\n renderMapRoute(map,backendData.rows[0]);\n /**\n * @name: \u63a5\u6536\u540e\u7aef\u8c03\u7528\u8c37\u6b4c\u63a5\u53e3\u67e5\u8be2\u7684\u8def\u7ebf\u6570\u636e\u5728\u5730\u56fe\u4e0a\u6e32\u67d3\u8def\u7ebf\n * @test: \n * @msg: \n * @param {type} map \uff1a\u5730\u56fe\u5bf9\u8c61\uff0cdata :\u67e5\u8be2\u5230\u7684rows\u4e0b\u9762\u7684\u8def\u7ebf\u5bf9\u8c61\n * @return: \n */\n function renderMapRoute(map,data){\n /*\n *\u89e3\u7801\u8def\u5f84 \u4f7f\u7528\u8c37\u6b4c\u7684\u8f6c\u7801\u6a21\u5757\u5728\u5f15\u5165\u6587\u4ef6\u65f6\u9700\u8981\u5728\u5c3e\u90e8\u52a0\u4e0a&libraries=geometry\n *<script type="text/javascript" src="http://ditu.google.cn/maps/api/js?v=3&sensor=false&key=\u4f60\u7684\u8c37\u6b4c\u5730\u56feAPI_KEY&hl=zh-CN&libraries=geometry"><\/script>\n */\n const decodeFn=google.maps.geometry.encoding.decodePath; // google map\u89e3\u7801\u5de5\u5177\n let routeArr = decodeFn(data.points);\n let arrLength = routeArr.length;\n let startLatLng = routeArr[0]; // \u8d77\u70b9\n let endLatLng = routeArr[arrLength-1]; // \u7ec8\u70b9\n // \u8bbe\u7f6e\u6700\u4f73\u89c6\u89d2\n var bounds = new google.maps.LatLngBounds();\n for(let i=0,len=routeArr.length;i<len;i++){\n bounds.extend(routeArr[i]);\n }\n map.fitBounds(bounds);\n // \u7ed8\u5236\u8def\u7ebf\n var flightPath = new google.maps.Polyline({\n path: routeArr,\n geodesic: true,\n strokeColor: \'#00B3FD\',\n strokeOpacity: .8,\n strokeWeight: 8\n });\n flightPath.setMap(map);\n // \u7ed8\u5236\u8d77\u59cb\u70b9\n var startMarker = new google.maps.Marker({\n position: startLatLng,\n animation: google.maps.Animation.DROP,\n map: map,\n label:"\u8d77\u70b9",\n });\n var endMarker = new google.maps.Marker({\n position: endLatLng,\n animation: google.maps.Animation.DROP,\n map: map,\n label:"\u7ec8\u70b9"\n })\n }\n ']},GoogleMapPopup:{Code:["\n // react\u4e2d\u4f7f\u7528\n import React from \"react\";\n import './App.css'\n \n let map ;\n \n // \u81ea\u5b9a\u4e49\u7a97\u53e3\u7c7b\n class Popup extends window.google.maps.OverlayView{\n constructor(position,content1){\n super();\n this.position = position;\n let content=document.createElement('div');\n content.innerHTML=\"<b>\"+content1+\"</b>\";\n \n content.classList.add('popup-bubble-content');\n \n var pixelOffset = document.createElement('div');\n pixelOffset.classList.add('popup-bubble-anchor');\n pixelOffset.appendChild(content);\n \n this.anchor = document.createElement('div');\n this.anchor.classList.add('popup-tip-anchor');\n this.anchor.appendChild(pixelOffset);\n this.stopEventPropagation();\n }\n \n // \u6302\u5728\u5230\u5730\u56fe\u65f6\u8c03\u7528\n onAdd(){\n this.getPanes().floatPane.appendChild(this.anchor);\n };\n \n // \u4ece\u5730\u56fe\u79fb\u9664\u65f6\u8c03\u7528\n onRemove(){\n if (this.anchor.parentElement) {\n this.anchor.parentElement.removeChild(this.anchor);\n }\n };\n \n // \u7ed8\u5236\u65b9\u6cd5\n draw(){\n var divPosition = this.getProjection().fromLatLngToDivPixel(this.position);\n // \u89c6\u56fe\u5916\u65f6\u81ea\u52a8\u9690\u85cf\n var display =\n Math.abs(divPosition.x) < 4000 && Math.abs(divPosition.y) < 4000 ?\n 'block' :\n 'none';\n \n if (display === 'block') {\n this.anchor.style.left = divPosition.x + 'px';\n this.anchor.style.top = divPosition.y + 'px';\n }\n if (this.anchor.style.display !== display) {\n this.anchor.style.display = display;\n }\n };\n \n // \u963b\u6b62\u4e8b\u4ef6\u4f20\u9012\n stopEventPropagation(){\n var anchor = this.anchor;\n anchor.style.cursor = 'auto';\n \n ['click', 'dblclick', 'contextmenu', 'wheel', 'mousedown', 'touchstart',\n 'pointerdown']\n .forEach(function(event) {\n anchor.addEventListener(event, function(e) {\n e.stopPropagation();\n });\n });\n };\n \n }\n \n class App extends React.Component{\n constructor(props){\n super(props);\n this.state = {\n \n };\n }\n \n componentDidMount(){\n if(!map) this.__initMap();\n }\n\n componentWillUnmount(){\n map = null;\n }\n \n // \u521d\u59cb\u5316\u5730\u56fe\n __initMap(){\n \n // \u521d\u59cb\u5316\u5730\u56fe ,\u7531\u4e8e\u793a\u4f8b\u4e2d\u5730\u56fejs\u6587\u4ef6\u662f\u5168\u5c40\u5f15\u5165\u7684\uff0c\u6240\u4ee5googlemap\u7684api\u662f\u5728window\u4e0b\n map = new window.google.maps.Map(this.refs.map, {\n center: {lat: 32.07226, lng: 118.78173},\n zoom: 10,\n mapTypeId:window.google.maps.MapTypeId.ROADMAP\n });\n\n // \u521b\u5efa\u4e24\u4e2a\u81ea\u5b9a\u4e49\u5f39\u51fa\u7a97\u53e3\uff0c\u4f20\u5165\u5750\u6807\u4e0e\u5c55\u793a\u6587\u5b57\n new Popup(new window.google.maps.LatLng(32.01923,118.78972),\"\u57ce\u5e021\").setMap(map);\n new Popup(new window.google.maps.LatLng(32.05911,118.78173),\"\u57ce\u5e022\").setMap(map);\n }\n \n render(){\n return (\n <div>\n <div id='map' ref='map' style={{width: '100%',height:'540px'}}></div>\n </div>\n )\n }\n }\n \n export default App;\n ","\n // \u666e\u901a\u9875\u9762\u4e2d\u4f7f\u7528\n <style>\n .popup-tip-anchor {\n height: 0;\n position: absolute;\n /* The max width of the info window. */\n width: 200px;\n }\n \n .popup-bubble-anchor {\n position: absolute;\n width: 100%;\n bottom: /* TIP_HEIGHT= */ 8px;\n left: 0;\n }\n \n .popup-bubble-anchor::after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n /* Center the tip horizontally. */\n transform: translate(-50%, 0);\n /* The tip is a https://css-tricks.com/snippets/css/css-triangle/ */\n width: 0;\n height: 0;\n /* The tip is 8px high, and 12px wide. */\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-top: /* TIP_HEIGHT= */ 8px solid white;\n }\n \n .popup-bubble-content {\n position: absolute;\n top: 0;\n left: 0;\n transform: translate(-50%, -100%);\n /* Style the info window. */\n background-color: white;\n padding: 5px;\n border-radius: 5px;\n font-family: sans-serif;\n overflow-y: auto;\n max-height: 60px;\n box-shadow: 0px 2px 10px 1px rgba(0,0,0,0.5);\n }\n </style>\n\n // \u521d\u59cb\u5316\u5730\u56fe\n var map;\n function initMap() {\n definePopupClass();\n \n map = new google.maps.Map(document.getElementById('map'), {\n center: {lat: 32.07226, lng: 118.78173},\n zoom: 10,\n });\n \n // popup = new Popup(new google.maps.LatLng(32.01923,118.78972),\"\u6211\u8981\u663e\u793a\u7684\");\n // popup.setMap(map);\n \n \n new Popup(new google.maps.LatLng(32.01923,118.78972),\"\u57ce\u5e021\").setMap(map);\n new Popup(new google.maps.LatLng(32.05911,118.78173),\"\u57ce\u5e022\").setMap(map);\n \n }\n \n // \u5b9a\u4e49\u7a97\u53e3\u7c7b\n function definePopupClass() {\n /**\n * @param {!google.maps.LatLng} position\n * @param {!Element} content1\n * @constructor\n * @extends {google.maps.OverlayView}\n */\n Popup = function(position, content1) {\n this.position = position;\n let content=document.createElement('div');\n content.innerHTML=\"<b>\"+content1+\"</b>\";\n \n content.classList.add('popup-bubble-content');\n \n var pixelOffset = document.createElement('div');\n pixelOffset.classList.add('popup-bubble-anchor');\n pixelOffset.appendChild(content);\n \n this.anchor = document.createElement('div');\n this.anchor.classList.add('popup-tip-anchor');\n this.anchor.appendChild(pixelOffset);\n \n this.stopEventPropagation();\n };\n\n Popup.prototype = Object.create(google.maps.OverlayView.prototype);\n \n // \u6302\u8f7d\u65f6\u8c03\u7528\n Popup.prototype.onAdd = function() {\n this.getPanes().floatPane.appendChild(this.anchor);\n };\n \n // \u4ece\u5730\u56fe\u79fb\u9664\u65f6\u8c03\u7528\n Popup.prototype.onRemove = function() {\n if (this.anchor.parentElement) {\n this.anchor.parentElement.removeChild(this.anchor);\n }\n };\n \n // \u7ed8\u5236\u65b9\u6cd5\n Popup.prototype.draw = function() {\n var divPosition = this.getProjection().fromLatLngToDivPixel(this.position);\n // Hide the popup when it is far out of view.\n var display =\n Math.abs(divPosition.x) < 4000 && Math.abs(divPosition.y) < 4000 ?\n 'block' :\n 'none';\n \n if (display === 'block') {\n this.anchor.style.left = divPosition.x + 'px';\n this.anchor.style.top = divPosition.y + 'px';\n }\n if (this.anchor.style.display !== display) {\n this.anchor.style.display = display;\n }\n };\n \n Popup.prototype.stopEventPropagation = function() {\n var anchor = this.anchor;\n anchor.style.cursor = 'auto';\n \n ['click', 'dblclick', 'contextmenu', 'wheel', 'mousedown', 'touchstart',\n 'pointerdown']\n .forEach(function(event) {\n anchor.addEventListener(event, function(e) {\n e.stopPropagation();\n });\n });\n };\n }\n \n initMap();\n ","\n // react\u4e2d\u4f7f\u7528\n import React from \"react\";\n import './App.css'\n \n let map ;\n \n class App extends React.Component{\n constructor(props){\n super(props);\n this.state = {\n \n };\n }\n \n componentDidMount(){\n if(!map) this.__initMap();\n }\n\n componentWillUnmount(){\n map = null;\n }\n \n // \u521d\u59cb\u5316\u5730\u56fe\n __initMap(){\n var destination = {lat: 32.061051, lng: 118.852237}; //\u8bbe\u7f6e\u7684\u662f\u4e2d\u5c71\u9675\u5750\u6807\n map = new window.google.maps.Map(this.refs.map, {\n center: destination,\n zoom: 12,\n mapTypeId:window.google.maps.MapTypeId.ROADMAP\n });\n this.__renderMarkerAndInfoWindow(map,destination);\n }\n // \u7ed8\u5236\u6807\u8bb0\u70b9\u548c\u81ea\u5b9a\u4e49\u7a97\u53e3\n __renderMarkerAndInfoWindow(map,position){\n var contentString = '<div id=\"content\">'+\n '<div id=\"siteNotice\">'+\n '</div>'+\n '<h1 id=\"firstHeading\" class=\"firstHeading\">\u4e2d\u5c71\u9675\u56ed\u98ce\u666f\u533a</h1>'+\n '<div id=\"bodyContent\">'+\n '<p><b>\u4e2d\u5c71\u9675\u56ed\u98ce\u666f\u533a</b>, \u4e2d\u5c71\u9675\u4f4d\u4e8e\u5357\u4eac\u5e02\u7384\u6b66\u533a\u7d2b\u91d1\u5c71\u5357\u9e93\u949f\u5c71\u98ce\u666f\u533a\u5185\uff0c' +\n '\u662f\u4e2d\u56fd\u8fd1\u4ee3\u4f1f\u5927\u7684\u6c11\u4e3b\u9769\u547d\u5148\u884c\u8005\u5b59\u4e2d\u5c71\u5148\u751f\u7684\u9675\u5bdd\uff0c\u53ca\u5176\u9644\u5c5e\u7eaa\u5ff5\u5efa\u7b51\u7fa4\uff0c '+\n '\u9762\u79ef8\u4e07\u4f59\u5e73\u65b9\u7c73\u3002\u4e2d\u5c71\u9675\u81ea1926\u5e74\u6625\u52a8\u5de5\uff0c\u81f31929\u5e74\u590f\u5efa\u6210\uff0c1961\u5e74\u6210\u4e3a\u9996\u6279\u5168\u56fd\u91cd\u70b9\u6587\u7269\u4fdd\u62a4\u5355\u4f4d\uff0c '+\n '2006\u5e74\u5217\u4e3a\u9996\u6279\u56fd\u5bb6\u91cd\u70b9\u98ce\u666f\u540d\u80dc\u533a\u548c\u56fd\u5bb65A\u7ea7\u65c5\u6e38\u666f\u533a\uff0c2016\u5e74\u5165\u9009\u201c\u9996\u6279\u4e2d\u56fd20\u4e16\u7eaa\u5efa\u7b51\u9057\u4ea7\u201d\u540d\u5f55'+\n '\u4e2d\u5c71\u9675\u524d\u4e34\u5e73\u5ddd\uff0c\u80cc\u62e5\u9752\u5d82\uff0c\u4e1c\u6bd7\u7075\u8c37\u5bfa\uff0c\u897f\u90bb\u660e\u5b5d\u9675\uff0c\u6574\u4e2a\u5efa\u7b51\u7fa4\u4f9d\u5c71\u52bf\u800c\u5efa\uff0c\u7531\u5357\u5f80\u5317\u6cbf\u4e2d\u8f74\u7ebf\u9010\u6e10\u5347\u9ad8\uff0c'+\n '\u4e3b\u8981\u5efa\u7b51\u6709\u535a\u7231\u574a\u3001\u5893\u9053\u3001\u9675\u95e8\u3001\u77f3\u9636\u3001\u7891\u4ead\u3001\u796d\u5802\u548c\u5893\u5ba4\u7b49\uff0c\u6392\u5217\u5728\u4e00\u6761\u4e2d\u8f74\u7ebf\u4e0a\uff0c\u4f53\u73b0\u4e86\u4e2d\u56fd\u4f20\u7edf\u5efa\u7b51\u7684\u98ce\u683c\uff0c'+\n '\u4ece\u7a7a\u4e2d\u5f80\u4e0b\u770b\uff0c\u50cf\u4e00\u5ea7\u5e73\u5367\u5728\u7eff\u7ed2\u6bef\u4e0a\u7684\u201c\u81ea\u7531\u949f\u201d\u3002\u878d\u6c47\u4e2d\u56fd\u53e4\u4ee3\u4e0e\u897f\u65b9\u5efa\u7b51\u4e4b\u7cbe\u534e\uff0c\u5e84\u4e25\u7b80\u6734\uff0c\u522b\u521b\u65b0\u683c\u3002</p>'+\n '<p>\u666f\u533a\u8be6\u60c5: \u4e2d\u5c71\u9675, <a href=\"http://www.iShow.com/g8996/guide-0-0/\">'+\n 'http://www.iShow.com/g8996/guide-0-0/</a> '+\n '</p>'+\n '</div>'+\n '</div>';\n \n var marker = new window.google.maps.Marker({\n position: position,\n map: map,\n title: '\u4e2d\u5c71\u9675'\n });\n var infowindow = new window.google.maps.InfoWindow({\n content: contentString\n });\n \n infowindow.open(map, marker);\n marker.addListener('click', function() {\n infowindow.open(map, marker);\n });\n }\n \n render(){\n return (\n <div>\n <div id='map' ref='map' style={{width: '100%',height:'540px'}}></div>\n </div>\n )\n }\n }\n \n export default App;\n ","\n // \u666e\u901a\u9875\u9762\u4e2d\u4f7f\u7528\n var map;\n function initMap() {\n var destination = {lat: 32.061051, lng: 118.852237}; //\u8bbe\u7f6e\u7684\u662f\u4e2d\u5c71\u9675\u5750\u6807\n map = new window.google.maps.Map(document.getElementById('map'), {\n center: destination,\n zoom: 12,\n mapTypeId:window.google.maps.MapTypeId.ROADMAP\n });\n\n var contentString = '<div id=\"content\">'+\n '<div id=\"siteNotice\">'+\n '</div>'+\n '<h1 id=\"firstHeading\" class=\"firstHeading\">\u4e2d\u5c71\u9675\u56ed\u98ce\u666f\u533a</h1>'+\n '<div id=\"bodyContent\">'+\n '<p><b>\u4e2d\u5c71\u9675\u56ed\u98ce\u666f\u533a</b>, \u4e2d\u5c71\u9675\u4f4d\u4e8e\u5357\u4eac\u5e02\u7384\u6b66\u533a\u7d2b\u91d1\u5c71\u5357\u9e93\u949f\u5c71\u98ce\u666f\u533a\u5185\uff0c' +\n '\u662f\u4e2d\u56fd\u8fd1\u4ee3\u4f1f\u5927\u7684\u6c11\u4e3b\u9769\u547d\u5148\u884c\u8005\u5b59\u4e2d\u5c71\u5148\u751f\u7684\u9675\u5bdd\uff0c\u53ca\u5176\u9644\u5c5e\u7eaa\u5ff5\u5efa\u7b51\u7fa4\uff0c '+\n '\u9762\u79ef8\u4e07\u4f59\u5e73\u65b9\u7c73\u3002\u4e2d\u5c71\u9675\u81ea1926\u5e74\u6625\u52a8\u5de5\uff0c\u81f31929\u5e74\u590f\u5efa\u6210\uff0c1961\u5e74\u6210\u4e3a\u9996\u6279\u5168\u56fd\u91cd\u70b9\u6587\u7269\u4fdd\u62a4\u5355\u4f4d\uff0c '+\n '2006\u5e74\u5217\u4e3a\u9996\u6279\u56fd\u5bb6\u91cd\u70b9\u98ce\u666f\u540d\u80dc\u533a\u548c\u56fd\u5bb65A\u7ea7\u65c5\u6e38\u666f\u533a\uff0c2016\u5e74\u5165\u9009\u201c\u9996\u6279\u4e2d\u56fd20\u4e16\u7eaa\u5efa\u7b51\u9057\u4ea7\u201d\u540d\u5f55'+\n '\u4e2d\u5c71\u9675\u524d\u4e34\u5e73\u5ddd\uff0c\u80cc\u62e5\u9752\u5d82\uff0c\u4e1c\u6bd7\u7075\u8c37\u5bfa\uff0c\u897f\u90bb\u660e\u5b5d\u9675\uff0c\u6574\u4e2a\u5efa\u7b51\u7fa4\u4f9d\u5c71\u52bf\u800c\u5efa\uff0c\u7531\u5357\u5f80\u5317\u6cbf\u4e2d\u8f74\u7ebf\u9010\u6e10\u5347\u9ad8\uff0c'+\n '\u4e3b\u8981\u5efa\u7b51\u6709\u535a\u7231\u574a\u3001\u5893\u9053\u3001\u9675\u95e8\u3001\u77f3\u9636\u3001\u7891\u4ead\u3001\u796d\u5802\u548c\u5893\u5ba4\u7b49\uff0c\u6392\u5217\u5728\u4e00\u6761\u4e2d\u8f74\u7ebf\u4e0a\uff0c\u4f53\u73b0\u4e86\u4e2d\u56fd\u4f20\u7edf\u5efa\u7b51\u7684\u98ce\u683c\uff0c'+\n '\u4ece\u7a7a\u4e2d\u5f80\u4e0b\u770b\uff0c\u50cf\u4e00\u5ea7\u5e73\u5367\u5728\u7eff\u7ed2\u6bef\u4e0a\u7684\u201c\u81ea\u7531\u949f\u201d\u3002\u878d\u6c47\u4e2d\u56fd\u53e4\u4ee3\u4e0e\u897f\u65b9\u5efa\u7b51\u4e4b\u7cbe\u534e\uff0c\u5e84\u4e25\u7b80\u6734\uff0c\u522b\u521b\u65b0\u683c\u3002</p>'+\n '<p>\u666f\u533a\u8be6\u60c5: \u4e2d\u5c71\u9675, <a href=\"http://www.iShow.com/g8996/guide-0-0/\">'+\n 'http://www.iShow.com/g8996/guide-0-0/</a> '+\n '</p>'+\n '</div>'+\n '</div>';\n\n var marker = new google.maps.Marker({\n position: destination,\n map: map,\n title: '\u4e2d\u5c71\u9675'\n });\n var infowindow = new google.maps.InfoWindow({\n content: contentString\n });\n infowindow.open(map, marker);\n // \u6dfb\u52a0\u70b9\u51fb\u5f39\u7a97\u4e8b\u4ef6\n marker.addListener('click', function() {\n infowindow.open(map, marker);\n });\n }\n initMap();\n "]},GoogleMapH5:{Code:["\n\n\n import React from \"react\";\n import { Tabs } from \"../../ishow\";\n import './App.css'\n import ViewCode from './viewCode';\n\n let map;\n\n /**\n * @name: \u81ea\u5b9a\u4e49\u6807\u7b7e\u7684\u6784\u9020\u7c7b \u4f7f\u7528\u81ea\u5b9a\u4e49\u6807\u7b7e\u4ee3\u66ffinfowindow\u7684\u4f5c\u7528\n * @test: test for font\n * @msg: \n * @param {type} \n * @return: \n */\n class Popup extends window.google.maps.OverlayView{\n constructor(position,content1){ // \u5982\u53c2\u5750\u6807\u548c\u6570\u636e\u5bf9\u8c61\n super();\n this.position = position;\n // \u4f7f\u7528\u81ea\u5b9a\u4e49\u6a21\u677f\n let contentStr =`\n <div class=\"context-contain\" ref=\"popup\" style=\"display:block\">\n <img id=\"popupImg\" src=\"http://m.iShowcdn.com/fb2/t1/G1/M00/1F/D6/Cii9EVdol6SIMxT8AAh0VDJGjFEAAGpWwLtklYACHRs714_w80_h80_c0_t0.jpg\" class=\"context-img\" alt=\"\"></img>\n <div class=\"context-text\">\n <span id=\"popupName\">${content1}</span>\n <span class=\"subtext\" id=\"popupSubtext\">the subtext title for the english name of a poi</span>\n </div>\n <a id=\"navigation\" href=\"https://maps.google.cn/maps?saddr=&amp;daddr=40.07985, 116.60311&amp;dirflg=D\" class=\"context-link\">\u5bfc\u822a</a>\n </div>\n `\n // \u5c06\u6a21\u677f\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3adom\n let objE = document.createElement(\"div\");\n \u3000\u3000 objE.innerHTML = contentStr;\n let popdom =objE.childNodes[1];\n this.anchor = popdom;\n \n this.stopEventPropagation();\n }\n\n // \u6302\u8f7d\u65f6\u6267\u884c\n onAdd(){\n this.getPanes().floatPane.appendChild(this.anchor);\n };\n \n // \u79fb\u9664\u65f6\u6267\u884c\n onRemove(){\n if (this.anchor.parentElement) {\n this.anchor.parentElement.removeChild(this.anchor);\n }\n };\n \n // \u81ea\u5b9a\u4e49\u6807\u7b7e\u7ed8\u5236\n draw(){\n let divPosition = this.getProjection().fromLatLngToDivPixel(this.position);\n // Hide the popup when it is far out of view.\n let display =\n Math.abs(divPosition.x) < 4000 && Math.abs(divPosition.y) < 4000 ?\n 'block' :\n 'none';\n \n if (display === 'block') {\n \n this.anchor.style.left = Number(divPosition.x -140) + 'px'; //140\u548c100\u662f\u81ea\u5b9a\u4e49\u6807\u7b7e\u7684\u504f\u79fb\u91cf \u663e\u793a\u6240\u6709\u662f\u504f\u79fb\u91cf\u4e3a20\n this.anchor.style.top = Number(divPosition.y-100) + 'px'; \n }\n if (this.anchor.style.display !== display) {\n this.anchor.style.display = display;\n }\n };\n \n // \u963b\u6b62\u4e8b\u4ef6\u5192\u6ce1\n stopEventPropagation(){\n let anchor = this.anchor;\n anchor.style.cursor = 'auto';\n \n ['click', 'dblclick', 'contextmenu', 'wheel', 'mousedown', 'touchstart',\n 'pointerdown']\n .forEach(function(event) {\n anchor.addEventListener(event, function(e) {\n e.stopPropagation();\n });\n });\n };\n\n }\n class App extends React.Component{\n constructor(props){\n super(props);\n this.state = {\n\n };\n }\n\n componentDidMount(){\n if(!map) this.__initMap();\n this.__renderMarker();\n }\n\n componentWillUnmount(){\n map = null;\n }\n\n // \u521d\u59cb\u5316\u5730\u56fe\n __initMap(){\n // \u521d\u59cb\u5316\u4e16\u754c\u5730\u56fe\n map = new window.google.maps.Map(this.refs.map, {\n center: { lat: 32.07226, lng: 118.79357 },\n zoom: 13,\n mapTypeId:window.google.maps.MapTypeId.ROADMAP,\n mapTypeControl: false,\n gestureHandling:'greedy', //H5\u4e2d\u5730\u56fe\u5f00\u542fgreedy\u6a21\u5f0f \u542f\u52a8\u5355\u6307\u62d6\u52a8\uff0c\u53cc\u6307\u7f29\u653e\u529f\u80fd\n });\n \n }\n // \u5730\u56fe\u6e32\u67d3\n __renderMarker(){\n let popupList=[];\n let markerList=[];\n // \u4f7f\u7528\u81ea\u5b9a\u4e49\u6807\u8bb0\u70b9\u6837\u5f0f\u56fe\u7247 \u5e76\u901a\u8fc7scaledSize\u8c03\u6574\u56fe\u7247\u5927\u5c0f\n let icon = {\n url:'./image/markericon.png',\n scaledSize:{\n width:32,\n height:52\n }\n };\n let marker= new window.google.maps.Marker({\n title: '\u4e2d\u5c71\u9675\u98ce\u666f\u533a',\n label: {text: '1', color:\"#2360E0\"},\n position: {lat: 32.061051, lng: 118.852237},\n map: map,\n icon:icon\n });\n markerList.push(marker);\n let marker2= new window.google.maps.Marker({\n title: '\u7384\u6b66\u6e56\u516c\u56ed',\n label: {text: '2', color:\"#2360E0\"},\n position: {lat:32.07226,lng: 118.79357},\n map: map,\n icon:icon\n });\n markerList.push(marker2);\n // \u4e3a\u6807\u8bb0\u70b9\u6dfb\u52a0\u70b9\u51fb\u4e8b\u4ef6\n markerList.forEach(function(marker,index){ \n let markerpopup;\n if(index === 0){\n markerpopup =new Popup(marker.getPosition(),marker.title);\n markerpopup.setMap(map);\n popupList.push(markerpopup);\n }\n marker.addListener('click', function() {\n if(popupList.length>0){\n popupList.forEach(function(popup){\n popup.setMap(null);\n })\n }\n if(!markerpopup){\n markerpopup =new Popup(marker.getPosition(),marker.title);\n markerpopup.setMap(map);\n popupList.push(markerpopup);\n }else{\n markerpopup.setMap(map);\n }\n // \u70b9\u51fb\u65f6\u81ea\u52a8\u5c45\u4e2d\n map.setCenter(marker.getPosition());\n }); \n }); \n // \u7ebf\u6761\u8bbe\u7f6e\n var patharr = [];\n patharr.push(marker.getPosition());\n patharr.push(marker2.getPosition());\n var polyOptions = {\n path:patharr,\n geodesic: true,\n strokeColor:\"#0080FF\", // \u989c\u8272\n strokeOpacity: 0.8, // \u900f\u660e\u5ea6 \n strokeWeight: 6 // \u5bbd\u5ea6\n }\n var poly = new window.google.maps.Polyline(polyOptions);\n poly.setMap(map); // \u88c5\u8f7d\n\n }\n\n\n render(){\n return (\n <div>\n <div ref='map' style={{width: '100%',height:'540px'}}></div>\n </div>\n )\n }\n }\n\n export default App;\n "]}}),c=t(213),p=t(223),d=t.n(p),u=function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}(),h=function(n){function e(){var n,t,r,a;o(this,e);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return t=r=i(this,(n=e.__proto__||Object.getPrototypeOf(e)).call.apply(n,[this].concat(l))),r.updateCode=function(n){},r.copyCode=function(){},a=t,i(r,a)}return r(e,n),u(e,[{key:"render",value:function(){var n=this.props.name,e=this.props.code,t=l[n].Code&&l[n].Code.length?l[n].Code:"\u6ca1\u6709\u4ee3\u7801\u54e6~";return s.a.createElement("div",{className:"codeCollapse",style:{marginTop:20,marginBottom:20}},s.a.createElement(c.a,{value:"1"},s.a.createElement(c.a.Item,{title:"\u67e5\u770b\u4ee3\u7801",name:"1",style:{background:"#000",fontSize:"16"}},s.a.createElement(d.a,{className:"language-jsx"},t[e]))))}}]),e}(a.Component);e.a=h},223:function(n,e,t){"use strict";function o(n){return n&&n.__esModule?n:{default:n}}Object.defineProperty(e,"__esModule",{value:!0});var i=t(224);Object.defineProperty(e,"PrismCode",{enumerable:!0,get:function(){return o(i).default}}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return o(i).default}})},224:function(n,e,t){"use strict";function o(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function i(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function r(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}(),s=t(0),l=function(n){return n&&n.__esModule?n:{default:n}}(s),c=t(1),p=function(n){function e(){var n,t,r,a;o(this,e);for(var s=arguments.length,l=Array(s),c=0;c<s;c++)l[c]=arguments[c];return t=r=i(this,(n=e.__proto__||Object.getPrototypeOf(e)).call.apply(n,[this].concat(l))),r._handleRefMount=function(n){r._domNode=n},a=t,i(r,a)}return r(e,n),a(e,[{key:"componentDidMount",value:function(){this._hightlight()}},{key:"componentDidUpdate",value:function(){this._hightlight()}},{key:"_hightlight",value:function(){Prism.highlightElement(this._domNode,this.props.async)}},{key:"render",value:function(){var n=this.props,e=n.className,t=n.component,o=n.children;return l.default.createElement(t,{ref:this._handleRefMount,className:e},o)}}]),e}(s.PureComponent);p.propTypes={async:c.PropTypes.bool,className:c.PropTypes.string,children:c.PropTypes.any,component:c.PropTypes.node},p.defaultProps={component:"code"},e.default=p},228:function(n,e,t){"use strict";function o(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function i(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function r(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}var a=t(0),s=t.n(a),l=t(1),c=t.n(l),p=t(50),d=t(292),u=(t.n(d),function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}()),h=function(n){function e(n){o(this,e);var t=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,n));return t.state={checked:n.checked,focus:n.focus,label:t.getLabel(n)},t}return r(e,n),u(e,[{key:"componentWillReceiveProps",value:function(n){this.setState({checked:n.checked,focus:n.focus,label:this.getLabel(n)})}},{key:"onFocus",value:function(){this.setState({focus:!0})}},{key:"onBlur",value:function(){this.setState({focus:!1})}},{key:"onChange",value:function(n){var e=this;if(n.target instanceof HTMLInputElement){var t=this.state.label,o=this.props,i=o.trueLabel,r=o.falseLabel,a=n.target.checked,s=this.context.ElCheckboxGroup;if(s){var l=s.state.options.length+(a?1:-1);if(void 0!==s.props.min&&l<s.props.min)return;if(void 0!==s.props.max&&l>s.props.max)return}var c=t;(this.props.trueLabel||this.props.falseLabel)&&(c=a?i:r),this.setState({checked:a,label:c},function(){e.props.onChange&&e.props.onChange(a)})}}},{key:"getLabel",value:function(n){return n.trueLabel||n.falseLabel?n.checked?n.trueLabel:n.falseLabel:n.label}},{key:"render",value:function(){return s.a.createElement("label",{style:this.style(),className:this.className("ishow-checkbox")},s.a.createElement("span",{className:this.classNames("ishow-checkbox__input",{"is-disabled":this.props.disabled,"is-checked":this.state.checked,"is-indeterminate":this.props.indeterminate,"is-focus":this.state.focus})},s.a.createElement("span",{className:"ishow-checkbox__inner"}),s.a.createElement("input",{className:"ishow-checkbox__original",type:"checkbox",checked:this.state.checked,disabled:this.props.disabled,onFocus:this.onFocus.bind(this),onBlur:this.onBlur.bind(this),onChange:this.onChange.bind(this)})),s.a.createElement("span",{className:"ishow-checkbox__label",title:this.props.children||this.state.label},this.props.children||this.state.label))}}]),e}(p.b);h.elementType="Checkbox",e.a=h,h.contextTypes={ElCheckboxGroup:c.a.any},h.propTypes={label:c.a.string,trueLabel:c.a.oneOfType([c.a.string,c.a.number]),falseLabel:c.a.oneOfType([c.a.string,c.a.number]),disabled:c.a.bool,checked:c.a.bool,indeterminate:c.a.bool,focus:c.a.bool,onChange:c.a.func},h.defaultProps={checked:!1,focus:!1}},230:function(n,e,t){var o=t(240);"string"===typeof o&&(o=[[n.i,o,""]]);var i={hmr:!1};i.transform=void 0;t(193)(o,i);o.locals&&(n.exports=o.locals)},233:function(n,e){n.exports=function(n,e,t,o){function i(){function i(){a=Number(new Date),t.apply(l,p)}function s(){r=void 0}var l=this,c=Number(new Date)-a,p=arguments;o&&!r&&i(),r&&clearTimeout(r),void 0===o&&c>n?i():!0!==e&&(r=setTimeout(o?s:i,void 0===o?n-c:n))}var r,a=0;return"boolean"!==typeof e&&(o=t,t=e,e=void 0),i}},237:function(n,e,t){(function(e){for(var o=t(238),i="undefined"===typeof window?e:window,r=["moz","webkit"],a="AnimationFrame",s=i["request"+a],l=i["cancel"+a]||i["cancelRequest"+a],c=0;!s&&c<r.length;c++)s=i[r[c]+"Request"+a],l=i[r[c]+"Cancel"+a]||i[r[c]+"CancelRequest"+a];if(!s||!l){var p=0,d=0,u=[];s=function(n){if(0===u.length){var e=o(),t=Math.max(0,1e3/60-(e-p));p=t+e,setTimeout(function(){var n=u.slice(0);u.length=0;for(var e=0;e<n.length;e++)if(!n[e].cancelled)try{n[e].callback(p)}catch(n){setTimeout(function(){throw n},0)}},Math.round(t))}return u.push({handle:++d,callback:n,cancelled:!1}),d},l=function(n){for(var e=0;e<u.length;e++)u[e].handle===n&&(u[e].cancelled=!0)}}n.exports=function(n){return s.call(i,n)},n.exports.cancel=function(){l.apply(i,arguments)},n.exports.polyfill=function(n){n||(n=i),n.requestAnimationFrame=s,n.cancelAnimationFrame=l}}).call(e,t(52))},238:function(n,e,t){(function(e){(function(){var t,o,i,r,a,s;"undefined"!==typeof performance&&null!==performance&&performance.now?n.exports=function(){return performance.now()}:"undefined"!==typeof e&&null!==e&&e.hrtime?(n.exports=function(){return(t()-a)/1e6},o=e.hrtime,t=function(){var n;return n=o(),1e9*n[0]+n[1]},r=t(),s=1e9*e.uptime(),a=r-s):Date.now?(n.exports=function(){return Date.now()-i},i=Date.now()):(n.exports=function(){return(new Date).getTime()-i},i=(new Date).getTime())}).call(this)}).call(e,t(239))},239:function(n,e){function t(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(n){if(p===setTimeout)return setTimeout(n,0);if((p===t||!p)&&setTimeout)return p=setTimeout,setTimeout(n,0);try{return p(n,0)}catch(e){try{return p.call(null,n,0)}catch(e){return p.call(this,n,0)}}}function r(n){if(d===clearTimeout)return clearTimeout(n);if((d===o||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(n);try{return d(n)}catch(e){try{return d.call(null,n)}catch(e){return d.call(this,n)}}}function a(){m&&h&&(m=!1,h.length?A=h.concat(A):f=-1,A.length&&s())}function s(){if(!m){var n=i(a);m=!0;for(var e=A.length;e;){for(h=A,A=[];++f<e;)h&&h[f].run();f=-1,e=A.length}h=null,m=!1,r(n)}}function l(n,e){this.fun=n,this.array=e}function c(){}var p,d,u=n.exports={};!function(){try{p="function"===typeof setTimeout?setTimeout:t}catch(n){p=t}try{d="function"===typeof clearTimeout?clearTimeout:o}catch(n){d=o}}();var h,A=[],m=!1,f=-1;u.nextTick=function(n){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];A.push(new l(n,e)),1!==A.length||m||i(s)},l.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=c,u.addListener=c,u.once=c,u.off=c,u.removeListener=c,u.removeAllListeners=c,u.emit=c,u.prependListener=c,u.prependOnceListener=c,u.listeners=function(n){return[]},u.binding=function(n){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(n){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},240:function(n,e,t){var o=t(194);e=n.exports=t(192)(!0),e.push([n.i,".fade-in-linear-enter-active,.fade-in-linear-leave-active,.ishow-fade-in-linear-enter-active,.ishow-fade-in-linear-leave-active{-webkit-transition:opacity .2s linear;-o-transition:opacity .2s linear;transition:opacity .2s linear}.fade-in-linear-enter,.fade-in-linear-leave,.fade-in-linear-leave-active,.ishow-fade-in-enter,.ishow-fade-in-leave-active,.ishow-fade-in-linear-enter,.ishow-fade-in-linear-leave,.ishow-fade-in-linear-leave-active{opacity:0}.ishow-fade-in-enter-active,.ishow-fade-in-leave-active,.ishow-zoom-in-center-enter-active,.ishow-zoom-in-center-leave-active{-webkit-transition:all .3s cubic-bezier(.55,0,.1,1);-o-transition:all .3s cubic-bezier(.55,0,.1,1);transition:all .3s cubic-bezier(.55,0,.1,1)}.ishow-zoom-in-bottom-enter-active,.ishow-zoom-in-bottom-leave-active,.ishow-zoom-in-left-enter-active,.ishow-zoom-in-left-leave-active,.ishow-zoom-in-top-enter-active,.ishow-zoom-in-top-leave-active{-webkit-transition:opacity .3s cubic-bezier(.23,1,.32,1) .1s,-webkit-transform .3s cubic-bezier(.23,1,.32,1) .1s;transition:opacity .3s cubic-bezier(.23,1,.32,1) .1s,-webkit-transform .3s cubic-bezier(.23,1,.32,1) .1s;-o-transition:transform .3s cubic-bezier(.23,1,.32,1) .1s,opacity .3s cubic-bezier(.23,1,.32,1) .1s;transition:transform .3s cubic-bezier(.23,1,.32,1) .1s,opacity .3s cubic-bezier(.23,1,.32,1) .1s;transition:transform .3s cubic-bezier(.23,1,.32,1) .1s,opacity .3s cubic-bezier(.23,1,.32,1) .1s,-webkit-transform .3s cubic-bezier(.23,1,.32,1) .1s}.ishow-zoom-in-center-enter,.ishow-zoom-in-center-leave-active{opacity:0;-ms-transform:scaleX(0);-webkit-transform:scaleX(0);transform:scaleX(0)}.ishow-zoom-in-top-enter-active,.ishow-zoom-in-top-leave-active{opacity:1;-ms-transform:scaleY(1);-webkit-transform:scaleY(1);transform:scaleY(1);-ms-transform-origin:center top;-webkit-transform-origin:center top;transform-origin:center top}.ishow-zoom-in-top-enter,.ishow-zoom-in-top-leave-active{opacity:0;-ms-transform:scaleY(0);-webkit-transform:scaleY(0);transform:scaleY(0)}.ishow-zoom-in-bottom-enter-active,.ishow-zoom-in-bottom-leave-active{opacity:1;-ms-transform:scaleY(1);-webkit-transform:scaleY(1);transform:scaleY(1);-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;transform-origin:center bottom}.ishow-zoom-in-bottom-enter,.ishow-zoom-in-bottom-leave-active{opacity:0;-ms-transform:scaleY(0);-webkit-transform:scaleY(0);transform:scaleY(0)}.ishow-zoom-in-left-enter-active,.ishow-zoom-in-left-leave-active{opacity:1;-ms-transform:scale(1);-webkit-transform:scale(1);transform:scale(1);-ms-transform-origin:top left;-webkit-transform-origin:top left;transform-origin:top left}.ishow-zoom-in-left-enter,.ishow-zoom-in-left-leave-active{opacity:0;-ms-transform:scale(.45);-webkit-transform:scale(.45);transform:scale(.45)}.collapse-transition{-webkit-transition:height .3s ease-in-out,padding-top .3s ease-in-out,padding-bottom .3s ease-in-out;-o-transition:.3s height ease-in-out,.3s padding-top ease-in-out,.3s padding-bottom ease-in-out;transition:height .3s ease-in-out,padding-top .3s ease-in-out,padding-bottom .3s ease-in-out}.horizontal-collapse-transition{-webkit-transition:width .3s ease-in-out,padding-left .3s ease-in-out,padding-right .3s ease-in-out;-o-transition:.3s width ease-in-out,.3s padding-left ease-in-out,.3s padding-right ease-in-out;transition:width .3s ease-in-out,padding-left .3s ease-in-out,padding-right .3s ease-in-out}.ishow-list-enter-active,.ishow-list-leave-active{-webkit-transition:all 1s;-o-transition:all 1s;transition:all 1s}.ishow-list-enter,.ishow-list-leave-active{opacity:0;-ms-transform:translateY(-30px);-webkit-transform:translateY(-30px);transform:translateY(-30px)}.ishow-opacity-transition{-webkit-transition:opacity .3s cubic-bezier(.55,0,.1,1);-o-transition:opacity .3s cubic-bezier(.55,0,.1,1);transition:opacity .3s cubic-bezier(.55,0,.1,1)}@font-face{font-family:element-icons;src:url("+o(t(208))+') format("woff"),url('+o(t(209))+') format("truetype");font-weight:400;font-style:normal}[class*=" ishow-icon-"],[class^=ishow-icon-]{font-family:element-icons!important;speak:none;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;vertical-align:baseline;display:inline-block;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ishow-icon-arrow-down:before{content:"\\E600"}.ishow-icon-arrow-left:before{content:"\\E601"}.ishow-icon-arrow-right:before{content:"\\E602"}.ishow-icon-arrow-up:before{content:"\\E603"}.ishow-icon-caret-bottom:before{content:"\\E604"}.ishow-icon-caret-left:before{content:"\\E605"}.ishow-icon-caret-right:before{content:"\\E606"}.ishow-icon-caret-top:before{content:"\\E607"}.ishow-icon-check:before{content:"\\E608"}.ishow-icon-circle-check:before{content:"\\E609"}.ishow-icon-circle-close:before{content:"\\E60A"}.ishow-icon-circle-cross:before{content:"\\E60B"}.ishow-icon-close:before{content:"\\E60C"}.ishow-icon-upload:before{content:"\\E60D"}.ishow-icon-d-arrow-left:before{content:"\\E60E"}.ishow-icon-d-arrow-right:before{content:"\\E60F"}.ishow-icon-d-caret:before{content:"\\E610"}.ishow-icon-date:before{content:"\\E611"}.ishow-icon-delete:before{content:"\\E612"}.ishow-icon-document:before{content:"\\E613"}.ishow-icon-edit:before{content:"\\E614"}.ishow-icon-information:before{content:"\\E615"}.ishow-icon-loading:before{content:"\\E616"}.ishow-icon-menu:before{content:"\\E617"}.ishow-icon-message:before{content:"\\E618"}.ishow-icon-minus:before{content:"\\E619"}.ishow-icon-more:before{content:"\\E61A"}.ishow-icon-picture:before{content:"\\E61B"}.ishow-icon-plus:before{content:"\\E61C"}.ishow-icon-search:before{content:"\\E61D"}.ishow-icon-setting:before{content:"\\E61E"}.ishow-icon-share:before{content:"\\E61F"}.ishow-icon-star-off:before{content:"\\E620"}.ishow-icon-star-on:before{content:"\\E621"}.ishow-icon-time:before{content:"\\E622"}.ishow-icon-warning:before{content:"\\E623"}.ishow-icon-delete2:before{content:"\\E624"}.ishow-icon-upload2:before{content:"\\E627"}.ishow-icon-view:before{content:"\\E626"}.ishow-icon-loading{-webkit-animation:rotating 1s linear infinite;animation:rotating 1s linear infinite}.ishow-icon--right{margin-left:5px}.ishow-icon--left{margin-right:5px}@-webkit-keyframes rotating{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes rotating{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}',"",{version:3,sources:["E:/demo/demo/src/ishow/Common/css/Base.css"],names:[],mappings:"AACA,gIAII,sCAAuC,AACvC,iCAAkC,AAClC,6BAA8B,CACjC,AAED,qNAQI,SAAU,CACb,AAED,8HAII,oDAAwD,AACxD,+CAAmD,AACnD,2CAA+C,CAClD,AAED,wMAMI,iHAAyH,AACzH,yGAAiH,AACjH,oGAA4G,AAC5G,iGAAyG,AACzG,oJAAgK,CACnK,AAED,+DAEI,UAAW,AACX,wBAAyB,AACzB,4BAA6B,AACrB,mBAAoB,CAC/B,AAED,gEAEI,UAAW,AACX,wBAAyB,AACzB,4BAA6B,AACrB,oBAAqB,AAC7B,gCAAiC,AACjC,oCAAqC,AAC7B,2BAA4B,CACvC,AAED,yDAEI,UAAW,AACX,wBAAyB,AACzB,4BAA6B,AACrB,mBAAoB,CAC/B,AAED,sEAEI,UAAW,AACX,wBAAyB,AACzB,4BAA6B,AACrB,oBAAqB,AAC7B,mCAAoC,AACpC,uCAAwC,AAChC,8BAA+B,CAC1C,AAED,+DAEI,UAAW,AACX,wBAAyB,AACzB,4BAA6B,AACrB,mBAAoB,CAC/B,AAED,kEAEI,UAAW,AACX,uBAA2B,AAC3B,2BAA+B,AACvB,mBAAuB,AAC/B,8BAA+B,AAC/B,kCAAmC,AAC3B,yBAA0B,CACrC,AAED,2DAEI,UAAW,AACX,yBAA+B,AAC/B,6BAAmC,AAC3B,oBAA0B,CACrC,AAED,qBACI,qGAAwG,AACxG,gGAAmG,AACnG,4FAA+F,CAClG,AAED,gCACI,oGAAuG,AACvG,+FAAkG,AAClG,2FAA8F,CACjG,AAED,kDAEI,0BAA2B,AAC3B,qBAAsB,AACtB,iBAAkB,CACrB,AAED,2CAEI,UAAW,AACX,gCAAiC,AACjC,oCAAqC,AAC7B,2BAA4B,CACvC,AAED,0BACI,wDAA4D,AAC5D,mDAAuD,AACvD,+CAAmD,CACtD,AAED,WACI,0BAA2B,AAC3B,kGAAqG,AACrG,gBAAiB,AACjB,iBAAkB,CACrB,AAED,6CAEI,oCAAsC,AACtC,WAAY,AACZ,kBAAmB,AACnB,gBAAiB,AACjB,oBAAqB,AACrB,oBAAqB,AACrB,cAAe,AACf,wBAAyB,AACzB,qBAAsB,AACtB,mCAAoC,AACpC,iCAAkC,CACrC,AAED,8BACI,eAAgB,CACnB,AAED,8BACI,eAAgB,CACnB,AAED,+BACI,eAAgB,CACnB,AAED,4BACI,eAAgB,CACnB,AAED,gCACI,eAAgB,CACnB,AAED,8BACI,eAAgB,CACnB,AAED,+BACI,eAAgB,CACnB,AAED,6BACI,eAAgB,CACnB,AAED,yBACI,eAAgB,CACnB,AAED,gCACI,eAAgB,CACnB,AAED,gCACI,eAAgB,CACnB,AAED,gCACI,eAAgB,CACnB,AAED,yBACI,eAAgB,CACnB,AAED,0BACI,eAAgB,CACnB,AAED,gCACI,eAAgB,CACnB,AAED,iCACI,eAAgB,CACnB,AAED,2BACI,eAAgB,CACnB,AAED,wBACI,eAAgB,CACnB,AAED,0BACI,eAAgB,CACnB,AAED,4BACI,eAAgB,CACnB,AAED,wBACI,eAAgB,CACnB,AAED,+BACI,eAAgB,CACnB,AAED,2BACI,eAAgB,CACnB,AAED,wBACI,eAAgB,CACnB,AAED,2BACI,eAAgB,CACnB,AAED,yBACI,eAAgB,CACnB,AAED,wBACI,eAAgB,CACnB,AAED,2BACI,eAAgB,CACnB,AAED,wBACI,eAAgB,CACnB,AAED,0BACI,eAAgB,CACnB,AAED,2BACI,eAAgB,CACnB,AAED,yBACI,eAAgB,CACnB,AAED,4BACI,eAAgB,CACnB,AAED,2BACI,eAAgB,CACnB,AAED,wBACI,eAAgB,CACnB,AAED,2BACI,eAAgB,CACnB,AAED,2BACI,eAAgB,CACnB,AAED,2BACI,eAAgB,CACnB,AAED,wBACI,eAAgB,CACnB,AAED,oBACI,8CAA+C,AACvC,qCAAsC,CACjD,AAED,mBACI,eAAgB,CACnB,AAED,kBACI,gBAAiB,CACpB,AAED,4BACI,GACI,4BAA8B,AACtB,mBAAqB,CAChC,AACD,GACI,gCAAmC,AAC3B,uBAA0B,CACrC,CACJ,AAED,oBACI,GACI,4BAA8B,AACtB,mBAAqB,CAChC,AACD,GACI,gCAAmC,AAC3B,uBAA0B,CACrC,CACJ",file:"Base.css",sourcesContent:['@charset "UTF-8";\r\n.ishow-fade-in-linear-enter-active,\r\n.ishow-fade-in-linear-leave-active,\r\n.fade-in-linear-enter-active,\r\n.fade-in-linear-leave-active {\r\n -webkit-transition: opacity .2s linear;\r\n -o-transition: opacity .2s linear;\r\n transition: opacity .2s linear\r\n}\r\n\r\n.ishow-fade-in-enter,\r\n.ishow-fade-in-leave-active,\r\n.ishow-fade-in-linear-enter,\r\n.ishow-fade-in-linear-leave,\r\n.ishow-fade-in-linear-leave-active,\r\n.fade-in-linear-enter,\r\n.fade-in-linear-leave,\r\n.fade-in-linear-leave-active {\r\n opacity: 0\r\n}\r\n\r\n.ishow-fade-in-enter-active,\r\n.ishow-fade-in-leave-active,\r\n.ishow-zoom-in-center-enter-active,\r\n.ishow-zoom-in-center-leave-active {\r\n -webkit-transition: all .3s cubic-bezier(.55, 0, .1, 1);\r\n -o-transition: all .3s cubic-bezier(.55, 0, .1, 1);\r\n transition: all .3s cubic-bezier(.55, 0, .1, 1)\r\n}\r\n\r\n.ishow-zoom-in-bottom-enter-active,\r\n.ishow-zoom-in-bottom-leave-active,\r\n.ishow-zoom-in-left-enter-active,\r\n.ishow-zoom-in-left-leave-active,\r\n.ishow-zoom-in-top-enter-active,\r\n.ishow-zoom-in-top-leave-active {\r\n -webkit-transition: opacity .3s cubic-bezier(.23, 1, .32, 1) .1s, -webkit-transform .3s cubic-bezier(.23, 1, .32, 1) .1s;\r\n transition: opacity .3s cubic-bezier(.23, 1, .32, 1) .1s, -webkit-transform .3s cubic-bezier(.23, 1, .32, 1) .1s;\r\n -o-transition: transform .3s cubic-bezier(.23, 1, .32, 1) .1s, opacity .3s cubic-bezier(.23, 1, .32, 1) .1s;\r\n transition: transform .3s cubic-bezier(.23, 1, .32, 1) .1s, opacity .3s cubic-bezier(.23, 1, .32, 1) .1s;\r\n transition: transform .3s cubic-bezier(.23, 1, .32, 1) .1s, opacity .3s cubic-bezier(.23, 1, .32, 1) .1s, -webkit-transform .3s cubic-bezier(.23, 1, .32, 1) .1s\r\n}\r\n\r\n.ishow-zoom-in-center-enter,\r\n.ishow-zoom-in-center-leave-active {\r\n opacity: 0;\r\n -ms-transform: scaleX(0);\r\n -webkit-transform: scaleX(0);\r\n transform: scaleX(0)\r\n}\r\n\r\n.ishow-zoom-in-top-enter-active,\r\n.ishow-zoom-in-top-leave-active {\r\n opacity: 1;\r\n -ms-transform: scaleY(1);\r\n -webkit-transform: scaleY(1);\r\n transform: scaleY(1);\r\n -ms-transform-origin: center top;\r\n -webkit-transform-origin: center top;\r\n transform-origin: center top\r\n}\r\n\r\n.ishow-zoom-in-top-enter,\r\n.ishow-zoom-in-top-leave-active {\r\n opacity: 0;\r\n -ms-transform: scaleY(0);\r\n -webkit-transform: scaleY(0);\r\n transform: scaleY(0)\r\n}\r\n\r\n.ishow-zoom-in-bottom-enter-active,\r\n.ishow-zoom-in-bottom-leave-active {\r\n opacity: 1;\r\n -ms-transform: scaleY(1);\r\n -webkit-transform: scaleY(1);\r\n transform: scaleY(1);\r\n -ms-transform-origin: center bottom;\r\n -webkit-transform-origin: center bottom;\r\n transform-origin: center bottom\r\n}\r\n\r\n.ishow-zoom-in-bottom-enter,\r\n.ishow-zoom-in-bottom-leave-active {\r\n opacity: 0;\r\n -ms-transform: scaleY(0);\r\n -webkit-transform: scaleY(0);\r\n transform: scaleY(0)\r\n}\r\n\r\n.ishow-zoom-in-left-enter-active,\r\n.ishow-zoom-in-left-leave-active {\r\n opacity: 1;\r\n -ms-transform: scale(1, 1);\r\n -webkit-transform: scale(1, 1);\r\n transform: scale(1, 1);\r\n -ms-transform-origin: top left;\r\n -webkit-transform-origin: top left;\r\n transform-origin: top left\r\n}\r\n\r\n.ishow-zoom-in-left-enter,\r\n.ishow-zoom-in-left-leave-active {\r\n opacity: 0;\r\n -ms-transform: scale(.45, .45);\r\n -webkit-transform: scale(.45, .45);\r\n transform: scale(.45, .45)\r\n}\r\n\r\n.collapse-transition {\r\n -webkit-transition: .3s height ease-in-out, .3s padding-top ease-in-out, .3s padding-bottom ease-in-out;\r\n -o-transition: .3s height ease-in-out, .3s padding-top ease-in-out, .3s padding-bottom ease-in-out;\r\n transition: .3s height ease-in-out, .3s padding-top ease-in-out, .3s padding-bottom ease-in-out\r\n}\r\n\r\n.horizontal-collapse-transition {\r\n -webkit-transition: .3s width ease-in-out, .3s padding-left ease-in-out, .3s padding-right ease-in-out;\r\n -o-transition: .3s width ease-in-out, .3s padding-left ease-in-out, .3s padding-right ease-in-out;\r\n transition: .3s width ease-in-out, .3s padding-left ease-in-out, .3s padding-right ease-in-out\r\n}\r\n\r\n.ishow-list-enter-active,\r\n.ishow-list-leave-active {\r\n -webkit-transition: all 1s;\r\n -o-transition: all 1s;\r\n transition: all 1s\r\n}\r\n\r\n.ishow-list-enter,\r\n.ishow-list-leave-active {\r\n opacity: 0;\r\n -ms-transform: translateY(-30px);\r\n -webkit-transform: translateY(-30px);\r\n transform: translateY(-30px)\r\n}\r\n\r\n.ishow-opacity-transition {\r\n -webkit-transition: opacity .3s cubic-bezier(.55, 0, .1, 1);\r\n -o-transition: opacity .3s cubic-bezier(.55, 0, .1, 1);\r\n transition: opacity .3s cubic-bezier(.55, 0, .1, 1)\r\n}\r\n\r\n@font-face {\r\n font-family: element-icons;\r\n src: url(../fonts/ishow-icons.woff) format(\'woff\'), url(../fonts/ishow-icons.ttf) format(\'truetype\');\r\n font-weight: 400;\r\n font-style: normal\r\n}\r\n\r\n[class*=" ishow-icon-"],\r\n[class^=ishow-icon-] {\r\n font-family: element-icons !important;\r\n speak: none;\r\n font-style: normal;\r\n font-weight: 400;\r\n font-variant: normal;\r\n text-transform: none;\r\n line-height: 1;\r\n vertical-align: baseline;\r\n display: inline-block;\r\n -webkit-font-smoothing: antialiased;\r\n -moz-osx-font-smoothing: grayscale\r\n}\r\n\r\n.ishow-icon-arrow-down:before {\r\n content: "\\e600"\r\n}\r\n\r\n.ishow-icon-arrow-left:before {\r\n content: "\\e601"\r\n}\r\n\r\n.ishow-icon-arrow-right:before {\r\n content: "\\e602"\r\n}\r\n\r\n.ishow-icon-arrow-up:before {\r\n content: "\\e603"\r\n}\r\n\r\n.ishow-icon-caret-bottom:before {\r\n content: "\\e604"\r\n}\r\n\r\n.ishow-icon-caret-left:before {\r\n content: "\\e605"\r\n}\r\n\r\n.ishow-icon-caret-right:before {\r\n content: "\\e606"\r\n}\r\n\r\n.ishow-icon-caret-top:before {\r\n content: "\\e607"\r\n}\r\n\r\n.ishow-icon-check:before {\r\n content: "\\e608"\r\n}\r\n\r\n.ishow-icon-circle-check:before {\r\n content: "\\e609"\r\n}\r\n\r\n.ishow-icon-circle-close:before {\r\n content: "\\e60a"\r\n}\r\n\r\n.ishow-icon-circle-cross:before {\r\n content: "\\e60b"\r\n}\r\n\r\n.ishow-icon-close:before {\r\n content: "\\e60c"\r\n}\r\n\r\n.ishow-icon-upload:before {\r\n content: "\\e60d"\r\n}\r\n\r\n.ishow-icon-d-arrow-left:before {\r\n content: "\\e60e"\r\n}\r\n\r\n.ishow-icon-d-arrow-right:before {\r\n content: "\\e60f"\r\n}\r\n\r\n.ishow-icon-d-caret:before {\r\n content: "\\e610"\r\n}\r\n\r\n.ishow-icon-date:before {\r\n content: "\\e611"\r\n}\r\n\r\n.ishow-icon-delete:before {\r\n content: "\\e612"\r\n}\r\n\r\n.ishow-icon-document:before {\r\n content: "\\e613"\r\n}\r\n\r\n.ishow-icon-edit:before {\r\n content: "\\e614"\r\n}\r\n\r\n.ishow-icon-information:before {\r\n content: "\\e615"\r\n}\r\n\r\n.ishow-icon-loading:before {\r\n content: "\\e616"\r\n}\r\n\r\n.ishow-icon-menu:before {\r\n content: "\\e617"\r\n}\r\n\r\n.ishow-icon-message:before {\r\n content: "\\e618"\r\n}\r\n\r\n.ishow-icon-minus:before {\r\n content: "\\e619"\r\n}\r\n\r\n.ishow-icon-more:before {\r\n content: "\\e61a"\r\n}\r\n\r\n.ishow-icon-picture:before {\r\n content: "\\e61b"\r\n}\r\n\r\n.ishow-icon-plus:before {\r\n content: "\\e61c"\r\n}\r\n\r\n.ishow-icon-search:before {\r\n content: "\\e61d"\r\n}\r\n\r\n.ishow-icon-setting:before {\r\n content: "\\e61e"\r\n}\r\n\r\n.ishow-icon-share:before {\r\n content: "\\e61f"\r\n}\r\n\r\n.ishow-icon-star-off:before {\r\n content: "\\e620"\r\n}\r\n\r\n.ishow-icon-star-on:before {\r\n content: "\\e621"\r\n}\r\n\r\n.ishow-icon-time:before {\r\n content: "\\e622"\r\n}\r\n\r\n.ishow-icon-warning:before {\r\n content: "\\e623"\r\n}\r\n\r\n.ishow-icon-delete2:before {\r\n content: "\\e624"\r\n}\r\n\r\n.ishow-icon-upload2:before {\r\n content: "\\e627"\r\n}\r\n\r\n.ishow-icon-view:before {\r\n content: "\\e626"\r\n}\r\n\r\n.ishow-icon-loading {\r\n -webkit-animation: rotating 1s linear infinite;\r\n animation: rotating 1s linear infinite\r\n}\r\n\r\n.ishow-icon--right {\r\n margin-left: 5px\r\n}\r\n\r\n.ishow-icon--left {\r\n margin-right: 5px\r\n}\r\n\r\n@-webkit-keyframes rotating {\r\n 0% {\r\n -webkit-transform: rotateZ(0);\r\n transform: rotateZ(0)\r\n }\r\n 100% {\r\n -webkit-transform: rotateZ(360deg);\r\n transform: rotateZ(360deg)\r\n }\r\n}\r\n\r\n@keyframes rotating {\r\n 0% {\r\n -webkit-transform: rotateZ(0);\r\n transform: rotateZ(0)\r\n }\r\n 100% {\r\n -webkit-transform: rotateZ(360deg);\r\n transform: rotateZ(360deg)\r\n }\r\n}'],sourceRoot:""}])},242:function(n,e,t){"use strict";function o(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function i(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function r(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}var a=t(0),s=t.n(a),l=(t(201),{Tree:{Options:[{param:"message",instruction:"\u6d88\u606f\u6587\u5b57",type:"string/ReactElement",optional:"\u2014",defaultvalue:"\u2014"},{param:"type",instruction:"\u4e3b\u9898",type:"string",optional:"success/warning/info/error",defaultvalue:"info"},{param:"iconClass",instruction:"\u81ea\u5b9a\u4e49\u56fe\u6807\u7684\u7c7b\u540d\uff0c\u4f1a\u8986\u76d6 type",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"customClass",instruction:"\u81ea\u5b9a\u4e49\u7c7b\u540d",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"duration",instruction:"\u663e\u793a\u65f6\u95f4, \u6beb\u79d2\u3002\u8bbe\u4e3a 0 \u5219\u4e0d\u4f1a\u81ea\u52a8\u5173\u95ed",type:"number",optional:"\u2014",defaultvalue:"3000"},{param:"showClose",instruction:"\u662f\u5426\u663e\u793a\u5173\u95ed\u6309\u94ae",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"onClose",instruction:"\u5173\u95ed\u65f6\u7684\u56de\u8c03\u51fd\u6570, \u53c2\u6570\u4e3a\u88ab\u5173\u95ed\u7684 message \u5b9e\u4f8b",type:"function",optional:"\u2014",defaultvalue:"\u2014"}],List:[{param:"data",instruction:"\u5c55\u793a\u6570\u636e",type:"array",optional:"\u2014",defaultvalue:"\u2014"},{param:"emptyText",instruction:"\u5185\u5bb9\u4e3a\u7a7a\u7684\u65f6\u5019\u5c55\u793a\u7684\u6587\u672c",type:"String",optional:"\u2014",defaultvalue:"\u2014"},{param:"nodeKey",instruction:"\u6bcf\u4e2a\u6811\u8282\u70b9\u7528\u6765\u4f5c\u4e3a\u552f\u4e00\u6807\u8bc6\u7684\u5c5e\u6027\uff0c\u6574\u9897\u6811\u5e94\u8be5\u662f\u552f\u4e00\u7684",type:"String",optional:"\u2014",defaultvalue:"\u2014"},{param:"options",instruction:"\u914d\u7f6e\u9009\u9879\uff0c\u5177\u4f53\u770b\u4e0b\u8868",type:"object",optional:"\u2014",defaultvalue:"\u2014"},{param:"load",instruction:"\u52a0\u8f7d\u5b50\u6811\u6570\u636e\u7684\u65b9\u6cd5",type:"function(node, resolve)",optional:"\u2014",defaultvalue:"\u2014"},{param:"renderContent",instruction:"\u6811\u8282\u70b9\u7684\u5185\u5bb9\u533a\u7684\u6e32\u67d3 Function",type:"(nodeModel, data, store)=>ReactElement",optional:"\u2014",defaultvalue:"\u2014"},{param:"highlightCurrent",instruction:"\u662f\u5426\u9ad8\u4eae\u5f53\u524d\u9009\u4e2d\u8282\u70b9\uff0c\u9ed8\u8ba4\u503c\u662f false\u3002",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"currentNodeKey",instruction:"\u5f53\u524d\u9009\u4e2d\u8282\u70b9\u7684 key\uff0c\u53ea\u5199\u5c5e\u6027",type:"string, number",optional:"\u2014",defaultvalue:"\u2014"},{param:"defaultExpandAll",instruction:"\u662f\u5426\u9ed8\u8ba4\u5c55\u5f00\u6240\u6709\u8282\u70b9",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"expandOnClickNode",instruction:"\u662f\u5426\u5728\u70b9\u51fb\u8282\u70b9\u7684\u65f6\u5019\u5c55\u5f00\u6216\u8005\u6536\u7f29\u8282\u70b9\uff0c\u9ed8\u8ba4\u503c\u4e3atrue,\u5982\u679c\u4e3afalse\uff0c\u5219\u53ea\u6709\u70b9\u7bad\u5934\u56fe\u6807\u7684\u65f6\u5019\u624d\u4f1a\u5c55\u5f00\u6216\u8005\u6536\u7f29\u8282\u70b9\u3002",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"autoExpandParent",instruction:"\u5c55\u5f00\u5b50\u8282\u70b9\u7684\u65f6\u5019\u662f\u5426\u81ea\u52a8\u5c55\u5f00\u7236\u8282\u70b9",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"defaultExpandedKeys",instruction:"\u9ed8\u8ba4\u5c55\u5f00\u7684\u8282\u70b9\u7684key\u7684\u6570\u7ec4",type:"array",optional:"\u2014",defaultvalue:"\u2014"},{param:"isShowCheckbox",instruction:"\u8282\u70b9\u662f\u5426\u53ef\u88ab\u9009\u62e9",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"checkedKeyStrictly",instruction:"\u5728\u663e\u793a\u590d\u9009\u6846\u7684\u60c5\u51b5\u4e0b\uff0c\u662f\u5426\u4e25\u683c\u7684\u9075\u5faa\u7236\u5b50\u4e0d\u4e92\u76f8\u5173\u8054\u7684\u505a\u6cd5\uff0c\u9ed8\u8ba4\u4e3afalse",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"defaultCheckedKeys",instruction:"\u9ed8\u8ba4\u52fe\u9009\u7684\u8282\u70b9\u7684key\u7684\u6570\u7ec4",type:"array",optional:"\u2014",defaultvalue:"\u2014"},{param:"filterNodeMethod",instruction:"\u5bf9\u6811\u8282\u70b9\u8fdb\u884c\u7b5b\u9009\u65f6\u6267\u884c\u7684\u65b9\u6cd5\uff0c\u8fd4\u56de true \u8868\u793a\u8fd9\u4e2a\u8282\u70b9\u53ef\u4ee5\u663e\u793a\uff0c\u8fd4\u56de false \u5219\u8868\u793a\u8fd9\u4e2a\u8282\u70b9\u4f1a\u88ab\u9690\u85cf",type:"Function(value, data, node)",optional:"\u2014",defaultvalue:"\u2014"},{param:"accordion",instruction:"\u662f\u5426\u6bcf\u6b21\u53ea\u6253\u5f00\u4e00\u4e2a\u540c\u7ea7\u6811\u8282\u70b9\u5c55\u5f00",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"indent",instruction:"\u76f8\u90bb\u7ea7\u8282\u70b9\u95f4\u7684\u6c34\u5e73\u7f29\u8fdb\uff0c\u5355\u4f4d\u4e3a\u50cf\u7d20",type:"number",optional:"\u2014",defaultvalue:"16"}],Events:[{eventName:"onNodeClicked",instruction:"\u8282\u70b9\u88ab\u70b9\u51fb\u65f6\u7684\u56de\u8c03",callbackParam:"onNodeClicked(nodeModel.data, node)"},{eventName:"onCheckChange",instruction:"\u8282\u70b9\u9009\u4e2d\u72b6\u6001\u53d1\u751f\u53d8\u5316\u65f6\u7684\u56de\u8c03",callbackParam:"onCheckChange(nodeModel.data, checked, indeterminate)"},{eventName:"onCurrentChange",instruction:"\u5f53\u524d\u9009\u4e2d\u8282\u70b9\u53d8\u5316\u65f6\u89e6\u53d1\u7684\u4e8b\u4ef6",callbackParam:"onCurrentChange(nodeModel.data, node)"},{eventName:"onNodeExpand",instruction:"\u8282\u70b9\u88ab\u5c55\u5f00\u65f6\u89e6\u53d1\u7684\u4e8b\u4ef6",callbackParam:"onNodeExpand(nodeModel.data, nodeModel, node)"},{eventName:"onNodeCollapse",instruction:"\u8282\u70b9\u88ab\u5173\u95ed\u65f6\u89e6\u53d1\u7684\u4e8b\u4ef6",callbackParam:"onNodeCollapse(nodeModel.data, nodeModel, node)"}]},Form:{List:[{param:"model",instruction:"\u8868\u5355\u6570\u636e\u5bf9\u8c61",type:"object",optional:"\u2014",defaultvalue:"\u2014"},{param:"rules",instruction:"\u8868\u5355\u9a8c\u8bc1\u89c4\u5219",type:"object",optional:"\u2014",defaultvalue:"\u2014"},{param:"inline",instruction:"\u884c\u5185\u8868\u5355\u6a21\u5f0f",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"labelPosition",instruction:"\u8868\u5355\u57df\u6807\u7b7e\u7684\u4f4d\u7f6e",type:"string",optional:"\u2014",defaultvalue:"right"},{param:"labelWidth",instruction:"\u8868\u5355\u57df\u6807\u7b7e\u7684\u5bbd\u5ea6\uff0c\u6240\u6709\u7684 form-item \u90fd\u4f1a\u7ee7\u627f form \u7ec4\u4ef6\u7684 labelWidth \u7684\u503c",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"labelSuffix",instruction:"\u8868\u5355\u57df\u6807\u7b7e\u7684\u540e\u7f00",type:"string",optional:"\u2014",defaultvalue:"\u2014"}],Method:[{methodName:"validate(cb)",instruction:"\u5bf9\u6574\u4e2a\u8868\u5355\u8fdb\u884c\u6821\u9a8c\u7684\u65b9\u6cd5",methodParam:"\u2014"},{methodName:"validateField(prop, cb)",instruction:"\u5bf9\u90e8\u5206\u8868\u5355\u5b57\u6bb5\u8fdb\u884c\u6821\u9a8c\u7684\u65b9\u6cd5",methodParam:"\u2014"},{methodName:"resetFields",instruction:"\u5bf9\u6574\u4e2a\u8868\u5355\u8fdb\u884c\u91cd\u7f6e\uff0c\u5c06\u6240\u6709\u5b57\u6bb5\u503c\u91cd\u7f6e\u4e3a\u7a7a\u5e76\u79fb\u9664\u6821\u9a8c\u7ed3\u679c",methodParam:"\u2014"}]},FormItem:{List:[{param:"prop",instruction:"\u8868\u5355\u57df model \u5b57\u6bb5",type:"string",optional:"\u4f20\u5165 Form \u7ec4\u4ef6\u7684 model \u4e2d\u7684\u5b57\u6bb5",defaultvalue:"\u2014"},{param:"label",instruction:"\u6807\u7b7e\u6587\u672c",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"labelWidth",instruction:"\u8868\u5355\u57df\u6807\u7b7e\u7684\u7684\u5bbd\u5ea6\uff0c\u4f8b\u5982`50px`",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"required",instruction:"\u662f\u5426\u5fc5\u586b\uff0c\u5982\u4e0d\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6839\u636e\u6821\u9a8c\u89c4\u5219\u81ea\u52a8\u751f\u6210",type:"boolean",optional:"\u2014",defaultvalue:"false"}]},Transfer:{List:[{param:"data",instruction:"Transfer \u7684\u6570\u636e\u6e90",type:"array[{ key, label, disabled }]",optional:"\u2014",defaultvalue:"[ ]"},{param:"filterable",instruction:"\u662f\u5426\u53ef\u641c\u7d22",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"filterPlaceholder",instruction:"\u641c\u7d22\u6846\u5360\u4f4d\u7b26",type:"string",optional:"\u2014",defaultvalue:"\u8bf7\u8f93\u5165\u641c\u7d22\u5185\u5bb9"},{param:"filterMethod",instruction:"\u81ea\u5b9a\u4e49\u641c\u7d22\u65b9\u6cd5",type:"function",optional:"\u2014",defaultvalue:"\u2014"},{param:"titles",instruction:"\u81ea\u5b9a\u4e49\u5217\u8868\u6807\u9898",type:"array",optional:"\u2014",defaultvalue:"['\u5217\u8868 1', '\u5217\u8868 2']"},{param:"buttonTexts",instruction:"\u81ea\u5b9a\u4e49\u6309\u94ae\u6587\u6848",type:"array",optional:"\u2014",defaultvalue:"[]"},{param:"renderContent",instruction:"\u81ea\u5b9a\u4e49\u6570\u636e\u9879\u6e32\u67d3\u51fd\u6570",type:"function(h, option)",optional:"\u2014",defaultvalue:"\u2014"},{param:"footerFormat",instruction:"\u5217\u8868\u5e95\u90e8\u52fe\u9009\u72b6\u6001\u6587\u6848",type:"object{noChecked, hasChecked}",optional:"\u2014",defaultvalue:"{ noChecked: '\u5171 total \u9879', hasChecked: '\u5df2\u9009 checked/total \u9879' }"},{param:"propsAlias",instruction:"\u6570\u636e\u6e90\u7684\u5b57\u6bb5\u522b\u540d",type:"object{key, label, disabled}",optional:"\u2014",defaultvalue:"\u2014"},{param:"leftDefaultChecked",instruction:"\u521d\u59cb\u72b6\u6001\u4e0b\u5de6\u4fa7\u5217\u8868\u7684\u5df2\u52fe\u9009\u9879\u7684 key \u6570\u7ec4",type:"array",optional:"\u2014",defaultvalue:"[ ]"},{param:"rightDefaultChecked",instruction:"\u521d\u59cb\u72b6\u6001\u4e0b\u53f3\u4fa7\u5217\u8868\u7684\u5df2\u52fe\u9009\u9879\u7684 key \u6570\u7ec4",type:"array",optional:"\u2014",defaultvalue:"[ ]"},{param:"leftFooter",instruction:"\u5de6\u4fa7\u5217\u8868\u5e95\u90e8\u7684\u5185\u5bb9",type:"ReactElement",optional:"-",defaultvalue:"-"},{param:"rightFooter",instruction:"\u53f3\u4fa7\u5217\u8868\u5e95\u90e8\u7684\u5185\u5bb9",type:"ReactElement",optional:"\u2014",defaultvalue:"-"},{param:"allCheckVisible",instruction:"\u662f\u5426\u663e\u793a\u5168\u9009\u52fe\u9009\u6846",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"isShowTitle",instruction:"\u662f\u5426\u663e\u793a\u9762\u677f\u5934\u90e8\u6807\u9898",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"disabled",instruction:"\u662f\u5426\u7981\u7528\u9009\u62e9\u6846",type:"boolean",optional:"\u2014",defaultvalue:"false"}],Events:[{eventName:"onChange",instruction:"\u53f3\u4fa7\u5217\u8868\u5143\u7d20\u53d8\u5316\u65f6\u89e6\u53d1",callbackParam:"\u5f53\u524d\u503c\u3001\u6570\u636e\u79fb\u52a8\u7684\u65b9\u5411\uff08'left' / 'right'\uff09\u3001\u53d1\u751f\u79fb\u52a8\u7684\u6570\u636e key \u6570\u7ec4"}]},Carousel:{List:[{param:"height",instruction:"\u8d70\u9a6c\u706f\u7684\u9ad8\u5ea6",type:"number",optional:"\u2014",defaultvalue:"300"},{param:"initialIndex",instruction:"\u521d\u59cb\u72b6\u6001\u6fc0\u6d3b\u7684\u5e7b\u706f\u7247\u7684\u7d22\u5f15\uff0c\u4ece 0 \u5f00\u59cb",type:"number",optional:"\u2014",defaultvalue:"0"},{param:"trigger",instruction:"\u6307\u793a\u5668\u7684\u89e6\u53d1\u65b9\u5f0f",type:"string",optional:"click",defaultvalue:"\u2014"},{param:"autoplay",instruction:"\u662f\u5426\u81ea\u52a8\u5207\u6362",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"interval",instruction:"\u81ea\u52a8\u5207\u6362\u7684\u65f6\u95f4\u95f4\u9694\uff0c\u5355\u4f4d\u4e3a\u6beb\u79d2",type:"number",optional:"\u2014",defaultvalue:"true"},{param:"indicatorPosition",instruction:"\u6307\u793a\u5668\u7684\u4f4d\u7f6e",type:"string",optional:"outside/none",defaultvalue:"\u2014"},{param:"arrow",instruction:"\u5207\u6362\u7bad\u5934\u7684\u663e\u793a\u65f6\u673a",type:"string",optional:"always/hover/never",defaultvalue:"hover"},{param:"type",instruction:"\u8d70\u9a6c\u706f\u7684\u7c7b\u578b",type:"string",optional:"card/flatcard",defaultvalue:"\u2014"}],Events:[{eventName:"onChange",instruction:"\u5e7b\u706f\u7247\u5207\u6362\u65f6\u89e6\u53d1",callbackParam:"\u76ee\u524d\u6fc0\u6d3b\u7684\u5e7b\u706f\u7247\u7684\u7d22\u5f15\uff0c\u539f\u5e7b\u706f\u7247\u7684\u7d22\u5f15"}],Method:[{methodName:"setActiveItem",instruction:"\u624b\u52a8\u5207\u6362\u5e7b\u706f\u7247",methodParam:"\u9700\u8981\u5207\u6362\u7684\u5e7b\u706f\u7247\u7684\u7d22\u5f15\uff0c\u4ece 0 \u5f00\u59cb\uff1b\u6216\u76f8\u5e94 Carousel.Item \u7684 name \u5c5e\u6027\u503c"},{methodName:"prev",instruction:"\u5207\u6362\u81f3\u4e0a\u4e00\u5f20\u5e7b\u706f\u7247",methodParam:"\u2014"},{methodName:"next",instruction:"\u5207\u6362\u81f3\u4e0b\u4e00\u5f20\u5e7b\u706f\u7247",methodParam:"\u2014"}]},CarouselItem:{List:[{param:"name",instruction:"\u5e7b\u706f\u7247\u7684\u540d\u5b57\uff0c\u53ef\u7528\u4f5c setActiveItem \u7684\u53c2\u6570",type:"string",optional:"\u2014",defaultvalue:"\u2014"}]},Collapse:{List:[{param:"accordion",instruction:"\u662f\u5426\u4e3a\u624b\u98ce\u7434\u6a21\u5f0f",type:"boolean",optional:"-",defaultvalue:"false"},{param:"value",instruction:"\u5f53\u524d\u6fc0\u6d3b\u7684\u9762\u677f(\u5982\u679c\u662f\u624b\u98ce\u7434\u6a21\u5f0f\uff0c\u7ed1\u5b9a\u503c\u7c7b\u578b\u9700\u8981\u4e3astring\uff0c\u5426\u5219\u4e3aarray)",type:"string/array",optional:"-",defaultvalue:"-"}],Events:[{eventName:"onChange",instruction:"\u5f53\u524d\u6fc0\u6d3b\u9762\u677f\u6539\u53d8\u65f6\u89e6\u53d1(\u5982\u679c\u662f\u624b\u98ce\u7434\u6a21\u5f0f\uff0c\u53c2\u6570\u7c7b\u578b\u4e3astring\uff0c\u5426\u5219\u4e3aarray)",callbackParam:"(activeNames: array/string)"}]},CollapseItem:{List:[{param:"name",instruction:"\u552f\u4e00\u6807\u5fd7\u7b26",type:"string/number",optional:"-",defaultvalue:"-"},{param:"title",instruction:"\u9762\u677f\u6807\u9898",type:"string/node",optional:"-",defaultvalue:"-"}]},Rate:{List:[{param:"max",instruction:"\u6700\u5927\u5206\u503c",type:"number",optional:"-",defaultvalue:"5"},{param:"disabled",instruction:"\u662f\u5426\u4e3a\u53ea\u8bfb",type:"boolean",optional:"-",defaultvalue:"false"},{param:"allowHalf",instruction:"\u662f\u5426\u5141\u8bb8\u534a\u9009",type:"boolean",optional:"-",defaultvalue:"false"},{param:"lowThreshold",instruction:"\u4f4e\u5206\u548c\u4e2d\u7b49\u5206\u6570\u7684\u754c\u7ebf\u503c\uff0c\u503c\u672c\u8eab\u88ab\u5212\u5206\u5728\u4f4e\u5206\u4e2d",type:"number",optional:"-",defaultvalue:"2"},{param:"highThreshold",instruction:"\u9ad8\u5206\u548c\u4e2d\u7b49\u5206\u6570\u7684\u754c\u7ebf\u503c\uff0c\u503c\u672c\u8eab\u88ab\u5212\u5206\u5728\u9ad8\u5206\u4e2d",type:"number",optional:"-",defaultvalue:"4"},{param:"colors",instruction:"icon\u7684\u989c\u8272\u6570\u7ec4\uff0c\u5171\u67093\u4e2a\u5143\u7d20\uff0c\u4e3a3\u4e2a\u5206\u6bb5\u591a\u5bf9\u5e94\u7684\u989c\u8272",type:"array",optional:"-",defaultvalue:"['#F7BA2A', '#F7BA2A', '#F7BA2A']"},{param:"voidColor",instruction:"\u672a\u9009\u4e2dicon\u7684\u989c\u8272",type:"string",optional:"-",defaultvalue:"#C6D1DE"},{param:"disabledVoidColor",instruction:"\u53ea\u8bfb\u65f6\u672a\u9009\u4e2dicon\u7684\u989c\u8272",type:"string",optional:"-",defaultvalue:"#EFF2F7"},{param:"iconClasses",instruction:"icon \u7684\u7c7b\u540d\u6570\u7ec4\uff0c\u5171\u6709 3 \u4e2a\u5143\u7d20\uff0c\u4e3a 3 \u4e2a\u5206\u6bb5\u6240\u5bf9\u5e94\u7684\u7c7b\u540d",type:"array",optional:"-",defaultvalue:"['el-icon-star-on', 'el-icon-star-on','el-icon-star-on']"},{param:"voidconClass",instruction:"\u672a\u9009\u4e2dicon\u7684\u7c7b\u540d",type:"string",optional:"-",defaultvalue:"el-icon-star-off"},{param:"disabledVoidconClass",instruction:"\u53ea\u8bfb\u65f6\u672a\u9009\u4e2dicon\u7684\u7c7b\u540d",type:"string",optional:"-",defaultvalue:"el-icon-star-on"},{param:"showText",instruction:"\u662f\u5426\u663e\u793a\u8f85\u52a9\u6587\u5b57",type:"boolean",optional:"-",defaultvalue:"false"},{param:"textColor",instruction:"\u8f85\u52a9\u6587\u5b57\u7684\u989c\u8272",type:"string",optional:"-",defaultvalue:"1F2D3D"},{param:"texts",instruction:"\u8f85\u52a9\u6587\u5b57\u6570\u7ec4",type:"array",optional:"-",defaultvalue:"['\u6781\u5dee', '\u5931\u671b', '\u4e00\u822c', '\u6ee1\u610f', '\u60ca\u559c']"},{param:"textTemplate",instruction:"\u53ea\u8bfb\u65f6\u7684\u8f85\u52a9\u6587\u5b57\u6a21\u677f",type:"string",optional:"-",defaultvalue:"{value}"}],Events:[{eventName:"onChange",instruction:"\u5206\u503c\u6539\u53d8\u65f6\u89e6\u53d1",callbackParam:"\u6539\u53d8\u540e\u7684\u5206\u503c"}]},Card:{List:[{param:"header",instruction:"\u8bbe\u7f6e header\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7 slot#header \u4f20\u5165 DOM",type:"string",optional:"-",defaultvalue:"-"},{param:"bodyStyle",instruction:"\u8bbe\u7f6e body \u7684\u6837\u5f0f",type:"object",optional:"-",defaultvalue:"{ padding: '20px' }"}]},Layout:{List:[{param:"style",instruction:"\u6837\u5f0f",type:"Object",optional:"-",defaultvalue:"-"}]},Sider:{List:[{param:"collapsible",instruction:"\u662f\u5426\u53ef\u6536\u8d77",type:"Boolean",optional:"\u2014",defaultvalue:"false"},{param:"defaultCollapsed",instruction:"\u662f\u5426\u9ed8\u8ba4\u6536\u8d77",type:"Boolean",optional:"\u2014",defaultvalue:"false"},{param:"collapsed",instruction:"\u5f53\u524d\u6536\u8d77\u72b6\u6001\t",type:"Boolean",optional:"\u2014",defaultvalue:"\u2014"},{param:"onCollapse",instruction:"\u5c55\u5f00\u2014\u6536\u8d77\u65f6\u7684\u56de\u8c03\u51fd\u6570\uff0c\u6709\u70b9\u51fb trigger \u4ee5\u53ca\u54cd\u5e94\u5f0f\u53cd\u9988\u4e24\u79cd\u65b9\u5f0f\u53ef\u4ee5\u89e6\u53d1",type:"(collapsed, type) => {}",optional:"\u2014",defaultvalue:"\u2014"},{param:"trigger",instruction:"\u81ea\u5b9a\u4e49 trigger\uff0c\u8bbe\u7f6e\u4e3a null \u65f6\u9690\u85cf trigger",type:"string|ReactNode",optional:"\u2014",defaultvalue:"\u2014"},{param:"width",instruction:"\u5bbd\u5ea6",type:"number|string",optional:"\u2014",defaultvalue:"200"},{param:"collapsedWidth",instruction:"\u6536\u7f29\u5bbd\u5ea6\uff0c\u8bbe\u7f6e\u4e3a 0 \u4f1a\u51fa\u73b0\u7279\u6b8a trigger",type:"number",optional:"\u2014",defaultvalue:"64"},{param:"breakpoint",instruction:"\u89e6\u53d1\u54cd\u5e94\u5f0f\u5e03\u5c40\u7684\u65ad\u70b9\t",type:"Enum { 'xs', 'sm', 'md', 'lg', 'xl' }",optional:"\u2014",defaultvalue:"\u2014"},{param:"style",instruction:"\u6307\u5b9a\u6837\u5f0f",type:"object",optional:"\u2014",defaultvalue:"\u2014"},{param:"className",instruction:"\u5bb9\u5668 className",type:"String",optional:"\u2014",defaultvalue:"\u2014"}]},Slider:{List:[{param:"min",instruction:"\u6700\u5c0f\u503c",type:"number",optional:"-",defaultvalue:"0"},{param:"max",instruction:"\u6700\u5927\u503c",type:"numner",optional:"-",defaultvalue:"100"},{param:"disabled",instruction:"\u662f\u5426\u7981\u7528",type:"Boolean",optional:"-",defaultvalue:"false"},{param:"step",instruction:"\u6b65\u957f",type:"number",optional:"-",defaultvalue:"1"},{param:"showInput",instruction:"\u662f\u5426\u663e\u793a\u8f93\u5165\u6846\uff0c\u4ec5\u5728\u975e\u8303\u56f4\u9009\u62e9\u65f6\u6709\u6548",type:"boolean",optional:"-",defaultvalue:"false"},{param:"showInputControls",instruction:"\u5728\u663e\u793a\u8f93\u5165\u6846\u7684\u60c5\u51b5\u4e0b\uff0c\u662f\u5426\u663e\u793a\u8f93\u5165\u6846\u7684\u63a7\u5236\u6309\u94ae",type:"boolean",optional:"-",defaultvalue:"false"},{param:"showStops",instruction:"\u662f\u5426\u663e\u793a\u95f4\u65ad\u70b9",type:"boolean",optional:"-",defaultvalue:"false"},{param:"range",instruction:"\u662f\u5426\u4e3a\u8303\u56f4\u9009\u62e9",type:"boolean",optional:"-",defaultvalue:"false"}],Events:[{eventName:"onChange",instruction:"\u503c\u6539\u53d8\u65f6\u89e6\u53d1",callbackParam:"\u6539\u53d8\u540e\u7684\u503c"}]},Row:{List:[{param:"gutter",instruction:"\u6805\u683c\u95f4\u9694",type:"Number",optional:"-",defaultvalue:"0"},{param:"type",instruction:"\u5e03\u5c40\u6a21\u5f0f\uff0c\u53ef\u9009 flex\uff0c\u73b0\u4ee3\u6d4f\u89c8\u5668 \u4e0b\u6709\u6548",type:"String",optional:"-",defaultvalue:"-"},{param:"align",instruction:"flex \u5e03\u5c40\u4e0b\u7684\u5782\u76f4\u5bf9\u9f50\u65b9\u5f0f\uff1atop middle bottom",type:"String",optional:"-",defaultvalue:"top"},{param:"justify",instruction:"flex \u5e03\u5c40\u4e0b\u7684\u6c34\u5e73\u6392\u5217\u65b9\u5f0f\uff1astart end center space-around space-between",type:"String",optional:"-",defaultvalue:"start"}]},Col:{List:[{param:"span",instruction:"\u6805\u683c\u5360\u4f4d\u683c\u6570\uff0c\u4e3a 0 \u65f6\u76f8\u5f53\u4e8e display: none",type:"Number",optional:"-",defaultvalue:"-"},{param:"order",instruction:"\u6805\u683c\u987a\u5e8f\uff0cflex \u5e03\u5c40\u6a21\u5f0f\u4e0b\u6709\u6548",type:"Number",optional:"-",defaultvalue:"0"},{param:"offset",instruction:"\u6805\u683c\u5de6\u4fa7\u7684\u95f4\u9694\u683c\u6570\uff0c\u95f4\u9694\u5185\u4e0d\u53ef\u4ee5\u6709\u6805\u683c",type:"Number",optional:"-",defaultvalue:"0"},{param:"push",instruction:"\u6805\u683c\u5411\u53f3\u79fb\u52a8\u683c\u6570",type:"Number",optional:"-",defaultvalue:"0"},{param:"pull",instruction:"\u6805\u683c\u5411\u5de6\u79fb\u52a8\u683c\u6570",type:"Number",optional:"-",defaultvalue:"0"},{param:"xs",instruction:"<768px \u54cd\u5e94\u5f0f\u6805\u683c\uff0c\u53ef\u4e3a\u6805\u683c\u6570\u6216\u4e00\u4e2a\u5305\u542b\u5176\u4ed6\u5c5e\u6027\u7684\u5bf9\u8c61",type:"Number|Object",optional:"-",defaultvalue:"-"},{param:"sm",instruction:"\u2265768px \u54cd\u5e94\u5f0f\u6805\u683c\uff0c\u53ef\u4e3a\u6805\u683c\u6570\u6216\u4e00\u4e2a\u5305\u542b\u5176\u4ed6\u5c5e\u6027\u7684\u5bf9\u8c61",type:"Number|Object",optional:"-",defaultvalue:"-"},{param:"md",instruction:"\u2265992px \u54cd\u5e94\u5f0f\u6805\u683c\uff0c\u53ef\u4e3a\u6805\u683c\u6570\u6216\u4e00\u4e2a\u5305\u542b\u5176\u4ed6\u5c5e\u6027\u7684\u5bf9\u8c61",type:"Number|Object",optional:"-",defaultvalue:"-"},{param:"lg",instruction:"\u22651200px \u54cd\u5e94\u5f0f\u6805\u683c\uff0c\u53ef\u4e3a\u6805\u683c\u6570\u6216\u4e00\u4e2a\u5305\u542b\u5176\u4ed6\u5c5e\u6027\u7684\u5bf9\u8c61",type:"Number|Object",optional:"-",defaultvalue:"-"},{param:"xl",instruction:"\u22651600px \u54cd\u5e94\u5f0f\u6805\u683c\uff0c\u53ef\u4e3a\u6805\u683c\u6570\u6216\u4e00\u4e2a\u5305\u542b\u5176\u4ed6\u5c5e\u6027\u7684\u5bf9\u8c61",type:"Number|Object",optional:"-",defaultvalue:"-"}]},Button:{List:[{param:"size",instruction:"\u5c3a\u5bf8",type:"String",optional:"large,small,mini",defaultvalue:"-"},{param:"type",instruction:"\u7c7b\u578b",type:"String",optional:"primary,success,warning,danger,info,text",defaultvalue:"-"},{param:"plain",instruction:"\u662f\u5426\u6734\u7d20\u6309\u94ae",type:"boolean",optional:"true,false",defaultvalue:"false"},{param:"loading",instruction:"\u662f\u5426\u52a0\u8f7d\u4e2d\u72b6\u6001",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"disabled",instruction:"\u7981\u7528",type:"boolean",optional:"true, false",defaultvalue:"false"},{param:"icon",instruction:"\u56fe\u6807\uff0c\u5df2\u6709\u56fe\u6807\u5e93\u4e2d\u7684\u56fe\u6807\u540d",type:"String",optional:"\u2014",defaultvalue:"-"},{param:"nativeType",instruction:"\u539f\u58f0type\u5c5e\u6027",type:"String",optional:"button,submit,reset",defaultvalue:"button"}]},Radio:{List:[{param:"checked",instruction:"Radio\u662f\u5426\u88ab\u9009\u4e2d",type:"boolean",optional:"-",defaultvalue:"false"},{param:"value",instruction:"Radio\u7684value",type:"string,number,boolean",optional:"-",defaultvalue:"-"},{param:"disabled",instruction:"\u662f\u5426\u7981\u7528\t",type:"boolean",optional:"true,false",defaultvalue:"false"},{param:"name",instruction:"\u539f\u58f0name\u5c5e\u6027",type:"string",optional:"\u2014",defaultvalue:"-"}]},RadioGroup:{List:[{param:"size",instruction:"Radio\u6309\u94ae\u7ec4\u5c3a\u5bf8",type:"string",optional:"large\uff0csmall",defaultvalue:"-"},{param:"fill",instruction:"\u6309\u94ae\u6fc0\u6d3b\u65f6\u7684\u586b\u5145\u8272\u548c\u8fb9\u6846\u8272",type:"string",optional:"-",defaultvalue:"#20a0ff"},{param:"textColor",instruction:"\u6309\u94ae\u6fc0\u6d3b\u65f6\u7684\u6587\u672c\u8272\t",type:"string",optional:"true,false",defaultvalue:"#fff"}],Events:[{eventName:"onChange",instruction:"\u7ed1\u5b9a\u503c\u53d8\u5316\u65f6\u89e6\u53d1\u7684\u4e8b\u4ef6",callbackParam:"\u9009\u4e2d\u7684 Radio label \u503c"}]},RadioButton:{List:[{param:"value",instruction:"Radio\u7684value",type:"string\uff0cnumber",optional:"-",defaultvalue:"-"},{param:"disabled",instruction:"\u662f\u5426\u7981\u7528",type:"boolean",optional:"-",defaultvalue:"false"}]},Checkbox:{List:[{param:"label",instruction:"\u9009\u4e2d\u72b6\u6001\u7684\u503c\uff08\u53ea\u6709\u5728Checkbox.Group\u6216\u8005\u7ed1\u5b9a\u5bf9\u8c61\u7c7b\u578b\u4e3aarray\u65f6\u6709\u6548\uff09",type:"string",optional:"-",defaultvalue:"-"},{param:"trueLabel",instruction:"\u9009\u4e2d\u65f6\u7684\u503c",type:"string, number",optional:"-",defaultvalue:"-"},{param:"falseLabel",instruction:"\u6ca1\u6709\u9009\u4e2d\u65f6\u7684\u503c",type:"string, number",optional:"-",defaultvalue:"-"},{param:"disabled",instruction:"\u6309\u94ae\u7981\u7528",type:"boolean",optional:"-",defaultvalue:"false"},{param:"checked",instruction:"\u5f53\u524d\u662f\u5426\u52fe\u9009",type:"boolean",optional:"-",defaultvalue:"false"}]},Animate:{List:[{param:"animation-name",instruction:"\u53ef\u4ee5\u7ed1\u5b9a\u5230\u9009\u62e9\u5668\u7684 keyframe \u540d\u79f0",type:"string",optional:"-",defaultvalue:"-"},{param:"animation-duration",instruction:"\u5b8c\u6210\u52a8\u753b\u6240\u82b1\u8d39\u7684\u65f6\u95f4\uff0c\u4ee5\u79d2\u6216\u6beb\u79d2\u8ba1",type:"string",optional:"-",defaultvalue:"-"},{param:"animation-timing-function",instruction:"\u52a8\u753b\u7684\u901f\u5ea6\u66f2\u7ebf",type:"string",optional:"linear,ease,ease-in,ease-out,ease-in-out,cubic-bezier(n,n,n,n)(n\u4e3a\u4ece0\u52301\u7684\u503c)",defaultvalue:"ease"},{param:"animation-delay",instruction:"\u52a8\u753b\u5f00\u59cb\u4e4b\u524d\u7684\u5ef6\u8fdf",type:"string",optional:"-",defaultvalue:"false"},{param:"animation-iteration-count",instruction:"\u52a8\u753b\u64ad\u653e\u6b21\u6570",type:"number",optional:"-",defaultvalue:"false"},{param:"animation-direction",instruction:"\u662f\u5426\u8f6e\u6d41\u53cd\u5411\u64ad\u653e\u52a8\u753b",type:"boolean",optional:"-",defaultvalue:"false"}]},CheckboxGroup:{List:[{param:"size",instruction:"Checkbox \u6309\u94ae\u7ec4\u5c3a\u5bf8\t",type:"string",optional:"large, small",defaultvalue:"-"},{param:"fill",instruction:"\u6309\u94ae\u6fc0\u6d3b\u65f6\u7684\u586b\u5145\u8272\u548c\u8fb9\u6846\u8272",type:"string",optional:"-",defaultvalue:"#20a0ff"},{param:"textColor",instruction:"\u6309\u94ae\u6fc0\u6d3b\u65f6\u7684\u6587\u672c\u989c\u8272\t",type:"string",optional:"-",defaultvalue:"#fff"},{param:"min",instruction:"\u53ef\u88ab\u52fe\u9009\u7684checkbox\u7684\u6700\u5927\u6570\u91cf",type:"number",optional:"-",defaultvalue:"-"},{param:"max",instruction:"\u53ef\u88ab\u52fe\u9009\u7684checkbox\u7684\u6700\u5c0f\u6570\u91cf",type:"number",optional:"-",defaultvalue:"-"}],Events:[{eventName:"onChange",instruction:"\u7ed1\u5b9a\u503c\u53d8\u5316\u65f6\u89e6\u53d1\u7684\u4e8b\u4ef6",callbackParam:"value"}]},Input:{List:[{param:"type",instruction:"\u7c7b\u578b",type:"string",optional:"text/textarea",defaultvalue:"text"},{param:"value",instruction:"\u7ed1\u5b9a\u503c",type:"string, number",optional:"\u2014",defaultvalue:"\u2014"},{param:"maxLength",instruction:"\u6700\u5927\u8f93\u5165\u957f\u5ea6",type:"number",optional:"\u2014",defaultvalue:"\u2014"},{param:"placeholder",instruction:"\u8f93\u5165\u6846\u5360\u4f4d\u6587\u672c",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"disabled",instruction:"\u7981\u7528",type:"boolean",optional:"\u2014",defaultvalue:"FALSE"},{param:"size",instruction:"\u8f93\u5165\u6846\u5c3a\u5bf8\uff0c\u53ea\u5728\xa0type!=textarea\u65f6\u6709\u6548",type:"string",optional:"large, small, mini",defaultvalue:"\u2014"},{param:"icon",instruction:"\u8f93\u5165\u6846\u5c3e\u90e8\u56fe\u6807",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"rows",instruction:"\u8f93\u5165\u6846\u884c\u6570\uff0c\u53ea\u5bf9\xa0type=textarea\u6709\u6548",type:"number",optional:"\u2014",defaultvalue:"2"},{param:"autosize",instruction:"\u81ea\u9002\u5e94\u5185\u5bb9\u9ad8\u5ea6\uff0c\u53ea\u5bf9\xa0type=textarea\u6709\u6548\uff0c\u53ef\u4f20\u5165\u5bf9\u8c61\uff0c\u5982\uff0c{ minRows: 2, maxRows: 6 }",type:"boolean/object",optional:"\u2014",defaultvalue:"FALSE"},{param:"autoComplete",instruction:"\u539f\u751f\u5c5e\u6027\uff0c\u81ea\u52a8\u8865\u5168",type:"string",optional:"on, off",defaultvalue:"off"},{param:"name",instruction:"\u539f\u751f\u5c5e\u6027",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"readOnly",instruction:"\u539f\u751f\u5c5e\u6027\uff0c\u662f\u5426\u53ea\u8bfb",type:"boolean",optional:"\u2014",defaultvalue:"FALSE"},{param:"autoFocus",instruction:"\u539f\u751f\u5c5e\u6027\uff0c\u81ea\u52a8\u83b7\u53d6\u7126\u70b9",type:"boolean",optional:"true, false",defaultvalue:"FALSE"},{param:"onIconClick",instruction:"\u70b9\u51fb Input \u5185\u7684\u56fe\u6807\u7684\u94a9\u5b50\u51fd\u6570",type:"function",optional:"\u2014",defaultvalue:"\u2014"}]},Autocomplete:{List:[{param:"placeholder",instruction:"\u8f93\u5165\u6846\u5360\u4f4d\u6587\u672c",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"disabled",instruction:"\u7981\u7528",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"value",instruction:"\u5fc5\u586b\u503c\u8f93\u5165\u7ed1\u5b9a\u503c",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"customItem",instruction:"\u901a\u8fc7\u8be5\u53c2\u6570\u6307\u5b9a\u81ea\u5b9a\u4e49\u7684\u8f93\u5165\u5efa\u8bae\u5217\u8868\u9879\u7684\u7ec4\u4ef6\u540d",type:"Element",optional:"\u2014",defaultvalue:"\u2014"},{param:"fetchSuggestions",instruction:"\u8fd4\u56de\u8f93\u5165\u5efa\u8bae\u7684\u65b9\u6cd5\uff0c\u4ec5\u5f53\u4f60\u7684\u8f93\u5165\u5efa\u8bae\u6570\u636e resolve \u65f6\uff0c\u901a\u8fc7\u8c03\u7528 callback(data:[]) \u6765\u8fd4\u56de\u5b83",type:"Function(queryString, callback)",optional:"\u2014",defaultvalue:"\u2014"},{param:"popperClass",instruction:"Autocomplete \u4e0b\u62c9\u5217\u8868\u7684\u7c7b\u540d",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"triggerOnFocus",instruction:"\u662f\u5426\u5728\u8f93\u5165\u6846 focus \u65f6\u663e\u793a\u5efa\u8bae\u5217\u8868",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"onIconClick",instruction:"\u70b9\u51fb\u56fe\u6807\u7684\u56de\u8c03\u51fd\u6570",type:"function",optional:"\u2014",defaultvalue:"\u2014"},{param:"icon",instruction:"\u8f93\u5165\u6846\u5c3e\u90e8\u56fe\u6807",type:"string",optional:"\u2014",defaultvalue:"\u2014"}],Events:[{eventName:"onSelect",instruction:"\u70b9\u51fb\u9009\u4e2d\u5efa\u8bae\u9879\u65f6\u89e6\u53d1",callbackParam:"\u9009\u4e2d\u5efa\u8bae\u9879"}]},Select:{List:[{param:"multiple",instruction:"\u662f\u5426\u591a\u9009",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"disabled",instruction:"\u662f\u5426\u7981\u7528",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"clearable",instruction:"\u5355\u9009\u65f6\u662f\u5426\u53ef\u4ee5\u6e05\u7a7a\u9009\u9879",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"name",instruction:"select input\u7684name\u5c5e\u6027",type:"string",optional:"\u2014",defaultvalue:"-"},{param:"placeholder",instruction:"\u5360\u4f4d\u7b26",type:"string",optional:"\u2014",defaultvalue:"\u8bf7\u9009\u62e9"},{param:"filterable",instruction:"\u662f\u5426\u53ef\u641c\u7d22",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"filterMethod",instruction:"\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u65b9\u6cd5",type:"function",optional:"\u2014",defaultvalue:"-"},{param:"remote",instruction:"\u662f\u5426\u4e3a\u8fdc\u7a0b\u641c\u7d22",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"remoteMethod",instruction:"\u8fdc\u7a0b\u641c\u7d22\u65b9\u6cd5",type:"function",optional:"\u2014",defaultvalue:"-"},{param:"loading",instruction:"\u662f\u5426\u6b63\u5728\u4ece\u8fdc\u7a0b\u83b7\u53d6\u6570\u636e",type:"boolean",optional:"\u2014",defaultvalue:"false"}],Events:[{eventName:"onChange",instruction:"\u9009\u4e2d\u503c\u53d1\u751f\u53d8\u5316\u65f6\u89e6\u53d1",callbackParam:"\u76ee\u524d\u7684\u9009\u4e2d\u503c"},{eventName:"onVisibleChange",instruction:"\u4e0b\u62c9\u6846\u51fa\u73b0/\u9690\u85cf\u65f6\u89e6\u53d1",callbackParam:"\u51fa\u73b0\u5219\u4e3a true\uff0c\u9690\u85cf\u5219\u4e3a false"},{eventName:"onRemoveTag",instruction:"\u591a\u9009\u6a21\u5f0f\u4e0b\u79fb\u9664tag\u65f6\u89e6\u53d1",callbackParam:"\u79fb\u9664\u7684tag\u503c"},{eventName:"onClear",instruction:"\u53ef\u6e05\u7a7a\u7684\u5355\u9009\u6a21\u5f0f\u4e0b\u7528\u6237\u70b9\u51fb\u6e05\u7a7a\u6309\u94ae\u65f6\u89e6\u53d1",callbackParam:"-"}]},Option:{List:[{param:"value",instruction:"\u9009\u9879\u7684\u503c",type:"string/number/object",optional:"\u2014",defaultvalue:"\u2014"},{param:"label",instruction:"\u9009\u9879\u7684\u6807\u7b7e\uff0c\u82e5\u4e0d\u8bbe\u7f6e\u5219\u9ed8\u8ba4\u4e0e value \u76f8\u540c",type:"string/number",optional:"\u2014",defaultvalue:"\u2014"},{param:"disabled",instruction:"\u662f\u5426\u7981\u7528\u8be5\u9009\u9879",type:"boolean",optional:"\u2014",defaultvalue:"false"}]},OptionGroup:{List:[{param:"label",instruction:"\u5206\u7ec4\u7684\u7ec4\u540d",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"disabled",instruction:"\u662f\u5426\u5c06\u8be5\u5206\u7ec4\u4e0b\u6240\u6709\u9009\u9879\u7f6e\u4e3a\u7981\u7528",type:"boolean",optional:"\u2014",defaultvalue:"false"}]},Switch:{List:[{param:"disabled",instruction:"\u662f\u5426\u7981\u7528",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"width",instruction:"switch \u7684\u5bbd\u5ea6\uff08\u50cf\u7d20\uff09",type:"number",optional:"\u2014",defaultvalue:"58\uff08\u6709\u6587\u5b57\uff09/ 46\uff08\u65e0\u6587\u5b57\uff09"},{param:"onIconClass",instruction:"switch \u6253\u5f00\u65f6\u6240\u663e\u793a\u56fe\u6807\u7684\u7c7b\u540d\uff0c",type:"\u2014",optional:"\u2014",defaultvalue:"-"},{param:"\u8bbe\u7f6e\u6b64\u9879\u4f1a\u5ffd\u7565 onText",instruction:"string",type:"\u2014",optional:"\u2014",defaultvalue:"-"},{param:"offIconClass",instruction:"switch \u5173\u95ed\u65f6\u6240\u663e\u793a\u56fe\u6807\u7684\u7c7b\u540d\uff0c",type:"\u2014",optional:"\u2014",defaultvalue:"-"},{param:"\u8bbe\u7f6e\u6b64\u9879\u4f1a\u5ffd\u7565 offText",instruction:"string",type:"\u2014",optional:"\u2014",defaultvalue:"-"},{param:"onText",instruction:"switch \u6253\u5f00\u65f6\u7684\u6587\u5b57",type:"string",optional:"\u2014",defaultvalue:"ON"},{param:"offText",instruction:"switch \u5173\u95ed\u65f6\u7684\u6587\u5b57",type:"string",optional:"\u2014",defaultvalue:"OFF"},{param:"onValue",instruction:"switch \u6253\u5f00\u65f6\u7684\u503c",type:"boolean / string / number",optional:"\u2014",defaultvalue:"true"},{param:"offValue",instruction:"switch \u5173\u95ed\u65f6\u7684\u503c",type:"boolean / string / number",optional:"\u2014",defaultvalue:"false"},{param:"onColor",instruction:"switch \u6253\u5f00\u65f6\u7684\u80cc\u666f\u8272",type:"string",optional:"\u2014",defaultvalue:"#20A0FF"},{param:"offColor",instruction:"switch \u5173\u95ed\u65f6\u7684\u80cc\u666f\u8272",type:"string",optional:"\u2014",defaultvalue:"#C0CCDA"},{param:"name",instruction:"switch \u5bf9\u5e94\u7684 name \u5c5e\u6027",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"allowFocus",instruction:"\u5141\u8bb8 switch \u89e6\u53d1 focus \u548c blur \u4e8b\u4ef6",type:"boolean",optional:"boolean",defaultvalue:"\u2014"}],Events:[{eventName:"onChange",instruction:"switch \u72b6\u6001\u53d1\u751f\u53d8\u5316\u65f6\u7684\u56de\u8c03\u51fd\u6570",callbackParam:"value"},{eventName:"onBlur",instruction:"switch \u5931\u53bb\u7126\u70b9\u65f6\u89e6\u53d1\uff0c\u4ec5\u5f53 allow-focus \u4e3a true \u65f6\u751f\u6548",callbackParam:"event: Event"},{eventName:"onFocus",instruction:"switch \u83b7\u5f97\u7126\u70b9\u65f6\u89e6\u53d1\uff0c\u4ec5\u5f53 allow-focus \u4e3a true \u65f6\u751f\u6548",callbackParam:"event: Event"}]},DateTimePickerCommon:{List:[{param:"disabled",instruction:"\u662f\u5426\u7981\u7528",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"width",instruction:"switch \u7684\u5bbd\u5ea6\uff08\u50cf\u7d20\uff09",type:"number",optional:"\u2014",defaultvalue:"58\uff08\u6709\u6587\u5b57\uff09/ 46\uff08\u65e0\u6587\u5b57\uff09"},{param:"onIconClass",instruction:"switch \u6253\u5f00\u65f6\u6240\u663e\u793a\u56fe\u6807\u7684\u7c7b\u540d\uff0c",type:"\u2014",optional:"\u2014",defaultvalue:"\u2014"},{param:"\u8bbe\u7f6e\u6b64\u9879\u4f1a\u5ffd\u7565 onText",instruction:"string",type:"\u2014",optional:"\u2014",defaultvalue:"\u2014"},{param:"offIconClass",instruction:"switch \u5173\u95ed\u65f6\u6240\u663e\u793a\u56fe\u6807\u7684\u7c7b\u540d\uff0c",type:"\u2014",optional:"\u2014",defaultvalue:"\u2014"},{param:"\u8bbe\u7f6e\u6b64\u9879\u4f1a\u5ffd\u7565 offText",instruction:"string",type:"\u2014",optional:"\u2014",defaultvalue:"\u2014"},{param:"placeholder",instruction:"\u5360\u4f4d\u5185\u5bb9",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"format",instruction:"\u65f6\u95f4\u65e5\u671f\u683c\u5f0f\u5316",type:"string",optional:"\u5e74 yyyy\uff0c\u6708 MM\uff0c\u65e5 dd\uff0c\u5c0f\u65f6 HH\uff0c\u5206 mm\uff0c\u79d2 ss",defaultvalue:"yyyy-MM-dd"},{param:"align",instruction:"\u5bf9\u9f50\u65b9\u5f0f",type:"string",optional:"left, center, right",defaultvalue:"left"},{param:"isShowTrigger",instruction:"\u662f\u5426\u663e\u793a\u56fe\u6807",type:"boolean",optional:"-",defaultvalue:"true"},{param:"isReadOnly",instruction:"\u662f\u5426\u662f\u53ea\u8bfb",type:"boolean",optional:"-",defaultvalue:"false"},{param:"isDisabled",instruction:"\u662f\u5426\u662f\u7981\u7528",type:"boolean",optional:"-",defaultvalue:"false"},{param:"isShowTime",instruction:"\u662f\u5426\u663e\u793a\u65f6\u95f4",type:"boolean",optional:"-",defaultvalue:"false"},{param:"firstDayOfWeek",instruction:"\u5468\u8d77\u59cb\u65e5",type:"Number",optional:"0 \u5230 6",defaultvalue:"0"},{param:"onFocus",instruction:"focus \u4e8b\u4ef6\u89e6\u53d1",type:"(SyntheticEvent)=>()",optional:"-",defaultvalue:"-"},{param:"onBlur",instruction:"blur \u4e8b\u4ef6\u89e6\u53d1",type:"(SyntheticEvent)=>()",optional:"-",defaultvalue:"-"}]},DatePicker:{List:[{param:"value",instruction:"-",type:"Date/null",optional:"\u2014",defaultvalue:"-"},{param:"shortcuts",instruction:"\u5feb\u6377\u9009\u9879",type:"{text: string, onClick: ()=>()}[]",optional:"-",defaultvalue:"-"},{param:"selectionMode",instruction:"\u65e5\u671f\u7c7b\u578b",type:"string, one of ['year', 'month', 'week', 'day']",optional:"-",defaultvalue:"'day'"},{param:"disabledDate",instruction:"\u662f\u5426\u7981\u7528\u65e5\u671f",type:"(Date, selectionMode)=>boolean",optional:"-",defaultvalue:"-"},{param:"showWeekNumber",instruction:"\u662f\u5426\u5c55\u793a\u5468\u6570",type:"boolean",optional:"-",defaultvalue:"false"}]},DateRangePanel:{List:[{param:"value",instruction:"-",type:"Date[]/null",optional:"\u2014",defaultvalue:"-"},{param:"shortcuts",instruction:"\u5feb\u6377\u9009\u9879",type:"{text: string, onClick: ()=>()}[]",optional:"-",defaultvalue:"-"},{param:"showWeekNumber",instruction:"\u662f\u5426\u5c55\u793a\u5468\u6570",type:"boolean",optional:"-",defaultvalue:"false"},{param:"rangeSeparator",instruction:"\u9009\u62e9\u8303\u56f4\u65f6\u7684\u5206\u9694\u7b26",type:"string",optional:"-",defaultvalue:" - "}]},TimeSelect:{List:[{param:"value",instruction:"\u503c",type:"date/null",optional:"\u2014",defaultvalue:"-"},{param:"start",instruction:"\u5f00\u59cb\u65f6\u95f4",type:"string",optional:"\u2014",defaultvalue:"09:00"},{param:"end",instruction:"\u7ed3\u675f\u65f6\u95f4",type:"string",optional:"\u2014",defaultvalue:"18:00"},{param:"step",instruction:"\u95f4\u9694\u65f6\u95f4",type:"string",optional:"\u2014",defaultvalue:"00:30"},{param:"minTime",instruction:"\u6700\u5c0f\u65f6\u95f4",type:"date",optional:"\u2014",defaultvalue:"-"},{param:"maxTime",instruction:"\u6700\u5927\u65f6\u95f4",type:"date",optional:"\u2014",defaultvalue:"-"}]},TimePicker:{List:[{param:"value",instruction:"\u503c",type:"date/null",optional:"\u2014",defaultvalue:"-"},{param:"selectableRange",instruction:"\u53ef\u9009\u65f6\u95f4\u6bb5\uff0c\u4f8b\u5982'18:30:00 - 20:30:00'\u6216\u8005\u4f20\u5165\u6570\u7ec4['09:30:00 - 12:00:00', '14:30:00 - 18:30:00']",type:"string/string[]",optional:"\u2014",defaultvalue:"\u2014"}]},TimeRangePicker:{List:[{param:"value",instruction:"\u503c",type:"date[]/null",optional:"\u2014",defaultvalue:"-"},{param:"selectableRange",instruction:"\u53ef\u9009\u65f6\u95f4\u6bb5\uff0c\u4f8b\u5982'18:30:00 - 20:30:00'\u6216\u8005\u4f20\u5165\u6570\u7ec4['09:30:00 - 12:00:00', '14:30:00 - 18:30:00']",type:"string/string[]",optional:"\u2014",defaultvalue:"\u2014"},{param:"rangeSeparator",instruction:"\u9009\u62e9\u8303\u56f4\u65f6\u7684\u5206\u9694\u7b26",type:"string",optional:"-",defaultvalue:"'- "}]},Upload:{List:[{param:"action",instruction:"\u5fc5\u9009\u53c2\u6570, \u4e0a\u4f20\u7684\u5730\u5740",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"headers",instruction:"\u53ef\u9009\u53c2\u6570, \u8bbe\u7f6e\u4e0a\u4f20\u7684\u8bf7\u6c42\u5934\u90e8",type:"object",optional:"\u2014",defaultvalue:"\u2014"},{param:"multiple",instruction:"\u53ef\u9009\u53c2\u6570, \u662f\u5426\u652f\u6301\u591a\u9009\u6587\u4ef6",type:"boolean",optional:"\u2014",defaultvalue:"\u2014"},{param:"data",instruction:"\u53ef\u9009\u53c2\u6570, \u4e0a\u4f20\u65f6\u9644\u5e26\u7684\u989d\u5916\u53c2\u6570",type:"object",optional:"\u2014",defaultvalue:"\u2014"},{param:"name",instruction:"\u53ef\u9009\u53c2\u6570, \u4e0a\u4f20\u7684\u6587\u4ef6\u5b57\u6bb5\u540d",type:"string",optional:"\u2014",defaultvalue:"file"},{param:"withCredentials",instruction:"\u652f\u6301\u53d1\u9001 cookie \u51ed\u8bc1\u4fe1\u606f",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"showFileList",instruction:"\u662f\u5426\u663e\u793a\u5df2\u4e0a\u4f20\u6587\u4ef6\u5217\u8868",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"drag",instruction:"\u53ef\u9009\u53c2\u6570\uff0c\u662f\u5426\u652f\u6301\u62d6\u62fd",type:"boolean",optional:"-",defaultvalue:"-"},{param:"accept",instruction:"\u53ef\u9009\u53c2\u6570, \u63a5\u53d7\u4e0a\u4f20\u7684\u6587\u4ef6\u7c7b\u578b\uff08thumbnailMode \u6a21\u5f0f\u4e0b\u6b64\u53c2\u6570\u65e0\u6548\uff09",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"onPreview",instruction:"\u53ef\u9009\u53c2\u6570, \u70b9\u51fb\u5df2\u4e0a\u4f20\u7684\u6587\u4ef6\u94fe\u63a5\u65f6\u7684\u94a9\u5b50, \u53ef\u4ee5\u901a\u8fc7 file.response \u62ff\u5230\u670d\u52a1\u7aef\u8fd4\u56de\u6570\u636e",type:"function(file)",optional:"\u2014",defaultvalue:"\u2014"},{param:"onRemove",instruction:"\u53ef\u9009\u53c2\u6570, \u6587\u4ef6\u5217\u8868\u79fb\u9664\u6587\u4ef6\u65f6\u7684\u94a9\u5b50",type:"function(file, fileList)",optional:"\u2014",defaultvalue:"\u2014"},{param:"onSuccess",instruction:"\u53ef\u9009\u53c2\u6570, \u6587\u4ef6\u4e0a\u4f20\u6210\u529f\u65f6\u7684\u94a9\u5b50",type:"function(response, file, fileList)",optional:"\u2014",defaultvalue:"\u2014"},{param:"onError",instruction:"\u53ef\u9009\u53c2\u6570, \u6587\u4ef6\u4e0a\u4f20\u5931\u8d25\u65f6\u7684\u94a9\u5b50",type:"function(err, file, fileList)",optional:"\u2014",defaultvalue:"\u2014"},{param:"onProgress",instruction:"\u53ef\u9009\u53c2\u6570, \u6587\u4ef6\u4e0a\u4f20\u65f6\u7684\u94a9\u5b50",type:"function(event, file, fileList)",optional:"\u2014",defaultvalue:"\u2014"},{param:"onChange",instruction:"\u53ef\u9009\u53c2\u6570, \u6587\u4ef6\u72b6\u6001\u6539\u53d8\u65f6\u7684\u94a9\u5b50\uff0c\u4e0a\u4f20\u6210\u529f\u6216\u8005\u5931\u8d25\u65f6\u90fd\u4f1a\u88ab\u8c03\u7528",type:"function(file, fileList)",optional:"\u2014",defaultvalue:"\u2014"},{param:"beforeUpload",instruction:"\u53ef\u9009\u53c2\u6570, \u4e0a\u4f20\u6587\u4ef6\u4e4b\u524d\u7684\u94a9\u5b50\uff0c\u53c2\u6570\u4e3a\u4e0a\u4f20\u7684\u6587\u4ef6\uff0c\u82e5\u8fd4\u56de false \u6216\u8005 Promise \u5219\u505c\u6b62\u4e0a\u4f20\u3002",type:"function(file)",optional:"\u2014",defaultvalue:"\u2014"},{param:"listType",instruction:"\u6587\u4ef6\u5217\u8868\u7684\u7c7b\u578b",type:"string",optional:"text/picture/picture-card",defaultvalue:"text"},{param:"autoUpload",instruction:"\u662f\u5426\u5728\u9009\u53d6\u6587\u4ef6\u540e\u7acb\u5373\u8fdb\u884c\u4e0a\u4f20",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"fileList",instruction:"\u4e0a\u4f20\u7684\u6587\u4ef6\u5217\u8868, \u4f8b\u5982: [{name: 'food.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg'}]",type:"array",optional:"\u2014",defaultvalue:"[]"}],Method:[{methodName:"clearFiles",instruction:"\u6e05\u7a7a\u5df2\u4e0a\u4f20\u7684\u6587\u4ef6\u5217\u8868",methodParam:"\u2014"}]},Table:{List:[{param:"data",instruction:"\u663e\u793a\u7684\u6570\u636e",type:"array",optional:"\u2014",defaultvalue:"\u2014"},{param:"height",instruction:"table \u7684\u9ad8\u5ea6\uff0c\u9ed8\u8ba4\u9ad8\u5ea6\u4e3a\u7a7a\uff0c\u5373\u81ea\u52a8\u9ad8\u5ea6\uff0c\u5355\u4f4d px",type:"string, number",optional:"\u2014",defaultvalue:"\u2014"},{param:"maxHeight",instruction:"Table \u7684\u6700\u5927\u9ad8\u5ea6",type:"string/number",optional:"\u2014",defaultvalue:"\u2014"},{param:"stripe",instruction:"\u662f\u5426\u4e3a\u6591\u9a6c\u7eb9 table",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"border",instruction:"\u662f\u5426\u5e26\u6709\u7eb5\u5411\u8fb9\u6846",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"fit",instruction:"\u5217\u7684\u5bbd\u5ea6\u662f\u5426\u81ea\u6491\u5f00",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"showHeader",instruction:"\u662f\u5426\u663e\u793a\u8868\u5934",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"highlightCurrentRow",instruction:"\u662f\u5426\u8981\u9ad8\u4eae\u5f53\u524d\u884c",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"currentRowKey",instruction:"\u5f53\u524d\u884c\u7684 key\uff0c\u53ea\u5199\u5c5e\u6027",type:"String,Number",optional:"\u2014",defaultvalue:"\u2014"},{param:"rowClassName",instruction:"\u884c\u7684 className \u7684\u56de\u8c03\u3002",type:"Function(row, index)",optional:"-",defaultvalue:"-"},{param:"rowStyle",instruction:"\u884c\u7684 style \u7684\u56de\u8c03\u65b9\u6cd5\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e2a\u56fa\u5b9a\u7684 Object \u4e3a\u6240\u6709\u884c\u8bbe\u7f6e\u4e00\u6837\u7684 Style\u3002",type:"Function(row, index)/Object",optional:"\u2014",defaultvalue:"\u2014"},{param:"rowKey",instruction:"\u884c\u6570\u636e\u7684 Key\uff0c\u7528\u6765\u4f18\u5316 Table \u7684\u6e32\u67d3\uff1b\u5728\u4f7f\u7528 reserveSelection \u529f\u80fd\u7684\u60c5\u51b5\u4e0b\uff0c\u8be5\u5c5e\u6027\u662f\u5fc5\u586b\u7684\u3002\u7c7b\u578b\u4e3a String \u65f6\uff0c\u652f\u6301\u591a\u5c42\u8bbf\u95ee\uff1auser.info.id\uff0c\u4f46\u4e0d\u652f\u6301 user.info[0].id\uff0c\u6b64\u79cd\u60c5\u51b5\u8bf7\u4f7f\u7528 Function\u3002",type:"Function(row)/String",optional:"\u2014",defaultvalue:"\u2014"},{param:"emptyText",instruction:"\u7a7a\u6570\u636e\u65f6\u663e\u793a\u7684\u6587\u672c\u5185\u5bb9",type:"String",optional:"-",defaultvalue:"-"},{param:"defaultExpandAll",instruction:"\u662f\u5426\u9ed8\u8ba4\u5c55\u5f00\u6240\u6709\u884c\uff0c\u5f53 Table \u4e2d\u5b58\u5728 type=expand \u7684 Column \u7684\u65f6\u5019\u6709\u6548",type:"Boolean",optional:"\u2014",defaultvalue:"false"},{param:"expandRowKeys",instruction:"\u53ef\u4ee5\u901a\u8fc7\u8be5\u5c5e\u6027\u8bbe\u7f6e Table \u76ee\u524d\u7684\u5c55\u5f00\u884c\uff0c\u9700\u8981\u8bbe\u7f6e row-key \u5c5e\u6027\u624d\u80fd\u4f7f\u7528\uff0c\u8be5\u5c5e\u6027\u4e3a\u5c55\u5f00\u884c\u7684 keys \u6570\u7ec4\u3002",type:"Array",optional:"\u2014",defaultvalue:"-"},{param:"defaultSort",instruction:"\u9ed8\u8ba4\u7684\u6392\u5e8f\u5217\u7684prop\u548c\u987a\u5e8f\u3002\u5b83\u7684prop\u5c5e\u6027\u6307\u5b9a\u9ed8\u8ba4\u7684\u6392\u5e8f\u7684\u5217\uff0corder\u6307\u5b9a\u9ed8\u8ba4\u6392\u5e8f\u7684\u987a\u5e8f",type:"Object",optional:"order: ascending, descending",defaultvalue:"\u5982\u679c\u53ea\u6307\u5b9a\u4e86prop, \u6ca1\u6709\u6307\u5b9aorder, \u5219\u9ed8\u8ba4\u987a\u5e8f\u662fascending"},{param:"showSummary",instruction:"\u662f\u5426\u5728\u8868\u5c3e\u663e\u793a\u5408\u8ba1\u884c",type:"Boolean",optional:"-",defaultvalue:"false"},{param:"sumText",instruction:"\u5408\u8ba1\u884c\u7b2c\u4e00\u5217\u7684\u6587\u672c",type:"String",optional:"-",defaultvalue:"\u5408\u8ba1"},{param:"summeryMethod",instruction:"\u81ea\u5b9a\u4e49\u7684\u5408\u8ba1\u8ba1\u7b97\u65b9\u6cd5",type:"Function({ columns, data })",optional:"-",defaultvalue:"-"}],Events:[{eventName:"onSelect",instruction:"\u5f53\u7528\u6237\u624b\u52a8\u52fe\u9009\u6570\u636e\u884c\u7684 Checkbox \u65f6\u89e6\u53d1\u7684\u4e8b\u4ef6",callbackParam:"selection, row"},{eventName:"onSelectAll",instruction:"\u5f53\u7528\u6237\u624b\u52a8\u52fe\u9009\u5168\u9009 Checkbox \u65f6\u89e6\u53d1\u7684\u4e8b\u4ef6",callbackParam:"selection"},{eventName:"onSelectChange",instruction:"\u5f53\u9009\u62e9\u9879\u53d1\u751f\u53d8\u5316\u65f6\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6",callbackParam:"selection"},{eventName:"onCellMouseEnter",instruction:"\u5f53\u5355\u5143\u683c hover \u8fdb\u5165\u65f6\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6",callbackParam:"row, column, cell, event"},{eventName:"onCellMouseLeave",instruction:"\u5f53\u5355\u5143\u683c hover \u9000\u51fa\u65f6\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6",callbackParam:"row, column, cell, event"},{eventName:"onCellClick",instruction:"\u5f53\u67d0\u4e2a\u5355\u5143\u683c\u88ab\u70b9\u51fb\u65f6\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6",callbackParam:"row, column, cell, event"},{eventName:"onCellDbClick",instruction:"\u5f53\u67d0\u4e2a\u5355\u5143\u683c\u88ab\u53cc\u51fb\u51fb\u65f6\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6",callbackParam:"row, column, cell, event"},{eventName:"onRowClick",instruction:"\u5f53\u67d0\u4e00\u884c\u88ab\u70b9\u51fb\u65f6\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6",callbackParam:"row, event, column"},{eventName:"onRowContextMenu",instruction:"\u5f53\u67d0\u4e00\u884c\u88ab\u9f20\u6807\u53f3\u952e\u70b9\u51fb\u65f6\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6",callbackParam:"row, event"},{eventName:"onRowDbClick",instruction:"\u5f53\u67d0\u4e00\u884c\u88ab\u53cc\u51fb\u65f6\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6",callbackParam:"row, event"},{eventName:"onHeaderClick",instruction:"\u5f53\u67d0\u4e00\u5217\u7684\u8868\u5934\u88ab\u70b9\u51fb\u65f6\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6",callbackParam:"column, event"},{eventName:"onSortChange",instruction:"\u5f53\u8868\u683c\u7684\u6392\u5e8f\u6761\u4ef6\u53d1\u751f\u53d8\u5316\u7684\u65f6\u5019\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6",callbackParam:"{ column, prop, order }"},{eventName:"onFilterChange",instruction:"\u5f53\u8868\u683c\u7684\u7b5b\u9009\u6761\u4ef6\u53d1\u751f\u53d8\u5316\u7684\u65f6\u5019\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6\uff0c\u53c2\u6570\u7684\u503c\u662f\u4e00\u4e2a\u5bf9\u8c61\uff0c\u5bf9\u8c61\u7684 key \u662f column \u7684 columnKey\uff0c\u5bf9\u5e94\u7684 value \u4e3a\u7528\u6237\u9009\u62e9\u7684\u7b5b\u9009\u6761\u4ef6\u7684\u6570\u7ec4\u3002",callbackParam:"filters"},{eventName:"onCurrentChange",instruction:"\u5f53\u8868\u683c\u7684\u5f53\u524d\u884c\u53d1\u751f\u53d8\u5316\u7684\u65f6\u5019\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6\uff0c\u5982\u679c\u8981\u9ad8\u4eae\u5f53\u524d\u884c\uff0c\u8bf7\u6253\u5f00\u8868\u683c\u7684 highlight-current-row \u5c5e\u6027",callbackParam:"currentRow, oldCurrentRow"},{eventName:"onHeaderDragEnd",instruction:"\u5f53\u62d6\u52a8\u8868\u5934\u6539\u53d8\u4e86\u5217\u7684\u5bbd\u5ea6\u7684\u65f6\u5019\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6",callbackParam:"newWidth, oldWidth, column, event"},{eventName:"onExpand",instruction:"\u5f53\u7528\u6237\u5bf9\u67d0\u4e00\u884c\u5c55\u5f00\u6216\u8005\u5173\u95ed\u7684\u4e0a\u4f1a\u89e6\u53d1\u8be5\u4e8b\u4ef6",callbackParam:"row, expanded"}],Method:[{methodName:"clearSelection",instruction:"\u6e05\u7a7a\u7528\u6237\u7684\u9009\u62e9\uff0c\u5f53\u4f7f\u7528 reserve-selection \u529f\u80fd\u7684\u65f6\u5019\uff0c\u53ef\u80fd\u4f1a\u9700\u8981\u4f7f\u7528\u6b64\u65b9\u6cd5",methodParam:"selection"},{methodName:"toggleRowSelection",instruction:"\u7528\u4e8e\u591a\u9009\u8868\u683c\uff0c\u5207\u6362\u67d0\u4e00\u884c\u7684\u9009\u4e2d\u72b6\u6001\uff0c\u5982\u679c\u4f7f\u7528\u4e86\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u5219\u662f\u8bbe\u7f6e\u8fd9\u4e00\u884c\u9009\u4e2d\u4e0e\u5426\uff08selected \u4e3a true \u5219\u9009\u4e2d\uff09",methodParam:"row, selected"},{methodName:"setCurrentRow",instruction:"\u7528\u4e8e\u5355\u9009\u8868\u683c\uff0c\u8bbe\u5b9a\u67d0\u4e00\u884c\u4e3a\u9009\u4e2d\u884c\uff0c\u5982\u679c\u8c03\u7528\u65f6\u4e0d\u52a0\u53c2\u6570\uff0c\u5219\u4f1a\u53d6\u6d88\u76ee\u524d\u9ad8\u4eae\u884c\u7684\u9009\u4e2d\u72b6\u6001\u3002",methodParam:"row"}]},TableColumn:{List:[{param:"type",instruction:"\u5bf9\u5e94\u5217\u7684\u7c7b\u578b\u3002\u5982\u679c\u8bbe\u7f6e\u4e86 selection \u5219\u663e\u793a\u591a\u9009\u6846\uff1b\u5982\u679c\u8bbe\u7f6e\u4e86 index \u5219\u663e\u793a\u8be5\u884c\u7684\u7d22\u5f15\uff08\u4ece 1 \u5f00\u59cb\u8ba1\u7b97\uff09\uff1b\u5982\u679c\u8bbe\u7f6e\u4e86 expand \u5219\u663e\u793a\u4e3a\u4e00\u4e2a\u53ef\u5c55\u5f00\u7684\u6309\u94ae",type:"string",optional:"selection/index/expand",defaultvalue:"\u2014"},{param:"columnKey",instruction:"column \u7684 key\uff0c\u5982\u679c\u9700\u8981\u4f7f\u7528 oFilterChange \u4e8b\u4ef6\uff0c\u5219\u9700\u8981\u6b64\u5c5e\u6027\u6807\u8bc6\u662f\u54ea\u4e2a column \u7684\u7b5b\u9009\u6761\u4ef6",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"label",instruction:"\u663e\u793a\u7684\u6807\u9898",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"prop",instruction:"\u5bf9\u5e94\u5217\u5185\u5bb9\u7684\u5b57\u6bb5\u540d\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 property \u5c5e\u6027",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"width",instruction:"\u5bf9\u5e94\u5217\u7684\u5bbd\u5ea6",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"minWidth",instruction:"\u5bf9\u5e94\u5217\u7684\u6700\u5c0f\u5bbd\u5ea6\uff0c\u4e0e width \u7684\u533a\u522b\u662f width \u662f\u56fa\u5b9a\u7684\uff0cmin-width \u4f1a\u628a\u5269\u4f59\u5bbd\u5ea6\u6309\u6bd4\u4f8b\u5206\u914d\u7ed9\u8bbe\u7f6e\u4e86 min-width \u7684\u5217",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"fixed",instruction:"\u5217\u662f\u5426\u56fa\u5b9a\u5728\u5de6\u4fa7\u6216\u8005\u53f3\u4fa7\uff0ctrue \u8868\u793a\u56fa\u5b9a\u5728\u5de6\u4fa7",type:"string, boolean",optional:"true, left, right",defaultvalue:"-"},{param:"render",instruction:"\u81ea\u5b9a\u4e49\u6e32\u67d3\u4f7f\u7528\u7684 Function",type:"Function(row, column, index)",optional:"\u2014",defaultvalue:"\u2014"},{param:"renderHeader",instruction:"\u5217\u6807\u9898 Label \u533a\u57df\u6e32\u67d3\u4f7f\u7528\u7684 Function",type:"Function(column)",optional:"\u2014",defaultvalue:"\u2014"},{param:"sortable",instruction:"\u5bf9\u5e94\u5217\u662f\u5426\u53ef\u4ee5\u6392\u5e8f\uff0c\u5982\u679c\u8bbe\u7f6e\u4e3a 'custom'\uff0c\u5219\u4ee3\u8868\u7528\u6237\u5e0c\u671b\u8fdc\u7a0b\u6392\u5e8f\uff0c\u9700\u8981\u76d1\u542c Table \u7684 sort-change \u4e8b\u4ef6",type:"boolean, string",optional:"true, false, 'custom'",defaultvalue:"false"},{param:"sortMethod",instruction:"\u5bf9\u6570\u636e\u8fdb\u884c\u6392\u5e8f\u7684\u65f6\u5019\u4f7f\u7528\u7684\u65b9\u6cd5\uff0c\u4ec5\u5f53 sortable \u8bbe\u7f6e\u4e3a true \u7684\u65f6\u5019\u6709\u6548",type:"Function(a, b)",optional:"-",defaultvalue:"-"},{param:"resizable",instruction:"\u5bf9\u5e94\u5217\u662f\u5426\u53ef\u4ee5\u901a\u8fc7\u62d6\u52a8\u6539\u53d8\u5bbd\u5ea6\uff08\u5982\u679c\u9700\u8981\u5728 el-table \u4e0a\u8bbe\u7f6e border \u5c5e\u6027\u4e3a\u771f\uff09",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"align",instruction:"\u5bf9\u9f50\u65b9\u5f0f",type:"String",optional:"left, center, right",defaultvalue:"left"},{param:"headerAlign",instruction:"\u8868\u5934\u5bf9\u9f50\u65b9\u5f0f\uff0c\u82e5\u4e0d\u8bbe\u7f6e\u8be5\u9879\uff0c\u5219\u4f7f\u7528\u8868\u683c\u7684\u5bf9\u9f50\u65b9\u5f0f",type:"String",optional:"left/center/right",defaultvalue:"\u2014"},{param:"className",instruction:"\u5217\u7684 className",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"labelClassName",instruction:"\u5f53\u524d\u5217\u6807\u9898\u7684\u81ea\u5b9a\u4e49\u7c7b\u540d",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"selectable",instruction:"\u4ec5\u5bf9 type=selection \u7684\u5217\u6709\u6548\uff0c\u7c7b\u578b\u4e3a Function\uff0cFunction \u7684\u8fd4\u56de\u503c\u7528\u6765\u51b3\u5b9a\u8fd9\u4e00\u884c\u7684 CheckBox \u662f\u5426\u53ef\u4ee5\u52fe\u9009",type:"Function(row, index)",optional:"\u2014",defaultvalue:"\u2014"},{param:"reserveSelection",instruction:"\u4ec5\u5bf9 type=selection \u7684\u5217\u6709\u6548\uff0c\u7c7b\u578b\u4e3a Boolean\uff0c\u4e3a true \u5219\u4ee3\u8868\u4f1a\u4fdd\u7559\u4e4b\u524d\u6570\u636e\u7684\u9009\u9879\uff0c\u9700\u8981\u914d\u5408 Table \u7684 clearSelection \u65b9\u6cd5\u4f7f\u7528\u3002",type:"Boolean",optional:"\u2014",defaultvalue:"false"},{param:"filters",instruction:"\u6570\u636e\u8fc7\u6ee4\u7684\u9009\u9879\uff0c\u6570\u7ec4\u683c\u5f0f\uff0c\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u9700\u8981\u6709 text \u548c value \u5c5e\u6027\u3002",type:"Array[{ text, value }]",optional:"\u2014",defaultvalue:"\u2014"},{param:"filterPlacement",instruction:"\u8fc7\u6ee4\u5f39\u51fa\u6846\u7684\u5b9a\u4f4d",type:"String",optional:"\u4e0e Tooltip \u7684 placement \u5c5e\u6027\u76f8\u540c",defaultvalue:"\u2014"},{param:"filterMultiple",instruction:"\u6570\u636e\u8fc7\u6ee4\u7684\u9009\u9879\u662f\u5426\u591a\u9009",type:"Boolean",optional:"\u2014",defaultvalue:"true"},{param:"filterMethod",instruction:"\u6570\u636e\u8fc7\u6ee4\u4f7f\u7528\u7684\u65b9\u6cd5\uff0c\u5982\u679c\u662f\u591a\u9009\u7684\u7b5b\u9009\u9879\uff0c\u5bf9\u6bcf\u4e00\u6761\u6570\u636e\u4f1a\u6267\u884c\u591a\u6b21\uff0c\u4efb\u610f\u4e00\u6b21\u8fd4\u56de true \u5c31\u4f1a\u663e\u793a\u3002",type:"Function(value, row)",optional:"\u2014",defaultvalue:"\u2014"},{param:"filteredValue",instruction:"\u9009\u4e2d\u7684\u6570\u636e\u8fc7\u6ee4\u9879\uff0c\u5982\u679c\u9700\u8981\u81ea\u5b9a\u4e49\u8868\u5934\u8fc7\u6ee4\u7684\u6e32\u67d3\u65b9\u5f0f\uff0c\u53ef\u80fd\u4f1a\u9700\u8981\u6b64\u5c5e\u6027\u3002",type:"Array",optional:"\u2014",defaultvalue:"\u2014"}]},Tag:{List:[{param:"type",instruction:"\u4e3b\u9898",type:"string",optional:"'primary', 'gray', 'success', 'warning', 'danger'",defaultvalue:"\u2014"},{param:"closable",instruction:"\u662f\u5426\u53ef\u5173\u95ed",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"closeTransition",instruction:"\u662f\u5426\u7981\u7528\u5173\u95ed\u65f6\u7684\u6e10\u53d8\u52a8\u753b",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"hit",instruction:"\u662f\u5426\u6709\u8fb9\u6846\u63cf\u8fb9",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"color",instruction:"\u80cc\u666f\u8272",type:"string",optional:"\u2014",defaultvalue:"\u2014"}],Events:[{eventName:"onClose",instruction:"\u5173\u95edtag\u65f6\u89e6\u53d1\u7684\u4e8b\u4ef6",callbackParam:"\u2014"}]},Progress:{List:[{param:"percentage",instruction:"\u767e\u5206\u6bd4\uff08\u5fc5\u586b\uff09",type:"number",optional:"0-100",defaultvalue:"0"},{param:"type",instruction:"\u8fdb\u5ea6\u6761\u7c7b\u578b",type:"string",optional:"line/circle",defaultvalue:"line"},{param:"strokeWidth",instruction:"\u8fdb\u5ea6\u6761\u7684\u5bbd\u5ea6\uff0c\u5355\u4f4d px",type:"number",optional:"\u2014",defaultvalue:"6"},{param:"textInside",instruction:"\u8fdb\u5ea6\u6761\u663e\u793a\u6587\u5b57\u5185\u7f6e\u5728\u8fdb\u5ea6\u6761\u5185\uff08\u53ea\u5728 type=line \u65f6\u53ef\u7528\uff09",type:"Boolean",optional:"\u2014",defaultvalue:"false"},{param:"status",instruction:"\u8fdb\u5ea6\u6761\u5f53\u524d\u72b6\u6001",type:"string",optional:"success/exception",defaultvalue:"\u2014"},{param:"width",instruction:"\u73af\u5f62\u8fdb\u5ea6\u6761\u753b\u5e03\u5bbd\u5ea6\uff08\u53ea\u5728 type=circle \u65f6\u53ef\u7528\uff09",type:"number",optional:"-",defaultvalue:"126"},{param:"showText",instruction:"\u662f\u5426\u663e\u793a\u8fdb\u5ea6\u6761\u6587\u5b57\u5185\u5bb9",type:"boolean",optional:"\u2014",defaultvalue:"true"}]},Pagination:{List:[{param:"small",instruction:"\u662f\u5426\u4f7f\u7528\u5c0f\u578b\u5206\u9875\u6837\u5f0f",type:"Boolean",optional:"\u2014",defaultvalue:"false"},{param:"pageSize",instruction:"\u6bcf\u9875\u663e\u793a\u6761\u76ee\u4e2a\u6570",type:"Number",optional:"\u2014",defaultvalue:"10"},{param:"total",instruction:"\u603b\u6761\u76ee\u6570",type:"Number",optional:"\u2014",defaultvalue:"-"},{param:"pageCount",instruction:"\u603b\u9875\u6570\uff0ctotal \u548c pageCount \u8bbe\u7f6e\u4efb\u610f\u4e00\u4e2a\u5c31\u53ef\u4ee5\u8fbe\u5230\u663e\u793a\u9875\u7801\u7684\u529f\u80fd\uff1b\u5982\u679c\u8981\u652f\u6301 pageSizes \u7684\u66f4\u6539\uff0c\u5219\u9700\u8981\u4f7f\u7528 total \u5c5e\u6027",type:"Number",optional:"\u2014",defaultvalue:"-"},{param:"currentPage",instruction:"\u5f53\u524d\u9875\u6570",type:"Number",optional:"\u2014",defaultvalue:"1"},{param:"layout",instruction:"\u7ec4\u4ef6\u5e03\u5c40\uff0c\u5b50\u7ec4\u4ef6\u540d\u7528\u9017\u53f7\u5206\u9694",type:"String",optional:"sizes, prev, pager, next, jumper, ->, total",defaultvalue:"'prev, pager, next, jumper, ->, total'"},{param:"pageSizes",instruction:"\u6bcf\u9875\u663e\u793a\u4e2a\u6570\u9009\u62e9\u5668\u7684\u9009\u9879\u8bbe\u7f6e",type:"Number[]",optional:"\u2014",defaultvalue:"[10, 20, 30, 40, 50, 100]"}],Events:[{eventName:"onSizeChange",instruction:"pageSize \u6539\u53d8\u65f6\u4f1a\u89e6\u53d1",callbackParam:"\u6bcf\u9875\u6761\u6570size"},{eventName:"onCurrentChange",instruction:"currentPage \u6539\u53d8\u65f6\u4f1a\u89e6\u53d1",callbackParam:"\u5f53\u524d\u9875currentPage"}]},Loading:{List:[{param:"fullscreen",instruction:"\u662f\u5426\u5168\u5c4f\u663e\u793a",type:"bool",optional:"-",defaultvalue:"false"},{param:"text",instruction:"\u81ea\u5b9a\u4e49\u52a0\u8f7d\u6587\u6848",type:"string",optional:"-",defaultvalue:"-"},{param:"loading",instruction:"\u63a7\u5236\u52a0\u8f7d\u9875\u663e\u793a",type:"bool",optional:"-",defaultvalue:"true"}]},Message:{Options:[{param:"message",instruction:"\u6d88\u606f\u6587\u5b57",type:"string/ReactElement",optional:"\u2014",defaultvalue:"\u2014"},{param:"type",instruction:"\u4e3b\u9898",type:"string",optional:"success/warning/info/error",defaultvalue:"info"},{param:"iconClass",instruction:"\u81ea\u5b9a\u4e49\u56fe\u6807\u7684\u7c7b\u540d\uff0c\u4f1a\u8986\u76d6 type",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"customClass",instruction:"\u81ea\u5b9a\u4e49\u7c7b\u540d",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"duration",instruction:"\u663e\u793a\u65f6\u95f4, \u6beb\u79d2\u3002\u8bbe\u4e3a 0 \u5219\u4e0d\u4f1a\u81ea\u52a8\u5173\u95ed",type:"number",optional:"\u2014",defaultvalue:"3000"},{param:"showClose",instruction:"\u662f\u5426\u663e\u793a\u5173\u95ed\u6309\u94ae",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"onClose",instruction:"\u5173\u95ed\u65f6\u7684\u56de\u8c03\u51fd\u6570, \u53c2\u6570\u4e3a\u88ab\u5173\u95ed\u7684 message \u5b9e\u4f8b",type:"function",optional:"\u2014",defaultvalue:"\u2014"}]},MessageBox:{Options:[{param:"title",instruction:"MessageBox \u6807\u9898",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"message",instruction:"MessageBox \u6d88\u606f\u6b63\u6587\u5185\u5bb9",type:"string/ReactElement",optional:"\u2014",defaultvalue:"\u2014"},{param:"type",instruction:"\u6d88\u606f\u7c7b\u578b\uff0c\u7528\u4e8e\u663e\u793a\u56fe\u6807",type:"string",optional:"success/info/"},{param:"warning/error",instruction:"\u2014"},{param:"lockScroll",instruction:"\u662f\u5426\u5728 MessageBox \u51fa\u73b0\u65f6\u5c06 body \u6eda\u52a8\u9501\u5b9a",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"showCancelButton",instruction:"\u662f\u5426\u663e\u793a\u53d6\u6d88\u6309\u94ae",type:"boolean",optional:"\u2014",defaultvalue:"false\uff08\u4ee5 confirm \u548c prompt \u65b9\u5f0f\u8c03\u7528\u65f6\u4e3a true\uff09"},{param:"showConfirmButton",instruction:"\u662f\u5426\u663e\u793a\u786e\u5b9a\u6309\u94ae",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"cancelButtonText",instruction:"\u53d6\u6d88\u6309\u94ae\u7684\u6587\u672c\u5185\u5bb9",type:"string",optional:"\u2014",defaultvalue:"\u53d6\u6d88"},{param:"confirmButtonText",instruction:"\u786e\u5b9a\u6309\u94ae\u7684\u6587\u672c\u5185\u5bb9",type:"string",optional:"\u2014",defaultvalue:"\u786e\u5b9a"},{param:"cancelButtonClass",instruction:"\u53d6\u6d88\u6309\u94ae\u7684\u81ea\u5b9a\u4e49\u7c7b\u540d",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"confirmButtonClass",instruction:"\u786e\u5b9a\u6309\u94ae\u7684\u81ea\u5b9a\u4e49\u7c7b\u540d",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"showInput",instruction:"\u662f\u5426\u663e\u793a\u8f93\u5165\u6846",type:"boolean",optional:"\u2014",defaultvalue:"false\uff08\u4ee5 prompt \u65b9\u5f0f\u8c03\u7528\u65f6\u4e3a true\uff09"},{param:"inputPlaceholder",instruction:"\u8f93\u5165\u6846\u7684\u5360\u4f4d\u7b26",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"inputType",instruction:"\u8f93\u5165\u6846\u7684\u7c7b\u578b",type:"string",optional:"\u2014",defaultvalue:"text"},{param:"inputValue",instruction:"\u8f93\u5165\u6846\u7684\u521d\u59cb\u6587\u672c",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"inputPattern",instruction:"\u8f93\u5165\u6846\u7684\u6821\u9a8c\u8868\u8fbe\u5f0f",type:"regexp",optional:"\u2014",defaultvalue:"\u2014"},{param:"inputValidator",instruction:"\u8f93\u5165\u6846\u7684\u6821\u9a8c\u51fd\u6570\u3002\u53ef\u4ee5\u8fd4\u56de\u5e03\u5c14\u503c\u6216\u5b57\u7b26\u4e32\uff0c\u82e5\u8fd4\u56de\u4e00\u4e2a\u5b57\u7b26\u4e32, \u5219\u8fd4\u56de\u7ed3\u679c\u4f1a\u88ab\u8d4b\u503c\u7ed9 inputErrorMessage",type:"function",optional:"\u2014",defaultvalue:"\u2014"},{param:"inputErrorMessage",instruction:"\u6821\u9a8c\u672a\u901a\u8fc7\u65f6\u7684\u63d0\u793a\u6587\u672c",type:"string",optional:"\u2014",defaultvalue:"\u8f93\u5165\u7684\u6570\u636e\u4e0d\u5408\u6cd5!"}]},Notification:{Options:[{param:"title",instruction:"\u6807\u9898",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"message",instruction:"\u8bf4\u660e\u6587\u5b57",type:"string/ReactElement",optional:"\u2014",defaultvalue:"\u2014"},{param:"type",instruction:"\u4e3b\u9898\u6837\u5f0f\uff0c\u5982\u679c\u4e0d\u5728\u53ef\u9009\u503c\u5185\u5c06\u88ab\u5ffd\u7565\uff0c\u4e0eiconClass\u5fc5\u9009\u5176\u4e00",type:"string",optional:"success/warning/info/error",defaultvalue:"\u2014"},{param:"iconClass",instruction:"\u81ea\u5b9a\u4e49\u56fe\u6807\u7684\u7c7b\u540d\u3002\u53ef\u4e0etype\u540c\u65f6\u8bbe\u7f6e\uff0c\u540c\u65f6\u8bbe\u7f6e\u9ed8\u8ba4\u4e3aiconClass\u7684\u56fe\u6807\uff0c\u4e24\u8005\u5fc5\u9009\u5176\u4e00",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"duration",instruction:"\u663e\u793a\u65f6\u95f4, \u6beb\u79d2\u3002\u8bbe\u4e3a 0 \u5219\u4e0d\u4f1a\u81ea\u52a8\u5173\u95ed",type:"number",optional:"\u2014",defaultvalue:"4500"},{param:"onClose",instruction:"\u5173\u95ed\u65f6\u7684\u56de\u8c03\u51fd\u6570",type:"function",optional:"\u2014",defaultvalue:"\u2014"},{param:"onClick",instruction:"\u70b9\u51fb Notification \u65f6\u7684\u56de\u8c03\u51fd\u6570",type:"function",optional:"\u2014",defaultvalue:"\u2014"},{param:"offset",instruction:"\u504f\u79fb\u7684\u8ddd\u79bb\uff0c\u5728\u540c\u4e00\u65f6\u523b\uff0c\u6240\u6709\u7684 Notification \u5b9e\u4f8b\u5e94\u5f53\u5177\u6709\u4e00\u4e2a\u76f8\u540c\u7684\u504f\u79fb\u91cf",type:"number",optional:"\u2014",defaultvalue:"0"}]},Menu:{List:[{param:"mode",instruction:"\u6a21\u5f0f",type:"string",optional:"horizontal,vertical",defaultvalue:"vertical"},{param:"theme",instruction:"\u4e3b\u9898\u8272",type:"string",optional:"light,dark",defaultvalue:"light"},{param:"defaultActive",instruction:"\u5f53\u524d\u6fc0\u6d3b\u83dc\u5355\u7684 index",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"defaultOpeneds",instruction:"\u5f53\u524d\u6253\u5f00\u7684submenu\u7684 key \u6570\u7ec4",type:"Array",optional:"\u2014",defaultvalue:"\u2014"},{param:"uniqueOpened",instruction:"\u662f\u5426\u53ea\u4fdd\u6301\u4e00\u4e2a\u5b50\u83dc\u5355\u7684\u5c55\u5f00",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"menuTrigger",instruction:"\u5b50\u83dc\u5355\u6253\u5f00\u7684\u89e6\u53d1\u65b9\u5f0f(\u53ea\u5728 mode \u4e3a horizontal \u65f6\u6709\u6548)",type:"string",optional:"\u2014",defaultvalue:"hover"}],Events:[{eventName:"onSelect",instruction:"\u83dc\u5355\u6fc0\u6d3b\u56de\u8c03",callbackParam:"index: \u9009\u4e2d\u83dc\u5355\u9879\u7684 indexPath: \u9009\u4e2d\u83dc\u5355\u9879\u7684 index path"},{eventName:"onOpen",instruction:"SubMenu \u5c55\u5f00\u7684\u56de\u8c03",callbackParam:"index: \u6253\u5f00\u7684 subMenu \u7684 index\uff0c indexPath: \u6253\u5f00\u7684 subMenu \u7684 index path"},{eventName:"onClose",instruction:"SubMenu \u6536\u8d77\u7684\u56de\u8c03",callbackParam:"index: \u6536\u8d77\u7684 subMenu \u7684 index\uff0c indexPath: \u6536\u8d77\u7684 subMenu \u7684 index path"}]},SubMenu:{List:[{param:"index",instruction:"\u552f\u4e00\u6807\u5fd7",type:"string",optional:"\u2014",defaultvalue:"\u2014"}]},MenuGroup:{List:[{param:"title",instruction:"\u5206\u7ec4\u6807\u9898",type:"string",optional:"\u2014",defaultvalue:"\u2014"}]},MenuItem:{List:[{param:"index",instruction:"\u552f\u4e00\u6807\u5fd7",type:"string",optional:"\u2014",defaultvalue:"\u2014"}]},Tab:{List:[{param:"type",instruction:"\u98ce\u683c\u7c7b\u578b",type:"string",optional:"card, border-card",defaultvalue:"\u2014"},{param:"closable",instruction:"\u6807\u7b7e\u662f\u5426\u53ef\u5173\u95ed",type:"boolean",optional:"-",defaultvalue:"false"},{param:"addable",instruction:"\u6807\u7b7e\u662f\u5426\u53ef\u589e\u52a0",type:"boolean",optional:"-",defaultvalue:"false"},{param:"editable",instruction:"\u6807\u7b7e\u662f\u5426\u540c\u65f6\u53ef\u589e\u52a0\u548c\u5173\u95ed",type:"boolean",optional:"-",defaultvalue:"false"},{param:"activeName",instruction:"\u9009\u4e2d\u9009\u9879\u5361\u7684 name",type:"string",optional:"\u2014",defaultvalue:"\u7b2c\u4e00\u4e2a\u9009\u9879\u5361\u7684 name"},{param:"value",instruction:"\u7ed1\u5b9a\u503c\uff0c\u9009\u4e2d\u9009\u9879\u5361\u7684name",type:"string",optional:"\u2014",defaultvalue:"\u7b2c\u4e00\u4e2a\u9009\u9879\u5361\u7684 name"}],Events:[{eventName:"onTabClick",instruction:"tab \u88ab\u9009\u4e2d\u65f6\u89e6\u53d1",callbackParam:"\u88ab\u9009\u4e2d\u7684\u6807\u7b7e tab \u5b9e\u4f8b"},{eventName:"onTabRemove",instruction:"\u70b9\u51fb tab \u79fb\u9664\u6309\u94ae\u540e\u89e6\u53d1",callbackParam:"\u88ab\u5220\u9664\u7684\u6807\u7b7e\u7684 name"},{eventName:"onTabAdd",instruction:"\u70b9\u51fb tabs \u7684\u65b0\u589e\u6309\u94ae\u540e\u89e6\u53d1",callbackParam:"-"},{eventName:"onTabEdit",instruction:"\u70b9\u51fb tabs \u7684\u65b0\u589e\u6309\u94ae\u6216 tab \u88ab\u5173\u95ed\u540e\u89e6\u53d1",callbackParam:"(targetName, action)"}]},TabPane:{List:[{param:"label",instruction:"\u9009\u9879\u5361\u6807\u9898",type:"string,node",optional:"\u2014",defaultvalue:"\u2014"},{param:"disabled",instruction:"\u662f\u5426\u7981\u7528",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"name",instruction:"\u4e0e\u9009\u9879\u5361 activeName \u5bf9\u5e94\u7684\u6807\u8bc6\u7b26\uff0c\u8868\u793a\u9009\u9879\u5361\u522b\u540d",type:"string",optional:"\u2014",defaultvalue:"\u8be5\u9009\u9879\u5361\u5728\u9009\u9879\u5361\u5217\u8868\u4e2d\u7684\u987a\u5e8f\u503c\uff0c\u5982\u7b2c\u4e00\u4e2a\u9009\u9879\u5361\u5219\u4e3a'1'"},{param:"closable",instruction:"\u6807\u7b7e\u662f\u5426\u53ef\u5173\u95ed",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"customClass",instruction:"\u81ea\u5b9a\u4e49\u6837\u5f0fclass\u540d",type:"string",optional:"\u2014",defaultvalue:"\u2014"}]},Breadcrumb:{List:[{param:"separator",instruction:"\u5206\u9694\u7b26",type:"string",optional:"\u2014",defaultvalue:"\u659c\u6760'/'"}]},Dropdown:{List:[{param:"type",instruction:"\u83dc\u5355\u6309\u94ae\u7c7b\u578b\uff0c\u540c Button \u7ec4\u4ef6(\u53ea\u5728splitButton\u4e3a true \u7684\u60c5\u51b5\u4e0b\u6709\u6548)",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"size",instruction:"\u83dc\u5355\u6309\u94ae\u5c3a\u5bf8\uff0c\u540c Button \u7ec4\u4ef6(\u53ea\u5728splitButton\u4e3a true \u7684\u60c5\u51b5\u4e0b\u6709\u6548)",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"splitButton",instruction:"\u4e0b\u62c9\u89e6\u53d1\u5143\u7d20\u5448\u73b0\u4e3a\u6309\u94ae\u7ec4\uff0c\u4e0d\u53ef\u5355\u72ec\u4f7f\u7528\uff0c\u5fc5\u987b\u589e\u8bbeonClick\u5c5e\u6027\uff0c\u5426\u5219\u4f1a\u62a5\u9519",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"menuAlign",instruction:"\u83dc\u5355\u6c34\u5e73\u5bf9\u9f50\u65b9\u5411",type:"string",optional:"start, end",defaultvalue:"end"},{param:"trigger",instruction:"\u89e6\u53d1\u4e0b\u62c9\u7684\u884c\u4e3a",type:"string",optional:"hover, click",defaultvalue:"hover"},{param:"hideOnClick",instruction:"\u662f\u5426\u5728\u70b9\u51fb\u83dc\u5355\u9879\u540e\u9690\u85cf\u83dc\u5355",type:"boolean",optional:"\u2014",defaultvalue:"true"}],Events:[{eventName:"onClick",instruction:"splitButton \u4e3a true \u65f6\uff0c\u70b9\u51fb\u5de6\u4fa7\u6309\u94ae\u7684\u56de\u8c03",callbackParam:"\u2014"},{eventName:"onCommand",instruction:"\u70b9\u51fb\u83dc\u5355\u9879\u89e6\u53d1\u7684\u4e8b\u4ef6\u56de\u8c03",callbackParam:"Dropdown.Item \u7684\u6307\u4ee4"},{eventName:"onVisibleChange",instruction:"\u4e0b\u62c9\u6846\u51fa\u73b0/\u9690\u85cf\u65f6\u89e6\u53d1",callbackParam:"\u51fa\u73b0\u5219\u4e3a true\uff0c\u9690\u85cf\u5219\u4e3a false"}]},DropdownMenuItem:{List:[{param:"command",instruction:"\u6307\u4ee4",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"disabled",instruction:"\u7981\u7528",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"divided",instruction:"\u663e\u793a\u5206\u5272\u7ebf",type:"boolean",optional:"\u2014",defaultvalue:"false"}]},Steps:{List:[{param:"space",instruction:"\u6bcf\u4e2a step \u7684\u95f4\u8ddd\uff0c\u4e0d\u586b\u5199\u5c06\u81ea\u9002\u5e94\u95f4\u8ddd",type:"Number",optional:"\u2014",defaultvalue:"\u2014"},{param:"direction",instruction:"\u663e\u793a\u65b9\u5411",type:"string",optional:"vertical/horizontal",defaultvalue:"horizontal"},{param:"active",instruction:"\u8bbe\u7f6e\u5f53\u524d\u6fc0\u6d3b\u6b65\u9aa4",type:"number",optional:"\u2014",defaultvalue:"0"},{param:"processStatus",instruction:"\u8bbe\u7f6e\u5f53\u524d\u6b65\u9aa4\u7684\u72b6\u6001",type:"string",optional:"wait/process/finish/error/success",defaultvalue:"process"},{param:"finishStatus",instruction:"\u8bbe\u7f6e\u7ed3\u675f\u6b65\u9aa4\u7684\u72b6\u6001",type:"string",optional:"wait/process/finish/error/success",defaultvalue:"finish"}]},Step:{List:[{param:"title",instruction:"\u6807\u9898",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"description",instruction:"\u63cf\u8ff0\u6027\u6587\u5b57",type:"string/ReactElement",optional:"\u2014",defaultvalue:"\u2014"},{param:"icon",instruction:"\u56fe\u6807",type:"Element Icon \u63d0\u4f9b\u7684\u56fe\u6807\uff0c\u5982\u679c\u8981\u4f7f\u7528\u81ea\u5b9a\u4e49\u56fe\u6807\u53ef\u4ee5\u901a\u8fc7\u81ea\u5b9a\u4e49element\u7684\u65b9\u5f0f\u5199\u5165",optional:"string",defaultvalue:"\u2014"}]},Dialog:{List:[{param:"title",instruction:"Dialog \u7684\u6807\u9898",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"size",instruction:"Dialog \u7684\u5927\u5c0f",type:"string",optional:"tiny/small/large/full",defaultvalue:"small"},{param:"top",instruction:"Dialog CSS \u4e2d\u7684 top \u503c\uff08\u4ec5\u5728 size \u4e0d\u4e3a full \u65f6\u6709\u6548\uff09",type:"string",optional:"\u2014",defaultvalue:"15%"},{param:"modal",instruction:"\u662f\u5426\u9700\u8981\u906e\u7f69\u5c42",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"lockScroll",instruction:"\u662f\u5426\u5728 Dialog \u51fa\u73b0\u65f6\u5c06 body \u6eda\u52a8\u9501\u5b9a",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"customClass",instruction:"Dialog \u7684\u81ea\u5b9a\u4e49\u7c7b\u540d",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"closeOnClickModal",instruction:"\u662f\u5426\u53ef\u4ee5\u901a\u8fc7\u70b9\u51fb modal \u5173\u95ed Dialog",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"closeOnPressEscape",instruction:"\u662f\u5426\u53ef\u4ee5\u901a\u8fc7\u6309\u4e0b ESC \u5173\u95ed Dialog",type:"boolean",optional:"\u2014",defaultvalue:"true"}],Events:[{eventName:"onOpen",instruction:"Dialog \u6253\u5f00\u7684\u56de\u8c03",callbackParam:"\u2014"}]},Tooltip:{List:[{param:"effect",instruction:"\u9ed8\u8ba4\u63d0\u4f9b\u7684\u4e3b\u9898",type:"String",optional:"dark, light",defaultvalue:"dark"},{param:"content",instruction:"\u663e\u793a\u7684\u5185\u5bb9",type:"String/Node",optional:"\u2014",defaultvalue:"\u2014"},{param:"placement",instruction:"Tooltip \u7684\u51fa\u73b0\u4f4d\u7f6e",type:"String",optional:"top, top-start, top-end, bottom, bottom-start, bottom-end, left, left-start, left-end, right, right-start, right-end",defaultvalue:"bottom"},{param:"visible",instruction:"\u72b6\u6001\u662f\u5426\u53ef\u89c1",type:"Boolean",optional:"\u2014",defaultvalue:"false"},{param:"disabled",instruction:"Tooltip \u662f\u5426\u53ef\u7528",type:"Boolean",optional:"\u2014",defaultvalue:"false"},{param:"transition",instruction:"\u5b9a\u4e49\u6e10\u53d8\u52a8\u753b",type:"String",optional:"\u2014",defaultvalue:"fade-in-linear"},{param:"visibleArrow",instruction:"\u662f\u5426\u663e\u793a Tooltip \u7bad\u5934",type:"Boolean",optional:"\u2014",defaultvalue:"true"},{param:"openDelay",instruction:"\u5ef6\u8fdf\u51fa\u73b0\uff0c\u5355\u4f4d\u6beb\u79d2",type:"Number",optional:"\u2014",defaultvalue:"0"},{param:"manual",instruction:"\u624b\u52a8\u63a7\u5236\u6a21\u5f0f\uff0c\u8bbe\u7f6e\u4e3a true \u540e\uff0cmouseenter \u548c mouseleave \u4e8b\u4ef6\u5c06\u4e0d\u4f1a\u751f\u6548",type:"Boolean",optional:"true,false",defaultvalue:"false"}]},Popover:{List:[{param:"trigger",instruction:"\u89e6\u53d1\u65b9\u5f0f",type:"String",optional:"click/focus/hover",defaultvalue:"click"},{param:"title",instruction:"\u6807\u9898",type:"String",optional:"\u2014",defaultvalue:"\u2014"},{param:"content",instruction:"\u663e\u793a\u7684\u5185\u5bb9\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7 slot \u4f20\u5165 DOM",type:"String",optional:"\u2014",defaultvalue:"\u2014"},{param:"width",instruction:"\u5bbd\u5ea6",type:"String, Number",optional:"\u2014",defaultvalue:"\u6700\u5c0f\u5bbd\u5ea6 150px"},{param:"placement",instruction:"\u51fa\u73b0\u4f4d\u7f6e",type:"String",optional:"top/top-start/top-end/bottom/bottom-start/bottom-end/left/left-start/left-end/right/right-start/right-end",defaultvalue:"bottom"},{param:"visible",instruction:"\u72b6\u6001\u662f\u5426\u53ef\u89c1",type:"Boolean",optional:"\u2014",defaultvalue:"false"},{param:"transition",instruction:"\u5b9a\u4e49\u6e10\u53d8\u52a8\u753b",type:"String",optional:"\u2014",defaultvalue:"fade-in-linear"},{param:"visibleArrow",instruction:"\u662f\u5426\u663e\u793a Tooltip \u7bad\u5934",type:"Boolean",optional:"\u2014",defaultvalue:"true"},{param:"popperClass",instruction:"\u4e3a popper \u6dfb\u52a0\u7c7b\u540d",type:"String",optional:"-",defaultvalue:"-"}]},BarChart:{List:[{param:"option",instruction:"\u56fe\u8868\u7684\u914d\u7f6e(\u8be6\u89c1echarts\u6587\u6863)",type:"function",optional:"-",defaultvalue:"-"},{param:"style",instruction:"\u56fe\u8868\u6837\u5f0f",type:"object",optional:"-",defaultvalue:"-"},{param:"className",instruction:"\u56fe\u8868\u7c7b\u540d",type:"String",optional:"-",defaultvalue:"react_for_echarts"}]},PieChart:{List:[{param:"option",instruction:"\u56fe\u8868\u7684\u914d\u7f6e(\u8be6\u89c1echarts\u6587\u6863)",type:"function",optional:"-",defaultvalue:"-"},{param:"style",instruction:"\u56fe\u8868\u6837\u5f0f",type:"object",optional:"-",defaultvalue:"-"},{param:"className",instruction:"\u56fe\u8868\u7c7b\u540d",type:"String",optional:"-",defaultvalue:"react_for_echarts"}]},LineChart:{List:[{param:"option",instruction:"\u56fe\u8868\u7684\u914d\u7f6e(\u8be6\u89c1echarts\u6587\u6863)",type:"function",optional:"-",defaultvalue:"-"},{param:"style",instruction:"\u56fe\u8868\u6837\u5f0f",type:"object",optional:"-",defaultvalue:"-"},{param:"className",instruction:"\u56fe\u8868\u7c7b\u540d",type:"String",optional:"-",defaultvalue:"react_for_echarts"}]},Cascader:{List:[{param:"options",instruction:"\u53ef\u9009\u9879\u6570\u636e\u6e90\uff0c\u952e\u540d\u53ef\u901a\u8fc7 props \u5c5e\u6027\u914d\u7f6e",type:"array",optional:"\u2014",defaultvalue:"\u2014"},{param:"props",instruction:"\u914d\u7f6e\u9009\u9879\uff0c\u5177\u4f53\u89c1\u4e0b\u8868",type:"object",optional:"\u2014",defaultvalue:"\u2014"},{param:"value",instruction:"\u9009\u4e2d\u9879\u7ed1\u5b9a\u503c",type:"array",optional:"\u2014",defaultvalue:"\u2014"},{param:"popperClass",instruction:"\u81ea\u5b9a\u4e49\u6d6e\u5c42\u7c7b\u540d",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"placeholder",instruction:"\u8f93\u5165\u6846\u5360\u4f4d\u6587\u672c",type:"string",optional:"\u2014",defaultvalue:"\u8bf7\u9009\u62e9"},{param:"disabled",instruction:"\u662f\u5426\u7981\u7528",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"clearable",instruction:"\u662f\u5426\u652f\u6301\u6e05\u7a7a\u9009\u9879",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"expandTrigger",instruction:"\u6b21\u7ea7\u83dc\u5355\u7684\u5c55\u5f00\u65b9\u5f0f",type:"string",optional:"click / hover",defaultvalue:"click"},{param:"showAllLevels",instruction:"\u8f93\u5165\u6846\u4e2d\u662f\u5426\u663e\u793a\u9009\u4e2d\u503c\u7684\u5b8c\u6574\u8def\u5f84",type:"boolean",optional:"\u2014",defaultvalue:"true"},{param:"filterable",instruction:"\u662f\u5426\u53ef\u641c\u7d22\u9009\u9879",type:"boolean",optional:"\u2014",defaultvalue:"\u2014"},{param:"debounce",instruction:"\u641c\u7d22\u5173\u952e\u8bcd\u8f93\u5165\u7684\u53bb\u6296\u5ef6\u8fdf\uff0c\u6beb\u79d2",type:"number",optional:"\u2014",defaultvalue:"300"},{param:"changeOnSelect",instruction:"\u662f\u5426\u5141\u8bb8\u9009\u62e9\u4efb\u610f\u4e00\u7ea7\u7684\u9009\u9879",type:"boolean",optional:"\u2014",defaultvalue:"false"},{param:"size",instruction:"\u5c3a\u5bf8",type:"string",optional:"large / small / mini",defaultvalue:"\u2014"},{param:"beforeFilter",instruction:"\u53ef\u9009\u53c2\u6570, \u7b5b\u9009\u4e4b\u524d\u7684\u94a9\u5b50\uff0c\u53c2\u6570\u4e3a\u8f93\u5165\u7684\u503c\uff0c\u82e5\u8fd4\u56de false \u6216\u8005\u8fd4\u56de Promise \u4e14\u88ab reject\uff0c\u5219\u505c\u6b62\u7b5b\u9009\u3002",type:"function(value)",optional:"\u2014",defaultvalue:"\u2014"}],Options:[{param:"value",instruction:"\u6307\u5b9a\u9009\u9879\u7684\u503c\u4e3a\u9009\u9879\u5bf9\u8c61\u7684\u67d0\u4e2a\u5c5e\u6027\u503c",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"label",instruction:"\u6307\u5b9a\u9009\u9879\u6807\u7b7e\u4e3a\u9009\u9879\u5bf9\u8c61\u7684\u67d0\u4e2a\u5c5e\u6027\u503c",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"children",instruction:"\u6307\u5b9a\u9009\u9879\u7684\u5b50\u9009\u9879\u4e3a\u9009\u9879\u5bf9\u8c61\u7684\u67d0\u4e2a\u5c5e\u6027\u503c",type:"string",optional:"\u2014",defaultvalue:"\u2014"},{param:"disabled",instruction:"\u6307\u5b9a\u9009\u9879\u7684\u7981\u7528\u4e3a\u9009\u9879\u5bf9\u8c61\u7684\u67d0\u4e2a\u5c5e\u6027\u503c",type:"string",optional:"\u2014",defaultvalue:"\u2014"}],Events:[{eventName:"onChange",instruction:"\u5f53\u7ed1\u5b9a\u503c\u53d8\u5316\u65f6\u89e6\u53d1\u7684\u4e8b\u4ef6",callbackParam:"\u5f53\u524d\u503c"},{eventName:"activeItemChange",instruction:"\u5f53\u7236\u7ea7\u9009\u9879\u53d8\u5316\u65f6\u89e6\u53d1\u7684\u4e8b\u4ef6\uff0c\u4ec5\u5728 change-on-select \u4e3a false \u65f6\u53ef\u7528",callbackParam:"\u5404\u7236\u7ea7\u9009\u9879\u7ec4\u6210\u7684\u6570\u7ec4"}]},Badge:{List:[{param:"value",instruction:"\u663e\u793a\u503c",type:"string, number",optional:"\u2014",defaultvalue:"\u2014"},{param:"max",instruction:"\u6700\u5927\u503c\uff0c\u8d85\u8fc7\u6700\u5927\u503c\u4f1a\u663e\u793a '{max}+'\uff0c\u8981\u6c42 value \u662f Number \u7c7b\u578b",type:"number",optional:"\u2014",defaultvalue:"\u2014"},{param:"isDot",instruction:"\u5c0f\u5706\u70b9",type:"boolean",optional:"\u2014",defaultvalue:"false"}]}}),c=function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}(),p=function(n){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return r(e,n),c(e,[{key:"render",value:function(){var n=this.props.name,e=l[n].Method&&l[n].Method.length?l[n].Method:null,t=l[n].Events&&l[n].Events.length?l[n].Events:null,o=l[n].List&&l[n].List.length?l[n].List:l[n].Options&&l[n].Options.length?l[n].Options:[],i=l[n].List?"\u53c2\u6570":l[n].Options?"\u9009\u9879":"",r=function(n,e){var t=n.param,o=n.instruction,i=n.type,r=n.optional,a=n.defaultvalue;return s.a.createElement("tr",{key:e},s.a.createElement("td",null,t),s.a.createElement("td",null,o),s.a.createElement("td",null,i),s.a.createElement("td",null,r),s.a.createElement("td",null,a))},a=function(n,e){var t=n.eventName,o=n.instruction,i=n.callbackParam;return s.a.createElement("tr",{key:e},s.a.createElement("td",null,t),s.a.createElement("td",null,o),s.a.createElement("td",null,i))},c=function(n,e){var t=n.methodName,o=n.instruction,i=n.methodParam;return s.a.createElement("tr",{key:e},s.a.createElement("td",null,t),s.a.createElement("td",null,o),s.a.createElement("td",null,i))};return s.a.createElement("div",null,s.a.createElement("h2",null,this.props.name,"\xa0\xa0",i),s.a.createElement("table",{className:"grid",align:"center"},s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,"\u53c2\u6570"),s.a.createElement("th",null,"\u8bf4\u660e"),s.a.createElement("th",null,"\u7c7b\u578b"),s.a.createElement("th",null,"\u53ef\u9009\u503c"),s.a.createElement("th",null,"\u9ed8\u8ba4\u503c"))),s.a.createElement("tbody",null,o&&o.map(function(n,e){return r(n,e)}))),t&&s.a.createElement("div",null,s.a.createElement("h2",null,this.props.name,"\xa0\xa0\u4e8b\u4ef6"),s.a.createElement("table",{className:"grid",align:"center"},s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,"\u4e8b\u4ef6\u540d\u79f0"),s.a.createElement("th",null,"\u8bf4\u660e"),s.a.createElement("th",null,"\u56de\u8c03\u53c2\u6570"))),s.a.createElement("tbody",null,t&&t.map(function(n,e){return a(n,e)})))),e&&s.a.createElement("div",null,s.a.createElement("h2",null,this.props.name,"\xa0\xa0\u65b9\u6cd5"),s.a.createElement("table",{className:"grid",align:"center"},s.a.createElement("thead",null,s.a.createElement("tr",null,s.a.createElement("th",null,"\u65b9\u6cd5\u540d\u79f0"),s.a.createElement("th",null,"\u8bf4\u660e"),s.a.createElement("th",null,"\u53c2\u6570"))),s.a.createElement("tbody",null,e&&e.map(function(n,e){return c(n,e)})))))}}]),e}(a.Component);e.a=p},253:function(n,e,t){var o,i;"function"===typeof Symbol&&Symbol.iterator;!function(r,a){o=a,void 0!==(i="function"===typeof o?o.call(e,t,e,n):o)&&(n.exports=i)}(0,function(){"use strict";function n(n,e,t){this._reference=n.jquery?n[0]:n,this.state={};var o="undefined"===typeof e||null===e,i=e&&"[object Object]"===Object.prototype.toString.call(e);return this._popper=o||i?this.parse(i?e:{}):e.jquery?e[0]:e,this._options=Object.assign({},f,t),this._options.modifiers=this._options.modifiers.map(function(n){if(-1===this._options.modifiersIgnored.indexOf(n))return"applyStyle"===n&&this._popper.setAttribute("x-placement",this._options.placement),this.modifiers[n]||n}.bind(this)),this.state.position=this._getPosition(this._popper,this._reference),c(this._popper,{position:this.state.position,top:0}),this.update(),this._setupEventListeners(),this}function e(n){var e=n.style.display,t=n.style.visibility;n.style.display="block",n.style.visibility="hidden";var o=(n.offsetWidth,m.getComputedStyle(n)),i=parseFloat(o.marginTop)+parseFloat(o.marginBottom),r=parseFloat(o.marginLeft)+parseFloat(o.marginRight),a={width:n.offsetWidth+r,height:n.offsetHeight+i};return n.style.display=e,n.style.visibility=t,a}function t(n){var e={left:"right",right:"left",bottom:"top",top:"bottom"};return n.replace(/left|right|bottom|top/g,function(n){return e[n]})}function o(n){var e=Object.assign({},n);return e.right=e.left+e.width,e.bottom=e.top+e.height,e}function i(n,e){var t,o=0;for(t in n){if(n[t]===e)return o;o++}return null}function r(n,e){return m.getComputedStyle(n,null)[e]}function a(n){var e=n.offsetParent;return e!==m.document.body&&e?e:m.document.documentElement}function s(n){var e=n.parentNode;return e?e===m.document?m.document.body.scrollTop?m.document.body:m.document.documentElement:-1!==["scroll","auto"].indexOf(r(e,"overflow"))||-1!==["scroll","auto"].indexOf(r(e,"overflow-x"))||-1!==["scroll","auto"].indexOf(r(e,"overflow-y"))?e:s(n.parentNode):n}function l(n){return n!==m.document.body&&("fixed"===r(n,"position")||(n.parentNode?l(n.parentNode):n))}function c(n,e){function t(n){return""!==n&&!isNaN(parseFloat(n))&&isFinite(n)}Object.keys(e).forEach(function(o){var i="";-1!==["width","height","top","right","bottom","left"].indexOf(o)&&t(e[o])&&(i="px"),n.style[o]=e[o]+i})}function p(n){var e={};return n&&"[object Function]"===e.toString.call(n)}function d(n){var e={width:n.offsetWidth,height:n.offsetHeight,left:n.offsetLeft,top:n.offsetTop};return e.right=e.left+e.width,e.bottom=e.top+e.height,e}function u(n){var e=n.getBoundingClientRect(),t=-1!=navigator.userAgent.indexOf("MSIE"),o=t&&"HTML"===n.tagName?-n.scrollTop:e.top;return{left:e.left,top:o,right:e.right,bottom:e.bottom,width:e.right-e.left,height:e.bottom-o}}function h(n,e,t){var o=u(n),i=u(e);if(t){var r=s(e);i.top+=r.scrollTop,i.bottom+=r.scrollTop,i.left+=r.scrollLeft,i.right+=r.scrollLeft}return{top:o.top-i.top,left:o.left-i.left,bottom:o.top-i.top+o.height,right:o.left-i.left+o.width,width:o.width,height:o.height}}function A(n){for(var e=["","ms","webkit","moz","o"],t=0;t<e.length;t++){var o=e[t]?e[t]+n.charAt(0).toUpperCase()+n.slice(1):n;if("undefined"!==typeof m.document.body.style[o])return o}return null}var m=window,f={placement:"bottom",gpuAcceleration:!0,offset:0,boundariesElement:"viewport",boundariesPadding:5,preventOverflowOrder:["left","right","top","bottom"],flipBehavior:"flip",arrowElement:"[x-arrow]",modifiers:["shift","offset","preventOverflow","keepTogether","arrow","flip","applyStyle"],modifiersIgnored:[],forceAbsolute:!1};return n.prototype.destroy=function(){return this._popper.removeAttribute("x-placement"),this._popper.style.left="",this._popper.style.position="",this._popper.style.top="",this._popper.style[A("transform")]="",this._removeEventListeners(),this._options.removeOnDestroy&&this._popper.remove(),this},n.prototype.update=function(){var n={instance:this,styles:{}};n.placement=this._options.placement,n._originalPlacement=this._options.placement,n.offsets=this._getOffsets(this._popper,this._reference,n.placement),n.boundaries=this._getBoundaries(n,this._options.boundariesPadding,this._options.boundariesElement),n=this.runModifiers(n,this._options.modifiers),"function"===typeof this.state.updateCallback&&this.state.updateCallback(n)},n.prototype.onCreate=function(n){return n(this),this},n.prototype.onUpdate=function(n){return this.state.updateCallback=n,this},n.prototype.parse=function(n){function e(n,e){e.forEach(function(e){n.classList.add(e)})}function t(n,e){e.forEach(function(e){n.setAttribute(e.split(":")[0],e.split(":")[1]||"")})}var o={tagName:"div",classNames:["popper"],attributes:[],parent:m.document.body,content:"",contentType:"text",arrowTagName:"div",arrowClassNames:["popper__arrow"],arrowAttributes:["x-arrow"]};n=Object.assign({},o,n);var i=m.document,r=i.createElement(n.tagName);if(e(r,n.classNames),t(r,n.attributes),"node"===n.contentType?r.appendChild(n.content.jquery?n.content[0]:n.content):"html"===n.contentType?r.innerHTML=n.content:r.textContent=n.content,n.arrowTagName){var a=i.createElement(n.arrowTagName);e(a,n.arrowClassNames),t(a,n.arrowAttributes),r.appendChild(a)}var s=n.parent.jquery?n.parent[0]:n.parent;if("string"===typeof s){if(s=i.querySelectorAll(n.parent),s.length>1&&console.warn("WARNING: the given `parent` query("+n.parent+") matched more than one element, the first one will be used"),0===s.length)throw"ERROR: the given `parent` doesn't exists!";s=s[0]}return s.length>1&&s instanceof Element===!1&&(console.warn("WARNING: you have passed as parent a list of elements, the first one will be used"),s=s[0]),s.appendChild(r),r},n.prototype._getPosition=function(n,e){var t=a(e);return this._options.forceAbsolute?"absolute":l(e,t)?"fixed":"absolute"},n.prototype._getOffsets=function(n,t,o){o=o.split("-")[0];var i={};i.position=this.state.position;var r="fixed"===i.position,s=h(t,a(n),r),l=e(n);return-1!==["right","left"].indexOf(o)?(i.top=s.top+s.height/2-l.height/2,i.left="left"===o?s.left-l.width:s.right):(i.left=s.left+s.width/2-l.width/2,i.top="top"===o?s.top-l.height:s.bottom),i.width=l.width,i.height=l.height,{popper:i,reference:s}},n.prototype._setupEventListeners=function(){if(this.state.updateBound=this.update.bind(this),m.addEventListener("resize",this.state.updateBound),"window"!==this._options.boundariesElement){var n=s(this._reference);n!==m.document.body&&n!==m.document.documentElement||(n=m),n.addEventListener("scroll",this.state.updateBound)}},n.prototype._removeEventListeners=function(){if(m.removeEventListener("resize",this.state.updateBound),"window"!==this._options.boundariesElement){var n=s(this._reference);n!==m.document.body&&n!==m.document.documentElement||(n=m),n.removeEventListener("scroll",this.state.updateBound)}this.state.updateBound=null},n.prototype._getBoundaries=function(n,e,t){var o,i,r={};if("window"===t){var l=m.document.body,c=m.document.documentElement;i=Math.max(l.scrollHeight,l.offsetHeight,c.clientHeight,c.scrollHeight,c.offsetHeight),o=Math.max(l.scrollWidth,l.offsetWidth,c.clientWidth,c.scrollWidth,c.offsetWidth),r={top:0,right:o,bottom:i,left:0}}else if("viewport"===t){var p=a(this._popper),u=s(this._popper),h=d(p),A="fixed"===n.offsets.popper.position?0:function(n){return n==document.body?Math.max(document.documentElement.scrollTop,document.body.scrollTop):n.scrollTop}(u),f="fixed"===n.offsets.popper.position?0:function(n){return n==document.body?Math.max(document.documentElement.scrollLeft,document.body.scrollLeft):n.scrollLeft}(u);r={top:0-(h.top-A),right:m.document.documentElement.clientWidth-(h.left-f),bottom:m.document.documentElement.clientHeight-(h.top-A),left:0-(h.left-f)}}else r=a(this._popper)===t?{top:0,left:0,right:t.clientWidth,bottom:t.clientHeight}:d(t);return r.left+=e,r.right-=e,r.top=r.top+e,r.bottom=r.bottom-e,r},n.prototype.runModifiers=function(n,e,t){var o=e.slice();return void 0!==t&&(o=this._options.modifiers.slice(0,i(this._options.modifiers,t))),o.forEach(function(e){p(e)&&(n=e.call(this,n))}.bind(this)),n},n.prototype.isModifierRequired=function(n,e){var t=i(this._options.modifiers,n);return!!this._options.modifiers.slice(0,t).filter(function(n){return n===e}).length},n.prototype.modifiers={},n.prototype.modifiers.applyStyle=function(n){var e,t={position:n.offsets.popper.position},o=Math.round(n.offsets.popper.left),i=Math.round(n.offsets.popper.top);return this._options.gpuAcceleration&&(e=A("transform"))?(t[e]="translate3d("+o+"px, "+i+"px, 0)",t.top=0,t.left=0):(t.left=o,t.top=i),Object.assign(t,n.styles),c(this._popper,t),this._popper.setAttribute("x-placement",n.placement),this.isModifierRequired(this.modifiers.applyStyle,this.modifiers.arrow)&&n.offsets.arrow&&c(n.arrowElement,n.offsets.arrow),n},n.prototype.modifiers.shift=function(n){var e=n.placement,t=e.split("-")[0],i=e.split("-")[1];if(i){var r=n.offsets.reference,a=o(n.offsets.popper),s={y:{start:{top:r.top},end:{top:r.top+r.height-a.height}},x:{start:{left:r.left},end:{left:r.left+r.width-a.width}}},l=-1!==["bottom","top"].indexOf(t)?"x":"y";n.offsets.popper=Object.assign(a,s[l][i])}return n},n.prototype.modifiers.preventOverflow=function(n){var e=this._options.preventOverflowOrder,t=o(n.offsets.popper),i={left:function(){var e=t.left;return t.left<n.boundaries.left&&(e=Math.max(t.left,n.boundaries.left)),{left:e}},right:function(){var e=t.left;return t.right>n.boundaries.right&&(e=Math.min(t.left,n.boundaries.right-t.width)),{left:e}},top:function(){var e=t.top;return t.top<n.boundaries.top&&(e=Math.max(t.top,n.boundaries.top)),{top:e}},bottom:function(){var e=t.top;return t.bottom>n.boundaries.bottom&&(e=Math.min(t.top,n.boundaries.bottom-t.height)),{top:e}}};return e.forEach(function(e){n.offsets.popper=Object.assign(t,i[e]())}),n},n.prototype.modifiers.keepTogether=function(n){var e=o(n.offsets.popper),t=n.offsets.reference,i=Math.floor;return e.right<i(t.left)&&(n.offsets.popper.left=i(t.left)-e.width),e.left>i(t.right)&&(n.offsets.popper.left=i(t.right)),e.bottom<i(t.top)&&(n.offsets.popper.top=i(t.top)-e.height),e.top>i(t.bottom)&&(n.offsets.popper.top=i(t.bottom)),n},n.prototype.modifiers.flip=function(n){if(!this.isModifierRequired(this.modifiers.flip,this.modifiers.preventOverflow))return console.warn("WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!"),n;if(n.flipped&&n.placement===n._originalPlacement)return n;var e=n.placement.split("-")[0],i=t(e),r=n.placement.split("-")[1]||"",a=[];return a="flip"===this._options.flipBehavior?[e,i]:this._options.flipBehavior,a.forEach(function(s,l){if(e===s&&a.length!==l+1){e=n.placement.split("-")[0],i=t(e);var c=o(n.offsets.popper),p=-1!==["right","bottom"].indexOf(e);(p&&Math.floor(n.offsets.reference[e])>Math.floor(c[i])||!p&&Math.floor(n.offsets.reference[e])<Math.floor(c[i]))&&(n.flipped=!0,n.placement=a[l+1],r&&(n.placement+="-"+r),n.offsets.popper=this._getOffsets(this._popper,this._reference,n.placement).popper,n=this.runModifiers(n,this._options.modifiers,this._flip))}}.bind(this)),n},n.prototype.modifiers.offset=function(n){var e=this._options.offset,t=n.offsets.popper;return-1!==n.placement.indexOf("left")?t.top-=e:-1!==n.placement.indexOf("right")?t.top+=e:-1!==n.placement.indexOf("top")?t.left-=e:-1!==n.placement.indexOf("bottom")&&(t.left+=e),n},n.prototype.modifiers.arrow=function(n){var t=this._options.arrowElement;if("string"===typeof t&&(t=this._popper.querySelector(t)),!t)return n;if(!this._popper.contains(t))return console.warn("WARNING: `arrowElement` must be child of its popper element!"),n;if(!this.isModifierRequired(this.modifiers.arrow,this.modifiers.keepTogether))return console.warn("WARNING: keepTogether modifier is required by arrow modifier in order to work, be sure to include it before arrow!"),n;var i={},r=n.placement.split("-")[0],a=o(n.offsets.popper),s=n.offsets.reference,l=-1!==["left","right"].indexOf(r),c=l?"height":"width",p=l?"top":"left",d=l?"left":"top",u=l?"bottom":"right",h=e(t)[c];s[u]-h<a[p]&&(n.offsets.popper[p]-=a[p]-(s[u]-h)),s[p]+h>a[u]&&(n.offsets.popper[p]+=s[p]+h-a[u]);var A=s[p]+s[c]/2-h/2,m=A-a[p];return m=Math.max(Math.min(a[c]-h-3,m),3),i[p]=m,i[d]="",n.offsets.arrow=i,n.arrowElement=t,n},Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(void 0===n||null===n)throw new TypeError("Cannot convert first argument to object");for(var e=Object(n),t=1;t<arguments.length;t++){var o=arguments[t];if(void 0!==o&&null!==o){o=Object(o);for(var i=Object.keys(o),r=0,a=i.length;r<a;r++){var s=i[r],l=Object.getOwnPropertyDescriptor(o,s);void 0!==l&&l.enumerable&&(e[s]=o[s])}}}return e}}),n})},266:function(n,e,t){"use strict";function o(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function i(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function r(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}var a=t(0),s=t.n(a),l=t(1),c=t.n(l),p=t(50),d=function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}(),u=function(n){function e(n){o(this,e);var t=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,n));return t.state={options:t.props.value||[]},t}return r(e,n),d(e,[{key:"componentWillReceiveProps",value:function(n){n.value!==this.props.value&&this.setState({options:n.value})}},{key:"getChildContext",value:function(){return{ElCheckboxGroup:this}}},{key:"onChange",value:function(n,e){var t=this.state.options.indexOf(n);e?-1===t&&this.state.options.push(n):this.state.options.splice(t,1),this.forceUpdate(),this.props.onChange&&this.props.onChange(this.state.options)}},{key:"render",value:function(){var n=this,e=this.state.options,t=s.a.Children.map(this.props.children,function(t,o){if(!t)return null;var i=t.type.elementType;return"Checkbox"!==i&&"CheckboxButton"!==i?null:s.a.cloneElement(t,Object.assign({},t.props,{key:o,checked:t.props.checked||e.indexOf(t.props.value)>=0||e.indexOf(t.props.label)>=0,onChange:n.onChange.bind(n,t.props.value||t.props.label)}))});return s.a.createElement("div",{style:this.style(),className:this.className("ishow-checkbox-group")},t)}}]),e}(p.b);e.a=u,u.childContextTypes={ElCheckboxGroup:c.a.any},u.propTypes={min:c.a.oneOfType([c.a.string,c.a.number]),max:c.a.oneOfType([c.a.string,c.a.number]),size:c.a.string,fill:c.a.string,textColor:c.a.string,value:c.a.any,onChange:c.a.func}},270:function(n,e,t){var o=t(323);"string"===typeof o&&(o=[[n.i,o,""]]);var i={hmr:!1};i.transform=void 0;t(193)(o,i);o.locals&&(n.exports=o.locals)},271:function(n,e,t){var o=t(324);"string"===typeof o&&(o=[[n.i,o,""]]);var i={hmr:!1};i.transform=void 0;t(193)(o,i);o.locals&&(n.exports=o.locals)},278:function(n,e,t){"use strict";t.d(e,"a",function(){return w}),t.d(e,"b",function(){return v});var o="undefined"===typeof window,i=function(){if(!o){var n=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(n){return window.setTimeout(n,20)};return function(e){return n(e)}}}(),r=function(){if(!o){var n=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout;return function(e){return n(e)}}}(),a=function(n){var e=n.__resizeTrigger__,t=e.firstElementChild,o=e.lastElementChild,i=t.firstElementChild;o.scrollLeft=o.scrollWidth,o.scrollTop=o.scrollHeight,i.style.width=t.offsetWidth+1+"px",i.style.height=t.offsetHeight+1+"px",t.scrollLeft=t.scrollWidth,t.scrollTop=t.scrollHeight},s=function(n){return n.offsetWidth!==n.__resizeLast__.width||n.offsetHeight!==n.__resizeLast__.height},l=function(n){var e=this;a(this),this.__resizeRAF__&&r(this.__resizeRAF__),this.__resizeRAF__=i(function(){s(e)&&(e.__resizeLast__.width=e.offsetWidth,e.__resizeLast__.height=e.offsetHeight,e.__resizeListeners__.forEach(function(t){t.call(e,n)}))})},c=o?{}:document.attachEvent,p="Webkit Moz O ms".split(" "),d="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),u=!1,h="",A="animationstart";if(!c&&!o){var m=document.createElement("fakeelement");if(void 0!==m.style.animationName&&(u=!0),!1===u)for(var f="",b=0;b<p.length;b++)if(void 0!==m.style[p[b]+"AnimationName"]){f=p[b],h="-"+f.toLowerCase()+"-",A=d[b],u=!0;break}}var g=!1,C=function(){if(!g&&!o){var n="@"+h+"keyframes resizeanim { from { opacity: 0; } to { opacity: 0; } } ",e=h+"animation: 1ms resizeanim;",t=n+"\n .resize-triggers { "+e+' visibility: hidden; opacity: 0; }\n .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: ""; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; }\n .resize-triggers > div { background: #eee; overflow: auto; }\n .contract-trigger:before { width: 200%; height: 200%; }',i=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t)),i.appendChild(r),g=!0}},w=function(n,e){if(!o)if(c)n.attachEvent("onresize",e);else{if(!n.__resizeTrigger__){"static"===getComputedStyle(n).position&&(n.style.position="relative"),C(),n.__resizeLast__={},n.__resizeListeners__=[];var t=n.__resizeTrigger__=document.createElement("div");t.className="resize-triggers",t.innerHTML='<div class="expand-trigger"><div></div></div><div class="contract-trigger"></div>',n.appendChild(t),a(n),n.addEventListener("scroll",l,!0),A&&t.addEventListener(A,function(e){"resizeanim"===e.animationName&&a(n)})}n.__resizeListeners__.push(e)}},v=function(n,e){c?n.detachEvent("onresize",e):(n.__resizeListeners__.splice(n.__resizeListeners__.indexOf(e),1),n.__resizeListeners__.length||(n.removeEventListener("scroll",l),n.__resizeTrigger__=!n.removeChild(n.__resizeTrigger__)))}},292:function(n,e,t){var o=t(293);"string"===typeof o&&(o=[[n.i,o,""]]);var i={hmr:!1};i.transform=void 0;t(193)(o,i);o.locals&&(n.exports=o.locals)},293:function(n,e,t){e=n.exports=t(192)(!0),e.push([n.i,'.ishow-checkbox,.ishow-checkbox__input{cursor:pointer;display:inline-block;position:relative}.ishow-checkbox,.ishow-checkbox-button__inner{white-space:nowrap;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none}.ishow-checkbox{color:#1f2d3d}.ishow-checkbox+.ishow-checkbox{margin-left:15px}.ishow-checkbox__input{white-space:nowrap;outline:0;line-height:1;vertical-align:middle}.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner{background-color:#20a0ff;border-color:#0190fe}.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner:before{content:"";position:absolute;display:block;border:1px solid #fff;margin-top:-1px;left:3px;right:3px;top:50%}.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner:after{display:none}.ishow-checkbox__input.is-focus .ishow-checkbox__inner{border-color:#20a0ff}.ishow-checkbox__input.is-checked .ishow-checkbox__inner{background-color:#20a0ff;border-color:#0190fe}.ishow-checkbox__input.is-checked .ishow-checkbox__inner:after{-ms-transform:rotate(45deg) scaleY(1);-webkit-transform:rotate(45deg) scaleY(1);transform:rotate(45deg) scaleY(1)}.ishow-checkbox__input.is-disabled .ishow-checkbox__inner{background-color:#eef1f6;border-color:#d1dbe5;cursor:not-allowed}.ishow-checkbox__input.is-disabled .ishow-checkbox__inner:after{cursor:not-allowed;border-color:#eef1f6}.ishow-checkbox__input.is-disabled .ishow-checkbox__inner+.ishow-checkbox__label{cursor:not-allowed}.ishow-checkbox__input.is-disabled.is-checked .ishow-checkbox__inner{background-color:#d1dbe5;border-color:#d1dbe5}.ishow-checkbox__input.is-disabled.is-checked .ishow-checkbox__inner:after{border-color:#fff}.ishow-checkbox__input.is-disabled.is-indeterminate .ishow-checkbox__inner{background-color:#d1dbe5;border-color:#d1dbe5}.ishow-checkbox__input.is-disabled.is-indeterminate .ishow-checkbox__inner:before{border-color:#fff}.ishow-checkbox__input.is-disabled+.ishow-checkbox__label{color:#bbb;cursor:not-allowed}.ishow-checkbox__inner{display:inline-block;position:relative;border:1px solid #bfcbd9;border-radius:4px;-webkit-box-sizing:border-box;box-sizing:border-box;width:18px;height:18px;background-color:#fff;z-index:1;-webkit-transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46);-o-transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46);transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46)}.ishow-checkbox__inner:hover{border-color:#20a0ff}.ishow-checkbox__inner:after{-webkit-box-sizing:content-box;box-sizing:content-box;content:"";border:2px solid #fff;border-left:0;border-top:0;height:8px;left:5px;position:absolute;top:1px;-ms-transform:rotate(45deg) scaleY(0);-webkit-transform:rotate(45deg) scaleY(0);transform:rotate(45deg) scaleY(0);width:4px;-webkit-transition:-webkit-transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;transition:-webkit-transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;-o-transition:transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;transition:transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;transition:transform .15s cubic-bezier(.71,-.46,.88,.6) .05s,-webkit-transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;-ms-transform-origin:center;-webkit-transform-origin:center;transform-origin:center}.ishow-checkbox__original{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;left:-999px}.ishow-checkbox-button,.ishow-checkbox-button__inner{display:inline-block;position:relative}.ishow-checkbox__label{font-size:14px;padding-left:5px}.ishow-checkbox-button.is-checked .ishow-checkbox-button__inner{color:#fff;background-color:#20a0ff;border-color:#20a0ff;-webkit-box-shadow:-1px 0 0 0 #20a0ff;box-shadow:-1px 0 0 0 #20a0ff}.ishow-checkbox-button.is-disabled .ishow-checkbox-button__inner{color:#bfcbd9;cursor:not-allowed;background-image:none;background-color:#eef1f6;border-color:#d1dbe5;-webkit-box-shadow:none;box-shadow:none}.ishow-checkbox-button.is-focus .ishow-checkbox-button__inner{border-color:#20a0ff}.ishow-checkbox-button:first-child .ishow-checkbox-button__inner{border-left:1px solid #bfcbd9;border-radius:4px 0 0 4px;-webkit-box-shadow:none!important;box-shadow:none!important}.ishow-checkbox-button:last-child .ishow-checkbox-button__inner{border-radius:0 4px 4px 0}.ishow-checkbox-button__inner{line-height:1;vertical-align:middle;background:#fff;border:1px solid #bfcbd9;border-left:0;color:#1f2d3d;-webkit-appearance:none;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;outline:0;margin:0;cursor:pointer;-webkit-transition:all .3s cubic-bezier(.645,.045,.355,1);-o-transition:all .3s cubic-bezier(.645,.045,.355,1);transition:all .3s cubic-bezier(.645,.045,.355,1);padding:10px 15px;font-size:14px;border-radius:0}.ishow-checkbox-button__inner:hover{color:#20a0ff}.ishow-checkbox-button__inner [class*=ishow-icon-]{line-height:.9}.ishow-checkbox-button__inner [class*=ishow-icon-]+span{margin-left:5px}.ishow-checkbox-button__original{opacity:0;outline:0;position:absolute;margin:0;visibility:hidden;left:-999px}.ishow-checkbox-button--large .ishow-checkbox-button__inner{padding:11px 19px;font-size:16px;border-radius:0}.ishow-checkbox-button--small .ishow-checkbox-button__inner{padding:7px 9px;font-size:12px;border-radius:0}.ishow-checkbox-button--mini .ishow-checkbox-button__inner{padding:4px;font-size:12px;border-radius:0}',"",{version:3,sources:["E:/demo/demo/src/ishow/Common/css/checkbox.css"],names:[],mappings:"AACA,uCACE,eAAgB,AAChB,qBAAsB,AACtB,iBAAkB,CACnB,AAED,8CACE,mBAAoB,AACpB,sBAAuB,AACvB,yBAA0B,AAC1B,oBAAqB,CACtB,AAED,gBACE,aAAe,CAChB,AAED,gCACE,gBAAiB,CAClB,AAED,uBACE,mBAAoB,AACpB,UAAW,AACX,cAAe,AACf,qBAAsB,CACvB,AAED,+DACE,yBAA0B,AAC1B,oBAAqB,CACtB,AAED,sEACE,WAAY,AACZ,kBAAmB,AACnB,cAAe,AACf,sBAAuB,AACvB,gBAAiB,AACjB,SAAU,AACV,UAAW,AACX,OAAQ,CACT,AAED,qEACE,YAAa,CACd,AAED,uDACE,oBAAqB,CACtB,AAED,yDACE,yBAA0B,AAC1B,oBAAqB,CACtB,AAED,+DACE,sCAAuC,AACvC,0CAA2C,AACnC,iCAAkC,CAC3C,AAED,0DACE,yBAA0B,AAC1B,qBAAsB,AACtB,kBAAmB,CACpB,AAED,gEACE,mBAAoB,AACpB,oBAAqB,CACtB,AAED,iFACE,kBAAmB,CACpB,AAED,qEACE,yBAA0B,AAC1B,oBAAqB,CACtB,AAED,2EACE,iBAAkB,CACnB,AAED,2EACE,yBAA0B,AAC1B,oBAAqB,CACtB,AAED,kFACE,iBAAkB,CACnB,AAED,0DACE,WAAY,AACZ,kBAAmB,CACpB,AAED,uBACE,qBAAsB,AACtB,kBAAmB,AACnB,yBAA0B,AAC1B,kBAAmB,AACnB,8BAA+B,AACvB,sBAAuB,AAC/B,WAAY,AACZ,YAAa,AACb,sBAAuB,AACvB,UAAW,AACX,2HAAmI,AACnI,sHAA8H,AAC9H,kHAA0H,CAC3H,AAED,6BACE,oBAAqB,CACtB,AAED,6BACE,+BAAgC,AACxB,uBAAwB,AAChC,WAAY,AACZ,sBAAuB,AACvB,cAAe,AACf,aAAc,AACd,WAAY,AACZ,SAAU,AACV,kBAAmB,AACnB,QAAS,AACT,sCAAuC,AACvC,0CAA2C,AACnC,kCAAmC,AAC3C,UAAW,AACX,6EAAiF,AACjF,qEAAyE,AACzE,gEAAoE,AACpE,6DAAiE,AACjE,uHAA+H,AAC/H,4BAA6B,AAC7B,gCAAiC,AACzB,uBAAwB,CACjC,AAED,0BACE,UAAW,AACX,UAAW,AACX,kBAAmB,AACnB,SAAU,AACV,QAAS,AACT,SAAU,AACV,WAAY,CACb,AAED,qDACE,qBAAsB,AACtB,iBAAkB,CACnB,AAED,uBACE,eAAgB,AAChB,gBAAiB,CAClB,AAED,gEACE,WAAY,AACZ,yBAA0B,AAC1B,qBAAsB,AACtB,sCAAuC,AAC/B,6BAA8B,CACvC,AAED,iEACE,cAAe,AACf,mBAAoB,AACpB,sBAAuB,AACvB,yBAA0B,AAC1B,qBAAsB,AACtB,wBAAyB,AACjB,eAAgB,CACzB,AAED,8DACE,oBAAqB,CACtB,AAED,iEACE,8BAA+B,AAC/B,0BAA2B,AAC3B,kCAAoC,AAC5B,yBAA2B,CACpC,AAED,gEACE,yBAA0B,CAC3B,AAED,8BACE,cAAe,AACf,sBAAuB,AACvB,gBAAiB,AACjB,yBAA0B,AAC1B,cAAe,AACf,cAAe,AACf,wBAAyB,AACzB,kBAAmB,AACnB,8BAA+B,AACvB,sBAAuB,AAC/B,UAAW,AACX,SAAU,AACV,eAAgB,AAChB,0DAA8D,AAC9D,qDAAyD,AACzD,kDAAsD,AACtD,kBAAmB,AACnB,eAAgB,AAChB,eAAgB,CACjB,AAED,oCACE,aAAc,CACf,AAED,mDACE,cAAe,CAChB,AAED,wDACE,eAAgB,CACjB,AAED,iCACE,UAAW,AACX,UAAW,AACX,kBAAmB,AACnB,SAAU,AACV,kBAAmB,AACnB,WAAY,CACb,AAED,4DACE,kBAAmB,AACnB,eAAgB,AAChB,eAAgB,CACjB,AAED,4DACE,gBAAiB,AACjB,eAAgB,AAChB,eAAgB,CACjB,AAED,2DACE,YAAa,AACb,eAAgB,AAChB,eAAgB,CACjB",file:"checkbox.css",sourcesContent:['@charset "UTF-8";\n.ishow-checkbox, .ishow-checkbox__input {\n cursor: pointer;\n display: inline-block;\n position: relative\n}\n\n.ishow-checkbox, .ishow-checkbox-button__inner {\n white-space: nowrap;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none\n}\n\n.ishow-checkbox {\n color: #1f2d3d;\n}\n\n.ishow-checkbox+.ishow-checkbox {\n margin-left: 15px\n}\n\n.ishow-checkbox__input {\n white-space: nowrap;\n outline: 0;\n line-height: 1;\n vertical-align: middle\n}\n\n.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner {\n background-color: #20a0ff;\n border-color: #0190fe\n}\n\n.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner::before {\n content: \'\';\n position: absolute;\n display: block;\n border: 1px solid #fff;\n margin-top: -1px;\n left: 3px;\n right: 3px;\n top: 50%\n}\n\n.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner::after {\n display: none\n}\n\n.ishow-checkbox__input.is-focus .ishow-checkbox__inner {\n border-color: #20a0ff\n}\n\n.ishow-checkbox__input.is-checked .ishow-checkbox__inner {\n background-color: #20a0ff;\n border-color: #0190fe\n}\n\n.ishow-checkbox__input.is-checked .ishow-checkbox__inner::after {\n -ms-transform: rotate(45deg) scaleY(1);\n -webkit-transform: rotate(45deg) scaleY(1);\n transform: rotate(45deg) scaleY(1)\n}\n\n.ishow-checkbox__input.is-disabled .ishow-checkbox__inner {\n background-color: #eef1f6;\n border-color: #d1dbe5;\n cursor: not-allowed\n}\n\n.ishow-checkbox__input.is-disabled .ishow-checkbox__inner::after {\n cursor: not-allowed;\n border-color: #eef1f6\n}\n\n.ishow-checkbox__input.is-disabled .ishow-checkbox__inner+.ishow-checkbox__label {\n cursor: not-allowed\n}\n\n.ishow-checkbox__input.is-disabled.is-checked .ishow-checkbox__inner {\n background-color: #d1dbe5;\n border-color: #d1dbe5\n}\n\n.ishow-checkbox__input.is-disabled.is-checked .ishow-checkbox__inner::after {\n border-color: #fff\n}\n\n.ishow-checkbox__input.is-disabled.is-indeterminate .ishow-checkbox__inner {\n background-color: #d1dbe5;\n border-color: #d1dbe5\n}\n\n.ishow-checkbox__input.is-disabled.is-indeterminate .ishow-checkbox__inner::before {\n border-color: #fff\n}\n\n.ishow-checkbox__input.is-disabled+.ishow-checkbox__label {\n color: #bbb;\n cursor: not-allowed\n}\n\n.ishow-checkbox__inner {\n display: inline-block;\n position: relative;\n border: 1px solid #bfcbd9;\n border-radius: 4px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n width: 18px;\n height: 18px;\n background-color: #fff;\n z-index: 1;\n -webkit-transition: border-color .25s cubic-bezier(.71, -.46, .29, 1.46), background-color .25s cubic-bezier(.71, -.46, .29, 1.46);\n -o-transition: border-color .25s cubic-bezier(.71, -.46, .29, 1.46), background-color .25s cubic-bezier(.71, -.46, .29, 1.46);\n transition: border-color .25s cubic-bezier(.71, -.46, .29, 1.46), background-color .25s cubic-bezier(.71, -.46, .29, 1.46)\n}\n\n.ishow-checkbox__inner:hover {\n border-color: #20a0ff\n}\n\n.ishow-checkbox__inner::after {\n -webkit-box-sizing: content-box;\n box-sizing: content-box;\n content: "";\n border: 2px solid #fff;\n border-left: 0;\n border-top: 0;\n height: 8px;\n left: 5px;\n position: absolute;\n top: 1px;\n -ms-transform: rotate(45deg) scaleY(0);\n -webkit-transform: rotate(45deg) scaleY(0);\n transform: rotate(45deg) scaleY(0);\n width: 4px;\n -webkit-transition: -webkit-transform .15s cubic-bezier(.71, -.46, .88, .6) .05s;\n transition: -webkit-transform .15s cubic-bezier(.71, -.46, .88, .6) .05s;\n -o-transition: transform .15s cubic-bezier(.71, -.46, .88, .6) .05s;\n transition: transform .15s cubic-bezier(.71, -.46, .88, .6) .05s;\n transition: transform .15s cubic-bezier(.71, -.46, .88, .6) .05s, -webkit-transform .15s cubic-bezier(.71, -.46, .88, .6) .05s;\n -ms-transform-origin: center;\n -webkit-transform-origin: center;\n transform-origin: center\n}\n\n.ishow-checkbox__original {\n opacity: 0;\n outline: 0;\n position: absolute;\n margin: 0;\n width: 0;\n height: 0;\n left: -999px\n}\n\n.ishow-checkbox-button, .ishow-checkbox-button__inner {\n display: inline-block;\n position: relative\n}\n\n.ishow-checkbox__label {\n font-size: 14px;\n padding-left: 5px\n}\n\n.ishow-checkbox-button.is-checked .ishow-checkbox-button__inner {\n color: #fff;\n background-color: #20a0ff;\n border-color: #20a0ff;\n -webkit-box-shadow: -1px 0 0 0 #20a0ff;\n box-shadow: -1px 0 0 0 #20a0ff\n}\n\n.ishow-checkbox-button.is-disabled .ishow-checkbox-button__inner {\n color: #bfcbd9;\n cursor: not-allowed;\n background-image: none;\n background-color: #eef1f6;\n border-color: #d1dbe5;\n -webkit-box-shadow: none;\n box-shadow: none\n}\n\n.ishow-checkbox-button.is-focus .ishow-checkbox-button__inner {\n border-color: #20a0ff\n}\n\n.ishow-checkbox-button:first-child .ishow-checkbox-button__inner {\n border-left: 1px solid #bfcbd9;\n border-radius: 4px 0 0 4px;\n -webkit-box-shadow: none !important;\n box-shadow: none !important\n}\n\n.ishow-checkbox-button:last-child .ishow-checkbox-button__inner {\n border-radius: 0 4px 4px 0\n}\n\n.ishow-checkbox-button__inner {\n line-height: 1;\n vertical-align: middle;\n background: #fff;\n border: 1px solid #bfcbd9;\n border-left: 0;\n color: #1f2d3d;\n -webkit-appearance: none;\n text-align: center;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n outline: 0;\n margin: 0;\n cursor: pointer;\n -webkit-transition: all .3s cubic-bezier(.645, .045, .355, 1);\n -o-transition: all .3s cubic-bezier(.645, .045, .355, 1);\n transition: all .3s cubic-bezier(.645, .045, .355, 1);\n padding: 10px 15px;\n font-size: 14px;\n border-radius: 0\n}\n\n.ishow-checkbox-button__inner:hover {\n color: #20a0ff\n}\n\n.ishow-checkbox-button__inner [class*=ishow-icon-] {\n line-height: .9\n}\n\n.ishow-checkbox-button__inner [class*=ishow-icon-]+span {\n margin-left: 5px\n}\n\n.ishow-checkbox-button__original {\n opacity: 0;\n outline: 0;\n position: absolute;\n margin: 0;\n visibility: hidden;\n left: -999px\n}\n\n.ishow-checkbox-button--large .ishow-checkbox-button__inner {\n padding: 11px 19px;\n font-size: 16px;\n border-radius: 0\n}\n\n.ishow-checkbox-button--small .ishow-checkbox-button__inner {\n padding: 7px 9px;\n font-size: 12px;\n border-radius: 0\n}\n\n.ishow-checkbox-button--mini .ishow-checkbox-button__inner {\n padding: 4px;\n font-size: 12px;\n border-radius: 0\n}\n'],sourceRoot:""}])},322:function(n,e,t){"use strict";function o(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function i(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function r(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}function a(){var n=document.createElement("div");return n.className="ishow-table-poper",n.style.zIndex=999,document.body.appendChild(n),n}function s(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function l(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function c(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}function p(n){if(Array.isArray(n)){for(var e=0,t=Array(n.length);e<n.length;e++)t[e]=n[e];return t}return Array.from(n)}function d(){if(void 0!==cn)return cn;var n=ln.createElement("div"),e=ln.body||n;n.style.visibility="hidden",n.style.width="100px",n.style.position="absolute",n.style.top="-9999px",n.style.overflow="scroll",e.appendChild(n);var t=n.offsetWidth,o=n.clientWidth;return e.removeChild(n),t-o}function u(n,e){return"string"!==typeof e?null:e.split(".").reduce(function(n,e){return(n||{})[e]},n)}function h(n,e){return"string"===typeof e?u(n,e):"function"===typeof e?e(n):void 0}function A(n){var e=[];return n.forEach(function(n){n.subColumns?e.push.apply(e,p(A(n.subColumns))):e.push(n)}),e}function m(n){return L.Children.map(n,function(n){if("TableColumn"!==n.type.typeName)return console.warn("Table component's children must be TableColumn, but received "+n.type),{};var e=Object.assign({},n.props);return e.children&&(e.subColumns=m(e.children),delete e.children),e})}function f(n){return n.children?m(n.children):n.columns||[]}function b(n){function e(n,o){if(o?(n.level=o.level+1,t<n.level&&(t=n.level)):n.level=1,n.subColumns){var i=0;n.subColumns.forEach(function(t){e(t,n),i+=t.colSpan}),n.colSpan=i}else n.colSpan=1}var t=1;n.forEach(function(n){e(n)});for(var o=[],i=0;i<t;i++)o.push([]);for(var r=[],a=n.slice(),s=0;a[s];s++)r.push(a[s]),a[s].subColumns&&a.push.apply(a,p(a[s].subColumns));return r.forEach(function(n){n.subColumns?n.rowSpan=1:n.rowSpan=t-n.level+1,o[n.level-1].push(n)}),o}function g(n,e){var t={};for(var o in n)e.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}function C(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function w(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function v(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}function y(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function B(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function x(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}function k(n,e){var t={};for(var o in n)e.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}function _(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function E(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function I(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}function D(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function S(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function z(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}function T(n,e){return u(n,e.property)}function M(n,e){return n.map(function(n){var t=void 0;if(n.subColumns)t=Object.assign({},n),t.subColumns=M(n.subColumns,e);else{var o=n.width,i=n.minWidth;void 0!==o&&(o=parseInt(o,10),isNaN(o)&&(o=null)),void 0!==i?(i=parseInt(i,10),isNaN(i)&&(i=80)):i=80;var r="ishow-table_"+e+"_column_"+xn++;t=Object.assign({id:r,sortable:!1,resizable:!0,showOverflowTooltip:!1,align:"left",filterMultiple:!0},n,{columnKey:n.columnKey||r,width:o,minWidth:i,realWidth:o||i,property:n.prop||n.property,render:n.render||T,align:n.align?"is-"+n.align:null,headerAlign:n.headerAlign?"is-"+n.headerAlign:n.align?"is-"+n.align:null,filterable:n.filters&&n.filterMethod,filterOpened:!1,filteredValue:n.filteredValue||null,filterPlacement:n.filterPlacement||"bottom"},yn[n.type||"default"],Bn[n.type])}return t})}function P(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function N(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function O(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function R(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}function F(n,e){return e.reduce(function(n,e){var t=e.filterable,o=e.filterMultiple,i=e.filteredValue,r=e.filterMethod;if(t){if(o&&Array.isArray(i)&&i.length)return n.filter(function(n){return i.some(function(e){return r(e,n)})});if(i)return n.filter(function(n){return r(i,n)})}return n},n)}var L=t(0),j=t(1),W=t.n(j),Y=t(50),U=t(202),q=t(233),H=t.n(q),X=t(278),Q=t(228),V=t(8),G=t.n(V),K=t(198),Z=t(253),J=t.n(Z),$=t(266),nn=(t(270),function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}());Q.a.Group=$.a;var en=function(n){function e(n){o(this,e);var t=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,n));return t.container=a(),["handleClickOutside","onEnter","onAfterLeave"].forEach(function(n){t[n]=t[n].bind(t)}),t.state={filteredValue:n.filteredValue},t}return r(e,n),nn(e,[{key:"componentDidMount",value:function(){this.renderPortal(this.renderContent(),this.container),document.addEventListener("click",this.handleClickOutside)}},{key:"componentWillReceiveProps",value:function(n){this.props.filteredValue!==n.filteredValue&&this.setState({filteredValue:n.filteredValue})}},{key:"componentDidUpdate",value:function(){this.renderPortal(this.renderContent(),this.container)}},{key:"componentWillUnmount",value:function(){void 0!==this.poperIns&&this.poperIns.destroy(),G.a.unmountComponentAtNode(this.container),document.removeEventListener("click",this.handleClickOutside),document.body.removeChild(this.container)}},{key:"handleFiltersChange",value:function(n){this.setState({filteredValue:n})}},{key:"changeFilteredValue",value:function(n){this.props.onFilterChange(n),this.props.toggleFilter()}},{key:"handleClickOutside",value:function(){this.props.visible&&this.props.toggleFilter()}},{key:"onEnter",value:function(){this.poperIns=new J.a(this.refer,this.container,{placement:this.props.placement})}},{key:"onAfterLeave",value:function(){this.poperIns.destroy()}},{key:"renderPortal",value:function(n,e){G.a.unstable_renderSubtreeIntoContainer(this,n,e)}},{key:"renderContent",value:function(){var n=this,e=this.props,t=e.multiple,o=e.filters,i=e.visible,r=this.state.filteredValue,a=void 0;return a=t?[L.createElement("div",{className:"ishow-table-filter__content",key:"content"},L.createElement(Q.a.Group,{value:r||[],onChange:this.handleFiltersChange.bind(this),className:"ishow-table-filter__checkbox-group"},o&&o.map(function(n){return L.createElement(Q.a,{value:n.value,label:n.text,key:n.value})}))),L.createElement("div",{className:"ishow-table-filter__bottom",key:"bottom"},L.createElement("button",{className:this.classNames({"is-disabled":!r||!r.length}),disabled:!r||!r.length,onClick:this.changeFilteredValue.bind(this,r)},U.a.t("ishow.table.confirmFilter")),L.createElement("button",{onClick:this.changeFilteredValue.bind(this,null)},U.a.t("ishow.table.resetFilter")))]:L.createElement("ul",{className:"ishow-table-filter__list"},L.createElement("li",{className:this.classNames("ishow-table-filter__list-item",{"is-active":!r}),onClick:this.changeFilteredValue.bind(this,null)},U.a.t("ishow.table.clearFilter")),o&&o.map(function(e){return L.createElement("li",{key:e.value,className:n.classNames("ishow-table-filter__list-item",{"is-active":e.value===r}),onClick:n.changeFilteredValue.bind(n,e.value)},e.text)})),L.createElement(K.a,{name:"ishow-zoom-in-top",onEnter:this.onEnter,onAfterLeave:this.onAfterLeave},L.createElement(Y.a,{show:i},L.createElement("div",{className:"ishow-table-filter",ref:function(e){n.poper=e},onClick:function(n){n.nativeEvent.stopImmediatePropagation()}},a)))}},{key:"render",value:function(){var n=this;return L.cloneElement(this.props.children,{ref:function(e){n.refer=e}})}}]),e}(Y.b),tn=en,on=function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}(),rn=document,an=function(n){function e(n){s(this,e);var t=l(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,n));return["handleHeaderClick","handleFilterClick","handleSortClick"].forEach(function(n){t[n]=H()(300,!0,t[n])}),t}return c(e,n),on(e,[{key:"handleMouseMove",value:function(n,e){if(n.resizable&&(!n.subColumns||!n.subColumns.length)&&!this.dragging&&this.props.border){for(var t=e.target;t&&"TH"!==t.tagName;)t=t.parentNode;var o=t.getBoundingClientRect(),i=rn.body.style;o.width>12&&o.right-e.pageX<8?(i.cursor="col-resize",this.draggingColumn=n):(i.cursor="",this.draggingColumn=null)}}},{key:"handleMouseDown",value:function(n,e){var t=this;if(this.draggingColumn){this.dragging=!0;for(var o=this.context.table,i=o.el,r=o.resizeProxy,a=i.getBoundingClientRect().left,s=e.target;s&&"TH"!==s.tagName;)s=s.parentNode;var l=s.getBoundingClientRect(),c=l.left-a+30;s.classList.add("noclick");var p=e.clientX,d=l.right-a,u=l.left-a;r.style.visibility="visible",r.style.left=d+"px",rn.onselectstart=function(){return!1},rn.ondragstart=function(){return!1};var h=function(n){var e=n.clientX-p,t=d+e;r.style.left=Math.max(c,t)+"px"},A=function e(o){if(t.dragging){var i=parseInt(r.style.left,10),a=i-u,l=n.realWidth;n.width=n.realWidth=a,t.dragging=!1,t.draggingColumn=null,rn.body.style.cursor="",r.style.visibility="hidden",rn.removeEventListener("mousemove",h),rn.removeEventListener("mouseup",e),rn.onselectstart=null,rn.ondragstart=null,setTimeout(function(){s.classList.remove("noclick")}),t.context.layout.scheduleLayout(),t.dispatchEvent("onHeaderDragEnd",a,l,n,o)}};rn.addEventListener("mousemove",h),rn.addEventListener("mouseup",A)}}},{key:"handleHeaderClick",value:function(n,e){n.sortable&&!n.filters?this.handleSortClick(n,null,e):n.filters&&!n.sortable?this.handleFilterClick(n,e):this.dispatchEvent("onHeaderClick",n,e)}},{key:"handleSortClick",value:function(n,e,t){t.stopPropagation(),t.nativeEvent.stopImmediatePropagation();for(var o=t.target;o&&"TH"!==o.tagName;)o=o.parentNode;if(!o.classList.contains("noclick")){var i=void 0;if(e)i=e;else{var r=this.props.store,a=r.sortColumn,s=r.sortOrder;i=n===a&&s?"ascending"===s?"descending":null:"ascending"}this.context.store.changeSortCondition(n,i),this.dispatchEvent("onHeaderClick",n,t)}}},{key:"handleFilterClick",value:function(n,e){e&&(e.stopPropagation(),e.nativeEvent.stopImmediatePropagation()),this.context.store.toggleFilterOpened(n),e&&this.dispatchEvent("onHeaderClick",n,e)}},{key:"dispatchEvent",value:function(n){for(var e=this.props[n],t=arguments.length,o=Array(t>1?t-1:0),i=1;i<t;i++)o[i-1]=arguments[i];e&&e.apply(void 0,o)}},{key:"changeFilteredValue",value:function(n,e){this.context.store.changeFilteredValue(n,e)}},{key:"isCellHidden",value:function(n,e){var t=this.props.fixed;if(!0===t||"left"===t)return n>=this.leftFixedCount;if("right"===t){for(var o=0,i=0;i<n;i++)o+=e[i].colSpan;return o<this.columnsCount-this.rightFixedCount}return n<this.leftFixedCount||n>=this.columnsCount-this.rightFixedCount}},{key:"renderHeader",value:function(n){var e=n.type;return"expand"===e?n.label||"":"index"===e?n.label||"#":"selection"===e?L.createElement(Q.a,{checked:this.context.store.isAllSelected,onChange:this.context.store.toggleAllSelection}):n.renderHeader?n.renderHeader(n):n.label}},{key:"renderTitle",value:function(n){if("[object String]"===Object.prototype.toString.call(n.label))return n.label}},{key:"render",value:function(){var n=this,e=this.props,t=e.store,o=e.layout,i=e.fixed;return L.createElement("table",{className:"ishow-table__header",cellPadding:0,cellSpacing:0,style:this.style({borderSpacing:0,border:0})},L.createElement("colgroup",null,t.columns.map(function(n,e){return L.createElement("col",{style:{width:n.realWidth},key:e})}),!i&&L.createElement("col",{style:{width:o.scrollY?o.gutterWidth:0}})),L.createElement("thead",null,t.columnRows.map(function(e,r){return L.createElement("tr",{key:r},e.map(function(o,i){return L.createElement("th",{colSpan:o.colSpan,rowSpan:o.rowSpan,className:n.className(t.sortColumn===o&&t.sortOrder,o.headerAlign,o.className,o.labelClassName,o.columnKey,{"is-hidden":0===r&&n.isCellHidden(i,e),"is-leaf":!o.subColumns,"is-sortable":o.sortable}),onMouseMove:n.handleMouseMove.bind(n,o),onMouseDown:n.handleMouseDown.bind(n,o),onClick:n.handleHeaderClick.bind(n,o),key:i,title:n.renderTitle(o)},L.createElement("div",{className:"cell"},n.renderHeader(o),o.sortable&&L.createElement("span",{className:"caret-wrapper",onClick:n.handleSortClick.bind(n,o,null)},L.createElement("i",{className:"sort-caret ascending",onClick:n.handleSortClick.bind(n,o,"ascending")}),L.createElement("i",{className:"sort-caret descending",onClick:n.handleSortClick.bind(n,o,"descending")})),o.filterable&&L.createElement(tn,{visible:o.filterOpened,multiple:o.filterMultiple,filters:o.filters,filteredValue:o.filteredValue,placement:o.filterPlacement,onFilterChange:n.changeFilteredValue.bind(n,o),toggleFilter:n.handleFilterClick.bind(n,o)},L.createElement("span",{className:"ishow-table__column-filter-trigger",onClick:n.handleFilterClick.bind(n,o)},L.createElement("i",{className:n.classNames("ishow-icon-arrow-down",{"ishow-icon-arrow-up":o.filterOpened})})))))}),!i&&L.createElement("th",{className:"gutter",style:{width:o.scrollY?o.gutterWidth:0}}))})))}},{key:"columnsCount",get:function(){return this.props.store.columns.length}},{key:"leftFixedCount",get:function(){return this.props.store.fixedColumns.length}},{key:"rightFixedCount",get:function(){return this.props.store.rightFixedColumns.length}}]),e}(Y.b);an.contextTypes={store:W.a.any,layout:W.a.any,table:W.a.any};var sn=an,ln=document,cn=void 0,pn=function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}(),dn=function(n){function e(n){C(this,e);var t=w(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,n));return["handleMouseLeave"].forEach(function(n){t[n]=t[n].bind(t)}),t}return v(e,n),pn(e,[{key:"handleMouseEnter",value:function(n){this.context.store.setHoverRow(n)}},{key:"handleMouseLeave",value:function(){this.context.store.setHoverRow(null)}},{key:"handleCellMouseEnter",value:function(n,e,t){this.dispatchEvent("onCellMouseEnter",n,e,t.currentTarget,t)}},{key:"handleCellMouseLeave",value:function(n,e,t){this.dispatchEvent("onCellMouseLeave",n,e,t.currentTarget,t)}},{key:"handleCellClick",value:function(n,e,t){this.dispatchEvent("onCellClick",n,e,t.currentTarget,t),this.dispatchEvent("onRowClick",n,t,e)}},{key:"handleCellDbClick",value:function(n,e,t){this.dispatchEvent("onCellDbClick",n,e,t.currentTarget,t),this.dispatchEvent("onRowDbClick",n,e)}},{key:"handleRowContextMenu",value:function(n,e){this.dispatchEvent("onRowContextMenu",n,e)}},{key:"dispatchEvent",value:function(n){for(var e=this.props[n],t=arguments.length,o=Array(t>1?t-1:0),i=1;i<t;i++)o[i-1]=arguments[i];e&&e.apply(void 0,o)}},{key:"isColumnHidden",value:function(n){var e=this.props,t=(e.store,e.layout,g(e,["store","layout"]));return!0===t.fixed||"left"===t.fixed?n>=this.leftFixedCount:"right"===t.fixed?n<this.columnsCount-this.rightFixedCount:n<this.leftFixedCount||n>=this.columnsCount-this.rightFixedCount}},{key:"getRowStyle",value:function(n,e){var t=this.props.rowStyle;return"function"===typeof t?t.call(null,n,e):t}},{key:"getKeyOfRow",value:function(n,e){var t=this.props.rowKey;return t?h(n,t):e}},{key:"handleExpandClick",value:function(n,e){this.context.store.toggleRowExpanded(n,e)}},{key:"handleClick",value:function(n){this.context.store.setCurrentRow(n)}},{key:"renderCell",value:function(n,e,t,o){var i=this,r=e.type,a=e.selectable;if("expand"===r)return L.createElement("div",{className:this.classNames("ishow-table__expand-icon ",{"ishow-table__expand-icon--expanded":this.context.store.isRowExpanding(n,o)}),onClick:this.handleExpandClick.bind(this,n,o)},L.createElement("i",{className:"ishow-icon ishow-icon-arrow-right"}));if("index"===r)return L.createElement("div",null,t+1);if("selection"===r){var s=this.context.store.isRowSelected(n,o);return L.createElement(Q.a,{checked:s,disabled:a&&!a(n,t),onChange:function(){i.context.store.toggleRowSelection(n,!s)}})}return e.render(n,e,t)}},{key:"renderTitle",value:function(n){if(n&&n.props&&n.props.dangerouslySetInnerHTML&&n.props.dangerouslySetInnerHTML.__html)return n.props.dangerouslySetInnerHTML.__html;if(n&&n.props&&n.props.children){if("[object String]"===Object.prototype.toString.call(n.props.children))return n.type&&"Button"===n.type.name?void 0:n.props.children}else if("[object Array]"!==Object.prototype.toString.call(n)&&"[object Object]"!==Object.prototype.toString.call(n))return n}},{key:"render",value:function(){var n=this,e=this.props,t=e.store,o=e.layout,i=g(e,["store","layout"]),r=t.columns.map(function(e,t){return n.isColumnHidden(t)});return L.createElement("table",{className:"ishow-table__body",cellPadding:0,cellSpacing:0,style:this.style({borderSpacing:0,border:0})},L.createElement("colgroup",null,t.columns.map(function(n,e){return L.createElement("col",{style:{width:n.realWidth},key:e})})),L.createElement("tbody",null,t.data.map(function(e,a){var s=n.getKeyOfRow(e,a);return[L.createElement("tr",{key:s,style:n.getRowStyle(e,a),className:n.className("ishow-table__row",{"ishow-table__row--striped":i.stripe&&a%2===1,"hover-row":t.hoverRow===a,"current-row":i.highlightCurrentRow&&(i.currentRowKey===s||t.currentRow===e)},"string"===typeof i.rowClassName?i.rowClassName:"function"===typeof i.rowClassName&&i.rowClassName(e,a)),onMouseEnter:n.handleMouseEnter.bind(n,a),onMouseLeave:n.handleMouseLeave,onClick:n.handleClick.bind(n,e),onContextMenu:n.handleRowContextMenu.bind(n,e)},t.columns.map(function(t,o){return L.createElement("td",{key:o,className:n.classNames(t.className,t.align,t.columnKey,{"is-hidden":r[o]}),onMouseEnter:n.handleCellMouseEnter.bind(n,e,t),onMouseLeave:n.handleCellMouseLeave.bind(n,e,t),onClick:n.handleCellClick.bind(n,e,t),onDoubleClick:n.handleCellDbClick.bind(n,e,t)},L.createElement("div",{className:"cell",title:n.renderTitle(n.renderCell(e,t,a,s))},n.renderCell(e,t,a,s)))}),!i.fixed&&o.scrollY&&!!o.gutterWidth&&L.createElement("td",{className:"gutter"})),n.context.store.isRowExpanding(e,s)&&L.createElement("tr",{key:s+"Expanded"},L.createElement("td",{colSpan:t.columns.length,className:"ishow-table__expanded-cell"},"function"===typeof i.renderExpanded&&i.renderExpanded(e,a)))]})))}},{key:"columnsCount",get:function(){return this.props.store.columns.length}},{key:"leftFixedCount",get:function(){return this.props.store.fixedColumns.length}},{key:"rightFixedCount",get:function(){return this.props.store.rightFixedColumns.length}}]),e}(Y.b);dn.contextTypes={store:W.a.any,layout:W.a.any};var un=dn,hn=function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}(),An=function(n){function e(){return y(this,e),B(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return x(e,n),hn(e,[{key:"isCellHidden",value:function(n,e){var t=this.props.fixed;if(!0===t||"left"===t)return n>=this.leftFixedCount;if("right"===t){for(var o=0,i=0;i<n;i++)o+=e[i].colSpan;return o<this.columnsCount-this.rightFixedCount}return n<this.leftFixedCount||n>=this.columnsCount-this.rightFixedCount}},{key:"render",value:function(){var n=this,e=this.props,t=e.store,o=e.layout,i=e.fixed,r=e.summaryMethod,a=e.sumText,s=r?r(t.columns,t.data):t.columns.map(function(n,e){if(0===e)return a;var o=t.data.reduce(function(e,t){return e+parseFloat(u(t,n.property))},0);return isNaN(o)?"":o});return L.createElement("table",{className:"ishow-table__footer",cellSpacing:"0",cellPadding:"0",style:this.style({borderSpacing:0,border:0})},L.createElement("colgroup",null,t.columns.map(function(n,e){return L.createElement("col",{style:{width:n.realWidth},key:e})}),!i&&L.createElement("col",{style:{width:o.scrollY?o.gutterWidth:0}})),L.createElement("tbody",null,L.createElement("tr",null,t.columns.map(function(e,o){return L.createElement("td",{key:o,colSpan:e.colSpan,rowSpan:e.rowSpan,className:n.className(e.headerAlign,e.className,e.labelClassName,e.columnKey,{"is-hidden":n.isCellHidden(o,t.columns),"is-leaf":!e.subColumns})},L.createElement("div",{className:"cell"},s[o]))}),!i&&L.createElement("td",{className:"gutter",style:{width:o.scrollY?o.gutterWidth:0}}))))}},{key:"columnsCount",get:function(){return this.props.store.columns.length}},{key:"leftFixedCount",get:function(){return this.props.store.fixedColumns.length}},{key:"rightFixedCount",get:function(){return this.props.store.rightFixedColumns.length}}]),e}(Y.b),mn=An,fn=(t(271),function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}()),bn=function(n){function e(n){_(this,e);var t=E(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,n));return t.state={},["syncScroll"].forEach(function(n){t[n]=t[n].bind(t)}),t}return I(e,n),fn(e,[{key:"getChildContext",value:function(){return{table:this}}},{key:"syncScroll",value:function(){var n=this.headerWrapper,e=this.footerWrapper,t=this.bodyWrapper,o=this.fixedBodyWrapper,i=this.rightFixedBodyWrapper;n&&(n.scrollLeft=t.scrollLeft),e&&(e.scrollLeft=t.scrollLeft),o&&(o.scrollTop=t.scrollTop),i&&(i.scrollTop=t.scrollTop)}},{key:"bindRef",value:function(n){var e=this;return function(t){e[n]=t}}},{key:"render",value:function(){var n=this.props,e=n.store,t=n.layout,o=(n.loading,k(n,["store","layout","loading"])),i=this.state.isHidden;return L.createElement("div",{style:this.style({height:o.height,maxHeight:o.maxHeight}),className:this.className("ishow-table",{"ishow-table--fit":o.fit,"ishow-table--striped":o.stripe,"ishow-table--border":o.border,"ishow-table--hidden":i,"ishow-table--fluid-height":o.maxHeight,"ishow-table--enable-row-hover":!e.isComplex,"ishow-table--enable-row-transition":(e.data||[]).length&&(e.data||[]).length<100}),ref:this.bindRef("el")},o.showHeader&&L.createElement("div",{className:"ishow-table__header-wrapper",ref:this.bindRef("headerWrapper")},L.createElement(sn,Object.assign({},this.props,{style:{width:"100%",height:"100%"}}))),L.createElement("div",{style:this.bodyWrapperHeight,className:"ishow-table__body-wrapper",ref:this.bindRef("bodyWrapper"),onScroll:this.syncScroll},L.createElement(un,Object.assign({},this.props,{style:{width:"100%",height:"100%"}})),(!o.data||!o.data.length)&&L.createElement("div",{style:{width:this.bodyWidth},className:"ishow-table__empty-block"},L.createElement("span",{className:"ishow-table__empty-text"},o.emptyText?o.emptyText:U.a.t("ishow.table.emptyText")))),o.showSummary&&L.createElement("div",{style:{visibility:o.data&&o.data.length?"visible":"hidden"},className:"ishow-table__footer-wrapper",ref:this.bindRef("footerWrapper")},L.createElement(mn,Object.assign({},this.props,{style:{width:t.bodyWidth||""}}))),!!e.fixedColumns.length&&L.createElement("div",{style:Object.assign({},this.fixedHeight,{width:t.fixedWidth||""}),className:"ishow-table__fixed",ref:this.bindRef("fixedWrapper")},o.showHeader&&L.createElement("div",{className:"ishow-table__fixed-header-wrapper",ref:this.bindRef("fixedHeaderWrapper")},L.createElement(sn,Object.assign({fixed:"left"},this.props,{style:{width:t.fixedWidth||"",height:"100%"}}))),L.createElement("div",{style:Object.assign({},this.fixedBodyHeight,{top:t.headerHeight||0}),className:"ishow-table__fixed-body-wrapper",ref:this.bindRef("fixedBodyWrapper")},L.createElement(un,Object.assign({fixed:"left"},this.props,{style:{width:t.fixedWidth||"",height:"100%"}}))),o.showSummary&&L.createElement("div",{className:"ishow-table__fixed-footer-wrapper",ref:this.bindRef("fixedFooterWrapper")},L.createElement(mn,Object.assign({fixed:"left"},this.props,{style:{width:t.fixedWidth||""}})))),!!e.rightFixedColumns.length&&L.createElement("div",{className:"ishow-table__fixed-right",ref:this.bindRef("rightFixedWrapper"),style:Object.assign({},{width:t.rightFixedWidth||"",right:t.scrollY?o.border?t.gutterWidth:t.gutterWidth||1:""},this.fixedHeight)},o.showHeader&&L.createElement("div",{className:"ishow-table__fixed-header-wrapper",ref:this.bindRef("rightFixedHeaderWrapper")},L.createElement(sn,Object.assign({fixed:"right"},this.props,{style:{width:t.rightFixedWidth||""}}))),L.createElement("div",{className:"ishow-table__fixed-body-wrapper",ref:this.bindRef("rightFixedBodyWrapper"),style:Object.assign({},{top:t.headerHeight},this.fixedBodyHeight)},L.createElement(un,Object.assign({fixed:"right"},this.props,{style:{width:t.rightFixedWidth||"",height:"100%"}}))),o.showSummary&&L.createElement("div",{className:"ishow-table__fixed-footer-wrapper",ref:this.bindRef("rightFixedFooterWrapper"),style:{visibility:o.data&&o.data.length?"visible":"hidden"}},L.createElement(mn,Object.assign({fixed:"right"},this.props,{style:{width:t.rightFixedWidth||""}})))),!!e.rightFixedColumns.length&&L.createElement("div",{className:"ishow-table__fixed-right-patch",style:{width:t.scrollY?t.gutterWidth:"0",height:t.headerHeight}}),L.createElement("div",{className:"ishow-table__column-resize-proxy",ref:this.bindRef("resizeProxy"),style:{visibility:"hidden"}}))}},{key:"bodyWrapperHeight",get:function(){var n=this.props,e=n.layout,t=n.height,o=n.maxHeight,i={};return t?i.height=e.bodyHeight||"":o&&null!==e.headerHeight&&(i.maxHeight=o-e.headerHeight-e.footerHeight),i}},{key:"bodyWidth",get:function(){var n=this.props.layout,e=n.bodyWidth,t=n.scrollY,o=n.gutterWidth;return e?e-(t?o:0):""}},{key:"fixedHeight",get:function(){var n=this.props.layout;return{bottom:n.scrollX?n.gutterWidth-1:0}}},{key:"fixedBodyHeight",get:function(){var n=this.props,e=n.layout,t=k(n,["layout"]),o={};return t.height?o.height=e.fixedBodyHeight||"":t.maxHeight&&null!==e.headerHeight&&(o.maxHeight=t.maxHeight-e.headerHeight-e.footerHeight-(e.scrollX?e.gutterWidth:0)),o}}]),e}(Y.b);bn.contextTypes={store:W.a.any,layout:W.a.any},bn.childContextTypes={table:W.a.any};var gn=bn,Cn=function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}(),wn=function(n){function e(n){D(this,e);var t=S(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,n));return t.state={height:n.height||n.maxHeight||null,gutterWidth:d(),tableHeight:null,headerHeight:null,bodyHeight:null,footerHeight:null,fixedBodyHeight:null,viewportHeight:null,scrollX:null,scrollY:null},t.resizeListener=H()(50,function(){t.scheduleLayout()}),t}return z(e,n),Cn(e,[{key:"componentDidMount",value:function(){this.el=this.table.el,this.scheduleLayout(),Object(X.a)(this.el,this.resizeListener)}},{key:"componentWillReceiveProps",value:function(n){var e=this.props.height||this.props.maxHeight,t=n.height||n.maxHeight;e!==t&&this.setState({height:t})}},{key:"componentDidUpdate",value:function(n){var e=this;if(this.isPropChanged("columns",n)||this.isPropChanged("style",n)||this.isPropChanged("className",n))return void this.scheduleLayout();["height","maxHeight","data","store.expandingRows","expandRowKeys","showSummary","summaryMethod","sumText"].some(function(t){return e.isPropChanged(t,n)})&&(this.updateHeight(),this.updateScrollY())}},{key:"componentWillUnmount",value:function(){Object(X.b)(this.el,this.resizeListener)}},{key:"isPropChanged",value:function(n,e){return u(this.props,n)!==u(e,n)}},{key:"getChildContext",value:function(){return{layout:this}}},{key:"scheduleLayout",value:function(){var n=this;this.setState(this.caculateWidth(),function(){n.updateHeight(),n.updateScrollY()})}},{key:"caculateWidth",value:function(){var n=this.props,e=n.store,t=e.columns,o=e.fixedColumns,i=e.rightFixedColumns,r=n.fit,a=this.state.gutterWidth,s=t.reduce(function(n,e){return n+(e.width||e.minWidth)},0),l=this.table.el.clientWidth,c=void 0,p=void 0,d=void 0,u=t.filter(function(n){return"number"!==typeof n.width});if(u.length&&r){if(s<l-a){c=!1;var h=l-a-s;if(1===u.length)u[0].realWidth=u[0].minWidth+h;else{var A=u.reduce(function(n,e){return n+e.minWidth},0),m=h/A,f=0;u.forEach(function(n,e){if(0!==e){var t=Math.floor(n.minWidth*m);f+=t,n.realWidth=n.minWidth+t}}),u[0].realWidth=u[0].minWidth+h-f}}else c=!0,u.forEach(function(n){n.realWidth=n.minWidth});l=Math.max(s,l)}else c=s>l,l=s;return o.length&&(p=o.reduce(function(n,e){return n+e.realWidth},0)),i.length&&(d=i.reduce(function(n,e){return n+e.realWidth},0)),{scrollX:c,bodyWidth:l,fixedWidth:p,rightFixedWidth:d}}},{key:"updateHeight",value:function(){var n=this;this.setState(function(e){var t=n.props.data,o=e.scrollX,i=e.gutterWidth,r=!t||!t.length,a=n.table,s=a.headerWrapper,l=a.footerWrapper,c=n.el.clientHeight,p=s?s.offsetHeight:0,d=l?l.offsetHeight:0,u=c-p-d+(l?1:0);return{tableHeight:c,headerHeight:p,bodyHeight:u,footerHeight:d,fixedBodyHeight:u-(o?i:0),viewportHeight:c-(o&&!r?i:0)}})}},{key:"updateScrollY",value:function(){var n=this;this.setState(function(e){var t=n.table.bodyWrapper,o=e.fixedBodyHeight;return{scrollY:t.querySelector(".ishow-table__body").offsetHeight>o}})}},{key:"render",value:function(){var n=this;return L.createElement(gn,Object.assign({ref:function(e){n.table=e}},this.props,{layout:this.state}))}}]),e}(Y.b);wn.childContextTypes={layout:W.a.any};var vn=wn,yn={default:{order:""},selection:{width:48,minWidth:48,realWidth:48,className:"ishow-table-column--selection"},expand:{width:48,minWidth:48,realWidth:48},index:{width:48,minWidth:48,realWidth:48}},Bn={expand:{sortable:!1,resizable:!1,className:"ishow-table__expand-column"},index:{sortable:!1},selection:{sortable:!1,resizable:!1}},xn=1,kn=function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}(),_n=1,En=function(n){function e(n){N(this,e);var t=O(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,n));return t.state={fixedColumns:null,rightFixedColumns:null,columnRows:null,columns:null,isComplex:null,expandingRows:[],hoverRow:null,rowKey:n.rowKey,defaultExpandAll:n.defaultExpandAll,currentRow:null,selectable:null,selectedRows:null,sortOrder:null,sortColumn:null},["toggleRowSelection","toggleAllSelection","clearSelection","setCurrentRow"].forEach(function(n){t[n]=t[n].bind(t)}),t._isMounted=!1,t}return R(e,n),kn(e,[{key:"getChildContext",value:function(){return{store:this}}}]),kn(e,[{key:"componentWillMount",value:function(){this.updateColumns(f(this.props)),this.updateData(this.props),this._isMounted=!0}},{key:"componentWillReceiveProps",value:function(n){var e=f(n);f(this.props)!==e&&this.updateColumns(e),this.updateData(n)}},{key:"updateColumns",value:function(n){var e=M(n,_n++),t=e.filter(function(n){return!0===n.fixed||"left"===n.fixed}),o=e.filter(function(n){return"right"===n.fixed}),i=void 0;e[0]&&"selection"===e[0].type&&(i=e[0].selectable,t.length&&!e[0].fixed&&(e[0].fixed=!0,t.unshift(e[0]))),e=[].concat(t,e.filter(function(n){return!n.fixed}),o),this.setState(Object.assign(this.state||{},{fixedColumns:t,rightFixedColumns:o,columnRows:b(e),columns:A(e),isComplex:t.length>0||o.length>0,selectable:i}))}},{key:"updateData",value:function(n){var e=n.data,t=void 0===e?[]:e,o=n.defaultExpandAll,i=n.defaultSort,r=this.state.columns,a=[];t&&(a=F(t.slice(),r));var s=this.state,l=s.hoverRow,c=s.currentRow,p=s.selectedRows,d=s.expandingRows;if(l=l&&t.includes(l)?l:null,c=c&&t.includes(c)?c:null,p=this._isMounted&&t!==this.props.data&&!r[0].reserveSelection?[]:p&&p.filter(function(n){return t.includes(n)})||[],d=this._isMounted?d.filter(function(n){return t.includes(n)}):o?t.slice():[],this.setState(Object.assign(this.state,{data:a,filteredData:a,hoverRow:l,currentRow:c,expandingRows:d,selectedRows:p})),this._isMounted&&t===this.props.data||!i)this.changeSortCondition(null,null,!1);else{var u=i.prop,h=i.order,A=void 0===h?"ascending":h,m=r.find(function(n){return n.property===u});this.changeSortCondition(m,A,!1)}}},{key:"setHoverRow",value:function(n){this.state.isComplex&&this.setState({hoverRow:n})}},{key:"toggleRowExpanded",value:function(n,e){var t=this,o=this.props.expandRowKeys,i=this.state.expandingRows;if(o){var r=o.includes(e);return void this.dispatchEvent("onExpand",n,!r)}i=i.slice();var a=i.indexOf(n);a>-1?i.splice(a,1):i.push(n),this.setState({expandingRows:i},function(){t.dispatchEvent("onExpand",n,-1===a)})}},{key:"isRowExpanding",value:function(n,e){var t=this.props.expandRowKeys,o=this.state.expandingRows;return t?t.includes(e):o.includes(n)}},{key:"setCurrentRow",value:function(){var n=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this.props,o=t.highlightCurrentRow,i=t.currentRowKey;if(o&&!i){var r=this.state.currentRow;this.setState({currentRow:e},function(){n.dispatchEvent("onCurrentChange",e,r)})}}},{key:"toggleRowSelection",value:function(n,e){var t=this,o=this.props.currentRowKey;if(!Array.isArray(o)){var i=this.state.selectedRows.slice(),r=i.indexOf(n);void 0!==e?e?-1===r&&i.push(n):-1!==r&&i.splice(r,1):-1===r?i.push(n):i.splice(r,1),this.setState({selectedRows:i},function(){t.dispatchEvent("onSelect",i,n),t.dispatchEvent("onSelectChange",i)})}}},{key:"toggleAllSelection",value:function(){var n=this,e=this.props.currentRowKey;if(!Array.isArray(e)){var t=this.state,o=t.data,i=t.selectedRows,r=t.selectable;i=this.isAllSelected?[]:r?o.filter(function(n,e){return r(n,e)}):o.slice(),this.setState({selectedRows:i},function(){n.dispatchEvent("onSelectAll",i),n.dispatchEvent("onSelectChange",i)})}}},{key:"clearSelection",value:function(){var n=this.props.currentRowKey;Array.isArray(n)||this.setState({selectedRows:[]})}},{key:"isRowSelected",value:function(n,e){var t=this.props.currentRowKey,o=this.state.selectedRows;return Array.isArray(t)?t.includes(e):o.includes(n)}},{key:"changeSortCondition",value:function(n,e){var t=this,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!n){var i=this.state;n=i.sortColumn,e=i.sortOrder}var r=this.state.filteredData.slice();if(!n)return void this.setState({data:r});var a=n,s=a.sortMethod,l=a.property,c=void 0;if(e){var p="ascending"===e?1:-1;c=s?r.sort(function(n,e){return s(n,e)?p:-p}):r.sort(function(n,e){var t=u(n,l),o=u(e,l);return t===o?0:t>o?p:-p})}else c=r;this.setState({sortColumn:n,sortOrder:e,data:c},function(){o&&t.dispatchEvent("onSortChange",n&&e?{column:n,prop:n.property,order:e}:{column:null,prop:null,order:null})})}},{key:"toggleFilterOpened",value:function(n){n.filterOpened=!n.filterOpened,this.forceUpdate()}},{key:"changeFilteredValue",value:function(n,e){var t=this;n.filteredValue=e;var o=F(this.props.data.slice(),this.state.columns);this.setState(Object.assign(this.state,{filteredData:o}),function(){t.dispatchEvent("onFilterChange",P({},n.columnKey,e))}),this.changeSortCondition(null,null,!1)}},{key:"dispatchEvent",value:function(n){for(var e=this.props[n],t=arguments.length,o=Array(t>1?t-1:0),i=1;i<t;i++)o[i-1]=arguments[i];e&&e.apply(void 0,o)}},{key:"render",value:function(){var n=(this.state.columns.find(function(n){return"expand"===n.type})||{}).expandPannel;return L.createElement(vn,Object.assign({},this.props,{renderExpanded:n,store:this.state}))}},{key:"isAllSelected",get:function(){var n=this.props.currentRowKey,e=this.state,t=e.selectedRows,o=e.data,i=e.selectable,r=i?o.filter(function(n,e){return i(n,e)}):o;return!!r.length&&(Array.isArray(n)?n.length===r.length:t.length===r.length)}}]),e}(Y.b);En.propTypes={style:W.a.object,columns:W.a.arrayOf(W.a.object),data:W.a.arrayOf(W.a.object),height:W.a.oneOfType([W.a.string,W.a.number]),maxHeight:W.a.oneOfType([W.a.string,W.a.number]),stripe:W.a.bool,border:W.a.bool,fit:W.a.bool,showHeader:W.a.bool,highlightCurrentRow:W.a.bool,currentRowKey:W.a.oneOfType([W.a.string,W.a.number]),rowClassName:W.a.func,rowStyle:W.a.func,rowKey:W.a.func,emptyText:W.a.string,defaultExpandAll:W.a.bool,expandRowKeys:W.a.arrayOf(W.a.oneOfType([W.a.string,W.a.number])),defaultSort:W.a.shape({prop:W.a.string,order:W.a.oneOf(["ascending","descending"])}),tooltipEffect:W.a.oneOf(["dark","light"]),showSummary:W.a.bool,sumText:W.a.string,summaryMethod:W.a.func,onSelect:W.a.func,onSelectAll:W.a.func,onSelectChange:W.a.func},En.defaultProps={data:[],showHeader:!0,stripe:!1,fit:!0,emptyText:U.a.t("ishow.table.emptyText"),defaultExpandAll:!1,highlightCurrentRow:!1,showSummary:!1,sumText:U.a.t("ishow.table.sumText")},En.childContextTypes={store:W.a.any};e.a=En},323:function(n,e,t){e=n.exports=t(192)(!0),e.push([n.i,'.ishow-checkbox,.ishow-checkbox__input{cursor:pointer;display:inline-block;position:relative}.ishow-checkbox,.ishow-checkbox-button__inner{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;white-space:nowrap}.ishow-checkbox{color:#1f2d3d}.ishow-checkbox+.ishow-checkbox{margin-left:15px}.ishow-checkbox__input{white-space:nowrap;outline:0;line-height:1;vertical-align:middle}.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner{background-color:#20a0ff;border-color:#0190fe}.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner:before{content:"";position:absolute;display:block;border:1px solid #fff;margin-top:-1px;left:3px;right:3px;top:50%}.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner:after{display:none}.ishow-checkbox__input.is-focus .ishow-checkbox__inner{border-color:#20a0ff}.ishow-checkbox__input.is-checked .ishow-checkbox__inner{background-color:#20a0ff;border-color:#0190fe}.ishow-checkbox__input.is-checked .ishow-checkbox__inner:after{-ms-transform:rotate(45deg) scaleY(1);-webkit-transform:rotate(45deg) scaleY(1);transform:rotate(45deg) scaleY(1)}.ishow-checkbox__input.is-disabled .ishow-checkbox__inner{background-color:#eef1f6;border-color:#d1dbe5;cursor:not-allowed}.ishow-checkbox__input.is-disabled .ishow-checkbox__inner:after{cursor:not-allowed;border-color:#eef1f6}.ishow-checkbox__input.is-disabled .ishow-checkbox__inner+.ishow-checkbox__label{cursor:not-allowed}.ishow-checkbox__input.is-disabled.is-checked .ishow-checkbox__inner{background-color:#d1dbe5;border-color:#d1dbe5}.ishow-checkbox__input.is-disabled.is-checked .ishow-checkbox__inner:after{border-color:#fff}.ishow-checkbox__input.is-disabled.is-indeterminate .ishow-checkbox__inner{background-color:#d1dbe5;border-color:#d1dbe5}.ishow-checkbox__input.is-disabled.is-indeterminate .ishow-checkbox__inner:before{border-color:#fff}.ishow-checkbox__input.is-disabled+.ishow-checkbox__label{color:#bbb;cursor:not-allowed}.ishow-checkbox__inner{display:inline-block;position:relative;border:1px solid #bfcbd9;border-radius:4px;-webkit-box-sizing:border-box;box-sizing:border-box;width:18px;height:18px;background-color:#fff;z-index:1;-webkit-transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46);-o-transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46);transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46)}.ishow-checkbox__inner:hover{border-color:#20a0ff}.ishow-checkbox__inner:after{-webkit-box-sizing:content-box;box-sizing:content-box;content:"";border:2px solid #fff;border-left:0;border-top:0;height:8px;left:5px;position:absolute;top:1px;-ms-transform:rotate(45deg) scaleY(0);-webkit-transform:rotate(45deg) scaleY(0);transform:rotate(45deg) scaleY(0);width:4px;-webkit-transition:-webkit-transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;transition:-webkit-transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;-o-transition:transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;transition:transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;transition:transform .15s cubic-bezier(.71,-.46,.88,.6) .05s,-webkit-transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;-ms-transform-origin:center;-webkit-transform-origin:center;transform-origin:center}.ishow-checkbox__original{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;left:-999px}.ishow-checkbox-button,.ishow-checkbox-button__inner{position:relative;display:inline-block}.ishow-checkbox__label{font-size:14px;padding-left:5px}.ishow-checkbox-button.is-checked .ishow-checkbox-button__inner{color:#fff;background-color:#20a0ff;border-color:#20a0ff;-webkit-box-shadow:-1px 0 0 0 #20a0ff;box-shadow:-1px 0 0 0 #20a0ff}.ishow-checkbox-button.is-disabled .ishow-checkbox-button__inner{color:#bfcbd9;cursor:not-allowed;background-image:none;background-color:#eef1f6;border-color:#d1dbe5;-webkit-box-shadow:none;box-shadow:none}.ishow-checkbox-button.is-focus .ishow-checkbox-button__inner{border-color:#20a0ff}.ishow-checkbox-button:first-child .ishow-checkbox-button__inner{border-left:1px solid #bfcbd9;border-radius:4px 0 0 4px;-webkit-box-shadow:none!important;box-shadow:none!important}.ishow-checkbox-button:last-child .ishow-checkbox-button__inner{border-radius:0 4px 4px 0}.ishow-checkbox-button__inner{line-height:1;vertical-align:middle;background:#fff;border:1px solid #bfcbd9;border-left:0;color:#1f2d3d;-webkit-appearance:none;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;outline:0;margin:0;cursor:pointer;-webkit-transition:all .3s cubic-bezier(.645,.045,.355,1);-o-transition:all .3s cubic-bezier(.645,.045,.355,1);transition:all .3s cubic-bezier(.645,.045,.355,1);padding:10px 15px;font-size:14px;border-radius:0}.ishow-checkbox-button__inner:hover{color:#20a0ff}.ishow-checkbox-button__inner [class*=ishow-icon-]{line-height:.9}.ishow-checkbox-button__inner [class*=ishow-icon-]+span{margin-left:5px}.ishow-checkbox-button__original{opacity:0;outline:0;position:absolute;margin:0;visibility:hidden;left:-999px}.ishow-checkbox-button--large .ishow-checkbox-button__inner{padding:11px 19px;font-size:16px;border-radius:0}.ishow-checkbox-button--small .ishow-checkbox-button__inner{padding:7px 9px;font-size:12px;border-radius:0}.ishow-checkbox-button--mini .ishow-checkbox-button__inner{padding:4px;font-size:12px;border-radius:0}.ishow-tag{background-color:#8391a5;display:inline-block;padding:0 5px;height:24px;line-height:22px;font-size:12px;color:#fff;border-radius:4px;-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid transparent;white-space:nowrap}.ishow-tag .ishow-icon-close{border-radius:50%;text-align:center;position:relative;cursor:pointer;font-size:12px;-ms-transform:scale(.75);-webkit-transform:scale(.75);transform:scale(.75);height:18px;width:18px;line-height:18px;vertical-align:middle;top:-1px;right:-2px}.ishow-tag .ishow-icon-close:hover{background-color:#fff;color:#8391a5}.ishow-tag--gray{background-color:#e4e8f1;border-color:#e4e8f1;color:#48576a}.ishow-tag--gray .ishow-tag__close:hover{background-color:#48576a;color:#fff}.ishow-tag--gray.is-hit{border-color:#48576a}.ishow-tag--primary{background-color:rgba(32,160,255,.1);border-color:rgba(32,160,255,.2);color:#20a0ff}.ishow-tag--primary .ishow-tag__close:hover{background-color:#20a0ff;color:#fff}.ishow-tag--primary.is-hit{border-color:#20a0ff}.ishow-tag--success{background-color:rgba(18,206,102,.1);border-color:rgba(18,206,102,.2);color:#13ce66}.ishow-tag--success .ishow-tag__close:hover{background-color:#13ce66;color:#fff}.ishow-tag--success.is-hit{border-color:#13ce66}.ishow-tag--warning{background-color:rgba(247,186,41,.1);border-color:rgba(247,186,41,.2);color:#f7ba2a}.ishow-tag--warning .ishow-tag__close:hover{background-color:#f7ba2a;color:#fff}.ishow-tag--warning.is-hit{border-color:#f7ba2a}.ishow-tag--danger{background-color:rgba(255,73,73,.1);border-color:rgba(255,73,73,.2);color:#ff4949}.ishow-tag--danger .ishow-tag__close:hover{background-color:#ff4949;color:#fff}.ishow-tag--danger.is-hit{border-color:#ff4949}.ishow-table-column--selection .cell{padding-left:14px;padding-right:14px}.ishow-table-filter{border:1px solid #d1dbe5;border-radius:2px;background-color:#fff;-webkit-box-shadow:0 2px 4px rgba(0,0,0,.12),0 0 6px rgba(0,0,0,.12);box-shadow:0 2px 4px rgba(0,0,0,.12),0 0 6px rgba(0,0,0,.12);-webkit-box-sizing:border-box;box-sizing:border-box;margin:2px 0}.ishow-table-filter__list{padding:5px 0;margin:0;list-style:none;min-width:100px}.ishow-table-filter__list-item{line-height:36px;padding:0 10px;cursor:pointer;font-size:14px}.ishow-table-filter__list-item:hover{background-color:#e4e8f1;color:#48576a}.ishow-table-filter__list-item.is-active{background-color:#20a0ff;color:#fff}.ishow-table-filter__content{min-width:100px}.ishow-table-filter__bottom{border-top:1px solid #d1dbe5;padding:8px}.ishow-table-filter__bottom button{background:0 0;border:none;color:#8391a5;cursor:pointer;font-size:14px;padding:0 3px}.ishow-table-filter__bottom button:hover{color:#20a0ff}.ishow-table-filter__bottom button:focus{outline:0}.ishow-table-filter__bottom button.is-disabled{color:#bfcbd9;cursor:not-allowed}.ishow-table-filter__checkbox-group{padding:10px}.ishow-table-filter__checkbox-group label.ishow-checkbox{display:block;margin-bottom:8px;margin-left:5px}.ishow-table-filter__checkbox-group .ishow-checkbox:last-child{margin-bottom:0}',"",{version:3,sources:["E:/demo/demo/src/ishow/Common/css/Table-column.css"],names:[],mappings:"AAAiB,uCAAuC,eAAe,qBAAqB,iBAAiB,CAAC,8CAA8C,sBAAsB,yBAAyB,qBAAqB,kBAAkB,CAAC,gBAAgB,aAAa,CAAC,gCAAgC,gBAAgB,CAAC,uBAAuB,mBAAmB,UAAU,cAAc,qBAAqB,CAAC,+DAA+D,yBAAyB,oBAAoB,CAAC,sEAAuE,WAAW,kBAAkB,cAAc,sBAAsB,gBAAgB,SAAS,UAAU,OAAO,CAAC,qEAAsE,YAAY,CAAC,uDAAuD,oBAAoB,CAAC,yDAAyD,yBAAyB,oBAAoB,CAAC,+DAAgE,sCAAsC,0CAA0C,iCAAiC,CAAC,0DAA0D,yBAAyB,qBAAqB,kBAAkB,CAAC,gEAAiE,mBAAmB,oBAAoB,CAAC,iFAAiF,kBAAkB,CAAC,qEAAqE,yBAAyB,oBAAoB,CAAC,2EAA4E,iBAAiB,CAAC,2EAA2E,yBAAyB,oBAAoB,CAAC,kFAAmF,iBAAiB,CAAC,0DAA0D,WAAW,kBAAkB,CAAC,uBAAuB,qBAAqB,kBAAkB,yBAAyB,kBAAkB,8BAA8B,sBAAsB,WAAW,YAAY,sBAAsB,UAAU,2HAA2H,sHAAsH,kHAAkH,CAAC,6BAA6B,oBAAoB,CAAC,6BAA8B,+BAA+B,uBAAuB,WAAW,sBAAsB,cAAc,aAAa,WAAW,SAAS,kBAAkB,QAAQ,sCAAsC,0CAA0C,kCAAkC,UAAU,6EAA6E,qEAAqE,gEAAgE,6DAA6D,uHAAwH,4BAA4B,gCAAgC,uBAAuB,CAAC,0BAA0B,UAAU,UAAU,kBAAkB,SAAS,QAAQ,SAAS,WAAW,CAAC,qDAAqD,kBAAkB,oBAAoB,CAAC,uBAAuB,eAAe,gBAAgB,CAAC,gEAAgE,WAAW,yBAAyB,qBAAqB,sCAAsC,6BAA6B,CAAC,iEAAiE,cAAc,mBAAmB,sBAAsB,yBAAyB,qBAAqB,wBAAwB,eAAe,CAAC,8DAA8D,oBAAoB,CAAC,iEAAiE,8BAA8B,0BAA0B,kCAAkC,yBAAyB,CAAC,gEAAgE,yBAAyB,CAAC,8BAA8B,cAAc,sBAAsB,gBAAgB,yBAAyB,cAAc,cAAc,wBAAwB,kBAAkB,8BAA8B,sBAAsB,UAAU,SAAS,eAAe,0DAA0D,qDAAqD,kDAAkD,kBAAkB,eAAe,eAAe,CAAC,oCAAoC,aAAa,CAAC,mDAAmD,cAAc,CAAC,wDAAwD,eAAe,CAAC,iCAAiC,UAAU,UAAU,kBAAkB,SAAS,kBAAkB,WAAW,CAAC,4DAA4D,kBAAkB,eAAe,eAAe,CAAC,4DAA4D,gBAAgB,eAAe,eAAe,CAAC,2DAA2D,YAAY,eAAe,eAAe,CAAC,WAAW,yBAAyB,qBAAqB,cAAc,YAAY,iBAAiB,eAAe,WAAW,kBAAkB,8BAA8B,sBAAsB,6BAA6B,kBAAkB,CAAC,6BAA6B,kBAAkB,kBAAkB,kBAAkB,eAAe,eAAe,yBAA6B,6BAAiC,qBAAyB,YAAY,WAAW,iBAAiB,sBAAsB,SAAS,UAAU,CAAC,mCAAmC,sBAAsB,aAAa,CAAC,iBAAiB,yBAAyB,qBAAqB,aAAa,CAAC,yCAAyC,yBAAyB,UAAU,CAAC,wBAAwB,oBAAoB,CAAC,oBAAoB,qCAAqC,iCAAiC,aAAa,CAAC,4CAA4C,yBAAyB,UAAU,CAAC,2BAA2B,oBAAoB,CAAC,oBAAoB,qCAAqC,iCAAiC,aAAa,CAAC,4CAA4C,yBAAyB,UAAU,CAAC,2BAA2B,oBAAoB,CAAC,oBAAoB,qCAAqC,iCAAiC,aAAa,CAAC,4CAA4C,yBAAyB,UAAU,CAAC,2BAA2B,oBAAoB,CAAC,mBAAmB,oCAAoC,gCAAgC,aAAa,CAAC,2CAA2C,yBAAyB,UAAU,CAAC,0BAA0B,oBAAoB,CAAC,qCAAqC,kBAAkB,kBAAkB,CAAC,oBAAoB,yBAAyB,kBAAkB,sBAAsB,qEAAqE,6DAA6D,8BAA8B,sBAAsB,YAAY,CAAC,0BAA0B,cAAc,SAAS,gBAAgB,eAAe,CAAC,+BAA+B,iBAAiB,eAAe,eAAe,cAAc,CAAC,qCAAqC,yBAAyB,aAAa,CAAC,yCAAyC,yBAAyB,UAAU,CAAC,6BAA6B,eAAe,CAAC,4BAA4B,6BAA6B,WAAW,CAAC,mCAAmC,eAAe,YAAY,cAAc,eAAe,eAAe,aAAa,CAAC,yCAAyC,aAAa,CAAC,yCAAyC,SAAS,CAAC,+CAA+C,cAAc,kBAAkB,CAAC,oCAAoC,YAAY,CAAC,yDAAyD,cAAc,kBAAkB,eAAe,CAAC,+DAA+D,eAAe,CAAC",file:"Table-column.css",sourcesContent:['@charset "UTF-8";.ishow-checkbox,.ishow-checkbox__input{cursor:pointer;display:inline-block;position:relative}.ishow-checkbox,.ishow-checkbox-button__inner{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;white-space:nowrap}.ishow-checkbox{color:#1f2d3d}.ishow-checkbox+.ishow-checkbox{margin-left:15px}.ishow-checkbox__input{white-space:nowrap;outline:0;line-height:1;vertical-align:middle}.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner{background-color:#20a0ff;border-color:#0190fe}.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner::before{content:\'\';position:absolute;display:block;border:1px solid #fff;margin-top:-1px;left:3px;right:3px;top:50%}.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner::after{display:none}.ishow-checkbox__input.is-focus .ishow-checkbox__inner{border-color:#20a0ff}.ishow-checkbox__input.is-checked .ishow-checkbox__inner{background-color:#20a0ff;border-color:#0190fe}.ishow-checkbox__input.is-checked .ishow-checkbox__inner::after{-ms-transform:rotate(45deg) scaleY(1);-webkit-transform:rotate(45deg) scaleY(1);transform:rotate(45deg) scaleY(1)}.ishow-checkbox__input.is-disabled .ishow-checkbox__inner{background-color:#eef1f6;border-color:#d1dbe5;cursor:not-allowed}.ishow-checkbox__input.is-disabled .ishow-checkbox__inner::after{cursor:not-allowed;border-color:#eef1f6}.ishow-checkbox__input.is-disabled .ishow-checkbox__inner+.ishow-checkbox__label{cursor:not-allowed}.ishow-checkbox__input.is-disabled.is-checked .ishow-checkbox__inner{background-color:#d1dbe5;border-color:#d1dbe5}.ishow-checkbox__input.is-disabled.is-checked .ishow-checkbox__inner::after{border-color:#fff}.ishow-checkbox__input.is-disabled.is-indeterminate .ishow-checkbox__inner{background-color:#d1dbe5;border-color:#d1dbe5}.ishow-checkbox__input.is-disabled.is-indeterminate .ishow-checkbox__inner::before{border-color:#fff}.ishow-checkbox__input.is-disabled+.ishow-checkbox__label{color:#bbb;cursor:not-allowed}.ishow-checkbox__inner{display:inline-block;position:relative;border:1px solid #bfcbd9;border-radius:4px;-webkit-box-sizing:border-box;box-sizing:border-box;width:18px;height:18px;background-color:#fff;z-index:1;-webkit-transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46);-o-transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46);transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46)}.ishow-checkbox__inner:hover{border-color:#20a0ff}.ishow-checkbox__inner::after{-webkit-box-sizing:content-box;box-sizing:content-box;content:"";border:2px solid #fff;border-left:0;border-top:0;height:8px;left:5px;position:absolute;top:1px;-ms-transform:rotate(45deg) scaleY(0);-webkit-transform:rotate(45deg) scaleY(0);transform:rotate(45deg) scaleY(0);width:4px;-webkit-transition:-webkit-transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;transition:-webkit-transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;-o-transition:transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;transition:transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;transition:transform .15s cubic-bezier(.71,-.46,.88,.6) .05s, -webkit-transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;-ms-transform-origin:center;-webkit-transform-origin:center;transform-origin:center}.ishow-checkbox__original{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;left:-999px}.ishow-checkbox-button,.ishow-checkbox-button__inner{position:relative;display:inline-block}.ishow-checkbox__label{font-size:14px;padding-left:5px}.ishow-checkbox-button.is-checked .ishow-checkbox-button__inner{color:#fff;background-color:#20a0ff;border-color:#20a0ff;-webkit-box-shadow:-1px 0 0 0 #20a0ff;box-shadow:-1px 0 0 0 #20a0ff}.ishow-checkbox-button.is-disabled .ishow-checkbox-button__inner{color:#bfcbd9;cursor:not-allowed;background-image:none;background-color:#eef1f6;border-color:#d1dbe5;-webkit-box-shadow:none;box-shadow:none}.ishow-checkbox-button.is-focus .ishow-checkbox-button__inner{border-color:#20a0ff}.ishow-checkbox-button:first-child .ishow-checkbox-button__inner{border-left:1px solid #bfcbd9;border-radius:4px 0 0 4px;-webkit-box-shadow:none!important;box-shadow:none!important}.ishow-checkbox-button:last-child .ishow-checkbox-button__inner{border-radius:0 4px 4px 0}.ishow-checkbox-button__inner{line-height:1;vertical-align:middle;background:#fff;border:1px solid #bfcbd9;border-left:0;color:#1f2d3d;-webkit-appearance:none;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;outline:0;margin:0;cursor:pointer;-webkit-transition:all .3s cubic-bezier(.645,.045,.355,1);-o-transition:all .3s cubic-bezier(.645,.045,.355,1);transition:all .3s cubic-bezier(.645,.045,.355,1);padding:10px 15px;font-size:14px;border-radius:0}.ishow-checkbox-button__inner:hover{color:#20a0ff}.ishow-checkbox-button__inner [class*=ishow-icon-]{line-height:.9}.ishow-checkbox-button__inner [class*=ishow-icon-]+span{margin-left:5px}.ishow-checkbox-button__original{opacity:0;outline:0;position:absolute;margin:0;visibility:hidden;left:-999px}.ishow-checkbox-button--large .ishow-checkbox-button__inner{padding:11px 19px;font-size:16px;border-radius:0}.ishow-checkbox-button--small .ishow-checkbox-button__inner{padding:7px 9px;font-size:12px;border-radius:0}.ishow-checkbox-button--mini .ishow-checkbox-button__inner{padding:4px;font-size:12px;border-radius:0}.ishow-tag{background-color:#8391a5;display:inline-block;padding:0 5px;height:24px;line-height:22px;font-size:12px;color:#fff;border-radius:4px;-webkit-box-sizing:border-box;box-sizing:border-box;border:1px solid transparent;white-space:nowrap}.ishow-tag .ishow-icon-close{border-radius:50%;text-align:center;position:relative;cursor:pointer;font-size:12px;-ms-transform:scale(.75,.75);-webkit-transform:scale(.75,.75);transform:scale(.75,.75);height:18px;width:18px;line-height:18px;vertical-align:middle;top:-1px;right:-2px}.ishow-tag .ishow-icon-close:hover{background-color:#fff;color:#8391a5}.ishow-tag--gray{background-color:#e4e8f1;border-color:#e4e8f1;color:#48576a}.ishow-tag--gray .ishow-tag__close:hover{background-color:#48576a;color:#fff}.ishow-tag--gray.is-hit{border-color:#48576a}.ishow-tag--primary{background-color:rgba(32,160,255,.1);border-color:rgba(32,160,255,.2);color:#20a0ff}.ishow-tag--primary .ishow-tag__close:hover{background-color:#20a0ff;color:#fff}.ishow-tag--primary.is-hit{border-color:#20a0ff}.ishow-tag--success{background-color:rgba(18,206,102,.1);border-color:rgba(18,206,102,.2);color:#13ce66}.ishow-tag--success .ishow-tag__close:hover{background-color:#13ce66;color:#fff}.ishow-tag--success.is-hit{border-color:#13ce66}.ishow-tag--warning{background-color:rgba(247,186,41,.1);border-color:rgba(247,186,41,.2);color:#f7ba2a}.ishow-tag--warning .ishow-tag__close:hover{background-color:#f7ba2a;color:#fff}.ishow-tag--warning.is-hit{border-color:#f7ba2a}.ishow-tag--danger{background-color:rgba(255,73,73,.1);border-color:rgba(255,73,73,.2);color:#ff4949}.ishow-tag--danger .ishow-tag__close:hover{background-color:#ff4949;color:#fff}.ishow-tag--danger.is-hit{border-color:#ff4949}.ishow-table-column--selection .cell{padding-left:14px;padding-right:14px}.ishow-table-filter{border:1px solid #d1dbe5;border-radius:2px;background-color:#fff;-webkit-box-shadow:0 2px 4px rgba(0,0,0,.12),0 0 6px rgba(0,0,0,.12);box-shadow:0 2px 4px rgba(0,0,0,.12),0 0 6px rgba(0,0,0,.12);-webkit-box-sizing:border-box;box-sizing:border-box;margin:2px 0}.ishow-table-filter__list{padding:5px 0;margin:0;list-style:none;min-width:100px}.ishow-table-filter__list-item{line-height:36px;padding:0 10px;cursor:pointer;font-size:14px}.ishow-table-filter__list-item:hover{background-color:#e4e8f1;color:#48576a}.ishow-table-filter__list-item.is-active{background-color:#20a0ff;color:#fff}.ishow-table-filter__content{min-width:100px}.ishow-table-filter__bottom{border-top:1px solid #d1dbe5;padding:8px}.ishow-table-filter__bottom button{background:0 0;border:none;color:#8391a5;cursor:pointer;font-size:14px;padding:0 3px}.ishow-table-filter__bottom button:hover{color:#20a0ff}.ishow-table-filter__bottom button:focus{outline:0}.ishow-table-filter__bottom button.is-disabled{color:#bfcbd9;cursor:not-allowed}.ishow-table-filter__checkbox-group{padding:10px}.ishow-table-filter__checkbox-group label.ishow-checkbox{display:block;margin-bottom:8px;margin-left:5px}.ishow-table-filter__checkbox-group .ishow-checkbox:last-child{margin-bottom:0}'],sourceRoot:""}])},324:function(n,e,t){e=n.exports=t(192)(!0),e.push([n.i,'.ishow-checkbox,.ishow-checkbox__input{cursor:pointer;display:inline-block;position:relative}.ishow-checkbox,.ishow-checkbox-button__inner{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;white-space:nowrap}.ishow-table--hidden,.ishow-table .hidden-columns,.ishow-table td.is-hidden>*,.ishow-table th.is-hidden>*{visibility:hidden}.ishow-checkbox{color:#1f2d3d}.ishow-checkbox+.ishow-checkbox{margin-left:15px}.ishow-checkbox__input{white-space:nowrap;outline:0;line-height:1;vertical-align:middle}.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner{background-color:#20a0ff;border-color:#0190fe}.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner:before{content:"";position:absolute;display:block;border:1px solid #fff;margin-top:-1px;left:3px;right:3px;top:50%}.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner:after{display:none}.ishow-checkbox__input.is-focus .ishow-checkbox__inner{border-color:#20a0ff}.ishow-checkbox__input.is-checked .ishow-checkbox__inner{background-color:#20a0ff;border-color:#0190fe}.ishow-checkbox__input.is-checked .ishow-checkbox__inner:after{-ms-transform:rotate(45deg) scaleY(1);-webkit-transform:rotate(45deg) scaleY(1);transform:rotate(45deg) scaleY(1)}.ishow-checkbox__input.is-disabled .ishow-checkbox__inner{background-color:#eef1f6;border-color:#d1dbe5;cursor:not-allowed}.ishow-checkbox__input.is-disabled .ishow-checkbox__inner:after{cursor:not-allowed;border-color:#eef1f6}.ishow-checkbox__input.is-disabled .ishow-checkbox__inner+.ishow-checkbox__label{cursor:not-allowed}.ishow-checkbox__input.is-disabled.is-checked .ishow-checkbox__inner{background-color:#d1dbe5;border-color:#d1dbe5}.ishow-checkbox__input.is-disabled.is-checked .ishow-checkbox__inner:after{border-color:#fff}.ishow-checkbox__input.is-disabled.is-indeterminate .ishow-checkbox__inner{background-color:#d1dbe5;border-color:#d1dbe5}.ishow-checkbox__input.is-disabled.is-indeterminate .ishow-checkbox__inner:before{border-color:#fff}.ishow-checkbox__input.is-disabled+.ishow-checkbox__label{color:#bbb;cursor:not-allowed}.ishow-checkbox__inner{display:inline-block;position:relative;border:1px solid #bfcbd9;border-radius:4px;-webkit-box-sizing:border-box;box-sizing:border-box;width:18px;height:18px;background-color:#fff;z-index:1;-webkit-transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46);-o-transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46);transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46)}.ishow-checkbox__inner:hover{border-color:#20a0ff}.ishow-checkbox__inner:after{-webkit-box-sizing:content-box;box-sizing:content-box;content:"";border:2px solid #fff;border-left:0;border-top:0;height:8px;left:5px;position:absolute;top:1px;-ms-transform:rotate(45deg) scaleY(0);-webkit-transform:rotate(45deg) scaleY(0);transform:rotate(45deg) scaleY(0);width:4px;-webkit-transition:-webkit-transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;transition:-webkit-transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;-o-transition:transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;transition:transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;transition:transform .15s cubic-bezier(.71,-.46,.88,.6) .05s,-webkit-transform .15s cubic-bezier(.71,-.46,.88,.6) .05s;-ms-transform-origin:center;-webkit-transform-origin:center;transform-origin:center}.ishow-table,.ishow-table td,.ishow-table th,.ishow-tag{-webkit-box-sizing:border-box;box-sizing:border-box}.ishow-checkbox__original{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;left:-999px}.ishow-checkbox-button,.ishow-checkbox-button__inner{position:relative;display:inline-block}.ishow-checkbox__label{font-size:14px;padding-left:5px}.ishow-checkbox-button.is-checked .ishow-checkbox-button__inner{color:#fff;background-color:#20a0ff;border-color:#20a0ff;-webkit-box-shadow:-1px 0 0 0 #20a0ff;box-shadow:-1px 0 0 0 #20a0ff}.ishow-checkbox-button.is-disabled .ishow-checkbox-button__inner{color:#bfcbd9;cursor:not-allowed;background-image:none;background-color:#eef1f6;border-color:#d1dbe5;-webkit-box-shadow:none;box-shadow:none}.ishow-checkbox-button.is-focus .ishow-checkbox-button__inner{border-color:#20a0ff}.ishow-checkbox-button:first-child .ishow-checkbox-button__inner{border-left:1px solid #bfcbd9;border-radius:4px 0 0 4px;-webkit-box-shadow:none!important;box-shadow:none!important}.ishow-checkbox-button:last-child .ishow-checkbox-button__inner{border-radius:0 4px 4px 0}.ishow-checkbox-button__inner{line-height:1;vertical-align:middle;background:#fff;border:1px solid #bfcbd9;border-left:0;color:#1f2d3d;-webkit-appearance:none;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;outline:0;margin:0;cursor:pointer;-webkit-transition:all .3s cubic-bezier(.645,.045,.355,1);-o-transition:all .3s cubic-bezier(.645,.045,.355,1);transition:all .3s cubic-bezier(.645,.045,.355,1);padding:10px 15px;font-size:14px;border-radius:0}.ishow-checkbox-button__inner:hover{color:#20a0ff}.ishow-checkbox-button__inner [class*=ishow-icon-]{line-height:.9}.ishow-checkbox-button__inner [class*=ishow-icon-]+span{margin-left:5px}.ishow-checkbox-button__original{opacity:0;outline:0;position:absolute;margin:0;visibility:hidden;left:-999px}.ishow-checkbox-button--large .ishow-checkbox-button__inner{padding:11px 19px;font-size:16px;border-radius:0}.ishow-checkbox-button--small .ishow-checkbox-button__inner{padding:7px 9px;font-size:12px;border-radius:0}.ishow-checkbox-button--mini .ishow-checkbox-button__inner{padding:4px;font-size:12px;border-radius:0}.ishow-tag{background-color:#8391a5;display:inline-block;padding:0 5px;height:24px;line-height:22px;font-size:12px;color:#fff;border-radius:4px;border:1px solid transparent;white-space:nowrap}.ishow-tag .ishow-icon-close{border-radius:50%;text-align:center;position:relative;cursor:pointer;font-size:12px;-ms-transform:scale(.75);-webkit-transform:scale(.75);transform:scale(.75);height:18px;width:18px;line-height:18px;vertical-align:middle;top:-1px;right:-2px}.ishow-tag .ishow-icon-close:hover{background-color:#fff;color:#8391a5}.ishow-tag--gray{background-color:#e4e8f1;border-color:#e4e8f1;color:#48576a}.ishow-tag--gray .ishow-tag__close:hover{background-color:#48576a;color:#fff}.ishow-tag--gray.is-hit{border-color:#48576a}.ishow-tag--primary{background-color:rgba(32,160,255,.1);border-color:rgba(32,160,255,.2);color:#20a0ff}.ishow-tag--primary .ishow-tag__close:hover{background-color:#20a0ff;color:#fff}.ishow-tag--primary.is-hit{border-color:#20a0ff}.ishow-tag--success{background-color:rgba(18,206,102,.1);border-color:rgba(18,206,102,.2);color:#13ce66}.ishow-tag--success .ishow-tag__close:hover{background-color:#13ce66;color:#fff}.ishow-tag--success.is-hit{border-color:#13ce66}.ishow-tag--warning{background-color:rgba(247,186,41,.1);border-color:rgba(247,186,41,.2);color:#f7ba2a}.ishow-tag--warning .ishow-tag__close:hover{background-color:#f7ba2a;color:#fff}.ishow-tag--warning.is-hit{border-color:#f7ba2a}.ishow-tag--danger{background-color:rgba(255,73,73,.1);border-color:rgba(255,73,73,.2);color:#ff4949}.ishow-tag--danger .ishow-tag__close:hover{background-color:#ff4949;color:#fff}.ishow-tag--danger.is-hit{border-color:#ff4949}.ishow-table{position:relative;overflow:hidden;width:100%;max-width:100%;background-color:#fff;border:1px solid #dfe6ec;font-size:14px;color:#1f2d3d}.ishow-table .ishow-tooltip.cell{white-space:nowrap;min-width:50px}.ishow-table td,.ishow-table th{height:40px;min-width:0;-o-text-overflow:ellipsis;text-overflow:ellipsis;vertical-align:middle;position:relative}.ishow-table:after,.ishow-table:before{content:"";position:absolute;background-color:#dfe6ec;z-index:1}.ishow-table td.is-right,.ishow-table th.is-right{text-align:right}.ishow-table td.is-left,.ishow-table th.is-left{text-align:left}.ishow-table td.is-center,.ishow-table th.is-center{text-align:center}.ishow-table td,.ishow-table th.is-leaf{border-bottom:1px solid #dfe6ec}.ishow-table td.gutter,.ishow-table th.gutter{width:15px;border-right-width:0;border-bottom-width:0;padding:0}.ishow-table .cell,.ishow-table th>div{-webkit-box-sizing:border-box;box-sizing:border-box;-o-text-overflow:ellipsis;text-overflow:ellipsis;padding-left:18px;padding-right:18px}.ishow-table:before{left:0;bottom:0;width:100%;height:1px}.ishow-table:after{top:0;right:0;width:1px;height:100%}.ishow-table .caret-wrapper,.ishow-table th>.cell{position:relative;vertical-align:middle;display:inline-block}.ishow-table th{white-space:nowrap;overflow:hidden;background-color:#eef1f6;text-align:left}.ishow-table th.is-sortable{cursor:pointer}.ishow-table th>div{display:inline-block;line-height:40px;overflow:hidden;white-space:nowrap}.ishow-table td>div{-webkit-box-sizing:border-box;box-sizing:border-box}.ishow-table th.required>div:before{display:inline-block;content:"";width:8px;height:8px;border-radius:50%;background:#ff4d51;margin-right:5px;vertical-align:middle}.ishow-table th>.cell{word-wrap:normal;-o-text-overflow:ellipsis;text-overflow:ellipsis;line-height:30px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.ishow-table th>.cell.highlight{color:#20a0ff}.ishow-table .caret-wrapper{cursor:pointer;margin-left:5px;margin-top:-2px;width:16px;height:30px;overflow:visible;overflow:initial}.ishow-table .cell,.ishow-table__footer-wrapper,.ishow-table__header-wrapper{overflow:hidden}.ishow-table .sort-caret{display:inline-block;width:0;height:0;border:0;content:"";position:absolute;left:3px;z-index:2}.ishow-table .sort-caret.ascending,.ishow-table .sort-caret.descending{border-right:5px solid transparent;border-left:5px solid transparent}.ishow-table .sort-caret.ascending{top:9px;border-top:none;border-bottom:5px solid #97a8be}.ishow-table .sort-caret.descending{bottom:9px;border-top:5px solid #97a8be;border-bottom:none}.ishow-table .ascending .sort-caret.ascending{border-bottom-color:#48576a}.ishow-table .descending .sort-caret.descending{border-top-color:#48576a}.ishow-table td.gutter{width:0}.ishow-table .cell{white-space:normal;word-break:break-all;line-height:24px}.ishow-table tr input[type=checkbox]{margin:0}.ishow-table tr{background-color:#fff}.ishow-table .hidden-columns{position:absolute;z-index:-1}.ishow-table__empty-block{position:relative;min-height:60px;text-align:center;width:100%;height:100%}.ishow-table__empty-text{position:absolute;left:50%;top:50%;-ms-transform:translate(-50%,-50%);-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);color:#5e7382}.ishow-table__expand-column .cell{padding:0;text-align:center}.ishow-table__expand-icon{position:relative;cursor:pointer;color:#666;font-size:12px;-webkit-transition:-webkit-transform .2s ease-in-out;transition:-webkit-transform .2s ease-in-out;-o-transition:transform .2s ease-in-out;transition:transform .2s ease-in-out;transition:transform .2s ease-in-out,-webkit-transform .2s ease-in-out;height:40px}.ishow-table__expand-icon>.ishow-icon{position:absolute;left:50%;top:50%;margin-left:-5px;margin-top:-5px}.ishow-table__expand-icon--expanded{-ms-transform:rotate(90deg);-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ishow-table__expanded-cell{padding:20px 50px;background-color:#fbfdff;-webkit-box-shadow:inset 0 2px 0 #f4f4f4;box-shadow:inset 0 2px 0 #f4f4f4}.ishow-table__expanded-cell:hover{background-color:#fbfdff!important}.ishow-table--fit{border-right:0;border-bottom:0}.ishow-table--border th,.ishow-table__fixed-right-patch{border-bottom:1px solid #dfe6ec}.ishow-table--fit td.gutter,.ishow-table--fit th.gutter{border-right-width:1px}.ishow-table--border td,.ishow-table--border th{border-right:1px solid #dfe6ec}.ishow-table__fixed,.ishow-table__fixed-right{position:absolute;top:0;left:0;-webkit-box-shadow:-1px 0 1px 1px #d3d4d6;box-shadow:-1px 0 1px 1px #d3d4d6;overflow-x:hidden}.ishow-table__fixed-right:before,.ishow-table__fixed:before{content:"";position:absolute;left:0;bottom:0;width:100%;height:1px;background-color:#dfe6ec;z-index:4}.ishow-table__fixed-right-patch{position:absolute;top:-1px;right:0;background-color:#eef1f6}.ishow-table__fixed-right{top:0;left:auto;right:0;-webkit-box-shadow:-1px 0 8px #d3d4d6;box-shadow:-1px 0 8px #d3d4d6}.ishow-table__fixed-right .ishow-table__fixed-body-wrapper,.ishow-table__fixed-right .ishow-table__fixed-footer-wrapper,.ishow-table__fixed-right .ishow-table__fixed-header-wrapper{left:auto;right:0}.ishow-table__fixed-header-wrapper{position:absolute;left:0;top:0;z-index:3}.ishow-table__fixed-header-wrapper thead div{background-color:#eef1f6;color:#1f2d3d}.ishow-table__fixed-footer-wrapper{position:absolute;left:0;bottom:0;z-index:3}.ishow-table__fixed-footer-wrapper tbody td{border-top:1px solid #dfe6ec;background-color:#fbfdff;color:#1f2d3d}.ishow-table__fixed-body-wrapper{position:absolute;left:0;top:37px;overflow:hidden;z-index:3}.ishow-table__body-wrapper,.ishow-table__footer-wrapper,.ishow-table__header-wrapper{width:100%}.ishow-table__footer-wrapper{margin-top:-1px}.ishow-table__footer-wrapper td{border-top:1px solid #dfe6ec}.ishow-table__body,.ishow-table__footer,.ishow-table__header{table-layout:fixed}.ishow-table__footer-wrapper thead div,.ishow-table__header-wrapper thead div{background-color:#eef1f6;color:#1f2d3d}.ishow-table__footer-wrapper tbody td,.ishow-table__header-wrapper tbody td{background-color:#fbfdff;color:#1f2d3d}.ishow-table__body-wrapper{overflow:auto;position:relative}.ishow-table--striped .ishow-table__body tr.ishow-table__row--striped td{background:#fafafa;background-clip:padding-box}.ishow-table--striped .ishow-table__body tr.ishow-table__row--striped.current-row td{background:#edf7ff}.ishow-table__body tr.hover-row.current-row>td,.ishow-table__body tr.hover-row.ishow-table__row--striped.current-row>td,.ishow-table__body tr.hover-row.ishow-table__row--striped>td,.ishow-table__body tr.hover-row>td{background-color:#eef1f6}.ishow-table__body tr.current-row>td{background:#edf7ff}.ishow-table__column-resize-proxy{position:absolute;left:200px;top:0;bottom:0;width:0;border-left:1px solid #dfe6ec;z-index:10}.ishow-table__column-filter-trigger{display:inline-block;line-height:34px;margin-left:5px;cursor:pointer}.ishow-table__column-filter-trigger i{color:#97a8be}.ishow-table--enable-row-transition .ishow-table__body td{-webkit-transition:background-color .25s ease;-o-transition:background-color .25s ease;transition:background-color .25s ease}.ishow-table--enable-row-hover .ishow-table__body tr:hover>td{background-color:#edf7ff;background-clip:padding-box}.ishow-table--fluid-height .ishow-table__fixed,.ishow-table--fluid-height .ishow-table__fixed-right{bottom:0;overflow:hidden}',"",{version:3,sources:["E:/demo/demo/src/ishow/Common/css/Table.css"],names:[],mappings:"AACA,uCAEI,eAAgB,AAChB,qBAAsB,AACtB,iBAAkB,CACrB,AAED,8CAEI,sBAAuB,AACvB,yBAA0B,AAC1B,qBAAsB,AACtB,kBAAmB,CACtB,AAED,0GAII,iBAAkB,CACrB,AAED,gBACI,aAAc,CACjB,AAED,gCACI,gBAAiB,CACpB,AAED,uBACI,mBAAoB,AACpB,UAAW,AACX,cAAe,AACf,qBAAsB,CACzB,AAED,+DACI,yBAA0B,AAC1B,oBAAqB,CACxB,AAED,sEACI,WAAY,AACZ,kBAAmB,AACnB,cAAe,AACf,sBAAuB,AACvB,gBAAiB,AACjB,SAAU,AACV,UAAW,AACX,OAAQ,CACX,AAED,qEACI,YAAa,CAChB,AAED,uDACI,oBAAqB,CACxB,AAED,yDACI,yBAA0B,AAC1B,oBAAqB,CACxB,AAED,+DACI,sCAAuC,AACvC,0CAA2C,AACnC,iCAAkC,CAC7C,AAED,0DACI,yBAA0B,AAC1B,qBAAsB,AACtB,kBAAmB,CACtB,AAED,gEACI,mBAAoB,AACpB,oBAAqB,CACxB,AAED,iFACI,kBAAmB,CACtB,AAED,qEACI,yBAA0B,AAC1B,oBAAqB,CACxB,AAED,2EACI,iBAAkB,CACrB,AAED,2EACI,yBAA0B,AAC1B,oBAAqB,CACxB,AAED,kFACI,iBAAkB,CACrB,AAED,0DACI,WAAY,AACZ,kBAAmB,CACtB,AAED,uBACI,qBAAsB,AACtB,kBAAmB,AACnB,yBAA0B,AAC1B,kBAAmB,AACnB,8BAA+B,AACvB,sBAAuB,AAC/B,WAAY,AACZ,YAAa,AACb,sBAAuB,AACvB,UAAW,AACX,2HAAmI,AACnI,sHAA8H,AAC9H,kHAA0H,CAC7H,AAED,6BACI,oBAAqB,CACxB,AAED,6BACI,+BAAgC,AACxB,uBAAwB,AAChC,WAAY,AACZ,sBAAuB,AACvB,cAAe,AACf,aAAc,AACd,WAAY,AACZ,SAAU,AACV,kBAAmB,AACnB,QAAS,AACT,sCAAuC,AACvC,0CAA2C,AACnC,kCAAmC,AAC3C,UAAW,AACX,6EAAiF,AACjF,qEAAyE,AACzE,gEAAoE,AACpE,6DAAiE,AACjE,uHAA+H,AAC/H,4BAA6B,AAC7B,gCAAiC,AACzB,uBAAwB,CACnC,AAED,wDAII,8BAA+B,AACvB,qBAAsB,CACjC,AAED,0BACI,UAAW,AACX,UAAW,AACX,kBAAmB,AACnB,SAAU,AACV,QAAS,AACT,SAAU,AACV,WAAY,CACf,AAED,qDAEI,kBAAmB,AACnB,oBAAqB,CACxB,AAED,uBACI,eAAgB,AAChB,gBAAiB,CACpB,AAED,gEACI,WAAY,AACZ,yBAA0B,AAC1B,qBAAsB,AACtB,sCAAuC,AAC/B,6BAA8B,CACzC,AAED,iEACI,cAAe,AACf,mBAAoB,AACpB,sBAAuB,AACvB,yBAA0B,AAC1B,qBAAsB,AACtB,wBAAyB,AACjB,eAAgB,CAC3B,AAED,8DACI,oBAAqB,CACxB,AAED,iEACI,8BAA+B,AAC/B,0BAA2B,AAC3B,kCAAoC,AAC5B,yBAA2B,CACtC,AAED,gEACI,yBAA0B,CAC7B,AAED,8BACI,cAAe,AACf,sBAAuB,AACvB,gBAAiB,AACjB,yBAA0B,AAC1B,cAAe,AACf,cAAe,AACf,wBAAyB,AACzB,kBAAmB,AACnB,8BAA+B,AACvB,sBAAuB,AAC/B,UAAW,AACX,SAAU,AACV,eAAgB,AAChB,0DAA8D,AAC9D,qDAAyD,AACzD,kDAAsD,AACtD,kBAAmB,AACnB,eAAgB,AAChB,eAAgB,CACnB,AAED,oCACI,aAAc,CACjB,AAED,mDACI,cAAe,CAClB,AAED,wDACI,eAAgB,CACnB,AAED,iCACI,UAAW,AACX,UAAW,AACX,kBAAmB,AACnB,SAAU,AACV,kBAAmB,AACnB,WAAY,CACf,AAED,4DACI,kBAAmB,AACnB,eAAgB,AAChB,eAAgB,CACnB,AAED,4DACI,gBAAiB,AACjB,eAAgB,AAChB,eAAgB,CACnB,AAED,2DACI,YAAa,AACb,eAAgB,AAChB,eAAgB,CACnB,AAED,WACI,yBAA0B,AAC1B,qBAAsB,AACtB,cAAe,AACf,YAAa,AACb,iBAAkB,AAClB,eAAgB,AAChB,WAAY,AACZ,kBAAmB,AACnB,6BAA8B,AAC9B,kBAAmB,CACtB,AAED,6BACI,kBAAmB,AACnB,kBAAmB,AACnB,kBAAmB,AACnB,eAAgB,AAChB,eAAgB,AAChB,yBAA+B,AAC/B,6BAAmC,AAC3B,qBAA2B,AACnC,YAAa,AACb,WAAY,AACZ,iBAAkB,AAClB,sBAAuB,AACvB,SAAU,AACV,UAAW,CACd,AAED,mCACI,sBAAuB,AACvB,aAAc,CACjB,AAED,iBACI,yBAA0B,AAC1B,qBAAsB,AACtB,aAAc,CACjB,AAED,yCACI,yBAA0B,AAC1B,UAAW,CACd,AAED,wBACI,oBAAqB,CACxB,AAED,oBACI,qCAAyC,AACzC,iCAAqC,AACrC,aAAc,CACjB,AAED,4CACI,yBAA0B,AAC1B,UAAW,CACd,AAED,2BACI,oBAAqB,CACxB,AAED,oBACI,qCAAyC,AACzC,iCAAqC,AACrC,aAAc,CACjB,AAED,4CACI,yBAA0B,AAC1B,UAAW,CACd,AAED,2BACI,oBAAqB,CACxB,AAED,oBACI,qCAAyC,AACzC,iCAAqC,AACrC,aAAc,CACjB,AAED,4CACI,yBAA0B,AAC1B,UAAW,CACd,AAED,2BACI,oBAAqB,CACxB,AAED,mBACI,oCAAwC,AACxC,gCAAoC,AACpC,aAAc,CACjB,AAED,2CACI,yBAA0B,AAC1B,UAAW,CACd,AAED,0BACI,oBAAqB,CACxB,AAED,aACI,kBAAmB,AACnB,gBAAiB,AACjB,WAAY,AACZ,eAAgB,AAChB,sBAAuB,AACvB,yBAA0B,AAC1B,eAAgB,AAChB,aAAc,CACjB,AAED,iCACI,mBAAoB,AACpB,cAAe,CAClB,AAED,gCAEI,YAAa,AACb,YAAa,AACb,0BAA2B,AACxB,uBAAwB,AAC3B,sBAAuB,AACvB,iBAAkB,CACrB,AAED,uCAEI,WAAY,AACZ,kBAAmB,AACnB,yBAA0B,AAC1B,SAAU,CACb,AAED,kDAEI,gBAAiB,CACpB,AAED,gDAEI,eAAgB,CACnB,AAED,oDAEI,iBAAkB,CACrB,AAED,wCAEI,+BAAgC,CACnC,AAED,8CAEI,WAAY,AACZ,qBAAsB,AACtB,sBAAuB,AACvB,SAAU,CACb,AAED,uCAEI,8BAA+B,AACvB,sBAAuB,AAC/B,0BAA2B,AACxB,uBAAwB,AAC3B,kBAAmB,AACnB,kBAAmB,CACtB,AAED,oBACI,OAAQ,AACR,SAAU,AACV,WAAY,AACZ,UAAW,CACd,AAED,mBACI,MAAO,AACP,QAAS,AACT,UAAW,AACX,WAAY,CACf,AAED,kDAEI,kBAAmB,AACnB,sBAAuB,AACvB,oBAAqB,CACxB,AAED,gBACI,mBAAoB,AACpB,gBAAiB,AACjB,yBAA0B,AAC1B,eAAgB,CACnB,AAED,4BACI,cAAe,CAClB,AAED,oBACI,qBAAsB,AACtB,iBAAkB,AAClB,gBAAiB,AACjB,kBAAmB,CACtB,AAED,oBACI,8BAA+B,AACvB,qBAAsB,CACjC,AAED,oCACI,qBAAsB,AACtB,WAAY,AACZ,UAAW,AACX,WAAY,AACZ,kBAAmB,AACnB,mBAAoB,AACpB,iBAAkB,AAClB,qBAAsB,CACzB,AAED,sBACI,iBAAkB,AAClB,0BAA2B,AACxB,uBAAwB,AAC3B,iBAAkB,AAClB,WAAY,AACZ,8BAA+B,AACvB,qBAAsB,CACjC,AAED,gCACI,aAAc,CACjB,AAED,4BACI,eAAgB,AAChB,gBAAiB,AACjB,gBAAiB,AACjB,WAAY,AACZ,YAAa,AACb,iBAAkB,AAClB,gBAAiB,CACpB,AAED,6EAGI,eAAgB,CACnB,AAED,yBACI,qBAAsB,AACtB,QAAS,AACT,SAAU,AACV,SAAU,AACV,WAAY,AACZ,kBAAmB,AACnB,SAAU,AACV,SAAU,CACb,AAED,uEAEI,mCAAoC,AACpC,iCAAkC,CACrC,AAED,mCACI,QAAS,AACT,gBAAiB,AACjB,+BAAgC,CACnC,AAED,oCACI,WAAY,AACZ,6BAA8B,AAC9B,kBAAmB,CACtB,AAED,8CACI,2BAA4B,CAC/B,AAED,gDACI,wBAAyB,CAC5B,AAED,uBACI,OAAQ,CACX,AAED,mBACI,mBAAoB,AACpB,qBAAsB,AACtB,gBAAiB,CACpB,AAED,qCACI,QAAS,CACZ,AAED,gBACI,qBAAsB,CACzB,AAED,6BACI,kBAAmB,AACnB,UAAW,CACd,AAED,0BACI,kBAAmB,AACnB,gBAAiB,AACjB,kBAAmB,AACnB,WAAY,AACZ,WAAY,CACf,AAED,yBACI,kBAAmB,AACnB,SAAU,AACV,QAAS,AACT,mCAAqC,AACrC,uCAAyC,AACjC,+BAAiC,AACzC,aAAc,CACjB,AAED,kCACI,UAAW,AACX,iBAAkB,CACrB,AAED,0BACI,kBAAmB,AACnB,eAAgB,AAChB,WAAY,AACZ,eAAgB,AAChB,qDAAsD,AACtD,6CAA8C,AAC9C,wCAAyC,AACzC,qCAAsC,AACtC,uEAAyE,AACzE,WAAY,CACf,AAED,sCACI,kBAAmB,AACnB,SAAU,AACV,QAAS,AACT,iBAAkB,AAClB,eAAgB,CACnB,AAED,oCACI,4BAA6B,AAC7B,gCAAiC,AACzB,uBAAwB,CACnC,AAED,4BACI,kBAAmB,AACnB,yBAA0B,AAC1B,yCAA0C,AAClC,gCAAiC,CAC5C,AAED,kCACI,kCAAoC,CACvC,AAED,kBACI,eAAgB,AAChB,eAAgB,CACnB,AAED,wDAEI,+BAAgC,CACnC,AAED,wDAEI,sBAAuB,CAC1B,AAED,gDAEI,8BAA+B,CAClC,AAED,8CAEI,kBAAmB,AACnB,MAAO,AACP,OAAQ,AAGR,0CAA2C,AACnC,kCAAmC,AAC3C,iBAAkB,CACrB,AAED,4DAEI,WAAY,AACZ,kBAAmB,AACnB,OAAQ,AACR,SAAU,AACV,WAAY,AACZ,WAAY,AACZ,yBAA0B,AAC1B,SAAU,CACb,AAED,gCACI,kBAAmB,AACnB,SAAU,AACV,QAAS,AACT,wBAAyB,CAC5B,AAED,0BACI,MAAO,AACP,UAAW,AACX,QAAS,AACT,sCAAuC,AAC/B,6BAA8B,CACzC,AAED,qLAGI,UAAW,AACX,OAAQ,CACX,AAED,mCACI,kBAAmB,AACnB,OAAQ,AACR,MAAO,AACP,SAAU,CACb,AAED,6CACI,yBAA0B,AAC1B,aAAc,CACjB,AAED,mCACI,kBAAmB,AACnB,OAAQ,AACR,SAAU,AACV,SAAU,CACb,AAED,4CACI,6BAA8B,AAC9B,yBAA0B,AAC1B,aAAc,CACjB,AAED,iCACI,kBAAmB,AACnB,OAAQ,AACR,SAAU,AACV,gBAAiB,AACjB,SAAU,CACb,AAED,qFAGI,UAAW,CACd,AAED,6BACI,eAAgB,CACnB,AAED,gCACI,4BAA6B,CAChC,AAED,6DAGI,kBAAmB,CACtB,AAED,8EAEI,yBAA0B,AAC1B,aAAc,CACjB,AAED,4EAEI,yBAA0B,AAC1B,aAAc,CACjB,AAED,2BACI,cAAe,AACf,iBAAkB,CACrB,AAED,yEACI,mBAAoB,AACpB,2BAA4B,CAC/B,AAED,qFACI,kBAAmB,CACtB,AAED,wNAII,wBAAyB,CAC5B,AAED,qCACI,kBAAmB,CACtB,AAED,kCACI,kBAAmB,AACnB,WAAY,AACZ,MAAO,AACP,SAAU,AACV,QAAS,AACT,8BAA+B,AAC/B,UAAW,CACd,AAED,oCACI,qBAAsB,AACtB,iBAAkB,AAClB,gBAAiB,AACjB,cAAe,CAClB,AAED,sCACI,aAAc,CACjB,AAED,0DACI,8CAA+C,AAC/C,yCAA0C,AAC1C,qCAAsC,CACzC,AAED,8DAEI,yBAA0B,AAE1B,2BAA4B,CAC/B,AAED,oGAEI,SAAU,AACV,eAAgB,CACnB",file:"Table.css",sourcesContent:['@charset "UTF-8";\r\n.ishow-checkbox,\r\n.ishow-checkbox__input {\r\n cursor: pointer;\r\n display: inline-block;\r\n position: relative\r\n}\r\n\r\n.ishow-checkbox,\r\n.ishow-checkbox-button__inner {\r\n -moz-user-select: none;\r\n -webkit-user-select: none;\r\n -ms-user-select: none;\r\n white-space: nowrap\r\n}\r\n\r\n.ishow-table .hidden-columns,\r\n.ishow-table td.is-hidden>*,\r\n.ishow-table th.is-hidden>*,\r\n.ishow-table--hidden {\r\n visibility: hidden\r\n}\r\n\r\n.ishow-checkbox {\r\n color: #1f2d3d\r\n}\r\n\r\n.ishow-checkbox+.ishow-checkbox {\r\n margin-left: 15px\r\n}\r\n\r\n.ishow-checkbox__input {\r\n white-space: nowrap;\r\n outline: 0;\r\n line-height: 1;\r\n vertical-align: middle\r\n}\r\n\r\n.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner {\r\n background-color: #20a0ff;\r\n border-color: #0190fe\r\n}\r\n\r\n.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner::before {\r\n content: \'\';\r\n position: absolute;\r\n display: block;\r\n border: 1px solid #fff;\r\n margin-top: -1px;\r\n left: 3px;\r\n right: 3px;\r\n top: 50%\r\n}\r\n\r\n.ishow-checkbox__input.is-indeterminate .ishow-checkbox__inner::after {\r\n display: none\r\n}\r\n\r\n.ishow-checkbox__input.is-focus .ishow-checkbox__inner {\r\n border-color: #20a0ff\r\n}\r\n\r\n.ishow-checkbox__input.is-checked .ishow-checkbox__inner {\r\n background-color: #20a0ff;\r\n border-color: #0190fe\r\n}\r\n\r\n.ishow-checkbox__input.is-checked .ishow-checkbox__inner::after {\r\n -ms-transform: rotate(45deg) scaleY(1);\r\n -webkit-transform: rotate(45deg) scaleY(1);\r\n transform: rotate(45deg) scaleY(1)\r\n}\r\n\r\n.ishow-checkbox__input.is-disabled .ishow-checkbox__inner {\r\n background-color: #eef1f6;\r\n border-color: #d1dbe5;\r\n cursor: not-allowed\r\n}\r\n\r\n.ishow-checkbox__input.is-disabled .ishow-checkbox__inner::after {\r\n cursor: not-allowed;\r\n border-color: #eef1f6\r\n}\r\n\r\n.ishow-checkbox__input.is-disabled .ishow-checkbox__inner+.ishow-checkbox__label {\r\n cursor: not-allowed\r\n}\r\n\r\n.ishow-checkbox__input.is-disabled.is-checked .ishow-checkbox__inner {\r\n background-color: #d1dbe5;\r\n border-color: #d1dbe5\r\n}\r\n\r\n.ishow-checkbox__input.is-disabled.is-checked .ishow-checkbox__inner::after {\r\n border-color: #fff\r\n}\r\n\r\n.ishow-checkbox__input.is-disabled.is-indeterminate .ishow-checkbox__inner {\r\n background-color: #d1dbe5;\r\n border-color: #d1dbe5\r\n}\r\n\r\n.ishow-checkbox__input.is-disabled.is-indeterminate .ishow-checkbox__inner::before {\r\n border-color: #fff\r\n}\r\n\r\n.ishow-checkbox__input.is-disabled+.ishow-checkbox__label {\r\n color: #bbb;\r\n cursor: not-allowed\r\n}\r\n\r\n.ishow-checkbox__inner {\r\n display: inline-block;\r\n position: relative;\r\n border: 1px solid #bfcbd9;\r\n border-radius: 4px;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n width: 18px;\r\n height: 18px;\r\n background-color: #fff;\r\n z-index: 1;\r\n -webkit-transition: border-color .25s cubic-bezier(.71, -.46, .29, 1.46), background-color .25s cubic-bezier(.71, -.46, .29, 1.46);\r\n -o-transition: border-color .25s cubic-bezier(.71, -.46, .29, 1.46), background-color .25s cubic-bezier(.71, -.46, .29, 1.46);\r\n transition: border-color .25s cubic-bezier(.71, -.46, .29, 1.46), background-color .25s cubic-bezier(.71, -.46, .29, 1.46)\r\n}\r\n\r\n.ishow-checkbox__inner:hover {\r\n border-color: #20a0ff\r\n}\r\n\r\n.ishow-checkbox__inner::after {\r\n -webkit-box-sizing: content-box;\r\n box-sizing: content-box;\r\n content: "";\r\n border: 2px solid #fff;\r\n border-left: 0;\r\n border-top: 0;\r\n height: 8px;\r\n left: 5px;\r\n position: absolute;\r\n top: 1px;\r\n -ms-transform: rotate(45deg) scaleY(0);\r\n -webkit-transform: rotate(45deg) scaleY(0);\r\n transform: rotate(45deg) scaleY(0);\r\n width: 4px;\r\n -webkit-transition: -webkit-transform .15s cubic-bezier(.71, -.46, .88, .6) .05s;\r\n transition: -webkit-transform .15s cubic-bezier(.71, -.46, .88, .6) .05s;\r\n -o-transition: transform .15s cubic-bezier(.71, -.46, .88, .6) .05s;\r\n transition: transform .15s cubic-bezier(.71, -.46, .88, .6) .05s;\r\n transition: transform .15s cubic-bezier(.71, -.46, .88, .6) .05s, -webkit-transform .15s cubic-bezier(.71, -.46, .88, .6) .05s;\r\n -ms-transform-origin: center;\r\n -webkit-transform-origin: center;\r\n transform-origin: center\r\n}\r\n\r\n.ishow-table,\r\n.ishow-table td,\r\n.ishow-table th,\r\n.ishow-tag {\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box\r\n}\r\n\r\n.ishow-checkbox__original {\r\n opacity: 0;\r\n outline: 0;\r\n position: absolute;\r\n margin: 0;\r\n width: 0;\r\n height: 0;\r\n left: -999px\r\n}\r\n\r\n.ishow-checkbox-button,\r\n.ishow-checkbox-button__inner {\r\n position: relative;\r\n display: inline-block\r\n}\r\n\r\n.ishow-checkbox__label {\r\n font-size: 14px;\r\n padding-left: 5px\r\n}\r\n\r\n.ishow-checkbox-button.is-checked .ishow-checkbox-button__inner {\r\n color: #fff;\r\n background-color: #20a0ff;\r\n border-color: #20a0ff;\r\n -webkit-box-shadow: -1px 0 0 0 #20a0ff;\r\n box-shadow: -1px 0 0 0 #20a0ff\r\n}\r\n\r\n.ishow-checkbox-button.is-disabled .ishow-checkbox-button__inner {\r\n color: #bfcbd9;\r\n cursor: not-allowed;\r\n background-image: none;\r\n background-color: #eef1f6;\r\n border-color: #d1dbe5;\r\n -webkit-box-shadow: none;\r\n box-shadow: none\r\n}\r\n\r\n.ishow-checkbox-button.is-focus .ishow-checkbox-button__inner {\r\n border-color: #20a0ff\r\n}\r\n\r\n.ishow-checkbox-button:first-child .ishow-checkbox-button__inner {\r\n border-left: 1px solid #bfcbd9;\r\n border-radius: 4px 0 0 4px;\r\n -webkit-box-shadow: none !important;\r\n box-shadow: none !important\r\n}\r\n\r\n.ishow-checkbox-button:last-child .ishow-checkbox-button__inner {\r\n border-radius: 0 4px 4px 0\r\n}\r\n\r\n.ishow-checkbox-button__inner {\r\n line-height: 1;\r\n vertical-align: middle;\r\n background: #fff;\r\n border: 1px solid #bfcbd9;\r\n border-left: 0;\r\n color: #1f2d3d;\r\n -webkit-appearance: none;\r\n text-align: center;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n outline: 0;\r\n margin: 0;\r\n cursor: pointer;\r\n -webkit-transition: all .3s cubic-bezier(.645, .045, .355, 1);\r\n -o-transition: all .3s cubic-bezier(.645, .045, .355, 1);\r\n transition: all .3s cubic-bezier(.645, .045, .355, 1);\r\n padding: 10px 15px;\r\n font-size: 14px;\r\n border-radius: 0\r\n}\r\n\r\n.ishow-checkbox-button__inner:hover {\r\n color: #20a0ff\r\n}\r\n\r\n.ishow-checkbox-button__inner [class*=ishow-icon-] {\r\n line-height: .9\r\n}\r\n\r\n.ishow-checkbox-button__inner [class*=ishow-icon-]+span {\r\n margin-left: 5px\r\n}\r\n\r\n.ishow-checkbox-button__original {\r\n opacity: 0;\r\n outline: 0;\r\n position: absolute;\r\n margin: 0;\r\n visibility: hidden;\r\n left: -999px\r\n}\r\n\r\n.ishow-checkbox-button--large .ishow-checkbox-button__inner {\r\n padding: 11px 19px;\r\n font-size: 16px;\r\n border-radius: 0\r\n}\r\n\r\n.ishow-checkbox-button--small .ishow-checkbox-button__inner {\r\n padding: 7px 9px;\r\n font-size: 12px;\r\n border-radius: 0\r\n}\r\n\r\n.ishow-checkbox-button--mini .ishow-checkbox-button__inner {\r\n padding: 4px;\r\n font-size: 12px;\r\n border-radius: 0\r\n}\r\n\r\n.ishow-tag {\r\n background-color: #8391a5;\r\n display: inline-block;\r\n padding: 0 5px;\r\n height: 24px;\r\n line-height: 22px;\r\n font-size: 12px;\r\n color: #fff;\r\n border-radius: 4px;\r\n border: 1px solid transparent;\r\n white-space: nowrap\r\n}\r\n\r\n.ishow-tag .ishow-icon-close {\r\n border-radius: 50%;\r\n text-align: center;\r\n position: relative;\r\n cursor: pointer;\r\n font-size: 12px;\r\n -ms-transform: scale(.75, .75);\r\n -webkit-transform: scale(.75, .75);\r\n transform: scale(.75, .75);\r\n height: 18px;\r\n width: 18px;\r\n line-height: 18px;\r\n vertical-align: middle;\r\n top: -1px;\r\n right: -2px\r\n}\r\n\r\n.ishow-tag .ishow-icon-close:hover {\r\n background-color: #fff;\r\n color: #8391a5\r\n}\r\n\r\n.ishow-tag--gray {\r\n background-color: #e4e8f1;\r\n border-color: #e4e8f1;\r\n color: #48576a\r\n}\r\n\r\n.ishow-tag--gray .ishow-tag__close:hover {\r\n background-color: #48576a;\r\n color: #fff\r\n}\r\n\r\n.ishow-tag--gray.is-hit {\r\n border-color: #48576a\r\n}\r\n\r\n.ishow-tag--primary {\r\n background-color: rgba(32, 160, 255, .1);\r\n border-color: rgba(32, 160, 255, .2);\r\n color: #20a0ff\r\n}\r\n\r\n.ishow-tag--primary .ishow-tag__close:hover {\r\n background-color: #20a0ff;\r\n color: #fff\r\n}\r\n\r\n.ishow-tag--primary.is-hit {\r\n border-color: #20a0ff\r\n}\r\n\r\n.ishow-tag--success {\r\n background-color: rgba(18, 206, 102, .1);\r\n border-color: rgba(18, 206, 102, .2);\r\n color: #13ce66\r\n}\r\n\r\n.ishow-tag--success .ishow-tag__close:hover {\r\n background-color: #13ce66;\r\n color: #fff\r\n}\r\n\r\n.ishow-tag--success.is-hit {\r\n border-color: #13ce66\r\n}\r\n\r\n.ishow-tag--warning {\r\n background-color: rgba(247, 186, 41, .1);\r\n border-color: rgba(247, 186, 41, .2);\r\n color: #f7ba2a\r\n}\r\n\r\n.ishow-tag--warning .ishow-tag__close:hover {\r\n background-color: #f7ba2a;\r\n color: #fff\r\n}\r\n\r\n.ishow-tag--warning.is-hit {\r\n border-color: #f7ba2a\r\n}\r\n\r\n.ishow-tag--danger {\r\n background-color: rgba(255, 73, 73, .1);\r\n border-color: rgba(255, 73, 73, .2);\r\n color: #ff4949\r\n}\r\n\r\n.ishow-tag--danger .ishow-tag__close:hover {\r\n background-color: #ff4949;\r\n color: #fff\r\n}\r\n\r\n.ishow-tag--danger.is-hit {\r\n border-color: #ff4949\r\n}\r\n\r\n.ishow-table {\r\n position: relative;\r\n overflow: hidden;\r\n width: 100%;\r\n max-width: 100%;\r\n background-color: #fff;\r\n border: 1px solid #dfe6ec;\r\n font-size: 14px;\r\n color: #1f2d3d\r\n}\r\n\r\n.ishow-table .ishow-tooltip.cell {\r\n white-space: nowrap;\r\n min-width: 50px\r\n}\r\n\r\n.ishow-table td,\r\n.ishow-table th {\r\n height: 40px;\r\n min-width: 0;\r\n -o-text-overflow: ellipsis;\r\n text-overflow: ellipsis;\r\n vertical-align: middle;\r\n position: relative\r\n}\r\n\r\n.ishow-table::after,\r\n.ishow-table::before {\r\n content: \'\';\r\n position: absolute;\r\n background-color: #dfe6ec;\r\n z-index: 1\r\n}\r\n\r\n.ishow-table td.is-right,\r\n.ishow-table th.is-right {\r\n text-align: right\r\n}\r\n\r\n.ishow-table td.is-left,\r\n.ishow-table th.is-left {\r\n text-align: left\r\n}\r\n\r\n.ishow-table td.is-center,\r\n.ishow-table th.is-center {\r\n text-align: center\r\n}\r\n\r\n.ishow-table td,\r\n.ishow-table th.is-leaf {\r\n border-bottom: 1px solid #dfe6ec\r\n}\r\n\r\n.ishow-table td.gutter,\r\n.ishow-table th.gutter {\r\n width: 15px;\r\n border-right-width: 0;\r\n border-bottom-width: 0;\r\n padding: 0\r\n}\r\n\r\n.ishow-table .cell,\r\n.ishow-table th>div {\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box;\r\n -o-text-overflow: ellipsis;\r\n text-overflow: ellipsis;\r\n padding-left: 18px;\r\n padding-right: 18px\r\n}\r\n\r\n.ishow-table::before {\r\n left: 0;\r\n bottom: 0;\r\n width: 100%;\r\n height: 1px\r\n}\r\n\r\n.ishow-table::after {\r\n top: 0;\r\n right: 0;\r\n width: 1px;\r\n height: 100%\r\n}\r\n\r\n.ishow-table .caret-wrapper,\r\n.ishow-table th>.cell {\r\n position: relative;\r\n vertical-align: middle;\r\n display: inline-block\r\n}\r\n\r\n.ishow-table th {\r\n white-space: nowrap;\r\n overflow: hidden;\r\n background-color: #eef1f6;\r\n text-align: left\r\n}\r\n\r\n.ishow-table th.is-sortable {\r\n cursor: pointer\r\n}\r\n\r\n.ishow-table th>div {\r\n display: inline-block;\r\n line-height: 40px;\r\n overflow: hidden;\r\n white-space: nowrap\r\n}\r\n\r\n.ishow-table td>div {\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box\r\n}\r\n\r\n.ishow-table th.required>div::before {\r\n display: inline-block;\r\n content: "";\r\n width: 8px;\r\n height: 8px;\r\n border-radius: 50%;\r\n background: #ff4d51;\r\n margin-right: 5px;\r\n vertical-align: middle\r\n}\r\n\r\n.ishow-table th>.cell {\r\n word-wrap: normal;\r\n -o-text-overflow: ellipsis;\r\n text-overflow: ellipsis;\r\n line-height: 30px;\r\n width: 100%;\r\n -webkit-box-sizing: border-box;\r\n box-sizing: border-box\r\n}\r\n\r\n.ishow-table th>.cell.highlight {\r\n color: #20a0ff\r\n}\r\n\r\n.ishow-table .caret-wrapper {\r\n cursor: pointer;\r\n margin-left: 5px;\r\n margin-top: -2px;\r\n width: 16px;\r\n height: 30px;\r\n overflow: visible;\r\n overflow: initial\r\n}\r\n\r\n.ishow-table .cell,\r\n.ishow-table__footer-wrapper,\r\n.ishow-table__header-wrapper {\r\n overflow: hidden\r\n}\r\n\r\n.ishow-table .sort-caret {\r\n display: inline-block;\r\n width: 0;\r\n height: 0;\r\n border: 0;\r\n content: "";\r\n position: absolute;\r\n left: 3px;\r\n z-index: 2\r\n}\r\n\r\n.ishow-table .sort-caret.ascending,\r\n.ishow-table .sort-caret.descending {\r\n border-right: 5px solid transparent;\r\n border-left: 5px solid transparent\r\n}\r\n\r\n.ishow-table .sort-caret.ascending {\r\n top: 9px;\r\n border-top: none;\r\n border-bottom: 5px solid #97a8be\r\n}\r\n\r\n.ishow-table .sort-caret.descending {\r\n bottom: 9px;\r\n border-top: 5px solid #97a8be;\r\n border-bottom: none\r\n}\r\n\r\n.ishow-table .ascending .sort-caret.ascending {\r\n border-bottom-color: #48576a\r\n}\r\n\r\n.ishow-table .descending .sort-caret.descending {\r\n border-top-color: #48576a\r\n}\r\n\r\n.ishow-table td.gutter {\r\n width: 0\r\n}\r\n\r\n.ishow-table .cell {\r\n white-space: normal;\r\n word-break: break-all;\r\n line-height: 24px\r\n}\r\n\r\n.ishow-table tr input[type=checkbox] {\r\n margin: 0\r\n}\r\n\r\n.ishow-table tr {\r\n background-color: #fff\r\n}\r\n\r\n.ishow-table .hidden-columns {\r\n position: absolute;\r\n z-index: -1\r\n}\r\n\r\n.ishow-table__empty-block {\r\n position: relative;\r\n min-height: 60px;\r\n text-align: center;\r\n width: 100%;\r\n height: 100%\r\n}\r\n\r\n.ishow-table__empty-text {\r\n position: absolute;\r\n left: 50%;\r\n top: 50%;\r\n -ms-transform: translate(-50%, -50%);\r\n -webkit-transform: translate(-50%, -50%);\r\n transform: translate(-50%, -50%);\r\n color: #5e7382\r\n}\r\n\r\n.ishow-table__expand-column .cell {\r\n padding: 0;\r\n text-align: center\r\n}\r\n\r\n.ishow-table__expand-icon {\r\n position: relative;\r\n cursor: pointer;\r\n color: #666;\r\n font-size: 12px;\r\n -webkit-transition: -webkit-transform .2s ease-in-out;\r\n transition: -webkit-transform .2s ease-in-out;\r\n -o-transition: transform .2s ease-in-out;\r\n transition: transform .2s ease-in-out;\r\n transition: transform .2s ease-in-out, -webkit-transform .2s ease-in-out;\r\n height: 40px\r\n}\r\n\r\n.ishow-table__expand-icon>.ishow-icon {\r\n position: absolute;\r\n left: 50%;\r\n top: 50%;\r\n margin-left: -5px;\r\n margin-top: -5px\r\n}\r\n\r\n.ishow-table__expand-icon--expanded {\r\n -ms-transform: rotate(90deg);\r\n -webkit-transform: rotate(90deg);\r\n transform: rotate(90deg)\r\n}\r\n\r\n.ishow-table__expanded-cell {\r\n padding: 20px 50px;\r\n background-color: #fbfdff;\r\n -webkit-box-shadow: inset 0 2px 0 #f4f4f4;\r\n box-shadow: inset 0 2px 0 #f4f4f4\r\n}\r\n\r\n.ishow-table__expanded-cell:hover {\r\n background-color: #fbfdff !important\r\n}\r\n\r\n.ishow-table--fit {\r\n border-right: 0;\r\n border-bottom: 0\r\n}\r\n\r\n.ishow-table--border th,\r\n.ishow-table__fixed-right-patch {\r\n border-bottom: 1px solid #dfe6ec\r\n}\r\n\r\n.ishow-table--fit td.gutter,\r\n.ishow-table--fit th.gutter {\r\n border-right-width: 1px\r\n}\r\n\r\n.ishow-table--border td,\r\n.ishow-table--border th {\r\n border-right: 1px solid #dfe6ec\r\n}\r\n\r\n.ishow-table__fixed,\r\n.ishow-table__fixed-right {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n /* box-shadow: 1px 0 8px 4px #ddd; */\r\n /* box-shadow: 1px 0 8px #d3d4d6; */\r\n -webkit-box-shadow: -1px 0 1px 1px #d3d4d6;\r\n box-shadow: -1px 0 1px 1px #d3d4d6;\r\n overflow-x: hidden\r\n}\r\n\r\n.ishow-table__fixed-right::before,\r\n.ishow-table__fixed::before {\r\n content: \'\';\r\n position: absolute;\r\n left: 0;\r\n bottom: 0;\r\n width: 100%;\r\n height: 1px;\r\n background-color: #dfe6ec;\r\n z-index: 4\r\n}\r\n\r\n.ishow-table__fixed-right-patch {\r\n position: absolute;\r\n top: -1px;\r\n right: 0;\r\n background-color: #eef1f6\r\n}\r\n\r\n.ishow-table__fixed-right {\r\n top: 0;\r\n left: auto;\r\n right: 0;\r\n -webkit-box-shadow: -1px 0 8px #d3d4d6;\r\n box-shadow: -1px 0 8px #d3d4d6\r\n}\r\n\r\n.ishow-table__fixed-right .ishow-table__fixed-body-wrapper,\r\n.ishow-table__fixed-right .ishow-table__fixed-footer-wrapper,\r\n.ishow-table__fixed-right .ishow-table__fixed-header-wrapper {\r\n left: auto;\r\n right: 0\r\n}\r\n\r\n.ishow-table__fixed-header-wrapper {\r\n position: absolute;\r\n left: 0;\r\n top: 0;\r\n z-index: 3\r\n}\r\n\r\n.ishow-table__fixed-header-wrapper thead div {\r\n background-color: #eef1f6;\r\n color: #1f2d3d\r\n}\r\n\r\n.ishow-table__fixed-footer-wrapper {\r\n position: absolute;\r\n left: 0;\r\n bottom: 0;\r\n z-index: 3\r\n}\r\n\r\n.ishow-table__fixed-footer-wrapper tbody td {\r\n border-top: 1px solid #dfe6ec;\r\n background-color: #fbfdff;\r\n color: #1f2d3d\r\n}\r\n\r\n.ishow-table__fixed-body-wrapper {\r\n position: absolute;\r\n left: 0;\r\n top: 37px;\r\n overflow: hidden;\r\n z-index: 3\r\n}\r\n\r\n.ishow-table__body-wrapper,\r\n.ishow-table__footer-wrapper,\r\n.ishow-table__header-wrapper {\r\n width: 100%\r\n}\r\n\r\n.ishow-table__footer-wrapper {\r\n margin-top: -1px\r\n}\r\n\r\n.ishow-table__footer-wrapper td {\r\n border-top: 1px solid #dfe6ec\r\n}\r\n\r\n.ishow-table__body,\r\n.ishow-table__footer,\r\n.ishow-table__header {\r\n table-layout: fixed\r\n}\r\n\r\n.ishow-table__footer-wrapper thead div,\r\n.ishow-table__header-wrapper thead div {\r\n background-color: #eef1f6;\r\n color: #1f2d3d\r\n}\r\n\r\n.ishow-table__footer-wrapper tbody td,\r\n.ishow-table__header-wrapper tbody td {\r\n background-color: #fbfdff;\r\n color: #1f2d3d\r\n}\r\n\r\n.ishow-table__body-wrapper {\r\n overflow: auto;\r\n position: relative\r\n}\r\n\r\n.ishow-table--striped .ishow-table__body tr.ishow-table__row--striped td {\r\n background: #FAFAFA;\r\n background-clip: padding-box\r\n}\r\n\r\n.ishow-table--striped .ishow-table__body tr.ishow-table__row--striped.current-row td {\r\n background: #edf7ff\r\n}\r\n\r\n.ishow-table__body tr.hover-row.current-row>td,\r\n.ishow-table__body tr.hover-row.ishow-table__row--striped.current-row>td,\r\n.ishow-table__body tr.hover-row.ishow-table__row--striped>td,\r\n.ishow-table__body tr.hover-row>td {\r\n background-color: #eef1f6\r\n}\r\n\r\n.ishow-table__body tr.current-row>td {\r\n background: #edf7ff\r\n}\r\n\r\n.ishow-table__column-resize-proxy {\r\n position: absolute;\r\n left: 200px;\r\n top: 0;\r\n bottom: 0;\r\n width: 0;\r\n border-left: 1px solid #dfe6ec;\r\n z-index: 10\r\n}\r\n\r\n.ishow-table__column-filter-trigger {\r\n display: inline-block;\r\n line-height: 34px;\r\n margin-left: 5px;\r\n cursor: pointer\r\n}\r\n\r\n.ishow-table__column-filter-trigger i {\r\n color: #97a8be\r\n}\r\n\r\n.ishow-table--enable-row-transition .ishow-table__body td {\r\n -webkit-transition: background-color .25s ease;\r\n -o-transition: background-color .25s ease;\r\n transition: background-color .25s ease\r\n}\r\n\r\n.ishow-table--enable-row-hover .ishow-table__body tr:hover>td {\r\n /* background-color: #eef1f6; */\r\n background-color: #edf7ff;\r\n /* background-color: #fafafa; \u7528\u8fd9\u4e2a\u7684\u8bddhover\u8868\u683c\u884c\u65f6\u989c\u8272\u4f1a\u6de1\u4e00\u70b9*/\r\n background-clip: padding-box\r\n}\r\n\r\n.ishow-table--fluid-height .ishow-table__fixed,\r\n.ishow-table--fluid-height .ishow-table__fixed-right {\r\n bottom: 0;\r\n overflow: hidden\r\n}'],sourceRoot:""}])},427:function(n,e,t){"use strict";function o(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function i(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function r(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}var a=t(0),s=t.n(a),l=t(1),c=t.n(l),p=t(50),d=t(428),u=(t.n(d),function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}()),h=function(n){function e(){return o(this,e),i(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return r(e,n),u(e,[{key:"componentWillUnmount",value:function(){this.enableScroll()}},{key:"getStyle",value:function(){return this.props.fullscreen?(this.disableScroll(),{position:"fixed",top:0,right:0,bottom:0,left:0,zIndex:99999}):(this.enableScroll(),{position:"relative"})}},{key:"documentBody",value:function(){return document.body}},{key:"disableScroll",value:function(){var n=this.documentBody();n&&n.style.setProperty("overflow","hidden")}},{key:"enableScroll",value:function(){var n=this.documentBody();n&&n.style.removeProperty("overflow")}},{key:"render",value:function(){var n=this.props,e=n.loading,t=n.fullscreen,o=n.text;return s.a.createElement("div",{style:this.style(this.getStyle()),className:this.className()},e&&s.a.createElement("div",{style:{display:"block",position:"absolute",zIndex:657,backgroundColor:"rgba(255, 255, 255, 0.901961)",margin:0,top:0,right:0,bottom:0,left:0}},s.a.createElement("div",{className:this.classNames("ishow-loading-spinner",{"is-full-screen":t}),style:{position:"absolute",display:"inline-block",left:0}},s.a.createElement("svg",{className:"circular",viewBox:"25 25 50 50"},s.a.createElement("circle",{className:"path",cx:"50",cy:"50",r:"20",fill:"none"})),o&&s.a.createElement("p",{className:"ishow-loading-text"},o))),this.props.children)}}]),e}(p.b);e.a=h,h.propTypes={loading:c.a.bool,fullscreen:c.a.bool,text:c.a.string},h.defaultProps={loading:!0}},428:function(n,e,t){var o=t(429);"string"===typeof o&&(o=[[n.i,o,""]]);var i={hmr:!1};i.transform=void 0;t(193)(o,i);o.locals&&(n.exports=o.locals)},429:function(n,e,t){e=n.exports=t(192)(!0),e.push([n.i,".ishow-loading-mask{position:absolute;z-index:10000;background-color:hsla(0,0%,100%,.9);margin:0;top:0;right:0;bottom:0;left:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}.ishow-loading-mask.is-fullscreen{position:fixed}.ishow-loading-mask.is-fullscreen .ishow-loading-spinner{margin-top:-25px}.ishow-loading-mask.is-fullscreen .ishow-loading-spinner .circular{width:50px;height:50px}.ishow-loading-spinner{top:50%;margin-top:-21px;width:100%;text-align:center;position:absolute}.ishow-loading-spinner .ishow-loading-text{color:#20a0ff;margin:3px 0;font-size:14px}.ishow-loading-spinner .circular{width:42px;height:42px;-webkit-animation:loading-rotate 2s linear infinite;animation:loading-rotate 2s linear infinite}.ishow-loading-spinner .path{-webkit-animation:loading-dash 1.5s ease-in-out infinite;animation:loading-dash 1.5s ease-in-out infinite;stroke-dasharray:90,150;stroke-dashoffset:0;stroke-width:2;stroke:#20a0ff;stroke-linecap:round}.ishow-loading-fade-enter,.ishow-loading-fade-leave-active{opacity:0}@-webkit-keyframes loading-rotate{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes loading-rotate{to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@-webkit-keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}@keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}","",{version:3,sources:["E:/demo/demo/src/ishow/Common/css/Loading.css"],names:[],mappings:"AACA,oBACI,kBAAmB,AACnB,cAAe,AACf,oCAA0C,AAC1C,SAAU,AACV,MAAO,AACP,QAAS,AACT,SAAU,AACV,OAAQ,AACR,+BAAgC,AAChC,0BAA2B,AAC3B,sBAAuB,CAC1B,AAED,kCACI,cAAe,CAClB,AAED,yDACI,gBAAiB,CACpB,AAED,mEACI,WAAY,AACZ,WAAY,CACf,AAED,uBACI,QAAS,AACT,iBAAkB,AAClB,WAAY,AACZ,kBAAmB,AACnB,iBAAkB,CACrB,AAED,2CACI,cAAe,AACf,aAAc,AACd,cAAe,CAClB,AAED,iCACI,WAAY,AACZ,YAAa,AACb,oDAAqD,AAC7C,2CAA4C,CACvD,AAED,6BACI,yDAA0D,AAClD,iDAAkD,AAC1D,wBAA0B,AAC1B,oBAAqB,AACrB,eAAgB,AAChB,eAAgB,AAChB,oBAAqB,CACxB,AAED,2DAEI,SAAU,CACb,AAED,kCACI,GACI,gCAAkC,AAC1B,uBAAyB,CACpC,CACJ,AAED,0BACI,GACI,gCAAkC,AAC1B,uBAAyB,CACpC,CACJ,AAED,gCACI,GACI,uBAAyB,AACzB,mBAAoB,CACvB,AACD,IACI,wBAA0B,AAC1B,uBAAwB,CAC3B,AACD,GACI,wBAA0B,AAC1B,wBAAyB,CAC5B,CACJ,AAED,wBACI,GACI,uBAAyB,AACzB,mBAAoB,CACvB,AACD,IACI,wBAA0B,AAC1B,uBAAwB,CAC3B,AACD,GACI,wBAA0B,AAC1B,wBAAyB,CAC5B,CACJ",file:"Loading.css",sourcesContent:['@charset "UTF-8";\r\n.ishow-loading-mask {\r\n position: absolute;\r\n z-index: 10000;\r\n background-color: rgba(255, 255, 255, .9);\r\n margin: 0;\r\n top: 0;\r\n right: 0;\r\n bottom: 0;\r\n left: 0;\r\n -webkit-transition: opacity .3s;\r\n -o-transition: opacity .3s;\r\n transition: opacity .3s\r\n}\r\n\r\n.ishow-loading-mask.is-fullscreen {\r\n position: fixed\r\n}\r\n\r\n.ishow-loading-mask.is-fullscreen .ishow-loading-spinner {\r\n margin-top: -25px\r\n}\r\n\r\n.ishow-loading-mask.is-fullscreen .ishow-loading-spinner .circular {\r\n width: 50px;\r\n height: 50px\r\n}\r\n\r\n.ishow-loading-spinner {\r\n top: 50%;\r\n margin-top: -21px;\r\n width: 100%;\r\n text-align: center;\r\n position: absolute\r\n}\r\n\r\n.ishow-loading-spinner .ishow-loading-text {\r\n color: #20a0ff;\r\n margin: 3px 0;\r\n font-size: 14px\r\n}\r\n\r\n.ishow-loading-spinner .circular {\r\n width: 42px;\r\n height: 42px;\r\n -webkit-animation: loading-rotate 2s linear infinite;\r\n animation: loading-rotate 2s linear infinite\r\n}\r\n\r\n.ishow-loading-spinner .path {\r\n -webkit-animation: loading-dash 1.5s ease-in-out infinite;\r\n animation: loading-dash 1.5s ease-in-out infinite;\r\n stroke-dasharray: 90, 150;\r\n stroke-dashoffset: 0;\r\n stroke-width: 2;\r\n stroke: #20a0ff;\r\n stroke-linecap: round\r\n}\r\n\r\n.ishow-loading-fade-enter,\r\n.ishow-loading-fade-leave-active {\r\n opacity: 0\r\n}\r\n\r\n@-webkit-keyframes loading-rotate {\r\n 100% {\r\n -webkit-transform: rotate(360deg);\r\n transform: rotate(360deg)\r\n }\r\n}\r\n\r\n@keyframes loading-rotate {\r\n 100% {\r\n -webkit-transform: rotate(360deg);\r\n transform: rotate(360deg)\r\n }\r\n}\r\n\r\n@-webkit-keyframes loading-dash {\r\n 0% {\r\n stroke-dasharray: 1, 200;\r\n stroke-dashoffset: 0\r\n }\r\n 50% {\r\n stroke-dasharray: 90, 150;\r\n stroke-dashoffset: -40px\r\n }\r\n 100% {\r\n stroke-dasharray: 90, 150;\r\n stroke-dashoffset: -120px\r\n }\r\n}\r\n\r\n@keyframes loading-dash {\r\n 0% {\r\n stroke-dasharray: 1, 200;\r\n stroke-dashoffset: 0\r\n }\r\n 50% {\r\n stroke-dasharray: 90, 150;\r\n stroke-dashoffset: -40px\r\n }\r\n 100% {\r\n stroke-dasharray: 90, 150;\r\n stroke-dashoffset: -120px\r\n }\r\n}'],sourceRoot:""}])},937:function(n,e,t){"use strict";function o(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function i(n,e){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==typeof e&&"function"!==typeof e?n:e}function r(n,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(n,e):n.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var a=t(0),s=t.n(a),l=t(201),c=(t.n(l),t(322)),p=t(427),d=t(222),u=t(242),h=function(){function n(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}return function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}}(),A=function(n){function e(n){o(this,e);var t=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,n));return t.table={columns:[{label:"\u65e5\u671f",prop:"date",width:180},{label:"\u59d3\u540d",prop:"name",width:180},{label:"\u5730\u5740",prop:"address"}],data:[{date:"2016-05-02",name:"iShow UI\u5927\u524d\u7aef--Yuri",address:"\u5357\u4eac\u5e02\u7384\u6b66\u533a699-32\u53f7XX\u5927\u53a6"},{date:"2016-05-04",name:"iShow UI\u5927\u524d\u7aef--Yuri",address:"\u5357\u4eac\u5e02\u7384\u6b66\u533a699-32\u53f7XX\u5927\u53a6"},{date:"2016-05-01",name:"iShow UI\u5927\u524d\u7aef--Yuri",address:"\u5357\u4eac\u5e02\u7384\u6b66\u533a699-32\u53f7XX\u5927\u53a6"},{date:"2016-05-03",name:"iShow UI\u5927\u524d\u7aef--Yuri",address:"\u5357\u4eac\u5e02\u7384\u6b66\u533a699-32\u53f7XX\u5927\u53a6"}]},t}return r(e,n),h(e,[{key:"render",value:function(){return s.a.createElement("div",{className:"App"},s.a.createElement("h1",null,"Loading \u52a0\u8f7d"),s.a.createElement("h3",null,"\u5e38\u7528\u7684\u52a0\u8f7d"),s.a.createElement("div",{style:{marginBottom:20}},s.a.createElement("div",{className:"ishow-loading-demo"},s.a.createElement(p.a,{text:"\u8ba2\u5355\u8d44\u6e90\u786e\u8ba4\u4e2d"},s.a.createElement(c.a,{style:{width:"100%"},columns:this.table.columns,data:this.table.data})))),s.a.createElement(d.a,{name:"Loading",code:"0"}),s.a.createElement(u.a,{name:"Loading"}))}}]),e}(a.Component);e.default=A}});
src/challenges/react/React_32.js
bonham000/fcc-react-tests-module
/* eslint-disable */ import React from 'react' import assert from 'assert' import { transform } from 'babel-standalone' import Enzyme from '../Enzyme'; const shallow = Enzyme.shallow; const mount = Enzyme.mount; const render = Enzyme.render; export const QA = true; // ---------------------------- define challenge title ---------------------------- export const challengeTitle = `<span class = 'default'>Challenge: </span>Pass a Callback as Props` // ---------------------------- challenge text ---------------------------- export const challengeText = `<span class = 'default'>Intro: </span>You can pass <code>state</code> as props to child components, but you're not limited to passing data. You can also pass handler functions or any method that's defined on a React component to a child component. This is how you allow child components to interact with their parent components. You pass methods to a child just like a regular prop. It's assigned a name and you have access to that method name under <code>this.props</code> in the child component.` // ---------------------------- challenge instructions ---------------------------- export const challengeInstructions = `<span class = 'default'>Instructions: </span>There are three components outlined in the code editor. The <code>MyApp</code> component is the parent that will render the <code>GetInput</code> and <code>RenderInput</code> child components. Add the <code>GetInput</code> component to the render method in <code>MyApp</code>, then pass it a prop called <code>input</code> assigned to <code>inputValue</code> from <code>MyApp</code>'s <code>state</code>. Also create a prop called <code>handleInput</code> and pass the input handler <code>handleChange</code> to it. <br><br> Next, add <code>RenderInput</code> to the render method in <code>MyApp</code>, then create a prop called <code>input</code> and pass the <code>inputValue</code> from <code>state</code> to it. Once you are finished you will be able to type in the <code>input</code> field in the <code>GetInput</code> component, which then calls the handler method in its parent via props. This updates the input in the <code>state</code> of the parent, which is passed as props to both children. Observe how the data flows between the components and how the single source of truth remains the <code>state</code> of the parent component. Admittedly, this example is a bit contrived, but should serve to illustrate how data and callbacks can be passed between React components.` // ---------------------------- define challenge seed code ---------------------------- export const seedCode = `class MyApp extends React.Component { constructor(props) { super(props); this.state = { inputValue: '' } } handleChange = (event) => { this.setState({ inputValue: event.target.value }); } render() { return ( <div> { /* change code below this line */ } { /* change code above this line */ } </div> ); } }; class GetInput extends React.Component { constructor(props) { super(props); } render() { return ( <div> <h3>Get Input:</h3> <input value={this.props.input} onChange={this.props.handleInput}/> </div> ); } }; class RenderInput extends React.Component { constructor(props) { super(props); } render() { return ( <div> <h3>Input Render:</h3> <p>{this.props.input}</p> </div> ); } };` // ---------------------------- define challenge solution code ---------------------------- export const solutionCode = `class MyApp extends React.Component { constructor(props) { super(props); this.state = { inputValue: '' } } handleChange = (event) => { this.setState({ inputValue: event.target.value }); } render() { return ( <div> <GetInput input={this.state.inputValue} handleInput={this.handleChange}/> <RenderInput input={this.state.inputValue}/> </div> ); } }; class GetInput extends React.Component { constructor(props) { super(props); } render() { return ( <div> <h3>Get Input:</h3> <input value={this.props.input} onChange={this.props.handleInput}/> </div> ); } }; class RenderInput extends React.Component { constructor(props) { super(props); } render() { return ( <div> <h3>Input Render:</h3> <p>{this.props.input}</p> </div> ); } };` // ---------------------------- define challenge tests ---------------------------- export const executeTests = (code, errorSuppression) => { const error_0 = 'Your JSX code should transpile successfully.'; const error_1 = 'The MyApp component should render.'; const error_2 = 'The GetInput component should render.'; const error_3 = 'The RenderInput component should render.'; const error_4 = 'The GetInput component should receive the MyApp state property inputValue as props and contain an input element which modifies MyApp state.'; const error_5 = 'The RenderInput component should receive the MyApp state property inputValue as props.'; let testResults = [ { test: 0, status: false, condition: error_0 }, { test: 1, status: false, condition: error_1 }, { test: 2, status: false, condition: error_2 }, { test: 3, status: false, condition: error_3 }, { test: 4, status: false, condition: error_4 }, { test: 5, status: false, condition: error_5 } ]; let es5, mockedComponent, passed = true; // this applies an export to the user's code so // we can access their component here for tests const exportScript = '\n export default MyApp' const modifiedCode = code.concat(exportScript); // test 0: try to transpile JSX, ES6 code to ES5 in browser try { es5 = transform(modifiedCode, { presets: [ 'es2015', 'stage-2', 'react' ] }).code; testResults[0].status = true; if (!errorSuppression) console.log('No transpilation errors!'); } catch (err) { passed = false; testResults[0].status = false; if (!errorSuppression) console.error(`Transpilation error: ${err}`); } // now we will try to shallow render the component with Enzyme's shallow method // you can also use mount to perform a full render to the DOM environment // to do this you must import mount above; i.e. import { shallow, mount } from enzyme try { var React = require('react'); mockedComponent = mount(React.createElement(eval(es5))); } catch (err) { passed = false; if (!errorSuppression) console.error(`Invalid React code: ${err}`); } // run specific tests to verify the functionality // that the challenge is trying to assess: // test 1: try { assert.strictEqual(mockedComponent.find('MyApp').length, 1, error_1); testResults[1].status = true; } catch (err) { passed = false; testResults[1].status = false; } // test 2: try { assert.strictEqual(mockedComponent.find('GetInput').length, 1, error_2); testResults[2].status = true; } catch (err) { passed = false; testResults[2].status = false; } // test 3: try { assert.strictEqual(mockedComponent.find('RenderInput').length, 1, error_3); testResults[3].status = true; } catch (err) { passed = false; testResults[3].status = false; } // test 4: try { mockedComponent.setState({inputValue: ''}); const before = mockedComponent.state('inputValue'); mockedComponent.find('input').simulate('change', {target: {value: 'TestInput'}}); const after = mockedComponent.state('inputValue'); assert.strictEqual(before === '' && after === 'TestInput', true, error_4); testResults[4].status = true; } catch (err) { passed = false; testResults[4].status = false; } // test 5: try { mockedComponent.setState({ inputValue: 'TestName' }); assert.strictEqual(mockedComponent.find('p').text().includes('TestName'), true, error_5); testResults[5].status = true; } catch (err) { passed = false; testResults[5].status = false; } return { passed, testResults } } // ---------------------------- define live render function ---------------------------- export const liveRender = (code) => { try { const exportScript = '\n export default MyApp' const modifiedCode = code.concat(exportScript); const es5 = transform(modifiedCode, { presets: [ 'es2015', 'stage-2', 'react' ] }).code; const renderedComponent = React.createElement(eval(es5)); return renderedComponent; } catch (err) { // console.log(`Live rendering failure: ${err}`); } }
ajax/libs/datatables/1.10.6/js/jquery.js
mscharl/cdnjs
/*! 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});
cendari/static/extjs/docs/output/Ext.window.Window.js
CENDARI/editorsnotes
Ext.data.JsonP.Ext_window_Window({"tagname":"class","html":"<div><pre class=\"hierarchy\"><h4>Alternate names</h4><div class='alternate-class-name'>Ext.Window</div><h4>Hierarchy</h4><div class='subclass first-child'><a href='#!/api/Ext.Base' rel='Ext.Base' class='docClass'>Ext.Base</a><div class='subclass '><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='docClass'>Ext.AbstractComponent</a><div class='subclass '><a href='#!/api/Ext.Component' rel='Ext.Component' class='docClass'>Ext.Component</a><div class='subclass '><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='docClass'>Ext.container.AbstractContainer</a><div class='subclass '><a href='#!/api/Ext.container.Container' rel='Ext.container.Container' class='docClass'>Ext.container.Container</a><div class='subclass '><a href='#!/api/Ext.panel.AbstractPanel' rel='Ext.panel.AbstractPanel' class='docClass'>Ext.panel.AbstractPanel</a><div class='subclass '><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='docClass'>Ext.panel.Panel</a><div class='subclass '><strong>Ext.window.Window</strong></div></div></div></div></div></div></div></div><h4>Mixins</h4><div class='dependency'><a href='#!/api/Ext.util.Floating' rel='Ext.util.Floating' class='docClass'>Ext.util.Floating</a></div><div class='dependency'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='docClass'>Ext.util.Observable</a></div><div class='dependency'><a href='#!/api/Ext.util.Animate' rel='Ext.util.Animate' class='docClass'>Ext.util.Animate</a></div><div class='dependency'><a href='#!/api/Ext.state.Stateful' rel='Ext.state.Stateful' class='docClass'>Ext.state.Stateful</a></div><h4>Requires</h4><div class='dependency'><a href='#!/api/Ext.util.ComponentDragger' rel='Ext.util.ComponentDragger' class='docClass'>Ext.util.ComponentDragger</a></div><div class='dependency'><a href='#!/api/Ext.util.Region' rel='Ext.util.Region' class='docClass'>Ext.util.Region</a></div><div class='dependency'><a href='#!/api/Ext.EventManager' rel='Ext.EventManager' class='docClass'>Ext.EventManager</a></div><h4>Files</h4><div class='dependency'><a href='source/Window.html#Ext-window-Window' target='_blank'>Window.js</a></div></pre><div class='doc-contents'><p>A specialized panel intended for use as an application window. Windows are floated, <a href=\"#!/api/Ext.window.Window-cfg-resizable\" rel=\"Ext.window.Window-cfg-resizable\" class=\"docClass\">resizable</a>, and\n<a href=\"#!/api/Ext.window.Window-cfg-draggable\" rel=\"Ext.window.Window-cfg-draggable\" class=\"docClass\">draggable</a> by default. Windows can be <a href=\"#!/api/Ext.window.Window-cfg-maximizable\" rel=\"Ext.window.Window-cfg-maximizable\" class=\"docClass\">maximized</a> to fill the viewport, restored to\ntheir prior size, and can be <a href=\"#!/api/Ext.window.Window-event-minimize\" rel=\"Ext.window.Window-event-minimize\" class=\"docClass\">minimize</a>d.</p>\n\n<p>Windows can also be linked to a <a href=\"#!/api/Ext.ZIndexManager\" rel=\"Ext.ZIndexManager\" class=\"docClass\">Ext.ZIndexManager</a> or managed by the <a href=\"#!/api/Ext.WindowManager\" rel=\"Ext.WindowManager\" class=\"docClass\">Ext.WindowManager</a> to provide\ngrouping, activation, to front, to back and other application-specific behavior.</p>\n\n<p>By default, Windows will be rendered to document.body. To <a href=\"#!/api/Ext.window.Window-cfg-constrain\" rel=\"Ext.window.Window-cfg-constrain\" class=\"docClass\">constrain</a> a Window to another element specify\n<a href=\"#!/api/Ext.Component-cfg-renderTo\" rel=\"Ext.Component-cfg-renderTo\" class=\"docClass\">renderTo</a>.</p>\n\n<p><strong>As with all <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Container</a>s, it is important to consider how you want the Window to size\nand arrange any child Components. Choose an appropriate <a href=\"#!/api/Ext.window.Window-cfg-layout\" rel=\"Ext.window.Window-cfg-layout\" class=\"docClass\">layout</a> configuration which lays out child Components\nin the required manner.</strong></p>\n\n<pre class='inline-example '><code>Ext.create('Ext.window.Window', {\n title: 'Hello',\n height: 200,\n width: 400,\n layout: 'fit',\n items: { // Let's put an empty grid in just to illustrate fit layout\n xtype: 'grid',\n border: false,\n columns: [{header: 'World'}], // One header just for show. There's no data,\n store: Ext.create('Ext.data.ArrayStore', {}) // A dummy empty data store\n }\n}).show();\n</code></pre>\n</div><div class='members'><div id='m-cfg'><div class='definedBy'>Defined By</div><h3 class='members-title'>Config options</h3><div class='subsection'><div id='cfg-activeItem' class='member first-child inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-cfg-activeItem' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-cfg-activeItem' class='name expandable'>activeItem</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></span></div><div class='description'><div class='short'>A string component id or the numeric index of the component that should be initially activated within the\ncontainer's...</div><div class='long'><p>A string component id or the numeric index of the component that should be initially activated within the\ncontainer's layout on render. For example, activeItem: 'item-1' or activeItem: 0 (index 0 = the first\nitem in the container's collection). activeItem only applies to layout styles that can display\nitems one at a time (like <a href=\"#!/api/Ext.layout.container.Card\" rel=\"Ext.layout.container.Card\" class=\"docClass\">Ext.layout.container.Card</a> and <a href=\"#!/api/Ext.layout.container.Fit\" rel=\"Ext.layout.container.Fit\" class=\"docClass\">Ext.layout.container.Fit</a>).</p>\n</div></div></div><div id='cfg-animCollapse' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-animCollapse' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-animCollapse' class='name expandable'>animCollapse</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>true to animate the transition when the panel is collapsed, false to skip the animation (defaults to true\nif the Ext....</div><div class='long'><p><code>true</code> to animate the transition when the panel is collapsed, <code>false</code> to skip the animation (defaults to <code>true</code>\nif the <a href=\"#!/api/Ext.fx.Anim\" rel=\"Ext.fx.Anim\" class=\"docClass\">Ext.fx.Anim</a> class is available, otherwise <code>false</code>). May also be specified as the animation\nduration in milliseconds.</p>\n</div></div></div><div id='cfg-animateTarget' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-animateTarget' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-animateTarget' class='name expandable'>animateTarget</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a></span></div><div class='description'><div class='short'>Id or element from which the window should animate while opening. ...</div><div class='long'><p>Id or element from which the window should animate while opening.</p>\n<p>Defaults to: <code>null</code></p></div></div></div><div id='cfg-autoDestroy' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-cfg-autoDestroy' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-cfg-autoDestroy' class='name expandable'>autoDestroy</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>If true the container will automatically destroy any contained component that is removed from it, else\ndestruction mu...</div><div class='long'><p>If true the container will automatically destroy any contained component that is removed from it, else\ndestruction must be handled manually.\nDefaults to true.</p>\n<p>Defaults to: <code>true</code></p></div></div></div><div id='cfg-autoEl' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-autoEl' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-autoEl' class='name expandable'>autoEl</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span></div><div class='description'><div class='short'>A tag name or DomHelper spec used to create the Element which will\nencapsulate this Component. ...</div><div class='long'><p>A tag name or <a href=\"#!/api/Ext.DomHelper\" rel=\"Ext.DomHelper\" class=\"docClass\">DomHelper</a> spec used to create the <a href=\"#!/api/Ext.AbstractComponent-method-getEl\" rel=\"Ext.AbstractComponent-method-getEl\" class=\"docClass\">Element</a> which will\nencapsulate this Component.</p>\n\n<p>You do not normally need to specify this. For the base classes <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> and\n<a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a>, this defaults to <strong>'div'</strong>. The more complex Sencha classes use a more\ncomplex DOM structure specified by their own <a href=\"#!/api/Ext.AbstractComponent-cfg-renderTpl\" rel=\"Ext.AbstractComponent-cfg-renderTpl\" class=\"docClass\">renderTpl</a>s.</p>\n\n<p>This is intended to allow the developer to create application-specific utility Components encapsulated by\ndifferent DOM elements. Example usage:</p>\n\n<pre><code>{\n xtype: 'component',\n autoEl: {\n tag: 'img',\n src: 'http://www.example.com/example.jpg'\n }\n}, {\n xtype: 'component',\n autoEl: {\n tag: 'blockquote',\n html: 'autoEl is cool!'\n }\n}, {\n xtype: 'container',\n autoEl: 'ul',\n cls: 'ux-unordered-list',\n items: {\n xtype: 'component',\n autoEl: 'li',\n html: 'First list item'\n }\n}\n</code></pre>\n</div></div></div><div id='cfg-autoRender' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-autoRender' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-autoRender' class='name expandable'>autoRender</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/HTMLElement/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a></span></div><div class='description'><div class='short'>This config is intended mainly for non-floating Components which may or may not be shown. ...</div><div class='long'><p>This config is intended mainly for non-<a href=\"#!/api/Ext.AbstractComponent-cfg-floating\" rel=\"Ext.AbstractComponent-cfg-floating\" class=\"docClass\">floating</a> Components which may or may not be shown. Instead of using\n<a href=\"#!/api/Ext.AbstractComponent-cfg-renderTo\" rel=\"Ext.AbstractComponent-cfg-renderTo\" class=\"docClass\">renderTo</a> in the configuration, and rendering upon construction, this allows a Component to render itself\nupon first <em><a href=\"#!/api/Ext.AbstractComponent-event-show\" rel=\"Ext.AbstractComponent-event-show\" class=\"docClass\">show</a></em>. If <a href=\"#!/api/Ext.AbstractComponent-cfg-floating\" rel=\"Ext.AbstractComponent-cfg-floating\" class=\"docClass\">floating</a> is true, the value of this config is omited as if it is <code>true</code>.</p>\n\n<p>Specify as <code>true</code> to have this Component render to the document body upon first show.</p>\n\n<p>Specify as an element, or the ID of an element to have this Component render to a specific element upon first\nshow.</p>\n\n<p><strong>This defaults to <code>true</code> for the <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Window</a> class.</strong></p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-autoScroll' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-cfg-autoScroll' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-cfg-autoScroll' class='name expandable'>autoScroll</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>true to use overflow:'auto' on the components layout element and show scroll bars automatically when necessary,\nfalse...</div><div class='long'><p><code>true</code> to use overflow:'auto' on the components layout element and show scroll bars automatically when necessary,\n<code>false</code> to clip any overflowing content.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-autoShow' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-autoShow' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-autoShow' class='name expandable'>autoShow</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to automatically show the component upon creation. ...</div><div class='long'><p>True to automatically show the component upon creation. This config option may only be used for\n<a href=\"#!/api/Ext.AbstractComponent-cfg-floating\" rel=\"Ext.AbstractComponent-cfg-floating\" class=\"docClass\">floating</a> components or components that use <a href=\"#!/api/Ext.AbstractComponent-cfg-autoRender\" rel=\"Ext.AbstractComponent-cfg-autoRender\" class=\"docClass\">autoRender</a>. Defaults to false.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-baseCls' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-baseCls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-baseCls' class='name expandable'>baseCls</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>The base CSS class to apply to this panel's element. ...</div><div class='long'><p>The base CSS class to apply to this panel's element.</p>\n<p>Defaults to: <code>&quot;x-window&quot;</code></p></div></div></div><div id='cfg-bbar' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-bbar' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-bbar' class='name expandable'>bbar</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[]</span></div><div class='description'><div class='short'>Convenience config. ...</div><div class='long'><p>Convenience config. Short for 'Bottom Bar'.</p>\n\n<pre><code>bbar: [\n { xtype: 'button', text: 'Button 1' }\n]\n</code></pre>\n\n<p>is equivalent to</p>\n\n<pre><code>dockedItems: [{\n xtype: 'toolbar',\n dock: 'bottom',\n items: [\n { xtype: 'button', text: 'Button 1' }\n ]\n}]\n</code></pre>\n</div></div></div><div id='cfg-bodyBorder' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.AbstractPanel' rel='Ext.panel.AbstractPanel' class='definedIn docClass'>Ext.panel.AbstractPanel</a><br/><a href='source/AbstractPanel.html#Ext-panel-AbstractPanel-cfg-bodyBorder' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.AbstractPanel-cfg-bodyBorder' class='name expandable'>bodyBorder</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>A shortcut to add or remove the border on the body of a panel. ...</div><div class='long'><p>A shortcut to add or remove the border on the body of a panel. This only applies to a panel\nwhich has the <a href=\"#!/api/Ext.panel.AbstractPanel-cfg-frame\" rel=\"Ext.panel.AbstractPanel-cfg-frame\" class=\"docClass\">frame</a> configuration set to <code>true</code>.</p>\n</div></div></div><div id='cfg-bodyCls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.AbstractPanel' rel='Ext.panel.AbstractPanel' class='definedIn docClass'>Ext.panel.AbstractPanel</a><br/><a href='source/AbstractPanel.html#Ext-panel-AbstractPanel-cfg-bodyCls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.AbstractPanel-cfg-bodyCls' class='name expandable'>bodyCls</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[]</span></div><div class='description'><div class='short'>A CSS class, space-delimited string of classes, or array of classes to be applied to the panel's body element. ...</div><div class='long'><p>A CSS class, space-delimited string of classes, or array of classes to be applied to the panel's body element.\nThe following examples are all valid:</p>\n\n<pre><code>bodyCls: 'foo'\nbodyCls: 'foo bar'\nbodyCls: ['foo', 'bar']\n</code></pre>\n\n</div></div></div><div id='cfg-bodyPadding' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.AbstractPanel' rel='Ext.panel.AbstractPanel' class='definedIn docClass'>Ext.panel.AbstractPanel</a><br/><a href='source/AbstractPanel.html#Ext-panel-AbstractPanel-cfg-bodyPadding' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.AbstractPanel-cfg-bodyPadding' class='name expandable'>bodyPadding</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>A shortcut for setting a padding style on the body element. ...</div><div class='long'><p>A shortcut for setting a padding style on the body element. The value can either be\na number to be applied to all sides, or a normal css string describing padding.</p>\n</div></div></div><div id='cfg-bodyStyle' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.AbstractPanel' rel='Ext.panel.AbstractPanel' class='definedIn docClass'>Ext.panel.AbstractPanel</a><br/><a href='source/AbstractPanel.html#Ext-panel-AbstractPanel-cfg-bodyStyle' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.AbstractPanel-cfg-bodyStyle' class='name expandable'>bodyStyle</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a></span></div><div class='description'><div class='short'>Custom CSS styles to be applied to the panel's body element, which can be supplied as a valid CSS style string,\nan ob...</div><div class='long'><p>Custom CSS styles to be applied to the panel's body element, which can be supplied as a valid CSS style string,\nan object containing style property name/value pairs or a function that returns such a string or object.\nFor example, these two formats are interpreted to be equivalent:</p>\n\n<pre><code>bodyStyle: 'background:#ffc; padding:10px;'\n\nbodyStyle: {\n background: '#ffc',\n padding: '10px'\n}\n</code></pre>\n\n</div></div></div><div id='cfg-border' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-border' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-border' class='name expandable'>border</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>Specifies the border for this component. ...</div><div class='long'><p>Specifies the border for this component. The border can be a single numeric value to apply to all sides or it can\nbe a CSS style specification for each style, for example: '10 5 3 10'.</p>\n</div></div></div><div id='cfg-bubbleEvents' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-cfg-bubbleEvents' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-cfg-bubbleEvents' class='name expandable'>bubbleEvents</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[]</span></div><div class='description'><div class='short'>An array of events that, when fired, should be bubbled to any parent container. ...</div><div class='long'><p>An array of events that, when fired, should be bubbled to any parent container.\nSee <a href=\"#!/api/Ext.util.Observable-method-enableBubble\" rel=\"Ext.util.Observable-method-enableBubble\" class=\"docClass\">Ext.util.Observable.enableBubble</a>.\nDefaults to <code>['add', 'remove']</code>.\n\n<p>Defaults to: <code>[&quot;add&quot;, &quot;remove&quot;]</code></p></div></div></div><div id='cfg-buttonAlign' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-buttonAlign' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-buttonAlign' class='name expandable'>buttonAlign</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>The alignment of any buttons added to this panel. ...</div><div class='long'><p>The alignment of any buttons added to this panel. Valid values are 'right', 'left' and 'center' (defaults to\n'right' for buttons/fbar, 'left' for other toolbar types).</p>\n\n<p><strong>NOTE:</strong> The prefered way to specify toolbars is to use the dockedItems config. Instead of buttonAlign you\nwould add the layout: { pack: 'start' | 'center' | 'end' } option to the dockedItem config.</p>\n</div></div></div><div id='cfg-buttons' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-buttons' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-buttons' class='name expandable'>buttons</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[]</span></div><div class='description'><div class='short'>Convenience config used for adding buttons docked to the bottom of the panel. ...</div><div class='long'><p>Convenience config used for adding buttons docked to the bottom of the panel. This is a\nsynonym for the <a href=\"#!/api/Ext.panel.Panel-cfg-fbar\" rel=\"Ext.panel.Panel-cfg-fbar\" class=\"docClass\">fbar</a> config.</p>\n\n<pre><code>buttons: [\n { text: 'Button 1' }\n]\n</code></pre>\n\n<p>is equivalent to</p>\n\n<pre><code>dockedItems: [{\n xtype: 'toolbar',\n dock: 'bottom',\n ui: 'footer',\n defaults: {minWidth: <a href=\"#!/api/Ext.panel.Panel-cfg-minButtonWidth\" rel=\"Ext.panel.Panel-cfg-minButtonWidth\" class=\"docClass\">minButtonWidth</a>},\n items: [\n { xtype: 'component', flex: 1 },\n { xtype: 'button', text: 'Button 1' }\n ]\n}]\n</code></pre>\n\n<p>The <a href=\"#!/api/Ext.panel.Panel-cfg-minButtonWidth\" rel=\"Ext.panel.Panel-cfg-minButtonWidth\" class=\"docClass\">minButtonWidth</a> is used as the default <a href=\"#!/api/Ext.button.Button-cfg-minWidth\" rel=\"Ext.button.Button-cfg-minWidth\" class=\"docClass\">minWidth</a> for\neach of the buttons in the buttons toolbar.</p>\n</div></div></div><div id='cfg-childEls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-childEls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-childEls' class='name expandable'>childEls</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[]</span></div><div class='description'><div class='short'>An array describing the child elements of the Component. ...</div><div class='long'><p>An array describing the child elements of the Component. Each member of the array\nis an object with these properties:</p>\n\n<ul>\n<li><code>name</code> - The property name on the Component for the child element.</li>\n<li><code>itemId</code> - The id to combine with the Component's id that is the id of the child element.</li>\n<li><code>id</code> - The id of the child element.</li>\n</ul>\n\n\n<p>If the array member is a string, it is equivalent to <code>{ name: m, itemId: m }</code>.</p>\n\n<p>For example, a Component which renders a title and body text:</p>\n\n<pre><code>Ext.create('Ext.Component', {\n renderTo: Ext.getBody(),\n renderTpl: [\n '&lt;h1 id=\"{id}-title\"&gt;{title}&lt;/h1&gt;',\n '&lt;p&gt;{msg}&lt;/p&gt;',\n ],\n renderData: {\n title: \"Error\",\n msg: \"Something went wrong\"\n },\n childEls: [\"title\"],\n listeners: {\n afterrender: function(cmp){\n // After rendering the component will have a title property\n cmp.title.setStyle({color: \"red\"});\n }\n }\n});\n</code></pre>\n\n<p>A more flexible, but somewhat slower, approach is <a href=\"#!/api/Ext.AbstractComponent-cfg-renderSelectors\" rel=\"Ext.AbstractComponent-cfg-renderSelectors\" class=\"docClass\">renderSelectors</a>.</p>\n</div></div></div><div id='cfg-closable' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-closable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-closable' class='name expandable'>closable</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to display the 'close' tool button and allow the user to close the window, false to hide the button and\ndisallow...</div><div class='long'><p>True to display the 'close' tool button and allow the user to close the window, false to hide the button and\ndisallow closing the window.</p>\n\n<p>By default, when close is requested by either clicking the close button in the header or pressing ESC when the\nWindow has focus, the <a href=\"#!/api/Ext.window.Window-method-close\" rel=\"Ext.window.Window-method-close\" class=\"docClass\">close</a> method will be called. This will <em><a href=\"#!/api/Ext.Component-event-destroy\" rel=\"Ext.Component-event-destroy\" class=\"docClass\">destroy</a></em> the\nWindow and its content meaning that it may not be reused.</p>\n\n<p>To make closing a Window <em>hide</em> the Window so that it may be reused, set <a href=\"#!/api/Ext.window.Window-cfg-closeAction\" rel=\"Ext.window.Window-cfg-closeAction\" class=\"docClass\">closeAction</a> to 'hide'.</p>\n<p>Defaults to: <code>true</code></p></div></div></div><div id='cfg-closeAction' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-closeAction' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-closeAction' class='name expandable'>closeAction</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>The action to take when the close header tool is clicked:\n\n\n'destroy' :\n\nremove the window from the DOM and destroy i...</div><div class='long'><p>The action to take when the close header tool is clicked:</p>\n\n<ul>\n<li><p><strong><code>'<a href=\"#!/api/Ext.panel.Panel-event-destroy\" rel=\"Ext.panel.Panel-event-destroy\" class=\"docClass\">destroy</a>'</code></strong> :</p>\n\n<p><a href=\"#!/api/Ext.panel.Panel-event-destroy\" rel=\"Ext.panel.Panel-event-destroy\" class=\"docClass\">remove</a> the window from the DOM and <a href=\"#!/api/Ext.Component-event-destroy\" rel=\"Ext.Component-event-destroy\" class=\"docClass\">destroy</a> it and all descendant\nComponents. The window will <strong>not</strong> be available to be redisplayed via the <a href=\"#!/api/Ext.panel.Panel-event-show\" rel=\"Ext.panel.Panel-event-show\" class=\"docClass\">show</a> method.</p></li>\n<li><p><strong><code>'<a href=\"#!/api/Ext.panel.Panel-event-hide\" rel=\"Ext.panel.Panel-event-hide\" class=\"docClass\">hide</a>'</code></strong> :</p>\n\n<p><a href=\"#!/api/Ext.panel.Panel-event-hide\" rel=\"Ext.panel.Panel-event-hide\" class=\"docClass\">hide</a> the window by setting visibility to hidden and applying negative offsets. The window will be\navailable to be redisplayed via the <a href=\"#!/api/Ext.panel.Panel-event-show\" rel=\"Ext.panel.Panel-event-show\" class=\"docClass\">show</a> method.</p></li>\n</ul>\n\n\n<p><strong>Note:</strong> This behavior has changed! setting <em>does</em> affect the <a href=\"#!/api/Ext.panel.Panel-method-close\" rel=\"Ext.panel.Panel-method-close\" class=\"docClass\">close</a> method which will invoke the\napproriate closeAction.</p>\n<p>Defaults to: <code>&quot;destroy&quot;</code></p></div></div></div><div id='cfg-cls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-cls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-cls' class='name expandable'>cls</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>An optional extra CSS class that will be added to this component's Element. ...</div><div class='long'><p>An optional extra CSS class that will be added to this component's Element. This can be useful\nfor adding customized styles to the component or any of its children using standard CSS rules.</p>\n<p>Defaults to: <code>&quot;&quot;</code></p></div></div></div><div id='cfg-collapseDirection' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-collapseDirection' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-collapseDirection' class='name expandable'>collapseDirection</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>The direction to collapse the Panel when the toggle button is clicked. ...</div><div class='long'><p>The direction to collapse the Panel when the toggle button is clicked.</p>\n\n<p>Defaults to the <a href=\"#!/api/Ext.panel.Panel-cfg-headerPosition\" rel=\"Ext.panel.Panel-cfg-headerPosition\" class=\"docClass\">headerPosition</a></p>\n\n<p><strong>Important: This config is <em>ignored</em> for <a href=\"#!/api/Ext.panel.Panel-cfg-collapsible\" rel=\"Ext.panel.Panel-cfg-collapsible\" class=\"docClass\">collapsible</a> Panels which are direct child items of a <a href=\"#!/api/Ext.layout.container.Border\" rel=\"Ext.layout.container.Border\" class=\"docClass\">border layout</a>.</strong></p>\n\n<p>Specify as <code>'top'</code>, <code>'bottom'</code>, <code>'left'</code> or <code>'right'</code>.</p>\n</div></div></div><div id='cfg-collapseFirst' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-collapseFirst' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-collapseFirst' class='name expandable'>collapseFirst</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>true to make sure the collapse/expand toggle button always renders first (to the left of) any other tools in\nthe pane...</div><div class='long'><p><code>true</code> to make sure the collapse/expand toggle button always renders first (to the left of) any other tools in\nthe panel's title bar, <code>false</code> to render it last.</p>\n<p>Defaults to: <code>true</code></p></div></div></div><div id='cfg-collapseMode' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-collapseMode' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-collapseMode' class='name expandable'>collapseMode</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>Important: this config is only effective for collapsible Panels which are direct child items of a\nborder layout. ...</div><div class='long'><p><strong>Important: this config is only effective for <a href=\"#!/api/Ext.panel.Panel-cfg-collapsible\" rel=\"Ext.panel.Panel-cfg-collapsible\" class=\"docClass\">collapsible</a> Panels which are direct child items of a\n<a href=\"#!/api/Ext.layout.container.Border\" rel=\"Ext.layout.container.Border\" class=\"docClass\">border layout</a>.</strong></p>\n\n<p>When <em>not</em> a direct child item of a <a href=\"#!/api/Ext.layout.container.Border\" rel=\"Ext.layout.container.Border\" class=\"docClass\">border layout</a>, then the Panel's header\nremains visible, and the body is collapsed to zero dimensions. If the Panel has no header, then a new header\n(orientated correctly depending on the <a href=\"#!/api/Ext.panel.Panel-cfg-collapseDirection\" rel=\"Ext.panel.Panel-cfg-collapseDirection\" class=\"docClass\">collapseDirection</a>) will be inserted to show a the title and a re-\nexpand tool.</p>\n\n<p>When a child item of a <a href=\"#!/api/Ext.layout.container.Border\" rel=\"Ext.layout.container.Border\" class=\"docClass\">border layout</a>, this config has two options:</p>\n\n<ul>\n<li><p><strong><code>undefined/omitted</code></strong></p>\n\n<p>When collapsed, a placeholder <a href=\"#!/api/Ext.panel.Header\" rel=\"Ext.panel.Header\" class=\"docClass\">Header</a> is injected into the layout to represent the Panel\nand to provide a UI with a Tool to allow the user to re-expand the Panel.</p></li>\n<li><p><strong><code>header</code></strong> :</p>\n\n<p>The Panel collapses to leave its header visible as when not inside a <a href=\"#!/api/Ext.layout.container.Border\" rel=\"Ext.layout.container.Border\" class=\"docClass\">border\nlayout</a>.</p></li>\n</ul>\n\n</div></div></div><div id='cfg-collapsed' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-collapsed' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-collapsed' class='name expandable'>collapsed</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to render the window collapsed, false to render it expanded. ...</div><div class='long'><p>True to render the window collapsed, false to render it expanded. Note that if <a href=\"#!/api/Ext.window.Window-cfg-expandOnShow\" rel=\"Ext.window.Window-cfg-expandOnShow\" class=\"docClass\">expandOnShow</a>\nis true (the default) it will override the <code>collapsed</code> config and the window will always be\nexpanded when shown.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-collapsedCls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-collapsedCls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-collapsedCls' class='name expandable'>collapsedCls</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>A CSS class to add to the panel's element after it has been collapsed. ...</div><div class='long'><p>A CSS class to add to the panel's element after it has been collapsed.</p>\n<p>Defaults to: <code>&quot;collapsed&quot;</code></p></div></div></div><div id='cfg-collapsible' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-collapsible' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-collapsible' class='name expandable'>collapsible</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to make the panel collapsible and have an expand/collapse toggle Tool added into the header tool button\narea. ...</div><div class='long'><p>True to make the panel collapsible and have an expand/collapse toggle Tool added into the header tool button\narea. False to keep the panel sized either statically, or by an owning layout manager, with no toggle Tool.</p>\n\n<p>See <a href=\"#!/api/Ext.panel.Panel-cfg-collapseMode\" rel=\"Ext.panel.Panel-cfg-collapseMode\" class=\"docClass\">collapseMode</a> and <a href=\"#!/api/Ext.panel.Panel-cfg-collapseDirection\" rel=\"Ext.panel.Panel-cfg-collapseDirection\" class=\"docClass\">collapseDirection</a></p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-componentCls' class='member inherited'><a href='#' class='side not-expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-componentCls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-componentCls' class='name not-expandable'>componentCls</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'><p>CSS Class to be added to a components root level element to give distinction to it via styling.</p>\n</div><div class='long'><p>CSS Class to be added to a components root level element to give distinction to it via styling.</p>\n</div></div></div><div id='cfg-componentLayout' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-componentLayout' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-componentLayout' class='name expandable'>componentLayout</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span></div><div class='description'><div class='short'>The sizing and positioning of a Component's internal Elements is the responsibility of the Component's layout\nmanager...</div><div class='long'><p>The sizing and positioning of a Component's internal Elements is the responsibility of the Component's layout\nmanager which sizes a Component's internal structure in response to the Component being sized.</p>\n\n<p>Generally, developers will not use this configuration as all provided Components which need their internal\nelements sizing (Such as <a href=\"#!/api/Ext.form.field.Base\" rel=\"Ext.form.field.Base\" class=\"docClass\">input fields</a>) come with their own componentLayout managers.</p>\n\n<p>The <a href=\"#!/api/Ext.layout.container.Auto\" rel=\"Ext.layout.container.Auto\" class=\"docClass\">default layout manager</a> will be used on instances of the base <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>\nclass which simply sizes the Component's encapsulating element to the height and width specified in the\n<a href=\"#!/api/Ext.AbstractComponent-method-setSize\" rel=\"Ext.AbstractComponent-method-setSize\" class=\"docClass\">setSize</a> method.</p>\n</div></div></div><div id='cfg-constrain' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-constrain' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-constrain' class='name expandable'>constrain</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to constrain the window within its containing element, false to allow it to fall outside of its containing\nelement. ...</div><div class='long'><p>True to constrain the window within its containing element, false to allow it to fall outside of its containing\nelement. By default the window will be rendered to document.body. To render and constrain the window within\nanother element specify <a href=\"#!/api/Ext.window.Window-cfg-renderTo\" rel=\"Ext.window.Window-cfg-renderTo\" class=\"docClass\">renderTo</a>. Optionally the header only can be constrained\nusing <a href=\"#!/api/Ext.window.Window-cfg-constrainHeader\" rel=\"Ext.window.Window-cfg-constrainHeader\" class=\"docClass\">constrainHeader</a>.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-constrainHeader' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-constrainHeader' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-constrainHeader' class='name expandable'>constrainHeader</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to constrain the window header within its containing element (allowing the window body to fall outside of\nits co...</div><div class='long'><p>True to constrain the window header within its containing element (allowing the window body to fall outside of\nits containing element) or false to allow the header to fall outside its containing element.\nOptionally the entire window can be constrained using <a href=\"#!/api/Ext.window.Window-cfg-constrain\" rel=\"Ext.window.Window-cfg-constrain\" class=\"docClass\">constrain</a>.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-contentEl' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-contentEl' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-contentEl' class='name expandable'>contentEl</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>Specify an existing HTML element, or the id of an existing HTML element to use as the content for this component. ...</div><div class='long'><p>Specify an existing HTML element, or the <code>id</code> of an existing HTML element to use as the content for this component.</p>\n\n<p>This config option is used to take an existing HTML element and place it in the layout element of a new component\n(it simply moves the specified DOM element <em>after the Component is rendered</em> to use as the content.</p>\n\n<p><strong>Notes:</strong></p>\n\n<p>The specified HTML element is appended to the layout element of the component <em>after any configured\n<a href=\"#!/api/Ext.AbstractComponent-cfg-html\" rel=\"Ext.AbstractComponent-cfg-html\" class=\"docClass\">HTML</a> has been inserted</em>, and so the document will not contain this element at the time\nthe <a href=\"#!/api/Ext.AbstractComponent-event-render\" rel=\"Ext.AbstractComponent-event-render\" class=\"docClass\">render</a> event is fired.</p>\n\n<p>The specified HTML element used will not participate in any <strong><code><a href=\"#!/api/Ext.container.Container-cfg-layout\" rel=\"Ext.container.Container-cfg-layout\" class=\"docClass\">layout</a></code></strong>\nscheme that the Component may use. It is just HTML. Layouts operate on child\n<strong><code><a href=\"#!/api/Ext.container.Container-cfg-items\" rel=\"Ext.container.Container-cfg-items\" class=\"docClass\">items</a></code></strong>.</p>\n\n<p>Add either the <code>x-hidden</code> or the <code>x-hide-display</code> CSS class to prevent a brief flicker of the content before it\nis rendered to the panel.</p>\n</div></div></div><div id='cfg-data' class='member inherited'><a href='#' class='side not-expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-data' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-data' class='name not-expandable'>data</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span></div><div class='description'><div class='short'><p>The initial set of data to apply to the <code><a href=\"#!/api/Ext.AbstractComponent-cfg-tpl\" rel=\"Ext.AbstractComponent-cfg-tpl\" class=\"docClass\">tpl</a></code> to update the content area of the Component.</p>\n</div><div class='long'><p>The initial set of data to apply to the <code><a href=\"#!/api/Ext.AbstractComponent-cfg-tpl\" rel=\"Ext.AbstractComponent-cfg-tpl\" class=\"docClass\">tpl</a></code> to update the content area of the Component.</p>\n</div></div></div><div id='cfg-defaultDockWeights' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.AbstractPanel' rel='Ext.panel.AbstractPanel' class='definedIn docClass'>Ext.panel.AbstractPanel</a><br/><a href='source/AbstractPanel.html#Ext-panel-AbstractPanel-cfg-defaultDockWeights' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.AbstractPanel-cfg-defaultDockWeights' class='name expandable'>defaultDockWeights</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span></div><div class='description'><div class='short'>This object holds the default weights applied to dockedItems that have no weight. ...</div><div class='long'><p>This object holds the default weights applied to dockedItems that have no weight. These start with a\nweight of 1, to allow negative weights to insert before top items and are odd numbers\nso that even weights can be used to get between different dock orders.</p>\n\n<p>To make default docking order match border layout, do this:</p>\n\n<pre><code>Ext.panel.AbstractPanel.prototype.defaultDockWeights = { top: 1, bottom: 3, left: 5, right: 7 };</code></pre>\n\n\n<p>Changing these defaults as above or individually on this object will effect all Panels.\nTo change the defaults on a single panel, you should replace the entire object:</p>\n\n<pre><code>initComponent: function () {\n // NOTE: Don't change members of defaultDockWeights since the object is shared.\n this.defaultDockWeights = { top: 1, bottom: 3, left: 5, right: 7 };\n\n this.callParent();\n}</code></pre>\n\n\n<p>To change only one of the default values, you do this:</p>\n\n<pre><code>initComponent: function () {\n // NOTE: Don't change members of defaultDockWeights since the object is shared.\n this.defaultDockWeights = Ext.applyIf({ top: 10 }, this.defaultDockWeights);\n\n this.callParent();\n}</code></pre>\n\n<p>Defaults to: <code>{top: 1, left: 3, right: 5, bottom: 7}</code></p></div></div></div><div id='cfg-defaultFocus' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-defaultFocus' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-defaultFocus' class='name expandable'>defaultFocus</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>/<a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span></div><div class='description'><div class='short'>Specifies a Component to receive focus when this Window is focused. ...</div><div class='long'><p>Specifies a Component to receive focus when this Window is focused.</p>\n\n<p>This may be one of:</p>\n\n<ul>\n<li>The index of a footer Button.</li>\n<li>The id or <a href=\"#!/api/Ext.AbstractComponent-cfg-itemId\" rel=\"Ext.AbstractComponent-cfg-itemId\" class=\"docClass\">Ext.AbstractComponent.itemId</a> of a descendant Component.</li>\n<li>A Component.</li>\n</ul>\n\n</div></div></div><div id='cfg-defaultType' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-cfg-defaultType' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-cfg-defaultType' class='name expandable'>defaultType</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>The default xtype of child Components to create in this Container when\na child item is specified as a raw configurati...</div><div class='long'><p>The default <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">xtype</a> of child Components to create in this Container when\na child item is specified as a raw configuration object, rather than as an instantiated Component.</p>\n\n\n<p>Defaults to <code>'panel'</code>.</p>\n\n<p>Defaults to: <code>&quot;panel&quot;</code></p></div></div></div><div id='cfg-defaults' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-cfg-defaults' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-cfg-defaults' class='name expandable'>defaults</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a></span></div><div class='description'><div class='short'>This option is a means of applying default settings to all added items whether added through the items\nconfig or via ...</div><div class='long'><p>This option is a means of applying default settings to all added items whether added through the <a href=\"#!/api/Ext.container.AbstractContainer-cfg-items\" rel=\"Ext.container.AbstractContainer-cfg-items\" class=\"docClass\">items</a>\nconfig or via the <a href=\"#!/api/Ext.container.AbstractContainer-event-add\" rel=\"Ext.container.AbstractContainer-event-add\" class=\"docClass\">add</a> or <a href=\"#!/api/Ext.container.AbstractContainer-method-insert\" rel=\"Ext.container.AbstractContainer-method-insert\" class=\"docClass\">insert</a> methods.</p>\n\n<p>Defaults are applied to both config objects and instantiated components conditionally so as not to override\nexisting properties in the item (see <a href=\"#!/api/Ext-method-applyIf\" rel=\"Ext-method-applyIf\" class=\"docClass\">Ext.applyIf</a>).</p>\n\n<p>If the defaults option is specified as a function, then the function will be called using this Container as the\nscope (<code>this</code> reference) and passing the added item as the first parameter. Any resulting object\nfrom that call is then applied to the item as default properties.</p>\n\n<p>For example, to automatically apply padding to the body of each of a set of\ncontained <a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a> items, you could pass: <code>defaults: {bodyStyle:'padding:15px'}</code>.</p>\n\n<p>Usage:</p>\n\n<pre><code>defaults: { // defaults are applied to items, not the container\n autoScroll: true\n},\nitems: [\n // default will not be applied here, panel1 will be autoScroll: false\n {\n xtype: 'panel',\n id: 'panel1',\n autoScroll: false\n },\n // this component will have autoScroll: true\n new Ext.panel.Panel({\n id: 'panel2'\n })\n]\n</code></pre>\n</div></div></div><div id='cfg-disabled' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-disabled' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-disabled' class='name expandable'>disabled</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to disable the component. ...</div><div class='long'><p>True to disable the component.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-disabledCls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-disabledCls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-disabledCls' class='name expandable'>disabledCls</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>CSS class to add when the Component is disabled. ...</div><div class='long'><p>CSS class to add when the Component is disabled. Defaults to 'x-item-disabled'.</p>\n<p>Defaults to: <code>&quot;x-item-disabled&quot;</code></p></div></div></div><div id='cfg-dockedItems' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-dockedItems' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-dockedItems' class='name expandable'>dockedItems</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[]</span></div><div class='description'><div class='short'>A component or series of components to be added as docked items to this panel. ...</div><div class='long'><p>A component or series of components to be added as docked items to this panel. The docked items can be docked to\neither the top, right, left or bottom of a panel. This is typically used for things like toolbars or tab bars:</p>\n\n<pre><code>var panel = new Ext.panel.Panel({\n dockedItems: [{\n xtype: 'toolbar',\n dock: 'top',\n items: [{\n text: 'Docked to the top'\n }]\n }]\n});\n</code></pre>\n</div></div></div><div id='cfg-draggable' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-draggable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-draggable' class='name expandable'>draggable</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to allow the window to be dragged by the header bar, false to disable dragging. ...</div><div class='long'><p>True to allow the window to be dragged by the header bar, false to disable dragging. Note that\nby default the window will be centered in the viewport, so if dragging is disabled the window may need to be\npositioned programmatically after render (e.g., myWindow.setPosition(100, 100);).</p>\n<p>Defaults to: <code>true</code></p></div></div></div><div id='cfg-expandOnShow' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-expandOnShow' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-expandOnShow' class='name expandable'>expandOnShow</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to always expand the window when it is displayed, false to keep it in its current state (which may be\ncollapsed)...</div><div class='long'><p>True to always expand the window when it is displayed, false to keep it in its current state (which may be\n<a href=\"#!/api/Ext.window.Window-cfg-collapsed\" rel=\"Ext.window.Window-cfg-collapsed\" class=\"docClass\">collapsed</a>) when displayed.</p>\n<p>Defaults to: <code>true</code></p></div></div></div><div id='cfg-fbar' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-fbar' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-fbar' class='name expandable'>fbar</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[]</span></div><div class='description'><div class='short'>Convenience config used for adding items to the bottom of the panel. ...</div><div class='long'><p>Convenience config used for adding items to the bottom of the panel. Short for Footer Bar.</p>\n\n<pre><code>fbar: [\n { type: 'button', text: 'Button 1' }\n]\n</code></pre>\n\n<p>is equivalent to</p>\n\n<pre><code>dockedItems: [{\n xtype: 'toolbar',\n dock: 'bottom',\n ui: 'footer',\n defaults: {minWidth: <a href=\"#!/api/Ext.panel.Panel-cfg-minButtonWidth\" rel=\"Ext.panel.Panel-cfg-minButtonWidth\" class=\"docClass\">minButtonWidth</a>},\n items: [\n { xtype: 'component', flex: 1 },\n { xtype: 'button', text: 'Button 1' }\n ]\n}]\n</code></pre>\n\n<p>The <a href=\"#!/api/Ext.panel.Panel-cfg-minButtonWidth\" rel=\"Ext.panel.Panel-cfg-minButtonWidth\" class=\"docClass\">minButtonWidth</a> is used as the default <a href=\"#!/api/Ext.button.Button-cfg-minWidth\" rel=\"Ext.button.Button-cfg-minWidth\" class=\"docClass\">minWidth</a> for\neach of the buttons in the fbar.</p>\n</div></div></div><div id='cfg-floatable' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-floatable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-floatable' class='name expandable'>floatable</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>Important: This config is only effective for collapsible Panels which are direct child items of a\nborder layout. ...</div><div class='long'><p><strong>Important: This config is only effective for <a href=\"#!/api/Ext.panel.Panel-cfg-collapsible\" rel=\"Ext.panel.Panel-cfg-collapsible\" class=\"docClass\">collapsible</a> Panels which are direct child items of a\n<a href=\"#!/api/Ext.layout.container.Border\" rel=\"Ext.layout.container.Border\" class=\"docClass\">border layout</a>.</strong></p>\n\n<p>true to allow clicking a collapsed Panel's <a href=\"#!/api/Ext.panel.Panel-cfg-placeholder\" rel=\"Ext.panel.Panel-cfg-placeholder\" class=\"docClass\">placeholder</a> to display the Panel floated above the layout,\nfalse to force the user to fully expand a collapsed region by clicking the expand button to see it again.</p>\n<p>Defaults to: <code>true</code></p></div></div></div><div id='cfg-floating' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-cfg-floating' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-cfg-floating' class='name expandable'>floating</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>Specify as true to float the Component outside of the document flow using CSS absolute positioning. ...</div><div class='long'><p>Specify as true to float the Component outside of the document flow using CSS absolute positioning.</p>\n\n<p>Components such as <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Window</a>s and <a href=\"#!/api/Ext.menu.Menu\" rel=\"Ext.menu.Menu\" class=\"docClass\">Menu</a>s are floating by default.</p>\n\n<p>Floating Components that are programatically <a href=\"#!/api/Ext.Component-event-render\" rel=\"Ext.Component-event-render\" class=\"docClass\">rendered</a> will register themselves with\nthe global <a href=\"#!/api/Ext.WindowManager\" rel=\"Ext.WindowManager\" class=\"docClass\">ZIndexManager</a></p>\n\n<h3>Floating Components as child items of a Container</h3>\n\n<p>A floating Component may be used as a child item of a Container. This just allows the floating Component to seek\na ZIndexManager by examining the ownerCt chain.</p>\n\n<p>When configured as floating, Components acquire, at render time, a <a href=\"#!/api/Ext.ZIndexManager\" rel=\"Ext.ZIndexManager\" class=\"docClass\">ZIndexManager</a> which\nmanages a stack of related floating Components. The ZIndexManager brings a single floating Component to the top\nof its stack when the Component's <a href=\"#!/api/Ext.Component-method-toFront\" rel=\"Ext.Component-method-toFront\" class=\"docClass\">toFront</a> method is called.</p>\n\n<p>The ZIndexManager is found by traversing up the <a href=\"#!/api/Ext.Component-property-ownerCt\" rel=\"Ext.Component-property-ownerCt\" class=\"docClass\">ownerCt</a> chain to find an ancestor which itself is\nfloating. This is so that descendant floating Components of floating <em>Containers</em> (Such as a ComboBox dropdown\nwithin a Window) can have its zIndex managed relative to any siblings, but always <strong>above</strong> that floating\nancestor Container.</p>\n\n<p>If no floating ancestor is found, a floating Component registers itself with the default <a href=\"#!/api/Ext.WindowManager\" rel=\"Ext.WindowManager\" class=\"docClass\">ZIndexManager</a>.</p>\n\n<p>Floating components <em>do not participate in the Container's layout</em>. Because of this, they are not rendered until\nyou explicitly <a href=\"#!/api/Ext.Component-event-show\" rel=\"Ext.Component-event-show\" class=\"docClass\">show</a> them.</p>\n\n<p>After rendering, the ownerCt reference is deleted, and the <a href=\"#!/api/Ext.Component-property-floatParent\" rel=\"Ext.Component-property-floatParent\" class=\"docClass\">floatParent</a> property is set to the found\nfloating ancestor Container. If no floating ancestor Container was found the <a href=\"#!/api/Ext.Component-property-floatParent\" rel=\"Ext.Component-property-floatParent\" class=\"docClass\">floatParent</a> property will\nnot be set.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-focusOnToFront' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Floating' rel='Ext.util.Floating' class='definedIn docClass'>Ext.util.Floating</a><br/><a href='source/Floating.html#Ext-util-Floating-cfg-focusOnToFront' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Floating-cfg-focusOnToFront' class='name expandable'>focusOnToFront</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>Specifies whether the floated component should be automatically focused when\nit is brought to the front. ...</div><div class='long'><p>Specifies whether the floated component should be automatically <a href=\"#!/api/Ext.Component-method-focus\" rel=\"Ext.Component-method-focus\" class=\"docClass\">focused</a> when\nit is <a href=\"#!/api/Ext.util.Floating-method-toFront\" rel=\"Ext.util.Floating-method-toFront\" class=\"docClass\">brought to the front</a>.</p>\n<p>Defaults to: <code>true</code></p></div></div></div><div id='cfg-frame' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-frame' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-frame' class='name expandable'>frame</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to apply a frame to the panel. ...</div><div class='long'><p>True to apply a frame to the panel.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-frameHeader' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-frameHeader' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-frameHeader' class='name expandable'>frameHeader</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to apply a frame to the panel panels header (if 'frame' is true). ...</div><div class='long'><p>True to apply a frame to the panel panels header (if 'frame' is true).</p>\n<p>Defaults to: <code>true</code></p></div></div></div><div id='cfg-headerPosition' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-headerPosition' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-headerPosition' class='name expandable'>headerPosition</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>Specify as 'top', 'bottom', 'left' or 'right'. ...</div><div class='long'><p>Specify as <code>'top'</code>, <code>'bottom'</code>, <code>'left'</code> or <code>'right'</code>.</p>\n<p>Defaults to: <code>&quot;top&quot;</code></p></div></div></div><div id='cfg-height' class='member inherited'><a href='#' class='side not-expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-height' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-height' class='name not-expandable'>height</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></span></div><div class='description'><div class='short'><p>The height of this component in pixels.</p>\n</div><div class='long'><p>The height of this component in pixels.</p>\n</div></div></div><div id='cfg-hidden' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-hidden' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-hidden' class='name expandable'>hidden</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>Render this Window hidden. ...</div><div class='long'><p>Render this Window hidden. If <code>true</code>, the <a href=\"#!/api/Ext.window.Window-event-hide\" rel=\"Ext.window.Window-event-hide\" class=\"docClass\">hide</a> method will be called internally.</p>\n<p>Defaults to: <code>true</code></p></div></div></div><div id='cfg-hideCollapseTool' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-hideCollapseTool' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-hideCollapseTool' class='name expandable'>hideCollapseTool</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>true to hide the expand/collapse toggle button when collapsible == true, false to display it. ...</div><div class='long'><p><code>true</code> to hide the expand/collapse toggle button when <code><a href=\"#!/api/Ext.panel.Panel-cfg-collapsible\" rel=\"Ext.panel.Panel-cfg-collapsible\" class=\"docClass\">collapsible</a> == true</code>, <code>false</code> to display it.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-hideMode' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-hideMode' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-hideMode' class='name expandable'>hideMode</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>A String which specifies how this Component's encapsulating DOM element will be hidden. ...</div><div class='long'><p>A String which specifies how this Component's encapsulating DOM element will be hidden. Values may be:</p>\n\n<ul>\n<li><code>'display'</code> : The Component will be hidden using the <code>display: none</code> style.</li>\n<li><code>'visibility'</code> : The Component will be hidden using the <code>visibility: hidden</code> style.</li>\n<li><code>'offsets'</code> : The Component will be hidden by absolutely positioning it out of the visible area of the document.\nThis is useful when a hidden Component must maintain measurable dimensions. Hiding using <code>display</code> results in a\nComponent having zero dimensions.</li>\n</ul>\n\n<p>Defaults to: <code>&quot;display&quot;</code></p></div></div></div><div id='cfg-html' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-html' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-html' class='name expandable'>html</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span></div><div class='description'><div class='short'>An HTML fragment, or a DomHelper specification to use as the layout element content. ...</div><div class='long'><p>An HTML fragment, or a <a href=\"#!/api/Ext.DomHelper\" rel=\"Ext.DomHelper\" class=\"docClass\">DomHelper</a> specification to use as the layout element content.\nThe HTML content is added after the component is rendered, so the document will not contain this HTML at the time\nthe <a href=\"#!/api/Ext.AbstractComponent-event-render\" rel=\"Ext.AbstractComponent-event-render\" class=\"docClass\">render</a> event is fired. This content is inserted into the body <em>before</em> any configured <a href=\"#!/api/Ext.AbstractComponent-cfg-contentEl\" rel=\"Ext.AbstractComponent-cfg-contentEl\" class=\"docClass\">contentEl</a>\nis appended.</p>\n<p>Defaults to: <code>&quot;&quot;</code></p></div></div></div><div id='cfg-iconCls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-iconCls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-iconCls' class='name expandable'>iconCls</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>CSS class for icon in header. ...</div><div class='long'><p>CSS class for icon in header. Used for displaying an icon to the left of a title.</p>\n</div></div></div><div id='cfg-id' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-id' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-id' class='name expandable'>id</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>The unique id of this component instance. ...</div><div class='long'><p>The <strong>unique id of this component instance.</strong></p>\n\n<p>It should not be necessary to use this configuration except for singleton objects in your application. Components\ncreated with an id may be accessed globally using <a href=\"#!/api/Ext-method-getCmp\" rel=\"Ext-method-getCmp\" class=\"docClass\">Ext.getCmp</a>.</p>\n\n<p>Instead of using assigned ids, use the <a href=\"#!/api/Ext.AbstractComponent-cfg-itemId\" rel=\"Ext.AbstractComponent-cfg-itemId\" class=\"docClass\">itemId</a> config, and <a href=\"#!/api/Ext.ComponentQuery\" rel=\"Ext.ComponentQuery\" class=\"docClass\">ComponentQuery</a>\nwhich provides selector-based searching for Sencha Components analogous to DOM querying. The <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Container</a> class contains <a href=\"#!/api/Ext.container.Container-method-down\" rel=\"Ext.container.Container-method-down\" class=\"docClass\">shortcut methods</a> to query\nits descendant Components by selector.</p>\n\n<p>Note that this id will also be used as the element id for the containing HTML element that is rendered to the\npage for this component. This allows you to write id-based CSS rules to style the specific instance of this\ncomponent uniquely, and also to select sub-elements using this component's id as the parent.</p>\n\n<p><strong>Note</strong>: to avoid complications imposed by a unique id also see <code><a href=\"#!/api/Ext.AbstractComponent-cfg-itemId\" rel=\"Ext.AbstractComponent-cfg-itemId\" class=\"docClass\">itemId</a></code>.</p>\n\n<p><strong>Note</strong>: to access the container of a Component see <code><a href=\"#!/api/Ext.AbstractComponent-property-ownerCt\" rel=\"Ext.AbstractComponent-property-ownerCt\" class=\"docClass\">ownerCt</a></code>.</p>\n\n<p>Defaults to an <a href=\"#!/api/Ext.AbstractComponent-method-getId\" rel=\"Ext.AbstractComponent-method-getId\" class=\"docClass\">auto-assigned id</a>.</p>\n</div></div></div><div id='cfg-itemId' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-itemId' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-itemId' class='name expandable'>itemId</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>An itemId can be used as an alternative way to get a reference to a component when no object reference is\navailable. ...</div><div class='long'><p>An itemId can be used as an alternative way to get a reference to a component when no object reference is\navailable. Instead of using an <code><a href=\"#!/api/Ext.AbstractComponent-cfg-id\" rel=\"Ext.AbstractComponent-cfg-id\" class=\"docClass\">id</a></code> with <a href=\"#!/api/Ext\" rel=\"Ext\" class=\"docClass\">Ext</a>.<a href=\"#!/api/Ext-method-getCmp\" rel=\"Ext-method-getCmp\" class=\"docClass\">getCmp</a>, use <code>itemId</code> with\n<a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a>.<a href=\"#!/api/Ext.container.Container-method-getComponent\" rel=\"Ext.container.Container-method-getComponent\" class=\"docClass\">getComponent</a> which will retrieve\n<code>itemId</code>'s or <a href=\"#!/api/Ext.AbstractComponent-cfg-id\" rel=\"Ext.AbstractComponent-cfg-id\" class=\"docClass\">id</a>'s. Since <code>itemId</code>'s are an index to the container's internal MixedCollection, the\n<code>itemId</code> is scoped locally to the container -- avoiding potential conflicts with <a href=\"#!/api/Ext.ComponentManager\" rel=\"Ext.ComponentManager\" class=\"docClass\">Ext.ComponentManager</a>\nwhich requires a <strong>unique</strong> <code><a href=\"#!/api/Ext.AbstractComponent-cfg-id\" rel=\"Ext.AbstractComponent-cfg-id\" class=\"docClass\">id</a></code>.</p>\n\n<pre><code>var c = new Ext.panel.Panel({ //\n <a href=\"#!/api/Ext.Component-cfg-height\" rel=\"Ext.Component-cfg-height\" class=\"docClass\">height</a>: 300,\n <a href=\"#!/api/Ext.AbstractComponent-cfg-renderTo\" rel=\"Ext.AbstractComponent-cfg-renderTo\" class=\"docClass\">renderTo</a>: document.body,\n <a href=\"#!/api/Ext.container.Container-cfg-layout\" rel=\"Ext.container.Container-cfg-layout\" class=\"docClass\">layout</a>: 'auto',\n <a href=\"#!/api/Ext.container.Container-cfg-items\" rel=\"Ext.container.Container-cfg-items\" class=\"docClass\">items</a>: [\n {\n itemId: 'p1',\n <a href=\"#!/api/Ext.panel.Panel-cfg-title\" rel=\"Ext.panel.Panel-cfg-title\" class=\"docClass\">title</a>: 'Panel 1',\n <a href=\"#!/api/Ext.Component-cfg-height\" rel=\"Ext.Component-cfg-height\" class=\"docClass\">height</a>: 150\n },\n {\n itemId: 'p2',\n <a href=\"#!/api/Ext.panel.Panel-cfg-title\" rel=\"Ext.panel.Panel-cfg-title\" class=\"docClass\">title</a>: 'Panel 2',\n <a href=\"#!/api/Ext.Component-cfg-height\" rel=\"Ext.Component-cfg-height\" class=\"docClass\">height</a>: 150\n }\n ]\n})\np1 = c.<a href=\"#!/api/Ext.container.Container-method-getComponent\" rel=\"Ext.container.Container-method-getComponent\" class=\"docClass\">getComponent</a>('p1'); // not the same as <a href=\"#!/api/Ext-method-getCmp\" rel=\"Ext-method-getCmp\" class=\"docClass\">Ext.getCmp()</a>\np2 = p1.<a href=\"#!/api/Ext.AbstractComponent-property-ownerCt\" rel=\"Ext.AbstractComponent-property-ownerCt\" class=\"docClass\">ownerCt</a>.<a href=\"#!/api/Ext.container.Container-method-getComponent\" rel=\"Ext.container.Container-method-getComponent\" class=\"docClass\">getComponent</a>('p2'); // reference via a sibling\n</code></pre>\n\n<p>Also see <a href=\"#!/api/Ext.AbstractComponent-cfg-id\" rel=\"Ext.AbstractComponent-cfg-id\" class=\"docClass\">id</a>, <code><a href=\"#!/api/Ext.container.Container-method-query\" rel=\"Ext.container.Container-method-query\" class=\"docClass\">Ext.container.Container.query</a></code>, <code><a href=\"#!/api/Ext.container.Container-method-down\" rel=\"Ext.container.Container-method-down\" class=\"docClass\">Ext.container.Container.down</a></code> and\n<code><a href=\"#!/api/Ext.container.Container-method-child\" rel=\"Ext.container.Container-method-child\" class=\"docClass\">Ext.container.Container.child</a></code>.</p>\n\n<p><strong>Note</strong>: to access the container of an item see <a href=\"#!/api/Ext.AbstractComponent-property-ownerCt\" rel=\"Ext.AbstractComponent-property-ownerCt\" class=\"docClass\">ownerCt</a>.</p>\n</div></div></div><div id='cfg-items' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-cfg-items' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-cfg-items' class='name expandable'>items</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[]</span></div><div class='description'><div class='short'>A single item, or an array of child Components to be added to this container\n\n\nUnless configured with a layout, a Con...</div><div class='long'><p>A single item, or an array of child Components to be added to this container</p>\n\n\n<p><b>Unless configured with a <a href=\"#!/api/Ext.container.AbstractContainer-cfg-layout\" rel=\"Ext.container.AbstractContainer-cfg-layout\" class=\"docClass\">layout</a>, a Container simply renders child Components serially into\nits encapsulating element and performs no sizing or positioning upon them.</b><p>\n<p>Example:</p>\n<pre><code>// specifying a single item\nitems: {...},\nlayout: 'fit', // The single items is sized to fit\n\n// specifying multiple items\nitems: [{...}, {...}],\nlayout: 'hbox', // The items are arranged horizontally\n </code></pre>\n<p>Each item may be:</p>\n<ul>\n<li>A <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Component</a></li>\n<li>A Component configuration object</li>\n</ul>\n<p>If a configuration object is specified, the actual type of Component to be\ninstantiated my be indicated by using the <a href=\"#!/api/Ext.Component-cfg-xtype\" rel=\"Ext.Component-cfg-xtype\" class=\"docClass\">xtype</a> option.</p>\n<p>Every Component class has its own <a href=\"#!/api/Ext.Component-cfg-xtype\" rel=\"Ext.Component-cfg-xtype\" class=\"docClass\">xtype</a>.</p>\n<p>If an <a href=\"#!/api/Ext.Component-cfg-xtype\" rel=\"Ext.Component-cfg-xtype\" class=\"docClass\">xtype</a> is not explicitly\nspecified, the <a href=\"#!/api/Ext.container.AbstractContainer-cfg-defaultType\" rel=\"Ext.container.AbstractContainer-cfg-defaultType\" class=\"docClass\">defaultType</a> for the Container is used, which by default is usually <code>panel</code>.</p>\n<p><b>Notes</b>:</p>\n<p>Ext uses lazy rendering. Child Components will only be rendered\nshould it become necessary. Items are automatically laid out when they are first\nshown (no sizing is done while hidden), or in response to a <a href=\"#!/api/Ext.container.AbstractContainer-method-doLayout\" rel=\"Ext.container.AbstractContainer-method-doLayout\" class=\"docClass\">doLayout</a> call.</p>\n<p>Do not specify <code><a href=\"#!/api/Ext.panel.Panel-cfg-contentEl\" rel=\"Ext.panel.Panel-cfg-contentEl\" class=\"docClass\">contentEl</a></code> or\n<code><a href=\"#!/api/Ext.panel.Panel-cfg-html\" rel=\"Ext.panel.Panel-cfg-html\" class=\"docClass\">html</a></code> with <code>items</code>.</p>\n\n</div></div></div><div id='cfg-layout' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-cfg-layout' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-cfg-layout' class='name expandable'>layout</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span></div><div class='description'><div class='short'>Important: In order for child items to be correctly sized and\npositioned, typically a layout manager must be specifie...</div><div class='long'><p><b>Important</b>: In order for child items to be correctly sized and\npositioned, typically a layout manager <b>must</b> be specified through\nthe <code>layout</code> configuration option.</p>\n\n\n<p>The sizing and positioning of child <a href=\"#!/api/Ext.container.AbstractContainer-cfg-items\" rel=\"Ext.container.AbstractContainer-cfg-items\" class=\"docClass\">items</a> is the responsibility of\nthe Container's layout manager which creates and manages the type of layout\nyou have in mind. For example:</p>\n\n\n<p>If the <a href=\"#!/api/Ext.container.AbstractContainer-cfg-layout\" rel=\"Ext.container.AbstractContainer-cfg-layout\" class=\"docClass\">layout</a> configuration is not explicitly specified for\na general purpose container (e.g. Container or Panel) the\n<a href=\"#!/api/Ext.layout.container.Auto\" rel=\"Ext.layout.container.Auto\" class=\"docClass\">default layout manager</a> will be used\nwhich does nothing but render child components sequentially into the\nContainer (no sizing or positioning will be performed in this situation).</p>\n\n\n<p><b><code>layout</code></b> may be specified as either as an Object or as a String:</p>\n\n\n<div><ul class=\"mdetail-params\">\n<li><u>Specify as an Object</u></li>\n<div><ul class=\"mdetail-params\">\n<li>Example usage:</li>\n<pre><code>layout: {\n type: 'vbox',\n align: 'left'\n}\n </code></pre>\n\n<li><code><b>type</b></code></li>\n<br/><p>The layout type to be used for this container. If not specified,\na default <a href=\"#!/api/Ext.layout.container.Auto\" rel=\"Ext.layout.container.Auto\" class=\"docClass\">Ext.layout.container.Auto</a> will be created and used.</p>\n<p>Valid layout <code>type</code> values are:</p>\n<div class=\"sub-desc\"><ul class=\"mdetail-params\">\n<li><code><b><a href=\"#!/api/Ext.layout.container.Auto\" rel=\"Ext.layout.container.Auto\" class=\"docClass\">Auto</a></b></code> &nbsp;&nbsp;&nbsp; <b>Default</b></li>\n<li><code><b><a href=\"#!/api/Ext.layout.container.Card\" rel=\"Ext.layout.container.Card\" class=\"docClass\">card</a></b></code></li>\n<li><code><b><a href=\"#!/api/Ext.layout.container.Fit\" rel=\"Ext.layout.container.Fit\" class=\"docClass\">fit</a></b></code></li>\n<li><code><b><a href=\"#!/api/Ext.layout.container.HBox\" rel=\"Ext.layout.container.HBox\" class=\"docClass\">hbox</a></b></code></li>\n<li><code><b><a href=\"#!/api/Ext.layout.container.VBox\" rel=\"Ext.layout.container.VBox\" class=\"docClass\">vbox</a></b></code></li>\n<li><code><b><a href=\"#!/api/Ext.layout.container.Anchor\" rel=\"Ext.layout.container.Anchor\" class=\"docClass\">anchor</a></b></code></li>\n<li><code><b><a href=\"#!/api/Ext.layout.container.Table\" rel=\"Ext.layout.container.Table\" class=\"docClass\">table</a></b></code></li>\n</ul></div>\n\n<li>Layout specific configuration properties</li>\n<p>Additional layout specific configuration properties may also be\nspecified. For complete details regarding the valid config options for\neach layout type, see the layout class corresponding to the <code>type</code>\nspecified.</p>\n\n</ul></div>\n\n<li><u>Specify as a String</u></li>\n<div><ul class=\"mdetail-params\">\n<li>Example usage:</li>\n<pre><code>layout: 'vbox'\n </code></pre>\n<li><code><b>layout</b></code></li>\n<p>The layout <code>type</code> to be used for this container (see list\nof valid layout type values above).</p>\n<p>Additional layout specific configuration properties. For complete\ndetails regarding the valid config options for each layout type, see the\nlayout class corresponding to the <code>layout</code> specified.</p>\n</ul></div></ul></div>\n\n</div></div></div><div id='cfg-lbar' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-lbar' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-lbar' class='name expandable'>lbar</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[]</span></div><div class='description'><div class='short'>Convenience config. ...</div><div class='long'><p>Convenience config. Short for 'Left Bar' (left-docked, vertical toolbar).</p>\n\n<pre><code>lbar: [\n { xtype: 'button', text: 'Button 1' }\n]\n</code></pre>\n\n<p>is equivalent to</p>\n\n<pre><code>dockedItems: [{\n xtype: 'toolbar',\n dock: 'left',\n items: [\n { xtype: 'button', text: 'Button 1' }\n ]\n}]\n</code></pre>\n</div></div></div><div id='cfg-listeners' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-cfg-listeners' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-cfg-listeners' class='name expandable'>listeners</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span></div><div class='description'><div class='short'>A config object containing one or more event handlers to be added to this object during initialization. ...</div><div class='long'><p>A config object containing one or more event handlers to be added to this object during initialization. This\nshould be a valid listeners config object as specified in the <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">addListener</a> example for attaching multiple\nhandlers at once.</p>\n\n<p><strong>DOM events from Ext JS <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Components</a></strong></p>\n\n<p>While <em>some</em> Ext JS Component classes export selected DOM events (e.g. \"click\", \"mouseover\" etc), this is usually\nonly done when extra value can be added. For example the <a href=\"#!/api/Ext.view.View\" rel=\"Ext.view.View\" class=\"docClass\">DataView</a>'s <strong><code><a href=\"#!/api/Ext.view.View-event-itemclick\" rel=\"Ext.view.View-event-itemclick\" class=\"docClass\">itemclick</a></code></strong> event passing the node clicked on. To access DOM events directly from a\nchild element of a Component, we need to specify the <code>element</code> option to identify the Component property to add a\nDOM listener to:</p>\n\n<pre><code>new Ext.panel.Panel({\n width: 400,\n height: 200,\n dockedItems: [{\n xtype: 'toolbar'\n }],\n listeners: {\n click: {\n element: 'el', //bind to the underlying el property on the panel\n fn: function(){ console.log('click el'); }\n },\n dblclick: {\n element: 'body', //bind to the underlying body property on the panel\n fn: function(){ console.log('dblclick body'); }\n }\n }\n});\n</code></pre>\n</div></div></div><div id='cfg-loader' class='member inherited'><a href='#' class='side not-expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-loader' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-loader' class='name not-expandable'>loader</a><span> : <a href=\"#!/api/Ext.ComponentLoader\" rel=\"Ext.ComponentLoader\" class=\"docClass\">Ext.ComponentLoader</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span></div><div class='description'><div class='short'><p>A configuration object or an instance of a <a href=\"#!/api/Ext.ComponentLoader\" rel=\"Ext.ComponentLoader\" class=\"docClass\">Ext.ComponentLoader</a> to load remote content for this Component.</p>\n</div><div class='long'><p>A configuration object or an instance of a <a href=\"#!/api/Ext.ComponentLoader\" rel=\"Ext.ComponentLoader\" class=\"docClass\">Ext.ComponentLoader</a> to load remote content for this Component.</p>\n</div></div></div><div id='cfg-maintainFlex' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-cfg-maintainFlex' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-cfg-maintainFlex' class='name expandable'>maintainFlex</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>Only valid when a sibling element of a Splitter within a\nVBox or HBox layout. ...</div><div class='long'><p><strong>Only valid when a sibling element of a <a href=\"#!/api/Ext.resizer.Splitter\" rel=\"Ext.resizer.Splitter\" class=\"docClass\">Splitter</a> within a\n<a href=\"#!/api/Ext.layout.container.VBox\" rel=\"Ext.layout.container.VBox\" class=\"docClass\">VBox</a> or <a href=\"#!/api/Ext.layout.container.HBox\" rel=\"Ext.layout.container.HBox\" class=\"docClass\">HBox</a> layout.</strong></p>\n\n<p>Specifies that if an immediate sibling Splitter is moved, the Component on the <em>other</em> side is resized, and this\nComponent maintains its configured <a href=\"#!/api/Ext.layout.container.Box-cfg-flex\" rel=\"Ext.layout.container.Box-cfg-flex\" class=\"docClass\">flex</a> value.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-margin' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-margin' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-margin' class='name expandable'>margin</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>Specifies the margin for this component. ...</div><div class='long'><p>Specifies the margin for this component. The margin can be a single numeric value to apply to all sides or it can\nbe a CSS style specification for each style, for example: '10 5 3 10'.</p>\n</div></div></div><div id='cfg-maxHeight' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-maxHeight' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-maxHeight' class='name expandable'>maxHeight</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></span></div><div class='description'><div class='short'>The maximum value in pixels which this Component will set its height to. ...</div><div class='long'><p>The maximum value in pixels which this Component will set its height to.</p>\n\n<p><strong>Warning:</strong> This will override any size management applied by layout managers.</p>\n</div></div></div><div id='cfg-maxWidth' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-maxWidth' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-maxWidth' class='name expandable'>maxWidth</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></span></div><div class='description'><div class='short'>The maximum value in pixels which this Component will set its width to. ...</div><div class='long'><p>The maximum value in pixels which this Component will set its width to.</p>\n\n<p><strong>Warning:</strong> This will override any size management applied by layout managers.</p>\n</div></div></div><div id='cfg-maximizable' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-maximizable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-maximizable' class='name expandable'>maximizable</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to display the 'maximize' tool button and allow the user to maximize the window, false to hide the button\nand di...</div><div class='long'><p>True to display the 'maximize' tool button and allow the user to maximize the window, false to hide the button\nand disallow maximizing the window. Note that when a window is maximized, the tool button\nwill automatically change to a 'restore' button with the appropriate behavior already built-in that will restore\nthe window to its previous size.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-maximized' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-maximized' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-maximized' class='name expandable'>maximized</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to initially display the window in a maximized state. ...</div><div class='long'><p>True to initially display the window in a maximized state.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-minButtonWidth' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-minButtonWidth' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-minButtonWidth' class='name expandable'>minButtonWidth</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></span></div><div class='description'><div class='short'>Minimum width of all footer toolbar buttons in pixels. ...</div><div class='long'><p>Minimum width of all footer toolbar buttons in pixels. If set, this will be used as the default\nvalue for the <a href=\"#!/api/Ext.button.Button-cfg-minWidth\" rel=\"Ext.button.Button-cfg-minWidth\" class=\"docClass\">Ext.button.Button.minWidth</a> config of each Button added to the <strong>footer toolbar</strong> via the\n<a href=\"#!/api/Ext.panel.Panel-cfg-fbar\" rel=\"Ext.panel.Panel-cfg-fbar\" class=\"docClass\">fbar</a> or <a href=\"#!/api/Ext.panel.Panel-cfg-buttons\" rel=\"Ext.panel.Panel-cfg-buttons\" class=\"docClass\">buttons</a> configurations. It will be ignored for buttons that have a minWidth configured\nsome other way, e.g. in their own config object or via the <a href=\"#!/api/Ext.container.Container-cfg-defaults\" rel=\"Ext.container.Container-cfg-defaults\" class=\"docClass\">defaults</a> of\ntheir parent container.</p>\n<p>Defaults to: <code>75</code></p></div></div></div><div id='cfg-minHeight' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-minHeight' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-minHeight' class='name expandable'>minHeight</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></span></div><div class='description'><div class='short'>The minimum value in pixels which this Component will set its height to. ...</div><div class='long'><p>The minimum value in pixels which this Component will set its height to.</p>\n\n<p><strong>Warning:</strong> This will override any size management applied by layout managers.</p>\n</div></div></div><div id='cfg-minWidth' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-minWidth' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-minWidth' class='name expandable'>minWidth</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></span></div><div class='description'><div class='short'>The minimum value in pixels which this Component will set its width to. ...</div><div class='long'><p>The minimum value in pixels which this Component will set its width to.</p>\n\n<p><strong>Warning:</strong> This will override any size management applied by layout managers.</p>\n</div></div></div><div id='cfg-minimizable' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-minimizable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-minimizable' class='name expandable'>minimizable</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to display the 'minimize' tool button and allow the user to minimize the window, false to hide the button\nand di...</div><div class='long'><p>True to display the 'minimize' tool button and allow the user to minimize the window, false to hide the button\nand disallow minimizing the window. Note that this button provides no implementation -- the\nbehavior of minimizing a window is implementation-specific, so the minimize event must be handled and a custom\nminimize behavior implemented for this option to be useful.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-modal' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-modal' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-modal' class='name expandable'>modal</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to make the window modal and mask everything behind it when displayed, false to display it without\nrestricting a...</div><div class='long'><p>True to make the window modal and mask everything behind it when displayed, false to display it without\nrestricting access to other UI elements.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-onEsc' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-onEsc' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-onEsc' class='name expandable'>onEsc</a><span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a></span></div><div class='description'><div class='short'>Allows override of the built-in processing for the escape key. ...</div><div class='long'><p>Allows override of the built-in processing for the escape key. Default action is to close the Window (performing\nwhatever action is specified in <a href=\"#!/api/Ext.window.Window-cfg-closeAction\" rel=\"Ext.window.Window-cfg-closeAction\" class=\"docClass\">closeAction</a>. To prevent the Window closing when the escape key is\npressed, specify this as <a href=\"#!/api/Ext-method-emptyFn\" rel=\"Ext-method-emptyFn\" class=\"docClass\">Ext.emptyFn</a>.</p>\n</div></div></div><div id='cfg-overCls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-overCls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-overCls' class='name expandable'>overCls</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>An optional extra CSS class that will be added to this component's Element when the mouse moves over the Element,\nand...</div><div class='long'><p>An optional extra CSS class that will be added to this component's Element when the mouse moves over the Element,\nand removed when the mouse moves out. This can be useful for adding customized 'active' or 'hover' styles to the\ncomponent or any of its children using standard CSS rules.</p>\n<p>Defaults to: <code>&quot;&quot;</code></p></div></div></div><div id='cfg-overlapHeader' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-overlapHeader' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-overlapHeader' class='name expandable'>overlapHeader</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to overlap the header in a panel over the framing of the panel itself. ...</div><div class='long'><p>True to overlap the header in a panel over the framing of the panel itself. This is needed when frame:true (and\nis done automatically for you). Otherwise it is undefined. If you manually add rounded corners to a panel header\nwhich does not have frame:true, this will need to be set to true.</p>\n</div></div></div><div id='cfg-padding' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-padding' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-padding' class='name expandable'>padding</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>Specifies the padding for this component. ...</div><div class='long'><p>Specifies the padding for this component. The padding can be a single numeric value to apply to all sides or it\ncan be a CSS style specification for each style, for example: '10 5 3 10'.</p>\n</div></div></div><div id='cfg-placeholder' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-placeholder' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-placeholder' class='name expandable'>placeholder</a><span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span></div><div class='description'><div class='short'>Important: This config is only effective for collapsible Panels which are direct child items of a\nborder layout when ...</div><div class='long'><p><strong>Important: This config is only effective for <a href=\"#!/api/Ext.panel.Panel-cfg-collapsible\" rel=\"Ext.panel.Panel-cfg-collapsible\" class=\"docClass\">collapsible</a> Panels which are direct child items of a\n<a href=\"#!/api/Ext.layout.container.Border\" rel=\"Ext.layout.container.Border\" class=\"docClass\">border layout</a> when not using the <code>'header'</code> <a href=\"#!/api/Ext.panel.Panel-cfg-collapseMode\" rel=\"Ext.panel.Panel-cfg-collapseMode\" class=\"docClass\">collapseMode</a>.</strong></p>\n\n<p><strong>Optional.</strong> A Component (or config object for a Component) to show in place of this Panel when this Panel is\ncollapsed by a <a href=\"#!/api/Ext.layout.container.Border\" rel=\"Ext.layout.container.Border\" class=\"docClass\">border layout</a>. Defaults to a generated <a href=\"#!/api/Ext.panel.Header\" rel=\"Ext.panel.Header\" class=\"docClass\">Header</a> containing a <a href=\"#!/api/Ext.panel.Tool\" rel=\"Ext.panel.Tool\" class=\"docClass\">Tool</a> to re-expand the Panel.</p>\n</div></div></div><div id='cfg-plain' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-plain' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-plain' class='name expandable'>plain</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to render the window body with a transparent background so that it will blend into the framing elements,\nfalse t...</div><div class='long'><p>True to render the window body with a transparent background so that it will blend into the framing elements,\nfalse to add a lighter background color to visually highlight the body element and separate it more distinctly\nfrom the surrounding frame.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-plugins' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-plugins' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-plugins' class='name expandable'>plugins</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[]</span></div><div class='description'><div class='short'>An object or array of objects that will provide custom functionality for this component. ...</div><div class='long'><p>An object or array of objects that will provide custom functionality for this component. The only requirement for\na valid plugin is that it contain an init method that accepts a reference of type <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>. When a component\nis created, if any plugins are available, the component will call the init method on each plugin, passing a\nreference to itself. Each plugin can then call methods or respond to events on the component as needed to provide\nits functionality.</p>\n</div></div></div><div id='cfg-preventHeader' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-preventHeader' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-preventHeader' class='name expandable'>preventHeader</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>Prevent a Header from being created and shown. ...</div><div class='long'><p>Prevent a Header from being created and shown.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-rbar' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-rbar' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-rbar' class='name expandable'>rbar</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[]</span></div><div class='description'><div class='short'>Convenience config. ...</div><div class='long'><p>Convenience config. Short for 'Right Bar' (right-docked, vertical toolbar).</p>\n\n<pre><code>rbar: [\n { xtype: 'button', text: 'Button 1' }\n]\n</code></pre>\n\n<p>is equivalent to</p>\n\n<pre><code>dockedItems: [{\n xtype: 'toolbar',\n dock: 'right',\n items: [\n { xtype: 'button', text: 'Button 1' }\n ]\n}]\n</code></pre>\n</div></div></div><div id='cfg-renderData' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-renderData' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-renderData' class='name expandable'>renderData</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span></div><div class='description'><div class='short'>The data used by renderTpl in addition to the following property values of the component:\n\n\nid\nui\nuiCls\nbaseCls\ncompo...</div><div class='long'><p>The data used by <a href=\"#!/api/Ext.AbstractComponent-cfg-renderTpl\" rel=\"Ext.AbstractComponent-cfg-renderTpl\" class=\"docClass\">renderTpl</a> in addition to the following property values of the component:</p>\n\n<ul>\n<li>id</li>\n<li>ui</li>\n<li>uiCls</li>\n<li>baseCls</li>\n<li>componentCls</li>\n<li>frame</li>\n</ul>\n\n\n<p>See <a href=\"#!/api/Ext.AbstractComponent-cfg-renderSelectors\" rel=\"Ext.AbstractComponent-cfg-renderSelectors\" class=\"docClass\">renderSelectors</a> and <a href=\"#!/api/Ext.AbstractComponent-cfg-childEls\" rel=\"Ext.AbstractComponent-cfg-childEls\" class=\"docClass\">childEls</a> for usage examples.</p>\n</div></div></div><div id='cfg-renderSelectors' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-renderSelectors' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-renderSelectors' class='name expandable'>renderSelectors</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span></div><div class='description'><div class='short'>An object containing properties specifying DomQuery selectors which identify child elements\ncreated by the render pro...</div><div class='long'><p>An object containing properties specifying <a href=\"#!/api/Ext.DomQuery\" rel=\"Ext.DomQuery\" class=\"docClass\">DomQuery</a> selectors which identify child elements\ncreated by the render process.</p>\n\n<p>After the Component's internal structure is rendered according to the <a href=\"#!/api/Ext.AbstractComponent-cfg-renderTpl\" rel=\"Ext.AbstractComponent-cfg-renderTpl\" class=\"docClass\">renderTpl</a>, this object is iterated through,\nand the found Elements are added as properties to the Component using the <code>renderSelector</code> property name.</p>\n\n<p>For example, a Component which renderes a title and description into its element:</p>\n\n<pre><code>Ext.create('Ext.Component', {\n renderTo: Ext.getBody(),\n renderTpl: [\n '&lt;h1 class=\"title\"&gt;{title}&lt;/h1&gt;',\n '&lt;p&gt;{desc}&lt;/p&gt;'\n ],\n renderData: {\n title: \"Error\",\n desc: \"Something went wrong\"\n },\n renderSelectors: {\n titleEl: 'h1.title',\n descEl: 'p'\n },\n listeners: {\n afterrender: function(cmp){\n // After rendering the component will have a titleEl and descEl properties\n cmp.titleEl.setStyle({color: \"red\"});\n }\n }\n});\n</code></pre>\n\n<p>For a faster, but less flexible, alternative that achieves the same end result (properties for child elements on the\nComponent after render), see <a href=\"#!/api/Ext.AbstractComponent-cfg-childEls\" rel=\"Ext.AbstractComponent-cfg-childEls\" class=\"docClass\">childEls</a> and <a href=\"#!/api/Ext.AbstractComponent-method-addChildEls\" rel=\"Ext.AbstractComponent-method-addChildEls\" class=\"docClass\">addChildEls</a>.</p>\n</div></div></div><div id='cfg-renderTo' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-renderTo' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-renderTo' class='name expandable'>renderTo</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/HTMLElement/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a></span></div><div class='description'><div class='short'>Specify the id of the element, a DOM element or an existing Element that this component will be rendered into. ...</div><div class='long'><p>Specify the id of the element, a DOM element or an existing Element that this component will be rendered into.</p>\n\n<p><strong>Notes:</strong></p>\n\n<p>Do <em>not</em> use this option if the Component is to be a child item of a <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Container</a>.\nIt is the responsibility of the <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Container</a>'s\n<a href=\"#!/api/Ext.container.Container-cfg-layout\" rel=\"Ext.container.Container-cfg-layout\" class=\"docClass\">layout manager</a> to render and manage its child items.</p>\n\n<p>When using this config, a call to render() is not required.</p>\n\n<p>See <code><a href=\"#!/api/Ext.AbstractComponent-event-render\" rel=\"Ext.AbstractComponent-event-render\" class=\"docClass\">render</a></code> also.</p>\n</div></div></div><div id='cfg-renderTpl' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-renderTpl' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-renderTpl' class='name expandable'>renderTpl</a><span> : <a href=\"#!/api/Ext.XTemplate\" rel=\"Ext.XTemplate\" class=\"docClass\">Ext.XTemplate</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[]</span></div><div class='description'><div class='short'>An XTemplate used to create the internal structure inside this Component's encapsulating\nElement. ...</div><div class='long'><p>An <a href=\"#!/api/Ext.XTemplate\" rel=\"Ext.XTemplate\" class=\"docClass\">XTemplate</a> used to create the internal structure inside this Component's encapsulating\n<a href=\"#!/api/Ext.AbstractComponent-method-getEl\" rel=\"Ext.AbstractComponent-method-getEl\" class=\"docClass\">Element</a>.</p>\n\n<p>You do not normally need to specify this. For the base classes <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> and\n<a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a>, this defaults to <strong><code>null</code></strong> which means that they will be initially rendered\nwith no internal structure; they render their <a href=\"#!/api/Ext.AbstractComponent-method-getEl\" rel=\"Ext.AbstractComponent-method-getEl\" class=\"docClass\">Element</a> empty. The more specialized ExtJS and Touch\nclasses which use a more complex DOM structure, provide their own template definitions.</p>\n\n<p>This is intended to allow the developer to create application-specific utility Components with customized\ninternal structure.</p>\n\n<p>Upon rendering, any created child elements may be automatically imported into object properties using the\n<a href=\"#!/api/Ext.AbstractComponent-cfg-renderSelectors\" rel=\"Ext.AbstractComponent-cfg-renderSelectors\" class=\"docClass\">renderSelectors</a> and <a href=\"#!/api/Ext.AbstractComponent-cfg-childEls\" rel=\"Ext.AbstractComponent-cfg-childEls\" class=\"docClass\">childEls</a> options.</p>\n<p>Defaults to: <code>null</code></p></div></div></div><div id='cfg-resizable' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-resizable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-resizable' class='name expandable'>resizable</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span></div><div class='description'><div class='short'>Specify as true to allow user resizing at each edge and corner of the window, false to disable resizing. ...</div><div class='long'><p>Specify as <code>true</code> to allow user resizing at each edge and corner of the window, false to disable resizing.</p>\n\n<p>This may also be specified as a config object to <a href=\"#!/api/Ext.resizer.Resizer\" rel=\"Ext.resizer.Resizer\" class=\"docClass\">Ext.resizer.Resizer</a></p>\n<p>Defaults to: <code>true</code></p></div></div></div><div id='cfg-resizeHandles' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-cfg-resizeHandles' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-cfg-resizeHandles' class='name expandable'>resizeHandles</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>A valid Ext.resizer.Resizer handles config string. ...</div><div class='long'><p>A valid <a href=\"#!/api/Ext.resizer.Resizer\" rel=\"Ext.resizer.Resizer\" class=\"docClass\">Ext.resizer.Resizer</a> handles config string. Only applies when resizable = true.</p>\n<p>Defaults to: <code>&quot;all&quot;</code></p></div></div></div><div id='cfg-saveDelay' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.state.Stateful' rel='Ext.state.Stateful' class='definedIn docClass'>Ext.state.Stateful</a><br/><a href='source/Stateful.html#Ext-state-Stateful-cfg-saveDelay' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.state.Stateful-cfg-saveDelay' class='name expandable'>saveDelay</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></span></div><div class='description'><div class='short'>A buffer to be applied if many state events are fired within a short period. ...</div><div class='long'><p>A buffer to be applied if many state events are fired within a short period.</p>\n<p>Defaults to: <code>100</code></p></div></div></div><div id='cfg-shadow' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Floating' rel='Ext.util.Floating' class='definedIn docClass'>Ext.util.Floating</a><br/><a href='source/Floating.html#Ext-util-Floating-cfg-shadow' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Floating-cfg-shadow' class='name expandable'>shadow</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>Specifies whether the floating component should be given a shadow. ...</div><div class='long'><p>Specifies whether the floating component should be given a shadow. Set to true to automatically create an <a href=\"#!/api/Ext.Shadow\" rel=\"Ext.Shadow\" class=\"docClass\">Ext.Shadow</a>, or a string indicating the shadow's display <a href=\"#!/api/Ext.Shadow-cfg-mode\" rel=\"Ext.Shadow-cfg-mode\" class=\"docClass\">Ext.Shadow.mode</a>. Set to false to disable the\nshadow.</p>\n<p>Defaults to: <code>&quot;sides&quot;</code></p></div></div></div><div id='cfg-stateEvents' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.state.Stateful' rel='Ext.state.Stateful' class='definedIn docClass'>Ext.state.Stateful</a><br/><a href='source/Stateful.html#Ext-state-Stateful-cfg-stateEvents' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.state.Stateful-cfg-stateEvents' class='name expandable'>stateEvents</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[]</span></div><div class='description'><div class='short'>An array of events that, when fired, should trigger this object to\nsave its state. ...</div><div class='long'><p>An array of events that, when fired, should trigger this object to\nsave its state. Defaults to none. <code>stateEvents</code> may be any type\nof event supported by this object, including browser or custom events\n(e.g., <tt>['click', 'customerchange']</tt>).</p>\n\n\n<p>See <code><a href=\"#!/api/Ext.state.Stateful-cfg-stateful\" rel=\"Ext.state.Stateful-cfg-stateful\" class=\"docClass\">stateful</a></code> for an explanation of saving and\nrestoring object state.</p>\n\n</div></div></div><div id='cfg-stateId' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.state.Stateful' rel='Ext.state.Stateful' class='definedIn docClass'>Ext.state.Stateful</a><br/><a href='source/Stateful.html#Ext-state-Stateful-cfg-stateId' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.state.Stateful-cfg-stateId' class='name expandable'>stateId</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>The unique id for this object to use for state management purposes. ...</div><div class='long'><p>The unique id for this object to use for state management purposes.</p>\n\n<p>See <a href=\"#!/api/Ext.state.Stateful-cfg-stateful\" rel=\"Ext.state.Stateful-cfg-stateful\" class=\"docClass\">stateful</a> for an explanation of saving and restoring state.</p>\n\n</div></div></div><div id='cfg-stateful' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.state.Stateful' rel='Ext.state.Stateful' class='definedIn docClass'>Ext.state.Stateful</a><br/><a href='source/Stateful.html#Ext-state-Stateful-cfg-stateful' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.state.Stateful-cfg-stateful' class='name expandable'>stateful</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>A flag which causes the object to attempt to restore the state of\ninternal properties from a saved state on startup. ...</div><div class='long'><p>A flag which causes the object to attempt to restore the state of\ninternal properties from a saved state on startup. The object must have\na <code><a href=\"#!/api/Ext.state.Stateful-cfg-stateId\" rel=\"Ext.state.Stateful-cfg-stateId\" class=\"docClass\">stateId</a></code> for state to be managed.\nAuto-generated ids are not guaranteed to be stable across page loads and\ncannot be relied upon to save and restore the same state for a object.<p>\n<p>For state saving to work, the state manager's provider must have been\nset to an implementation of <a href=\"#!/api/Ext.state.Provider\" rel=\"Ext.state.Provider\" class=\"docClass\">Ext.state.Provider</a> which overrides the\n<a href=\"#!/api/Ext.state.Provider-method-set\" rel=\"Ext.state.Provider-method-set\" class=\"docClass\">set</a> and <a href=\"#!/api/Ext.state.Provider-method-get\" rel=\"Ext.state.Provider-method-get\" class=\"docClass\">get</a>\nmethods to save and recall name/value pairs. A built-in implementation,\n<a href=\"#!/api/Ext.state.CookieProvider\" rel=\"Ext.state.CookieProvider\" class=\"docClass\">Ext.state.CookieProvider</a> is available.</p>\n<p>To set the state provider for the current page:</p>\n<pre><code>Ext.state.Manager.setProvider(new Ext.state.CookieProvider({\n expires: new Date(new Date().getTime()+(1000*60*60*24*7)), //7 days from now\n}));\n</code></pre>\n<p>A stateful object attempts to save state when one of the events\nlisted in the <code><a href=\"#!/api/Ext.state.Stateful-cfg-stateEvents\" rel=\"Ext.state.Stateful-cfg-stateEvents\" class=\"docClass\">stateEvents</a></code> configuration fires.</p>\n<p>To save state, a stateful object first serializes its state by\ncalling <b><code><a href=\"#!/api/Ext.state.Stateful-method-getState\" rel=\"Ext.state.Stateful-method-getState\" class=\"docClass\">getState</a></code></b>. By default, this function does\nnothing. The developer must provide an implementation which returns an\nobject hash which represents the restorable state of the object.</p>\n<p>The value yielded by getState is passed to <a href=\"#!/api/Ext.state.Manager-method-set\" rel=\"Ext.state.Manager-method-set\" class=\"docClass\">Ext.state.Manager.set</a>\nwhich uses the configured <a href=\"#!/api/Ext.state.Provider\" rel=\"Ext.state.Provider\" class=\"docClass\">Ext.state.Provider</a> to save the object\nkeyed by the <code><a href=\"#!/api/Ext.state.Stateful-cfg-stateId\" rel=\"Ext.state.Stateful-cfg-stateId\" class=\"docClass\">stateId</a></code>.</p>\n<p>During construction, a stateful object attempts to <i>restore</i>\nits state by calling <a href=\"#!/api/Ext.state.Manager-method-get\" rel=\"Ext.state.Manager-method-get\" class=\"docClass\">Ext.state.Manager.get</a> passing the\n<code><a href=\"#!/api/Ext.state.Stateful-cfg-stateId\" rel=\"Ext.state.Stateful-cfg-stateId\" class=\"docClass\">stateId</a></code></p>\n<p>The resulting object is passed to <b><code><a href=\"#!/api/Ext.state.Stateful-method-applyState\" rel=\"Ext.state.Stateful-method-applyState\" class=\"docClass\">applyState</a></code></b>.\nThe default implementation of <code><a href=\"#!/api/Ext.state.Stateful-method-applyState\" rel=\"Ext.state.Stateful-method-applyState\" class=\"docClass\">applyState</a></code> simply copies\nproperties into the object, but a developer may override this to support\nmore behaviour.</p>\n<p>You can perform extra processing on state save and restore by attaching\nhandlers to the <a href=\"#!/api/Ext.state.Stateful-event-beforestaterestore\" rel=\"Ext.state.Stateful-event-beforestaterestore\" class=\"docClass\">beforestaterestore</a>, <a href=\"#!/api/Ext.state.Stateful-event-staterestore\" rel=\"Ext.state.Stateful-event-staterestore\" class=\"docClass\">staterestore</a>,\n<a href=\"#!/api/Ext.state.Stateful-event-beforestatesave\" rel=\"Ext.state.Stateful-event-beforestatesave\" class=\"docClass\">beforestatesave</a> and <a href=\"#!/api/Ext.state.Stateful-event-statesave\" rel=\"Ext.state.Stateful-event-statesave\" class=\"docClass\">statesave</a> events.</p>\n\n<p>Defaults to: <code>true</code></p></div></div></div><div id='cfg-style' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-style' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-style' class='name expandable'>style</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>A custom style specification to be applied to this component's Element. ...</div><div class='long'><p>A custom style specification to be applied to this component's Element. Should be a valid argument to\n<a href=\"#!/api/Ext.Element-method-applyStyles\" rel=\"Ext.Element-method-applyStyles\" class=\"docClass\">Ext.Element.applyStyles</a>.</p>\n\n<pre><code>new Ext.panel.Panel({\n title: 'Some Title',\n renderTo: Ext.getBody(),\n width: 400, height: 300,\n layout: 'form',\n items: [{\n xtype: 'textarea',\n style: {\n width: '95%',\n marginBottom: '10px'\n }\n },\n new Ext.button.Button({\n text: 'Send',\n minWidth: '100',\n style: {\n marginBottom: '10px'\n }\n })\n ]\n});\n</code></pre>\n</div></div></div><div id='cfg-styleHtmlCls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-styleHtmlCls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-styleHtmlCls' class='name expandable'>styleHtmlCls</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>The class that is added to the content target when you set styleHtmlContent to true. ...</div><div class='long'><p>The class that is added to the content target when you set styleHtmlContent to true.</p>\n<p>Defaults to: <code>&quot;x-html&quot;</code></p></div></div></div><div id='cfg-styleHtmlContent' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-styleHtmlContent' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-styleHtmlContent' class='name expandable'>styleHtmlContent</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to automatically style the html inside the content target of this component (body for panels). ...</div><div class='long'><p>True to automatically style the html inside the content target of this component (body for panels).</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-suspendLayout' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-cfg-suspendLayout' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-cfg-suspendLayout' class='name expandable'>suspendLayout</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>If true, suspend calls to doLayout. ...</div><div class='long'><p>If true, suspend calls to doLayout. Useful when batching multiple adds to a container and not passing them\nas multiple arguments or an array.</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-tbar' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-tbar' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-tbar' class='name expandable'>tbar</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[]</span></div><div class='description'><div class='short'>Convenience config. ...</div><div class='long'><p>Convenience config. Short for 'Top Bar'.</p>\n\n<pre><code>tbar: [\n { xtype: 'button', text: 'Button 1' }\n]\n</code></pre>\n\n<p>is equivalent to</p>\n\n<pre><code>dockedItems: [{\n xtype: 'toolbar',\n dock: 'top',\n items: [\n { xtype: 'button', text: 'Button 1' }\n ]\n}]\n</code></pre>\n</div></div></div><div id='cfg-title' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-title' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-title' class='name expandable'>title</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>The title text to be used to display in the panel header. ...</div><div class='long'><p>The title text to be used to display in the <a href=\"#!/api/Ext.panel.Header\" rel=\"Ext.panel.Header\" class=\"docClass\">panel header</a>. When a\n<code>title</code> is specified the <a href=\"#!/api/Ext.panel.Header\" rel=\"Ext.panel.Header\" class=\"docClass\">Ext.panel.Header</a> will automatically be created and displayed unless\n<a href=\"#!/api/Ext.panel.Panel-cfg-preventHeader\" rel=\"Ext.panel.Panel-cfg-preventHeader\" class=\"docClass\">preventHeader</a> is set to <code>true</code>.</p>\n<p>Defaults to: <code>&quot;&quot;</code></p></div></div></div><div id='cfg-titleCollapse' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-titleCollapse' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-titleCollapse' class='name expandable'>titleCollapse</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>true to allow expanding and collapsing the panel (when collapsible = true) by clicking anywhere in\nthe header bar, fa...</div><div class='long'><p><code>true</code> to allow expanding and collapsing the panel (when <code><a href=\"#!/api/Ext.panel.Panel-cfg-collapsible\" rel=\"Ext.panel.Panel-cfg-collapsible\" class=\"docClass\">collapsible</a> = true</code>) by clicking anywhere in\nthe header bar, <code>false</code>) to allow it only by clicking to tool butto).</p>\n<p>Defaults to: <code>false</code></p></div></div></div><div id='cfg-toFrontOnShow' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-cfg-toFrontOnShow' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-cfg-toFrontOnShow' class='name expandable'>toFrontOnShow</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>True to automatically call toFront when the show method is called on an already visible,\nfloating component. ...</div><div class='long'><p>True to automatically call <a href=\"#!/api/Ext.Component-method-toFront\" rel=\"Ext.Component-method-toFront\" class=\"docClass\">toFront</a> when the <a href=\"#!/api/Ext.Component-event-show\" rel=\"Ext.Component-event-show\" class=\"docClass\">show</a> method is called on an already visible,\nfloating component.</p>\n<p>Defaults to: <code>true</code></p></div></div></div><div id='cfg-tools' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-cfg-tools' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-cfg-tools' class='name expandable'>tools</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[]/<a href=\"#!/api/Ext.panel.Tool\" rel=\"Ext.panel.Tool\" class=\"docClass\">Ext.panel.Tool</a>[]</span></div><div class='description'><div class='short'>An array of Ext.panel.Tool configs/instances to be added to the header tool area. ...</div><div class='long'><p>An array of <a href=\"#!/api/Ext.panel.Tool\" rel=\"Ext.panel.Tool\" class=\"docClass\">Ext.panel.Tool</a> configs/instances to be added to the header tool area. The tools are stored as\nchild components of the header container. They can be accessed using <a href=\"#!/api/Ext.panel.Panel-method-down\" rel=\"Ext.panel.Panel-method-down\" class=\"docClass\">down</a> and {#query}, as well as the\nother component methods. The toggle tool is automatically created if <a href=\"#!/api/Ext.panel.Panel-cfg-collapsible\" rel=\"Ext.panel.Panel-cfg-collapsible\" class=\"docClass\">collapsible</a> is set to true.</p>\n\n<p>Note that, apart from the toggle tool which is provided when a panel is collapsible, these tools only provide the\nvisual button. Any required functionality must be provided by adding handlers that implement the necessary\nbehavior.</p>\n\n<p>Example usage:</p>\n\n<pre><code>tools:[{\n type:'refresh',\n tooltip: 'Refresh form Data',\n // hidden:true,\n handler: function(event, toolEl, panel){\n // refresh logic\n }\n},\n{\n type:'help',\n tooltip: 'Get Help',\n handler: function(event, toolEl, panel){\n // show help here\n }\n}]\n</code></pre>\n</div></div></div><div id='cfg-tpl' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-tpl' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-tpl' class='name expandable'>tpl</a><span> : <a href=\"#!/api/Ext.XTemplate\" rel=\"Ext.XTemplate\" class=\"docClass\">Ext.XTemplate</a>/<a href=\"#!/api/Ext.Template\" rel=\"Ext.Template\" class=\"docClass\">Ext.Template</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[]</span></div><div class='description'><div class='short'>An Ext.Template, Ext.XTemplate or an array of strings to form an Ext.XTemplate. ...</div><div class='long'><p>An <a href=\"#!/api/Ext.Template\" rel=\"Ext.Template\" class=\"docClass\">Ext.Template</a>, <a href=\"#!/api/Ext.XTemplate\" rel=\"Ext.XTemplate\" class=\"docClass\">Ext.XTemplate</a> or an array of strings to form an <a href=\"#!/api/Ext.XTemplate\" rel=\"Ext.XTemplate\" class=\"docClass\">Ext.XTemplate</a>. Used in\nconjunction with the <code><a href=\"#!/api/Ext.AbstractComponent-cfg-data\" rel=\"Ext.AbstractComponent-cfg-data\" class=\"docClass\">data</a></code> and <code><a href=\"#!/api/Ext.AbstractComponent-cfg-tplWriteMode\" rel=\"Ext.AbstractComponent-cfg-tplWriteMode\" class=\"docClass\">tplWriteMode</a></code> configurations.</p>\n</div></div></div><div id='cfg-tplWriteMode' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-tplWriteMode' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-tplWriteMode' class='name expandable'>tplWriteMode</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>The Ext.(X)Template method to use when updating the content area of the Component. ...</div><div class='long'><p>The Ext.(X)Template method to use when updating the content area of the Component.\nSee <code><a href=\"#!/api/Ext.XTemplate-method-overwrite\" rel=\"Ext.XTemplate-method-overwrite\" class=\"docClass\">Ext.XTemplate.overwrite</a></code> for information on default mode.</p>\n<p>Defaults to: <code>&quot;overwrite&quot;</code></p></div></div></div><div id='cfg-ui' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-ui' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-ui' class='name expandable'>ui</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[]</span></div><div class='description'><div class='short'>A set style for a component. ...</div><div class='long'><p>A set style for a component. Can be a string or an Array of multiple strings (UIs)</p>\n<p>Defaults to: <code>&quot;default&quot;</code></p></div></div></div><div id='cfg-width' class='member inherited'><a href='#' class='side not-expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-width' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-width' class='name not-expandable'>width</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></span></div><div class='description'><div class='short'><p>The width of this component in pixels.</p>\n</div><div class='long'><p>The width of this component in pixels.</p>\n</div></div></div><div id='cfg-x' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-x' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-x' class='name expandable'>x</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></span></div><div class='description'><div class='short'>The X position of the left edge of the window on initial showing. ...</div><div class='long'><p>The X position of the left edge of the window on initial showing. Defaults to centering the Window within the\nwidth of the Window's container <a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Element</a> (The Element that the Window is rendered to).</p>\n</div></div></div><div id='cfg-xtype' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-cfg-xtype' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-cfg-xtype' class='name expandable'>xtype</a><span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span></div><div class='description'><div class='short'>The xtype configuration option can be used to optimize Component creation and rendering. ...</div><div class='long'><p>The <code>xtype</code> configuration option can be used to optimize Component creation and rendering. It serves as a\nshortcut to the full componet name. For example, the component <code>Ext.button.Button</code> has an xtype of <code>button</code>.</p>\n\n<p>You can define your own xtype on a custom <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">component</a> by specifying the\n<a href=\"#!/api/Ext.Class-cfg-alias\" rel=\"Ext.Class-cfg-alias\" class=\"docClass\">alias</a> config option with a prefix of <code>widget</code>. For example:</p>\n\n<pre><code>Ext.define('PressMeButton', {\n extend: 'Ext.button.Button',\n alias: 'widget.pressmebutton',\n text: 'Press Me'\n})\n</code></pre>\n\n<p>Any Component can be created implicitly as an object config with an xtype specified, allowing it to be\ndeclared and passed into the rendering pipeline without actually being instantiated as an object. Not only is\nrendering deferred, but the actual creation of the object itself is also deferred, saving memory and resources\nuntil they are actually needed. In complex, nested layouts containing many Components, this can make a\nnoticeable improvement in performance.</p>\n\n<pre><code>// Explicit creation of contained Components:\nvar panel = new Ext.Panel({\n ...\n items: [\n Ext.create('Ext.button.Button', {\n text: 'OK'\n })\n ]\n};\n\n// Implicit creation using xtype:\nvar panel = new Ext.Panel({\n ...\n items: [{\n xtype: 'button',\n text: 'OK'\n }]\n};\n</code></pre>\n\n<p>In the first example, the button will always be created immediately during the panel's initialization. With\nmany added Components, this approach could potentially slow the rendering of the page. In the second example,\nthe button will not be created or rendered until the panel is actually displayed in the browser. If the panel\nis never displayed (for example, if it is a tab that remains hidden) then the button will never be created and\nwill never consume any resources whatsoever.</p>\n</div></div></div><div id='cfg-y' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-cfg-y' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-cfg-y' class='name expandable'>y</a><span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></span></div><div class='description'><div class='short'>The Y position of the top edge of the window on initial showing. ...</div><div class='long'><p>The Y position of the top edge of the window on initial showing. Defaults to centering the Window within the\nheight of the Window's container <a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Element</a> (The Element that the Window is rendered to).</p>\n</div></div></div></div></div><div id='m-property'><div class='definedBy'>Defined By</div><h3 class='members-title'>Properties</h3><div class='subsection'><div id='property-dd' class='member first-child not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-property-dd' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-property-dd' class='name expandable'>dd</a><span> : <a href=\"#!/api/Ext.util.ComponentDragger\" rel=\"Ext.util.ComponentDragger\" class=\"docClass\">Ext.util.ComponentDragger</a></span></div><div class='description'><div class='short'>If this Window is configured draggable, this property will contain an instance of\nExt.util.ComponentDragger (A subcla...</div><div class='long'><p>If this Window is configured <a href=\"#!/api/Ext.window.Window-cfg-draggable\" rel=\"Ext.window.Window-cfg-draggable\" class=\"docClass\">draggable</a>, this property will contain an instance of\n<a href=\"#!/api/Ext.util.ComponentDragger\" rel=\"Ext.util.ComponentDragger\" class=\"docClass\">Ext.util.ComponentDragger</a> (A subclass of <a href=\"#!/api/Ext.dd.DragTracker\" rel=\"Ext.dd.DragTracker\" class=\"docClass\">DragTracker</a>) which handles dragging\nthe Window's DOM Element, and constraining according to the <a href=\"#!/api/Ext.window.Window-cfg-constrain\" rel=\"Ext.window.Window-cfg-constrain\" class=\"docClass\">constrain</a> and <a href=\"#!/api/Ext.window.Window-cfg-constrainHeader\" rel=\"Ext.window.Window-cfg-constrainHeader\" class=\"docClass\">constrainHeader</a> .</p>\n\n<p>This has implementations of <code>onBeforeStart</code>, <code>onDrag</code> and <code>onEnd</code> which perform the dragging action. If\nextra logic is needed at these points, use <a href=\"#!/api/Ext.Function-method-createInterceptor\" rel=\"Ext.Function-method-createInterceptor\" class=\"docClass\">createInterceptor</a> or\n<a href=\"#!/api/Ext.Function-method-createSequence\" rel=\"Ext.Function-method-createSequence\" class=\"docClass\">createSequence</a> to augment the existing implementations.</p>\n</div></div></div><div id='property-draggable' class='member inherited'><a href='#' class='side not-expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-property-draggable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-property-draggable' class='name not-expandable'>draggable</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'><p>Read-only property indicating whether or not the component can be dragged</p>\n</div><div class='long'><p>Read-only property indicating whether or not the component can be dragged</p>\n</div></div></div><div id='property-floatParent' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-property-floatParent' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-property-floatParent' class='name expandable'>floatParent</a><span> : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.Container</a></span></div><div class='description'><div class='short'>Only present for floating Components which were inserted as descendant items of floating Containers. ...</div><div class='long'><p>Only present for <a href=\"#!/api/Ext.Component-cfg-floating\" rel=\"Ext.Component-cfg-floating\" class=\"docClass\">floating</a> Components which were inserted as descendant items of floating Containers.</p>\n\n<p>Floating Components that are programatically <a href=\"#!/api/Ext.Component-event-render\" rel=\"Ext.Component-event-render\" class=\"docClass\">rendered</a> will not have a <code>floatParent</code>\nproperty.</p>\n\n<p>For <a href=\"#!/api/Ext.Component-cfg-floating\" rel=\"Ext.Component-cfg-floating\" class=\"docClass\">floating</a> Components which are child items of a Container, the floatParent will be the floating\nancestor Container which is responsible for the base z-index value of all its floating descendants. It provides\na <a href=\"#!/api/Ext.ZIndexManager\" rel=\"Ext.ZIndexManager\" class=\"docClass\">ZIndexManager</a> which provides z-indexing services for all its descendant floating\nComponents.</p>\n\n<p>For example, the dropdown <a href=\"#!/api/Ext.view.BoundList\" rel=\"Ext.view.BoundList\" class=\"docClass\">BoundList</a> of a ComboBox which is in a Window will have the\nWindow as its <code>floatParent</code></p>\n\n<p>See <a href=\"#!/api/Ext.Component-cfg-floating\" rel=\"Ext.Component-cfg-floating\" class=\"docClass\">floating</a> and <a href=\"#!/api/Ext.Component-property-zIndexManager\" rel=\"Ext.Component-property-zIndexManager\" class=\"docClass\">zIndexManager</a></p>\n</div></div></div><div id='property-frameSize' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-property-frameSize' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-property-frameSize' class='name expandable'>frameSize</a><span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span></div><div class='description'><div class='short'>Read-only property indicating the width of any framing elements which were added within the encapsulating element\nto ...</div><div class='long'><p>Read-only property indicating the width of any framing elements which were added within the encapsulating element\nto provide graphical, rounded borders. See the <a href=\"#!/api/Ext.AbstractComponent-cfg-frame\" rel=\"Ext.AbstractComponent-cfg-frame\" class=\"docClass\">frame</a> config.</p>\n\n<p>This is an object containing the frame width in pixels for all four sides of the Component containing the\nfollowing properties:</p>\n<ul><li><span class='pre'>top</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The width of the top framing element in pixels.</p>\n</div></li><li><span class='pre'>right</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The width of the right framing element in pixels.</p>\n</div></li><li><span class='pre'>bottom</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The width of the bottom framing element in pixels.</p>\n</div></li><li><span class='pre'>left</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The width of the left framing element in pixels.</p>\n</div></li></ul></div></div></div><div id='property-items' class='member inherited'><a href='#' class='side not-expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-property-items' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-property-items' class='name not-expandable'>items</a><span> : <a href=\"#!/api/Ext.util.MixedCollection\" rel=\"Ext.util.MixedCollection\" class=\"docClass\">Ext.util.MixedCollection</a></span></div><div class='description'><div class='short'><p>The MixedCollection containing all the child items of this container.</p>\n</div><div class='long'><p>The MixedCollection containing all the child items of this container.</p>\n</div></div></div><div id='property-maskOnDisable' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-property-maskOnDisable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-property-maskOnDisable' class='name expandable'>maskOnDisable</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'>This is an internal flag that you use when creating custom components. ...</div><div class='long'><p>This is an internal flag that you use when creating custom components. By default this is set to true which means\nthat every component gets a mask when its disabled. Components like FieldContainer, FieldSet, Field, Button, Tab\noverride this property to false since they want to implement custom disable logic.</p>\n</div></div></div><div id='property-ownerCt' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-property-ownerCt' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-property-ownerCt' class='name expandable'>ownerCt</a><span> : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.Container</a></span></div><div class='description'><div class='short'>This Component's owner Container (is set automatically\nwhen this Component is added to a Container). ...</div><div class='long'><p>This Component's owner <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Container</a> (is set automatically\nwhen this Component is added to a Container). Read-only.</p>\n\n<p><strong>Note</strong>: to access items within the Container see <a href=\"#!/api/Ext.AbstractComponent-cfg-itemId\" rel=\"Ext.AbstractComponent-cfg-itemId\" class=\"docClass\">itemId</a>.</p>\n</div></div></div><div id='property-rendered' class='member inherited'><a href='#' class='side not-expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-property-rendered' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-property-rendered' class='name not-expandable'>rendered</a><span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span></div><div class='description'><div class='short'><p>Read-only property indicating whether or not the component has been rendered.</p>\n</div><div class='long'><p>Read-only property indicating whether or not the component has been rendered.</p>\n</div></div></div><div id='property-self' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Base' rel='Ext.Base' class='definedIn docClass'>Ext.Base</a><br/><a href='source/Base3.html#Ext-Base-property-self' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Base-property-self' class='name expandable'>self</a><span> : <a href=\"#!/api/Ext.Class\" rel=\"Ext.Class\" class=\"docClass\">Ext.Class</a></span><strong class='protected-signature'>protected</strong></div><div class='description'><div class='short'>Get the reference to the current class from which this object was instantiated. ...</div><div class='long'><p>Get the reference to the current class from which this object was instantiated. Unlike <a href=\"#!/api/Ext.Base-method-statics\" rel=\"Ext.Base-method-statics\" class=\"docClass\">statics</a>,\n<code>this.self</code> is scope-dependent and it's meant to be used for dynamic inheritance. See <a href=\"#!/api/Ext.Base-method-statics\" rel=\"Ext.Base-method-statics\" class=\"docClass\">statics</a>\nfor a detailed comparison</p>\n\n<pre><code>Ext.define('My.Cat', {\n statics: {\n speciesName: 'Cat' // My.Cat.speciesName = 'Cat'\n },\n\n constructor: function() {\n alert(this.self.speciesName); / dependent on 'this'\n\n return this;\n },\n\n clone: function() {\n return new this.self();\n }\n});\n\n\nExt.define('My.SnowLeopard', {\n extend: 'My.Cat',\n statics: {\n speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'\n }\n});\n\nvar cat = new My.Cat(); // alerts 'Cat'\nvar snowLeopard = new My.SnowLeopard(); // alerts 'Snow Leopard'\n\nvar clone = snowLeopard.clone();\nalert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'\n</code></pre>\n</div></div></div><div id='property-zIndexManager' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-property-zIndexManager' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-property-zIndexManager' class='name expandable'>zIndexManager</a><span> : <a href=\"#!/api/Ext.ZIndexManager\" rel=\"Ext.ZIndexManager\" class=\"docClass\">Ext.ZIndexManager</a></span></div><div class='description'><div class='short'>Only present for floating Components after they have been rendered. ...</div><div class='long'><p>Only present for <a href=\"#!/api/Ext.Component-cfg-floating\" rel=\"Ext.Component-cfg-floating\" class=\"docClass\">floating</a> Components after they have been rendered.</p>\n\n<p>A reference to the ZIndexManager which is managing this Component's z-index.</p>\n\n<p>The <a href=\"#!/api/Ext.ZIndexManager\" rel=\"Ext.ZIndexManager\" class=\"docClass\">ZIndexManager</a> maintains a stack of floating Component z-indices, and also provides\na single modal mask which is insert just beneath the topmost visible modal floating Component.</p>\n\n<p>Floating Components may be <a href=\"#!/api/Ext.Component-method-toFront\" rel=\"Ext.Component-method-toFront\" class=\"docClass\">brought to the front</a> or <a href=\"#!/api/Ext.Component-method-toBack\" rel=\"Ext.Component-method-toBack\" class=\"docClass\">sent to the back</a> of the\nz-index stack.</p>\n\n<p>This defaults to the global <a href=\"#!/api/Ext.WindowManager\" rel=\"Ext.WindowManager\" class=\"docClass\">ZIndexManager</a> for floating Components that are\nprogramatically <a href=\"#!/api/Ext.Component-event-render\" rel=\"Ext.Component-event-render\" class=\"docClass\">rendered</a>.</p>\n\n<p>For <a href=\"#!/api/Ext.Component-cfg-floating\" rel=\"Ext.Component-cfg-floating\" class=\"docClass\">floating</a> Components which are added to a Container, the ZIndexManager is acquired from the first\nancestor Container found which is floating, or if not found the global <a href=\"#!/api/Ext.WindowManager\" rel=\"Ext.WindowManager\" class=\"docClass\">ZIndexManager</a> is\nused.</p>\n\n<p>See <a href=\"#!/api/Ext.Component-cfg-floating\" rel=\"Ext.Component-cfg-floating\" class=\"docClass\">floating</a> and <a href=\"#!/api/Ext.Component-property-floatParent\" rel=\"Ext.Component-property-floatParent\" class=\"docClass\">floatParent</a></p>\n</div></div></div></div></div><div id='m-method'><h3 class='members-title'>Methods</h3><div class='subsection'><div class='definedBy'>Defined By</div><h4 class='members-subtitle'>Instance Methods</h3><div id='method-constructor' class='member first-child inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-constructor' target='_blank' class='viewSource'>view source</a></div><strong class='constructor-signature'>new</strong><a href='#!/api/Ext.Component-method-constructor' class='name expandable'>Ext.window.Window</a>( <span class='pre'><a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> config</span> ) : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></div><div class='description'><div class='short'>Creates new Component. ...</div><div class='long'><p>Creates new Component.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>config</span> : <a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The configuration options may be specified as either:</p>\n\n<ul>\n<li><strong>an element</strong> : it is set as the internal element and its id used as the component id</li>\n<li><strong>a string</strong> : it is assumed to be the id of an existing element and is used as the component id</li>\n<li><strong>anything else</strong> : it is assumed to be a standard config object and is applied to the component</li>\n</ul>\n\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-add' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-method-add' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-method-add' class='name expandable'>add</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>[]/<a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>... component</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>[]/<a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Adds Component(s) to this Container. ...</div><div class='long'><p>Adds <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Component</a>(s) to this Container.</p>\n\n<h2>Description:</h2>\n\n<ul>\n<li>Fires the <a href=\"#!/api/Ext.container.AbstractContainer-event-beforeadd\" rel=\"Ext.container.AbstractContainer-event-beforeadd\" class=\"docClass\">beforeadd</a> event before adding.</li>\n<li>The Container's <a href=\"#!/api/Ext.container.AbstractContainer-cfg-defaults\" rel=\"Ext.container.AbstractContainer-cfg-defaults\" class=\"docClass\">default config values</a> will be applied\naccordingly (see <code><a href=\"#!/api/Ext.container.AbstractContainer-cfg-defaults\" rel=\"Ext.container.AbstractContainer-cfg-defaults\" class=\"docClass\">defaults</a></code> for details).</li>\n<li>Fires the <code><a href=\"#!/api/Ext.container.AbstractContainer-event-add\" rel=\"Ext.container.AbstractContainer-event-add\" class=\"docClass\">add</a></code> event after the component has been added.</li>\n</ul>\n\n\n<h2>Notes:</h2>\n\n<p>If the Container is <strong>already rendered</strong> when <code>add</code>\nis called, it will render the newly added Component into its content area.</p>\n\n<p><strong><strong>If</strong></strong> the Container was configured with a size-managing <a href=\"#!/api/Ext.container.AbstractContainer-cfg-layout\" rel=\"Ext.container.AbstractContainer-cfg-layout\" class=\"docClass\">layout</a> manager, the Container\nwill recalculate its internal layout at this time too.</p>\n\n<p>Note that the default layout manager simply renders child Components sequentially into the content area and thereafter performs no sizing.</p>\n\n<p>If adding multiple new child Components, pass them as an array to the <code>add</code> method, so that only one layout recalculation is performed.</p>\n\n<pre><code>tb = new <a href=\"#!/api/Ext.toolbar.Toolbar\" rel=\"Ext.toolbar.Toolbar\" class=\"docClass\">Ext.toolbar.Toolbar</a>({\n renderTo: document.body\n}); // toolbar is rendered\ntb.add([{text:'Button 1'}, {text:'Button 2'}]); // add multiple items. (<a href=\"#!/api/Ext.container.AbstractContainer-cfg-defaultType\" rel=\"Ext.container.AbstractContainer-cfg-defaultType\" class=\"docClass\">defaultType</a> for <a href=\"#!/api/Ext.toolbar.Toolbar\" rel=\"Ext.toolbar.Toolbar\" class=\"docClass\">Toolbar</a> is 'button')\n</code></pre>\n\n<h2>Warning:</h2>\n\n<p>Components directly managed by the BorderLayout layout manager\nmay not be removed or added. See the Notes for <a href=\"#!/api/Ext.layout.container.Border\" rel=\"Ext.layout.container.Border\" class=\"docClass\">BorderLayout</a>\nfor more details.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>component</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>[]/<a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>...<div class='sub-desc'><p>Either one or more Components to add or an Array of Components to add.\nSee <code><a href=\"#!/api/Ext.container.AbstractContainer-cfg-items\" rel=\"Ext.container.AbstractContainer-cfg-items\" class=\"docClass\">items</a></code> for additional information.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>[]/<a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>The Components that were added.</p>\n</div></li></ul></div></div></div><div id='method-addChildEls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-addChildEls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-addChildEls' class='name expandable'>addChildEls</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Adds each argument passed to this method to the childEls array. ...</div><div class='long'><p>Adds each argument passed to this method to the <a href=\"#!/api/Ext.AbstractComponent-cfg-childEls\" rel=\"Ext.AbstractComponent-cfg-childEls\" class=\"docClass\">childEls</a> array.</p>\n</div></div></div><div id='method-addClass' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-addClass' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-addClass' class='name expandable'>addClass</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> cls</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Adds a CSS class to the top level element representing this component. ...</div><div class='long'><p>Adds a CSS class to the top level element representing this component.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>cls</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The CSS class name to add</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>Returns the Component to allow method chaining.</p>\n</div></li></ul></div></div></div><div id='method-addCls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-addCls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-addCls' class='name expandable'>addCls</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> cls</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Adds a CSS class to the top level element representing this component. ...</div><div class='long'><p>Adds a CSS class to the top level element representing this component.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>cls</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The CSS class name to add</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>Returns the Component to allow method chaining.</p>\n</div></li></ul></div></div></div><div id='method-addClsWithUI' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-addClsWithUI' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-addClsWithUI' class='name expandable'>addClsWithUI</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[] cls, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> skip</span> )</div><div class='description'><div class='short'>Adds a cls to the uiCls array, which will also call addUIClsToElement and adds to all elements of this\ncomponent. ...</div><div class='long'><p>Adds a cls to the uiCls array, which will also call <a href=\"#!/api/Ext.AbstractComponent-method-addUIClsToElement\" rel=\"Ext.AbstractComponent-method-addUIClsToElement\" class=\"docClass\">addUIClsToElement</a> and adds to all elements of this\ncomponent.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>cls</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[]<div class='sub-desc'><p>A string or an array of strings to add to the uiCls</p>\n</div></li><li><span class='pre'>skip</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>(Boolean) skip True to skip adding it to the class and do it later (via the return)</p>\n</div></li></ul></div></div></div><div id='method-addDocked' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.AbstractPanel' rel='Ext.panel.AbstractPanel' class='definedIn docClass'>Ext.panel.AbstractPanel</a><br/><a href='source/AbstractPanel.html#Ext-panel-AbstractPanel-method-addDocked' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.AbstractPanel-method-addDocked' class='name expandable'>addDocked</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[] component, [<a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> pos]</span> )</div><div class='description'><div class='short'>Adds docked item(s) to the panel. ...</div><div class='long'><p>Adds docked item(s) to the panel.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>component</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[]<div class='sub-desc'><p>The Component or array of components to add. The components\nmust include a 'dock' parameter on each component to indicate where it should be docked ('top', 'right',\n'bottom', 'left').</p>\n</div></li><li><span class='pre'>pos</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> (optional)<div class='sub-desc'><p>The index at which the Component will be added</p>\n</div></li></ul></div></div></div><div id='method-addEvents' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-addEvents' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-addEvents' class='name expandable'>addEvents</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> o, [<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>... more]</span> )</div><div class='description'><div class='short'>Adds the specified events to the list of events which this Observable may fire. ...</div><div class='long'><p>Adds the specified events to the list of events which this Observable may fire.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>o</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>Either an object with event names as properties with a value of <code>true</code> or the first\nevent name string if multiple event names are being passed as separate parameters. Usage:</p>\n\n<pre><code>this.addEvents({\n storeloaded: true,\n storecleared: true\n});\n</code></pre>\n</div></li><li><span class='pre'>more</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>... (optional)<div class='sub-desc'><p>Additional event names if multiple event names are being passed as separate\nparameters. Usage:</p>\n\n<pre><code>this.addEvents('storeloaded', 'storecleared');\n</code></pre>\n</div></li></ul></div></div></div><div id='method-addListener' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-addListener' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-addListener' class='name expandable'>addListener</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> eventName, <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> fn, [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> scope], [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> options]</span> )</div><div class='description'><div class='short'>Appends an event handler to this object. ...</div><div class='long'><p>Appends an event handler to this object.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>eventName</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The name of the event to listen for. May also be an object who's property names are\nevent names.</p>\n\n</div></li><li><span class='pre'>fn</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a><div class='sub-desc'><p>The method the event invokes. Will be called with arguments given to\n<a href=\"#!/api/Ext.util.Observable-method-fireEvent\" rel=\"Ext.util.Observable-method-fireEvent\" class=\"docClass\">fireEvent</a> plus the <code>options</code> parameter described below.</p>\n\n</div></li><li><span class='pre'>scope</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>The scope (<code>this</code> reference) in which the handler function is executed. <strong>If\nomitted, defaults to the object which fired the event.</strong></p>\n\n</div></li><li><span class='pre'>options</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>An object containing handler configuration.</p>\n\n\n\n\n<p><strong>Note:</strong> Unlike in ExtJS 3.x, the options object will also be passed as the last argument to every event handler.</p>\n\n\n\n\n<p>This object may contain any of the following properties:</p>\n\n\n\n\n<ul>\n<li><p><strong>scope</strong> : Object</p>\n\n<p>The scope (<code>this</code> reference) in which the handler function is executed. <strong>If omitted, defaults to the object\nwhich fired the event.</strong></p></li>\n<li><p><strong>delay</strong> : Number</p>\n\n<p>The number of milliseconds to delay the invocation of the handler after the event fires.</p></li>\n<li><p><strong>single</strong> : Boolean</p>\n\n<p>True to add a handler to handle just the next firing of the event, and then remove itself.</p></li>\n<li><p><strong>buffer</strong> : Number</p>\n\n<p>Causes the handler to be scheduled to run in an <a href=\"#!/api/Ext.util.DelayedTask\" rel=\"Ext.util.DelayedTask\" class=\"docClass\">Ext.util.DelayedTask</a> delayed by the specified number of\nmilliseconds. If the event fires again within that time, the original handler is <em>not</em> invoked, but the new\nhandler is scheduled in its place.</p></li>\n<li><p><strong>target</strong> : Observable</p>\n\n<p>Only call the handler if the event was fired on the target Observable, <em>not</em> if the event was bubbled up from a\nchild Observable.</p></li>\n<li><p><strong>element</strong> : String</p>\n\n<p><strong>This option is only valid for listeners bound to <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Components</a>.</strong> The name of a Component\nproperty which references an element to add a listener to.</p>\n\n<p>This option is useful during Component construction to add DOM event listeners to elements of\n<a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Components</a> which will exist only after the Component is rendered.\nFor example, to add a click listener to a Panel's body:</p>\n\n<pre><code>new Ext.panel.Panel({\n title: 'The title',\n listeners: {\n click: this.handlePanelClick,\n element: 'body'\n }\n});\n</code></pre></li>\n</ul>\n\n\n\n\n<p><strong>Combining Options</strong></p>\n\n\n\n\n<p>Using the options argument, it is possible to combine different types of listeners:</p>\n\n\n\n\n<p>A delayed, one-time listener.</p>\n\n\n\n\n<pre><code>myPanel.on('hide', this.handleClick, this, {\n single: true,\n delay: 100\n});\n</code></pre>\n\n\n\n\n<p><strong>Attaching multiple handlers in 1 call</strong></p>\n\n\n\n\n<p>The method also allows for a single argument to be passed which is a config object containing properties which\nspecify multiple events. For example:</p>\n\n\n\n\n<pre><code>myGridPanel.on({\n cellClick: this.onCellClick,\n mouseover: this.onMouseOver,\n mouseout: this.onMouseOut,\n scope: this // Important. Ensure \"this\" is correct during handler execution\n});\n</code></pre>\n\n\n\n\n<p>One can also specify options for each event handler separately:</p>\n\n\n\n\n<pre><code>myGridPanel.on({\n cellClick: {fn: this.onCellClick, scope: this, single: true},\n mouseover: {fn: panel.onMouseOver, scope: panel}\n});\n</code></pre>\n\n</div></li></ul></div></div></div><div id='method-addManagedListener' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-addManagedListener' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-addManagedListener' class='name expandable'>addManagedListener</a>( <span class='pre'><a href=\"#!/api/Ext.util.Observable\" rel=\"Ext.util.Observable\" class=\"docClass\">Ext.util.Observable</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a> item, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> ename, [<a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> fn], [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> scope], [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> opt]</span> )</div><div class='description'><div class='short'>Adds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is\ndestr...</div><div class='long'><p>Adds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is\ndestroyed.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>item</span> : <a href=\"#!/api/Ext.util.Observable\" rel=\"Ext.util.Observable\" class=\"docClass\">Ext.util.Observable</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a><div class='sub-desc'><p>The item to which to add a listener/listeners.</p>\n\n</div></li><li><span class='pre'>ename</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The event name, or an object containing event name properties.</p>\n\n</div></li><li><span class='pre'>fn</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> (optional)<div class='sub-desc'><p>If the <code>ename</code> parameter was an event name, this is the handler function.</p>\n\n</div></li><li><span class='pre'>scope</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>If the <code>ename</code> parameter was an event name, this is the scope (<code>this</code> reference)\nin which the handler function is executed.</p>\n\n</div></li><li><span class='pre'>opt</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>If the <code>ename</code> parameter was an event name, this is the\n<a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">addListener</a> options.</p>\n\n</div></li></ul></div></div></div><div id='method-addStateEvents' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.state.Stateful' rel='Ext.state.Stateful' class='definedIn docClass'>Ext.state.Stateful</a><br/><a href='source/Stateful.html#Ext-state-Stateful-method-addStateEvents' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.state.Stateful-method-addStateEvents' class='name expandable'>addStateEvents</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[] events</span> )</div><div class='description'><div class='short'>Add events that will trigger the state to be saved. ...</div><div class='long'><p>Add events that will trigger the state to be saved.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>events</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[]<div class='sub-desc'><p>The event name or an array of event names.</p>\n</div></li></ul></div></div></div><div id='method-addUIClsToElement' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-addUIClsToElement' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-addUIClsToElement' class='name expandable'>addUIClsToElement</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> ui</span> )</div><div class='description'><div class='short'>Method which adds a specified UI + uiCls to the components element. ...</div><div class='long'><p>Method which adds a specified UI + uiCls to the components element. Can be overridden to remove the UI from more\nthan just the components element.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>ui</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The UI to remove from the element</p>\n</div></li></ul></div></div></div><div id='method-afterComponentLayout' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-afterComponentLayout' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-afterComponentLayout' class='name expandable'>afterComponentLayout</a>( <span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> adjWidth, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> adjHeight, <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> isSetSize, <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> callingContainer</span> )</div><div class='description'><div class='short'>Occurs after componentLayout is run. ...</div><div class='long'><p>Occurs after componentLayout is run.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>adjWidth</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The box-adjusted width that was set</p>\n</div></li><li><span class='pre'>adjHeight</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The box-adjusted height that was set</p>\n</div></li><li><span class='pre'>isSetSize</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a><div class='sub-desc'><p>Whether or not the height/width are stored on the component permanently</p>\n</div></li><li><span class='pre'>callingContainer</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'><p>Container requesting the layout. Only used when isSetSize is false.</p>\n</div></li></ul></div></div></div><div id='method-alignTo' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Floating' rel='Ext.util.Floating' class='definedIn docClass'>Ext.util.Floating</a><br/><a href='source/Floating.html#Ext-util-Floating-method-alignTo' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Floating-method-alignTo' class='name expandable'>alignTo</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a>/HTMLElement/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> element, [<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> position], [<a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>[] offsets]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Aligns this floating Component to the specified element ...</div><div class='long'><p>Aligns this floating Component to the specified element</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>element</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a>/HTMLElement/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The element or <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> to align to. If passing a component, it must be a\nomponent instance. If a string id is passed, it will be used as an element id.</p>\n</div></li><li><span class='pre'>position</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> (optional)<div class='sub-desc'><p>The position to align to (see <a href=\"#!/api/Ext.Element-method-alignTo\" rel=\"Ext.Element-method-alignTo\" class=\"docClass\">Ext.Element.alignTo</a> for more details).</p>\n<p>Defaults to: <code>&quot;tl-bl?&quot;</code></p></div></li><li><span class='pre'>offsets</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>[] (optional)<div class='sub-desc'><p>Offset the positioning by [x, y]</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-animate' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Animate' rel='Ext.util.Animate' class='definedIn docClass'>Ext.util.Animate</a><br/><a href='source/Animate.html#Ext-util-Animate-method-animate' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Animate-method-animate' class='name expandable'>animate</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> config</span> ) : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></div><div class='description'><div class='short'>Perform custom animation on this object. ...</div><div class='long'><p>Perform custom animation on this object.<p>\n<p>This method is applicable to both the <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Component</a> class and the <a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Element</a> class.\nIt performs animated transitions of certain properties of this object over a specified timeline.</p>\n<p>The sole parameter is an object which specifies start property values, end property values, and properties which\ndescribe the timeline. Of the properties listed below, only <b><code>to</code></b> is mandatory.</p>\n<p>Properties include<ul>\n<li><code>from</code> <div class=\"sub-desc\">An object which specifies start values for the properties being animated.\nIf not supplied, properties are animated from current settings. The actual properties which may be animated depend upon\nths object being animated. See the sections below on Element and Component animation.<div></li>\n<li><code>to</code> <div class=\"sub-desc\">An object which specifies end values for the properties being animated.</div></li>\n<li><code>duration</code><div class=\"sub-desc\">The duration <b>in milliseconds</b> for which the animation will run.</div></li>\n<li><code>easing</code> <div class=\"sub-desc\">A string value describing an easing type to modify the rate of change from the default linear to non-linear. Values may be one of:<code><ul>\n<li>ease</li>\n<li>easeIn</li>\n<li>easeOut</li>\n<li>easeInOut</li>\n<li>backIn</li>\n<li>backOut</li>\n<li>elasticIn</li>\n<li>elasticOut</li>\n<li>bounceIn</li>\n<li>bounceOut</li>\n</ul></code></div></li>\n<li><code>keyframes</code> <div class=\"sub-desc\">This is an object which describes the state of animated properties at certain points along the timeline.\nit is an object containing properties who's names are the percentage along the timeline being described and who's values specify the animation state at that point.</div></li>\n<li><code>listeners</code> <div class=\"sub-desc\">This is a standard <a href=\"#!/api/Ext.util.Observable-cfg-listeners\" rel=\"Ext.util.Observable-cfg-listeners\" class=\"docClass\">listeners</a> configuration object which may be used\nto inject behaviour at either the <code>beforeanimate</code> event or the <code>afteranimate</code> event.</div></li>\n</ul></p>\n<h3>Animating an <a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Element</a></h3>\nWhen animating an Element, the following properties may be specified in <code>from</code>, <code>to</code>, and <code>keyframe</code> objects:<ul>\n<li><code>x</code> <div class=\"sub-desc\">The page X position in pixels.</div></li>\n<li><code>y</code> <div class=\"sub-desc\">The page Y position in pixels</div></li>\n<li><code>left</code> <div class=\"sub-desc\">The element's CSS <code>left</code> value. Units must be supplied.</div></li>\n<li><code>top</code> <div class=\"sub-desc\">The element's CSS <code>top</code> value. Units must be supplied.</div></li>\n<li><code>width</code> <div class=\"sub-desc\">The element's CSS <code>width</code> value. Units must be supplied.</div></li>\n<li><code>height</code> <div class=\"sub-desc\">The element's CSS <code>height</code> value. Units must be supplied.</div></li>\n<li><code>scrollLeft</code> <div class=\"sub-desc\">The element's <code>scrollLeft</code> value.</div></li>\n<li><code>scrollTop</code> <div class=\"sub-desc\">The element's <code>scrollLeft</code> value.</div></li>\n<li><code>opacity</code> <div class=\"sub-desc\">The element's <code>opacity</code> value. This must be a value between <code>0</code> and <code>1</code>.</div></li>\n</ul>\n<p><b>Be aware than animating an Element which is being used by an Ext Component without in some way informing the Component about the changed element state\nwill result in incorrect Component behaviour. This is because the Component will be using the old state of the element. To avoid this problem, it is now possible to\ndirectly animate certain properties of Components.</b></p>\n<h3>Animating a <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Component</a></h3>\nWhen animating an Element, the following properties may be specified in <code>from</code>, <code>to</code>, and <code>keyframe</code> objects:<ul>\n<li><code>x</code> <div class=\"sub-desc\">The Component's page X position in pixels.</div></li>\n<li><code>y</code> <div class=\"sub-desc\">The Component's page Y position in pixels</div></li>\n<li><code>left</code> <div class=\"sub-desc\">The Component's <code>left</code> value in pixels.</div></li>\n<li><code>top</code> <div class=\"sub-desc\">The Component's <code>top</code> value in pixels.</div></li>\n<li><code>width</code> <div class=\"sub-desc\">The Component's <code>width</code> value in pixels.</div></li>\n<li><code>width</code> <div class=\"sub-desc\">The Component's <code>width</code> value in pixels.</div></li>\n<li><code>dynamic</code> <div class=\"sub-desc\">Specify as true to update the Component's layout (if it is a Container) at every frame\nof the animation. <i>Use sparingly as laying out on every intermediate size change is an expensive operation</i>.</div></li>\n</ul>\n<p>For example, to animate a Window to a new size, ensuring that its internal layout, and any shadow is correct:</p>\n<pre><code>myWindow = Ext.create('Ext.window.Window', {\n title: 'Test Component animation',\n width: 500,\n height: 300,\n layout: {\n type: 'hbox',\n align: 'stretch'\n },\n items: [{\n title: 'Left: 33%',\n margins: '5 0 5 5',\n flex: 1\n }, {\n title: 'Left: 66%',\n margins: '5 5 5 5',\n flex: 2\n }]\n});\nmyWindow.show();\nmyWindow.header.el.on('click', function() {\n myWindow.animate({\n to: {\n width: (myWindow.getWidth() == 500) ? 700 : 500,\n height: (myWindow.getHeight() == 300) ? 400 : 300,\n }\n });\n});\n</code></pre>\n<p>For performance reasons, by default, the internal layout is only updated when the Window reaches its final <code>\"to\"</code> size. If dynamic updating of the Window's child\nComponents is required, then configure the animation with <code>dynamic: true</code> and the two child items will maintain their proportions during the animation.</p>\n\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>config</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>An object containing properties which describe the animation's start and end states, and the timeline of the animation.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-applyState' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.state.Stateful' rel='Ext.state.Stateful' class='definedIn docClass'>Ext.state.Stateful</a><br/><a href='source/Stateful.html#Ext-state-Stateful-method-applyState' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.state.Stateful-method-applyState' class='name expandable'>applyState</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> state</span> )</div><div class='description'><div class='short'>Applies the state to the object. ...</div><div class='long'><p>Applies the state to the object. This should be overridden in subclasses to do\nmore complex state operations. By default it applies the state properties onto\nthe current object.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>state</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The state</p>\n</div></li></ul></div></div></div><div id='method-beforeComponentLayout' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-beforeComponentLayout' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-beforeComponentLayout' class='name expandable'>beforeComponentLayout</a>( <span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> adjWidth, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> adjHeight, <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> isSetSize, <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> callingContainer</span> )</div><div class='description'><div class='short'>Occurs before componentLayout is run. ...</div><div class='long'><p>Occurs before componentLayout is run. Returning false from this method will prevent the componentLayout from\nbeing executed.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>adjWidth</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The box-adjusted width that was set</p>\n</div></li><li><span class='pre'>adjHeight</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The box-adjusted height that was set</p>\n</div></li><li><span class='pre'>isSetSize</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a><div class='sub-desc'><p>Whether or not the height/width are stored on the component permanently</p>\n</div></li><li><span class='pre'>callingContainer</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'><p>Container requesting sent the layout. Only used when isSetSize is false.</p>\n</div></li></ul></div></div></div><div id='method-beforeLayout' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-method-beforeLayout' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-method-beforeLayout' class='name expandable'>beforeLayout</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Occurs before componentLayout is run. ...</div><div class='long'><p>Occurs before componentLayout is run. Returning false from this method will prevent the containerLayout\nfrom being executed.</p>\n</div></div></div><div id='method-bubble' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-bubble' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-bubble' class='name expandable'>bubble</a>( <span class='pre'><a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> fn, [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> scope], [<a href=\"#!/api/Array\" rel=\"Array\" class=\"docClass\">Array</a> args]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Bubbles up the component/container heirarchy, calling the specified function with each component. ...</div><div class='long'><p>Bubbles up the component/container heirarchy, calling the specified function with each component. The scope\n(<em>this</em>) of function call will be the scope provided or the current component. The arguments to the function will\nbe the args provided or the current component. If the function returns false at any point, the bubble is stopped.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>fn</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a><div class='sub-desc'><p>The function to call</p>\n</div></li><li><span class='pre'>scope</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>The scope of the function. Defaults to current node.</p>\n</div></li><li><span class='pre'>args</span> : <a href=\"#!/api/Array\" rel=\"Array\" class=\"docClass\">Array</a> (optional)<div class='sub-desc'><p>The args to call the function with. Defaults to passing the current component.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-callOverridden' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Base' rel='Ext.Base' class='definedIn docClass'>Ext.Base</a><br/><a href='source/Base3.html#Ext-Base-method-callOverridden' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Base-method-callOverridden' class='name expandable'>callOverridden</a>( <span class='pre'><a href=\"#!/api/Array\" rel=\"Array\" class=\"docClass\">Array</a>/Arguments args</span> ) : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><strong class='protected-signature'>protected</strong></div><div class='description'><div class='short'>Call the original method that was previously overridden with override\n\nExt.define('My.Cat', {\n constructor: functi...</div><div class='long'><p>Call the original method that was previously overridden with <a href=\"#!/api/Ext.Base-static-method-override\" rel=\"Ext.Base-static-method-override\" class=\"docClass\">override</a></p>\n\n<pre><code>Ext.define('My.Cat', {\n constructor: function() {\n alert(\"I'm a cat!\");\n\n return this;\n }\n});\n\nMy.Cat.override({\n constructor: function() {\n alert(\"I'm going to be a cat!\");\n\n var instance = this.callOverridden();\n\n alert(\"Meeeeoooowwww\");\n\n return instance;\n }\n});\n\nvar kitty = new My.Cat(); // alerts \"I'm going to be a cat!\"\n // alerts \"I'm a cat!\"\n // alerts \"Meeeeoooowwww\"\n</code></pre>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>args</span> : <a href=\"#!/api/Array\" rel=\"Array\" class=\"docClass\">Array</a>/Arguments<div class='sub-desc'><p>The arguments, either an array or the <code>arguments</code> object</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span><div class='sub-desc'><p>Returns the result after calling the overridden method</p>\n</div></li></ul></div></div></div><div id='method-callParent' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Base' rel='Ext.Base' class='definedIn docClass'>Ext.Base</a><br/><a href='source/Base3.html#Ext-Base-method-callParent' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Base-method-callParent' class='name expandable'>callParent</a>( <span class='pre'><a href=\"#!/api/Array\" rel=\"Array\" class=\"docClass\">Array</a>/Arguments args</span> ) : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><strong class='protected-signature'>protected</strong></div><div class='description'><div class='short'>Call the parent's overridden method. ...</div><div class='long'><p>Call the parent's overridden method. For example:</p>\n\n<pre><code>Ext.define('My.own.A', {\n constructor: function(test) {\n alert(test);\n }\n});\n\nExt.define('My.own.B', {\n extend: 'My.own.A',\n\n constructor: function(test) {\n alert(test);\n\n this.callParent([test + 1]);\n }\n});\n\nExt.define('My.own.C', {\n extend: 'My.own.B',\n\n constructor: function() {\n alert(\"Going to call parent's overriden constructor...\");\n\n this.callParent(arguments);\n }\n});\n\nvar a = new My.own.A(1); // alerts '1'\nvar b = new My.own.B(1); // alerts '1', then alerts '2'\nvar c = new My.own.C(2); // alerts \"Going to call parent's overriden constructor...\"\n // alerts '2', then alerts '3'\n</code></pre>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>args</span> : <a href=\"#!/api/Array\" rel=\"Array\" class=\"docClass\">Array</a>/Arguments<div class='sub-desc'><p>The arguments, either an array or the <code>arguments</code> object\nfrom the current method, for example: <code>this.callParent(arguments)</code></p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span><div class='sub-desc'><p>Returns the result from the superclass' method</p>\n</div></li></ul></div></div></div><div id='method-cascade' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-method-cascade' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-method-cascade' class='name expandable'>cascade</a>( <span class='pre'><a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> fn, [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> scope], [<a href=\"#!/api/Array\" rel=\"Array\" class=\"docClass\">Array</a> args]</span> ) : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.Container</a></div><div class='description'><div class='short'>Cascades down the component/container heirarchy from this component (passed in the first call), calling the specified...</div><div class='long'><p>Cascades down the component/container heirarchy from this component (passed in the first call), calling the specified function with\neach component. The scope (<code>this</code> reference) of the\nfunction call will be the scope provided or the current component. The arguments to the function\nwill be the args provided or the current component. If the function returns false at any point,\nthe cascade is stopped on that branch.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>fn</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a><div class='sub-desc'><p>The function to call</p>\n</div></li><li><span class='pre'>scope</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>The scope of the function (defaults to current component)</p>\n</div></li><li><span class='pre'>args</span> : <a href=\"#!/api/Array\" rel=\"Array\" class=\"docClass\">Array</a> (optional)<div class='sub-desc'><p>The args to call the function with. The current component always passed as the last argument.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.Container</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-center' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Floating' rel='Ext.util.Floating' class='definedIn docClass'>Ext.util.Floating</a><br/><a href='source/Floating.html#Ext-util-Floating-method-center' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Floating-method-center' class='name expandable'>center</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Center this Component in its container. ...</div><div class='long'><p>Center this Component in its container.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-child' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-method-child' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-method-child' class='name expandable'>child</a>( <span class='pre'>[<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> selector]</span> )</div><div class='description'><div class='short'>Retrieves the first direct child of this container which matches the passed selector. ...</div><div class='long'><p>Retrieves the first direct child of this container which matches the passed selector.\nThe passed in selector must comply with an <a href=\"#!/api/Ext.ComponentQuery\" rel=\"Ext.ComponentQuery\" class=\"docClass\">Ext.ComponentQuery</a> selector.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>selector</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> (optional)<div class='sub-desc'><p>An <a href=\"#!/api/Ext.ComponentQuery\" rel=\"Ext.ComponentQuery\" class=\"docClass\">Ext.ComponentQuery</a> selector. If no selector is\nspecified, the first child will be returned.</p>\n</div></li></ul></div></div></div><div id='method-clearListeners' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-clearListeners' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-clearListeners' class='name expandable'>clearListeners</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Removes all listeners for this object including the managed listeners ...</div><div class='long'><p>Removes all listeners for this object including the managed listeners</p>\n</div></div></div><div id='method-clearManagedListeners' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-clearManagedListeners' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-clearManagedListeners' class='name expandable'>clearManagedListeners</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Removes all managed listeners for this object. ...</div><div class='long'><p>Removes all managed listeners for this object.</p>\n</div></div></div><div id='method-cloneConfig' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-cloneConfig' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-cloneConfig' class='name expandable'>cloneConfig</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> overrides</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Clone the current component using the original config values passed into this instance by default. ...</div><div class='long'><p>Clone the current component using the original config values passed into this instance by default.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>overrides</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>A new config containing any properties to override in the cloned version.\nAn id property can be passed on this object, otherwise one will be generated to avoid duplicates.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>clone The cloned copy of this component</p>\n</div></li></ul></div></div></div><div id='method-close' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-method-close' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-method-close' class='name expandable'>close</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Closes the Panel. ...</div><div class='long'><p>Closes the Panel. By default, this method, removes it from the DOM, <a href=\"#!/api/Ext.Component-event-destroy\" rel=\"Ext.Component-event-destroy\" class=\"docClass\">destroy</a>s the\nPanel object and all its descendant Components. The <a href=\"#!/api/Ext.panel.Panel-event-beforeclose\" rel=\"Ext.panel.Panel-event-beforeclose\" class=\"docClass\">beforeclose</a> event is fired before the\nclose happens and will cancel the close action if it returns false.</p>\n\n<p><strong>Note:</strong> This method is also affected by the <a href=\"#!/api/Ext.panel.Panel-cfg-closeAction\" rel=\"Ext.panel.Panel-cfg-closeAction\" class=\"docClass\">closeAction</a> setting. For more explicit control use\n<a href=\"#!/api/Ext.panel.Panel-event-destroy\" rel=\"Ext.panel.Panel-event-destroy\" class=\"docClass\">destroy</a> and <a href=\"#!/api/Ext.panel.Panel-event-hide\" rel=\"Ext.panel.Panel-event-hide\" class=\"docClass\">hide</a> methods.</p>\n</div></div></div><div id='method-collapse' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-method-collapse' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-method-collapse' class='name expandable'>collapse</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> direction, [<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> animate]</span> ) : <a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a></div><div class='description'><div class='short'>Collapses the panel body so that the body becomes hidden. ...</div><div class='long'><p>Collapses the panel body so that the body becomes hidden. Docked Components parallel to the border towards which\nthe collapse takes place will remain visible. Fires the <a href=\"#!/api/Ext.panel.Panel-event-beforecollapse\" rel=\"Ext.panel.Panel-event-beforecollapse\" class=\"docClass\">beforecollapse</a> event which will cancel the\ncollapse action if it returns false.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>direction</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>. The direction to collapse towards. Must be one of</p>\n\n<ul>\n<li>Ext.Component.DIRECTION_TOP</li>\n<li>Ext.Component.DIRECTION_RIGHT</li>\n<li>Ext.Component.DIRECTION_BOTTOM</li>\n<li>Ext.Component.DIRECTION_LEFT</li>\n</ul>\n\n</div></li><li><span class='pre'>animate</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>True to animate the transition, else false (defaults to the value of the\n<a href=\"#!/api/Ext.panel.Panel-cfg-animCollapse\" rel=\"Ext.panel.Panel-cfg-animCollapse\" class=\"docClass\">animCollapse</a> panel config)</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-constructPlugins' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-constructPlugins' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-constructPlugins' class='name expandable'>constructPlugins</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Ensures that the plugins array contains fully constructed plugin instances. ...</div><div class='long'><p>Ensures that the plugins array contains fully constructed plugin instances. This converts any configs into their\nappropriate instances.</p>\n</div></div></div><div id='method-destroy' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-destroy' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-destroy' class='name expandable'>destroy</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Destroys the Component. ...</div><div class='long'><p>Destroys the Component.</p>\n</div></div></div><div id='method-disable' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-disable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-disable' class='name expandable'>disable</a>( <span class='pre'>[<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> silent]</span> )</div><div class='description'><div class='short'>Disable the component. ...</div><div class='long'><p>Disable the component.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>silent</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>Passing true will supress the 'disable' event from being fired.</p>\n<p>Defaults to: <code>false</code></p></div></li></ul></div></div></div><div id='method-doAutoRender' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-doAutoRender' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-doAutoRender' class='name expandable'>doAutoRender</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Handles autoRender. ...</div><div class='long'><p>Handles autoRender. Floating Components may have an ownerCt. If they are asking to be constrained, constrain them\nwithin that ownerCt, and have their z-index managed locally. Floating Components are always rendered to\ndocument.body</p>\n</div></div></div><div id='method-doComponentLayout' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-doComponentLayout' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-doComponentLayout' class='name expandable'>doComponentLayout</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> width, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> height, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> isSetSize, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> callingContainer</span> ) : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a></div><div class='description'><div class='short'>This method needs to be called whenever you change something on this component that requires the Component's\nlayout t...</div><div class='long'><p>This method needs to be called whenever you change something on this component that requires the Component's\nlayout to be recalculated.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>width</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'>\n</div></li><li><span class='pre'>height</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'>\n</div></li><li><span class='pre'>isSetSize</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'>\n</div></li><li><span class='pre'>callingContainer</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-doConstrain' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Floating' rel='Ext.util.Floating' class='definedIn docClass'>Ext.util.Floating</a><br/><a href='source/Floating.html#Ext-util-Floating-method-doConstrain' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Floating-method-doConstrain' class='name expandable'>doConstrain</a>( <span class='pre'>[<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/HTMLElement/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a>/<a href=\"#!/api/Ext.util.Region\" rel=\"Ext.util.Region\" class=\"docClass\">Ext.util.Region</a> constrainTo]</span> )</div><div class='description'><div class='short'>Moves this floating Component into a constrain region. ...</div><div class='long'><p>Moves this floating Component into a constrain region.</p>\n\n<p>By default, this Component is constrained to be within the container it was added to, or the element it was\nrendered to.</p>\n\n<p>An alternative constraint may be passed.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>constrainTo</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/HTMLElement/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a>/<a href=\"#!/api/Ext.util.Region\" rel=\"Ext.util.Region\" class=\"docClass\">Ext.util.Region</a> (optional)<div class='sub-desc'><p>The Element or <a href=\"#!/api/Ext.util.Region\" rel=\"Ext.util.Region\" class=\"docClass\">Region</a> into which this Component is\nto be constrained. Defaults to the element into which this floating Component was rendered.</p>\n</div></li></ul></div></div></div><div id='method-doLayout' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-method-doLayout' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-method-doLayout' class='name expandable'>doLayout</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a></div><div class='description'><div class='short'>Manually force this container's layout to be recalculated. ...</div><div class='long'><p>Manually force this container's layout to be recalculated. The framework uses this internally to refresh layouts\nform most cases.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-down' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-method-down' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-method-down' class='name expandable'>down</a>( <span class='pre'>[<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> selector]</span> )</div><div class='description'><div class='short'>Retrieves the first descendant of this container which matches the passed selector. ...</div><div class='long'><p>Retrieves the first descendant of this container which matches the passed selector.\nThe passed in selector must comply with an <a href=\"#!/api/Ext.ComponentQuery\" rel=\"Ext.ComponentQuery\" class=\"docClass\">Ext.ComponentQuery</a> selector.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>selector</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> (optional)<div class='sub-desc'><p>An <a href=\"#!/api/Ext.ComponentQuery\" rel=\"Ext.ComponentQuery\" class=\"docClass\">Ext.ComponentQuery</a> selector. If no selector is\nspecified, the first child will be returned.</p>\n</div></li></ul></div></div></div><div id='method-enable' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-enable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-enable' class='name expandable'>enable</a>( <span class='pre'>[<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> silent]</span> )</div><div class='description'><div class='short'>Enable the component ...</div><div class='long'><p>Enable the component</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>silent</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>Passing true will supress the 'enable' event from being fired.</p>\n<p>Defaults to: <code>false</code></p></div></li></ul></div></div></div><div id='method-enableBubble' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-enableBubble' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-enableBubble' class='name expandable'>enableBubble</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[] events</span> )</div><div class='description'><div class='short'>Enables events fired by this Observable to bubble up an owner hierarchy by calling this.getBubbleTarget() if\npresent. ...</div><div class='long'><p>Enables events fired by this Observable to bubble up an owner hierarchy by calling <code>this.getBubbleTarget()</code> if\npresent. There is no implementation in the Observable base class.</p>\n\n<p>This is commonly used by Ext.Components to bubble events to owner Containers.\nSee <a href=\"#!/api/Ext.Component-method-getBubbleTarget\" rel=\"Ext.Component-method-getBubbleTarget\" class=\"docClass\">Ext.Component.getBubbleTarget</a>. The default implementation in <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> returns the\nComponent's immediate owner. But if a known target is required, this can be overridden to access the\nrequired target more quickly.</p>\n\n<p>Example:</p>\n\n<pre><code>Ext.override(Ext.form.field.Base, {\n // Add functionality to Field's initComponent to enable the change event to bubble\n initComponent : Ext.Function.createSequence(Ext.form.field.Base.prototype.initComponent, function() {\n this.enableBubble('change');\n }),\n\n // We know that we want Field's events to bubble directly to the FormPanel.\n getBubbleTarget : function() {\n if (!this.formPanel) {\n this.formPanel = this.findParentByType('form');\n }\n return this.formPanel;\n }\n});\n\nvar myForm = new Ext.formPanel({\n title: 'User Details',\n items: [{\n ...\n }],\n listeners: {\n change: function() {\n // Title goes red if form has been modified.\n myForm.header.setStyle('color', 'red');\n }\n }\n});\n</code></pre>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>events</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[]<div class='sub-desc'><p>The event name to bubble, or an Array of event names.</p>\n</div></li></ul></div></div></div><div id='method-expand' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-method-expand' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-method-expand' class='name expandable'>expand</a>( <span class='pre'>[<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> animate]</span> ) : <a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a></div><div class='description'><div class='short'>Expands the panel body so that it becomes visible. ...</div><div class='long'><p>Expands the panel body so that it becomes visible. Fires the <a href=\"#!/api/Ext.panel.Panel-event-beforeexpand\" rel=\"Ext.panel.Panel-event-beforeexpand\" class=\"docClass\">beforeexpand</a> event which will cancel the\nexpand action if it returns false.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>animate</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>True to animate the transition, else false (defaults to the value of the\n<a href=\"#!/api/Ext.panel.Panel-cfg-animCollapse\" rel=\"Ext.panel.Panel-cfg-animCollapse\" class=\"docClass\">animCollapse</a> panel config)</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-findLayoutController' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-findLayoutController' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-findLayoutController' class='name expandable'>findLayoutController</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>This method finds the topmost active layout who's processing will eventually determine the size and position of\nthis ...</div><div class='long'><p>This method finds the topmost active layout who's processing will eventually determine the size and position of\nthis Component.</p>\n\n<p>This method is useful when dynamically adding Components into Containers, and some processing must take place\nafter the final sizing and positioning of the Component has been performed.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-findParentBy' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-findParentBy' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-findParentBy' class='name expandable'>findParentBy</a>( <span class='pre'><a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> fn</span> ) : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a></div><div class='description'><div class='short'>Find a container above this component at any level by a custom function. ...</div><div class='long'><p>Find a container above this component at any level by a custom function. If the passed function returns true, the\ncontainer will be returned.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>fn</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a><div class='sub-desc'><p>The custom function to call with the arguments (container, this component).</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a></span><div class='sub-desc'><p>The first Container for which the custom function returns true</p>\n</div></li></ul></div></div></div><div id='method-findParentByType' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-findParentByType' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-findParentByType' class='name expandable'>findParentByType</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Ext.Class\" rel=\"Ext.Class\" class=\"docClass\">Ext.Class</a> xtype</span> ) : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a></div><div class='description'><div class='short'>Find a container above this component at any level by xtype or class\n\nSee also the up method. ...</div><div class='long'><p>Find a container above this component at any level by xtype or class</p>\n\n<p>See also the <a href=\"#!/api/Ext.Component-method-up\" rel=\"Ext.Component-method-up\" class=\"docClass\">up</a> method.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>xtype</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Ext.Class\" rel=\"Ext.Class\" class=\"docClass\">Ext.Class</a><div class='sub-desc'><p>The xtype string for a component, or the class of the component directly</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a></span><div class='sub-desc'><p>The first Container which matches the given xtype or class</p>\n</div></li></ul></div></div></div><div id='method-fireEvent' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-fireEvent' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-fireEvent' class='name expandable'>fireEvent</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> eventName, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>... args</span> ) : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></div><div class='description'><div class='short'>Fires the specified event with the passed parameters (minus the event name, plus the options object passed\nto addList...</div><div class='long'><p>Fires the specified event with the passed parameters (minus the event name, plus the <code>options</code> object passed\nto <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">addListener</a>).</p>\n\n<p>An event may be set to bubble up an Observable parent hierarchy (See <a href=\"#!/api/Ext.Component-method-getBubbleTarget\" rel=\"Ext.Component-method-getBubbleTarget\" class=\"docClass\">Ext.Component.getBubbleTarget</a>) by\ncalling <a href=\"#!/api/Ext.util.Observable-method-enableBubble\" rel=\"Ext.util.Observable-method-enableBubble\" class=\"docClass\">enableBubble</a>.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>eventName</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The name of the event to fire.</p>\n</div></li><li><span class='pre'>args</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>...<div class='sub-desc'><p>Variable number of parameters are passed to handlers.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>returns false if any of the handlers return false otherwise it returns true.</p>\n</div></li></ul></div></div></div><div id='method-focus' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-focus' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-focus' class='name expandable'>focus</a>( <span class='pre'>[<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> selectText], [<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a>/<a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> delay]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Try to focus this component. ...</div><div class='long'><p>Try to focus this component.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>selectText</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>If applicable, true to also select the text in this component</p>\n</div></li><li><span class='pre'>delay</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a>/<a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> (optional)<div class='sub-desc'><p>Delay the focus this number of milliseconds (true for 10 milliseconds).</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-forceComponentLayout' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-forceComponentLayout' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-forceComponentLayout' class='name expandable'>forceComponentLayout</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Forces this component to redo its componentLayout. ...</div><div class='long'><p>Forces this component to redo its componentLayout.</p>\n</div></div></div><div id='method-getActiveAnimation' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Animate' rel='Ext.util.Animate' class='definedIn docClass'>Ext.util.Animate</a><br/><a href='source/Animate.html#Ext-util-Animate-method-getActiveAnimation' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Animate-method-getActiveAnimation' class='name expandable'>getActiveAnimation</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.fx.Anim\" rel=\"Ext.fx.Anim\" class=\"docClass\">Ext.fx.Anim</a>/<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></div><div class='description'><div class='short'>Returns the current animation if this object has any effects actively running or queued, else returns false. ...</div><div class='long'><p>Returns the current animation if this object has any effects actively running or queued, else returns false.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.fx.Anim\" rel=\"Ext.fx.Anim\" class=\"docClass\">Ext.fx.Anim</a>/<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>Anim if element has active effects, else false</p>\n\n</div></li></ul></div></div></div><div id='method-getBox' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-getBox' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-getBox' class='name expandable'>getBox</a>( <span class='pre'>[<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> local]</span> ) : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></div><div class='description'><div class='short'>Gets the current box measurements of the component's underlying element. ...</div><div class='long'><p>Gets the current box measurements of the component's underlying element.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>local</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>If true the element's left and top are returned instead of page XY.</p>\n<p>Defaults to: <code>false</code></p></div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span><div class='sub-desc'><p>box An object in the format {x, y, width, height}</p>\n</div></li></ul></div></div></div><div id='method-getBubbleTarget' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-getBubbleTarget' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-getBubbleTarget' class='name expandable'>getBubbleTarget</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a></div><div class='description'><div class='short'>Provides the link for Observable's fireEvent method to bubble up the ownership hierarchy. ...</div><div class='long'><p>Provides the link for Observable's fireEvent method to bubble up the ownership hierarchy.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a></span><div class='sub-desc'><p>the Container which owns this Component.</p>\n</div></li></ul></div></div></div><div id='method-getChildByElement' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.Container' rel='Ext.container.Container' class='definedIn docClass'>Ext.container.Container</a><br/><a href='source/Container.html#Ext-container-Container-method-getChildByElement' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.Container-method-getChildByElement' class='name expandable'>getChildByElement</a>( <span class='pre'><a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a>/HTMLElement/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> el</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Return the immediate child Component in which the passed element is located. ...</div><div class='long'><p>Return the immediate child Component in which the passed element is located.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>el</span> : <a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a>/HTMLElement/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The element to test (or ID of element).</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>The child item which contains the passed element.</p>\n</div></li></ul></div></div></div><div id='method-getComponent' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.AbstractPanel' rel='Ext.panel.AbstractPanel' class='definedIn docClass'>Ext.panel.AbstractPanel</a><br/><a href='source/AbstractPanel.html#Ext-panel-AbstractPanel-method-getComponent' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.AbstractPanel-method-getComponent' class='name expandable'>getComponent</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> comp</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Attempts a default component lookup (see Ext.container.Container.getComponent). ...</div><div class='long'><p>Attempts a default component lookup (see <a href=\"#!/api/Ext.container.Container-method-getComponent\" rel=\"Ext.container.Container-method-getComponent\" class=\"docClass\">Ext.container.Container.getComponent</a>). If the component is not found in the normal\nitems, the dockedItems are searched and the matched component (if any) returned (see <a href=\"#!/api/Ext.panel.AbstractPanel-method-getDockedComponent\" rel=\"Ext.panel.AbstractPanel-method-getDockedComponent\" class=\"docClass\">getDockedComponent</a>). Note that docked\nitems will only be matched by component id or itemId -- if you pass a numeric index only non-docked child components will be searched.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>comp</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The component id, itemId or position to find</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>The component (if found)</p>\n</div></li></ul></div></div></div><div id='method-getDockedComponent' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.AbstractPanel' rel='Ext.panel.AbstractPanel' class='definedIn docClass'>Ext.panel.AbstractPanel</a><br/><a href='source/AbstractPanel.html#Ext-panel-AbstractPanel-method-getDockedComponent' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.AbstractPanel-method-getDockedComponent' class='name expandable'>getDockedComponent</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> comp</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Finds a docked component by id, itemId or position. ...</div><div class='long'><p>Finds a docked component by id, itemId or position. Also see <a href=\"#!/api/Ext.panel.AbstractPanel-method-getDockedItems\" rel=\"Ext.panel.AbstractPanel-method-getDockedItems\" class=\"docClass\">getDockedItems</a></p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>comp</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The id, itemId or position of the docked component (see <a href=\"#!/api/Ext.panel.AbstractPanel-method-getComponent\" rel=\"Ext.panel.AbstractPanel-method-getComponent\" class=\"docClass\">getComponent</a> for details)</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>The docked component (if found)</p>\n</div></li></ul></div></div></div><div id='method-getDockedItems' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.AbstractPanel' rel='Ext.panel.AbstractPanel' class='definedIn docClass'>Ext.panel.AbstractPanel</a><br/><a href='source/AbstractPanel.html#Ext-panel-AbstractPanel-method-getDockedItems' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.AbstractPanel-method-getDockedItems' class='name expandable'>getDockedItems</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> cqSelector</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>[]</div><div class='description'><div class='short'>Retrieve an array of all currently docked Components. ...</div><div class='long'><p>Retrieve an array of all currently docked Components.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>cqSelector</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>A <a href=\"#!/api/Ext.ComponentQuery\" rel=\"Ext.ComponentQuery\" class=\"docClass\">ComponentQuery</a> selector string to filter the returned items.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>[]</span><div class='sub-desc'><p>An array of components.</p>\n</div></li></ul></div></div></div><div id='method-getEl' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-getEl' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-getEl' class='name expandable'>getEl</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.core.Element</a></div><div class='description'><div class='short'>Retrieves the top level element representing this component. ...</div><div class='long'><p>Retrieves the top level element representing this component.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.core.Element</a></span><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-getFocusEl' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-method-getFocusEl' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-method-getFocusEl' class='name expandable'>getFocusEl</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Gets the configured default focus item. ...</div><div class='long'><p>Gets the configured default focus item. If a <a href=\"#!/api/Ext.window.Window-cfg-defaultFocus\" rel=\"Ext.window.Window-cfg-defaultFocus\" class=\"docClass\">defaultFocus</a> is set, it will receive focus, otherwise the\nContainer itself will receive focus.</p>\n</div></div></div><div id='method-getHeight' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-getHeight' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-getHeight' class='name expandable'>getHeight</a>( <span class='pre'></span> ) : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></div><div class='description'><div class='short'>Gets the current height of the component's underlying element. ...</div><div class='long'><p>Gets the current height of the component's underlying element.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></span><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-getId' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-getId' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-getId' class='name expandable'>getId</a>( <span class='pre'></span> ) : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></div><div class='description'><div class='short'>Retrieves the id of this component. ...</div><div class='long'><p>Retrieves the id of this component. Will autogenerate an id if one has not already been set.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-getInsertPosition' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-getInsertPosition' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-getInsertPosition' class='name expandable'>getInsertPosition</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a>/HTMLElement position</span> ) : HTMLElement</div><div class='description'><div class='short'>This function takes the position argument passed to onRender and returns a DOM element that you can use in the\ninsert...</div><div class='long'><p>This function takes the position argument passed to onRender and returns a DOM element that you can use in the\ninsertBefore.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>position</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a>/HTMLElement<div class='sub-desc'><p>Index, element id or element you want to put this\ncomponent before.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'>HTMLElement</span><div class='sub-desc'><p>DOM element that you can use in the insertBefore</p>\n</div></li></ul></div></div></div><div id='method-getLayout' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-method-getLayout' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-method-getLayout' class='name expandable'>getLayout</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.layout.container.AbstractContainer\" rel=\"Ext.layout.container.AbstractContainer\" class=\"docClass\">Ext.layout.container.AbstractContainer</a></div><div class='description'><div class='short'>Returns the layout instance currently associated with this Container. ...</div><div class='long'><p>Returns the <a href=\"#!/api/Ext.layout.container.AbstractContainer\" rel=\"Ext.layout.container.AbstractContainer\" class=\"docClass\">layout</a> instance currently associated with this Container.\nIf a layout has not been instantiated yet, that is done first</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.layout.container.AbstractContainer\" rel=\"Ext.layout.container.AbstractContainer\" class=\"docClass\">Ext.layout.container.AbstractContainer</a></span><div class='sub-desc'><p>The layout</p>\n</div></li></ul></div></div></div><div id='method-getLoader' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-getLoader' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-getLoader' class='name expandable'>getLoader</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.ComponentLoader\" rel=\"Ext.ComponentLoader\" class=\"docClass\">Ext.ComponentLoader</a></div><div class='description'><div class='short'>Gets the Ext.ComponentLoader for this Component. ...</div><div class='long'><p>Gets the <a href=\"#!/api/Ext.ComponentLoader\" rel=\"Ext.ComponentLoader\" class=\"docClass\">Ext.ComponentLoader</a> for this Component.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.ComponentLoader\" rel=\"Ext.ComponentLoader\" class=\"docClass\">Ext.ComponentLoader</a></span><div class='sub-desc'><p>The loader instance, null if it doesn't exist.</p>\n</div></li></ul></div></div></div><div id='method-getPlugin' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-getPlugin' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-getPlugin' class='name expandable'>getPlugin</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> pluginId</span> ) : <a href=\"#!/api/Ext.AbstractPlugin\" rel=\"Ext.AbstractPlugin\" class=\"docClass\">Ext.AbstractPlugin</a></div><div class='description'><div class='short'>Retrieves a plugin by its pluginId which has been bound to this component. ...</div><div class='long'><p>Retrieves a plugin by its pluginId which has been bound to this component.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>pluginId</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.AbstractPlugin\" rel=\"Ext.AbstractPlugin\" class=\"docClass\">Ext.AbstractPlugin</a></span><div class='sub-desc'><p>plugin instance.</p>\n</div></li></ul></div></div></div><div id='method-getPosition' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-getPosition' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-getPosition' class='name expandable'>getPosition</a>( <span class='pre'>[<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> local]</span> ) : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>[]</div><div class='description'><div class='short'>Gets the current XY position of the component's underlying element. ...</div><div class='long'><p>Gets the current XY position of the component's underlying element.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>local</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>If true the element's left and top are returned instead of page XY.</p>\n<p>Defaults to: <code>false</code></p></div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>[]</span><div class='sub-desc'><p>The XY position of the element (e.g., [100, 200])</p>\n</div></li></ul></div></div></div><div id='method-getSize' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-getSize' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-getSize' class='name expandable'>getSize</a>( <span class='pre'></span> ) : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></div><div class='description'><div class='short'>Gets the current size of the component's underlying element. ...</div><div class='long'><p>Gets the current size of the component's underlying element.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span><div class='sub-desc'><p>An object containing the element's size {width: (element width), height: (element height)}</p>\n</div></li></ul></div></div></div><div id='method-getState' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-getState' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-getState' class='name expandable'>getState</a>( <span class='pre'></span> ) : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></div><div class='description'><div class='short'>The supplied default state gathering method for the AbstractComponent class. ...</div><div class='long'><p>The supplied default state gathering method for the AbstractComponent class.</p>\n\n<p>This method returns dimension settings such as <code>flex</code>, <code>anchor</code>, <code>width</code> and <code>height</code> along with <code>collapsed</code>\nstate.</p>\n\n<p>Subclasses which implement more complex state should call the superclass's implementation, and apply their state\nto the result if this basic state is to be saved.</p>\n\n<p>Note that Component state will only be saved if the Component has a <a href=\"#!/api/Ext.AbstractComponent-cfg-stateId\" rel=\"Ext.AbstractComponent-cfg-stateId\" class=\"docClass\">stateId</a> and there as a StateProvider\nconfigured for the document.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-getStateId' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.state.Stateful' rel='Ext.state.Stateful' class='definedIn docClass'>Ext.state.Stateful</a><br/><a href='source/Stateful.html#Ext-state-Stateful-method-getStateId' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.state.Stateful-method-getStateId' class='name expandable'>getStateId</a>( <span class='pre'></span> ) : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></div><div class='description'><div class='short'>Gets the state id for this object. ...</div><div class='long'><p>Gets the state id for this object.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span><div class='sub-desc'><p>The state id, null if not found.</p>\n</div></li></ul></div></div></div><div id='method-getWidth' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-getWidth' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-getWidth' class='name expandable'>getWidth</a>( <span class='pre'></span> ) : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></div><div class='description'><div class='short'>Gets the current width of the component's underlying element. ...</div><div class='long'><p>Gets the current width of the component's underlying element.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a></span><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-getXType' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-getXType' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-getXType' class='name expandable'>getXType</a>( <span class='pre'></span> ) : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></div><div class='description'><div class='short'>Gets the xtype for this component as registered with Ext.ComponentManager. ...</div><div class='long'><p>Gets the xtype for this component as registered with <a href=\"#!/api/Ext.ComponentManager\" rel=\"Ext.ComponentManager\" class=\"docClass\">Ext.ComponentManager</a>. For a list of all available\nxtypes, see the <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> header. Example usage:</p>\n\n<pre><code>var t = new Ext.form.field.Text();\nalert(t.getXType()); // alerts 'textfield'\n</code></pre>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span><div class='sub-desc'><p>The xtype</p>\n</div></li></ul></div></div></div><div id='method-getXTypes' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-getXTypes' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-getXTypes' class='name expandable'>getXTypes</a>( <span class='pre'></span> ) : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></div><div class='description'><div class='short'>Returns this Component's xtype hierarchy as a slash-delimited string. ...</div><div class='long'><p>Returns this Component's xtype hierarchy as a slash-delimited string. For a list of all available xtypes, see the\n<a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> header.</p>\n\n<p><strong>If using your own subclasses, be aware that a Component must register its own xtype to participate in\ndetermination of inherited xtypes.</strong></p>\n\n<p>Example usage:</p>\n\n<pre><code>var t = new Ext.form.field.Text();\nalert(t.getXTypes()); // alerts 'component/field/textfield'\n</code></pre>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span><div class='sub-desc'><p>The xtype hierarchy string</p>\n</div></li></ul></div></div></div><div id='method-hasActiveFx' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Animate' rel='Ext.util.Animate' class='definedIn docClass'>Ext.util.Animate</a><br/><a href='source/Animate.html#Ext-util-Animate-method-hasActiveFx' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Animate-method-hasActiveFx' class='name expandable'>hasActiveFx</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.fx.Anim\" rel=\"Ext.fx.Anim\" class=\"docClass\">Ext.fx.Anim</a>/<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a><strong class='deprecated-signature'>deprecated</strong></div><div class='description'><div class='short'>Returns the current animation if this object has any effects actively running or queued, else returns false. ...</div><div class='long'><p>Returns the current animation if this object has any effects actively running or queued, else returns false.</p>\n<div class='deprecated'><p>This method has been <strong>deprecated</strong> since 4.0</p><p>Replaced by <a href=\"#!/api/Ext.util.Animate-method-getActiveAnimation\" rel=\"Ext.util.Animate-method-getActiveAnimation\" class=\"docClass\">getActiveAnimation</a></p>\n</div><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.fx.Anim\" rel=\"Ext.fx.Anim\" class=\"docClass\">Ext.fx.Anim</a>/<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>Anim if element has active effects, else false</p>\n\n</div></li></ul></div></div></div><div id='method-hasListener' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-hasListener' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-hasListener' class='name expandable'>hasListener</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> eventName</span> ) : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></div><div class='description'><div class='short'>Checks to see if this object has any listeners for a specified event ...</div><div class='long'><p>Checks to see if this object has any listeners for a specified event</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>eventName</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The name of the event to check for</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>True if the event is being listened for, else false</p>\n</div></li></ul></div></div></div><div id='method-hasUICls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-hasUICls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-hasUICls' class='name expandable'>hasUICls</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> cls</span> )</div><div class='description'><div class='short'>Checks if there is currently a specified uiCls ...</div><div class='long'><p>Checks if there is currently a specified uiCls</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>cls</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The cls to check</p>\n</div></li></ul></div></div></div><div id='method-hide' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-hide' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-hide' class='name expandable'>hide</a>( <span class='pre'>[<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a>/<a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> animateTarget], [<a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> callback], [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> scope]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Hides this Component, setting it to invisible using the configured hideMode. ...</div><div class='long'><p>Hides this Component, setting it to invisible using the configured <a href=\"#!/api/Ext.Component-cfg-hideMode\" rel=\"Ext.Component-cfg-hideMode\" class=\"docClass\">hideMode</a>.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>animateTarget</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a>/<a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> (optional)<div class='sub-desc'><p><strong>only valid for <a href=\"#!/api/Ext.Component-cfg-floating\" rel=\"Ext.Component-cfg-floating\" class=\"docClass\">floating</a> Components\nsuch as <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Window</a>s or <a href=\"#!/api/Ext.tip.ToolTip\" rel=\"Ext.tip.ToolTip\" class=\"docClass\">ToolTip</a>s, or regular Components which have\nbeen configured with <code>floating: true</code>.</strong>. The target to which the Component should animate while hiding.</p>\n<p>Defaults to: <code>null</code></p></div></li><li><span class='pre'>callback</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> (optional)<div class='sub-desc'><p>A callback function to call after the Component is hidden.</p>\n</div></li><li><span class='pre'>scope</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>The scope (<code>this</code> reference) in which the callback is executed.\nDefaults to this Component.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-initComponent' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-initComponent' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-initComponent' class='name expandable'>initComponent</a>( <span class='pre'></span> )<strong class='template-signature'>template</strong></div><div class='description'><div class='short'>The initComponent template method is an important initialization step for a Component. ...</div><div class='long'><p>The initComponent template method is an important initialization step for a Component. It is intended to be\nimplemented by each subclass of <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> to provide any needed constructor logic. The\ninitComponent method of the class being created is called first, with each initComponent method\nup the hierarchy to <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> being called thereafter. This makes it easy to implement and,\nif needed, override the constructor logic of the Component at any step in the hierarchy.</p>\n\n<p>The initComponent method <strong>must</strong> contain a call to <a href=\"#!/api/Ext.Base-method-callParent\" rel=\"Ext.Base-method-callParent\" class=\"docClass\">callParent</a> in order\nto ensure that the parent class' initComponent method is also called.</p>\n\n<p>The following example demonstrates using a dynamic string for the text of a button at the time of\ninstantiation of the class.</p>\n\n<pre><code>Ext.define('DynamicButtonText', {\n extend: 'Ext.button.Button',\n\n initComponent: function() {\n this.text = new Date();\n this.renderTo = Ext.getBody();\n this.callParent();\n }\n});\n\nExt.onReady(function() {\n Ext.create('DynamicButtonText');\n});\n</code></pre>\n<div class='template'><p>This is a template method. A hook into the functionality of this class.Feel free to override it in child classes.</p></div></div></div></div><div id='method-initConfig' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Base' rel='Ext.Base' class='definedIn docClass'>Ext.Base</a><br/><a href='source/Base3.html#Ext-Base-method-initConfig' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Base-method-initConfig' class='name expandable'>initConfig</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> config</span> ) : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><strong class='protected-signature'>protected</strong></div><div class='description'><div class='short'>Initialize configuration for this class. ...</div><div class='long'><p>Initialize configuration for this class. a typical example:</p>\n\n<pre><code>Ext.define('My.awesome.Class', {\n // The default config\n config: {\n name: 'Awesome',\n isAwesome: true\n },\n\n constructor: function(config) {\n this.initConfig(config);\n\n return this;\n }\n});\n\nvar awesome = new My.awesome.Class({\n name: 'Super Awesome'\n});\n\nalert(awesome.getName()); // 'Super Awesome'\n</code></pre>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>config</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span><div class='sub-desc'><p>mixins The mixin prototypes as key - value pairs</p>\n</div></li></ul></div></div></div><div id='method-insert' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-method-insert' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-method-insert' class='name expandable'>insert</a>( <span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> index, <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> component</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Inserts a Component into this Container at a specified index. ...</div><div class='long'><p>Inserts a Component into this Container at a specified index. Fires the\n<a href=\"#!/api/Ext.container.AbstractContainer-event-beforeadd\" rel=\"Ext.container.AbstractContainer-event-beforeadd\" class=\"docClass\">beforeadd</a> event before inserting, then fires the <a href=\"#!/api/Ext.container.AbstractContainer-event-add\" rel=\"Ext.container.AbstractContainer-event-add\" class=\"docClass\">add</a> event after the\nComponent has been inserted.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>index</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The index at which the Component will be inserted\ninto the Container's items collection</p>\n</div></li><li><span class='pre'>component</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'><p>The child Component to insert.<br><br>\nExt uses lazy rendering, and will only render the inserted Component should\nit become necessary.<br><br>\nA Component config object may be passed in order to avoid the overhead of\nconstructing a real Component object if lazy rendering might mean that the\ninserted Component will not be rendered immediately. To take advantage of\nthis 'lazy instantiation', set the <a href=\"#!/api/Ext.Component-cfg-xtype\" rel=\"Ext.Component-cfg-xtype\" class=\"docClass\">Ext.Component.xtype</a> config\nproperty to the registered type of the Component wanted.<br><br>\nFor a list of all available xtypes, see <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>component The Component (or config object) that was\ninserted with the Container's default config values applied.</p>\n</div></li></ul></div></div></div><div id='method-insertDocked' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.AbstractPanel' rel='Ext.panel.AbstractPanel' class='definedIn docClass'>Ext.panel.AbstractPanel</a><br/><a href='source/AbstractPanel.html#Ext-panel-AbstractPanel-method-insertDocked' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.AbstractPanel-method-insertDocked' class='name expandable'>insertDocked</a>( <span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> pos, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[] component</span> )</div><div class='description'><div class='short'>Inserts docked item(s) to the panel at the indicated position. ...</div><div class='long'><p>Inserts docked item(s) to the panel at the indicated position.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>pos</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The index at which the Component will be inserted</p>\n</div></li><li><span class='pre'>component</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>[]<div class='sub-desc'><p>. The Component or array of components to add. The components\nmust include a 'dock' paramater on each component to indicate where it should be docked ('top', 'right',\n'bottom', 'left').</p>\n</div></li></ul></div></div></div><div id='method-is' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-is' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-is' class='name expandable'>is</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> selector</span> ) : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></div><div class='description'><div class='short'>Tests whether this Component matches the selector string. ...</div><div class='long'><p>Tests whether this Component matches the selector string.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>selector</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The selector string to test against.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>True if this Component matches the selector.</p>\n</div></li></ul></div></div></div><div id='method-isDescendantOf' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-isDescendantOf' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-isDescendantOf' class='name expandable'>isDescendantOf</a>( <span class='pre'><a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.Container</a> container</span> ) : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></div><div class='description'><div class='short'>Determines whether this component is the descendant of a particular container. ...</div><div class='long'><p>Determines whether this component is the descendant of a particular container.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>container</span> : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.Container</a><div class='sub-desc'>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>True if it is.</p>\n</div></li></ul></div></div></div><div id='method-isDisabled' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-isDisabled' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-isDisabled' class='name expandable'>isDisabled</a>( <span class='pre'></span> ) : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></div><div class='description'><div class='short'>Method to determine whether this Component is currently disabled. ...</div><div class='long'><p>Method to determine whether this Component is currently disabled.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>the disabled state of this Component.</p>\n</div></li></ul></div></div></div><div id='method-isDraggable' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-isDraggable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-isDraggable' class='name expandable'>isDraggable</a>( <span class='pre'></span> ) : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></div><div class='description'><div class='short'>Method to determine whether this Component is draggable. ...</div><div class='long'><p>Method to determine whether this Component is draggable.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>the draggable state of this component.</p>\n</div></li></ul></div></div></div><div id='method-isDroppable' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-isDroppable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-isDroppable' class='name expandable'>isDroppable</a>( <span class='pre'></span> ) : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></div><div class='description'><div class='short'>Method to determine whether this Component is droppable. ...</div><div class='long'><p>Method to determine whether this Component is droppable.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>the droppable state of this component.</p>\n</div></li></ul></div></div></div><div id='method-isFloating' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-isFloating' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-isFloating' class='name expandable'>isFloating</a>( <span class='pre'></span> ) : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></div><div class='description'><div class='short'>Method to determine whether this Component is floating. ...</div><div class='long'><p>Method to determine whether this Component is floating.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>the floating state of this component.</p>\n</div></li></ul></div></div></div><div id='method-isHidden' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-isHidden' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-isHidden' class='name expandable'>isHidden</a>( <span class='pre'></span> ) : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></div><div class='description'><div class='short'>Method to determine whether this Component is currently set to hidden. ...</div><div class='long'><p>Method to determine whether this Component is currently set to hidden.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>the hidden state of this Component.</p>\n</div></li></ul></div></div></div><div id='method-isVisible' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-isVisible' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-isVisible' class='name expandable'>isVisible</a>( <span class='pre'>[<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> deep]</span> ) : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></div><div class='description'><div class='short'>Returns true if this component is visible. ...</div><div class='long'><p>Returns true if this component is visible.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>deep</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>Pass <code>true</code> to interrogate the visibility status of all parent Containers to\ndetermine whether this Component is truly visible to the user.</p>\n\n<p>Generally, to determine whether a Component is hidden, the no argument form is needed. For example when creating\ndynamically laid out UIs in a hidden Container before showing them.</p>\n<p>Defaults to: <code>false</code></p></div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>True if this component is visible, false otherwise.</p>\n</div></li></ul></div></div></div><div id='method-isXType' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-isXType' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-isXType' class='name expandable'>isXType</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> xtype, [<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> shallow]</span> ) : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></div><div class='description'><div class='short'>Tests whether or not this Component is of a specific xtype. ...</div><div class='long'><p>Tests whether or not this Component is of a specific xtype. This can test whether this Component is descended\nfrom the xtype (default) or whether it is directly of the xtype specified (shallow = true).</p>\n\n<p><strong>If using your own subclasses, be aware that a Component must register its own xtype to participate in\ndetermination of inherited xtypes.</strong></p>\n\n<p>For a list of all available xtypes, see the <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> header.</p>\n\n<p>Example usage:</p>\n\n<pre><code>var t = new Ext.form.field.Text();\nvar isText = t.isXType('textfield'); // true\nvar isBoxSubclass = t.isXType('field'); // true, descended from <a href=\"#!/api/Ext.form.field.Base\" rel=\"Ext.form.field.Base\" class=\"docClass\">Ext.form.field.Base</a>\nvar isBoxInstance = t.isXType('field', true); // false, not a direct <a href=\"#!/api/Ext.form.field.Base\" rel=\"Ext.form.field.Base\" class=\"docClass\">Ext.form.field.Base</a> instance\n</code></pre>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>xtype</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The xtype to check for this Component</p>\n</div></li><li><span class='pre'>shallow</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>True to check whether this Component is directly of the specified xtype, false to\ncheck whether this Component is descended from the xtype.</p>\n<p>Defaults to: <code>false</code></p></div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>True if this component descends from the specified xtype, false otherwise.</p>\n</div></li></ul></div></div></div><div id='method-maximize' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-method-maximize' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-method-maximize' class='name expandable'>maximize</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a></div><div class='description'><div class='short'>Fits the window within its current container and automatically replaces the 'maximize' tool\nbutton with the 'restore'...</div><div class='long'><p>Fits the window within its current container and automatically replaces the <a href=\"#!/api/Ext.window.Window-cfg-maximizable\" rel=\"Ext.window.Window-cfg-maximizable\" class=\"docClass\">'maximize' tool\nbutton</a> with the 'restore' tool button. Also see <a href=\"#!/api/Ext.window.Window-method-toggleMaximize\" rel=\"Ext.window.Window-method-toggleMaximize\" class=\"docClass\">toggleMaximize</a>.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-minimize' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-method-minimize' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-method-minimize' class='name expandable'>minimize</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a></div><div class='description'><div class='short'>Placeholder method for minimizing the window. ...</div><div class='long'><p>Placeholder method for minimizing the window. By default, this method simply fires the <a href=\"#!/api/Ext.window.Window-event-minimize\" rel=\"Ext.window.Window-event-minimize\" class=\"docClass\">minimize</a> event\nsince the behavior of minimizing a window is application-specific. To implement custom minimize behavior, either\nthe minimize event can be handled or this method can be overridden.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-mon' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-mon' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-mon' class='name expandable'>mon</a>( <span class='pre'><a href=\"#!/api/Ext.util.Observable\" rel=\"Ext.util.Observable\" class=\"docClass\">Ext.util.Observable</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a> item, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> ename, [<a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> fn], [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> scope], [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> opt]</span> )</div><div class='description'><div class='short'>Shorthand for addManagedListener. ...</div><div class='long'><p>Shorthand for <a href=\"#!/api/Ext.util.Observable-method-addManagedListener\" rel=\"Ext.util.Observable-method-addManagedListener\" class=\"docClass\">addManagedListener</a>.</p>\n\n<p>Adds listeners to any Observable object (or Ext.Element) which are automatically removed when this Component is\ndestroyed.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>item</span> : <a href=\"#!/api/Ext.util.Observable\" rel=\"Ext.util.Observable\" class=\"docClass\">Ext.util.Observable</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a><div class='sub-desc'><p>The item to which to add a listener/listeners.</p>\n\n</div></li><li><span class='pre'>ename</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The event name, or an object containing event name properties.</p>\n\n</div></li><li><span class='pre'>fn</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> (optional)<div class='sub-desc'><p>If the <code>ename</code> parameter was an event name, this is the handler function.</p>\n\n</div></li><li><span class='pre'>scope</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>If the <code>ename</code> parameter was an event name, this is the scope (<code>this</code> reference)\nin which the handler function is executed.</p>\n\n</div></li><li><span class='pre'>opt</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>If the <code>ename</code> parameter was an event name, this is the\n<a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">addListener</a> options.</p>\n\n</div></li></ul></div></div></div><div id='method-move' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-method-move' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-method-move' class='name expandable'>move</a>( <span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> fromIdx, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> toIdx</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Moves a Component within the Container ...</div><div class='long'><p>Moves a Component within the Container</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>fromIdx</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The index the Component you wish to move is currently at.</p>\n</div></li><li><span class='pre'>toIdx</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The new index for the Component.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>component The Component (or config object) that was moved.</p>\n</div></li></ul></div></div></div><div id='method-mun' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-mun' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-mun' class='name expandable'>mun</a>( <span class='pre'><a href=\"#!/api/Ext.util.Observable\" rel=\"Ext.util.Observable\" class=\"docClass\">Ext.util.Observable</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a> item, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> ename, [<a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> fn], [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> scope]</span> )</div><div class='description'><div class='short'>Shorthand for removeManagedListener. ...</div><div class='long'><p>Shorthand for <a href=\"#!/api/Ext.util.Observable-method-removeManagedListener\" rel=\"Ext.util.Observable-method-removeManagedListener\" class=\"docClass\">removeManagedListener</a>.</p>\n\n<p>Removes listeners that were added by the <a href=\"#!/api/Ext.util.Observable-method-mon\" rel=\"Ext.util.Observable-method-mon\" class=\"docClass\">mon</a> method.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>item</span> : <a href=\"#!/api/Ext.util.Observable\" rel=\"Ext.util.Observable\" class=\"docClass\">Ext.util.Observable</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a><div class='sub-desc'><p>The item from which to remove a listener/listeners.</p>\n\n</div></li><li><span class='pre'>ename</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The event name, or an object containing event name properties.</p>\n\n</div></li><li><span class='pre'>fn</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> (optional)<div class='sub-desc'><p>If the <code>ename</code> parameter was an event name, this is the handler function.</p>\n\n</div></li><li><span class='pre'>scope</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>If the <code>ename</code> parameter was an event name, this is the scope (<code>this</code> reference)\nin which the handler function is executed.</p>\n\n</div></li></ul></div></div></div><div id='method-nextNode' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-nextNode' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-nextNode' class='name expandable'>nextNode</a>( <span class='pre'>[<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> selector]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Returns the next node in the Component tree in tree traversal order. ...</div><div class='long'><p>Returns the next node in the Component tree in tree traversal order.</p>\n\n<p>Note that this is not limited to siblings, and if invoked upon a node with no matching siblings, will walk the\ntree to attempt to find a match. Contrast with <a href=\"#!/api/Ext.AbstractComponent-method-nextSibling\" rel=\"Ext.AbstractComponent-method-nextSibling\" class=\"docClass\">nextSibling</a>.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>selector</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> (optional)<div class='sub-desc'><p>A <a href=\"#!/api/Ext.ComponentQuery\" rel=\"Ext.ComponentQuery\" class=\"docClass\">ComponentQuery</a> selector to filter the following nodes.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>The next node (or the next node which matches the selector).\nReturns null if there is no matching node.</p>\n</div></li></ul></div></div></div><div id='method-nextSibling' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-nextSibling' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-nextSibling' class='name expandable'>nextSibling</a>( <span class='pre'>[<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> selector]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Returns the next sibling of this Component. ...</div><div class='long'><p>Returns the next sibling of this Component.</p>\n\n<p>Optionally selects the next sibling which matches the passed <a href=\"#!/api/Ext.ComponentQuery\" rel=\"Ext.ComponentQuery\" class=\"docClass\">ComponentQuery</a> selector.</p>\n\n<p>May also be refered to as <strong><code>next()</code></strong></p>\n\n<p>Note that this is limited to siblings, and if no siblings of the item match, <code>null</code> is returned. Contrast with\n<a href=\"#!/api/Ext.AbstractComponent-method-nextNode\" rel=\"Ext.AbstractComponent-method-nextNode\" class=\"docClass\">nextNode</a></p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>selector</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> (optional)<div class='sub-desc'><p>A <a href=\"#!/api/Ext.ComponentQuery\" rel=\"Ext.ComponentQuery\" class=\"docClass\">ComponentQuery</a> selector to filter the following items.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>The next sibling (or the next sibling which matches the selector).\nReturns null if there is no matching sibling.</p>\n</div></li></ul></div></div></div><div id='method-on' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-on' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-on' class='name expandable'>on</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> eventName, <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> fn, [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> scope], [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> options]</span> )</div><div class='description'><div class='short'>Shorthand for addListener. ...</div><div class='long'><p>Shorthand for <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">addListener</a>.</p>\n\n<p>Appends an event handler to this object.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>eventName</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The name of the event to listen for. May also be an object who's property names are\nevent names.</p>\n\n</div></li><li><span class='pre'>fn</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a><div class='sub-desc'><p>The method the event invokes. Will be called with arguments given to\n<a href=\"#!/api/Ext.util.Observable-method-fireEvent\" rel=\"Ext.util.Observable-method-fireEvent\" class=\"docClass\">fireEvent</a> plus the <code>options</code> parameter described below.</p>\n\n</div></li><li><span class='pre'>scope</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>The scope (<code>this</code> reference) in which the handler function is executed. <strong>If\nomitted, defaults to the object which fired the event.</strong></p>\n\n</div></li><li><span class='pre'>options</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>An object containing handler configuration.</p>\n\n\n\n\n<p><strong>Note:</strong> Unlike in ExtJS 3.x, the options object will also be passed as the last argument to every event handler.</p>\n\n\n\n\n<p>This object may contain any of the following properties:</p>\n\n\n\n\n<ul>\n<li><p><strong>scope</strong> : Object</p>\n\n<p>The scope (<code>this</code> reference) in which the handler function is executed. <strong>If omitted, defaults to the object\nwhich fired the event.</strong></p></li>\n<li><p><strong>delay</strong> : Number</p>\n\n<p>The number of milliseconds to delay the invocation of the handler after the event fires.</p></li>\n<li><p><strong>single</strong> : Boolean</p>\n\n<p>True to add a handler to handle just the next firing of the event, and then remove itself.</p></li>\n<li><p><strong>buffer</strong> : Number</p>\n\n<p>Causes the handler to be scheduled to run in an <a href=\"#!/api/Ext.util.DelayedTask\" rel=\"Ext.util.DelayedTask\" class=\"docClass\">Ext.util.DelayedTask</a> delayed by the specified number of\nmilliseconds. If the event fires again within that time, the original handler is <em>not</em> invoked, but the new\nhandler is scheduled in its place.</p></li>\n<li><p><strong>target</strong> : Observable</p>\n\n<p>Only call the handler if the event was fired on the target Observable, <em>not</em> if the event was bubbled up from a\nchild Observable.</p></li>\n<li><p><strong>element</strong> : String</p>\n\n<p><strong>This option is only valid for listeners bound to <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Components</a>.</strong> The name of a Component\nproperty which references an element to add a listener to.</p>\n\n<p>This option is useful during Component construction to add DOM event listeners to elements of\n<a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Components</a> which will exist only after the Component is rendered.\nFor example, to add a click listener to a Panel's body:</p>\n\n<pre><code>new Ext.panel.Panel({\n title: 'The title',\n listeners: {\n click: this.handlePanelClick,\n element: 'body'\n }\n});\n</code></pre></li>\n</ul>\n\n\n\n\n<p><strong>Combining Options</strong></p>\n\n\n\n\n<p>Using the options argument, it is possible to combine different types of listeners:</p>\n\n\n\n\n<p>A delayed, one-time listener.</p>\n\n\n\n\n<pre><code>myPanel.on('hide', this.handleClick, this, {\n single: true,\n delay: 100\n});\n</code></pre>\n\n\n\n\n<p><strong>Attaching multiple handlers in 1 call</strong></p>\n\n\n\n\n<p>The method also allows for a single argument to be passed which is a config object containing properties which\nspecify multiple events. For example:</p>\n\n\n\n\n<pre><code>myGridPanel.on({\n cellClick: this.onCellClick,\n mouseover: this.onMouseOver,\n mouseout: this.onMouseOut,\n scope: this // Important. Ensure \"this\" is correct during handler execution\n});\n</code></pre>\n\n\n\n\n<p>One can also specify options for each event handler separately:</p>\n\n\n\n\n<pre><code>myGridPanel.on({\n cellClick: {fn: this.onCellClick, scope: this, single: true},\n mouseover: {fn: panel.onMouseOver, scope: panel}\n});\n</code></pre>\n\n</div></li></ul></div></div></div><div id='method-previousNode' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-previousNode' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-previousNode' class='name expandable'>previousNode</a>( <span class='pre'>[<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> selector]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Returns the previous node in the Component tree in tree traversal order. ...</div><div class='long'><p>Returns the previous node in the Component tree in tree traversal order.</p>\n\n<p>Note that this is not limited to siblings, and if invoked upon a node with no matching siblings, will walk the\ntree in reverse order to attempt to find a match. Contrast with <a href=\"#!/api/Ext.AbstractComponent-method-previousSibling\" rel=\"Ext.AbstractComponent-method-previousSibling\" class=\"docClass\">previousSibling</a>.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>selector</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> (optional)<div class='sub-desc'><p>A <a href=\"#!/api/Ext.ComponentQuery\" rel=\"Ext.ComponentQuery\" class=\"docClass\">ComponentQuery</a> selector to filter the preceding nodes.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>The previous node (or the previous node which matches the selector).\nReturns null if there is no matching node.</p>\n</div></li></ul></div></div></div><div id='method-previousSibling' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-previousSibling' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-previousSibling' class='name expandable'>previousSibling</a>( <span class='pre'>[<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> selector]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Returns the previous sibling of this Component. ...</div><div class='long'><p>Returns the previous sibling of this Component.</p>\n\n<p>Optionally selects the previous sibling which matches the passed <a href=\"#!/api/Ext.ComponentQuery\" rel=\"Ext.ComponentQuery\" class=\"docClass\">ComponentQuery</a>\nselector.</p>\n\n<p>May also be refered to as <strong><code>prev()</code></strong></p>\n\n<p>Note that this is limited to siblings, and if no siblings of the item match, <code>null</code> is returned. Contrast with\n<a href=\"#!/api/Ext.AbstractComponent-method-previousNode\" rel=\"Ext.AbstractComponent-method-previousNode\" class=\"docClass\">previousNode</a></p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>selector</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> (optional)<div class='sub-desc'><p>A <a href=\"#!/api/Ext.ComponentQuery\" rel=\"Ext.ComponentQuery\" class=\"docClass\">ComponentQuery</a> selector to filter the preceding items.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>The previous sibling (or the previous sibling which matches the selector).\nReturns null if there is no matching sibling.</p>\n</div></li></ul></div></div></div><div id='method-query' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-method-query' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-method-query' class='name expandable'>query</a>( <span class='pre'>[<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> selector]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>[]</div><div class='description'><div class='short'>Retrieves all descendant components which match the passed selector. ...</div><div class='long'><p>Retrieves all descendant components which match the passed selector.\nExecutes an Ext.ComponentQuery.query using this container as its root.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>selector</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> (optional)<div class='sub-desc'><p>Selector complying to an <a href=\"#!/api/Ext.ComponentQuery\" rel=\"Ext.ComponentQuery\" class=\"docClass\">Ext.ComponentQuery</a> selector.\nIf no selector is specified all items will be returned.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>[]</span><div class='sub-desc'><p>Components which matched the selector</p>\n</div></li></ul></div></div></div><div id='method-relayEvents' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-relayEvents' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-relayEvents' class='name expandable'>relayEvents</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> origin, <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[] events, <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> prefix</span> )</div><div class='description'><div class='short'>Relays selected events from the specified Observable as if the events were fired by this. ...</div><div class='long'><p>Relays selected events from the specified Observable as if the events were fired by <code>this</code>.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>origin</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The Observable whose events this object is to relay.</p>\n</div></li><li><span class='pre'>events</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[]<div class='sub-desc'><p>Array of event names to relay.</p>\n</div></li><li><span class='pre'>prefix</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-remove' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-method-remove' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-method-remove' class='name expandable'>remove</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> component, [<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> autoDestroy]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Removes a component from this container. ...</div><div class='long'><p>Removes a component from this container. Fires the <a href=\"#!/api/Ext.container.AbstractContainer-event-beforeremove\" rel=\"Ext.container.AbstractContainer-event-beforeremove\" class=\"docClass\">beforeremove</a> event before removing, then fires\nthe <a href=\"#!/api/Ext.container.AbstractContainer-event-remove\" rel=\"Ext.container.AbstractContainer-event-remove\" class=\"docClass\">remove</a> event after the component has been removed.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>component</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The component reference or id to remove.</p>\n</div></li><li><span class='pre'>autoDestroy</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>True to automatically invoke the removed Component's <a href=\"#!/api/Ext.Component-event-destroy\" rel=\"Ext.Component-event-destroy\" class=\"docClass\">Ext.Component.destroy</a> function.\nDefaults to the value of this Container's <a href=\"#!/api/Ext.container.AbstractContainer-cfg-autoDestroy\" rel=\"Ext.container.AbstractContainer-cfg-autoDestroy\" class=\"docClass\">autoDestroy</a> config.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>component The Component that was removed.</p>\n</div></li></ul></div></div></div><div id='method-removeAll' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-method-removeAll' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-method-removeAll' class='name expandable'>removeAll</a>( <span class='pre'>[<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> autoDestroy]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>[]</div><div class='description'><div class='short'>Removes all components from this container. ...</div><div class='long'><p>Removes all components from this container.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>autoDestroy</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>True to automatically invoke the removed Component's <a href=\"#!/api/Ext.Component-event-destroy\" rel=\"Ext.Component-event-destroy\" class=\"docClass\">Ext.Component.destroy</a> function.\nDefaults to the value of this Container's <a href=\"#!/api/Ext.container.AbstractContainer-cfg-autoDestroy\" rel=\"Ext.container.AbstractContainer-cfg-autoDestroy\" class=\"docClass\">autoDestroy</a> config.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a>[]</span><div class='sub-desc'><p>Array of the destroyed components</p>\n</div></li></ul></div></div></div><div id='method-removeChildEls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-removeChildEls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-removeChildEls' class='name expandable'>removeChildEls</a>( <span class='pre'><a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> testFn</span> )</div><div class='description'><div class='short'>Removes items in the childEls array based on the return value of a supplied test function. ...</div><div class='long'><p>Removes items in the childEls array based on the return value of a supplied test function. The function is called\nwith a entry in childEls and if the test function return true, that entry is removed. If false, that entry is\nkept.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>testFn</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a><div class='sub-desc'><p>The test function.</p>\n</div></li></ul></div></div></div><div id='method-removeCls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-removeCls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-removeCls' class='name expandable'>removeCls</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> className</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Removes a CSS class from the top level element representing this component. ...</div><div class='long'><p>Removes a CSS class from the top level element representing this component.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>className</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>Returns the Component to allow method chaining.</p>\n</div></li></ul></div></div></div><div id='method-removeClsWithUI' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-removeClsWithUI' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-removeClsWithUI' class='name expandable'>removeClsWithUI</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[] cls</span> )</div><div class='description'><div class='short'>Removes a cls to the uiCls array, which will also call removeUIClsFromElement and removes it from all\nelements of thi...</div><div class='long'><p>Removes a cls to the uiCls array, which will also call <a href=\"#!/api/Ext.AbstractComponent-method-removeUIClsFromElement\" rel=\"Ext.AbstractComponent-method-removeUIClsFromElement\" class=\"docClass\">removeUIClsFromElement</a> and removes it from all\nelements of this component.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>cls</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[]<div class='sub-desc'><p>A string or an array of strings to remove to the uiCls</p>\n</div></li></ul></div></div></div><div id='method-removeDocked' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.AbstractPanel' rel='Ext.panel.AbstractPanel' class='definedIn docClass'>Ext.panel.AbstractPanel</a><br/><a href='source/AbstractPanel.html#Ext-panel-AbstractPanel-method-removeDocked' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.AbstractPanel-method-removeDocked' class='name expandable'>removeDocked</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> item, [<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> autoDestroy]</span> )</div><div class='description'><div class='short'>Removes the docked item from the panel. ...</div><div class='long'><p>Removes the docked item from the panel.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>item</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'><p>. The Component to remove.</p>\n</div></li><li><span class='pre'>autoDestroy</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>Destroy the component after removal.</p>\n</div></li></ul></div></div></div><div id='method-removeListener' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-removeListener' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-removeListener' class='name expandable'>removeListener</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> eventName, <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> fn, [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> scope]</span> )</div><div class='description'><div class='short'>Removes an event handler. ...</div><div class='long'><p>Removes an event handler.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>eventName</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The type of event the handler was associated with.</p>\n\n</div></li><li><span class='pre'>fn</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a><div class='sub-desc'><p>The handler to remove. <strong>This must be a reference to the function passed into the\n<a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">addListener</a> call.</strong></p>\n\n</div></li><li><span class='pre'>scope</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>The scope originally specified for the handler. It must be the same as the\nscope argument specified in the original call to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">addListener</a> or the listener will not be removed.</p>\n\n</div></li></ul></div></div></div><div id='method-removeManagedListener' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-removeManagedListener' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-removeManagedListener' class='name expandable'>removeManagedListener</a>( <span class='pre'><a href=\"#!/api/Ext.util.Observable\" rel=\"Ext.util.Observable\" class=\"docClass\">Ext.util.Observable</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a> item, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> ename, [<a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> fn], [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> scope]</span> )</div><div class='description'><div class='short'>Removes listeners that were added by the mon method. ...</div><div class='long'><p>Removes listeners that were added by the <a href=\"#!/api/Ext.util.Observable-method-mon\" rel=\"Ext.util.Observable-method-mon\" class=\"docClass\">mon</a> method.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>item</span> : <a href=\"#!/api/Ext.util.Observable\" rel=\"Ext.util.Observable\" class=\"docClass\">Ext.util.Observable</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a><div class='sub-desc'><p>The item from which to remove a listener/listeners.</p>\n\n</div></li><li><span class='pre'>ename</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The event name, or an object containing event name properties.</p>\n\n</div></li><li><span class='pre'>fn</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> (optional)<div class='sub-desc'><p>If the <code>ename</code> parameter was an event name, this is the handler function.</p>\n\n</div></li><li><span class='pre'>scope</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>If the <code>ename</code> parameter was an event name, this is the scope (<code>this</code> reference)\nin which the handler function is executed.</p>\n\n</div></li></ul></div></div></div><div id='method-removeUIClsFromElement' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-removeUIClsFromElement' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-removeUIClsFromElement' class='name expandable'>removeUIClsFromElement</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> ui</span> )</div><div class='description'><div class='short'>Method which removes a specified UI + uiCls from the components element. ...</div><div class='long'><p>Method which removes a specified UI + uiCls from the components element. The cls which is added to the element\nwill be: <code>this.baseCls + '-' + ui</code></p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>ui</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The UI to add to the element</p>\n</div></li></ul></div></div></div><div id='method-restore' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-method-restore' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-method-restore' class='name expandable'>restore</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a></div><div class='description'><div class='short'>Restores a maximized window back to its original size and position prior to being maximized\nand also replaces the 're...</div><div class='long'><p>Restores a <a href=\"#!/api/Ext.window.Window-cfg-maximizable\" rel=\"Ext.window.Window-cfg-maximizable\" class=\"docClass\">maximized</a> window back to its original size and position prior to being maximized\nand also replaces the 'restore' tool button with the 'maximize' tool button. Also see <a href=\"#!/api/Ext.window.Window-method-toggleMaximize\" rel=\"Ext.window.Window-method-toggleMaximize\" class=\"docClass\">toggleMaximize</a>.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-resumeEvents' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-resumeEvents' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-resumeEvents' class='name expandable'>resumeEvents</a>( <span class='pre'></span> )</div><div class='description'><div class='short'>Resumes firing events (see suspendEvents). ...</div><div class='long'><p>Resumes firing events (see <a href=\"#!/api/Ext.util.Observable-method-suspendEvents\" rel=\"Ext.util.Observable-method-suspendEvents\" class=\"docClass\">suspendEvents</a>).</p>\n\n<p>If events were suspended using the <code>queueSuspended</code> parameter, then all events fired\nduring event suspension will be sent to any listeners now.</p>\n</div></div></div><div id='method-savePropToState' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.state.Stateful' rel='Ext.state.Stateful' class='definedIn docClass'>Ext.state.Stateful</a><br/><a href='source/Stateful.html#Ext-state-Stateful-method-savePropToState' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.state.Stateful-method-savePropToState' class='name expandable'>savePropToState</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> propName, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> state, [<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> stateName]</span> ) : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></div><div class='description'><div class='short'>Conditionally saves a single property from this object to the given state object. ...</div><div class='long'><p>Conditionally saves a single property from this object to the given state object.\nThe idea is to only save state which has changed from the initial state so that\ncurrent software settings do not override future software settings. Only those\nvalues that are user-changed state should be saved.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>propName</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The name of the property to save.</p>\n</div></li><li><span class='pre'>state</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The state object in to which to save the property.</p>\n</div></li><li><span class='pre'>stateName</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> (optional)<div class='sub-desc'><p>The name to use for the property in state.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a></span><div class='sub-desc'><p>True if the property was saved, false if not.</p>\n</div></li></ul></div></div></div><div id='method-sequenceFx' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Animate' rel='Ext.util.Animate' class='definedIn docClass'>Ext.util.Animate</a><br/><a href='source/Animate.html#Ext-util-Animate-method-sequenceFx' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Animate-method-sequenceFx' class='name expandable'>sequenceFx</a>( <span class='pre'></span> ) : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></div><div class='description'><div class='short'>Ensures that all effects queued after sequenceFx is called on this object are\nrun in sequence. ...</div><div class='long'><p>Ensures that all effects queued after sequenceFx is called on this object are\nrun in sequence. This is the opposite of <a href=\"#!/api/Ext.util.Animate-method-syncFx\" rel=\"Ext.util.Animate-method-syncFx\" class=\"docClass\">syncFx</a>.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-setActive' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Floating' rel='Ext.util.Floating' class='definedIn docClass'>Ext.util.Floating</a><br/><a href='source/Floating.html#Ext-util-Floating-method-setActive' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Floating-method-setActive' class='name expandable'>setActive</a>( <span class='pre'>[<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> active], [<a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> newActive]</span> )</div><div class='description'><div class='short'>This method is called internally by Ext.ZIndexManager to signal that a floating Component has either been\nmoved to th...</div><div class='long'><p>This method is called internally by <a href=\"#!/api/Ext.ZIndexManager\" rel=\"Ext.ZIndexManager\" class=\"docClass\">Ext.ZIndexManager</a> to signal that a floating Component has either been\nmoved to the top of its zIndex stack, or pushed from the top of its zIndex stack.</p>\n\n<p>If a <em>Window</em> is superceded by another Window, deactivating it hides its shadow.</p>\n\n<p>This method also fires the <a href=\"#!/api/Ext.Component-event-activate\" rel=\"Ext.Component-event-activate\" class=\"docClass\">activate</a> or\n<a href=\"#!/api/Ext.Component-event-deactivate\" rel=\"Ext.Component-event-deactivate\" class=\"docClass\">deactivate</a> event depending on which action occurred.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>active</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>True to activate the Component, false to deactivate it.</p>\n<p>Defaults to: <code>false</code></p></div></li><li><span class='pre'>newActive</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> (optional)<div class='sub-desc'><p>The newly active Component which is taking over topmost zIndex position.</p>\n</div></li></ul></div></div></div><div id='method-setAutoScroll' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-setAutoScroll' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-setAutoScroll' class='name expandable'>setAutoScroll</a>( <span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> scroll</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Sets the overflow on the content element of the component. ...</div><div class='long'><p>Sets the overflow on the content element of the component.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>scroll</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a><div class='sub-desc'><p>True to allow the Component to auto scroll.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-setDisabled' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-setDisabled' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-setDisabled' class='name expandable'>setDisabled</a>( <span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> disabled</span> )</div><div class='description'><div class='short'>Enable or disable the component. ...</div><div class='long'><p>Enable or disable the component.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>disabled</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a><div class='sub-desc'><p>True to disable.</p>\n</div></li></ul></div></div></div><div id='method-setDocked' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-setDocked' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-setDocked' class='name expandable'>setDocked</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> dock, [<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> layoutParent]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Sets the dock position of this component in its parent panel. ...</div><div class='long'><p>Sets the dock position of this component in its parent panel. Note that this only has effect if this item is part\nof the dockedItems collection of a parent that has a DockLayout (note that any Panel has a DockLayout by default)</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>dock</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The dock position.</p>\n</div></li><li><span class='pre'>layoutParent</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>True to re-layout parent.</p>\n<p>Defaults to: <code>false</code></p></div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-setHeight' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-setHeight' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-setHeight' class='name expandable'>setHeight</a>( <span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> height</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Sets the height of the component. ...</div><div class='long'><p>Sets the height of the component. This method fires the <a href=\"#!/api/Ext.AbstractComponent-event-resize\" rel=\"Ext.AbstractComponent-event-resize\" class=\"docClass\">resize</a> event.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>height</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The new height to set. This may be one of:</p>\n\n<ul>\n<li>A Number specifying the new height in the <a href=\"#!/api/Ext.AbstractComponent-method-getEl\" rel=\"Ext.AbstractComponent-method-getEl\" class=\"docClass\">Element</a>'s <a href=\"#!/api/Ext.Element-property-defaultUnit\" rel=\"Ext.Element-property-defaultUnit\" class=\"docClass\">Ext.Element.defaultUnit</a>s (by default, pixels).</li>\n<li>A String used to set the CSS height style.</li>\n<li><em>undefined</em> to leave the height unchanged.</li>\n</ul>\n\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-setIconCls' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-method-setIconCls' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-method-setIconCls' class='name expandable'>setIconCls</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> newIconCls</span> )</div><div class='description'><div class='short'>Set the iconCls for the panel's header. ...</div><div class='long'><p>Set the iconCls for the panel's header. See <a href=\"#!/api/Ext.panel.Header-cfg-iconCls\" rel=\"Ext.panel.Header-cfg-iconCls\" class=\"docClass\">Ext.panel.Header.iconCls</a>. It will fire the\n<a href=\"#!/api/Ext.panel.Panel-event-iconchange\" rel=\"Ext.panel.Panel-event-iconchange\" class=\"docClass\">iconchange</a> event after completion.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>newIconCls</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The new CSS class name</p>\n</div></li></ul></div></div></div><div id='method-setLoading' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-setLoading' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-setLoading' class='name expandable'>setLoading</a>( <span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> load, [<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> targetEl]</span> ) : <a href=\"#!/api/Ext.LoadMask\" rel=\"Ext.LoadMask\" class=\"docClass\">Ext.LoadMask</a></div><div class='description'><div class='short'>This method allows you to show or hide a LoadMask on top of this component. ...</div><div class='long'><p>This method allows you to show or hide a LoadMask on top of this component.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>load</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>True to show the default LoadMask, a config object that will be passed to the\nLoadMask constructor, or a message String to show. False to hide the current LoadMask.</p>\n</div></li><li><span class='pre'>targetEl</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>True to mask the targetEl of this Component instead of the <code>this.el</code>. For example,\nsetting this to true on a Panel will cause only the body to be masked.</p>\n<p>Defaults to: <code>false</code></p></div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.LoadMask\" rel=\"Ext.LoadMask\" class=\"docClass\">Ext.LoadMask</a></span><div class='sub-desc'><p>The LoadMask instance that has just been shown.</p>\n</div></li></ul></div></div></div><div id='method-setPagePosition' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-setPagePosition' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-setPagePosition' class='name expandable'>setPagePosition</a>( <span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> x, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> y, [<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> animate]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Sets the page XY position of the component. ...</div><div class='long'><p>Sets the page XY position of the component. To set the left and top instead, use <a href=\"#!/api/Ext.Component-method-setPosition\" rel=\"Ext.Component-method-setPosition\" class=\"docClass\">setPosition</a>.\nThis method fires the <a href=\"#!/api/Ext.Component-event-move\" rel=\"Ext.Component-event-move\" class=\"docClass\">move</a> event.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>x</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The new x position</p>\n</div></li><li><span class='pre'>y</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The new y position</p>\n</div></li><li><span class='pre'>animate</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>True to animate the Component into its new position. You may also pass an\nanimation configuration.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-setPosition' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-setPosition' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-setPosition' class='name expandable'>setPosition</a>( <span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> left, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> top, [<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> animate]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Sets the left and top of the component. ...</div><div class='long'><p>Sets the left and top of the component. To set the page XY position instead, use <a href=\"#!/api/Ext.Component-method-setPagePosition\" rel=\"Ext.Component-method-setPagePosition\" class=\"docClass\">setPagePosition</a>. This\nmethod fires the <a href=\"#!/api/Ext.Component-event-move\" rel=\"Ext.Component-event-move\" class=\"docClass\">move</a> event.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>left</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The new left</p>\n</div></li><li><span class='pre'>top</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The new top</p>\n</div></li><li><span class='pre'>animate</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>If true, the Component is <em>animated</em> into its new position. You may also pass an\nanimation configuration.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-setSize' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-setSize' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-setSize' class='name expandable'>setSize</a>( <span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> width, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> height</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Sets the width and height of this Component. ...</div><div class='long'><p>Sets the width and height of this Component. This method fires the <a href=\"#!/api/Ext.AbstractComponent-event-resize\" rel=\"Ext.AbstractComponent-event-resize\" class=\"docClass\">resize</a> event. This method can accept\neither width and height as separate arguments, or you can pass a size object like <code>{width:10, height:20}</code>.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>width</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The new width to set. This may be one of:</p>\n\n<ul>\n<li>A Number specifying the new width in the <a href=\"#!/api/Ext.AbstractComponent-method-getEl\" rel=\"Ext.AbstractComponent-method-getEl\" class=\"docClass\">Element</a>'s <a href=\"#!/api/Ext.Element-property-defaultUnit\" rel=\"Ext.Element-property-defaultUnit\" class=\"docClass\">Ext.Element.defaultUnit</a>s (by default, pixels).</li>\n<li>A String used to set the CSS width style.</li>\n<li>A size object in the format <code>{width: widthValue, height: heightValue}</code>.</li>\n<li><code>undefined</code> to leave the width unchanged.</li>\n</ul>\n\n</div></li><li><span class='pre'>height</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The new height to set (not required if a size object is passed as the first arg).\nThis may be one of:</p>\n\n<ul>\n<li>A Number specifying the new height in the <a href=\"#!/api/Ext.AbstractComponent-method-getEl\" rel=\"Ext.AbstractComponent-method-getEl\" class=\"docClass\">Element</a>'s <a href=\"#!/api/Ext.Element-property-defaultUnit\" rel=\"Ext.Element-property-defaultUnit\" class=\"docClass\">Ext.Element.defaultUnit</a>s (by default, pixels).</li>\n<li>A String used to set the CSS height style. Animation may <strong>not</strong> be used.</li>\n<li><code>undefined</code> to leave the height unchanged.</li>\n</ul>\n\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-setTitle' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-method-setTitle' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-method-setTitle' class='name expandable'>setTitle</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> newTitle</span> )</div><div class='description'><div class='short'>Set a title for the panel's header. ...</div><div class='long'><p>Set a title for the panel's header. See <a href=\"#!/api/Ext.panel.Header-cfg-title\" rel=\"Ext.panel.Header-cfg-title\" class=\"docClass\">Ext.panel.Header.title</a>.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>newTitle</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-setUI' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-setUI' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-setUI' class='name expandable'>setUI</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> ui</span> )</div><div class='description'><div class='short'>Sets the UI for the component. ...</div><div class='long'><p>Sets the UI for the component. This will remove any existing UIs on the component. It will also loop through any\nuiCls set on the component and rename them so they include the new UI</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>ui</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The new UI for the component</p>\n</div></li></ul></div></div></div><div id='method-setVisible' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-setVisible' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-setVisible' class='name expandable'>setVisible</a>( <span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> visible</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Convenience function to hide or show this component by boolean. ...</div><div class='long'><p>Convenience function to hide or show this component by boolean.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>visible</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a><div class='sub-desc'><p>True to show, false to hide</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-setWidth' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-setWidth' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-setWidth' class='name expandable'>setWidth</a>( <span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> width</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Sets the width of the component. ...</div><div class='long'><p>Sets the width of the component. This method fires the <a href=\"#!/api/Ext.AbstractComponent-event-resize\" rel=\"Ext.AbstractComponent-event-resize\" class=\"docClass\">resize</a> event.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>width</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The new width to setThis may be one of:</p>\n\n<ul>\n<li>A Number specifying the new width in the <a href=\"#!/api/Ext.AbstractComponent-method-getEl\" rel=\"Ext.AbstractComponent-method-getEl\" class=\"docClass\">Element</a>'s <a href=\"#!/api/Ext.Element-property-defaultUnit\" rel=\"Ext.Element-property-defaultUnit\" class=\"docClass\">Ext.Element.defaultUnit</a>s (by default, pixels).</li>\n<li>A String used to set the CSS width style.</li>\n</ul>\n\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-show' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-show' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-show' class='name expandable'>show</a>( <span class='pre'>[<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a> animateTarget], [<a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> callback], [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> scope]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Shows this Component, rendering it first if autoRender or floating are true. ...</div><div class='long'><p>Shows this Component, rendering it first if <a href=\"#!/api/Ext.Component-cfg-autoRender\" rel=\"Ext.Component-cfg-autoRender\" class=\"docClass\">autoRender</a> or <a href=\"#!/api/Ext.Component-cfg-floating\" rel=\"Ext.Component-cfg-floating\" class=\"docClass\">floating</a> are <code>true</code>.</p>\n\n<p>After being shown, a <a href=\"#!/api/Ext.Component-cfg-floating\" rel=\"Ext.Component-cfg-floating\" class=\"docClass\">floating</a> Component (such as a <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a>), is activated it and\nbrought to the front of its <a href=\"#!/api/Ext.Component-property-zIndexManager\" rel=\"Ext.Component-property-zIndexManager\" class=\"docClass\">z-index stack</a>.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>animateTarget</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a> (optional)<div class='sub-desc'><p><strong>only valid for <a href=\"#!/api/Ext.Component-cfg-floating\" rel=\"Ext.Component-cfg-floating\" class=\"docClass\">floating</a> Components such as <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Window</a>s or <a href=\"#!/api/Ext.tip.ToolTip\" rel=\"Ext.tip.ToolTip\" class=\"docClass\">ToolTip</a>s, or regular Components which have been configured\nwith <code>floating: true</code>.</strong> The target from which the Component should animate from while opening.</p>\n<p>Defaults to: <code>null</code></p></div></li><li><span class='pre'>callback</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> (optional)<div class='sub-desc'><p>A callback function to call after the Component is displayed.\nOnly necessary if animation was specified.</p>\n</div></li><li><span class='pre'>scope</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>The scope (<code>this</code> reference) in which the callback is executed.\nDefaults to this Component.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-showAt' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-showAt' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-showAt' class='name expandable'>showAt</a>( <span class='pre'><a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> x, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> y, [<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> animate]</span> )</div><div class='description'><div class='short'>Displays component at specific xy position. ...</div><div class='long'><p>Displays component at specific xy position.\nA floating component (like a menu) is positioned relative to its ownerCt if any.\nUseful for popping up a context menu:</p>\n\n<pre><code>listeners: {\n itemcontextmenu: function(view, record, item, index, event, options) {\n Ext.create('Ext.menu.Menu', {\n width: 100,\n height: 100,\n margin: '0 0 10 0',\n items: [{\n text: 'regular item 1'\n },{\n text: 'regular item 2'\n },{\n text: 'regular item 3'\n }]\n }).showAt(event.getXY());\n }\n}\n</code></pre>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>x</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The new x position</p>\n</div></li><li><span class='pre'>y</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The new y position</p>\n</div></li><li><span class='pre'>animate</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>True to animate the Component into its new position. You may also pass an\nanimation configuration.</p>\n</div></li></ul></div></div></div><div id='method-statics' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Base' rel='Ext.Base' class='definedIn docClass'>Ext.Base</a><br/><a href='source/Base3.html#Ext-Base-method-statics' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Base-method-statics' class='name expandable'>statics</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.Class\" rel=\"Ext.Class\" class=\"docClass\">Ext.Class</a><strong class='protected-signature'>protected</strong></div><div class='description'><div class='short'>Get the reference to the class from which this object was instantiated. ...</div><div class='long'><p>Get the reference to the class from which this object was instantiated. Note that unlike <a href=\"#!/api/Ext.Base-property-self\" rel=\"Ext.Base-property-self\" class=\"docClass\">self</a>,\n<code>this.statics()</code> is scope-independent and it always returns the class from which it was called, regardless of what\n<code>this</code> points to during run-time</p>\n\n<pre><code>Ext.define('My.Cat', {\n statics: {\n totalCreated: 0,\n speciesName: 'Cat' // My.Cat.speciesName = 'Cat'\n },\n\n constructor: function() {\n var statics = this.statics();\n\n alert(statics.speciesName); // always equals to 'Cat' no matter what 'this' refers to\n // equivalent to: My.Cat.speciesName\n\n alert(this.self.speciesName); // dependent on 'this'\n\n statics.totalCreated++;\n\n return this;\n },\n\n clone: function() {\n var cloned = new this.self; // dependent on 'this'\n\n cloned.groupName = this.statics().speciesName; // equivalent to: My.Cat.speciesName\n\n return cloned;\n }\n});\n\n\nExt.define('My.SnowLeopard', {\n extend: 'My.Cat',\n\n statics: {\n speciesName: 'Snow Leopard' // My.SnowLeopard.speciesName = 'Snow Leopard'\n },\n\n constructor: function() {\n this.callParent();\n }\n});\n\nvar cat = new My.Cat(); // alerts 'Cat', then alerts 'Cat'\n\nvar snowLeopard = new My.SnowLeopard(); // alerts 'Cat', then alerts 'Snow Leopard'\n\nvar clone = snowLeopard.clone();\nalert(Ext.getClassName(clone)); // alerts 'My.SnowLeopard'\nalert(clone.groupName); // alerts 'Cat'\n\nalert(My.Cat.totalCreated); // alerts 3\n</code></pre>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Class\" rel=\"Ext.Class\" class=\"docClass\">Ext.Class</a></span><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='method-stopAnimation' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Animate' rel='Ext.util.Animate' class='definedIn docClass'>Ext.util.Animate</a><br/><a href='source/Animate.html#Ext-util-Animate-method-stopAnimation' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Animate-method-stopAnimation' class='name expandable'>stopAnimation</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a></div><div class='description'><div class='short'>Stops any running effects and clears this object's internal effects queue if it contains\nany additional effects that ...</div><div class='long'><p>Stops any running effects and clears this object's internal effects queue if it contains\nany additional effects that haven't started yet.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a></span><div class='sub-desc'><p>The Element</p>\n</div></li></ul></div></div></div><div id='method-stopFx' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Animate' rel='Ext.util.Animate' class='definedIn docClass'>Ext.util.Animate</a><br/><a href='source/Animate.html#Ext-util-Animate-method-stopFx' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Animate-method-stopFx' class='name expandable'>stopFx</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a><strong class='deprecated-signature'>deprecated</strong></div><div class='description'><div class='short'>Stops any running effects and clears this object's internal effects queue if it contains\nany additional effects that ...</div><div class='long'><p>Stops any running effects and clears this object's internal effects queue if it contains\nany additional effects that haven't started yet.</p>\n<div class='deprecated'><p>This method has been <strong>deprecated</strong> since 4.0</p><p>Replaced by <a href=\"#!/api/Ext.util.Animate-method-stopAnimation\" rel=\"Ext.util.Animate-method-stopAnimation\" class=\"docClass\">stopAnimation</a></p>\n</div><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a></span><div class='sub-desc'><p>The Element</p>\n</div></li></ul></div></div></div><div id='method-suspendEvents' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-suspendEvents' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-suspendEvents' class='name expandable'>suspendEvents</a>( <span class='pre'><a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> queueSuspended</span> )</div><div class='description'><div class='short'>Suspends the firing of all events. ...</div><div class='long'><p>Suspends the firing of all events. (see <a href=\"#!/api/Ext.util.Observable-method-resumeEvents\" rel=\"Ext.util.Observable-method-resumeEvents\" class=\"docClass\">resumeEvents</a>)</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>queueSuspended</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a><div class='sub-desc'><p>Pass as true to queue up suspended events to be fired\nafter the <a href=\"#!/api/Ext.util.Observable-method-resumeEvents\" rel=\"Ext.util.Observable-method-resumeEvents\" class=\"docClass\">resumeEvents</a> call instead of discarding all suspended events.</p>\n</div></li></ul></div></div></div><div id='method-syncFx' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Animate' rel='Ext.util.Animate' class='definedIn docClass'>Ext.util.Animate</a><br/><a href='source/Animate.html#Ext-util-Animate-method-syncFx' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Animate-method-syncFx' class='name expandable'>syncFx</a>( <span class='pre'></span> ) : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></div><div class='description'><div class='short'>Ensures that all effects queued after syncFx is called on this object are\nrun concurrently. ...</div><div class='long'><p>Ensures that all effects queued after syncFx is called on this object are\nrun concurrently. This is the opposite of <a href=\"#!/api/Ext.util.Animate-method-sequenceFx\" rel=\"Ext.util.Animate-method-sequenceFx\" class=\"docClass\">sequenceFx</a>.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-toBack' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Floating' rel='Ext.util.Floating' class='definedIn docClass'>Ext.util.Floating</a><br/><a href='source/Floating.html#Ext-util-Floating-method-toBack' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Floating-method-toBack' class='name expandable'>toBack</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Sends this Component to the back of (lower z-index than) any other visible windows ...</div><div class='long'><p>Sends this Component to the back of (lower z-index than) any other visible windows</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-toFront' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Floating' rel='Ext.util.Floating' class='definedIn docClass'>Ext.util.Floating</a><br/><a href='source/Floating.html#Ext-util-Floating-method-toFront' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Floating-method-toFront' class='name expandable'>toFront</a>( <span class='pre'>[<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> preventFocus]</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Brings this floating Component to the front of any other visible, floating Components managed by the same ZIndexManag...</div><div class='long'><p>Brings this floating Component to the front of any other visible, floating Components managed by the same <a href=\"#!/api/Ext.ZIndexManager\" rel=\"Ext.ZIndexManager\" class=\"docClass\">ZIndexManager</a></p>\n\n<p>If this Component is modal, inserts the modal mask just below this Component in the z-index stack.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>preventFocus</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>Specify <code>true</code> to prevent the Component from being focused.</p>\n<p>Defaults to: <code>false</code></p></div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-toggleCollapse' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-method-toggleCollapse' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-method-toggleCollapse' class='name expandable'>toggleCollapse</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a></div><div class='description'><div class='short'>Shortcut for performing an expand or collapse based on the current state of the panel. ...</div><div class='long'><p>Shortcut for performing an <a href=\"#!/api/Ext.panel.Panel-event-expand\" rel=\"Ext.panel.Panel-event-expand\" class=\"docClass\">expand</a> or <a href=\"#!/api/Ext.panel.Panel-event-collapse\" rel=\"Ext.panel.Panel-event-collapse\" class=\"docClass\">collapse</a> based on the current state of the panel.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-toggleMaximize' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-method-toggleMaximize' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-method-toggleMaximize' class='name expandable'>toggleMaximize</a>( <span class='pre'></span> ) : <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a></div><div class='description'><div class='short'>A shortcut method for toggling between maximize and restore based on the current maximized\nstate of the window. ...</div><div class='long'><p>A shortcut method for toggling between <a href=\"#!/api/Ext.window.Window-event-maximize\" rel=\"Ext.window.Window-event-maximize\" class=\"docClass\">maximize</a> and <a href=\"#!/api/Ext.window.Window-event-restore\" rel=\"Ext.window.Window-event-restore\" class=\"docClass\">restore</a> based on the current maximized\nstate of the window.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='method-un' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.util.Observable' rel='Ext.util.Observable' class='definedIn docClass'>Ext.util.Observable</a><br/><a href='source/Observable.html#Ext-util-Observable-method-un' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.util.Observable-method-un' class='name expandable'>un</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> eventName, <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> fn, [<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> scope]</span> )</div><div class='description'><div class='short'>Shorthand for removeListener. ...</div><div class='long'><p>Shorthand for <a href=\"#!/api/Ext.util.Observable-method-removeListener\" rel=\"Ext.util.Observable-method-removeListener\" class=\"docClass\">removeListener</a>.</p>\n\n<p>Removes an event handler.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>eventName</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The type of event the handler was associated with.</p>\n\n</div></li><li><span class='pre'>fn</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a><div class='sub-desc'><p>The handler to remove. <strong>This must be a reference to the function passed into the\n<a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">addListener</a> call.</strong></p>\n\n</div></li><li><span class='pre'>scope</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> (optional)<div class='sub-desc'><p>The scope originally specified for the handler. It must be the same as the\nscope argument specified in the original call to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">addListener</a> or the listener will not be removed.</p>\n\n</div></li></ul></div></div></div><div id='method-up' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-up' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-up' class='name expandable'>up</a>( <span class='pre'>[<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> selector]</span> ) : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a></div><div class='description'><div class='short'>Walks up the ownerCt axis looking for an ancestor Container which matches the passed simple selector. ...</div><div class='long'><p>Walks up the <code>ownerCt</code> axis looking for an ancestor Container which matches the passed simple selector.</p>\n\n<p>Example:</p>\n\n<pre><code>var owningTabPanel = grid.up('tabpanel');\n</code></pre>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>selector</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> (optional)<div class='sub-desc'><p>The simple selector to test.</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a></span><div class='sub-desc'><p>The matching ancestor Container (or <code>undefined</code> if no match was found).</p>\n</div></li></ul></div></div></div><div id='method-update' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-method-update' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-method-update' class='name expandable'>update</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> htmlOrData, [<a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> loadScripts], [<a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> callback]</span> )</div><div class='description'><div class='short'>Update the content area of a component. ...</div><div class='long'><p>Update the content area of a component.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>htmlOrData</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>If this component has been configured with a template via the tpl config then\nit will use this argument as data to populate the template. If this component was not configured with a template,\nthe components content area will be updated via <a href=\"#!/api/Ext.Element\" rel=\"Ext.Element\" class=\"docClass\">Ext.Element</a> update</p>\n</div></li><li><span class='pre'>loadScripts</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> (optional)<div class='sub-desc'><p>Only legitimate when using the html configuration.</p>\n<p>Defaults to: <code>false</code></p></div></li><li><span class='pre'>callback</span> : <a href=\"#!/api/Function\" rel=\"Function\" class=\"docClass\">Function</a> (optional)<div class='sub-desc'><p>Only legitimate when using the html configuration. Callback to execute when\nscripts have finished loading</p>\n</div></li></ul></div></div></div><div id='method-updateBox' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Component' rel='Ext.Component' class='definedIn docClass'>Ext.Component</a><br/><a href='source/Component.html#Ext-Component-method-updateBox' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Component-method-updateBox' class='name expandable'>updateBox</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> box</span> ) : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></div><div class='description'><div class='short'>Sets the current box measurements of the component's underlying element. ...</div><div class='long'><p>Sets the current box measurements of the component's underlying element.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>box</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>An object in the format {x, y, width, height}</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div></div><div class='subsection'><div class='definedBy'>Defined By</div><h4 class='members-subtitle'>Static Methods</h3><div id='static-method-addStatics' class='member first-child inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Base' rel='Ext.Base' class='definedIn docClass'>Ext.Base</a><br/><a href='source/Base3.html#Ext-Base-static-method-addStatics' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Base-static-method-addStatics' class='name expandable'>addStatics</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> members</span> ) : <a href=\"#!/api/Ext.Base\" rel=\"Ext.Base\" class=\"docClass\">Ext.Base</a><strong class='static-signature'>static</strong></div><div class='description'><div class='short'>Add / override static properties of this class. ...</div><div class='long'><p>Add / override static properties of this class.</p>\n\n<pre><code>Ext.define('My.cool.Class', {\n ...\n});\n\nMy.cool.Class.addStatics({\n someProperty: 'someValue', // My.cool.Class.someProperty = 'someValue'\n method1: function() { ... }, // My.cool.Class.method1 = function() { ... };\n method2: function() { ... } // My.cool.Class.method2 = function() { ... };\n});\n</code></pre>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>members</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Base\" rel=\"Ext.Base\" class=\"docClass\">Ext.Base</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='static-method-borrow' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Base' rel='Ext.Base' class='definedIn docClass'>Ext.Base</a><br/><a href='source/Base3.html#Ext-Base-static-method-borrow' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Base-static-method-borrow' class='name expandable'>borrow</a>( <span class='pre'><a href=\"#!/api/Ext.Base\" rel=\"Ext.Base\" class=\"docClass\">Ext.Base</a> fromClass, <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[] members</span> ) : <a href=\"#!/api/Ext.Base\" rel=\"Ext.Base\" class=\"docClass\">Ext.Base</a><strong class='static-signature'>static</strong></div><div class='description'><div class='short'>Borrow another class' members to the prototype of this class. ...</div><div class='long'><p>Borrow another class' members to the prototype of this class.</p>\n\n<pre><code>Ext.define('Bank', {\n money: '$$$',\n printMoney: function() {\n alert('$$$$$$$');\n }\n});\n\nExt.define('Thief', {\n ...\n});\n\nThief.borrow(Bank, ['money', 'printMoney']);\n\nvar steve = new Thief();\n\nalert(steve.money); // alerts '$$$'\nsteve.printMoney(); // alerts '$$$$$$$'\n</code></pre>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>fromClass</span> : <a href=\"#!/api/Ext.Base\" rel=\"Ext.Base\" class=\"docClass\">Ext.Base</a><div class='sub-desc'><p>The class to borrow members from</p>\n</div></li><li><span class='pre'>members</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>[]<div class='sub-desc'><p>The names of the members to borrow</p>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Base\" rel=\"Ext.Base\" class=\"docClass\">Ext.Base</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div><div id='static-method-create' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Base' rel='Ext.Base' class='definedIn docClass'>Ext.Base</a><br/><a href='source/Base3.html#Ext-Base-static-method-create' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Base-static-method-create' class='name expandable'>create</a>( <span class='pre'></span> ) : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><strong class='static-signature'>static</strong></div><div class='description'><div class='short'>Create a new instance of this Class. ...</div><div class='long'><p>Create a new instance of this Class.</p>\n\n<pre><code>Ext.define('My.cool.Class', {\n ...\n});\n\nMy.cool.Class.create({\n someConfig: true\n});\n</code></pre>\n\n<p>All parameters are passed to the constructor of the class.</p>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a></span><div class='sub-desc'><p>the created instance.</p>\n</div></li></ul></div></div></div><div id='static-method-createAlias' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Base' rel='Ext.Base' class='definedIn docClass'>Ext.Base</a><br/><a href='source/Base3.html#Ext-Base-static-method-createAlias' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Base-static-method-createAlias' class='name expandable'>createAlias</a>( <span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> alias, <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> origin</span> )<strong class='static-signature'>static</strong></div><div class='description'><div class='short'>Create aliases for existing prototype methods. ...</div><div class='long'><p>Create aliases for existing prototype methods. Example:</p>\n\n<pre><code>Ext.define('My.cool.Class', {\n method1: function() { ... },\n method2: function() { ... }\n});\n\nvar test = new My.cool.Class();\n\nMy.cool.Class.createAlias({\n method3: 'method1',\n method4: 'method2'\n});\n\ntest.method3(); // test.method1()\n\nMy.cool.Class.createAlias('method5', 'method3');\n\ntest.method5(); // test.method3() -&gt; test.method1()\n</code></pre>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>alias</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The new method name, or an object to set multiple aliases. See\n<a href=\"#!/api/Ext.Function-method-flexSetter\" rel=\"Ext.Function-method-flexSetter\" class=\"docClass\">flexSetter</a></p>\n</div></li><li><span class='pre'>origin</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a>/<a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The original method name</p>\n</div></li></ul></div></div></div><div id='static-method-getName' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Base' rel='Ext.Base' class='definedIn docClass'>Ext.Base</a><br/><a href='source/Base3.html#Ext-Base-static-method-getName' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Base-static-method-getName' class='name expandable'>getName</a>( <span class='pre'></span> ) : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><strong class='static-signature'>static</strong></div><div class='description'><div class='short'>Get the current class' name in string format. ...</div><div class='long'><p>Get the current class' name in string format.</p>\n\n<pre><code>Ext.define('My.cool.Class', {\n constructor: function() {\n alert(this.self.getName()); // alerts 'My.cool.Class'\n }\n});\n\nMy.cool.Class.getName(); // 'My.cool.Class'\n</code></pre>\n<h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a></span><div class='sub-desc'><p>className</p>\n</div></li></ul></div></div></div><div id='static-method-implement' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Base' rel='Ext.Base' class='definedIn docClass'>Ext.Base</a><br/><a href='source/Base3.html#Ext-Base-static-method-implement' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Base-static-method-implement' class='name expandable'>implement</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> members</span> )<strong class='static-signature'>static</strong></div><div class='description'><div class='short'>Add methods / properties to the prototype of this class. ...</div><div class='long'><p>Add methods / properties to the prototype of this class.</p>\n\n<pre><code>Ext.define('My.awesome.Cat', {\n constructor: function() {\n ...\n }\n});\n\n My.awesome.Cat.implement({\n meow: function() {\n alert('Meowww...');\n }\n });\n\n var kitty = new My.awesome.Cat;\n kitty.meow();\n</code></pre>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>members</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'>\n</div></li></ul></div></div></div><div id='static-method-override' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.Base' rel='Ext.Base' class='definedIn docClass'>Ext.Base</a><br/><a href='source/Base3.html#Ext-Base-static-method-override' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.Base-static-method-override' class='name expandable'>override</a>( <span class='pre'><a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> members</span> ) : <a href=\"#!/api/Ext.Base\" rel=\"Ext.Base\" class=\"docClass\">Ext.Base</a><strong class='static-signature'>static</strong></div><div class='description'><div class='short'>Override prototype members of this class. ...</div><div class='long'><p>Override prototype members of this class. Overridden methods can be invoked via\n<a href=\"#!/api/Ext.Base-method-callOverridden\" rel=\"Ext.Base-method-callOverridden\" class=\"docClass\">callOverridden</a></p>\n\n<pre><code>Ext.define('My.Cat', {\n constructor: function() {\n alert(\"I'm a cat!\");\n\n return this;\n }\n});\n\nMy.Cat.override({\n constructor: function() {\n alert(\"I'm going to be a cat!\");\n\n var instance = this.callOverridden();\n\n alert(\"Meeeeoooowwww\");\n\n return instance;\n }\n});\n\nvar kitty = new My.Cat(); // alerts \"I'm going to be a cat!\"\n // alerts \"I'm a cat!\"\n // alerts \"Meeeeoooowwww\"\n</code></pre>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>members</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'>\n</div></li></ul><h3 class='pa'>Returns</h3><ul><li><span class='pre'><a href=\"#!/api/Ext.Base\" rel=\"Ext.Base\" class=\"docClass\">Ext.Base</a></span><div class='sub-desc'><p>this</p>\n</div></li></ul></div></div></div></div></div><div id='m-event'><div class='definedBy'>Defined By</div><h3 class='members-title'>Events</h3><div class='subsection'><div id='event-activate' class='member first-child not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-event-activate' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-event-activate' class='name expandable'>activate</a>( <span class='pre'><a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the window has been visually activated via setActive. ...</div><div class='long'><p>Fires after the window has been visually activated via <a href=\"#!/api/Ext.window.Window-method-setActive\" rel=\"Ext.window.Window-method-setActive\" class=\"docClass\">setActive</a>.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-add' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-event-add' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-event-add' class='name expandable'>add</a>( <span class='pre'><a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a> this, <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> component, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> index, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>@bubbles\nFires after any Ext.Component is added or inserted into the container. ...</div><div class='long'><p>@bubbles\nFires after any <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> is added or inserted into the container.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a><div class='sub-desc'>\n</div></li><li><span class='pre'>component</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'><p>The component that was added</p>\n</div></li><li><span class='pre'>index</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The index at which the component was added to the container's items collection</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-added' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-added' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-added' class='name expandable'>added</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a> container, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> pos, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after a Component had been added to a Container. ...</div><div class='long'><p>Fires after a Component had been added to a Container.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>container</span> : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a><div class='sub-desc'><p>Parent Container</p>\n</div></li><li><span class='pre'>pos</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>position of Component</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-afterlayout' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-event-afterlayout' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-event-afterlayout' class='name expandable'>afterlayout</a>( <span class='pre'><a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a> this, <a href=\"#!/api/Ext.layout.container.Container\" rel=\"Ext.layout.container.Container\" class=\"docClass\">Ext.layout.container.Container</a> layout, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires when the components in this container are arranged by the associated layout manager. ...</div><div class='long'><p>Fires when the components in this container are arranged by the associated layout manager.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a><div class='sub-desc'>\n</div></li><li><span class='pre'>layout</span> : <a href=\"#!/api/Ext.layout.container.Container\" rel=\"Ext.layout.container.Container\" class=\"docClass\">Ext.layout.container.Container</a><div class='sub-desc'><p>The ContainerLayout implementation for this container</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-afterrender' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-afterrender' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-afterrender' class='name expandable'>afterrender</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the component rendering is finished. ...</div><div class='long'><p>Fires after the component rendering is finished.</p>\n\n<p>The afterrender event is fired after this Component has been <a href=\"#!/api/Ext.AbstractComponent-property-rendered\" rel=\"Ext.AbstractComponent-property-rendered\" class=\"docClass\">rendered</a>, been postprocesed by any\nafterRender method defined for the Component.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-beforeactivate' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-beforeactivate' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-beforeactivate' class='name expandable'>beforeactivate</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires before a Component has been visually activated. ...</div><div class='long'><p>Fires before a Component has been visually activated. Returning false from an event listener can prevent\nthe activate from occurring.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-beforeadd' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-event-beforeadd' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-event-beforeadd' class='name expandable'>beforeadd</a>( <span class='pre'><a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a> this, <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> component, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> index, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires before any Ext.Component is added or inserted into the container. ...</div><div class='long'><p>Fires before any <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> is added or inserted into the container.\nA handler can return false to cancel the add.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a><div class='sub-desc'>\n</div></li><li><span class='pre'>component</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'><p>The component being added</p>\n</div></li><li><span class='pre'>index</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The index at which the component will be added to the container's items collection</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-beforeclose' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-event-beforeclose' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-event-beforeclose' class='name expandable'>beforeclose</a>( <span class='pre'><a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a> panel, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires before the user closes the panel. ...</div><div class='long'><p>Fires before the user closes the panel. Return false from any listener to stop the close event being\nfired</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>panel</span> : <a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a><div class='sub-desc'><p>The Panel object</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-beforecollapse' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-event-beforecollapse' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-event-beforecollapse' class='name expandable'>beforecollapse</a>( <span class='pre'><a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a> p, <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> direction, <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> animate, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires before this panel is collapsed. ...</div><div class='long'><p>Fires before this panel is collapsed. Return false to prevent the collapse.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>p</span> : <a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a><div class='sub-desc'><p>The Panel being collapsed.</p>\n</div></li><li><span class='pre'>direction</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>. The direction of the collapse. One of</p>\n\n<ul>\n<li>Ext.Component.DIRECTION_TOP</li>\n<li>Ext.Component.DIRECTION_RIGHT</li>\n<li>Ext.Component.DIRECTION_BOTTOM</li>\n<li>Ext.Component.DIRECTION_LEFT</li>\n</ul>\n\n</div></li><li><span class='pre'>animate</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a><div class='sub-desc'><p>True if the collapse is animated, else false.</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-beforedeactivate' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-beforedeactivate' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-beforedeactivate' class='name expandable'>beforedeactivate</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires before a Component has been visually deactivated. ...</div><div class='long'><p>Fires before a Component has been visually deactivated. Returning false from an event listener can\nprevent the deactivate from occurring.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-beforedestroy' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-beforedestroy' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-beforedestroy' class='name expandable'>beforedestroy</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires before the component is destroyed. ...</div><div class='long'><p>Fires before the component is <a href=\"#!/api/Ext.AbstractComponent-event-destroy\" rel=\"Ext.AbstractComponent-event-destroy\" class=\"docClass\">destroy</a>ed. Return false from an event handler to stop the\n<a href=\"#!/api/Ext.AbstractComponent-event-destroy\" rel=\"Ext.AbstractComponent-event-destroy\" class=\"docClass\">destroy</a>.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-beforeexpand' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-event-beforeexpand' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-event-beforeexpand' class='name expandable'>beforeexpand</a>( <span class='pre'><a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a> p, <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a> animate, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires before this panel is expanded. ...</div><div class='long'><p>Fires before this panel is expanded. Return false to prevent the expand.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>p</span> : <a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a><div class='sub-desc'><p>The Panel being expanded.</p>\n</div></li><li><span class='pre'>animate</span> : <a href=\"#!/api/Boolean\" rel=\"Boolean\" class=\"docClass\">Boolean</a><div class='sub-desc'><p>True if the expand is animated, else false.</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-beforehide' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-beforehide' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-beforehide' class='name expandable'>beforehide</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires before the component is hidden when calling the hide method. ...</div><div class='long'><p>Fires before the component is hidden when calling the <a href=\"#!/api/Ext.AbstractComponent-event-hide\" rel=\"Ext.AbstractComponent-event-hide\" class=\"docClass\">hide</a> method. Return false from an event\nhandler to stop the hide.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-beforeremove' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-event-beforeremove' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-event-beforeremove' class='name expandable'>beforeremove</a>( <span class='pre'><a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a> this, <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> component, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires before any Ext.Component is removed from the container. ...</div><div class='long'><p>Fires before any <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> is removed from the container. A handler can return\nfalse to cancel the remove.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a><div class='sub-desc'>\n</div></li><li><span class='pre'>component</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'><p>The component being removed</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-beforerender' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-beforerender' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-beforerender' class='name expandable'>beforerender</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires before the component is rendered. ...</div><div class='long'><p>Fires before the component is <a href=\"#!/api/Ext.AbstractComponent-property-rendered\" rel=\"Ext.AbstractComponent-property-rendered\" class=\"docClass\">rendered</a>. Return false from an event handler to stop the\n<a href=\"#!/api/Ext.AbstractComponent-event-render\" rel=\"Ext.AbstractComponent-event-render\" class=\"docClass\">render</a>.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-beforeshow' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-beforeshow' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-beforeshow' class='name expandable'>beforeshow</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires before the component is shown when calling the show method. ...</div><div class='long'><p>Fires before the component is shown when calling the <a href=\"#!/api/Ext.AbstractComponent-event-show\" rel=\"Ext.AbstractComponent-event-show\" class=\"docClass\">show</a> method. Return false from an event\nhandler to stop the show.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-beforestaterestore' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.state.Stateful' rel='Ext.state.Stateful' class='definedIn docClass'>Ext.state.Stateful</a><br/><a href='source/Stateful.html#Ext-state-Stateful-event-beforestaterestore' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.state.Stateful-event-beforestaterestore' class='name expandable'>beforestaterestore</a>( <span class='pre'><a href=\"#!/api/Ext.state.Stateful\" rel=\"Ext.state.Stateful\" class=\"docClass\">Ext.state.Stateful</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> state, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires before the state of the object is restored. ...</div><div class='long'><p>Fires before the state of the object is restored. Return false from an event handler to stop the restore.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.state.Stateful\" rel=\"Ext.state.Stateful\" class=\"docClass\">Ext.state.Stateful</a><div class='sub-desc'>\n</div></li><li><span class='pre'>state</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The hash of state values returned from the StateProvider. If this\nevent is not vetoed, then the state object is passed to <b><tt>applyState</tt></b>. By default,\nthat simply copies property values into this object. The method maybe overriden to\nprovide custom state restoration.</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-beforestatesave' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.state.Stateful' rel='Ext.state.Stateful' class='definedIn docClass'>Ext.state.Stateful</a><br/><a href='source/Stateful.html#Ext-state-Stateful-event-beforestatesave' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.state.Stateful-event-beforestatesave' class='name expandable'>beforestatesave</a>( <span class='pre'><a href=\"#!/api/Ext.state.Stateful\" rel=\"Ext.state.Stateful\" class=\"docClass\">Ext.state.Stateful</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> state, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires before the state of the object is saved to the configured state provider. ...</div><div class='long'><p>Fires before the state of the object is saved to the configured state provider. Return false to stop the save.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.state.Stateful\" rel=\"Ext.state.Stateful\" class=\"docClass\">Ext.state.Stateful</a><div class='sub-desc'>\n</div></li><li><span class='pre'>state</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The hash of state values. This is determined by calling\n<b><tt>getState()</tt></b> on the object. This method must be provided by the\ndeveloper to return whetever representation of state is required, by default, <a href=\"#!/api/Ext.state.Stateful\" rel=\"Ext.state.Stateful\" class=\"docClass\">Ext.state.Stateful</a>\nhas a null implementation.</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-bodyresize' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.AbstractPanel' rel='Ext.panel.AbstractPanel' class='definedIn docClass'>Ext.panel.AbstractPanel</a><br/><a href='source/AbstractPanel.html#Ext-panel-AbstractPanel-event-bodyresize' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.AbstractPanel-event-bodyresize' class='name expandable'>bodyresize</a>( <span class='pre'><a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a> p, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> width, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> height, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the Panel has been resized. ...</div><div class='long'><p>Fires after the Panel has been resized.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>p</span> : <a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a><div class='sub-desc'><p>the Panel which has been resized.</p>\n</div></li><li><span class='pre'>width</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The Panel body's new width.</p>\n</div></li><li><span class='pre'>height</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The Panel body's new height.</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-collapse' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-event-collapse' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-event-collapse' class='name expandable'>collapse</a>( <span class='pre'><a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a> p, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after this Panel hass collapsed. ...</div><div class='long'><p>Fires after this Panel hass collapsed.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>p</span> : <a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a><div class='sub-desc'><p>The Panel that has been collapsed.</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-deactivate' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-event-deactivate' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-event-deactivate' class='name expandable'>deactivate</a>( <span class='pre'><a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the window has been visually deactivated via setActive. ...</div><div class='long'><p>Fires after the window has been visually deactivated via <a href=\"#!/api/Ext.window.Window-method-setActive\" rel=\"Ext.window.Window-method-setActive\" class=\"docClass\">setActive</a>.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-destroy' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-destroy' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-destroy' class='name expandable'>destroy</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the component is destroyed. ...</div><div class='long'><p>Fires after the component is <a href=\"#!/api/Ext.AbstractComponent-event-destroy\" rel=\"Ext.AbstractComponent-event-destroy\" class=\"docClass\">destroy</a>ed.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-disable' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-disable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-disable' class='name expandable'>disable</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the component is disabled. ...</div><div class='long'><p>Fires after the component is disabled.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-enable' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-enable' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-enable' class='name expandable'>enable</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the component is enabled. ...</div><div class='long'><p>Fires after the component is enabled.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-expand' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-event-expand' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-event-expand' class='name expandable'>expand</a>( <span class='pre'><a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a> p, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after this Panel has expanded. ...</div><div class='long'><p>Fires after this Panel has expanded.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>p</span> : <a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a><div class='sub-desc'><p>The Panel that has been expanded.</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-hide' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-hide' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-hide' class='name expandable'>hide</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the component is hidden. ...</div><div class='long'><p>Fires after the component is hidden. Fires after the component is hidden when calling the <a href=\"#!/api/Ext.AbstractComponent-event-hide\" rel=\"Ext.AbstractComponent-event-hide\" class=\"docClass\">hide</a>\nmethod.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-iconchange' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-event-iconchange' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-event-iconchange' class='name expandable'>iconchange</a>( <span class='pre'><a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a> p, <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> newIconCls, <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> oldIconCls, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the Panel iconCls has been set or changed. ...</div><div class='long'><p>Fires after the Panel iconCls has been set or changed.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>p</span> : <a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a><div class='sub-desc'><p>the Panel which has been resized.</p>\n</div></li><li><span class='pre'>newIconCls</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The new iconCls.</p>\n</div></li><li><span class='pre'>oldIconCls</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The previous panel iconCls.</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-maximize' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-event-maximize' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-event-maximize' class='name expandable'>maximize</a>( <span class='pre'><a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the window has been maximized. ...</div><div class='long'><p>Fires after the window has been maximized.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-minimize' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-event-minimize' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-event-minimize' class='name expandable'>minimize</a>( <span class='pre'><a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the window has been minimized. ...</div><div class='long'><p>Fires after the window has been minimized.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-move' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-move' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-move' class='name expandable'>move</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> x, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> y, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the component is moved. ...</div><div class='long'><p>Fires after the component is moved.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>x</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The new x position</p>\n</div></li><li><span class='pre'>y</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The new y position</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-remove' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.container.AbstractContainer' rel='Ext.container.AbstractContainer' class='definedIn docClass'>Ext.container.AbstractContainer</a><br/><a href='source/AbstractContainer.html#Ext-container-AbstractContainer-event-remove' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.container.AbstractContainer-event-remove' class='name expandable'>remove</a>( <span class='pre'><a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a> this, <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> component, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>@bubbles\nFires after any Ext.Component is removed from the container. ...</div><div class='long'><p>@bubbles\nFires after any <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> is removed from the container.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a><div class='sub-desc'>\n</div></li><li><span class='pre'>component</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'><p>The component that was removed</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-removed' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-removed' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-removed' class='name expandable'>removed</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a> ownerCt, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires when a component is removed from an Ext.container.Container ...</div><div class='long'><p>Fires when a component is removed from an <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a></p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>ownerCt</span> : <a href=\"#!/api/Ext.container.Container\" rel=\"Ext.container.Container\" class=\"docClass\">Ext.container.Container</a><div class='sub-desc'><p>Container which holds the component</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-render' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-render' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-render' class='name expandable'>render</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the component markup is rendered. ...</div><div class='long'><p>Fires after the component markup is <a href=\"#!/api/Ext.AbstractComponent-property-rendered\" rel=\"Ext.AbstractComponent-property-rendered\" class=\"docClass\">rendered</a>.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-resize' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-event-resize' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-event-resize' class='name expandable'>resize</a>( <span class='pre'><a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a> this, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> width, <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a> height, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the window has been resized. ...</div><div class='long'><p>Fires after the window has been resized.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a><div class='sub-desc'>\n</div></li><li><span class='pre'>width</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The window's new width</p>\n</div></li><li><span class='pre'>height</span> : <a href=\"#!/api/Number\" rel=\"Number\" class=\"docClass\">Number</a><div class='sub-desc'><p>The window's new height</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-restore' class='member not-inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.window.Window' rel='Ext.window.Window' class='definedIn docClass'>Ext.window.Window</a><br/><a href='source/Window.html#Ext-window-Window-event-restore' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.window.Window-event-restore' class='name expandable'>restore</a>( <span class='pre'><a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the window has been restored to its original size after being maximized. ...</div><div class='long'><p>Fires after the window has been restored to its original size after being maximized.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.window.Window\" rel=\"Ext.window.Window\" class=\"docClass\">Ext.window.Window</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-show' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.AbstractComponent' rel='Ext.AbstractComponent' class='definedIn docClass'>Ext.AbstractComponent</a><br/><a href='source/AbstractComponent.html#Ext-AbstractComponent-event-show' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.AbstractComponent-event-show' class='name expandable'>show</a>( <span class='pre'><a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the component is shown when calling the show method. ...</div><div class='long'><p>Fires after the component is shown when calling the <a href=\"#!/api/Ext.AbstractComponent-event-show\" rel=\"Ext.AbstractComponent-event-show\" class=\"docClass\">show</a> method.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.Component\" rel=\"Ext.Component\" class=\"docClass\">Ext.Component</a><div class='sub-desc'>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-staterestore' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.state.Stateful' rel='Ext.state.Stateful' class='definedIn docClass'>Ext.state.Stateful</a><br/><a href='source/Stateful.html#Ext-state-Stateful-event-staterestore' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.state.Stateful-event-staterestore' class='name expandable'>staterestore</a>( <span class='pre'><a href=\"#!/api/Ext.state.Stateful\" rel=\"Ext.state.Stateful\" class=\"docClass\">Ext.state.Stateful</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> state, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the state of the object is restored. ...</div><div class='long'><p>Fires after the state of the object is restored.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.state.Stateful\" rel=\"Ext.state.Stateful\" class=\"docClass\">Ext.state.Stateful</a><div class='sub-desc'>\n</div></li><li><span class='pre'>state</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The hash of state values returned from the StateProvider. This is passed\nto <b><tt>applyState</tt></b>. By default, that simply copies property values into this\nobject. The method maybe overriden to provide custom state restoration.</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-statesave' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.state.Stateful' rel='Ext.state.Stateful' class='definedIn docClass'>Ext.state.Stateful</a><br/><a href='source/Stateful.html#Ext-state-Stateful-event-statesave' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.state.Stateful-event-statesave' class='name expandable'>statesave</a>( <span class='pre'><a href=\"#!/api/Ext.state.Stateful\" rel=\"Ext.state.Stateful\" class=\"docClass\">Ext.state.Stateful</a> this, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> state, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the state of the object is saved to the configured state provider. ...</div><div class='long'><p>Fires after the state of the object is saved to the configured state provider.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>this</span> : <a href=\"#!/api/Ext.state.Stateful\" rel=\"Ext.state.Stateful\" class=\"docClass\">Ext.state.Stateful</a><div class='sub-desc'>\n</div></li><li><span class='pre'>state</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The hash of state values. This is determined by calling\n<b><tt>getState()</tt></b> on the object. This method must be provided by the\ndeveloper to return whetever representation of state is required, by default, <a href=\"#!/api/Ext.state.Stateful\" rel=\"Ext.state.Stateful\" class=\"docClass\">Ext.state.Stateful</a>\nhas a null implementation.</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div><div id='event-titlechange' class='member inherited'><a href='#' class='side expandable'><span>&nbsp;</span></a><div class='title'><div class='meta'><a href='#!/api/Ext.panel.Panel' rel='Ext.panel.Panel' class='definedIn docClass'>Ext.panel.Panel</a><br/><a href='source/Panel3.html#Ext-panel-Panel-event-titlechange' target='_blank' class='viewSource'>view source</a></div><a href='#!/api/Ext.panel.Panel-event-titlechange' class='name expandable'>titlechange</a>( <span class='pre'><a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a> p, <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> newTitle, <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a> oldTitle, <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a> eOpts</span> )</div><div class='description'><div class='short'>Fires after the Panel title has been set or changed. ...</div><div class='long'><p>Fires after the Panel title has been set or changed.</p>\n<h3 class=\"pa\">Parameters</h3><ul><li><span class='pre'>p</span> : <a href=\"#!/api/Ext.panel.Panel\" rel=\"Ext.panel.Panel\" class=\"docClass\">Ext.panel.Panel</a><div class='sub-desc'><p>the Panel which has been resized.</p>\n</div></li><li><span class='pre'>newTitle</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The new title.</p>\n</div></li><li><span class='pre'>oldTitle</span> : <a href=\"#!/api/String\" rel=\"String\" class=\"docClass\">String</a><div class='sub-desc'><p>The previous panel title.</p>\n</div></li><li><span class='pre'>eOpts</span> : <a href=\"#!/api/Object\" rel=\"Object\" class=\"docClass\">Object</a><div class='sub-desc'><p>The options object passed to <a href=\"#!/api/Ext.util.Observable-method-addListener\" rel=\"Ext.util.Observable-method-addListener\" class=\"docClass\">Ext.util.Observable.addListener</a>.</p>\n\n\n\n</div></li></ul></div></div></div></div></div></div></div>","allMixins":["Ext.util.Floating","Ext.util.Observable","Ext.util.Animate","Ext.state.Stateful"],"meta":{},"requires":["Ext.util.ComponentDragger","Ext.util.Region","Ext.EventManager"],"deprecated":null,"extends":"Ext.panel.Panel","inheritable":false,"static":false,"superclasses":["Ext.Base","Ext.AbstractComponent","Ext.Component","Ext.container.AbstractContainer","Ext.container.Container","Ext.panel.AbstractPanel","Ext.panel.Panel","Ext.window.Window"],"singleton":false,"code_type":"ext_define","alias":null,"statics":{"property":[],"css_var":[],"css_mixin":[],"cfg":[],"method":[{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"addStatics","id":"static-method-addStatics"},{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"borrow","id":"static-method-borrow"},{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"create","id":"static-method-create"},{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"createAlias","id":"static-method-createAlias"},{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"getName","id":"static-method-getName"},{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"implement","id":"static-method-implement"},{"tagname":"method","deprecated":null,"static":true,"owner":"Ext.Base","template":false,"required":null,"protected":false,"name":"override","id":"static-method-override"}],"event":[]},"subclasses":["Ext.window.MessageBox"],"uses":[],"protected":false,"mixins":[],"members":{"property":[{"tagname":"property","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":null,"protected":false,"name":"dd","id":"property-dd"},{"tagname":"property","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"draggable","id":"property-draggable"},{"tagname":"property","deprecated":null,"static":false,"owner":"Ext.Component","template":null,"required":null,"protected":false,"name":"floatParent","id":"property-floatParent"},{"tagname":"property","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"frameSize","id":"property-frameSize"},{"tagname":"property","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":null,"protected":false,"name":"items","id":"property-items"},{"tagname":"property","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"maskOnDisable","id":"property-maskOnDisable"},{"tagname":"property","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"ownerCt","id":"property-ownerCt"},{"tagname":"property","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"rendered","id":"property-rendered"},{"tagname":"property","deprecated":null,"static":false,"owner":"Ext.Base","template":null,"required":null,"protected":true,"name":"self","id":"property-self"},{"tagname":"property","deprecated":null,"static":false,"owner":"Ext.Component","template":null,"required":null,"protected":false,"name":"zIndexManager","id":"property-zIndexManager"}],"css_var":[],"css_mixin":[],"cfg":[{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":false,"protected":false,"name":"activeItem","id":"cfg-activeItem"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"animCollapse","id":"cfg-animCollapse"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"animateTarget","id":"cfg-animateTarget"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":false,"protected":false,"name":"autoDestroy","id":"cfg-autoDestroy"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"autoEl","id":"cfg-autoEl"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"autoRender","id":"cfg-autoRender"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.Component","template":null,"required":false,"protected":false,"name":"autoScroll","id":"cfg-autoScroll"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"autoShow","id":"cfg-autoShow"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"baseCls","id":"cfg-baseCls"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"bbar","id":"cfg-bbar"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.AbstractPanel","template":null,"required":false,"protected":false,"name":"bodyBorder","id":"cfg-bodyBorder"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.AbstractPanel","template":null,"required":false,"protected":false,"name":"bodyCls","id":"cfg-bodyCls"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.AbstractPanel","template":null,"required":false,"protected":false,"name":"bodyPadding","id":"cfg-bodyPadding"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.AbstractPanel","template":null,"required":false,"protected":false,"name":"bodyStyle","id":"cfg-bodyStyle"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"border","id":"cfg-border"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":false,"protected":false,"name":"bubbleEvents","id":"cfg-bubbleEvents"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"buttonAlign","id":"cfg-buttonAlign"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"buttons","id":"cfg-buttons"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"childEls","id":"cfg-childEls"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"closable","id":"cfg-closable"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"closeAction","id":"cfg-closeAction"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"cls","id":"cfg-cls"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"collapseDirection","id":"cfg-collapseDirection"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"collapseFirst","id":"cfg-collapseFirst"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"collapseMode","id":"cfg-collapseMode"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"collapsed","id":"cfg-collapsed"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"collapsedCls","id":"cfg-collapsedCls"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"collapsible","id":"cfg-collapsible"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"componentCls","id":"cfg-componentCls"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"componentLayout","id":"cfg-componentLayout"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"constrain","id":"cfg-constrain"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"constrainHeader","id":"cfg-constrainHeader"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"contentEl","id":"cfg-contentEl"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"data","id":"cfg-data"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.AbstractPanel","template":null,"required":false,"protected":false,"name":"defaultDockWeights","id":"cfg-defaultDockWeights"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"defaultFocus","id":"cfg-defaultFocus"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":false,"protected":false,"name":"defaultType","id":"cfg-defaultType"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":false,"protected":false,"name":"defaults","id":"cfg-defaults"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"disabled","id":"cfg-disabled"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"disabledCls","id":"cfg-disabledCls"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"dockedItems","id":"cfg-dockedItems"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"draggable","id":"cfg-draggable"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"expandOnShow","id":"cfg-expandOnShow"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"fbar","id":"cfg-fbar"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"floatable","id":"cfg-floatable"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.Component","template":null,"required":false,"protected":false,"name":"floating","id":"cfg-floating"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.util.Floating","template":null,"required":false,"protected":false,"name":"focusOnToFront","id":"cfg-focusOnToFront"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"frame","id":"cfg-frame"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"frameHeader","id":"cfg-frameHeader"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"headerPosition","id":"cfg-headerPosition"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"height","id":"cfg-height"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"hidden","id":"cfg-hidden"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"hideCollapseTool","id":"cfg-hideCollapseTool"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"hideMode","id":"cfg-hideMode"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"html","id":"cfg-html"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"iconCls","id":"cfg-iconCls"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"id","id":"cfg-id"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"itemId","id":"cfg-itemId"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":false,"protected":false,"name":"items","id":"cfg-items"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":false,"protected":false,"name":"layout","id":"cfg-layout"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"lbar","id":"cfg-lbar"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":null,"required":false,"protected":false,"name":"listeners","id":"cfg-listeners"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"loader","id":"cfg-loader"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.Component","template":null,"required":false,"protected":false,"name":"maintainFlex","id":"cfg-maintainFlex"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"margin","id":"cfg-margin"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"maxHeight","id":"cfg-maxHeight"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"maxWidth","id":"cfg-maxWidth"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"maximizable","id":"cfg-maximizable"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"maximized","id":"cfg-maximized"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"minButtonWidth","id":"cfg-minButtonWidth"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"minHeight","id":"cfg-minHeight"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"minWidth","id":"cfg-minWidth"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"minimizable","id":"cfg-minimizable"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"modal","id":"cfg-modal"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"onEsc","id":"cfg-onEsc"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"overCls","id":"cfg-overCls"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"overlapHeader","id":"cfg-overlapHeader"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"padding","id":"cfg-padding"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"placeholder","id":"cfg-placeholder"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"plain","id":"cfg-plain"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"plugins","id":"cfg-plugins"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"preventHeader","id":"cfg-preventHeader"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"rbar","id":"cfg-rbar"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"renderData","id":"cfg-renderData"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"renderSelectors","id":"cfg-renderSelectors"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"renderTo","id":"cfg-renderTo"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"renderTpl","id":"cfg-renderTpl"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"resizable","id":"cfg-resizable"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.Component","template":null,"required":false,"protected":false,"name":"resizeHandles","id":"cfg-resizeHandles"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.state.Stateful","template":null,"required":false,"protected":false,"name":"saveDelay","id":"cfg-saveDelay"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.util.Floating","template":null,"required":false,"protected":false,"name":"shadow","id":"cfg-shadow"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.state.Stateful","template":null,"required":false,"protected":false,"name":"stateEvents","id":"cfg-stateEvents"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.state.Stateful","template":null,"required":false,"protected":false,"name":"stateId","id":"cfg-stateId"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.state.Stateful","template":null,"required":false,"protected":false,"name":"stateful","id":"cfg-stateful"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"style","id":"cfg-style"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"styleHtmlCls","id":"cfg-styleHtmlCls"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"styleHtmlContent","id":"cfg-styleHtmlContent"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":false,"protected":false,"name":"suspendLayout","id":"cfg-suspendLayout"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"tbar","id":"cfg-tbar"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"title","id":"cfg-title"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"titleCollapse","id":"cfg-titleCollapse"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.Component","template":null,"required":false,"protected":false,"name":"toFrontOnShow","id":"cfg-toFrontOnShow"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":false,"protected":false,"name":"tools","id":"cfg-tools"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"tpl","id":"cfg-tpl"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"tplWriteMode","id":"cfg-tplWriteMode"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"ui","id":"cfg-ui"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"width","id":"cfg-width"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"x","id":"cfg-x"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":false,"protected":false,"name":"xtype","id":"cfg-xtype"},{"tagname":"cfg","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":false,"protected":false,"name":"y","id":"cfg-y"}],"method":[{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"constructor","id":"method-constructor"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":false,"required":null,"protected":false,"name":"add","id":"method-add"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"addChildEls","id":"method-addChildEls"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"addClass","id":"method-addClass"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"addCls","id":"method-addCls"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"addClsWithUI","id":"method-addClsWithUI"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.panel.AbstractPanel","template":false,"required":null,"protected":false,"name":"addDocked","id":"method-addDocked"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"addEvents","id":"method-addEvents"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"addListener","id":"method-addListener"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"addManagedListener","id":"method-addManagedListener"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.state.Stateful","template":false,"required":null,"protected":false,"name":"addStateEvents","id":"method-addStateEvents"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"addUIClsToElement","id":"method-addUIClsToElement"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"afterComponentLayout","id":"method-afterComponentLayout"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Floating","template":false,"required":null,"protected":false,"name":"alignTo","id":"method-alignTo"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Animate","template":false,"required":null,"protected":false,"name":"animate","id":"method-animate"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.state.Stateful","template":false,"required":null,"protected":false,"name":"applyState","id":"method-applyState"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"beforeComponentLayout","id":"method-beforeComponentLayout"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":false,"required":null,"protected":false,"name":"beforeLayout","id":"method-beforeLayout"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"bubble","id":"method-bubble"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Base","template":false,"required":null,"protected":true,"name":"callOverridden","id":"method-callOverridden"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Base","template":false,"required":null,"protected":true,"name":"callParent","id":"method-callParent"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":false,"required":null,"protected":false,"name":"cascade","id":"method-cascade"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Floating","template":false,"required":null,"protected":false,"name":"center","id":"method-center"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":false,"required":null,"protected":false,"name":"child","id":"method-child"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"clearListeners","id":"method-clearListeners"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"clearManagedListeners","id":"method-clearManagedListeners"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"cloneConfig","id":"method-cloneConfig"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":false,"required":null,"protected":false,"name":"close","id":"method-close"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":false,"required":null,"protected":false,"name":"collapse","id":"method-collapse"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"constructPlugins","id":"method-constructPlugins"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"destroy","id":"method-destroy"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"disable","id":"method-disable"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"doAutoRender","id":"method-doAutoRender"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"doComponentLayout","id":"method-doComponentLayout"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Floating","template":false,"required":null,"protected":false,"name":"doConstrain","id":"method-doConstrain"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":false,"required":null,"protected":false,"name":"doLayout","id":"method-doLayout"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":false,"required":null,"protected":false,"name":"down","id":"method-down"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"enable","id":"method-enable"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"enableBubble","id":"method-enableBubble"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":false,"required":null,"protected":false,"name":"expand","id":"method-expand"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"findLayoutController","id":"method-findLayoutController"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"findParentBy","id":"method-findParentBy"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"findParentByType","id":"method-findParentByType"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"fireEvent","id":"method-fireEvent"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"focus","id":"method-focus"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"forceComponentLayout","id":"method-forceComponentLayout"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Animate","template":false,"required":null,"protected":false,"name":"getActiveAnimation","id":"method-getActiveAnimation"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"getBox","id":"method-getBox"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"getBubbleTarget","id":"method-getBubbleTarget"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.container.Container","template":false,"required":null,"protected":false,"name":"getChildByElement","id":"method-getChildByElement"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.panel.AbstractPanel","template":false,"required":null,"protected":false,"name":"getComponent","id":"method-getComponent"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.panel.AbstractPanel","template":false,"required":null,"protected":false,"name":"getDockedComponent","id":"method-getDockedComponent"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.panel.AbstractPanel","template":false,"required":null,"protected":false,"name":"getDockedItems","id":"method-getDockedItems"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"getEl","id":"method-getEl"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.window.Window","template":false,"required":null,"protected":false,"name":"getFocusEl","id":"method-getFocusEl"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"getHeight","id":"method-getHeight"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"getId","id":"method-getId"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"getInsertPosition","id":"method-getInsertPosition"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":false,"required":null,"protected":false,"name":"getLayout","id":"method-getLayout"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"getLoader","id":"method-getLoader"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"getPlugin","id":"method-getPlugin"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"getPosition","id":"method-getPosition"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"getSize","id":"method-getSize"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"getState","id":"method-getState"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.state.Stateful","template":false,"required":null,"protected":false,"name":"getStateId","id":"method-getStateId"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"getWidth","id":"method-getWidth"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"getXType","id":"method-getXType"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"getXTypes","id":"method-getXTypes"},{"tagname":"method","deprecated":{"doc":null,"tagname":"deprecated","text":"<p>Replaced by <a href=\"#!/api/Ext.util.Animate-method-getActiveAnimation\" rel=\"Ext.util.Animate-method-getActiveAnimation\" class=\"docClass\">getActiveAnimation</a></p>\n","version":"4.0"},"static":false,"owner":"Ext.util.Animate","template":false,"required":null,"protected":false,"name":"hasActiveFx","id":"method-hasActiveFx"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"hasListener","id":"method-hasListener"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"hasUICls","id":"method-hasUICls"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"hide","id":"method-hide"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":true,"required":null,"protected":false,"name":"initComponent","id":"method-initComponent"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Base","template":false,"required":null,"protected":true,"name":"initConfig","id":"method-initConfig"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":false,"required":null,"protected":false,"name":"insert","id":"method-insert"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.panel.AbstractPanel","template":false,"required":null,"protected":false,"name":"insertDocked","id":"method-insertDocked"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"is","id":"method-is"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"isDescendantOf","id":"method-isDescendantOf"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"isDisabled","id":"method-isDisabled"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"isDraggable","id":"method-isDraggable"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"isDroppable","id":"method-isDroppable"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"isFloating","id":"method-isFloating"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"isHidden","id":"method-isHidden"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"isVisible","id":"method-isVisible"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"isXType","id":"method-isXType"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.window.Window","template":false,"required":null,"protected":false,"name":"maximize","id":"method-maximize"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.window.Window","template":false,"required":null,"protected":false,"name":"minimize","id":"method-minimize"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"mon","id":"method-mon"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":false,"required":null,"protected":false,"name":"move","id":"method-move"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"mun","id":"method-mun"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"nextNode","id":"method-nextNode"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"nextSibling","id":"method-nextSibling"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"on","id":"method-on"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"previousNode","id":"method-previousNode"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"previousSibling","id":"method-previousSibling"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":false,"required":null,"protected":false,"name":"query","id":"method-query"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"relayEvents","id":"method-relayEvents"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":false,"required":null,"protected":false,"name":"remove","id":"method-remove"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":false,"required":null,"protected":false,"name":"removeAll","id":"method-removeAll"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"removeChildEls","id":"method-removeChildEls"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"removeCls","id":"method-removeCls"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"removeClsWithUI","id":"method-removeClsWithUI"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.panel.AbstractPanel","template":false,"required":null,"protected":false,"name":"removeDocked","id":"method-removeDocked"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"removeListener","id":"method-removeListener"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"removeManagedListener","id":"method-removeManagedListener"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"removeUIClsFromElement","id":"method-removeUIClsFromElement"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.window.Window","template":false,"required":null,"protected":false,"name":"restore","id":"method-restore"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"resumeEvents","id":"method-resumeEvents"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.state.Stateful","template":false,"required":null,"protected":false,"name":"savePropToState","id":"method-savePropToState"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Animate","template":false,"required":null,"protected":false,"name":"sequenceFx","id":"method-sequenceFx"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Floating","template":false,"required":null,"protected":false,"name":"setActive","id":"method-setActive"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"setAutoScroll","id":"method-setAutoScroll"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"setDisabled","id":"method-setDisabled"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"setDocked","id":"method-setDocked"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"setHeight","id":"method-setHeight"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":false,"required":null,"protected":false,"name":"setIconCls","id":"method-setIconCls"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"setLoading","id":"method-setLoading"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"setPagePosition","id":"method-setPagePosition"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"setPosition","id":"method-setPosition"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"setSize","id":"method-setSize"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":false,"required":null,"protected":false,"name":"setTitle","id":"method-setTitle"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"setUI","id":"method-setUI"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"setVisible","id":"method-setVisible"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"setWidth","id":"method-setWidth"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"show","id":"method-show"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"showAt","id":"method-showAt"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Base","template":false,"required":null,"protected":true,"name":"statics","id":"method-statics"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Animate","template":false,"required":null,"protected":false,"name":"stopAnimation","id":"method-stopAnimation"},{"tagname":"method","deprecated":{"doc":"Stops any running effects and clears this object's internal effects queue if it contains\nany additional effects that haven't started yet.","tagname":"deprecated","text":"<p>Replaced by <a href=\"#!/api/Ext.util.Animate-method-stopAnimation\" rel=\"Ext.util.Animate-method-stopAnimation\" class=\"docClass\">stopAnimation</a></p>\n","version":"4.0"},"static":false,"owner":"Ext.util.Animate","template":false,"required":null,"protected":false,"name":"stopFx","id":"method-stopFx"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"suspendEvents","id":"method-suspendEvents"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Animate","template":false,"required":null,"protected":false,"name":"syncFx","id":"method-syncFx"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Floating","template":false,"required":null,"protected":false,"name":"toBack","id":"method-toBack"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Floating","template":false,"required":null,"protected":false,"name":"toFront","id":"method-toFront"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":false,"required":null,"protected":false,"name":"toggleCollapse","id":"method-toggleCollapse"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.window.Window","template":false,"required":null,"protected":false,"name":"toggleMaximize","id":"method-toggleMaximize"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.util.Observable","template":false,"required":null,"protected":false,"name":"un","id":"method-un"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"up","id":"method-up"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":false,"required":null,"protected":false,"name":"update","id":"method-update"},{"tagname":"method","deprecated":null,"static":false,"owner":"Ext.Component","template":false,"required":null,"protected":false,"name":"updateBox","id":"method-updateBox"}],"event":[{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":null,"protected":false,"name":"activate","id":"event-activate"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":null,"protected":false,"name":"add","id":"event-add"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"added","id":"event-added"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":null,"protected":false,"name":"afterlayout","id":"event-afterlayout"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"afterrender","id":"event-afterrender"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"beforeactivate","id":"event-beforeactivate"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":null,"protected":false,"name":"beforeadd","id":"event-beforeadd"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":null,"protected":false,"name":"beforeclose","id":"event-beforeclose"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":null,"protected":false,"name":"beforecollapse","id":"event-beforecollapse"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"beforedeactivate","id":"event-beforedeactivate"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"beforedestroy","id":"event-beforedestroy"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":null,"protected":false,"name":"beforeexpand","id":"event-beforeexpand"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"beforehide","id":"event-beforehide"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":null,"protected":false,"name":"beforeremove","id":"event-beforeremove"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"beforerender","id":"event-beforerender"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"beforeshow","id":"event-beforeshow"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.state.Stateful","template":null,"required":null,"protected":false,"name":"beforestaterestore","id":"event-beforestaterestore"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.state.Stateful","template":null,"required":null,"protected":false,"name":"beforestatesave","id":"event-beforestatesave"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.panel.AbstractPanel","template":null,"required":null,"protected":false,"name":"bodyresize","id":"event-bodyresize"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":null,"protected":false,"name":"collapse","id":"event-collapse"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":null,"protected":false,"name":"deactivate","id":"event-deactivate"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"destroy","id":"event-destroy"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"disable","id":"event-disable"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"enable","id":"event-enable"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":null,"protected":false,"name":"expand","id":"event-expand"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"hide","id":"event-hide"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":null,"protected":false,"name":"iconchange","id":"event-iconchange"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":null,"protected":false,"name":"maximize","id":"event-maximize"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":null,"protected":false,"name":"minimize","id":"event-minimize"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"move","id":"event-move"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.container.AbstractContainer","template":null,"required":null,"protected":false,"name":"remove","id":"event-remove"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"removed","id":"event-removed"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"render","id":"event-render"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":null,"protected":false,"name":"resize","id":"event-resize"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.window.Window","template":null,"required":null,"protected":false,"name":"restore","id":"event-restore"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.AbstractComponent","template":null,"required":null,"protected":false,"name":"show","id":"event-show"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.state.Stateful","template":null,"required":null,"protected":false,"name":"staterestore","id":"event-staterestore"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.state.Stateful","template":null,"required":null,"protected":false,"name":"statesave","id":"event-statesave"},{"tagname":"event","deprecated":null,"static":false,"owner":"Ext.panel.Panel","template":null,"required":null,"protected":false,"name":"titlechange","id":"event-titlechange"}]},"private":false,"component":true,"name":"Ext.window.Window","alternateClassNames":["Ext.Window"],"id":"class-Ext.window.Window","mixedInto":[],"xtypes":{"widget":["window"]},"files":[{"href":"Window.html#Ext-window-Window","filename":"Window.js"}]});
packages/material-ui-icons/src/TableChartRounded.js
kybarg/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <path d="M10 10.02h5V21h-5V10.02zM17 21h3c1.1 0 2-.9 2-2v-9h-5v11zm3-18H5c-1.1 0-2 .9-2 2v3h19V5c0-1.1-.9-2-2-2zM3 19c0 1.1.9 2 2 2h3V10H3v9z" /> , 'TableChartRounded');
lib/components/modifications-map/transit-editor/index.js
conveyal/scenario-editor
// @flow import lonlat from '@conveyal/lonlat' import message from '@conveyal/woonerf/message' import Leaflet from 'leaflet' import React from 'react' import { LayerGroup, Marker, Polyline, Popup } from 'react-leaflet' import { ADD_TRIP_PATTERN, MINIMUM_SNAP_STOP_ZOOM_LEVEL } from '../../../constants' import colors from '../../../constants/colors' import {DEFAULT_SEGMENT_SPEED} from '../../../constants/timetables' import {Button} from '../../buttons' import { getControlPointIconForZoom, getNewStopIconForZoom, getSnappedStopIconForZoom } from '../../map/circle-icons' import getStopsFromSegments from '../../../utils/get-stops' import getNearestStopToPoint from '../../../utils/get-stop-near-point' import getLineString from '../../../utils/get-line-string' import createLogDomEvent from '../../../utils/log-dom-event' import type {Feed, LonLatC, GTFSStop} from '../../../types' import GTFSStopGridLayer from '../gtfs-stop-gridlayer' const logDomEvent = createLogDomEvent('transit-editor') // Wrapper to use `async`/`await` functions that can't be passed as event handlers const runAsync = (as) => as().catch(e => { console.error(e); throw e }) // Helper function to get the coordinates from a segment depending on type const coordinatesFromSegment = (segment, end = false) => segment.geometry.type === 'Point' ? segment.geometry.coordinates : end ? segment.geometry.coordinates.slice(-1)[0] : segment.geometry.coordinates[0] const getLineWeightForZoom = (z: number) => z < 11 ? 1 : z - 10 type Props = { allowExtend: boolean, allStops: GTFSStop[], extendFromEnd: boolean, feeds: Feed[], followRoad: boolean, modification: any, spacing: number, updateModification: (any) => void } export default class TransitEditor extends LayerGroup { props: Props state = { ...getStateFromProps(this.props), controlPointIcon: getControlPointIconForZoom(this.context.map.getZoom()), lineWeight: getLineWeightForZoom(this.context.map.getZoom()), newStopIcon: getNewStopIconForZoom(this.context.map.getZoom()), newSnappedStopIcon: getSnappedStopIconForZoom(this.context.map.getZoom()) } componentWillReceiveProps (newProps: Props) { if (this.props.modification.segments !== newProps.modification.segments || this.props.feeds !== newProps.feeds) { this.setState(getStateFromProps(newProps)) } } componentDidMount () { super.componentDidMount() const {map} = this.context // this is pretty cloogy but I can't figure out how to use react-leaflet events to listen to parent events. map.on('click', this._handleMapClick) map.on('mousemove', this._handleMouseMove) map.on('zoomend', this._handleZoomEnd) // Focus the map on the routes const bounds = new Leaflet.LatLngBounds() const segments = this._getSegments() if (segments.length > 0 && segments[0].geometry.type !== 'Point') { for (const segment of segments) { const coordinates = segment.geometry.coordinates for (const coord of coordinates) { bounds.extend([coord[1], coord[0]]) } } map.fitBounds(bounds) } } componentWillUnmount () { super.componentWillUnmount() const {map} = this.context map.off('click', this._handleMapClick) map.off('mousemove', this._handleMouseMove) map.off('zoomend', this._handleZoomEnd) } _handleZoomEnd = () => { const z = this.context.map.getZoom() this.setState({ controlPointIcon: getControlPointIconForZoom(z), lineWeight: getLineWeightForZoom(z), newStopIcon: getNewStopIconForZoom(z), newSnappedStopIcon: getSnappedStopIconForZoom(z) }) } render () { const { controlPointIcon, controlPoints, cursorPosition, lineWeight, mouseOverLineString, newStopIcon, newSnappedStopIcon, segmentFeatures, showStop, stops } = this.state const zoom = this.context.map.getZoom() return ( <g> {mouseOverLineString && <Polyline positions={mouseOverLineString} weight={lineWeight} />} <GTFSStopGridLayer stops={this.props.allStops} /> {segmentFeatures .map((feature, index) => ( <Polyline color={colors.ADDED} key={`segment-${index}`} onClick={this._clickSegment(index)} onBlur={this._handleMouseOutSegment} onFocus={this._handleMouseOverSegment} onMouseover={this._handleMouseOverSegment} onMouseout={this._handleMouseOutSegment} positions={feature} weight={lineWeight} /> ))} {stops.filter(s => s.autoCreated).map((stop, i) => <Marker position={stop} draggable icon={newStopIcon} key={`auto-created-stop-${i}-${lonlat.toString(stop)}`} onClick={this._dragAutoCreatedStop(stop.index)} onDragend={this._dragAutoCreatedStop(stop.index)} opacity={0.5} zIndexOffset={500} />)} {controlPoints.map(controlPoint => <Marker position={controlPoint.position} draggable icon={controlPointIcon} key={`control-point-${controlPoint.index}-${lonlat.toString(controlPoint.position)}-${zoom}`} onDragend={this._dragControlPoint(controlPoint.index)} zIndexOffset={750} > <Popup> <div> <Button style='primary' onClick={this._toggleControlPoint(controlPoint.index)}> {message('transitEditor.makeStop')} </Button>&nbsp; <Button style='danger' onClick={this._deleteStopOrPoint(controlPoint.index)}> {message('transitEditor.deletePoint')} </Button> </div> </Popup> </Marker>)} {stops.filter(s => !s.autoCreated).map(stop => <Marker position={stop} icon={stop.stopId ? newSnappedStopIcon : newStopIcon} draggable key={`stop-${stop.index}-${lonlat.toString(stop)}`} onDragend={this._dragStop(stop.index)} zIndexOffset={1000} > <Popup> <div> <Button style='primary' onClick={this._toggleStop(stop.index)}> {message('transitEditor.makeControlPoint')} </Button>&nbsp; <Button style='danger' onClick={this._deleteStopOrPoint(stop.index)}> {message('transitEditor.deletePoint')} </Button> </div> </Popup> </Marker>)} {showStop && <Marker position={cursorPosition} icon={newStopIcon} interactive={false} />} </g> ) } /** * Get a stop ID at the specified location, or null if this is not near a stop */ _getStopNear (pointClickedOnMap: LonLatC) { const zoom = this.context.map.getZoom() if (zoom >= MINIMUM_SNAP_STOP_ZOOM_LEVEL) { return getNearestStopToPoint(pointClickedOnMap, this.props.allStops, zoom) } } _getSegments () { return [...(this.props.modification.segments || [])] } /** * Handle a user clicking on the map */ _handleMapClick = (event: Leaflet.MouseEvent) => { logDomEvent('_handleMapClick', event) const p = this.props const {allowExtend, extendFromEnd, followRoad, spacing, updateModification} = this.props if (allowExtend) { runAsync(async () => { let coordinates = lonlat.toCoordinates(event.latlng) let segments = this._getSegments() const snapStop = this._getStopNear(event.latlng) let stopId if (snapStop) { stopId = snapStop.stop_id coordinates = [snapStop.stop_lon, snapStop.stop_lat] } if (segments.length > 0) { if (extendFromEnd) { // Insert a segment at the end const lastSegment = segments[segments.length - 1] const from = coordinatesFromSegment(lastSegment, true) segments = [...segments, { fromStopId: lastSegment.toStopId, geometry: await getLineString(from, coordinates, {followRoad}), spacing, stopAtEnd: true, stopAtStart: lastSegment.stopAtEnd, toStopId: stopId }] } else { const firstSegment = segments[0] const to = coordinatesFromSegment(firstSegment) segments = [{ fromStopId: stopId, geometry: await getLineString(coordinates, to, {followRoad}), spacing, stopAtEnd: firstSegment.stopAtStart, stopAtStart: true, toStopId: firstSegment.fromStopId }, ...segments] } // Remove all leftover point features segments = segments.filter(s => s.geometry.type !== 'Point') } else { segments[0] = { fromStopId: stopId, geometry: { type: 'Point', coordinates: lonlat.toCoordinates(coordinates) }, spacing, stopAtEnd: true, stopAtStart: true, toStopId: stopId } } // Update the segment speeds const updateSegmentSpeeds = ss => { if (!extendFromEnd) { ss.unshift(ss[0] || DEFAULT_SEGMENT_SPEED) } return this._extendSegmentSpeedsTo(ss, segments.length) } if (p.modification.type === ADD_TRIP_PATTERN) { updateModification({ segments, timetables: p.modification.timetables.map(tt => ({ ...tt, segmentSpeeds: updateSegmentSpeeds([...tt.segmentSpeeds]) })) }) } else { // type === REROUTE updateModification({ segments, segmentSpeeds: updateSegmentSpeeds([...p.modification.segmentSpeeds]) }) } }) } } // We previously allowed segment speeds to get out of sync with the segments. // This ensures consistent array lengths. _extendSegmentSpeedsTo (ss: number[], newLength: number) { const lastSpeed = ss[ss.length - 1] || DEFAULT_SEGMENT_SPEED for (let i = ss.length; i < newLength; i++) { ss.push(lastSpeed) } return ss } _handleMouseMove = (event: Leaflet.MouseEvent) => { logDomEvent('_handleMouseMove', event) this.setState({cursorPosition: event.latlng}) } _handleMouseOverSegment = (event: Leaflet.MouseEvent) => { logDomEvent('_handleMouseOverSegment', event) this.setState({showStop: true}) } _handleMouseOutSegment = (event: Leaflet.MouseEvent) => { logDomEvent('_handleMouseOutSegment', event) this.setState({showStop: false}) } _dragAutoCreatedStop = (index: number) => (event: Leaflet.MouseEvent) => { logDomEvent('_dragAutoCreatedStop', event) Leaflet.DomEvent.stop(event) this._insertStop(lonlat.toCoordinates(event.target.getLatLng()), index) } _dragStop = (index: number) => (event: Leaflet.MouseEvent) => { logDomEvent('_dragStop', event) Leaflet.DomEvent.stop(event) const {followRoad, updateModification} = this.props const segments = this._getSegments() const position = event.target.getLatLng() const snapStop = this._getStopNear(position) const isEnd = index === segments.length const isStart = index === 0 let coordinates = lonlat.toCoordinates(position) let newStopId if (snapStop) { newStopId = snapStop.stop_id coordinates = [snapStop.stop_lon, snapStop.stop_lat] } runAsync(async () => { if (!isStart) { const previousSegment = segments[index - 1] // will overwrite geometry and preserve other attributes segments[index - 1] = { ...previousSegment, toStopId: newStopId, geometry: await getLineString(coordinatesFromSegment(previousSegment), coordinates, {followRoad}) } } if (!isEnd) { const nextSegment = segments[index] segments[index] = { ...nextSegment, fromStopId: newStopId, geometry: await getLineString(coordinates, coordinatesFromSegment(nextSegment, true), {followRoad}) } } updateModification({segments}) }) } _toggleStop = (index: number) => () => { const segments = this._getSegments() if (index < segments.length) { segments[index] = { ...segments[index], stopAtStart: false, fromStopId: null } } if (index > 0) { segments[index - 1] = { ...segments[index - 1], stopAtEnd: false, toStopId: null } } this.props.updateModification({segments}) } _dragControlPoint = (index: number) => (event: Leaflet.MouseEvent) => { logDomEvent('_dragControlPoint', event) Leaflet.DomEvent.stop(event) const {followRoad, updateModification} = this.props const coordinates = lonlat.toCoordinates(event.target.getLatLng()) const segments = this._getSegments() const isEnd = index === segments.length const isStart = index === 0 runAsync(async () => { if (!isStart) { const previousSegment = segments[index - 1] // will overwrite geometry and preserve other attributes segments[index - 1] = { ...previousSegment, geometry: await getLineString(coordinatesFromSegment(previousSegment), coordinates, {followRoad}) } } if (!isEnd) { const nextSegment = segments[index] // can be a point if only one stop has been created const toCoordinates = coordinatesFromSegment(nextSegment, true) segments[index] = { ...nextSegment, geometry: await getLineString(coordinates, toCoordinates, {followRoad}) } } updateModification({segments}) }) } _toggleControlPoint = (index: number) => () => { const segments = this._getSegments() if (index < segments.length) { segments[index] = { ...segments[index], stopAtStart: true } } if (index > 0) { segments[index - 1] = { ...segments[index - 1], stopAtEnd: true } } this.props.updateModification({segments}) } /** * TODO Move to an action */ _deleteStopOrPoint = (index: number) => () => { const p = this.props let segments = this._getSegments() const newSegmentsLength = segments.length - 1 if (index === 0) { segments = segments.slice(1) // Update segment speeds const removeFirstSegmentSpeed = ss => this._extendSegmentSpeedsTo(ss.slice(1), newSegmentsLength) if (p.modification.type === ADD_TRIP_PATTERN) { p.updateModification({ segments, timetables: p.modification.timetables.map(tt => ({ ...tt, segmentSpeeds: removeFirstSegmentSpeed([...tt.segmentSpeeds]) })) }) } else { // type === REROUTE p.updateModification({ segments, segmentSpeeds: removeFirstSegmentSpeed([...p.modification.segmentSpeeds]) }) } } else if (index === segments.length) { // nb stop index not hop index segments.pop() // Update segment speeds const removeLastSegmentSpeed = ss => { if (ss.length === segments.length) { return ss.slice(0, -1) } else { return this._extendSegmentSpeedsTo(ss, newSegmentsLength) } } if (p.modification.type === ADD_TRIP_PATTERN) { p.updateModification({ segments, timetables: p.modification.timetables.map(tt => ({ ...tt, segmentSpeeds: removeLastSegmentSpeed(tt.segmentSpeeds) })) }) } else { // type === REROUTE p.updateModification({ segments, segmentSpeeds: removeLastSegmentSpeed(p.modification.segmentSpeeds) }) } } else { // ok a little trickier const seg0 = segments[index - 1] const seg1 = segments[index] getLineString( coordinatesFromSegment(seg0), coordinatesFromSegment(seg1, true), {followRoad: p.followRoad} ).then(line => { segments.splice(index - 1, 2, { fromStopId: seg0.fromStopId, geometry: line, spacing: seg0.spacing, stopAtEnd: seg1.stopAtEnd, stopAtStart: seg0.stopAtStart, toStopId: seg1.toStopId }) // Splice out a segment speed const spliceSegmentSpeed = ss => { if (ss.length > index) { ss.splice(index, 1) } return this._extendSegmentSpeedsTo(ss, newSegmentsLength) } if (p.modification.type === ADD_TRIP_PATTERN) { p.updateModification({ segments, timetables: p.modification.timetables.map(tt => ({ ...tt, segmentSpeeds: spliceSegmentSpeed(tt.segmentSpeeds) })) }) } else { // type === REROUTE p.updateModification({ segments, segmentSpeeds: spliceSegmentSpeed(p.modification.segmentSpeeds) }) } p.updateModification({segments}) }) } } _clickSegment = (index: number) => (event: Leaflet.MouseEvent) => { logDomEvent('_clickSegment', event) Leaflet.DomEvent.stop(event) this._insertStop(event.latlng, index) } /** * Insert a stop at the specified position. TODO should be done in actions. */ async _insertStop (coordinates: LonLatC, index: number) { const p = this.props const {followRoad} = p let segments = this._getSegments() const snapStop = this._getStopNear(coordinates) let stopId if (snapStop) { coordinates = [snapStop.stop_lon, snapStop.stop_lat] stopId = snapStop.stop_id } const sourceSegment = segments[index] const line0 = await getLineString(coordinatesFromSegment(sourceSegment), coordinates, {followRoad}) const line1 = await getLineString(coordinates, coordinatesFromSegment(sourceSegment, true), {followRoad}) segments = [ ...segments.slice(0, index), { fromStopId: sourceSegment.fromStopId, geometry: line0, spacing: sourceSegment.spacing, stopAtEnd: true, stopAtStart: sourceSegment.stopAtStart, toStopId: stopId }, { fromStopId: stopId, geometry: line1, spacing: sourceSegment.spacing, stopAtEnd: sourceSegment.stopAtEnd, stopAtStart: true, toStopId: sourceSegment.toStopId }, ...segments.slice(index + 1) ] // Determine new segment speeds const insertSpeed = ss => { if (ss.length > index) { const duplicateSpeed = ss[index] ss.splice(index + 1, 0, duplicateSpeed) } return this._extendSegmentSpeedsTo(ss, segments.length) } if (p.modification.type === ADD_TRIP_PATTERN) { p.updateModification({ segments, timetables: p.modification.timetables.map(tt => ({ ...tt, segmentSpeeds: insertSpeed(tt.segmentSpeeds) })) }) } else { // type === REROUTE p.updateModification({ segments, segmentSpeeds: insertSpeed(p.modification.segmentSpeeds) }) } } } /** * Scope stops with their feed ID so that we can snap new patterns to stops from * multiple feeds. */ function getStateFromProps ({extendFromEnd, feeds, modification}) { const segments = modification.segments || [] return { controlPoints: getControlPointsForSegments(segments), previousCoordinates: segments.length > 0 && lonlat.toLeaflet(extendFromEnd ? coordinatesFromSegment(segments.slice(-1)[0], true) : lonlat.toLeaflet(coordinatesFromSegment(segments[0], false))), mouseOverLineString: null, segmentFeatures: segments .filter(segment => segment.geometry.type !== 'Point') // if there's just a single stop, don't render an additional marker .map(segment => segment.geometry.coordinates.map(c => lonlat.toLeaflet(c))), stops: getStopsFromSegments(segments) } } function getControlPointsForSegments (segments) { const controlPoints = [] for (let i = 0; i < segments.length; i++) { if (!segments[i].stopAtStart) { controlPoints.push({ position: lonlat(coordinatesFromSegment(segments[i])), index: i }) } if (i === segments.length - 1 && !segments[i].stopAtEnd) { controlPoints.push({ position: lonlat(coordinatesFromSegment(segments[i], true)), index: i + 1 }) } } return controlPoints }
packages/material-ui-icons/src/Comment.js
allanalexandre/material-ui
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <React.Fragment><path d="M21.99 4c0-1.1-.89-2-1.99-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h14l4 4-.01-18zM18 14H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z" /><path fill="none" d="M0 0h24v24H0z" /></React.Fragment> , 'Comment');
ajax/libs/react/15.2.0/react-dom-server.js
cdnjs/cdnjs
/** * ReactDOMServer v15.2.0 * * Copyright 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ // Based off https://github.com/ForbesLindesay/umd/blob/master/template.js ;(function(f) { // CommonJS if (typeof exports === "object" && typeof module !== "undefined") { module.exports = f(require('react')); // RequireJS } else if (typeof define === "function" && define.amd) { define(['react'], f); // <script> } else { var g; if (typeof window !== "undefined") { g = window; } else if (typeof global !== "undefined") { g = global; } else if (typeof self !== "undefined") { g = self; } else { // works providing we're not in "use strict"; // needed for Java 8 Nashorn // see https://github.com/facebook/react/issues/3037 g = this; } g.ReactDOMServer = f(g.React); } })(function(React) { return React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; });
lib/js/SharedElement.js
taxfix/native-navigation
import React from 'react'; import PropTypes from 'prop-types'; import SafeModule from 'react-native-safe-module'; const NativeSharedElement = SafeModule.component({ viewName: 'NativeNavigationSharedElement', mockComponent: ({ children }) => children, propTypes: { id: PropTypes.string, nativeNavigationInstanceId: PropTypes.string, }, }); const numberOrString = PropTypes.oneOfType([ PropTypes.number, PropTypes.string, ]); const IdPropTypes = { type: PropTypes.string.isRequired, typeId: numberOrString, subType: PropTypes.string, subTypeId: numberOrString, }; const propTypes = { ...IdPropTypes, children: PropTypes.node.isRequired, }; const defaultProps = { /* eslint-disable react/default-props-match-prop-types */ typeId: '', subType: '', subTypeId: '', /* eslint-enable react/default-props-match-prop-types */ }; const contextTypes = { nativeNavigationInstanceId: PropTypes.string, }; class SharedElement extends React.Component { getId() { const { type, typeId, subType, subTypeId, } = this.props; return `${type}|${typeId}|${subType}|${subTypeId}`; } render() { return ( <NativeSharedElement id={this.getId()} nativeNavigationInstanceId={this.context.nativeNavigationInstanceId} > {React.Children.only(this.props.children)} </NativeSharedElement> ); } } SharedElement.propTypes = propTypes; SharedElement.defaultProps = defaultProps; SharedElement.contextTypes = contextTypes; SharedElement.IdPropTypes = IdPropTypes; module.exports = SharedElement;
src/Table.js
modulexcite/react-bootstrap
import React from 'react'; import classNames from 'classnames'; const Table = React.createClass({ propTypes: { striped: React.PropTypes.bool, bordered: React.PropTypes.bool, condensed: React.PropTypes.bool, hover: React.PropTypes.bool, responsive: React.PropTypes.bool }, render() { let classes = { 'table': true, 'table-striped': this.props.striped, 'table-bordered': this.props.bordered, 'table-condensed': this.props.condensed, 'table-hover': this.props.hover }; let table = ( <table {...this.props} className={classNames(this.props.className, classes)}> {this.props.children} </table> ); return this.props.responsive ? ( <div className="table-responsive"> {table} </div> ) : table; } }); export default Table;
src/components/Upload.js
rawad-alawar/stow
import React, {Component} from 'react' import ReactDOM from 'react-dom' import {connect} from 'react-redux' import {hashHistory, Link} from 'react-router' import request from 'superagent' import {validateForm, addNewListing} from './utils' class Upload extends Component { constructor() { super() this.state = { error: <div></div>, style: '' } } componentDidMount() { $('#upload').cloudinary_upload_widget( { cloud_name: 'dvzbt8kfq', upload_preset: 'rwy3xr9i', cropping: 'server', folder: 'user_photos', theme: 'minimal', button_caption: '<i class="fa fa-camera-retro fa-1x">Upload Image</i>', cropping_aspect_ratio: 1, callback: '/profile' }, (error, result) => { if (error) { console.log('Error: ', error) } else { let userUpload = { external_photo_id: result[0].signature, photo_url: result[0].url } document.querySelector('#url').value = userUpload.photo_url } } ) } handleUpload(e) { e.preventDefault() const formData = { heading: {value: this.refs.title.value, mustHave: true}, listerName: {value: this.props.user.get('username'), mustHave: false}, description: {value: this.refs.description.value, mustHave: false}, city: {value: this.refs.city.value, mustHave: true}, suburb: {value: this.refs.suburb.value, mustHave: true}, size: {value: this.refs.size.value, mustHave: false}, price: {value: this.refs.price.value, mustHave: true}, url: {value: document.querySelector('#url').value, mustHave: false} } var form = validateForm(formData) if(form.isValid) addNewListing('upload', null, formData) else { this.setState({error: <p className='onError'>Please fill in the required fields</p>}) this.setState({style: 'error'}) } } render() { return ( <div className="row-sm-12 row-centered uploadForm"> <div className="jumbotron col-sm-5 text-center col-centered"> <form className="form-signin"> <h2 className="form-signin-heading">Upload your stow space! </h2> <label className="sr-only">Title</label> <input type="text" id="title" className={`form-control ${this.state.style}`} placeholder="title" ref='title' required autofocus/> <label for="details" className="sr-only">Tell us about your stow space!</label> <textarea className="form-control img-responsive" placeholder="e.g very large space, indoor cupboard..." rows="8" cols="75" id="description" ref='description' required autofocus></textarea> <div id="upload"></div> <div id="url" type="hidden" ref="url"></div> <label className="sr-only">Suburb</label> <input type="text" id="suburb" className={`form-control ${this.state.style}`} placeholder="Suburb..." ref='suburb' required autofocus/> <label className="sr-only">City</label> <input type="text" id="city" className={`form-control ${this.state.style}`} placeholder="City..." ref='city' required autofocus/> <label className="sr-only">Price</label> <input type="text" id="price" className={`form-control ${this.state.style}`} placeholder="$/week" ref='price' required autofocus/> <label className="sr-only">Approximate Size</label> <input type="text" id="size" className="form-control" placeholder="Approximate size..." ref='size' required autofocus/> {this.state.error} <Link to='/'> <button type="button" className="btn btn-lg btn-danger">Cancel</button> </Link> <input type="submit" className="btn btn-lg btn-primary pull-right" onClick={this.handleUpload.bind(this)}/> </form> </div> </div> ) } } function mapStateToProps(state) { return { user: state.get('currentUser') } } export default connect(mapStateToProps)(Upload)
ajax/libs/webshim/1.14.3/dev/shims/moxie/js/moxie.js
rteasdale/cdnjs
/** * mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill * v1.2.1 * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing * * Date: 2014-05-14 */ /** * Compiled inline version. (Library mode) */ /*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */ /*globals $code */ (function(exports, undefined) { "use strict"; var modules = {}; function require(ids, callback) { var module, defs = []; for (var i = 0; i < ids.length; ++i) { module = modules[ids[i]] || resolve(ids[i]); if (!module) { throw 'module definition dependecy not found: ' + ids[i]; } defs.push(module); } callback.apply(null, defs); } function define(id, dependencies, definition) { if (typeof id !== 'string') { throw 'invalid module definition, module id must be defined and be a string'; } if (dependencies === undefined) { throw 'invalid module definition, dependencies must be specified'; } if (definition === undefined) { throw 'invalid module definition, definition function must be specified'; } require(dependencies, function() { modules[id] = definition.apply(null, arguments); }); } function defined(id) { return !!modules[id]; } function resolve(id) { var target = exports; var fragments = id.split(/[.\/]/); for (var fi = 0; fi < fragments.length; ++fi) { if (!target[fragments[fi]]) { return; } target = target[fragments[fi]]; } return target; } function expose(ids) { for (var i = 0; i < ids.length; i++) { var target = exports; var id = ids[i]; var fragments = id.split(/[.\/]/); for (var fi = 0; fi < fragments.length - 1; ++fi) { if (target[fragments[fi]] === undefined) { target[fragments[fi]] = {}; } target = target[fragments[fi]]; } target[fragments[fragments.length - 1]] = modules[id]; } } // Included from: src/javascript/core/utils/Basic.js /** * Basic.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/utils/Basic', [], function() { /** Gets the true type of the built-in object (better version of typeof). @author Angus Croll (http://javascriptweblog.wordpress.com/) @method typeOf @for Utils @static @param {Object} o Object to check. @return {String} Object [[Class]] */ var typeOf = function(o) { var undef; if (o === undef) { return 'undefined'; } else if (o === null) { return 'null'; } else if (o.nodeType) { return 'node'; } // the snippet below is awesome, however it fails to detect null, undefined and arguments types in IE lte 8 return ({}).toString.call(o).match(/\s([a-z|A-Z]+)/)[1].toLowerCase(); }; /** Extends the specified object with another object. @method extend @static @param {Object} target Object to extend. @param {Object} [obj]* Multiple objects to extend with. @return {Object} Same as target, the extended object. */ var extend = function(target) { var undef; each(arguments, function(arg, i) { if (i > 0) { each(arg, function(value, key) { if (value !== undef) { if (typeOf(target[key]) === typeOf(value) && !!~inArray(typeOf(value), ['array', 'object'])) { extend(target[key], value); } else { target[key] = value; } } }); } }); return target; }; /** Executes the callback function for each item in array/object. If you return false in the callback it will break the loop. @method each @static @param {Object} obj Object to iterate. @param {function} callback Callback function to execute for each item. */ var each = function(obj, callback) { var length, key, i, undef; if (obj) { try { length = obj.length; } catch(ex) { length = undef; } if (length === undef) { // Loop object items for (key in obj) { if (obj.hasOwnProperty(key)) { if (callback(obj[key], key) === false) { return; } } } } else { // Loop array items for (i = 0; i < length; i++) { if (callback(obj[i], i) === false) { return; } } } } }; /** Checks if object is empty. @method isEmptyObj @static @param {Object} o Object to check. @return {Boolean} */ var isEmptyObj = function(obj) { var prop; if (!obj || typeOf(obj) !== 'object') { return true; } for (prop in obj) { return false; } return true; }; /** Recieve an array of functions (usually async) to call in sequence, each function receives a callback as first argument that it should call, when it completes. Finally, after everything is complete, main callback is called. Passing truthy value to the callback as a first argument will interrupt the sequence and invoke main callback immediately. @method inSeries @static @param {Array} queue Array of functions to call in sequence @param {Function} cb Main callback that is called in the end, or in case of error */ var inSeries = function(queue, cb) { var i = 0, length = queue.length; if (typeOf(cb) !== 'function') { cb = function() {}; } if (!queue || !queue.length) { cb(); } function callNext(i) { if (typeOf(queue[i]) === 'function') { queue[i](function(error) { /*jshint expr:true */ ++i < length && !error ? callNext(i) : cb(error); }); } } callNext(i); }; /** Recieve an array of functions (usually async) to call in parallel, each function receives a callback as first argument that it should call, when it completes. After everything is complete, main callback is called. Passing truthy value to the callback as a first argument will interrupt the process and invoke main callback immediately. @method inParallel @static @param {Array} queue Array of functions to call in sequence @param {Function} cb Main callback that is called in the end, or in case of erro */ var inParallel = function(queue, cb) { var count = 0, num = queue.length, cbArgs = new Array(num); each(queue, function(fn, i) { fn(function(error) { if (error) { return cb(error); } var args = [].slice.call(arguments); args.shift(); // strip error - undefined or not cbArgs[i] = args; count++; if (count === num) { cbArgs.unshift(null); cb.apply(this, cbArgs); } }); }); }; /** Find an element in array and return it's index if present, otherwise return -1. @method inArray @static @param {Mixed} needle Element to find @param {Array} array @return {Int} Index of the element, or -1 if not found */ var inArray = function(needle, array) { if (array) { if (Array.prototype.indexOf) { return Array.prototype.indexOf.call(array, needle); } for (var i = 0, length = array.length; i < length; i++) { if (array[i] === needle) { return i; } } } return -1; }; /** Returns elements of first array if they are not present in second. And false - otherwise. @private @method arrayDiff @param {Array} needles @param {Array} array @return {Array|Boolean} */ var arrayDiff = function(needles, array) { var diff = []; if (typeOf(needles) !== 'array') { needles = [needles]; } if (typeOf(array) !== 'array') { array = [array]; } for (var i in needles) { if (inArray(needles[i], array) === -1) { diff.push(needles[i]); } } return diff.length ? diff : false; }; /** Find intersection of two arrays. @private @method arrayIntersect @param {Array} array1 @param {Array} array2 @return {Array} Intersection of two arrays or null if there is none */ var arrayIntersect = function(array1, array2) { var result = []; each(array1, function(item) { if (inArray(item, array2) !== -1) { result.push(item); } }); return result.length ? result : null; }; /** Forces anything into an array. @method toArray @static @param {Object} obj Object with length field. @return {Array} Array object containing all items. */ var toArray = function(obj) { var i, arr = []; for (i = 0; i < obj.length; i++) { arr[i] = obj[i]; } return arr; }; /** Generates an unique ID. This is 99.99% unique since it takes the current time and 5 random numbers. The only way a user would be able to get the same ID is if the two persons at the same exact milisecond manages to get 5 the same random numbers between 0-65535 it also uses a counter so each call will be guaranteed to be page unique. It's more probable for the earth to be hit with an ansteriod. Y @method guid @static @param {String} prefix to prepend (by default 'o' will be prepended). @method guid @return {String} Virtually unique id. */ var guid = (function() { var counter = 0; return function(prefix) { var guid = new Date().getTime().toString(32), i; for (i = 0; i < 5; i++) { guid += Math.floor(Math.random() * 65535).toString(32); } return (prefix || 'o_') + guid + (counter++).toString(32); }; }()); /** Trims white spaces around the string @method trim @static @param {String} str @return {String} */ var trim = function(str) { if (!str) { return str; } return String.prototype.trim ? String.prototype.trim.call(str) : str.toString().replace(/^\s*/, '').replace(/\s*$/, ''); }; /** Parses the specified size string into a byte value. For example 10kb becomes 10240. @method parseSizeStr @static @param {String/Number} size String to parse or number to just pass through. @return {Number} Size in bytes. */ var parseSizeStr = function(size) { if (typeof(size) !== 'string') { return size; } var muls = { t: 1099511627776, g: 1073741824, m: 1048576, k: 1024 }, mul; size = /^([0-9]+)([mgk]?)$/.exec(size.toLowerCase().replace(/[^0-9mkg]/g, '')); mul = size[2]; size = +size[1]; if (muls.hasOwnProperty(mul)) { size *= muls[mul]; } return size; }; return { guid: guid, typeOf: typeOf, extend: extend, each: each, isEmptyObj: isEmptyObj, inSeries: inSeries, inParallel: inParallel, inArray: inArray, arrayDiff: arrayDiff, arrayIntersect: arrayIntersect, toArray: toArray, trim: trim, parseSizeStr: parseSizeStr }; }); // Included from: src/javascript/core/I18n.js /** * I18n.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define("moxie/core/I18n", [ "moxie/core/utils/Basic" ], function(Basic) { var i18n = {}; return { /** * Extends the language pack object with new items. * * @param {Object} pack Language pack items to add. * @return {Object} Extended language pack object. */ addI18n: function(pack) { return Basic.extend(i18n, pack); }, /** * Translates the specified string by checking for the english string in the language pack lookup. * * @param {String} str String to look for. * @return {String} Translated string or the input string if it wasn't found. */ translate: function(str) { return i18n[str] || str; }, /** * Shortcut for translate function * * @param {String} str String to look for. * @return {String} Translated string or the input string if it wasn't found. */ _: function(str) { return this.translate(str); }, /** * Pseudo sprintf implementation - simple way to replace tokens with specified values. * * @param {String} str String with tokens * @return {String} String with replaced tokens */ sprintf: function(str) { var args = [].slice.call(arguments, 1); return str.replace(/%[a-z]/g, function() { var value = args.shift(); return Basic.typeOf(value) !== 'undefined' ? value : ''; }); } }; }); // Included from: src/javascript/core/utils/Mime.js /** * Mime.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define("moxie/core/utils/Mime", [ "moxie/core/utils/Basic", "moxie/core/I18n" ], function(Basic, I18n) { var mimeData = "" + "application/msword,doc dot," + "application/pdf,pdf," + "application/pgp-signature,pgp," + "application/postscript,ps ai eps," + "application/rtf,rtf," + "application/vnd.ms-excel,xls xlb," + "application/vnd.ms-powerpoint,ppt pps pot," + "application/zip,zip," + "application/x-shockwave-flash,swf swfl," + "application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx," + "application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx," + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx," + "application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx," + "application/vnd.openxmlformats-officedocument.presentationml.template,potx," + "application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx," + "application/x-javascript,js," + "application/json,json," + "audio/mpeg,mp3 mpga mpega mp2," + "audio/x-wav,wav," + "audio/x-m4a,m4a," + "audio/ogg,oga ogg," + "audio/aiff,aiff aif," + "audio/flac,flac," + "audio/aac,aac," + "audio/ac3,ac3," + "audio/x-ms-wma,wma," + "image/bmp,bmp," + "image/gif,gif," + "image/jpeg,jpg jpeg jpe," + "image/photoshop,psd," + "image/png,png," + "image/svg+xml,svg svgz," + "image/tiff,tiff tif," + "text/plain,asc txt text diff log," + "text/html,htm html xhtml," + "text/css,css," + "text/csv,csv," + "text/rtf,rtf," + "video/mpeg,mpeg mpg mpe m2v," + "video/quicktime,qt mov," + "video/mp4,mp4," + "video/x-m4v,m4v," + "video/x-flv,flv," + "video/x-ms-wmv,wmv," + "video/avi,avi," + "video/webm,webm," + "video/3gpp,3gpp 3gp," + "video/3gpp2,3g2," + "video/vnd.rn-realvideo,rv," + "video/ogg,ogv," + "video/x-matroska,mkv," + "application/vnd.oasis.opendocument.formula-template,otf," + "application/octet-stream,exe"; var Mime = { mimes: {}, extensions: {}, // Parses the default mime types string into a mimes and extensions lookup maps addMimeType: function (mimeData) { var items = mimeData.split(/,/), i, ii, ext; for (i = 0; i < items.length; i += 2) { ext = items[i + 1].split(/ /); // extension to mime lookup for (ii = 0; ii < ext.length; ii++) { this.mimes[ext[ii]] = items[i]; } // mime to extension lookup this.extensions[items[i]] = ext; } }, extList2mimes: function (filters, addMissingExtensions) { var self = this, ext, i, ii, type, mimes = []; // convert extensions to mime types list for (i = 0; i < filters.length; i++) { ext = filters[i].extensions.split(/\s*,\s*/); for (ii = 0; ii < ext.length; ii++) { // if there's an asterisk in the list, then accept attribute is not required if (ext[ii] === '*') { return []; } type = self.mimes[ext[ii]]; if (!type) { if (addMissingExtensions && /^\w+$/.test(ext[ii])) { mimes.push('.' + ext[ii]); } else { return []; // accept all } } else if (Basic.inArray(type, mimes) === -1) { mimes.push(type); } } } return mimes; }, mimes2exts: function(mimes) { var self = this, exts = []; Basic.each(mimes, function(mime) { if (mime === '*') { exts = []; return false; } // check if this thing looks like mime type var m = mime.match(/^(\w+)\/(\*|\w+)$/); if (m) { if (m[2] === '*') { // wildcard mime type detected Basic.each(self.extensions, function(arr, mime) { if ((new RegExp('^' + m[1] + '/')).test(mime)) { [].push.apply(exts, self.extensions[mime]); } }); } else if (self.extensions[mime]) { [].push.apply(exts, self.extensions[mime]); } } }); return exts; }, mimes2extList: function(mimes) { var accept = [], exts = []; if (Basic.typeOf(mimes) === 'string') { mimes = Basic.trim(mimes).split(/\s*,\s*/); } exts = this.mimes2exts(mimes); accept.push({ title: I18n.translate('Files'), extensions: exts.length ? exts.join(',') : '*' }); // save original mimes string accept.mimes = mimes; return accept; }, getFileExtension: function(fileName) { var matches = fileName && fileName.match(/\.([^.]+)$/); if (matches) { return matches[1].toLowerCase(); } return ''; }, getFileMime: function(fileName) { return this.mimes[this.getFileExtension(fileName)] || ''; } }; Mime.addMimeType(mimeData); return Mime; }); // Included from: src/javascript/core/utils/Env.js /** * Env.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define("moxie/core/utils/Env", [ "moxie/core/utils/Basic" ], function(Basic) { // UAParser.js v0.6.2 // Lightweight JavaScript-based User-Agent string parser // https://github.com/faisalman/ua-parser-js // // Copyright © 2012-2013 Faisalman <[email protected]> // Dual licensed under GPLv2 & MIT var UAParser = (function (undefined) { ////////////// // Constants ///////////// var EMPTY = '', UNKNOWN = '?', FUNC_TYPE = 'function', UNDEF_TYPE = 'undefined', OBJ_TYPE = 'object', MAJOR = 'major', MODEL = 'model', NAME = 'name', TYPE = 'type', VENDOR = 'vendor', VERSION = 'version', ARCHITECTURE= 'architecture', CONSOLE = 'console', MOBILE = 'mobile', TABLET = 'tablet'; /////////// // Helper ////////// var util = { has : function (str1, str2) { return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1; }, lowerize : function (str) { return str.toLowerCase(); } }; /////////////// // Map helper ////////////// var mapper = { rgx : function () { // loop through all regexes maps for (var result, i = 0, j, k, p, q, matches, match, args = arguments; i < args.length; i += 2) { var regex = args[i], // even sequence (0,2,4,..) props = args[i + 1]; // odd sequence (1,3,5,..) // construct object barebones if (typeof(result) === UNDEF_TYPE) { result = {}; for (p in props) { q = props[p]; if (typeof(q) === OBJ_TYPE) { result[q[0]] = undefined; } else { result[q] = undefined; } } } // try matching uastring with regexes for (j = k = 0; j < regex.length; j++) { matches = regex[j].exec(this.getUA()); if (!!matches) { for (p = 0; p < props.length; p++) { match = matches[++k]; q = props[p]; // check if given property is actually array if (typeof(q) === OBJ_TYPE && q.length > 0) { if (q.length == 2) { if (typeof(q[1]) == FUNC_TYPE) { // assign modified match result[q[0]] = q[1].call(this, match); } else { // assign given value, ignore regex match result[q[0]] = q[1]; } } else if (q.length == 3) { // check whether function or regex if (typeof(q[1]) === FUNC_TYPE && !(q[1].exec && q[1].test)) { // call function (usually string mapper) result[q[0]] = match ? q[1].call(this, match, q[2]) : undefined; } else { // sanitize match using given regex result[q[0]] = match ? match.replace(q[1], q[2]) : undefined; } } else if (q.length == 4) { result[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined; } } else { result[q] = match ? match : undefined; } } break; } } if(!!matches) break; // break the loop immediately if match found } return result; }, str : function (str, map) { for (var i in map) { // check if array if (typeof(map[i]) === OBJ_TYPE && map[i].length > 0) { for (var j = 0; j < map[i].length; j++) { if (util.has(map[i][j], str)) { return (i === UNKNOWN) ? undefined : i; } } } else if (util.has(map[i], str)) { return (i === UNKNOWN) ? undefined : i; } } return str; } }; /////////////// // String map ////////////// var maps = { browser : { oldsafari : { major : { '1' : ['/8', '/1', '/3'], '2' : '/4', '?' : '/' }, version : { '1.0' : '/8', '1.2' : '/1', '1.3' : '/3', '2.0' : '/412', '2.0.2' : '/416', '2.0.3' : '/417', '2.0.4' : '/419', '?' : '/' } } }, device : { sprint : { model : { 'Evo Shift 4G' : '7373KT' }, vendor : { 'HTC' : 'APA', 'Sprint' : 'Sprint' } } }, os : { windows : { version : { 'ME' : '4.90', 'NT 3.11' : 'NT3.51', 'NT 4.0' : 'NT4.0', '2000' : 'NT 5.0', 'XP' : ['NT 5.1', 'NT 5.2'], 'Vista' : 'NT 6.0', '7' : 'NT 6.1', '8' : 'NT 6.2', '8.1' : 'NT 6.3', 'RT' : 'ARM' } } } }; ////////////// // Regex map ///////////// var regexes = { browser : [[ // Presto based /(opera\smini)\/((\d+)?[\w\.-]+)/i, // Opera Mini /(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i, // Opera Mobi/Tablet /(opera).+version\/((\d+)?[\w\.]+)/i, // Opera > 9.80 /(opera)[\/\s]+((\d+)?[\w\.]+)/i // Opera < 9.80 ], [NAME, VERSION, MAJOR], [ /\s(opr)\/((\d+)?[\w\.]+)/i // Opera Webkit ], [[NAME, 'Opera'], VERSION, MAJOR], [ // Mixed /(kindle)\/((\d+)?[\w\.]+)/i, // Kindle /(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer // Trident based /(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i, // Avant/IEMobile/SlimBrowser/Baidu /(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i, // Internet Explorer // Webkit/KHTML based /(rekonq)((?:\/)[\w\.]+)*/i, // Rekonq /(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i // Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron ], [NAME, VERSION, MAJOR], [ /(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i // IE11 ], [[NAME, 'IE'], VERSION, MAJOR], [ /(yabrowser)\/((\d+)?[\w\.]+)/i // Yandex ], [[NAME, 'Yandex'], VERSION, MAJOR], [ /(comodo_dragon)\/((\d+)?[\w\.]+)/i // Comodo Dragon ], [[NAME, /_/g, ' '], VERSION, MAJOR], [ /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia ], [NAME, VERSION, MAJOR], [ /(dolfin)\/((\d+)?[\w\.]+)/i // Dolphin ], [[NAME, 'Dolphin'], VERSION, MAJOR], [ /((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i // Chrome for Android/iOS ], [[NAME, 'Chrome'], VERSION, MAJOR], [ /((?:android.+))version\/((\d+)?[\w\.]+)\smobile\ssafari/i // Android Browser ], [[NAME, 'Android Browser'], VERSION, MAJOR], [ /version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari ], [VERSION, MAJOR, [NAME, 'Mobile Safari']], [ /version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile ], [VERSION, MAJOR, NAME], [ /webkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i // Safari < 3.0 ], [NAME, [MAJOR, mapper.str, maps.browser.oldsafari.major], [VERSION, mapper.str, maps.browser.oldsafari.version]], [ /(konqueror)\/((\d+)?[\w\.]+)/i, // Konqueror /(webkit|khtml)\/((\d+)?[\w\.]+)/i ], [NAME, VERSION, MAJOR], [ // Gecko based /(navigator|netscape)\/((\d+)?[\w\.-]+)/i // Netscape ], [[NAME, 'Netscape'], VERSION, MAJOR], [ /(swiftfox)/i, // Swiftfox /(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i, // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror /(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i, // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix /(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla // Other /(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i, // UCBrowser/Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/QQBrowser /(links)\s\(((\d+)?[\w\.]+)/i, // Links /(gobrowser)\/?((\d+)?[\w\.]+)*/i, // GoBrowser /(ice\s?browser)\/v?((\d+)?[\w\._]+)/i, // ICE Browser /(mosaic)[\/\s]((\d+)?[\w\.]+)/i // Mosaic ], [NAME, VERSION, MAJOR] ], engine : [[ /(presto)\/([\w\.]+)/i, // Presto /(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m /(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links /(icab)[\/\s]([23]\.[\d\.]+)/i // iCab ], [NAME, VERSION], [ /rv\:([\w\.]+).*(gecko)/i // Gecko ], [VERSION, NAME] ], os : [[ // Windows based /(windows)\snt\s6\.2;\s(arm)/i, // Windows RT /(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i ], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [ /(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i ], [[NAME, 'Windows'], [VERSION, mapper.str, maps.os.windows.version]], [ // Mobile/Embedded OS /\((bb)(10);/i // BlackBerry 10 ], [[NAME, 'BlackBerry'], VERSION], [ /(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry /(tizen)\/([\w\.]+)/i, // Tizen /(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i // Android/WebOS/Palm/QNX/Bada/RIM/MeeGo ], [NAME, VERSION], [ /(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian ], [[NAME, 'Symbian'], VERSION],[ /mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS ], [[NAME, 'Firefox OS'], VERSION], [ // Console /(nintendo|playstation)\s([wids3portablevu]+)/i, // Nintendo/Playstation // GNU/Linux based /(mint)[\/\s\(]?(\w+)*/i, // Mint /(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i, // Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware // Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk /(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux /(gnu)\s?([\w\.]+)*/i // GNU ], [NAME, VERSION], [ /(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS ], [[NAME, 'Chromium OS'], VERSION],[ // Solaris /(sunos)\s?([\w\.]+\d)*/i // Solaris ], [[NAME, 'Solaris'], VERSION], [ // BSD based /\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly ], [NAME, VERSION],[ /(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i // iOS ], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [ /(mac\sos\sx)\s?([\w\s\.]+\w)*/i // Mac OS ], [NAME, [VERSION, /_/g, '.']], [ // Other /(haiku)\s(\w+)/i, // Haiku /(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX /(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos)/i, // Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS /(unix)\s?([\w\.]+)*/i // UNIX ], [NAME, VERSION] ] }; ///////////////// // Constructor //////////////// var UAParser = function (uastring) { var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY); this.getBrowser = function () { return mapper.rgx.apply(this, regexes.browser); }; this.getEngine = function () { return mapper.rgx.apply(this, regexes.engine); }; this.getOS = function () { return mapper.rgx.apply(this, regexes.os); }; this.getResult = function() { return { ua : this.getUA(), browser : this.getBrowser(), engine : this.getEngine(), os : this.getOS() }; }; this.getUA = function () { return ua; }; this.setUA = function (uastring) { ua = uastring; return this; }; this.setUA(ua); }; return new UAParser().getResult(); })(); function version_compare(v1, v2, operator) { // From: http://phpjs.org/functions // + original by: Philippe Jausions (http://pear.php.net/user/jausions) // + original by: Aidan Lister (http://aidanlister.com/) // + reimplemented by: Kankrelune (http://www.webfaktory.info/) // + improved by: Brett Zamir (http://brett-zamir.me) // + improved by: Scott Baker // + improved by: Theriault // * example 1: version_compare('8.2.5rc', '8.2.5a'); // * returns 1: 1 // * example 2: version_compare('8.2.50', '8.2.52', '<'); // * returns 2: true // * example 3: version_compare('5.3.0-dev', '5.3.0'); // * returns 3: -1 // * example 4: version_compare('4.1.0.52','4.01.0.51'); // * returns 4: 1 // Important: compare must be initialized at 0. var i = 0, x = 0, compare = 0, // vm maps textual PHP versions to negatives so they're less than 0. // PHP currently defines these as CASE-SENSITIVE. It is important to // leave these as negatives so that they can come before numerical versions // and as if no letters were there to begin with. // (1alpha is < 1 and < 1.1 but > 1dev1) // If a non-numerical value can't be mapped to this table, it receives // -7 as its value. vm = { 'dev': -6, 'alpha': -5, 'a': -5, 'beta': -4, 'b': -4, 'RC': -3, 'rc': -3, '#': -2, 'p': 1, 'pl': 1 }, // This function will be called to prepare each version argument. // It replaces every _, -, and + with a dot. // It surrounds any nonsequence of numbers/dots with dots. // It replaces sequences of dots with a single dot. // version_compare('4..0', '4.0') == 0 // Important: A string of 0 length needs to be converted into a value // even less than an unexisting value in vm (-7), hence [-8]. // It's also important to not strip spaces because of this. // version_compare('', ' ') == 1 prepVersion = function (v) { v = ('' + v).replace(/[_\-+]/g, '.'); v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.'); return (!v.length ? [-8] : v.split('.')); }, // This converts a version component to a number. // Empty component becomes 0. // Non-numerical component becomes a negative number. // Numerical component becomes itself as an integer. numVersion = function (v) { return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10)); }; v1 = prepVersion(v1); v2 = prepVersion(v2); x = Math.max(v1.length, v2.length); for (i = 0; i < x; i++) { if (v1[i] == v2[i]) { continue; } v1[i] = numVersion(v1[i]); v2[i] = numVersion(v2[i]); if (v1[i] < v2[i]) { compare = -1; break; } else if (v1[i] > v2[i]) { compare = 1; break; } } if (!operator) { return compare; } // Important: operator is CASE-SENSITIVE. // "No operator" seems to be treated as "<." // Any other values seem to make the function return null. switch (operator) { case '>': case 'gt': return (compare > 0); case '>=': case 'ge': return (compare >= 0); case '<=': case 'le': return (compare <= 0); case '==': case '=': case 'eq': return (compare === 0); case '<>': case '!=': case 'ne': return (compare !== 0); case '': case '<': case 'lt': return (compare < 0); default: return null; } } var can = (function() { var caps = { define_property: (function() { /* // currently too much extra code required, not exactly worth it try { // as of IE8, getters/setters are supported only on DOM elements var obj = {}; if (Object.defineProperty) { Object.defineProperty(obj, 'prop', { enumerable: true, configurable: true }); return true; } } catch(ex) {} if (Object.prototype.__defineGetter__ && Object.prototype.__defineSetter__) { return true; }*/ return false; }()), create_canvas: (function() { // On the S60 and BB Storm, getContext exists, but always returns undefined // so we actually have to call getContext() to verify // github.com/Modernizr/Modernizr/issues/issue/97/ var el = document.createElement('canvas'); return !!(el.getContext && el.getContext('2d')); }()), return_response_type: function(responseType) { try { if (Basic.inArray(responseType, ['', 'text', 'document']) !== -1) { return true; } else if (window.XMLHttpRequest) { var xhr = new XMLHttpRequest(); xhr.open('get', '/'); // otherwise Gecko throws an exception if ('responseType' in xhr) { xhr.responseType = responseType; // as of 23.0.1271.64, Chrome switched from throwing exception to merely logging it to the console (why? o why?) if (xhr.responseType !== responseType) { return false; } return true; } } } catch (ex) {} return false; }, // ideas for this heavily come from Modernizr (http://modernizr.com/) use_data_uri: (function() { var du = new Image(); du.onload = function() { caps.use_data_uri = (du.width === 1 && du.height === 1); }; setTimeout(function() { du.src = "data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="; }, 1); return false; }()), use_data_uri_over32kb: function() { // IE8 return caps.use_data_uri && (Env.browser !== 'IE' || Env.version >= 9); }, use_data_uri_of: function(bytes) { return (caps.use_data_uri && bytes < 33000 || caps.use_data_uri_over32kb()); }, use_fileinput: function() { var el = document.createElement('input'); el.setAttribute('type', 'file'); return !el.disabled; } }; return function(cap) { var args = [].slice.call(arguments); args.shift(); // shift of cap return Basic.typeOf(caps[cap]) === 'function' ? caps[cap].apply(this, args) : !!caps[cap]; }; }()); var Env = { can: can, browser: UAParser.browser.name, version: parseFloat(UAParser.browser.major), os: UAParser.os.name, // everybody intuitively types it in a lowercase for some reason osVersion: UAParser.os.version, verComp: version_compare, swf_url: "../flash/Moxie.swf", xap_url: "../silverlight/Moxie.xap", global_event_dispatcher: "moxie.core.EventTarget.instance.dispatchEvent" }; // for backward compatibility // @deprecated Use `Env.os` instead Env.OS = Env.os; return Env; }); // Included from: src/javascript/core/utils/Dom.js /** * Dom.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/utils/Dom', ['moxie/core/utils/Env'], function(Env) { /** Get DOM Element by it's id. @method get @for Utils @param {String} id Identifier of the DOM Element @return {DOMElement} */ var get = function(id) { if (typeof id !== 'string') { return id; } return document.getElementById(id); }; /** Checks if specified DOM element has specified class. @method hasClass @static @param {Object} obj DOM element like object to add handler to. @param {String} name Class name */ var hasClass = function(obj, name) { if (!obj.className) { return false; } var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)"); return regExp.test(obj.className); }; /** Adds specified className to specified DOM element. @method addClass @static @param {Object} obj DOM element like object to add handler to. @param {String} name Class name */ var addClass = function(obj, name) { if (!hasClass(obj, name)) { obj.className = !obj.className ? name : obj.className.replace(/\s+$/, '') + ' ' + name; } }; /** Removes specified className from specified DOM element. @method removeClass @static @param {Object} obj DOM element like object to add handler to. @param {String} name Class name */ var removeClass = function(obj, name) { if (obj.className) { var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)"); obj.className = obj.className.replace(regExp, function($0, $1, $2) { return $1 === ' ' && $2 === ' ' ? ' ' : ''; }); } }; /** Returns a given computed style of a DOM element. @method getStyle @static @param {Object} obj DOM element like object. @param {String} name Style you want to get from the DOM element */ var getStyle = function(obj, name) { if (obj.currentStyle) { return obj.currentStyle[name]; } else if (window.getComputedStyle) { return window.getComputedStyle(obj, null)[name]; } }; /** Returns the absolute x, y position of an Element. The position will be returned in a object with x, y fields. @method getPos @static @param {Element} node HTML element or element id to get x, y position from. @param {Element} root Optional root element to stop calculations at. @return {object} Absolute position of the specified element object with x, y fields. */ var getPos = function(node, root) { var x = 0, y = 0, parent, doc = document, nodeRect, rootRect; node = node; root = root || doc.body; // Returns the x, y cordinate for an element on IE 6 and IE 7 function getIEPos(node) { var bodyElm, rect, x = 0, y = 0; if (node) { rect = node.getBoundingClientRect(); bodyElm = doc.compatMode === "CSS1Compat" ? doc.documentElement : doc.body; x = rect.left + bodyElm.scrollLeft; y = rect.top + bodyElm.scrollTop; } return { x : x, y : y }; } // Use getBoundingClientRect on IE 6 and IE 7 but not on IE 8 in standards mode if (node && node.getBoundingClientRect && Env.browser === 'IE' && (!doc.documentMode || doc.documentMode < 8)) { nodeRect = getIEPos(node); rootRect = getIEPos(root); return { x : nodeRect.x - rootRect.x, y : nodeRect.y - rootRect.y }; } parent = node; while (parent && parent != root && parent.nodeType) { x += parent.offsetLeft || 0; y += parent.offsetTop || 0; parent = parent.offsetParent; } parent = node.parentNode; while (parent && parent != root && parent.nodeType) { x -= parent.scrollLeft || 0; y -= parent.scrollTop || 0; parent = parent.parentNode; } return { x : x, y : y }; }; /** Returns the size of the specified node in pixels. @method getSize @static @param {Node} node Node to get the size of. @return {Object} Object with a w and h property. */ var getSize = function(node) { return { w : node.offsetWidth || node.clientWidth, h : node.offsetHeight || node.clientHeight }; }; return { get: get, hasClass: hasClass, addClass: addClass, removeClass: removeClass, getStyle: getStyle, getPos: getPos, getSize: getSize }; }); // Included from: src/javascript/core/Exceptions.js /** * Exceptions.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/Exceptions', [ 'moxie/core/utils/Basic' ], function(Basic) { function _findKey(obj, value) { var key; for (key in obj) { if (obj[key] === value) { return key; } } return null; } return { RuntimeError: (function() { var namecodes = { NOT_INIT_ERR: 1, NOT_SUPPORTED_ERR: 9, JS_ERR: 4 }; function RuntimeError(code) { this.code = code; this.name = _findKey(namecodes, code); this.message = this.name + ": RuntimeError " + this.code; } Basic.extend(RuntimeError, namecodes); RuntimeError.prototype = Error.prototype; return RuntimeError; }()), OperationNotAllowedException: (function() { function OperationNotAllowedException(code) { this.code = code; this.name = 'OperationNotAllowedException'; } Basic.extend(OperationNotAllowedException, { NOT_ALLOWED_ERR: 1 }); OperationNotAllowedException.prototype = Error.prototype; return OperationNotAllowedException; }()), ImageError: (function() { var namecodes = { WRONG_FORMAT: 1, MAX_RESOLUTION_ERR: 2 }; function ImageError(code) { this.code = code; this.name = _findKey(namecodes, code); this.message = this.name + ": ImageError " + this.code; } Basic.extend(ImageError, namecodes); ImageError.prototype = Error.prototype; return ImageError; }()), FileException: (function() { var namecodes = { NOT_FOUND_ERR: 1, SECURITY_ERR: 2, ABORT_ERR: 3, NOT_READABLE_ERR: 4, ENCODING_ERR: 5, NO_MODIFICATION_ALLOWED_ERR: 6, INVALID_STATE_ERR: 7, SYNTAX_ERR: 8 }; function FileException(code) { this.code = code; this.name = _findKey(namecodes, code); this.message = this.name + ": FileException " + this.code; } Basic.extend(FileException, namecodes); FileException.prototype = Error.prototype; return FileException; }()), DOMException: (function() { var namecodes = { INDEX_SIZE_ERR: 1, DOMSTRING_SIZE_ERR: 2, HIERARCHY_REQUEST_ERR: 3, WRONG_DOCUMENT_ERR: 4, INVALID_CHARACTER_ERR: 5, NO_DATA_ALLOWED_ERR: 6, NO_MODIFICATION_ALLOWED_ERR: 7, NOT_FOUND_ERR: 8, NOT_SUPPORTED_ERR: 9, INUSE_ATTRIBUTE_ERR: 10, INVALID_STATE_ERR: 11, SYNTAX_ERR: 12, INVALID_MODIFICATION_ERR: 13, NAMESPACE_ERR: 14, INVALID_ACCESS_ERR: 15, VALIDATION_ERR: 16, TYPE_MISMATCH_ERR: 17, SECURITY_ERR: 18, NETWORK_ERR: 19, ABORT_ERR: 20, URL_MISMATCH_ERR: 21, QUOTA_EXCEEDED_ERR: 22, TIMEOUT_ERR: 23, INVALID_NODE_TYPE_ERR: 24, DATA_CLONE_ERR: 25 }; function DOMException(code) { this.code = code; this.name = _findKey(namecodes, code); this.message = this.name + ": DOMException " + this.code; } Basic.extend(DOMException, namecodes); DOMException.prototype = Error.prototype; return DOMException; }()), EventException: (function() { function EventException(code) { this.code = code; this.name = 'EventException'; } Basic.extend(EventException, { UNSPECIFIED_EVENT_TYPE_ERR: 0 }); EventException.prototype = Error.prototype; return EventException; }()) }; }); // Included from: src/javascript/core/EventTarget.js /** * EventTarget.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/EventTarget', [ 'moxie/core/Exceptions', 'moxie/core/utils/Basic' ], function(x, Basic) { /** Parent object for all event dispatching components and objects @class EventTarget @constructor EventTarget */ function EventTarget() { // hash of event listeners by object uid var eventpool = {}; Basic.extend(this, { /** Unique id of the event dispatcher, usually overriden by children @property uid @type String */ uid: null, /** Can be called from within a child in order to acquire uniqie id in automated manner @method init */ init: function() { if (!this.uid) { this.uid = Basic.guid('uid_'); } }, /** Register a handler to a specific event dispatched by the object @method addEventListener @param {String} type Type or basically a name of the event to subscribe to @param {Function} fn Callback function that will be called when event happens @param {Number} [priority=0] Priority of the event handler - handlers with higher priorities will be called first @param {Object} [scope=this] A scope to invoke event handler in */ addEventListener: function(type, fn, priority, scope) { var self = this, list; type = Basic.trim(type); if (/\s/.test(type)) { // multiple event types were passed for one handler Basic.each(type.split(/\s+/), function(type) { self.addEventListener(type, fn, priority, scope); }); return; } type = type.toLowerCase(); priority = parseInt(priority, 10) || 0; list = eventpool[this.uid] && eventpool[this.uid][type] || []; list.push({fn : fn, priority : priority, scope : scope || this}); if (!eventpool[this.uid]) { eventpool[this.uid] = {}; } eventpool[this.uid][type] = list; }, /** Check if any handlers were registered to the specified event @method hasEventListener @param {String} type Type or basically a name of the event to check @return {Mixed} Returns a handler if it was found and false, if - not */ hasEventListener: function(type) { return type ? !!(eventpool[this.uid] && eventpool[this.uid][type]) : !!eventpool[this.uid]; }, /** Unregister the handler from the event, or if former was not specified - unregister all handlers @method removeEventListener @param {String} type Type or basically a name of the event @param {Function} [fn] Handler to unregister */ removeEventListener: function(type, fn) { type = type.toLowerCase(); var list = eventpool[this.uid] && eventpool[this.uid][type], i; if (list) { if (fn) { for (i = list.length - 1; i >= 0; i--) { if (list[i].fn === fn) { list.splice(i, 1); break; } } } else { list = []; } // delete event list if it has become empty if (!list.length) { delete eventpool[this.uid][type]; // and object specific entry in a hash if it has no more listeners attached if (Basic.isEmptyObj(eventpool[this.uid])) { delete eventpool[this.uid]; } } } }, /** Remove all event handlers from the object @method removeAllEventListeners */ removeAllEventListeners: function() { if (eventpool[this.uid]) { delete eventpool[this.uid]; } }, /** Dispatch the event @method dispatchEvent @param {String/Object} Type of event or event object to dispatch @param {Mixed} [...] Variable number of arguments to be passed to a handlers @return {Boolean} true by default and false if any handler returned false */ dispatchEvent: function(type) { var uid, list, args, tmpEvt, evt = {}, result = true, undef; if (Basic.typeOf(type) !== 'string') { // we can't use original object directly (because of Silverlight) tmpEvt = type; if (Basic.typeOf(tmpEvt.type) === 'string') { type = tmpEvt.type; if (tmpEvt.total !== undef && tmpEvt.loaded !== undef) { // progress event evt.total = tmpEvt.total; evt.loaded = tmpEvt.loaded; } evt.async = tmpEvt.async || false; } else { throw new x.EventException(x.EventException.UNSPECIFIED_EVENT_TYPE_ERR); } } // check if event is meant to be dispatched on an object having specific uid if (type.indexOf('::') !== -1) { (function(arr) { uid = arr[0]; type = arr[1]; }(type.split('::'))); } else { uid = this.uid; } type = type.toLowerCase(); list = eventpool[uid] && eventpool[uid][type]; if (list) { // sort event list by prority list.sort(function(a, b) { return b.priority - a.priority; }); args = [].slice.call(arguments); // first argument will be pseudo-event object args.shift(); evt.type = type; args.unshift(evt); // Dispatch event to all listeners var queue = []; Basic.each(list, function(handler) { // explicitly set the target, otherwise events fired from shims do not get it args[0].target = handler.scope; // if event is marked as async, detach the handler if (evt.async) { queue.push(function(cb) { setTimeout(function() { cb(handler.fn.apply(handler.scope, args) === false); }, 1); }); } else { queue.push(function(cb) { cb(handler.fn.apply(handler.scope, args) === false); // if handler returns false stop propagation }); } }); if (queue.length) { Basic.inSeries(queue, function(err) { result = !err; }); } } return result; }, /** Alias for addEventListener @method bind @protected */ bind: function() { this.addEventListener.apply(this, arguments); }, /** Alias for removeEventListener @method unbind @protected */ unbind: function() { this.removeEventListener.apply(this, arguments); }, /** Alias for removeAllEventListeners @method unbindAll @protected */ unbindAll: function() { this.removeAllEventListeners.apply(this, arguments); }, /** Alias for dispatchEvent @method trigger @protected */ trigger: function() { return this.dispatchEvent.apply(this, arguments); }, /** Converts properties of on[event] type to corresponding event handlers, is used to avoid extra hassle around the process of calling them back @method convertEventPropsToHandlers @private */ convertEventPropsToHandlers: function(handlers) { var h; if (Basic.typeOf(handlers) !== 'array') { handlers = [handlers]; } for (var i = 0; i < handlers.length; i++) { h = 'on' + handlers[i]; if (Basic.typeOf(this[h]) === 'function') { this.addEventListener(handlers[i], this[h]); } else if (Basic.typeOf(this[h]) === 'undefined') { this[h] = null; // object must have defined event properties, even if it doesn't make use of them } } } }); } EventTarget.instance = new EventTarget(); return EventTarget; }); // Included from: src/javascript/core/utils/Encode.js /** * Encode.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/utils/Encode', [], function() { /** Encode string with UTF-8 @method utf8_encode @for Utils @static @param {String} str String to encode @return {String} UTF-8 encoded string */ var utf8_encode = function(str) { return unescape(encodeURIComponent(str)); }; /** Decode UTF-8 encoded string @method utf8_decode @static @param {String} str String to decode @return {String} Decoded string */ var utf8_decode = function(str_data) { return decodeURIComponent(escape(str_data)); }; /** Decode Base64 encoded string (uses browser's default method if available), from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_decode.js @method atob @static @param {String} data String to decode @return {String} Decoded string */ var atob = function(data, utf8) { if (typeof(window.atob) === 'function') { return utf8 ? utf8_decode(window.atob(data)) : window.atob(data); } // http://kevin.vanzonneveld.net // + original by: Tyler Akins (http://rumkin.com) // + improved by: Thunder.m // + input by: Aman Gupta // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Onno Marsman // + bugfixed by: Pellentesque Malesuada // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + input by: Brett Zamir (http://brett-zamir.me) // + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // * example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA=='); // * returns 1: 'Kevin van Zonneveld' // mozilla has this native // - but breaks in 2.0.0.12! //if (typeof this.window.atob == 'function') { // return atob(data); //} var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, dec = "", tmp_arr = []; if (!data) { return data; } data += ''; do { // unpack four hexets into three octets using index points in b64 h1 = b64.indexOf(data.charAt(i++)); h2 = b64.indexOf(data.charAt(i++)); h3 = b64.indexOf(data.charAt(i++)); h4 = b64.indexOf(data.charAt(i++)); bits = h1 << 18 | h2 << 12 | h3 << 6 | h4; o1 = bits >> 16 & 0xff; o2 = bits >> 8 & 0xff; o3 = bits & 0xff; if (h3 == 64) { tmp_arr[ac++] = String.fromCharCode(o1); } else if (h4 == 64) { tmp_arr[ac++] = String.fromCharCode(o1, o2); } else { tmp_arr[ac++] = String.fromCharCode(o1, o2, o3); } } while (i < data.length); dec = tmp_arr.join(''); return utf8 ? utf8_decode(dec) : dec; }; /** Base64 encode string (uses browser's default method if available), from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_encode.js @method btoa @static @param {String} data String to encode @return {String} Base64 encoded string */ var btoa = function(data, utf8) { if (utf8) { utf8_encode(data); } if (typeof(window.btoa) === 'function') { return window.btoa(data); } // http://kevin.vanzonneveld.net // + original by: Tyler Akins (http://rumkin.com) // + improved by: Bayron Guevara // + improved by: Thunder.m // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Pellentesque Malesuada // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + improved by: Rafał Kukawski (http://kukawski.pl) // * example 1: base64_encode('Kevin van Zonneveld'); // * returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA==' // mozilla has this native // - but breaks in 2.0.0.12! var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, enc = "", tmp_arr = []; if (!data) { return data; } do { // pack three octets into four hexets o1 = data.charCodeAt(i++); o2 = data.charCodeAt(i++); o3 = data.charCodeAt(i++); bits = o1 << 16 | o2 << 8 | o3; h1 = bits >> 18 & 0x3f; h2 = bits >> 12 & 0x3f; h3 = bits >> 6 & 0x3f; h4 = bits & 0x3f; // use hexets to index into b64, and append result to encoded string tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4); } while (i < data.length); enc = tmp_arr.join(''); var r = data.length % 3; return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3); }; return { utf8_encode: utf8_encode, utf8_decode: utf8_decode, atob: atob, btoa: btoa }; }); // Included from: src/javascript/runtime/Runtime.js /** * Runtime.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/runtime/Runtime', [ "moxie/core/utils/Basic", "moxie/core/utils/Dom", "moxie/core/EventTarget" ], function(Basic, Dom, EventTarget) { var runtimeConstructors = {}, runtimes = {}; /** Common set of methods and properties for every runtime instance @class Runtime @param {Object} options @param {String} type Sanitized name of the runtime @param {Object} [caps] Set of capabilities that differentiate specified runtime @param {Object} [modeCaps] Set of capabilities that do require specific operational mode @param {String} [preferredMode='browser'] Preferred operational mode to choose if no required capabilities were requested */ function Runtime(options, type, caps, modeCaps, preferredMode) { /** Dispatched when runtime is initialized and ready. Results in RuntimeInit on a connected component. @event Init */ /** Dispatched when runtime fails to initialize. Results in RuntimeError on a connected component. @event Error */ var self = this , _shim , _uid = Basic.guid(type + '_') , defaultMode = preferredMode || 'browser' ; options = options || {}; // register runtime in private hash runtimes[_uid] = this; /** Default set of capabilities, which can be redifined later by specific runtime @private @property caps @type Object */ caps = Basic.extend({ // Runtime can: // provide access to raw binary data of the file access_binary: false, // provide access to raw binary data of the image (image extension is optional) access_image_binary: false, // display binary data as thumbs for example display_media: false, // make cross-domain requests do_cors: false, // accept files dragged and dropped from the desktop drag_and_drop: false, // filter files in selection dialog by their extensions filter_by_extension: true, // resize image (and manipulate it raw data of any file in general) resize_image: false, // periodically report how many bytes of total in the file were uploaded (loaded) report_upload_progress: false, // provide access to the headers of http response return_response_headers: false, // support response of specific type, which should be passed as an argument // e.g. runtime.can('return_response_type', 'blob') return_response_type: false, // return http status code of the response return_status_code: true, // send custom http header with the request send_custom_headers: false, // pick up the files from a dialog select_file: false, // select whole folder in file browse dialog select_folder: false, // select multiple files at once in file browse dialog select_multiple: true, // send raw binary data, that is generated after image resizing or manipulation of other kind send_binary_string: false, // send cookies with http request and therefore retain session send_browser_cookies: true, // send data formatted as multipart/form-data send_multipart: true, // slice the file or blob to smaller parts slice_blob: false, // upload file without preloading it to memory, stream it out directly from disk stream_upload: false, // programmatically trigger file browse dialog summon_file_dialog: false, // upload file of specific size, size should be passed as argument // e.g. runtime.can('upload_filesize', '500mb') upload_filesize: true, // initiate http request with specific http method, method should be passed as argument // e.g. runtime.can('use_http_method', 'put') use_http_method: true }, caps); // default to the mode that is compatible with preferred caps if (options.preferred_caps) { defaultMode = Runtime.getMode(modeCaps, options.preferred_caps, defaultMode); } // small extension factory here (is meant to be extended with actual extensions constructors) _shim = (function() { var objpool = {}; return { exec: function(uid, comp, fn, args) { if (_shim[comp]) { if (!objpool[uid]) { objpool[uid] = { context: this, instance: new _shim[comp]() }; } if (objpool[uid].instance[fn]) { return objpool[uid].instance[fn].apply(this, args); } } }, removeInstance: function(uid) { delete objpool[uid]; }, removeAllInstances: function() { var self = this; Basic.each(objpool, function(obj, uid) { if (Basic.typeOf(obj.instance.destroy) === 'function') { obj.instance.destroy.call(obj.context); } self.removeInstance(uid); }); } }; }()); // public methods Basic.extend(this, { /** Specifies whether runtime instance was initialized or not @property initialized @type {Boolean} @default false */ initialized: false, // shims require this flag to stop initialization retries /** Unique ID of the runtime @property uid @type {String} */ uid: _uid, /** Runtime type (e.g. flash, html5, etc) @property type @type {String} */ type: type, /** Runtime (not native one) may operate in browser or client mode. @property mode @private @type {String|Boolean} current mode or false, if none possible */ mode: Runtime.getMode(modeCaps, (options.required_caps), defaultMode), /** id of the DOM container for the runtime (if available) @property shimid @type {String} */ shimid: _uid + '_container', /** Number of connected clients. If equal to zero, runtime can be destroyed @property clients @type {Number} */ clients: 0, /** Runtime initialization options @property options @type {Object} */ options: options, /** Checks if the runtime has specific capability @method can @param {String} cap Name of capability to check @param {Mixed} [value] If passed, capability should somehow correlate to the value @param {Object} [refCaps] Set of capabilities to check the specified cap against (defaults to internal set) @return {Boolean} true if runtime has such capability and false, if - not */ can: function(cap, value) { var refCaps = arguments[2] || caps; // if cap var is a comma-separated list of caps, convert it to object (key/value) if (Basic.typeOf(cap) === 'string' && Basic.typeOf(value) === 'undefined') { cap = Runtime.parseCaps(cap); } if (Basic.typeOf(cap) === 'object') { for (var key in cap) { if (!this.can(key, cap[key], refCaps)) { return false; } } return true; } // check the individual cap if (Basic.typeOf(refCaps[cap]) === 'function') { return refCaps[cap].call(this, value); } else { return (value === refCaps[cap]); } }, /** Returns container for the runtime as DOM element @method getShimContainer @return {DOMElement} */ getShimContainer: function() { var container, shimContainer = Dom.get(this.shimid); // if no container for shim, create one if (!shimContainer) { container = this.options.container ? Dom.get(this.options.container) : document.body; // create shim container and insert it at an absolute position into the outer container shimContainer = document.createElement('div'); shimContainer.id = this.shimid; shimContainer.className = 'moxie-shim moxie-shim-' + this.type; Basic.extend(shimContainer.style, { position: 'absolute', top: '0px', left: '0px', width: '1px', height: '1px', overflow: 'hidden' }); container.appendChild(shimContainer); container = null; } return shimContainer; }, /** Returns runtime as DOM element (if appropriate) @method getShim @return {DOMElement} */ getShim: function() { return _shim; }, /** Invokes a method within the runtime itself (might differ across the runtimes) @method shimExec @param {Mixed} [] @protected @return {Mixed} Depends on the action and component */ shimExec: function(component, action) { var args = [].slice.call(arguments, 2); return self.getShim().exec.call(this, this.uid, component, action, args); }, /** Operaional interface that is used by components to invoke specific actions on the runtime (is invoked in the scope of component) @method exec @param {Mixed} []* @protected @return {Mixed} Depends on the action and component */ exec: function(component, action) { // this is called in the context of component, not runtime var args = [].slice.call(arguments, 2); if (self[component] && self[component][action]) { return self[component][action].apply(this, args); } return self.shimExec.apply(this, arguments); }, /** Destroys the runtime (removes all events and deletes DOM structures) @method destroy */ destroy: function() { if (!self) { return; // obviously already destroyed } var shimContainer = Dom.get(this.shimid); if (shimContainer) { shimContainer.parentNode.removeChild(shimContainer); } if (_shim) { _shim.removeAllInstances(); } this.unbindAll(); delete runtimes[this.uid]; this.uid = null; // mark this runtime as destroyed _uid = self = _shim = shimContainer = null; } }); // once we got the mode, test against all caps if (this.mode && options.required_caps && !this.can(options.required_caps)) { this.mode = false; } } /** Default order to try different runtime types @property order @type String @static */ Runtime.order = 'html5,flash,silverlight,html4'; /** Retrieves runtime from private hash by it's uid @method getRuntime @private @static @param {String} uid Unique identifier of the runtime @return {Runtime|Boolean} Returns runtime, if it exists and false, if - not */ Runtime.getRuntime = function(uid) { return runtimes[uid] ? runtimes[uid] : false; }; /** Register constructor for the Runtime of new (or perhaps modified) type @method addConstructor @static @param {String} type Runtime type (e.g. flash, html5, etc) @param {Function} construct Constructor for the Runtime type */ Runtime.addConstructor = function(type, constructor) { constructor.prototype = EventTarget.instance; runtimeConstructors[type] = constructor; }; /** Get the constructor for the specified type. method getConstructor @static @param {String} type Runtime type (e.g. flash, html5, etc) @return {Function} Constructor for the Runtime type */ Runtime.getConstructor = function(type) { return runtimeConstructors[type] || null; }; /** Get info about the runtime (uid, type, capabilities) @method getInfo @static @param {String} uid Unique identifier of the runtime @return {Mixed} Info object or null if runtime doesn't exist */ Runtime.getInfo = function(uid) { var runtime = Runtime.getRuntime(uid); if (runtime) { return { uid: runtime.uid, type: runtime.type, mode: runtime.mode, can: function() { return runtime.can.apply(runtime, arguments); } }; } return null; }; /** Convert caps represented by a comma-separated string to the object representation. @method parseCaps @static @param {String} capStr Comma-separated list of capabilities @return {Object} */ Runtime.parseCaps = function(capStr) { var capObj = {}; if (Basic.typeOf(capStr) !== 'string') { return capStr || {}; } Basic.each(capStr.split(','), function(key) { capObj[key] = true; // we assume it to be - true }); return capObj; }; /** Test the specified runtime for specific capabilities. @method can @static @param {String} type Runtime type (e.g. flash, html5, etc) @param {String|Object} caps Set of capabilities to check @return {Boolean} Result of the test */ Runtime.can = function(type, caps) { var runtime , constructor = Runtime.getConstructor(type) , mode ; if (constructor) { runtime = new constructor({ required_caps: caps }); mode = runtime.mode; runtime.destroy(); return !!mode; } return false; }; /** Figure out a runtime that supports specified capabilities. @method thatCan @static @param {String|Object} caps Set of capabilities to check @param {String} [runtimeOrder] Comma-separated list of runtimes to check against @return {String} Usable runtime identifier or null */ Runtime.thatCan = function(caps, runtimeOrder) { var types = (runtimeOrder || Runtime.order).split(/\s*,\s*/); for (var i in types) { if (Runtime.can(types[i], caps)) { return types[i]; } } return null; }; /** Figure out an operational mode for the specified set of capabilities. @method getMode @static @param {Object} modeCaps Set of capabilities that depend on particular runtime mode @param {Object} [requiredCaps] Supplied set of capabilities to find operational mode for @param {String|Boolean} [defaultMode='browser'] Default mode to use @return {String|Boolean} Compatible operational mode */ Runtime.getMode = function(modeCaps, requiredCaps, defaultMode) { var mode = null; if (Basic.typeOf(defaultMode) === 'undefined') { // only if not specified defaultMode = 'browser'; } if (requiredCaps && !Basic.isEmptyObj(modeCaps)) { // loop over required caps and check if they do require the same mode Basic.each(requiredCaps, function(value, cap) { if (modeCaps.hasOwnProperty(cap)) { var capMode = modeCaps[cap](value); // make sure we always have an array if (typeof(capMode) === 'string') { capMode = [capMode]; } if (!mode) { mode = capMode; } else if (!(mode = Basic.arrayIntersect(mode, capMode))) { // if cap requires conflicting mode - runtime cannot fulfill required caps return (mode = false); } } }); if (mode) { return Basic.inArray(defaultMode, mode) !== -1 ? defaultMode : mode[0]; } else if (mode === false) { return false; } } return defaultMode; }; /** Capability check that always returns true @private @static @return {True} */ Runtime.capTrue = function() { return true; }; /** Capability check that always returns false @private @static @return {False} */ Runtime.capFalse = function() { return false; }; /** Evaluate the expression to boolean value and create a function that always returns it. @private @static @param {Mixed} expr Expression to evaluate @return {Function} Function returning the result of evaluation */ Runtime.capTest = function(expr) { return function() { return !!expr; }; }; return Runtime; }); // Included from: src/javascript/runtime/RuntimeClient.js /** * RuntimeClient.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/runtime/RuntimeClient', [ 'moxie/core/Exceptions', 'moxie/core/utils/Basic', 'moxie/runtime/Runtime' ], function(x, Basic, Runtime) { /** Set of methods and properties, required by a component to acquire ability to connect to a runtime @class RuntimeClient */ return function RuntimeClient() { var runtime; Basic.extend(this, { /** Connects to the runtime specified by the options. Will either connect to existing runtime or create a new one. Increments number of clients connected to the specified runtime. @method connectRuntime @param {Mixed} options Can be a runtme uid or a set of key-value pairs defining requirements and pre-requisites */ connectRuntime: function(options) { var comp = this, ruid; function initialize(items) { var type, constructor; // if we ran out of runtimes if (!items.length) { comp.trigger('RuntimeError', new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR)); runtime = null; return; } type = items.shift(); constructor = Runtime.getConstructor(type); if (!constructor) { initialize(items); return; } // try initializing the runtime runtime = new constructor(options); runtime.bind('Init', function() { // mark runtime as initialized runtime.initialized = true; // jailbreak ... setTimeout(function() { runtime.clients++; // this will be triggered on component comp.trigger('RuntimeInit', runtime); }, 1); }); runtime.bind('Error', function() { runtime.destroy(); // runtime cannot destroy itself from inside at a right moment, thus we do it here initialize(items); }); /*runtime.bind('Exception', function() { });*/ // check if runtime managed to pick-up operational mode if (!runtime.mode) { runtime.trigger('Error'); return; } runtime.init(); } // check if a particular runtime was requested if (Basic.typeOf(options) === 'string') { ruid = options; } else if (Basic.typeOf(options.ruid) === 'string') { ruid = options.ruid; } if (ruid) { runtime = Runtime.getRuntime(ruid); if (runtime) { runtime.clients++; return runtime; } else { // there should be a runtime and there's none - weird case throw new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR); } } // initialize a fresh one, that fits runtime list and required features best initialize((options.runtime_order || Runtime.order).split(/\s*,\s*/)); }, /** Returns the runtime to which the client is currently connected. @method getRuntime @return {Runtime} Runtime or null if client is not connected */ getRuntime: function() { if (runtime && runtime.uid) { return runtime; } runtime = null; // make sure we do not leave zombies rambling around return null; }, /** Disconnects from the runtime. Decrements number of clients connected to the specified runtime. @method disconnectRuntime */ disconnectRuntime: function() { if (runtime && --runtime.clients <= 0) { runtime.destroy(); runtime = null; } } }); }; }); // Included from: src/javascript/file/Blob.js /** * Blob.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/file/Blob', [ 'moxie/core/utils/Basic', 'moxie/core/utils/Encode', 'moxie/runtime/RuntimeClient' ], function(Basic, Encode, RuntimeClient) { var blobpool = {}; /** @class Blob @constructor @param {String} ruid Unique id of the runtime, to which this blob belongs to @param {Object} blob Object "Native" blob object, as it is represented in the runtime */ function Blob(ruid, blob) { function _sliceDetached(start, end, type) { var blob, data = blobpool[this.uid]; if (Basic.typeOf(data) !== 'string' || !data.length) { return null; // or throw exception } blob = new Blob(null, { type: type, size: end - start }); blob.detach(data.substr(start, blob.size)); return blob; } RuntimeClient.call(this); if (ruid) { this.connectRuntime(ruid); } if (!blob) { blob = {}; } else if (Basic.typeOf(blob) === 'string') { // dataUrl or binary string blob = { data: blob }; } Basic.extend(this, { /** Unique id of the component @property uid @type {String} */ uid: blob.uid || Basic.guid('uid_'), /** Unique id of the connected runtime, if falsy, then runtime will have to be initialized before this Blob can be used, modified or sent @property ruid @type {String} */ ruid: ruid, /** Size of blob @property size @type {Number} @default 0 */ size: blob.size || 0, /** Mime type of blob @property type @type {String} @default '' */ type: blob.type || '', /** @method slice @param {Number} [start=0] */ slice: function(start, end, type) { if (this.isDetached()) { return _sliceDetached.apply(this, arguments); } return this.getRuntime().exec.call(this, 'Blob', 'slice', this.getSource(), start, end, type); }, /** Returns "native" blob object (as it is represented in connected runtime) or null if not found @method getSource @return {Blob} Returns "native" blob object or null if not found */ getSource: function() { if (!blobpool[this.uid]) { return null; } return blobpool[this.uid]; }, /** Detaches blob from any runtime that it depends on and initialize with standalone value @method detach @protected @param {DOMString} [data=''] Standalone value */ detach: function(data) { if (this.ruid) { this.getRuntime().exec.call(this, 'Blob', 'destroy'); this.disconnectRuntime(); this.ruid = null; } data = data || ''; // if dataUrl, convert to binary string var matches = data.match(/^data:([^;]*);base64,/); if (matches) { this.type = matches[1]; data = Encode.atob(data.substring(data.indexOf('base64,') + 7)); } this.size = data.length; blobpool[this.uid] = data; }, /** Checks if blob is standalone (detached of any runtime) @method isDetached @protected @return {Boolean} */ isDetached: function() { return !this.ruid && Basic.typeOf(blobpool[this.uid]) === 'string'; }, /** Destroy Blob and free any resources it was using @method destroy */ destroy: function() { this.detach(); delete blobpool[this.uid]; } }); if (blob.data) { this.detach(blob.data); // auto-detach if payload has been passed } else { blobpool[this.uid] = blob; } } return Blob; }); // Included from: src/javascript/file/File.js /** * File.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/file/File', [ 'moxie/core/utils/Basic', 'moxie/core/utils/Mime', 'moxie/file/Blob' ], function(Basic, Mime, Blob) { /** @class File @extends Blob @constructor @param {String} ruid Unique id of the runtime, to which this blob belongs to @param {Object} file Object "Native" file object, as it is represented in the runtime */ function File(ruid, file) { var name, type; if (!file) { // avoid extra errors in case we overlooked something file = {}; } // figure out the type if (file.type && file.type !== '') { type = file.type; } else { type = Mime.getFileMime(file.name); } // sanitize file name or generate new one if (file.name) { name = file.name.replace(/\\/g, '/'); name = name.substr(name.lastIndexOf('/') + 1); } else { var prefix = type.split('/')[0]; name = Basic.guid((prefix !== '' ? prefix : 'file') + '_'); if (Mime.extensions[type]) { name += '.' + Mime.extensions[type][0]; // append proper extension if possible } } Blob.apply(this, arguments); Basic.extend(this, { /** File mime type @property type @type {String} @default '' */ type: type || '', /** File name @property name @type {String} @default UID */ name: name || Basic.guid('file_'), /** Relative path to the file inside a directory @property relativePath @type {String} @default '' */ relativePath: '', /** Date of last modification @property lastModifiedDate @type {String} @default now */ lastModifiedDate: file.lastModifiedDate || (new Date()).toLocaleString() // Thu Aug 23 2012 19:40:00 GMT+0400 (GET) }); } File.prototype = Blob.prototype; return File; }); // Included from: src/javascript/file/FileInput.js /** * FileInput.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/file/FileInput', [ 'moxie/core/utils/Basic', 'moxie/core/utils/Mime', 'moxie/core/utils/Dom', 'moxie/core/Exceptions', 'moxie/core/EventTarget', 'moxie/core/I18n', 'moxie/file/File', 'moxie/runtime/Runtime', 'moxie/runtime/RuntimeClient' ], function(Basic, Mime, Dom, x, EventTarget, I18n, File, Runtime, RuntimeClient) { /** Provides a convenient way to create cross-browser file-picker. Generates file selection dialog on click, converts selected files to _File_ objects, to be used in conjunction with _Image_, preloaded in memory with _FileReader_ or uploaded to a server through _XMLHttpRequest_. @class FileInput @constructor @extends EventTarget @uses RuntimeClient @param {Object|String|DOMElement} options If options is string or node, argument is considered as _browse\_button_. @param {String|DOMElement} options.browse_button DOM Element to turn into file picker. @param {Array} [options.accept] Array of mime types to accept. By default accepts all. @param {String} [options.file='file'] Name of the file field (not the filename). @param {Boolean} [options.multiple=false] Enable selection of multiple files. @param {Boolean} [options.directory=false] Turn file input into the folder input (cannot be both at the same time). @param {String|DOMElement} [options.container] DOM Element to use as a container for file-picker. Defaults to parentNode for _browse\_button_. @param {Object|String} [options.required_caps] Set of required capabilities, that chosen runtime must support. @example <div id="container"> <a id="file-picker" href="javascript:;">Browse...</a> </div> <script> var fileInput = new mOxie.FileInput({ browse_button: 'file-picker', // or document.getElementById('file-picker') container: 'container', accept: [ {title: "Image files", extensions: "jpg,gif,png"} // accept only images ], multiple: true // allow multiple file selection }); fileInput.onchange = function(e) { // do something to files array console.info(e.target.files); // or this.files or fileInput.files }; fileInput.init(); // initialize </script> */ var dispatches = [ /** Dispatched when runtime is connected and file-picker is ready to be used. @event ready @param {Object} event */ 'ready', /** Dispatched right after [ready](#event_ready) event, and whenever [refresh()](#method_refresh) is invoked. Check [corresponding documentation entry](#method_refresh) for more info. @event refresh @param {Object} event */ /** Dispatched when selection of files in the dialog is complete. @event change @param {Object} event */ 'change', 'cancel', // TODO: might be useful /** Dispatched when mouse cursor enters file-picker area. Can be used to style element accordingly. @event mouseenter @param {Object} event */ 'mouseenter', /** Dispatched when mouse cursor leaves file-picker area. Can be used to style element accordingly. @event mouseleave @param {Object} event */ 'mouseleave', /** Dispatched when functional mouse button is pressed on top of file-picker area. @event mousedown @param {Object} event */ 'mousedown', /** Dispatched when functional mouse button is released on top of file-picker area. @event mouseup @param {Object} event */ 'mouseup' ]; function FileInput(options) { var self = this, container, browseButton, defaults; // if flat argument passed it should be browse_button id if (Basic.inArray(Basic.typeOf(options), ['string', 'node']) !== -1) { options = { browse_button : options }; } // this will help us to find proper default container browseButton = Dom.get(options.browse_button); if (!browseButton) { // browse button is required throw new x.DOMException(x.DOMException.NOT_FOUND_ERR); } // figure out the options defaults = { accept: [{ title: I18n.translate('All Files'), extensions: '*' }], name: 'file', multiple: false, required_caps: false, container: browseButton.parentNode || document.body }; options = Basic.extend({}, defaults, options); // convert to object representation if (typeof(options.required_caps) === 'string') { options.required_caps = Runtime.parseCaps(options.required_caps); } // normalize accept option (could be list of mime types or array of title/extensions pairs) if (typeof(options.accept) === 'string') { options.accept = Mime.mimes2extList(options.accept); } container = Dom.get(options.container); // make sure we have container if (!container) { container = document.body; } // make container relative, if it's not if (Dom.getStyle(container, 'position') === 'static') { container.style.position = 'relative'; } container = browseButton = null; // IE RuntimeClient.call(self); Basic.extend(self, { /** Unique id of the component @property uid @protected @readOnly @type {String} @default UID */ uid: Basic.guid('uid_'), /** Unique id of the connected runtime, if any. @property ruid @protected @type {String} */ ruid: null, /** Unique id of the runtime container. Useful to get hold of it for various manipulations. @property shimid @protected @type {String} */ shimid: null, /** Array of selected mOxie.File objects @property files @type {Array} @default null */ files: null, /** Initializes the file-picker, connects it to runtime and dispatches event ready when done. @method init */ init: function() { self.convertEventPropsToHandlers(dispatches); self.bind('RuntimeInit', function(e, runtime) { self.ruid = runtime.uid; self.shimid = runtime.shimid; self.bind("Ready", function() { self.trigger("Refresh"); }, 999); self.bind("Change", function() { var files = runtime.exec.call(self, 'FileInput', 'getFiles'); self.files = []; Basic.each(files, function(file) { // ignore empty files (IE10 for example hangs if you try to send them via XHR) if (file.size === 0) { return true; } self.files.push(new File(self.ruid, file)); }); }, 999); // re-position and resize shim container self.bind('Refresh', function() { var pos, size, browseButton, shimContainer; browseButton = Dom.get(options.browse_button); shimContainer = Dom.get(runtime.shimid); // do not use runtime.getShimContainer(), since it will create container if it doesn't exist if (browseButton) { pos = Dom.getPos(browseButton, Dom.get(options.container)); size = Dom.getSize(browseButton); if (shimContainer) { Basic.extend(shimContainer.style, { top : pos.y + 'px', left : pos.x + 'px', width : size.w + 'px', height : size.h + 'px' }); } } shimContainer = browseButton = null; }); runtime.exec.call(self, 'FileInput', 'init', options); }); // runtime needs: options.required_features, options.runtime_order and options.container self.connectRuntime(Basic.extend({}, options, { required_caps: { select_file: true } })); }, /** Disables file-picker element, so that it doesn't react to mouse clicks. @method disable @param {Boolean} [state=true] Disable component if - true, enable if - false */ disable: function(state) { var runtime = this.getRuntime(); if (runtime) { runtime.exec.call(this, 'FileInput', 'disable', Basic.typeOf(state) === 'undefined' ? true : state); } }, /** Reposition and resize dialog trigger to match the position and size of browse_button element. @method refresh */ refresh: function() { self.trigger("Refresh"); }, /** Destroy component. @method destroy */ destroy: function() { var runtime = this.getRuntime(); if (runtime) { runtime.exec.call(this, 'FileInput', 'destroy'); this.disconnectRuntime(); } if (Basic.typeOf(this.files) === 'array') { // no sense in leaving associated files behind Basic.each(this.files, function(file) { file.destroy(); }); } this.files = null; } }); } FileInput.prototype = EventTarget.instance; return FileInput; }); // Included from: src/javascript/runtime/RuntimeTarget.js /** * RuntimeTarget.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/runtime/RuntimeTarget', [ 'moxie/core/utils/Basic', 'moxie/runtime/RuntimeClient', "moxie/core/EventTarget" ], function(Basic, RuntimeClient, EventTarget) { /** Instance of this class can be used as a target for the events dispatched by shims, when allowing them onto components is for either reason inappropriate @class RuntimeTarget @constructor @protected @extends EventTarget */ function RuntimeTarget() { this.uid = Basic.guid('uid_'); RuntimeClient.call(this); this.destroy = function() { this.disconnectRuntime(); this.unbindAll(); }; } RuntimeTarget.prototype = EventTarget.instance; return RuntimeTarget; }); // Included from: src/javascript/file/FileReader.js /** * FileReader.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/file/FileReader', [ 'moxie/core/utils/Basic', 'moxie/core/utils/Encode', 'moxie/core/Exceptions', 'moxie/core/EventTarget', 'moxie/file/Blob', 'moxie/file/File', 'moxie/runtime/RuntimeTarget' ], function(Basic, Encode, x, EventTarget, Blob, File, RuntimeTarget) { /** Utility for preloading o.Blob/o.File objects in memory. By design closely follows [W3C FileReader](http://www.w3.org/TR/FileAPI/#dfn-filereader) interface. Where possible uses native FileReader, where - not falls back to shims. @class FileReader @constructor FileReader @extends EventTarget @uses RuntimeClient */ var dispatches = [ /** Dispatched when the read starts. @event loadstart @param {Object} event */ 'loadstart', /** Dispatched while reading (and decoding) blob, and reporting partial Blob data (progess.loaded/progress.total). @event progress @param {Object} event */ 'progress', /** Dispatched when the read has successfully completed. @event load @param {Object} event */ 'load', /** Dispatched when the read has been aborted. For instance, by invoking the abort() method. @event abort @param {Object} event */ 'abort', /** Dispatched when the read has failed. @event error @param {Object} event */ 'error', /** Dispatched when the request has completed (either in success or failure). @event loadend @param {Object} event */ 'loadend' ]; function FileReader() { var self = this, _fr; Basic.extend(this, { /** UID of the component instance. @property uid @type {String} */ uid: Basic.guid('uid_'), /** Contains current state of FileReader object. Can take values of FileReader.EMPTY, FileReader.LOADING and FileReader.DONE. @property readyState @type {Number} @default FileReader.EMPTY */ readyState: FileReader.EMPTY, /** Result of the successful read operation. @property result @type {String} */ result: null, /** Stores the error of failed asynchronous read operation. @property error @type {DOMError} */ error: null, /** Initiates reading of File/Blob object contents to binary string. @method readAsBinaryString @param {Blob|File} blob Object to preload */ readAsBinaryString: function(blob) { _read.call(this, 'readAsBinaryString', blob); }, /** Initiates reading of File/Blob object contents to dataURL string. @method readAsDataURL @param {Blob|File} blob Object to preload */ readAsDataURL: function(blob) { _read.call(this, 'readAsDataURL', blob); }, /** Initiates reading of File/Blob object contents to string. @method readAsText @param {Blob|File} blob Object to preload */ readAsText: function(blob) { _read.call(this, 'readAsText', blob); }, /** Aborts preloading process. @method abort */ abort: function() { this.result = null; if (Basic.inArray(this.readyState, [FileReader.EMPTY, FileReader.DONE]) !== -1) { return; } else if (this.readyState === FileReader.LOADING) { this.readyState = FileReader.DONE; } if (_fr) { _fr.getRuntime().exec.call(this, 'FileReader', 'abort'); } this.trigger('abort'); this.trigger('loadend'); }, /** Destroy component and release resources. @method destroy */ destroy: function() { this.abort(); if (_fr) { _fr.getRuntime().exec.call(this, 'FileReader', 'destroy'); _fr.disconnectRuntime(); } self = _fr = null; } }); function _read(op, blob) { _fr = new RuntimeTarget(); function error(err) { self.readyState = FileReader.DONE; self.error = err; self.trigger('error'); loadEnd(); } function loadEnd() { _fr.destroy(); _fr = null; self.trigger('loadend'); } function exec(runtime) { _fr.bind('Error', function(e, err) { error(err); }); _fr.bind('Progress', function(e) { self.result = runtime.exec.call(_fr, 'FileReader', 'getResult'); self.trigger(e); }); _fr.bind('Load', function(e) { self.readyState = FileReader.DONE; self.result = runtime.exec.call(_fr, 'FileReader', 'getResult'); self.trigger(e); loadEnd(); }); runtime.exec.call(_fr, 'FileReader', 'read', op, blob); } this.convertEventPropsToHandlers(dispatches); if (this.readyState === FileReader.LOADING) { return error(new x.DOMException(x.DOMException.INVALID_STATE_ERR)); } this.readyState = FileReader.LOADING; this.trigger('loadstart'); // if source is o.Blob/o.File if (blob instanceof Blob) { if (blob.isDetached()) { var src = blob.getSource(); switch (op) { case 'readAsText': case 'readAsBinaryString': this.result = src; break; case 'readAsDataURL': this.result = 'data:' + blob.type + ';base64,' + Encode.btoa(src); break; } this.readyState = FileReader.DONE; this.trigger('load'); loadEnd(); } else { exec(_fr.connectRuntime(blob.ruid)); } } else { error(new x.DOMException(x.DOMException.NOT_FOUND_ERR)); } } } /** Initial FileReader state @property EMPTY @type {Number} @final @static @default 0 */ FileReader.EMPTY = 0; /** FileReader switches to this state when it is preloading the source @property LOADING @type {Number} @final @static @default 1 */ FileReader.LOADING = 1; /** Preloading is complete, this is a final state @property DONE @type {Number} @final @static @default 2 */ FileReader.DONE = 2; FileReader.prototype = EventTarget.instance; return FileReader; }); // Included from: src/javascript/core/utils/Url.js /** * Url.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/utils/Url', [], function() { /** Parse url into separate components and fill in absent parts with parts from current url, based on https://raw.github.com/kvz/phpjs/master/functions/url/parse_url.js @method parseUrl @for Utils @static @param {String} url Url to parse (defaults to empty string if undefined) @return {Object} Hash containing extracted uri components */ var parseUrl = function(url, currentUrl) { var key = ['source', 'scheme', 'authority', 'userInfo', 'user', 'pass', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'fragment'] , i = key.length , ports = { http: 80, https: 443 } , uri = {} , regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/ , m = regex.exec(url || '') ; while (i--) { if (m[i]) { uri[key[i]] = m[i]; } } // when url is relative, we set the origin and the path ourselves if (!uri.scheme) { // come up with defaults if (!currentUrl || typeof(currentUrl) === 'string') { currentUrl = parseUrl(currentUrl || document.location.href); } uri.scheme = currentUrl.scheme; uri.host = currentUrl.host; uri.port = currentUrl.port; var path = ''; // for urls without trailing slash we need to figure out the path if (/^[^\/]/.test(uri.path)) { path = currentUrl.path; // if path ends with a filename, strip it if (!/(\/|\/[^\.]+)$/.test(path)) { path = path.replace(/\/[^\/]+$/, '/'); } else { path += '/'; } } uri.path = path + (uri.path || ''); // site may reside at domain.com or domain.com/subdir } if (!uri.port) { uri.port = ports[uri.scheme] || 80; } uri.port = parseInt(uri.port, 10); if (!uri.path) { uri.path = "/"; } delete uri.source; return uri; }; /** Resolve url - among other things will turn relative url to absolute @method resolveUrl @static @param {String} url Either absolute or relative @return {String} Resolved, absolute url */ var resolveUrl = function(url) { var ports = { // we ignore default ports http: 80, https: 443 } , urlp = parseUrl(url) ; return urlp.scheme + '://' + urlp.host + (urlp.port !== ports[urlp.scheme] ? ':' + urlp.port : '') + urlp.path + (urlp.query ? urlp.query : ''); }; /** Check if specified url has the same origin as the current document @method hasSameOrigin @param {String|Object} url @return {Boolean} */ var hasSameOrigin = function(url) { function origin(url) { return [url.scheme, url.host, url.port].join('/'); } if (typeof url === 'string') { url = parseUrl(url); } return origin(parseUrl()) === origin(url); }; return { parseUrl: parseUrl, resolveUrl: resolveUrl, hasSameOrigin: hasSameOrigin }; }); // Included from: src/javascript/file/FileReaderSync.js /** * FileReaderSync.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/file/FileReaderSync', [ 'moxie/core/utils/Basic', 'moxie/runtime/RuntimeClient', 'moxie/core/utils/Encode' ], function(Basic, RuntimeClient, Encode) { /** Synchronous FileReader implementation. Something like this is available in WebWorkers environment, here it can be used to read only preloaded blobs/files and only below certain size (not yet sure what that'd be, but probably < 1mb). Not meant to be used directly by user. @class FileReaderSync @private @constructor */ return function() { RuntimeClient.call(this); Basic.extend(this, { uid: Basic.guid('uid_'), readAsBinaryString: function(blob) { return _read.call(this, 'readAsBinaryString', blob); }, readAsDataURL: function(blob) { return _read.call(this, 'readAsDataURL', blob); }, /*readAsArrayBuffer: function(blob) { return _read.call(this, 'readAsArrayBuffer', blob); },*/ readAsText: function(blob) { return _read.call(this, 'readAsText', blob); } }); function _read(op, blob) { if (blob.isDetached()) { var src = blob.getSource(); switch (op) { case 'readAsBinaryString': return src; case 'readAsDataURL': return 'data:' + blob.type + ';base64,' + Encode.btoa(src); case 'readAsText': var txt = ''; for (var i = 0, length = src.length; i < length; i++) { txt += String.fromCharCode(src[i]); } return txt; } } else { var result = this.connectRuntime(blob.ruid).exec.call(this, 'FileReaderSync', 'read', op, blob); this.disconnectRuntime(); return result; } } }; }); // Included from: src/javascript/xhr/FormData.js /** * FormData.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define("moxie/xhr/FormData", [ "moxie/core/Exceptions", "moxie/core/utils/Basic", "moxie/file/Blob" ], function(x, Basic, Blob) { /** FormData @class FormData @constructor */ function FormData() { var _blob, _fields = []; Basic.extend(this, { /** Append another key-value pair to the FormData object @method append @param {String} name Name for the new field @param {String|Blob|Array|Object} value Value for the field */ append: function(name, value) { var self = this, valueType = Basic.typeOf(value); // according to specs value might be either Blob or String if (value instanceof Blob) { _blob = { name: name, value: value // unfortunately we can only send single Blob in one FormData }; } else if ('array' === valueType) { name += '[]'; Basic.each(value, function(value) { self.append(name, value); }); } else if ('object' === valueType) { Basic.each(value, function(value, key) { self.append(name + '[' + key + ']', value); }); } else if ('null' === valueType || 'undefined' === valueType || 'number' === valueType && isNaN(value)) { self.append(name, "false"); } else { _fields.push({ name: name, value: value.toString() }); } }, /** Checks if FormData contains Blob. @method hasBlob @return {Boolean} */ hasBlob: function() { return !!this.getBlob(); }, /** Retrieves blob. @method getBlob @return {Object} Either Blob if found or null */ getBlob: function() { return _blob && _blob.value || null; }, /** Retrieves blob field name. @method getBlobName @return {String} Either Blob field name or null */ getBlobName: function() { return _blob && _blob.name || null; }, /** Loop over the fields in FormData and invoke the callback for each of them. @method each @param {Function} cb Callback to call for each field */ each: function(cb) { Basic.each(_fields, function(field) { cb(field.value, field.name); }); if (_blob) { cb(_blob.value, _blob.name); } }, destroy: function() { _blob = null; _fields = []; } }); } return FormData; }); // Included from: src/javascript/xhr/XMLHttpRequest.js /** * XMLHttpRequest.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define("moxie/xhr/XMLHttpRequest", [ "moxie/core/utils/Basic", "moxie/core/Exceptions", "moxie/core/EventTarget", "moxie/core/utils/Encode", "moxie/core/utils/Url", "moxie/runtime/Runtime", "moxie/runtime/RuntimeTarget", "moxie/file/Blob", "moxie/file/FileReaderSync", "moxie/xhr/FormData", "moxie/core/utils/Env", "moxie/core/utils/Mime" ], function(Basic, x, EventTarget, Encode, Url, Runtime, RuntimeTarget, Blob, FileReaderSync, FormData, Env, Mime) { var httpCode = { 100: 'Continue', 101: 'Switching Protocols', 102: 'Processing', 200: 'OK', 201: 'Created', 202: 'Accepted', 203: 'Non-Authoritative Information', 204: 'No Content', 205: 'Reset Content', 206: 'Partial Content', 207: 'Multi-Status', 226: 'IM Used', 300: 'Multiple Choices', 301: 'Moved Permanently', 302: 'Found', 303: 'See Other', 304: 'Not Modified', 305: 'Use Proxy', 306: 'Reserved', 307: 'Temporary Redirect', 400: 'Bad Request', 401: 'Unauthorized', 402: 'Payment Required', 403: 'Forbidden', 404: 'Not Found', 405: 'Method Not Allowed', 406: 'Not Acceptable', 407: 'Proxy Authentication Required', 408: 'Request Timeout', 409: 'Conflict', 410: 'Gone', 411: 'Length Required', 412: 'Precondition Failed', 413: 'Request Entity Too Large', 414: 'Request-URI Too Long', 415: 'Unsupported Media Type', 416: 'Requested Range Not Satisfiable', 417: 'Expectation Failed', 422: 'Unprocessable Entity', 423: 'Locked', 424: 'Failed Dependency', 426: 'Upgrade Required', 500: 'Internal Server Error', 501: 'Not Implemented', 502: 'Bad Gateway', 503: 'Service Unavailable', 504: 'Gateway Timeout', 505: 'HTTP Version Not Supported', 506: 'Variant Also Negotiates', 507: 'Insufficient Storage', 510: 'Not Extended' }; function XMLHttpRequestUpload() { this.uid = Basic.guid('uid_'); } XMLHttpRequestUpload.prototype = EventTarget.instance; /** Implementation of XMLHttpRequest @class XMLHttpRequest @constructor @uses RuntimeClient @extends EventTarget */ var dispatches = ['loadstart', 'progress', 'abort', 'error', 'load', 'timeout', 'loadend']; // & readystatechange (for historical reasons) var NATIVE = 1, RUNTIME = 2; function XMLHttpRequest() { var self = this, // this (together with _p() @see below) is here to gracefully upgrade to setter/getter syntax where possible props = { /** The amount of milliseconds a request can take before being terminated. Initially zero. Zero means there is no timeout. @property timeout @type Number @default 0 */ timeout: 0, /** Current state, can take following values: UNSENT (numeric value 0) The object has been constructed. OPENED (numeric value 1) The open() method has been successfully invoked. During this state request headers can be set using setRequestHeader() and the request can be made using the send() method. HEADERS_RECEIVED (numeric value 2) All redirects (if any) have been followed and all HTTP headers of the final response have been received. Several response members of the object are now available. LOADING (numeric value 3) The response entity body is being received. DONE (numeric value 4) @property readyState @type Number @default 0 (UNSENT) */ readyState: XMLHttpRequest.UNSENT, /** True when user credentials are to be included in a cross-origin request. False when they are to be excluded in a cross-origin request and when cookies are to be ignored in its response. Initially false. @property withCredentials @type Boolean @default false */ withCredentials: false, /** Returns the HTTP status code. @property status @type Number @default 0 */ status: 0, /** Returns the HTTP status text. @property statusText @type String */ statusText: "", /** Returns the response type. Can be set to change the response type. Values are: the empty string (default), "arraybuffer", "blob", "document", "json", and "text". @property responseType @type String */ responseType: "", /** Returns the document response entity body. Throws an "InvalidStateError" exception if responseType is not the empty string or "document". @property responseXML @type Document */ responseXML: null, /** Returns the text response entity body. Throws an "InvalidStateError" exception if responseType is not the empty string or "text". @property responseText @type String */ responseText: null, /** Returns the response entity body (http://www.w3.org/TR/XMLHttpRequest/#response-entity-body). Can become: ArrayBuffer, Blob, Document, JSON, Text @property response @type Mixed */ response: null }, _async = true, _url, _method, _headers = {}, _user, _password, _encoding = null, _mimeType = null, // flags _sync_flag = false, _send_flag = false, _upload_events_flag = false, _upload_complete_flag = false, _error_flag = false, _same_origin_flag = false, // times _start_time, _timeoutset_time, _finalMime = null, _finalCharset = null, _options = {}, _xhr, _responseHeaders = '', _responseHeadersBag ; Basic.extend(this, props, { /** Unique id of the component @property uid @type String */ uid: Basic.guid('uid_'), /** Target for Upload events @property upload @type XMLHttpRequestUpload */ upload: new XMLHttpRequestUpload(), /** Sets the request method, request URL, synchronous flag, request username, and request password. Throws a "SyntaxError" exception if one of the following is true: method is not a valid HTTP method. url cannot be resolved. url contains the "user:password" format in the userinfo production. Throws a "SecurityError" exception if method is a case-insensitive match for CONNECT, TRACE or TRACK. Throws an "InvalidAccessError" exception if one of the following is true: Either user or password is passed as argument and the origin of url does not match the XMLHttpRequest origin. There is an associated XMLHttpRequest document and either the timeout attribute is not zero, the withCredentials attribute is true, or the responseType attribute is not the empty string. @method open @param {String} method HTTP method to use on request @param {String} url URL to request @param {Boolean} [async=true] If false request will be done in synchronous manner. Asynchronous by default. @param {String} [user] Username to use in HTTP authentication process on server-side @param {String} [password] Password to use in HTTP authentication process on server-side */ open: function(method, url, async, user, password) { var urlp; // first two arguments are required if (!method || !url) { throw new x.DOMException(x.DOMException.SYNTAX_ERR); } // 2 - check if any code point in method is higher than U+00FF or after deflating method it does not match the method if (/[\u0100-\uffff]/.test(method) || Encode.utf8_encode(method) !== method) { throw new x.DOMException(x.DOMException.SYNTAX_ERR); } // 3 if (!!~Basic.inArray(method.toUpperCase(), ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'TRACE', 'TRACK'])) { _method = method.toUpperCase(); } // 4 - allowing these methods poses a security risk if (!!~Basic.inArray(_method, ['CONNECT', 'TRACE', 'TRACK'])) { throw new x.DOMException(x.DOMException.SECURITY_ERR); } // 5 url = Encode.utf8_encode(url); // 6 - Resolve url relative to the XMLHttpRequest base URL. If the algorithm returns an error, throw a "SyntaxError". urlp = Url.parseUrl(url); _same_origin_flag = Url.hasSameOrigin(urlp); // 7 - manually build up absolute url _url = Url.resolveUrl(url); // 9-10, 12-13 if ((user || password) && !_same_origin_flag) { throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR); } _user = user || urlp.user; _password = password || urlp.pass; // 11 _async = async || true; if (_async === false && (_p('timeout') || _p('withCredentials') || _p('responseType') !== "")) { throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR); } // 14 - terminate abort() // 15 - terminate send() // 18 _sync_flag = !_async; _send_flag = false; _headers = {}; _reset.call(this); // 19 _p('readyState', XMLHttpRequest.OPENED); // 20 this.convertEventPropsToHandlers(['readystatechange']); // unify event handlers this.dispatchEvent('readystatechange'); }, /** Appends an header to the list of author request headers, or if header is already in the list of author request headers, combines its value with value. Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set. Throws a "SyntaxError" exception if header is not a valid HTTP header field name or if value is not a valid HTTP header field value. @method setRequestHeader @param {String} header @param {String|Number} value */ setRequestHeader: function(header, value) { var uaHeaders = [ // these headers are controlled by the user agent "accept-charset", "accept-encoding", "access-control-request-headers", "access-control-request-method", "connection", "content-length", "cookie", "cookie2", "content-transfer-encoding", "date", "expect", "host", "keep-alive", "origin", "referer", "te", "trailer", "transfer-encoding", "upgrade", "user-agent", "via" ]; // 1-2 if (_p('readyState') !== XMLHttpRequest.OPENED || _send_flag) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 3 if (/[\u0100-\uffff]/.test(header) || Encode.utf8_encode(header) !== header) { throw new x.DOMException(x.DOMException.SYNTAX_ERR); } // 4 /* this step is seemingly bypassed in browsers, probably to allow various unicode characters in header values if (/[\u0100-\uffff]/.test(value) || Encode.utf8_encode(value) !== value) { throw new x.DOMException(x.DOMException.SYNTAX_ERR); }*/ header = Basic.trim(header).toLowerCase(); // setting of proxy-* and sec-* headers is prohibited by spec if (!!~Basic.inArray(header, uaHeaders) || /^(proxy\-|sec\-)/.test(header)) { return false; } // camelize // browsers lowercase header names (at least for custom ones) // header = header.replace(/\b\w/g, function($1) { return $1.toUpperCase(); }); if (!_headers[header]) { _headers[header] = value; } else { // http://tools.ietf.org/html/rfc2616#section-4.2 (last paragraph) _headers[header] += ', ' + value; } return true; }, /** Returns all headers from the response, with the exception of those whose field name is Set-Cookie or Set-Cookie2. @method getAllResponseHeaders @return {String} reponse headers or empty string */ getAllResponseHeaders: function() { return _responseHeaders || ''; }, /** Returns the header field value from the response of which the field name matches header, unless the field name is Set-Cookie or Set-Cookie2. @method getResponseHeader @param {String} header @return {String} value(s) for the specified header or null */ getResponseHeader: function(header) { header = header.toLowerCase(); if (_error_flag || !!~Basic.inArray(header, ['set-cookie', 'set-cookie2'])) { return null; } if (_responseHeaders && _responseHeaders !== '') { // if we didn't parse response headers until now, do it and keep for later if (!_responseHeadersBag) { _responseHeadersBag = {}; Basic.each(_responseHeaders.split(/\r\n/), function(line) { var pair = line.split(/:\s+/); if (pair.length === 2) { // last line might be empty, omit pair[0] = Basic.trim(pair[0]); // just in case _responseHeadersBag[pair[0].toLowerCase()] = { // simply to retain header name in original form header: pair[0], value: Basic.trim(pair[1]) }; } }); } if (_responseHeadersBag.hasOwnProperty(header)) { return _responseHeadersBag[header].header + ': ' + _responseHeadersBag[header].value; } } return null; }, /** Sets the Content-Type header for the response to mime. Throws an "InvalidStateError" exception if the state is LOADING or DONE. Throws a "SyntaxError" exception if mime is not a valid media type. @method overrideMimeType @param String mime Mime type to set */ overrideMimeType: function(mime) { var matches, charset; // 1 if (!!~Basic.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 2 mime = Basic.trim(mime.toLowerCase()); if (/;/.test(mime) && (matches = mime.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))) { mime = matches[1]; if (matches[2]) { charset = matches[2]; } } if (!Mime.mimes[mime]) { throw new x.DOMException(x.DOMException.SYNTAX_ERR); } // 3-4 _finalMime = mime; _finalCharset = charset; }, /** Initiates the request. The optional argument provides the request entity body. The argument is ignored if request method is GET or HEAD. Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set. @method send @param {Blob|Document|String|FormData} [data] Request entity body @param {Object} [options] Set of requirements and pre-requisities for runtime initialization */ send: function(data, options) { if (Basic.typeOf(options) === 'string') { _options = { ruid: options }; } else if (!options) { _options = {}; } else { _options = options; } this.convertEventPropsToHandlers(dispatches); this.upload.convertEventPropsToHandlers(dispatches); // 1-2 if (this.readyState !== XMLHttpRequest.OPENED || _send_flag) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 3 // sending Blob if (data instanceof Blob) { _options.ruid = data.ruid; _mimeType = data.type || 'application/octet-stream'; } // FormData else if (data instanceof FormData) { if (data.hasBlob()) { var blob = data.getBlob(); _options.ruid = blob.ruid; _mimeType = blob.type || 'application/octet-stream'; } } // DOMString else if (typeof data === 'string') { _encoding = 'UTF-8'; _mimeType = 'text/plain;charset=UTF-8'; // data should be converted to Unicode and encoded as UTF-8 data = Encode.utf8_encode(data); } // if withCredentials not set, but requested, set it automatically if (!this.withCredentials) { this.withCredentials = (_options.required_caps && _options.required_caps.send_browser_cookies) && !_same_origin_flag; } // 4 - storage mutex // 5 _upload_events_flag = (!_sync_flag && this.upload.hasEventListener()); // DSAP // 6 _error_flag = false; // 7 _upload_complete_flag = !data; // 8 - Asynchronous steps if (!_sync_flag) { // 8.1 _send_flag = true; // 8.2 // this.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr // 8.3 //if (!_upload_complete_flag) { // this.upload.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr //} } // 8.5 - Return the send() method call, but continue running the steps in this algorithm. _doXHR.call(this, data); }, /** Cancels any network activity. @method abort */ abort: function() { _error_flag = true; _sync_flag = false; if (!~Basic.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED, XMLHttpRequest.DONE])) { _p('readyState', XMLHttpRequest.DONE); _send_flag = false; if (_xhr) { _xhr.getRuntime().exec.call(_xhr, 'XMLHttpRequest', 'abort', _upload_complete_flag); } else { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } _upload_complete_flag = true; } else { _p('readyState', XMLHttpRequest.UNSENT); } }, destroy: function() { if (_xhr) { if (Basic.typeOf(_xhr.destroy) === 'function') { _xhr.destroy(); } _xhr = null; } this.unbindAll(); if (this.upload) { this.upload.unbindAll(); this.upload = null; } } }); /* this is nice, but maybe too lengthy // if supported by JS version, set getters/setters for specific properties o.defineProperty(this, 'readyState', { configurable: false, get: function() { return _p('readyState'); } }); o.defineProperty(this, 'timeout', { configurable: false, get: function() { return _p('timeout'); }, set: function(value) { if (_sync_flag) { throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR); } // timeout still should be measured relative to the start time of request _timeoutset_time = (new Date).getTime(); _p('timeout', value); } }); // the withCredentials attribute has no effect when fetching same-origin resources o.defineProperty(this, 'withCredentials', { configurable: false, get: function() { return _p('withCredentials'); }, set: function(value) { // 1-2 if (!~o.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED]) || _send_flag) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 3-4 if (_anonymous_flag || _sync_flag) { throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR); } // 5 _p('withCredentials', value); } }); o.defineProperty(this, 'status', { configurable: false, get: function() { return _p('status'); } }); o.defineProperty(this, 'statusText', { configurable: false, get: function() { return _p('statusText'); } }); o.defineProperty(this, 'responseType', { configurable: false, get: function() { return _p('responseType'); }, set: function(value) { // 1 if (!!~o.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 2 if (_sync_flag) { throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR); } // 3 _p('responseType', value.toLowerCase()); } }); o.defineProperty(this, 'responseText', { configurable: false, get: function() { // 1 if (!~o.inArray(_p('responseType'), ['', 'text'])) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 2-3 if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } return _p('responseText'); } }); o.defineProperty(this, 'responseXML', { configurable: false, get: function() { // 1 if (!~o.inArray(_p('responseType'), ['', 'document'])) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } // 2-3 if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) { throw new x.DOMException(x.DOMException.INVALID_STATE_ERR); } return _p('responseXML'); } }); o.defineProperty(this, 'response', { configurable: false, get: function() { if (!!~o.inArray(_p('responseType'), ['', 'text'])) { if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) { return ''; } } if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) { return null; } return _p('response'); } }); */ function _p(prop, value) { if (!props.hasOwnProperty(prop)) { return; } if (arguments.length === 1) { // get return Env.can('define_property') ? props[prop] : self[prop]; } else { // set if (Env.can('define_property')) { props[prop] = value; } else { self[prop] = value; } } } /* function _toASCII(str, AllowUnassigned, UseSTD3ASCIIRules) { // TODO: http://tools.ietf.org/html/rfc3490#section-4.1 return str.toLowerCase(); } */ function _doXHR(data) { var self = this; _start_time = new Date().getTime(); _xhr = new RuntimeTarget(); function loadEnd() { if (_xhr) { // it could have been destroyed by now _xhr.destroy(); _xhr = null; } self.dispatchEvent('loadend'); self = null; } function exec(runtime) { _xhr.bind('LoadStart', function(e) { _p('readyState', XMLHttpRequest.LOADING); self.dispatchEvent('readystatechange'); self.dispatchEvent(e); if (_upload_events_flag) { self.upload.dispatchEvent(e); } }); _xhr.bind('Progress', function(e) { if (_p('readyState') !== XMLHttpRequest.LOADING) { _p('readyState', XMLHttpRequest.LOADING); // LoadStart unreliable (in Flash for example) self.dispatchEvent('readystatechange'); } self.dispatchEvent(e); }); _xhr.bind('UploadProgress', function(e) { if (_upload_events_flag) { self.upload.dispatchEvent({ type: 'progress', lengthComputable: false, total: e.total, loaded: e.loaded }); } }); _xhr.bind('Load', function(e) { _p('readyState', XMLHttpRequest.DONE); _p('status', Number(runtime.exec.call(_xhr, 'XMLHttpRequest', 'getStatus') || 0)); _p('statusText', httpCode[_p('status')] || ""); _p('response', runtime.exec.call(_xhr, 'XMLHttpRequest', 'getResponse', _p('responseType'))); if (!!~Basic.inArray(_p('responseType'), ['text', ''])) { _p('responseText', _p('response')); } else if (_p('responseType') === 'document') { _p('responseXML', _p('response')); } _responseHeaders = runtime.exec.call(_xhr, 'XMLHttpRequest', 'getAllResponseHeaders'); self.dispatchEvent('readystatechange'); if (_p('status') > 0) { // status 0 usually means that server is unreachable if (_upload_events_flag) { self.upload.dispatchEvent(e); } self.dispatchEvent(e); } else { _error_flag = true; self.dispatchEvent('error'); } loadEnd(); }); _xhr.bind('Abort', function(e) { self.dispatchEvent(e); loadEnd(); }); _xhr.bind('Error', function(e) { _error_flag = true; _p('readyState', XMLHttpRequest.DONE); self.dispatchEvent('readystatechange'); _upload_complete_flag = true; self.dispatchEvent(e); loadEnd(); }); runtime.exec.call(_xhr, 'XMLHttpRequest', 'send', { url: _url, method: _method, async: _async, user: _user, password: _password, headers: _headers, mimeType: _mimeType, encoding: _encoding, responseType: self.responseType, withCredentials: self.withCredentials, options: _options }, data); } // clarify our requirements if (typeof(_options.required_caps) === 'string') { _options.required_caps = Runtime.parseCaps(_options.required_caps); } _options.required_caps = Basic.extend({}, _options.required_caps, { return_response_type: self.responseType }); if (data instanceof FormData) { _options.required_caps.send_multipart = true; } if (!_same_origin_flag) { _options.required_caps.do_cors = true; } if (_options.ruid) { // we do not need to wait if we can connect directly exec(_xhr.connectRuntime(_options)); } else { _xhr.bind('RuntimeInit', function(e, runtime) { exec(runtime); }); _xhr.bind('RuntimeError', function(e, err) { self.dispatchEvent('RuntimeError', err); }); _xhr.connectRuntime(_options); } } function _reset() { _p('responseText', ""); _p('responseXML', null); _p('response', null); _p('status', 0); _p('statusText', ""); _start_time = _timeoutset_time = null; } } XMLHttpRequest.UNSENT = 0; XMLHttpRequest.OPENED = 1; XMLHttpRequest.HEADERS_RECEIVED = 2; XMLHttpRequest.LOADING = 3; XMLHttpRequest.DONE = 4; XMLHttpRequest.prototype = EventTarget.instance; return XMLHttpRequest; }); // Included from: src/javascript/runtime/flash/Runtime.js /** * Runtime.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /*global ActiveXObject:true */ /** Defines constructor for Flash runtime. @class moxie/runtime/flash/Runtime @private */ define("moxie/runtime/flash/Runtime", [ "moxie/core/utils/Basic", "moxie/core/utils/Env", "moxie/core/utils/Dom", "moxie/core/Exceptions", "moxie/runtime/Runtime" ], function(Basic, Env, Dom, x, Runtime) { var type = 'flash', extensions = {}; /** Get the version of the Flash Player @method getShimVersion @private @return {Number} Flash Player version */ function getShimVersion() { var version; try { version = navigator.plugins['Shockwave Flash']; version = version.description; } catch (e1) { try { version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version'); } catch (e2) { version = '0.0'; } } version = version.match(/\d+/g); return parseFloat(version[0] + '.' + version[1]); } /** Constructor for the Flash Runtime @class FlashRuntime @extends Runtime */ function FlashRuntime(options) { var I = this, initTimer; options = Basic.extend({ swf_url: Env.swf_url }, options); Runtime.call(this, options, type, { access_binary: function(value) { return value && I.mode === 'browser'; }, access_image_binary: function(value) { return value && I.mode === 'browser'; }, display_media: Runtime.capTrue, do_cors: Runtime.capTrue, drag_and_drop: false, report_upload_progress: function() { return I.mode === 'client'; }, resize_image: Runtime.capTrue, return_response_headers: false, return_response_type: function(responseType) { if (responseType === 'json' && !!window.JSON) { return true; } return !Basic.arrayDiff(responseType, ['', 'text', 'document']) || I.mode === 'browser'; }, return_status_code: function(code) { return I.mode === 'browser' || !Basic.arrayDiff(code, [200, 404]); }, select_file: Runtime.capTrue, select_multiple: Runtime.capTrue, send_binary_string: function(value) { return value && I.mode === 'browser'; }, send_browser_cookies: function(value) { return value && I.mode === 'browser'; }, send_custom_headers: function(value) { return value && I.mode === 'browser'; }, send_multipart: Runtime.capTrue, slice_blob: function(value) { return value && I.mode === 'browser'; }, stream_upload: function(value) { return value && I.mode === 'browser'; }, summon_file_dialog: false, upload_filesize: function(size) { return Basic.parseSizeStr(size) <= 2097152 || I.mode === 'client'; }, use_http_method: function(methods) { return !Basic.arrayDiff(methods, ['GET', 'POST']); } }, { // capabilities that require specific mode access_binary: function(value) { return value ? 'browser' : 'client'; }, access_image_binary: function(value) { return value ? 'browser' : 'client'; }, report_upload_progress: function(value) { return value ? 'browser' : 'client'; }, return_response_type: function(responseType) { return Basic.arrayDiff(responseType, ['', 'text', 'json', 'document']) ? 'browser' : ['client', 'browser']; }, return_status_code: function(code) { return Basic.arrayDiff(code, [200, 404]) ? 'browser' : ['client', 'browser']; }, send_binary_string: function(value) { return value ? 'browser' : 'client'; }, send_browser_cookies: function(value) { return value ? 'browser' : 'client'; }, send_custom_headers: function(value) { return value ? 'browser' : 'client'; }, stream_upload: function(value) { return value ? 'client' : 'browser'; }, upload_filesize: function(size) { return Basic.parseSizeStr(size) >= 2097152 ? 'client' : 'browser'; } }, 'client'); // minimal requirement for Flash Player version if (getShimVersion() < 10) { this.mode = false; // with falsy mode, runtime won't operable, no matter what the mode was before } Basic.extend(this, { getShim: function() { return Dom.get(this.uid); }, shimExec: function(component, action) { var args = [].slice.call(arguments, 2); return I.getShim().exec(this.uid, component, action, args); }, init: function() { var html, el, container; container = this.getShimContainer(); // if not the minimal height, shims are not initialized in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc) Basic.extend(container.style, { position: 'absolute', top: '-8px', left: '-8px', width: '9px', height: '9px', overflow: 'hidden' }); // insert flash object html = '<object id="' + this.uid + '" type="application/x-shockwave-flash" data="' + options.swf_url + '" '; if (Env.browser === 'IE') { html += 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" '; } html += 'width="100%" height="100%" style="outline:0">' + '<param name="movie" value="' + options.swf_url + '" />' + '<param name="flashvars" value="uid=' + escape(this.uid) + '&target=' + Env.global_event_dispatcher + '" />' + '<param name="wmode" value="transparent" />' + '<param name="allowscriptaccess" value="always" />' + '</object>'; if (Env.browser === 'IE') { el = document.createElement('div'); container.appendChild(el); el.outerHTML = html; el = container = null; // just in case } else { container.innerHTML = html; } // Init is dispatched by the shim initTimer = setTimeout(function() { if (I && !I.initialized) { // runtime might be already destroyed by this moment I.trigger("Error", new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR)); } }, 5000); }, destroy: (function(destroy) { // extend default destroy method return function() { destroy.call(I); clearTimeout(initTimer); // initialization check might be still onwait options = initTimer = destroy = I = null; }; }(this.destroy)) }, extensions); } Runtime.addConstructor(type, FlashRuntime); return extensions; }); // Included from: src/javascript/runtime/flash/file/Blob.js /** * Blob.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/flash/file/Blob @private */ define("moxie/runtime/flash/file/Blob", [ "moxie/runtime/flash/Runtime", "moxie/file/Blob" ], function(extensions, Blob) { var FlashBlob = { slice: function(blob, start, end, type) { var self = this.getRuntime(); if (start < 0) { start = Math.max(blob.size + start, 0); } else if (start > 0) { start = Math.min(start, blob.size); } if (end < 0) { end = Math.max(blob.size + end, 0); } else if (end > 0) { end = Math.min(end, blob.size); } blob = self.shimExec.call(this, 'Blob', 'slice', start, end, type || ''); if (blob) { blob = new Blob(self.uid, blob); } return blob; } }; return (extensions.Blob = FlashBlob); }); // Included from: src/javascript/runtime/flash/file/FileInput.js /** * FileInput.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/flash/file/FileInput @private */ define("moxie/runtime/flash/file/FileInput", [ "moxie/runtime/flash/Runtime" ], function(extensions) { var FileInput = { init: function(options) { this.getRuntime().shimExec.call(this, 'FileInput', 'init', { name: options.name, accept: options.accept, multiple: options.multiple }); this.trigger('ready'); } }; return (extensions.FileInput = FileInput); }); // Included from: src/javascript/runtime/flash/file/FileReader.js /** * FileReader.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/flash/file/FileReader @private */ define("moxie/runtime/flash/file/FileReader", [ "moxie/runtime/flash/Runtime", "moxie/core/utils/Encode" ], function(extensions, Encode) { var _result = ''; function _formatData(data, op) { switch (op) { case 'readAsText': return Encode.atob(data, 'utf8'); case 'readAsBinaryString': return Encode.atob(data); case 'readAsDataURL': return data; } return null; } var FileReader = { read: function(op, blob) { var target = this, self = target.getRuntime(); // special prefix for DataURL read mode if (op === 'readAsDataURL') { _result = 'data:' + (blob.type || '') + ';base64,'; } target.bind('Progress', function(e, data) { if (data) { _result += _formatData(data, op); } }); return self.shimExec.call(this, 'FileReader', 'readAsBase64', blob.uid); }, getResult: function() { return _result; }, destroy: function() { _result = null; } }; return (extensions.FileReader = FileReader); }); // Included from: src/javascript/runtime/flash/file/FileReaderSync.js /** * FileReaderSync.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/flash/file/FileReaderSync @private */ define("moxie/runtime/flash/file/FileReaderSync", [ "moxie/runtime/flash/Runtime", "moxie/core/utils/Encode" ], function(extensions, Encode) { function _formatData(data, op) { switch (op) { case 'readAsText': return Encode.atob(data, 'utf8'); case 'readAsBinaryString': return Encode.atob(data); case 'readAsDataURL': return data; } return null; } var FileReaderSync = { read: function(op, blob) { var result, self = this.getRuntime(); result = self.shimExec.call(this, 'FileReaderSync', 'readAsBase64', blob.uid); if (!result) { return null; // or throw ex } // special prefix for DataURL read mode if (op === 'readAsDataURL') { result = 'data:' + (blob.type || '') + ';base64,' + result; } return _formatData(result, op, blob.type); } }; return (extensions.FileReaderSync = FileReaderSync); }); // Included from: src/javascript/runtime/Transporter.js /** * Transporter.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define("moxie/runtime/Transporter", [ "moxie/core/utils/Basic", "moxie/core/utils/Encode", "moxie/runtime/RuntimeClient", "moxie/core/EventTarget" ], function(Basic, Encode, RuntimeClient, EventTarget) { function Transporter() { var mod, _runtime, _data, _size, _pos, _chunk_size; RuntimeClient.call(this); Basic.extend(this, { uid: Basic.guid('uid_'), state: Transporter.IDLE, result: null, transport: function(data, type, options) { var self = this; options = Basic.extend({ chunk_size: 204798 }, options); // should divide by three, base64 requires this if ((mod = options.chunk_size % 3)) { options.chunk_size += 3 - mod; } _chunk_size = options.chunk_size; _reset.call(this); _data = data; _size = data.length; if (Basic.typeOf(options) === 'string' || options.ruid) { _run.call(self, type, this.connectRuntime(options)); } else { // we require this to run only once var cb = function(e, runtime) { self.unbind("RuntimeInit", cb); _run.call(self, type, runtime); }; this.bind("RuntimeInit", cb); this.connectRuntime(options); } }, abort: function() { var self = this; self.state = Transporter.IDLE; if (_runtime) { _runtime.exec.call(self, 'Transporter', 'clear'); self.trigger("TransportingAborted"); } _reset.call(self); }, destroy: function() { this.unbindAll(); _runtime = null; this.disconnectRuntime(); _reset.call(this); } }); function _reset() { _size = _pos = 0; _data = this.result = null; } function _run(type, runtime) { var self = this; _runtime = runtime; //self.unbind("RuntimeInit"); self.bind("TransportingProgress", function(e) { _pos = e.loaded; if (_pos < _size && Basic.inArray(self.state, [Transporter.IDLE, Transporter.DONE]) === -1) { _transport.call(self); } }, 999); self.bind("TransportingComplete", function() { _pos = _size; self.state = Transporter.DONE; _data = null; // clean a bit self.result = _runtime.exec.call(self, 'Transporter', 'getAsBlob', type || ''); }, 999); self.state = Transporter.BUSY; self.trigger("TransportingStarted"); _transport.call(self); } function _transport() { var self = this, chunk, bytesLeft = _size - _pos; if (_chunk_size > bytesLeft) { _chunk_size = bytesLeft; } chunk = Encode.btoa(_data.substr(_pos, _chunk_size)); _runtime.exec.call(self, 'Transporter', 'receive', chunk, _size); } } Transporter.IDLE = 0; Transporter.BUSY = 1; Transporter.DONE = 2; Transporter.prototype = EventTarget.instance; return Transporter; }); // Included from: src/javascript/runtime/flash/xhr/XMLHttpRequest.js /** * XMLHttpRequest.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/flash/xhr/XMLHttpRequest @private */ define("moxie/runtime/flash/xhr/XMLHttpRequest", [ "moxie/runtime/flash/Runtime", "moxie/core/utils/Basic", "moxie/file/Blob", "moxie/file/File", "moxie/file/FileReaderSync", "moxie/xhr/FormData", "moxie/runtime/Transporter" ], function(extensions, Basic, Blob, File, FileReaderSync, FormData, Transporter) { var XMLHttpRequest = { send: function(meta, data) { var target = this, self = target.getRuntime(); function send() { meta.transport = self.mode; self.shimExec.call(target, 'XMLHttpRequest', 'send', meta, data); } function appendBlob(name, blob) { self.shimExec.call(target, 'XMLHttpRequest', 'appendBlob', name, blob.uid); data = null; send(); } function attachBlob(blob, cb) { var tr = new Transporter(); tr.bind("TransportingComplete", function() { cb(this.result); }); tr.transport(blob.getSource(), blob.type, { ruid: self.uid }); } // copy over the headers if any if (!Basic.isEmptyObj(meta.headers)) { Basic.each(meta.headers, function(value, header) { self.shimExec.call(target, 'XMLHttpRequest', 'setRequestHeader', header, value.toString()); // Silverlight doesn't accept integers into the arguments of type object }); } // transfer over multipart params and blob itself if (data instanceof FormData) { var blobField; data.each(function(value, name) { if (value instanceof Blob) { blobField = name; } else { self.shimExec.call(target, 'XMLHttpRequest', 'append', name, value); } }); if (!data.hasBlob()) { data = null; send(); } else { var blob = data.getBlob(); if (blob.isDetached()) { attachBlob(blob, function(attachedBlob) { blob.destroy(); appendBlob(blobField, attachedBlob); }); } else { appendBlob(blobField, blob); } } } else if (data instanceof Blob) { if (data.isDetached()) { attachBlob(data, function(attachedBlob) { data.destroy(); data = attachedBlob.uid; send(); }); } else { data = data.uid; send(); } } else { send(); } }, getResponse: function(responseType) { var frs, blob, self = this.getRuntime(); blob = self.shimExec.call(this, 'XMLHttpRequest', 'getResponseAsBlob'); if (blob) { blob = new File(self.uid, blob); if ('blob' === responseType) { return blob; } try { frs = new FileReaderSync(); if (!!~Basic.inArray(responseType, ["", "text"])) { return frs.readAsText(blob); } else if ('json' === responseType && !!window.JSON) { return JSON.parse(frs.readAsText(blob)); } } finally { blob.destroy(); } } return null; }, abort: function(upload_complete_flag) { var self = this.getRuntime(); self.shimExec.call(this, 'XMLHttpRequest', 'abort'); this.dispatchEvent('readystatechange'); // this.dispatchEvent('progress'); this.dispatchEvent('abort'); //if (!upload_complete_flag) { // this.dispatchEvent('uploadprogress'); //} } }; return (extensions.XMLHttpRequest = XMLHttpRequest); }); // Included from: src/javascript/runtime/html4/Runtime.js /** * Runtime.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /*global File:true */ /** Defines constructor for HTML4 runtime. @class moxie/runtime/html4/Runtime @private */ define("moxie/runtime/html4/Runtime", [ "moxie/core/utils/Basic", "moxie/core/Exceptions", "moxie/runtime/Runtime", "moxie/core/utils/Env" ], function(Basic, x, Runtime, Env) { var type = 'html4', extensions = {}; function Html4Runtime(options) { var I = this , Test = Runtime.capTest , True = Runtime.capTrue ; Runtime.call(this, options, type, { access_binary: Test(window.FileReader || window.File && File.getAsDataURL), access_image_binary: false, display_media: Test(extensions.Image && (Env.can('create_canvas') || Env.can('use_data_uri_over32kb'))), do_cors: false, drag_and_drop: false, filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest return (Env.browser === 'Chrome' && Env.version >= 28) || (Env.browser === 'IE' && Env.version >= 10); }()), resize_image: function() { return extensions.Image && I.can('access_binary') && Env.can('create_canvas'); }, report_upload_progress: false, return_response_headers: false, return_response_type: function(responseType) { if (responseType === 'json' && !!window.JSON) { return true; } return !!~Basic.inArray(responseType, ['text', 'document', '']); }, return_status_code: function(code) { return !Basic.arrayDiff(code, [200, 404]); }, select_file: function() { return Env.can('use_fileinput'); }, select_multiple: false, send_binary_string: false, send_custom_headers: false, send_multipart: true, slice_blob: false, stream_upload: function() { return I.can('select_file'); }, summon_file_dialog: Test(function() { // yeah... some dirty sniffing here... return (Env.browser === 'Firefox' && Env.version >= 4) || (Env.browser === 'Opera' && Env.version >= 12) || !!~Basic.inArray(Env.browser, ['Chrome', 'Safari']); }()), upload_filesize: True, use_http_method: function(methods) { return !Basic.arrayDiff(methods, ['GET', 'POST']); } }); Basic.extend(this, { init : function() { this.trigger("Init"); }, destroy: (function(destroy) { // extend default destroy method return function() { destroy.call(I); destroy = I = null; }; }(this.destroy)) }); Basic.extend(this.getShim(), extensions); } Runtime.addConstructor(type, Html4Runtime); return extensions; }); // Included from: src/javascript/core/utils/Events.js /** * Events.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ define('moxie/core/utils/Events', [ 'moxie/core/utils/Basic' ], function(Basic) { var eventhash = {}, uid = 'moxie_' + Basic.guid(); // IE W3C like event funcs function preventDefault() { this.returnValue = false; } function stopPropagation() { this.cancelBubble = true; } /** Adds an event handler to the specified object and store reference to the handler in objects internal Plupload registry (@see removeEvent). @method addEvent @for Utils @static @param {Object} obj DOM element like object to add handler to. @param {String} name Name to add event listener to. @param {Function} callback Function to call when event occurs. @param {String} [key] that might be used to add specifity to the event record. */ var addEvent = function(obj, name, callback, key) { var func, events; name = name.toLowerCase(); // Add event listener if (obj.addEventListener) { func = callback; obj.addEventListener(name, func, false); } else if (obj.attachEvent) { func = function() { var evt = window.event; if (!evt.target) { evt.target = evt.srcElement; } evt.preventDefault = preventDefault; evt.stopPropagation = stopPropagation; callback(evt); }; obj.attachEvent('on' + name, func); } // Log event handler to objects internal mOxie registry if (!obj[uid]) { obj[uid] = Basic.guid(); } if (!eventhash.hasOwnProperty(obj[uid])) { eventhash[obj[uid]] = {}; } events = eventhash[obj[uid]]; if (!events.hasOwnProperty(name)) { events[name] = []; } events[name].push({ func: func, orig: callback, // store original callback for IE key: key }); }; /** Remove event handler from the specified object. If third argument (callback) is not specified remove all events with the specified name. @method removeEvent @static @param {Object} obj DOM element to remove event listener(s) from. @param {String} name Name of event listener to remove. @param {Function|String} [callback] might be a callback or unique key to match. */ var removeEvent = function(obj, name, callback) { var type, undef; name = name.toLowerCase(); if (obj[uid] && eventhash[obj[uid]] && eventhash[obj[uid]][name]) { type = eventhash[obj[uid]][name]; } else { return; } for (var i = type.length - 1; i >= 0; i--) { // undefined or not, key should match if (type[i].orig === callback || type[i].key === callback) { if (obj.removeEventListener) { obj.removeEventListener(name, type[i].func, false); } else if (obj.detachEvent) { obj.detachEvent('on'+name, type[i].func); } type[i].orig = null; type[i].func = null; type.splice(i, 1); // If callback was passed we are done here, otherwise proceed if (callback !== undef) { break; } } } // If event array got empty, remove it if (!type.length) { delete eventhash[obj[uid]][name]; } // If mOxie registry has become empty, remove it if (Basic.isEmptyObj(eventhash[obj[uid]])) { delete eventhash[obj[uid]]; // IE doesn't let you remove DOM object property with - delete try { delete obj[uid]; } catch(e) { obj[uid] = undef; } } }; /** Remove all kind of events from the specified object @method removeAllEvents @static @param {Object} obj DOM element to remove event listeners from. @param {String} [key] unique key to match, when removing events. */ var removeAllEvents = function(obj, key) { if (!obj || !obj[uid]) { return; } Basic.each(eventhash[obj[uid]], function(events, name) { removeEvent(obj, name, key); }); }; return { addEvent: addEvent, removeEvent: removeEvent, removeAllEvents: removeAllEvents }; }); // Included from: src/javascript/runtime/html4/file/FileInput.js /** * FileInput.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html4/file/FileInput @private */ define("moxie/runtime/html4/file/FileInput", [ "moxie/runtime/html4/Runtime", "moxie/core/utils/Basic", "moxie/core/utils/Dom", "moxie/core/utils/Events", "moxie/core/utils/Mime", "moxie/core/utils/Env" ], function(extensions, Basic, Dom, Events, Mime, Env) { function FileInput() { var _uid, _files = [], _mimes = [], _options; function addInput() { var comp = this, I = comp.getRuntime(), shimContainer, browseButton, currForm, form, input, uid; uid = Basic.guid('uid_'); shimContainer = I.getShimContainer(); // we get new ref everytime to avoid memory leaks in IE if (_uid) { // move previous form out of the view currForm = Dom.get(_uid + '_form'); if (currForm) { Basic.extend(currForm.style, { top: '100%' }); } } // build form in DOM, since innerHTML version not able to submit file for some reason form = document.createElement('form'); form.setAttribute('id', uid + '_form'); form.setAttribute('method', 'post'); form.setAttribute('enctype', 'multipart/form-data'); form.setAttribute('encoding', 'multipart/form-data'); Basic.extend(form.style, { overflow: 'hidden', position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }); input = document.createElement('input'); input.setAttribute('id', uid); input.setAttribute('type', 'file'); input.setAttribute('name', _options.name || 'Filedata'); input.setAttribute('accept', _mimes.join(',')); Basic.extend(input.style, { fontSize: '999px', opacity: 0 }); form.appendChild(input); shimContainer.appendChild(form); // prepare file input to be placed underneath the browse_button element Basic.extend(input.style, { position: 'absolute', top: 0, left: 0, width: '100%', height: '100%' }); if (Env.browser === 'IE' && Env.version < 10) { Basic.extend(input.style, { filter : "progid:DXImageTransform.Microsoft.Alpha(opacity=0)" }); } input.onchange = function() { // there should be only one handler for this var file; if (!this.value) { return; } if (this.files) { file = this.files[0]; } else { file = { name: this.value }; } _files = [file]; this.onchange = function() {}; // clear event handler addInput.call(comp); // after file is initialized as o.File, we need to update form and input ids comp.bind('change', function onChange() { var input = Dom.get(uid), form = Dom.get(uid + '_form'), file; comp.unbind('change', onChange); if (comp.files.length && input && form) { file = comp.files[0]; input.setAttribute('id', file.uid); form.setAttribute('id', file.uid + '_form'); // set upload target form.setAttribute('target', file.uid + '_iframe'); } input = form = null; }, 998); input = form = null; comp.trigger('change'); }; // route click event to the input if (I.can('summon_file_dialog')) { browseButton = Dom.get(_options.browse_button); Events.removeEvent(browseButton, 'click', comp.uid); Events.addEvent(browseButton, 'click', function(e) { if (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file] input.click(); } e.preventDefault(); }, comp.uid); } _uid = uid; shimContainer = currForm = browseButton = null; } Basic.extend(this, { init: function(options) { var comp = this, I = comp.getRuntime(), shimContainer; // figure out accept string _options = options; _mimes = options.accept.mimes || Mime.extList2mimes(options.accept, I.can('filter_by_extension')); shimContainer = I.getShimContainer(); (function() { var browseButton, zIndex, top; browseButton = Dom.get(options.browse_button); // Route click event to the input[type=file] element for browsers that support such behavior if (I.can('summon_file_dialog')) { if (Dom.getStyle(browseButton, 'position') === 'static') { browseButton.style.position = 'relative'; } zIndex = parseInt(Dom.getStyle(browseButton, 'z-index'), 10) || 1; browseButton.style.zIndex = zIndex; shimContainer.style.zIndex = zIndex - 1; } /* Since we have to place input[type=file] on top of the browse_button for some browsers, browse_button loses interactivity, so we restore it here */ top = I.can('summon_file_dialog') ? browseButton : shimContainer; Events.addEvent(top, 'mouseover', function() { comp.trigger('mouseenter'); }, comp.uid); Events.addEvent(top, 'mouseout', function() { comp.trigger('mouseleave'); }, comp.uid); Events.addEvent(top, 'mousedown', function() { comp.trigger('mousedown'); }, comp.uid); Events.addEvent(Dom.get(options.container), 'mouseup', function() { comp.trigger('mouseup'); }, comp.uid); browseButton = null; }()); addInput.call(this); shimContainer = null; // trigger ready event asynchronously comp.trigger({ type: 'ready', async: true }); }, getFiles: function() { return _files; }, disable: function(state) { var input; if ((input = Dom.get(_uid))) { input.disabled = !!state; } }, destroy: function() { var I = this.getRuntime() , shim = I.getShim() , shimContainer = I.getShimContainer() ; Events.removeAllEvents(shimContainer, this.uid); Events.removeAllEvents(_options && Dom.get(_options.container), this.uid); Events.removeAllEvents(_options && Dom.get(_options.browse_button), this.uid); if (shimContainer) { shimContainer.innerHTML = ''; } shim.removeInstance(this.uid); _uid = _files = _mimes = _options = shimContainer = shim = null; } }); } return (extensions.FileInput = FileInput); }); // Included from: src/javascript/runtime/html5/Runtime.js /** * Runtime.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /*global File:true */ /** Defines constructor for HTML5 runtime. @class moxie/runtime/html5/Runtime @private */ define("moxie/runtime/html5/Runtime", [ "moxie/core/utils/Basic", "moxie/core/Exceptions", "moxie/runtime/Runtime", "moxie/core/utils/Env" ], function(Basic, x, Runtime, Env) { var type = "html5", extensions = {}; function Html5Runtime(options) { var I = this , Test = Runtime.capTest , True = Runtime.capTrue ; var caps = Basic.extend({ access_binary: Test(window.FileReader || window.File && window.File.getAsDataURL), access_image_binary: function() { return I.can('access_binary') && !!extensions.Image; }, display_media: Test(Env.can('create_canvas') || Env.can('use_data_uri_over32kb')), do_cors: Test(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()), drag_and_drop: Test(function() { // this comes directly from Modernizr: http://www.modernizr.com/ var div = document.createElement('div'); // IE has support for drag and drop since version 5, but doesn't support dropping files from desktop return (('draggable' in div) || ('ondragstart' in div && 'ondrop' in div)) && (Env.browser !== 'IE' || Env.version > 9); }()), filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest return (Env.browser === 'Chrome' && Env.version >= 28) || (Env.browser === 'IE' && Env.version >= 10); }()), return_response_headers: True, return_response_type: function(responseType) { if (responseType === 'json' && !!window.JSON) { // we can fake this one even if it's not supported return true; } return Env.can('return_response_type', responseType); }, return_status_code: True, report_upload_progress: Test(window.XMLHttpRequest && new XMLHttpRequest().upload), resize_image: function() { return I.can('access_binary') && Env.can('create_canvas'); }, select_file: function() { return Env.can('use_fileinput') && window.File; }, select_folder: function() { return I.can('select_file') && Env.browser === 'Chrome' && Env.version >= 21; }, select_multiple: function() { // it is buggy on Safari Windows and iOS return I.can('select_file') && !(Env.browser === 'Safari' && Env.os === 'Windows') && !(Env.os === 'iOS' && Env.verComp(Env.osVersion, "7.0.4", '<')); }, send_binary_string: Test(window.XMLHttpRequest && (new XMLHttpRequest().sendAsBinary || (window.Uint8Array && window.ArrayBuffer))), send_custom_headers: Test(window.XMLHttpRequest), send_multipart: function() { return !!(window.XMLHttpRequest && new XMLHttpRequest().upload && window.FormData) || I.can('send_binary_string'); }, slice_blob: Test(window.File && (File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice)), stream_upload: function(){ return I.can('slice_blob') && I.can('send_multipart'); }, summon_file_dialog: Test(function() { // yeah... some dirty sniffing here... return (Env.browser === 'Firefox' && Env.version >= 4) || (Env.browser === 'Opera' && Env.version >= 12) || (Env.browser === 'IE' && Env.version >= 10) || !!~Basic.inArray(Env.browser, ['Chrome', 'Safari']); }()), upload_filesize: True }, arguments[2] ); Runtime.call(this, options, (arguments[1] || type), caps); Basic.extend(this, { init : function() { this.trigger("Init"); }, destroy: (function(destroy) { // extend default destroy method return function() { destroy.call(I); destroy = I = null; }; }(this.destroy)) }); Basic.extend(this.getShim(), extensions); } Runtime.addConstructor(type, Html5Runtime); return extensions; }); // Included from: src/javascript/runtime/html5/file/FileReader.js /** * FileReader.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html5/file/FileReader @private */ define("moxie/runtime/html5/file/FileReader", [ "moxie/runtime/html5/Runtime", "moxie/core/utils/Encode", "moxie/core/utils/Basic" ], function(extensions, Encode, Basic) { function FileReader() { var _fr, _convertToBinary = false; Basic.extend(this, { read: function(op, blob) { var target = this; _fr = new window.FileReader(); _fr.addEventListener('progress', function(e) { target.trigger(e); }); _fr.addEventListener('load', function(e) { target.trigger(e); }); _fr.addEventListener('error', function(e) { target.trigger(e, _fr.error); }); _fr.addEventListener('loadend', function() { _fr = null; }); if (Basic.typeOf(_fr[op]) === 'function') { _convertToBinary = false; _fr[op](blob.getSource()); } else if (op === 'readAsBinaryString') { // readAsBinaryString is depricated in general and never existed in IE10+ _convertToBinary = true; _fr.readAsDataURL(blob.getSource()); } }, getResult: function() { return _fr && _fr.result ? (_convertToBinary ? _toBinary(_fr.result) : _fr.result) : null; }, abort: function() { if (_fr) { _fr.abort(); } }, destroy: function() { _fr = null; } }); function _toBinary(str) { return Encode.atob(str.substring(str.indexOf('base64,') + 7)); } } return (extensions.FileReader = FileReader); }); // Included from: src/javascript/runtime/html4/file/FileReader.js /** * FileReader.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html4/file/FileReader @private */ define("moxie/runtime/html4/file/FileReader", [ "moxie/runtime/html4/Runtime", "moxie/runtime/html5/file/FileReader" ], function(extensions, FileReader) { return (extensions.FileReader = FileReader); }); // Included from: src/javascript/runtime/html4/xhr/XMLHttpRequest.js /** * XMLHttpRequest.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/html4/xhr/XMLHttpRequest @private */ define("moxie/runtime/html4/xhr/XMLHttpRequest", [ "moxie/runtime/html4/Runtime", "moxie/core/utils/Basic", "moxie/core/utils/Dom", "moxie/core/utils/Url", "moxie/core/Exceptions", "moxie/core/utils/Events", "moxie/file/Blob", "moxie/xhr/FormData" ], function(extensions, Basic, Dom, Url, x, Events, Blob, FormData) { function XMLHttpRequest() { var _status, _response, _iframe; function cleanup(cb) { var target = this, uid, form, inputs, i, hasFile = false; if (!_iframe) { return; } uid = _iframe.id.replace(/_iframe$/, ''); form = Dom.get(uid + '_form'); if (form) { inputs = form.getElementsByTagName('input'); i = inputs.length; while (i--) { switch (inputs[i].getAttribute('type')) { case 'hidden': inputs[i].parentNode.removeChild(inputs[i]); break; case 'file': hasFile = true; // flag the case for later break; } } inputs = []; if (!hasFile) { // we need to keep the form for sake of possible retries form.parentNode.removeChild(form); } form = null; } // without timeout, request is marked as canceled (in console) setTimeout(function() { Events.removeEvent(_iframe, 'load', target.uid); if (_iframe.parentNode) { // #382 _iframe.parentNode.removeChild(_iframe); } // check if shim container has any other children, if - not, remove it as well var shimContainer = target.getRuntime().getShimContainer(); if (!shimContainer.children.length) { shimContainer.parentNode.removeChild(shimContainer); } shimContainer = _iframe = null; cb(); }, 1); } Basic.extend(this, { send: function(meta, data) { var target = this, I = target.getRuntime(), uid, form, input, blob; _status = _response = null; function createIframe() { var container = I.getShimContainer() || document.body , temp = document.createElement('div') ; // IE 6 won't be able to set the name using setAttribute or iframe.name temp.innerHTML = '<iframe id="' + uid + '_iframe" name="' + uid + '_iframe" src="javascript:&quot;&quot;" style="display:none"></iframe>'; _iframe = temp.firstChild; container.appendChild(_iframe); /* _iframe.onreadystatechange = function() { console.info(_iframe.readyState); };*/ Events.addEvent(_iframe, 'load', function() { // _iframe.onload doesn't work in IE lte 8 var el; try { el = _iframe.contentWindow.document || _iframe.contentDocument || window.frames[_iframe.id].document; // try to detect some standard error pages if (/^4(0[0-9]|1[0-7]|2[2346])\s/.test(el.title)) { // test if title starts with 4xx HTTP error _status = el.title.replace(/^(\d+).*$/, '$1'); } else { _status = 200; // get result _response = Basic.trim(el.body.innerHTML); // we need to fire these at least once target.trigger({ type: 'progress', loaded: _response.length, total: _response.length }); if (blob) { // if we were uploading a file target.trigger({ type: 'uploadprogress', loaded: blob.size || 1025, total: blob.size || 1025 }); } } } catch (ex) { if (Url.hasSameOrigin(meta.url)) { // if response is sent with error code, iframe in IE gets redirected to res://ieframe.dll/http_x.htm // which obviously results to cross domain error (wtf?) _status = 404; } else { cleanup.call(target, function() { target.trigger('error'); }); return; } } cleanup.call(target, function() { target.trigger('load'); }); }, target.uid); } // end createIframe // prepare data to be sent and convert if required if (data instanceof FormData && data.hasBlob()) { blob = data.getBlob(); uid = blob.uid; input = Dom.get(uid); form = Dom.get(uid + '_form'); if (!form) { throw new x.DOMException(x.DOMException.NOT_FOUND_ERR); } } else { uid = Basic.guid('uid_'); form = document.createElement('form'); form.setAttribute('id', uid + '_form'); form.setAttribute('method', meta.method); form.setAttribute('enctype', 'multipart/form-data'); form.setAttribute('encoding', 'multipart/form-data'); form.setAttribute('target', uid + '_iframe'); I.getShimContainer().appendChild(form); } if (data instanceof FormData) { data.each(function(value, name) { if (value instanceof Blob) { if (input) { input.setAttribute('name', name); } } else { var hidden = document.createElement('input'); Basic.extend(hidden, { type : 'hidden', name : name, value : value }); // make sure that input[type="file"], if it's there, comes last if (input) { form.insertBefore(hidden, input); } else { form.appendChild(hidden); } } }); } // set destination url form.setAttribute("action", meta.url); createIframe(); form.submit(); target.trigger('loadstart'); }, getStatus: function() { return _status; }, getResponse: function(responseType) { if ('json' === responseType) { // strip off <pre>..</pre> tags that might be enclosing the response if (Basic.typeOf(_response) === 'string' && !!window.JSON) { try { return JSON.parse(_response.replace(/^\s*<pre[^>]*>/, '').replace(/<\/pre>\s*$/, '')); } catch (ex) { return null; } } } else if ('document' === responseType) { } return _response; }, abort: function() { var target = this; if (_iframe && _iframe.contentWindow) { if (_iframe.contentWindow.stop) { // FireFox/Safari/Chrome _iframe.contentWindow.stop(); } else if (_iframe.contentWindow.document.execCommand) { // IE _iframe.contentWindow.document.execCommand('Stop'); } else { _iframe.src = "about:blank"; } } cleanup.call(this, function() { // target.dispatchEvent('readystatechange'); target.dispatchEvent('abort'); }); } }); } return (extensions.XMLHttpRequest = XMLHttpRequest); }); // Included from: src/javascript/runtime/silverlight/Runtime.js /** * RunTime.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /*global ActiveXObject:true */ /** Defines constructor for Silverlight runtime. @class moxie/runtime/silverlight/Runtime @private */ define("moxie/runtime/silverlight/Runtime", [ "moxie/core/utils/Basic", "moxie/core/utils/Env", "moxie/core/utils/Dom", "moxie/core/Exceptions", "moxie/runtime/Runtime" ], function(Basic, Env, Dom, x, Runtime) { var type = "silverlight", extensions = {}; function isInstalled(version) { var isVersionSupported = false, control = null, actualVer, actualVerArray, reqVerArray, requiredVersionPart, actualVersionPart, index = 0; try { try { control = new ActiveXObject('AgControl.AgControl'); if (control.IsVersionSupported(version)) { isVersionSupported = true; } control = null; } catch (e) { var plugin = navigator.plugins["Silverlight Plug-In"]; if (plugin) { actualVer = plugin.description; if (actualVer === "1.0.30226.2") { actualVer = "2.0.30226.2"; } actualVerArray = actualVer.split("."); while (actualVerArray.length > 3) { actualVerArray.pop(); } while ( actualVerArray.length < 4) { actualVerArray.push(0); } reqVerArray = version.split("."); while (reqVerArray.length > 4) { reqVerArray.pop(); } do { requiredVersionPart = parseInt(reqVerArray[index], 10); actualVersionPart = parseInt(actualVerArray[index], 10); index++; } while (index < reqVerArray.length && requiredVersionPart === actualVersionPart); if (requiredVersionPart <= actualVersionPart && !isNaN(requiredVersionPart)) { isVersionSupported = true; } } } } catch (e2) { isVersionSupported = false; } return isVersionSupported; } /** Constructor for the Silverlight Runtime @class SilverlightRuntime @extends Runtime */ function SilverlightRuntime(options) { var I = this, initTimer; options = Basic.extend({ xap_url: Env.xap_url }, options); Runtime.call(this, options, type, { access_binary: Runtime.capTrue, access_image_binary: Runtime.capTrue, display_media: Runtime.capTrue, do_cors: Runtime.capTrue, drag_and_drop: false, report_upload_progress: Runtime.capTrue, resize_image: Runtime.capTrue, return_response_headers: function(value) { return value && I.mode === 'client'; }, return_response_type: function(responseType) { if (responseType !== 'json') { return true; } else { return !!window.JSON; } }, return_status_code: function(code) { return I.mode === 'client' || !Basic.arrayDiff(code, [200, 404]); }, select_file: Runtime.capTrue, select_multiple: Runtime.capTrue, send_binary_string: Runtime.capTrue, send_browser_cookies: function(value) { return value && I.mode === 'browser'; }, send_custom_headers: function(value) { return value && I.mode === 'client'; }, send_multipart: Runtime.capTrue, slice_blob: Runtime.capTrue, stream_upload: true, summon_file_dialog: false, upload_filesize: Runtime.capTrue, use_http_method: function(methods) { return I.mode === 'client' || !Basic.arrayDiff(methods, ['GET', 'POST']); } }, { // capabilities that require specific mode return_response_headers: function(value) { return value ? 'client' : 'browser'; }, return_status_code: function(code) { return Basic.arrayDiff(code, [200, 404]) ? 'client' : ['client', 'browser']; }, send_browser_cookies: function(value) { return value ? 'browser' : 'client'; }, send_custom_headers: function(value) { return value ? 'client' : 'browser'; }, use_http_method: function(methods) { return Basic.arrayDiff(methods, ['GET', 'POST']) ? 'client' : ['client', 'browser']; } }); // minimal requirement if (!isInstalled('2.0.31005.0') || Env.browser === 'Opera') { this.mode = false; } Basic.extend(this, { getShim: function() { return Dom.get(this.uid).content.Moxie; }, shimExec: function(component, action) { var args = [].slice.call(arguments, 2); return I.getShim().exec(this.uid, component, action, args); }, init : function() { var container; container = this.getShimContainer(); container.innerHTML = '<object id="' + this.uid + '" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;">' + '<param name="source" value="' + options.xap_url + '"/>' + '<param name="background" value="Transparent"/>' + '<param name="windowless" value="true"/>' + '<param name="enablehtmlaccess" value="true"/>' + '<param name="initParams" value="uid=' + this.uid + ',target=' + Env.global_event_dispatcher + '"/>' + '</object>'; // Init is dispatched by the shim initTimer = setTimeout(function() { if (I && !I.initialized) { // runtime might be already destroyed by this moment I.trigger("Error", new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR)); } }, Env.OS !== 'Windows'? 10000 : 5000); // give it more time to initialize in non Windows OS (like Mac) }, destroy: (function(destroy) { // extend default destroy method return function() { destroy.call(I); clearTimeout(initTimer); // initialization check might be still onwait options = initTimer = destroy = I = null; }; }(this.destroy)) }, extensions); } Runtime.addConstructor(type, SilverlightRuntime); return extensions; }); // Included from: src/javascript/runtime/silverlight/file/Blob.js /** * Blob.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/silverlight/file/Blob @private */ define("moxie/runtime/silverlight/file/Blob", [ "moxie/runtime/silverlight/Runtime", "moxie/core/utils/Basic", "moxie/runtime/flash/file/Blob" ], function(extensions, Basic, Blob) { return (extensions.Blob = Basic.extend({}, Blob)); }); // Included from: src/javascript/runtime/silverlight/file/FileInput.js /** * FileInput.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/silverlight/file/FileInput @private */ define("moxie/runtime/silverlight/file/FileInput", [ "moxie/runtime/silverlight/Runtime" ], function(extensions) { var FileInput = { init: function(options) { function toFilters(accept) { var filter = ''; for (var i = 0; i < accept.length; i++) { filter += (filter !== '' ? '|' : '') + accept[i].title + " | *." + accept[i].extensions.replace(/,/g, ';*.'); } return filter; } this.getRuntime().shimExec.call(this, 'FileInput', 'init', toFilters(options.accept), options.name, options.multiple); this.trigger('ready'); } }; return (extensions.FileInput = FileInput); }); // Included from: src/javascript/runtime/silverlight/file/FileReader.js /** * FileReader.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/silverlight/file/FileReader @private */ define("moxie/runtime/silverlight/file/FileReader", [ "moxie/runtime/silverlight/Runtime", "moxie/core/utils/Basic", "moxie/runtime/flash/file/FileReader" ], function(extensions, Basic, FileReader) { return (extensions.FileReader = Basic.extend({}, FileReader)); }); // Included from: src/javascript/runtime/silverlight/file/FileReaderSync.js /** * FileReaderSync.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/silverlight/file/FileReaderSync @private */ define("moxie/runtime/silverlight/file/FileReaderSync", [ "moxie/runtime/silverlight/Runtime", "moxie/core/utils/Basic", "moxie/runtime/flash/file/FileReaderSync" ], function(extensions, Basic, FileReaderSync) { return (extensions.FileReaderSync = Basic.extend({}, FileReaderSync)); }); // Included from: src/javascript/runtime/silverlight/xhr/XMLHttpRequest.js /** * XMLHttpRequest.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /** @class moxie/runtime/silverlight/xhr/XMLHttpRequest @private */ define("moxie/runtime/silverlight/xhr/XMLHttpRequest", [ "moxie/runtime/silverlight/Runtime", "moxie/core/utils/Basic", "moxie/runtime/flash/xhr/XMLHttpRequest" ], function(extensions, Basic, XMLHttpRequest) { return (extensions.XMLHttpRequest = Basic.extend({}, XMLHttpRequest)); }); expose(["moxie/core/utils/Basic","moxie/core/I18n","moxie/core/utils/Mime","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/file/File","moxie/file/FileInput","moxie/runtime/RuntimeTarget","moxie/file/FileReader","moxie/core/utils/Url","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/core/utils/Events"]); })(this);/** * o.js * * Copyright 2013, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ /*global moxie:true */ /** Globally exposed namespace with the most frequently used public classes and handy methods. @class o @static @private */ (function(exports) { "use strict"; var o = {}, inArray = exports.moxie.core.utils.Basic.inArray; // directly add some public classes // (we do it dynamically here, since for custom builds we cannot know beforehand what modules were included) (function addAlias(ns) { var name, itemType; for (name in ns) { itemType = typeof(ns[name]); if (itemType === 'object' && !~inArray(name, ['Exceptions', 'Env', 'Mime'])) { addAlias(ns[name]); } else if (itemType === 'function') { o[name] = ns[name]; } } })(exports.moxie); // add some manually o.Env = exports.moxie.core.utils.Env; o.Mime = exports.moxie.core.utils.Mime; o.Exceptions = exports.moxie.core.Exceptions; // expose globally exports.mOxie = o; if (!exports.o) { exports.o = o; } return o; })(this);
website/core/SnackPlayer.js
formatlos/react-native
/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SnackPlayer */ 'use strict'; var Prism = require('Prism'); var React = require('React'); const PropTypes = require('prop-types'); const LatestSDKVersion = '16.0.0'; var ReactNativeToExpoSDKVersionMap = { '0.44': '17.0.0', '0.43': '16.0.0', '0.42': '15.0.0', '0.41': '14.0.0', }; /** * Use the SnackPlayer by including a ```SnackPlayer``` block in markdown. * * Optionally, include url parameters directly after the block's language. * Valid options are name, description, and platform. * * E.g. * ```SnackPlayer?platform=android&name=Hello%20world! * import React from 'react'; * import { Text } from 'react-native'; * * export default class App extends React.Component { * render() { * return <Text>Hello World!</Text>; * } * } * ``` */ class SnackPlayer extends React.Component { constructor(props, context) { super(props, context); this.parseParams = this.parseParams.bind(this); } componentDidMount() { window.ExpoSnack && window.ExpoSnack.initialize(); } render() { var code = encodeURIComponent(this.props.children); var params = this.parseParams(this.props.params); var platform = params.platform ? params.platform : 'ios'; var name = params.name ? decodeURIComponent(params.name) : 'Example'; var description = params.description ? decodeURIComponent(params.description) : 'Example usage'; var optionalProps = {}; var { version } = this.context; if (version === 'next') { optionalProps[ 'data-snack-sdk-version' ] = LatestSDKVersion; } else { optionalProps[ 'data-snack-sdk-version' ] = ReactNativeToExpoSDKVersionMap[version] || LatestSDKVersion; } return ( <div className="snack-player"> <div className="mobile-friendly-snack" style={{ display: 'none' }} > <Prism> {this.props.children} </Prism> </div> <div className="desktop-friendly-snack" style={{ marginTop: 15, marginBottom: 15 }} > <div data-snack-name={name} data-snack-description={description} data-snack-code={code} data-snack-platform={platform} data-snack-preview="true" {...optionalProps} style={{ overflow: 'hidden', background: '#fafafa', border: '1px solid rgba(0,0,0,.16)', borderRadius: '4px', height: '514px', width: '880px', }} /> </div> </div> ); } parseParams(paramString) { var params = {}; if (paramString) { var pairs = paramString.split('&'); for (var i = 0; i < pairs.length; i++) { var pair = pairs[i].split('='); params[pair[0]] = pair[1]; } } return params; } } SnackPlayer.contextTypes = { version: PropTypes.number.isRequired, }; module.exports = SnackPlayer;
src/svg-icons/image/exposure-zero.js
pancho111203/material-ui
import React from 'react'; import pure from 'recompose/pure'; import SvgIcon from '../../SvgIcon'; let ImageExposureZero = (props) => ( <SvgIcon {...props}> <path d="M16.14 12.5c0 1-.1 1.85-.3 2.55-.2.7-.48 1.27-.83 1.7-.36.44-.79.75-1.3.95-.51.2-1.07.3-1.7.3-.62 0-1.18-.1-1.69-.3-.51-.2-.95-.51-1.31-.95-.36-.44-.65-1.01-.85-1.7-.2-.7-.3-1.55-.3-2.55v-2.04c0-1 .1-1.85.3-2.55.2-.7.48-1.26.84-1.69.36-.43.8-.74 1.31-.93C10.81 5.1 11.38 5 12 5c.63 0 1.19.1 1.7.29.51.19.95.5 1.31.93.36.43.64.99.84 1.69.2.7.3 1.54.3 2.55v2.04zm-2.11-2.36c0-.64-.05-1.18-.13-1.62-.09-.44-.22-.79-.4-1.06-.17-.27-.39-.46-.64-.58-.25-.13-.54-.19-.86-.19-.32 0-.61.06-.86.18s-.47.31-.64.58c-.17.27-.31.62-.4 1.06s-.13.98-.13 1.62v2.67c0 .64.05 1.18.14 1.62.09.45.23.81.4 1.09s.39.48.64.61.54.19.87.19c.33 0 .62-.06.87-.19s.46-.33.63-.61c.17-.28.3-.64.39-1.09.09-.45.13-.99.13-1.62v-2.66z"/> </SvgIcon> ); ImageExposureZero = pure(ImageExposureZero); ImageExposureZero.displayName = 'ImageExposureZero'; ImageExposureZero.muiName = 'SvgIcon'; export default ImageExposureZero;
examples/real-world/index.js
cornedor/redux
import 'babel-core/polyfill'; import React from 'react'; import BrowserHistory from 'react-router/lib/BrowserHistory'; import { Provider } from 'react-redux'; import { Router, Route } from 'react-router'; import configureStore from './store/configureStore'; import App from './containers/App'; import UserPage from './containers/UserPage'; import RepoPage from './containers/RepoPage'; const history = new BrowserHistory(); const store = configureStore(); React.render( <Provider store={store}> {() => <Router history={history}> <Route path="/" component={App}> <Route path="/:login/:name" component={RepoPage} /> <Route path="/:login" component={UserPage} /> </Route> </Router> } </Provider>, document.getElementById('root') );
components/Map/ControlLayer/ControlLayer.js
rdjpalmer/bloom
import PropTypes from 'prop-types'; import React from 'react'; import cx from 'classnames'; import Control from '../Control/Control'; import ControlGroup from '../ControlGroup/ControlGroup'; import ControlIcon from '../Control/ControlIcon'; import css from './ControlLayer.css'; const ControlLayer = (props) => { const { children, className, controlGroupClassName, onZoomIn, onZoomOut, } = props; return ( <div className={ cx(css.root, className) }> <ControlGroup className={ cx(css.controlGroup, controlGroupClassName) }> <Control onClick={ onZoomIn }> <ControlIcon name="plus" /> </Control> <Control onClick={ onZoomOut }> <ControlIcon name="minus" /> </Control> </ControlGroup> { children } </div> ); }; ControlLayer.propTypes = { className: PropTypes.string, controlGroupClassName: PropTypes.string, children: PropTypes.node.isRequired, onZoomIn: PropTypes.func.isRequired, onZoomOut: PropTypes.func.isRequired, }; export default ControlLayer;
ajax/libs/F2/1.3.2/f2.min.js
sparkgeo/cdnjs
/*! F2 - v1.3.2 - 11-18-2013 - See below for copyright and license */ (function(exports){if(!exports.F2||exports.F2_TESTING_MODE){/*! JSON.org requires the following notice to accompany json2: Copyright (c) 2002 JSON.org http://json.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The Software shall be used for Good, not Evil. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ "object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(e){return 10>e?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,o,i,a,s=gap,l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),"function"==typeof rep&&(l=rep.call(t,e,l)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?l+"":"null";case"boolean":case"null":return l+"";case"object":if(!l)return"null";if(gap+=indent,a=[],"[object Array]"===Object.prototype.toString.apply(l)){for(i=l.length,n=0;i>n;n+=1)a[n]=str(n,l)||"null";return o=0===a.length?"[]":gap?"[\n"+gap+a.join(",\n"+gap)+"\n"+s+"]":"["+a.join(",")+"]",gap=s,o}if(rep&&"object"==typeof rep)for(i=rep.length,n=0;i>n;n+=1)"string"==typeof rep[n]&&(r=rep[n],o=str(r,l),o&&a.push(quote(r)+(gap?": ":":")+o));else for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(o=str(r,l),o&&a.push(quote(r)+(gap?": ":":")+o));return o=0===a.length?"{}":gap?"{\n"+gap+a.join(",\n"+gap)+"\n"+s+"}":"{"+a.join(",")+"}",gap=s,o}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(e,t,n){var r;if(gap="",indent="","number"==typeof n)for(r=0;n>r;r+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var n,r,o=e[t];if(o&&"object"==typeof o)for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(r=walk(o,n),void 0!==r?o[n]=r:delete o[n]);return reviver.call(e,t,o)}var j;if(text+="",cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),/*! * jQuery JavaScript Library v1.8.3 * The jQuery Foundation and other contributors require the following notice to accompany jQuery: * * Copyright (c) 2013 jQuery Foundation and other contributors * * http://jquery.com * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software * is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ function(e,t){function n(e){var t=ht[e]={};return Y.each(e.split(tt),function(e,n){t[n]=!0}),t}function r(e,n,r){if(r===t&&1===e.nodeType){var o="data-"+n.replace(mt,"-$1").toLowerCase();if(r=e.getAttribute(o),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:gt.test(r)?Y.parseJSON(r):r}catch(i){}Y.data(e,n,r)}else r=t}return r}function o(e){var t;for(t in e)if(("data"!==t||!Y.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function i(){return!1}function a(){return!0}function s(e){return!e||!e.parentNode||11===e.parentNode.nodeType}function l(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function c(e,t,n){if(t=t||0,Y.isFunction(t))return Y.grep(e,function(e,r){var o=!!t.call(e,r,e);return o===n});if(t.nodeType)return Y.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=Y.grep(e,function(e){return 1===e.nodeType});if(It.test(t))return Y.filter(t,r,!n);t=Y.filter(t,r)}return Y.grep(e,function(e){return Y.inArray(e,t)>=0===n})}function u(e){var t=Lt.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function p(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function f(e,t){if(1===t.nodeType&&Y.hasData(e)){var n,r,o,i=Y._data(e),a=Y._data(t,i),s=i.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,o=s[n].length;o>r;r++)Y.event.add(t,n,s[n][r])}a.data&&(a.data=Y.extend({},a.data))}}function d(e,t){var n;1===t.nodeType&&(t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),Y.support.html5Clone&&e.innerHTML&&!Y.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Vt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.selected=e.defaultSelected:"input"===n||"textarea"===n?t.defaultValue=e.defaultValue:"script"===n&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(Y.expando))}function h(e){return e.getElementsByTagName!==t?e.getElementsByTagName("*"):e.querySelectorAll!==t?e.querySelectorAll("*"):[]}function g(e){Vt.test(e.type)&&(e.defaultChecked=e.checked)}function m(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,o=vn.length;o--;)if(t=vn[o]+n,t in e)return t;return r}function y(e,t){return e=t||e,"none"===Y.css(e,"display")||!Y.contains(e.ownerDocument,e)}function v(e,t){for(var n,r,o=[],i=0,a=e.length;a>i;i++)n=e[i],n.style&&(o[i]=Y._data(n,"olddisplay"),t?(o[i]||"none"!==n.style.display||(n.style.display=""),""===n.style.display&&y(n)&&(o[i]=Y._data(n,"olddisplay",_(n.nodeName)))):(r=nn(n,"display"),o[i]||"none"===r||Y._data(n,"olddisplay",r)));for(i=0;a>i;i++)n=e[i],n.style&&(t&&"none"!==n.style.display&&""!==n.style.display||(n.style.display=t?o[i]||"":"none"));return e}function b(e,t,n){var r=pn.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function x(e,t,n,r){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,i=0;4>o;o+=2)"margin"===n&&(i+=Y.css(e,n+yn[o],!0)),r?("content"===n&&(i-=parseFloat(nn(e,"padding"+yn[o]))||0),"margin"!==n&&(i-=parseFloat(nn(e,"border"+yn[o]+"Width"))||0)):(i+=parseFloat(nn(e,"padding"+yn[o]))||0,"padding"!==n&&(i+=parseFloat(nn(e,"border"+yn[o]+"Width"))||0));return i}function w(e,t,n){var r="width"===t?e.offsetWidth:e.offsetHeight,o=!0,i=Y.support.boxSizing&&"border-box"===Y.css(e,"boxSizing");if(0>=r||null==r){if(r=nn(e,t),(0>r||null==r)&&(r=e.style[t]),fn.test(r))return r;o=i&&(Y.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+x(e,t,n||(i?"border":"content"),o)+"px"}function _(e){if(hn[e])return hn[e];var t=Y("<"+e+">").appendTo($.body),n=t.css("display");return t.remove(),("none"===n||""===n)&&(rn=$.body.appendChild(rn||Y.extend($.createElement("iframe"),{frameBorder:0,width:0,height:0})),on&&rn.createElement||(on=(rn.contentWindow||rn.contentDocument).document,on.write("<!doctype html><html><body>"),on.close()),t=on.body.appendChild(on.createElement(e)),n=nn(t,"display"),$.body.removeChild(rn)),hn[e]=n,n}function C(e,t,n,r){var o;if(Y.isArray(t))Y.each(t,function(t,o){n||wn.test(e)?r(e,o):C(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==Y.type(t))r(e,t);else for(o in t)C(e+"["+o+"]",t[o],n,r)}function A(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o,i,a=t.toLowerCase().split(tt),s=0,l=a.length;if(Y.isFunction(n))for(;l>s;s++)r=a[s],i=/^\+/.test(r),i&&(r=r.substr(1)||"*"),o=e[r]=e[r]||[],o[i?"unshift":"push"](n)}}function T(e,n,r,o,i,a){i=i||n.dataTypes[0],a=a||{},a[i]=!0;for(var s,l=e[i],c=0,u=l?l.length:0,p=e===Dn;u>c&&(p||!s);c++)s=l[c](n,r,o),"string"==typeof s&&(!p||a[s]?s=t:(n.dataTypes.unshift(s),s=T(e,n,r,o,s,a)));return!p&&s||a["*"]||(s=T(e,n,r,o,"*",a)),s}function k(e,n){var r,o,i=Y.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((i[r]?e:o||(o={}))[r]=n[r]);o&&Y.extend(!0,e,o)}function E(e,n,r){var o,i,a,s,l=e.contents,c=e.dataTypes,u=e.responseFields;for(i in u)i in r&&(n[u[i]]=r[i]);for(;"*"===c[0];)c.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("content-type"));if(o)for(i in l)if(l[i]&&l[i].test(o)){c.unshift(i);break}if(c[0]in r)a=c[0];else{for(i in r){if(!c[0]||e.converters[i+" "+c[0]]){a=i;break}s||(s=i)}a=a||s}return a?(a!==c[0]&&c.unshift(a),r[a]):t}function F(e,t){var n,r,o,i,a=e.dataTypes.slice(),s=a[0],l={},c=0;if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),a[1])for(n in e.converters)l[n.toLowerCase()]=e.converters[n];for(;o=a[++c];)if("*"!==o){if("*"!==s&&s!==o){if(n=l[s+" "+o]||l["* "+o],!n)for(r in l)if(i=r.split(" "),i[1]===o&&(n=l[s+" "+i[0]]||l["* "+i[0]])){n===!0?n=l[r]:l[r]!==!0&&(o=i[0],a.splice(c--,0,o));break}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(u){return{state:"parsererror",error:n?u:"No conversion from "+s+" to "+o}}}s=o}return{state:"success",data:t}}function N(){try{return new e.XMLHttpRequest}catch(t){}}function S(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function j(){return setTimeout(function(){Jn=t},0),Jn=Y.now()}function R(e,t){Y.each(t,function(t,n){for(var r=(er[t]||[]).concat(er["*"]),o=0,i=r.length;i>o;o++)if(r[o].call(e,t,n))return})}function O(e,t,n){var r,o=0,i=Zn.length,a=Y.Deferred().always(function(){delete s.elem}),s=function(){for(var t=Jn||j(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,i=0,s=l.tweens.length;s>i;i++)l.tweens[i].run(o);return a.notifyWith(e,[l,o,n]),1>o&&s?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:Y.extend({},t),opts:Y.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Jn||j(),duration:n.duration,tweens:[],createTween:function(t,n){var r=Y.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){for(var n=0,r=t?l.tweens.length:0;r>n;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(M(c,l.opts.specialEasing);i>o;o++)if(r=Zn[o].call(l,e,c,l.opts))return r;return R(l,c),Y.isFunction(l.opts.start)&&l.opts.start.call(e,l),Y.fx.timer(Y.extend(s,{anim:l,queue:l.opts.queue,elem:e})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function M(e,t){var n,r,o,i,a;for(n in e)if(r=Y.camelCase(n),o=t[r],i=e[n],Y.isArray(i)&&(o=i[1],i=e[n]=i[0]),n!==r&&(e[r]=i,delete e[n]),a=Y.cssHooks[r],a&&"expand"in a){i=a.expand(i),delete e[r];for(n in i)n in e||(e[n]=i[n],t[n]=o)}else t[r]=o}function H(e,t,n){var r,o,i,a,s,l,c,u,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&y(e);n.queue||(u=Y._queueHooks(e,"fx"),null==u.unqueued&&(u.unqueued=0,p=u.empty.fire,u.empty.fire=function(){u.unqueued||p()}),u.unqueued++,f.always(function(){f.always(function(){u.unqueued--,Y.queue(e,"fx").length||u.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===Y.css(e,"display")&&"none"===Y.css(e,"float")&&(Y.support.inlineBlockNeedsLayout&&"inline"!==_(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",Y.support.shrinkWrapBlocks||f.done(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Kn.exec(i)){if(delete t[r],l=l||"toggle"===i,i===(m?"hide":"show"))continue;g.push(r)}if(a=g.length){s=Y._data(e,"fxshow")||Y._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),l&&(s.hidden=!m),m?Y(e).show():f.done(function(){Y(e).hide()}),f.done(function(){var t;Y.removeData(e,"fxshow",!0);for(t in h)Y.style(e,t,h[t])});for(r=0;a>r;r++)o=g[r],c=f.createTween(o,m?s[o]:0),h[o]=s[o]||Y.style(e,o),o in s||(s[o]=c.start,m&&(c.end=c.start,c.start="width"===o||"height"===o?1:0))}}function I(e,t,n,r,o){return new I.prototype.init(e,t,n,r,o)}function D(e,t){var n,r={height:e},o=0;for(t=t?1:0;4>o;o+=2-t)n=yn[o],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function P(e){return Y.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var L,B,$=e.document,q=e.location,W=e.navigator,U=e.jQuery,Q=e.$,z=Array.prototype.push,X=Array.prototype.slice,J=Array.prototype.indexOf,V=Object.prototype.toString,K=Object.prototype.hasOwnProperty,G=String.prototype.trim,Y=function(e,t){return new Y.fn.init(e,t,L)},Z=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,et=/\S/,tt=/\s+/,nt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rt=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,ot=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,it=/^[\],:{}\s]*$/,at=/(?:^|:|,)(?:\s*\[)+/g,st=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,lt=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,ct=/^-ms-/,ut=/-([\da-z])/gi,pt=function(e,t){return(t+"").toUpperCase()},ft=function(){$.addEventListener?($.removeEventListener("DOMContentLoaded",ft,!1),Y.ready()):"complete"===$.readyState&&($.detachEvent("onreadystatechange",ft),Y.ready())},dt={};Y.fn=Y.prototype={constructor:Y,init:function(e,n,r){var o,i,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if("string"==typeof e){if(o="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:rt.exec(e),!o||!o[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(o[1])return n=n instanceof Y?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:$,e=Y.parseHTML(o[1],a,!0),ot.test(o[1])&&Y.isPlainObject(n)&&this.attr.call(e,n,!0),Y.merge(this,e);if(i=$.getElementById(o[2]),i&&i.parentNode){if(i.id!==o[2])return r.find(e);this.length=1,this[0]=i}return this.context=$,this.selector=e,this}return Y.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),Y.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return X.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=Y.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,"find"===t?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return Y.each(this,e,t)},ready:function(e){return Y.ready.promise().done(e),this},eq:function(e){return e=+e,-1===e?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(X.apply(this,arguments),"slice",X.call(arguments).join(","))},map:function(e){return this.pushStack(Y.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:z,sort:[].sort,splice:[].splice},Y.fn.init.prototype=Y.fn,Y.extend=Y.fn.extend=function(){var e,n,r,o,i,a,s=arguments[0]||{},l=1,c=arguments.length,u=!1;for("boolean"==typeof s&&(u=s,s=arguments[1]||{},l=2),"object"==typeof s||Y.isFunction(s)||(s={}),c===l&&(s=this,--l);c>l;l++)if(null!=(e=arguments[l]))for(n in e)r=s[n],o=e[n],s!==o&&(u&&o&&(Y.isPlainObject(o)||(i=Y.isArray(o)))?(i?(i=!1,a=r&&Y.isArray(r)?r:[]):a=r&&Y.isPlainObject(r)?r:{},s[n]=Y.extend(u,a,o)):o!==t&&(s[n]=o));return s},Y.extend({noConflict:function(t){return e.$===Y&&(e.$=Q),t&&e.jQuery===Y&&(e.jQuery=U),Y},isReady:!1,readyWait:1,holdReady:function(e){e?Y.readyWait++:Y.ready(!0)},ready:function(e){if(e===!0?!--Y.readyWait:!Y.isReady){if(!$.body)return setTimeout(Y.ready,1);Y.isReady=!0,e!==!0&&--Y.readyWait>0||(B.resolveWith($,[Y]),Y.fn.trigger&&Y($).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===Y.type(e)},isArray:Array.isArray||function(e){return"array"===Y.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":dt[V.call(e)]||"object"},isPlainObject:function(e){if(!e||"object"!==Y.type(e)||e.nodeType||Y.isWindow(e))return!1;try{if(e.constructor&&!K.call(e,"constructor")&&!K.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||K.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){var r;return e&&"string"==typeof e?("boolean"==typeof t&&(n=t,t=0),t=t||$,(r=ot.exec(e))?[t.createElement(r[1])]:(r=Y.buildFragment([e],t,n?null:[]),Y.merge([],(r.cacheable?Y.clone(r.fragment):r.fragment).childNodes))):null},parseJSON:function(n){return n&&"string"==typeof n?(n=Y.trim(n),e.JSON&&e.JSON.parse?e.JSON.parse(n):it.test(n.replace(st,"@").replace(lt,"]").replace(at,""))?Function("return "+n)():(Y.error("Invalid JSON: "+n),t)):null},parseXML:function(n){var r,o;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(o=new DOMParser,r=o.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(i){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||Y.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&et.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(ct,"ms-").replace(ut,pt)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var o,i=0,a=e.length,s=a===t||Y.isFunction(e);if(r)if(s){for(o in e)if(n.apply(e[o],r)===!1)break}else for(;a>i&&n.apply(e[i++],r)!==!1;);else if(s){for(o in e)if(n.call(e[o],o,e[o])===!1)break}else for(;a>i&&n.call(e[i],i,e[i++])!==!1;);return e},trim:G&&!G.call(" ")?function(e){return null==e?"":G.call(e)}:function(e){return null==e?"":(e+"").replace(nt,"")},makeArray:function(e,t){var n,r=t||[];return null!=e&&(n=Y.type(e),null==e.length||"string"===n||"function"===n||"regexp"===n||Y.isWindow(e)?z.call(r,e):Y.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(J)return J.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,o=e.length,i=0;if("number"==typeof r)for(;r>i;i++)e[o++]=n[i];else for(;n[i]!==t;)e[o++]=n[i++];return e.length=o,e},grep:function(e,t,n){var r,o=[],i=0,a=e.length;for(n=!!n;a>i;i++)r=!!t(e[i],i),n!==r&&o.push(e[i]);return o},map:function(e,n,r){var o,i,a=[],s=0,l=e.length,c=e instanceof Y||l!==t&&"number"==typeof l&&(l>0&&e[0]&&e[l-1]||0===l||Y.isArray(e));if(c)for(;l>s;s++)o=n(e[s],s,r),null!=o&&(a[a.length]=o);else for(i in e)o=n(e[i],i,r),null!=o&&(a[a.length]=o);return a.concat.apply([],a)},guid:1,proxy:function(e,n){var r,o,i;return"string"==typeof n&&(r=e[n],n=e,e=r),Y.isFunction(e)?(o=X.call(arguments,2),i=function(){return e.apply(n,o.concat(X.call(arguments)))},i.guid=e.guid=e.guid||Y.guid++,i):t},access:function(e,n,r,o,i,a,s){var l,c=null==r,u=0,p=e.length;if(r&&"object"==typeof r){for(u in r)Y.access(e,n,u,r[u],1,a,o);i=1}else if(o!==t){if(l=s===t&&Y.isFunction(o),c&&(l?(l=n,n=function(e,t,n){return l.call(Y(e),n)}):(n.call(e,o),n=null)),n)for(;p>u;u++)n(e[u],r,l?o.call(e[u],u,n(e[u],r)):o,s);i=1}return i?e:c?n.call(e):p?n(e[0],r):a},now:function(){return(new Date).getTime()}}),Y.ready.promise=function(t){if(!B)if(B=Y.Deferred(),"complete"===$.readyState)setTimeout(Y.ready,1);else if($.addEventListener)$.addEventListener("DOMContentLoaded",ft,!1),e.addEventListener("load",Y.ready,!1);else{$.attachEvent("onreadystatechange",ft),e.attachEvent("onload",Y.ready);var n=!1;try{n=null==e.frameElement&&$.documentElement}catch(r){}n&&n.doScroll&&function o(){if(!Y.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}Y.ready()}}()}return B.promise(t)},Y.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){dt["[object "+t+"]"]=t.toLowerCase()}),L=Y($);var ht={};Y.Callbacks=function(e){e="string"==typeof e?ht[e]||n(e):Y.extend({},e);var r,o,i,a,s,l,c=[],u=!e.once&&[],p=function(t){for(r=e.memory&&t,o=!0,l=a||0,a=0,s=c.length,i=!0;c&&s>l;l++)if(c[l].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}i=!1,c&&(u?u.length&&p(u.shift()):r?c=[]:f.disable())},f={add:function(){if(c){var t=c.length;(function n(t){Y.each(t,function(t,r){var o=Y.type(r);"function"===o?e.unique&&f.has(r)||c.push(r):r&&r.length&&"string"!==o&&n(r)})})(arguments),i?s=c.length:r&&(a=t,p(r))}return this},remove:function(){return c&&Y.each(arguments,function(e,t){for(var n;(n=Y.inArray(t,c,n))>-1;)c.splice(n,1),i&&(s>=n&&s--,l>=n&&l--)}),this},has:function(e){return Y.inArray(e,c)>-1},empty:function(){return c=[],this},disable:function(){return c=u=r=t,this},disabled:function(){return!c},lock:function(){return u=t,r||f.disable(),this},locked:function(){return!u},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!c||o&&!u||(i?u.push(t):p(t)),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},Y.extend({Deferred:function(e){var t=[["resolve","done",Y.Callbacks("once memory"),"resolved"],["reject","fail",Y.Callbacks("once memory"),"rejected"],["notify","progress",Y.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var e=arguments;return Y.Deferred(function(n){Y.each(t,function(t,r){var i=r[0],a=e[t];o[r[1]](Y.isFunction(a)?function(){var e=a.apply(this,arguments);e&&Y.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[i+"With"](this===o?n:this,[e])}:n[i])}),e=null}).promise()},promise:function(e){return null!=e?Y.extend(e,r):r}},o={};return r.pipe=r.then,Y.each(t,function(e,i){var a=i[2],s=i[3];r[i[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),o[i[0]]=a.fire,o[i[0]+"With"]=a.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(e){var t,n,r,o=0,i=X.call(arguments),a=i.length,s=1!==a||e&&Y.isFunction(e.promise)?a:0,l=1===s?e:Y.Deferred(),c=function(e,n,r){return function(o){n[e]=this,r[e]=arguments.length>1?X.call(arguments):o,r===t?l.notifyWith(n,r):--s||l.resolveWith(n,r)}};if(a>1)for(t=Array(a),n=Array(a),r=Array(a);a>o;o++)i[o]&&Y.isFunction(i[o].promise)?i[o].promise().done(c(o,r,i)).fail(l.reject).progress(c(o,n,t)):--s;return s||l.resolveWith(r,i),l.promise()}}),Y.support=function(){var n,r,o,i,a,s,l,c,u,p,f,d=$.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",r=d.getElementsByTagName("*"),o=d.getElementsByTagName("a")[0],!r||!o||!r.length)return{};i=$.createElement("select"),a=i.appendChild($.createElement("option")),s=d.getElementsByTagName("input")[0],o.style.cssText="top:1px;float:left;opacity:.5",n={leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(o.getAttribute("style")),hrefNormalized:"/a"===o.getAttribute("href"),opacity:/^0.5/.test(o.style.opacity),cssFloat:!!o.style.cssFloat,checkOn:"on"===s.value,optSelected:a.selected,getSetAttribute:"t"!==d.className,enctype:!!$.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==$.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===$.compatMode,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},s.checked=!0,n.noCloneChecked=s.cloneNode(!0).checked,i.disabled=!0,n.optDisabled=!a.disabled;try{delete d.test}catch(h){n.deleteExpando=!1}if(!d.addEventListener&&d.attachEvent&&d.fireEvent&&(d.attachEvent("onclick",f=function(){n.noCloneEvent=!1}),d.cloneNode(!0).fireEvent("onclick"),d.detachEvent("onclick",f)),s=$.createElement("input"),s.value="t",s.setAttribute("type","radio"),n.radioValue="t"===s.value,s.setAttribute("checked","checked"),s.setAttribute("name","t"),d.appendChild(s),l=$.createDocumentFragment(),l.appendChild(d.lastChild),n.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,n.appendChecked=s.checked,l.removeChild(s),l.appendChild(d),d.attachEvent)for(u in{submit:!0,change:!0,focusin:!0})c="on"+u,p=c in d,p||(d.setAttribute(c,"return;"),p="function"==typeof d[c]),n[u+"Bubbles"]=p;return Y(function(){var r,o,i,a,s="padding:0;margin:0;border:0;display:block;overflow:hidden;",l=$.getElementsByTagName("body")[0];l&&(r=$.createElement("div"),r.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",l.insertBefore(r,l.firstChild),o=$.createElement("div"),r.appendChild(o),o.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=o.getElementsByTagName("td"),i[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===i[0].offsetHeight,i[0].style.display="",i[1].style.display="none",n.reliableHiddenOffsets=p&&0===i[0].offsetHeight,o.innerHTML="",o.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",n.boxSizing=4===o.offsetWidth,n.doesNotIncludeMarginInBodyOffset=1!==l.offsetTop,e.getComputedStyle&&(n.pixelPosition="1%"!==(e.getComputedStyle(o,null)||{}).top,n.boxSizingReliable="4px"===(e.getComputedStyle(o,null)||{width:"4px"}).width,a=$.createElement("div"),a.style.cssText=o.style.cssText=s,a.style.marginRight=a.style.width="0",o.style.width="1px",o.appendChild(a),n.reliableMarginRight=!parseFloat((e.getComputedStyle(a,null)||{}).marginRight)),o.style.zoom!==t&&(o.innerHTML="",o.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",n.inlineBlockNeedsLayout=3===o.offsetWidth,o.style.display="block",o.style.overflow="visible",o.innerHTML="<div></div>",o.firstChild.style.width="5px",n.shrinkWrapBlocks=3!==o.offsetWidth,r.style.zoom=1),l.removeChild(r),r=o=i=a=null)}),l.removeChild(d),r=o=i=a=s=l=d=null,n}();var gt=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,mt=/([A-Z])/g;Y.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(Y.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?Y.cache[e[Y.expando]]:e[Y.expando],!!e&&!o(e)},data:function(e,n,r,o){if(Y.acceptData(e)){var i,a,s=Y.expando,l="string"==typeof n,c=e.nodeType,u=c?Y.cache:e,p=c?e[s]:e[s]&&s;if(p&&u[p]&&(o||u[p].data)||!l||r!==t)return p||(c?e[s]=p=Y.deletedIds.pop()||Y.guid++:p=s),u[p]||(u[p]={},c||(u[p].toJSON=Y.noop)),("object"==typeof n||"function"==typeof n)&&(o?u[p]=Y.extend(u[p],n):u[p].data=Y.extend(u[p].data,n)),i=u[p],o||(i.data||(i.data={}),i=i.data),r!==t&&(i[Y.camelCase(n)]=r),l?(a=i[n],null==a&&(a=i[Y.camelCase(n)])):a=i,a}},removeData:function(e,t,n){if(Y.acceptData(e)){var r,i,a,s=e.nodeType,l=s?Y.cache:e,c=s?e[Y.expando]:Y.expando;if(l[c]){if(t&&(r=n?l[c]:l[c].data)){Y.isArray(t)||(t in r?t=[t]:(t=Y.camelCase(t),t=t in r?[t]:t.split(" ")));for(i=0,a=t.length;a>i;i++)delete r[t[i]];if(!(n?o:Y.isEmptyObject)(r))return}(n||(delete l[c].data,o(l[c])))&&(s?Y.cleanData([e],!0):Y.support.deleteExpando||l!=l.window?delete l[c]:l[c]=null)}}},_data:function(e,t,n){return Y.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&Y.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),Y.fn.extend({data:function(e,n){var o,i,a,s,l,c=this[0],u=0,p=null;if(e===t){if(this.length&&(p=Y.data(c),1===c.nodeType&&!Y._data(c,"parsedAttrs"))){for(a=c.attributes,l=a.length;l>u;u++)s=a[u].name,s.indexOf("data-")||(s=Y.camelCase(s.substring(5)),r(c,s,p[s]));Y._data(c,"parsedAttrs",!0)}return p}return"object"==typeof e?this.each(function(){Y.data(this,e)}):(o=e.split(".",2),o[1]=o[1]?"."+o[1]:"",i=o[1]+"!",Y.access(this,function(n){return n===t?(p=this.triggerHandler("getData"+i,[o[0]]),p===t&&c&&(p=Y.data(c,e),p=r(c,e,p)),p===t&&o[1]?this.data(o[0]):p):(o[1]=n,this.each(function(){var t=Y(this);t.triggerHandler("setData"+i,o),Y.data(this,e,n),t.triggerHandler("changeData"+i,o)}),t)},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){Y.removeData(this,e)})}}),Y.extend({queue:function(e,n,r){var o;return e?(n=(n||"fx")+"queue",o=Y._data(e,n),r&&(!o||Y.isArray(r)?o=Y._data(e,n,Y.makeArray(r)):o.push(r)),o||[]):t},dequeue:function(e,t){t=t||"fx";var n=Y.queue(e,t),r=n.length,o=n.shift(),i=Y._queueHooks(e,t),a=function(){Y.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,a,i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y._data(e,n)||Y._data(e,n,{empty:Y.Callbacks("once memory").add(function(){Y.removeData(e,t+"queue",!0),Y.removeData(e,n,!0)})})}}),Y.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?Y.queue(this[0],e):n===t?this:this.each(function(){var t=Y.queue(this,e,n);Y._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&Y.dequeue(this,e)})},dequeue:function(e){return this.each(function(){Y.dequeue(this,e)})},delay:function(e,t){return e=Y.fx?Y.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,o=1,i=Y.Deferred(),a=this,s=this.length,l=function(){--o||i.resolveWith(a,[a])};for("string"!=typeof e&&(n=e,e=t),e=e||"fx";s--;)r=Y._data(a[s],e+"queueHooks"),r&&r.empty&&(o++,r.empty.add(l));return l(),i.promise(n)}});var yt,vt,bt,xt=/[\t\r\n]/g,wt=/\r/g,_t=/^(?:button|input)$/i,Ct=/^(?:button|input|object|select|textarea)$/i,At=/^a(?:rea|)$/i,Tt=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,kt=Y.support.getSetAttribute;Y.fn.extend({attr:function(e,t){return Y.access(this,Y.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){Y.removeAttr(this,e)})},prop:function(e,t){return Y.access(this,Y.prop,e,t,arguments.length>1)},removeProp:function(e){return e=Y.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,o,i,a,s;if(Y.isFunction(e))return this.each(function(t){Y(this).addClass(e.call(this,t,this.className))});if(e&&"string"==typeof e)for(t=e.split(tt),n=0,r=this.length;r>n;n++)if(o=this[n],1===o.nodeType)if(o.className||1!==t.length){for(i=" "+o.className+" ",a=0,s=t.length;s>a;a++)0>i.indexOf(" "+t[a]+" ")&&(i+=t[a]+" ");o.className=Y.trim(i)}else o.className=e;return this},removeClass:function(e){var n,r,o,i,a,s,l;if(Y.isFunction(e))return this.each(function(t){Y(this).removeClass(e.call(this,t,this.className))});if(e&&"string"==typeof e||e===t)for(n=(e||"").split(tt),s=0,l=this.length;l>s;s++)if(o=this[s],1===o.nodeType&&o.className){for(r=(" "+o.className+" ").replace(xt," "),i=0,a=n.length;a>i;i++)for(;r.indexOf(" "+n[i]+" ")>=0;)r=r.replace(" "+n[i]+" "," ");o.className=e?Y.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return Y.isFunction(e)?this.each(function(n){Y(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n)for(var o,i=0,a=Y(this),s=t,l=e.split(tt);o=l[i++];)s=r?s:!a.hasClass(o),a[s?"addClass":"removeClass"](o);else("undefined"===n||"boolean"===n)&&(this.className&&Y._data(this,"__className__",this.className),this.className=this.className||e===!1?"":Y._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(xt," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,o,i=this[0];{if(arguments.length)return o=Y.isFunction(e),this.each(function(r){var i,a=Y(this);1===this.nodeType&&(i=o?e.call(this,r,a.val()):e,null==i?i="":"number"==typeof i?i+="":Y.isArray(i)&&(i=Y.map(i,function(e){return null==e?"":e+""})),n=Y.valHooks[this.type]||Y.valHooks[this.nodeName.toLowerCase()],n&&"set"in n&&n.set(this,i,"value")!==t||(this.value=i))});if(i)return n=Y.valHooks[i.type]||Y.valHooks[i.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(i,"value"))!==t?r:(r=i.value,"string"==typeof r?r.replace(wt,""):null==r?"":r)}}}),Y.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){for(var t,n,r=e.options,o=e.selectedIndex,i="select-one"===e.type||0>o,a=i?null:[],s=i?o+1:r.length,l=0>o?s:i?o:0;s>l;l++)if(n=r[l],!(!n.selected&&l!==o||(Y.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&Y.nodeName(n.parentNode,"optgroup"))){if(t=Y(n).val(),i)return t;a.push(t)}return a},set:function(e,t){var n=Y.makeArray(t);return Y(e).find("option").each(function(){this.selected=Y.inArray(Y(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,o){var i,a,s,l=e.nodeType;if(e&&3!==l&&8!==l&&2!==l)return o&&Y.isFunction(Y.fn[n])?Y(e)[n](r):e.getAttribute===t?Y.prop(e,n,r):(s=1!==l||!Y.isXMLDoc(e),s&&(n=n.toLowerCase(),a=Y.attrHooks[n]||(Tt.test(n)?vt:yt)),r!==t?null===r?(Y.removeAttr(e,n),t):a&&"set"in a&&s&&(i=a.set(e,r,n))!==t?i:(e.setAttribute(n,r+""),r):a&&"get"in a&&s&&null!==(i=a.get(e,n))?i:(i=e.getAttribute(n),null===i?t:i))},removeAttr:function(e,t){var n,r,o,i,a=0;if(t&&1===e.nodeType)for(r=t.split(tt);r.length>a;a++)o=r[a],o&&(n=Y.propFix[o]||o,i=Tt.test(o),i||Y.attr(e,o,""),e.removeAttribute(kt?o:n),i&&n in e&&(e[n]=!1))},attrHooks:{type:{set:function(e,t){if(_t.test(e.nodeName)&&e.parentNode)Y.error("type property can't be changed");else if(!Y.support.radioValue&&"radio"===t&&Y.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return yt&&Y.nodeName(e,"button")?yt.get(e,t):t in e?e.value:null},set:function(e,n,r){return yt&&Y.nodeName(e,"button")?yt.set(e,n,r):(e.value=n,t)}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var o,i,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!Y.isXMLDoc(e),a&&(n=Y.propFix[n]||n,i=Y.propHooks[n]),r!==t?i&&"set"in i&&(o=i.set(e,r,n))!==t?o:e[n]=r:i&&"get"in i&&null!==(o=i.get(e,n))?o:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):Ct.test(e.nodeName)||At.test(e.nodeName)&&e.href?0:t}}}}),vt={get:function(e,n){var r,o=Y.prop(e,n);return o===!0||"boolean"!=typeof o&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?Y.removeAttr(e,n):(r=Y.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},kt||(bt={name:!0,id:!0,coords:!0},yt=Y.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(bt[n]?""!==r.value:r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=$.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},Y.each(["width","height"],function(e,n){Y.attrHooks[n]=Y.extend(Y.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})}),Y.attrHooks.contenteditable={get:yt.get,set:function(e,t,n){""===t&&(t="false"),yt.set(e,t,n) }}),Y.support.hrefNormalized||Y.each(["href","src","width","height"],function(e,n){Y.attrHooks[n]=Y.extend(Y.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null===r?t:r}})}),Y.support.style||(Y.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),Y.support.optSelected||(Y.propHooks.selected=Y.extend(Y.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),Y.support.enctype||(Y.propFix.enctype="encoding"),Y.support.checkOn||Y.each(["radio","checkbox"],function(){Y.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),Y.each(["radio","checkbox"],function(){Y.valHooks[this]=Y.extend(Y.valHooks[this],{set:function(e,n){return Y.isArray(n)?e.checked=Y.inArray(Y(e).val(),n)>=0:t}})});var Et=/^(?:textarea|input|select)$/i,Ft=/^([^\.]*|)(?:\.(.+)|)$/,Nt=/(?:^|\s)hover(\.\S+|)\b/,St=/^key/,jt=/^(?:mouse|contextmenu)|click/,Rt=/^(?:focusinfocus|focusoutblur)$/,Ot=function(e){return Y.event.special.hover?e:e.replace(Nt,"mouseenter$1 mouseleave$1")};Y.event={add:function(e,n,r,o,i){var a,s,l,c,u,p,f,d,h,g,m;if(3!==e.nodeType&&8!==e.nodeType&&n&&r&&(a=Y._data(e))){for(r.handler&&(h=r,r=h.handler,i=h.selector),r.guid||(r.guid=Y.guid++),l=a.events,l||(a.events=l={}),s=a.handle,s||(a.handle=s=function(e){return Y===t||e&&Y.event.triggered===e.type?t:Y.event.dispatch.apply(s.elem,arguments)},s.elem=e),n=Y.trim(Ot(n)).split(" "),c=0;n.length>c;c++)u=Ft.exec(n[c])||[],p=u[1],f=(u[2]||"").split(".").sort(),m=Y.event.special[p]||{},p=(i?m.delegateType:m.bindType)||p,m=Y.event.special[p]||{},d=Y.extend({type:p,origType:u[1],data:o,handler:r,guid:r.guid,selector:i,needsContext:i&&Y.expr.match.needsContext.test(i),namespace:f.join(".")},h),g=l[p],g||(g=l[p]=[],g.delegateCount=0,m.setup&&m.setup.call(e,o,f,s)!==!1||(e.addEventListener?e.addEventListener(p,s,!1):e.attachEvent&&e.attachEvent("on"+p,s))),m.add&&(m.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),i?g.splice(g.delegateCount++,0,d):g.push(d),Y.event.global[p]=!0;e=null}},global:{},remove:function(e,t,n,r,o){var i,a,s,l,c,u,p,f,d,h,g,m=Y.hasData(e)&&Y._data(e);if(m&&(f=m.events)){for(t=Y.trim(Ot(t||"")).split(" "),i=0;t.length>i;i++)if(a=Ft.exec(t[i])||[],s=l=a[1],c=a[2],s){for(d=Y.event.special[s]||{},s=(r?d.delegateType:d.bindType)||s,h=f[s]||[],u=h.length,c=c?RegExp("(^|\\.)"+c.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null,p=0;h.length>p;p++)g=h[p],!o&&l!==g.origType||n&&n.guid!==g.guid||c&&!c.test(g.namespace)||r&&r!==g.selector&&("**"!==r||!g.selector)||(h.splice(p--,1),g.selector&&h.delegateCount--,d.remove&&d.remove.call(e,g));0===h.length&&u!==h.length&&(d.teardown&&d.teardown.call(e,c,m.handle)!==!1||Y.removeEvent(e,s,m.handle),delete f[s])}else for(s in f)Y.event.remove(e,s+t[i],n,r,!0);Y.isEmptyObject(f)&&(delete m.handle,Y.removeData(e,"events",!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,o,i){if(!o||3!==o.nodeType&&8!==o.nodeType){var a,s,l,c,u,p,f,d,h,g,m=n.type||n,y=[];if(!Rt.test(m+Y.event.triggered)&&(m.indexOf("!")>=0&&(m=m.slice(0,-1),s=!0),m.indexOf(".")>=0&&(y=m.split("."),m=y.shift(),y.sort()),o&&!Y.event.customEvent[m]||Y.event.global[m]))if(n="object"==typeof n?n[Y.expando]?n:new Y.Event(m,n):new Y.Event(m),n.type=m,n.isTrigger=!0,n.exclusive=s,n.namespace=y.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+y.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,p=0>m.indexOf(":")?"on"+m:"",o){if(n.result=t,n.target||(n.target=o),r=null!=r?Y.makeArray(r):[],r.unshift(n),f=Y.event.special[m]||{},!f.trigger||f.trigger.apply(o,r)!==!1){if(h=[[o,f.bindType||m]],!i&&!f.noBubble&&!Y.isWindow(o)){for(g=f.delegateType||m,c=Rt.test(g+m)?o:o.parentNode,u=o;c;c=c.parentNode)h.push([c,g]),u=c;u===(o.ownerDocument||$)&&h.push([u.defaultView||u.parentWindow||e,g])}for(l=0;h.length>l&&!n.isPropagationStopped();l++)c=h[l][0],n.type=h[l][1],d=(Y._data(c,"events")||{})[n.type]&&Y._data(c,"handle"),d&&d.apply(c,r),d=p&&c[p],d&&Y.acceptData(c)&&d.apply&&d.apply(c,r)===!1&&n.preventDefault();return n.type=m,i||n.isDefaultPrevented()||f._default&&f._default.apply(o.ownerDocument,r)!==!1||"click"===m&&Y.nodeName(o,"a")||!Y.acceptData(o)||p&&o[m]&&("focus"!==m&&"blur"!==m||0!==n.target.offsetWidth)&&!Y.isWindow(o)&&(u=o[p],u&&(o[p]=null),Y.event.triggered=m,o[m](),Y.event.triggered=t,u&&(o[p]=u)),n.result}}else{a=Y.cache;for(l in a)a[l].events&&a[l].events[m]&&Y.event.trigger(n,r,a[l].handle.elem,!0)}}},dispatch:function(n){n=Y.event.fix(n||e.event);var r,o,i,a,s,l,c,u,p,f=(Y._data(this,"events")||{})[n.type]||[],d=f.delegateCount,h=X.call(arguments),g=!n.exclusive&&!n.namespace,m=Y.event.special[n.type]||{},y=[];if(h[0]=n,n.delegateTarget=this,!m.preDispatch||m.preDispatch.call(this,n)!==!1){if(d&&(!n.button||"click"!==n.type))for(i=n.target;i!=this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==n.type){for(s={},c=[],r=0;d>r;r++)u=f[r],p=u.selector,s[p]===t&&(s[p]=u.needsContext?Y(p,this).index(i)>=0:Y.find(p,this,null,[i]).length),s[p]&&c.push(u);c.length&&y.push({elem:i,matches:c})}for(f.length>d&&y.push({elem:this,matches:f.slice(d)}),r=0;y.length>r&&!n.isPropagationStopped();r++)for(l=y[r],n.currentTarget=l.elem,o=0;l.matches.length>o&&!n.isImmediatePropagationStopped();o++)u=l.matches[o],(g||!n.namespace&&!u.namespace||n.namespace_re&&n.namespace_re.test(u.namespace))&&(n.data=u.data,n.handleObj=u,a=((Y.event.special[u.origType]||{}).handle||u.handler).apply(l.elem,h),a!==t&&(n.result=a,a===!1&&(n.preventDefault(),n.stopPropagation())));return m.postDispatch&&m.postDispatch.call(this,n),n.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,o,i,a=n.button,s=n.fromElement;return null==e.pageX&&null!=n.clientX&&(r=e.target.ownerDocument||$,o=r.documentElement,i=r.body,e.pageX=n.clientX+(o&&o.scrollLeft||i&&i.scrollLeft||0)-(o&&o.clientLeft||i&&i.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||i&&i.scrollTop||0)-(o&&o.clientTop||i&&i.clientTop||0)),!e.relatedTarget&&s&&(e.relatedTarget=s===e.target?n.toElement:s),e.which||a===t||(e.which=1&a?1:2&a?3:4&a?2:0),e}},fix:function(e){if(e[Y.expando])return e;var t,n,r=e,o=Y.event.fixHooks[e.type]||{},i=o.props?this.props.concat(o.props):this.props;for(e=Y.Event(r),t=i.length;t;)n=i[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||$),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,o.filter?o.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){Y.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var o=Y.extend(new Y.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?Y.event.trigger(o,null,t):Y.event.dispatch.call(t,o),o.isDefaultPrevented()&&n.preventDefault()}},Y.event.handle=Y.event.dispatch,Y.removeEvent=$.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,n,r){var o="on"+n;e.detachEvent&&(e[o]===t&&(e[o]=null),e.detachEvent(o,r))},Y.Event=function(e,n){return this instanceof Y.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?a:i):this.type=e,n&&Y.extend(this,n),this.timeStamp=e&&e.timeStamp||Y.now(),this[Y.expando]=!0,t):new Y.Event(e,n)},Y.Event.prototype={preventDefault:function(){this.isDefaultPrevented=a;var e=this.originalEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=a;var e=this.originalEvent;e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=a,this.stopPropagation()},isDefaultPrevented:i,isPropagationStopped:i,isImmediatePropagationStopped:i},Y.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){Y.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,o=e.relatedTarget,i=e.handleObj;return i.selector,(!o||o!==r&&!Y.contains(r,o))&&(e.type=i.origType,n=i.handler.apply(this,arguments),e.type=t),n}}}),Y.support.submitBubbles||(Y.event.special.submit={setup:function(){return Y.nodeName(this,"form")?!1:(Y.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=Y.nodeName(n,"input")||Y.nodeName(n,"button")?n.form:t;r&&!Y._data(r,"_submit_attached")&&(Y.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),Y._data(r,"_submit_attached",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&Y.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return Y.nodeName(this,"form")?!1:(Y.event.remove(this,"._submit"),t)}}),Y.support.changeBubbles||(Y.event.special.change={setup:function(){return Et.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(Y.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),Y.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),Y.event.simulate("change",this,e,!0)})),!1):(Y.event.add(this,"beforeactivate._change",function(e){var t=e.target;Et.test(t.nodeName)&&!Y._data(t,"_change_attached")&&(Y.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||Y.event.simulate("change",this.parentNode,e,!0)}),Y._data(t,"_change_attached",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return Y.event.remove(this,"._change"),!Et.test(this.nodeName)}}),Y.support.focusinBubbles||Y.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){Y.event.simulate(t,e.target,Y.event.fix(e),!0)};Y.event.special[t]={setup:function(){0===n++&&$.addEventListener(e,r,!0)},teardown:function(){0===--n&&$.removeEventListener(e,r,!0)}}}),Y.fn.extend({on:function(e,n,r,o,a){var s,l;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(l in e)this.on(l,n,r,e[l],a);return this}if(null==r&&null==o?(o=n,r=n=t):null==o&&("string"==typeof n?(o=r,r=t):(o=r,r=n,n=t)),o===!1)o=i;else if(!o)return this;return 1===a&&(s=o,o=function(e){return Y().off(e),s.apply(this,arguments)},o.guid=s.guid||(s.guid=Y.guid++)),this.each(function(){Y.event.add(this,e,o,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var o,a;if(e&&e.preventDefault&&e.handleObj)return o=e.handleObj,Y(e.delegateTarget).off(o.namespace?o.origType+"."+o.namespace:o.origType,o.selector,o.handler),this;if("object"==typeof e){for(a in e)this.off(a,n,e[a]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=i),this.each(function(){Y.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return Y(this.context).on(e,this.selector,t,n),this},die:function(e,t){return Y(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){Y.event.trigger(e,t,this)})},triggerHandler:function(e,n){return this[0]?Y.event.trigger(e,n,this[0],!0):t},toggle:function(e){var t=arguments,n=e.guid||Y.guid++,r=0,o=function(n){var o=(Y._data(this,"lastToggle"+e.guid)||0)%r;return Y._data(this,"lastToggle"+e.guid,o+1),n.preventDefault(),t[o].apply(this,arguments)||!1};for(o.guid=n;t.length>r;)t[r++].guid=n;return this.click(o)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),Y.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){Y.fn[t]=function(e,n){return null==n&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},St.test(t)&&(Y.event.fixHooks[t]=Y.event.keyHooks),jt.test(t)&&(Y.event.fixHooks[t]=Y.event.mouseHooks)}),/*! * Sizzle CSS Selector Engine * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://sizzlejs.com/ */ function(e,t){function n(e,t,n,r){n=n||[],t=t||j;var o,i,a,s,l=t.nodeType;if(!e||"string"!=typeof e)return n;if(1!==l&&9!==l)return[];if(a=w(t),!a&&!r&&(o=nt.exec(e)))if(s=o[1]){if(9===l){if(i=t.getElementById(s),!i||!i.parentNode)return n;if(i.id===s)return n.push(i),n}else if(t.ownerDocument&&(i=t.ownerDocument.getElementById(s))&&_(t,i)&&i.id===s)return n.push(i),n}else{if(o[2])return I.apply(n,D.call(t.getElementsByTagName(e),0)),n;if((s=o[3])&&ft&&t.getElementsByClassName)return I.apply(n,D.call(t.getElementsByClassName(s),0)),n}return g(e.replace(G,"$1"),t,n,r,a)}function r(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function o(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function i(e){return L(function(t){return t=+t,L(function(n,r){for(var o,i=e([],n.length,t),a=i.length;a--;)n[o=i[a]]&&(n[o]=!(r[o]=n[o]))})})}function a(e,t,n){if(e===t)return n;for(var r=e.nextSibling;r;){if(r===t)return-1;r=r.nextSibling}return 1}function s(e,t){var r,o,i,a,s,l,c,u=q[N][e+" "];if(u)return t?0:u.slice(0);for(s=e,l=[],c=b.preFilter;s;){(!r||(o=Z.exec(s)))&&(o&&(s=s.slice(o[0].length)||s),l.push(i=[])),r=!1,(o=et.exec(s))&&(i.push(r=new S(o.shift())),s=s.slice(r.length),r.type=o[0].replace(G," "));for(a in b.filter)!(o=st[a].exec(s))||c[a]&&!(o=c[a](o))||(i.push(r=new S(o.shift())),s=s.slice(r.length),r.type=a,r.matches=o);if(!r)break}return t?s.length:s?n.error(e):q(e,l).slice(0)}function l(e,t,n){var r=t.dir,o=n&&"parentNode"===t.dir,i=M++;return t.first?function(t,n,i){for(;t=t[r];)if(o||1===t.nodeType)return e(t,n,i)}:function(t,n,a){if(a){for(;t=t[r];)if((o||1===t.nodeType)&&e(t,n,a))return t}else for(var s,l=O+" "+i+" ",c=l+y;t=t[r];)if(o||1===t.nodeType){if((s=t[N])===c)return t.sizset;if("string"==typeof s&&0===s.indexOf(l)){if(t.sizset)return t}else{if(t[N]=c,e(t,n,a))return t.sizset=!0,t;t.sizset=!1}}}}function c(e){return e.length>1?function(t,n,r){for(var o=e.length;o--;)if(!e[o](t,n,r))return!1;return!0}:e[0]}function u(e,t,n,r,o){for(var i,a=[],s=0,l=e.length,c=null!=t;l>s;s++)(i=e[s])&&(!n||n(i,r,o))&&(a.push(i),c&&t.push(s));return a}function p(e,t,n,r,o,i){return r&&!r[N]&&(r=p(r)),o&&!o[N]&&(o=p(o,i)),L(function(i,a,s,l){var c,p,f,d=[],g=[],m=a.length,y=i||h(t||"*",s.nodeType?[s]:s,[]),v=!e||!i&&t?y:u(y,d,e,s,l),b=n?o||(i?e:m||r)?[]:a:v;if(n&&n(v,b,s,l),r)for(c=u(b,g),r(c,[],s,l),p=c.length;p--;)(f=c[p])&&(b[g[p]]=!(v[g[p]]=f));if(i){if(o||e){if(o){for(c=[],p=b.length;p--;)(f=b[p])&&c.push(v[p]=f);o(null,b=[],c,l)}for(p=b.length;p--;)(f=b[p])&&(c=o?P.call(i,f):d[p])>-1&&(i[c]=!(a[c]=f))}}else b=u(b===a?b.splice(m,b.length):b),o?o(null,a,b,l):I.apply(a,b)})}function f(e){for(var t,n,r,o=e.length,i=b.relative[e[0].type],a=i||b.relative[" "],s=i?1:0,u=l(function(e){return e===t},a,!0),d=l(function(e){return P.call(t,e)>-1},a,!0),h=[function(e,n,r){return!i&&(r||n!==k)||((t=n).nodeType?u(e,n,r):d(e,n,r))}];o>s;s++)if(n=b.relative[e[s].type])h=[l(c(h),n)];else{if(n=b.filter[e[s].type].apply(null,e[s].matches),n[N]){for(r=++s;o>r&&!b.relative[e[r].type];r++);return p(s>1&&c(h),s>1&&e.slice(0,s-1).join("").replace(G,"$1"),n,r>s&&f(e.slice(s,r)),o>r&&f(e=e.slice(r)),o>r&&e.join(""))}h.push(n)}return c(h)}function d(e,t){var r=t.length>0,o=e.length>0,i=function(a,s,l,c,p){var f,d,h,g=[],m=0,v="0",x=a&&[],w=null!=p,_=k,C=a||o&&b.find.TAG("*",p&&s.parentNode||s),A=O+=null==_?1:Math.E;for(w&&(k=s!==j&&s,y=i.el);null!=(f=C[v]);v++){if(o&&f){for(d=0;h=e[d];d++)if(h(f,s,l)){c.push(f);break}w&&(O=A,y=++i.el)}r&&((f=!h&&f)&&m--,a&&x.push(f))}if(m+=v,r&&v!==m){for(d=0;h=t[d];d++)h(x,g,s,l);if(a){if(m>0)for(;v--;)x[v]||g[v]||(g[v]=H.call(c));g=u(g)}I.apply(c,g),w&&!a&&g.length>0&&m+t.length>1&&n.uniqueSort(c)}return w&&(O=A,k=_),x};return i.el=0,r?L(i):i}function h(e,t,r){for(var o=0,i=t.length;i>o;o++)n(e,t[o],r);return r}function g(e,t,n,r,o){var i,a,l,c,u,p=s(e);if(p.length,!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(l=a[0]).type&&9===t.nodeType&&!o&&b.relative[a[1].type]){if(t=b.find.ID(l.matches[0].replace(at,""),t,o)[0],!t)return n;e=e.slice(a.shift().length)}for(i=st.POS.test(e)?-1:a.length-1;i>=0&&(l=a[i],!b.relative[c=l.type]);i--)if((u=b.find[c])&&(r=u(l.matches[0].replace(at,""),rt.test(a[0].type)&&t.parentNode||t,o))){if(a.splice(i,1),e=r.length&&a.join(""),!e)return I.apply(n,D.call(r,0)),n;break}}return C(e,p)(r,t,o,n,rt.test(e)),n}function m(){}var y,v,b,x,w,_,C,A,T,k,E=!0,F="undefined",N=("sizcache"+Math.random()).replace(".",""),S=String,j=e.document,R=j.documentElement,O=0,M=0,H=[].pop,I=[].push,D=[].slice,P=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(this[t]===e)return t;return-1},L=function(e,t){return e[N]=null==t||t,e},B=function(){var e={},t=[];return L(function(n,r){return t.push(n)>b.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},$=B(),q=B(),W=B(),U="[\\x20\\t\\r\\n\\f]",Q="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",z=Q.replace("w","w#"),X="([*^$|!~]?=)",J="\\["+U+"*("+Q+")"+U+"*(?:"+X+U+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+z+")|)|)"+U+"*\\]",V=":("+Q+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+J+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+U+"*((?:-\\d)?\\d*)"+U+"*\\)|)(?=[^-]|$)",G=RegExp("^"+U+"+|((?:^|[^\\\\])(?:\\\\.)*)"+U+"+$","g"),Z=RegExp("^"+U+"*,"+U+"*"),et=RegExp("^"+U+"*([\\x20\\t\\r\\n\\f>+~])"+U+"*"),tt=RegExp(V),nt=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,rt=/[\x20\t\r\n\f]*[+~]/,ot=/h\d/i,it=/input|select|textarea|button/i,at=/\\(?!\\)/g,st={ID:RegExp("^#("+Q+")"),CLASS:RegExp("^\\.("+Q+")"),NAME:RegExp("^\\[name=['\"]?("+Q+")['\"]?\\]"),TAG:RegExp("^("+Q.replace("w","w*")+")"),ATTR:RegExp("^"+J),PSEUDO:RegExp("^"+V),POS:RegExp(K,"i"),CHILD:RegExp("^:(only|nth|first|last)-child(?:\\("+U+"*(even|odd|(([+-]|)(\\d*)n|)"+U+"*(?:([+-]|)"+U+"*(\\d+)|))"+U+"*\\)|)","i"),needsContext:RegExp("^"+U+"*[>+~]|"+K,"i")},lt=function(e){var t=j.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},ct=lt(function(e){return e.appendChild(j.createComment("")),!e.getElementsByTagName("*").length}),ut=lt(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==F&&"#"===e.firstChild.getAttribute("href")}),pt=lt(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),ft=lt(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),dt=lt(function(e){e.id=N+0,e.innerHTML="<a name='"+N+"'></a><div name='"+N+"'></div>",R.insertBefore(e,R.firstChild);var t=j.getElementsByName&&j.getElementsByName(N).length===2+j.getElementsByName(N+0).length;return v=!j.getElementById(N),R.removeChild(e),t});try{D.call(R.childNodes,0)[0].nodeType}catch(ht){D=function(e){for(var t,n=[];t=this[e];e++)n.push(t);return n}}n.matches=function(e,t){return n(e,null,null,t)},n.matchesSelector=function(e,t){return n(t,null,null,[e]).length>0},x=n.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=x(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r];r++)n+=x(t);return n},w=n.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},_=n.contains=R.contains?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&1===r.nodeType&&n.contains&&n.contains(r))}:R.compareDocumentPosition?function(e,t){return t&&!!(16&e.compareDocumentPosition(t))}:function(e,t){for(;t=t.parentNode;)if(t===e)return!0;return!1},n.attr=function(e,t){var n,r=w(e);return r||(t=t.toLowerCase()),(n=b.attrHandle[t])?n(e):r||pt?e.getAttribute(t):(n=e.getAttributeNode(t),n?"boolean"==typeof e[t]?e[t]?t:null:n.specified?n.value:null:null)},b=n.selectors={cacheLength:50,createPseudo:L,match:st,attrHandle:ut?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:v?function(e,t,n){if(typeof t.getElementById!==F&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==F&&!r){var o=n.getElementById(e);return o?o.id===e||typeof o.getAttributeNode!==F&&o.getAttributeNode("id").value===e?[o]:t:[]}},TAG:ct?function(e,n){return typeof n.getElementsByTagName!==F?n.getElementsByTagName(e):t}:function(e,t){var n=t.getElementsByTagName(e);if("*"===e){for(var r,o=[],i=0;r=n[i];i++)1===r.nodeType&&o.push(r);return o}return n},NAME:dt&&function(e,n){return typeof n.getElementsByName!==F?n.getElementsByName(name):t},CLASS:ft&&function(e,n,r){return typeof n.getElementsByClassName===F||r?t:n.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(at,""),e[3]=(e[4]||e[5]||"").replace(at,""),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1]?(e[2]||n.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*("even"===e[2]||"odd"===e[2])),e[4]=+(e[6]+e[7]||"odd"===e[2])):e[2]&&n.error(e[0]),e},PSEUDO:function(e){var t,n;return st.CHILD.test(e[0])?null:(e[3]?e[2]=e[3]:(t=e[4])&&(tt.test(t)&&(n=s(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t),e.slice(0,3))}},filter:{ID:v?function(e){return e=e.replace(at,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace(at,""),function(t){var n=typeof t.getAttributeNode!==F&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(at,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=$[N][e+" "];return t||(t=RegExp("(^|"+U+")"+e+"("+U+"|$)"))&&$(e,function(e){return t.test(e.className||typeof e.getAttribute!==F&&e.getAttribute("class")||"")})},ATTR:function(e,t,r){return function(o){var i=n.attr(o,e);return null==i?"!="===t:t?(i+="","="===t?i===r:"!="===t?i!==r:"^="===t?r&&0===i.indexOf(r):"*="===t?r&&i.indexOf(r)>-1:"$="===t?r&&i.substr(i.length-r.length)===r:"~="===t?(" "+i+" ").indexOf(r)>-1:"|="===t?i===r||i.substr(0,r.length+1)===r+"-":!1):!0}},CHILD:function(e,t,n,r){return"nth"===e?function(e){var t,o,i=e.parentNode;if(1===n&&0===r)return!0;if(i)for(o=0,t=i.firstChild;t&&(1!==t.nodeType||(o++,e!==t));t=t.nextSibling);return o-=r,o===n||0===o%n&&o/n>=0}:function(t){var n=t;switch(e){case"only":case"first":for(;n=n.previousSibling;)if(1===n.nodeType)return!1;if("first"===e)return!0;n=t;case"last":for(;n=n.nextSibling;)if(1===n.nodeType)return!1;return!0}}},PSEUDO:function(e,t){var r,o=b.pseudos[e]||b.setFilters[e.toLowerCase()]||n.error("unsupported pseudo: "+e);return o[N]?o(t):o.length>1?(r=[e,e,"",t],b.setFilters.hasOwnProperty(e.toLowerCase())?L(function(e,n){for(var r,i=o(e,t),a=i.length;a--;)r=P.call(e,i[a]),e[r]=!(n[r]=i[a])}):function(e){return o(e,0,r)}):o}},pseudos:{not:L(function(e){var t=[],n=[],r=C(e.replace(G,"$1"));return r[N]?L(function(e,t,n,o){for(var i,a=r(e,null,o,[]),s=e.length;s--;)(i=a[s])&&(e[s]=!(t[s]=i))}):function(e,o,i){return t[0]=e,r(t,null,i,n),!n.pop()}}),has:L(function(e){return function(t){return n(e,t).length>0}}),contains:L(function(e){return function(t){return(t.textContent||t.innerText||x(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!b.pseudos.empty(e)},empty:function(e){var t;for(e=e.firstChild;e;){if(e.nodeName>"@"||3===(t=e.nodeType)||4===t)return!1;e=e.nextSibling}return!0},header:function(e){return ot.test(e.nodeName)},text:function(e){var t,n;return"input"===e.nodeName.toLowerCase()&&"text"===(t=e.type)&&(null==(n=e.getAttribute("type"))||n.toLowerCase()===t)},radio:r("radio"),checkbox:r("checkbox"),file:r("file"),password:r("password"),image:r("image"),submit:o("submit"),reset:o("reset"),button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},input:function(e){return it.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:i(function(){return[0]}),last:i(function(e,t){return[t-1]}),eq:i(function(e,t,n){return[0>n?n+t:n]}),even:i(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:i(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:i(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r);return e}),gt:i(function(e,t,n){for(var r=0>n?n+t:n;t>++r;)e.push(r);return e})}},A=R.compareDocumentPosition?function(e,t){return e===t?(T=!0,0):(e.compareDocumentPosition&&t.compareDocumentPosition?4&e.compareDocumentPosition(t):e.compareDocumentPosition)?-1:1}:function(e,t){if(e===t)return T=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,o=[],i=[],s=e.parentNode,l=t.parentNode,c=s;if(s===l)return a(e,t);if(!s)return-1;if(!l)return 1;for(;c;)o.unshift(c),c=c.parentNode;for(c=l;c;)i.unshift(c),c=c.parentNode;n=o.length,r=i.length;for(var u=0;n>u&&r>u;u++)if(o[u]!==i[u])return a(o[u],i[u]);return u===n?a(e,i[u],-1):a(o[u],t,1)},[0,0].sort(A),E=!T,n.uniqueSort=function(e){var t,n=[],r=1,o=0;if(T=E,e.sort(A),T){for(;t=e[r];r++)t===e[r-1]&&(o=n.push(r));for(;o--;)e.splice(n[o],1)}return e},n.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},C=n.compile=function(e,t){var n,r=[],o=[],i=W[N][e+" "];if(!i){for(t||(t=s(e)),n=t.length;n--;)i=f(t[n]),i[N]?r.push(i):o.push(i);i=W(e,d(o,r))}return i},j.querySelectorAll&&function(){var e,t=g,r=/'|\\/g,o=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],a=[":active"],l=R.matchesSelector||R.mozMatchesSelector||R.webkitMatchesSelector||R.oMatchesSelector||R.msMatchesSelector;lt(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+U+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),lt(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+U+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=RegExp(i.join("|")),g=function(e,n,o,a,l){if(!a&&!l&&!i.test(e)){var c,u,p=!0,f=N,d=n,h=9===n.nodeType&&e;if(1===n.nodeType&&"object"!==n.nodeName.toLowerCase()){for(c=s(e),(p=n.getAttribute("id"))?f=p.replace(r,"\\$&"):n.setAttribute("id",f),f="[id='"+f+"'] ",u=c.length;u--;)c[u]=f+c[u].join("");d=rt.test(e)&&n.parentNode||n,h=c.join(",")}if(h)try{return I.apply(o,D.call(d.querySelectorAll(h),0)),o}catch(g){}finally{p||n.removeAttribute("id")}}return t(e,n,o,a,l)},l&&(lt(function(t){e=l.call(t,"div");try{l.call(t,"[test!='']:sizzle"),a.push("!=",V)}catch(n){}}),a=RegExp(a.join("|")),n.matchesSelector=function(t,r){if(r=r.replace(o,"='$1']"),!w(t)&&!a.test(r)&&!i.test(r))try{var s=l.call(t,r);if(s||e||t.document&&11!==t.document.nodeType)return s}catch(c){}return n(r,null,null,[t]).length>0})}(),b.pseudos.nth=b.pseudos.eq,b.filters=m.prototype=b.pseudos,b.setFilters=new m,n.attr=Y.attr,Y.find=n,Y.expr=n.selectors,Y.expr[":"]=Y.expr.pseudos,Y.unique=n.uniqueSort,Y.text=n.getText,Y.isXMLDoc=n.isXML,Y.contains=n.contains}(e);var Mt=/Until$/,Ht=/^(?:parents|prev(?:Until|All))/,It=/^.[^:#\[\.,]*$/,Dt=Y.expr.match.needsContext,Pt={children:!0,contents:!0,next:!0,prev:!0};Y.fn.extend({find:function(e){var t,n,r,o,i,a,s=this;if("string"!=typeof e)return Y(e).filter(function(){for(t=0,n=s.length;n>t;t++)if(Y.contains(s[t],this))return!0});for(a=this.pushStack("","find",e),t=0,n=this.length;n>t;t++)if(r=a.length,Y.find(e,this[t],a),t>0)for(o=r;a.length>o;o++)for(i=0;r>i;i++)if(a[i]===a[o]){a.splice(o--,1);break}return a},has:function(e){var t,n=Y(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(Y.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(c(this,e,!1),"not",e)},filter:function(e){return this.pushStack(c(this,e,!0),"filter",e)},is:function(e){return!!e&&("string"==typeof e?Dt.test(e)?Y(e,this.context).index(this[0])>=0:Y.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){for(var n,r=0,o=this.length,i=[],a=Dt.test(e)||"string"!=typeof e?Y(e,t||this.context):0;o>r;r++)for(n=this[r];n&&n.ownerDocument&&n!==t&&11!==n.nodeType;){if(a?a.index(n)>-1:Y.find.matchesSelector(n,e)){i.push(n);break}n=n.parentNode}return i=i.length>1?Y.unique(i):i,this.pushStack(i,"closest",e)},index:function(e){return e?"string"==typeof e?Y.inArray(this[0],Y(e)):Y.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n="string"==typeof e?Y(e,t):Y.makeArray(e&&e.nodeType?[e]:e),r=Y.merge(this.get(),n);return this.pushStack(s(n[0])||s(r[0])?r:Y.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),Y.fn.andSelf=Y.fn.addBack,Y.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return Y.dir(e,"parentNode")},parentsUntil:function(e,t,n){return Y.dir(e,"parentNode",n)},next:function(e){return l(e,"nextSibling")},prev:function(e){return l(e,"previousSibling")},nextAll:function(e){return Y.dir(e,"nextSibling")},prevAll:function(e){return Y.dir(e,"previousSibling")},nextUntil:function(e,t,n){return Y.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return Y.dir(e,"previousSibling",n)},siblings:function(e){return Y.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return Y.sibling(e.firstChild)},contents:function(e){return Y.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:Y.merge([],e.childNodes)}},function(e,t){Y.fn[e]=function(n,r){var o=Y.map(this,t,n);return Mt.test(e)||(r=n),r&&"string"==typeof r&&(o=Y.filter(r,o)),o=this.length>1&&!Pt[e]?Y.unique(o):o,this.length>1&&Ht.test(e)&&(o=o.reverse()),this.pushStack(o,e,X.call(arguments).join(","))}}),Y.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?Y.find.matchesSelector(t[0],e)?[t[0]]:[]:Y.find.matches(e,t)},dir:function(e,n,r){for(var o=[],i=e[n];i&&9!==i.nodeType&&(r===t||1!==i.nodeType||!Y(i).is(r));)1===i.nodeType&&o.push(i),i=i[n];return o},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});var Lt="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Bt=/ jQuery\d+="(?:null|\d+)"/g,$t=/^\s+/,qt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Wt=/<([\w:]+)/,Ut=/<tbody/i,Qt=/<|&#?\w+;/,zt=/<(?:script|style|link)/i,Xt=/<(?:script|object|embed|option|style)/i,Jt=RegExp("<(?:"+Lt+")[\\s/>]","i"),Vt=/^(?:checkbox|radio)$/,Kt=/checked\s*(?:[^=]|=\s*.checked.)/i,Gt=/\/(java|ecma)script/i,Yt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Zt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},en=u($),tn=en.appendChild($.createElement("div"));Zt.optgroup=Zt.option,Zt.tbody=Zt.tfoot=Zt.colgroup=Zt.caption=Zt.thead,Zt.th=Zt.td,Y.support.htmlSerialize||(Zt._default=[1,"X<div>","</div>"]),Y.fn.extend({text:function(e){return Y.access(this,function(e){return e===t?Y.text(this):this.empty().append((this[0]&&this[0].ownerDocument||$).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(Y.isFunction(e))return this.each(function(t){Y(this).wrapAll(e.call(this,t))});if(this[0]){var t=Y(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return Y.isFunction(e)?this.each(function(t){Y(this).wrapInner(e.call(this,t))}):this.each(function(){var t=Y(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=Y.isFunction(e);return this.each(function(n){Y(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){Y.nodeName(this,"body")||Y(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!s(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=Y.clean(arguments);return this.pushStack(Y.merge(e,this),"before",this.selector)}},after:function(){if(!s(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=Y.clean(arguments);return this.pushStack(Y.merge(this,e),"after",this.selector)}},remove:function(e,t){for(var n,r=0;null!=(n=this[r]);r++)(!e||Y.filter(e,[n]).length)&&(t||1!==n.nodeType||(Y.cleanData(n.getElementsByTagName("*")),Y.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)for(1===e.nodeType&&Y.cleanData(e.getElementsByTagName("*"));e.firstChild;)e.removeChild(e.firstChild);return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return Y.clone(this,e,t)})},html:function(e){return Y.access(this,function(e){var n=this[0]||{},r=0,o=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(Bt,""):t;if(!("string"!=typeof e||zt.test(e)||!Y.support.htmlSerialize&&Jt.test(e)||!Y.support.leadingWhitespace&&$t.test(e)||Zt[(Wt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(qt,"<$1></$2>");try{for(;o>r;r++)n=this[r]||{},1===n.nodeType&&(Y.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(i){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return s(this[0])?this.length?this.pushStack(Y(Y.isFunction(e)?e():e),"replaceWith",e):this:Y.isFunction(e)?this.each(function(t){var n=Y(this),r=n.html();n.replaceWith(e.call(this,t,r))}):("string"!=typeof e&&(e=Y(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;Y(this).remove(),t?Y(t).before(e):Y(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var o,i,a,s,l=0,c=e[0],u=[],f=this.length;if(!Y.support.checkClone&&f>1&&"string"==typeof c&&Kt.test(c))return this.each(function(){Y(this).domManip(e,n,r)});if(Y.isFunction(c))return this.each(function(o){var i=Y(this);e[0]=c.call(this,o,n?i.html():t),i.domManip(e,n,r)});if(this[0]){if(o=Y.buildFragment(e,this,u),a=o.fragment,i=a.firstChild,1===a.childNodes.length&&(a=i),i)for(n=n&&Y.nodeName(i,"tr"),s=o.cacheable||f-1;f>l;l++)r.call(n&&Y.nodeName(this[l],"table")?p(this[l],"tbody"):this[l],l===s?a:Y.clone(a,!0,!0));a=i=null,u.length&&Y.each(u,function(e,t){t.src?Y.ajax?Y.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):Y.error("no ajax"):Y.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Yt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),Y.buildFragment=function(e,n,r){var o,i,a,s=e[0];return n=n||$,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,!(1===e.length&&"string"==typeof s&&512>s.length&&n===$&&"<"===s.charAt(0))||Xt.test(s)||!Y.support.checkClone&&Kt.test(s)||!Y.support.html5Clone&&Jt.test(s)||(i=!0,o=Y.fragments[s],a=o!==t),o||(o=n.createDocumentFragment(),Y.clean(e,n,o,r),i&&(Y.fragments[s]=a&&o)),{fragment:o,cacheable:i}},Y.fragments={},Y.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){Y.fn[e]=function(n){var r,o=0,i=[],a=Y(n),s=a.length,l=1===this.length&&this[0].parentNode;if((null==l||l&&11===l.nodeType&&1===l.childNodes.length)&&1===s)return a[t](this[0]),this;for(;s>o;o++)r=(o>0?this.clone(!0):this).get(),Y(a[o])[t](r),i=i.concat(r);return this.pushStack(i,e,a.selector)}}),Y.extend({clone:function(e,t,n){var r,o,i,a;if(Y.support.html5Clone||Y.isXMLDoc(e)||!Jt.test("<"+e.nodeName+">")?a=e.cloneNode(!0):(tn.innerHTML=e.outerHTML,tn.removeChild(a=tn.firstChild)),!(Y.support.noCloneEvent&&Y.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||Y.isXMLDoc(e)))for(d(e,a),r=h(e),o=h(a),i=0;r[i];++i)o[i]&&d(r[i],o[i]);if(t&&(f(e,a),n))for(r=h(e),o=h(a),i=0;r[i];++i)f(r[i],o[i]);return r=o=null,a},clean:function(e,n,r,o){var i,a,s,l,c,p,f,d,h,m,y,v=n===$&&en,b=[];for(n&&n.createDocumentFragment!==t||(n=$),i=0;null!=(s=e[i]);i++)if("number"==typeof s&&(s+=""),s){if("string"==typeof s)if(Qt.test(s)){for(v=v||u(n),f=n.createElement("div"),v.appendChild(f),s=s.replace(qt,"<$1></$2>"),l=(Wt.exec(s)||["",""])[1].toLowerCase(),c=Zt[l]||Zt._default,p=c[0],f.innerHTML=c[1]+s+c[2];p--;)f=f.lastChild;if(!Y.support.tbody)for(d=Ut.test(s),h="table"!==l||d?"<table>"!==c[1]||d?[]:f.childNodes:f.firstChild&&f.firstChild.childNodes,a=h.length-1;a>=0;--a)Y.nodeName(h[a],"tbody")&&!h[a].childNodes.length&&h[a].parentNode.removeChild(h[a]);!Y.support.leadingWhitespace&&$t.test(s)&&f.insertBefore(n.createTextNode($t.exec(s)[0]),f.firstChild),s=f.childNodes,f.parentNode.removeChild(f)}else s=n.createTextNode(s);s.nodeType?b.push(s):Y.merge(b,s)}if(f&&(s=f=v=null),!Y.support.appendChecked)for(i=0;null!=(s=b[i]);i++)Y.nodeName(s,"input")?g(s):s.getElementsByTagName!==t&&Y.grep(s.getElementsByTagName("input"),g);if(r)for(m=function(e){return!e.type||Gt.test(e.type)?o?o.push(e.parentNode?e.parentNode.removeChild(e):e):r.appendChild(e):t},i=0;null!=(s=b[i]);i++)Y.nodeName(s,"script")&&m(s)||(r.appendChild(s),s.getElementsByTagName!==t&&(y=Y.grep(Y.merge([],s.getElementsByTagName("script")),m),b.splice.apply(b,[i+1,0].concat(y)),i+=y.length));return b},cleanData:function(e,t){for(var n,r,o,i,a=0,s=Y.expando,l=Y.cache,c=Y.support.deleteExpando,u=Y.event.special;null!=(o=e[a]);a++)if((t||Y.acceptData(o))&&(r=o[s],n=r&&l[r])){if(n.events)for(i in n.events)u[i]?Y.event.remove(o,i):Y.removeEvent(o,i,n.handle);l[r]&&(delete l[r],c?delete o[s]:o.removeAttribute?o.removeAttribute(s):o[s]=null,Y.deletedIds.push(r))}}}),function(){var e,t;Y.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=Y.uaMatch(W.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),Y.browser=t,Y.sub=function(){function e(t,n){return new e.fn.init(t,n)}Y.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(n,r){return r&&r instanceof Y&&!(r instanceof e)&&(r=e(r)),Y.fn.init.call(this,n,r,t)},e.fn.init.prototype=e.fn;var t=e($);return e}}();var nn,rn,on,an=/alpha\([^)]*\)/i,sn=/opacity=([^)]*)/,ln=/^(top|right|bottom|left)$/,cn=/^(none|table(?!-c[ea]).+)/,un=/^margin/,pn=RegExp("^("+Z+")(.*)$","i"),fn=RegExp("^("+Z+")(?!px)[a-z%]+$","i"),dn=RegExp("^([-+])=("+Z+")","i"),hn={BODY:"block"},gn={position:"absolute",visibility:"hidden",display:"block"},mn={letterSpacing:0,fontWeight:400},yn=["Top","Right","Bottom","Left"],vn=["Webkit","O","Moz","ms"],bn=Y.fn.toggle;Y.fn.extend({css:function(e,n){return Y.access(this,function(e,n,r){return r!==t?Y.style(e,n,r):Y.css(e,n)},e,n,arguments.length>1)},show:function(){return v(this,!0)},hide:function(){return v(this)},toggle:function(e,t){var n="boolean"==typeof e;return Y.isFunction(e)&&Y.isFunction(t)?bn.apply(this,arguments):this.each(function(){(n?e:y(this))?Y(this).show():Y(this).hide()})}}),Y.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=nn(e,"opacity");return""===n?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":Y.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,o){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,a,s,l=Y.camelCase(n),c=e.style;if(n=Y.cssProps[l]||(Y.cssProps[l]=m(c,l)),s=Y.cssHooks[n]||Y.cssHooks[l],r===t)return s&&"get"in s&&(i=s.get(e,!1,o))!==t?i:c[n];if(a=typeof r,"string"===a&&(i=dn.exec(r))&&(r=(i[1]+1)*i[2]+parseFloat(Y.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||Y.cssNumber[l]||(r+="px"),s&&"set"in s&&(r=s.set(e,r,o))===t)))try{c[n]=r}catch(u){}}},css:function(e,n,r,o){var i,a,s,l=Y.camelCase(n);return n=Y.cssProps[l]||(Y.cssProps[l]=m(e.style,l)),s=Y.cssHooks[n]||Y.cssHooks[l],s&&"get"in s&&(i=s.get(e,!0,o)),i===t&&(i=nn(e,n)),"normal"===i&&n in mn&&(i=mn[n]),r||o!==t?(a=parseFloat(i),r||Y.isNumeric(a)?a||0:i):i},swap:function(e,t,n){var r,o,i={};for(o in t)i[o]=e.style[o],e.style[o]=t[o];r=n.call(e);for(o in t)e.style[o]=i[o];return r}}),e.getComputedStyle?nn=function(t,n){var r,o,i,a,s=e.getComputedStyle(t,null),l=t.style;return s&&(r=s.getPropertyValue(n)||s[n],""!==r||Y.contains(t.ownerDocument,t)||(r=Y.style(t,n)),fn.test(r)&&un.test(n)&&(o=l.width,i=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=r,r=s.width,l.width=o,l.minWidth=i,l.maxWidth=a)),r}:$.documentElement.currentStyle&&(nn=function(e,t){var n,r,o=e.currentStyle&&e.currentStyle[t],i=e.style;return null==o&&i&&i[t]&&(o=i[t]),fn.test(o)&&!ln.test(t)&&(n=i.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),i.left="fontSize"===t?"1em":o,o=i.pixelLeft+"px",i.left=n,r&&(e.runtimeStyle.left=r)),""===o?"auto":o}),Y.each(["height","width"],function(e,n){Y.cssHooks[n]={get:function(e,r,o){return r?0===e.offsetWidth&&cn.test(nn(e,"display"))?Y.swap(e,gn,function(){return w(e,n,o)}):w(e,n,o):t},set:function(e,t,r){return b(e,t,r?x(e,n,r,Y.support.boxSizing&&"border-box"===Y.css(e,"boxSizing")):0)}}}),Y.support.opacity||(Y.cssHooks.opacity={get:function(e,t){return sn.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,o=Y.isNumeric(t)?"alpha(opacity="+100*t+")":"",i=r&&r.filter||n.filter||"";n.zoom=1,t>=1&&""===Y.trim(i.replace(an,""))&&n.removeAttribute&&(n.removeAttribute("filter"),r&&!r.filter)||(n.filter=an.test(i)?i.replace(an,o):i+" "+o)}}),Y(function(){Y.support.reliableMarginRight||(Y.cssHooks.marginRight={get:function(e,n){return Y.swap(e,{display:"inline-block"},function(){return n?nn(e,"marginRight"):t})}}),!Y.support.pixelPosition&&Y.fn.position&&Y.each(["top","left"],function(e,t){Y.cssHooks[t]={get:function(e,n){if(n){var r=nn(e,t);return fn.test(r)?Y(e).position()[t]+"px":r}}}})}),Y.expr&&Y.expr.filters&&(Y.expr.filters.hidden=function(e){return 0===e.offsetWidth&&0===e.offsetHeight||!Y.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||nn(e,"display"))},Y.expr.filters.visible=function(e){return!Y.expr.filters.hidden(e)}),Y.each({margin:"",padding:"",border:"Width"},function(e,t){Y.cssHooks[e+t]={expand:function(n){var r,o="string"==typeof n?n.split(" "):[n],i={};for(r=0;4>r;r++)i[e+yn[r]+t]=o[r]||o[r-2]||o[0];return i}},un.test(e)||(Y.cssHooks[e+t].set=b)});var xn=/%20/g,wn=/\[\]$/,_n=/\r?\n/g,Cn=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,An=/^(?:select|textarea)/i; Y.fn.extend({serialize:function(){return Y.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?Y.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||An.test(this.nodeName)||Cn.test(this.type))}).map(function(e,t){var n=Y(this).val();return null==n?null:Y.isArray(n)?Y.map(n,function(e){return{name:t.name,value:e.replace(_n,"\r\n")}}):{name:t.name,value:n.replace(_n,"\r\n")}}).get()}}),Y.param=function(e,n){var r,o=[],i=function(e,t){t=Y.isFunction(t)?t():null==t?"":t,o[o.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=Y.ajaxSettings&&Y.ajaxSettings.traditional),Y.isArray(e)||e.jquery&&!Y.isPlainObject(e))Y.each(e,function(){i(this.name,this.value)});else for(r in e)C(r,e[r],n,i);return o.join("&").replace(xn,"+")};var Tn,kn,En=/#.*$/,Fn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Sn=/^(?:GET|HEAD)$/,jn=/^\/\//,Rn=/\?/,On=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,Mn=/([?&])_=[^&]*/,Hn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,In=Y.fn.load,Dn={},Pn={},Ln=["*/"]+["*"];try{kn=q.href}catch(Bn){kn=$.createElement("a"),kn.href="",kn=kn.href}Tn=Hn.exec(kn.toLowerCase())||[],Y.fn.load=function(e,n,r){if("string"!=typeof e&&In)return In.apply(this,arguments);if(!this.length)return this;var o,i,a,s=this,l=e.indexOf(" ");return l>=0&&(o=e.slice(l,e.length),e=e.slice(0,l)),Y.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(i="POST"),Y.ajax({url:e,type:i,dataType:"html",data:n,complete:function(e,t){r&&s.each(r,a||[e.responseText,t,e])}}).done(function(e){a=arguments,s.html(o?Y("<div>").append(e.replace(On,"")).find(o):e)}),this},Y.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){Y.fn[t]=function(e){return this.on(t,e)}}),Y.each(["get","post"],function(e,n){Y[n]=function(e,r,o,i){return Y.isFunction(r)&&(i=i||o,o=r,r=t),Y.ajax({type:n,url:e,data:r,success:o,dataType:i})}}),Y.extend({getScript:function(e,n){return Y.get(e,t,n,"script")},getJSON:function(e,t,n){return Y.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?k(e,Y.ajaxSettings):(t=e,e=Y.ajaxSettings),k(e,t),e},ajaxSettings:{url:kn,isLocal:Nn.test(Tn[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Ln},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":Y.parseJSON,"text xml":Y.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:A(Dn),ajaxTransport:A(Pn),ajax:function(e,n){function r(e,n,r,a){var c,p,v,b,w,C=n;2!==x&&(x=2,l&&clearTimeout(l),s=t,i=a||"",_.readyState=e>0?4:0,r&&(b=E(f,_,r)),e>=200&&300>e||304===e?(f.ifModified&&(w=_.getResponseHeader("Last-Modified"),w&&(Y.lastModified[o]=w),w=_.getResponseHeader("Etag"),w&&(Y.etag[o]=w)),304===e?(C="notmodified",c=!0):(c=F(f,b),C=c.state,p=c.data,v=c.error,c=!v)):(v=C,(!C||e)&&(C="error",0>e&&(e=0))),_.status=e,_.statusText=(n||C)+"",c?g.resolveWith(d,[p,C,_]):g.rejectWith(d,[_,C,v]),_.statusCode(y),y=t,u&&h.trigger("ajax"+(c?"Success":"Error"),[_,f,c?p:v]),m.fireWith(d,[_,C]),u&&(h.trigger("ajaxComplete",[_,f]),--Y.active||Y.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=t),n=n||{};var o,i,a,s,l,c,u,p,f=Y.ajaxSetup({},n),d=f.context||f,h=d!==f&&(d.nodeType||d instanceof Y)?Y(d):Y.event,g=Y.Deferred(),m=Y.Callbacks("once memory"),y=f.statusCode||{},v={},b={},x=0,w="canceled",_={readyState:0,setRequestHeader:function(e,t){if(!x){var n=e.toLowerCase();e=b[n]=b[n]||e,v[e]=t}return this},getAllResponseHeaders:function(){return 2===x?i:null},getResponseHeader:function(e){var n;if(2===x){if(!a)for(a={};n=Fn.exec(i);)a[n[1].toLowerCase()]=n[2];n=a[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return x||(f.mimeType=e),this},abort:function(e){return e=e||w,s&&s.abort(e),r(0,e),this}};if(g.promise(_),_.success=_.done,_.error=_.fail,_.complete=m.add,_.statusCode=function(e){if(e){var t;if(2>x)for(t in e)y[t]=[y[t],e[t]];else t=e[_.status],_.always(t)}return this},f.url=((e||f.url)+"").replace(En,"").replace(jn,Tn[1]+"//"),f.dataTypes=Y.trim(f.dataType||"*").toLowerCase().split(tt),null==f.crossDomain&&(c=Hn.exec(f.url.toLowerCase()),f.crossDomain=!(!c||c[1]===Tn[1]&&c[2]===Tn[2]&&(c[3]||("http:"===c[1]?80:443))==(Tn[3]||("http:"===Tn[1]?80:443)))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=Y.param(f.data,f.traditional)),T(Dn,f,n,_),2===x)return _;if(u=f.global,f.type=f.type.toUpperCase(),f.hasContent=!Sn.test(f.type),u&&0===Y.active++&&Y.event.trigger("ajaxStart"),!f.hasContent&&(f.data&&(f.url+=(Rn.test(f.url)?"&":"?")+f.data,delete f.data),o=f.url,f.cache===!1)){var C=Y.now(),A=f.url.replace(Mn,"$1_="+C);f.url=A+(A===f.url?(Rn.test(f.url)?"&":"?")+"_="+C:"")}(f.data&&f.hasContent&&f.contentType!==!1||n.contentType)&&_.setRequestHeader("Content-Type",f.contentType),f.ifModified&&(o=o||f.url,Y.lastModified[o]&&_.setRequestHeader("If-Modified-Since",Y.lastModified[o]),Y.etag[o]&&_.setRequestHeader("If-None-Match",Y.etag[o])),_.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+Ln+"; q=0.01":""):f.accepts["*"]);for(p in f.headers)_.setRequestHeader(p,f.headers[p]);if(f.beforeSend&&(f.beforeSend.call(d,_,f)===!1||2===x))return _.abort();w="abort";for(p in{success:1,error:1,complete:1})_[p](f[p]);if(s=T(Pn,f,n,_)){_.readyState=1,u&&h.trigger("ajaxSend",[_,f]),f.async&&f.timeout>0&&(l=setTimeout(function(){_.abort("timeout")},f.timeout));try{x=1,s.send(v,r)}catch(k){if(!(2>x))throw k;r(-1,k)}}else r(-1,"No Transport");return _},active:0,lastModified:{},etag:{}});var $n=[],qn=/\?/,Wn=/(=)\?(?=&|$)|\?\?/,Un=Y.now();Y.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=$n.pop()||Y.expando+"_"+Un++;return this[e]=!0,e}}),Y.ajaxPrefilter("json jsonp",function(n,r,o){var i,a,s,l=n.data,c=n.url,u=n.jsonp!==!1,p=u&&Wn.test(c),f=u&&!p&&"string"==typeof l&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Wn.test(l);return"jsonp"===n.dataTypes[0]||p||f?(i=n.jsonpCallback=Y.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,a=e[i],p?n.url=c.replace(Wn,"$1"+i):f?n.data=l.replace(Wn,"$1"+i):u&&(n.url+=(qn.test(c)?"&":"?")+n.jsonp+"="+i),n.converters["script json"]=function(){return s||Y.error(i+" was not called"),s[0]},n.dataTypes[0]="json",e[i]=function(){s=arguments},o.always(function(){e[i]=a,n[i]&&(n.jsonpCallback=r.jsonpCallback,$n.push(i)),s&&Y.isFunction(a)&&a(s[0]),s=a=t}),"script"):t}),Y.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return Y.globalEval(e),e}}}),Y.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),Y.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=$.head||$.getElementsByTagName("head")[0]||$.documentElement;return{send:function(o,i){n=$.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,o){(o||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,o||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Qn,zn=e.ActiveXObject?function(){for(var e in Qn)Qn[e](0,1)}:!1,Xn=0;Y.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&N()||S()}:N,function(e){Y.extend(Y.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(Y.ajaxSettings.xhr()),Y.support.ajax&&Y.ajaxTransport(function(n){if(!n.crossDomain||Y.support.cors){var r;return{send:function(o,i){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");try{for(s in o)l.setRequestHeader(s,o[s])}catch(c){}l.send(n.hasContent&&n.data||null),r=function(e,o){var s,c,u,p,f;try{if(r&&(o||4===l.readyState))if(r=t,a&&(l.onreadystatechange=Y.noop,zn&&delete Qn[a]),o)4!==l.readyState&&l.abort();else{s=l.status,u=l.getAllResponseHeaders(),p={},f=l.responseXML,f&&f.documentElement&&(p.xml=f);try{p.text=l.responseText}catch(d){}try{c=l.statusText}catch(d){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(h){o||i(-1,h)}p&&i(s,c,p,u)},n.async?4===l.readyState?setTimeout(r,0):(a=++Xn,zn&&(Qn||(Qn={},Y(e).unload(zn)),Qn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var Jn,Vn,Kn=/^(?:toggle|show|hide)$/,Gn=RegExp("^(?:([-+])=|)("+Z+")([a-z%]*)$","i"),Yn=/queueHooks$/,Zn=[H],er={"*":[function(e,t){var n,r,o=this.createTween(e,t),i=Gn.exec(t),a=o.cur(),s=+a||0,l=1,c=20;if(i){if(n=+i[2],r=i[3]||(Y.cssNumber[e]?"":"px"),"px"!==r&&s){s=Y.css(o.elem,e,!0)||n||1;do l=l||".5",s/=l,Y.style(o.elem,e,s+r);while(l!==(l=o.cur()/a)&&1!==l&&--c)}o.unit=r,o.start=s,o.end=i[1]?s+(i[1]+1)*n:n}return o}]};Y.Animation=Y.extend(O,{tweener:function(e,t){Y.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,o=e.length;o>r;r++)n=e[r],er[n]=er[n]||[],er[n].unshift(t)},prefilter:function(e,t){t?Zn.unshift(e):Zn.push(e)}}),Y.Tween=I,I.prototype={constructor:I,init:function(e,t,n,r,o,i){this.elem=e,this.prop=n,this.easing=o||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=i||(Y.cssNumber[n]?"":"px")},cur:function(){var e=I.propHooks[this.prop];return e&&e.get?e.get(this):I.propHooks._default.get(this)},run:function(e){var t,n=I.propHooks[this.prop];return this.pos=t=this.options.duration?Y.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):I.propHooks._default.set(this),this}},I.prototype.init.prototype=I.prototype,I.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=Y.css(e.elem,e.prop,!1,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){Y.fx.step[e.prop]?Y.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[Y.cssProps[e.prop]]||Y.cssHooks[e.prop])?Y.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},I.propHooks.scrollTop=I.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},Y.each(["toggle","show","hide"],function(e,t){var n=Y.fn[t];Y.fn[t]=function(r,o,i){return null==r||"boolean"==typeof r||!e&&Y.isFunction(r)&&Y.isFunction(o)?n.apply(this,arguments):this.animate(D(t,!0),r,o,i)}}),Y.fn.extend({fadeTo:function(e,t,n,r){return this.filter(y).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var o=Y.isEmptyObject(e),i=Y.speed(t,n,r),a=function(){var t=O(this,Y.extend({},e),i);o&&t.stop(!0)};return o||i.queue===!1?this.each(a):this.queue(i.queue,a)},stop:function(e,n,r){var o=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",i=Y.timers,a=Y._data(this);if(n)a[n]&&a[n].stop&&o(a[n]);else for(n in a)a[n]&&a[n].stop&&Yn.test(n)&&o(a[n]);for(n=i.length;n--;)i[n].elem!==this||null!=e&&i[n].queue!==e||(i[n].anim.stop(r),t=!1,i.splice(n,1));(t||!r)&&Y.dequeue(this,e)})}}),Y.each({slideDown:D("show"),slideUp:D("hide"),slideToggle:D("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){Y.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),Y.speed=function(e,t,n){var r=e&&"object"==typeof e?Y.extend({},e):{complete:n||!n&&t||Y.isFunction(e)&&e,duration:e,easing:n&&t||t&&!Y.isFunction(t)&&t};return r.duration=Y.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in Y.fx.speeds?Y.fx.speeds[r.duration]:Y.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){Y.isFunction(r.old)&&r.old.call(this),r.queue&&Y.dequeue(this,r.queue)},r},Y.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},Y.timers=[],Y.fx=I.prototype.init,Y.fx.tick=function(){var e,n=Y.timers,r=0;for(Jn=Y.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||Y.fx.stop(),Jn=t},Y.fx.timer=function(e){e()&&Y.timers.push(e)&&!Vn&&(Vn=setInterval(Y.fx.tick,Y.fx.interval))},Y.fx.interval=13,Y.fx.stop=function(){clearInterval(Vn),Vn=null},Y.fx.speeds={slow:600,fast:200,_default:400},Y.fx.step={},Y.expr&&Y.expr.filters&&(Y.expr.filters.animated=function(e){return Y.grep(Y.timers,function(t){return e===t.elem}).length});var tr=/^(?:body|html)$/i;Y.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){Y.offset.setOffset(this,e,t)});var n,r,o,i,a,s,l,c={top:0,left:0},u=this[0],p=u&&u.ownerDocument;if(p)return(r=p.body)===u?Y.offset.bodyOffset(u):(n=p.documentElement,Y.contains(n,u)?(u.getBoundingClientRect!==t&&(c=u.getBoundingClientRect()),o=P(p),i=n.clientTop||r.clientTop||0,a=n.clientLeft||r.clientLeft||0,s=o.pageYOffset||n.scrollTop,l=o.pageXOffset||n.scrollLeft,{top:c.top+s-i,left:c.left+l-a}):c)},Y.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return Y.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(Y.css(e,"marginTop"))||0,n+=parseFloat(Y.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=Y.css(e,"position");"static"===r&&(e.style.position="relative");var o,i,a=Y(e),s=a.offset(),l=Y.css(e,"top"),c=Y.css(e,"left"),u=("absolute"===r||"fixed"===r)&&Y.inArray("auto",[l,c])>-1,p={},f={};u?(f=a.position(),o=f.top,i=f.left):(o=parseFloat(l)||0,i=parseFloat(c)||0),Y.isFunction(t)&&(t=t.call(e,n,s)),null!=t.top&&(p.top=t.top-s.top+o),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):a.css(p)}},Y.fn.extend({position:function(){if(this[0]){var e=this[0],t=this.offsetParent(),n=this.offset(),r=tr.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(Y.css(e,"marginTop"))||0,n.left-=parseFloat(Y.css(e,"marginLeft"))||0,r.top+=parseFloat(Y.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(Y.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||$.body;e&&!tr.test(e.nodeName)&&"static"===Y.css(e,"position");)e=e.offsetParent;return e||$.body})}}),Y.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);Y.fn[e]=function(o){return Y.access(this,function(e,o,i){var a=P(e);return i===t?a?n in a?a[n]:a.document.documentElement[o]:e[o]:(a?a.scrollTo(r?Y(a).scrollLeft():i,r?i:Y(a).scrollTop()):e[o]=i,t)},e,o,arguments.length,null)}}),Y.each({Height:"height",Width:"width"},function(e,n){Y.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,o){Y.fn[o]=function(o,i){var a=arguments.length&&(r||"boolean"!=typeof o),s=r||(o===!0||i===!0?"margin":"border");return Y.access(this,function(n,r,o){var i;return Y.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(i=n.documentElement,Math.max(n.body["scroll"+e],i["scroll"+e],n.body["offset"+e],i["offset"+e],i["client"+e])):o===t?Y.css(n,r,o,s):Y.style(n,r,o,s)},n,a?o:t,a,null)}})}),e.jQuery=e.$=Y,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return Y})}(window),/*! ========================================================= * bootstrap-modal.js v2.2.2 * http://twitter.github.com/bootstrap/javascript.html#modals * ========================================================= * Twitter, Inc. require the following notice to accompany Bootstrap: * * Copyright (c) 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work * except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing permissions and limitations under the License. * * ========================================================= */ !function(e){"use strict";var t=function(t,n){this.options=n,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=e.Event("show");this.$element.trigger(n),this.isShown||n.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.backdrop(function(){var n=e.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),n&&t.$element[0].offsetWidth,t.$element.addClass("in").attr("aria-hidden",!1),t.enforceFocus(),n?t.$element.one(e.support.transition.end,function(){t.$element.focus().trigger("shown")}):t.$element.focus().trigger("shown")}))},hide:function(t){t&&t.preventDefault(),t=e.Event("hide"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),e(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),e.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal())},enforceFocus:function(){var t=this;e(document).on("focusin.modal",function(e){t.$element[0]===e.target||t.$element.has(e.target).length||t.$element.focus()})},escape:function(){var e=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(t){27==t.which&&e.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var t=this,n=setTimeout(function(){t.$element.off(e.support.transition.end),t.hideModal()},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),t.hideModal()})},hideModal:function(){this.$element.hide().trigger("hidden"),this.backdrop()},removeBackdrop:function(){this.$backdrop.remove(),this.$backdrop=null},backdrop:function(t){var n=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var r=e.support.transition&&n;this.$backdrop=e('<div class="modal-backdrop '+n+'" />').appendTo(document.body),this.$backdrop.click("static"==this.options.backdrop?e.proxy(this.$element[0].focus,this.$element[0]):e.proxy(this.hide,this)),r&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),r?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,e.proxy(this.removeBackdrop,this)):this.removeBackdrop()):t&&t()}};var n=e.fn.modal;e.fn.modal=function(n){return this.each(function(){var r=e(this),o=r.data("modal"),i=e.extend({},e.fn.modal.defaults,r.data(),"object"==typeof n&&n);o||r.data("modal",o=new t(this,i)),"string"==typeof n?o[n]():i.show&&o.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=n,this},e(document).on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),r=n.attr("href"),o=e(n.attr("data-target")||r&&r.replace(/.*(?=#[^\s]+$)/,"")),i=o.data("modal")?"toggle":e.extend({remote:!/#/.test(r)&&r},o.data(),n.data());t.preventDefault(),o.modal(i).one("hide",function(){n.focus()})})}(window.jQuery);/*! * This file creates $ and jQuery variables within the F2 closure scope */ var $,jQuery=$=window.jQuery.noConflict(!0);/*! * Hij1nx requires the following notice to accompany EventEmitter: * * Copyright (c) 2011 hij1nx * * http://www.twitter.com/hij1nx * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the 'Software'), to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ !function(e){function t(){this._events={}}function n(e){e&&(e.delimiter&&(this.delimiter=e.delimiter),e.wildcard&&(this.wildcard=e.wildcard),this.wildcard&&(this.listenerTree={}))}function r(e){this._events={},n.call(this,e)}function o(e,t,n,r){if(!n)return[];var i,a,s,l,c,u,p,f=[],d=t.length,h=t[r],g=t[r+1];if(r===d&&n._listeners){if("function"==typeof n._listeners)return e&&e.push(n._listeners),[n];for(i=0,a=n._listeners.length;a>i;i++)e&&e.push(n._listeners[i]);return[n]}if("*"===h||"**"===h||n[h]){if("*"===h){for(s in n)"_listeners"!==s&&n.hasOwnProperty(s)&&(f=f.concat(o(e,t,n[s],r+1)));return f}if("**"===h){p=r+1===d||r+2===d&&"*"===g,p&&n._listeners&&(f=f.concat(o(e,t,n,d)));for(s in n)"_listeners"!==s&&n.hasOwnProperty(s)&&("*"===s||"**"===s?(n[s]._listeners&&!p&&(f=f.concat(o(e,t,n[s],d))),f=f.concat(o(e,t,n[s],r))):f=s===g?f.concat(o(e,t,n[s],r+2)):f.concat(o(e,t,n[s],r)));return f}f=f.concat(o(e,t,n[h],r+1))}if(l=n["*"],l&&o(e,t,l,r+1),c=n["**"])if(d>r){c._listeners&&o(e,t,c,d);for(s in c)"_listeners"!==s&&c.hasOwnProperty(s)&&(s===g?o(e,t,c[s],r+2):s===h?o(e,t,c[s],r+1):(u={},u[s]=c[s],o(e,t,{"**":u},r+1)))}else c._listeners?o(e,t,c,d):c["*"]&&c["*"]._listeners&&o(e,t,c["*"],d);return f}function i(e,t){e="string"==typeof e?e.split(this.delimiter):e.slice();for(var n=0,r=e.length;r>n+1;n++)if("**"===e[n]&&"**"===e[n+1])return;for(var o=this.listenerTree,i=e.shift();i;){if(o[i]||(o[i]={}),o=o[i],0===e.length){if(o._listeners){if("function"==typeof o._listeners)o._listeners=[o._listeners,t];else if(a(o._listeners)&&(o._listeners.push(t),!o._listeners.warned)){var l=s;this._events.maxListeners!==undefined&&(l=this._events.maxListeners),l>0&&o._listeners.length>l&&(o._listeners.warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",o._listeners.length),console.trace())}}else o._listeners=t;return!0}i=e.shift()}return!0}var a=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},s=10;r.prototype.delimiter=".",r.prototype.setMaxListeners=function(e){this._events||t.call(this),this._events.maxListeners=e},r.prototype.event="",r.prototype.once=function(e,t){return this.many(e,1,t),this},r.prototype.many=function(e,t,n){function r(){0===--t&&o.off(e,r),n.apply(this,arguments)}var o=this;if("function"!=typeof n)throw Error("many only accepts instances of Function");return r._origin=n,this.on(e,r),o},r.prototype.emit=function(){this._events||t.call(this);var e=arguments[0];if("newListener"===e&&!this._events.newListener)return!1;if(this._all){for(var n=arguments.length,r=Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(i=0,n=this._all.length;n>i;i++)this.event=e,this._all[i].apply(this,r)}if("error"===e&&!(this._all||this._events.error||this.wildcard&&this.listenerTree.error))throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");var a;if(this.wildcard){a=[];var s="string"==typeof e?e.split(this.delimiter):e.slice();o.call(this,a,s,this.listenerTree,0)}else a=this._events[e];if("function"==typeof a){if(this.event=e,1===arguments.length)a.call(this);else if(arguments.length>1)switch(arguments.length){case 2:a.call(this,arguments[1]);break;case 3:a.call(this,arguments[1],arguments[2]);break;default:for(var n=arguments.length,r=Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];a.apply(this,r)}return!0}if(a){for(var n=arguments.length,r=Array(n-1),i=1;n>i;i++)r[i-1]=arguments[i];for(var l=a.slice(),i=0,n=l.length;n>i;i++)this.event=e,l[i].apply(this,r);return l.length>0||this._all}return this._all},r.prototype.on=function(e,n){if("function"==typeof e)return this.onAny(e),this;if("function"!=typeof n)throw Error("on only accepts instances of Function");if(this._events||t.call(this),this.emit("newListener",e,n),this.wildcard)return i.call(this,e,n),this;if(this._events[e]){if("function"==typeof this._events[e])this._events[e]=[this._events[e],n];else if(a(this._events[e])&&(this._events[e].push(n),!this._events[e].warned)){var r=s;this._events.maxListeners!==undefined&&(r=this._events.maxListeners),r>0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),console.trace())}}else this._events[e]=n;return this},r.prototype.onAny=function(e){if(this._all||(this._all=[]),"function"!=typeof e)throw Error("onAny only accepts instances of Function");return this._all.push(e),this},r.prototype.addListener=r.prototype.on,r.prototype.off=function(e,t){if("function"!=typeof t)throw Error("removeListener only takes instances of Function");var n,r=[];if(this.wildcard){var i="string"==typeof e?e.split(this.delimiter):e.slice();r=o.call(this,null,i,this.listenerTree,0)}else{if(!this._events[e])return this;n=this._events[e],r.push({_listeners:n})}for(var s=0;r.length>s;s++){var l=r[s];if(n=l._listeners,a(n)){for(var c=-1,u=0,p=n.length;p>u;u++)if(n[u]===t||n[u].listener&&n[u].listener===t||n[u]._origin&&n[u]._origin===t){c=u;break}if(0>c)return this;this.wildcard?l._listeners.splice(c,1):this._events[e].splice(c,1),0===n.length&&(this.wildcard?delete l._listeners:delete this._events[e])}else(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete l._listeners:delete this._events[e])}return this},r.prototype.offAny=function(e){var t,n=0,r=0;if(e&&this._all&&this._all.length>0){for(t=this._all,n=0,r=t.length;r>n;n++)if(e===t[n])return t.splice(n,1),this}else this._all=[];return this},r.prototype.removeListener=r.prototype.off,r.prototype.removeAllListeners=function(e){if(0===arguments.length)return!this._events||t.call(this),this;if(this.wildcard)for(var n="string"==typeof e?e.split(this.delimiter):e.slice(),r=o.call(this,null,n,this.listenerTree,0),i=0;r.length>i;i++){var a=r[i];a._listeners=null}else{if(!this._events[e])return this;this._events[e]=null}return this},r.prototype.listeners=function(e){if(this.wildcard){var n=[],r="string"==typeof e?e.split(this.delimiter):e.slice();return o.call(this,n,r,this.listenerTree,0),n}return this._events||t.call(this),this._events[e]||(this._events[e]=[]),a(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]},r.prototype.listenersAny=function(){return this._all?this._all:[]},e.EventEmitter2=r}("undefined"!=typeof process&&process.title!==void 0&&exports!==void 0?exports:window),/*! * Øyvind Sean Kinsey and others require the following notice to accompany easyXDM: * * http://easyxdm.net/ * Copyright(c) 2009-2011, Øyvind Sean Kinsey, [email protected]. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ function(e,t,n,r,o,i){function a(e,t){var n=typeof e[t];return"function"==n||!("object"!=n||!e[t])||"unknown"==n}function s(e,t){return!("object"!=typeof e[t]||!e[t])}function l(e){return"[object Array]"===Object.prototype.toString.call(e)}function c(){try{var e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");return F=Array.prototype.slice.call(e.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/),1),N=parseInt(F[0],10)>9&&parseInt(F[1],10)>0,e=null,!0}catch(t){return!1}}function u(){if(!U){U=!0;for(var e=0;Q.length>e;e++)Q[e]();Q.length=0}}function p(e,t){return U?(e.call(t),void 0):(Q.push(function(){e.call(t)}),void 0)}function f(){var e=parent;if(""!==P)for(var t=0,n=P.split(".");n.length>t;t++)e=e[n[t]];return e.easyXDM}function d(t){return e.easyXDM=B,P=t,P&&($="easyXDM_"+P.replace(".","_")+"_"),L}function h(e){return e.match(H)[3]}function g(e){return e.match(H)[4]||""}function m(e){var t=e.toLowerCase().match(H),n=t[2],r=t[3],o=t[4]||"";return("http:"==n&&":80"==o||"https:"==n&&":443"==o)&&(o=""),n+"//"+r+o}function y(e){if(e=e.replace(D,"$1/"),!e.match(/^(http||https):\/\//)){var t="/"===e.substring(0,1)?"":n.pathname;"/"!==t.substring(t.length-1)&&(t=t.substring(0,t.lastIndexOf("/")+1)),e=n.protocol+"//"+n.host+t+e}for(;I.test(e);)e=e.replace(I,"");return e}function v(e,t){var n="",r=e.indexOf("#");-1!==r&&(n=e.substring(r),e=e.substring(0,r));var o=[];for(var a in t)t.hasOwnProperty(a)&&o.push(a+"="+i(t[a]));return e+(q?"#":-1==e.indexOf("?")?"?":"&")+o.join("&")+n}function b(e){return e===void 0}function x(e,t,n){var r;for(var o in t)t.hasOwnProperty(o)&&(o in e?(r=t[o],"object"==typeof r?x(e[o],r,n):n||(e[o]=t[o])):e[o]=t[o]);return e}function w(){var e=t.body.appendChild(t.createElement("form")),n=e.appendChild(t.createElement("input"));n.name=$+"TEST"+O,E=n!==e.elements[n.name],t.body.removeChild(e)}function _(e){b(E)&&w();var n;E?n=t.createElement('<iframe name="'+e.props.name+'"/>'):(n=t.createElement("IFRAME"),n.name=e.props.name),n.id=n.name=e.props.name,delete e.props.name,e.onLoad&&S(n,"load",e.onLoad),"string"==typeof e.container&&(e.container=t.getElementById(e.container)),e.container||(x(n.style,{position:"absolute",top:"-2000px"}),e.container=t.body);var r=e.props.src;return delete e.props.src,x(n,e.props),n.border=n.frameBorder=0,n.allowTransparency=!0,e.container.appendChild(n),n.src=r,e.props.src=r,n}function C(e,t){"string"==typeof e&&(e=[e]);for(var n,r=e.length;r--;)if(n=e[r],n=RegExp("^"==n.substr(0,1)?n:"^"+n.replace(/(\*)/g,".$1").replace(/\?/g,".")+"$"),n.test(t))return!0;return!1}function A(r){var o,i=r.protocol;if(r.isHost=r.isHost||b(X.xdm_p),q=r.hash||!1,r.props||(r.props={}),r.isHost)r.remote=y(r.remote),r.channel=r.channel||"default"+O++,r.secret=Math.random().toString(16).substring(2),b(i)&&(m(n.href)==m(r.remote)?i="4":a(e,"postMessage")||a(t,"postMessage")?i="1":r.swf&&a(e,"ActiveXObject")&&c()?i="6":"Gecko"===navigator.product&&"frameElement"in e&&-1==navigator.userAgent.indexOf("WebKit")?i="5":r.remoteHelper?(r.remoteHelper=y(r.remoteHelper),i="2"):i="0");else if(r.channel=X.xdm_c,r.secret=X.xdm_s,r.remote=X.xdm_e,i=X.xdm_p,r.acl&&!C(r.acl,r.remote))throw Error("Access denied for "+r.remote);switch(r.protocol=i,i){case"0":if(x(r,{interval:100,delay:2e3,useResize:!0,useParent:!1,usePolling:!1},!0),r.isHost){if(!r.local){for(var s,l=n.protocol+"//"+n.host,u=t.body.getElementsByTagName("img"),p=u.length;p--;)if(s=u[p],s.src.substring(0,l.length)===l){r.local=s.src;break}r.local||(r.local=e)}var f={xdm_c:r.channel,xdm_p:0};r.local===e?(r.usePolling=!0,r.useParent=!0,r.local=n.protocol+"//"+n.host+n.pathname+n.search,f.xdm_e=r.local,f.xdm_pa=1):f.xdm_e=y(r.local),r.container&&(r.useResize=!1,f.xdm_po=1),r.remote=v(r.remote,f)}else x(r,{channel:X.xdm_c,remote:X.xdm_e,useParent:!b(X.xdm_pa),usePolling:!b(X.xdm_po),useResize:r.useParent?!1:r.useResize});o=[new L.stack.HashTransport(r),new L.stack.ReliableBehavior({}),new L.stack.QueueBehavior({encode:!0,maxLength:4e3-r.remote.length}),new L.stack.VerifyBehavior({initiate:r.isHost})];break;case"1":o=[new L.stack.PostMessageTransport(r)];break;case"2":o=[new L.stack.NameTransport(r),new L.stack.QueueBehavior,new L.stack.VerifyBehavior({initiate:r.isHost})];break;case"3":o=[new L.stack.NixTransport(r)];break;case"4":o=[new L.stack.SameOriginTransport(r)];break;case"5":o=[new L.stack.FrameElementTransport(r)];break;case"6":F||c(),o=[new L.stack.FlashTransport(r)]}return o.push(new L.stack.QueueBehavior({lazy:r.lazy,remove:!0})),o}function T(e){for(var t,n={incoming:function(e,t){this.up.incoming(e,t)},outgoing:function(e,t){this.down.outgoing(e,t)},callback:function(e){this.up.callback(e)},init:function(){this.down.init()},destroy:function(){this.down.destroy()}},r=0,o=e.length;o>r;r++)t=e[r],x(t,n,!0),0!==r&&(t.down=e[r-1]),r!==o-1&&(t.up=e[r+1]);return t}function k(e){e.up.down=e.down,e.down.up=e.up,e.up=e.down=null}var E,F,N,S,j,R=this,O=Math.floor(1e4*Math.random()),M=Function.prototype,H=/^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/,I=/[\-\w]+\/\.\.\//,D=/([^:])\/\//g,P="",L={},B=e.easyXDM,$="easyXDM_",q=!1;if(a(e,"addEventListener"))S=function(e,t,n){e.addEventListener(t,n,!1)},j=function(e,t,n){e.removeEventListener(t,n,!1)};else{if(!a(e,"attachEvent"))throw Error("Browser not supported");S=function(e,t,n){e.attachEvent("on"+t,n)},j=function(e,t,n){e.detachEvent("on"+t,n)}}var W,U=!1,Q=[];if("readyState"in t?(W=t.readyState,U="complete"==W||~navigator.userAgent.indexOf("AppleWebKit/")&&("loaded"==W||"interactive"==W)):U=!!t.body,!U){if(a(e,"addEventListener"))S(t,"DOMContentLoaded",u);else if(S(t,"readystatechange",function(){"complete"==t.readyState&&u()}),t.documentElement.doScroll&&e===top){var z=function(){if(!U){try{t.documentElement.doScroll("left")}catch(e){return r(z,1),void 0}u()}};z()}S(e,"load",u)}var X=function(e){e=e.substring(1).split("&");for(var t,n={},r=e.length;r--;)t=e[r].split("="),n[t[0]]=o(t[1]);return n}(/xdm_e=/.test(n.search)?n.search:n.hash),J=function(){var e={},t={a:[1,2,3]},n='{"a":[1,2,3]}';return"undefined"!=typeof JSON&&"function"==typeof JSON.stringify&&JSON.stringify(t).replace(/\s/g,"")===n?JSON:(Object.toJSON&&Object.toJSON(t).replace(/\s/g,"")===n&&(e.stringify=Object.toJSON),"function"==typeof String.prototype.evalJSON&&(t=n.evalJSON(),t.a&&3===t.a.length&&3===t.a[2]&&(e.parse=function(e){return e.evalJSON()})),e.stringify&&e.parse?(J=function(){return e},e):null)};x(L,{version:"2.4.15.118",query:X,stack:{},apply:x,getJSONObject:J,whenReady:p,noConflict:d}),L.DomHelper={on:S,un:j,requiresJSON:function(n){s(e,"JSON")||t.write('<script type="text/javascript" src="'+n+'"><'+"/script>")}},function(){var e={};L.Fn={set:function(t,n){e[t]=n},get:function(t,n){var r=e[t];return n&&delete e[t],r}}}(),L.Socket=function(e){var t=T(A(e).concat([{incoming:function(t,n){e.onMessage(t,n)},callback:function(t){e.onReady&&e.onReady(t)}}])),n=m(e.remote);this.origin=m(e.remote),this.destroy=function(){t.destroy()},this.postMessage=function(e){t.outgoing(e,n)},t.init()},L.Rpc=function(e,t){if(t.local)for(var n in t.local)if(t.local.hasOwnProperty(n)){var r=t.local[n];"function"==typeof r&&(t.local[n]={method:r})}var o=T(A(e).concat([new L.stack.RpcBehavior(this,t),{callback:function(t){e.onReady&&e.onReady(t)}}]));this.origin=m(e.remote),this.destroy=function(){o.destroy()},o.init()},L.stack.SameOriginTransport=function(e){var t,o,i,a;return t={outgoing:function(e,t,n){i(e),n&&n()},destroy:function(){o&&(o.parentNode.removeChild(o),o=null)},onDOMReady:function(){a=m(e.remote),e.isHost?(x(e.props,{src:v(e.remote,{xdm_e:n.protocol+"//"+n.host+n.pathname,xdm_c:e.channel,xdm_p:4}),name:$+e.channel+"_provider"}),o=_(e),L.Fn.set(e.channel,function(e){return i=e,r(function(){t.up.callback(!0)},0),function(e){t.up.incoming(e,a)}})):(i=f().Fn.get(e.channel,!0)(function(e){t.up.incoming(e,a)}),r(function(){t.up.callback(!0)},0))},init:function(){p(t.onDOMReady,t)}}},L.stack.FlashTransport=function(e){function o(e){r(function(){a.up.incoming(e,l)},0)}function i(n){var r=e.swf+"?host="+e.isHost,o="easyXDM_swf_"+Math.floor(1e4*Math.random());L.Fn.set("flash_loaded"+n.replace(/[\-.]/g,"_"),function(){L.stack.FlashTransport[n].swf=c=u.firstChild;for(var e=L.stack.FlashTransport[n].queue,t=0;e.length>t;t++)e[t]();e.length=0}),e.swfContainer?u="string"==typeof e.swfContainer?t.getElementById(e.swfContainer):e.swfContainer:(u=t.createElement("div"),x(u.style,N&&e.swfNoThrottle?{height:"20px",width:"20px",position:"fixed",right:0,top:0}:{height:"1px",width:"1px",position:"absolute",overflow:"hidden",right:0,top:0}),t.body.appendChild(u));var i="callback=flash_loaded"+n.replace(/[\-.]/g,"_")+"&proto="+R.location.protocol+"&domain="+h(R.location.href)+"&port="+g(R.location.href)+"&ns="+P;u.innerHTML="<object height='20' width='20' type='application/x-shockwave-flash' id='"+o+"' data='"+r+"'>"+"<param name='allowScriptAccess' value='always'></param>"+"<param name='wmode' value='transparent'>"+"<param name='movie' value='"+r+"'></param>"+"<param name='flashvars' value='"+i+"'></param>"+"<embed type='application/x-shockwave-flash' FlashVars='"+i+"' allowScriptAccess='always' wmode='transparent' src='"+r+"' height='1' width='1'></embed>"+"</object>"}var a,s,l,c,u;return a={outgoing:function(t,n,r){c.postMessage(e.channel,""+t),r&&r()},destroy:function(){try{c.destroyChannel(e.channel)}catch(t){}c=null,s&&(s.parentNode.removeChild(s),s=null)},onDOMReady:function(){l=e.remote,L.Fn.set("flash_"+e.channel+"_init",function(){r(function(){a.up.callback(!0)})}),L.Fn.set("flash_"+e.channel+"_onMessage",o),e.swf=y(e.swf);var t=h(e.swf),u=function(){L.stack.FlashTransport[t].init=!0,c=L.stack.FlashTransport[t].swf,c.createChannel(e.channel,e.secret,m(e.remote),e.isHost),e.isHost&&(N&&e.swfNoThrottle&&x(e.props,{position:"fixed",right:0,top:0,height:"20px",width:"20px"}),x(e.props,{src:v(e.remote,{xdm_e:m(n.href),xdm_c:e.channel,xdm_p:6,xdm_s:e.secret}),name:$+e.channel+"_provider"}),s=_(e))};L.stack.FlashTransport[t]&&L.stack.FlashTransport[t].init?u():L.stack.FlashTransport[t]?L.stack.FlashTransport[t].queue.push(u):(L.stack.FlashTransport[t]={queue:[u]},i(t))},init:function(){p(a.onDOMReady,a)}}},L.stack.PostMessageTransport=function(t){function o(e){if(e.origin)return m(e.origin);if(e.uri)return m(e.uri);if(e.domain)return n.protocol+"//"+e.domain;throw"Unable to retrieve the origin of the event"}function i(e){var n=o(e);n==c&&e.data.substring(0,t.channel.length+1)==t.channel+" "&&a.up.incoming(e.data.substring(t.channel.length+1),n)}var a,s,l,c;return a={outgoing:function(e,n,r){l.postMessage(t.channel+" "+e,n||c),r&&r()},destroy:function(){j(e,"message",i),s&&(l=null,s.parentNode.removeChild(s),s=null)},onDOMReady:function(){if(c=m(t.remote),t.isHost){var o=function(n){n.data==t.channel+"-ready"&&(l="postMessage"in s.contentWindow?s.contentWindow:s.contentWindow.document,j(e,"message",o),S(e,"message",i),r(function(){a.up.callback(!0)},0))};S(e,"message",o),x(t.props,{src:v(t.remote,{xdm_e:m(n.href),xdm_c:t.channel,xdm_p:1}),name:$+t.channel+"_provider"}),s=_(t)}else S(e,"message",i),l="postMessage"in e.parent?e.parent:e.parent.document,l.postMessage(t.channel+"-ready",c),r(function(){a.up.callback(!0)},0)},init:function(){p(a.onDOMReady,a)}}},L.stack.FrameElementTransport=function(o){var i,a,s,l;return i={outgoing:function(e,t,n){s.call(this,e),n&&n()},destroy:function(){a&&(a.parentNode.removeChild(a),a=null)},onDOMReady:function(){l=m(o.remote),o.isHost?(x(o.props,{src:v(o.remote,{xdm_e:m(n.href),xdm_c:o.channel,xdm_p:5}),name:$+o.channel+"_provider"}),a=_(o),a.fn=function(e){return delete a.fn,s=e,r(function(){i.up.callback(!0)},0),function(e){i.up.incoming(e,l)}}):(t.referrer&&m(t.referrer)!=X.xdm_e&&(e.top.location=X.xdm_e),s=e.frameElement.fn(function(e){i.up.incoming(e,l)}),i.up.callback(!0))},init:function(){p(i.onDOMReady,i)}}},L.stack.NameTransport=function(e){function t(t){var n=e.remoteHelper+(s?"#_3":"#_2")+e.channel;l.contentWindow.sendMessage(t,n)}function n(){s?2!==++u&&s||a.up.callback(!0):(t("ready"),a.up.callback(!0))}function o(e){a.up.incoming(e,d)}function i(){f&&r(function(){f(!0)},0)}var a,s,l,c,u,f,d,h;return a={outgoing:function(e,n,r){f=r,t(e)},destroy:function(){l.parentNode.removeChild(l),l=null,s&&(c.parentNode.removeChild(c),c=null)},onDOMReady:function(){s=e.isHost,u=0,d=m(e.remote),e.local=y(e.local),s?(L.Fn.set(e.channel,function(t){s&&"ready"===t&&(L.Fn.set(e.channel,o),n())}),h=v(e.remote,{xdm_e:e.local,xdm_c:e.channel,xdm_p:2}),x(e.props,{src:h+"#"+e.channel,name:$+e.channel+"_provider"}),c=_(e)):(e.remoteHelper=e.remote,L.Fn.set(e.channel,o)),l=_({props:{src:e.local+"#_4"+e.channel},onLoad:function t(){var o=l||this;j(o,"load",t),L.Fn.set(e.channel+"_load",i),function a(){"function"==typeof o.contentWindow.sendMessage?n():r(a,50)}()}})},init:function(){p(a.onDOMReady,a)}}},L.stack.HashTransport=function(t){function n(e){if(g){var n=t.remote+"#"+d++ +"_"+e;(l||!y?g.contentWindow:g).location=n}}function o(e){f=e,s.up.incoming(f.substring(f.indexOf("_")+1),v)}function i(){if(h){var e=h.location.href,t="",n=e.indexOf("#");-1!=n&&(t=e.substring(n)),t&&t!=f&&o(t)}}function a(){c=setInterval(i,u)}var s,l,c,u,f,d,h,g,y,v;return s={outgoing:function(e){n(e)},destroy:function(){e.clearInterval(c),(l||!y)&&g.parentNode.removeChild(g),g=null},onDOMReady:function(){if(l=t.isHost,u=t.interval,f="#"+t.channel,d=0,y=t.useParent,v=m(t.remote),l){if(t.props={src:t.remote,name:$+t.channel+"_provider"},y)t.onLoad=function(){h=e,a(),s.up.callback(!0)};else{var n=0,o=t.delay/50;(function i(){if(++n>o)throw Error("Unable to reference listenerwindow");try{h=g.contentWindow.frames[$+t.channel+"_consumer"]}catch(e){}h?(a(),s.up.callback(!0)):r(i,50)})()}g=_(t)}else h=e,a(),y?(g=parent,s.up.callback(!0)):(x(t,{props:{src:t.remote+"#"+t.channel+new Date,name:$+t.channel+"_consumer"},onLoad:function(){s.up.callback(!0)}}),g=_(t))},init:function(){p(s.onDOMReady,s)}}},L.stack.ReliableBehavior=function(){var e,t,n=0,r=0,o="";return e={incoming:function(i,a){var s=i.indexOf("_"),l=i.substring(0,s).split(",");i=i.substring(s+1),l[0]==n&&(o="",t&&t(!0)),i.length>0&&(e.down.outgoing(l[1]+","+n+"_"+o,a),r!=l[1]&&(r=l[1],e.up.incoming(i,a)))},outgoing:function(i,a,s){o=i,t=s,e.down.outgoing(r+","+ ++n+"_"+i,a)}}},L.stack.QueueBehavior=function(e){function t(){if(e.remove&&0===s.length)return k(n),void 0;if(!l&&0!==s.length&&!a){l=!0;var o=s.shift();n.down.outgoing(o.data,o.origin,function(e){l=!1,o.callback&&r(function(){o.callback(e)},0),t()})}}var n,a,s=[],l=!0,c="",u=0,p=!1,f=!1;return n={init:function(){b(e)&&(e={}),e.maxLength&&(u=e.maxLength,f=!0),e.lazy?p=!0:n.down.init()},callback:function(e){l=!1;var r=n.up;t(),r.callback(e)},incoming:function(t,r){if(f){var i=t.indexOf("_"),a=parseInt(t.substring(0,i),10);c+=t.substring(i+1),0===a&&(e.encode&&(c=o(c)),n.up.incoming(c,r),c="")}else n.up.incoming(t,r)},outgoing:function(r,o,a){e.encode&&(r=i(r));var l,c=[];if(f){for(;0!==r.length;)l=r.substring(0,u),r=r.substring(l.length),c.push(l);for(;l=c.shift();)s.push({data:c.length+"_"+l,origin:o,callback:0===c.length?a:null})}else s.push({data:r,origin:o,callback:a});p?n.down.init():t()},destroy:function(){a=!0,n.down.destroy()}}},L.stack.VerifyBehavior=function(e){function t(){r=Math.random().toString(16).substring(2),n.down.outgoing(r)}var n,r,o;return n={incoming:function(i,a){var s=i.indexOf("_");-1===s?i===r?n.up.callback(!0):o||(o=i,e.initiate||t(),n.down.outgoing(i)):i.substring(0,s)===o&&n.up.incoming(i.substring(s+1),a)},outgoing:function(e,t,o){n.down.outgoing(r+"_"+e,t,o)},callback:function(){e.initiate&&t()}}},L.stack.RpcBehavior=function(e,t){function n(e){e.jsonrpc="2.0",i.down.outgoing(a.stringify(e))}function r(e,t){var r=Array.prototype.slice;return function(){var o,i=arguments.length,a={method:t};i>0&&"function"==typeof arguments[i-1]?(i>1&&"function"==typeof arguments[i-2]?(o={success:arguments[i-2],error:arguments[i-1]},a.params=r.call(arguments,0,i-2)):(o={success:arguments[i-1]},a.params=r.call(arguments,0,i-1)),c[""+ ++s]=o,a.id=s):a.params=r.call(arguments,0),e.namedParams&&1===a.params.length&&(a.params=a.params[0]),n(a)}}function o(e,t,r,o){if(!r)return t&&n({id:t,error:{code:-32601,message:"Procedure not found."}}),void 0;var i,a;t?(i=function(e){i=M,n({id:t,result:e})},a=function(e,r){a=M;var o={id:t,error:{code:-32099,message:e}};r&&(o.error.data=r),n(o)}):i=a=M,l(o)||(o=[o]);try{var s=r.method.apply(r.scope,o.concat([i,a]));b(s)||i(s)}catch(c){a(c.message)}}var i,a=t.serializer||J(),s=0,c={};return i={incoming:function(e){var r=a.parse(e);if(r.method)t.handle?t.handle(r,n):o(r.method,r.id,t.local[r.method],r.params);else{var i=c[r.id];r.error?i.error&&i.error(r.error):i.success&&i.success(r.result),delete c[r.id]}},init:function(){if(t.remote)for(var n in t.remote)t.remote.hasOwnProperty(n)&&(e[n]=r(t.remote[n],n));i.down.init()},destroy:function(){for(var n in t.remote)t.remote.hasOwnProperty(n)&&e.hasOwnProperty(n)&&delete e[n];i.down.destroy()}}},R.easyXDM=L}(window,document,location,window.setTimeout,decodeURIComponent,encodeURIComponent);/*! * F2 v1.3.2 11-18-2013 * Copyright (c) 2013 Markit On Demand, Inc. http://www.openf2.org * * "F2" is licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific * language governing permissions and limitations under the License. * * Please note that F2 ("Software") may contain third party material that Markit * On Demand Inc. has a license to use and include within the Software (the * "Third Party Material"). A list of the software comprising the Third Party Material * and the terms and conditions under which such Third Party Material is distributed * are reproduced in the ThirdPartyMaterial.md file available at: * * https://github.com/OpenF2/F2/blob/master/ThirdPartyMaterial.md * * The inclusion of the Third Party Material in the Software does not grant, provide * nor result in you having acquiring any rights whatsoever, other than as stipulated * in the terms and conditions related to the specific Third Party Material, if any. * */ var F2;F2=function(){var e=function(e,n){function r(e){var t=[];return e.replace(/^(\.\.?(\/|$))+/,"").replace(/\/(\.(\/|$))+/g,"/").replace(/\/\.\.$/,"/../").replace(/\/?[^\/]*/g,function(e){"/.."===e?t.pop():t.push(e)}),t.join("").replace(/^\//,"/"===e.charAt(0)?"/":"")}return n=t(n||""),e=t(e||""),n&&e?(n.protocol||e.protocol)+(n.protocol||n.authority?n.authority:e.authority)+r(n.protocol||n.authority||"/"===n.pathname.charAt(0)?n.pathname:n.pathname?(e.authority&&!e.pathname?"/":"")+e.pathname.slice(0,e.pathname.lastIndexOf("/")+1)+n.pathname:e.pathname)+(n.protocol||n.authority||n.pathname?n.search:n.search||e.search)+n.hash:null},t=function(e){var t=(e+"").replace(/^\s+|\s+$/g,"").match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);return t?{href:t[0]||"",protocol:t[1]||"",authority:t[2]||"",host:t[3]||"",hostname:t[4]||"",port:t[5]||"",pathname:t[6]||"",search:t[7]||"",hash:t[8]||""}:null};return{appConfigReplacer:function(e,t){return"root"==e||"ui"==e||"height"==e?void 0:t},Apps:{},extend:function(e,t,n){var r="function"==typeof t,o=e?e.split("."):[],i=this;t=t||{},"F2"===o[0]&&(o=o.slice(1));for(var a=0,s=o.length;s>a;a++)i[o[a]]||(i[o[a]]=r&&a+1==s?t:{}),i=i[o[a]];if(!r)for(var l in t)(i[l]===void 0||n)&&(i[l]=t[l]);return i},guid:function(){var e=function(){return(0|65536*(1+Math.random())).toString(16).substring(1)};return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()},inArray:function(e,t){return jQuery.inArray(e,t)>-1},isLocalRequest:function(t){var n,r,o=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,i=t.toLowerCase(),a=o.exec(i);try{n=location.href}catch(s){n=document.createElement("a"),n.href="",n=n.href}n=n.toLowerCase(),a||(i=e(n,i).toLowerCase(),a=o.exec(i)),r=o.exec(n)||[];var l=!(a&&(a[1]!==r[1]||a[2]!==r[2]||(a[3]||("http:"===a[1]?"80":"443"))!==(r[3]||("http:"===r[1]?"80":"443"))));return l},isNativeDOMNode:function(e){var t="object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName,n="object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&1===e.nodeType&&"string"==typeof e.nodeName;return t||n},log:function(){for(var e,t,n,r="log",o=function(){},i=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],a=i.length,s=window.console=window.console||{};a--;)t=i[a],s[t]||(s[t]=o),arguments&&arguments.length>1&&arguments[0]==t&&(r=t,n=Array.prototype.slice.call(arguments,1));e=Function.prototype.bind?Function.prototype.bind.call(s[r],s):function(){Function.prototype.apply.call(s[r],s,n||arguments)},e.apply(this,n||arguments)},parse:function(e){return JSON.parse(e)},stringify:function(e,t,n){return JSON.stringify(e,t,n)},version:function(){return"1.3.2"}}}(),F2.extend("AppHandlers",function(){var e=F2.guid(),t=F2.guid(),n={appCreateRoot:[],appRenderBefore:[],appDestroyBefore:[],appRenderAfter:[],appDestroyAfter:[],appRender:[],appDestroy:[],appScriptLoadFailed:[]},r={appRender:function(e,t){var n=null;F2.isNativeDOMNode(e.root)?(n=jQuery(e.root),n.append(t)):(e.root=jQuery(t).get(0),n=jQuery(e.root)),jQuery("body").append(n)},appDestroy:function(e){e&&e.app&&e.app.destroy&&"function"==typeof e.app.destroy?e.app.destroy():e&&e.app&&e.app.destroy&&F2.log(e.config.appId+" has a destroy property, but destroy is not of type function and as such will not be executed."),jQuery(e.config.root).fadeOut(500,function(){jQuery(this).remove()})}},o=function(e,t,n,r){i(e);var o={func:n,namespace:t,domNode:F2.isNativeDOMNode(n)?n:null};if(!o.func&&!o.domNode)throw"Invalid or null argument passed. Handler will not be added to collection. A valid dom element or callback function is required.";if(o.domNode&&!r)throw"Invalid argument passed. Handler will not be added to collection. A callback function is required for this event type.";return o},i=function(n){if(e!=n&&t!=n)throw"Invalid token passed. Please verify that you have correctly received and stored token from F2.AppHandlers.getToken()."},a=function(e,t,r){if(i(e),r||t)if(!r&&t)n[t]=[];else if(r&&!t){r=r.toLowerCase();for(var o in n){for(var a=n[o],s=[],l=0,c=a.length;c>l;l++){var u=a[l];u&&(u.namespace&&u.namespace.toLowerCase()==r||s.push(u))}a=s}}else if(r&&n[t]){r=r.toLowerCase();for(var p=[],f=0,d=n[t].length;d>f;f++){var h=n[t][f];h&&(h.namespace&&h.namespace.toLowerCase()==r||p.push(h))}n[t]=p}};return{getToken:function(){return delete this.getToken,e},__f2GetToken:function(){return delete this.__f2GetToken,t},__trigger:function(e,o){if(e!=t)throw"Token passed is invalid. Only F2 is allowed to call F2.AppHandlers.__trigger().";if(!n||!n[o])throw"Invalid EventKey passed. Check your inputs and try again.";for(var i=[],a=2,s=arguments.length;s>a;a++)i.push(arguments[a]);if(0===n[o].length&&r[o])return r[o].apply(F2,i),this;if(0===n[o].length&&!n[o])return this;for(var l=0,c=n[o].length;c>l;l++){var u=n[o][l];if(u.domNode&&arguments[2]&&arguments[2].root&&arguments[3]){var p=jQuery(arguments[2].root).append(arguments[3]);jQuery(u.domNode).append(p)}else u.domNode&&arguments[2]&&!arguments[2].root&&arguments[3]?(arguments[2].root=jQuery(arguments[3]).get(0),jQuery(u.domNode).append(arguments[2].root)):u.func.apply(F2,i)}return this},on:function(e,t,r){var i=null;if(!t)throw"eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.";if(t.indexOf(".")>-1){var a=t.split(".");t=a[0],i=a[1]}if(!n||!n[t])throw"Invalid EventKey passed. Check your inputs and try again.";return n[t].push(o(e,i,r,"appRender"==t)),this},off:function(e,t){var r=null;if(!t)throw"eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.";if(t.indexOf(".")>-1){var o=t.split(".");t=o[0],r=o[1]}if(!n||!n[t])throw"Invalid EventKey passed. Check your inputs and try again.";return a(e,t,r),this}}}()),F2.extend("Constants",{AppHandlers:function(){return{APP_CREATE_ROOT:"appCreateRoot",APP_RENDER_BEFORE:"appRenderBefore",APP_RENDER:"appRender",APP_RENDER_AFTER:"appRenderAfter",APP_DESTROY_BEFORE:"appDestroyBefore",APP_DESTROY:"appDestroy",APP_DESTROY_AFTER:"appDestroyAfter",APP_SCRIPT_LOAD_FAILED:"appScriptLoadFailed"}}()}),F2.extend("",{App:function(){return{init:function(){}}},AppConfig:{appId:"",context:{},enableBatchRequests:!1,height:0,instanceId:"",isSecure:!1,manifestUrl:"",maxWidth:0,minGridSize:4,minWidth:300,name:"",root:void 0,ui:void 0,views:[]},AppManifest:{apps:[],inlineScripts:[],scripts:[],styles:[]},AppContent:{data:{},html:"",status:""},ContainerConfig:{afterAppRender:function(){},appRender:function(){},beforeAppRender:function(){},debugMode:!1,scriptErrorTimeout:7e3,isSecureAppPage:!1,secureAppPagePath:"",supportedViews:[],UI:{Mask:{backgroundColor:"#FFF",loadingIcon:"",opacity:.6,useClasses:!1,zIndex:2}},xhr:{dataType:function(){},type:function(){},url:function(){}}}}),F2.extend("Constants",{Css:function(){var e="f2-";return{APP:e+"app",APP_CONTAINER:e+"app-container",APP_TITLE:e+"app-title",APP_VIEW:e+"app-view",APP_VIEW_TRIGGER:e+"app-view-trigger",MASK:e+"mask",MASK_CONTAINER:e+"mask-container"}}(),Events:function(){var e="App.",t="Container.";return{APP_SYMBOL_CHANGE:e+"symbolChange",APP_WIDTH_CHANGE:e+"widthChange.",CONTAINER_SYMBOL_CHANGE:t+"symbolChange",CONTAINER_WIDTH_CHANGE:t+"widthChange"}}(),JSONP_CALLBACK:"F2_jsonpCallback_",Sockets:{EVENT:"__event__",LOAD:"__socketLoad__",RPC:"__rpc__",RPC_CALLBACK:"__rpcCallback__",UI_RPC:"__uiRpc__"},Views:{DATA_ATTRIBUTE:"data-f2-view",ABOUT:"about",HELP:"help",HOME:"home",REMOVE:"remove",SETTINGS:"settings"}}),F2.extend("Events",function(){var e=new EventEmitter2({wildcard:!0});return e.setMaxListeners(0),{_socketEmit:function(){return EventEmitter2.prototype.emit.apply(e,[].slice.call(arguments))},emit:function(){return F2.Rpc.broadcast(F2.Constants.Sockets.EVENT,[].slice.call(arguments)),EventEmitter2.prototype.emit.apply(e,[].slice.call(arguments))},many:function(t,n,r){return e.many(t,n,r)},off:function(t,n){return e.off(t,n)},on:function(t,n){return e.on(t,n)},once:function(t,n){return e.once(t,n)}}}()),F2.extend("Rpc",function(){var e={},t="",n={},r=RegExp("^"+F2.Constants.Sockets.EVENT),o=RegExp("^"+F2.Constants.Sockets.RPC),i=RegExp("^"+F2.Constants.Sockets.RPC_CALLBACK),a=RegExp("^"+F2.Constants.Sockets.LOAD),s=RegExp("^"+F2.Constants.Sockets.UI_RPC),l=function(){var e,t=!1,r=[],o=new easyXDM.Socket({onMessage:function(i,s){if(!t&&a.test(i)){i=i.replace(a,"");var l=F2.parse(i);2==l.length&&(e=l[0],n[e.instanceId]={config:e,socket:o},F2.registerApps([e],[l[1]]),jQuery.each(r,function(){p(e,i,s)}),t=!0)}else t?p(e,i,s):r.push(i)}})},c=function(e,n){var r=jQuery(e.root);if(r.is("."+F2.Constants.Css.APP_CONTAINER)||r.find("."+F2.Constants.Css.APP_CONTAINER),!r.length)return F2.log("Unable to locate app in order to establish secure connection."),void 0;var o={scrolling:"no",style:{width:"100%"}};e.height&&(o.style.height=e.height+"px");var i=new easyXDM.Socket({remote:t,container:r.get(0),props:o,onMessage:function(t,n){p(e,t,n)},onReady:function(){i.postMessage(F2.Constants.Sockets.LOAD+F2.stringify([e,n],F2.appConfigReplacer))}});return i},u=function(e,t){return function(){F2.Rpc.call(e,F2.Constants.Sockets.RPC_CALLBACK,t,[].slice.call(arguments).slice(2))}},p=function(t,n){function a(e,t){for(var n=(t+"").split("."),r=0;n.length>r;r++){if(void 0===e[n[r]]){e=void 0;break}e=e[n[r]]}return e}function l(e,t,n){var r=F2.parse(t.replace(e,""));return r.params&&r.params.length&&r.callbacks&&r.callbacks.length&&jQuery.each(r.callbacks,function(e,t){jQuery.each(r.params,function(e,o){t==o&&(r.params[e]=u(n,t))})}),r}var c,p;s.test(n)?(c=l(s,n,t.instanceId),p=a(t.ui,c.functionName),void 0!==p?p.apply(t.ui,c.params):F2.log("Unable to locate UI RPC function: "+c.functionName)):o.test(n)?(c=l(o,n,t.instanceId),p=a(window,c.functionName),void 0!==p?p.apply(p,c.params):F2.log("Unable to locate RPC function: "+c.functionName)):i.test(n)?(c=l(i,n,t.instanceId),void 0!==e[c.functionName]&&(e[c.functionName].apply(e[c.functionName],c.params),delete e[c.functionName])):r.test(n)&&(c=l(r,n,t.instanceId),F2.Events._socketEmit.apply(F2.Events,c))},f=function(t){var n=F2.guid();return e[n]=t,n};return{broadcast:function(e,t){var r=e+F2.stringify(t);jQuery.each(n,function(e,t){t.socket.postMessage(r)})},call:function(e,t,r,o){var i=[];jQuery.each(o,function(e,t){if("function"==typeof t){var n=f(t);o[e]=n,i.push(n)}}),n[e].socket.postMessage(t+F2.stringify({functionName:r,params:o,callbacks:i}))},init:function(e){t=e,t||l()},isRemote:function(e){return void 0!==n[e]&&n[e].config.isSecure&&0===jQuery(n[e].config.root).find("iframe").length},register:function(e,t){e&&t?n[e.instanceId]={config:e,socket:c(e,t)}:F2.log("Unable to register socket connection. Please check container configuration.")}}}()),F2.extend("UI",function(){var e,t=function(e){var t=e,n=jQuery(e.root),r=function(e){e=e||jQuery(t.root).outerHeight(),F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"updateHeight",[e]):(t.height=e,n.find("iframe").height(t.height))};return{hideMask:function(e){F2.UI.hideMask(t.instanceId,e)},Modals:function(){var e=function(e){return['<div class="modal">','<header class="modal-header">',"<h3>Alert!</h3>","</header>",'<div class="modal-body">',"<p>",e,"</p>","</div>",'<div class="modal-footer">','<button class="btn btn-primary btn-ok">OK</button>',"</div>","</div>"].join("")},n=function(e){return['<div class="modal">','<header class="modal-header">',"<h3>Confirm</h3>","</header>",'<div class="modal-body">',"<p>",e,"</p>","</div>",'<div class="modal-footer">','<button type="button" class="btn btn-primary btn-ok">OK</button>','<button type="button" class="btn btn-cancel">Cancel</button">',"</div>","</div>"].join("")};return{alert:function(n,r){return F2.isInit()?(F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Modals.alert",[].slice.call(arguments)):jQuery(e(n)).on("show",function(){var e=this;jQuery(e).find(".btn-primary").on("click",function(){jQuery(e).modal("hide").remove(),(r||jQuery.noop)()})}).modal({backdrop:!0}),void 0):(F2.log("F2.init() must be called before F2.UI.Modals.alert()"),void 0)},confirm:function(e,r,o){return F2.isInit()?(F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Modals.confirm",[].slice.call(arguments)):jQuery(n(e)).on("show",function(){var e=this;jQuery(e).find(".btn-ok").on("click",function(){jQuery(e).modal("hide").remove(),(r||jQuery.noop)()}),jQuery(e).find(".btn-cancel").on("click",function(){jQuery(e).modal("hide").remove(),(o||jQuery.noop)()})}).modal({backdrop:!0}),void 0):(F2.log("F2.init() must be called before F2.UI.Modals.confirm()"),void 0)}}}(),setTitle:function(e){F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"setTitle",[e]):jQuery(t.root).find("."+F2.Constants.Css.APP_TITLE).text(e)},showMask:function(e,n){F2.UI.showMask(t.instanceId,e,n)},updateHeight:r,Views:function(){var e=new EventEmitter2,o=/change/i;e.setMaxListeners(0);var i=function(e){return o.test(e)?!0:(F2.log('"'+e+'" is not a valid F2.UI.Views event name'),!1)};return{change:function(o){"function"==typeof o?this.on("change",o):"string"==typeof o&&(t.isSecure&&!F2.Rpc.isRemote(t.instanceId)?F2.Rpc.call(t.instanceId,F2.Constants.Sockets.UI_RPC,"Views.change",[].slice.call(arguments)):F2.inArray(o,t.views)&&(jQuery("."+F2.Constants.Css.APP_VIEW,n).addClass("hide").filter('[data-f2-view="'+o+'"]',n).removeClass("hide"),r(),e.emit("change",o)))},off:function(t,n){i(t)&&e.off(t,n)},on:function(t,n){i(t)&&e.on(t,n)}}}()}};return t.hideMask=function(e,t){if(!F2.isInit())return F2.log("F2.init() must be called before F2.UI.hideMask()"),void 0;if(F2.Rpc.isRemote(e)&&!jQuery(t).is("."+F2.Constants.Css.APP))F2.Rpc.call(e,F2.Constants.Sockets.RPC,"F2.UI.hideMask",[e,jQuery(t).selector]);else{var n=jQuery(t);n.find("> ."+F2.Constants.Css.MASK).remove(),n.removeClass(F2.Constants.Css.MASK_CONTAINER),n.data(F2.Constants.Css.MASK_CONTAINER)&&n.css({position:"static"})}},t.init=function(t){e=t,e.UI=jQuery.extend(!0,{},F2.ContainerConfig.UI,e.UI||{})},t.showMask=function(t,n,r){if(!F2.isInit())return F2.log("F2.init() must be called before F2.UI.showMask()"),void 0;if(F2.Rpc.isRemote(t)&&jQuery(n).is("."+F2.Constants.Css.APP))F2.Rpc.call(t,F2.Constants.Sockets.RPC,"F2.UI.showMask",[t,jQuery(n).selector,r]);else{r&&!e.UI.Mask.loadingIcon&&F2.log("Unable to display loading icon. Please set F2.ContainerConfig.UI.Mask.loadingIcon when calling F2.init();");var o=jQuery(n).addClass(F2.Constants.Css.MASK_CONTAINER),i=jQuery("<div>").height("100%").width("100%").addClass(F2.Constants.Css.MASK);e.UI.Mask.useClasses||i.css({"background-color":e.UI.Mask.backgroundColor,"background-image":e.UI.Mask.loadingIcon?"url("+e.UI.Mask.loadingIcon+")":"","background-position":"50% 50%","background-repeat":"no-repeat",display:"block",left:0,"min-height":30,padding:0,position:"absolute",top:0,"z-index":e.UI.Mask.zIndex,filter:"alpha(opacity="+100*e.UI.Mask.opacity+")",opacity:e.UI.Mask.opacity}),"static"===o.css("position")&&(o.css({position:"relative"}),o.data(F2.Constants.Css.MASK_CONTAINER,!0)),o.append(i)}},t}()),F2.extend("",function(){var _apps={},_config=!1,_bUsesAppHandlers=!1,_sAppHandlerToken=F2.AppHandlers.__f2GetToken(),_afterAppRender=function(e,t){var n=_config.afterAppRender||function(e,t){return jQuery(t).appendTo("body")},r=n(e,t);return _config.afterAppRender&&!r?(F2.log("F2.ContainerConfig.afterAppRender() must return the DOM Element that contains the app"),void 0):(jQuery(r).addClass(F2.Constants.Css.APP),r.get(0))},_appRender=function(e,t){return t=_outerHtml(jQuery(t).addClass(F2.Constants.Css.APP_CONTAINER+" "+e.appId)),_config.appRender&&(t=_config.appRender(e,t)),_outerHtml(t)},_beforeAppRender=function(e){var t=_config.beforeAppRender||jQuery.noop;return t(e)},_appScriptLoadFailed=function(e,t){var n=_config.appScriptLoadFailed||jQuery.noop;return n(e,t)},_createAppConfig=function(e){return e=jQuery.extend(!0,{},e),e.instanceId=e.instanceId||F2.guid(),e.views=e.views||[],F2.inArray(F2.Constants.Views.HOME,e.views)||e.views.push(F2.Constants.Views.HOME),e},_hydrateContainerConfig=function(e){e.scriptErrorTimeout||(e.scriptErrorTimeout=F2.ContainerConfig.scriptErrorTimeout),e.debugMode!==!0&&(e.debugMode=F2.ContainerConfig.debugMode)},_initAppEvents=function(e){jQuery(e.root).on("click","."+F2.Constants.Css.APP_VIEW_TRIGGER+"["+F2.Constants.Views.DATA_ATTRIBUTE+"]",function(t){t.preventDefault();var n=jQuery(this).attr(F2.Constants.Views.DATA_ATTRIBUTE).toLowerCase();n==F2.Constants.Views.REMOVE?F2.removeApp(e.instanceId):e.ui.Views.change(n)})},_initContainerEvents=function(){var e,t=function(){F2.Events.emit(F2.Constants.Events.CONTAINER_WIDTH_CHANGE)};jQuery(window).on("resize",function(){clearTimeout(e),e=setTimeout(t,100)})},_isInit=function(){return!!_config},_createAppInstance=function(e,t){e.ui=new F2.UI(e),void 0!==F2.Apps[e.appId]&&("function"==typeof F2.Apps[e.appId]?setTimeout(function(){_apps[e.instanceId].app=new F2.Apps[e.appId](e,t,e.root),void 0!==_apps[e.instanceId].app.init&&_apps[e.instanceId].app.init()},0):F2.log("app initialization class is defined but not a function. ("+e.appId+")"))},_loadApps=function(appConfigs,appManifest){if(appConfigs=[].concat(appConfigs),1==appConfigs.length&&appConfigs[0].isSecure&&!_config.isSecureAppPage)return _loadSecureApp(appConfigs[0],appManifest),void 0;if(appConfigs.length!=appManifest.apps.length)return F2.log("The number of apps defined in the AppManifest do not match the number requested.",appManifest),void 0;var scripts=appManifest.scripts||[],styles=appManifest.styles||[],inlines=appManifest.inlineScripts||[],scriptCount=scripts.length,scriptsLoaded=0,readyStates="addEventListener"in window?{}:{loaded:!0,complete:!0},appInit=function(){jQuery.each(appConfigs,function(e,t){_createAppInstance(t,appManifest.apps[e])})},_error=function(e){setTimeout(function(){var t={src:e.target.src,appId:appConfigs[0].appId};F2.log("Script defined in '"+t.appId+"' failed to load '"+t.src+"'"),F2.Events.emit("RESOURCE_FAILED_TO_LOAD",t),_bUsesAppHandlers?F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED,appConfigs[0],t.src):_appScriptLoadFailed(appConfigs[0],t.src)},_config.scriptErrorTimeout)},evalInlines=function(){jQuery.each(inlines,function(i,e){try{eval(e)}catch(exception){F2.log("Error loading inline script: "+exception+"\n\n"+e),_bUsesAppHandlers?F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED,appConfigs[0],exception):_appScriptLoadFailed(appConfigs[0],exception)}})},stylesFragment=null,useCreateStyleSheet=!!document.createStyleSheet;jQuery.each(styles,function(e,t){useCreateStyleSheet?document.createStyleSheet(t):(stylesFragment=stylesFragment||[],stylesFragment.push('<link rel="stylesheet" type="text/css" href="'+t+'"/>'))}),stylesFragment&&jQuery("head").append(stylesFragment.join("")),jQuery.each(appManifest.apps,function(e,t){if(_bUsesAppHandlers){F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER,appConfigs[e],_outerHtml(t.html));var n=appConfigs[e].appId;if(!appConfigs[e].root)throw"Root for "+n+" must be a native DOM element and cannot be null or undefined. Check your AppHandler callbacks to ensure you have set App root to a native DOM element.";var r=jQuery(appConfigs[e].root);if(0===r.parents("body:first").length)throw"App root for "+n+" was not appended to the DOM. Check your AppHandler callbacks to ensure you have rendered the app root to the DOM.";if(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER_AFTER,appConfigs[e]),!F2.isNativeDOMNode(appConfigs[e].root))throw"App root for "+n+" must be a native DOM element. Check your AppHandler callbacks to ensure you have set app root to a native DOM element.";r.addClass(F2.Constants.Css.APP_CONTAINER+" "+n)}else appConfigs[e].root=_afterAppRender(appConfigs[e],_appRender(appConfigs[e],t.html));_initAppEvents(appConfigs[e])}),jQuery.each(scripts,function(e,t){var n=document,r=n.createElement("script"),o=t;_config.debugMode&&(o+="?cachebuster="+(new Date).getTime()),r.async=!1,r.src=o,r.type="text/javascript",r.charset="utf-8",r.onerror=_error,r.onload=r.onreadystatechange=function(e){e=e||window.event,("load"==e.type||readyStates[r.readyState])&&(r.onload=r.onreadystatechange=r.onerror=null,r=null,++scriptsLoaded==scriptCount&&(evalInlines(),appInit()))},n.body.appendChild(r)}),scriptCount||(evalInlines(),appInit())},_loadSecureApp=function(e,t){if(_config.secureAppPagePath){if(_bUsesAppHandlers){var n=jQuery(e.root);if(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER,e,t.html),0===n.parents("body:first").length)throw"App was never rendered on the page. Please check your AppHandler callbacks to ensure you have rendered the app root to the DOM.";if(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER_AFTER,e),!e.root)throw"App Root must be a native dom node and can not be null or undefined. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.";if(!F2.isNativeDOMNode(e.root))throw"App Root must be a native dom node. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.";jQuery(e.root).addClass(F2.Constants.Css.APP_CONTAINER+" "+e.appId)}else e.root=_afterAppRender(e,_appRender(e,"<div></div>"));e.ui=new F2.UI(e),_initAppEvents(e),F2.Rpc.register(e,t)}else F2.log('Unable to load secure app: "secureAppPagePath" is not defined in F2.ContainerConfig.')},_outerHtml=function(e){return jQuery("<div></div>").append(e).html()},_validateApp=function(e){return e.appId?e.root||e.manifestUrl?!0:(F2.log('"manifestUrl" missing from app object'),!1):(F2.log('"appId" missing from app object'),!1)},_validateContainerConfig=function(){if(_config&&_config.xhr){if("function"!=typeof _config.xhr&&"object"!=typeof _config.xhr)throw"ContainerConfig.xhr should be a function or an object";if(_config.xhr.dataType&&"function"!=typeof _config.xhr.dataType)throw"ContainerConfig.xhr.dataType should be a function";if(_config.xhr.type&&"function"!=typeof _config.xhr.type)throw"ContainerConfig.xhr.type should be a function";if(_config.xhr.url&&"function"!=typeof _config.xhr.url)throw"ContainerConfig.xhr.url should be a function"}return!0};return{getContainerState:function(){return _isInit()?jQuery.map(_apps,function(e){return{appId:e.config.appId}}):(F2.log("F2.init() must be called before F2.getContainerState()"),void 0)},init:function(e){_config=e||{},_validateContainerConfig(),_hydrateContainerConfig(_config),_bUsesAppHandlers=!(_config.beforeAppRender||_config.appRender||_config.afterAppRender||_config.appScriptLoadFailed),(_config.secureAppPagePath||_config.isSecureAppPage)&&F2.Rpc.init(_config.secureAppPagePath?_config.secureAppPagePath:!1),F2.UI.init(_config),_config.isSecureAppPage||_initContainerEvents()},isInit:_isInit,registerApps:function(e,t){if(!_isInit())return F2.log("F2.init() must be called before F2.registerApps()"),void 0;if(!e)return F2.log("At least one AppConfig must be passed when calling F2.registerApps()"),void 0;var n=[],r={},o={},i=!1;return e=[].concat(e),t=[].concat(t||[]),i=!!t.length,e.length?e.length&&i&&e.length!=t.length?(F2.log('The length of "apps" does not equal the length of "appManifests"'),void 0):(jQuery.each(e,function(e,o){if(o=_createAppConfig(o),o.root=o.root||null,_validateApp(o)){if(_apps[o.instanceId]={config:o},o.root){if(!o.root&&"string"!=typeof o.root&&!F2.isNativeDOMNode(o.root))throw F2.log("AppConfig invalid for pre-load, not a valid string and not dom node"),F2.log("AppConfig instance:",o),"Preloaded appConfig.root property must be a native dom node or a string representing a sizzle selector. Please check your inputs and try again.";if(1!=jQuery(o.root).length)throw F2.log("AppConfig invalid for pre-load, root not unique"),F2.log("AppConfig instance:",o),F2.log("Number of dom node instances:",jQuery(o.root).length),"Preloaded appConfig.root property must map to a unique dom node. Please check your inputs and try again.";return _createAppInstance(o),_initAppEvents(o),void 0}_bUsesAppHandlers?(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_CREATE_ROOT,o),F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_RENDER_BEFORE,o)):o.root=_beforeAppRender(o),i?_loadApps(o,t[e]):o.enableBatchRequests&&!o.isSecure?(r[o.manifestUrl.toLowerCase()]=r[o.manifestUrl.toLowerCase()]||[],r[o.manifestUrl.toLowerCase()].push(o)):n.push({apps:[o],url:o.manifestUrl})}}),i||(jQuery.each(r,function(e,t){n.push({url:e,apps:t})}),jQuery.each(n,function(e,t){var n=F2.Constants.JSONP_CALLBACK+t.apps[0].appId;o[n]=o[n]||[],o[n].push(t)}),jQuery.each(o,function(e,t){var n=function(r,o){if(o){var i=o.url,a="GET",s="jsonp",l=function(){n(e,t.pop())},c=function(){jQuery.each(o.apps,function(e,t){F2.log("Removed failed "+t.name+" app",t),F2.removeApp(t.instanceId)})},u=function(e){_loadApps(o.apps,e)};if(_config.xhr&&_config.xhr.dataType&&(s=_config.xhr.dataType(o.url,o.apps),"string"!=typeof s))throw"ContainerConfig.xhr.dataType should return a string";if(_config.xhr&&_config.xhr.type&&(a=_config.xhr.type(o.url,o.apps),"string"!=typeof a))throw"ContainerConfig.xhr.type should return a string";if(_config.xhr&&_config.xhr.url&&(i=_config.xhr.url(o.url,o.apps),"string"!=typeof i))throw"ContainerConfig.xhr.url should return a string";var p=_config.xhr;"function"!=typeof p&&(p=function(e,t,n,i,l){jQuery.ajax({url:e,type:a,data:{params:F2.stringify(o.apps,F2.appConfigReplacer)},jsonp:!1,jsonpCallback:r,dataType:s,success:n,error:function(e,t,n){F2.log("Failed to load app(s)",""+n,o.apps),i()},complete:l})}),p(i,o.apps,u,c,l)}};n(e,t.pop())})),void 0):(F2.log("At least one AppConfig must be passed when calling F2.registerApps()"),void 0)},removeAllApps:function(){return _isInit()?(jQuery.each(_apps,function(e,t){F2.removeApp(t.config.instanceId)}),void 0):(F2.log("F2.init() must be called before F2.removeAllApps()"),void 0)},removeApp:function(e){return _isInit()?(_apps[e]&&(F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_DESTROY_BEFORE,_apps[e]),F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_DESTROY,_apps[e]),F2.AppHandlers.__trigger(_sAppHandlerToken,F2.Constants.AppHandlers.APP_DESTROY_AFTER,_apps[e]),delete _apps[e]),void 0):(F2.log("F2.init() must be called before F2.removeApp()"),void 0)}}}()),exports.F2=F2,"undefined"!=typeof define&&define.amd&&define(function(){return F2})}})("undefined"!=typeof exports?exports:window); //@ sourceMappingURL=f2.min.map
ajax/libs/quickblox/1.0.0/quickblox.min.js
rigdern/cdnjs
!function(e,t,n){function r(n,i){if(!t[n]){if(!e[n]){var s="function"==typeof require&&require;if(!i&&s)return s(n,!0);if(o)return o(n,!0);throw new Error("Cannot find module '"+n+"'")}var a=t[n]={exports:{}};e[n][0].call(a.exports,function(t){var o=e[n][1][t];return r(o?o:t)},a,a.exports)}return t[n].exports}for(var o="function"==typeof require&&require,i=0;i<n.length;i++)r(n[i]);return r}({1:[function(e,t){function n(e){this.service=e}function r(e,t){return signature=a(e,t).toString(),e+"&signature="+signature}function o(e){var t={application_id:e.appId||s.creds.appId,auth_key:e.authKey||s.creds.authKey,nonce:Math.floor(1e4*Math.random()),timestamp:i.unixTime()};e.login&&e.password?t.user={login:e.login,password:e.password}:e.email&&e.password?t.user={email:e.email,password:e.password}:e.provider&&(t.provider=e.provider,e.scope&&(t.scope=e.scope),t.keys={token:e.keys.token},e.keys.secret&&(messages.keys.secret=e.keys.secret));var n="application_id="+t.application_id+"&auth_key="+t.auth_key;return t.keys&&t.keys.token&&(n+="&keys[token]="+t.keys.token),n+="&nonce="+t.nonce,t.provider&&(n+="&provider="+t.provider),n+="&timestamp="+t.timestamp,t.user&&(t.user.login&&(n+="&user[login]="+t.user.login),t.user.email&&(n+="&user[email]="+t.user.email),t.user.password&&(n+="&user[password]="+t.user.password)),n}t.exports=n;var i=e("./qbUtils"),s=e("./qbConfig"),a=(e("./qbProxy"),e("../lib/jquery-1.10.2"),e("crypto-js/hmac-sha1")),u=s.urls.base+s.urls.session+s.urls.type,l=s.urls.base+s.urls.login+s.urls.type;n.prototype.createSession=function(e,t){var n,i=this;"function"==typeof e&&"undefined"==typeof t&&(t=e,e={}),n=o(e),n=r(n,e.authSecret||s.creds.authSecret),this.service.ajax({url:u,data:n,type:"POST",processData:!1},function(e,n){s.debug&&console.debug("AuthProxy.createSession callback",e,n),n&&n.session?(i.service.setSession(n.session),t(e,n.session)):t(e,null)})},n.prototype.destroySession=function(e){var t,n=this;t={token:this.service.getSession().token},this.service.ajax({url:u,type:"DELETE",dataType:"text"},function(t,r){s.debug&&console.debug("AuthProxy.destroySession callback",t,r),null===t&&n.service.setSession(null),e(t,!0)})},n.prototype.login=function(e,t){var n=this;null!==this.service.getSession()?(e.token=this.service.getSession().token,this.service.ajax({url:l,type:"POST",data:e},function(e,n){e?t(e,n):t(e,n.user)})):this.createSession(function(r,o){e.token=o.token,n.service.ajax({url:l,type:"POST",data:e},function(e,n){e?t(e,n):t(e,n.user)})})},n.prototype.logout=function(e){var t;t={token:this.service.getSession().token},this.service.ajax({url:l,dataType:"text",data:t,type:"DELETE"},e)},n.prototype.nonce=function(){return this._nonce++}},{"../lib/jquery-1.10.2":11,"./qbConfig":2,"./qbProxy":7,"./qbUtils":9,"crypto-js/hmac-sha1":13}],2:[function(e,t){var n={creds:{appId:"",authKey:"",authSecret:""},urls:{base:"https://api.quickblox.com/",find:"find",session:"session",login:"login",users:"users",pushtokens:"push_tokens",subscriptions:"subscriptions",events:"events",pullevents:"pull_events",geo:"geodata",places:"places",data:"data",content:"blobs",chat:"chat",type:".json"},debug:!1};t.exports=n},{}],3:[function(e,t){function n(e){return s+"/"+e}function r(e){this.service=e}function o(e){for(var t=o.options,n=t.parser[t.strictMode?"strict":"loose"].exec(e),r={},i=14;i--;)r[t.key[i]]=n[i]||"";return r[t.q.name]={},r[t.key[12]].replace(t.q.parser,function(e,n,o){n&&(r[t.q.name][n]=o)}),r}t.exports=r;var i=e("./qbConfig"),s=(e("./qbUtils"),i.urls.base+i.urls.content),a=s+"/tagged";r.prototype.create=function(e,t){i.debug&&console.debug("ContentProxy.create",e),this.service.ajax({url:s+i.urls.type,data:{blob:e},type:"POST"},function(e,n){e?t(e,null):t(e,n.blob)})},r.prototype.list=function(e,t){"function"==typeof e&&"undefined"==typeof t&&(t=e,e=null),this.service.ajax({url:s+i.urls.type},function(e,n){e?t(e,null):t(e,n)})},r.prototype.delete=function(e,t){this.service.ajax({url:n(e)+i.urls.type,type:"DELETE"},function(e,n){e?t(e,null):t(null,n)})},r.prototype.createAndUpload=function(e,t){var n,r,s,a,u,l={},c=this;i.debug&&console.debug("ContentProxy.createAndUpload",e),n=e.file,r=e.name||n.name,s=e.type||n.type,a=n.size,l.name=r,l.content_type=s,e.public&&(l.public=e.public),e.tag_list&&(l.tag_list=e.tag_list),this.create(l,function(e,r){if(e)t(e,null);else{var i=o(r.blob_object_access.params),s={url:i.protocol+"://"+i.host},l=new FormData;u=r.id,l.append("key",i.queryKey.key),l.append("acl",i.queryKey.acl),l.append("success_action_status",i.queryKey.success_action_status),l.append("AWSAccessKeyId",i.queryKey.AWSAccessKeyId),l.append("Policy",decodeURIComponent(i.queryKey.Policy)),l.append("Signature",decodeURIComponent(i.queryKey.Signature)),l.append("Content-Type",i.queryKey["Content-Type"]),l.append("file",n,r.name),s.data=l,c.upload(s,function(e){e?t(e,null):c.markUploaded({id:u,size:a},function(e){e?t(e,null):t(null,r)})})}})},r.prototype.upload=function(e,t){this.service.ajax({url:e.url,data:e.data,dataType:"xml",contentType:!1,processData:!1,type:"POST"},function(e,n){if(e)t(e,null);else{var r,o,s={},a=n.documentElement,u=a.childNodes;for(r=0,o=u.length;o>r;r++)s[u[r].nodeName]=u[r].childNodes[0].nodeValue;i.debug&&console.debug("result",s),t(null,s)}})},r.prototype.taggedForCurrentUser=function(e){this.service.ajax({url:a+i.urls.type},function(t,n){t?e(t,null):e(null,n)})},r.prototype.markUploaded=function(e,t){this.service.ajax({url:n(e.id)+"/complete"+i.urls.type,type:"PUT",data:{size:e.size},dataType:"text"},function(e,n){e?t(e,null):t(null,n)})},r.prototype.getInfo=function(e,t){this.service.ajax({url:n(e)+i.urls.type},function(e,n){e?t(e,null):t(null,n)})},r.prototype.getFile=function(e,t){this.service.ajax({url:n(id)+i.urls.type},function(e,n){e?t(e,null):t(null,n)})},r.prototype.getFileUrl=function(e,t){this.service.ajax({url:n(e)+"/getblobobjectbyid"+i.urls.type,type:"POST"},function(e,n){e?t(e,null):t(null,n.blob_object_access.params)})},r.prototype.update=function(e,t){var r={};r.blob={},"undefined"!=typeof e.name&&(r.blob.name=e.name),this.service.ajax({url:n(param.id),data:r},function(e,n){e?t(e,null):t(null,n)})},o.options={strictMode:!1,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}}},{"./qbConfig":2,"./qbUtils":9}],4:[function(e,t){function n(e){this.service=e,r.debug&&console.debug("LocationProxy",e)}t.exports=n;var r=e("./qbConfig"),o=e("./qbUtils"),i=r.urls.base+r.urls.data;n.prototype.create=function(e,t,n){r.debug&&console.debug("DataProxy.create",e,t),this.service.ajax({url:o.resourceUrl(i,e),data:t,type:"POST"},function(e,t){e?n(e,null):n(e,t)})},n.prototype.list=function(e,t,n){"undefined"==typeof n&&"function"==typeof t&&(n=t,t=null),r.debug&&console.debug("DataProxy.list",e,t),this.service.ajax({url:o.resourceUrl(i,e),data:t},function(e,t){e?n(e,null):n(e,t)})},n.prototype.update=function(e,t,n){r.debug&&console.debug("DataProxy.update",e,t),this.service.ajax({url:o.resourceUrl(i,e+"/"+t._id),data:t,type:"PUT"},function(e,t){e?n(e,null):n(e,t)})},n.prototype.delete=function(e,t,n){r.debug&&console.debug("DataProxy.delete",e,t),this.service.ajax({url:o.resourceUrl(i,e+"/"+t),type:"DELETE",dataType:"text"},function(e){e?n(e,null):n(e,!0)})},n.prototype.uploadFile=function(e,t,n){var s;r.debug&&console.debug("DataProxy.uploadFile",e,t),s=new FormData,s.append("field_name",t.field_name),s.append("file",t.file),this.service.ajax({url:o.resourceUrl(i,e+"/"+t.id+"/file"),data:s,contentType:!1,processData:!1,type:"POST"},function(e,t){e?n(e,null):n(e,t)})},n.prototype.updateFile=function(e,t,n){var s;r.debug&&console.debug("DataProxy.updateFile",e,t),s=new FormData,s.append("field_name",t.field_name),s.append("file",t.file),this.service.ajax({url:o.resourceUrl(i,e+"/"+t.id+"/file"),data:s,contentType:!1,processData:!1,type:"POST"},function(e,t){e?n(e,null):n(e,t)})},n.prototype.downloadFile=function(e,t,n){r.debug&&console.debug("DataProxy.downloadFile",e,t),this.service.ajax({url:o.resourceUrl(i,e+"/"+t.id+"/file"),data:"field_name="+t.field_name,type:"GET",contentType:!1,processData:!1,mimeType:"text/plain; charset=x-user-defined",dataType:"binary"},function(e,t){e?n(e,null):n(e,t)})},n.prototype.deleteFile=function(e,t,n){r.debug&&console.debug("DataProxy.deleteFile",e,t),this.service.ajax({url:o.resourceUrl(i,e+"/"+t.id+"/file"),data:{field_name:t.field_name},dataType:"text",type:"DELETE"},function(e){e?n(e,null):n(e,!0)})}},{"./qbConfig":2,"./qbUtils":9}],5:[function(e,t){function n(e){this.service=e,this.geodata=new r(e),this.places=new o(e),i.debug&&console.debug("LocationProxy",e)}function r(e){this.service=e}function o(e){this.service=e}t.exports=n;var i=e("./qbConfig"),s=e("./qbUtils"),a=i.urls.base+i.urls.geo,u=a+"/"+i.urls.find+i.urls.type,l=i.urls.base+i.urls.places;r.prototype.create=function(e,t){i.debug&&console.debug("GeoProxy.create",{geo_data:e}),this.service.ajax({url:a+i.urls.type,data:{geo_data:e},type:"POST"},function(e,n){e?t(e,null):t(e,n.geo_datum)})},r.prototype.update=function(e,t){var n,r=["longitude","latitude","status"],o={};for(n in e)e.hasOwnProperty(n)&&r.indexOf(n)>0&&(o[n]=e[n]);i.debug&&console.debug("GeoProxy.create",e),this.service.ajax({url:s.resourceUrl(a,e.id),data:{geo_data:o},type:"PUT"},function(e,n){e?t(e,null):t(e,n.geo_datum)})},r.prototype.get=function(e,t){i.debug&&console.debug("GeoProxy.get",e),this.service.ajax({url:s.resourceUrl(a,e)},function(e,n){e?t(e,null):t(null,n.geo_datum)})},r.prototype.list=function(e,t){"function"==typeof e&&(t=e,e=void 0),i.debug&&console.debug("GeoProxy.find",e),this.service.ajax({url:u,data:e},t)},r.prototype.delete=function(e,t){i.debug&&console.debug("GeoProxy.delete",e),this.service.ajax({url:s.resourceUrl(a,e),type:"DELETE",dataType:"text"},function(e){e?t(e,null):t(null,!0)})},r.prototype.purge=function(e,t){i.debug&&console.debug("GeoProxy.purge",e),this.service.ajax({url:a+i.urls.type,data:{days:e},type:"DELETE",dataType:"text"},function(e){e?t(e,null):t(null,!0)})},o.prototype.list=function(e,t){i.debug&&console.debug("PlacesProxy.list",e),this.service.ajax({url:l+i.urls.type},t)},o.prototype.create=function(e,t){i.debug&&console.debug("PlacesProxy.create",e),this.service.ajax({url:l+i.urls.type,data:{place:e},type:"POST"},t)},o.prototype.get=function(e,t){i.debug&&console.debug("PlacesProxy.get",params),this.service.ajax({url:s.resourceUrl(l,e)},t)},o.prototype.update=function(e,t){i.debug&&console.debug("PlacesProxy.update",e),this.service.ajax({url:s.resourceUrl(l,id),data:{place:e},type:"PUT"},t)},o.prototype.delete=function(e,t){i.debug&&console.debug("PlacesProxy.delete",params),this.service.ajax({url:s.resourceUrl(l,e),type:"DELETE"},t)}},{"./qbConfig":2,"./qbUtils":9}],6:[function(e,t){function n(e){this.service=e,this.tokens=new r(e),this.subscriptions=new o(e),this.events=new i(e)}function r(e){this.service=e}function o(e){this.service=e}function i(e){this.service=e}t.exports=n;var s=e("./qbConfig"),a=(e("./qbProxy"),e("../lib/jquery-1.10.2"),s.urls.base+s.urls.pushtokens),u=s.urls.base+s.urls.subscriptions,l=s.urls.base+s.urls.events,c=s.urls.base+s.urls.pullevents;r.prototype.create=function(e,t){var n={push_token:{environment:e.environment,client_identification_sequence:e.client_identification_sequence},device:{platform:e.platform,udid:e.udid}};s.debug&&console.debug("TokensProxy.create",n),this.service.ajax({url:a+s.urls.type,type:"POST",data:n},function(e,n){e?t(e,null):t(null,n.push_token)})},r.prototype.delete=function(e,t){var n=a+"/"+e+s.urls.type;s.debug&&console.debug("MessageProxy.deletePushToken",e),this.service.ajax({url:n,type:"DELETE",dataType:"text"},function(e){e?t(e,null):t(null,!0)})},o.prototype.create=function(e,t){s.debug&&console.debug("MessageProxy.createSubscription",e),this.service.ajax({url:u+s.urls.type,type:"POST",data:e},t)},o.prototype.list=function(e){s.debug&&console.debug("MessageProxy.listSubscription",params),this.service.ajax({url:u+s.urls.type},e)},o.prototype.delete=function(e,t){var n=u+"/"+e+s.urls.type;s.debug&&console.debug("MessageProxy.deleteSubscription",e),this.service.ajax({url:n,type:"DELETE",dataType:"text"},function(e){e?t(e,null):t(null,!0)})},i.prototype.create=function(e,t){s.debug&&console.debug("MessageProxy.createEvent",e);var n={event:e};this.service.ajax({url:l+s.urls.type,type:"POST",data:n},t)},i.prototype.list=function(e){s.debug&&console.debug("MessageProxy.listEvents"),this.service.ajax({url:l+s.urls.type},e)},i.prototype.get=function(e,t){var n=l+"/"+params.id+s.urls.type;s.debug&&console.debug("MessageProxy.getEvents",e),this.service.ajax({url:n},t)},i.prototype.update=function(e,t){var n=l+"/"+e.id+s.urls.type;s.debug&&console.debug("MessageProxy.createEvent",e);var r={event:e};this.service.ajax({url:n,type:"PUT",data:r},t)},i.prototype.delete=function(e,t){var n=l+"/"+params.id+s.urls.type;s.debug&&console.debug("MessageProxy.deleteEvent",e),this.service.ajax({url:n,type:"DELETE"},t)},i.prototype.pullEvents=function(e){s.debug&&console.debug("MessageProxy.getPullEvents",params),this.service.ajax({url:c+s.urls.type},e)}},{"../lib/jquery-1.10.2":11,"./qbConfig":2,"./qbProxy":7}],7:[function(e,t){function n(e){this.qbInst=e,o.support.cors=!0,o.ajaxSetup({accepts:{binary:"text/plain; charset=x-user-defined"},contents:{},converters:{"text binary":!0}}),r.debug&&console.debug("ServiceProxy",e)}t.exports=n;var r=e("./qbConfig"),o=e("../lib/jquery-1.10.2");n.prototype.setSession=function(e){this.qbInst.session=e},n.prototype.getSession=function(){return this.qbInst.session},n.prototype.ajax=function(e,t){var n=this;r.debug&&console.debug("ServiceProxy",e.type||"GET",e);var i={url:e.url,type:e.type||"GET",dataType:e.dataType||"json",data:e.data,beforeSend:function(e,t){r.debug&&console.debug("ServiceProxy.ajax beforeSend",e,t),-1===t.url.indexOf("://qbprod.s3.amazonaws.com")&&(console.debug("setting headers on request to "+t.url),e.setRequestHeader("QuickBlox-REST-API-Version","0.1.1"),n.qbInst.session&&n.qbInst.session.token&&e.setRequestHeader("QB-Token",n.qbInst.session.token))},success:function(e,n){r.debug&&console.debug("ServiceProxy.ajax success",n,e),t(null,e)},error:function(e,n,o){r.debug&&console.debug("ServiceProxy.ajax error",e,n,o);var i={status:n,message:o};e&&e.responseText&&(i.detail=e.responseText||e.responseXML),r.debug&&console.debug("ServiceProxy.ajax error",o),t(i,null)}};("boolean"==typeof e.contentType||"string"==typeof e.contentType)&&(i.contentType=e.contentType),"boolean"==typeof e.processData&&(i.processData=e.processData),"boolean"==typeof e.crossDomain&&(i.crossDomain=e.crossDomain),"boolean"==typeof e.async&&(i.async=e.async),"boolean"==typeof e.cache&&(i.cache=e.cache),"boolean"==typeof e.crossDomain&&(i.crossDomain=e.crossDomain),"string"==typeof e.mimeType&&(i.mimeType=e.mimeType),o.ajax(i)}},{"../lib/jquery-1.10.2":11,"./qbConfig":2}],8:[function(e,t){function n(e){this.service=e}t.exports=n;var r=e("./qbConfig"),o=(e("./qbProxy"),r.urls.base+r.urls.users);n.prototype.listUsers=function(e,t){var n,o,i={};if(n=r.urls.base+r.urls.users+r.urls.type,"function"==typeof e&&(t=e,e=void 0),e&&e.filter){switch(e.filter.type){case"id":o="number id in";break;case"email":o="string email in";break;case"login":o="string login in";break;case"facebook_id":o="number facebook_id in";break;case"twitter_id":o="number twitter_id in";break;case"phone":o="string phone in"}o=o+" "+e.filter.value,i["filter[]"]=o}e&&e.perPage&&(i.per_page=e.perPage),e&&e.pageNo&&(i.page=e.pageNo),r.debug&&console.debug("UsersProxy.list",i),this.service.ajax({url:n,data:i},t)},n.prototype.create=function(e,t){var n=o+r.urls.type;r.debug&&console.debug("UsersProxy.create",e),this.service.ajax({url:n,type:"POST",data:{user:e}},function(e,n){e?t(e,null):t(null,n.user)})},n.prototype.delete=function(e,t){var n=o+"/"+e+r.urls.type;r.debug&&console.debug("UsersProxy.delete",n),this.service.ajax({url:n,type:"DELETE",dataType:"text"},function(e){e?t(e,null):t(null,!0)})},n.prototype.update=function(e,t){var n,i=["login","blob_id","email","external_user_id","facebook_id","twitter_id","full_name","phone","website","tag_list","password","old_password"],s=o+"/"+e.id+r.urls.type,a={};for(n in e)e.hasOwnProperty(n)&&i.indexOf(n)>0&&(a[n]=e[n]);r.debug&&console.debug("UsersProxy.update",s,e),this.service.ajax({url:s,type:"PUT",data:{user:a}},function(e,n){e?t(e,null):(console.debug(n.user),t(null,n.user))})},n.prototype.get=function(e,t){var n=o;"function"==typeof e&&(t=e,e={}),"number"==typeof e?n+="/"+e+r.urls.type:"object"==typeof e&&(e.id?n+="/"+e.id+r.urls.type:e.facebookId?n+="/by_facebook_id"+r.urls.type+"?facebook_id="+e.facebookId:e.login?n+="/by_login"+r.urls.type+"?login="+e.login:e.fullName?n+="/by_full_name"+r.urls.type+"?full_name="+e.fullName:e.twitterId?n+="/by_twitter_id"+r.urls.type+"?twitter_id="+e.twitterId:e.email?n+="/by_email"+r.urls.type+"?email="+e.email:e.tags&&(n+="/by_tags"+r.urls.type+"?tag="+e.tags)),r.debug&&console.debug("UsersProxy.get",n),this.service.ajax({url:n},function(e,n){var o;n&&n.user&&(o=n.user),r.debug&&console.debug("UserProxy.get",o),t(e,o)})}},{"./qbConfig":2,"./qbProxy":7}],9:[function(e,t,n){function r(){Date.now||(Date.now=function(){return(new Date).getTime()}),"undefined"!=typeof console&&console.log||(window.console={debug:function(){},trace:function(){},log:function(){},info:function(){},warn:function(){},error:function(){}})}var o=e("./qbConfig");n.shims=function(){r()},n.unixTime=function(){return Math.floor(Date.now()/1e3).toString()},n.resourceUrl=function(e,t,n){return e+"/"+t+("undefined"==typeof n?o.urls.type:n)}},{"./qbConfig":2}],10:[function(e,t){function n(){r.debug&&console.debug("Quickblox instantiated",this)}t.exports=n;var r=e("./qbConfig"),o=e("./qbUtils"),i=e("./qbProxy"),s=e("./qbAuth"),a=e("./qbUsers"),u=e("./qbMessages"),l=e("./qbLocation"),c=e("./qbData"),p=e("./qbContent"),f=function(e,t){return o.shims(),"undefined"==typeof e.config&&(e=new n),t&&"undefined"==typeof t.QB&&(t.QB=e),e}(f||{},window);n.prototype.init=function(e,t,n,o){this.session=null,this.service=new i(this),this.auth=new s(this.service),this.users=new a(this.service),this.messages=new u(this.service),this.location=new l(this.service),this.data=new c(this.service),this.content=new p(this.service),"object"==typeof e&&(o=e.debug,n=e.authSecret,t=e.authKey,e=e.appId),r.creds.appId=e,r.creds.authKey=t,r.creds.authSecret=n,o&&(r.debug=o,console.debug("QuickBlox.init",this))},n.prototype.config=r,n.prototype.createSession=function(e,t){this.auth.createSession(e,t)},n.prototype.destroySession=function(e){this.session&&this.auth.destroySession(e)},n.prototype.login=function(e,t){this.auth.login(e,t)},n.prototype.logout=function(e){this.session&&this.auth.logout(e)}},{"./qbAuth":1,"./qbConfig":2,"./qbContent":3,"./qbData":4,"./qbLocation":5,"./qbMessages":6,"./qbProxy":7,"./qbUsers":8,"./qbUtils":9}],11:[function(e,t){!function(){!function(e,n){function r(e){var t=e.length,n=pt.type(e);return pt.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}function o(e){var t=Et[e]={};return pt.each(e.match(dt)||[],function(e,n){t[n]=!0}),t}function i(e,t,r,o){if(pt.acceptData(e)){var i,s,a=pt.expando,u=e.nodeType,l=u?pt.cache:e,c=u?e[a]:e[a]&&a;if(c&&l[c]&&(o||l[c].data)||r!==n||"string"!=typeof t)return c||(c=u?e[a]=nt.pop()||pt.guid++:a),l[c]||(l[c]=u?{}:{toJSON:pt.noop}),("object"==typeof t||"function"==typeof t)&&(o?l[c]=pt.extend(l[c],t):l[c].data=pt.extend(l[c].data,t)),s=l[c],o||(s.data||(s.data={}),s=s.data),r!==n&&(s[pt.camelCase(t)]=r),"string"==typeof t?(i=s[t],null==i&&(i=s[pt.camelCase(t)])):i=s,i}}function s(e,t,n){if(pt.acceptData(e)){var r,o,i=e.nodeType,s=i?pt.cache:e,a=i?e[pt.expando]:pt.expando;if(s[a]){if(t&&(r=n?s[a]:s[a].data)){pt.isArray(t)?t=t.concat(pt.map(t,pt.camelCase)):t in r?t=[t]:(t=pt.camelCase(t),t=t in r?[t]:t.split(" ")),o=t.length;for(;o--;)delete r[t[o]];if(n?!u(r):!pt.isEmptyObject(r))return}(n||(delete s[a].data,u(s[a])))&&(i?pt.cleanData([e],!0):pt.support.deleteExpando||s!=s.window?delete s[a]:s[a]=null)}}}function a(e,t,r){if(r===n&&1===e.nodeType){var o="data-"+t.replace(jt,"-$1").toLowerCase();if(r=e.getAttribute(o),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:Nt.test(r)?pt.parseJSON(r):r}catch(i){}pt.data(e,t,r)}else r=n}return r}function u(e){var t;for(t in e)if(("data"!==t||!pt.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function l(){return!0}function c(){return!1}function p(){try{return Q.activeElement}catch(e){}}function f(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function d(e,t,n){if(pt.isFunction(t))return pt.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return pt.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(Wt.test(t))return pt.filter(t,e,n);t=pt.filter(t,e)}return pt.grep(e,function(e){return pt.inArray(e,t)>=0!==n})}function h(e){var t=Kt.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function y(e,t){return pt.nodeName(e,"table")&&pt.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function g(e){return e.type=(null!==pt.find.attr(e,"type"))+"/"+e.type,e}function m(e){var t=sn.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function v(e,t){for(var n,r=0;null!=(n=e[r]);r++)pt._data(n,"globalEval",!t||pt._data(t[r],"globalEval"))}function b(e,t){if(1===t.nodeType&&pt.hasData(e)){var n,r,o,i=pt._data(e),s=pt._data(t,i),a=i.events;if(a){delete s.handle,s.events={};for(n in a)for(r=0,o=a[n].length;o>r;r++)pt.event.add(t,n,a[n][r])}s.data&&(s.data=pt.extend({},s.data))}}function x(e,t){var n,r,o;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!pt.support.noCloneEvent&&t[pt.expando]){o=pt._data(t);for(r in o.events)pt.removeEvent(t,r,o.handle);t.removeAttribute(pt.expando)}"script"===n&&t.text!==e.text?(g(t).text=e.text,m(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),pt.support.html5Clone&&e.innerHTML&&!pt.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&nn.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)}}function w(e,t){var r,o,i=0,s=typeof e.getElementsByTagName!==V?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==V?e.querySelectorAll(t||"*"):n;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[i]);i++)!t||pt.nodeName(o,t)?s.push(o):pt.merge(s,w(o,t));return t===n||t&&pt.nodeName(e,t)?pt.merge([e],s):s}function T(e){nn.test(e.type)&&(e.defaultChecked=e.checked)}function C(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,o=En.length;o--;)if(t=En[o]+n,t in e)return t;return r}function k(e,t){return e=t||e,"none"===pt.css(e,"display")||!pt.contains(e.ownerDocument,e)}function S(e,t){for(var n,r,o,i=[],s=0,a=e.length;a>s;s++)r=e[s],r.style&&(i[s]=pt._data(r,"olddisplay"),n=r.style.display,t?(i[s]||"none"!==n||(r.style.display=""),""===r.style.display&&k(r)&&(i[s]=pt._data(r,"olddisplay",_(r.nodeName)))):i[s]||(o=k(r),(n&&"none"!==n||!o)&&pt._data(r,"olddisplay",o?n:pt.css(r,"display"))));for(s=0;a>s;s++)r=e[s],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?i[s]||"":"none"));return e}function E(e,t,n){var r=bn.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function N(e,t,n,r,o){for(var i=n===(r?"border":"content")?4:"width"===t?1:0,s=0;4>i;i+=2)"margin"===n&&(s+=pt.css(e,n+Sn[i],!0,o)),r?("content"===n&&(s-=pt.css(e,"padding"+Sn[i],!0,o)),"margin"!==n&&(s-=pt.css(e,"border"+Sn[i]+"Width",!0,o))):(s+=pt.css(e,"padding"+Sn[i],!0,o),"padding"!==n&&(s+=pt.css(e,"border"+Sn[i]+"Width",!0,o)));return s}function j(e,t,n){var r=!0,o="width"===t?e.offsetWidth:e.offsetHeight,i=fn(e),s=pt.support.boxSizing&&"border-box"===pt.css(e,"boxSizing",!1,i);if(0>=o||null==o){if(o=dn(e,t,i),(0>o||null==o)&&(o=e.style[t]),xn.test(o))return o;r=s&&(pt.support.boxSizingReliable||o===e.style[t]),o=parseFloat(o)||0}return o+N(e,t,n||(s?"border":"content"),r,i)+"px"}function _(e){var t=Q,n=Tn[e];return n||(n=D(e,t),"none"!==n&&n||(pn=(pn||pt("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(pn[0].contentWindow||pn[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=D(e,t),pn.detach()),Tn[e]=n),n}function D(e,t){var n=pt(t.createElement(e)).appendTo(t.body),r=pt.css(n[0],"display");return n.remove(),r}function q(e,t,n,r){var o;if(pt.isArray(t))pt.each(t,function(t,o){n||jn.test(e)?r(e,o):q(e+"["+("object"==typeof o?t:"")+"]",o,n,r)});else if(n||"object"!==pt.type(t))r(e,t);else for(o in t)q(e+"["+o+"]",t[o],n,r)}function A(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o=0,i=t.toLowerCase().match(dt)||[];if(pt.isFunction(n))for(;r=i[o++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function P(e,t,n,r){function o(a){var u;return i[a]=!0,pt.each(e[a]||[],function(e,a){var l=a(t,n,r);return"string"!=typeof l||s||i[l]?s?!(u=l):void 0:(t.dataTypes.unshift(l),o(l),!1)}),u}var i={},s=e===$n;return o(t.dataTypes[0])||!i["*"]&&o("*")}function L(e,t){var r,o,i=pt.ajaxSettings.flatOptions||{};for(o in t)t[o]!==n&&((i[o]?e:r||(r={}))[o]=t[o]);return r&&pt.extend(!0,e,r),e}function H(e,t,r){for(var o,i,s,a,u=e.contents,l=e.dataTypes;"*"===l[0];)l.shift(),i===n&&(i=e.mimeType||t.getResponseHeader("Content-Type"));if(i)for(a in u)if(u[a]&&u[a].test(i)){l.unshift(a);break}if(l[0]in r)s=l[0];else{for(a in r){if(!l[0]||e.converters[a+" "+l[0]]){s=a;break}o||(o=a)}s=s||o}return s?(s!==l[0]&&l.unshift(s),r[s]):void 0}function M(e,t,n,r){var o,i,s,a,u,l={},c=e.dataTypes.slice();if(c[1])for(s in e.converters)l[s.toLowerCase()]=e.converters[s];for(i=c.shift();i;)if(e.responseFields[i]&&(n[e.responseFields[i]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=i,i=c.shift())if("*"===i)i=u;else if("*"!==u&&u!==i){if(s=l[u+" "+i]||l["* "+i],!s)for(o in l)if(a=o.split(" "),a[1]===i&&(s=l[u+" "+a[0]]||l["* "+a[0]])){s===!0?s=l[o]:l[o]!==!0&&(i=a[0],c.unshift(a[1]));break}if(s!==!0)if(s&&e["throws"])t=s(t);else try{t=s(t)}catch(p){return{state:"parsererror",error:s?p:"No conversion from "+u+" to "+i}}}return{state:"success",data:t}}function O(){try{return new e.XMLHttpRequest}catch(t){}}function B(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function F(){return setTimeout(function(){er=n}),er=pt.now()}function R(e,t,n){for(var r,o=(sr[t]||[]).concat(sr["*"]),i=0,s=o.length;s>i;i++)if(r=o[i].call(n,t,e))return r}function I(e,t,n){var r,o,i=0,s=ir.length,a=pt.Deferred().always(function(){delete u.elem}),u=function(){if(o)return!1;for(var t=er||F(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,i=1-r,s=0,u=l.tweens.length;u>s;s++)l.tweens[s].run(i);return a.notifyWith(e,[l,i,n]),1>i&&u?n:(a.resolveWith(e,[l]),!1)},l=a.promise({elem:e,props:pt.extend({},t),opts:pt.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:er||F(),duration:n.duration,tweens:[],createTween:function(t,n){var r=pt.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(o)return this;for(o=!0;r>n;n++)l.tweens[n].run(1);return t?a.resolveWith(e,[l,t]):a.rejectWith(e,[l,t]),this}}),c=l.props;for(U(c,l.opts.specialEasing);s>i;i++)if(r=ir[i].call(l,e,c,l.opts))return r;return pt.map(c,R,l),pt.isFunction(l.opts.start)&&l.opts.start.call(e,l),pt.fx.timer(pt.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 U(e,t){var n,r,o,i,s;for(n in e)if(r=pt.camelCase(n),o=t[r],i=e[n],pt.isArray(i)&&(o=i[1],i=e[n]=i[0]),n!==r&&(e[r]=i,delete e[n]),s=pt.cssHooks[r],s&&"expand"in s){i=s.expand(i),delete e[r];for(n in i)n in e||(e[n]=i[n],t[n]=o)}else t[r]=o}function W(e,t,n){var r,o,i,s,a,u,l=this,c={},p=e.style,f=e.nodeType&&k(e),d=pt._data(e,"fxshow");n.queue||(a=pt._queueHooks(e,"fx"),null==a.unqueued&&(a.unqueued=0,u=a.empty.fire,a.empty.fire=function(){a.unqueued||u()}),a.unqueued++,l.always(function(){l.always(function(){a.unqueued--,pt.queue(e,"fx").length||a.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===pt.css(e,"display")&&"none"===pt.css(e,"float")&&(pt.support.inlineBlockNeedsLayout&&"inline"!==_(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",pt.support.shrinkWrapBlocks||l.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(o=t[r],nr.exec(o)){if(delete t[r],i=i||"toggle"===o,o===(f?"hide":"show"))continue;c[r]=d&&d[r]||pt.style(e,r)}if(!pt.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=pt._data(e,"fxshow",{}),i&&(d.hidden=!f),f?pt(e).show():l.done(function(){pt(e).hide()}),l.done(function(){var t;pt._removeData(e,"fxshow");for(t in c)pt.style(e,t,c[t])});for(r in c)s=R(f?d[r]:0,r,l),r in d||(d[r]=s.start,f&&(s.end=s.start,s.start="width"===r||"height"===r?1:0))}}function z(e,t,n,r,o){return new z.prototype.init(e,t,n,r,o)}function $(e,t){var n,r={height:e},o=0;for(t=t?1:0;4>o;o+=2-t)n=Sn[o],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function X(e){return pt.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var K,G,V=typeof n,J=e.location,Q=e.document,Y=Q.documentElement,Z=e.jQuery,et=e.$,tt={},nt=[],rt="1.10.2",ot=nt.concat,it=nt.push,st=nt.slice,at=nt.indexOf,ut=tt.toString,lt=tt.hasOwnProperty,ct=rt.trim,pt=function(e,t){return new pt.fn.init(e,t,G)},ft=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,dt=/\S+/g,ht=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,yt=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,gt=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,mt=/^[\],:{}\s]*$/,vt=/(?:^|:|,)(?:\s*\[)+/g,bt=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,xt=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,wt=/^-ms-/,Tt=/-([\da-z])/gi,Ct=function(e,t){return t.toUpperCase()},kt=function(e){(Q.addEventListener||"load"===e.type||"complete"===Q.readyState)&&(St(),pt.ready())},St=function(){Q.addEventListener?(Q.removeEventListener("DOMContentLoaded",kt,!1),e.removeEventListener("load",kt,!1)):(Q.detachEvent("onreadystatechange",kt),e.detachEvent("onload",kt))};pt.fn=pt.prototype={jquery:rt,constructor:pt,init:function(e,t,r){var o,i;if(!e)return this;if("string"==typeof e){if(o="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:yt.exec(e),!o||!o[1]&&t)return!t||t.jquery?(t||r).find(e):this.constructor(t).find(e);if(o[1]){if(t=t instanceof pt?t[0]:t,pt.merge(this,pt.parseHTML(o[1],t&&t.nodeType?t.ownerDocument||t:Q,!0)),gt.test(o[1])&&pt.isPlainObject(t))for(o in t)pt.isFunction(this[o])?this[o](t[o]):this.attr(o,t[o]);return this}if(i=Q.getElementById(o[2]),i&&i.parentNode){if(i.id!==o[2])return r.find(e);this.length=1,this[0]=i}return this.context=Q,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):pt.isFunction(e)?r.ready(e):(e.selector!==n&&(this.selector=e.selector,this.context=e.context),pt.makeArray(e,this))},selector:"",length:0,toArray:function(){return st.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=pt.merge(this.constructor(),e); return t.prevObject=this,t.context=this.context,t},each:function(e,t){return pt.each(this,e,t)},ready:function(e){return pt.ready.promise().done(e),this},slice:function(){return this.pushStack(st.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(pt.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:it,sort:[].sort,splice:[].splice},pt.fn.init.prototype=pt.fn,pt.extend=pt.fn.extend=function(){var e,t,r,o,i,s,a=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[1]||{},u=2),"object"==typeof a||pt.isFunction(a)||(a={}),l===u&&(a=this,--u);l>u;u++)if(null!=(i=arguments[u]))for(o in i)e=a[o],r=i[o],a!==r&&(c&&r&&(pt.isPlainObject(r)||(t=pt.isArray(r)))?(t?(t=!1,s=e&&pt.isArray(e)?e:[]):s=e&&pt.isPlainObject(e)?e:{},a[o]=pt.extend(c,s,r)):r!==n&&(a[o]=r));return a},pt.extend({expando:"jQuery"+(rt+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===pt&&(e.$=et),t&&e.jQuery===pt&&(e.jQuery=Z),pt},isReady:!1,readyWait:1,holdReady:function(e){e?pt.readyWait++:pt.ready(!0)},ready:function(e){if(e===!0?!--pt.readyWait:!pt.isReady){if(!Q.body)return setTimeout(pt.ready);pt.isReady=!0,e!==!0&&--pt.readyWait>0||(K.resolveWith(Q,[pt]),pt.fn.trigger&&pt(Q).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===pt.type(e)},isArray:Array.isArray||function(e){return"array"===pt.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?String(e):"object"==typeof e||"function"==typeof e?tt[ut.call(e)]||"object":typeof e},isPlainObject:function(e){var t;if(!e||"object"!==pt.type(e)||e.nodeType||pt.isWindow(e))return!1;try{if(e.constructor&&!lt.call(e,"constructor")&&!lt.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(pt.support.ownLast)for(t in e)return lt.call(e,t);for(t in e);return t===n||lt.call(e,t)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||Q;var r=gt.exec(e),o=!n&&[];return r?[t.createElement(r[1])]:(r=pt.buildFragment([e],t,o),o&&pt(o).remove(),pt.merge([],r.childNodes))},parseJSON:function(t){return e.JSON&&e.JSON.parse?e.JSON.parse(t):null===t?t:"string"==typeof t&&(t=pt.trim(t),t&&mt.test(t.replace(bt,"@").replace(xt,"]").replace(vt,"")))?new Function("return "+t)():void pt.error("Invalid JSON: "+t)},parseXML:function(t){var r,o;if(!t||"string"!=typeof t)return null;try{e.DOMParser?(o=new DOMParser,r=o.parseFromString(t,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(t))}catch(i){r=n}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||pt.error("Invalid XML: "+t),r},noop:function(){},globalEval:function(t){t&&pt.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(wt,"ms-").replace(Tt,Ct)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var o,i=0,s=e.length,a=r(e);if(n){if(a)for(;s>i&&(o=t.apply(e[i],n),o!==!1);i++);else for(i in e)if(o=t.apply(e[i],n),o===!1)break}else if(a)for(;s>i&&(o=t.call(e[i],i,e[i]),o!==!1);i++);else for(i in e)if(o=t.call(e[i],i,e[i]),o===!1)break;return e},trim:ct&&!ct.call(" ")?function(e){return null==e?"":ct.call(e)}:function(e){return null==e?"":(e+"").replace(ht,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(r(Object(e))?pt.merge(n,"string"==typeof e?[e]:e):it.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(at)return at.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,t){var r=t.length,o=e.length,i=0;if("number"==typeof r)for(;r>i;i++)e[o++]=t[i];else for(;t[i]!==n;)e[o++]=t[i++];return e.length=o,e},grep:function(e,t,n){var r,o=[],i=0,s=e.length;for(n=!!n;s>i;i++)r=!!t(e[i],i),n!==r&&o.push(e[i]);return o},map:function(e,t,n){var o,i=0,s=e.length,a=r(e),u=[];if(a)for(;s>i;i++)o=t(e[i],i,n),null!=o&&(u[u.length]=o);else for(i in e)o=t(e[i],i,n),null!=o&&(u[u.length]=o);return ot.apply([],u)},guid:1,proxy:function(e,t){var r,o,i;return"string"==typeof t&&(i=e[t],t=e,e=i),pt.isFunction(e)?(r=st.call(arguments,2),o=function(){return e.apply(t||this,r.concat(st.call(arguments)))},o.guid=e.guid=e.guid||pt.guid++,o):n},access:function(e,t,r,o,i,s,a){var u=0,l=e.length,c=null==r;if("object"===pt.type(r)){i=!0;for(u in r)pt.access(e,t,u,r[u],!0,s,a)}else if(o!==n&&(i=!0,pt.isFunction(o)||(a=!0),c&&(a?(t.call(e,o),t=null):(c=t,t=function(e,t,n){return c.call(pt(e),n)})),t))for(;l>u;u++)t(e[u],r,a?o:o.call(e[u],u,t(e[u],r)));return i?e:c?t.call(e):l?t(e[0],r):s},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var o,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];o=n.apply(e,r||[]);for(i in t)e.style[i]=s[i];return o}}),pt.ready.promise=function(t){if(!K)if(K=pt.Deferred(),"complete"===Q.readyState)setTimeout(pt.ready);else if(Q.addEventListener)Q.addEventListener("DOMContentLoaded",kt,!1),e.addEventListener("load",kt,!1);else{Q.attachEvent("onreadystatechange",kt),e.attachEvent("onload",kt);var n=!1;try{n=null==e.frameElement&&Q.documentElement}catch(r){}n&&n.doScroll&&!function o(){if(!pt.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}St(),pt.ready()}}()}return K.promise(t)},pt.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){tt["[object "+t+"]"]=t.toLowerCase()}),G=pt(Q),function(e,t){function n(e,t,n,r){var o,i,s,a,u,l,c,p,h,y;if((t?t.ownerDocument||t:R)!==A&&q(t),t=t||A,n=n||[],!e||"string"!=typeof e)return n;if(1!==(a=t.nodeType)&&9!==a)return[];if(L&&!r){if(o=bt.exec(e))if(s=o[1]){if(9===a){if(i=t.getElementById(s),!i||!i.parentNode)return n;if(i.id===s)return n.push(i),n}else if(t.ownerDocument&&(i=t.ownerDocument.getElementById(s))&&B(t,i)&&i.id===s)return n.push(i),n}else{if(o[2])return et.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&C.getElementsByClassName&&t.getElementsByClassName)return et.apply(n,t.getElementsByClassName(s)),n}if(C.qsa&&(!H||!H.test(e))){if(p=c=F,h=t,y=9===a&&e,1===a&&"object"!==t.nodeName.toLowerCase()){for(l=f(e),(c=t.getAttribute("id"))?p=c.replace(Tt,"\\$&"):t.setAttribute("id",p),p="[id='"+p+"'] ",u=l.length;u--;)l[u]=p+d(l[u]);h=dt.test(e)&&t.parentNode||t,y=l.join(",")}if(y)try{return et.apply(n,h.querySelectorAll(y)),n}catch(g){}finally{c||t.removeAttribute("id")}}}return w(e.replace(lt,"$1"),t,n,r)}function r(){function e(n,r){return t.push(n+=" ")>S.cacheLength&&delete e[t.shift()],e[n]=r}var t=[];return e}function o(e){return e[F]=!0,e}function i(e){var t=A.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function s(e,t){for(var n=e.split("|"),r=e.length;r--;)S.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||V)-(~e.sourceIndex||V);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function u(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function l(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function c(e){return o(function(t){return t=+t,o(function(n,r){for(var o,i=e([],n.length,t),s=i.length;s--;)n[o=i[s]]&&(n[o]=!(r[o]=n[o]))})})}function p(){}function f(e,t){var r,o,i,s,a,u,l,c=z[e+" "];if(c)return t?0:c.slice(0);for(a=e,u=[],l=S.preFilter;a;){(!r||(o=ct.exec(a)))&&(o&&(a=a.slice(o[0].length)||a),u.push(i=[])),r=!1,(o=ft.exec(a))&&(r=o.shift(),i.push({value:r,type:o[0].replace(lt," ")}),a=a.slice(r.length));for(s in S.filter)!(o=mt[s].exec(a))||l[s]&&!(o=l[s](o))||(r=o.shift(),i.push({value:r,type:s,matches:o}),a=a.slice(r.length));if(!r)break}return t?a.length:a?n.error(e):z(e,u).slice(0)}function d(e){for(var t=0,n=e.length,r="";n>t;t++)r+=e[t].value;return r}function h(e,t,n){var r=t.dir,o=n&&"parentNode"===r,i=U++;return t.first?function(t,n,i){for(;t=t[r];)if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var a,u,l,c=I+" "+i;if(s){for(;t=t[r];)if((1===t.nodeType||o)&&e(t,n,s))return!0}else for(;t=t[r];)if(1===t.nodeType||o)if(l=t[F]||(t[F]={}),(u=l[r])&&u[0]===c){if((a=u[1])===!0||a===k)return a===!0}else if(u=l[r]=[c],u[1]=e(t,n,s)||k,u[1]===!0)return!0}}function y(e){return e.length>1?function(t,n,r){for(var o=e.length;o--;)if(!e[o](t,n,r))return!1;return!0}:e[0]}function g(e,t,n,r,o){for(var i,s=[],a=0,u=e.length,l=null!=t;u>a;a++)(i=e[a])&&(!n||n(i,r,o))&&(s.push(i),l&&t.push(a));return s}function m(e,t,n,r,i,s){return r&&!r[F]&&(r=m(r)),i&&!i[F]&&(i=m(i,s)),o(function(o,s,a,u){var l,c,p,f=[],d=[],h=s.length,y=o||x(t||"*",a.nodeType?[a]:a,[]),m=!e||!o&&t?y:g(y,f,e,a,u),v=n?i||(o?e:h||r)?[]:s:m;if(n&&n(m,v,a,u),r)for(l=g(v,d),r(l,[],a,u),c=l.length;c--;)(p=l[c])&&(v[d[c]]=!(m[d[c]]=p));if(o){if(i||e){if(i){for(l=[],c=v.length;c--;)(p=v[c])&&l.push(m[c]=p);i(null,v=[],l,u)}for(c=v.length;c--;)(p=v[c])&&(l=i?nt.call(o,p):f[c])>-1&&(o[l]=!(s[l]=p))}}else v=g(v===s?v.splice(h,v.length):v),i?i(null,s,v,u):et.apply(s,v)})}function v(e){for(var t,n,r,o=e.length,i=S.relative[e[0].type],s=i||S.relative[" "],a=i?1:0,u=h(function(e){return e===t},s,!0),l=h(function(e){return nt.call(t,e)>-1},s,!0),c=[function(e,n,r){return!i&&(r||n!==_)||((t=n).nodeType?u(e,n,r):l(e,n,r))}];o>a;a++)if(n=S.relative[e[a].type])c=[h(y(c),n)];else{if(n=S.filter[e[a].type].apply(null,e[a].matches),n[F]){for(r=++a;o>r&&!S.relative[e[r].type];r++);return m(a>1&&y(c),a>1&&d(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(lt,"$1"),n,r>a&&v(e.slice(a,r)),o>r&&v(e=e.slice(r)),o>r&&d(e))}c.push(n)}return y(c)}function b(e,t){var r=0,i=t.length>0,s=e.length>0,a=function(o,a,u,l,c){var p,f,d,h=[],y=0,m="0",v=o&&[],b=null!=c,x=_,w=o||s&&S.find.TAG("*",c&&a.parentNode||a),T=I+=null==x?1:Math.random()||.1;for(b&&(_=a!==A&&a,k=r);null!=(p=w[m]);m++){if(s&&p){for(f=0;d=e[f++];)if(d(p,a,u)){l.push(p);break}b&&(I=T,k=++r)}i&&((p=!d&&p)&&y--,o&&v.push(p))}if(y+=m,i&&m!==y){for(f=0;d=t[f++];)d(v,h,a,u);if(o){if(y>0)for(;m--;)v[m]||h[m]||(h[m]=Y.call(l));h=g(h)}et.apply(l,h),b&&!o&&h.length>0&&y+t.length>1&&n.uniqueSort(l)}return b&&(I=T,_=x),v};return i?o(a):a}function x(e,t,r){for(var o=0,i=t.length;i>o;o++)n(e,t[o],r);return r}function w(e,t,n,r){var o,i,s,a,u,l=f(e);if(!r&&1===l.length){if(i=l[0]=l[0].slice(0),i.length>2&&"ID"===(s=i[0]).type&&C.getById&&9===t.nodeType&&L&&S.relative[i[1].type]){if(t=(S.find.ID(s.matches[0].replace(Ct,kt),t)||[])[0],!t)return n;e=e.slice(i.shift().value.length)}for(o=mt.needsContext.test(e)?0:i.length;o--&&(s=i[o],!S.relative[a=s.type]);)if((u=S.find[a])&&(r=u(s.matches[0].replace(Ct,kt),dt.test(i[0].type)&&t.parentNode||t))){if(i.splice(o,1),e=r.length&&d(i),!e)return et.apply(n,r),n;break}}return j(e,l)(r,t,!L,n,dt.test(e)),n}var T,C,k,S,E,N,j,_,D,q,A,P,L,H,M,O,B,F="sizzle"+-new Date,R=e.document,I=0,U=0,W=r(),z=r(),$=r(),X=!1,K=function(e,t){return e===t?(X=!0,0):0},G=typeof t,V=1<<31,J={}.hasOwnProperty,Q=[],Y=Q.pop,Z=Q.push,et=Q.push,tt=Q.slice,nt=Q.indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(this[t]===e)return t;return-1},rt="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ot="[\\x20\\t\\r\\n\\f]",it="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",st=it.replace("w","w#"),at="\\["+ot+"*("+it+")"+ot+"*(?:([*^$|!~]?=)"+ot+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+st+")|)|)"+ot+"*\\]",ut=":("+it+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+at.replace(3,8)+")*)|.*)\\)|)",lt=new RegExp("^"+ot+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ot+"+$","g"),ct=new RegExp("^"+ot+"*,"+ot+"*"),ft=new RegExp("^"+ot+"*([>+~]|"+ot+")"+ot+"*"),dt=new RegExp(ot+"*[+~]"),ht=new RegExp("="+ot+"*([^\\]'\"]*)"+ot+"*\\]","g"),yt=new RegExp(ut),gt=new RegExp("^"+st+"$"),mt={ID:new RegExp("^#("+it+")"),CLASS:new RegExp("^\\.("+it+")"),TAG:new RegExp("^("+it.replace("w","w*")+")"),ATTR:new RegExp("^"+at),PSEUDO:new RegExp("^"+ut),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ot+"*(even|odd|(([+-]|)(\\d*)n|)"+ot+"*(?:([+-]|)"+ot+"*(\\d+)|))"+ot+"*\\)|)","i"),bool:new RegExp("^(?:"+rt+")$","i"),needsContext:new RegExp("^"+ot+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ot+"*((?:-\\d)?\\d*)"+ot+"*\\)|)(?=[^-]|$)","i")},vt=/^[^{]+\{\s*\[native \w/,bt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,xt=/^(?:input|select|textarea|button)$/i,wt=/^h\d$/i,Tt=/'|\\/g,Ct=new RegExp("\\\\([\\da-f]{1,6}"+ot+"?|("+ot+")|.)","ig"),kt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)};try{et.apply(Q=tt.call(R.childNodes),R.childNodes),Q[R.childNodes.length].nodeType}catch(St){et={apply:Q.length?function(e,t){Z.apply(e,tt.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}N=n.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},C=n.support={},q=n.setDocument=function(e){var t=e?e.ownerDocument||e:R,n=t.defaultView;return t!==A&&9===t.nodeType&&t.documentElement?(A=t,P=t.documentElement,L=!N(t),n&&n.attachEvent&&n!==n.top&&n.attachEvent("onbeforeunload",function(){q()}),C.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),C.getElementsByTagName=i(function(e){return e.appendChild(t.createComment("")),!e.getElementsByTagName("*").length}),C.getElementsByClassName=i(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),C.getById=i(function(e){return P.appendChild(e).id=F,!t.getElementsByName||!t.getElementsByName(F).length}),C.getById?(S.find.ID=function(e,t){if(typeof t.getElementById!==G&&L){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},S.filter.ID=function(e){var t=e.replace(Ct,kt);return function(e){return e.getAttribute("id")===t}}):(delete S.find.ID,S.filter.ID=function(e){var t=e.replace(Ct,kt);return function(e){var n=typeof e.getAttributeNode!==G&&e.getAttributeNode("id");return n&&n.value===t}}),S.find.TAG=C.getElementsByTagName?function(e,t){return typeof t.getElementsByTagName!==G?t.getElementsByTagName(e):void 0}:function(e,t){var n,r=[],o=0,i=t.getElementsByTagName(e);if("*"===e){for(;n=i[o++];)1===n.nodeType&&r.push(n);return r}return i},S.find.CLASS=C.getElementsByClassName&&function(e,t){return typeof t.getElementsByClassName!==G&&L?t.getElementsByClassName(e):void 0},M=[],H=[],(C.qsa=vt.test(t.querySelectorAll))&&(i(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||H.push("\\["+ot+"*(?:value|"+rt+")"),e.querySelectorAll(":checked").length||H.push(":checked")}),i(function(e){var n=t.createElement("input");n.setAttribute("type","hidden"),e.appendChild(n).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&H.push("[*^$]="+ot+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||H.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),H.push(",.*:")})),(C.matchesSelector=vt.test(O=P.webkitMatchesSelector||P.mozMatchesSelector||P.oMatchesSelector||P.msMatchesSelector))&&i(function(e){C.disconnectedMatch=O.call(e,"div"),O.call(e,"[s!='']:x"),M.push("!=",ut)}),H=H.length&&new RegExp(H.join("|")),M=M.length&&new RegExp(M.join("|")),B=vt.test(P.contains)||P.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)for(;t=t.parentNode;)if(t===e)return!0;return!1},K=P.compareDocumentPosition?function(e,n){if(e===n)return X=!0,0;var r=n.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(n);return r?1&r||!C.sortDetached&&n.compareDocumentPosition(e)===r?e===t||B(R,e)?-1:n===t||B(R,n)?1:D?nt.call(D,e)-nt.call(D,n):0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,n){var r,o=0,i=e.parentNode,s=n.parentNode,u=[e],l=[n];if(e===n)return X=!0,0;if(!i||!s)return e===t?-1:n===t?1:i?-1:s?1:D?nt.call(D,e)-nt.call(D,n):0;if(i===s)return a(e,n);for(r=e;r=r.parentNode;)u.unshift(r);for(r=n;r=r.parentNode;)l.unshift(r);for(;u[o]===l[o];)o++;return o?a(u[o],l[o]):u[o]===R?-1:l[o]===R?1:0},t):A},n.matches=function(e,t){return n(e,null,null,t)},n.matchesSelector=function(e,t){if((e.ownerDocument||e)!==A&&q(e),t=t.replace(ht,"='$1']"),!(!C.matchesSelector||!L||M&&M.test(t)||H&&H.test(t)))try{var r=O.call(e,t);if(r||C.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(o){}return n(t,A,null,[e]).length>0},n.contains=function(e,t){return(e.ownerDocument||e)!==A&&q(e),B(e,t)},n.attr=function(e,n){(e.ownerDocument||e)!==A&&q(e);var r=S.attrHandle[n.toLowerCase()],o=r&&J.call(S.attrHandle,n.toLowerCase())?r(e,n,!L):t;return o===t?C.attributes||!L?e.getAttribute(n):(o=e.getAttributeNode(n))&&o.specified?o.value:null:o},n.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},n.uniqueSort=function(e){var t,n=[],r=0,o=0;if(X=!C.detectDuplicates,D=!C.sortStable&&e.slice(0),e.sort(K),X){for(;t=e[o++];)t===e[o]&&(r=n.push(o));for(;r--;)e.splice(n[r],1)}return e},E=n.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=E(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r];r++)n+=E(t);return n},S=n.selectors={cacheLength:50,createPseudo:o,match:mt,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(Ct,kt),e[3]=(e[4]||e[5]||"").replace(Ct,kt),"~="===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]||n.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]&&n.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return mt.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&yt.test(r)&&(n=f(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(Ct,kt).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=W[e+" "];return t||(t=new RegExp("(^|"+ot+")"+e+"("+ot+"|$)"))&&W(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==G&&e.getAttribute("class")||"")})},ATTR:function(e,t,r){return function(o){var i=n.attr(o,e);return null==i?"!="===t:t?(i+="","="===t?i===r:"!="===t?i!==r:"^="===t?r&&0===i.indexOf(r):"*="===t?r&&i.indexOf(r)>-1:"$="===t?r&&i.slice(-r.length)===r:"~="===t?(" "+i+" ").indexOf(r)>-1:"|="===t?i===r||i.slice(0,r.length+1)===r+"-":!1):!0}},CHILD:function(e,t,n,r,o){var i="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===o?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,y=i!==s?"nextSibling":"previousSibling",g=t.parentNode,m=a&&t.nodeName.toLowerCase(),v=!u&&!a;if(g){if(i){for(;y;){for(p=t;p=p[y];)if(a?p.nodeName.toLowerCase()===m:1===p.nodeType)return!1;h=y="only"===e&&!h&&"nextSibling"}return!0}if(h=[s?g.firstChild:g.lastChild],s&&v){for(c=g[F]||(g[F]={}),l=c[e]||[],d=l[0]===I&&l[1],f=l[0]===I&&l[2],p=d&&g.childNodes[d];p=++d&&p&&p[y]||(f=d=0)||h.pop();)if(1===p.nodeType&&++f&&p===t){c[e]=[I,d,f];break}}else if(v&&(l=(t[F]||(t[F]={}))[e])&&l[0]===I)f=l[1];else for(;(p=++d&&p&&p[y]||(f=d=0)||h.pop())&&((a?p.nodeName.toLowerCase()!==m:1!==p.nodeType)||!++f||(v&&((p[F]||(p[F]={}))[e]=[I,f]),p!==t)););return f-=o,f===r||f%r===0&&f/r>=0}}},PSEUDO:function(e,t){var r,i=S.pseudos[e]||S.setFilters[e.toLowerCase()]||n.error("unsupported pseudo: "+e);return i[F]?i(t):i.length>1?(r=[e,e,"",t],S.setFilters.hasOwnProperty(e.toLowerCase())?o(function(e,n){for(var r,o=i(e,t),s=o.length;s--;)r=nt.call(e,o[s]),e[r]=!(n[r]=o[s])}):function(e){return i(e,0,r)}):i}},pseudos:{not:o(function(e){var t=[],n=[],r=j(e.replace(lt,"$1"));return r[F]?o(function(e,t,n,o){for(var i,s=r(e,null,o,[]),a=e.length;a--;)(i=s[a])&&(e[a]=!(t[a]=i))}):function(e,o,i){return t[0]=e,r(t,null,i,n),!n.pop()}}),has:o(function(e){return function(t){return n(e,t).length>0}}),contains:o(function(e){return function(t){return(t.textContent||t.innerText||E(t)).indexOf(e)>-1}}),lang:o(function(e){return gt.test(e||"")||n.error("unsupported lang: "+e),e=e.replace(Ct,kt).toLowerCase(),function(t){var n;do if(n=L?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===P},focus:function(e){return e===A.activeElement&&(!A.hasFocus||A.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!S.pseudos.empty(e)},header:function(e){return wt.test(e.nodeName)},input:function(e){return xt.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:c(function(){return[0]}),last:c(function(e,t){return[t-1]}),eq:c(function(e,t,n){return[0>n?n+t:n]}),even:c(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:c(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:c(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r);return e}),gt:c(function(e,t,n){for(var r=0>n?n+t:n;++r<t;)e.push(r);return e})}},S.pseudos.nth=S.pseudos.eq;for(T in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})S.pseudos[T]=u(T);for(T in{submit:!0,reset:!0})S.pseudos[T]=l(T);p.prototype=S.filters=S.pseudos,S.setFilters=new p,j=n.compile=function(e,t){var n,r=[],o=[],i=$[e+" "];if(!i){for(t||(t=f(e)),n=t.length;n--;)i=v(t[n]),i[F]?r.push(i):o.push(i);i=$(e,b(o,r))}return i},C.sortStable=F.split("").sort(K).join("")===F,C.detectDuplicates=X,q(),C.sortDetached=i(function(e){return 1&e.compareDocumentPosition(A.createElement("div"))}),i(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||s("type|href|height|width",function(e,t,n){return n?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),C.attributes&&i(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||s("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||s(rt,function(e,t,n){var r;return n?void 0:(r=e.getAttributeNode(t))&&r.specified?r.value:e[t]===!0?t.toLowerCase():null}),pt.find=n,pt.expr=n.selectors,pt.expr[":"]=pt.expr.pseudos,pt.unique=n.uniqueSort,pt.text=n.getText,pt.isXMLDoc=n.isXML,pt.contains=n.contains}(e);var Et={};pt.Callbacks=function(e){e="string"==typeof e?Et[e]||o(e):pt.extend({},e);var t,r,i,s,a,u,l=[],c=!e.once&&[],p=function(n){for(r=e.memory&&n,i=!0,a=u||0,u=0,s=l.length,t=!0;l&&s>a;a++)if(l[a].apply(n[0],n[1])===!1&&e.stopOnFalse){r=!1;break}t=!1,l&&(c?c.length&&p(c.shift()):r?l=[]:f.disable())},f={add:function(){if(l){var n=l.length;!function o(t){pt.each(t,function(t,n){var r=pt.type(n);"function"===r?e.unique&&f.has(n)||l.push(n):n&&n.length&&"string"!==r&&o(n)})}(arguments),t?s=l.length:r&&(u=n,p(r))}return this},remove:function(){return l&&pt.each(arguments,function(e,n){for(var r;(r=pt.inArray(n,l,r))>-1;)l.splice(r,1),t&&(s>=r&&s--,a>=r&&a--)}),this},has:function(e){return e?pt.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],s=0,this},disable:function(){return l=c=r=n,this},disabled:function(){return!l},lock:function(){return c=n,r||f.disable(),this},locked:function(){return!c},fireWith:function(e,n){return!l||i&&!c||(n=n||[],n=[e,n.slice?n.slice():n],t?c.push(n):p(n)),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!i}};return f},pt.extend({Deferred:function(e){var t=[["resolve","done",pt.Callbacks("once memory"),"resolved"],["reject","fail",pt.Callbacks("once memory"),"rejected"],["notify","progress",pt.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var e=arguments;return pt.Deferred(function(n){pt.each(t,function(t,i){var s=i[0],a=pt.isFunction(e[t])&&e[t];o[i[1]](function(){var e=a&&a.apply(this,arguments);e&&pt.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?pt.extend(e,r):r}},o={};return r.pipe=r.then,pt.each(t,function(e,i){var s=i[2],a=i[3];r[i[1]]=s.add,a&&s.add(function(){n=a},t[1^e][2].disable,t[2][2].lock),o[i[0]]=function(){return o[i[0]+"With"](this===o?r:this,arguments),this},o[i[0]+"With"]=s.fireWith}),r.promise(o),e&&e.call(o,o),o},when:function(e){var t,n,r,o=0,i=st.call(arguments),s=i.length,a=1!==s||e&&pt.isFunction(e.promise)?s:0,u=1===a?e:pt.Deferred(),l=function(e,n,r){return function(o){n[e]=this,r[e]=arguments.length>1?st.call(arguments):o,r===t?u.notifyWith(n,r):--a||u.resolveWith(n,r)}};if(s>1)for(t=new Array(s),n=new Array(s),r=new Array(s);s>o;o++)i[o]&&pt.isFunction(i[o].promise)?i[o].promise().done(l(o,r,i)).fail(u.reject).progress(l(o,n,t)):--a;return a||u.resolveWith(r,i),u.promise()}}),pt.support=function(t){var n,r,o,i,s,a,u,l,c,p=Q.createElement("div");if(p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*")||[],r=p.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;i=Q.createElement("select"),a=i.appendChild(Q.createElement("option")),o=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==p.className,t.leadingWhitespace=3===p.firstChild.nodeType,t.tbody=!p.getElementsByTagName("tbody").length,t.htmlSerialize=!!p.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=a.selected,t.enctype=!!Q.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==Q.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,i.disabled=!0,t.optDisabled=!a.disabled;try{delete p.test}catch(f){t.deleteExpando=!1}o=Q.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"),s=Q.createDocumentFragment(),s.appendChild(o),t.appendChecked=o.checked,t.checkClone=s.cloneNode(!0).cloneNode(!0).lastChild.checked,p.attachEvent&&(p.attachEvent("onclick",function(){t.noCloneEvent=!1}),p.cloneNode(!0).click());for(c in{submit:!0,change:!0,focusin:!0})p.setAttribute(u="on"+c,"t"),t[c+"Bubbles"]=u in e||p.attributes[u].expando===!1;p.style.backgroundClip="content-box",p.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===p.style.backgroundClip;for(c in pt(t))break;return t.ownLast="0"!==c,pt(function(){var n,r,o,i="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",s=Q.getElementsByTagName("body")[0];s&&(n=Q.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",s.appendChild(n).appendChild(p),p.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=p.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",l=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=l&&0===o[0].offsetHeight,p.innerHTML="",p.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%;",pt.swap(s,null!=s.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===p.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(p,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(p,null)||{width:"4px"}).width,r=p.appendChild(Q.createElement("div")),r.style.cssText=p.style.cssText=i,r.style.marginRight=r.style.width="0",p.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof p.style.zoom!==V&&(p.innerHTML="",p.style.cssText=i+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===p.offsetWidth,p.style.display="block",p.innerHTML="<div></div>",p.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==p.offsetWidth,t.inlineBlockNeedsLayout&&(s.style.zoom=1)),s.removeChild(n),n=p=o=r=null)}),n=i=s=a=r=o=null,t}({});var Nt=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,jt=/([A-Z])/g;pt.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?pt.cache[e[pt.expando]]:e[pt.expando],!!e&&!u(e)},data:function(e,t,n){return i(e,t,n)},removeData:function(e,t){return s(e,t)},_data:function(e,t,n){return i(e,t,n,!0)},_removeData:function(e,t){return s(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&pt.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),pt.fn.extend({data:function(e,t){var r,o,i=null,s=0,u=this[0];if(e===n){if(this.length&&(i=pt.data(u),1===u.nodeType&&!pt._data(u,"parsedAttrs"))){for(r=u.attributes;s<r.length;s++)o=r[s].name,0===o.indexOf("data-")&&(o=pt.camelCase(o.slice(5)),a(u,o,i[o]));pt._data(u,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){pt.data(this,e)}):arguments.length>1?this.each(function(){pt.data(this,e,t)}):u?a(u,e,pt.data(u,e)):null},removeData:function(e){return this.each(function(){pt.removeData(this,e)})}}),pt.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=pt._data(e,t),n&&(!r||pt.isArray(n)?r=pt._data(e,t,pt.makeArray(n)):r.push(n)),r||[]):void 0},dequeue:function(e,t){t=t||"fx";var n=pt.queue(e,t),r=n.length,o=n.shift(),i=pt._queueHooks(e,t),s=function(){pt.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,s,i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return pt._data(e,n)||pt._data(e,n,{empty:pt.Callbacks("once memory").add(function(){pt._removeData(e,t+"queue"),pt._removeData(e,n)})})}}),pt.fn.extend({queue:function(e,t){var r=2;return"string"!=typeof e&&(t=e,e="fx",r--),arguments.length<r?pt.queue(this[0],e):t===n?this:this.each(function(){var n=pt.queue(this,e,t);pt._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&pt.dequeue(this,e)})},dequeue:function(e){return this.each(function(){pt.dequeue(this,e) })},delay:function(e,t){return e=pt.fx?pt.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,t){var r,o=1,i=pt.Deferred(),s=this,a=this.length,u=function(){--o||i.resolveWith(s,[s])};for("string"!=typeof e&&(t=e,e=n),e=e||"fx";a--;)r=pt._data(s[a],e+"queueHooks"),r&&r.empty&&(o++,r.empty.add(u));return u(),i.promise(t)}});var _t,Dt,qt=/[\t\r\n\f]/g,At=/\r/g,Pt=/^(?:input|select|textarea|button|object)$/i,Lt=/^(?:a|area)$/i,Ht=/^(?:checked|selected)$/i,Mt=pt.support.getSetAttribute,Ot=pt.support.input;pt.fn.extend({attr:function(e,t){return pt.access(this,pt.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){pt.removeAttr(this,e)})},prop:function(e,t){return pt.access(this,pt.prop,e,t,arguments.length>1)},removeProp:function(e){return e=pt.propFix[e]||e,this.each(function(){try{this[e]=n,delete this[e]}catch(t){}})},addClass:function(e){var t,n,r,o,i,s=0,a=this.length,u="string"==typeof e&&e;if(pt.isFunction(e))return this.each(function(t){pt(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(dt)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(qt," "):" ")){for(i=0;o=t[i++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");n.className=pt.trim(r)}return this},removeClass:function(e){var t,n,r,o,i,s=0,a=this.length,u=0===arguments.length||"string"==typeof e&&e;if(pt.isFunction(e))return this.each(function(t){pt(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(dt)||[];a>s;s++)if(n=this[s],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(qt," "):"")){for(i=0;o=t[i++];)for(;r.indexOf(" "+o+" ")>=0;)r=r.replace(" "+o+" "," ");n.className=e?pt.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):this.each(pt.isFunction(e)?function(n){pt(this).toggleClass(e.call(this,n,this.className,t),t)}:function(){if("string"===n)for(var t,r=0,o=pt(this),i=e.match(dt)||[];t=i[r++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else(n===V||"boolean"===n)&&(this.className&&pt._data(this,"__className__",this.className),this.className=this.className||e===!1?"":pt._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,r=this.length;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(qt," ").indexOf(t)>=0)return!0;return!1},val:function(e){var t,r,o,i=this[0];{if(arguments.length)return o=pt.isFunction(e),this.each(function(t){var i;1===this.nodeType&&(i=o?e.call(this,t,pt(this).val()):e,null==i?i="":"number"==typeof i?i+="":pt.isArray(i)&&(i=pt.map(i,function(e){return null==e?"":e+""})),r=pt.valHooks[this.type]||pt.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,i,"value")!==n||(this.value=i))});if(i)return r=pt.valHooks[i.type]||pt.valHooks[i.nodeName.toLowerCase()],r&&"get"in r&&(t=r.get(i,"value"))!==n?t:(t=i.value,"string"==typeof t?t.replace(At,""):null==t?"":t)}}}),pt.extend({valHooks:{option:{get:function(e){var t=pt.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){for(var t,n,r=e.options,o=e.selectedIndex,i="select-one"===e.type||0>o,s=i?null:[],a=i?o+1:r.length,u=0>o?a:i?o:0;a>u;u++)if(n=r[u],!(!n.selected&&u!==o||(pt.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&pt.nodeName(n.parentNode,"optgroup"))){if(t=pt(n).val(),i)return t;s.push(t)}return s},set:function(e,t){for(var n,r,o=e.options,i=pt.makeArray(t),s=o.length;s--;)r=o[s],(r.selected=pt.inArray(pt(r).val(),i)>=0)&&(n=!0);return n||(e.selectedIndex=-1),i}}},attr:function(e,t,r){var o,i,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===V?pt.prop(e,t,r):(1===s&&pt.isXMLDoc(e)||(t=t.toLowerCase(),o=pt.attrHooks[t]||(pt.expr.match.bool.test(t)?Dt:_t)),r===n?o&&"get"in o&&null!==(i=o.get(e,t))?i:(i=pt.find.attr(e,t),null==i?n:i):null!==r?o&&"set"in o&&(i=o.set(e,r,t))!==n?i:(e.setAttribute(t,r+""),r):void pt.removeAttr(e,t))},removeAttr:function(e,t){var n,r,o=0,i=t&&t.match(dt);if(i&&1===e.nodeType)for(;n=i[o++];)r=pt.propFix[n]||n,pt.expr.match.bool.test(n)?Ot&&Mt||!Ht.test(n)?e[r]=!1:e[pt.camelCase("default-"+n)]=e[r]=!1:pt.attr(e,n,""),e.removeAttribute(Mt?n:r)},attrHooks:{type:{set:function(e,t){if(!pt.support.radioValue&&"radio"===t&&pt.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,t,r){var o,i,s,a=e.nodeType;if(e&&3!==a&&8!==a&&2!==a)return s=1!==a||!pt.isXMLDoc(e),s&&(t=pt.propFix[t]||t,i=pt.propHooks[t]),r!==n?i&&"set"in i&&(o=i.set(e,r,t))!==n?o:e[t]=r:i&&"get"in i&&null!==(o=i.get(e,t))?o:e[t]},propHooks:{tabIndex:{get:function(e){var t=pt.find.attr(e,"tabindex");return t?parseInt(t,10):Pt.test(e.nodeName)||Lt.test(e.nodeName)&&e.href?0:-1}}}}),Dt={set:function(e,t,n){return t===!1?pt.removeAttr(e,n):Ot&&Mt||!Ht.test(n)?e.setAttribute(!Mt&&pt.propFix[n]||n,n):e[pt.camelCase("default-"+n)]=e[n]=!0,n}},pt.each(pt.expr.match.bool.source.match(/\w+/g),function(e,t){var r=pt.expr.attrHandle[t]||pt.find.attr;pt.expr.attrHandle[t]=Ot&&Mt||!Ht.test(t)?function(e,t,o){var i=pt.expr.attrHandle[t],s=o?n:(pt.expr.attrHandle[t]=n)!=r(e,t,o)?t.toLowerCase():null;return pt.expr.attrHandle[t]=i,s}:function(e,t,r){return r?n:e[pt.camelCase("default-"+t)]?t.toLowerCase():null}}),Ot&&Mt||(pt.attrHooks.value={set:function(e,t,n){return pt.nodeName(e,"input")?void(e.defaultValue=t):_t&&_t.set(e,t,n)}}),Mt||(_t={set:function(e,t,r){var o=e.getAttributeNode(r);return o||e.setAttributeNode(o=e.ownerDocument.createAttribute(r)),o.value=t+="","value"===r||t===e.getAttribute(r)?t:n}},pt.expr.attrHandle.id=pt.expr.attrHandle.name=pt.expr.attrHandle.coords=function(e,t,r){var o;return r?n:(o=e.getAttributeNode(t))&&""!==o.value?o.value:null},pt.valHooks.button={get:function(e,t){var r=e.getAttributeNode(t);return r&&r.specified?r.value:n},set:_t.set},pt.attrHooks.contenteditable={set:function(e,t,n){_t.set(e,""===t?!1:t,n)}},pt.each(["width","height"],function(e,t){pt.attrHooks[t]={set:function(e,n){return""===n?(e.setAttribute(t,"auto"),n):void 0}}})),pt.support.hrefNormalized||pt.each(["href","src"],function(e,t){pt.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),pt.support.style||(pt.attrHooks.style={get:function(e){return e.style.cssText||n},set:function(e,t){return e.style.cssText=t+""}}),pt.support.optSelected||(pt.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),pt.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){pt.propFix[this.toLowerCase()]=this}),pt.support.enctype||(pt.propFix.enctype="encoding"),pt.each(["radio","checkbox"],function(){pt.valHooks[this]={set:function(e,t){return pt.isArray(t)?e.checked=pt.inArray(pt(e).val(),t)>=0:void 0}},pt.support.checkOn||(pt.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Bt=/^(?:input|select|textarea)$/i,Ft=/^key/,Rt=/^(?:mouse|contextmenu)|click/,It=/^(?:focusinfocus|focusoutblur)$/,Ut=/^([^.]*)(?:\.(.+)|)$/;pt.event={global:{},add:function(e,t,r,o,i){var s,a,u,l,c,p,f,d,h,y,g,m=pt._data(e);if(m){for(r.handler&&(l=r,r=l.handler,i=l.selector),r.guid||(r.guid=pt.guid++),(a=m.events)||(a=m.events={}),(p=m.handle)||(p=m.handle=function(e){return typeof pt===V||e&&pt.event.triggered===e.type?n:pt.event.dispatch.apply(p.elem,arguments)},p.elem=e),t=(t||"").match(dt)||[""],u=t.length;u--;)s=Ut.exec(t[u])||[],h=g=s[1],y=(s[2]||"").split(".").sort(),h&&(c=pt.event.special[h]||{},h=(i?c.delegateType:c.bindType)||h,c=pt.event.special[h]||{},f=pt.extend({type:h,origType:g,data:o,handler:r,guid:r.guid,selector:i,needsContext:i&&pt.expr.match.needsContext.test(i),namespace:y.join(".")},l),(d=a[h])||(d=a[h]=[],d.delegateCount=0,c.setup&&c.setup.call(e,o,y,p)!==!1||(e.addEventListener?e.addEventListener(h,p,!1):e.attachEvent&&e.attachEvent("on"+h,p))),c.add&&(c.add.call(e,f),f.handler.guid||(f.handler.guid=r.guid)),i?d.splice(d.delegateCount++,0,f):d.push(f),pt.event.global[h]=!0);e=null}},remove:function(e,t,n,r,o){var i,s,a,u,l,c,p,f,d,h,y,g=pt.hasData(e)&&pt._data(e);if(g&&(c=g.events)){for(t=(t||"").match(dt)||[""],l=t.length;l--;)if(a=Ut.exec(t[l])||[],d=y=a[1],h=(a[2]||"").split(".").sort(),d){for(p=pt.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],a=a[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=i=f.length;i--;)s=f[i],!o&&y!==s.origType||n&&n.guid!==s.guid||a&&!a.test(s.namespace)||r&&r!==s.selector&&("**"!==r||!s.selector)||(f.splice(i,1),s.selector&&f.delegateCount--,p.remove&&p.remove.call(e,s));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,g.handle)!==!1||pt.removeEvent(e,d,g.handle),delete c[d])}else for(d in c)pt.event.remove(e,d+t[l],n,r,!0);pt.isEmptyObject(c)&&(delete g.handle,pt._removeData(e,"events"))}},trigger:function(t,r,o,i){var s,a,u,l,c,p,f,d=[o||Q],h=lt.call(t,"type")?t.type:t,y=lt.call(t,"namespace")?t.namespace.split("."):[];if(u=p=o=o||Q,3!==o.nodeType&&8!==o.nodeType&&!It.test(h+pt.event.triggered)&&(h.indexOf(".")>=0&&(y=h.split("."),h=y.shift(),y.sort()),a=h.indexOf(":")<0&&"on"+h,t=t[pt.expando]?t:new pt.Event(h,"object"==typeof t&&t),t.isTrigger=i?2:3,t.namespace=y.join("."),t.namespace_re=t.namespace?new RegExp("(^|\\.)"+y.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=n,t.target||(t.target=o),r=null==r?[t]:pt.makeArray(r,[t]),c=pt.event.special[h]||{},i||!c.trigger||c.trigger.apply(o,r)!==!1)){if(!i&&!c.noBubble&&!pt.isWindow(o)){for(l=c.delegateType||h,It.test(l+h)||(u=u.parentNode);u;u=u.parentNode)d.push(u),p=u;p===(o.ownerDocument||Q)&&d.push(p.defaultView||p.parentWindow||e)}for(f=0;(u=d[f++])&&!t.isPropagationStopped();)t.type=f>1?l:c.bindType||h,s=(pt._data(u,"events")||{})[t.type]&&pt._data(u,"handle"),s&&s.apply(u,r),s=a&&u[a],s&&pt.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&t.preventDefault();if(t.type=h,!i&&!t.isDefaultPrevented()&&(!c._default||c._default.apply(d.pop(),r)===!1)&&pt.acceptData(o)&&a&&o[h]&&!pt.isWindow(o)){p=o[a],p&&(o[a]=null),pt.event.triggered=h;try{o[h]()}catch(g){}pt.event.triggered=n,p&&(o[a]=p)}return t.result}},dispatch:function(e){e=pt.event.fix(e);var t,r,o,i,s,a=[],u=st.call(arguments),l=(pt._data(this,"events")||{})[e.type]||[],c=pt.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){for(a=pt.event.handlers.call(this,e,l),t=0;(i=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=i.elem,s=0;(o=i.handlers[s++])&&!e.isImmediatePropagationStopped();)(!e.namespace_re||e.namespace_re.test(o.namespace))&&(e.handleObj=o,e.data=o.data,r=((pt.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,u),r!==n&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,t){var r,o,i,s,a=[],u=t.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(i=[],s=0;u>s;s++)o=t[s],r=o.selector+" ",i[r]===n&&(i[r]=o.needsContext?pt(r,this).index(l)>=0:pt.find(r,this,null,[l]).length),i[r]&&i.push(o);i.length&&a.push({elem:l,handlers:i})}return u<t.length&&a.push({elem:this,handlers:t.slice(u)}),a},fix:function(e){if(e[pt.expando])return e;var t,n,r,o=e.type,i=e,s=this.fixHooks[o];for(s||(this.fixHooks[o]=s=Rt.test(o)?this.mouseHooks:Ft.test(o)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new pt.Event(i),t=r.length;t--;)n=r[t],e[n]=i[n];return e.target||(e.target=i.srcElement||Q),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,i):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,t){var r,o,i,s=t.button,a=t.fromElement;return null==e.pageX&&null!=t.clientX&&(o=e.target.ownerDocument||Q,i=o.documentElement,r=o.body,e.pageX=t.clientX+(i&&i.scrollLeft||r&&r.scrollLeft||0)-(i&&i.clientLeft||r&&r.clientLeft||0),e.pageY=t.clientY+(i&&i.scrollTop||r&&r.scrollTop||0)-(i&&i.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?t.toElement:a),e.which||s===n||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==p()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===p()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return pt.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(e){return pt.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==n&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var o=pt.extend(new pt.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?pt.event.trigger(o,null,t):pt.event.dispatch.call(t,o),o.isDefaultPrevented()&&n.preventDefault()}},pt.removeEvent=Q.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]===V&&(e[r]=null),e.detachEvent(r,n))},pt.Event=function(e,t){return this instanceof pt.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?l:c):this.type=e,t&&pt.extend(this,t),this.timeStamp=e&&e.timeStamp||pt.now(),void(this[pt.expando]=!0)):new pt.Event(e,t)},pt.Event.prototype={isDefaultPrevented:c,isPropagationStopped:c,isImmediatePropagationStopped:c,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=l,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=l,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=l,this.stopPropagation()}},pt.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){pt.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,o=e.relatedTarget,i=e.handleObj;return(!o||o!==r&&!pt.contains(r,o))&&(e.type=i.origType,n=i.handler.apply(this,arguments),e.type=t),n}}}),pt.support.submitBubbles||(pt.event.special.submit={setup:function(){return pt.nodeName(this,"form")?!1:void pt.event.add(this,"click._submit keypress._submit",function(e){var t=e.target,r=pt.nodeName(t,"input")||pt.nodeName(t,"button")?t.form:n;r&&!pt._data(r,"submitBubbles")&&(pt.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),pt._data(r,"submitBubbles",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&pt.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return pt.nodeName(this,"form")?!1:void pt.event.remove(this,"._submit")}}),pt.support.changeBubbles||(pt.event.special.change={setup:function(){return Bt.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(pt.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),pt.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),pt.event.simulate("change",this,e,!0)})),!1):void pt.event.add(this,"beforeactivate._change",function(e){var t=e.target;Bt.test(t.nodeName)&&!pt._data(t,"changeBubbles")&&(pt.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||pt.event.simulate("change",this.parentNode,e,!0)}),pt._data(t,"changeBubbles",!0))})},handle:function(e){var t=e.target;return this!==t||e.isSimulated||e.isTrigger||"radio"!==t.type&&"checkbox"!==t.type?e.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return pt.event.remove(this,"._change"),!Bt.test(this.nodeName)}}),pt.support.focusinBubbles||pt.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){pt.event.simulate(t,e.target,pt.event.fix(e),!0)};pt.event.special[t]={setup:function(){0===n++&&Q.addEventListener(e,r,!0)},teardown:function(){0===--n&&Q.removeEventListener(e,r,!0)}}}),pt.fn.extend({on:function(e,t,r,o,i){var s,a;if("object"==typeof e){"string"!=typeof t&&(r=r||t,t=n);for(s in e)this.on(s,t,r,e[s],i);return this}if(null==r&&null==o?(o=t,r=t=n):null==o&&("string"==typeof t?(o=r,r=n):(o=r,r=t,t=n)),o===!1)o=c;else if(!o)return this;return 1===i&&(a=o,o=function(e){return pt().off(e),a.apply(this,arguments)},o.guid=a.guid||(a.guid=pt.guid++)),this.each(function(){pt.event.add(this,e,o,r,t)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,t,r){var o,i;if(e&&e.preventDefault&&e.handleObj)return o=e.handleObj,pt(e.delegateTarget).off(o.namespace?o.origType+"."+o.namespace:o.origType,o.selector,o.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return(t===!1||"function"==typeof t)&&(r=t,t=n),r===!1&&(r=c),this.each(function(){pt.event.remove(this,e,r,t)})},trigger:function(e,t){return this.each(function(){pt.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?pt.event.trigger(e,t,n,!0):void 0}});var Wt=/^.[^:#\[\.,]*$/,zt=/^(?:parents|prev(?:Until|All))/,$t=pt.expr.match.needsContext,Xt={children:!0,contents:!0,next:!0,prev:!0};pt.fn.extend({find:function(e){var t,n=[],r=this,o=r.length;if("string"!=typeof e)return this.pushStack(pt(e).filter(function(){for(t=0;o>t;t++)if(pt.contains(r[t],this))return!0}));for(t=0;o>t;t++)pt.find(e,r[t],n);return n=this.pushStack(o>1?pt.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=pt(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(pt.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(d(this,e||[],!0))},filter:function(e){return this.pushStack(d(this,e||[],!1))},is:function(e){return!!d(this,"string"==typeof e&&$t.test(e)?pt(e):e||[],!1).length},closest:function(e,t){for(var n,r=0,o=this.length,i=[],s=$t.test(e)||"string"!=typeof e?pt(e,t||this.context):0;o>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(s?s.index(n)>-1:1===n.nodeType&&pt.find.matchesSelector(n,e))){n=i.push(n);break}return this.pushStack(i.length>1?pt.unique(i):i)},index:function(e){return e?"string"==typeof e?pt.inArray(this[0],pt(e)):pt.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?pt(e,t):pt.makeArray(e&&e.nodeType?[e]:e),r=pt.merge(this.get(),n);return this.pushStack(pt.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),pt.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return pt.dir(e,"parentNode")},parentsUntil:function(e,t,n){return pt.dir(e,"parentNode",n)},next:function(e){return f(e,"nextSibling")},prev:function(e){return f(e,"previousSibling")},nextAll:function(e){return pt.dir(e,"nextSibling")},prevAll:function(e){return pt.dir(e,"previousSibling")},nextUntil:function(e,t,n){return pt.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return pt.dir(e,"previousSibling",n)},siblings:function(e){return pt.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return pt.sibling(e.firstChild)},contents:function(e){return pt.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:pt.merge([],e.childNodes)}},function(e,t){pt.fn[e]=function(n,r){var o=pt.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(o=pt.filter(r,o)),this.length>1&&(Xt[e]||(o=pt.unique(o)),zt.test(e)&&(o=o.reverse())),this.pushStack(o)}}),pt.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?pt.find.matchesSelector(r,e)?[r]:[]:pt.find.matches(e,pt.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,t,r){for(var o=[],i=e[t];i&&9!==i.nodeType&&(r===n||1!==i.nodeType||!pt(i).is(r));)1===i.nodeType&&o.push(i),i=i[t];return o},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});var Kt="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,Vt=new RegExp("<(?:"+Kt+")[\\s/>]","i"),Jt=/^\s+/,Qt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Yt=/<([\w:]+)/,Zt=/<tbody/i,en=/<|&#?\w+;/,tn=/<(?:script|style|link)/i,nn=/^(?:checkbox|radio)$/i,rn=/checked\s*(?:[^=]|=\s*.checked.)/i,on=/^$|\/(?:java|ecma)script/i,sn=/^true\/(.*)/,an=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,un={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:pt.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},ln=h(Q),cn=ln.appendChild(Q.createElement("div"));un.optgroup=un.option,un.tbody=un.tfoot=un.colgroup=un.caption=un.thead,un.th=un.td,pt.fn.extend({text:function(e){return pt.access(this,function(e){return e===n?pt.text(this):this.empty().append((this[0]&&this[0].ownerDocument||Q).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=y(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=y(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){for(var n,r=e?pt.filter(e,this):this,o=0;null!=(n=r[o]);o++)t||1!==n.nodeType||pt.cleanData(w(n)),n.parentNode&&(t&&pt.contains(n.ownerDocument,n)&&v(w(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&pt.cleanData(w(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&pt.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 pt.clone(this,e,t)})},html:function(e){return pt.access(this,function(e){var t=this[0]||{},r=0,o=this.length;if(e===n)return 1===t.nodeType?t.innerHTML.replace(Gt,""):n;if(!("string"!=typeof e||tn.test(e)||!pt.support.htmlSerialize&&Vt.test(e)||!pt.support.leadingWhitespace&&Jt.test(e)||un[(Yt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(Qt,"<$1></$2>");try{for(;o>r;r++)t=this[r]||{},1===t.nodeType&&(pt.cleanData(w(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=pt.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],o=e[t++];o&&(r&&r.parentNode!==o&&(r=this.nextSibling),pt(this).remove(),o.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=ot.apply([],e);var r,o,i,s,a,u,l=0,c=this.length,p=this,f=c-1,d=e[0],h=pt.isFunction(d);if(h||!(1>=c||"string"!=typeof d||pt.support.checkClone)&&rn.test(d))return this.each(function(r){var o=p.eq(r);h&&(e[0]=d.call(this,r,o.html())),o.domManip(e,t,n)});if(c&&(u=pt.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=u.firstChild,1===u.childNodes.length&&(u=r),r)){for(s=pt.map(w(u,"script"),g),i=s.length;c>l;l++)o=u,l!==f&&(o=pt.clone(o,!0,!0),i&&pt.merge(s,w(o,"script"))),t.call(this[l],o,l);if(i)for(a=s[s.length-1].ownerDocument,pt.map(s,m),l=0;i>l;l++)o=s[l],on.test(o.type||"")&&!pt._data(o,"globalEval")&&pt.contains(a,o)&&(o.src?pt._evalUrl(o.src):pt.globalEval((o.text||o.textContent||o.innerHTML||"").replace(an,"")));u=r=null}return this}}),pt.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){pt.fn[e]=function(e){for(var n,r=0,o=[],i=pt(e),s=i.length-1;s>=r;r++)n=r===s?this:this.clone(!0),pt(i[r])[t](n),it.apply(o,n.get());return this.pushStack(o)}}),pt.extend({clone:function(e,t,n){var r,o,i,s,a,u=pt.contains(e.ownerDocument,e);if(pt.support.html5Clone||pt.isXMLDoc(e)||!Vt.test("<"+e.nodeName+">")?i=e.cloneNode(!0):(cn.innerHTML=e.outerHTML,cn.removeChild(i=cn.firstChild)),!(pt.support.noCloneEvent&&pt.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||pt.isXMLDoc(e)))for(r=w(i),a=w(e),s=0;null!=(o=a[s]);++s)r[s]&&x(o,r[s]);if(t)if(n)for(a=a||w(e),r=r||w(i),s=0;null!=(o=a[s]);s++)b(o,r[s]);else b(e,i);return r=w(i,"script"),r.length>0&&v(r,!u&&w(e,"script")),r=a=o=null,i},buildFragment:function(e,t,n,r){for(var o,i,s,a,u,l,c,p=e.length,f=h(t),d=[],y=0;p>y;y++)if(i=e[y],i||0===i)if("object"===pt.type(i))pt.merge(d,i.nodeType?[i]:i);else if(en.test(i)){for(a=a||f.appendChild(t.createElement("div")),u=(Yt.exec(i)||["",""])[1].toLowerCase(),c=un[u]||un._default,a.innerHTML=c[1]+i.replace(Qt,"<$1></$2>")+c[2],o=c[0];o--;)a=a.lastChild;if(!pt.support.leadingWhitespace&&Jt.test(i)&&d.push(t.createTextNode(Jt.exec(i)[0])),!pt.support.tbody)for(i="table"!==u||Zt.test(i)?"<table>"!==c[1]||Zt.test(i)?0:a:a.firstChild,o=i&&i.childNodes.length;o--;)pt.nodeName(l=i.childNodes[o],"tbody")&&!l.childNodes.length&&i.removeChild(l);for(pt.merge(d,a.childNodes),a.textContent="";a.firstChild;)a.removeChild(a.firstChild);a=f.lastChild}else d.push(t.createTextNode(i));for(a&&f.removeChild(a),pt.support.appendChecked||pt.grep(w(d,"input"),T),y=0;i=d[y++];)if((!r||-1===pt.inArray(i,r))&&(s=pt.contains(i.ownerDocument,i),a=w(f.appendChild(i),"script"),s&&v(a),n))for(o=0;i=a[o++];)on.test(i.type||"")&&n.push(i);return a=null,f},cleanData:function(e,t){for(var n,r,o,i,s=0,a=pt.expando,u=pt.cache,l=pt.support.deleteExpando,c=pt.event.special;null!=(n=e[s]);s++)if((t||pt.acceptData(n))&&(o=n[a],i=o&&u[o])){if(i.events)for(r in i.events)c[r]?pt.event.remove(n,r):pt.removeEvent(n,r,i.handle);u[o]&&(delete u[o],l?delete n[a]:typeof n.removeAttribute!==V?n.removeAttribute(a):n[a]=null,nt.push(o))}},_evalUrl:function(e){return pt.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),pt.fn.extend({wrapAll:function(e){if(pt.isFunction(e))return this.each(function(t){pt(this).wrapAll(e.call(this,t))});if(this[0]){var t=pt(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return this.each(pt.isFunction(e)?function(t){pt(this).wrapInner(e.call(this,t))}:function(){var t=pt(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=pt.isFunction(e);return this.each(function(n){pt(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){pt.nodeName(this,"body")||pt(this).replaceWith(this.childNodes)}).end()}});var pn,fn,dn,hn=/alpha\([^)]*\)/i,yn=/opacity\s*=\s*([^)]*)/,gn=/^(top|right|bottom|left)$/,mn=/^(none|table(?!-c[ea]).+)/,vn=/^margin/,bn=new RegExp("^("+ft+")(.*)$","i"),xn=new RegExp("^("+ft+")(?!px)[a-z%]+$","i"),wn=new RegExp("^([+-])=("+ft+")","i"),Tn={BODY:"block"},Cn={position:"absolute",visibility:"hidden",display:"block"},kn={letterSpacing:0,fontWeight:400},Sn=["Top","Right","Bottom","Left"],En=["Webkit","O","Moz","ms"];pt.fn.extend({css:function(e,t){return pt.access(this,function(e,t,r){var o,i,s={},a=0;if(pt.isArray(t)){for(i=fn(e),o=t.length;o>a;a++)s[t[a]]=pt.css(e,t[a],!1,i);return s}return r!==n?pt.style(e,t,r):pt.css(e,t)},e,t,arguments.length>1)},show:function(){return S(this,!0)},hide:function(){return S(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){k(this)?pt(this).show():pt(this).hide()})}}),pt.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=dn(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":pt.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,r,o){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,s,a,u=pt.camelCase(t),l=e.style;if(t=pt.cssProps[u]||(pt.cssProps[u]=C(l,u)),a=pt.cssHooks[t]||pt.cssHooks[u],r===n)return a&&"get"in a&&(i=a.get(e,!1,o))!==n?i:l[t];if(s=typeof r,"string"===s&&(i=wn.exec(r))&&(r=(i[1]+1)*i[2]+parseFloat(pt.css(e,t)),s="number"),!(null==r||"number"===s&&isNaN(r)||("number"!==s||pt.cssNumber[u]||(r+="px"),pt.support.clearCloneStyle||""!==r||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&(r=a.set(e,r,o))===n)))try{l[t]=r}catch(c){}}},css:function(e,t,r,o){var i,s,a,u=pt.camelCase(t);return t=pt.cssProps[u]||(pt.cssProps[u]=C(e.style,u)),a=pt.cssHooks[t]||pt.cssHooks[u],a&&"get"in a&&(s=a.get(e,!0,r)),s===n&&(s=dn(e,t,o)),"normal"===s&&t in kn&&(s=kn[t]),""===r||r?(i=parseFloat(s),r===!0||pt.isNumeric(i)?i||0:s):s}}),e.getComputedStyle?(fn=function(t){return e.getComputedStyle(t,null)},dn=function(e,t,r){var o,i,s,a=r||fn(e),u=a?a.getPropertyValue(t)||a[t]:n,l=e.style;return a&&(""!==u||pt.contains(e.ownerDocument,e)||(u=pt.style(e,t)),xn.test(u)&&vn.test(t)&&(o=l.width,i=l.minWidth,s=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=a.width,l.width=o,l.minWidth=i,l.maxWidth=s)),u}):Q.documentElement.currentStyle&&(fn=function(e){return e.currentStyle},dn=function(e,t,r){var o,i,s,a=r||fn(e),u=a?a[t]:n,l=e.style;return null==u&&l&&l[t]&&(u=l[t]),xn.test(u)&&!gn.test(t)&&(o=l.left,i=e.runtimeStyle,s=i&&i.left,s&&(i.left=e.currentStyle.left),l.left="fontSize"===t?"1em":u,u=l.pixelLeft+"px",l.left=o,s&&(i.left=s)),""===u?"auto":u}),pt.each(["height","width"],function(e,t){pt.cssHooks[t]={get:function(e,n,r){return n?0===e.offsetWidth&&mn.test(pt.css(e,"display"))?pt.swap(e,Cn,function(){return j(e,t,r)}):j(e,t,r):void 0},set:function(e,n,r){var o=r&&fn(e);return E(e,n,r?N(e,t,r,pt.support.boxSizing&&"border-box"===pt.css(e,"boxSizing",!1,o),o):0)}}}),pt.support.opacity||(pt.cssHooks.opacity={get:function(e,t){return yn.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,o=pt.isNumeric(t)?"alpha(opacity="+100*t+")":"",i=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===pt.trim(i.replace(hn,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=hn.test(i)?i.replace(hn,o):i+" "+o)}}),pt(function(){pt.support.reliableMarginRight||(pt.cssHooks.marginRight={get:function(e,t){return t?pt.swap(e,{display:"inline-block"},dn,[e,"marginRight"]):void 0}}),!pt.support.pixelPosition&&pt.fn.position&&pt.each(["top","left"],function(e,t){pt.cssHooks[t]={get:function(e,n){return n?(n=dn(e,t),xn.test(n)?pt(e).position()[t]+"px":n):void 0}}})}),pt.expr&&pt.expr.filters&&(pt.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0||!pt.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||pt.css(e,"display"))},pt.expr.filters.visible=function(e){return!pt.expr.filters.hidden(e)}),pt.each({margin:"",padding:"",border:"Width"},function(e,t){pt.cssHooks[e+t]={expand:function(n){for(var r=0,o={},i="string"==typeof n?n.split(" "):[n];4>r;r++)o[e+Sn[r]+t]=i[r]||i[r-2]||i[0]; return o}},vn.test(e)||(pt.cssHooks[e+t].set=E)});var Nn=/%20/g,jn=/\[\]$/,_n=/\r?\n/g,Dn=/^(?:submit|button|image|reset|file)$/i,qn=/^(?:input|select|textarea|keygen)/i;pt.fn.extend({serialize:function(){return pt.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=pt.prop(this,"elements");return e?pt.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!pt(this).is(":disabled")&&qn.test(this.nodeName)&&!Dn.test(e)&&(this.checked||!nn.test(e))}).map(function(e,t){var n=pt(this).val();return null==n?null:pt.isArray(n)?pt.map(n,function(e){return{name:t.name,value:e.replace(_n,"\r\n")}}):{name:t.name,value:n.replace(_n,"\r\n")}}).get()}}),pt.param=function(e,t){var r,o=[],i=function(e,t){t=pt.isFunction(t)?t():null==t?"":t,o[o.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(t===n&&(t=pt.ajaxSettings&&pt.ajaxSettings.traditional),pt.isArray(e)||e.jquery&&!pt.isPlainObject(e))pt.each(e,function(){i(this.name,this.value)});else for(r in e)q(r,e[r],t,i);return o.join("&").replace(Nn,"+")},pt.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){pt.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),pt.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 An,Pn,Ln=pt.now(),Hn=/\?/,Mn=/#.*$/,On=/([?&])_=[^&]*/,Bn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Fn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Rn=/^(?:GET|HEAD)$/,In=/^\/\//,Un=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Wn=pt.fn.load,zn={},$n={},Xn="*/".concat("*");try{Pn=J.href}catch(Kn){Pn=Q.createElement("a"),Pn.href="",Pn=Pn.href}An=Un.exec(Pn.toLowerCase())||[],pt.fn.load=function(e,t,r){if("string"!=typeof e&&Wn)return Wn.apply(this,arguments);var o,i,s,a=this,u=e.indexOf(" ");return u>=0&&(o=e.slice(u,e.length),e=e.slice(0,u)),pt.isFunction(t)?(r=t,t=n):t&&"object"==typeof t&&(s="POST"),a.length>0&&pt.ajax({url:e,type:s,dataType:"html",data:t}).done(function(e){i=arguments,a.html(o?pt("<div>").append(pt.parseHTML(e)).find(o):e)}).complete(r&&function(e,t){a.each(r,i||[e.responseText,t,e])}),this},pt.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){pt.fn[t]=function(e){return this.on(t,e)}}),pt.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Pn,type:"GET",isLocal:Fn.test(An[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Xn,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":pt.parseJSON,"text xml":pt.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?L(L(e,pt.ajaxSettings),t):L(pt.ajaxSettings,e)},ajaxPrefilter:A(zn),ajaxTransport:A($n),ajax:function(e,t){function r(e,t,r,o){var i,p,v,b,w,C=t;2!==x&&(x=2,u&&clearTimeout(u),c=n,a=o||"",T.readyState=e>0?4:0,i=e>=200&&300>e||304===e,r&&(b=H(f,T,r)),b=M(f,b,T,i),i?(f.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(pt.lastModified[s]=w),w=T.getResponseHeader("etag"),w&&(pt.etag[s]=w)),204===e||"HEAD"===f.type?C="nocontent":304===e?C="notmodified":(C=b.state,p=b.data,v=b.error,i=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),T.status=e,T.statusText=(t||C)+"",i?y.resolveWith(d,[p,C,T]):y.rejectWith(d,[T,C,v]),T.statusCode(m),m=n,l&&h.trigger(i?"ajaxSuccess":"ajaxError",[T,f,i?p:v]),g.fireWith(d,[T,C]),l&&(h.trigger("ajaxComplete",[T,f]),--pt.active||pt.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=n),t=t||{};var o,i,s,a,u,l,c,p,f=pt.ajaxSetup({},t),d=f.context||f,h=f.context&&(d.nodeType||d.jquery)?pt(d):pt.event,y=pt.Deferred(),g=pt.Callbacks("once memory"),m=f.statusCode||{},v={},b={},x=0,w="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!p)for(p={};t=Bn.exec(a);)p[t[1].toLowerCase()]=t[2];t=p[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=b[n]=b[n]||e,v[e]=t),this},overrideMimeType:function(e){return x||(f.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else T.always(e[T.status]);return this},abort:function(e){var t=e||w;return c&&c.abort(t),r(0,t),this}};if(y.promise(T).complete=g.add,T.success=T.done,T.error=T.fail,f.url=((e||f.url||Pn)+"").replace(Mn,"").replace(In,An[1]+"//"),f.type=t.method||t.type||f.method||f.type,f.dataTypes=pt.trim(f.dataType||"*").toLowerCase().match(dt)||[""],null==f.crossDomain&&(o=Un.exec(f.url.toLowerCase()),f.crossDomain=!(!o||o[1]===An[1]&&o[2]===An[2]&&(o[3]||("http:"===o[1]?"80":"443"))===(An[3]||("http:"===An[1]?"80":"443")))),f.data&&f.processData&&"string"!=typeof f.data&&(f.data=pt.param(f.data,f.traditional)),P(zn,f,t,T),2===x)return T;l=f.global,l&&0===pt.active++&&pt.event.trigger("ajaxStart"),f.type=f.type.toUpperCase(),f.hasContent=!Rn.test(f.type),s=f.url,f.hasContent||(f.data&&(s=f.url+=(Hn.test(s)?"&":"?")+f.data,delete f.data),f.cache===!1&&(f.url=On.test(s)?s.replace(On,"$1_="+Ln++):s+(Hn.test(s)?"&":"?")+"_="+Ln++)),f.ifModified&&(pt.lastModified[s]&&T.setRequestHeader("If-Modified-Since",pt.lastModified[s]),pt.etag[s]&&T.setRequestHeader("If-None-Match",pt.etag[s])),(f.data&&f.hasContent&&f.contentType!==!1||t.contentType)&&T.setRequestHeader("Content-Type",f.contentType),T.setRequestHeader("Accept",f.dataTypes[0]&&f.accepts[f.dataTypes[0]]?f.accepts[f.dataTypes[0]]+("*"!==f.dataTypes[0]?", "+Xn+"; q=0.01":""):f.accepts["*"]);for(i in f.headers)T.setRequestHeader(i,f.headers[i]);if(f.beforeSend&&(f.beforeSend.call(d,T,f)===!1||2===x))return T.abort();w="abort";for(i in{success:1,error:1,complete:1})T[i](f[i]);if(c=P($n,f,t,T)){T.readyState=1,l&&h.trigger("ajaxSend",[T,f]),f.async&&f.timeout>0&&(u=setTimeout(function(){T.abort("timeout")},f.timeout));try{x=1,c.send(v,r)}catch(C){if(!(2>x))throw C;r(-1,C)}}else r(-1,"No Transport");return T},getJSON:function(e,t,n){return pt.get(e,t,n,"json")},getScript:function(e,t){return pt.get(e,n,t,"script")}}),pt.each(["get","post"],function(e,t){pt[t]=function(e,r,o,i){return pt.isFunction(r)&&(i=i||o,o=r,r=n),pt.ajax({url:e,type:t,dataType:i,data:r,success:o})}}),pt.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return pt.globalEval(e),e}}}),pt.ajaxPrefilter("script",function(e){e.cache===n&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),pt.ajaxTransport("script",function(e){if(e.crossDomain){var t,r=Q.head||pt("head")[0]||Q.documentElement;return{send:function(n,o){t=Q.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||o(200,"success"))},r.insertBefore(t,r.firstChild)},abort:function(){t&&t.onload(n,!0)}}}});var Gn=[],Vn=/(=)\?(?=&|$)|\?\?/;pt.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gn.pop()||pt.expando+"_"+Ln++;return this[e]=!0,e}}),pt.ajaxPrefilter("json jsonp",function(t,r,o){var i,s,a,u=t.jsonp!==!1&&(Vn.test(t.url)?"url":"string"==typeof t.data&&!(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vn.test(t.data)&&"data");return u||"jsonp"===t.dataTypes[0]?(i=t.jsonpCallback=pt.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,u?t[u]=t[u].replace(Vn,"$1"+i):t.jsonp!==!1&&(t.url+=(Hn.test(t.url)?"&":"?")+t.jsonp+"="+i),t.converters["script json"]=function(){return a||pt.error(i+" was not called"),a[0]},t.dataTypes[0]="json",s=e[i],e[i]=function(){a=arguments},o.always(function(){e[i]=s,t[i]&&(t.jsonpCallback=r.jsonpCallback,Gn.push(i)),a&&pt.isFunction(s)&&s(a[0]),a=s=n}),"script"):void 0});var Jn,Qn,Yn=0,Zn=e.ActiveXObject&&function(){var e;for(e in Jn)Jn[e](n,!0)};pt.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&O()||B()}:O,Qn=pt.ajaxSettings.xhr(),pt.support.cors=!!Qn&&"withCredentials"in Qn,Qn=pt.support.ajax=!!Qn,Qn&&pt.ajaxTransport(function(t){if(!t.crossDomain||pt.support.cors){var r;return{send:function(o,i){var s,a,u=t.xhr();if(t.username?u.open(t.type,t.url,t.async,t.username,t.password):u.open(t.type,t.url,t.async),t.xhrFields)for(a in t.xhrFields)u[a]=t.xhrFields[a];t.mimeType&&u.overrideMimeType&&u.overrideMimeType(t.mimeType),t.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");try{for(a in o)u.setRequestHeader(a,o[a])}catch(l){}u.send(t.hasContent&&t.data||null),r=function(e,o){var a,l,c,p;try{if(r&&(o||4===u.readyState))if(r=n,s&&(u.onreadystatechange=pt.noop,Zn&&delete Jn[s]),o)4!==u.readyState&&u.abort();else{p={},a=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}a||!t.isLocal||t.crossDomain?1223===a&&(a=204):a=p.text?200:404}}catch(d){o||i(-1,d)}p&&i(a,c,p,l)},t.async?4===u.readyState?setTimeout(r):(s=++Yn,Zn&&(Jn||(Jn={},pt(e).unload(Zn)),Jn[s]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(n,!0)}}}});var er,tr,nr=/^(?:toggle|show|hide)$/,rr=new RegExp("^(?:([+-])=|)("+ft+")([a-z%]*)$","i"),or=/queueHooks$/,ir=[W],sr={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),o=rr.exec(t),i=o&&o[3]||(pt.cssNumber[e]?"":"px"),s=(pt.cssNumber[e]||"px"!==i&&+r)&&rr.exec(pt.css(n.elem,e)),a=1,u=20;if(s&&s[3]!==i){i=i||s[3],o=o||[],s=+r||1;do a=a||".5",s/=a,pt.style(n.elem,e,s+i);while(a!==(a=n.cur()/r)&&1!==a&&--u)}return o&&(s=n.start=+s||+r||0,n.unit=i,n.end=o[1]?s+(o[1]+1)*o[2]:+o[2]),n}]};pt.Animation=pt.extend(I,{tweener:function(e,t){pt.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,r=0,o=e.length;o>r;r++)n=e[r],sr[n]=sr[n]||[],sr[n].unshift(t)},prefilter:function(e,t){t?ir.unshift(e):ir.push(e)}}),pt.Tween=z,z.prototype={constructor:z,init:function(e,t,n,r,o,i){this.elem=e,this.prop=n,this.easing=o||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=i||(pt.cssNumber[n]?"":"px")},cur:function(){var e=z.propHooks[this.prop];return e&&e.get?e.get(this):z.propHooks._default.get(this)},run:function(e){var t,n=z.propHooks[this.prop];return this.pos=t=this.options.duration?pt.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):z.propHooks._default.set(this),this}},z.prototype.init.prototype=z.prototype,z.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=pt.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){pt.fx.step[e.prop]?pt.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[pt.cssProps[e.prop]]||pt.cssHooks[e.prop])?pt.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},z.propHooks.scrollTop=z.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},pt.each(["toggle","show","hide"],function(e,t){var n=pt.fn[t];pt.fn[t]=function(e,r,o){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate($(t,!0),e,r,o)}}),pt.fn.extend({fadeTo:function(e,t,n,r){return this.filter(k).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var o=pt.isEmptyObject(e),i=pt.speed(t,n,r),s=function(){var t=I(this,pt.extend({},e),i);(o||pt._data(this,"finish"))&&t.stop(!0)};return s.finish=s,o||i.queue===!1?this.each(s):this.queue(i.queue,s)},stop:function(e,t,r){var o=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=t,t=e,e=n),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",i=pt.timers,s=pt._data(this);if(n)s[n]&&s[n].stop&&o(s[n]);else for(n in s)s[n]&&s[n].stop&&or.test(n)&&o(s[n]);for(n=i.length;n--;)i[n].elem!==this||null!=e&&i[n].queue!==e||(i[n].anim.stop(r),t=!1,i.splice(n,1));(t||!r)&&pt.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=pt._data(this),r=n[e+"queue"],o=n[e+"queueHooks"],i=pt.timers,s=r?r.length:0;for(n.finish=!0,pt.queue(this,e,[]),o&&o.stop&&o.stop.call(this,!0),t=i.length;t--;)i[t].elem===this&&i[t].queue===e&&(i[t].anim.stop(!0),i.splice(t,1));for(t=0;s>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),pt.each({slideDown:$("show"),slideUp:$("hide"),slideToggle:$("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){pt.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),pt.speed=function(e,t,n){var r=e&&"object"==typeof e?pt.extend({},e):{complete:n||!n&&t||pt.isFunction(e)&&e,duration:e,easing:n&&t||t&&!pt.isFunction(t)&&t};return r.duration=pt.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in pt.fx.speeds?pt.fx.speeds[r.duration]:pt.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){pt.isFunction(r.old)&&r.old.call(this),r.queue&&pt.dequeue(this,r.queue)},r},pt.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},pt.timers=[],pt.fx=z.prototype.init,pt.fx.tick=function(){var e,t=pt.timers,r=0;for(er=pt.now();r<t.length;r++)e=t[r],e()||t[r]!==e||t.splice(r--,1);t.length||pt.fx.stop(),er=n},pt.fx.timer=function(e){e()&&pt.timers.push(e)&&pt.fx.start()},pt.fx.interval=13,pt.fx.start=function(){tr||(tr=setInterval(pt.fx.tick,pt.fx.interval))},pt.fx.stop=function(){clearInterval(tr),tr=null},pt.fx.speeds={slow:600,fast:200,_default:400},pt.fx.step={},pt.expr&&pt.expr.filters&&(pt.expr.filters.animated=function(e){return pt.grep(pt.timers,function(t){return e===t.elem}).length}),pt.fn.offset=function(e){if(arguments.length)return e===n?this:this.each(function(t){pt.offset.setOffset(this,e,t)});var t,r,o={top:0,left:0},i=this[0],s=i&&i.ownerDocument;if(s)return t=s.documentElement,pt.contains(t,i)?(typeof i.getBoundingClientRect!==V&&(o=i.getBoundingClientRect()),r=X(s),{top:o.top+(r.pageYOffset||t.scrollTop)-(t.clientTop||0),left:o.left+(r.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):o},pt.offset={setOffset:function(e,t,n){var r=pt.css(e,"position");"static"===r&&(e.style.position="relative");var o,i,s=pt(e),a=s.offset(),u=pt.css(e,"top"),l=pt.css(e,"left"),c=("absolute"===r||"fixed"===r)&&pt.inArray("auto",[u,l])>-1,p={},f={};c?(f=s.position(),o=f.top,i=f.left):(o=parseFloat(u)||0,i=parseFloat(l)||0),pt.isFunction(t)&&(t=t.call(e,n,a)),null!=t.top&&(p.top=t.top-a.top+o),null!=t.left&&(p.left=t.left-a.left+i),"using"in t?t.using.call(e,p):s.css(p)}},pt.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===pt.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),pt.nodeName(e[0],"html")||(n=e.offset()),n.top+=pt.css(e[0],"borderTopWidth",!0),n.left+=pt.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-pt.css(r,"marginTop",!0),left:t.left-n.left-pt.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||Y;e&&!pt.nodeName(e,"html")&&"static"===pt.css(e,"position");)e=e.offsetParent;return e||Y})}}),pt.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var r=/Y/.test(t);pt.fn[e]=function(o){return pt.access(this,function(e,o,i){var s=X(e);return i===n?s?t in s?s[t]:s.document.documentElement[o]:e[o]:void(s?s.scrollTo(r?pt(s).scrollLeft():i,r?i:pt(s).scrollTop()):e[o]=i)},e,o,arguments.length,null)}}),pt.each({Height:"height",Width:"width"},function(e,t){pt.each({padding:"inner"+e,content:t,"":"outer"+e},function(r,o){pt.fn[o]=function(o,i){var s=arguments.length&&(r||"boolean"!=typeof o),a=r||(o===!0||i===!0?"margin":"border");return pt.access(this,function(t,r,o){var i;return pt.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):o===n?pt.css(t,r,a):pt.style(t,r,o,a)},t,s?o:n,s,null)}})}),pt.fn.size=function(){return this.length},pt.fn.andSelf=pt.fn.addBack,"object"==typeof t&&t&&"object"==typeof t.exports?t.exports=pt:(e.jQuery=e.$=pt,"function"==typeof define&&define.amd&&define("jquery",[],function(){return pt}))}(window)}()},{}],12:[function(e,t,n){!function(e,r){"object"==typeof n?t.exports=n=r():"function"==typeof define&&define.amd?define([],r):e.CryptoJS=r()}(this,function(){var e=e||function(e,t){var n={},r=n.lib={},o=r.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var n=new e;return t&&n.mixIn(t),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),i=r.WordArray=o.extend({init:function(e,n){e=this.words=e||[],this.sigBytes=n!=t?n:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,o=e.sigBytes;if(this.clamp(),r%4)for(var i=0;o>i;i++){var s=255&n[i>>>2]>>>24-8*(i%4);t[r+i>>>2]|=s<<24-8*((r+i)%4)}else if(n.length>65535)for(var i=0;o>i;i+=4)t[r+i>>>2]=n[i>>>2];else t.push.apply(t,n);return this.sigBytes+=o,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-8*(n%4),t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;t>r;r+=4)n.push(0|4294967296*e.random());return new i.init(n,t)}}),s=n.enc={},a=s.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;n>o;o++){var i=255&t[o>>>2]>>>24-8*(o%4);r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;t>r;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-4*(r%8);return new i.init(n,t/2)}},u=s.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],o=0;n>o;o++){var i=255&t[o>>>2]>>>24-8*(o%4);r.push(String.fromCharCode(i))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;t>r;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-8*(r%4);return new i.init(n,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(t){throw Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},c=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,o=n.sigBytes,s=this.blockSize,a=4*s,u=o/a;u=t?e.ceil(u):e.max((0|u)-this._minBufferSize,0);var l=u*s,c=e.min(4*l,o);if(l){for(var p=0;l>p;p+=s)this._doProcessBlock(r,p);var f=r.splice(0,l);n.sigBytes-=c}return new i.init(f,c)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});r.Hasher=c.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){c.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var t=this._doFinalize();return t},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new p.HMAC.init(e,n).finalize(t)}}});var p=n.algo={};return n}(Math);return e})},{}],13:[function(e,t,n){!function(r,o){"object"==typeof n?t.exports=n=o(e("./core"),e("./sha1"),e("./hmac")):"function"==typeof define&&define.amd?define(["./core","./sha1","./hmac"],o):o(r.CryptoJS)}(this,function(e){return e.HmacSHA1})},{"./core":12,"./hmac":14,"./sha1":15}],14:[function(e,t,n){!function(r,o){"object"==typeof n?t.exports=n=o(e("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(e){!function(){var t=e,n=t.lib,r=n.Base,o=t.enc,i=o.Utf8,s=t.algo;s.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),s=this._iKey=t.clone(),a=o.words,u=s.words,l=0;n>l;l++)a[l]^=1549556828,u[l]^=909522486;o.sigBytes=s.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);t.reset();var r=t.finalize(this._oKey.clone().concat(n));return r}})}()})},{"./core":12}],15:[function(e,t,n){!function(r,o){"object"==typeof n?t.exports=n=o(e("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(e){return function(){var t=e,n=t.lib,r=n.WordArray,o=n.Hasher,i=t.algo,s=[],a=i.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],u=n[4],l=0;80>l;l++){if(16>l)s[l]=0|e[t+l];else{var c=s[l-3]^s[l-8]^s[l-14]^s[l-16];s[l]=c<<1|c>>>31}var p=(r<<5|r>>>27)+u+s[l];p+=20>l?(o&i|~o&a)+1518500249:40>l?(o^i^a)+1859775393:60>l?(o&i|o&a|i&a)-1894007588:(o^i^a)-899497514,u=a,a=i,i=o<<30|o>>>2,o=r,r=p}n[0]=0|n[0]+r,n[1]=0|n[1]+o,n[2]=0|n[2]+i,n[3]=0|n[3]+a,n[4]=0|n[4]+u},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[(r+64>>>9<<4)+14]=Math.floor(n/4294967296),t[(r+64>>>9<<4)+15]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA1=o._createHelper(a),t.HmacSHA1=o._createHmacHelper(a)}(),e.SHA1})},{"./core":12}]},{},[10]);
actor-apps/app-web/src/app/components/Deactivated.react.js
taimur97/actor-platform
import React from 'react'; class Deactivated extends React.Component { render() { return ( <div className="deactivated row center-xs middle-xs"> <div className="deactivated__window"> <h2>Tab deactivated</h2> <p> Oops, you have opened another tab with Actor, so we had to deactivate this one to prevent some dangerous things happening. </p> </div> </div> ); } } export default Deactivated;