Guest User

Untitled

a guest
Aug 12th, 2016
115
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*can-util@3.0.0-pre.33#dom/class-name/class-name*/
  2. define('can-util@3.0.0-pre.33#dom/class-name/class-name', function (require, exports, module) {
  3. var has = function (className) {
  4. if (this.classList) {
  5. return this.classList.contains(className);
  6. } else {
  7. return !!this.className.match(new RegExp('(\\s|^)' + className + '(\\s|$)'));
  8. }
  9. };
  10. module.exports = {
  11. has: has,
  12. add: function (className) {
  13. if (this.classList) {
  14. this.classList.add(className);
  15. } else if (!has.call(this, className)) {
  16. this.className += ' ' + className;
  17. }
  18. },
  19. remove: function (className) {
  20. if (this.classList) {
  21. this.classList.remove(className);
  22. } else if (has.call(this, className)) {
  23. var reg = new RegExp('(\\s|^)' + className + '(\\s|$)');
  24. this.className = this.className.replace(reg, ' ');
  25. }
  26. }
  27. };
  28. });
  29. /*can-control@3.0.0-pre.5#can-control*/
  30. define('can-control@3.0.0-pre.5#can-control', function (require, exports, module) {
  31. var Construct = require('can-construct');
  32. var namespace = require('can-util/namespace');
  33. var string = require('can-util/js/string/string');
  34. var assign = require('can-util/js/assign/assign');
  35. var isFunction = require('can-util/js/is-function/is-function');
  36. var isArray = require('can-util/js/is-array/is-array');
  37. var each = require('can-util/js/each/each');
  38. var dev = require('can-util/js/dev/dev');
  39. var domData = require('can-util/dom/data/data');
  40. var className = require('can-util/dom/class-name/class-name');
  41. var domEvents = require('can-util/dom/events/events');
  42. var canEvent = require('can-event');
  43. var processors;
  44. require('can-util/dom/dispatch/dispatch');
  45. require('can-util/dom/events/delegate/delegate');
  46. var bind = function (el, ev, callback) {
  47. canEvent.on.call(el, ev, callback);
  48. return function () {
  49. canEvent.off.call(el, ev, callback);
  50. };
  51. }, slice = [].slice, paramReplacer = /\{([^\}]+)\}/g, delegate = function (el, selector, ev, callback) {
  52. canEvent.on.call(el, ev, selector, callback);
  53. return function () {
  54. canEvent.off.call(el, ev, selector, callback);
  55. };
  56. }, binder = function (el, ev, callback, selector) {
  57. return selector ? delegate(el, selector.trim(), ev, callback) : bind(el, ev, callback);
  58. }, basicProcessor;
  59. var Control = Construct.extend({
  60. setup: function () {
  61. Construct.setup.apply(this, arguments);
  62. if (Control) {
  63. var control = this, funcName;
  64. control.actions = {};
  65. for (funcName in control.prototype) {
  66. if (control._isAction(funcName)) {
  67. control.actions[funcName] = control._action(funcName);
  68. }
  69. }
  70. }
  71. },
  72. _shifter: function (context, name) {
  73. var method = typeof name === 'string' ? context[name] : name;
  74. if (!isFunction(method)) {
  75. method = context[method];
  76. }
  77. return function () {
  78. context.called = name;
  79. return method.apply(context, [this].concat(slice.call(arguments, 0)));
  80. };
  81. },
  82. _isAction: function (methodName) {
  83. var val = this.prototype[methodName], type = typeof val;
  84. return methodName !== 'constructor' && (type === 'function' || type === 'string' && isFunction(this.prototype[val])) && !!(Control.isSpecial(methodName) || processors[methodName] || /[^\w]/.test(methodName));
  85. },
  86. _action: function (methodName, options) {
  87. paramReplacer.lastIndex = 0;
  88. if (options || !paramReplacer.test(methodName)) {
  89. var convertedName = options ? string.sub(methodName, this._lookup(options)) : methodName;
  90. if (!convertedName) {
  91. return null;
  92. }
  93. var arr = isArray(convertedName), name = arr ? convertedName[1] : convertedName, parts = name.split(/\s+/g), event = parts.pop();
  94. return {
  95. processor: processors[event] || basicProcessor,
  96. parts: [
  97. name,
  98. parts.join(' '),
  99. event
  100. ],
  101. delegate: arr ? convertedName[0] : undefined
  102. };
  103. }
  104. },
  105. _lookup: function (options) {
  106. return [
  107. options,
  108. window
  109. ];
  110. },
  111. processors: {},
  112. defaults: {},
  113. convertElement: function (element) {
  114. return typeof element === 'string' ? document.querySelector(element) : element;
  115. },
  116. isSpecial: function (eventName) {
  117. return eventName === 'inserted' || eventName === 'removed';
  118. }
  119. }, {
  120. setup: function (element, options) {
  121. var cls = this.constructor, pluginname = cls.pluginName || cls.shortName, arr;
  122. this.element = cls.convertElement(element);
  123. if (pluginname && pluginname !== 'can_control') {
  124. className.add.call(element, pluginname);
  125. }
  126. arr = domData.get.call(this.element, 'controls');
  127. if (!arr) {
  128. arr = [];
  129. domData.set.call(this.element, 'controls', arr);
  130. }
  131. arr.push(this);
  132. this.options = assign(assign({}, cls.defaults), options);
  133. this.on();
  134. return [
  135. this.element,
  136. this.options
  137. ];
  138. },
  139. on: function (el, selector, eventName, func) {
  140. if (!el) {
  141. this.off();
  142. var cls = this.constructor, bindings = this._bindings, actions = cls.actions, element = this.element, destroyCB = Control._shifter(this, 'destroy'), funcName, ready;
  143. for (funcName in actions) {
  144. if (actions.hasOwnProperty(funcName)) {
  145. ready = actions[funcName] || cls._action(funcName, this.options, this);
  146. if (ready) {
  147. bindings.control[funcName] = ready.processor(ready.delegate || element, ready.parts[2], ready.parts[1], funcName, this);
  148. }
  149. }
  150. }
  151. domEvents.addEventListener.call(element, 'removed', destroyCB);
  152. bindings.user.push(function (el) {
  153. domEvents.removeEventListener.call(el, 'removed', destroyCB);
  154. });
  155. return bindings.user.length;
  156. }
  157. if (typeof el === 'string') {
  158. func = eventName;
  159. eventName = selector;
  160. selector = el;
  161. el = this.element;
  162. }
  163. if (func === undefined) {
  164. func = eventName;
  165. eventName = selector;
  166. selector = null;
  167. }
  168. if (typeof func === 'string') {
  169. func = Control._shifter(this, func);
  170. }
  171. this._bindings.user.push(binder(el, eventName, func, selector));
  172. return this._bindings.user.length;
  173. },
  174. off: function () {
  175. var el = this.element[0], bindings = this._bindings;
  176. if (bindings) {
  177. each(bindings.user || [], function (value) {
  178. value(el);
  179. });
  180. each(bindings.control || {}, function (value) {
  181. value(el);
  182. });
  183. }
  184. this._bindings = {
  185. user: [],
  186. control: {}
  187. };
  188. },
  189. destroy: function () {
  190. if (this.element === null) {
  191. return;
  192. }
  193. var Class = this.constructor, pluginName = Class.pluginName || Class.shortName && string.underscore(Class.shortName), controls;
  194. this.off();
  195. if (pluginName && pluginName !== 'can_control') {
  196. className.remove.call(this.element, pluginName);
  197. }
  198. controls = domData.get.call(this.element, 'controls');
  199. controls.splice(controls.indexOf(this), 1);
  200. canEvent.dispatch.call(this, 'destroyed');
  201. this.element = null;
  202. }
  203. });
  204. processors = Control.processors;
  205. basicProcessor = function (el, event, selector, methodName, control) {
  206. return binder(el, event, Control._shifter(control, methodName), selector);
  207. };
  208. each([
  209. 'change',
  210. 'click',
  211. 'contextmenu',
  212. 'dblclick',
  213. 'keydown',
  214. 'keyup',
  215. 'keypress',
  216. 'mousedown',
  217. 'mousemove',
  218. 'mouseout',
  219. 'mouseover',
  220. 'mouseup',
  221. 'reset',
  222. 'resize',
  223. 'scroll',
  224. 'select',
  225. 'submit',
  226. 'focusin',
  227. 'focusout',
  228. 'mouseenter',
  229. 'mouseleave',
  230. 'touchstart',
  231. 'touchmove',
  232. 'touchcancel',
  233. 'touchend',
  234. 'touchleave',
  235. 'inserted',
  236. 'removed',
  237. 'dragstart',
  238. 'dragenter',
  239. 'dragover',
  240. 'dragleave',
  241. 'drag',
  242. 'drop',
  243. 'dragend'
  244. ], function (v) {
  245. processors[v] = basicProcessor;
  246. });
  247. module.exports = namespace.Control = Control;
  248. });
  249. /*can-component@3.0.0-pre.14#control/control*/
  250. define('can-component@3.0.0-pre.14#control/control', function (require, exports, module) {
  251. var Control = require('can-control');
  252. var canEach = require('can-util/js/each/each');
  253. var string = require('can-util/js/string/string');
  254. var canCompute = require('can-compute');
  255. var observeReader = require('can-observation/reader/reader');
  256. var paramReplacer = /\{([^\}]+)\}/g;
  257. var ComponentControl = Control.extend({
  258. _lookup: function (options) {
  259. return [
  260. options.scope,
  261. options,
  262. window
  263. ];
  264. },
  265. _action: function (methodName, options, controlInstance) {
  266. var hasObjectLookup, readyCompute;
  267. paramReplacer.lastIndex = 0;
  268. hasObjectLookup = paramReplacer.test(methodName);
  269. if (!controlInstance && hasObjectLookup) {
  270. return;
  271. } else if (!hasObjectLookup) {
  272. return Control._action.apply(this, arguments);
  273. } else {
  274. readyCompute = canCompute(function () {
  275. var delegate;
  276. var name = methodName.replace(paramReplacer, function (matched, key) {
  277. var value;
  278. if (key === 'scope' || key === 'viewModel') {
  279. delegate = options.viewModel;
  280. return '';
  281. }
  282. key = key.replace(/^(scope|^viewModel)\./, '');
  283. value = observeReader.read(options.viewModel, observeReader.reads(key), { readCompute: false }).value;
  284. if (value === undefined) {
  285. value = string.getObject(key);
  286. }
  287. if (typeof value === 'string') {
  288. return value;
  289. } else {
  290. delegate = value;
  291. return '';
  292. }
  293. });
  294. var parts = name.split(/\s+/g), event = parts.pop();
  295. return {
  296. processor: this.processors[event] || this.processors.click,
  297. parts: [
  298. name,
  299. parts.join(' '),
  300. event
  301. ],
  302. delegate: delegate || undefined
  303. };
  304. }, this);
  305. var handler = function (ev, ready) {
  306. controlInstance._bindings.control[methodName](controlInstance.element);
  307. controlInstance._bindings.control[methodName] = ready.processor(ready.delegate || controlInstance.element, ready.parts[2], ready.parts[1], methodName, controlInstance);
  308. };
  309. readyCompute.bind('change', handler);
  310. controlInstance._bindings.readyComputes[methodName] = {
  311. compute: readyCompute,
  312. handler: handler
  313. };
  314. return readyCompute();
  315. }
  316. }
  317. }, {
  318. setup: function (el, options) {
  319. this.scope = options.scope;
  320. this.viewModel = options.viewModel;
  321. return Control.prototype.setup.call(this, el, options);
  322. },
  323. off: function () {
  324. if (this._bindings) {
  325. canEach(this._bindings.readyComputes || {}, function (value) {
  326. value.compute.unbind('change', value.handler);
  327. });
  328. }
  329. Control.prototype.off.apply(this, arguments);
  330. this._bindings.readyComputes = {};
  331. },
  332. destroy: function () {
  333. Control.prototype.destroy.apply(this, arguments);
  334. if (typeof this.options.destroy === 'function') {
  335. this.options.destroy.apply(this, arguments);
  336. }
  337. }
  338. });
  339. module.exports = ComponentControl;
  340. });
  341. /*can-view-model@3.0.0-pre.4#can-view-model*/
  342. define('can-view-model@3.0.0-pre.4#can-view-model', function (require, exports, module) {
  343. 'use strict';
  344. var domData = require('can-util/dom/data/data');
  345. var SimpleMap = require('can-simple-map');
  346. var types = require('can-util/js/types/types');
  347. var ns = require('can-util/namespace');
  348. module.exports = ns.viewModel = function (el, attr, val) {
  349. var scope = domData.get.call(el, 'viewModel');
  350. if (!scope) {
  351. scope = types.DefaultMap ? new types.DefaultMap() : new SimpleMap();
  352. domData.set.call(el, 'viewModel', scope);
  353. }
  354. switch (arguments.length) {
  355. case 0:
  356. case 1:
  357. return scope;
  358. case 2:
  359. return 'attr' in scope ? scope.attr(attr) : scope[attr];
  360. default:
  361. if ('attr' in scope) {
  362. scope.attr(attr, val);
  363. } else {
  364. scope[attr] = val;
  365. }
  366. return el;
  367. }
  368. };
  369. });
  370. /*can-util@3.0.0-pre.33#js/string-to-any/string-to-any*/
  371. define('can-util@3.0.0-pre.33#js/string-to-any/string-to-any', function (require, exports, module) {
  372. module.exports = function (str) {
  373. switch (str) {
  374. case 'NaN':
  375. case 'Infinity':
  376. return +str;
  377. case 'null':
  378. return null;
  379. case 'undefined':
  380. return undefined;
  381. case 'true':
  382. case 'false':
  383. return str === 'true';
  384. default:
  385. var val = +str;
  386. if (!isNaN(val)) {
  387. return val;
  388. } else {
  389. return str;
  390. }
  391. }
  392. };
  393. });
  394. /*can-stache-bindings@3.0.0-pre.12#converters*/
  395. define('can-stache-bindings@3.0.0-pre.12#converters', function (require, exports, module) {
  396. var stache = require('can-stache');
  397. var stringToAny = require('can-util/js/string-to-any/string-to-any');
  398. stache.registerConverter('boolean-to-inList', {
  399. get: function (item, list) {
  400. if (!list) {
  401. return false;
  402. } else {
  403. return list.indexOf(item) !== -1;
  404. }
  405. },
  406. set: function (newVal, item, list) {
  407. if (!list) {
  408. return;
  409. }
  410. if (!newVal) {
  411. var idx = list.indexOf(item);
  412. if (idx !== -1) {
  413. list.splice(idx, 1);
  414. }
  415. } else {
  416. list.push(item);
  417. }
  418. }
  419. });
  420. stache.registerConverter('string-to-any', {
  421. get: function (compute) {
  422. return '' + compute();
  423. },
  424. set: function (newVal, compute) {
  425. var converted = stringToAny(newVal);
  426. compute(converted);
  427. }
  428. });
  429. });
  430. /*can-stache-bindings@3.0.0-pre.12#can-stache-bindings*/
  431. define('can-stache-bindings@3.0.0-pre.12#can-stache-bindings', function (require, exports, module) {
  432. var expression = require('can-stache/src/expression');
  433. var viewCallbacks = require('can-view-callbacks');
  434. var live = require('can-view-live');
  435. var Scope = require('can-view-scope');
  436. var canViewModel = require('can-view-model');
  437. var canEvent = require('can-event');
  438. var canBatch = require('can-event/batch/batch');
  439. var compute = require('can-compute');
  440. var observeReader = require('can-observation/reader/reader');
  441. var assign = require('can-util/js/assign/assign');
  442. var makeArray = require('can-util/js/make-array/make-array');
  443. var each = require('can-util/js/each/each');
  444. var string = require('can-util/js/string/string');
  445. var dev = require('can-util/js/dev/dev');
  446. var isArray = require('can-util/js/is-array/is-array');
  447. var types = require('can-util/js/types/types');
  448. var last = require('can-util/js/last/last');
  449. var getMutationObserver = require('can-util/dom/mutation-observer/mutation-observer');
  450. var domEvents = require('can-util/dom/events/events');
  451. require('can-util/dom/events/removed/removed');
  452. var domData = require('can-util/dom/data/data');
  453. var attr = require('can-util/dom/attr/attr');
  454. require('./converters');
  455. var behaviors = {
  456. viewModel: function (el, tagData, makeViewModel, initialViewModelData) {
  457. initialViewModelData = initialViewModelData || {};
  458. var bindingsSemaphore = {}, viewModel, onCompleteBindings = [], onTeardowns = {}, bindingInfos = {}, attributeViewModelBindings = assign({}, initialViewModelData);
  459. each(makeArray(el.attributes), function (node) {
  460. var dataBinding = makeDataBinding(node, el, {
  461. templateType: tagData.templateType,
  462. scope: tagData.scope,
  463. semaphore: bindingsSemaphore,
  464. getViewModel: function () {
  465. return viewModel;
  466. },
  467. attributeViewModelBindings: attributeViewModelBindings,
  468. alreadyUpdatedChild: true,
  469. nodeList: tagData.parentNodeList
  470. });
  471. if (dataBinding) {
  472. if (dataBinding.onCompleteBinding) {
  473. if (dataBinding.bindingInfo.parentToChild && dataBinding.value !== undefined) {
  474. initialViewModelData[cleanVMName(dataBinding.bindingInfo.childName)] = dataBinding.value;
  475. }
  476. onCompleteBindings.push(dataBinding.onCompleteBinding);
  477. }
  478. onTeardowns[node.name] = dataBinding.onTeardown;
  479. }
  480. });
  481. viewModel = makeViewModel(initialViewModelData);
  482. for (var i = 0, len = onCompleteBindings.length; i < len; i++) {
  483. onCompleteBindings[i]();
  484. }
  485. domEvents.addEventListener.call(el, 'attributes', function (ev) {
  486. var attrName = ev.attributeName, value = el.getAttribute(attrName);
  487. if (onTeardowns[attrName]) {
  488. onTeardowns[attrName]();
  489. }
  490. var parentBindingWasAttribute = bindingInfos[attrName] && bindingInfos[attrName].parent === 'attribute';
  491. if (value !== null || parentBindingWasAttribute) {
  492. var dataBinding = makeDataBinding({
  493. name: attrName,
  494. value: value
  495. }, el, {
  496. templateType: tagData.templateType,
  497. scope: tagData.scope,
  498. semaphore: {},
  499. getViewModel: function () {
  500. return viewModel;
  501. },
  502. attributeViewModelBindings: attributeViewModelBindings,
  503. initializeValues: true,
  504. nodeList: tagData.parentNodeList
  505. });
  506. if (dataBinding) {
  507. if (dataBinding.onCompleteBinding) {
  508. dataBinding.onCompleteBinding();
  509. }
  510. bindingInfos[attrName] = dataBinding.bindingInfo;
  511. onTeardowns[attrName] = dataBinding.onTeardown;
  512. }
  513. }
  514. });
  515. return function () {
  516. for (var attrName in onTeardowns) {
  517. onTeardowns[attrName]();
  518. }
  519. };
  520. },
  521. data: function (el, attrData) {
  522. if (domData.get.call(el, 'preventDataBindings')) {
  523. return;
  524. }
  525. var viewModel = canViewModel(el), semaphore = {}, teardown;
  526. var dataBinding = makeDataBinding({
  527. name: attrData.attributeName,
  528. value: el.getAttribute(attrData.attributeName),
  529. nodeList: attrData.nodeList
  530. }, el, {
  531. templateType: attrData.templateType,
  532. scope: attrData.scope,
  533. semaphore: semaphore,
  534. getViewModel: function () {
  535. return viewModel;
  536. }
  537. });
  538. if (dataBinding.onCompleteBinding) {
  539. dataBinding.onCompleteBinding();
  540. }
  541. teardown = dataBinding.onTeardown;
  542. canEvent.one.call(el, 'removed', function () {
  543. teardown();
  544. });
  545. domEvents.addEventListener.call(el, 'attributes', function (ev) {
  546. var attrName = ev.attributeName, value = el.getAttribute(attrName);
  547. if (attrName === attrData.attributeName) {
  548. if (teardown) {
  549. teardown();
  550. }
  551. if (value !== null) {
  552. var dataBinding = makeDataBinding({
  553. name: attrName,
  554. value: value
  555. }, el, {
  556. templateType: attrData.templateType,
  557. scope: attrData.scope,
  558. semaphore: semaphore,
  559. getViewModel: function () {
  560. return viewModel;
  561. },
  562. initializeValues: true,
  563. nodeList: attrData.nodeList
  564. });
  565. if (dataBinding) {
  566. if (dataBinding.onCompleteBinding) {
  567. dataBinding.onCompleteBinding();
  568. }
  569. teardown = dataBinding.onTeardown;
  570. }
  571. }
  572. }
  573. });
  574. },
  575. reference: function (el, attrData) {
  576. if (el.getAttribute(attrData.attributeName)) {
  577. console.warn('*reference attributes can only export the view model.');
  578. }
  579. var name = string.camelize(attrData.attributeName.substr(1).toLowerCase());
  580. var viewModel = canViewModel(el);
  581. var refs = attrData.scope.getRefs();
  582. refs._context.attr('*' + name, viewModel);
  583. },
  584. event: function (el, data) {
  585. var attributeName = data.attributeName, legacyBinding = attributeName.indexOf('can-') === 0, event = attributeName.indexOf('can-') === 0 ? attributeName.substr('can-'.length) : removeBrackets(attributeName, '(', ')'), onBindElement = legacyBinding;
  586. if (event.charAt(0) === '$') {
  587. event = event.substr(1);
  588. onBindElement = true;
  589. }
  590. var handler = function (ev) {
  591. var attrVal = el.getAttribute(attributeName);
  592. if (!attrVal) {
  593. return;
  594. }
  595. var viewModel = canViewModel(el);
  596. var expr = expression.parse(removeBrackets(attrVal), {
  597. lookupRule: 'method',
  598. methodRule: 'call'
  599. });
  600. if (!(expr instanceof expression.Call) && !(expr instanceof expression.Helper)) {
  601. var defaultArgs = [
  602. data.scope._context,
  603. el
  604. ].concat(makeArray(arguments)).map(function (data) {
  605. return new expression.Arg(new expression.Literal(data));
  606. });
  607. expr = new expression.Call(expr, defaultArgs, {});
  608. }
  609. var scopeData = data.scope.read(expr.methodExpr.key, { isArgument: true });
  610. if (!scopeData.value) {
  611. scopeData = data.scope.read(expr.methodExpr.key, { isArgument: true });
  612. return null;
  613. }
  614. var localScope = data.scope.add({
  615. '@element': el,
  616. '@event': ev,
  617. '@viewModel': viewModel,
  618. '@scope': data.scope,
  619. '@context': data.scope._context,
  620. '%element': this,
  621. '$element': el,
  622. '%event': ev,
  623. '%viewModel': viewModel,
  624. '%scope': data.scope,
  625. '%context': data.scope._context
  626. }, { notContext: true });
  627. var args = expr.args(localScope, null)();
  628. return scopeData.value.apply(scopeData.parent, args);
  629. };
  630. if (special[event]) {
  631. var specialData = special[event](data, el, handler);
  632. handler = specialData.handler;
  633. event = specialData.event;
  634. }
  635. canEvent.on.call(onBindElement ? el : canViewModel(el), event, handler);
  636. var attributesHandler = function (ev) {
  637. if (ev.attributeName === attributeName && !this.getAttribute(attributeName)) {
  638. canEvent.off.call(onBindElement ? el : canViewModel(el), event, handler);
  639. canEvent.off.call(el, 'attributes', attributesHandler);
  640. }
  641. };
  642. canEvent.on.call(el, 'attributes', attributesHandler);
  643. },
  644. value: function (el, data) {
  645. var propName = '$value', attrValue = removeBrackets(el.getAttribute('can-value')).trim(), getterSetter;
  646. if (el.nodeName.toLowerCase() === 'input' && (el.type === 'checkbox' || el.type === 'radio')) {
  647. var property = getComputeFrom.scope(el, data.scope, attrValue, {}, true);
  648. if (el.type === 'checkbox') {
  649. var trueValue = attr.has(el, 'can-true-value') ? el.getAttribute('can-true-value') : true, falseValue = attr.has(el, 'can-false-value') ? el.getAttribute('can-false-value') : false;
  650. getterSetter = compute(function (newValue) {
  651. if (arguments.length) {
  652. property(newValue ? trueValue : falseValue);
  653. } else {
  654. return property() == trueValue;
  655. }
  656. });
  657. } else if (el.type === 'radio') {
  658. getterSetter = compute(function (newValue) {
  659. if (arguments.length) {
  660. if (newValue) {
  661. property(el.value);
  662. }
  663. } else {
  664. return property() == el.value;
  665. }
  666. });
  667. }
  668. propName = '$checked';
  669. attrValue = 'getterSetter';
  670. data.scope = new Scope({ getterSetter: getterSetter });
  671. } else if (isContentEditable(el)) {
  672. propName = '$innerHTML';
  673. }
  674. var dataBinding = makeDataBinding({
  675. name: '{(' + propName + '})',
  676. value: attrValue
  677. }, el, {
  678. templateType: data.templateType,
  679. scope: data.scope,
  680. semaphore: {},
  681. initializeValues: true,
  682. legacyBindings: true,
  683. syncChildWithParent: true
  684. });
  685. canEvent.one.call(el, 'removed', function () {
  686. dataBinding.onTeardown();
  687. });
  688. }
  689. };
  690. viewCallbacks.attr(/^\{[^\}]+\}$/, behaviors.data);
  691. viewCallbacks.attr(/\*[\w\.\-_]+/, behaviors.reference);
  692. viewCallbacks.attr(/^\([\$?\w\.]+\)$/, behaviors.event);
  693. viewCallbacks.attr(/can-[\w\.]+/, behaviors.event);
  694. viewCallbacks.attr('can-value', behaviors.value);
  695. var getComputeFrom = {
  696. scope: function (el, scope, scopeProp, bindingData, mustBeACompute, stickyCompute) {
  697. if (!scopeProp) {
  698. return compute();
  699. } else {
  700. if (mustBeACompute) {
  701. var parentExpression = expression.parse(scopeProp, { baseMethodType: 'Call' });
  702. return parentExpression.value(scope, new Scope.Options({}));
  703. } else {
  704. return function (newVal) {
  705. scope.attr(cleanVMName(scopeProp), newVal);
  706. };
  707. }
  708. }
  709. },
  710. viewModel: function (el, scope, vmName, bindingData, mustBeACompute, stickyCompute) {
  711. var setName = cleanVMName(vmName);
  712. if (mustBeACompute) {
  713. return compute(function (newVal) {
  714. var viewModel = bindingData.getViewModel();
  715. if (arguments.length) {
  716. if (types.isMapLike(viewModel)) {
  717. viewModel.attr(setName, newVal);
  718. } else {
  719. viewModel[setName] = newVal;
  720. }
  721. } else {
  722. return vmName === '.' ? viewModel : observeReader.read(viewModel, observeReader.reads(vmName), {}).value;
  723. }
  724. });
  725. } else {
  726. return function (newVal) {
  727. var viewModel = bindingData.getViewModel();
  728. if (types.isMapLike(viewModel)) {
  729. viewModel.attr(setName, newVal);
  730. } else {
  731. viewModel[setName] = newVal;
  732. }
  733. };
  734. }
  735. },
  736. attribute: function (el, scope, prop, bindingData, mustBeACompute, stickyCompute, event) {
  737. if (!event) {
  738. if (prop === 'innerHTML') {
  739. event = [
  740. 'blur',
  741. 'change'
  742. ];
  743. } else {
  744. event = 'change';
  745. }
  746. }
  747. if (!isArray(event)) {
  748. event = [event];
  749. }
  750. var hasChildren = el.nodeName.toLowerCase() === 'select', isMultiselectValue = prop === 'value' && hasChildren && el.multiple, isStringValue, lastSet, scheduledAsyncSet = false, timer, set = function (newVal) {
  751. if (hasChildren && !scheduledAsyncSet) {
  752. clearTimeout(timer);
  753. timer = setTimeout(function () {
  754. set(newVal);
  755. }, 1);
  756. }
  757. lastSet = newVal;
  758. if (isMultiselectValue) {
  759. if (newVal && typeof newVal === 'string') {
  760. newVal = newVal.split(';');
  761. isStringValue = true;
  762. } else if (newVal) {
  763. newVal = makeArray(newVal);
  764. } else {
  765. newVal = [];
  766. }
  767. var isSelected = {};
  768. each(newVal, function (val) {
  769. isSelected[val] = true;
  770. });
  771. each(el.childNodes, function (option) {
  772. if ('value' in option && 'selected' in option) {
  773. option.selected = !!isSelected[option.value];
  774. }
  775. });
  776. } else {
  777. if (!bindingData.legacyBindings && hasChildren && 'selectedIndex' in el && prop === 'value') {
  778. attr.setSelectValue(el, newVal);
  779. } else {
  780. attr.setAttrOrProp(el, prop, newVal == null ? '' : newVal);
  781. }
  782. }
  783. return newVal;
  784. }, get = function () {
  785. if (isMultiselectValue) {
  786. var values = [], children = el.childNodes;
  787. each(children, function (child) {
  788. if (child.selected && child.value) {
  789. values.push(child.value);
  790. }
  791. });
  792. return isStringValue ? values.join(';') : values;
  793. } else if (hasChildren && 'selectedIndex' in el && el.selectedIndex === -1) {
  794. return undefined;
  795. }
  796. return attr.get(el, prop);
  797. };
  798. if (hasChildren) {
  799. setTimeout(function () {
  800. scheduledAsyncSet = true;
  801. }, 1);
  802. }
  803. var observer;
  804. return compute(get(), {
  805. on: function (updater) {
  806. each(event, function (eventName) {
  807. canEvent.on.call(el, eventName, updater);
  808. });
  809. if (hasChildren) {
  810. var onMutation = function (mutations) {
  811. if (stickyCompute) {
  812. set(stickyCompute());
  813. }
  814. updater();
  815. };
  816. var MO = getMutationObserver();
  817. if (MO) {
  818. observer = new MO(onMutation);
  819. observer.observe(el, {
  820. childList: true,
  821. subtree: true
  822. });
  823. } else {
  824. domData.set.call(el, 'canBindingCallback', { onMutation: onMutation });
  825. }
  826. }
  827. },
  828. off: function (updater) {
  829. each(event, function (eventName) {
  830. canEvent.off.call(el, eventName, updater);
  831. });
  832. if (hasChildren) {
  833. if (getMutationObserver()) {
  834. observer.disconnect();
  835. } else {
  836. domData.clean.call(el, 'canBindingCallback');
  837. }
  838. }
  839. },
  840. get: get,
  841. set: set
  842. });
  843. }
  844. };
  845. var bind = {
  846. childToParent: function (el, parentCompute, childCompute, bindingsSemaphore, attrName, syncChild) {
  847. var parentUpdateIsFunction = typeof parentCompute === 'function';
  848. var updateParent = function (ev, newVal) {
  849. if (!bindingsSemaphore[attrName]) {
  850. if (parentUpdateIsFunction) {
  851. parentCompute(newVal);
  852. if (syncChild) {
  853. if (parentCompute() !== childCompute()) {
  854. bindingsSemaphore[attrName] = (bindingsSemaphore[attrName] || 0) + 1;
  855. childCompute(parentCompute());
  856. canBatch.after(function () {
  857. --bindingsSemaphore[attrName];
  858. });
  859. }
  860. }
  861. } else if (types.isMapLike(parentCompute)) {
  862. parentCompute.attr(newVal, true);
  863. }
  864. }
  865. };
  866. if (childCompute && childCompute.isComputed) {
  867. childCompute.bind('change', updateParent);
  868. }
  869. return updateParent;
  870. },
  871. parentToChild: function (el, parentCompute, childUpdate, bindingsSemaphore, attrName) {
  872. var updateChild = function (ev, newValue) {
  873. bindingsSemaphore[attrName] = (bindingsSemaphore[attrName] || 0) + 1;
  874. childUpdate(newValue);
  875. canBatch.after(function () {
  876. --bindingsSemaphore[attrName];
  877. });
  878. };
  879. if (parentCompute && parentCompute.isComputed) {
  880. parentCompute.bind('change', updateChild);
  881. }
  882. return updateChild;
  883. }
  884. };
  885. var getBindingInfo = function (node, attributeViewModelBindings, templateType, tagName) {
  886. var attributeName = node.name, attributeValue = node.value || '';
  887. var matches = attributeName.match(bindingsRegExp);
  888. if (!matches) {
  889. var ignoreAttribute = ignoreAttributesRegExp.test(attributeName);
  890. var vmName = string.camelize(attributeName);
  891. if (ignoreAttribute || viewCallbacks.attr(attributeName)) {
  892. return;
  893. }
  894. var syntaxRight = attributeValue[0] === '{' && last(attributeValue) === '}';
  895. var isAttributeToChild = templateType === 'legacy' ? attributeViewModelBindings[vmName] : !syntaxRight;
  896. var scopeName = syntaxRight ? attributeValue.substr(1, attributeValue.length - 2) : attributeValue;
  897. if (isAttributeToChild) {
  898. return {
  899. bindingAttributeName: attributeName,
  900. parent: 'attribute',
  901. parentName: attributeName,
  902. child: 'viewModel',
  903. childName: vmName,
  904. parentToChild: true,
  905. childToParent: true
  906. };
  907. } else {
  908. return {
  909. bindingAttributeName: attributeName,
  910. parent: 'scope',
  911. parentName: scopeName,
  912. child: 'viewModel',
  913. childName: vmName,
  914. parentToChild: true,
  915. childToParent: true
  916. };
  917. }
  918. }
  919. var twoWay = !!matches[1], childToParent = twoWay || !!matches[2], parentToChild = twoWay || !childToParent;
  920. var childName = matches[3];
  921. var isDOM = childName.charAt(0) === '$';
  922. if (isDOM) {
  923. var bindingInfo = {
  924. parent: 'scope',
  925. child: 'attribute',
  926. childToParent: childToParent,
  927. parentToChild: parentToChild,
  928. bindingAttributeName: attributeName,
  929. childName: childName.substr(1),
  930. parentName: attributeValue,
  931. initializeValues: true
  932. };
  933. if (tagName === 'select') {
  934. bindingInfo.stickyParentToChild = true;
  935. }
  936. return bindingInfo;
  937. } else {
  938. return {
  939. parent: 'scope',
  940. child: 'viewModel',
  941. childToParent: childToParent,
  942. parentToChild: parentToChild,
  943. bindingAttributeName: attributeName,
  944. childName: string.camelize(childName),
  945. parentName: attributeValue,
  946. initializeValues: true
  947. };
  948. }
  949. };
  950. var bindingsRegExp = /\{(\()?(\^)?([^\}\)]+)\)?\}/, ignoreAttributesRegExp = /^(data-view-id|class|id|\[[\w\.-]+\]|#[\w\.-])$/i;
  951. var makeDataBinding = function (node, el, bindingData) {
  952. var bindingInfo = getBindingInfo(node, bindingData.attributeViewModelBindings, bindingData.templateType, el.nodeName.toLowerCase());
  953. if (!bindingInfo) {
  954. return;
  955. }
  956. bindingInfo.alreadyUpdatedChild = bindingData.alreadyUpdatedChild;
  957. if (bindingData.initializeValues) {
  958. bindingInfo.initializeValues = true;
  959. }
  960. var parentCompute = getComputeFrom[bindingInfo.parent](el, bindingData.scope, bindingInfo.parentName, bindingData, bindingInfo.parentToChild), childCompute = getComputeFrom[bindingInfo.child](el, bindingData.scope, bindingInfo.childName, bindingData, bindingInfo.childToParent, bindingInfo.stickyParentToChild && parentCompute), updateParent, updateChild, childLifecycle;
  961. if (bindingData.nodeList) {
  962. if (parentCompute && parentCompute.isComputed) {
  963. parentCompute.computeInstance.setPrimaryDepth(bindingData.nodeList.nesting + 1);
  964. }
  965. if (childCompute && childCompute.isComputed) {
  966. childCompute.computeInstance.setPrimaryDepth(bindingData.nodeList.nesting + 1);
  967. }
  968. }
  969. if (bindingInfo.parentToChild) {
  970. updateChild = bind.parentToChild(el, parentCompute, childCompute, bindingData.semaphore, bindingInfo.bindingAttributeName);
  971. }
  972. var completeBinding = function () {
  973. if (bindingInfo.childToParent) {
  974. updateParent = bind.childToParent(el, parentCompute, childCompute, bindingData.semaphore, bindingInfo.bindingAttributeName, bindingData.syncChildWithParent);
  975. } else if (bindingInfo.stickyParentToChild) {
  976. childCompute.bind('change', childLifecycle = function () {
  977. });
  978. }
  979. if (bindingInfo.initializeValues) {
  980. initializeValues(bindingInfo, childCompute, parentCompute, updateChild, updateParent);
  981. }
  982. };
  983. var onTeardown = function () {
  984. unbindUpdate(parentCompute, updateChild);
  985. unbindUpdate(childCompute, updateParent);
  986. unbindUpdate(childCompute, childLifecycle);
  987. };
  988. if (bindingInfo.child === 'viewModel') {
  989. return {
  990. value: getValue(parentCompute),
  991. onCompleteBinding: completeBinding,
  992. bindingInfo: bindingInfo,
  993. onTeardown: onTeardown
  994. };
  995. } else {
  996. completeBinding();
  997. return {
  998. bindingInfo: bindingInfo,
  999. onTeardown: onTeardown
  1000. };
  1001. }
  1002. };
  1003. var initializeValues = function (bindingInfo, childCompute, parentCompute, updateChild, updateParent) {
  1004. var doUpdateParent = false;
  1005. if (bindingInfo.parentToChild && !bindingInfo.childToParent) {
  1006. } else if (!bindingInfo.parentToChild && bindingInfo.childToParent) {
  1007. doUpdateParent = true;
  1008. } else if (getValue(childCompute) === undefined) {
  1009. } else if (getValue(parentCompute) === undefined) {
  1010. doUpdateParent = true;
  1011. }
  1012. if (doUpdateParent) {
  1013. updateParent({}, getValue(childCompute));
  1014. } else {
  1015. if (!bindingInfo.alreadyUpdatedChild) {
  1016. updateChild({}, getValue(parentCompute));
  1017. }
  1018. }
  1019. };
  1020. if (!getMutationObserver()) {
  1021. var updateSelectValue = function (el) {
  1022. var bindingCallback = domData.get.call(el, 'canBindingCallback');
  1023. if (bindingCallback) {
  1024. bindingCallback.onMutation(el);
  1025. }
  1026. };
  1027. live.registerChildMutationCallback('select', updateSelectValue);
  1028. live.registerChildMutationCallback('optgroup', function (el) {
  1029. updateSelectValue(el.parentNode);
  1030. });
  1031. }
  1032. var isContentEditable = function () {
  1033. var values = {
  1034. '': true,
  1035. 'true': true,
  1036. 'false': false
  1037. };
  1038. var editable = function (el) {
  1039. if (!el || !el.getAttribute) {
  1040. return;
  1041. }
  1042. var attr = el.getAttribute('contenteditable');
  1043. return values[attr];
  1044. };
  1045. return function (el) {
  1046. var val = editable(el);
  1047. if (typeof val === 'boolean') {
  1048. return val;
  1049. } else {
  1050. return !!editable(el.parentNode);
  1051. }
  1052. };
  1053. }(), removeBrackets = function (value, open, close) {
  1054. open = open || '{';
  1055. close = close || '}';
  1056. if (value[0] === open && value[value.length - 1] === close) {
  1057. return value.substr(1, value.length - 2);
  1058. }
  1059. return value;
  1060. }, getValue = function (value) {
  1061. return value && value.isComputed ? value() : value;
  1062. }, unbindUpdate = function (compute, updateOther) {
  1063. if (compute && compute.isComputed && typeof updateOther === 'function') {
  1064. compute.unbind('change', updateOther);
  1065. }
  1066. }, cleanVMName = function (name) {
  1067. return name.replace(/@/g, '');
  1068. };
  1069. var special = {
  1070. enter: function (data, el, original) {
  1071. return {
  1072. event: 'keyup',
  1073. handler: function (ev) {
  1074. if (ev.keyCode === 13) {
  1075. return original.call(this, ev);
  1076. }
  1077. }
  1078. };
  1079. }
  1080. };
  1081. module.exports = {
  1082. behaviors: behaviors,
  1083. getBindingInfo: getBindingInfo,
  1084. special: special
  1085. };
  1086. });
  1087. /*can-util@3.0.0-pre.33#dom/events/inserted/inserted*/
  1088. define('can-util@3.0.0-pre.33#dom/events/inserted/inserted', function (require, exports, module) {
  1089. var makeMutationEvent = require('../make-mutation-event/make-mutation-event');
  1090. makeMutationEvent('inserted', 'addedNodes');
  1091. });
  1092. /*can-component@3.0.0-pre.14#can-component*/
  1093. define('can-component@3.0.0-pre.14#can-component', function (require, exports, module) {
  1094. var ComponentControl = require('./control/control');
  1095. var namespace = require('can-util/namespace');
  1096. var Construct = require('can-construct');
  1097. var stacheBindings = require('can-stache-bindings');
  1098. var Scope = require('can-view-scope');
  1099. var viewCallbacks = require('can-view-callbacks');
  1100. var nodeLists = require('can-view-nodelist');
  1101. var domData = require('can-util/dom/data/data');
  1102. var domMutate = require('can-util/dom/mutate/mutate');
  1103. var getChildNodes = require('can-util/dom/child-nodes/child-nodes');
  1104. var domDispatch = require('can-util/dom/dispatch/dispatch');
  1105. var types = require('can-util/js/types/types');
  1106. var assign = require('can-util/js/assign/assign');
  1107. var canEach = require('can-util/js/each/each');
  1108. var isFunction = require('can-util/js/is-function/is-function');
  1109. require('can-util/dom/events/inserted/inserted');
  1110. require('can-util/dom/events/removed/removed');
  1111. require('can-view-model');
  1112. var Component = Construct.extend({
  1113. setup: function () {
  1114. Construct.setup.apply(this, arguments);
  1115. if (Component) {
  1116. var self = this;
  1117. this.Control = ComponentControl.extend(this.prototype.events);
  1118. var protoViewModel = this.prototype.viewModel || this.prototype.scope;
  1119. if (protoViewModel && this.prototype.ViewModel) {
  1120. throw new Error('Cannot provide both a ViewModel and a viewModel property');
  1121. }
  1122. if (protoViewModel && types.isMapLike(protoViewModel.prototype)) {
  1123. this.prototype.viewModel = this.prototype.scope = undefined;
  1124. } else {
  1125. protoViewModel = undefined;
  1126. }
  1127. this.ViewModel = this.prototype.ViewModel || protoViewModel || types.DefaultMap;
  1128. if (this.prototype.template || this.prototype.view) {
  1129. this.renderer = this.prototype.view || this.prototype.template;
  1130. }
  1131. viewCallbacks.tag(this.prototype.tag, function (el, options) {
  1132. new self(el, options);
  1133. });
  1134. }
  1135. }
  1136. }, {
  1137. setup: function (el, componentTagData) {
  1138. var component = this;
  1139. var lexicalContent = (typeof this.leakScope === 'undefined' ? true : !this.leakScope) && !!(this.template || this.view);
  1140. var teardownFunctions = [];
  1141. var initialViewModelData = {};
  1142. var callTeardownFunctions = function () {
  1143. for (var i = 0, len = teardownFunctions.length; i < len; i++) {
  1144. teardownFunctions[i]();
  1145. }
  1146. };
  1147. var setupBindings = !domData.get.call(el, 'preventDataBindings');
  1148. var viewModel, frag;
  1149. var teardownBindings;
  1150. if (setupBindings) {
  1151. var setupFn = componentTagData.setupBindings || function (el, callback, data) {
  1152. return stacheBindings.behaviors.viewModel(el, componentTagData, callback, data);
  1153. };
  1154. teardownBindings = setupFn(el, function (initialViewModelData) {
  1155. initialViewModelData['%root'] = componentTagData.scope.attr('%root');
  1156. var protoViewModel = component.scope || component.viewModel;
  1157. if (typeof protoViewModel === 'function') {
  1158. var scopeResult = protoViewModel.call(component, initialViewModelData, componentTagData.scope, el);
  1159. viewModel = scopeResult;
  1160. } else if (protoViewModel instanceof types.DefaultMap) {
  1161. viewModel = protoViewModel;
  1162. } else {
  1163. var scopeData = assign(assign({}, initialViewModelData), protoViewModel);
  1164. viewModel = new component.constructor.ViewModel(scopeData);
  1165. }
  1166. return viewModel;
  1167. }, initialViewModelData);
  1168. }
  1169. this.scope = this.viewModel = viewModel;
  1170. domData.set.call(el, 'viewModel', viewModel);
  1171. domData.set.call(el, 'preventDataBindings', true);
  1172. var shadowScope;
  1173. if (lexicalContent) {
  1174. shadowScope = Scope.refsScope().add(this.viewModel, { viewModel: true });
  1175. } else {
  1176. shadowScope = (this.constructor.renderer ? componentTagData.scope.add(new Scope.Refs()) : componentTagData.scope).add(this.viewModel, { viewModel: true });
  1177. }
  1178. var options = { helpers: {} }, addHelper = function (name, fn) {
  1179. options.helpers[name] = function () {
  1180. return fn.apply(viewModel, arguments);
  1181. };
  1182. };
  1183. canEach(this.helpers || {}, function (val, prop) {
  1184. if (isFunction(val)) {
  1185. addHelper(prop, val);
  1186. }
  1187. });
  1188. this._control = new this.constructor.Control(el, {
  1189. scope: this.viewModel,
  1190. viewModel: this.viewModel,
  1191. destroy: callTeardownFunctions
  1192. });
  1193. var nodeList = nodeLists.register([], function () {
  1194. domDispatch.call(el, 'beforeremove', [], false);
  1195. if (teardownBindings) {
  1196. teardownBindings();
  1197. }
  1198. }, componentTagData.parentNodeList || true, false);
  1199. nodeList.expression = '<' + this.tag + '>';
  1200. teardownFunctions.push(function () {
  1201. nodeLists.unregister(nodeList);
  1202. });
  1203. if (this.constructor.renderer) {
  1204. if (!options.tags) {
  1205. options.tags = {};
  1206. }
  1207. options.tags.content = function contentHookup(el, contentTagData) {
  1208. var subtemplate = componentTagData.subtemplate || contentTagData.subtemplate, renderingLightContent = subtemplate === componentTagData.subtemplate;
  1209. if (subtemplate) {
  1210. delete options.tags.content;
  1211. var lightTemplateData;
  1212. if (renderingLightContent) {
  1213. if (lexicalContent) {
  1214. lightTemplateData = componentTagData;
  1215. } else {
  1216. lightTemplateData = {
  1217. scope: contentTagData.scope.cloneFromRef(),
  1218. options: contentTagData.options
  1219. };
  1220. }
  1221. } else {
  1222. lightTemplateData = contentTagData;
  1223. }
  1224. if (contentTagData.parentNodeList) {
  1225. var frag = subtemplate(lightTemplateData.scope, lightTemplateData.options, contentTagData.parentNodeList);
  1226. nodeLists.replace([el], frag);
  1227. } else {
  1228. nodeLists.replace([el], subtemplate(lightTemplateData.scope, lightTemplateData.options));
  1229. }
  1230. options.tags.content = contentHookup;
  1231. }
  1232. };
  1233. frag = this.constructor.renderer(shadowScope, componentTagData.options.add(options), nodeList);
  1234. } else {
  1235. frag = componentTagData.subtemplate ? componentTagData.subtemplate(shadowScope, componentTagData.options.add(options), nodeList) : document.createDocumentFragment();
  1236. }
  1237. domMutate.appendChild.call(el, frag);
  1238. nodeLists.update(nodeList, getChildNodes(el));
  1239. }
  1240. });
  1241. viewCallbacks.tag('content', function (el, tagData) {
  1242. return tagData.scope;
  1243. });
  1244. module.exports = namespace.Component = Component;
  1245. });
  1246. /*can-define@0.7.17#can-define*/
  1247. define('can-define@0.7.17#can-define', function (require, exports, module) {
  1248. 'use strict';
  1249. 'format cjs';
  1250. var event = require('can-event');
  1251. var eventLifecycle = require('can-event/lifecycle/lifecycle');
  1252. var canBatch = require('can-event/batch/batch');
  1253. var compute = require('can-compute');
  1254. var Observation = require('can-observation');
  1255. var canEach = require('can-util/js/each/each');
  1256. var isEmptyObject = require('can-util/js/is-empty-object/is-empty-object');
  1257. var assign = require('can-util/js/assign/assign');
  1258. var dev = require('can-util/js/dev/dev');
  1259. var CID = require('can-util/js/cid/cid');
  1260. var isPlainObject = require('can-util/js/is-plain-object/is-plain-object');
  1261. var isArray = require('can-util/js/is-array/is-array');
  1262. var types = require('can-util/js/types/types');
  1263. var each = require('can-util/js/each/each');
  1264. var ns = require('can-util/namespace');
  1265. var behaviors, eventsProto, getPropDefineBehavior, define, make, makeDefinition, replaceWith, getDefinitionsAndMethods, isDefineType, getDefinitionOrMethod;
  1266. module.exports = define = ns.define = function (objPrototype, defines) {
  1267. var dataInitializers = {}, computedInitializers = {};
  1268. var result = getDefinitionsAndMethods(defines);
  1269. canEach(result.definitions, function (definition, property) {
  1270. define.property(objPrototype, property, definition, dataInitializers, computedInitializers);
  1271. });
  1272. replaceWith(objPrototype, '_data', function () {
  1273. var map = this;
  1274. var data = {};
  1275. for (var prop in dataInitializers) {
  1276. replaceWith(data, prop, dataInitializers[prop].bind(map), true);
  1277. }
  1278. return data;
  1279. });
  1280. replaceWith(objPrototype, '_computed', function () {
  1281. var map = this;
  1282. var data = {};
  1283. for (var prop in computedInitializers) {
  1284. replaceWith(data, prop, computedInitializers[prop].bind(map));
  1285. }
  1286. return data;
  1287. });
  1288. for (var prop in eventsProto) {
  1289. Object.defineProperty(objPrototype, prop, {
  1290. enumerable: false,
  1291. value: eventsProto[prop],
  1292. configurable: true,
  1293. writable: true
  1294. });
  1295. }
  1296. Object.defineProperty(objPrototype, '_define', {
  1297. enumerable: false,
  1298. value: result,
  1299. configurable: true,
  1300. writable: true
  1301. });
  1302. return result;
  1303. };
  1304. define.property = function (objPrototype, prop, definition, dataInitializers, computedInitializers) {
  1305. var type = definition.type;
  1306. delete definition.type;
  1307. if (type && isEmptyObject(definition) && type === define.types['*']) {
  1308. definition.type = type;
  1309. Object.defineProperty(objPrototype, prop, {
  1310. get: make.get.data(prop),
  1311. set: make.set.events(prop, make.get.data(prop), make.set.data(prop), make.eventType.data(prop)),
  1312. enumerable: true
  1313. });
  1314. return;
  1315. }
  1316. definition.type = type;
  1317. var dataProperty = definition.get ? 'computed' : 'data', reader = make.read[dataProperty](prop), getter = make.get[dataProperty](prop), setter = make.set[dataProperty](prop), getInitialValue;
  1318. var typeConvert = function (val) {
  1319. return val;
  1320. };
  1321. if (definition.Type) {
  1322. typeConvert = make.set.Type(prop, definition.Type, typeConvert);
  1323. }
  1324. if (type) {
  1325. typeConvert = make.set.type(prop, type, typeConvert);
  1326. }
  1327. if (definition.value !== undefined || definition.Value !== undefined) {
  1328. getInitialValue = make.get.defaultValue(prop, definition, typeConvert);
  1329. }
  1330. if (definition.get) {
  1331. computedInitializers[prop] = make.compute(prop, definition.get, getInitialValue);
  1332. } else if (getInitialValue) {
  1333. dataInitializers[prop] = getInitialValue;
  1334. }
  1335. if (definition.get && definition.set) {
  1336. setter = make.set.setter(prop, definition.set, make.read.lastSet(prop), setter, true);
  1337. } else if (definition.set) {
  1338. setter = make.set.events(prop, reader, setter, make.eventType[dataProperty](prop));
  1339. setter = make.set.setter(prop, definition.set, reader, setter, false);
  1340. } else if (!definition.get) {
  1341. setter = make.set.events(prop, reader, setter, make.eventType[dataProperty](prop));
  1342. }
  1343. if (type) {
  1344. setter = make.set.type(prop, type, setter);
  1345. }
  1346. if (definition.Type) {
  1347. setter = make.set.Type(prop, definition.Type, setter);
  1348. }
  1349. Object.defineProperty(objPrototype, prop, {
  1350. get: getter,
  1351. set: setter,
  1352. enumerable: 'serialize' in definition ? !!definition.serialize : !definition.get
  1353. });
  1354. };
  1355. define.Constructor = function (defines) {
  1356. var constructor = function (props) {
  1357. define.setup.call(this, props);
  1358. };
  1359. define(constructor.prototype, defines);
  1360. return constructor;
  1361. };
  1362. make = {
  1363. compute: function (prop, get, defaultValue) {
  1364. return function () {
  1365. var map = this;
  1366. return {
  1367. compute: compute.async(defaultValue && defaultValue(), get, map),
  1368. count: 0,
  1369. handler: function (ev, newVal, oldVal) {
  1370. canBatch.trigger.call(map, {
  1371. type: prop,
  1372. target: map
  1373. }, [
  1374. newVal,
  1375. oldVal
  1376. ]);
  1377. }
  1378. };
  1379. };
  1380. },
  1381. set: {
  1382. data: function (prop) {
  1383. return function (newVal) {
  1384. this._data[prop] = newVal;
  1385. };
  1386. },
  1387. computed: function (prop) {
  1388. return function (val) {
  1389. this._computed[prop].compute(val);
  1390. };
  1391. },
  1392. events: function (prop, getCurrent, setData, eventType) {
  1393. return function (newVal) {
  1394. var current = getCurrent.call(this);
  1395. if (newVal !== current) {
  1396. setData.call(this, newVal);
  1397. canBatch.trigger.call(this, {
  1398. type: prop,
  1399. target: this
  1400. }, [
  1401. newVal,
  1402. current
  1403. ]);
  1404. }
  1405. };
  1406. },
  1407. setter: function (prop, setter, getCurrent, setEvents, hasGetter) {
  1408. return function (value) {
  1409. var self = this;
  1410. canBatch.start();
  1411. var setterCalled = false, current = getCurrent.call(this), setValue = setter.call(this, value, function (value) {
  1412. setEvents.call(self, value);
  1413. setterCalled = true;
  1414. }, current);
  1415. if (setterCalled) {
  1416. canBatch.stop();
  1417. } else {
  1418. if (hasGetter) {
  1419. if (setValue !== undefined) {
  1420. if (current !== setValue) {
  1421. setEvents.call(this, setValue);
  1422. }
  1423. canBatch.stop();
  1424. } else if (setter.length === 0) {
  1425. setEvents.call(this, value);
  1426. canBatch.stop();
  1427. return;
  1428. } else if (setter.length === 1) {
  1429. canBatch.stop();
  1430. } else {
  1431. canBatch.stop();
  1432. return;
  1433. }
  1434. } else {
  1435. if (setValue !== undefined) {
  1436. setEvents.call(this, setValue);
  1437. canBatch.stop();
  1438. } else if (setter.length === 0) {
  1439. setEvents.call(this, value);
  1440. canBatch.stop();
  1441. return;
  1442. } else if (setter.length === 1) {
  1443. setEvents.call(this, undefined);
  1444. canBatch.stop();
  1445. } else {
  1446. canBatch.stop();
  1447. return;
  1448. }
  1449. }
  1450. }
  1451. };
  1452. },
  1453. type: function (prop, type, set) {
  1454. if (typeof type === 'object') {
  1455. return make.set.Type(prop, type, set);
  1456. } else {
  1457. return function (newValue) {
  1458. return set.call(this, type.call(this, newValue, prop));
  1459. };
  1460. }
  1461. },
  1462. Type: function (prop, Type, set) {
  1463. if (isArray(Type) && types.DefineList) {
  1464. Type = types.DefineList.extend({ '*': Type[0] });
  1465. } else if (typeof Type === 'object') {
  1466. if (types.DefineMap) {
  1467. Type = types.DefineMap.extend(Type);
  1468. } else {
  1469. Type = define.constructor(Type);
  1470. }
  1471. }
  1472. return function (newValue) {
  1473. if (newValue instanceof Type) {
  1474. return set.call(this, newValue);
  1475. } else {
  1476. return set.call(this, new Type(newValue));
  1477. }
  1478. };
  1479. }
  1480. },
  1481. eventType: {
  1482. data: function (prop) {
  1483. return function (newVal, oldVal) {
  1484. return oldVal !== undefined || this._data.hasOwnProperty(prop) ? 'set' : 'add';
  1485. };
  1486. },
  1487. computed: function () {
  1488. return function () {
  1489. return 'set';
  1490. };
  1491. }
  1492. },
  1493. read: {
  1494. data: function (prop) {
  1495. return function () {
  1496. return this._data[prop];
  1497. };
  1498. },
  1499. computed: function (prop) {
  1500. return function () {
  1501. return this._computed[prop].compute();
  1502. };
  1503. },
  1504. lastSet: function (prop) {
  1505. return function () {
  1506. return this._computed[prop].compute.computeInstance.lastSetValue.get();
  1507. };
  1508. }
  1509. },
  1510. get: {
  1511. defaultValue: function (prop, definition, typeConvert) {
  1512. return function () {
  1513. var value = definition.value;
  1514. if (value !== undefined) {
  1515. if (typeof value === 'function') {
  1516. value = value.call(this);
  1517. }
  1518. return typeConvert(value);
  1519. }
  1520. var Value = definition.Value;
  1521. if (Value) {
  1522. return typeConvert(new Value());
  1523. }
  1524. };
  1525. },
  1526. data: function (prop) {
  1527. return function () {
  1528. Observation.add(this, prop);
  1529. return this._data[prop];
  1530. };
  1531. },
  1532. computed: function (prop) {
  1533. return function () {
  1534. return this._computed[prop].compute();
  1535. };
  1536. }
  1537. }
  1538. };
  1539. behaviors = [
  1540. 'get',
  1541. 'set',
  1542. 'value',
  1543. 'Value',
  1544. 'type',
  1545. 'Type',
  1546. 'serialize'
  1547. ];
  1548. getPropDefineBehavior = function (behaviorName, prop, def, defaultDefinition) {
  1549. if (behaviorName in def) {
  1550. return def[behaviorName];
  1551. } else {
  1552. return defaultDefinition[behaviorName];
  1553. }
  1554. };
  1555. makeDefinition = function (prop, def, defaultDefinition) {
  1556. var definition = {};
  1557. behaviors.forEach(function (behavior) {
  1558. var behaviorDef = getPropDefineBehavior(behavior, prop, def, defaultDefinition);
  1559. if (behaviorDef !== undefined) {
  1560. if (behavior === 'type' && typeof behaviorDef === 'string') {
  1561. behaviorDef = define.types[behaviorDef];
  1562. }
  1563. definition[behavior] = behaviorDef;
  1564. }
  1565. });
  1566. if (isEmptyObject(definition)) {
  1567. definition.type = define.types['*'];
  1568. }
  1569. return definition;
  1570. };
  1571. getDefinitionOrMethod = function (prop, value, defaultDefinition) {
  1572. var definition;
  1573. if (typeof value === 'string') {
  1574. definition = { type: value };
  1575. } else if (typeof value === 'function') {
  1576. if (types.isConstructor(value)) {
  1577. definition = { Type: value };
  1578. } else if (isDefineType(value)) {
  1579. definition = { type: value };
  1580. }
  1581. } else if (isPlainObject(value)) {
  1582. definition = value;
  1583. }
  1584. if (definition) {
  1585. return makeDefinition(prop, definition, defaultDefinition);
  1586. } else {
  1587. return value;
  1588. }
  1589. };
  1590. getDefinitionsAndMethods = function (defines) {
  1591. var definitions = {};
  1592. var methods = {};
  1593. var defaults = defines['*'], defaultDefinition;
  1594. if (defaults) {
  1595. delete defines['*'];
  1596. defaultDefinition = getDefinitionOrMethod('*', defaults, {});
  1597. } else {
  1598. defaultDefinition = {};
  1599. }
  1600. canEach(defines, function (value, prop) {
  1601. if (prop === 'constructor') {
  1602. methods[prop] = value;
  1603. return;
  1604. } else {
  1605. var result = getDefinitionOrMethod(prop, value, defaultDefinition);
  1606. if (result && typeof result === 'object') {
  1607. definitions[prop] = result;
  1608. } else {
  1609. methods[prop] = result;
  1610. }
  1611. }
  1612. });
  1613. if (defaults) {
  1614. defines['*'] = defaults;
  1615. }
  1616. return {
  1617. definitions: definitions,
  1618. methods: methods,
  1619. defaultDefinition: defaultDefinition
  1620. };
  1621. };
  1622. replaceWith = function (obj, prop, cb, writable) {
  1623. Object.defineProperty(obj, prop, {
  1624. configurable: true,
  1625. get: function () {
  1626. var value = cb.call(this, obj, prop);
  1627. Object.defineProperty(this, prop, {
  1628. value: value,
  1629. writable: !!writable
  1630. });
  1631. return value;
  1632. }
  1633. });
  1634. };
  1635. eventsProto = assign({}, event);
  1636. assign(eventsProto, {
  1637. _eventSetup: function () {
  1638. },
  1639. _eventTeardown: function () {
  1640. },
  1641. addEventListener: function (eventName, handler) {
  1642. var computedBinding = this._computed && this._computed[eventName];
  1643. if (computedBinding && computedBinding.compute) {
  1644. if (!computedBinding.count) {
  1645. computedBinding.count = 1;
  1646. computedBinding.compute.addEventListener('change', computedBinding.handler);
  1647. } else {
  1648. computedBinding.count++;
  1649. }
  1650. }
  1651. return eventLifecycle.addAndSetup.apply(this, arguments);
  1652. },
  1653. removeEventListener: function (eventName, handler) {
  1654. var computedBinding = this._computed && this._computed[eventName];
  1655. if (computedBinding) {
  1656. if (computedBinding.count === 1) {
  1657. computedBinding.count = 0;
  1658. computedBinding.compute.removeEventListener('change', computedBinding.handler);
  1659. } else {
  1660. computedBinding.count--;
  1661. }
  1662. }
  1663. return eventLifecycle.removeAndTeardown.apply(this, arguments);
  1664. }
  1665. });
  1666. eventsProto.on = eventsProto.bind = eventsProto.addEventListener;
  1667. eventsProto.off = eventsProto.unbind = eventsProto.removeEventListener;
  1668. delete eventsProto.one;
  1669. var defineConfigurableAndNotEnumerable = function (obj, prop, value) {
  1670. Object.defineProperty(obj, prop, {
  1671. configurable: true,
  1672. enumerable: false,
  1673. writable: true,
  1674. value: value
  1675. });
  1676. };
  1677. define.setup = function (props, sealed) {
  1678. defineConfigurableAndNotEnumerable(this, '_cid');
  1679. defineConfigurableAndNotEnumerable(this, '__bindEvents', {});
  1680. defineConfigurableAndNotEnumerable(this, '_bindings', 0);
  1681. CID(this);
  1682. var definitions = this._define.definitions;
  1683. var instanceDefinitions = {};
  1684. var map = this;
  1685. each(props, function (value, prop) {
  1686. if (definitions[prop]) {
  1687. map[prop] = value;
  1688. } else {
  1689. var def = define.makeSimpleGetterSetter(prop);
  1690. instanceDefinitions[prop] = {};
  1691. Object.defineProperty(map, prop, def);
  1692. map[prop] = define.types.observable(value);
  1693. }
  1694. });
  1695. if (!isEmptyObject(instanceDefinitions)) {
  1696. defineConfigurableAndNotEnumerable(this, '_instanceDefinitions', instanceDefinitions);
  1697. }
  1698. };
  1699. define.replaceWith = replaceWith;
  1700. define.eventsProto = eventsProto;
  1701. define.defineConfigurableAndNotEnumerable = defineConfigurableAndNotEnumerable;
  1702. define.make = make;
  1703. define.getDefinitionOrMethod = getDefinitionOrMethod;
  1704. var simpleGetterSetters = {};
  1705. define.makeSimpleGetterSetter = function (prop) {
  1706. if (!simpleGetterSetters[prop]) {
  1707. var setter = make.set.events(prop, make.get.data(prop), make.set.data(prop), make.eventType.data(prop));
  1708. simpleGetterSetters[prop] = {
  1709. get: make.get.data(prop),
  1710. set: function (newVal) {
  1711. return setter.call(this, define.types.observable(newVal));
  1712. },
  1713. enumerable: true
  1714. };
  1715. }
  1716. return simpleGetterSetters[prop];
  1717. };
  1718. isDefineType = function (func) {
  1719. return func && func.canDefineType === true;
  1720. };
  1721. define.types = {
  1722. 'date': function (str) {
  1723. var type = typeof str;
  1724. if (type === 'string') {
  1725. str = Date.parse(str);
  1726. return isNaN(str) ? null : new Date(str);
  1727. } else if (type === 'number') {
  1728. return new Date(str);
  1729. } else {
  1730. return str;
  1731. }
  1732. },
  1733. 'number': function (val) {
  1734. if (val == null) {
  1735. return val;
  1736. }
  1737. return +val;
  1738. },
  1739. 'boolean': function (val) {
  1740. if (val === 'false' || val === '0' || !val) {
  1741. return false;
  1742. }
  1743. return true;
  1744. },
  1745. 'observable': function (newVal) {
  1746. if (isArray(newVal) && types.DefineList) {
  1747. newVal = new types.DefineList(newVal);
  1748. } else if (isPlainObject(newVal) && types.DefineMap) {
  1749. newVal = new types.DefineMap(newVal);
  1750. }
  1751. return newVal;
  1752. },
  1753. 'stringOrObservable': function (newVal) {
  1754. if (isArray(newVal)) {
  1755. return new types.DefaultList(newVal);
  1756. } else if (isPlainObject(newVal)) {
  1757. return new types.DefaultMap(newVal);
  1758. } else {
  1759. return define.types.string(newVal);
  1760. }
  1761. },
  1762. 'htmlbool': function (val) {
  1763. return typeof val === 'string' || !!val;
  1764. },
  1765. '*': function (val) {
  1766. return val;
  1767. },
  1768. 'any': function (val) {
  1769. return val;
  1770. },
  1771. 'string': function (val) {
  1772. if (val == null) {
  1773. return val;
  1774. }
  1775. return '' + val;
  1776. },
  1777. 'compute': {
  1778. set: function (newValue, setVal, setErr, oldValue) {
  1779. if (newValue.isComputed) {
  1780. return newValue;
  1781. }
  1782. if (oldValue && oldValue.isComputed) {
  1783. oldValue(newValue);
  1784. return oldValue;
  1785. }
  1786. return newValue;
  1787. },
  1788. get: function (value) {
  1789. return value && value.isComputed ? value() : value;
  1790. }
  1791. }
  1792. };
  1793. });
  1794. /*can-define@0.7.17#define-helpers/define-helpers*/
  1795. define('can-define@0.7.17#define-helpers/define-helpers', function (require, exports, module) {
  1796. var assign = require('can-util/js/assign/assign');
  1797. var CID = require('can-util/js/cid/cid');
  1798. var define = require('can-define');
  1799. var canBatch = require('can-event/batch/batch');
  1800. var hasMethod = function (obj, method) {
  1801. return obj && typeof obj === 'object' && method in obj;
  1802. };
  1803. var defineHelpers = {
  1804. extendedSetup: function (props) {
  1805. assign(this, props);
  1806. },
  1807. toObject: function (map, props, where, Type) {
  1808. if (props instanceof Type) {
  1809. props.each(function (value, prop) {
  1810. where[prop] = value;
  1811. });
  1812. return where;
  1813. } else {
  1814. return props;
  1815. }
  1816. },
  1817. defineExpando: function (map, prop, value) {
  1818. var constructorDefines = map._define.definitions;
  1819. if (constructorDefines && constructorDefines[prop]) {
  1820. return;
  1821. }
  1822. var instanceDefines = map._instanceDefinitions;
  1823. if (!instanceDefines) {
  1824. instanceDefines = map._instanceDefinitions = {};
  1825. }
  1826. if (!instanceDefines[prop]) {
  1827. var defaultDefinition = map._define.defaultDefinition || { type: define.types.observable };
  1828. define.property(map, prop, defaultDefinition, {}, {});
  1829. map._data[prop] = defaultDefinition.type ? defaultDefinition.type(value) : define.types.observable(value);
  1830. instanceDefines[prop] = defaultDefinition;
  1831. canBatch.start();
  1832. canBatch.trigger.call(map, {
  1833. type: '__keys',
  1834. target: map
  1835. });
  1836. if (map._data[prop] !== undefined) {
  1837. canBatch.trigger.call(map, {
  1838. type: prop,
  1839. target: map
  1840. }, [
  1841. map._data[prop],
  1842. undefined
  1843. ]);
  1844. }
  1845. canBatch.stop();
  1846. return true;
  1847. }
  1848. },
  1849. getValue: function (map, name, val, how) {
  1850. if (how === 'serialize') {
  1851. var constructorDefinitions = map._define.definitions;
  1852. var propDef = constructorDefinitions[name];
  1853. if (propDef && typeof propDef.serialize === 'function') {
  1854. return propDef.serialize.call(map, val, name);
  1855. }
  1856. var defaultDefinition = map._define.defaultDefinition;
  1857. if (defaultDefinition && typeof defaultDefinition.serialize === 'function') {
  1858. return defaultDefinition.serialize.call(map, val, name);
  1859. }
  1860. }
  1861. if (hasMethod(val, how)) {
  1862. return val[how]();
  1863. } else {
  1864. return val;
  1865. }
  1866. },
  1867. serialize: function () {
  1868. var serializeMap = null;
  1869. return function (map, how, where) {
  1870. var cid = CID(map), firstSerialize = false;
  1871. if (!serializeMap) {
  1872. firstSerialize = true;
  1873. serializeMap = {
  1874. get: {},
  1875. serialize: {}
  1876. };
  1877. }
  1878. serializeMap[how][cid] = where;
  1879. map.each(function (val, name) {
  1880. var result, isObservable = hasMethod(val, how), serialized = isObservable && serializeMap[how][CID(val)];
  1881. if (serialized) {
  1882. result = serialized;
  1883. } else {
  1884. result = defineHelpers.getValue(map, name, val, how);
  1885. }
  1886. if (result !== undefined) {
  1887. where[name] = result;
  1888. }
  1889. });
  1890. if (firstSerialize) {
  1891. serializeMap = null;
  1892. }
  1893. return where;
  1894. };
  1895. }()
  1896. };
  1897. module.exports = defineHelpers;
  1898. });
  1899. /*can-define@0.7.17#map/map*/
  1900. define('can-define@0.7.17#map/map', function (require, exports, module) {
  1901. var Construct = require('can-construct');
  1902. var define = require('can-define');
  1903. var assign = require('can-util/js/assign/assign');
  1904. var isArray = require('can-util/js/is-array/is-array');
  1905. var isPlainObject = require('can-util/js/is-plain-object/is-plain-object');
  1906. var defineHelpers = require('../define-helpers/define-helpers');
  1907. var Observation = require('can-observation');
  1908. var types = require('can-util/js/types/types');
  1909. var canBatch = require('can-event/batch/batch');
  1910. var ns = require('can-util/namespace');
  1911. var readWithoutObserve = Observation.ignore(function (map, prop) {
  1912. return map[prop];
  1913. });
  1914. var eachDefinition = function (map, cb, thisarg, definitions, observe) {
  1915. for (var prop in definitions) {
  1916. var definition = definitions[prop];
  1917. if (typeof definition !== 'object' || ('serialize' in definition ? !!definition.serialize : !definition.get)) {
  1918. var item = observe === false ? readWithoutObserve(map, prop) : map[prop];
  1919. if (cb.call(thisarg || item, item, prop, map) === false) {
  1920. return false;
  1921. }
  1922. }
  1923. }
  1924. };
  1925. var setProps = function (props, remove) {
  1926. props = assign({}, props);
  1927. var prop, self = this, newVal;
  1928. canBatch.start();
  1929. this.each(function (curVal, prop) {
  1930. if (prop === '_cid') {
  1931. return;
  1932. }
  1933. newVal = props[prop];
  1934. if (newVal === undefined) {
  1935. if (remove) {
  1936. self[prop] = undefined;
  1937. }
  1938. return;
  1939. }
  1940. if (typeof curVal !== 'object') {
  1941. self.set(prop, newVal);
  1942. } else if ('set' in curVal && isPlainObject(newVal)) {
  1943. curVal.set(newVal, remove);
  1944. } else if ('attr' in curVal && (isPlainObject(newVal) || isArray(newVal))) {
  1945. curVal.attr(newVal, remove);
  1946. } else if ('replace' in curVal && isArray(newVal)) {
  1947. curVal.replace(newVal);
  1948. } else if (curVal !== newVal) {
  1949. self.set(prop, newVal);
  1950. }
  1951. delete props[prop];
  1952. }, this, false);
  1953. for (prop in props) {
  1954. if (prop !== '_cid') {
  1955. newVal = props[prop];
  1956. this.set(prop, newVal);
  1957. }
  1958. }
  1959. canBatch.stop();
  1960. return this;
  1961. };
  1962. var DefineMap = Construct.extend('DefineMap', {
  1963. setup: function () {
  1964. if (DefineMap) {
  1965. var prototype = this.prototype;
  1966. define(prototype, prototype);
  1967. this.prototype.setup = function (props) {
  1968. define.setup.call(this, defineHelpers.toObject(this, props, {}, DefineMap), this.constructor.seal);
  1969. };
  1970. }
  1971. }
  1972. }, {
  1973. setup: function (props, sealed) {
  1974. if (!this._define) {
  1975. Object.defineProperty(this, '_define', {
  1976. enumerable: false,
  1977. value: { definitions: {} }
  1978. });
  1979. Object.defineProperty(this, '_data', {
  1980. enumerable: false,
  1981. value: {}
  1982. });
  1983. }
  1984. define.setup.call(this, defineHelpers.toObject(this, props, {}, DefineMap), sealed === true);
  1985. },
  1986. get: function (prop) {
  1987. if (arguments.length) {
  1988. defineHelpers.defineExpando(this, prop);
  1989. return this[prop];
  1990. } else {
  1991. return defineHelpers.serialize(this, 'get', {});
  1992. }
  1993. },
  1994. set: function (prop, value) {
  1995. if (typeof prop === 'object') {
  1996. return setProps.call(this, prop, value);
  1997. }
  1998. var defined = defineHelpers.defineExpando(this, prop, value);
  1999. if (!defined) {
  2000. this[prop] = value;
  2001. }
  2002. return this;
  2003. },
  2004. serialize: function () {
  2005. return defineHelpers.serialize(this, 'serialize', {});
  2006. },
  2007. forEach: function (cb, thisarg, observe) {
  2008. if (observe !== false) {
  2009. Observation.add(this, '__keys');
  2010. }
  2011. var res;
  2012. var constructorDefinitions = this._define.definitions;
  2013. if (constructorDefinitions) {
  2014. res = eachDefinition(this, cb, thisarg, constructorDefinitions, observe);
  2015. }
  2016. if (res === false) {
  2017. return this;
  2018. }
  2019. if (this._instanceDefinitions) {
  2020. eachDefinition(this, cb, thisarg, this._instanceDefinitions, observe);
  2021. }
  2022. return this;
  2023. },
  2024. '*': { type: define.types.observable }
  2025. });
  2026. for (var prop in define.eventsProto) {
  2027. Object.defineProperty(DefineMap.prototype, prop, {
  2028. enumerable: false,
  2029. value: define.eventsProto[prop]
  2030. });
  2031. }
  2032. types.DefineMap = DefineMap;
  2033. types.DefaultMap = DefineMap;
  2034. DefineMap.prototype.toObject = function () {
  2035. console.warn('Use DefineMap::get instead of DefineMap::toObject');
  2036. return this.get();
  2037. };
  2038. DefineMap.prototype.each = DefineMap.prototype.forEach;
  2039. module.exports = ns.DefineMap = DefineMap;
  2040. });
  2041. /*jquery@2.2.4#dist/jquery*/
  2042. (function (global, factory) {
  2043. if (typeof module === 'object' && typeof module.exports === 'object') {
  2044. module.exports = global.document ? factory(global, true) : function (w) {
  2045. if (!w.document) {
  2046. throw new Error('jQuery requires a window with a document');
  2047. }
  2048. return factory(w);
  2049. };
  2050. } else {
  2051. factory(global);
  2052. }
  2053. }(typeof window !== 'undefined' ? window : this, function (window, noGlobal) {
  2054. var arr = [];
  2055. var document = window.document;
  2056. var slice = arr.slice;
  2057. var concat = arr.concat;
  2058. var push = arr.push;
  2059. var indexOf = arr.indexOf;
  2060. var class2type = {};
  2061. var toString = class2type.toString;
  2062. var hasOwn = class2type.hasOwnProperty;
  2063. var support = {};
  2064. var version = '2.2.4', jQuery = function (selector, context) {
  2065. return new jQuery.fn.init(selector, context);
  2066. }, rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, rmsPrefix = /^-ms-/, rdashAlpha = /-([\da-z])/gi, fcamelCase = function (all, letter) {
  2067. return letter.toUpperCase();
  2068. };
  2069. jQuery.fn = jQuery.prototype = {
  2070. jquery: version,
  2071. constructor: jQuery,
  2072. selector: '',
  2073. length: 0,
  2074. toArray: function () {
  2075. return slice.call(this);
  2076. },
  2077. get: function (num) {
  2078. return num != null ? num < 0 ? this[num + this.length] : this[num] : slice.call(this);
  2079. },
  2080. pushStack: function (elems) {
  2081. var ret = jQuery.merge(this.constructor(), elems);
  2082. ret.prevObject = this;
  2083. ret.context = this.context;
  2084. return ret;
  2085. },
  2086. each: function (callback) {
  2087. return jQuery.each(this, callback);
  2088. },
  2089. map: function (callback) {
  2090. return this.pushStack(jQuery.map(this, function (elem, i) {
  2091. return callback.call(elem, i, elem);
  2092. }));
  2093. },
  2094. slice: function () {
  2095. return this.pushStack(slice.apply(this, arguments));
  2096. },
  2097. first: function () {
  2098. return this.eq(0);
  2099. },
  2100. last: function () {
  2101. return this.eq(-1);
  2102. },
  2103. eq: function (i) {
  2104. var len = this.length, j = +i + (i < 0 ? len : 0);
  2105. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  2106. },
  2107. end: function () {
  2108. return this.prevObject || this.constructor();
  2109. },
  2110. push: push,
  2111. sort: arr.sort,
  2112. splice: arr.splice
  2113. };
  2114. jQuery.extend = jQuery.fn.extend = function () {
  2115. var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false;
  2116. if (typeof target === 'boolean') {
  2117. deep = target;
  2118. target = arguments[i] || {};
  2119. i++;
  2120. }
  2121. if (typeof target !== 'object' && !jQuery.isFunction(target)) {
  2122. target = {};
  2123. }
  2124. if (i === length) {
  2125. target = this;
  2126. i--;
  2127. }
  2128. for (; i < length; i++) {
  2129. if ((options = arguments[i]) != null) {
  2130. for (name in options) {
  2131. src = target[name];
  2132. copy = options[name];
  2133. if (target === copy) {
  2134. continue;
  2135. }
  2136. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) {
  2137. if (copyIsArray) {
  2138. copyIsArray = false;
  2139. clone = src && jQuery.isArray(src) ? src : [];
  2140. } else {
  2141. clone = src && jQuery.isPlainObject(src) ? src : {};
  2142. }
  2143. target[name] = jQuery.extend(deep, clone, copy);
  2144. } else if (copy !== undefined) {
  2145. target[name] = copy;
  2146. }
  2147. }
  2148. }
  2149. }
  2150. return target;
  2151. };
  2152. jQuery.extend({
  2153. expando: 'jQuery' + (version + Math.random()).replace(/\D/g, ''),
  2154. isReady: true,
  2155. error: function (msg) {
  2156. throw new Error(msg);
  2157. },
  2158. noop: function () {
  2159. },
  2160. isFunction: function (obj) {
  2161. return jQuery.type(obj) === 'function';
  2162. },
  2163. isArray: Array.isArray,
  2164. isWindow: function (obj) {
  2165. return obj != null && obj === obj.window;
  2166. },
  2167. isNumeric: function (obj) {
  2168. var realStringObj = obj && obj.toString();
  2169. return !jQuery.isArray(obj) && realStringObj - parseFloat(realStringObj) + 1 >= 0;
  2170. },
  2171. isPlainObject: function (obj) {
  2172. var key;
  2173. if (jQuery.type(obj) !== 'object' || obj.nodeType || jQuery.isWindow(obj)) {
  2174. return false;
  2175. }
  2176. if (obj.constructor && !hasOwn.call(obj, 'constructor') && !hasOwn.call(obj.constructor.prototype || {}, 'isPrototypeOf')) {
  2177. return false;
  2178. }
  2179. for (key in obj) {
  2180. }
  2181. return key === undefined || hasOwn.call(obj, key);
  2182. },
  2183. isEmptyObject: function (obj) {
  2184. var name;
  2185. for (name in obj) {
  2186. return false;
  2187. }
  2188. return true;
  2189. },
  2190. type: function (obj) {
  2191. if (obj == null) {
  2192. return obj + '';
  2193. }
  2194. return typeof obj === 'object' || typeof obj === 'function' ? class2type[toString.call(obj)] || 'object' : typeof obj;
  2195. },
  2196. globalEval: function (code) {
  2197. var script, indirect = eval;
  2198. code = jQuery.trim(code);
  2199. if (code) {
  2200. if (code.indexOf('use strict') === 1) {
  2201. script = document.createElement('script');
  2202. script.text = code;
  2203. document.head.appendChild(script).parentNode.removeChild(script);
  2204. } else {
  2205. indirect(code);
  2206. }
  2207. }
  2208. },
  2209. camelCase: function (string) {
  2210. return string.replace(rmsPrefix, 'ms-').replace(rdashAlpha, fcamelCase);
  2211. },
  2212. nodeName: function (elem, name) {
  2213. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  2214. },
  2215. each: function (obj, callback) {
  2216. var length, i = 0;
  2217. if (isArrayLike(obj)) {
  2218. length = obj.length;
  2219. for (; i < length; i++) {
  2220. if (callback.call(obj[i], i, obj[i]) === false) {
  2221. break;
  2222. }
  2223. }
  2224. } else {
  2225. for (i in obj) {
  2226. if (callback.call(obj[i], i, obj[i]) === false) {
  2227. break;
  2228. }
  2229. }
  2230. }
  2231. return obj;
  2232. },
  2233. trim: function (text) {
  2234. return text == null ? '' : (text + '').replace(rtrim, '');
  2235. },
  2236. makeArray: function (arr, results) {
  2237. var ret = results || [];
  2238. if (arr != null) {
  2239. if (isArrayLike(Object(arr))) {
  2240. jQuery.merge(ret, typeof arr === 'string' ? [arr] : arr);
  2241. } else {
  2242. push.call(ret, arr);
  2243. }
  2244. }
  2245. return ret;
  2246. },
  2247. inArray: function (elem, arr, i) {
  2248. return arr == null ? -1 : indexOf.call(arr, elem, i);
  2249. },
  2250. merge: function (first, second) {
  2251. var len = +second.length, j = 0, i = first.length;
  2252. for (; j < len; j++) {
  2253. first[i++] = second[j];
  2254. }
  2255. first.length = i;
  2256. return first;
  2257. },
  2258. grep: function (elems, callback, invert) {
  2259. var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert;
  2260. for (; i < length; i++) {
  2261. callbackInverse = !callback(elems[i], i);
  2262. if (callbackInverse !== callbackExpect) {
  2263. matches.push(elems[i]);
  2264. }
  2265. }
  2266. return matches;
  2267. },
  2268. map: function (elems, callback, arg) {
  2269. var length, value, i = 0, ret = [];
  2270. if (isArrayLike(elems)) {
  2271. length = elems.length;
  2272. for (; i < length; i++) {
  2273. value = callback(elems[i], i, arg);
  2274. if (value != null) {
  2275. ret.push(value);
  2276. }
  2277. }
  2278. } else {
  2279. for (i in elems) {
  2280. value = callback(elems[i], i, arg);
  2281. if (value != null) {
  2282. ret.push(value);
  2283. }
  2284. }
  2285. }
  2286. return concat.apply([], ret);
  2287. },
  2288. guid: 1,
  2289. proxy: function (fn, context) {
  2290. var tmp, args, proxy;
  2291. if (typeof context === 'string') {
  2292. tmp = fn[context];
  2293. context = fn;
  2294. fn = tmp;
  2295. }
  2296. if (!jQuery.isFunction(fn)) {
  2297. return undefined;
  2298. }
  2299. args = slice.call(arguments, 2);
  2300. proxy = function () {
  2301. return fn.apply(context || this, args.concat(slice.call(arguments)));
  2302. };
  2303. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  2304. return proxy;
  2305. },
  2306. now: Date.now,
  2307. support: support
  2308. });
  2309. if (typeof Symbol === 'function') {
  2310. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  2311. }
  2312. jQuery.each('Boolean Number String Function Array Date RegExp Object Error Symbol'.split(' '), function (i, name) {
  2313. class2type['[object ' + name + ']'] = name.toLowerCase();
  2314. });
  2315. function isArrayLike(obj) {
  2316. var length = !!obj && 'length' in obj && obj.length, type = jQuery.type(obj);
  2317. if (type === 'function' || jQuery.isWindow(obj)) {
  2318. return false;
  2319. }
  2320. return type === 'array' || length === 0 || typeof length === 'number' && length > 0 && length - 1 in obj;
  2321. }
  2322. var Sizzle = function (window) {
  2323. var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, expando = 'sizzle' + 1 * new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function (a, b) {
  2324. if (a === b) {
  2325. hasDuplicate = true;
  2326. }
  2327. return 0;
  2328. }, MAX_NEGATIVE = 1 << 31, hasOwn = {}.hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, indexOf = function (list, elem) {
  2329. var i = 0, len = list.length;
  2330. for (; i < len; i++) {
  2331. if (list[i] === elem) {
  2332. return i;
  2333. }
  2334. }
  2335. return -1;
  2336. }, booleans = 'checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped', whitespace = '[\\x20\\t\\r\\n\\f]', identifier = '(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+', attributes = '\\[' + whitespace + '*(' + identifier + ')(?:' + whitespace + '*([*^$|!~]?=)' + whitespace + '*(?:\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)"|(' + identifier + '))|)' + whitespace + '*\\]', pseudos = ':(' + identifier + ')(?:\\((' + '(\'((?:\\\\.|[^\\\\\'])*)\'|"((?:\\\\.|[^\\\\"])*)")|' + '((?:\\\\.|[^\\\\()[\\]]|' + attributes + ')*)|' + '.*' + ')\\)|)', rwhitespace = new RegExp(whitespace + '+', 'g'), rtrim = new RegExp('^' + whitespace + '+|((?:^|[^\\\\])(?:\\\\.)*)' + whitespace + '+$', 'g'), rcomma = new RegExp('^' + whitespace + '*,' + whitespace + '*'), rcombinators = new RegExp('^' + whitespace + '*([>+~]|' + whitespace + ')' + whitespace + '*'), rattributeQuotes = new RegExp('=' + whitespace + '*([^\\]\'"]*?)' + whitespace + '*\\]', 'g'), rpseudo = new RegExp(pseudos), ridentifier = new RegExp('^' + identifier + '$'), matchExpr = {
  2337. 'ID': new RegExp('^#(' + identifier + ')'),
  2338. 'CLASS': new RegExp('^\\.(' + identifier + ')'),
  2339. 'TAG': new RegExp('^(' + identifier + '|[*])'),
  2340. 'ATTR': new RegExp('^' + attributes),
  2341. 'PSEUDO': new RegExp('^' + pseudos),
  2342. 'CHILD': new RegExp('^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(' + whitespace + '*(even|odd|(([+-]|)(\\d*)n|)' + whitespace + '*(?:([+-]|)' + whitespace + '*(\\d+)|))' + whitespace + '*\\)|)', 'i'),
  2343. 'bool': new RegExp('^(?:' + booleans + ')$', 'i'),
  2344. 'needsContext': new RegExp('^' + whitespace + '*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(' + whitespace + '*((?:-\\d)?\\d*)' + whitespace + '*\\)|)(?=[^-]|$)', 'i')
  2345. }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, rescape = /'|\\/g, runescape = new RegExp('\\\\([\\da-f]{1,6}' + whitespace + '?|(' + whitespace + ')|.)', 'ig'), funescape = function (_, escaped, escapedWhitespace) {
  2346. var high = '0x' + escaped - 65536;
  2347. return high !== high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320);
  2348. }, unloadHandler = function () {
  2349. setDocument();
  2350. };
  2351. try {
  2352. push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
  2353. arr[preferredDoc.childNodes.length].nodeType;
  2354. } catch (e) {
  2355. push = {
  2356. apply: arr.length ? function (target, els) {
  2357. push_native.apply(target, slice.call(els));
  2358. } : function (target, els) {
  2359. var j = target.length, i = 0;
  2360. while (target[j++] = els[i++]) {
  2361. }
  2362. target.length = j - 1;
  2363. }
  2364. };
  2365. }
  2366. function Sizzle(selector, context, results, seed) {
  2367. var m, i, elem, nid, nidselect, match, groups, newSelector, newContext = context && context.ownerDocument, nodeType = context ? context.nodeType : 9;
  2368. results = results || [];
  2369. if (typeof selector !== 'string' || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  2370. return results;
  2371. }
  2372. if (!seed) {
  2373. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  2374. setDocument(context);
  2375. }
  2376. context = context || document;
  2377. if (documentIsHTML) {
  2378. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  2379. if (m = match[1]) {
  2380. if (nodeType === 9) {
  2381. if (elem = context.getElementById(m)) {
  2382. if (elem.id === m) {
  2383. results.push(elem);
  2384. return results;
  2385. }
  2386. } else {
  2387. return results;
  2388. }
  2389. } else {
  2390. if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
  2391. results.push(elem);
  2392. return results;
  2393. }
  2394. }
  2395. } else if (match[2]) {
  2396. push.apply(results, context.getElementsByTagName(selector));
  2397. return results;
  2398. } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
  2399. push.apply(results, context.getElementsByClassName(m));
  2400. return results;
  2401. }
  2402. }
  2403. if (support.qsa && !compilerCache[selector + ' '] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  2404. if (nodeType !== 1) {
  2405. newContext = context;
  2406. newSelector = selector;
  2407. } else if (context.nodeName.toLowerCase() !== 'object') {
  2408. if (nid = context.getAttribute('id')) {
  2409. nid = nid.replace(rescape, '\\$&');
  2410. } else {
  2411. context.setAttribute('id', nid = expando);
  2412. }
  2413. groups = tokenize(selector);
  2414. i = groups.length;
  2415. nidselect = ridentifier.test(nid) ? '#' + nid : '[id=\'' + nid + '\']';
  2416. while (i--) {
  2417. groups[i] = nidselect + ' ' + toSelector(groups[i]);
  2418. }
  2419. newSelector = groups.join(',');
  2420. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  2421. }
  2422. if (newSelector) {
  2423. try {
  2424. push.apply(results, newContext.querySelectorAll(newSelector));
  2425. return results;
  2426. } catch (qsaError) {
  2427. } finally {
  2428. if (nid === expando) {
  2429. context.removeAttribute('id');
  2430. }
  2431. }
  2432. }
  2433. }
  2434. }
  2435. }
  2436. return select(selector.replace(rtrim, '$1'), context, results, seed);
  2437. }
  2438. function createCache() {
  2439. var keys = [];
  2440. function cache(key, value) {
  2441. if (keys.push(key + ' ') > Expr.cacheLength) {
  2442. delete cache[keys.shift()];
  2443. }
  2444. return cache[key + ' '] = value;
  2445. }
  2446. return cache;
  2447. }
  2448. function markFunction(fn) {
  2449. fn[expando] = true;
  2450. return fn;
  2451. }
  2452. function assert(fn) {
  2453. var div = document.createElement('div');
  2454. try {
  2455. return !!fn(div);
  2456. } catch (e) {
  2457. return false;
  2458. } finally {
  2459. if (div.parentNode) {
  2460. div.parentNode.removeChild(div);
  2461. }
  2462. div = null;
  2463. }
  2464. }
  2465. function addHandle(attrs, handler) {
  2466. var arr = attrs.split('|'), i = arr.length;
  2467. while (i--) {
  2468. Expr.attrHandle[arr[i]] = handler;
  2469. }
  2470. }
  2471. function siblingCheck(a, b) {
  2472. var cur = b && a, diff = cur && a.nodeType === 1 && b.nodeType === 1 && (~b.sourceIndex || MAX_NEGATIVE) - (~a.sourceIndex || MAX_NEGATIVE);
  2473. if (diff) {
  2474. return diff;
  2475. }
  2476. if (cur) {
  2477. while (cur = cur.nextSibling) {
  2478. if (cur === b) {
  2479. return -1;
  2480. }
  2481. }
  2482. }
  2483. return a ? 1 : -1;
  2484. }
  2485. function createInputPseudo(type) {
  2486. return function (elem) {
  2487. var name = elem.nodeName.toLowerCase();
  2488. return name === 'input' && elem.type === type;
  2489. };
  2490. }
  2491. function createButtonPseudo(type) {
  2492. return function (elem) {
  2493. var name = elem.nodeName.toLowerCase();
  2494. return (name === 'input' || name === 'button') && elem.type === type;
  2495. };
  2496. }
  2497. function createPositionalPseudo(fn) {
  2498. return markFunction(function (argument) {
  2499. argument = +argument;
  2500. return markFunction(function (seed, matches) {
  2501. var j, matchIndexes = fn([], seed.length, argument), i = matchIndexes.length;
  2502. while (i--) {
  2503. if (seed[j = matchIndexes[i]]) {
  2504. seed[j] = !(matches[j] = seed[j]);
  2505. }
  2506. }
  2507. });
  2508. });
  2509. }
  2510. function testContext(context) {
  2511. return context && typeof context.getElementsByTagName !== 'undefined' && context;
  2512. }
  2513. support = Sizzle.support = {};
  2514. isXML = Sizzle.isXML = function (elem) {
  2515. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  2516. return documentElement ? documentElement.nodeName !== 'HTML' : false;
  2517. };
  2518. setDocument = Sizzle.setDocument = function (node) {
  2519. var hasCompare, parent, doc = node ? node.ownerDocument || node : preferredDoc;
  2520. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  2521. return document;
  2522. }
  2523. document = doc;
  2524. docElem = document.documentElement;
  2525. documentIsHTML = !isXML(document);
  2526. if ((parent = document.defaultView) && parent.top !== parent) {
  2527. if (parent.addEventListener) {
  2528. parent.addEventListener('unload', unloadHandler, false);
  2529. } else if (parent.attachEvent) {
  2530. parent.attachEvent('onunload', unloadHandler);
  2531. }
  2532. }
  2533. support.attributes = assert(function (div) {
  2534. div.className = 'i';
  2535. return !div.getAttribute('className');
  2536. });
  2537. support.getElementsByTagName = assert(function (div) {
  2538. div.appendChild(document.createComment(''));
  2539. return !div.getElementsByTagName('*').length;
  2540. });
  2541. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  2542. support.getById = assert(function (div) {
  2543. docElem.appendChild(div).id = expando;
  2544. return !document.getElementsByName || !document.getElementsByName(expando).length;
  2545. });
  2546. if (support.getById) {
  2547. Expr.find['ID'] = function (id, context) {
  2548. if (typeof context.getElementById !== 'undefined' && documentIsHTML) {
  2549. var m = context.getElementById(id);
  2550. return m ? [m] : [];
  2551. }
  2552. };
  2553. Expr.filter['ID'] = function (id) {
  2554. var attrId = id.replace(runescape, funescape);
  2555. return function (elem) {
  2556. return elem.getAttribute('id') === attrId;
  2557. };
  2558. };
  2559. } else {
  2560. delete Expr.find['ID'];
  2561. Expr.filter['ID'] = function (id) {
  2562. var attrId = id.replace(runescape, funescape);
  2563. return function (elem) {
  2564. var node = typeof elem.getAttributeNode !== 'undefined' && elem.getAttributeNode('id');
  2565. return node && node.value === attrId;
  2566. };
  2567. };
  2568. }
  2569. Expr.find['TAG'] = support.getElementsByTagName ? function (tag, context) {
  2570. if (typeof context.getElementsByTagName !== 'undefined') {
  2571. return context.getElementsByTagName(tag);
  2572. } else if (support.qsa) {
  2573. return context.querySelectorAll(tag);
  2574. }
  2575. } : function (tag, context) {
  2576. var elem, tmp = [], i = 0, results = context.getElementsByTagName(tag);
  2577. if (tag === '*') {
  2578. while (elem = results[i++]) {
  2579. if (elem.nodeType === 1) {
  2580. tmp.push(elem);
  2581. }
  2582. }
  2583. return tmp;
  2584. }
  2585. return results;
  2586. };
  2587. Expr.find['CLASS'] = support.getElementsByClassName && function (className, context) {
  2588. if (typeof context.getElementsByClassName !== 'undefined' && documentIsHTML) {
  2589. return context.getElementsByClassName(className);
  2590. }
  2591. };
  2592. rbuggyMatches = [];
  2593. rbuggyQSA = [];
  2594. if (support.qsa = rnative.test(document.querySelectorAll)) {
  2595. assert(function (div) {
  2596. docElem.appendChild(div).innerHTML = '<a id=\'' + expando + '\'></a>' + '<select id=\'' + expando + '-\r\\\' msallowcapture=\'\'>' + '<option selected=\'\'></option></select>';
  2597. if (div.querySelectorAll('[msallowcapture^=\'\']').length) {
  2598. rbuggyQSA.push('[*^$]=' + whitespace + '*(?:\'\'|"")');
  2599. }
  2600. if (!div.querySelectorAll('[selected]').length) {
  2601. rbuggyQSA.push('\\[' + whitespace + '*(?:value|' + booleans + ')');
  2602. }
  2603. if (!div.querySelectorAll('[id~=' + expando + '-]').length) {
  2604. rbuggyQSA.push('~=');
  2605. }
  2606. if (!div.querySelectorAll(':checked').length) {
  2607. rbuggyQSA.push(':checked');
  2608. }
  2609. if (!div.querySelectorAll('a#' + expando + '+*').length) {
  2610. rbuggyQSA.push('.#.+[+~]');
  2611. }
  2612. });
  2613. assert(function (div) {
  2614. var input = document.createElement('input');
  2615. input.setAttribute('type', 'hidden');
  2616. div.appendChild(input).setAttribute('name', 'D');
  2617. if (div.querySelectorAll('[name=d]').length) {
  2618. rbuggyQSA.push('name' + whitespace + '*[*^$|!~]?=');
  2619. }
  2620. if (!div.querySelectorAll(':enabled').length) {
  2621. rbuggyQSA.push(':enabled', ':disabled');
  2622. }
  2623. div.querySelectorAll('*,:x');
  2624. rbuggyQSA.push(',.*:');
  2625. });
  2626. }
  2627. if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {
  2628. assert(function (div) {
  2629. support.disconnectedMatch = matches.call(div, 'div');
  2630. matches.call(div, '[s!=\'\']:x');
  2631. rbuggyMatches.push('!=', pseudos);
  2632. });
  2633. }
  2634. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join('|'));
  2635. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join('|'));
  2636. hasCompare = rnative.test(docElem.compareDocumentPosition);
  2637. contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
  2638. var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode;
  2639. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  2640. } : function (a, b) {
  2641. if (b) {
  2642. while (b = b.parentNode) {
  2643. if (b === a) {
  2644. return true;
  2645. }
  2646. }
  2647. }
  2648. return false;
  2649. };
  2650. sortOrder = hasCompare ? function (a, b) {
  2651. if (a === b) {
  2652. hasDuplicate = true;
  2653. return 0;
  2654. }
  2655. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  2656. if (compare) {
  2657. return compare;
  2658. }
  2659. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;
  2660. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  2661. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  2662. return -1;
  2663. }
  2664. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  2665. return 1;
  2666. }
  2667. return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  2668. }
  2669. return compare & 4 ? -1 : 1;
  2670. } : function (a, b) {
  2671. if (a === b) {
  2672. hasDuplicate = true;
  2673. return 0;
  2674. }
  2675. var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [a], bp = [b];
  2676. if (!aup || !bup) {
  2677. return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  2678. } else if (aup === bup) {
  2679. return siblingCheck(a, b);
  2680. }
  2681. cur = a;
  2682. while (cur = cur.parentNode) {
  2683. ap.unshift(cur);
  2684. }
  2685. cur = b;
  2686. while (cur = cur.parentNode) {
  2687. bp.unshift(cur);
  2688. }
  2689. while (ap[i] === bp[i]) {
  2690. i++;
  2691. }
  2692. return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
  2693. };
  2694. return document;
  2695. };
  2696. Sizzle.matches = function (expr, elements) {
  2697. return Sizzle(expr, null, null, elements);
  2698. };
  2699. Sizzle.matchesSelector = function (elem, expr) {
  2700. if ((elem.ownerDocument || elem) !== document) {
  2701. setDocument(elem);
  2702. }
  2703. expr = expr.replace(rattributeQuotes, '=\'$1\']');
  2704. if (support.matchesSelector && documentIsHTML && !compilerCache[expr + ' '] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  2705. try {
  2706. var ret = matches.call(elem, expr);
  2707. if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) {
  2708. return ret;
  2709. }
  2710. } catch (e) {
  2711. }
  2712. }
  2713. return Sizzle(expr, document, null, [elem]).length > 0;
  2714. };
  2715. Sizzle.contains = function (context, elem) {
  2716. if ((context.ownerDocument || context) !== document) {
  2717. setDocument(context);
  2718. }
  2719. return contains(context, elem);
  2720. };
  2721. Sizzle.attr = function (elem, name) {
  2722. if ((elem.ownerDocument || elem) !== document) {
  2723. setDocument(elem);
  2724. }
  2725. var fn = Expr.attrHandle[name.toLowerCase()], val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  2726. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  2727. };
  2728. Sizzle.error = function (msg) {
  2729. throw new Error('Syntax error, unrecognized expression: ' + msg);
  2730. };
  2731. Sizzle.uniqueSort = function (results) {
  2732. var elem, duplicates = [], j = 0, i = 0;
  2733. hasDuplicate = !support.detectDuplicates;
  2734. sortInput = !support.sortStable && results.slice(0);
  2735. results.sort(sortOrder);
  2736. if (hasDuplicate) {
  2737. while (elem = results[i++]) {
  2738. if (elem === results[i]) {
  2739. j = duplicates.push(i);
  2740. }
  2741. }
  2742. while (j--) {
  2743. results.splice(duplicates[j], 1);
  2744. }
  2745. }
  2746. sortInput = null;
  2747. return results;
  2748. };
  2749. getText = Sizzle.getText = function (elem) {
  2750. var node, ret = '', i = 0, nodeType = elem.nodeType;
  2751. if (!nodeType) {
  2752. while (node = elem[i++]) {
  2753. ret += getText(node);
  2754. }
  2755. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  2756. if (typeof elem.textContent === 'string') {
  2757. return elem.textContent;
  2758. } else {
  2759. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  2760. ret += getText(elem);
  2761. }
  2762. }
  2763. } else if (nodeType === 3 || nodeType === 4) {
  2764. return elem.nodeValue;
  2765. }
  2766. return ret;
  2767. };
  2768. Expr = Sizzle.selectors = {
  2769. cacheLength: 50,
  2770. createPseudo: markFunction,
  2771. match: matchExpr,
  2772. attrHandle: {},
  2773. find: {},
  2774. relative: {
  2775. '>': {
  2776. dir: 'parentNode',
  2777. first: true
  2778. },
  2779. ' ': { dir: 'parentNode' },
  2780. '+': {
  2781. dir: 'previousSibling',
  2782. first: true
  2783. },
  2784. '~': { dir: 'previousSibling' }
  2785. },
  2786. preFilter: {
  2787. 'ATTR': function (match) {
  2788. match[1] = match[1].replace(runescape, funescape);
  2789. match[3] = (match[3] || match[4] || match[5] || '').replace(runescape, funescape);
  2790. if (match[2] === '~=') {
  2791. match[3] = ' ' + match[3] + ' ';
  2792. }
  2793. return match.slice(0, 4);
  2794. },
  2795. 'CHILD': function (match) {
  2796. match[1] = match[1].toLowerCase();
  2797. if (match[1].slice(0, 3) === 'nth') {
  2798. if (!match[3]) {
  2799. Sizzle.error(match[0]);
  2800. }
  2801. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === 'even' || match[3] === 'odd'));
  2802. match[5] = +(match[7] + match[8] || match[3] === 'odd');
  2803. } else if (match[3]) {
  2804. Sizzle.error(match[0]);
  2805. }
  2806. return match;
  2807. },
  2808. 'PSEUDO': function (match) {
  2809. var excess, unquoted = !match[6] && match[2];
  2810. if (matchExpr['CHILD'].test(match[0])) {
  2811. return null;
  2812. }
  2813. if (match[3]) {
  2814. match[2] = match[4] || match[5] || '';
  2815. } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(')', unquoted.length - excess) - unquoted.length)) {
  2816. match[0] = match[0].slice(0, excess);
  2817. match[2] = unquoted.slice(0, excess);
  2818. }
  2819. return match.slice(0, 3);
  2820. }
  2821. },
  2822. filter: {
  2823. 'TAG': function (nodeNameSelector) {
  2824. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  2825. return nodeNameSelector === '*' ? function () {
  2826. return true;
  2827. } : function (elem) {
  2828. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  2829. };
  2830. },
  2831. 'CLASS': function (className) {
  2832. var pattern = classCache[className + ' '];
  2833. return pattern || (pattern = new RegExp('(^|' + whitespace + ')' + className + '(' + whitespace + '|$)')) && classCache(className, function (elem) {
  2834. return pattern.test(typeof elem.className === 'string' && elem.className || typeof elem.getAttribute !== 'undefined' && elem.getAttribute('class') || '');
  2835. });
  2836. },
  2837. 'ATTR': function (name, operator, check) {
  2838. return function (elem) {
  2839. var result = Sizzle.attr(elem, name);
  2840. if (result == null) {
  2841. return operator === '!=';
  2842. }
  2843. if (!operator) {
  2844. return true;
  2845. }
  2846. result += '';
  2847. return operator === '=' ? result === check : operator === '!=' ? result !== check : operator === '^=' ? check && result.indexOf(check) === 0 : operator === '*=' ? check && result.indexOf(check) > -1 : operator === '$=' ? check && result.slice(-check.length) === check : operator === '~=' ? (' ' + result.replace(rwhitespace, ' ') + ' ').indexOf(check) > -1 : operator === '|=' ? result === check || result.slice(0, check.length + 1) === check + '-' : false;
  2848. };
  2849. },
  2850. 'CHILD': function (type, what, argument, first, last) {
  2851. var simple = type.slice(0, 3) !== 'nth', forward = type.slice(-4) !== 'last', ofType = what === 'of-type';
  2852. return first === 1 && last === 0 ? function (elem) {
  2853. return !!elem.parentNode;
  2854. } : function (elem, context, xml) {
  2855. var cache, uniqueCache, outerCache, node, nodeIndex, start, dir = simple !== forward ? 'nextSibling' : 'previousSibling', parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false;
  2856. if (parent) {
  2857. if (simple) {
  2858. while (dir) {
  2859. node = elem;
  2860. while (node = node[dir]) {
  2861. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  2862. return false;
  2863. }
  2864. }
  2865. start = dir = type === 'only' && !start && 'nextSibling';
  2866. }
  2867. return true;
  2868. }
  2869. start = [forward ? parent.firstChild : parent.lastChild];
  2870. if (forward && useCache) {
  2871. node = parent;
  2872. outerCache = node[expando] || (node[expando] = {});
  2873. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  2874. cache = uniqueCache[type] || [];
  2875. nodeIndex = cache[0] === dirruns && cache[1];
  2876. diff = nodeIndex && cache[2];
  2877. node = nodeIndex && parent.childNodes[nodeIndex];
  2878. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  2879. if (node.nodeType === 1 && ++diff && node === elem) {
  2880. uniqueCache[type] = [
  2881. dirruns,
  2882. nodeIndex,
  2883. diff
  2884. ];
  2885. break;
  2886. }
  2887. }
  2888. } else {
  2889. if (useCache) {
  2890. node = elem;
  2891. outerCache = node[expando] || (node[expando] = {});
  2892. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  2893. cache = uniqueCache[type] || [];
  2894. nodeIndex = cache[0] === dirruns && cache[1];
  2895. diff = nodeIndex;
  2896. }
  2897. if (diff === false) {
  2898. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  2899. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  2900. if (useCache) {
  2901. outerCache = node[expando] || (node[expando] = {});
  2902. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  2903. uniqueCache[type] = [
  2904. dirruns,
  2905. diff
  2906. ];
  2907. }
  2908. if (node === elem) {
  2909. break;
  2910. }
  2911. }
  2912. }
  2913. }
  2914. }
  2915. diff -= last;
  2916. return diff === first || diff % first === 0 && diff / first >= 0;
  2917. }
  2918. };
  2919. },
  2920. 'PSEUDO': function (pseudo, argument) {
  2921. var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error('unsupported pseudo: ' + pseudo);
  2922. if (fn[expando]) {
  2923. return fn(argument);
  2924. }
  2925. if (fn.length > 1) {
  2926. args = [
  2927. pseudo,
  2928. pseudo,
  2929. '',
  2930. argument
  2931. ];
  2932. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
  2933. var idx, matched = fn(seed, argument), i = matched.length;
  2934. while (i--) {
  2935. idx = indexOf(seed, matched[i]);
  2936. seed[idx] = !(matches[idx] = matched[i]);
  2937. }
  2938. }) : function (elem) {
  2939. return fn(elem, 0, args);
  2940. };
  2941. }
  2942. return fn;
  2943. }
  2944. },
  2945. pseudos: {
  2946. 'not': markFunction(function (selector) {
  2947. var input = [], results = [], matcher = compile(selector.replace(rtrim, '$1'));
  2948. return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
  2949. var elem, unmatched = matcher(seed, null, xml, []), i = seed.length;
  2950. while (i--) {
  2951. if (elem = unmatched[i]) {
  2952. seed[i] = !(matches[i] = elem);
  2953. }
  2954. }
  2955. }) : function (elem, context, xml) {
  2956. input[0] = elem;
  2957. matcher(input, null, xml, results);
  2958. input[0] = null;
  2959. return !results.pop();
  2960. };
  2961. }),
  2962. 'has': markFunction(function (selector) {
  2963. return function (elem) {
  2964. return Sizzle(selector, elem).length > 0;
  2965. };
  2966. }),
  2967. 'contains': markFunction(function (text) {
  2968. text = text.replace(runescape, funescape);
  2969. return function (elem) {
  2970. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  2971. };
  2972. }),
  2973. 'lang': markFunction(function (lang) {
  2974. if (!ridentifier.test(lang || '')) {
  2975. Sizzle.error('unsupported lang: ' + lang);
  2976. }
  2977. lang = lang.replace(runescape, funescape).toLowerCase();
  2978. return function (elem) {
  2979. var elemLang;
  2980. do {
  2981. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute('xml:lang') || elem.getAttribute('lang')) {
  2982. elemLang = elemLang.toLowerCase();
  2983. return elemLang === lang || elemLang.indexOf(lang + '-') === 0;
  2984. }
  2985. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  2986. return false;
  2987. };
  2988. }),
  2989. 'target': function (elem) {
  2990. var hash = window.location && window.location.hash;
  2991. return hash && hash.slice(1) === elem.id;
  2992. },
  2993. 'root': function (elem) {
  2994. return elem === docElem;
  2995. },
  2996. 'focus': function (elem) {
  2997. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  2998. },
  2999. 'enabled': function (elem) {
  3000. return elem.disabled === false;
  3001. },
  3002. 'disabled': function (elem) {
  3003. return elem.disabled === true;
  3004. },
  3005. 'checked': function (elem) {
  3006. var nodeName = elem.nodeName.toLowerCase();
  3007. return nodeName === 'input' && !!elem.checked || nodeName === 'option' && !!elem.selected;
  3008. },
  3009. 'selected': function (elem) {
  3010. if (elem.parentNode) {
  3011. elem.parentNode.selectedIndex;
  3012. }
  3013. return elem.selected === true;
  3014. },
  3015. 'empty': function (elem) {
  3016. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  3017. if (elem.nodeType < 6) {
  3018. return false;
  3019. }
  3020. }
  3021. return true;
  3022. },
  3023. 'parent': function (elem) {
  3024. return !Expr.pseudos['empty'](elem);
  3025. },
  3026. 'header': function (elem) {
  3027. return rheader.test(elem.nodeName);
  3028. },
  3029. 'input': function (elem) {
  3030. return rinputs.test(elem.nodeName);
  3031. },
  3032. 'button': function (elem) {
  3033. var name = elem.nodeName.toLowerCase();
  3034. return name === 'input' && elem.type === 'button' || name === 'button';
  3035. },
  3036. 'text': function (elem) {
  3037. var attr;
  3038. return elem.nodeName.toLowerCase() === 'input' && elem.type === 'text' && ((attr = elem.getAttribute('type')) == null || attr.toLowerCase() === 'text');
  3039. },
  3040. 'first': createPositionalPseudo(function () {
  3041. return [0];
  3042. }),
  3043. 'last': createPositionalPseudo(function (matchIndexes, length) {
  3044. return [length - 1];
  3045. }),
  3046. 'eq': createPositionalPseudo(function (matchIndexes, length, argument) {
  3047. return [argument < 0 ? argument + length : argument];
  3048. }),
  3049. 'even': createPositionalPseudo(function (matchIndexes, length) {
  3050. var i = 0;
  3051. for (; i < length; i += 2) {
  3052. matchIndexes.push(i);
  3053. }
  3054. return matchIndexes;
  3055. }),
  3056. 'odd': createPositionalPseudo(function (matchIndexes, length) {
  3057. var i = 1;
  3058. for (; i < length; i += 2) {
  3059. matchIndexes.push(i);
  3060. }
  3061. return matchIndexes;
  3062. }),
  3063. 'lt': createPositionalPseudo(function (matchIndexes, length, argument) {
  3064. var i = argument < 0 ? argument + length : argument;
  3065. for (; --i >= 0;) {
  3066. matchIndexes.push(i);
  3067. }
  3068. return matchIndexes;
  3069. }),
  3070. 'gt': createPositionalPseudo(function (matchIndexes, length, argument) {
  3071. var i = argument < 0 ? argument + length : argument;
  3072. for (; ++i < length;) {
  3073. matchIndexes.push(i);
  3074. }
  3075. return matchIndexes;
  3076. })
  3077. }
  3078. };
  3079. Expr.pseudos['nth'] = Expr.pseudos['eq'];
  3080. for (i in {
  3081. radio: true,
  3082. checkbox: true,
  3083. file: true,
  3084. password: true,
  3085. image: true
  3086. }) {
  3087. Expr.pseudos[i] = createInputPseudo(i);
  3088. }
  3089. for (i in {
  3090. submit: true,
  3091. reset: true
  3092. }) {
  3093. Expr.pseudos[i] = createButtonPseudo(i);
  3094. }
  3095. function setFilters() {
  3096. }
  3097. setFilters.prototype = Expr.filters = Expr.pseudos;
  3098. Expr.setFilters = new setFilters();
  3099. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  3100. var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + ' '];
  3101. if (cached) {
  3102. return parseOnly ? 0 : cached.slice(0);
  3103. }
  3104. soFar = selector;
  3105. groups = [];
  3106. preFilters = Expr.preFilter;
  3107. while (soFar) {
  3108. if (!matched || (match = rcomma.exec(soFar))) {
  3109. if (match) {
  3110. soFar = soFar.slice(match[0].length) || soFar;
  3111. }
  3112. groups.push(tokens = []);
  3113. }
  3114. matched = false;
  3115. if (match = rcombinators.exec(soFar)) {
  3116. matched = match.shift();
  3117. tokens.push({
  3118. value: matched,
  3119. type: match[0].replace(rtrim, ' ')
  3120. });
  3121. soFar = soFar.slice(matched.length);
  3122. }
  3123. for (type in Expr.filter) {
  3124. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  3125. matched = match.shift();
  3126. tokens.push({
  3127. value: matched,
  3128. type: type,
  3129. matches: match
  3130. });
  3131. soFar = soFar.slice(matched.length);
  3132. }
  3133. }
  3134. if (!matched) {
  3135. break;
  3136. }
  3137. }
  3138. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0);
  3139. };
  3140. function toSelector(tokens) {
  3141. var i = 0, len = tokens.length, selector = '';
  3142. for (; i < len; i++) {
  3143. selector += tokens[i].value;
  3144. }
  3145. return selector;
  3146. }
  3147. function addCombinator(matcher, combinator, base) {
  3148. var dir = combinator.dir, checkNonElements = base && dir === 'parentNode', doneName = done++;
  3149. return combinator.first ? function (elem, context, xml) {
  3150. while (elem = elem[dir]) {
  3151. if (elem.nodeType === 1 || checkNonElements) {
  3152. return matcher(elem, context, xml);
  3153. }
  3154. }
  3155. } : function (elem, context, xml) {
  3156. var oldCache, uniqueCache, outerCache, newCache = [
  3157. dirruns,
  3158. doneName
  3159. ];
  3160. if (xml) {
  3161. while (elem = elem[dir]) {
  3162. if (elem.nodeType === 1 || checkNonElements) {
  3163. if (matcher(elem, context, xml)) {
  3164. return true;
  3165. }
  3166. }
  3167. }
  3168. } else {
  3169. while (elem = elem[dir]) {
  3170. if (elem.nodeType === 1 || checkNonElements) {
  3171. outerCache = elem[expando] || (elem[expando] = {});
  3172. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  3173. if ((oldCache = uniqueCache[dir]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  3174. return newCache[2] = oldCache[2];
  3175. } else {
  3176. uniqueCache[dir] = newCache;
  3177. if (newCache[2] = matcher(elem, context, xml)) {
  3178. return true;
  3179. }
  3180. }
  3181. }
  3182. }
  3183. }
  3184. };
  3185. }
  3186. function elementMatcher(matchers) {
  3187. return matchers.length > 1 ? function (elem, context, xml) {
  3188. var i = matchers.length;
  3189. while (i--) {
  3190. if (!matchers[i](elem, context, xml)) {
  3191. return false;
  3192. }
  3193. }
  3194. return true;
  3195. } : matchers[0];
  3196. }
  3197. function multipleContexts(selector, contexts, results) {
  3198. var i = 0, len = contexts.length;
  3199. for (; i < len; i++) {
  3200. Sizzle(selector, contexts[i], results);
  3201. }
  3202. return results;
  3203. }
  3204. function condense(unmatched, map, filter, context, xml) {
  3205. var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = map != null;
  3206. for (; i < len; i++) {
  3207. if (elem = unmatched[i]) {
  3208. if (!filter || filter(elem, context, xml)) {
  3209. newUnmatched.push(elem);
  3210. if (mapped) {
  3211. map.push(i);
  3212. }
  3213. }
  3214. }
  3215. }
  3216. return newUnmatched;
  3217. }
  3218. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  3219. if (postFilter && !postFilter[expando]) {
  3220. postFilter = setMatcher(postFilter);
  3221. }
  3222. if (postFinder && !postFinder[expando]) {
  3223. postFinder = setMatcher(postFinder, postSelector);
  3224. }
  3225. return markFunction(function (seed, results, context, xml) {
  3226. var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(selector || '*', context.nodeType ? [context] : context, []), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems, matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn;
  3227. if (matcher) {
  3228. matcher(matcherIn, matcherOut, context, xml);
  3229. }
  3230. if (postFilter) {
  3231. temp = condense(matcherOut, postMap);
  3232. postFilter(temp, [], context, xml);
  3233. i = temp.length;
  3234. while (i--) {
  3235. if (elem = temp[i]) {
  3236. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  3237. }
  3238. }
  3239. }
  3240. if (seed) {
  3241. if (postFinder || preFilter) {
  3242. if (postFinder) {
  3243. temp = [];
  3244. i = matcherOut.length;
  3245. while (i--) {
  3246. if (elem = matcherOut[i]) {
  3247. temp.push(matcherIn[i] = elem);
  3248. }
  3249. }
  3250. postFinder(null, matcherOut = [], temp, xml);
  3251. }
  3252. i = matcherOut.length;
  3253. while (i--) {
  3254. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  3255. seed[temp] = !(results[temp] = elem);
  3256. }
  3257. }
  3258. }
  3259. } else {
  3260. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  3261. if (postFinder) {
  3262. postFinder(null, results, matcherOut, xml);
  3263. } else {
  3264. push.apply(results, matcherOut);
  3265. }
  3266. }
  3267. });
  3268. }
  3269. function matcherFromTokens(tokens) {
  3270. var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[' '], i = leadingRelative ? 1 : 0, matchContext = addCombinator(function (elem) {
  3271. return elem === checkContext;
  3272. }, implicitRelative, true), matchAnyContext = addCombinator(function (elem) {
  3273. return indexOf(checkContext, elem) > -1;
  3274. }, implicitRelative, true), matchers = [function (elem, context, xml) {
  3275. var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  3276. checkContext = null;
  3277. return ret;
  3278. }];
  3279. for (; i < len; i++) {
  3280. if (matcher = Expr.relative[tokens[i].type]) {
  3281. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  3282. } else {
  3283. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  3284. if (matcher[expando]) {
  3285. j = ++i;
  3286. for (; j < len; j++) {
  3287. if (Expr.relative[tokens[j].type]) {
  3288. break;
  3289. }
  3290. }
  3291. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === ' ' ? '*' : '' })).replace(rtrim, '$1'), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));
  3292. }
  3293. matchers.push(matcher);
  3294. }
  3295. }
  3296. return elementMatcher(matchers);
  3297. }
  3298. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  3299. var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function (seed, context, xml, results, outermost) {
  3300. var elem, j, matcher, matchedCount = 0, i = '0', unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find['TAG']('*', outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len = elems.length;
  3301. if (outermost) {
  3302. outermostContext = context === document || context || outermost;
  3303. }
  3304. for (; i !== len && (elem = elems[i]) != null; i++) {
  3305. if (byElement && elem) {
  3306. j = 0;
  3307. if (!context && elem.ownerDocument !== document) {
  3308. setDocument(elem);
  3309. xml = !documentIsHTML;
  3310. }
  3311. while (matcher = elementMatchers[j++]) {
  3312. if (matcher(elem, context || document, xml)) {
  3313. results.push(elem);
  3314. break;
  3315. }
  3316. }
  3317. if (outermost) {
  3318. dirruns = dirrunsUnique;
  3319. }
  3320. }
  3321. if (bySet) {
  3322. if (elem = !matcher && elem) {
  3323. matchedCount--;
  3324. }
  3325. if (seed) {
  3326. unmatched.push(elem);
  3327. }
  3328. }
  3329. }
  3330. matchedCount += i;
  3331. if (bySet && i !== matchedCount) {
  3332. j = 0;
  3333. while (matcher = setMatchers[j++]) {
  3334. matcher(unmatched, setMatched, context, xml);
  3335. }
  3336. if (seed) {
  3337. if (matchedCount > 0) {
  3338. while (i--) {
  3339. if (!(unmatched[i] || setMatched[i])) {
  3340. setMatched[i] = pop.call(results);
  3341. }
  3342. }
  3343. }
  3344. setMatched = condense(setMatched);
  3345. }
  3346. push.apply(results, setMatched);
  3347. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  3348. Sizzle.uniqueSort(results);
  3349. }
  3350. }
  3351. if (outermost) {
  3352. dirruns = dirrunsUnique;
  3353. outermostContext = contextBackup;
  3354. }
  3355. return unmatched;
  3356. };
  3357. return bySet ? markFunction(superMatcher) : superMatcher;
  3358. }
  3359. compile = Sizzle.compile = function (selector, match) {
  3360. var i, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + ' '];
  3361. if (!cached) {
  3362. if (!match) {
  3363. match = tokenize(selector);
  3364. }
  3365. i = match.length;
  3366. while (i--) {
  3367. cached = matcherFromTokens(match[i]);
  3368. if (cached[expando]) {
  3369. setMatchers.push(cached);
  3370. } else {
  3371. elementMatchers.push(cached);
  3372. }
  3373. }
  3374. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  3375. cached.selector = selector;
  3376. }
  3377. return cached;
  3378. };
  3379. select = Sizzle.select = function (selector, context, results, seed) {
  3380. var i, tokens, token, type, find, compiled = typeof selector === 'function' && selector, match = !seed && tokenize(selector = compiled.selector || selector);
  3381. results = results || [];
  3382. if (match.length === 1) {
  3383. tokens = match[0] = match[0].slice(0);
  3384. if (tokens.length > 2 && (token = tokens[0]).type === 'ID' && support.getById && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  3385. context = (Expr.find['ID'](token.matches[0].replace(runescape, funescape), context) || [])[0];
  3386. if (!context) {
  3387. return results;
  3388. } else if (compiled) {
  3389. context = context.parentNode;
  3390. }
  3391. selector = selector.slice(tokens.shift().value.length);
  3392. }
  3393. i = matchExpr['needsContext'].test(selector) ? 0 : tokens.length;
  3394. while (i--) {
  3395. token = tokens[i];
  3396. if (Expr.relative[type = token.type]) {
  3397. break;
  3398. }
  3399. if (find = Expr.find[type]) {
  3400. if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
  3401. tokens.splice(i, 1);
  3402. selector = seed.length && toSelector(tokens);
  3403. if (!selector) {
  3404. push.apply(results, seed);
  3405. return results;
  3406. }
  3407. break;
  3408. }
  3409. }
  3410. }
  3411. }
  3412. (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
  3413. return results;
  3414. };
  3415. support.sortStable = expando.split('').sort(sortOrder).join('') === expando;
  3416. support.detectDuplicates = !!hasDuplicate;
  3417. setDocument();
  3418. support.sortDetached = assert(function (div1) {
  3419. return div1.compareDocumentPosition(document.createElement('div')) & 1;
  3420. });
  3421. if (!assert(function (div) {
  3422. div.innerHTML = '<a href=\'#\'></a>';
  3423. return div.firstChild.getAttribute('href') === '#';
  3424. })) {
  3425. addHandle('type|href|height|width', function (elem, name, isXML) {
  3426. if (!isXML) {
  3427. return elem.getAttribute(name, name.toLowerCase() === 'type' ? 1 : 2);
  3428. }
  3429. });
  3430. }
  3431. if (!support.attributes || !assert(function (div) {
  3432. div.innerHTML = '<input/>';
  3433. div.firstChild.setAttribute('value', '');
  3434. return div.firstChild.getAttribute('value') === '';
  3435. })) {
  3436. addHandle('value', function (elem, name, isXML) {
  3437. if (!isXML && elem.nodeName.toLowerCase() === 'input') {
  3438. return elem.defaultValue;
  3439. }
  3440. });
  3441. }
  3442. if (!assert(function (div) {
  3443. return div.getAttribute('disabled') == null;
  3444. })) {
  3445. addHandle(booleans, function (elem, name, isXML) {
  3446. var val;
  3447. if (!isXML) {
  3448. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  3449. }
  3450. });
  3451. }
  3452. return Sizzle;
  3453. }(window);
  3454. jQuery.find = Sizzle;
  3455. jQuery.expr = Sizzle.selectors;
  3456. jQuery.expr[':'] = jQuery.expr.pseudos;
  3457. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  3458. jQuery.text = Sizzle.getText;
  3459. jQuery.isXMLDoc = Sizzle.isXML;
  3460. jQuery.contains = Sizzle.contains;
  3461. var dir = function (elem, dir, until) {
  3462. var matched = [], truncate = until !== undefined;
  3463. while ((elem = elem[dir]) && elem.nodeType !== 9) {
  3464. if (elem.nodeType === 1) {
  3465. if (truncate && jQuery(elem).is(until)) {
  3466. break;
  3467. }
  3468. matched.push(elem);
  3469. }
  3470. }
  3471. return matched;
  3472. };
  3473. var siblings = function (n, elem) {
  3474. var matched = [];
  3475. for (; n; n = n.nextSibling) {
  3476. if (n.nodeType === 1 && n !== elem) {
  3477. matched.push(n);
  3478. }
  3479. }
  3480. return matched;
  3481. };
  3482. var rneedsContext = jQuery.expr.match.needsContext;
  3483. var rsingleTag = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/;
  3484. var risSimple = /^.[^:#\[\.,]*$/;
  3485. function winnow(elements, qualifier, not) {
  3486. if (jQuery.isFunction(qualifier)) {
  3487. return jQuery.grep(elements, function (elem, i) {
  3488. return !!qualifier.call(elem, i, elem) !== not;
  3489. });
  3490. }
  3491. if (qualifier.nodeType) {
  3492. return jQuery.grep(elements, function (elem) {
  3493. return elem === qualifier !== not;
  3494. });
  3495. }
  3496. if (typeof qualifier === 'string') {
  3497. if (risSimple.test(qualifier)) {
  3498. return jQuery.filter(qualifier, elements, not);
  3499. }
  3500. qualifier = jQuery.filter(qualifier, elements);
  3501. }
  3502. return jQuery.grep(elements, function (elem) {
  3503. return indexOf.call(qualifier, elem) > -1 !== not;
  3504. });
  3505. }
  3506. jQuery.filter = function (expr, elems, not) {
  3507. var elem = elems[0];
  3508. if (not) {
  3509. expr = ':not(' + expr + ')';
  3510. }
  3511. return elems.length === 1 && elem.nodeType === 1 ? jQuery.find.matchesSelector(elem, expr) ? [elem] : [] : jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  3512. return elem.nodeType === 1;
  3513. }));
  3514. };
  3515. jQuery.fn.extend({
  3516. find: function (selector) {
  3517. var i, len = this.length, ret = [], self = this;
  3518. if (typeof selector !== 'string') {
  3519. return this.pushStack(jQuery(selector).filter(function () {
  3520. for (i = 0; i < len; i++) {
  3521. if (jQuery.contains(self[i], this)) {
  3522. return true;
  3523. }
  3524. }
  3525. }));
  3526. }
  3527. for (i = 0; i < len; i++) {
  3528. jQuery.find(selector, self[i], ret);
  3529. }
  3530. ret = this.pushStack(len > 1 ? jQuery.unique(ret) : ret);
  3531. ret.selector = this.selector ? this.selector + ' ' + selector : selector;
  3532. return ret;
  3533. },
  3534. filter: function (selector) {
  3535. return this.pushStack(winnow(this, selector || [], false));
  3536. },
  3537. not: function (selector) {
  3538. return this.pushStack(winnow(this, selector || [], true));
  3539. },
  3540. is: function (selector) {
  3541. return !!winnow(this, typeof selector === 'string' && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
  3542. }
  3543. });
  3544. var rootjQuery, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, init = jQuery.fn.init = function (selector, context, root) {
  3545. var match, elem;
  3546. if (!selector) {
  3547. return this;
  3548. }
  3549. root = root || rootjQuery;
  3550. if (typeof selector === 'string') {
  3551. if (selector[0] === '<' && selector[selector.length - 1] === '>' && selector.length >= 3) {
  3552. match = [
  3553. null,
  3554. selector,
  3555. null
  3556. ];
  3557. } else {
  3558. match = rquickExpr.exec(selector);
  3559. }
  3560. if (match && (match[1] || !context)) {
  3561. if (match[1]) {
  3562. context = context instanceof jQuery ? context[0] : context;
  3563. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  3564. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  3565. for (match in context) {
  3566. if (jQuery.isFunction(this[match])) {
  3567. this[match](context[match]);
  3568. } else {
  3569. this.attr(match, context[match]);
  3570. }
  3571. }
  3572. }
  3573. return this;
  3574. } else {
  3575. elem = document.getElementById(match[2]);
  3576. if (elem && elem.parentNode) {
  3577. this.length = 1;
  3578. this[0] = elem;
  3579. }
  3580. this.context = document;
  3581. this.selector = selector;
  3582. return this;
  3583. }
  3584. } else if (!context || context.jquery) {
  3585. return (context || root).find(selector);
  3586. } else {
  3587. return this.constructor(context).find(selector);
  3588. }
  3589. } else if (selector.nodeType) {
  3590. this.context = this[0] = selector;
  3591. this.length = 1;
  3592. return this;
  3593. } else if (jQuery.isFunction(selector)) {
  3594. return root.ready !== undefined ? root.ready(selector) : selector(jQuery);
  3595. }
  3596. if (selector.selector !== undefined) {
  3597. this.selector = selector.selector;
  3598. this.context = selector.context;
  3599. }
  3600. return jQuery.makeArray(selector, this);
  3601. };
  3602. init.prototype = jQuery.fn;
  3603. rootjQuery = jQuery(document);
  3604. var rparentsprev = /^(?:parents|prev(?:Until|All))/, guaranteedUnique = {
  3605. children: true,
  3606. contents: true,
  3607. next: true,
  3608. prev: true
  3609. };
  3610. jQuery.fn.extend({
  3611. has: function (target) {
  3612. var targets = jQuery(target, this), l = targets.length;
  3613. return this.filter(function () {
  3614. var i = 0;
  3615. for (; i < l; i++) {
  3616. if (jQuery.contains(this, targets[i])) {
  3617. return true;
  3618. }
  3619. }
  3620. });
  3621. },
  3622. closest: function (selectors, context) {
  3623. var cur, i = 0, l = this.length, matched = [], pos = rneedsContext.test(selectors) || typeof selectors !== 'string' ? jQuery(selectors, context || this.context) : 0;
  3624. for (; i < l; i++) {
  3625. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  3626. if (cur.nodeType < 11 && (pos ? pos.index(cur) > -1 : cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  3627. matched.push(cur);
  3628. break;
  3629. }
  3630. }
  3631. }
  3632. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  3633. },
  3634. index: function (elem) {
  3635. if (!elem) {
  3636. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  3637. }
  3638. if (typeof elem === 'string') {
  3639. return indexOf.call(jQuery(elem), this[0]);
  3640. }
  3641. return indexOf.call(this, elem.jquery ? elem[0] : elem);
  3642. },
  3643. add: function (selector, context) {
  3644. return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
  3645. },
  3646. addBack: function (selector) {
  3647. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  3648. }
  3649. });
  3650. function sibling(cur, dir) {
  3651. while ((cur = cur[dir]) && cur.nodeType !== 1) {
  3652. }
  3653. return cur;
  3654. }
  3655. jQuery.each({
  3656. parent: function (elem) {
  3657. var parent = elem.parentNode;
  3658. return parent && parent.nodeType !== 11 ? parent : null;
  3659. },
  3660. parents: function (elem) {
  3661. return dir(elem, 'parentNode');
  3662. },
  3663. parentsUntil: function (elem, i, until) {
  3664. return dir(elem, 'parentNode', until);
  3665. },
  3666. next: function (elem) {
  3667. return sibling(elem, 'nextSibling');
  3668. },
  3669. prev: function (elem) {
  3670. return sibling(elem, 'previousSibling');
  3671. },
  3672. nextAll: function (elem) {
  3673. return dir(elem, 'nextSibling');
  3674. },
  3675. prevAll: function (elem) {
  3676. return dir(elem, 'previousSibling');
  3677. },
  3678. nextUntil: function (elem, i, until) {
  3679. return dir(elem, 'nextSibling', until);
  3680. },
  3681. prevUntil: function (elem, i, until) {
  3682. return dir(elem, 'previousSibling', until);
  3683. },
  3684. siblings: function (elem) {
  3685. return siblings((elem.parentNode || {}).firstChild, elem);
  3686. },
  3687. children: function (elem) {
  3688. return siblings(elem.firstChild);
  3689. },
  3690. contents: function (elem) {
  3691. return elem.contentDocument || jQuery.merge([], elem.childNodes);
  3692. }
  3693. }, function (name, fn) {
  3694. jQuery.fn[name] = function (until, selector) {
  3695. var matched = jQuery.map(this, fn, until);
  3696. if (name.slice(-5) !== 'Until') {
  3697. selector = until;
  3698. }
  3699. if (selector && typeof selector === 'string') {
  3700. matched = jQuery.filter(selector, matched);
  3701. }
  3702. if (this.length > 1) {
  3703. if (!guaranteedUnique[name]) {
  3704. jQuery.uniqueSort(matched);
  3705. }
  3706. if (rparentsprev.test(name)) {
  3707. matched.reverse();
  3708. }
  3709. }
  3710. return this.pushStack(matched);
  3711. };
  3712. });
  3713. var rnotwhite = /\S+/g;
  3714. function createOptions(options) {
  3715. var object = {};
  3716. jQuery.each(options.match(rnotwhite) || [], function (_, flag) {
  3717. object[flag] = true;
  3718. });
  3719. return object;
  3720. }
  3721. jQuery.Callbacks = function (options) {
  3722. options = typeof options === 'string' ? createOptions(options) : jQuery.extend({}, options);
  3723. var firing, memory, fired, locked, list = [], queue = [], firingIndex = -1, fire = function () {
  3724. locked = options.once;
  3725. fired = firing = true;
  3726. for (; queue.length; firingIndex = -1) {
  3727. memory = queue.shift();
  3728. while (++firingIndex < list.length) {
  3729. if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
  3730. firingIndex = list.length;
  3731. memory = false;
  3732. }
  3733. }
  3734. }
  3735. if (!options.memory) {
  3736. memory = false;
  3737. }
  3738. firing = false;
  3739. if (locked) {
  3740. if (memory) {
  3741. list = [];
  3742. } else {
  3743. list = '';
  3744. }
  3745. }
  3746. }, self = {
  3747. add: function () {
  3748. if (list) {
  3749. if (memory && !firing) {
  3750. firingIndex = list.length - 1;
  3751. queue.push(memory);
  3752. }
  3753. (function add(args) {
  3754. jQuery.each(args, function (_, arg) {
  3755. if (jQuery.isFunction(arg)) {
  3756. if (!options.unique || !self.has(arg)) {
  3757. list.push(arg);
  3758. }
  3759. } else if (arg && arg.length && jQuery.type(arg) !== 'string') {
  3760. add(arg);
  3761. }
  3762. });
  3763. }(arguments));
  3764. if (memory && !firing) {
  3765. fire();
  3766. }
  3767. }
  3768. return this;
  3769. },
  3770. remove: function () {
  3771. jQuery.each(arguments, function (_, arg) {
  3772. var index;
  3773. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  3774. list.splice(index, 1);
  3775. if (index <= firingIndex) {
  3776. firingIndex--;
  3777. }
  3778. }
  3779. });
  3780. return this;
  3781. },
  3782. has: function (fn) {
  3783. return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
  3784. },
  3785. empty: function () {
  3786. if (list) {
  3787. list = [];
  3788. }
  3789. return this;
  3790. },
  3791. disable: function () {
  3792. locked = queue = [];
  3793. list = memory = '';
  3794. return this;
  3795. },
  3796. disabled: function () {
  3797. return !list;
  3798. },
  3799. lock: function () {
  3800. locked = queue = [];
  3801. if (!memory) {
  3802. list = memory = '';
  3803. }
  3804. return this;
  3805. },
  3806. locked: function () {
  3807. return !!locked;
  3808. },
  3809. fireWith: function (context, args) {
  3810. if (!locked) {
  3811. args = args || [];
  3812. args = [
  3813. context,
  3814. args.slice ? args.slice() : args
  3815. ];
  3816. queue.push(args);
  3817. if (!firing) {
  3818. fire();
  3819. }
  3820. }
  3821. return this;
  3822. },
  3823. fire: function () {
  3824. self.fireWith(this, arguments);
  3825. return this;
  3826. },
  3827. fired: function () {
  3828. return !!fired;
  3829. }
  3830. };
  3831. return self;
  3832. };
  3833. jQuery.extend({
  3834. Deferred: function (func) {
  3835. var tuples = [
  3836. [
  3837. 'resolve',
  3838. 'done',
  3839. jQuery.Callbacks('once memory'),
  3840. 'resolved'
  3841. ],
  3842. [
  3843. 'reject',
  3844. 'fail',
  3845. jQuery.Callbacks('once memory'),
  3846. 'rejected'
  3847. ],
  3848. [
  3849. 'notify',
  3850. 'progress',
  3851. jQuery.Callbacks('memory')
  3852. ]
  3853. ], state = 'pending', promise = {
  3854. state: function () {
  3855. return state;
  3856. },
  3857. always: function () {
  3858. deferred.done(arguments).fail(arguments);
  3859. return this;
  3860. },
  3861. then: function () {
  3862. var fns = arguments;
  3863. return jQuery.Deferred(function (newDefer) {
  3864. jQuery.each(tuples, function (i, tuple) {
  3865. var fn = jQuery.isFunction(fns[i]) && fns[i];
  3866. deferred[tuple[1]](function () {
  3867. var returned = fn && fn.apply(this, arguments);
  3868. if (returned && jQuery.isFunction(returned.promise)) {
  3869. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  3870. } else {
  3871. newDefer[tuple[0] + 'With'](this === promise ? newDefer.promise() : this, fn ? [returned] : arguments);
  3872. }
  3873. });
  3874. });
  3875. fns = null;
  3876. }).promise();
  3877. },
  3878. promise: function (obj) {
  3879. return obj != null ? jQuery.extend(obj, promise) : promise;
  3880. }
  3881. }, deferred = {};
  3882. promise.pipe = promise.then;
  3883. jQuery.each(tuples, function (i, tuple) {
  3884. var list = tuple[2], stateString = tuple[3];
  3885. promise[tuple[1]] = list.add;
  3886. if (stateString) {
  3887. list.add(function () {
  3888. state = stateString;
  3889. }, tuples[i ^ 1][2].disable, tuples[2][2].lock);
  3890. }
  3891. deferred[tuple[0]] = function () {
  3892. deferred[tuple[0] + 'With'](this === deferred ? promise : this, arguments);
  3893. return this;
  3894. };
  3895. deferred[tuple[0] + 'With'] = list.fireWith;
  3896. });
  3897. promise.promise(deferred);
  3898. if (func) {
  3899. func.call(deferred, deferred);
  3900. }
  3901. return deferred;
  3902. },
  3903. when: function (subordinate) {
  3904. var i = 0, resolveValues = slice.call(arguments), length = resolveValues.length, remaining = length !== 1 || subordinate && jQuery.isFunction(subordinate.promise) ? length : 0, deferred = remaining === 1 ? subordinate : jQuery.Deferred(), updateFunc = function (i, contexts, values) {
  3905. return function (value) {
  3906. contexts[i] = this;
  3907. values[i] = arguments.length > 1 ? slice.call(arguments) : value;
  3908. if (values === progressValues) {
  3909. deferred.notifyWith(contexts, values);
  3910. } else if (!--remaining) {
  3911. deferred.resolveWith(contexts, values);
  3912. }
  3913. };
  3914. }, progressValues, progressContexts, resolveContexts;
  3915. if (length > 1) {
  3916. progressValues = new Array(length);
  3917. progressContexts = new Array(length);
  3918. resolveContexts = new Array(length);
  3919. for (; i < length; i++) {
  3920. if (resolveValues[i] && jQuery.isFunction(resolveValues[i].promise)) {
  3921. resolveValues[i].promise().progress(updateFunc(i, progressContexts, progressValues)).done(updateFunc(i, resolveContexts, resolveValues)).fail(deferred.reject);
  3922. } else {
  3923. --remaining;
  3924. }
  3925. }
  3926. }
  3927. if (!remaining) {
  3928. deferred.resolveWith(resolveContexts, resolveValues);
  3929. }
  3930. return deferred.promise();
  3931. }
  3932. });
  3933. var readyList;
  3934. jQuery.fn.ready = function (fn) {
  3935. jQuery.ready.promise().done(fn);
  3936. return this;
  3937. };
  3938. jQuery.extend({
  3939. isReady: false,
  3940. readyWait: 1,
  3941. holdReady: function (hold) {
  3942. if (hold) {
  3943. jQuery.readyWait++;
  3944. } else {
  3945. jQuery.ready(true);
  3946. }
  3947. },
  3948. ready: function (wait) {
  3949. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  3950. return;
  3951. }
  3952. jQuery.isReady = true;
  3953. if (wait !== true && --jQuery.readyWait > 0) {
  3954. return;
  3955. }
  3956. readyList.resolveWith(document, [jQuery]);
  3957. if (jQuery.fn.triggerHandler) {
  3958. jQuery(document).triggerHandler('ready');
  3959. jQuery(document).off('ready');
  3960. }
  3961. }
  3962. });
  3963. function completed() {
  3964. document.removeEventListener('DOMContentLoaded', completed);
  3965. window.removeEventListener('load', completed);
  3966. jQuery.ready();
  3967. }
  3968. jQuery.ready.promise = function (obj) {
  3969. if (!readyList) {
  3970. readyList = jQuery.Deferred();
  3971. if (document.readyState === 'complete' || document.readyState !== 'loading' && !document.documentElement.doScroll) {
  3972. window.setTimeout(jQuery.ready);
  3973. } else {
  3974. document.addEventListener('DOMContentLoaded', completed);
  3975. window.addEventListener('load', completed);
  3976. }
  3977. }
  3978. return readyList.promise(obj);
  3979. };
  3980. jQuery.ready.promise();
  3981. var access = function (elems, fn, key, value, chainable, emptyGet, raw) {
  3982. var i = 0, len = elems.length, bulk = key == null;
  3983. if (jQuery.type(key) === 'object') {
  3984. chainable = true;
  3985. for (i in key) {
  3986. access(elems, fn, i, key[i], true, emptyGet, raw);
  3987. }
  3988. } else if (value !== undefined) {
  3989. chainable = true;
  3990. if (!jQuery.isFunction(value)) {
  3991. raw = true;
  3992. }
  3993. if (bulk) {
  3994. if (raw) {
  3995. fn.call(elems, value);
  3996. fn = null;
  3997. } else {
  3998. bulk = fn;
  3999. fn = function (elem, key, value) {
  4000. return bulk.call(jQuery(elem), value);
  4001. };
  4002. }
  4003. }
  4004. if (fn) {
  4005. for (; i < len; i++) {
  4006. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
  4007. }
  4008. }
  4009. }
  4010. return chainable ? elems : bulk ? fn.call(elems) : len ? fn(elems[0], key) : emptyGet;
  4011. };
  4012. var acceptData = function (owner) {
  4013. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  4014. };
  4015. function Data() {
  4016. this.expando = jQuery.expando + Data.uid++;
  4017. }
  4018. Data.uid = 1;
  4019. Data.prototype = {
  4020. register: function (owner, initial) {
  4021. var value = initial || {};
  4022. if (owner.nodeType) {
  4023. owner[this.expando] = value;
  4024. } else {
  4025. Object.defineProperty(owner, this.expando, {
  4026. value: value,
  4027. writable: true,
  4028. configurable: true
  4029. });
  4030. }
  4031. return owner[this.expando];
  4032. },
  4033. cache: function (owner) {
  4034. if (!acceptData(owner)) {
  4035. return {};
  4036. }
  4037. var value = owner[this.expando];
  4038. if (!value) {
  4039. value = {};
  4040. if (acceptData(owner)) {
  4041. if (owner.nodeType) {
  4042. owner[this.expando] = value;
  4043. } else {
  4044. Object.defineProperty(owner, this.expando, {
  4045. value: value,
  4046. configurable: true
  4047. });
  4048. }
  4049. }
  4050. }
  4051. return value;
  4052. },
  4053. set: function (owner, data, value) {
  4054. var prop, cache = this.cache(owner);
  4055. if (typeof data === 'string') {
  4056. cache[data] = value;
  4057. } else {
  4058. for (prop in data) {
  4059. cache[prop] = data[prop];
  4060. }
  4061. }
  4062. return cache;
  4063. },
  4064. get: function (owner, key) {
  4065. return key === undefined ? this.cache(owner) : owner[this.expando] && owner[this.expando][key];
  4066. },
  4067. access: function (owner, key, value) {
  4068. var stored;
  4069. if (key === undefined || key && typeof key === 'string' && value === undefined) {
  4070. stored = this.get(owner, key);
  4071. return stored !== undefined ? stored : this.get(owner, jQuery.camelCase(key));
  4072. }
  4073. this.set(owner, key, value);
  4074. return value !== undefined ? value : key;
  4075. },
  4076. remove: function (owner, key) {
  4077. var i, name, camel, cache = owner[this.expando];
  4078. if (cache === undefined) {
  4079. return;
  4080. }
  4081. if (key === undefined) {
  4082. this.register(owner);
  4083. } else {
  4084. if (jQuery.isArray(key)) {
  4085. name = key.concat(key.map(jQuery.camelCase));
  4086. } else {
  4087. camel = jQuery.camelCase(key);
  4088. if (key in cache) {
  4089. name = [
  4090. key,
  4091. camel
  4092. ];
  4093. } else {
  4094. name = camel;
  4095. name = name in cache ? [name] : name.match(rnotwhite) || [];
  4096. }
  4097. }
  4098. i = name.length;
  4099. while (i--) {
  4100. delete cache[name[i]];
  4101. }
  4102. }
  4103. if (key === undefined || jQuery.isEmptyObject(cache)) {
  4104. if (owner.nodeType) {
  4105. owner[this.expando] = undefined;
  4106. } else {
  4107. delete owner[this.expando];
  4108. }
  4109. }
  4110. },
  4111. hasData: function (owner) {
  4112. var cache = owner[this.expando];
  4113. return cache !== undefined && !jQuery.isEmptyObject(cache);
  4114. }
  4115. };
  4116. var dataPriv = new Data();
  4117. var dataUser = new Data();
  4118. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g;
  4119. function dataAttr(elem, key, data) {
  4120. var name;
  4121. if (data === undefined && elem.nodeType === 1) {
  4122. name = 'data-' + key.replace(rmultiDash, '-$&').toLowerCase();
  4123. data = elem.getAttribute(name);
  4124. if (typeof data === 'string') {
  4125. try {
  4126. data = data === 'true' ? true : data === 'false' ? false : data === 'null' ? null : +data + '' === data ? +data : rbrace.test(data) ? jQuery.parseJSON(data) : data;
  4127. } catch (e) {
  4128. }
  4129. dataUser.set(elem, key, data);
  4130. } else {
  4131. data = undefined;
  4132. }
  4133. }
  4134. return data;
  4135. }
  4136. jQuery.extend({
  4137. hasData: function (elem) {
  4138. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  4139. },
  4140. data: function (elem, name, data) {
  4141. return dataUser.access(elem, name, data);
  4142. },
  4143. removeData: function (elem, name) {
  4144. dataUser.remove(elem, name);
  4145. },
  4146. _data: function (elem, name, data) {
  4147. return dataPriv.access(elem, name, data);
  4148. },
  4149. _removeData: function (elem, name) {
  4150. dataPriv.remove(elem, name);
  4151. }
  4152. });
  4153. jQuery.fn.extend({
  4154. data: function (key, value) {
  4155. var i, name, data, elem = this[0], attrs = elem && elem.attributes;
  4156. if (key === undefined) {
  4157. if (this.length) {
  4158. data = dataUser.get(elem);
  4159. if (elem.nodeType === 1 && !dataPriv.get(elem, 'hasDataAttrs')) {
  4160. i = attrs.length;
  4161. while (i--) {
  4162. if (attrs[i]) {
  4163. name = attrs[i].name;
  4164. if (name.indexOf('data-') === 0) {
  4165. name = jQuery.camelCase(name.slice(5));
  4166. dataAttr(elem, name, data[name]);
  4167. }
  4168. }
  4169. }
  4170. dataPriv.set(elem, 'hasDataAttrs', true);
  4171. }
  4172. }
  4173. return data;
  4174. }
  4175. if (typeof key === 'object') {
  4176. return this.each(function () {
  4177. dataUser.set(this, key);
  4178. });
  4179. }
  4180. return access(this, function (value) {
  4181. var data, camelKey;
  4182. if (elem && value === undefined) {
  4183. data = dataUser.get(elem, key) || dataUser.get(elem, key.replace(rmultiDash, '-$&').toLowerCase());
  4184. if (data !== undefined) {
  4185. return data;
  4186. }
  4187. camelKey = jQuery.camelCase(key);
  4188. data = dataUser.get(elem, camelKey);
  4189. if (data !== undefined) {
  4190. return data;
  4191. }
  4192. data = dataAttr(elem, camelKey, undefined);
  4193. if (data !== undefined) {
  4194. return data;
  4195. }
  4196. return;
  4197. }
  4198. camelKey = jQuery.camelCase(key);
  4199. this.each(function () {
  4200. var data = dataUser.get(this, camelKey);
  4201. dataUser.set(this, camelKey, value);
  4202. if (key.indexOf('-') > -1 && data !== undefined) {
  4203. dataUser.set(this, key, value);
  4204. }
  4205. });
  4206. }, null, value, arguments.length > 1, null, true);
  4207. },
  4208. removeData: function (key) {
  4209. return this.each(function () {
  4210. dataUser.remove(this, key);
  4211. });
  4212. }
  4213. });
  4214. jQuery.extend({
  4215. queue: function (elem, type, data) {
  4216. var queue;
  4217. if (elem) {
  4218. type = (type || 'fx') + 'queue';
  4219. queue = dataPriv.get(elem, type);
  4220. if (data) {
  4221. if (!queue || jQuery.isArray(data)) {
  4222. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  4223. } else {
  4224. queue.push(data);
  4225. }
  4226. }
  4227. return queue || [];
  4228. }
  4229. },
  4230. dequeue: function (elem, type) {
  4231. type = type || 'fx';
  4232. var queue = jQuery.queue(elem, type), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks(elem, type), next = function () {
  4233. jQuery.dequeue(elem, type);
  4234. };
  4235. if (fn === 'inprogress') {
  4236. fn = queue.shift();
  4237. startLength--;
  4238. }
  4239. if (fn) {
  4240. if (type === 'fx') {
  4241. queue.unshift('inprogress');
  4242. }
  4243. delete hooks.stop;
  4244. fn.call(elem, next, hooks);
  4245. }
  4246. if (!startLength && hooks) {
  4247. hooks.empty.fire();
  4248. }
  4249. },
  4250. _queueHooks: function (elem, type) {
  4251. var key = type + 'queueHooks';
  4252. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  4253. empty: jQuery.Callbacks('once memory').add(function () {
  4254. dataPriv.remove(elem, [
  4255. type + 'queue',
  4256. key
  4257. ]);
  4258. })
  4259. });
  4260. }
  4261. });
  4262. jQuery.fn.extend({
  4263. queue: function (type, data) {
  4264. var setter = 2;
  4265. if (typeof type !== 'string') {
  4266. data = type;
  4267. type = 'fx';
  4268. setter--;
  4269. }
  4270. if (arguments.length < setter) {
  4271. return jQuery.queue(this[0], type);
  4272. }
  4273. return data === undefined ? this : this.each(function () {
  4274. var queue = jQuery.queue(this, type, data);
  4275. jQuery._queueHooks(this, type);
  4276. if (type === 'fx' && queue[0] !== 'inprogress') {
  4277. jQuery.dequeue(this, type);
  4278. }
  4279. });
  4280. },
  4281. dequeue: function (type) {
  4282. return this.each(function () {
  4283. jQuery.dequeue(this, type);
  4284. });
  4285. },
  4286. clearQueue: function (type) {
  4287. return this.queue(type || 'fx', []);
  4288. },
  4289. promise: function (type, obj) {
  4290. var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function () {
  4291. if (!--count) {
  4292. defer.resolveWith(elements, [elements]);
  4293. }
  4294. };
  4295. if (typeof type !== 'string') {
  4296. obj = type;
  4297. type = undefined;
  4298. }
  4299. type = type || 'fx';
  4300. while (i--) {
  4301. tmp = dataPriv.get(elements[i], type + 'queueHooks');
  4302. if (tmp && tmp.empty) {
  4303. count++;
  4304. tmp.empty.add(resolve);
  4305. }
  4306. }
  4307. resolve();
  4308. return defer.promise(obj);
  4309. }
  4310. });
  4311. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  4312. var rcssNum = new RegExp('^(?:([+-])=|)(' + pnum + ')([a-z%]*)$', 'i');
  4313. var cssExpand = [
  4314. 'Top',
  4315. 'Right',
  4316. 'Bottom',
  4317. 'Left'
  4318. ];
  4319. var isHidden = function (elem, el) {
  4320. elem = el || elem;
  4321. return jQuery.css(elem, 'display') === 'none' || !jQuery.contains(elem.ownerDocument, elem);
  4322. };
  4323. function adjustCSS(elem, prop, valueParts, tween) {
  4324. var adjusted, scale = 1, maxIterations = 20, currentValue = tween ? function () {
  4325. return tween.cur();
  4326. } : function () {
  4327. return jQuery.css(elem, prop, '');
  4328. }, initial = currentValue(), unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? '' : 'px'), initialInUnit = (jQuery.cssNumber[prop] || unit !== 'px' && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  4329. if (initialInUnit && initialInUnit[3] !== unit) {
  4330. unit = unit || initialInUnit[3];
  4331. valueParts = valueParts || [];
  4332. initialInUnit = +initial || 1;
  4333. do {
  4334. scale = scale || '.5';
  4335. initialInUnit = initialInUnit / scale;
  4336. jQuery.style(elem, prop, initialInUnit + unit);
  4337. } while (scale !== (scale = currentValue() / initial) && scale !== 1 && --maxIterations);
  4338. }
  4339. if (valueParts) {
  4340. initialInUnit = +initialInUnit || +initial || 0;
  4341. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  4342. if (tween) {
  4343. tween.unit = unit;
  4344. tween.start = initialInUnit;
  4345. tween.end = adjusted;
  4346. }
  4347. }
  4348. return adjusted;
  4349. }
  4350. var rcheckableType = /^(?:checkbox|radio)$/i;
  4351. var rtagName = /<([\w:-]+)/;
  4352. var rscriptType = /^$|\/(?:java|ecma)script/i;
  4353. var wrapMap = {
  4354. option: [
  4355. 1,
  4356. '<select multiple=\'multiple\'>',
  4357. '</select>'
  4358. ],
  4359. thead: [
  4360. 1,
  4361. '<table>',
  4362. '</table>'
  4363. ],
  4364. col: [
  4365. 2,
  4366. '<table><colgroup>',
  4367. '</colgroup></table>'
  4368. ],
  4369. tr: [
  4370. 2,
  4371. '<table><tbody>',
  4372. '</tbody></table>'
  4373. ],
  4374. td: [
  4375. 3,
  4376. '<table><tbody><tr>',
  4377. '</tr></tbody></table>'
  4378. ],
  4379. _default: [
  4380. 0,
  4381. '',
  4382. ''
  4383. ]
  4384. };
  4385. wrapMap.optgroup = wrapMap.option;
  4386. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  4387. wrapMap.th = wrapMap.td;
  4388. function getAll(context, tag) {
  4389. var ret = typeof context.getElementsByTagName !== 'undefined' ? context.getElementsByTagName(tag || '*') : typeof context.querySelectorAll !== 'undefined' ? context.querySelectorAll(tag || '*') : [];
  4390. return tag === undefined || tag && jQuery.nodeName(context, tag) ? jQuery.merge([context], ret) : ret;
  4391. }
  4392. function setGlobalEval(elems, refElements) {
  4393. var i = 0, l = elems.length;
  4394. for (; i < l; i++) {
  4395. dataPriv.set(elems[i], 'globalEval', !refElements || dataPriv.get(refElements[i], 'globalEval'));
  4396. }
  4397. }
  4398. var rhtml = /<|&#?\w+;/;
  4399. function buildFragment(elems, context, scripts, selection, ignored) {
  4400. var elem, tmp, tag, wrap, contains, j, fragment = context.createDocumentFragment(), nodes = [], i = 0, l = elems.length;
  4401. for (; i < l; i++) {
  4402. elem = elems[i];
  4403. if (elem || elem === 0) {
  4404. if (jQuery.type(elem) === 'object') {
  4405. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  4406. } else if (!rhtml.test(elem)) {
  4407. nodes.push(context.createTextNode(elem));
  4408. } else {
  4409. tmp = tmp || fragment.appendChild(context.createElement('div'));
  4410. tag = (rtagName.exec(elem) || [
  4411. '',
  4412. ''
  4413. ])[1].toLowerCase();
  4414. wrap = wrapMap[tag] || wrapMap._default;
  4415. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  4416. j = wrap[0];
  4417. while (j--) {
  4418. tmp = tmp.lastChild;
  4419. }
  4420. jQuery.merge(nodes, tmp.childNodes);
  4421. tmp = fragment.firstChild;
  4422. tmp.textContent = '';
  4423. }
  4424. }
  4425. }
  4426. fragment.textContent = '';
  4427. i = 0;
  4428. while (elem = nodes[i++]) {
  4429. if (selection && jQuery.inArray(elem, selection) > -1) {
  4430. if (ignored) {
  4431. ignored.push(elem);
  4432. }
  4433. continue;
  4434. }
  4435. contains = jQuery.contains(elem.ownerDocument, elem);
  4436. tmp = getAll(fragment.appendChild(elem), 'script');
  4437. if (contains) {
  4438. setGlobalEval(tmp);
  4439. }
  4440. if (scripts) {
  4441. j = 0;
  4442. while (elem = tmp[j++]) {
  4443. if (rscriptType.test(elem.type || '')) {
  4444. scripts.push(elem);
  4445. }
  4446. }
  4447. }
  4448. }
  4449. return fragment;
  4450. }
  4451. (function () {
  4452. var fragment = document.createDocumentFragment(), div = fragment.appendChild(document.createElement('div')), input = document.createElement('input');
  4453. input.setAttribute('type', 'radio');
  4454. input.setAttribute('checked', 'checked');
  4455. input.setAttribute('name', 't');
  4456. div.appendChild(input);
  4457. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  4458. div.innerHTML = '<textarea>x</textarea>';
  4459. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  4460. }());
  4461. var rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  4462. function returnTrue() {
  4463. return true;
  4464. }
  4465. function returnFalse() {
  4466. return false;
  4467. }
  4468. function safeActiveElement() {
  4469. try {
  4470. return document.activeElement;
  4471. } catch (err) {
  4472. }
  4473. }
  4474. function on(elem, types, selector, data, fn, one) {
  4475. var origFn, type;
  4476. if (typeof types === 'object') {
  4477. if (typeof selector !== 'string') {
  4478. data = data || selector;
  4479. selector = undefined;
  4480. }
  4481. for (type in types) {
  4482. on(elem, type, selector, data, types[type], one);
  4483. }
  4484. return elem;
  4485. }
  4486. if (data == null && fn == null) {
  4487. fn = selector;
  4488. data = selector = undefined;
  4489. } else if (fn == null) {
  4490. if (typeof selector === 'string') {
  4491. fn = data;
  4492. data = undefined;
  4493. } else {
  4494. fn = data;
  4495. data = selector;
  4496. selector = undefined;
  4497. }
  4498. }
  4499. if (fn === false) {
  4500. fn = returnFalse;
  4501. } else if (!fn) {
  4502. return elem;
  4503. }
  4504. if (one === 1) {
  4505. origFn = fn;
  4506. fn = function (event) {
  4507. jQuery().off(event);
  4508. return origFn.apply(this, arguments);
  4509. };
  4510. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  4511. }
  4512. return elem.each(function () {
  4513. jQuery.event.add(this, types, fn, data, selector);
  4514. });
  4515. }
  4516. jQuery.event = {
  4517. global: {},
  4518. add: function (elem, types, handler, data, selector) {
  4519. var handleObjIn, eventHandle, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.get(elem);
  4520. if (!elemData) {
  4521. return;
  4522. }
  4523. if (handler.handler) {
  4524. handleObjIn = handler;
  4525. handler = handleObjIn.handler;
  4526. selector = handleObjIn.selector;
  4527. }
  4528. if (!handler.guid) {
  4529. handler.guid = jQuery.guid++;
  4530. }
  4531. if (!(events = elemData.events)) {
  4532. events = elemData.events = {};
  4533. }
  4534. if (!(eventHandle = elemData.handle)) {
  4535. eventHandle = elemData.handle = function (e) {
  4536. return typeof jQuery !== 'undefined' && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
  4537. };
  4538. }
  4539. types = (types || '').match(rnotwhite) || [''];
  4540. t = types.length;
  4541. while (t--) {
  4542. tmp = rtypenamespace.exec(types[t]) || [];
  4543. type = origType = tmp[1];
  4544. namespaces = (tmp[2] || '').split('.').sort();
  4545. if (!type) {
  4546. continue;
  4547. }
  4548. special = jQuery.event.special[type] || {};
  4549. type = (selector ? special.delegateType : special.bindType) || type;
  4550. special = jQuery.event.special[type] || {};
  4551. handleObj = jQuery.extend({
  4552. type: type,
  4553. origType: origType,
  4554. data: data,
  4555. handler: handler,
  4556. guid: handler.guid,
  4557. selector: selector,
  4558. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  4559. namespace: namespaces.join('.')
  4560. }, handleObjIn);
  4561. if (!(handlers = events[type])) {
  4562. handlers = events[type] = [];
  4563. handlers.delegateCount = 0;
  4564. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  4565. if (elem.addEventListener) {
  4566. elem.addEventListener(type, eventHandle);
  4567. }
  4568. }
  4569. }
  4570. if (special.add) {
  4571. special.add.call(elem, handleObj);
  4572. if (!handleObj.handler.guid) {
  4573. handleObj.handler.guid = handler.guid;
  4574. }
  4575. }
  4576. if (selector) {
  4577. handlers.splice(handlers.delegateCount++, 0, handleObj);
  4578. } else {
  4579. handlers.push(handleObj);
  4580. }
  4581. jQuery.event.global[type] = true;
  4582. }
  4583. },
  4584. remove: function (elem, types, handler, selector, mappedTypes) {
  4585. var j, origCount, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  4586. if (!elemData || !(events = elemData.events)) {
  4587. return;
  4588. }
  4589. types = (types || '').match(rnotwhite) || [''];
  4590. t = types.length;
  4591. while (t--) {
  4592. tmp = rtypenamespace.exec(types[t]) || [];
  4593. type = origType = tmp[1];
  4594. namespaces = (tmp[2] || '').split('.').sort();
  4595. if (!type) {
  4596. for (type in events) {
  4597. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  4598. }
  4599. continue;
  4600. }
  4601. special = jQuery.event.special[type] || {};
  4602. type = (selector ? special.delegateType : special.bindType) || type;
  4603. handlers = events[type] || [];
  4604. tmp = tmp[2] && new RegExp('(^|\\.)' + namespaces.join('\\.(?:.*\\.|)') + '(\\.|$)');
  4605. origCount = j = handlers.length;
  4606. while (j--) {
  4607. handleObj = handlers[j];
  4608. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === '**' && handleObj.selector)) {
  4609. handlers.splice(j, 1);
  4610. if (handleObj.selector) {
  4611. handlers.delegateCount--;
  4612. }
  4613. if (special.remove) {
  4614. special.remove.call(elem, handleObj);
  4615. }
  4616. }
  4617. }
  4618. if (origCount && !handlers.length) {
  4619. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  4620. jQuery.removeEvent(elem, type, elemData.handle);
  4621. }
  4622. delete events[type];
  4623. }
  4624. }
  4625. if (jQuery.isEmptyObject(events)) {
  4626. dataPriv.remove(elem, 'handle events');
  4627. }
  4628. },
  4629. dispatch: function (event) {
  4630. event = jQuery.event.fix(event);
  4631. var i, j, ret, matched, handleObj, handlerQueue = [], args = slice.call(arguments), handlers = (dataPriv.get(this, 'events') || {})[event.type] || [], special = jQuery.event.special[event.type] || {};
  4632. args[0] = event;
  4633. event.delegateTarget = this;
  4634. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  4635. return;
  4636. }
  4637. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  4638. i = 0;
  4639. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  4640. event.currentTarget = matched.elem;
  4641. j = 0;
  4642. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  4643. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  4644. event.handleObj = handleObj;
  4645. event.data = handleObj.data;
  4646. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  4647. if (ret !== undefined) {
  4648. if ((event.result = ret) === false) {
  4649. event.preventDefault();
  4650. event.stopPropagation();
  4651. }
  4652. }
  4653. }
  4654. }
  4655. }
  4656. if (special.postDispatch) {
  4657. special.postDispatch.call(this, event);
  4658. }
  4659. return event.result;
  4660. },
  4661. handlers: function (event, handlers) {
  4662. var i, matches, sel, handleObj, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target;
  4663. if (delegateCount && cur.nodeType && (event.type !== 'click' || isNaN(event.button) || event.button < 1)) {
  4664. for (; cur !== this; cur = cur.parentNode || this) {
  4665. if (cur.nodeType === 1 && (cur.disabled !== true || event.type !== 'click')) {
  4666. matches = [];
  4667. for (i = 0; i < delegateCount; i++) {
  4668. handleObj = handlers[i];
  4669. sel = handleObj.selector + ' ';
  4670. if (matches[sel] === undefined) {
  4671. matches[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  4672. }
  4673. if (matches[sel]) {
  4674. matches.push(handleObj);
  4675. }
  4676. }
  4677. if (matches.length) {
  4678. handlerQueue.push({
  4679. elem: cur,
  4680. handlers: matches
  4681. });
  4682. }
  4683. }
  4684. }
  4685. }
  4686. if (delegateCount < handlers.length) {
  4687. handlerQueue.push({
  4688. elem: this,
  4689. handlers: handlers.slice(delegateCount)
  4690. });
  4691. }
  4692. return handlerQueue;
  4693. },
  4694. props: ('altKey bubbles cancelable ctrlKey currentTarget detail eventPhase ' + 'metaKey relatedTarget shiftKey target timeStamp view which').split(' '),
  4695. fixHooks: {},
  4696. keyHooks: {
  4697. props: 'char charCode key keyCode'.split(' '),
  4698. filter: function (event, original) {
  4699. if (event.which == null) {
  4700. event.which = original.charCode != null ? original.charCode : original.keyCode;
  4701. }
  4702. return event;
  4703. }
  4704. },
  4705. mouseHooks: {
  4706. props: ('button buttons clientX clientY offsetX offsetY pageX pageY ' + 'screenX screenY toElement').split(' '),
  4707. filter: function (event, original) {
  4708. var eventDoc, doc, body, button = original.button;
  4709. if (event.pageX == null && original.clientX != null) {
  4710. eventDoc = event.target.ownerDocument || document;
  4711. doc = eventDoc.documentElement;
  4712. body = eventDoc.body;
  4713. event.pageX = original.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
  4714. event.pageY = original.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
  4715. }
  4716. if (!event.which && button !== undefined) {
  4717. event.which = button & 1 ? 1 : button & 2 ? 3 : button & 4 ? 2 : 0;
  4718. }
  4719. return event;
  4720. }
  4721. },
  4722. fix: function (event) {
  4723. if (event[jQuery.expando]) {
  4724. return event;
  4725. }
  4726. var i, prop, copy, type = event.type, originalEvent = event, fixHook = this.fixHooks[type];
  4727. if (!fixHook) {
  4728. this.fixHooks[type] = fixHook = rmouseEvent.test(type) ? this.mouseHooks : rkeyEvent.test(type) ? this.keyHooks : {};
  4729. }
  4730. copy = fixHook.props ? this.props.concat(fixHook.props) : this.props;
  4731. event = new jQuery.Event(originalEvent);
  4732. i = copy.length;
  4733. while (i--) {
  4734. prop = copy[i];
  4735. event[prop] = originalEvent[prop];
  4736. }
  4737. if (!event.target) {
  4738. event.target = document;
  4739. }
  4740. if (event.target.nodeType === 3) {
  4741. event.target = event.target.parentNode;
  4742. }
  4743. return fixHook.filter ? fixHook.filter(event, originalEvent) : event;
  4744. },
  4745. special: {
  4746. load: { noBubble: true },
  4747. focus: {
  4748. trigger: function () {
  4749. if (this !== safeActiveElement() && this.focus) {
  4750. this.focus();
  4751. return false;
  4752. }
  4753. },
  4754. delegateType: 'focusin'
  4755. },
  4756. blur: {
  4757. trigger: function () {
  4758. if (this === safeActiveElement() && this.blur) {
  4759. this.blur();
  4760. return false;
  4761. }
  4762. },
  4763. delegateType: 'focusout'
  4764. },
  4765. click: {
  4766. trigger: function () {
  4767. if (this.type === 'checkbox' && this.click && jQuery.nodeName(this, 'input')) {
  4768. this.click();
  4769. return false;
  4770. }
  4771. },
  4772. _default: function (event) {
  4773. return jQuery.nodeName(event.target, 'a');
  4774. }
  4775. },
  4776. beforeunload: {
  4777. postDispatch: function (event) {
  4778. if (event.result !== undefined && event.originalEvent) {
  4779. event.originalEvent.returnValue = event.result;
  4780. }
  4781. }
  4782. }
  4783. }
  4784. };
  4785. jQuery.removeEvent = function (elem, type, handle) {
  4786. if (elem.removeEventListener) {
  4787. elem.removeEventListener(type, handle);
  4788. }
  4789. };
  4790. jQuery.Event = function (src, props) {
  4791. if (!(this instanceof jQuery.Event)) {
  4792. return new jQuery.Event(src, props);
  4793. }
  4794. if (src && src.type) {
  4795. this.originalEvent = src;
  4796. this.type = src.type;
  4797. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined && src.returnValue === false ? returnTrue : returnFalse;
  4798. } else {
  4799. this.type = src;
  4800. }
  4801. if (props) {
  4802. jQuery.extend(this, props);
  4803. }
  4804. this.timeStamp = src && src.timeStamp || jQuery.now();
  4805. this[jQuery.expando] = true;
  4806. };
  4807. jQuery.Event.prototype = {
  4808. constructor: jQuery.Event,
  4809. isDefaultPrevented: returnFalse,
  4810. isPropagationStopped: returnFalse,
  4811. isImmediatePropagationStopped: returnFalse,
  4812. isSimulated: false,
  4813. preventDefault: function () {
  4814. var e = this.originalEvent;
  4815. this.isDefaultPrevented = returnTrue;
  4816. if (e && !this.isSimulated) {
  4817. e.preventDefault();
  4818. }
  4819. },
  4820. stopPropagation: function () {
  4821. var e = this.originalEvent;
  4822. this.isPropagationStopped = returnTrue;
  4823. if (e && !this.isSimulated) {
  4824. e.stopPropagation();
  4825. }
  4826. },
  4827. stopImmediatePropagation: function () {
  4828. var e = this.originalEvent;
  4829. this.isImmediatePropagationStopped = returnTrue;
  4830. if (e && !this.isSimulated) {
  4831. e.stopImmediatePropagation();
  4832. }
  4833. this.stopPropagation();
  4834. }
  4835. };
  4836. jQuery.each({
  4837. mouseenter: 'mouseover',
  4838. mouseleave: 'mouseout',
  4839. pointerenter: 'pointerover',
  4840. pointerleave: 'pointerout'
  4841. }, function (orig, fix) {
  4842. jQuery.event.special[orig] = {
  4843. delegateType: fix,
  4844. bindType: fix,
  4845. handle: function (event) {
  4846. var ret, target = this, related = event.relatedTarget, handleObj = event.handleObj;
  4847. if (!related || related !== target && !jQuery.contains(target, related)) {
  4848. event.type = handleObj.origType;
  4849. ret = handleObj.handler.apply(this, arguments);
  4850. event.type = fix;
  4851. }
  4852. return ret;
  4853. }
  4854. };
  4855. });
  4856. jQuery.fn.extend({
  4857. on: function (types, selector, data, fn) {
  4858. return on(this, types, selector, data, fn);
  4859. },
  4860. one: function (types, selector, data, fn) {
  4861. return on(this, types, selector, data, fn, 1);
  4862. },
  4863. off: function (types, selector, fn) {
  4864. var handleObj, type;
  4865. if (types && types.preventDefault && types.handleObj) {
  4866. handleObj = types.handleObj;
  4867. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + '.' + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  4868. return this;
  4869. }
  4870. if (typeof types === 'object') {
  4871. for (type in types) {
  4872. this.off(type, selector, types[type]);
  4873. }
  4874. return this;
  4875. }
  4876. if (selector === false || typeof selector === 'function') {
  4877. fn = selector;
  4878. selector = undefined;
  4879. }
  4880. if (fn === false) {
  4881. fn = returnFalse;
  4882. }
  4883. return this.each(function () {
  4884. jQuery.event.remove(this, types, fn, selector);
  4885. });
  4886. }
  4887. });
  4888. var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, rnoInnerhtml = /<script|<style|<link/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rscriptTypeMasked = /^true\/(.*)/, rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  4889. function manipulationTarget(elem, content) {
  4890. return jQuery.nodeName(elem, 'table') && jQuery.nodeName(content.nodeType !== 11 ? content : content.firstChild, 'tr') ? elem.getElementsByTagName('tbody')[0] || elem.appendChild(elem.ownerDocument.createElement('tbody')) : elem;
  4891. }
  4892. function disableScript(elem) {
  4893. elem.type = (elem.getAttribute('type') !== null) + '/' + elem.type;
  4894. return elem;
  4895. }
  4896. function restoreScript(elem) {
  4897. var match = rscriptTypeMasked.exec(elem.type);
  4898. if (match) {
  4899. elem.type = match[1];
  4900. } else {
  4901. elem.removeAttribute('type');
  4902. }
  4903. return elem;
  4904. }
  4905. function cloneCopyEvent(src, dest) {
  4906. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  4907. if (dest.nodeType !== 1) {
  4908. return;
  4909. }
  4910. if (dataPriv.hasData(src)) {
  4911. pdataOld = dataPriv.access(src);
  4912. pdataCur = dataPriv.set(dest, pdataOld);
  4913. events = pdataOld.events;
  4914. if (events) {
  4915. delete pdataCur.handle;
  4916. pdataCur.events = {};
  4917. for (type in events) {
  4918. for (i = 0, l = events[type].length; i < l; i++) {
  4919. jQuery.event.add(dest, type, events[type][i]);
  4920. }
  4921. }
  4922. }
  4923. }
  4924. if (dataUser.hasData(src)) {
  4925. udataOld = dataUser.access(src);
  4926. udataCur = jQuery.extend({}, udataOld);
  4927. dataUser.set(dest, udataCur);
  4928. }
  4929. }
  4930. function fixInput(src, dest) {
  4931. var nodeName = dest.nodeName.toLowerCase();
  4932. if (nodeName === 'input' && rcheckableType.test(src.type)) {
  4933. dest.checked = src.checked;
  4934. } else if (nodeName === 'input' || nodeName === 'textarea') {
  4935. dest.defaultValue = src.defaultValue;
  4936. }
  4937. }
  4938. function domManip(collection, args, callback, ignored) {
  4939. args = concat.apply([], args);
  4940. var fragment, first, scripts, hasScripts, node, doc, i = 0, l = collection.length, iNoClone = l - 1, value = args[0], isFunction = jQuery.isFunction(value);
  4941. if (isFunction || l > 1 && typeof value === 'string' && !support.checkClone && rchecked.test(value)) {
  4942. return collection.each(function (index) {
  4943. var self = collection.eq(index);
  4944. if (isFunction) {
  4945. args[0] = value.call(this, index, self.html());
  4946. }
  4947. domManip(self, args, callback, ignored);
  4948. });
  4949. }
  4950. if (l) {
  4951. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  4952. first = fragment.firstChild;
  4953. if (fragment.childNodes.length === 1) {
  4954. fragment = first;
  4955. }
  4956. if (first || ignored) {
  4957. scripts = jQuery.map(getAll(fragment, 'script'), disableScript);
  4958. hasScripts = scripts.length;
  4959. for (; i < l; i++) {
  4960. node = fragment;
  4961. if (i !== iNoClone) {
  4962. node = jQuery.clone(node, true, true);
  4963. if (hasScripts) {
  4964. jQuery.merge(scripts, getAll(node, 'script'));
  4965. }
  4966. }
  4967. callback.call(collection[i], node, i);
  4968. }
  4969. if (hasScripts) {
  4970. doc = scripts[scripts.length - 1].ownerDocument;
  4971. jQuery.map(scripts, restoreScript);
  4972. for (i = 0; i < hasScripts; i++) {
  4973. node = scripts[i];
  4974. if (rscriptType.test(node.type || '') && !dataPriv.access(node, 'globalEval') && jQuery.contains(doc, node)) {
  4975. if (node.src) {
  4976. if (jQuery._evalUrl) {
  4977. jQuery._evalUrl(node.src);
  4978. }
  4979. } else {
  4980. jQuery.globalEval(node.textContent.replace(rcleanScript, ''));
  4981. }
  4982. }
  4983. }
  4984. }
  4985. }
  4986. }
  4987. return collection;
  4988. }
  4989. function remove(elem, selector, keepData) {
  4990. var node, nodes = selector ? jQuery.filter(selector, elem) : elem, i = 0;
  4991. for (; (node = nodes[i]) != null; i++) {
  4992. if (!keepData && node.nodeType === 1) {
  4993. jQuery.cleanData(getAll(node));
  4994. }
  4995. if (node.parentNode) {
  4996. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  4997. setGlobalEval(getAll(node, 'script'));
  4998. }
  4999. node.parentNode.removeChild(node);
  5000. }
  5001. }
  5002. return elem;
  5003. }
  5004. jQuery.extend({
  5005. htmlPrefilter: function (html) {
  5006. return html.replace(rxhtmlTag, '<$1></$2>');
  5007. },
  5008. clone: function (elem, dataAndEvents, deepDataAndEvents) {
  5009. var i, l, srcElements, destElements, clone = elem.cloneNode(true), inPage = jQuery.contains(elem.ownerDocument, elem);
  5010. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  5011. destElements = getAll(clone);
  5012. srcElements = getAll(elem);
  5013. for (i = 0, l = srcElements.length; i < l; i++) {
  5014. fixInput(srcElements[i], destElements[i]);
  5015. }
  5016. }
  5017. if (dataAndEvents) {
  5018. if (deepDataAndEvents) {
  5019. srcElements = srcElements || getAll(elem);
  5020. destElements = destElements || getAll(clone);
  5021. for (i = 0, l = srcElements.length; i < l; i++) {
  5022. cloneCopyEvent(srcElements[i], destElements[i]);
  5023. }
  5024. } else {
  5025. cloneCopyEvent(elem, clone);
  5026. }
  5027. }
  5028. destElements = getAll(clone, 'script');
  5029. if (destElements.length > 0) {
  5030. setGlobalEval(destElements, !inPage && getAll(elem, 'script'));
  5031. }
  5032. return clone;
  5033. },
  5034. cleanData: function (elems) {
  5035. var data, elem, type, special = jQuery.event.special, i = 0;
  5036. for (; (elem = elems[i]) !== undefined; i++) {
  5037. if (acceptData(elem)) {
  5038. if (data = elem[dataPriv.expando]) {
  5039. if (data.events) {
  5040. for (type in data.events) {
  5041. if (special[type]) {
  5042. jQuery.event.remove(elem, type);
  5043. } else {
  5044. jQuery.removeEvent(elem, type, data.handle);
  5045. }
  5046. }
  5047. }
  5048. elem[dataPriv.expando] = undefined;
  5049. }
  5050. if (elem[dataUser.expando]) {
  5051. elem[dataUser.expando] = undefined;
  5052. }
  5053. }
  5054. }
  5055. }
  5056. });
  5057. jQuery.fn.extend({
  5058. domManip: domManip,
  5059. detach: function (selector) {
  5060. return remove(this, selector, true);
  5061. },
  5062. remove: function (selector) {
  5063. return remove(this, selector);
  5064. },
  5065. text: function (value) {
  5066. return access(this, function (value) {
  5067. return value === undefined ? jQuery.text(this) : this.empty().each(function () {
  5068. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  5069. this.textContent = value;
  5070. }
  5071. });
  5072. }, null, value, arguments.length);
  5073. },
  5074. append: function () {
  5075. return domManip(this, arguments, function (elem) {
  5076. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  5077. var target = manipulationTarget(this, elem);
  5078. target.appendChild(elem);
  5079. }
  5080. });
  5081. },
  5082. prepend: function () {
  5083. return domManip(this, arguments, function (elem) {
  5084. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  5085. var target = manipulationTarget(this, elem);
  5086. target.insertBefore(elem, target.firstChild);
  5087. }
  5088. });
  5089. },
  5090. before: function () {
  5091. return domManip(this, arguments, function (elem) {
  5092. if (this.parentNode) {
  5093. this.parentNode.insertBefore(elem, this);
  5094. }
  5095. });
  5096. },
  5097. after: function () {
  5098. return domManip(this, arguments, function (elem) {
  5099. if (this.parentNode) {
  5100. this.parentNode.insertBefore(elem, this.nextSibling);
  5101. }
  5102. });
  5103. },
  5104. empty: function () {
  5105. var elem, i = 0;
  5106. for (; (elem = this[i]) != null; i++) {
  5107. if (elem.nodeType === 1) {
  5108. jQuery.cleanData(getAll(elem, false));
  5109. elem.textContent = '';
  5110. }
  5111. }
  5112. return this;
  5113. },
  5114. clone: function (dataAndEvents, deepDataAndEvents) {
  5115. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  5116. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  5117. return this.map(function () {
  5118. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  5119. });
  5120. },
  5121. html: function (value) {
  5122. return access(this, function (value) {
  5123. var elem = this[0] || {}, i = 0, l = this.length;
  5124. if (value === undefined && elem.nodeType === 1) {
  5125. return elem.innerHTML;
  5126. }
  5127. if (typeof value === 'string' && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || [
  5128. '',
  5129. ''
  5130. ])[1].toLowerCase()]) {
  5131. value = jQuery.htmlPrefilter(value);
  5132. try {
  5133. for (; i < l; i++) {
  5134. elem = this[i] || {};
  5135. if (elem.nodeType === 1) {
  5136. jQuery.cleanData(getAll(elem, false));
  5137. elem.innerHTML = value;
  5138. }
  5139. }
  5140. elem = 0;
  5141. } catch (e) {
  5142. }
  5143. }
  5144. if (elem) {
  5145. this.empty().append(value);
  5146. }
  5147. }, null, value, arguments.length);
  5148. },
  5149. replaceWith: function () {
  5150. var ignored = [];
  5151. return domManip(this, arguments, function (elem) {
  5152. var parent = this.parentNode;
  5153. if (jQuery.inArray(this, ignored) < 0) {
  5154. jQuery.cleanData(getAll(this));
  5155. if (parent) {
  5156. parent.replaceChild(elem, this);
  5157. }
  5158. }
  5159. }, ignored);
  5160. }
  5161. });
  5162. jQuery.each({
  5163. appendTo: 'append',
  5164. prependTo: 'prepend',
  5165. insertBefore: 'before',
  5166. insertAfter: 'after',
  5167. replaceAll: 'replaceWith'
  5168. }, function (name, original) {
  5169. jQuery.fn[name] = function (selector) {
  5170. var elems, ret = [], insert = jQuery(selector), last = insert.length - 1, i = 0;
  5171. for (; i <= last; i++) {
  5172. elems = i === last ? this : this.clone(true);
  5173. jQuery(insert[i])[original](elems);
  5174. push.apply(ret, elems.get());
  5175. }
  5176. return this.pushStack(ret);
  5177. };
  5178. });
  5179. var iframe, elemdisplay = {
  5180. HTML: 'block',
  5181. BODY: 'block'
  5182. };
  5183. function actualDisplay(name, doc) {
  5184. var elem = jQuery(doc.createElement(name)).appendTo(doc.body), display = jQuery.css(elem[0], 'display');
  5185. elem.detach();
  5186. return display;
  5187. }
  5188. function defaultDisplay(nodeName) {
  5189. var doc = document, display = elemdisplay[nodeName];
  5190. if (!display) {
  5191. display = actualDisplay(nodeName, doc);
  5192. if (display === 'none' || !display) {
  5193. iframe = (iframe || jQuery('<iframe frameborder=\'0\' width=\'0\' height=\'0\'/>')).appendTo(doc.documentElement);
  5194. doc = iframe[0].contentDocument;
  5195. doc.write();
  5196. doc.close();
  5197. display = actualDisplay(nodeName, doc);
  5198. iframe.detach();
  5199. }
  5200. elemdisplay[nodeName] = display;
  5201. }
  5202. return display;
  5203. }
  5204. var rmargin = /^margin/;
  5205. var rnumnonpx = new RegExp('^(' + pnum + ')(?!px)[a-z%]+$', 'i');
  5206. var getStyles = function (elem) {
  5207. var view = elem.ownerDocument.defaultView;
  5208. if (!view || !view.opener) {
  5209. view = window;
  5210. }
  5211. return view.getComputedStyle(elem);
  5212. };
  5213. var swap = function (elem, options, callback, args) {
  5214. var ret, name, old = {};
  5215. for (name in options) {
  5216. old[name] = elem.style[name];
  5217. elem.style[name] = options[name];
  5218. }
  5219. ret = callback.apply(elem, args || []);
  5220. for (name in options) {
  5221. elem.style[name] = old[name];
  5222. }
  5223. return ret;
  5224. };
  5225. var documentElement = document.documentElement;
  5226. (function () {
  5227. var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, container = document.createElement('div'), div = document.createElement('div');
  5228. if (!div.style) {
  5229. return;
  5230. }
  5231. div.style.backgroundClip = 'content-box';
  5232. div.cloneNode(true).style.backgroundClip = '';
  5233. support.clearCloneStyle = div.style.backgroundClip === 'content-box';
  5234. container.style.cssText = 'border:0;width:8px;height:0;top:0;left:-9999px;' + 'padding:0;margin-top:1px;position:absolute';
  5235. container.appendChild(div);
  5236. function computeStyleTests() {
  5237. div.style.cssText = '-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;' + 'position:relative;display:block;' + 'margin:auto;border:1px;padding:1px;' + 'top:1%;width:50%';
  5238. div.innerHTML = '';
  5239. documentElement.appendChild(container);
  5240. var divStyle = window.getComputedStyle(div);
  5241. pixelPositionVal = divStyle.top !== '1%';
  5242. reliableMarginLeftVal = divStyle.marginLeft === '2px';
  5243. boxSizingReliableVal = divStyle.width === '4px';
  5244. div.style.marginRight = '50%';
  5245. pixelMarginRightVal = divStyle.marginRight === '4px';
  5246. documentElement.removeChild(container);
  5247. }
  5248. jQuery.extend(support, {
  5249. pixelPosition: function () {
  5250. computeStyleTests();
  5251. return pixelPositionVal;
  5252. },
  5253. boxSizingReliable: function () {
  5254. if (boxSizingReliableVal == null) {
  5255. computeStyleTests();
  5256. }
  5257. return boxSizingReliableVal;
  5258. },
  5259. pixelMarginRight: function () {
  5260. if (boxSizingReliableVal == null) {
  5261. computeStyleTests();
  5262. }
  5263. return pixelMarginRightVal;
  5264. },
  5265. reliableMarginLeft: function () {
  5266. if (boxSizingReliableVal == null) {
  5267. computeStyleTests();
  5268. }
  5269. return reliableMarginLeftVal;
  5270. },
  5271. reliableMarginRight: function () {
  5272. var ret, marginDiv = div.appendChild(document.createElement('div'));
  5273. marginDiv.style.cssText = div.style.cssText = '-webkit-box-sizing:content-box;box-sizing:content-box;' + 'display:block;margin:0;border:0;padding:0';
  5274. marginDiv.style.marginRight = marginDiv.style.width = '0';
  5275. div.style.width = '1px';
  5276. documentElement.appendChild(container);
  5277. ret = !parseFloat(window.getComputedStyle(marginDiv).marginRight);
  5278. documentElement.removeChild(container);
  5279. div.removeChild(marginDiv);
  5280. return ret;
  5281. }
  5282. });
  5283. }());
  5284. function curCSS(elem, name, computed) {
  5285. var width, minWidth, maxWidth, ret, style = elem.style;
  5286. computed = computed || getStyles(elem);
  5287. ret = computed ? computed.getPropertyValue(name) || computed[name] : undefined;
  5288. if ((ret === '' || ret === undefined) && !jQuery.contains(elem.ownerDocument, elem)) {
  5289. ret = jQuery.style(elem, name);
  5290. }
  5291. if (computed) {
  5292. if (!support.pixelMarginRight() && rnumnonpx.test(ret) && rmargin.test(name)) {
  5293. width = style.width;
  5294. minWidth = style.minWidth;
  5295. maxWidth = style.maxWidth;
  5296. style.minWidth = style.maxWidth = style.width = ret;
  5297. ret = computed.width;
  5298. style.width = width;
  5299. style.minWidth = minWidth;
  5300. style.maxWidth = maxWidth;
  5301. }
  5302. }
  5303. return ret !== undefined ? ret + '' : ret;
  5304. }
  5305. function addGetHookIf(conditionFn, hookFn) {
  5306. return {
  5307. get: function () {
  5308. if (conditionFn()) {
  5309. delete this.get;
  5310. return;
  5311. }
  5312. return (this.get = hookFn).apply(this, arguments);
  5313. }
  5314. };
  5315. }
  5316. var rdisplayswap = /^(none|table(?!-c[ea]).+)/, cssShow = {
  5317. position: 'absolute',
  5318. visibility: 'hidden',
  5319. display: 'block'
  5320. }, cssNormalTransform = {
  5321. letterSpacing: '0',
  5322. fontWeight: '400'
  5323. }, cssPrefixes = [
  5324. 'Webkit',
  5325. 'O',
  5326. 'Moz',
  5327. 'ms'
  5328. ], emptyStyle = document.createElement('div').style;
  5329. function vendorPropName(name) {
  5330. if (name in emptyStyle) {
  5331. return name;
  5332. }
  5333. var capName = name[0].toUpperCase() + name.slice(1), i = cssPrefixes.length;
  5334. while (i--) {
  5335. name = cssPrefixes[i] + capName;
  5336. if (name in emptyStyle) {
  5337. return name;
  5338. }
  5339. }
  5340. }
  5341. function setPositiveNumber(elem, value, subtract) {
  5342. var matches = rcssNum.exec(value);
  5343. return matches ? Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || 'px') : value;
  5344. }
  5345. function augmentWidthOrHeight(elem, name, extra, isBorderBox, styles) {
  5346. var i = extra === (isBorderBox ? 'border' : 'content') ? 4 : name === 'width' ? 1 : 0, val = 0;
  5347. for (; i < 4; i += 2) {
  5348. if (extra === 'margin') {
  5349. val += jQuery.css(elem, extra + cssExpand[i], true, styles);
  5350. }
  5351. if (isBorderBox) {
  5352. if (extra === 'content') {
  5353. val -= jQuery.css(elem, 'padding' + cssExpand[i], true, styles);
  5354. }
  5355. if (extra !== 'margin') {
  5356. val -= jQuery.css(elem, 'border' + cssExpand[i] + 'Width', true, styles);
  5357. }
  5358. } else {
  5359. val += jQuery.css(elem, 'padding' + cssExpand[i], true, styles);
  5360. if (extra !== 'padding') {
  5361. val += jQuery.css(elem, 'border' + cssExpand[i] + 'Width', true, styles);
  5362. }
  5363. }
  5364. }
  5365. return val;
  5366. }
  5367. function getWidthOrHeight(elem, name, extra) {
  5368. var valueIsBorderBox = true, val = name === 'width' ? elem.offsetWidth : elem.offsetHeight, styles = getStyles(elem), isBorderBox = jQuery.css(elem, 'boxSizing', false, styles) === 'border-box';
  5369. if (val <= 0 || val == null) {
  5370. val = curCSS(elem, name, styles);
  5371. if (val < 0 || val == null) {
  5372. val = elem.style[name];
  5373. }
  5374. if (rnumnonpx.test(val)) {
  5375. return val;
  5376. }
  5377. valueIsBorderBox = isBorderBox && (support.boxSizingReliable() || val === elem.style[name]);
  5378. val = parseFloat(val) || 0;
  5379. }
  5380. return val + augmentWidthOrHeight(elem, name, extra || (isBorderBox ? 'border' : 'content'), valueIsBorderBox, styles) + 'px';
  5381. }
  5382. function showHide(elements, show) {
  5383. var display, elem, hidden, values = [], index = 0, length = elements.length;
  5384. for (; index < length; index++) {
  5385. elem = elements[index];
  5386. if (!elem.style) {
  5387. continue;
  5388. }
  5389. values[index] = dataPriv.get(elem, 'olddisplay');
  5390. display = elem.style.display;
  5391. if (show) {
  5392. if (!values[index] && display === 'none') {
  5393. elem.style.display = '';
  5394. }
  5395. if (elem.style.display === '' && isHidden(elem)) {
  5396. values[index] = dataPriv.access(elem, 'olddisplay', defaultDisplay(elem.nodeName));
  5397. }
  5398. } else {
  5399. hidden = isHidden(elem);
  5400. if (display !== 'none' || !hidden) {
  5401. dataPriv.set(elem, 'olddisplay', hidden ? display : jQuery.css(elem, 'display'));
  5402. }
  5403. }
  5404. }
  5405. for (index = 0; index < length; index++) {
  5406. elem = elements[index];
  5407. if (!elem.style) {
  5408. continue;
  5409. }
  5410. if (!show || elem.style.display === 'none' || elem.style.display === '') {
  5411. elem.style.display = show ? values[index] || '' : 'none';
  5412. }
  5413. }
  5414. return elements;
  5415. }
  5416. jQuery.extend({
  5417. cssHooks: {
  5418. opacity: {
  5419. get: function (elem, computed) {
  5420. if (computed) {
  5421. var ret = curCSS(elem, 'opacity');
  5422. return ret === '' ? '1' : ret;
  5423. }
  5424. }
  5425. }
  5426. },
  5427. cssNumber: {
  5428. 'animationIterationCount': true,
  5429. 'columnCount': true,
  5430. 'fillOpacity': true,
  5431. 'flexGrow': true,
  5432. 'flexShrink': true,
  5433. 'fontWeight': true,
  5434. 'lineHeight': true,
  5435. 'opacity': true,
  5436. 'order': true,
  5437. 'orphans': true,
  5438. 'widows': true,
  5439. 'zIndex': true,
  5440. 'zoom': true
  5441. },
  5442. cssProps: { 'float': 'cssFloat' },
  5443. style: function (elem, name, value, extra) {
  5444. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  5445. return;
  5446. }
  5447. var ret, type, hooks, origName = jQuery.camelCase(name), style = elem.style;
  5448. name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(origName) || origName);
  5449. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  5450. if (value !== undefined) {
  5451. type = typeof value;
  5452. if (type === 'string' && (ret = rcssNum.exec(value)) && ret[1]) {
  5453. value = adjustCSS(elem, name, ret);
  5454. type = 'number';
  5455. }
  5456. if (value == null || value !== value) {
  5457. return;
  5458. }
  5459. if (type === 'number') {
  5460. value += ret && ret[3] || (jQuery.cssNumber[origName] ? '' : 'px');
  5461. }
  5462. if (!support.clearCloneStyle && value === '' && name.indexOf('background') === 0) {
  5463. style[name] = 'inherit';
  5464. }
  5465. if (!hooks || !('set' in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  5466. style[name] = value;
  5467. }
  5468. } else {
  5469. if (hooks && 'get' in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  5470. return ret;
  5471. }
  5472. return style[name];
  5473. }
  5474. },
  5475. css: function (elem, name, extra, styles) {
  5476. var val, num, hooks, origName = jQuery.camelCase(name);
  5477. name = jQuery.cssProps[origName] || (jQuery.cssProps[origName] = vendorPropName(origName) || origName);
  5478. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  5479. if (hooks && 'get' in hooks) {
  5480. val = hooks.get(elem, true, extra);
  5481. }
  5482. if (val === undefined) {
  5483. val = curCSS(elem, name, styles);
  5484. }
  5485. if (val === 'normal' && name in cssNormalTransform) {
  5486. val = cssNormalTransform[name];
  5487. }
  5488. if (extra === '' || extra) {
  5489. num = parseFloat(val);
  5490. return extra === true || isFinite(num) ? num || 0 : val;
  5491. }
  5492. return val;
  5493. }
  5494. });
  5495. jQuery.each([
  5496. 'height',
  5497. 'width'
  5498. ], function (i, name) {
  5499. jQuery.cssHooks[name] = {
  5500. get: function (elem, computed, extra) {
  5501. if (computed) {
  5502. return rdisplayswap.test(jQuery.css(elem, 'display')) && elem.offsetWidth === 0 ? swap(elem, cssShow, function () {
  5503. return getWidthOrHeight(elem, name, extra);
  5504. }) : getWidthOrHeight(elem, name, extra);
  5505. }
  5506. },
  5507. set: function (elem, value, extra) {
  5508. var matches, styles = extra && getStyles(elem), subtract = extra && augmentWidthOrHeight(elem, name, extra, jQuery.css(elem, 'boxSizing', false, styles) === 'border-box', styles);
  5509. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || 'px') !== 'px') {
  5510. elem.style[name] = value;
  5511. value = jQuery.css(elem, name);
  5512. }
  5513. return setPositiveNumber(elem, value, subtract);
  5514. }
  5515. };
  5516. });
  5517. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
  5518. if (computed) {
  5519. return (parseFloat(curCSS(elem, 'marginLeft')) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
  5520. return elem.getBoundingClientRect().left;
  5521. })) + 'px';
  5522. }
  5523. });
  5524. jQuery.cssHooks.marginRight = addGetHookIf(support.reliableMarginRight, function (elem, computed) {
  5525. if (computed) {
  5526. return swap(elem, { 'display': 'inline-block' }, curCSS, [
  5527. elem,
  5528. 'marginRight'
  5529. ]);
  5530. }
  5531. });
  5532. jQuery.each({
  5533. margin: '',
  5534. padding: '',
  5535. border: 'Width'
  5536. }, function (prefix, suffix) {
  5537. jQuery.cssHooks[prefix + suffix] = {
  5538. expand: function (value) {
  5539. var i = 0, expanded = {}, parts = typeof value === 'string' ? value.split(' ') : [value];
  5540. for (; i < 4; i++) {
  5541. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
  5542. }
  5543. return expanded;
  5544. }
  5545. };
  5546. if (!rmargin.test(prefix)) {
  5547. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  5548. }
  5549. });
  5550. jQuery.fn.extend({
  5551. css: function (name, value) {
  5552. return access(this, function (elem, name, value) {
  5553. var styles, len, map = {}, i = 0;
  5554. if (jQuery.isArray(name)) {
  5555. styles = getStyles(elem);
  5556. len = name.length;
  5557. for (; i < len; i++) {
  5558. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  5559. }
  5560. return map;
  5561. }
  5562. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
  5563. }, name, value, arguments.length > 1);
  5564. },
  5565. show: function () {
  5566. return showHide(this, true);
  5567. },
  5568. hide: function () {
  5569. return showHide(this);
  5570. },
  5571. toggle: function (state) {
  5572. if (typeof state === 'boolean') {
  5573. return state ? this.show() : this.hide();
  5574. }
  5575. return this.each(function () {
  5576. if (isHidden(this)) {
  5577. jQuery(this).show();
  5578. } else {
  5579. jQuery(this).hide();
  5580. }
  5581. });
  5582. }
  5583. });
  5584. function Tween(elem, options, prop, end, easing) {
  5585. return new Tween.prototype.init(elem, options, prop, end, easing);
  5586. }
  5587. jQuery.Tween = Tween;
  5588. Tween.prototype = {
  5589. constructor: Tween,
  5590. init: function (elem, options, prop, end, easing, unit) {
  5591. this.elem = elem;
  5592. this.prop = prop;
  5593. this.easing = easing || jQuery.easing._default;
  5594. this.options = options;
  5595. this.start = this.now = this.cur();
  5596. this.end = end;
  5597. this.unit = unit || (jQuery.cssNumber[prop] ? '' : 'px');
  5598. },
  5599. cur: function () {
  5600. var hooks = Tween.propHooks[this.prop];
  5601. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
  5602. },
  5603. run: function (percent) {
  5604. var eased, hooks = Tween.propHooks[this.prop];
  5605. if (this.options.duration) {
  5606. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
  5607. } else {
  5608. this.pos = eased = percent;
  5609. }
  5610. this.now = (this.end - this.start) * eased + this.start;
  5611. if (this.options.step) {
  5612. this.options.step.call(this.elem, this.now, this);
  5613. }
  5614. if (hooks && hooks.set) {
  5615. hooks.set(this);
  5616. } else {
  5617. Tween.propHooks._default.set(this);
  5618. }
  5619. return this;
  5620. }
  5621. };
  5622. Tween.prototype.init.prototype = Tween.prototype;
  5623. Tween.propHooks = {
  5624. _default: {
  5625. get: function (tween) {
  5626. var result;
  5627. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  5628. return tween.elem[tween.prop];
  5629. }
  5630. result = jQuery.css(tween.elem, tween.prop, '');
  5631. return !result || result === 'auto' ? 0 : result;
  5632. },
  5633. set: function (tween) {
  5634. if (jQuery.fx.step[tween.prop]) {
  5635. jQuery.fx.step[tween.prop](tween);
  5636. } else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  5637. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  5638. } else {
  5639. tween.elem[tween.prop] = tween.now;
  5640. }
  5641. }
  5642. }
  5643. };
  5644. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  5645. set: function (tween) {
  5646. if (tween.elem.nodeType && tween.elem.parentNode) {
  5647. tween.elem[tween.prop] = tween.now;
  5648. }
  5649. }
  5650. };
  5651. jQuery.easing = {
  5652. linear: function (p) {
  5653. return p;
  5654. },
  5655. swing: function (p) {
  5656. return 0.5 - Math.cos(p * Math.PI) / 2;
  5657. },
  5658. _default: 'swing'
  5659. };
  5660. jQuery.fx = Tween.prototype.init;
  5661. jQuery.fx.step = {};
  5662. var fxNow, timerId, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/;
  5663. function createFxNow() {
  5664. window.setTimeout(function () {
  5665. fxNow = undefined;
  5666. });
  5667. return fxNow = jQuery.now();
  5668. }
  5669. function genFx(type, includeWidth) {
  5670. var which, i = 0, attrs = { height: type };
  5671. includeWidth = includeWidth ? 1 : 0;
  5672. for (; i < 4; i += 2 - includeWidth) {
  5673. which = cssExpand[i];
  5674. attrs['margin' + which] = attrs['padding' + which] = type;
  5675. }
  5676. if (includeWidth) {
  5677. attrs.opacity = attrs.width = type;
  5678. }
  5679. return attrs;
  5680. }
  5681. function createTween(value, prop, animation) {
  5682. var tween, collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners['*']), index = 0, length = collection.length;
  5683. for (; index < length; index++) {
  5684. if (tween = collection[index].call(animation, prop, value)) {
  5685. return tween;
  5686. }
  5687. }
  5688. }
  5689. function defaultPrefilter(elem, props, opts) {
  5690. var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHidden(elem), dataShow = dataPriv.get(elem, 'fxshow');
  5691. if (!opts.queue) {
  5692. hooks = jQuery._queueHooks(elem, 'fx');
  5693. if (hooks.unqueued == null) {
  5694. hooks.unqueued = 0;
  5695. oldfire = hooks.empty.fire;
  5696. hooks.empty.fire = function () {
  5697. if (!hooks.unqueued) {
  5698. oldfire();
  5699. }
  5700. };
  5701. }
  5702. hooks.unqueued++;
  5703. anim.always(function () {
  5704. anim.always(function () {
  5705. hooks.unqueued--;
  5706. if (!jQuery.queue(elem, 'fx').length) {
  5707. hooks.empty.fire();
  5708. }
  5709. });
  5710. });
  5711. }
  5712. if (elem.nodeType === 1 && ('height' in props || 'width' in props)) {
  5713. opts.overflow = [
  5714. style.overflow,
  5715. style.overflowX,
  5716. style.overflowY
  5717. ];
  5718. display = jQuery.css(elem, 'display');
  5719. checkDisplay = display === 'none' ? dataPriv.get(elem, 'olddisplay') || defaultDisplay(elem.nodeName) : display;
  5720. if (checkDisplay === 'inline' && jQuery.css(elem, 'float') === 'none') {
  5721. style.display = 'inline-block';
  5722. }
  5723. }
  5724. if (opts.overflow) {
  5725. style.overflow = 'hidden';
  5726. anim.always(function () {
  5727. style.overflow = opts.overflow[0];
  5728. style.overflowX = opts.overflow[1];
  5729. style.overflowY = opts.overflow[2];
  5730. });
  5731. }
  5732. for (prop in props) {
  5733. value = props[prop];
  5734. if (rfxtypes.exec(value)) {
  5735. delete props[prop];
  5736. toggle = toggle || value === 'toggle';
  5737. if (value === (hidden ? 'hide' : 'show')) {
  5738. if (value === 'show' && dataShow && dataShow[prop] !== undefined) {
  5739. hidden = true;
  5740. } else {
  5741. continue;
  5742. }
  5743. }
  5744. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  5745. } else {
  5746. display = undefined;
  5747. }
  5748. }
  5749. if (!jQuery.isEmptyObject(orig)) {
  5750. if (dataShow) {
  5751. if ('hidden' in dataShow) {
  5752. hidden = dataShow.hidden;
  5753. }
  5754. } else {
  5755. dataShow = dataPriv.access(elem, 'fxshow', {});
  5756. }
  5757. if (toggle) {
  5758. dataShow.hidden = !hidden;
  5759. }
  5760. if (hidden) {
  5761. jQuery(elem).show();
  5762. } else {
  5763. anim.done(function () {
  5764. jQuery(elem).hide();
  5765. });
  5766. }
  5767. anim.done(function () {
  5768. var prop;
  5769. dataPriv.remove(elem, 'fxshow');
  5770. for (prop in orig) {
  5771. jQuery.style(elem, prop, orig[prop]);
  5772. }
  5773. });
  5774. for (prop in orig) {
  5775. tween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  5776. if (!(prop in dataShow)) {
  5777. dataShow[prop] = tween.start;
  5778. if (hidden) {
  5779. tween.end = tween.start;
  5780. tween.start = prop === 'width' || prop === 'height' ? 1 : 0;
  5781. }
  5782. }
  5783. }
  5784. } else if ((display === 'none' ? defaultDisplay(elem.nodeName) : display) === 'inline') {
  5785. style.display = display;
  5786. }
  5787. }
  5788. function propFilter(props, specialEasing) {
  5789. var index, name, easing, value, hooks;
  5790. for (index in props) {
  5791. name = jQuery.camelCase(index);
  5792. easing = specialEasing[name];
  5793. value = props[index];
  5794. if (jQuery.isArray(value)) {
  5795. easing = value[1];
  5796. value = props[index] = value[0];
  5797. }
  5798. if (index !== name) {
  5799. props[name] = value;
  5800. delete props[index];
  5801. }
  5802. hooks = jQuery.cssHooks[name];
  5803. if (hooks && 'expand' in hooks) {
  5804. value = hooks.expand(value);
  5805. delete props[name];
  5806. for (index in value) {
  5807. if (!(index in props)) {
  5808. props[index] = value[index];
  5809. specialEasing[index] = easing;
  5810. }
  5811. }
  5812. } else {
  5813. specialEasing[name] = easing;
  5814. }
  5815. }
  5816. }
  5817. function Animation(elem, properties, options) {
  5818. var result, stopped, index = 0, length = Animation.prefilters.length, deferred = jQuery.Deferred().always(function () {
  5819. delete tick.elem;
  5820. }), tick = function () {
  5821. if (stopped) {
  5822. return false;
  5823. }
  5824. var currentTime = fxNow || createFxNow(), remaining = Math.max(0, animation.startTime + animation.duration - currentTime), temp = remaining / animation.duration || 0, percent = 1 - temp, index = 0, length = animation.tweens.length;
  5825. for (; index < length; index++) {
  5826. animation.tweens[index].run(percent);
  5827. }
  5828. deferred.notifyWith(elem, [
  5829. animation,
  5830. percent,
  5831. remaining
  5832. ]);
  5833. if (percent < 1 && length) {
  5834. return remaining;
  5835. } else {
  5836. deferred.resolveWith(elem, [animation]);
  5837. return false;
  5838. }
  5839. }, animation = deferred.promise({
  5840. elem: elem,
  5841. props: jQuery.extend({}, properties),
  5842. opts: jQuery.extend(true, {
  5843. specialEasing: {},
  5844. easing: jQuery.easing._default
  5845. }, options),
  5846. originalProperties: properties,
  5847. originalOptions: options,
  5848. startTime: fxNow || createFxNow(),
  5849. duration: options.duration,
  5850. tweens: [],
  5851. createTween: function (prop, end) {
  5852. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  5853. animation.tweens.push(tween);
  5854. return tween;
  5855. },
  5856. stop: function (gotoEnd) {
  5857. var index = 0, length = gotoEnd ? animation.tweens.length : 0;
  5858. if (stopped) {
  5859. return this;
  5860. }
  5861. stopped = true;
  5862. for (; index < length; index++) {
  5863. animation.tweens[index].run(1);
  5864. }
  5865. if (gotoEnd) {
  5866. deferred.notifyWith(elem, [
  5867. animation,
  5868. 1,
  5869. 0
  5870. ]);
  5871. deferred.resolveWith(elem, [
  5872. animation,
  5873. gotoEnd
  5874. ]);
  5875. } else {
  5876. deferred.rejectWith(elem, [
  5877. animation,
  5878. gotoEnd
  5879. ]);
  5880. }
  5881. return this;
  5882. }
  5883. }), props = animation.props;
  5884. propFilter(props, animation.opts.specialEasing);
  5885. for (; index < length; index++) {
  5886. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  5887. if (result) {
  5888. if (jQuery.isFunction(result.stop)) {
  5889. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = jQuery.proxy(result.stop, result);
  5890. }
  5891. return result;
  5892. }
  5893. }
  5894. jQuery.map(props, createTween, animation);
  5895. if (jQuery.isFunction(animation.opts.start)) {
  5896. animation.opts.start.call(elem, animation);
  5897. }
  5898. jQuery.fx.timer(jQuery.extend(tick, {
  5899. elem: elem,
  5900. anim: animation,
  5901. queue: animation.opts.queue
  5902. }));
  5903. return animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  5904. }
  5905. jQuery.Animation = jQuery.extend(Animation, {
  5906. tweeners: {
  5907. '*': [function (prop, value) {
  5908. var tween = this.createTween(prop, value);
  5909. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  5910. return tween;
  5911. }]
  5912. },
  5913. tweener: function (props, callback) {
  5914. if (jQuery.isFunction(props)) {
  5915. callback = props;
  5916. props = ['*'];
  5917. } else {
  5918. props = props.match(rnotwhite);
  5919. }
  5920. var prop, index = 0, length = props.length;
  5921. for (; index < length; index++) {
  5922. prop = props[index];
  5923. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  5924. Animation.tweeners[prop].unshift(callback);
  5925. }
  5926. },
  5927. prefilters: [defaultPrefilter],
  5928. prefilter: function (callback, prepend) {
  5929. if (prepend) {
  5930. Animation.prefilters.unshift(callback);
  5931. } else {
  5932. Animation.prefilters.push(callback);
  5933. }
  5934. }
  5935. });
  5936. jQuery.speed = function (speed, easing, fn) {
  5937. var opt = speed && typeof speed === 'object' ? jQuery.extend({}, speed) : {
  5938. complete: fn || !fn && easing || jQuery.isFunction(speed) && speed,
  5939. duration: speed,
  5940. easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
  5941. };
  5942. 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;
  5943. if (opt.queue == null || opt.queue === true) {
  5944. opt.queue = 'fx';
  5945. }
  5946. opt.old = opt.complete;
  5947. opt.complete = function () {
  5948. if (jQuery.isFunction(opt.old)) {
  5949. opt.old.call(this);
  5950. }
  5951. if (opt.queue) {
  5952. jQuery.dequeue(this, opt.queue);
  5953. }
  5954. };
  5955. return opt;
  5956. };
  5957. jQuery.fn.extend({
  5958. fadeTo: function (speed, to, easing, callback) {
  5959. return this.filter(isHidden).css('opacity', 0).show().end().animate({ opacity: to }, speed, easing, callback);
  5960. },
  5961. animate: function (prop, speed, easing, callback) {
  5962. var empty = jQuery.isEmptyObject(prop), optall = jQuery.speed(speed, easing, callback), doAnimation = function () {
  5963. var anim = Animation(this, jQuery.extend({}, prop), optall);
  5964. if (empty || dataPriv.get(this, 'finish')) {
  5965. anim.stop(true);
  5966. }
  5967. };
  5968. doAnimation.finish = doAnimation;
  5969. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  5970. },
  5971. stop: function (type, clearQueue, gotoEnd) {
  5972. var stopQueue = function (hooks) {
  5973. var stop = hooks.stop;
  5974. delete hooks.stop;
  5975. stop(gotoEnd);
  5976. };
  5977. if (typeof type !== 'string') {
  5978. gotoEnd = clearQueue;
  5979. clearQueue = type;
  5980. type = undefined;
  5981. }
  5982. if (clearQueue && type !== false) {
  5983. this.queue(type || 'fx', []);
  5984. }
  5985. return this.each(function () {
  5986. var dequeue = true, index = type != null && type + 'queueHooks', timers = jQuery.timers, data = dataPriv.get(this);
  5987. if (index) {
  5988. if (data[index] && data[index].stop) {
  5989. stopQueue(data[index]);
  5990. }
  5991. } else {
  5992. for (index in data) {
  5993. if (data[index] && data[index].stop && rrun.test(index)) {
  5994. stopQueue(data[index]);
  5995. }
  5996. }
  5997. }
  5998. for (index = timers.length; index--;) {
  5999. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  6000. timers[index].anim.stop(gotoEnd);
  6001. dequeue = false;
  6002. timers.splice(index, 1);
  6003. }
  6004. }
  6005. if (dequeue || !gotoEnd) {
  6006. jQuery.dequeue(this, type);
  6007. }
  6008. });
  6009. },
  6010. finish: function (type) {
  6011. if (type !== false) {
  6012. type = type || 'fx';
  6013. }
  6014. return this.each(function () {
  6015. var index, data = dataPriv.get(this), queue = data[type + 'queue'], hooks = data[type + 'queueHooks'], timers = jQuery.timers, length = queue ? queue.length : 0;
  6016. data.finish = true;
  6017. jQuery.queue(this, type, []);
  6018. if (hooks && hooks.stop) {
  6019. hooks.stop.call(this, true);
  6020. }
  6021. for (index = timers.length; index--;) {
  6022. if (timers[index].elem === this && timers[index].queue === type) {
  6023. timers[index].anim.stop(true);
  6024. timers.splice(index, 1);
  6025. }
  6026. }
  6027. for (index = 0; index < length; index++) {
  6028. if (queue[index] && queue[index].finish) {
  6029. queue[index].finish.call(this);
  6030. }
  6031. }
  6032. delete data.finish;
  6033. });
  6034. }
  6035. });
  6036. jQuery.each([
  6037. 'toggle',
  6038. 'show',
  6039. 'hide'
  6040. ], function (i, name) {
  6041. var cssFn = jQuery.fn[name];
  6042. jQuery.fn[name] = function (speed, easing, callback) {
  6043. return speed == null || typeof speed === 'boolean' ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
  6044. };
  6045. });
  6046. jQuery.each({
  6047. slideDown: genFx('show'),
  6048. slideUp: genFx('hide'),
  6049. slideToggle: genFx('toggle'),
  6050. fadeIn: { opacity: 'show' },
  6051. fadeOut: { opacity: 'hide' },
  6052. fadeToggle: { opacity: 'toggle' }
  6053. }, function (name, props) {
  6054. jQuery.fn[name] = function (speed, easing, callback) {
  6055. return this.animate(props, speed, easing, callback);
  6056. };
  6057. });
  6058. jQuery.timers = [];
  6059. jQuery.fx.tick = function () {
  6060. var timer, i = 0, timers = jQuery.timers;
  6061. fxNow = jQuery.now();
  6062. for (; i < timers.length; i++) {
  6063. timer = timers[i];
  6064. if (!timer() && timers[i] === timer) {
  6065. timers.splice(i--, 1);
  6066. }
  6067. }
  6068. if (!timers.length) {
  6069. jQuery.fx.stop();
  6070. }
  6071. fxNow = undefined;
  6072. };
  6073. jQuery.fx.timer = function (timer) {
  6074. jQuery.timers.push(timer);
  6075. if (timer()) {
  6076. jQuery.fx.start();
  6077. } else {
  6078. jQuery.timers.pop();
  6079. }
  6080. };
  6081. jQuery.fx.interval = 13;
  6082. jQuery.fx.start = function () {
  6083. if (!timerId) {
  6084. timerId = window.setInterval(jQuery.fx.tick, jQuery.fx.interval);
  6085. }
  6086. };
  6087. jQuery.fx.stop = function () {
  6088. window.clearInterval(timerId);
  6089. timerId = null;
  6090. };
  6091. jQuery.fx.speeds = {
  6092. slow: 600,
  6093. fast: 200,
  6094. _default: 400
  6095. };
  6096. jQuery.fn.delay = function (time, type) {
  6097. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  6098. type = type || 'fx';
  6099. return this.queue(type, function (next, hooks) {
  6100. var timeout = window.setTimeout(next, time);
  6101. hooks.stop = function () {
  6102. window.clearTimeout(timeout);
  6103. };
  6104. });
  6105. };
  6106. (function () {
  6107. var input = document.createElement('input'), select = document.createElement('select'), opt = select.appendChild(document.createElement('option'));
  6108. input.type = 'checkbox';
  6109. support.checkOn = input.value !== '';
  6110. support.optSelected = opt.selected;
  6111. select.disabled = true;
  6112. support.optDisabled = !opt.disabled;
  6113. input = document.createElement('input');
  6114. input.value = 't';
  6115. input.type = 'radio';
  6116. support.radioValue = input.value === 't';
  6117. }());
  6118. var boolHook, attrHandle = jQuery.expr.attrHandle;
  6119. jQuery.fn.extend({
  6120. attr: function (name, value) {
  6121. return access(this, jQuery.attr, name, value, arguments.length > 1);
  6122. },
  6123. removeAttr: function (name) {
  6124. return this.each(function () {
  6125. jQuery.removeAttr(this, name);
  6126. });
  6127. }
  6128. });
  6129. jQuery.extend({
  6130. attr: function (elem, name, value) {
  6131. var ret, hooks, nType = elem.nodeType;
  6132. if (nType === 3 || nType === 8 || nType === 2) {
  6133. return;
  6134. }
  6135. if (typeof elem.getAttribute === 'undefined') {
  6136. return jQuery.prop(elem, name, value);
  6137. }
  6138. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  6139. name = name.toLowerCase();
  6140. hooks = jQuery.attrHooks[name] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  6141. }
  6142. if (value !== undefined) {
  6143. if (value === null) {
  6144. jQuery.removeAttr(elem, name);
  6145. return;
  6146. }
  6147. if (hooks && 'set' in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  6148. return ret;
  6149. }
  6150. elem.setAttribute(name, value + '');
  6151. return value;
  6152. }
  6153. if (hooks && 'get' in hooks && (ret = hooks.get(elem, name)) !== null) {
  6154. return ret;
  6155. }
  6156. ret = jQuery.find.attr(elem, name);
  6157. return ret == null ? undefined : ret;
  6158. },
  6159. attrHooks: {
  6160. type: {
  6161. set: function (elem, value) {
  6162. if (!support.radioValue && value === 'radio' && jQuery.nodeName(elem, 'input')) {
  6163. var val = elem.value;
  6164. elem.setAttribute('type', value);
  6165. if (val) {
  6166. elem.value = val;
  6167. }
  6168. return value;
  6169. }
  6170. }
  6171. }
  6172. },
  6173. removeAttr: function (elem, value) {
  6174. var name, propName, i = 0, attrNames = value && value.match(rnotwhite);
  6175. if (attrNames && elem.nodeType === 1) {
  6176. while (name = attrNames[i++]) {
  6177. propName = jQuery.propFix[name] || name;
  6178. if (jQuery.expr.match.bool.test(name)) {
  6179. elem[propName] = false;
  6180. }
  6181. elem.removeAttribute(name);
  6182. }
  6183. }
  6184. }
  6185. });
  6186. boolHook = {
  6187. set: function (elem, value, name) {
  6188. if (value === false) {
  6189. jQuery.removeAttr(elem, name);
  6190. } else {
  6191. elem.setAttribute(name, name);
  6192. }
  6193. return name;
  6194. }
  6195. };
  6196. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  6197. var getter = attrHandle[name] || jQuery.find.attr;
  6198. attrHandle[name] = function (elem, name, isXML) {
  6199. var ret, handle;
  6200. if (!isXML) {
  6201. handle = attrHandle[name];
  6202. attrHandle[name] = ret;
  6203. ret = getter(elem, name, isXML) != null ? name.toLowerCase() : null;
  6204. attrHandle[name] = handle;
  6205. }
  6206. return ret;
  6207. };
  6208. });
  6209. var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i;
  6210. jQuery.fn.extend({
  6211. prop: function (name, value) {
  6212. return access(this, jQuery.prop, name, value, arguments.length > 1);
  6213. },
  6214. removeProp: function (name) {
  6215. return this.each(function () {
  6216. delete this[jQuery.propFix[name] || name];
  6217. });
  6218. }
  6219. });
  6220. jQuery.extend({
  6221. prop: function (elem, name, value) {
  6222. var ret, hooks, nType = elem.nodeType;
  6223. if (nType === 3 || nType === 8 || nType === 2) {
  6224. return;
  6225. }
  6226. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  6227. name = jQuery.propFix[name] || name;
  6228. hooks = jQuery.propHooks[name];
  6229. }
  6230. if (value !== undefined) {
  6231. if (hooks && 'set' in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  6232. return ret;
  6233. }
  6234. return elem[name] = value;
  6235. }
  6236. if (hooks && 'get' in hooks && (ret = hooks.get(elem, name)) !== null) {
  6237. return ret;
  6238. }
  6239. return elem[name];
  6240. },
  6241. propHooks: {
  6242. tabIndex: {
  6243. get: function (elem) {
  6244. var tabindex = jQuery.find.attr(elem, 'tabindex');
  6245. return tabindex ? parseInt(tabindex, 10) : rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href ? 0 : -1;
  6246. }
  6247. }
  6248. },
  6249. propFix: {
  6250. 'for': 'htmlFor',
  6251. 'class': 'className'
  6252. }
  6253. });
  6254. if (!support.optSelected) {
  6255. jQuery.propHooks.selected = {
  6256. get: function (elem) {
  6257. var parent = elem.parentNode;
  6258. if (parent && parent.parentNode) {
  6259. parent.parentNode.selectedIndex;
  6260. }
  6261. return null;
  6262. },
  6263. set: function (elem) {
  6264. var parent = elem.parentNode;
  6265. if (parent) {
  6266. parent.selectedIndex;
  6267. if (parent.parentNode) {
  6268. parent.parentNode.selectedIndex;
  6269. }
  6270. }
  6271. }
  6272. };
  6273. }
  6274. jQuery.each([
  6275. 'tabIndex',
  6276. 'readOnly',
  6277. 'maxLength',
  6278. 'cellSpacing',
  6279. 'cellPadding',
  6280. 'rowSpan',
  6281. 'colSpan',
  6282. 'useMap',
  6283. 'frameBorder',
  6284. 'contentEditable'
  6285. ], function () {
  6286. jQuery.propFix[this.toLowerCase()] = this;
  6287. });
  6288. var rclass = /[\t\r\n\f]/g;
  6289. function getClass(elem) {
  6290. return elem.getAttribute && elem.getAttribute('class') || '';
  6291. }
  6292. jQuery.fn.extend({
  6293. addClass: function (value) {
  6294. var classes, elem, cur, curValue, clazz, j, finalValue, i = 0;
  6295. if (jQuery.isFunction(value)) {
  6296. return this.each(function (j) {
  6297. jQuery(this).addClass(value.call(this, j, getClass(this)));
  6298. });
  6299. }
  6300. if (typeof value === 'string' && value) {
  6301. classes = value.match(rnotwhite) || [];
  6302. while (elem = this[i++]) {
  6303. curValue = getClass(elem);
  6304. cur = elem.nodeType === 1 && (' ' + curValue + ' ').replace(rclass, ' ');
  6305. if (cur) {
  6306. j = 0;
  6307. while (clazz = classes[j++]) {
  6308. if (cur.indexOf(' ' + clazz + ' ') < 0) {
  6309. cur += clazz + ' ';
  6310. }
  6311. }
  6312. finalValue = jQuery.trim(cur);
  6313. if (curValue !== finalValue) {
  6314. elem.setAttribute('class', finalValue);
  6315. }
  6316. }
  6317. }
  6318. }
  6319. return this;
  6320. },
  6321. removeClass: function (value) {
  6322. var classes, elem, cur, curValue, clazz, j, finalValue, i = 0;
  6323. if (jQuery.isFunction(value)) {
  6324. return this.each(function (j) {
  6325. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  6326. });
  6327. }
  6328. if (!arguments.length) {
  6329. return this.attr('class', '');
  6330. }
  6331. if (typeof value === 'string' && value) {
  6332. classes = value.match(rnotwhite) || [];
  6333. while (elem = this[i++]) {
  6334. curValue = getClass(elem);
  6335. cur = elem.nodeType === 1 && (' ' + curValue + ' ').replace(rclass, ' ');
  6336. if (cur) {
  6337. j = 0;
  6338. while (clazz = classes[j++]) {
  6339. while (cur.indexOf(' ' + clazz + ' ') > -1) {
  6340. cur = cur.replace(' ' + clazz + ' ', ' ');
  6341. }
  6342. }
  6343. finalValue = jQuery.trim(cur);
  6344. if (curValue !== finalValue) {
  6345. elem.setAttribute('class', finalValue);
  6346. }
  6347. }
  6348. }
  6349. }
  6350. return this;
  6351. },
  6352. toggleClass: function (value, stateVal) {
  6353. var type = typeof value;
  6354. if (typeof stateVal === 'boolean' && type === 'string') {
  6355. return stateVal ? this.addClass(value) : this.removeClass(value);
  6356. }
  6357. if (jQuery.isFunction(value)) {
  6358. return this.each(function (i) {
  6359. jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
  6360. });
  6361. }
  6362. return this.each(function () {
  6363. var className, i, self, classNames;
  6364. if (type === 'string') {
  6365. i = 0;
  6366. self = jQuery(this);
  6367. classNames = value.match(rnotwhite) || [];
  6368. while (className = classNames[i++]) {
  6369. if (self.hasClass(className)) {
  6370. self.removeClass(className);
  6371. } else {
  6372. self.addClass(className);
  6373. }
  6374. }
  6375. } else if (value === undefined || type === 'boolean') {
  6376. className = getClass(this);
  6377. if (className) {
  6378. dataPriv.set(this, '__className__', className);
  6379. }
  6380. if (this.setAttribute) {
  6381. this.setAttribute('class', className || value === false ? '' : dataPriv.get(this, '__className__') || '');
  6382. }
  6383. }
  6384. });
  6385. },
  6386. hasClass: function (selector) {
  6387. var className, elem, i = 0;
  6388. className = ' ' + selector + ' ';
  6389. while (elem = this[i++]) {
  6390. if (elem.nodeType === 1 && (' ' + getClass(elem) + ' ').replace(rclass, ' ').indexOf(className) > -1) {
  6391. return true;
  6392. }
  6393. }
  6394. return false;
  6395. }
  6396. });
  6397. var rreturn = /\r/g, rspaces = /[\x20\t\r\n\f]+/g;
  6398. jQuery.fn.extend({
  6399. val: function (value) {
  6400. var hooks, ret, isFunction, elem = this[0];
  6401. if (!arguments.length) {
  6402. if (elem) {
  6403. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  6404. if (hooks && 'get' in hooks && (ret = hooks.get(elem, 'value')) !== undefined) {
  6405. return ret;
  6406. }
  6407. ret = elem.value;
  6408. return typeof ret === 'string' ? ret.replace(rreturn, '') : ret == null ? '' : ret;
  6409. }
  6410. return;
  6411. }
  6412. isFunction = jQuery.isFunction(value);
  6413. return this.each(function (i) {
  6414. var val;
  6415. if (this.nodeType !== 1) {
  6416. return;
  6417. }
  6418. if (isFunction) {
  6419. val = value.call(this, i, jQuery(this).val());
  6420. } else {
  6421. val = value;
  6422. }
  6423. if (val == null) {
  6424. val = '';
  6425. } else if (typeof val === 'number') {
  6426. val += '';
  6427. } else if (jQuery.isArray(val)) {
  6428. val = jQuery.map(val, function (value) {
  6429. return value == null ? '' : value + '';
  6430. });
  6431. }
  6432. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  6433. if (!hooks || !('set' in hooks) || hooks.set(this, val, 'value') === undefined) {
  6434. this.value = val;
  6435. }
  6436. });
  6437. }
  6438. });
  6439. jQuery.extend({
  6440. valHooks: {
  6441. option: {
  6442. get: function (elem) {
  6443. var val = jQuery.find.attr(elem, 'value');
  6444. return val != null ? val : jQuery.trim(jQuery.text(elem)).replace(rspaces, ' ');
  6445. }
  6446. },
  6447. select: {
  6448. get: function (elem) {
  6449. var value, option, options = elem.options, index = elem.selectedIndex, one = elem.type === 'select-one' || index < 0, values = one ? null : [], max = one ? index + 1 : options.length, i = index < 0 ? max : one ? index : 0;
  6450. for (; i < max; i++) {
  6451. option = options[i];
  6452. if ((option.selected || i === index) && (support.optDisabled ? !option.disabled : option.getAttribute('disabled') === null) && (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, 'optgroup'))) {
  6453. value = jQuery(option).val();
  6454. if (one) {
  6455. return value;
  6456. }
  6457. values.push(value);
  6458. }
  6459. }
  6460. return values;
  6461. },
  6462. set: function (elem, value) {
  6463. var optionSet, option, options = elem.options, values = jQuery.makeArray(value), i = options.length;
  6464. while (i--) {
  6465. option = options[i];
  6466. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
  6467. optionSet = true;
  6468. }
  6469. }
  6470. if (!optionSet) {
  6471. elem.selectedIndex = -1;
  6472. }
  6473. return values;
  6474. }
  6475. }
  6476. }
  6477. });
  6478. jQuery.each([
  6479. 'radio',
  6480. 'checkbox'
  6481. ], function () {
  6482. jQuery.valHooks[this] = {
  6483. set: function (elem, value) {
  6484. if (jQuery.isArray(value)) {
  6485. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  6486. }
  6487. }
  6488. };
  6489. if (!support.checkOn) {
  6490. jQuery.valHooks[this].get = function (elem) {
  6491. return elem.getAttribute('value') === null ? 'on' : elem.value;
  6492. };
  6493. }
  6494. });
  6495. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
  6496. jQuery.extend(jQuery.event, {
  6497. trigger: function (event, data, elem, onlyHandlers) {
  6498. var i, cur, tmp, bubbleType, ontype, handle, special, eventPath = [elem || document], type = hasOwn.call(event, 'type') ? event.type : event, namespaces = hasOwn.call(event, 'namespace') ? event.namespace.split('.') : [];
  6499. cur = tmp = elem = elem || document;
  6500. if (elem.nodeType === 3 || elem.nodeType === 8) {
  6501. return;
  6502. }
  6503. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  6504. return;
  6505. }
  6506. if (type.indexOf('.') > -1) {
  6507. namespaces = type.split('.');
  6508. type = namespaces.shift();
  6509. namespaces.sort();
  6510. }
  6511. ontype = type.indexOf(':') < 0 && 'on' + type;
  6512. event = event[jQuery.expando] ? event : new jQuery.Event(type, typeof event === 'object' && event);
  6513. event.isTrigger = onlyHandlers ? 2 : 3;
  6514. event.namespace = namespaces.join('.');
  6515. event.rnamespace = event.namespace ? new RegExp('(^|\\.)' + namespaces.join('\\.(?:.*\\.|)') + '(\\.|$)') : null;
  6516. event.result = undefined;
  6517. if (!event.target) {
  6518. event.target = elem;
  6519. }
  6520. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  6521. special = jQuery.event.special[type] || {};
  6522. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  6523. return;
  6524. }
  6525. if (!onlyHandlers && !special.noBubble && !jQuery.isWindow(elem)) {
  6526. bubbleType = special.delegateType || type;
  6527. if (!rfocusMorph.test(bubbleType + type)) {
  6528. cur = cur.parentNode;
  6529. }
  6530. for (; cur; cur = cur.parentNode) {
  6531. eventPath.push(cur);
  6532. tmp = cur;
  6533. }
  6534. if (tmp === (elem.ownerDocument || document)) {
  6535. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  6536. }
  6537. }
  6538. i = 0;
  6539. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  6540. event.type = i > 1 ? bubbleType : special.bindType || type;
  6541. handle = (dataPriv.get(cur, 'events') || {})[event.type] && dataPriv.get(cur, 'handle');
  6542. if (handle) {
  6543. handle.apply(cur, data);
  6544. }
  6545. handle = ontype && cur[ontype];
  6546. if (handle && handle.apply && acceptData(cur)) {
  6547. event.result = handle.apply(cur, data);
  6548. if (event.result === false) {
  6549. event.preventDefault();
  6550. }
  6551. }
  6552. }
  6553. event.type = type;
  6554. if (!onlyHandlers && !event.isDefaultPrevented()) {
  6555. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  6556. if (ontype && jQuery.isFunction(elem[type]) && !jQuery.isWindow(elem)) {
  6557. tmp = elem[ontype];
  6558. if (tmp) {
  6559. elem[ontype] = null;
  6560. }
  6561. jQuery.event.triggered = type;
  6562. elem[type]();
  6563. jQuery.event.triggered = undefined;
  6564. if (tmp) {
  6565. elem[ontype] = tmp;
  6566. }
  6567. }
  6568. }
  6569. }
  6570. return event.result;
  6571. },
  6572. simulate: function (type, elem, event) {
  6573. var e = jQuery.extend(new jQuery.Event(), event, {
  6574. type: type,
  6575. isSimulated: true
  6576. });
  6577. jQuery.event.trigger(e, null, elem);
  6578. }
  6579. });
  6580. jQuery.fn.extend({
  6581. trigger: function (type, data) {
  6582. return this.each(function () {
  6583. jQuery.event.trigger(type, data, this);
  6584. });
  6585. },
  6586. triggerHandler: function (type, data) {
  6587. var elem = this[0];
  6588. if (elem) {
  6589. return jQuery.event.trigger(type, data, elem, true);
  6590. }
  6591. }
  6592. });
  6593. 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) {
  6594. jQuery.fn[name] = function (data, fn) {
  6595. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
  6596. };
  6597. });
  6598. jQuery.fn.extend({
  6599. hover: function (fnOver, fnOut) {
  6600. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  6601. }
  6602. });
  6603. support.focusin = 'onfocusin' in window;
  6604. if (!support.focusin) {
  6605. jQuery.each({
  6606. focus: 'focusin',
  6607. blur: 'focusout'
  6608. }, function (orig, fix) {
  6609. var handler = function (event) {
  6610. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  6611. };
  6612. jQuery.event.special[fix] = {
  6613. setup: function () {
  6614. var doc = this.ownerDocument || this, attaches = dataPriv.access(doc, fix);
  6615. if (!attaches) {
  6616. doc.addEventListener(orig, handler, true);
  6617. }
  6618. dataPriv.access(doc, fix, (attaches || 0) + 1);
  6619. },
  6620. teardown: function () {
  6621. var doc = this.ownerDocument || this, attaches = dataPriv.access(doc, fix) - 1;
  6622. if (!attaches) {
  6623. doc.removeEventListener(orig, handler, true);
  6624. dataPriv.remove(doc, fix);
  6625. } else {
  6626. dataPriv.access(doc, fix, attaches);
  6627. }
  6628. }
  6629. };
  6630. });
  6631. }
  6632. var location = window.location;
  6633. var nonce = jQuery.now();
  6634. var rquery = /\?/;
  6635. jQuery.parseJSON = function (data) {
  6636. return JSON.parse(data + '');
  6637. };
  6638. jQuery.parseXML = function (data) {
  6639. var xml;
  6640. if (!data || typeof data !== 'string') {
  6641. return null;
  6642. }
  6643. try {
  6644. xml = new window.DOMParser().parseFromString(data, 'text/xml');
  6645. } catch (e) {
  6646. xml = undefined;
  6647. }
  6648. if (!xml || xml.getElementsByTagName('parsererror').length) {
  6649. jQuery.error('Invalid XML: ' + data);
  6650. }
  6651. return xml;
  6652. };
  6653. var rhash = /#.*$/, rts = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)$/gm, rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, prefilters = {}, transports = {}, allTypes = '*/'.concat('*'), originAnchor = document.createElement('a');
  6654. originAnchor.href = location.href;
  6655. function addToPrefiltersOrTransports(structure) {
  6656. return function (dataTypeExpression, func) {
  6657. if (typeof dataTypeExpression !== 'string') {
  6658. func = dataTypeExpression;
  6659. dataTypeExpression = '*';
  6660. }
  6661. var dataType, i = 0, dataTypes = dataTypeExpression.toLowerCase().match(rnotwhite) || [];
  6662. if (jQuery.isFunction(func)) {
  6663. while (dataType = dataTypes[i++]) {
  6664. if (dataType[0] === '+') {
  6665. dataType = dataType.slice(1) || '*';
  6666. (structure[dataType] = structure[dataType] || []).unshift(func);
  6667. } else {
  6668. (structure[dataType] = structure[dataType] || []).push(func);
  6669. }
  6670. }
  6671. }
  6672. };
  6673. }
  6674. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  6675. var inspected = {}, seekingTransport = structure === transports;
  6676. function inspect(dataType) {
  6677. var selected;
  6678. inspected[dataType] = true;
  6679. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  6680. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  6681. if (typeof dataTypeOrTransport === 'string' && !seekingTransport && !inspected[dataTypeOrTransport]) {
  6682. options.dataTypes.unshift(dataTypeOrTransport);
  6683. inspect(dataTypeOrTransport);
  6684. return false;
  6685. } else if (seekingTransport) {
  6686. return !(selected = dataTypeOrTransport);
  6687. }
  6688. });
  6689. return selected;
  6690. }
  6691. return inspect(options.dataTypes[0]) || !inspected['*'] && inspect('*');
  6692. }
  6693. function ajaxExtend(target, src) {
  6694. var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {};
  6695. for (key in src) {
  6696. if (src[key] !== undefined) {
  6697. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  6698. }
  6699. }
  6700. if (deep) {
  6701. jQuery.extend(true, target, deep);
  6702. }
  6703. return target;
  6704. }
  6705. function ajaxHandleResponses(s, jqXHR, responses) {
  6706. var ct, type, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes;
  6707. while (dataTypes[0] === '*') {
  6708. dataTypes.shift();
  6709. if (ct === undefined) {
  6710. ct = s.mimeType || jqXHR.getResponseHeader('Content-Type');
  6711. }
  6712. }
  6713. if (ct) {
  6714. for (type in contents) {
  6715. if (contents[type] && contents[type].test(ct)) {
  6716. dataTypes.unshift(type);
  6717. break;
  6718. }
  6719. }
  6720. }
  6721. if (dataTypes[0] in responses) {
  6722. finalDataType = dataTypes[0];
  6723. } else {
  6724. for (type in responses) {
  6725. if (!dataTypes[0] || s.converters[type + ' ' + dataTypes[0]]) {
  6726. finalDataType = type;
  6727. break;
  6728. }
  6729. if (!firstDataType) {
  6730. firstDataType = type;
  6731. }
  6732. }
  6733. finalDataType = finalDataType || firstDataType;
  6734. }
  6735. if (finalDataType) {
  6736. if (finalDataType !== dataTypes[0]) {
  6737. dataTypes.unshift(finalDataType);
  6738. }
  6739. return responses[finalDataType];
  6740. }
  6741. }
  6742. function ajaxConvert(s, response, jqXHR, isSuccess) {
  6743. var conv2, current, conv, tmp, prev, converters = {}, dataTypes = s.dataTypes.slice();
  6744. if (dataTypes[1]) {
  6745. for (conv in s.converters) {
  6746. converters[conv.toLowerCase()] = s.converters[conv];
  6747. }
  6748. }
  6749. current = dataTypes.shift();
  6750. while (current) {
  6751. if (s.responseFields[current]) {
  6752. jqXHR[s.responseFields[current]] = response;
  6753. }
  6754. if (!prev && isSuccess && s.dataFilter) {
  6755. response = s.dataFilter(response, s.dataType);
  6756. }
  6757. prev = current;
  6758. current = dataTypes.shift();
  6759. if (current) {
  6760. if (current === '*') {
  6761. current = prev;
  6762. } else if (prev !== '*' && prev !== current) {
  6763. conv = converters[prev + ' ' + current] || converters['* ' + current];
  6764. if (!conv) {
  6765. for (conv2 in converters) {
  6766. tmp = conv2.split(' ');
  6767. if (tmp[1] === current) {
  6768. conv = converters[prev + ' ' + tmp[0]] || converters['* ' + tmp[0]];
  6769. if (conv) {
  6770. if (conv === true) {
  6771. conv = converters[conv2];
  6772. } else if (converters[conv2] !== true) {
  6773. current = tmp[0];
  6774. dataTypes.unshift(tmp[1]);
  6775. }
  6776. break;
  6777. }
  6778. }
  6779. }
  6780. }
  6781. if (conv !== true) {
  6782. if (conv && s.throws) {
  6783. response = conv(response);
  6784. } else {
  6785. try {
  6786. response = conv(response);
  6787. } catch (e) {
  6788. return {
  6789. state: 'parsererror',
  6790. error: conv ? e : 'No conversion from ' + prev + ' to ' + current
  6791. };
  6792. }
  6793. }
  6794. }
  6795. }
  6796. }
  6797. }
  6798. return {
  6799. state: 'success',
  6800. data: response
  6801. };
  6802. }
  6803. jQuery.extend({
  6804. active: 0,
  6805. lastModified: {},
  6806. etag: {},
  6807. ajaxSettings: {
  6808. url: location.href,
  6809. type: 'GET',
  6810. isLocal: rlocalProtocol.test(location.protocol),
  6811. global: true,
  6812. processData: true,
  6813. async: true,
  6814. contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
  6815. accepts: {
  6816. '*': allTypes,
  6817. text: 'text/plain',
  6818. html: 'text/html',
  6819. xml: 'application/xml, text/xml',
  6820. json: 'application/json, text/javascript'
  6821. },
  6822. contents: {
  6823. xml: /\bxml\b/,
  6824. html: /\bhtml/,
  6825. json: /\bjson\b/
  6826. },
  6827. responseFields: {
  6828. xml: 'responseXML',
  6829. text: 'responseText',
  6830. json: 'responseJSON'
  6831. },
  6832. converters: {
  6833. '* text': String,
  6834. 'text html': true,
  6835. 'text json': jQuery.parseJSON,
  6836. 'text xml': jQuery.parseXML
  6837. },
  6838. flatOptions: {
  6839. url: true,
  6840. context: true
  6841. }
  6842. },
  6843. ajaxSetup: function (target, settings) {
  6844. return settings ? ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : ajaxExtend(jQuery.ajaxSettings, target);
  6845. },
  6846. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  6847. ajaxTransport: addToPrefiltersOrTransports(transports),
  6848. ajax: function (url, options) {
  6849. if (typeof url === 'object') {
  6850. options = url;
  6851. url = undefined;
  6852. }
  6853. options = options || {};
  6854. var transport, cacheURL, responseHeadersString, responseHeaders, timeoutTimer, urlAnchor, fireGlobals, i, s = jQuery.ajaxSetup({}, options), callbackContext = s.context || s, globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event, deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks('once memory'), statusCode = s.statusCode || {}, requestHeaders = {}, requestHeadersNames = {}, state = 0, strAbort = 'canceled', jqXHR = {
  6855. readyState: 0,
  6856. getResponseHeader: function (key) {
  6857. var match;
  6858. if (state === 2) {
  6859. if (!responseHeaders) {
  6860. responseHeaders = {};
  6861. while (match = rheaders.exec(responseHeadersString)) {
  6862. responseHeaders[match[1].toLowerCase()] = match[2];
  6863. }
  6864. }
  6865. match = responseHeaders[key.toLowerCase()];
  6866. }
  6867. return match == null ? null : match;
  6868. },
  6869. getAllResponseHeaders: function () {
  6870. return state === 2 ? responseHeadersString : null;
  6871. },
  6872. setRequestHeader: function (name, value) {
  6873. var lname = name.toLowerCase();
  6874. if (!state) {
  6875. name = requestHeadersNames[lname] = requestHeadersNames[lname] || name;
  6876. requestHeaders[name] = value;
  6877. }
  6878. return this;
  6879. },
  6880. overrideMimeType: function (type) {
  6881. if (!state) {
  6882. s.mimeType = type;
  6883. }
  6884. return this;
  6885. },
  6886. statusCode: function (map) {
  6887. var code;
  6888. if (map) {
  6889. if (state < 2) {
  6890. for (code in map) {
  6891. statusCode[code] = [
  6892. statusCode[code],
  6893. map[code]
  6894. ];
  6895. }
  6896. } else {
  6897. jqXHR.always(map[jqXHR.status]);
  6898. }
  6899. }
  6900. return this;
  6901. },
  6902. abort: function (statusText) {
  6903. var finalText = statusText || strAbort;
  6904. if (transport) {
  6905. transport.abort(finalText);
  6906. }
  6907. done(0, finalText);
  6908. return this;
  6909. }
  6910. };
  6911. deferred.promise(jqXHR).complete = completeDeferred.add;
  6912. jqXHR.success = jqXHR.done;
  6913. jqXHR.error = jqXHR.fail;
  6914. s.url = ((url || s.url || location.href) + '').replace(rhash, '').replace(rprotocol, location.protocol + '//');
  6915. s.type = options.method || options.type || s.method || s.type;
  6916. s.dataTypes = jQuery.trim(s.dataType || '*').toLowerCase().match(rnotwhite) || [''];
  6917. if (s.crossDomain == null) {
  6918. urlAnchor = document.createElement('a');
  6919. try {
  6920. urlAnchor.href = s.url;
  6921. urlAnchor.href = urlAnchor.href;
  6922. s.crossDomain = originAnchor.protocol + '//' + originAnchor.host !== urlAnchor.protocol + '//' + urlAnchor.host;
  6923. } catch (e) {
  6924. s.crossDomain = true;
  6925. }
  6926. }
  6927. if (s.data && s.processData && typeof s.data !== 'string') {
  6928. s.data = jQuery.param(s.data, s.traditional);
  6929. }
  6930. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  6931. if (state === 2) {
  6932. return jqXHR;
  6933. }
  6934. fireGlobals = jQuery.event && s.global;
  6935. if (fireGlobals && jQuery.active++ === 0) {
  6936. jQuery.event.trigger('ajaxStart');
  6937. }
  6938. s.type = s.type.toUpperCase();
  6939. s.hasContent = !rnoContent.test(s.type);
  6940. cacheURL = s.url;
  6941. if (!s.hasContent) {
  6942. if (s.data) {
  6943. cacheURL = s.url += (rquery.test(cacheURL) ? '&' : '?') + s.data;
  6944. delete s.data;
  6945. }
  6946. if (s.cache === false) {
  6947. s.url = rts.test(cacheURL) ? cacheURL.replace(rts, '$1_=' + nonce++) : cacheURL + (rquery.test(cacheURL) ? '&' : '?') + '_=' + nonce++;
  6948. }
  6949. }
  6950. if (s.ifModified) {
  6951. if (jQuery.lastModified[cacheURL]) {
  6952. jqXHR.setRequestHeader('If-Modified-Since', jQuery.lastModified[cacheURL]);
  6953. }
  6954. if (jQuery.etag[cacheURL]) {
  6955. jqXHR.setRequestHeader('If-None-Match', jQuery.etag[cacheURL]);
  6956. }
  6957. }
  6958. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  6959. jqXHR.setRequestHeader('Content-Type', s.contentType);
  6960. }
  6961. 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['*']);
  6962. for (i in s.headers) {
  6963. jqXHR.setRequestHeader(i, s.headers[i]);
  6964. }
  6965. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || state === 2)) {
  6966. return jqXHR.abort();
  6967. }
  6968. strAbort = 'abort';
  6969. for (i in {
  6970. success: 1,
  6971. error: 1,
  6972. complete: 1
  6973. }) {
  6974. jqXHR[i](s[i]);
  6975. }
  6976. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  6977. if (!transport) {
  6978. done(-1, 'No Transport');
  6979. } else {
  6980. jqXHR.readyState = 1;
  6981. if (fireGlobals) {
  6982. globalEventContext.trigger('ajaxSend', [
  6983. jqXHR,
  6984. s
  6985. ]);
  6986. }
  6987. if (state === 2) {
  6988. return jqXHR;
  6989. }
  6990. if (s.async && s.timeout > 0) {
  6991. timeoutTimer = window.setTimeout(function () {
  6992. jqXHR.abort('timeout');
  6993. }, s.timeout);
  6994. }
  6995. try {
  6996. state = 1;
  6997. transport.send(requestHeaders, done);
  6998. } catch (e) {
  6999. if (state < 2) {
  7000. done(-1, e);
  7001. } else {
  7002. throw e;
  7003. }
  7004. }
  7005. }
  7006. function done(status, nativeStatusText, responses, headers) {
  7007. var isSuccess, success, error, response, modified, statusText = nativeStatusText;
  7008. if (state === 2) {
  7009. return;
  7010. }
  7011. state = 2;
  7012. if (timeoutTimer) {
  7013. window.clearTimeout(timeoutTimer);
  7014. }
  7015. transport = undefined;
  7016. responseHeadersString = headers || '';
  7017. jqXHR.readyState = status > 0 ? 4 : 0;
  7018. isSuccess = status >= 200 && status < 300 || status === 304;
  7019. if (responses) {
  7020. response = ajaxHandleResponses(s, jqXHR, responses);
  7021. }
  7022. response = ajaxConvert(s, response, jqXHR, isSuccess);
  7023. if (isSuccess) {
  7024. if (s.ifModified) {
  7025. modified = jqXHR.getResponseHeader('Last-Modified');
  7026. if (modified) {
  7027. jQuery.lastModified[cacheURL] = modified;
  7028. }
  7029. modified = jqXHR.getResponseHeader('etag');
  7030. if (modified) {
  7031. jQuery.etag[cacheURL] = modified;
  7032. }
  7033. }
  7034. if (status === 204 || s.type === 'HEAD') {
  7035. statusText = 'nocontent';
  7036. } else if (status === 304) {
  7037. statusText = 'notmodified';
  7038. } else {
  7039. statusText = response.state;
  7040. success = response.data;
  7041. error = response.error;
  7042. isSuccess = !error;
  7043. }
  7044. } else {
  7045. error = statusText;
  7046. if (status || !statusText) {
  7047. statusText = 'error';
  7048. if (status < 0) {
  7049. status = 0;
  7050. }
  7051. }
  7052. }
  7053. jqXHR.status = status;
  7054. jqXHR.statusText = (nativeStatusText || statusText) + '';
  7055. if (isSuccess) {
  7056. deferred.resolveWith(callbackContext, [
  7057. success,
  7058. statusText,
  7059. jqXHR
  7060. ]);
  7061. } else {
  7062. deferred.rejectWith(callbackContext, [
  7063. jqXHR,
  7064. statusText,
  7065. error
  7066. ]);
  7067. }
  7068. jqXHR.statusCode(statusCode);
  7069. statusCode = undefined;
  7070. if (fireGlobals) {
  7071. globalEventContext.trigger(isSuccess ? 'ajaxSuccess' : 'ajaxError', [
  7072. jqXHR,
  7073. s,
  7074. isSuccess ? success : error
  7075. ]);
  7076. }
  7077. completeDeferred.fireWith(callbackContext, [
  7078. jqXHR,
  7079. statusText
  7080. ]);
  7081. if (fireGlobals) {
  7082. globalEventContext.trigger('ajaxComplete', [
  7083. jqXHR,
  7084. s
  7085. ]);
  7086. if (!--jQuery.active) {
  7087. jQuery.event.trigger('ajaxStop');
  7088. }
  7089. }
  7090. }
  7091. return jqXHR;
  7092. },
  7093. getJSON: function (url, data, callback) {
  7094. return jQuery.get(url, data, callback, 'json');
  7095. },
  7096. getScript: function (url, callback) {
  7097. return jQuery.get(url, undefined, callback, 'script');
  7098. }
  7099. });
  7100. jQuery.each([
  7101. 'get',
  7102. 'post'
  7103. ], function (i, method) {
  7104. jQuery[method] = function (url, data, callback, type) {
  7105. if (jQuery.isFunction(data)) {
  7106. type = type || callback;
  7107. callback = data;
  7108. data = undefined;
  7109. }
  7110. return jQuery.ajax(jQuery.extend({
  7111. url: url,
  7112. type: method,
  7113. dataType: type,
  7114. data: data,
  7115. success: callback
  7116. }, jQuery.isPlainObject(url) && url));
  7117. };
  7118. });
  7119. jQuery._evalUrl = function (url) {
  7120. return jQuery.ajax({
  7121. url: url,
  7122. type: 'GET',
  7123. dataType: 'script',
  7124. async: false,
  7125. global: false,
  7126. 'throws': true
  7127. });
  7128. };
  7129. jQuery.fn.extend({
  7130. wrapAll: function (html) {
  7131. var wrap;
  7132. if (jQuery.isFunction(html)) {
  7133. return this.each(function (i) {
  7134. jQuery(this).wrapAll(html.call(this, i));
  7135. });
  7136. }
  7137. if (this[0]) {
  7138. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  7139. if (this[0].parentNode) {
  7140. wrap.insertBefore(this[0]);
  7141. }
  7142. wrap.map(function () {
  7143. var elem = this;
  7144. while (elem.firstElementChild) {
  7145. elem = elem.firstElementChild;
  7146. }
  7147. return elem;
  7148. }).append(this);
  7149. }
  7150. return this;
  7151. },
  7152. wrapInner: function (html) {
  7153. if (jQuery.isFunction(html)) {
  7154. return this.each(function (i) {
  7155. jQuery(this).wrapInner(html.call(this, i));
  7156. });
  7157. }
  7158. return this.each(function () {
  7159. var self = jQuery(this), contents = self.contents();
  7160. if (contents.length) {
  7161. contents.wrapAll(html);
  7162. } else {
  7163. self.append(html);
  7164. }
  7165. });
  7166. },
  7167. wrap: function (html) {
  7168. var isFunction = jQuery.isFunction(html);
  7169. return this.each(function (i) {
  7170. jQuery(this).wrapAll(isFunction ? html.call(this, i) : html);
  7171. });
  7172. },
  7173. unwrap: function () {
  7174. return this.parent().each(function () {
  7175. if (!jQuery.nodeName(this, 'body')) {
  7176. jQuery(this).replaceWith(this.childNodes);
  7177. }
  7178. }).end();
  7179. }
  7180. });
  7181. jQuery.expr.filters.hidden = function (elem) {
  7182. return !jQuery.expr.filters.visible(elem);
  7183. };
  7184. jQuery.expr.filters.visible = function (elem) {
  7185. return elem.offsetWidth > 0 || elem.offsetHeight > 0 || elem.getClientRects().length > 0;
  7186. };
  7187. var r20 = /%20/g, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i;
  7188. function buildParams(prefix, obj, traditional, add) {
  7189. var name;
  7190. if (jQuery.isArray(obj)) {
  7191. jQuery.each(obj, function (i, v) {
  7192. if (traditional || rbracket.test(prefix)) {
  7193. add(prefix, v);
  7194. } else {
  7195. buildParams(prefix + '[' + (typeof v === 'object' && v != null ? i : '') + ']', v, traditional, add);
  7196. }
  7197. });
  7198. } else if (!traditional && jQuery.type(obj) === 'object') {
  7199. for (name in obj) {
  7200. buildParams(prefix + '[' + name + ']', obj[name], traditional, add);
  7201. }
  7202. } else {
  7203. add(prefix, obj);
  7204. }
  7205. }
  7206. jQuery.param = function (a, traditional) {
  7207. var prefix, s = [], add = function (key, value) {
  7208. value = jQuery.isFunction(value) ? value() : value == null ? '' : value;
  7209. s[s.length] = encodeURIComponent(key) + '=' + encodeURIComponent(value);
  7210. };
  7211. if (traditional === undefined) {
  7212. traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
  7213. }
  7214. if (jQuery.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  7215. jQuery.each(a, function () {
  7216. add(this.name, this.value);
  7217. });
  7218. } else {
  7219. for (prefix in a) {
  7220. buildParams(prefix, a[prefix], traditional, add);
  7221. }
  7222. }
  7223. return s.join('&').replace(r20, '+');
  7224. };
  7225. jQuery.fn.extend({
  7226. serialize: function () {
  7227. return jQuery.param(this.serializeArray());
  7228. },
  7229. serializeArray: function () {
  7230. return this.map(function () {
  7231. var elements = jQuery.prop(this, 'elements');
  7232. return elements ? jQuery.makeArray(elements) : this;
  7233. }).filter(function () {
  7234. var type = this.type;
  7235. return this.name && !jQuery(this).is(':disabled') && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
  7236. }).map(function (i, elem) {
  7237. var val = jQuery(this).val();
  7238. return val == null ? null : jQuery.isArray(val) ? jQuery.map(val, function (val) {
  7239. return {
  7240. name: elem.name,
  7241. value: val.replace(rCRLF, '\r\n')
  7242. };
  7243. }) : {
  7244. name: elem.name,
  7245. value: val.replace(rCRLF, '\r\n')
  7246. };
  7247. }).get();
  7248. }
  7249. });
  7250. jQuery.ajaxSettings.xhr = function () {
  7251. try {
  7252. return new window.XMLHttpRequest();
  7253. } catch (e) {
  7254. }
  7255. };
  7256. var xhrSuccessStatus = {
  7257. 0: 200,
  7258. 1223: 204
  7259. }, xhrSupported = jQuery.ajaxSettings.xhr();
  7260. support.cors = !!xhrSupported && 'withCredentials' in xhrSupported;
  7261. support.ajax = xhrSupported = !!xhrSupported;
  7262. jQuery.ajaxTransport(function (options) {
  7263. var callback, errorCallback;
  7264. if (support.cors || xhrSupported && !options.crossDomain) {
  7265. return {
  7266. send: function (headers, complete) {
  7267. var i, xhr = options.xhr();
  7268. xhr.open(options.type, options.url, options.async, options.username, options.password);
  7269. if (options.xhrFields) {
  7270. for (i in options.xhrFields) {
  7271. xhr[i] = options.xhrFields[i];
  7272. }
  7273. }
  7274. if (options.mimeType && xhr.overrideMimeType) {
  7275. xhr.overrideMimeType(options.mimeType);
  7276. }
  7277. if (!options.crossDomain && !headers['X-Requested-With']) {
  7278. headers['X-Requested-With'] = 'XMLHttpRequest';
  7279. }
  7280. for (i in headers) {
  7281. xhr.setRequestHeader(i, headers[i]);
  7282. }
  7283. callback = function (type) {
  7284. return function () {
  7285. if (callback) {
  7286. callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
  7287. if (type === 'abort') {
  7288. xhr.abort();
  7289. } else if (type === 'error') {
  7290. if (typeof xhr.status !== 'number') {
  7291. complete(0, 'error');
  7292. } else {
  7293. complete(xhr.status, xhr.statusText);
  7294. }
  7295. } else {
  7296. complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText, (xhr.responseType || 'text') !== 'text' || typeof xhr.responseText !== 'string' ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
  7297. }
  7298. }
  7299. };
  7300. };
  7301. xhr.onload = callback();
  7302. errorCallback = xhr.onerror = callback('error');
  7303. if (xhr.onabort !== undefined) {
  7304. xhr.onabort = errorCallback;
  7305. } else {
  7306. xhr.onreadystatechange = function () {
  7307. if (xhr.readyState === 4) {
  7308. window.setTimeout(function () {
  7309. if (callback) {
  7310. errorCallback();
  7311. }
  7312. });
  7313. }
  7314. };
  7315. }
  7316. callback = callback('abort');
  7317. try {
  7318. xhr.send(options.hasContent && options.data || null);
  7319. } catch (e) {
  7320. if (callback) {
  7321. throw e;
  7322. }
  7323. }
  7324. },
  7325. abort: function () {
  7326. if (callback) {
  7327. callback();
  7328. }
  7329. }
  7330. };
  7331. }
  7332. });
  7333. jQuery.ajaxSetup({
  7334. accepts: { script: 'text/javascript, application/javascript, ' + 'application/ecmascript, application/x-ecmascript' },
  7335. contents: { script: /\b(?:java|ecma)script\b/ },
  7336. converters: {
  7337. 'text script': function (text) {
  7338. jQuery.globalEval(text);
  7339. return text;
  7340. }
  7341. }
  7342. });
  7343. jQuery.ajaxPrefilter('script', function (s) {
  7344. if (s.cache === undefined) {
  7345. s.cache = false;
  7346. }
  7347. if (s.crossDomain) {
  7348. s.type = 'GET';
  7349. }
  7350. });
  7351. jQuery.ajaxTransport('script', function (s) {
  7352. if (s.crossDomain) {
  7353. var script, callback;
  7354. return {
  7355. send: function (_, complete) {
  7356. script = jQuery('<script>').prop({
  7357. charset: s.scriptCharset,
  7358. src: s.url
  7359. }).on('load error', callback = function (evt) {
  7360. script.remove();
  7361. callback = null;
  7362. if (evt) {
  7363. complete(evt.type === 'error' ? 404 : 200, evt.type);
  7364. }
  7365. });
  7366. document.head.appendChild(script[0]);
  7367. },
  7368. abort: function () {
  7369. if (callback) {
  7370. callback();
  7371. }
  7372. }
  7373. };
  7374. }
  7375. });
  7376. var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/;
  7377. jQuery.ajaxSetup({
  7378. jsonp: 'callback',
  7379. jsonpCallback: function () {
  7380. var callback = oldCallbacks.pop() || jQuery.expando + '_' + nonce++;
  7381. this[callback] = true;
  7382. return callback;
  7383. }
  7384. });
  7385. jQuery.ajaxPrefilter('json jsonp', function (s, originalSettings, jqXHR) {
  7386. var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? 'url' : typeof s.data === 'string' && (s.contentType || '').indexOf('application/x-www-form-urlencoded') === 0 && rjsonp.test(s.data) && 'data');
  7387. if (jsonProp || s.dataTypes[0] === 'jsonp') {
  7388. callbackName = s.jsonpCallback = jQuery.isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  7389. if (jsonProp) {
  7390. s[jsonProp] = s[jsonProp].replace(rjsonp, '$1' + callbackName);
  7391. } else if (s.jsonp !== false) {
  7392. s.url += (rquery.test(s.url) ? '&' : '?') + s.jsonp + '=' + callbackName;
  7393. }
  7394. s.converters['script json'] = function () {
  7395. if (!responseContainer) {
  7396. jQuery.error(callbackName + ' was not called');
  7397. }
  7398. return responseContainer[0];
  7399. };
  7400. s.dataTypes[0] = 'json';
  7401. overwritten = window[callbackName];
  7402. window[callbackName] = function () {
  7403. responseContainer = arguments;
  7404. };
  7405. jqXHR.always(function () {
  7406. if (overwritten === undefined) {
  7407. jQuery(window).removeProp(callbackName);
  7408. } else {
  7409. window[callbackName] = overwritten;
  7410. }
  7411. if (s[callbackName]) {
  7412. s.jsonpCallback = originalSettings.jsonpCallback;
  7413. oldCallbacks.push(callbackName);
  7414. }
  7415. if (responseContainer && jQuery.isFunction(overwritten)) {
  7416. overwritten(responseContainer[0]);
  7417. }
  7418. responseContainer = overwritten = undefined;
  7419. });
  7420. return 'script';
  7421. }
  7422. });
  7423. jQuery.parseHTML = function (data, context, keepScripts) {
  7424. if (!data || typeof data !== 'string') {
  7425. return null;
  7426. }
  7427. if (typeof context === 'boolean') {
  7428. keepScripts = context;
  7429. context = false;
  7430. }
  7431. context = context || document;
  7432. var parsed = rsingleTag.exec(data), scripts = !keepScripts && [];
  7433. if (parsed) {
  7434. return [context.createElement(parsed[1])];
  7435. }
  7436. parsed = buildFragment([data], context, scripts);
  7437. if (scripts && scripts.length) {
  7438. jQuery(scripts).remove();
  7439. }
  7440. return jQuery.merge([], parsed.childNodes);
  7441. };
  7442. var _load = jQuery.fn.load;
  7443. jQuery.fn.load = function (url, params, callback) {
  7444. if (typeof url !== 'string' && _load) {
  7445. return _load.apply(this, arguments);
  7446. }
  7447. var selector, type, response, self = this, off = url.indexOf(' ');
  7448. if (off > -1) {
  7449. selector = jQuery.trim(url.slice(off));
  7450. url = url.slice(0, off);
  7451. }
  7452. if (jQuery.isFunction(params)) {
  7453. callback = params;
  7454. params = undefined;
  7455. } else if (params && typeof params === 'object') {
  7456. type = 'POST';
  7457. }
  7458. if (self.length > 0) {
  7459. jQuery.ajax({
  7460. url: url,
  7461. type: type || 'GET',
  7462. dataType: 'html',
  7463. data: params
  7464. }).done(function (responseText) {
  7465. response = arguments;
  7466. self.html(selector ? jQuery('<div>').append(jQuery.parseHTML(responseText)).find(selector) : responseText);
  7467. }).always(callback && function (jqXHR, status) {
  7468. self.each(function () {
  7469. callback.apply(this, response || [
  7470. jqXHR.responseText,
  7471. status,
  7472. jqXHR
  7473. ]);
  7474. });
  7475. });
  7476. }
  7477. return this;
  7478. };
  7479. jQuery.each([
  7480. 'ajaxStart',
  7481. 'ajaxStop',
  7482. 'ajaxComplete',
  7483. 'ajaxError',
  7484. 'ajaxSuccess',
  7485. 'ajaxSend'
  7486. ], function (i, type) {
  7487. jQuery.fn[type] = function (fn) {
  7488. return this.on(type, fn);
  7489. };
  7490. });
  7491. jQuery.expr.filters.animated = function (elem) {
  7492. return jQuery.grep(jQuery.timers, function (fn) {
  7493. return elem === fn.elem;
  7494. }).length;
  7495. };
  7496. function getWindow(elem) {
  7497. return jQuery.isWindow(elem) ? elem : elem.nodeType === 9 && elem.defaultView;
  7498. }
  7499. jQuery.offset = {
  7500. setOffset: function (elem, options, i) {
  7501. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position = jQuery.css(elem, 'position'), curElem = jQuery(elem), props = {};
  7502. if (position === 'static') {
  7503. elem.style.position = 'relative';
  7504. }
  7505. curOffset = curElem.offset();
  7506. curCSSTop = jQuery.css(elem, 'top');
  7507. curCSSLeft = jQuery.css(elem, 'left');
  7508. calculatePosition = (position === 'absolute' || position === 'fixed') && (curCSSTop + curCSSLeft).indexOf('auto') > -1;
  7509. if (calculatePosition) {
  7510. curPosition = curElem.position();
  7511. curTop = curPosition.top;
  7512. curLeft = curPosition.left;
  7513. } else {
  7514. curTop = parseFloat(curCSSTop) || 0;
  7515. curLeft = parseFloat(curCSSLeft) || 0;
  7516. }
  7517. if (jQuery.isFunction(options)) {
  7518. options = options.call(elem, i, jQuery.extend({}, curOffset));
  7519. }
  7520. if (options.top != null) {
  7521. props.top = options.top - curOffset.top + curTop;
  7522. }
  7523. if (options.left != null) {
  7524. props.left = options.left - curOffset.left + curLeft;
  7525. }
  7526. if ('using' in options) {
  7527. options.using.call(elem, props);
  7528. } else {
  7529. curElem.css(props);
  7530. }
  7531. }
  7532. };
  7533. jQuery.fn.extend({
  7534. offset: function (options) {
  7535. if (arguments.length) {
  7536. return options === undefined ? this : this.each(function (i) {
  7537. jQuery.offset.setOffset(this, options, i);
  7538. });
  7539. }
  7540. var docElem, win, elem = this[0], box = {
  7541. top: 0,
  7542. left: 0
  7543. }, doc = elem && elem.ownerDocument;
  7544. if (!doc) {
  7545. return;
  7546. }
  7547. docElem = doc.documentElement;
  7548. if (!jQuery.contains(docElem, elem)) {
  7549. return box;
  7550. }
  7551. box = elem.getBoundingClientRect();
  7552. win = getWindow(doc);
  7553. return {
  7554. top: box.top + win.pageYOffset - docElem.clientTop,
  7555. left: box.left + win.pageXOffset - docElem.clientLeft
  7556. };
  7557. },
  7558. position: function () {
  7559. if (!this[0]) {
  7560. return;
  7561. }
  7562. var offsetParent, offset, elem = this[0], parentOffset = {
  7563. top: 0,
  7564. left: 0
  7565. };
  7566. if (jQuery.css(elem, 'position') === 'fixed') {
  7567. offset = elem.getBoundingClientRect();
  7568. } else {
  7569. offsetParent = this.offsetParent();
  7570. offset = this.offset();
  7571. if (!jQuery.nodeName(offsetParent[0], 'html')) {
  7572. parentOffset = offsetParent.offset();
  7573. }
  7574. parentOffset.top += jQuery.css(offsetParent[0], 'borderTopWidth', true);
  7575. parentOffset.left += jQuery.css(offsetParent[0], 'borderLeftWidth', true);
  7576. }
  7577. return {
  7578. top: offset.top - parentOffset.top - jQuery.css(elem, 'marginTop', true),
  7579. left: offset.left - parentOffset.left - jQuery.css(elem, 'marginLeft', true)
  7580. };
  7581. },
  7582. offsetParent: function () {
  7583. return this.map(function () {
  7584. var offsetParent = this.offsetParent;
  7585. while (offsetParent && jQuery.css(offsetParent, 'position') === 'static') {
  7586. offsetParent = offsetParent.offsetParent;
  7587. }
  7588. return offsetParent || documentElement;
  7589. });
  7590. }
  7591. });
  7592. jQuery.each({
  7593. scrollLeft: 'pageXOffset',
  7594. scrollTop: 'pageYOffset'
  7595. }, function (method, prop) {
  7596. var top = 'pageYOffset' === prop;
  7597. jQuery.fn[method] = function (val) {
  7598. return access(this, function (elem, method, val) {
  7599. var win = getWindow(elem);
  7600. if (val === undefined) {
  7601. return win ? win[prop] : elem[method];
  7602. }
  7603. if (win) {
  7604. win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
  7605. } else {
  7606. elem[method] = val;
  7607. }
  7608. }, method, val, arguments.length);
  7609. };
  7610. });
  7611. jQuery.each([
  7612. 'top',
  7613. 'left'
  7614. ], function (i, prop) {
  7615. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
  7616. if (computed) {
  7617. computed = curCSS(elem, prop);
  7618. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + 'px' : computed;
  7619. }
  7620. });
  7621. });
  7622. jQuery.each({
  7623. Height: 'height',
  7624. Width: 'width'
  7625. }, function (name, type) {
  7626. jQuery.each({
  7627. padding: 'inner' + name,
  7628. content: type,
  7629. '': 'outer' + name
  7630. }, function (defaultExtra, funcName) {
  7631. jQuery.fn[funcName] = function (margin, value) {
  7632. var chainable = arguments.length && (defaultExtra || typeof margin !== 'boolean'), extra = defaultExtra || (margin === true || value === true ? 'margin' : 'border');
  7633. return access(this, function (elem, type, value) {
  7634. var doc;
  7635. if (jQuery.isWindow(elem)) {
  7636. return elem.document.documentElement['client' + name];
  7637. }
  7638. if (elem.nodeType === 9) {
  7639. doc = elem.documentElement;
  7640. return Math.max(elem.body['scroll' + name], doc['scroll' + name], elem.body['offset' + name], doc['offset' + name], doc['client' + name]);
  7641. }
  7642. return value === undefined ? jQuery.css(elem, type, extra) : jQuery.style(elem, type, value, extra);
  7643. }, type, chainable ? margin : undefined, chainable, null);
  7644. };
  7645. });
  7646. });
  7647. jQuery.fn.extend({
  7648. bind: function (types, data, fn) {
  7649. return this.on(types, null, data, fn);
  7650. },
  7651. unbind: function (types, fn) {
  7652. return this.off(types, null, fn);
  7653. },
  7654. delegate: function (selector, types, data, fn) {
  7655. return this.on(types, selector, data, fn);
  7656. },
  7657. undelegate: function (selector, types, fn) {
  7658. return arguments.length === 1 ? this.off(selector, '**') : this.off(types, selector || '**', fn);
  7659. },
  7660. size: function () {
  7661. return this.length;
  7662. }
  7663. });
  7664. jQuery.fn.andSelf = jQuery.fn.addBack;
  7665. if (typeof define === 'function' && define.amd) {
  7666. define('jquery@2.2.4#dist/jquery', [], function () {
  7667. return jQuery;
  7668. });
  7669. }
  7670. var _jQuery = window.jQuery, _$ = window.$;
  7671. jQuery.noConflict = function (deep) {
  7672. if (window.$ === jQuery) {
  7673. window.$ = _$;
  7674. }
  7675. if (deep && window.jQuery === jQuery) {
  7676. window.jQuery = _jQuery;
  7677. }
  7678. return jQuery;
  7679. };
  7680. if (!noGlobal) {
  7681. window.jQuery = window.$ = jQuery;
  7682. }
  7683. return jQuery;
  7684. }));
  7685. /*can-view-import@3.0.0-pre.2#can-view-import*/
  7686. define('can-view-import@3.0.0-pre.2#can-view-import', function (require, exports, module) {
  7687. var assign = require('can-util/js/assign/assign');
  7688. var canData = require('can-util/dom/data/data');
  7689. var isFunction = require('can-util/js/is-function/is-function');
  7690. var importer = require('can-util/js/import/import');
  7691. var nodeLists = require('can-view-nodelist');
  7692. var tag = require('can-view-callbacks').tag;
  7693. var events = require('can-event');
  7694. tag('can-import', function (el, tagData) {
  7695. var moduleName = el.getAttribute('from');
  7696. var templateModule = tagData.options.attr('helpers.module');
  7697. var parentName = templateModule ? templateModule.id : undefined;
  7698. if (!moduleName) {
  7699. return Promise.reject('No module name provided');
  7700. }
  7701. var importPromise = importer(moduleName, parentName);
  7702. var root = tagData.scope.attr('%root');
  7703. if (root && isFunction(root.waitFor)) {
  7704. root.waitFor(importPromise);
  7705. }
  7706. canData.set.call(el, 'viewModel', importPromise);
  7707. canData.set.call(el, 'scope', importPromise);
  7708. var scope = tagData.scope.add(importPromise);
  7709. var handOffTag = el.getAttribute('can-tag');
  7710. if (handOffTag) {
  7711. var callback = tag(handOffTag);
  7712. canData.set.call(el, 'preventDataBindings', true);
  7713. callback(el, assign(tagData, { scope: scope }));
  7714. canData.set.call(el, 'preventDataBindings', false);
  7715. canData.set.call(el, 'viewModel', importPromise);
  7716. canData.set.call(el, 'scope', importPromise);
  7717. } else {
  7718. var frag = tagData.subtemplate ? tagData.subtemplate(scope, tagData.options) : document.createDocumentFragment();
  7719. var nodeList = nodeLists.register([], undefined, true);
  7720. events.one.call(el, 'removed', function () {
  7721. nodeLists.unregister(nodeList);
  7722. });
  7723. el.appendChild(frag);
  7724. nodeLists.update(nodeList, el.childNodes);
  7725. }
  7726. });
  7727. });
  7728. /*steal-stache@3.0.0-pre.3#add-bundles*/
  7729. define('steal-stache@3.0.0-pre.3#add-bundles', [], function(){ return {}; });
  7730. /*steal-stache@3.0.0-pre.3#steal-stache*/
  7731. define('steal-stache@3.0.0-pre.3#steal-stache', [], function(){ return {}; });
  7732. /*src/player-bio/components/player-bio.stache!steal-stache@3.0.0-pre.3#steal-stache*/
  7733. define('src/player-bio/components/player-bio.stache!steal-stache@3.0.0-pre.3#steal-stache', [
  7734. 'module',
  7735. 'can-stache',
  7736. 'can-stache/src/mustache_core',
  7737. 'can-view-import@3.0.0-pre.2#can-view-import',
  7738. 'can-stache-bindings@3.0.0-pre.12#can-stache-bindings'
  7739. ], function (module, stache, mustacheCore) {
  7740. var renderer = stache([
  7741. {
  7742. 'tokenType': 'start',
  7743. 'args': [
  7744. 'div',
  7745. false
  7746. ]
  7747. },
  7748. {
  7749. 'tokenType': 'attrStart',
  7750. 'args': ['class']
  7751. },
  7752. {
  7753. 'tokenType': 'attrValue',
  7754. 'args': ['player-bio']
  7755. },
  7756. {
  7757. 'tokenType': 'attrEnd',
  7758. 'args': ['class']
  7759. },
  7760. {
  7761. 'tokenType': 'end',
  7762. 'args': [
  7763. 'div',
  7764. false
  7765. ]
  7766. },
  7767. {
  7768. 'tokenType': 'chars',
  7769. 'args': ['\n ']
  7770. },
  7771. {
  7772. 'tokenType': 'start',
  7773. 'args': [
  7774. 'div',
  7775. false
  7776. ]
  7777. },
  7778. {
  7779. 'tokenType': 'attrStart',
  7780. 'args': ['class']
  7781. },
  7782. {
  7783. 'tokenType': 'attrValue',
  7784. 'args': ['player-image']
  7785. },
  7786. {
  7787. 'tokenType': 'attrEnd',
  7788. 'args': ['class']
  7789. },
  7790. {
  7791. 'tokenType': 'end',
  7792. 'args': [
  7793. 'div',
  7794. false
  7795. ]
  7796. },
  7797. {
  7798. 'tokenType': 'special',
  7799. 'args': ['#personalInfo.playerId']
  7800. },
  7801. {
  7802. 'tokenType': 'chars',
  7803. 'args': ['\n ']
  7804. },
  7805. {
  7806. 'tokenType': 'start',
  7807. 'args': [
  7808. 'img',
  7809. true
  7810. ]
  7811. },
  7812. {
  7813. 'tokenType': 'attrStart',
  7814. 'args': ['src']
  7815. },
  7816. {
  7817. 'tokenType': 'attrValue',
  7818. 'args': ['http://i.pgatour.com/image/upload/t_headshot_244x324/headshots_']
  7819. },
  7820. {
  7821. 'tokenType': 'special',
  7822. 'args': ['personalInfo.playerId']
  7823. },
  7824. {
  7825. 'tokenType': 'attrValue',
  7826. 'args': ['.png']
  7827. },
  7828. {
  7829. 'tokenType': 'attrEnd',
  7830. 'args': ['src']
  7831. },
  7832. {
  7833. 'tokenType': 'end',
  7834. 'args': [
  7835. 'img',
  7836. true
  7837. ]
  7838. },
  7839. {
  7840. 'tokenType': 'special',
  7841. 'args': ['/personalInfo.playerId']
  7842. },
  7843. {
  7844. 'tokenType': 'chars',
  7845. 'args': ['\n ']
  7846. },
  7847. {
  7848. 'tokenType': 'close',
  7849. 'args': ['div']
  7850. },
  7851. {
  7852. 'tokenType': 'chars',
  7853. 'args': ['\n ']
  7854. },
  7855. {
  7856. 'tokenType': 'start',
  7857. 'args': [
  7858. 'div',
  7859. false
  7860. ]
  7861. },
  7862. {
  7863. 'tokenType': 'attrStart',
  7864. 'args': ['class']
  7865. },
  7866. {
  7867. 'tokenType': 'attrValue',
  7868. 'args': ['box-central']
  7869. },
  7870. {
  7871. 'tokenType': 'attrEnd',
  7872. 'args': ['class']
  7873. },
  7874. {
  7875. 'tokenType': 'end',
  7876. 'args': [
  7877. 'div',
  7878. false
  7879. ]
  7880. },
  7881. {
  7882. 'tokenType': 'chars',
  7883. 'args': ['\n ']
  7884. },
  7885. {
  7886. 'tokenType': 'start',
  7887. 'args': [
  7888. 'div',
  7889. false
  7890. ]
  7891. },
  7892. {
  7893. 'tokenType': 'attrStart',
  7894. 'args': ['class']
  7895. },
  7896. {
  7897. 'tokenType': 'attrValue',
  7898. 'args': ['box-top']
  7899. },
  7900. {
  7901. 'tokenType': 'attrEnd',
  7902. 'args': ['class']
  7903. },
  7904. {
  7905. 'tokenType': 'end',
  7906. 'args': [
  7907. 'div',
  7908. false
  7909. ]
  7910. },
  7911. {
  7912. 'tokenType': 'chars',
  7913. 'args': ['\n ']
  7914. },
  7915. {
  7916. 'tokenType': 'start',
  7917. 'args': [
  7918. 'span',
  7919. false
  7920. ]
  7921. },
  7922. {
  7923. 'tokenType': 'attrStart',
  7924. 'args': ['class']
  7925. },
  7926. {
  7927. 'tokenType': 'attrValue',
  7928. 'args': ['player-name']
  7929. },
  7930. {
  7931. 'tokenType': 'attrEnd',
  7932. 'args': ['class']
  7933. },
  7934. {
  7935. 'tokenType': 'end',
  7936. 'args': [
  7937. 'span',
  7938. false
  7939. ]
  7940. },
  7941. {
  7942. 'tokenType': 'special',
  7943. 'args': ['name']
  7944. },
  7945. {
  7946. 'tokenType': 'close',
  7947. 'args': ['span']
  7948. },
  7949. {
  7950. 'tokenType': 'chars',
  7951. 'args': ['\n ']
  7952. },
  7953. {
  7954. 'tokenType': 'start',
  7955. 'args': [
  7956. 'span',
  7957. false
  7958. ]
  7959. },
  7960. {
  7961. 'tokenType': 'attrStart',
  7962. 'args': ['class']
  7963. },
  7964. {
  7965. 'tokenType': 'attrValue',
  7966. 'args': ['dropdown-icon glyphicon glyphicon-menu-down']
  7967. },
  7968. {
  7969. 'tokenType': 'attrEnd',
  7970. 'args': ['class']
  7971. },
  7972. {
  7973. 'tokenType': 'end',
  7974. 'args': [
  7975. 'span',
  7976. false
  7977. ]
  7978. },
  7979. {
  7980. 'tokenType': 'close',
  7981. 'args': ['span']
  7982. },
  7983. {
  7984. 'tokenType': 'chars',
  7985. 'args': ['\n ']
  7986. },
  7987. {
  7988. 'tokenType': 'start',
  7989. 'args': [
  7990. 'div',
  7991. false
  7992. ]
  7993. },
  7994. {
  7995. 'tokenType': 'attrStart',
  7996. 'args': ['class']
  7997. },
  7998. {
  7999. 'tokenType': 'attrValue',
  8000. 'args': ['dropdown hidden']
  8001. },
  8002. {
  8003. 'tokenType': 'attrEnd',
  8004. 'args': ['class']
  8005. },
  8006. {
  8007. 'tokenType': 'end',
  8008. 'args': [
  8009. 'div',
  8010. false
  8011. ]
  8012. },
  8013. {
  8014. 'tokenType': 'chars',
  8015. 'args': ['\n ']
  8016. },
  8017. {
  8018. 'tokenType': 'start',
  8019. 'args': [
  8020. 'div',
  8021. false
  8022. ]
  8023. },
  8024. {
  8025. 'tokenType': 'attrStart',
  8026. 'args': ['class']
  8027. },
  8028. {
  8029. 'tokenType': 'attrValue',
  8030. 'args': ['dropdown-content hidden']
  8031. },
  8032. {
  8033. 'tokenType': 'attrEnd',
  8034. 'args': ['class']
  8035. },
  8036. {
  8037. 'tokenType': 'end',
  8038. 'args': [
  8039. 'div',
  8040. false
  8041. ]
  8042. },
  8043. {
  8044. 'tokenType': 'chars',
  8045. 'args': ['\n ']
  8046. },
  8047. {
  8048. 'tokenType': 'start',
  8049. 'args': [
  8050. 'ul',
  8051. false
  8052. ]
  8053. },
  8054. {
  8055. 'tokenType': 'end',
  8056. 'args': [
  8057. 'ul',
  8058. false
  8059. ]
  8060. },
  8061. {
  8062. 'tokenType': 'special',
  8063. 'args': ['#playerList']
  8064. },
  8065. {
  8066. 'tokenType': 'chars',
  8067. 'args': ['\n ']
  8068. },
  8069. {
  8070. 'tokenType': 'start',
  8071. 'args': [
  8072. 'li',
  8073. false
  8074. ]
  8075. },
  8076. {
  8077. 'tokenType': 'end',
  8078. 'args': [
  8079. 'li',
  8080. false
  8081. ]
  8082. },
  8083. {
  8084. 'tokenType': 'chars',
  8085. 'args': ['\n ']
  8086. },
  8087. {
  8088. 'tokenType': 'start',
  8089. 'args': [
  8090. 'div',
  8091. false
  8092. ]
  8093. },
  8094. {
  8095. 'tokenType': 'attrStart',
  8096. 'args': ['class']
  8097. },
  8098. {
  8099. 'tokenType': 'attrValue',
  8100. 'args': ['player-select']
  8101. },
  8102. {
  8103. 'tokenType': 'attrEnd',
  8104. 'args': ['class']
  8105. },
  8106. {
  8107. 'tokenType': 'attrStart',
  8108. 'args': ['data-id']
  8109. },
  8110. {
  8111. 'tokenType': 'special',
  8112. 'args': ['playerId']
  8113. },
  8114. {
  8115. 'tokenType': 'attrEnd',
  8116. 'args': ['data-id']
  8117. },
  8118. {
  8119. 'tokenType': 'end',
  8120. 'args': [
  8121. 'div',
  8122. false
  8123. ]
  8124. },
  8125. {
  8126. 'tokenType': 'special',
  8127. 'args': ['playerName']
  8128. },
  8129. {
  8130. 'tokenType': 'close',
  8131. 'args': ['div']
  8132. },
  8133. {
  8134. 'tokenType': 'chars',
  8135. 'args': ['\n ']
  8136. },
  8137. {
  8138. 'tokenType': 'close',
  8139. 'args': ['li']
  8140. },
  8141. {
  8142. 'tokenType': 'special',
  8143. 'args': ['/playerList']
  8144. },
  8145. {
  8146. 'tokenType': 'chars',
  8147. 'args': ['\n ']
  8148. },
  8149. {
  8150. 'tokenType': 'close',
  8151. 'args': ['ul']
  8152. },
  8153. {
  8154. 'tokenType': 'chars',
  8155. 'args': ['\n ']
  8156. },
  8157. {
  8158. 'tokenType': 'close',
  8159. 'args': ['div']
  8160. },
  8161. {
  8162. 'tokenType': 'chars',
  8163. 'args': ['\n ']
  8164. },
  8165. {
  8166. 'tokenType': 'close',
  8167. 'args': ['div']
  8168. },
  8169. {
  8170. 'tokenType': 'chars',
  8171. 'args': ['\n ']
  8172. },
  8173. {
  8174. 'tokenType': 'start',
  8175. 'args': [
  8176. 'div',
  8177. false
  8178. ]
  8179. },
  8180. {
  8181. 'tokenType': 'end',
  8182. 'args': [
  8183. 'div',
  8184. false
  8185. ]
  8186. },
  8187. {
  8188. 'tokenType': 'special',
  8189. 'args': ['#personalInfo.countryCode']
  8190. },
  8191. {
  8192. 'tokenType': 'chars',
  8193. 'args': ['\n ']
  8194. },
  8195. {
  8196. 'tokenType': 'start',
  8197. 'args': [
  8198. 'span',
  8199. false
  8200. ]
  8201. },
  8202. {
  8203. 'tokenType': 'attrStart',
  8204. 'args': ['class']
  8205. },
  8206. {
  8207. 'tokenType': 'attrValue',
  8208. 'args': ['flag flag-24x24 ']
  8209. },
  8210. {
  8211. 'tokenType': 'special',
  8212. 'args': ['personalInfo.countryCode']
  8213. },
  8214. {
  8215. 'tokenType': 'attrEnd',
  8216. 'args': ['class']
  8217. },
  8218. {
  8219. 'tokenType': 'end',
  8220. 'args': [
  8221. 'span',
  8222. false
  8223. ]
  8224. },
  8225. {
  8226. 'tokenType': 'close',
  8227. 'args': ['span']
  8228. },
  8229. {
  8230. 'tokenType': 'chars',
  8231. 'args': [' ']
  8232. },
  8233. {
  8234. 'tokenType': 'special',
  8235. 'args': ['else']
  8236. },
  8237. {
  8238. 'tokenType': 'chars',
  8239. 'args': ['\n ']
  8240. },
  8241. {
  8242. 'tokenType': 'start',
  8243. 'args': [
  8244. 'span',
  8245. false
  8246. ]
  8247. },
  8248. {
  8249. 'tokenType': 'attrStart',
  8250. 'args': ['class']
  8251. },
  8252. {
  8253. 'tokenType': 'attrValue',
  8254. 'args': ['flag flag-24x24 UNKNOWN']
  8255. },
  8256. {
  8257. 'tokenType': 'attrEnd',
  8258. 'args': ['class']
  8259. },
  8260. {
  8261. 'tokenType': 'end',
  8262. 'args': [
  8263. 'span',
  8264. false
  8265. ]
  8266. },
  8267. {
  8268. 'tokenType': 'close',
  8269. 'args': ['span']
  8270. },
  8271. {
  8272. 'tokenType': 'special',
  8273. 'args': ['/personalInfo.countryCode']
  8274. },
  8275. {
  8276. 'tokenType': 'chars',
  8277. 'args': ['\n ']
  8278. },
  8279. {
  8280. 'tokenType': 'close',
  8281. 'args': ['div']
  8282. },
  8283. {
  8284. 'tokenType': 'chars',
  8285. 'args': ['\n ']
  8286. },
  8287. {
  8288. 'tokenType': 'start',
  8289. 'args': [
  8290. 'span',
  8291. false
  8292. ]
  8293. },
  8294. {
  8295. 'tokenType': 'attrStart',
  8296. 'args': ['class']
  8297. },
  8298. {
  8299. 'tokenType': 'attrValue',
  8300. 'args': ['social-icon glyphicon glyphicon-new-window']
  8301. },
  8302. {
  8303. 'tokenType': 'attrEnd',
  8304. 'args': ['class']
  8305. },
  8306. {
  8307. 'tokenType': 'end',
  8308. 'args': [
  8309. 'span',
  8310. false
  8311. ]
  8312. },
  8313. {
  8314. 'tokenType': 'close',
  8315. 'args': ['span']
  8316. },
  8317. {
  8318. 'tokenType': 'chars',
  8319. 'args': ['\n ']
  8320. },
  8321. {
  8322. 'tokenType': 'close',
  8323. 'args': ['div']
  8324. },
  8325. {
  8326. 'tokenType': 'chars',
  8327. 'args': ['\n ']
  8328. },
  8329. {
  8330. 'tokenType': 'start',
  8331. 'args': [
  8332. 'div',
  8333. false
  8334. ]
  8335. },
  8336. {
  8337. 'tokenType': 'attrStart',
  8338. 'args': ['class']
  8339. },
  8340. {
  8341. 'tokenType': 'attrValue',
  8342. 'args': ['box-left']
  8343. },
  8344. {
  8345. 'tokenType': 'attrEnd',
  8346. 'args': ['class']
  8347. },
  8348. {
  8349. 'tokenType': 'end',
  8350. 'args': [
  8351. 'div',
  8352. false
  8353. ]
  8354. },
  8355. {
  8356. 'tokenType': 'chars',
  8357. 'args': ['\n ']
  8358. },
  8359. {
  8360. 'tokenType': 'start',
  8361. 'args': [
  8362. 'div',
  8363. false
  8364. ]
  8365. },
  8366. {
  8367. 'tokenType': 'attrStart',
  8368. 'args': ['class']
  8369. },
  8370. {
  8371. 'tokenType': 'attrValue',
  8372. 'args': ['box-left-upper']
  8373. },
  8374. {
  8375. 'tokenType': 'attrEnd',
  8376. 'args': ['class']
  8377. },
  8378. {
  8379. 'tokenType': 'end',
  8380. 'args': [
  8381. 'div',
  8382. false
  8383. ]
  8384. },
  8385. {
  8386. 'tokenType': 'chars',
  8387. 'args': ['\n ']
  8388. },
  8389. {
  8390. 'tokenType': 'start',
  8391. 'args': [
  8392. 'div',
  8393. false
  8394. ]
  8395. },
  8396. {
  8397. 'tokenType': 'attrStart',
  8398. 'args': ['class']
  8399. },
  8400. {
  8401. 'tokenType': 'attrValue',
  8402. 'args': ['sponsor']
  8403. },
  8404. {
  8405. 'tokenType': 'attrEnd',
  8406. 'args': ['class']
  8407. },
  8408. {
  8409. 'tokenType': 'end',
  8410. 'args': [
  8411. 'div',
  8412. false
  8413. ]
  8414. },
  8415. {
  8416. 'tokenType': 'chars',
  8417. 'args': ['\n sponsor\n ']
  8418. },
  8419. {
  8420. 'tokenType': 'close',
  8421. 'args': ['div']
  8422. },
  8423. {
  8424. 'tokenType': 'chars',
  8425. 'args': ['\n ']
  8426. },
  8427. {
  8428. 'tokenType': 'start',
  8429. 'args': [
  8430. 'span',
  8431. false
  8432. ]
  8433. },
  8434. {
  8435. 'tokenType': 'attrStart',
  8436. 'args': ['class']
  8437. },
  8438. {
  8439. 'tokenType': 'attrValue',
  8440. 'args': ['metric-toggle']
  8441. },
  8442. {
  8443. 'tokenType': 'attrEnd',
  8444. 'args': ['class']
  8445. },
  8446. {
  8447. 'tokenType': 'end',
  8448. 'args': [
  8449. 'span',
  8450. false
  8451. ]
  8452. },
  8453. {
  8454. 'tokenType': 'special',
  8455. 'args': ['#showMetric']
  8456. },
  8457. {
  8458. 'tokenType': 'chars',
  8459. 'args': ['\n ']
  8460. },
  8461. {
  8462. 'tokenType': 'start',
  8463. 'args': [
  8464. 'span',
  8465. false
  8466. ]
  8467. },
  8468. {
  8469. 'tokenType': 'attrStart',
  8470. 'args': ['class']
  8471. },
  8472. {
  8473. 'tokenType': 'attrValue',
  8474. 'args': ['on']
  8475. },
  8476. {
  8477. 'tokenType': 'attrEnd',
  8478. 'args': ['class']
  8479. },
  8480. {
  8481. 'tokenType': 'end',
  8482. 'args': [
  8483. 'span',
  8484. false
  8485. ]
  8486. },
  8487. {
  8488. 'tokenType': 'chars',
  8489. 'args': ['\n METRIC ON\n ']
  8490. },
  8491. {
  8492. 'tokenType': 'start',
  8493. 'args': [
  8494. 'b',
  8495. false
  8496. ]
  8497. },
  8498. {
  8499. 'tokenType': 'attrStart',
  8500. 'args': ['class']
  8501. },
  8502. {
  8503. 'tokenType': 'attrValue',
  8504. 'args': ['switcher']
  8505. },
  8506. {
  8507. 'tokenType': 'attrEnd',
  8508. 'args': ['class']
  8509. },
  8510. {
  8511. 'tokenType': 'end',
  8512. 'args': [
  8513. 'b',
  8514. false
  8515. ]
  8516. },
  8517. {
  8518. 'tokenType': 'close',
  8519. 'args': ['b']
  8520. },
  8521. {
  8522. 'tokenType': 'chars',
  8523. 'args': ['\n ']
  8524. },
  8525. {
  8526. 'tokenType': 'close',
  8527. 'args': ['span']
  8528. },
  8529. {
  8530. 'tokenType': 'chars',
  8531. 'args': [' ']
  8532. },
  8533. {
  8534. 'tokenType': 'special',
  8535. 'args': ['else']
  8536. },
  8537. {
  8538. 'tokenType': 'chars',
  8539. 'args': ['\n ']
  8540. },
  8541. {
  8542. 'tokenType': 'start',
  8543. 'args': [
  8544. 'span',
  8545. false
  8546. ]
  8547. },
  8548. {
  8549. 'tokenType': 'attrStart',
  8550. 'args': ['class']
  8551. },
  8552. {
  8553. 'tokenType': 'attrValue',
  8554. 'args': ['off']
  8555. },
  8556. {
  8557. 'tokenType': 'attrEnd',
  8558. 'args': ['class']
  8559. },
  8560. {
  8561. 'tokenType': 'end',
  8562. 'args': [
  8563. 'span',
  8564. false
  8565. ]
  8566. },
  8567. {
  8568. 'tokenType': 'chars',
  8569. 'args': ['\n METRIC OFF\n ']
  8570. },
  8571. {
  8572. 'tokenType': 'start',
  8573. 'args': [
  8574. 'b',
  8575. false
  8576. ]
  8577. },
  8578. {
  8579. 'tokenType': 'attrStart',
  8580. 'args': ['class']
  8581. },
  8582. {
  8583. 'tokenType': 'attrValue',
  8584. 'args': ['switcher']
  8585. },
  8586. {
  8587. 'tokenType': 'attrEnd',
  8588. 'args': ['class']
  8589. },
  8590. {
  8591. 'tokenType': 'end',
  8592. 'args': [
  8593. 'b',
  8594. false
  8595. ]
  8596. },
  8597. {
  8598. 'tokenType': 'close',
  8599. 'args': ['b']
  8600. },
  8601. {
  8602. 'tokenType': 'chars',
  8603. 'args': ['\n ']
  8604. },
  8605. {
  8606. 'tokenType': 'close',
  8607. 'args': ['span']
  8608. },
  8609. {
  8610. 'tokenType': 'special',
  8611. 'args': ['/showMetric']
  8612. },
  8613. {
  8614. 'tokenType': 'chars',
  8615. 'args': ['\n ']
  8616. },
  8617. {
  8618. 'tokenType': 'close',
  8619. 'args': ['span']
  8620. },
  8621. {
  8622. 'tokenType': 'chars',
  8623. 'args': ['\n ']
  8624. },
  8625. {
  8626. 'tokenType': 'close',
  8627. 'args': ['div']
  8628. },
  8629. {
  8630. 'tokenType': 'chars',
  8631. 'args': ['\n ']
  8632. },
  8633. {
  8634. 'tokenType': 'start',
  8635. 'args': [
  8636. 'div',
  8637. false
  8638. ]
  8639. },
  8640. {
  8641. 'tokenType': 'attrStart',
  8642. 'args': ['class']
  8643. },
  8644. {
  8645. 'tokenType': 'attrValue',
  8646. 'args': ['box-left-lower']
  8647. },
  8648. {
  8649. 'tokenType': 'attrEnd',
  8650. 'args': ['class']
  8651. },
  8652. {
  8653. 'tokenType': 'end',
  8654. 'args': [
  8655. 'div',
  8656. false
  8657. ]
  8658. },
  8659. {
  8660. 'tokenType': 'chars',
  8661. 'args': ['\n ']
  8662. },
  8663. {
  8664. 'tokenType': 'start',
  8665. 'args': [
  8666. 'div',
  8667. false
  8668. ]
  8669. },
  8670. {
  8671. 'tokenType': 'attrStart',
  8672. 'args': ['class']
  8673. },
  8674. {
  8675. 'tokenType': 'attrValue',
  8676. 'args': ['row-1']
  8677. },
  8678. {
  8679. 'tokenType': 'attrEnd',
  8680. 'args': ['class']
  8681. },
  8682. {
  8683. 'tokenType': 'end',
  8684. 'args': [
  8685. 'div',
  8686. false
  8687. ]
  8688. },
  8689. {
  8690. 'tokenType': 'special',
  8691. 'args': ['#personalInfo.height']
  8692. },
  8693. {
  8694. 'tokenType': 'chars',
  8695. 'args': ['\n ']
  8696. },
  8697. {
  8698. 'tokenType': 'start',
  8699. 'args': [
  8700. 'div',
  8701. false
  8702. ]
  8703. },
  8704. {
  8705. 'tokenType': 'attrStart',
  8706. 'args': ['class']
  8707. },
  8708. {
  8709. 'tokenType': 'attrValue',
  8710. 'args': ['height']
  8711. },
  8712. {
  8713. 'tokenType': 'attrEnd',
  8714. 'args': ['class']
  8715. },
  8716. {
  8717. 'tokenType': 'end',
  8718. 'args': [
  8719. 'div',
  8720. false
  8721. ]
  8722. },
  8723. {
  8724. 'tokenType': 'special',
  8725. 'args': ['#showMetric']
  8726. },
  8727. {
  8728. 'tokenType': 'chars',
  8729. 'args': ['\n ']
  8730. },
  8731. {
  8732. 'tokenType': 'start',
  8733. 'args': [
  8734. 'div',
  8735. false
  8736. ]
  8737. },
  8738. {
  8739. 'tokenType': 'attrStart',
  8740. 'args': ['class']
  8741. },
  8742. {
  8743. 'tokenType': 'attrValue',
  8744. 'args': ['height-data']
  8745. },
  8746. {
  8747. 'tokenType': 'attrEnd',
  8748. 'args': ['class']
  8749. },
  8750. {
  8751. 'tokenType': 'end',
  8752. 'args': [
  8753. 'div',
  8754. false
  8755. ]
  8756. },
  8757. {
  8758. 'tokenType': 'special',
  8759. 'args': ['personalInfo.heightMetric']
  8760. },
  8761. {
  8762. 'tokenType': 'close',
  8763. 'args': ['div']
  8764. },
  8765. {
  8766. 'tokenType': 'chars',
  8767. 'args': [' ']
  8768. },
  8769. {
  8770. 'tokenType': 'special',
  8771. 'args': ['else']
  8772. },
  8773. {
  8774. 'tokenType': 'chars',
  8775. 'args': ['\n ']
  8776. },
  8777. {
  8778. 'tokenType': 'start',
  8779. 'args': [
  8780. 'div',
  8781. false
  8782. ]
  8783. },
  8784. {
  8785. 'tokenType': 'attrStart',
  8786. 'args': ['class']
  8787. },
  8788. {
  8789. 'tokenType': 'attrValue',
  8790. 'args': ['height-data']
  8791. },
  8792. {
  8793. 'tokenType': 'attrEnd',
  8794. 'args': ['class']
  8795. },
  8796. {
  8797. 'tokenType': 'end',
  8798. 'args': [
  8799. 'div',
  8800. false
  8801. ]
  8802. },
  8803. {
  8804. 'tokenType': 'special',
  8805. 'args': ['personalInfo.height']
  8806. },
  8807. {
  8808. 'tokenType': 'close',
  8809. 'args': ['div']
  8810. },
  8811. {
  8812. 'tokenType': 'special',
  8813. 'args': ['/showMetric']
  8814. },
  8815. {
  8816. 'tokenType': 'chars',
  8817. 'args': ['\n ']
  8818. },
  8819. {
  8820. 'tokenType': 'start',
  8821. 'args': [
  8822. 'div',
  8823. false
  8824. ]
  8825. },
  8826. {
  8827. 'tokenType': 'attrStart',
  8828. 'args': ['class']
  8829. },
  8830. {
  8831. 'tokenType': 'attrValue',
  8832. 'args': ['height-title']
  8833. },
  8834. {
  8835. 'tokenType': 'attrEnd',
  8836. 'args': ['class']
  8837. },
  8838. {
  8839. 'tokenType': 'end',
  8840. 'args': [
  8841. 'div',
  8842. false
  8843. ]
  8844. },
  8845. {
  8846. 'tokenType': 'chars',
  8847. 'args': ['height']
  8848. },
  8849. {
  8850. 'tokenType': 'close',
  8851. 'args': ['div']
  8852. },
  8853. {
  8854. 'tokenType': 'chars',
  8855. 'args': ['\n ']
  8856. },
  8857. {
  8858. 'tokenType': 'close',
  8859. 'args': ['div']
  8860. },
  8861. {
  8862. 'tokenType': 'special',
  8863. 'args': ['/personalInfo.height']
  8864. },
  8865. {
  8866. 'tokenType': 'chars',
  8867. 'args': ['\n ']
  8868. },
  8869. {
  8870. 'tokenType': 'special',
  8871. 'args': ['#personalInfo.age']
  8872. },
  8873. {
  8874. 'tokenType': 'chars',
  8875. 'args': ['\n ']
  8876. },
  8877. {
  8878. 'tokenType': 'start',
  8879. 'args': [
  8880. 'div',
  8881. false
  8882. ]
  8883. },
  8884. {
  8885. 'tokenType': 'attrStart',
  8886. 'args': ['class']
  8887. },
  8888. {
  8889. 'tokenType': 'attrValue',
  8890. 'args': ['age']
  8891. },
  8892. {
  8893. 'tokenType': 'attrEnd',
  8894. 'args': ['class']
  8895. },
  8896. {
  8897. 'tokenType': 'end',
  8898. 'args': [
  8899. 'div',
  8900. false
  8901. ]
  8902. },
  8903. {
  8904. 'tokenType': 'chars',
  8905. 'args': ['\n ']
  8906. },
  8907. {
  8908. 'tokenType': 'start',
  8909. 'args': [
  8910. 'div',
  8911. false
  8912. ]
  8913. },
  8914. {
  8915. 'tokenType': 'attrStart',
  8916. 'args': ['class']
  8917. },
  8918. {
  8919. 'tokenType': 'attrValue',
  8920. 'args': ['age-data']
  8921. },
  8922. {
  8923. 'tokenType': 'attrEnd',
  8924. 'args': ['class']
  8925. },
  8926. {
  8927. 'tokenType': 'end',
  8928. 'args': [
  8929. 'div',
  8930. false
  8931. ]
  8932. },
  8933. {
  8934. 'tokenType': 'special',
  8935. 'args': ['personalInfo.age']
  8936. },
  8937. {
  8938. 'tokenType': 'close',
  8939. 'args': ['div']
  8940. },
  8941. {
  8942. 'tokenType': 'chars',
  8943. 'args': ['\n ']
  8944. },
  8945. {
  8946. 'tokenType': 'start',
  8947. 'args': [
  8948. 'div',
  8949. false
  8950. ]
  8951. },
  8952. {
  8953. 'tokenType': 'attrStart',
  8954. 'args': ['class']
  8955. },
  8956. {
  8957. 'tokenType': 'attrValue',
  8958. 'args': ['age-title']
  8959. },
  8960. {
  8961. 'tokenType': 'attrEnd',
  8962. 'args': ['class']
  8963. },
  8964. {
  8965. 'tokenType': 'end',
  8966. 'args': [
  8967. 'div',
  8968. false
  8969. ]
  8970. },
  8971. {
  8972. 'tokenType': 'chars',
  8973. 'args': ['age']
  8974. },
  8975. {
  8976. 'tokenType': 'close',
  8977. 'args': ['div']
  8978. },
  8979. {
  8980. 'tokenType': 'chars',
  8981. 'args': ['\n ']
  8982. },
  8983. {
  8984. 'tokenType': 'close',
  8985. 'args': ['div']
  8986. },
  8987. {
  8988. 'tokenType': 'special',
  8989. 'args': ['/personalInfo.age']
  8990. },
  8991. {
  8992. 'tokenType': 'chars',
  8993. 'args': ['\n ']
  8994. },
  8995. {
  8996. 'tokenType': 'special',
  8997. 'args': ['#personalInfo.school']
  8998. },
  8999. {
  9000. 'tokenType': 'chars',
  9001. 'args': ['\n ']
  9002. },
  9003. {
  9004. 'tokenType': 'start',
  9005. 'args': [
  9006. 'div',
  9007. false
  9008. ]
  9009. },
  9010. {
  9011. 'tokenType': 'attrStart',
  9012. 'args': ['class']
  9013. },
  9014. {
  9015. 'tokenType': 'attrValue',
  9016. 'args': ['school']
  9017. },
  9018. {
  9019. 'tokenType': 'attrEnd',
  9020. 'args': ['class']
  9021. },
  9022. {
  9023. 'tokenType': 'end',
  9024. 'args': [
  9025. 'div',
  9026. false
  9027. ]
  9028. },
  9029. {
  9030. 'tokenType': 'chars',
  9031. 'args': ['\n ']
  9032. },
  9033. {
  9034. 'tokenType': 'start',
  9035. 'args': [
  9036. 'div',
  9037. false
  9038. ]
  9039. },
  9040. {
  9041. 'tokenType': 'attrStart',
  9042. 'args': ['class']
  9043. },
  9044. {
  9045. 'tokenType': 'attrValue',
  9046. 'args': ['school-data']
  9047. },
  9048. {
  9049. 'tokenType': 'attrEnd',
  9050. 'args': ['class']
  9051. },
  9052. {
  9053. 'tokenType': 'end',
  9054. 'args': [
  9055. 'div',
  9056. false
  9057. ]
  9058. },
  9059. {
  9060. 'tokenType': 'special',
  9061. 'args': ['personalInfo.school']
  9062. },
  9063. {
  9064. 'tokenType': 'close',
  9065. 'args': ['div']
  9066. },
  9067. {
  9068. 'tokenType': 'chars',
  9069. 'args': ['\n ']
  9070. },
  9071. {
  9072. 'tokenType': 'start',
  9073. 'args': [
  9074. 'div',
  9075. false
  9076. ]
  9077. },
  9078. {
  9079. 'tokenType': 'attrStart',
  9080. 'args': ['class']
  9081. },
  9082. {
  9083. 'tokenType': 'attrValue',
  9084. 'args': ['school-title']
  9085. },
  9086. {
  9087. 'tokenType': 'attrEnd',
  9088. 'args': ['class']
  9089. },
  9090. {
  9091. 'tokenType': 'end',
  9092. 'args': [
  9093. 'div',
  9094. false
  9095. ]
  9096. },
  9097. {
  9098. 'tokenType': 'chars',
  9099. 'args': ['college']
  9100. },
  9101. {
  9102. 'tokenType': 'close',
  9103. 'args': ['div']
  9104. },
  9105. {
  9106. 'tokenType': 'chars',
  9107. 'args': ['\n ']
  9108. },
  9109. {
  9110. 'tokenType': 'close',
  9111. 'args': ['div']
  9112. },
  9113. {
  9114. 'tokenType': 'special',
  9115. 'args': ['/personalInfo.school']
  9116. },
  9117. {
  9118. 'tokenType': 'chars',
  9119. 'args': ['\n ']
  9120. },
  9121. {
  9122. 'tokenType': 'special',
  9123. 'args': ['#personalInfo.weight']
  9124. },
  9125. {
  9126. 'tokenType': 'chars',
  9127. 'args': ['\n ']
  9128. },
  9129. {
  9130. 'tokenType': 'start',
  9131. 'args': [
  9132. 'div',
  9133. false
  9134. ]
  9135. },
  9136. {
  9137. 'tokenType': 'attrStart',
  9138. 'args': ['class']
  9139. },
  9140. {
  9141. 'tokenType': 'attrValue',
  9142. 'args': ['weight']
  9143. },
  9144. {
  9145. 'tokenType': 'attrEnd',
  9146. 'args': ['class']
  9147. },
  9148. {
  9149. 'tokenType': 'end',
  9150. 'args': [
  9151. 'div',
  9152. false
  9153. ]
  9154. },
  9155. {
  9156. 'tokenType': 'special',
  9157. 'args': ['#showMetric']
  9158. },
  9159. {
  9160. 'tokenType': 'chars',
  9161. 'args': ['\n ']
  9162. },
  9163. {
  9164. 'tokenType': 'start',
  9165. 'args': [
  9166. 'div',
  9167. false
  9168. ]
  9169. },
  9170. {
  9171. 'tokenType': 'attrStart',
  9172. 'args': ['class']
  9173. },
  9174. {
  9175. 'tokenType': 'attrValue',
  9176. 'args': ['weight-data']
  9177. },
  9178. {
  9179. 'tokenType': 'attrEnd',
  9180. 'args': ['class']
  9181. },
  9182. {
  9183. 'tokenType': 'end',
  9184. 'args': [
  9185. 'div',
  9186. false
  9187. ]
  9188. },
  9189. {
  9190. 'tokenType': 'special',
  9191. 'args': ['personalInfo.weightMetric']
  9192. },
  9193. {
  9194. 'tokenType': 'close',
  9195. 'args': ['div']
  9196. },
  9197. {
  9198. 'tokenType': 'chars',
  9199. 'args': [' ']
  9200. },
  9201. {
  9202. 'tokenType': 'special',
  9203. 'args': ['else']
  9204. },
  9205. {
  9206. 'tokenType': 'chars',
  9207. 'args': ['\n ']
  9208. },
  9209. {
  9210. 'tokenType': 'start',
  9211. 'args': [
  9212. 'div',
  9213. false
  9214. ]
  9215. },
  9216. {
  9217. 'tokenType': 'attrStart',
  9218. 'args': ['class']
  9219. },
  9220. {
  9221. 'tokenType': 'attrValue',
  9222. 'args': ['weight-data']
  9223. },
  9224. {
  9225. 'tokenType': 'attrEnd',
  9226. 'args': ['class']
  9227. },
  9228. {
  9229. 'tokenType': 'end',
  9230. 'args': [
  9231. 'div',
  9232. false
  9233. ]
  9234. },
  9235. {
  9236. 'tokenType': 'special',
  9237. 'args': ['personalInfo.weight']
  9238. },
  9239. {
  9240. 'tokenType': 'close',
  9241. 'args': ['div']
  9242. },
  9243. {
  9244. 'tokenType': 'special',
  9245. 'args': ['/showMetric']
  9246. },
  9247. {
  9248. 'tokenType': 'chars',
  9249. 'args': ['\n ']
  9250. },
  9251. {
  9252. 'tokenType': 'start',
  9253. 'args': [
  9254. 'div',
  9255. false
  9256. ]
  9257. },
  9258. {
  9259. 'tokenType': 'attrStart',
  9260. 'args': ['class']
  9261. },
  9262. {
  9263. 'tokenType': 'attrValue',
  9264. 'args': ['weight-title']
  9265. },
  9266. {
  9267. 'tokenType': 'attrEnd',
  9268. 'args': ['class']
  9269. },
  9270. {
  9271. 'tokenType': 'end',
  9272. 'args': [
  9273. 'div',
  9274. false
  9275. ]
  9276. },
  9277. {
  9278. 'tokenType': 'chars',
  9279. 'args': ['weight']
  9280. },
  9281. {
  9282. 'tokenType': 'close',
  9283. 'args': ['div']
  9284. },
  9285. {
  9286. 'tokenType': 'chars',
  9287. 'args': ['\n ']
  9288. },
  9289. {
  9290. 'tokenType': 'close',
  9291. 'args': ['div']
  9292. },
  9293. {
  9294. 'tokenType': 'special',
  9295. 'args': ['/personalInfo.weight']
  9296. },
  9297. {
  9298. 'tokenType': 'chars',
  9299. 'args': ['\n ']
  9300. },
  9301. {
  9302. 'tokenType': 'special',
  9303. 'args': ['#personalInfo.turnedPro']
  9304. },
  9305. {
  9306. 'tokenType': 'chars',
  9307. 'args': ['\n ']
  9308. },
  9309. {
  9310. 'tokenType': 'start',
  9311. 'args': [
  9312. 'div',
  9313. false
  9314. ]
  9315. },
  9316. {
  9317. 'tokenType': 'attrStart',
  9318. 'args': ['class']
  9319. },
  9320. {
  9321. 'tokenType': 'attrValue',
  9322. 'args': ['turned-pro']
  9323. },
  9324. {
  9325. 'tokenType': 'attrEnd',
  9326. 'args': ['class']
  9327. },
  9328. {
  9329. 'tokenType': 'end',
  9330. 'args': [
  9331. 'div',
  9332. false
  9333. ]
  9334. },
  9335. {
  9336. 'tokenType': 'chars',
  9337. 'args': ['\n ']
  9338. },
  9339. {
  9340. 'tokenType': 'start',
  9341. 'args': [
  9342. 'div',
  9343. false
  9344. ]
  9345. },
  9346. {
  9347. 'tokenType': 'attrStart',
  9348. 'args': ['class']
  9349. },
  9350. {
  9351. 'tokenType': 'attrValue',
  9352. 'args': ['turned-pro-data']
  9353. },
  9354. {
  9355. 'tokenType': 'attrEnd',
  9356. 'args': ['class']
  9357. },
  9358. {
  9359. 'tokenType': 'end',
  9360. 'args': [
  9361. 'div',
  9362. false
  9363. ]
  9364. },
  9365. {
  9366. 'tokenType': 'special',
  9367. 'args': ['personalInfo.turnedPro']
  9368. },
  9369. {
  9370. 'tokenType': 'close',
  9371. 'args': ['div']
  9372. },
  9373. {
  9374. 'tokenType': 'chars',
  9375. 'args': ['\n ']
  9376. },
  9377. {
  9378. 'tokenType': 'start',
  9379. 'args': [
  9380. 'div',
  9381. false
  9382. ]
  9383. },
  9384. {
  9385. 'tokenType': 'attrStart',
  9386. 'args': ['class']
  9387. },
  9388. {
  9389. 'tokenType': 'attrValue',
  9390. 'args': ['turned-pro-title']
  9391. },
  9392. {
  9393. 'tokenType': 'attrEnd',
  9394. 'args': ['class']
  9395. },
  9396. {
  9397. 'tokenType': 'end',
  9398. 'args': [
  9399. 'div',
  9400. false
  9401. ]
  9402. },
  9403. {
  9404. 'tokenType': 'chars',
  9405. 'args': ['turned pro']
  9406. },
  9407. {
  9408. 'tokenType': 'close',
  9409. 'args': ['div']
  9410. },
  9411. {
  9412. 'tokenType': 'chars',
  9413. 'args': ['\n ']
  9414. },
  9415. {
  9416. 'tokenType': 'close',
  9417. 'args': ['div']
  9418. },
  9419. {
  9420. 'tokenType': 'special',
  9421. 'args': ['/personalInfo.turnedPro']
  9422. },
  9423. {
  9424. 'tokenType': 'chars',
  9425. 'args': ['\n ']
  9426. },
  9427. {
  9428. 'tokenType': 'special',
  9429. 'args': ['#personalInfo.birthPlace']
  9430. },
  9431. {
  9432. 'tokenType': 'chars',
  9433. 'args': ['\n ']
  9434. },
  9435. {
  9436. 'tokenType': 'start',
  9437. 'args': [
  9438. 'div',
  9439. false
  9440. ]
  9441. },
  9442. {
  9443. 'tokenType': 'attrStart',
  9444. 'args': ['class']
  9445. },
  9446. {
  9447. 'tokenType': 'attrValue',
  9448. 'args': ['birthplace']
  9449. },
  9450. {
  9451. 'tokenType': 'attrEnd',
  9452. 'args': ['class']
  9453. },
  9454. {
  9455. 'tokenType': 'end',
  9456. 'args': [
  9457. 'div',
  9458. false
  9459. ]
  9460. },
  9461. {
  9462. 'tokenType': 'chars',
  9463. 'args': ['\n ']
  9464. },
  9465. {
  9466. 'tokenType': 'start',
  9467. 'args': [
  9468. 'div',
  9469. false
  9470. ]
  9471. },
  9472. {
  9473. 'tokenType': 'attrStart',
  9474. 'args': ['class']
  9475. },
  9476. {
  9477. 'tokenType': 'attrValue',
  9478. 'args': ['birth-place-data']
  9479. },
  9480. {
  9481. 'tokenType': 'attrEnd',
  9482. 'args': ['class']
  9483. },
  9484. {
  9485. 'tokenType': 'end',
  9486. 'args': [
  9487. 'div',
  9488. false
  9489. ]
  9490. },
  9491. {
  9492. 'tokenType': 'special',
  9493. 'args': ['personalInfo.birthPlace']
  9494. },
  9495. {
  9496. 'tokenType': 'close',
  9497. 'args': ['div']
  9498. },
  9499. {
  9500. 'tokenType': 'chars',
  9501. 'args': ['\n ']
  9502. },
  9503. {
  9504. 'tokenType': 'start',
  9505. 'args': [
  9506. 'div',
  9507. false
  9508. ]
  9509. },
  9510. {
  9511. 'tokenType': 'attrStart',
  9512. 'args': ['class']
  9513. },
  9514. {
  9515. 'tokenType': 'attrValue',
  9516. 'args': ['birth-place-title']
  9517. },
  9518. {
  9519. 'tokenType': 'attrEnd',
  9520. 'args': ['class']
  9521. },
  9522. {
  9523. 'tokenType': 'end',
  9524. 'args': [
  9525. 'div',
  9526. false
  9527. ]
  9528. },
  9529. {
  9530. 'tokenType': 'chars',
  9531. 'args': ['birthplace']
  9532. },
  9533. {
  9534. 'tokenType': 'close',
  9535. 'args': ['div']
  9536. },
  9537. {
  9538. 'tokenType': 'chars',
  9539. 'args': ['\n ']
  9540. },
  9541. {
  9542. 'tokenType': 'close',
  9543. 'args': ['div']
  9544. },
  9545. {
  9546. 'tokenType': 'special',
  9547. 'args': ['/personalInfo.birthPlace']
  9548. },
  9549. {
  9550. 'tokenType': 'chars',
  9551. 'args': ['\n ']
  9552. },
  9553. {
  9554. 'tokenType': 'close',
  9555. 'args': ['div']
  9556. },
  9557. {
  9558. 'tokenType': 'chars',
  9559. 'args': ['\n ']
  9560. },
  9561. {
  9562. 'tokenType': 'close',
  9563. 'args': ['div']
  9564. },
  9565. {
  9566. 'tokenType': 'chars',
  9567. 'args': ['\n ']
  9568. },
  9569. {
  9570. 'tokenType': 'close',
  9571. 'args': ['div']
  9572. },
  9573. {
  9574. 'tokenType': 'chars',
  9575. 'args': ['\n ']
  9576. },
  9577. {
  9578. 'tokenType': 'start',
  9579. 'args': [
  9580. 'div',
  9581. false
  9582. ]
  9583. },
  9584. {
  9585. 'tokenType': 'attrStart',
  9586. 'args': ['class']
  9587. },
  9588. {
  9589. 'tokenType': 'attrValue',
  9590. 'args': ['box-right']
  9591. },
  9592. {
  9593. 'tokenType': 'attrEnd',
  9594. 'args': ['class']
  9595. },
  9596. {
  9597. 'tokenType': 'end',
  9598. 'args': [
  9599. 'div',
  9600. false
  9601. ]
  9602. },
  9603. {
  9604. 'tokenType': 'chars',
  9605. 'args': ['\n ']
  9606. },
  9607. {
  9608. 'tokenType': 'start',
  9609. 'args': [
  9610. 'div',
  9611. false
  9612. ]
  9613. },
  9614. {
  9615. 'tokenType': 'attrStart',
  9616. 'args': ['class']
  9617. },
  9618. {
  9619. 'tokenType': 'attrValue',
  9620. 'args': ['box-left-upper']
  9621. },
  9622. {
  9623. 'tokenType': 'attrEnd',
  9624. 'args': ['class']
  9625. },
  9626. {
  9627. 'tokenType': 'end',
  9628. 'args': [
  9629. 'div',
  9630. false
  9631. ]
  9632. },
  9633. {
  9634. 'tokenType': 'chars',
  9635. 'args': ['\n ']
  9636. },
  9637. {
  9638. 'tokenType': 'start',
  9639. 'args': [
  9640. 'div',
  9641. false
  9642. ]
  9643. },
  9644. {
  9645. 'tokenType': 'attrStart',
  9646. 'args': ['class']
  9647. },
  9648. {
  9649. 'tokenType': 'attrValue',
  9650. 'args': ['fedexcup-rank']
  9651. },
  9652. {
  9653. 'tokenType': 'attrEnd',
  9654. 'args': ['class']
  9655. },
  9656. {
  9657. 'tokenType': 'end',
  9658. 'args': [
  9659. 'div',
  9660. false
  9661. ]
  9662. },
  9663. {
  9664. 'tokenType': 'special',
  9665. 'args': ['personalResults.rank']
  9666. },
  9667. {
  9668. 'tokenType': 'close',
  9669. 'args': ['div']
  9670. },
  9671. {
  9672. 'tokenType': 'chars',
  9673. 'args': ['\n ']
  9674. },
  9675. {
  9676. 'tokenType': 'start',
  9677. 'args': [
  9678. 'div',
  9679. false
  9680. ]
  9681. },
  9682. {
  9683. 'tokenType': 'attrStart',
  9684. 'args': ['class']
  9685. },
  9686. {
  9687. 'tokenType': 'attrValue',
  9688. 'args': ['title']
  9689. },
  9690. {
  9691. 'tokenType': 'attrEnd',
  9692. 'args': ['class']
  9693. },
  9694. {
  9695. 'tokenType': 'end',
  9696. 'args': [
  9697. 'div',
  9698. false
  9699. ]
  9700. },
  9701. {
  9702. 'tokenType': 'special',
  9703. 'args': ['personalResults.rankTitle']
  9704. },
  9705. {
  9706. 'tokenType': 'close',
  9707. 'args': ['div']
  9708. },
  9709. {
  9710. 'tokenType': 'chars',
  9711. 'args': ['\n ']
  9712. },
  9713. {
  9714. 'tokenType': 'close',
  9715. 'args': ['div']
  9716. },
  9717. {
  9718. 'tokenType': 'chars',
  9719. 'args': ['\n ']
  9720. },
  9721. {
  9722. 'tokenType': 'start',
  9723. 'args': [
  9724. 'div',
  9725. false
  9726. ]
  9727. },
  9728. {
  9729. 'tokenType': 'attrStart',
  9730. 'args': ['class']
  9731. },
  9732. {
  9733. 'tokenType': 'attrValue',
  9734. 'args': ['box-right-upper']
  9735. },
  9736. {
  9737. 'tokenType': 'attrEnd',
  9738. 'args': ['class']
  9739. },
  9740. {
  9741. 'tokenType': 'end',
  9742. 'args': [
  9743. 'div',
  9744. false
  9745. ]
  9746. },
  9747. {
  9748. 'tokenType': 'chars',
  9749. 'args': ['\n ']
  9750. },
  9751. {
  9752. 'tokenType': 'start',
  9753. 'args': [
  9754. 'div',
  9755. false
  9756. ]
  9757. },
  9758. {
  9759. 'tokenType': 'attrStart',
  9760. 'args': ['class']
  9761. },
  9762. {
  9763. 'tokenType': 'attrValue',
  9764. 'args': ['fedexcup-points']
  9765. },
  9766. {
  9767. 'tokenType': 'attrEnd',
  9768. 'args': ['class']
  9769. },
  9770. {
  9771. 'tokenType': 'end',
  9772. 'args': [
  9773. 'div',
  9774. false
  9775. ]
  9776. },
  9777. {
  9778. 'tokenType': 'special',
  9779. 'args': ['personalResults.points']
  9780. },
  9781. {
  9782. 'tokenType': 'close',
  9783. 'args': ['div']
  9784. },
  9785. {
  9786. 'tokenType': 'chars',
  9787. 'args': ['\n ']
  9788. },
  9789. {
  9790. 'tokenType': 'start',
  9791. 'args': [
  9792. 'div',
  9793. false
  9794. ]
  9795. },
  9796. {
  9797. 'tokenType': 'attrStart',
  9798. 'args': ['class']
  9799. },
  9800. {
  9801. 'tokenType': 'attrValue',
  9802. 'args': ['title']
  9803. },
  9804. {
  9805. 'tokenType': 'attrEnd',
  9806. 'args': ['class']
  9807. },
  9808. {
  9809. 'tokenType': 'end',
  9810. 'args': [
  9811. 'div',
  9812. false
  9813. ]
  9814. },
  9815. {
  9816. 'tokenType': 'special',
  9817. 'args': ['personalResults.pointsTitle']
  9818. },
  9819. {
  9820. 'tokenType': 'close',
  9821. 'args': ['div']
  9822. },
  9823. {
  9824. 'tokenType': 'chars',
  9825. 'args': ['\n ']
  9826. },
  9827. {
  9828. 'tokenType': 'close',
  9829. 'args': ['div']
  9830. },
  9831. {
  9832. 'tokenType': 'chars',
  9833. 'args': ['\n ']
  9834. },
  9835. {
  9836. 'tokenType': 'start',
  9837. 'args': [
  9838. 'div',
  9839. false
  9840. ]
  9841. },
  9842. {
  9843. 'tokenType': 'attrStart',
  9844. 'args': ['class']
  9845. },
  9846. {
  9847. 'tokenType': 'attrValue',
  9848. 'args': ['box-left-lower']
  9849. },
  9850. {
  9851. 'tokenType': 'attrEnd',
  9852. 'args': ['class']
  9853. },
  9854. {
  9855. 'tokenType': 'end',
  9856. 'args': [
  9857. 'div',
  9858. false
  9859. ]
  9860. },
  9861. {
  9862. 'tokenType': 'chars',
  9863. 'args': ['\n ']
  9864. },
  9865. {
  9866. 'tokenType': 'start',
  9867. 'args': [
  9868. 'div',
  9869. false
  9870. ]
  9871. },
  9872. {
  9873. 'tokenType': 'attrStart',
  9874. 'args': ['class']
  9875. },
  9876. {
  9877. 'tokenType': 'attrValue',
  9878. 'args': ['owg-rank']
  9879. },
  9880. {
  9881. 'tokenType': 'attrEnd',
  9882. 'args': ['class']
  9883. },
  9884. {
  9885. 'tokenType': 'end',
  9886. 'args': [
  9887. 'div',
  9888. false
  9889. ]
  9890. },
  9891. {
  9892. 'tokenType': 'special',
  9893. 'args': ['personalStat186.owgRank']
  9894. },
  9895. {
  9896. 'tokenType': 'close',
  9897. 'args': ['div']
  9898. },
  9899. {
  9900. 'tokenType': 'chars',
  9901. 'args': ['\n ']
  9902. },
  9903. {
  9904. 'tokenType': 'start',
  9905. 'args': [
  9906. 'div',
  9907. false
  9908. ]
  9909. },
  9910. {
  9911. 'tokenType': 'attrStart',
  9912. 'args': ['class']
  9913. },
  9914. {
  9915. 'tokenType': 'attrValue',
  9916. 'args': ['title']
  9917. },
  9918. {
  9919. 'tokenType': 'attrEnd',
  9920. 'args': ['class']
  9921. },
  9922. {
  9923. 'tokenType': 'end',
  9924. 'args': [
  9925. 'div',
  9926. false
  9927. ]
  9928. },
  9929. {
  9930. 'tokenType': 'chars',
  9931. 'args': ['owg rank']
  9932. },
  9933. {
  9934. 'tokenType': 'close',
  9935. 'args': ['div']
  9936. },
  9937. {
  9938. 'tokenType': 'chars',
  9939. 'args': ['\n ']
  9940. },
  9941. {
  9942. 'tokenType': 'close',
  9943. 'args': ['div']
  9944. },
  9945. {
  9946. 'tokenType': 'chars',
  9947. 'args': ['\n ']
  9948. },
  9949. {
  9950. 'tokenType': 'start',
  9951. 'args': [
  9952. 'div',
  9953. false
  9954. ]
  9955. },
  9956. {
  9957. 'tokenType': 'attrStart',
  9958. 'args': ['class']
  9959. },
  9960. {
  9961. 'tokenType': 'attrValue',
  9962. 'args': ['box-right-lower']
  9963. },
  9964. {
  9965. 'tokenType': 'attrEnd',
  9966. 'args': ['class']
  9967. },
  9968. {
  9969. 'tokenType': 'end',
  9970. 'args': [
  9971. 'div',
  9972. false
  9973. ]
  9974. },
  9975. {
  9976. 'tokenType': 'chars',
  9977. 'args': ['\n ']
  9978. },
  9979. {
  9980. 'tokenType': 'start',
  9981. 'args': [
  9982. 'div',
  9983. false
  9984. ]
  9985. },
  9986. {
  9987. 'tokenType': 'attrStart',
  9988. 'args': ['class']
  9989. },
  9990. {
  9991. 'tokenType': 'attrValue',
  9992. 'args': ['driving-distance']
  9993. },
  9994. {
  9995. 'tokenType': 'attrEnd',
  9996. 'args': ['class']
  9997. },
  9998. {
  9999. 'tokenType': 'end',
  10000. 'args': [
  10001. 'div',
  10002. false
  10003. ]
  10004. },
  10005. {
  10006. 'tokenType': 'special',
  10007. 'args': ['personalStats.scoringAverage']
  10008. },
  10009. {
  10010. 'tokenType': 'close',
  10011. 'args': ['div']
  10012. },
  10013. {
  10014. 'tokenType': 'chars',
  10015. 'args': ['\n ']
  10016. },
  10017. {
  10018. 'tokenType': 'start',
  10019. 'args': [
  10020. 'div',
  10021. false
  10022. ]
  10023. },
  10024. {
  10025. 'tokenType': 'attrStart',
  10026. 'args': ['class']
  10027. },
  10028. {
  10029. 'tokenType': 'attrValue',
  10030. 'args': ['title']
  10031. },
  10032. {
  10033. 'tokenType': 'attrEnd',
  10034. 'args': ['class']
  10035. },
  10036. {
  10037. 'tokenType': 'end',
  10038. 'args': [
  10039. 'div',
  10040. false
  10041. ]
  10042. },
  10043. {
  10044. 'tokenType': 'chars',
  10045. 'args': ['scoring average']
  10046. },
  10047. {
  10048. 'tokenType': 'close',
  10049. 'args': ['div']
  10050. },
  10051. {
  10052. 'tokenType': 'chars',
  10053. 'args': ['\n ']
  10054. },
  10055. {
  10056. 'tokenType': 'close',
  10057. 'args': ['div']
  10058. },
  10059. {
  10060. 'tokenType': 'chars',
  10061. 'args': ['\n ']
  10062. },
  10063. {
  10064. 'tokenType': 'close',
  10065. 'args': ['div']
  10066. },
  10067. {
  10068. 'tokenType': 'chars',
  10069. 'args': ['\n ']
  10070. },
  10071. {
  10072. 'tokenType': 'close',
  10073. 'args': ['div']
  10074. },
  10075. {
  10076. 'tokenType': 'chars',
  10077. 'args': ['\n ']
  10078. },
  10079. {
  10080. 'tokenType': 'start',
  10081. 'args': [
  10082. 'div',
  10083. false
  10084. ]
  10085. },
  10086. {
  10087. 'tokenType': 'attrStart',
  10088. 'args': ['class']
  10089. },
  10090. {
  10091. 'tokenType': 'attrValue',
  10092. 'args': ['player-bio-ad']
  10093. },
  10094. {
  10095. 'tokenType': 'attrEnd',
  10096. 'args': ['class']
  10097. },
  10098. {
  10099. 'tokenType': 'end',
  10100. 'args': [
  10101. 'div',
  10102. false
  10103. ]
  10104. },
  10105. {
  10106. 'tokenType': 'chars',
  10107. 'args': ['\n ']
  10108. },
  10109. {
  10110. 'tokenType': 'start',
  10111. 'args': [
  10112. 'pga-player-bio-ad',
  10113. true
  10114. ]
  10115. },
  10116. {
  10117. 'tokenType': 'end',
  10118. 'args': [
  10119. 'pga-player-bio-ad',
  10120. true
  10121. ]
  10122. },
  10123. {
  10124. 'tokenType': 'chars',
  10125. 'args': ['\n ']
  10126. },
  10127. {
  10128. 'tokenType': 'close',
  10129. 'args': ['div']
  10130. },
  10131. {
  10132. 'tokenType': 'chars',
  10133. 'args': ['\n']
  10134. },
  10135. {
  10136. 'tokenType': 'close',
  10137. 'args': ['div']
  10138. },
  10139. {
  10140. 'tokenType': 'chars',
  10141. 'args': ['\n']
  10142. },
  10143. {
  10144. 'tokenType': 'done',
  10145. 'args': []
  10146. }
  10147. ]);
  10148. return function (scope, options, nodeList) {
  10149. var moduleOptions = { module: module };
  10150. if (!(options instanceof mustacheCore.Options)) {
  10151. options = new mustacheCore.Options(options || {});
  10152. }
  10153. return renderer(scope, options.add(moduleOptions), nodeList);
  10154. };
  10155. });
  10156. /*when@3.7.7#es6-shim/Promise*/
  10157. define('when@3.7.7#es6-shim/Promise', [
  10158. 'module',
  10159. '@loader'
  10160. ], function (module, loader) {
  10161. loader.get('@@global-helpers').prepareGlobal(module.id, []);
  10162. var define = loader.global.define;
  10163. var require = loader.global.require;
  10164. var source = '!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.Promise=e():"undefined"!=typeof global?global.Promise=e():"undefined"!=typeof self&&(self.Promise=e())}(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);throw new Error("Cannot find module \'"+o+"\'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.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){\n/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/**\n * ES6 global Promise shim\n */\nvar unhandledRejections = require(\'../lib/decorators/unhandledRejection\');\nvar PromiseConstructor = unhandledRejections(require(\'../lib/Promise\'));\n\nmodule.exports = typeof global != \'undefined\' ? (global.Promise = PromiseConstructor)\n\t : typeof self != \'undefined\' ? (self.Promise = PromiseConstructor)\n\t : PromiseConstructor;\n\n},{"../lib/Promise":2,"../lib/decorators/unhandledRejection":4}],2:[function(require,module,exports){\n/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { \'use strict\';\ndefine(function (require) {\n\n\tvar makePromise = require(\'./makePromise\');\n\tvar Scheduler = require(\'./Scheduler\');\n\tvar async = require(\'./env\').asap;\n\n\treturn makePromise({\n\t\tscheduler: new Scheduler(async)\n\t});\n\n});\n})(typeof define === \'function\' && define.amd ? define : function (factory) { module.exports = factory(require); });\n\n},{"./Scheduler":3,"./env":5,"./makePromise":7}],3:[function(require,module,exports){\n/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { \'use strict\';\ndefine(function() {\n\n\t// Credit to Twisol (https://github.com/Twisol) for suggesting\n\t// this type of extensible queue + trampoline approach for next-tick conflation.\n\n\t/**\n\t * Async task scheduler\n\t * @param {function} async function to schedule a single async function\n\t * @constructor\n\t */\n\tfunction Scheduler(async) {\n\t\tthis._async = async;\n\t\tthis._running = false;\n\n\t\tthis._queue = this;\n\t\tthis._queueLen = 0;\n\t\tthis._afterQueue = {};\n\t\tthis._afterQueueLen = 0;\n\n\t\tvar self = this;\n\t\tthis.drain = function() {\n\t\t\tself._drain();\n\t\t};\n\t}\n\n\t/**\n\t * Enqueue a task\n\t * @param {{ run:function }} task\n\t */\n\tScheduler.prototype.enqueue = function(task) {\n\t\tthis._queue[this._queueLen++] = task;\n\t\tthis.run();\n\t};\n\n\t/**\n\t * Enqueue a task to run after the main task queue\n\t * @param {{ run:function }} task\n\t */\n\tScheduler.prototype.afterQueue = function(task) {\n\t\tthis._afterQueue[this._afterQueueLen++] = task;\n\t\tthis.run();\n\t};\n\n\tScheduler.prototype.run = function() {\n\t\tif (!this._running) {\n\t\t\tthis._running = true;\n\t\t\tthis._async(this.drain);\n\t\t}\n\t};\n\n\t/**\n\t * Drain the handler queue entirely, and then the after queue\n\t */\n\tScheduler.prototype._drain = function() {\n\t\tvar i = 0;\n\t\tfor (; i < this._queueLen; ++i) {\n\t\t\tthis._queue[i].run();\n\t\t\tthis._queue[i] = void 0;\n\t\t}\n\n\t\tthis._queueLen = 0;\n\t\tthis._running = false;\n\n\t\tfor (i = 0; i < this._afterQueueLen; ++i) {\n\t\t\tthis._afterQueue[i].run();\n\t\t\tthis._afterQueue[i] = void 0;\n\t\t}\n\n\t\tthis._afterQueueLen = 0;\n\t};\n\n\treturn Scheduler;\n\n});\n}(typeof define === \'function\' && define.amd ? define : function(factory) { module.exports = factory(); }));\n\n},{}],4:[function(require,module,exports){\n/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { \'use strict\';\ndefine(function(require) {\n\n\tvar setTimer = require(\'../env\').setTimer;\n\tvar format = require(\'../format\');\n\n\treturn function unhandledRejection(Promise) {\n\n\t\tvar logError = noop;\n\t\tvar logInfo = noop;\n\t\tvar localConsole;\n\n\t\tif(typeof console !== \'undefined\') {\n\t\t\t// Alias console to prevent things like uglify\'s drop_console option from\n\t\t\t// removing console.log/error. Unhandled rejections fall into the same\n\t\t\t// category as uncaught exceptions, and build tools shouldn\'t silence them.\n\t\t\tlocalConsole = console;\n\t\t\tlogError = typeof localConsole.error !== \'undefined\'\n\t\t\t\t? function (e) { localConsole.error(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\n\t\t\tlogInfo = typeof localConsole.info !== \'undefined\'\n\t\t\t\t? function (e) { localConsole.info(e); }\n\t\t\t\t: function (e) { localConsole.log(e); };\n\t\t}\n\n\t\tPromise.onPotentiallyUnhandledRejection = function(rejection) {\n\t\t\tenqueue(report, rejection);\n\t\t};\n\n\t\tPromise.onPotentiallyUnhandledRejectionHandled = function(rejection) {\n\t\t\tenqueue(unreport, rejection);\n\t\t};\n\n\t\tPromise.onFatalRejection = function(rejection) {\n\t\t\tenqueue(throwit, rejection.value);\n\t\t};\n\n\t\tvar tasks = [];\n\t\tvar reported = [];\n\t\tvar running = null;\n\n\t\tfunction report(r) {\n\t\t\tif(!r.handled) {\n\t\t\t\treported.push(r);\n\t\t\t\tlogError(\'Potentially unhandled rejection [\' + r.id + \'] \' + format.formatError(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction unreport(r) {\n\t\t\tvar i = reported.indexOf(r);\n\t\t\tif(i >= 0) {\n\t\t\t\treported.splice(i, 1);\n\t\t\t\tlogInfo(\'Handled previous rejection [\' + r.id + \'] \' + format.formatObject(r.value));\n\t\t\t}\n\t\t}\n\n\t\tfunction enqueue(f, x) {\n\t\t\ttasks.push(f, x);\n\t\t\tif(running === null) {\n\t\t\t\trunning = setTimer(flush, 0);\n\t\t\t}\n\t\t}\n\n\t\tfunction flush() {\n\t\t\trunning = null;\n\t\t\twhile(tasks.length > 0) {\n\t\t\t\ttasks.shift()(tasks.shift());\n\t\t\t}\n\t\t}\n\n\t\treturn Promise;\n\t};\n\n\tfunction throwit(e) {\n\t\tthrow e;\n\t}\n\n\tfunction noop() {}\n\n});\n}(typeof define === \'function\' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n\n},{"../env":5,"../format":6}],5:[function(require,module,exports){\n/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n/*global process,document,setTimeout,clearTimeout,MutationObserver,WebKitMutationObserver*/\n(function(define) { \'use strict\';\ndefine(function(require) {\n\t/*jshint maxcomplexity:6*/\n\n\t// Sniff "best" async scheduling option\n\t// Prefer process.nextTick or MutationObserver, then check for\n\t// setTimeout, and finally vertx, since its the only env that doesn\'t\n\t// have setTimeout\n\n\tvar MutationObs;\n\tvar capturedSetTimeout = typeof setTimeout !== \'undefined\' && setTimeout;\n\n\t// Default env\n\tvar setTimer = function(f, ms) { return setTimeout(f, ms); };\n\tvar clearTimer = function(t) { return clearTimeout(t); };\n\tvar asap = function (f) { return capturedSetTimeout(f, 0); };\n\n\t// Detect specific env\n\tif (isNode()) { // Node\n\t\tasap = function (f) { return process.nextTick(f); };\n\n\t} else if (MutationObs = hasMutationObserver()) { // Modern browser\n\t\tasap = initMutationObserver(MutationObs);\n\n\t} else if (!capturedSetTimeout) { // vert.x\n\t\tvar vertxRequire = require;\n\t\tvar vertx = vertxRequire(\'vertx\');\n\t\tsetTimer = function (f, ms) { return vertx.setTimer(ms, f); };\n\t\tclearTimer = vertx.cancelTimer;\n\t\tasap = vertx.runOnLoop || vertx.runOnContext;\n\t}\n\n\treturn {\n\t\tsetTimer: setTimer,\n\t\tclearTimer: clearTimer,\n\t\tasap: asap\n\t};\n\n\tfunction isNode () {\n\t\treturn typeof process !== \'undefined\' &&\n\t\t\tObject.prototype.toString.call(process) === \'[object process]\';\n\t}\n\n\tfunction hasMutationObserver () {\n\t\treturn (typeof MutationObserver === \'function\' && MutationObserver) ||\n\t\t\t(typeof WebKitMutationObserver === \'function\' && WebKitMutationObserver);\n\t}\n\n\tfunction initMutationObserver(MutationObserver) {\n\t\tvar scheduled;\n\t\tvar node = document.createTextNode(\'\');\n\t\tvar o = new MutationObserver(run);\n\t\to.observe(node, { characterData: true });\n\n\t\tfunction run() {\n\t\t\tvar f = scheduled;\n\t\t\tscheduled = void 0;\n\t\t\tf();\n\t\t}\n\n\t\tvar i = 0;\n\t\treturn function (f) {\n\t\t\tscheduled = f;\n\t\t\tnode.data = (i ^= 1);\n\t\t};\n\t}\n});\n}(typeof define === \'function\' && define.amd ? define : function(factory) { module.exports = factory(require); }));\n\n},{}],6:[function(require,module,exports){\n/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { \'use strict\';\ndefine(function() {\n\n\treturn {\n\t\tformatError: formatError,\n\t\tformatObject: formatObject,\n\t\ttryStringify: tryStringify\n\t};\n\n\t/**\n\t * Format an error into a string. If e is an Error and has a stack property,\n\t * it\'s returned. Otherwise, e is formatted using formatObject, with a\n\t * warning added about e not being a proper Error.\n\t * @param {*} e\n\t * @returns {String} formatted string, suitable for output to developers\n\t */\n\tfunction formatError(e) {\n\t\tvar s = typeof e === \'object\' && e !== null && (e.stack || e.message) ? e.stack || e.message : formatObject(e);\n\t\treturn e instanceof Error ? s : s + \' (WARNING: non-Error used)\';\n\t}\n\n\t/**\n\t * Format an object, detecting "plain" objects and running them through\n\t * JSON.stringify if possible.\n\t * @param {Object} o\n\t * @returns {string}\n\t */\n\tfunction formatObject(o) {\n\t\tvar s = String(o);\n\t\tif(s === \'[object Object]\' && typeof JSON !== \'undefined\') {\n\t\t\ts = tryStringify(o, s);\n\t\t}\n\t\treturn s;\n\t}\n\n\t/**\n\t * Try to return the result of JSON.stringify(x). If that fails, return\n\t * defaultValue\n\t * @param {*} x\n\t * @param {*} defaultValue\n\t * @returns {String|*} JSON.stringify(x) or defaultValue\n\t */\n\tfunction tryStringify(x, defaultValue) {\n\t\ttry {\n\t\t\treturn JSON.stringify(x);\n\t\t} catch(e) {\n\t\t\treturn defaultValue;\n\t\t}\n\t}\n\n});\n}(typeof define === \'function\' && define.amd ? define : function(factory) { module.exports = factory(); }));\n\n},{}],7:[function(require,module,exports){\n/** @license MIT License (c) copyright 2010-2014 original author or authors */\n/** @author Brian Cavalier */\n/** @author John Hann */\n\n(function(define) { \'use strict\';\ndefine(function() {\n\n\treturn function makePromise(environment) {\n\n\t\tvar tasks = environment.scheduler;\n\t\tvar emitRejection = initEmitRejection();\n\n\t\tvar objectCreate = Object.create ||\n\t\t\tfunction(proto) {\n\t\t\t\tfunction Child() {}\n\t\t\t\tChild.prototype = proto;\n\t\t\t\treturn new Child();\n\t\t\t};\n\n\t\t/**\n\t\t * Create a promise whose fate is determined by resolver\n\t\t * @constructor\n\t\t * @returns {Promise} promise\n\t\t * @name Promise\n\t\t */\n\t\tfunction Promise(resolver, handler) {\n\t\t\tthis._handler = resolver === Handler ? handler : init(resolver);\n\t\t}\n\n\t\t/**\n\t\t * Run the supplied resolver\n\t\t * @param resolver\n\t\t * @returns {Pending}\n\t\t */\n\t\tfunction init(resolver) {\n\t\t\tvar handler = new Pending();\n\n\t\t\ttry {\n\t\t\t\tresolver(promiseResolve, promiseReject, promiseNotify);\n\t\t\t} catch (e) {\n\t\t\t\tpromiseReject(e);\n\t\t\t}\n\n\t\t\treturn handler;\n\n\t\t\t/**\n\t\t\t * Transition from pre-resolution state to post-resolution state, notifying\n\t\t\t * all listeners of the ultimate fulfillment or rejection\n\t\t\t * @param {*} x resolution value\n\t\t\t */\n\t\t\tfunction promiseResolve (x) {\n\t\t\t\thandler.resolve(x);\n\t\t\t}\n\t\t\t/**\n\t\t\t * Reject this promise with reason, which will be used verbatim\n\t\t\t * @param {Error|*} reason rejection reason, strongly suggested\n\t\t\t * to be an Error type\n\t\t\t */\n\t\t\tfunction promiseReject (reason) {\n\t\t\t\thandler.reject(reason);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @deprecated\n\t\t\t * Issue a progress event, notifying all progress listeners\n\t\t\t * @param {*} x progress event payload to pass to all listeners\n\t\t\t */\n\t\t\tfunction promiseNotify (x) {\n\t\t\t\thandler.notify(x);\n\t\t\t}\n\t\t}\n\n\t\t// Creation\n\n\t\tPromise.resolve = resolve;\n\t\tPromise.reject = reject;\n\t\tPromise.never = never;\n\n\t\tPromise._defer = defer;\n\t\tPromise._handler = getHandler;\n\n\t\t/**\n\t\t * Returns a trusted promise. If x is already a trusted promise, it is\n\t\t * returned, otherwise returns a new trusted Promise which follows x.\n\t\t * @param {*} x\n\t\t * @return {Promise} promise\n\t\t */\n\t\tfunction resolve(x) {\n\t\t\treturn isPromise(x) ? x\n\t\t\t\t: new Promise(Handler, new Async(getHandler(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a reject promise with x as its reason (x is used verbatim)\n\t\t * @param {*} x\n\t\t * @returns {Promise} rejected promise\n\t\t */\n\t\tfunction reject(x) {\n\t\t\treturn new Promise(Handler, new Async(new Rejected(x)));\n\t\t}\n\n\t\t/**\n\t\t * Return a promise that remains pending forever\n\t\t * @returns {Promise} forever-pending promise.\n\t\t */\n\t\tfunction never() {\n\t\t\treturn foreverPendingPromise; // Should be frozen\n\t\t}\n\n\t\t/**\n\t\t * Creates an internal {promise, resolver} pair\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tfunction defer() {\n\t\t\treturn new Promise(Handler, new Pending());\n\t\t}\n\n\t\t// Transformation and flow control\n\n\t\t/**\n\t\t * Transform this promise\'s fulfillment value, returning a new Promise\n\t\t * for the transformed result. If the promise cannot be fulfilled, onRejected\n\t\t * is called with the reason. onProgress *may* be called with updates toward\n\t\t * this promise\'s fulfillment.\n\t\t * @param {function=} onFulfilled fulfillment handler\n\t\t * @param {function=} onRejected rejection handler\n\t\t * @param {function=} onProgress @deprecated progress handler\n\t\t * @return {Promise} new promise\n\t\t */\n\t\tPromise.prototype.then = function(onFulfilled, onRejected, onProgress) {\n\t\t\tvar parent = this._handler;\n\t\t\tvar state = parent.join().state();\n\n\t\t\tif ((typeof onFulfilled !== \'function\' && state > 0) ||\n\t\t\t\t(typeof onRejected !== \'function\' && state < 0)) {\n\t\t\t\t// Short circuit: value will not change, simply share handler\n\t\t\t\treturn new this.constructor(Handler, parent);\n\t\t\t}\n\n\t\t\tvar p = this._beget();\n\t\t\tvar child = p._handler;\n\n\t\t\tparent.chain(child, parent.receiver, onFulfilled, onRejected, onProgress);\n\n\t\t\treturn p;\n\t\t};\n\n\t\t/**\n\t\t * If this promise cannot be fulfilled due to an error, call onRejected to\n\t\t * handle the error. Shortcut for .then(undefined, onRejected)\n\t\t * @param {function?} onRejected\n\t\t * @return {Promise}\n\t\t */\n\t\tPromise.prototype[\'catch\'] = function(onRejected) {\n\t\t\treturn this.then(void 0, onRejected);\n\t\t};\n\n\t\t/**\n\t\t * Creates a new, pending promise of the same type as this promise\n\t\t * @private\n\t\t * @returns {Promise}\n\t\t */\n\t\tPromise.prototype._beget = function() {\n\t\t\treturn begetFrom(this._handler, this.constructor);\n\t\t};\n\n\t\tfunction begetFrom(parent, Promise) {\n\t\t\tvar child = new Pending(parent.receiver, parent.join().context);\n\t\t\treturn new Promise(Handler, child);\n\t\t}\n\n\t\t// Array combinators\n\n\t\tPromise.all = all;\n\t\tPromise.race = race;\n\t\tPromise._traverse = traverse;\n\n\t\t/**\n\t\t * Return a promise that will fulfill when all promises in the\n\t\t * input array have fulfilled, or will reject when one of the\n\t\t * promises rejects.\n\t\t * @param {array} promises array of promises\n\t\t * @returns {Promise} promise for array of fulfillment values\n\t\t */\n\t\tfunction all(promises) {\n\t\t\treturn traverseWith(snd, null, promises);\n\t\t}\n\n\t\t/**\n\t\t * Array<Promise<X>> -> Promise<Array<f(X)>>\n\t\t * @private\n\t\t * @param {function} f function to apply to each promise\'s value\n\t\t * @param {Array} promises array of promises\n\t\t * @returns {Promise} promise for transformed values\n\t\t */\n\t\tfunction traverse(f, promises) {\n\t\t\treturn traverseWith(tryCatch2, f, promises);\n\t\t}\n\n\t\tfunction traverseWith(tryMap, f, promises) {\n\t\t\tvar handler = typeof f === \'function\' ? mapAt : settleAt;\n\n\t\t\tvar resolver = new Pending();\n\t\t\tvar pending = promises.length >>> 0;\n\t\t\tvar results = new Array(pending);\n\n\t\t\tfor (var i = 0, x; i < promises.length && !resolver.resolved; ++i) {\n\t\t\t\tx = promises[i];\n\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\t--pending;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\ttraverseAt(promises, handler, i, x, resolver);\n\t\t\t}\n\n\t\t\tif(pending === 0) {\n\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t}\n\n\t\t\treturn new Promise(Handler, resolver);\n\n\t\t\tfunction mapAt(i, x, resolver) {\n\t\t\t\tif(!resolver.resolved) {\n\t\t\t\t\ttraverseAt(promises, settleAt, i, tryMap(f, x, i), resolver);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction settleAt(i, x, resolver) {\n\t\t\t\tresults[i] = x;\n\t\t\t\tif(--pending === 0) {\n\t\t\t\t\tresolver.become(new Fulfilled(results));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction traverseAt(promises, handler, i, x, resolver) {\n\t\t\tif (maybeThenable(x)) {\n\t\t\t\tvar h = getHandlerMaybeThenable(x);\n\t\t\t\tvar s = h.state();\n\n\t\t\t\tif (s === 0) {\n\t\t\t\t\th.fold(handler, i, void 0, resolver);\n\t\t\t\t} else if (s > 0) {\n\t\t\t\t\thandler(i, h.value, resolver);\n\t\t\t\t} else {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\thandler(i, x, resolver);\n\t\t\t}\n\t\t}\n\n\t\tPromise._visitRemaining = visitRemaining;\n\t\tfunction visitRemaining(promises, start, handler) {\n\t\t\tfor(var i=start; i<promises.length; ++i) {\n\t\t\t\tmarkAsHandled(getHandler(promises[i]), handler);\n\t\t\t}\n\t\t}\n\n\t\tfunction markAsHandled(h, handler) {\n\t\t\tif(h === handler) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar s = h.state();\n\t\t\tif(s === 0) {\n\t\t\t\th.visit(h, void 0, h._unreport);\n\t\t\t} else if(s < 0) {\n\t\t\t\th._unreport();\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Fulfill-reject competitive race. Return a promise that will settle\n\t\t * to the same state as the earliest input promise to settle.\n\t\t *\n\t\t * WARNING: The ES6 Promise spec requires that race()ing an empty array\n\t\t * must return a promise that is pending forever. This implementation\n\t\t * returns a singleton forever-pending promise, the same singleton that is\n\t\t * returned by Promise.never(), thus can be checked with ===\n\t\t *\n\t\t * @param {array} promises array of promises to race\n\t\t * @returns {Promise} if input is non-empty, a promise that will settle\n\t\t * to the same outcome as the earliest input promise to settle. if empty\n\t\t * is empty, returns a promise that will never settle.\n\t\t */\n\t\tfunction race(promises) {\n\t\t\tif(typeof promises !== \'object\' || promises === null) {\n\t\t\t\treturn reject(new TypeError(\'non-iterable passed to race()\'));\n\t\t\t}\n\n\t\t\t// Sigh, race([]) is untestable unless we return *something*\n\t\t\t// that is recognizable without calling .then() on it.\n\t\t\treturn promises.length === 0 ? never()\n\t\t\t\t : promises.length === 1 ? resolve(promises[0])\n\t\t\t\t : runRace(promises);\n\t\t}\n\n\t\tfunction runRace(promises) {\n\t\t\tvar resolver = new Pending();\n\t\t\tvar i, x, h;\n\t\t\tfor(i=0; i<promises.length; ++i) {\n\t\t\t\tx = promises[i];\n\t\t\t\tif (x === void 0 && !(i in promises)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\th = getHandler(x);\n\t\t\t\tif(h.state() !== 0) {\n\t\t\t\t\tresolver.become(h);\n\t\t\t\t\tvisitRemaining(promises, i+1, h);\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\th.visit(resolver, resolver.resolve, resolver.reject);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn new Promise(Handler, resolver);\n\t\t}\n\n\t\t// Promise internals\n\t\t// Below this, everything is @private\n\n\t\t/**\n\t\t * Get an appropriate handler for x, without checking for cycles\n\t\t * @param {*} x\n\t\t * @returns {object} handler\n\t\t */\n\t\tfunction getHandler(x) {\n\t\t\tif(isPromise(x)) {\n\t\t\t\treturn x._handler.join();\n\t\t\t}\n\t\t\treturn maybeThenable(x) ? getHandlerUntrusted(x) : new Fulfilled(x);\n\t\t}\n\n\t\t/**\n\t\t * Get a handler for thenable x.\n\t\t * NOTE: You must only call this if maybeThenable(x) == true\n\t\t * @param {object|function|Promise} x\n\t\t * @returns {object} handler\n\t\t */\n\t\tfunction getHandlerMaybeThenable(x) {\n\t\t\treturn isPromise(x) ? x._handler.join() : getHandlerUntrusted(x);\n\t\t}\n\n\t\t/**\n\t\t * Get a handler for potentially untrusted thenable x\n\t\t * @param {*} x\n\t\t * @returns {object} handler\n\t\t */\n\t\tfunction getHandlerUntrusted(x) {\n\t\t\ttry {\n\t\t\t\tvar untrustedThen = x.then;\n\t\t\t\treturn typeof untrustedThen === \'function\'\n\t\t\t\t\t? new Thenable(untrustedThen, x)\n\t\t\t\t\t: new Fulfilled(x);\n\t\t\t} catch(e) {\n\t\t\t\treturn new Rejected(e);\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Handler for a promise that is pending forever\n\t\t * @constructor\n\t\t */\n\t\tfunction Handler() {}\n\n\t\tHandler.prototype.when\n\t\t\t= Handler.prototype.become\n\t\t\t= Handler.prototype.notify // deprecated\n\t\t\t= Handler.prototype.fail\n\t\t\t= Handler.prototype._unreport\n\t\t\t= Handler.prototype._report\n\t\t\t= noop;\n\n\t\tHandler.prototype._state = 0;\n\n\t\tHandler.prototype.state = function() {\n\t\t\treturn this._state;\n\t\t};\n\n\t\t/**\n\t\t * Recursively collapse handler chain to find the handler\n\t\t * nearest to the fully resolved value.\n\t\t * @returns {object} handler nearest the fully resolved value\n\t\t */\n\t\tHandler.prototype.join = function() {\n\t\t\tvar h = this;\n\t\t\twhile(h.handler !== void 0) {\n\t\t\t\th = h.handler;\n\t\t\t}\n\t\t\treturn h;\n\t\t};\n\n\t\tHandler.prototype.chain = function(to, receiver, fulfilled, rejected, progress) {\n\t\t\tthis.when({\n\t\t\t\tresolver: to,\n\t\t\t\treceiver: receiver,\n\t\t\t\tfulfilled: fulfilled,\n\t\t\t\trejected: rejected,\n\t\t\t\tprogress: progress\n\t\t\t});\n\t\t};\n\n\t\tHandler.prototype.visit = function(receiver, fulfilled, rejected, progress) {\n\t\t\tthis.chain(failIfRejected, receiver, fulfilled, rejected, progress);\n\t\t};\n\n\t\tHandler.prototype.fold = function(f, z, c, to) {\n\t\t\tthis.when(new Fold(f, z, c, to));\n\t\t};\n\n\t\t/**\n\t\t * Handler that invokes fail() on any handler it becomes\n\t\t * @constructor\n\t\t */\n\t\tfunction FailIfRejected() {}\n\n\t\tinherit(Handler, FailIfRejected);\n\n\t\tFailIfRejected.prototype.become = function(h) {\n\t\t\th.fail();\n\t\t};\n\n\t\tvar failIfRejected = new FailIfRejected();\n\n\t\t/**\n\t\t * Handler that manages a queue of consumers waiting on a pending promise\n\t\t * @constructor\n\t\t */\n\t\tfunction Pending(receiver, inheritedContext) {\n\t\t\tPromise.createContext(this, inheritedContext);\n\n\t\t\tthis.consumers = void 0;\n\t\t\tthis.receiver = receiver;\n\t\t\tthis.handler = void 0;\n\t\t\tthis.resolved = false;\n\t\t}\n\n\t\tinherit(Handler, Pending);\n\n\t\tPending.prototype._state = 0;\n\n\t\tPending.prototype.resolve = function(x) {\n\t\t\tthis.become(getHandler(x));\n\t\t};\n\n\t\tPending.prototype.reject = function(x) {\n\t\t\tif(this.resolved) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.become(new Rejected(x));\n\t\t};\n\n\t\tPending.prototype.join = function() {\n\t\t\tif (!this.resolved) {\n\t\t\t\treturn this;\n\t\t\t}\n\n\t\t\tvar h = this;\n\n\t\t\twhile (h.handler !== void 0) {\n\t\t\t\th = h.handler;\n\t\t\t\tif (h === this) {\n\t\t\t\t\treturn this.handler = cycle();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn h;\n\t\t};\n\n\t\tPending.prototype.run = function() {\n\t\t\tvar q = this.consumers;\n\t\t\tvar handler = this.handler;\n\t\t\tthis.handler = this.handler.join();\n\t\t\tthis.consumers = void 0;\n\n\t\t\tfor (var i = 0; i < q.length; ++i) {\n\t\t\t\thandler.when(q[i]);\n\t\t\t}\n\t\t};\n\n\t\tPending.prototype.become = function(handler) {\n\t\t\tif(this.resolved) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.resolved = true;\n\t\t\tthis.handler = handler;\n\t\t\tif(this.consumers !== void 0) {\n\t\t\t\ttasks.enqueue(this);\n\t\t\t}\n\n\t\t\tif(this.context !== void 0) {\n\t\t\t\thandler._report(this.context);\n\t\t\t}\n\t\t};\n\n\t\tPending.prototype.when = function(continuation) {\n\t\t\tif(this.resolved) {\n\t\t\t\ttasks.enqueue(new ContinuationTask(continuation, this.handler));\n\t\t\t} else {\n\t\t\t\tif(this.consumers === void 0) {\n\t\t\t\t\tthis.consumers = [continuation];\n\t\t\t\t} else {\n\t\t\t\t\tthis.consumers.push(continuation);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * @deprecated\n\t\t */\n\t\tPending.prototype.notify = function(x) {\n\t\t\tif(!this.resolved) {\n\t\t\t\ttasks.enqueue(new ProgressTask(x, this));\n\t\t\t}\n\t\t};\n\n\t\tPending.prototype.fail = function(context) {\n\t\t\tvar c = typeof context === \'undefined\' ? this.context : context;\n\t\t\tthis.resolved && this.handler.join().fail(c);\n\t\t};\n\n\t\tPending.prototype._report = function(context) {\n\t\t\tthis.resolved && this.handler.join()._report(context);\n\t\t};\n\n\t\tPending.prototype._unreport = function() {\n\t\t\tthis.resolved && this.handler.join()._unreport();\n\t\t};\n\n\t\t/**\n\t\t * Wrap another handler and force it into a future stack\n\t\t * @param {object} handler\n\t\t * @constructor\n\t\t */\n\t\tfunction Async(handler) {\n\t\t\tthis.handler = handler;\n\t\t}\n\n\t\tinherit(Handler, Async);\n\n\t\tAsync.prototype.when = function(continuation) {\n\t\t\ttasks.enqueue(new ContinuationTask(continuation, this));\n\t\t};\n\n\t\tAsync.prototype._report = function(context) {\n\t\t\tthis.join()._report(context);\n\t\t};\n\n\t\tAsync.prototype._unreport = function() {\n\t\t\tthis.join()._unreport();\n\t\t};\n\n\t\t/**\n\t\t * Handler that wraps an untrusted thenable and assimilates it in a future stack\n\t\t * @param {function} then\n\t\t * @param {{then: function}} thenable\n\t\t * @constructor\n\t\t */\n\t\tfunction Thenable(then, thenable) {\n\t\t\tPending.call(this);\n\t\t\ttasks.enqueue(new AssimilateTask(then, thenable, this));\n\t\t}\n\n\t\tinherit(Pending, Thenable);\n\n\t\t/**\n\t\t * Handler for a fulfilled promise\n\t\t * @param {*} x fulfillment value\n\t\t * @constructor\n\t\t */\n\t\tfunction Fulfilled(x) {\n\t\t\tPromise.createContext(this);\n\t\t\tthis.value = x;\n\t\t}\n\n\t\tinherit(Handler, Fulfilled);\n\n\t\tFulfilled.prototype._state = 1;\n\n\t\tFulfilled.prototype.fold = function(f, z, c, to) {\n\t\t\trunContinuation3(f, z, this, c, to);\n\t\t};\n\n\t\tFulfilled.prototype.when = function(cont) {\n\t\t\trunContinuation1(cont.fulfilled, this, cont.receiver, cont.resolver);\n\t\t};\n\n\t\tvar errorId = 0;\n\n\t\t/**\n\t\t * Handler for a rejected promise\n\t\t * @param {*} x rejection reason\n\t\t * @constructor\n\t\t */\n\t\tfunction Rejected(x) {\n\t\t\tPromise.createContext(this);\n\n\t\t\tthis.id = ++errorId;\n\t\t\tthis.value = x;\n\t\t\tthis.handled = false;\n\t\t\tthis.reported = false;\n\n\t\t\tthis._report();\n\t\t}\n\n\t\tinherit(Handler, Rejected);\n\n\t\tRejected.prototype._state = -1;\n\n\t\tRejected.prototype.fold = function(f, z, c, to) {\n\t\t\tto.become(this);\n\t\t};\n\n\t\tRejected.prototype.when = function(cont) {\n\t\t\tif(typeof cont.rejected === \'function\') {\n\t\t\t\tthis._unreport();\n\t\t\t}\n\t\t\trunContinuation1(cont.rejected, this, cont.receiver, cont.resolver);\n\t\t};\n\n\t\tRejected.prototype._report = function(context) {\n\t\t\ttasks.afterQueue(new ReportTask(this, context));\n\t\t};\n\n\t\tRejected.prototype._unreport = function() {\n\t\t\tif(this.handled) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.handled = true;\n\t\t\ttasks.afterQueue(new UnreportTask(this));\n\t\t};\n\n\t\tRejected.prototype.fail = function(context) {\n\t\t\tthis.reported = true;\n\t\t\temitRejection(\'unhandledRejection\', this);\n\t\t\tPromise.onFatalRejection(this, context === void 0 ? this.context : context);\n\t\t};\n\n\t\tfunction ReportTask(rejection, context) {\n\t\t\tthis.rejection = rejection;\n\t\t\tthis.context = context;\n\t\t}\n\n\t\tReportTask.prototype.run = function() {\n\t\t\tif(!this.rejection.handled && !this.rejection.reported) {\n\t\t\t\tthis.rejection.reported = true;\n\t\t\t\temitRejection(\'unhandledRejection\', this.rejection) ||\n\t\t\t\t\tPromise.onPotentiallyUnhandledRejection(this.rejection, this.context);\n\t\t\t}\n\t\t};\n\n\t\tfunction UnreportTask(rejection) {\n\t\t\tthis.rejection = rejection;\n\t\t}\n\n\t\tUnreportTask.prototype.run = function() {\n\t\t\tif(this.rejection.reported) {\n\t\t\t\temitRejection(\'rejectionHandled\', this.rejection) ||\n\t\t\t\t\tPromise.onPotentiallyUnhandledRejectionHandled(this.rejection);\n\t\t\t}\n\t\t};\n\n\t\t// Unhandled rejection hooks\n\t\t// By default, everything is a noop\n\n\t\tPromise.createContext\n\t\t\t= Promise.enterContext\n\t\t\t= Promise.exitContext\n\t\t\t= Promise.onPotentiallyUnhandledRejection\n\t\t\t= Promise.onPotentiallyUnhandledRejectionHandled\n\t\t\t= Promise.onFatalRejection\n\t\t\t= noop;\n\n\t\t// Errors and singletons\n\n\t\tvar foreverPendingHandler = new Handler();\n\t\tvar foreverPendingPromise = new Promise(Handler, foreverPendingHandler);\n\n\t\tfunction cycle() {\n\t\t\treturn new Rejected(new TypeError(\'Promise cycle\'));\n\t\t}\n\n\t\t// Task runners\n\n\t\t/**\n\t\t * Run a single consumer\n\t\t * @constructor\n\t\t */\n\t\tfunction ContinuationTask(continuation, handler) {\n\t\t\tthis.continuation = continuation;\n\t\t\tthis.handler = handler;\n\t\t}\n\n\t\tContinuationTask.prototype.run = function() {\n\t\t\tthis.handler.join().when(this.continuation);\n\t\t};\n\n\t\t/**\n\t\t * Run a queue of progress handlers\n\t\t * @constructor\n\t\t */\n\t\tfunction ProgressTask(value, handler) {\n\t\t\tthis.handler = handler;\n\t\t\tthis.value = value;\n\t\t}\n\n\t\tProgressTask.prototype.run = function() {\n\t\t\tvar q = this.handler.consumers;\n\t\t\tif(q === void 0) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor (var c, i = 0; i < q.length; ++i) {\n\t\t\t\tc = q[i];\n\t\t\t\trunNotify(c.progress, this.value, this.handler, c.receiver, c.resolver);\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * Assimilate a thenable, sending it\'s value to resolver\n\t\t * @param {function} then\n\t\t * @param {object|function} thenable\n\t\t * @param {object} resolver\n\t\t * @constructor\n\t\t */\n\t\tfunction AssimilateTask(then, thenable, resolver) {\n\t\t\tthis._then = then;\n\t\t\tthis.thenable = thenable;\n\t\t\tthis.resolver = resolver;\n\t\t}\n\n\t\tAssimilateTask.prototype.run = function() {\n\t\t\tvar h = this.resolver;\n\t\t\ttryAssimilate(this._then, this.thenable, _resolve, _reject, _notify);\n\n\t\t\tfunction _resolve(x) { h.resolve(x); }\n\t\t\tfunction _reject(x) { h.reject(x); }\n\t\t\tfunction _notify(x) { h.notify(x); }\n\t\t};\n\n\t\tfunction tryAssimilate(then, thenable, resolve, reject, notify) {\n\t\t\ttry {\n\t\t\t\tthen.call(thenable, resolve, reject, notify);\n\t\t\t} catch (e) {\n\t\t\t\treject(e);\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Fold a handler value with z\n\t\t * @constructor\n\t\t */\n\t\tfunction Fold(f, z, c, to) {\n\t\t\tthis.f = f; this.z = z; this.c = c; this.to = to;\n\t\t\tthis.resolver = failIfRejected;\n\t\t\tthis.receiver = this;\n\t\t}\n\n\t\tFold.prototype.fulfilled = function(x) {\n\t\t\tthis.f.call(this.c, this.z, x, this.to);\n\t\t};\n\n\t\tFold.prototype.rejected = function(x) {\n\t\t\tthis.to.reject(x);\n\t\t};\n\n\t\tFold.prototype.progress = function(x) {\n\t\t\tthis.to.notify(x);\n\t\t};\n\n\t\t// Other helpers\n\n\t\t/**\n\t\t * @param {*} x\n\t\t * @returns {boolean} true iff x is a trusted Promise\n\t\t */\n\t\tfunction isPromise(x) {\n\t\t\treturn x instanceof Promise;\n\t\t}\n\n\t\t/**\n\t\t * Test just enough to rule out primitives, in order to take faster\n\t\t * paths in some code\n\t\t * @param {*} x\n\t\t * @returns {boolean} false iff x is guaranteed *not* to be a thenable\n\t\t */\n\t\tfunction maybeThenable(x) {\n\t\t\treturn (typeof x === \'object\' || typeof x === \'function\') && x !== null;\n\t\t}\n\n\t\tfunction runContinuation1(f, h, receiver, next) {\n\t\t\tif(typeof f !== \'function\') {\n\t\t\t\treturn next.become(h);\n\t\t\t}\n\n\t\t\tPromise.enterContext(h);\n\t\t\ttryCatchReject(f, h.value, receiver, next);\n\t\t\tPromise.exitContext();\n\t\t}\n\n\t\tfunction runContinuation3(f, x, h, receiver, next) {\n\t\t\tif(typeof f !== \'function\') {\n\t\t\t\treturn next.become(h);\n\t\t\t}\n\n\t\t\tPromise.enterContext(h);\n\t\t\ttryCatchReject3(f, x, h.value, receiver, next);\n\t\t\tPromise.exitContext();\n\t\t}\n\n\t\t/**\n\t\t * @deprecated\n\t\t */\n\t\tfunction runNotify(f, x, h, receiver, next) {\n\t\t\tif(typeof f !== \'function\') {\n\t\t\t\treturn next.notify(x);\n\t\t\t}\n\n\t\t\tPromise.enterContext(h);\n\t\t\ttryCatchReturn(f, x, receiver, next);\n\t\t\tPromise.exitContext();\n\t\t}\n\n\t\tfunction tryCatch2(f, a, b) {\n\t\t\ttry {\n\t\t\t\treturn f(a, b);\n\t\t\t} catch(e) {\n\t\t\t\treturn reject(e);\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Return f.call(thisArg, x), or if it throws return a rejected promise for\n\t\t * the thrown exception\n\t\t */\n\t\tfunction tryCatchReject(f, x, thisArg, next) {\n\t\t\ttry {\n\t\t\t\tnext.become(getHandler(f.call(thisArg, x)));\n\t\t\t} catch(e) {\n\t\t\t\tnext.become(new Rejected(e));\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * Same as above, but includes the extra argument parameter.\n\t\t */\n\t\tfunction tryCatchReject3(f, x, y, thisArg, next) {\n\t\t\ttry {\n\t\t\t\tf.call(thisArg, x, y, next);\n\t\t\t} catch(e) {\n\t\t\t\tnext.become(new Rejected(e));\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * @deprecated\n\t\t * Return f.call(thisArg, x), or if it throws, *return* the exception\n\t\t */\n\t\tfunction tryCatchReturn(f, x, thisArg, next) {\n\t\t\ttry {\n\t\t\t\tnext.notify(f.call(thisArg, x));\n\t\t\t} catch(e) {\n\t\t\t\tnext.notify(e);\n\t\t\t}\n\t\t}\n\n\t\tfunction inherit(Parent, Child) {\n\t\t\tChild.prototype = objectCreate(Parent.prototype);\n\t\t\tChild.prototype.constructor = Child;\n\t\t}\n\n\t\tfunction snd(x, y) {\n\t\t\treturn y;\n\t\t}\n\n\t\tfunction noop() {}\n\n\t\tfunction initEmitRejection() {\n\t\t\t/*global process, self, CustomEvent*/\n\t\t\tif(typeof process !== \'undefined\' && process !== null\n\t\t\t\t&& typeof process.emit === \'function\') {\n\t\t\t\t// Returning falsy here means to call the default\n\t\t\t\t// onPotentiallyUnhandledRejection API. This is safe even in\n\t\t\t\t// browserify since process.emit always returns falsy in browserify:\n\t\t\t\t// https://github.com/defunctzombie/node-process/blob/master/browser.js#L40-L46\n\t\t\t\treturn function(type, rejection) {\n\t\t\t\t\treturn type === \'unhandledRejection\'\n\t\t\t\t\t\t? process.emit(type, rejection.value, rejection)\n\t\t\t\t\t\t: process.emit(type, rejection);\n\t\t\t\t};\n\t\t\t} else if(typeof self !== \'undefined\' && typeof CustomEvent === \'function\') {\n\t\t\t\treturn (function(noop, self, CustomEvent) {\n\t\t\t\t\tvar hasCustomEvent = false;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar ev = new CustomEvent(\'unhandledRejection\');\n\t\t\t\t\t\thasCustomEvent = ev instanceof CustomEvent;\n\t\t\t\t\t} catch (e) {}\n\n\t\t\t\t\treturn !hasCustomEvent ? noop : function(type, rejection) {\n\t\t\t\t\t\tvar ev = new CustomEvent(type, {\n\t\t\t\t\t\t\tdetail: {\n\t\t\t\t\t\t\t\treason: rejection.value,\n\t\t\t\t\t\t\t\tkey: rejection\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tbubbles: false,\n\t\t\t\t\t\t\tcancelable: true\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\treturn !self.dispatchEvent(ev);\n\t\t\t\t\t};\n\t\t\t\t}(noop, self, CustomEvent));\n\t\t\t}\n\n\t\t\treturn noop;\n\t\t}\n\n\t\treturn Promise;\n\t};\n});\n}(typeof define === \'function\' && define.amd ? define : function(factory) { module.exports = factory(); }));\n\n},{}]},{},[1])\n//# sourceMappingURL=Promise.js.map\n(1)\n});\n;';
  10165. loader.global.define = undefined;
  10166. loader.global.module = undefined;
  10167. loader.global.exports = undefined;
  10168. loader.__exec({
  10169. 'source': source,
  10170. 'address': module.uri
  10171. });
  10172. loader.global.require = require;
  10173. loader.global.define = define;
  10174. return loader.get('@@global-helpers').retrieveGlobal(module.id, undefined);
  10175. });
  10176. /*can-connect@0.5.5#helpers/helpers*/
  10177. define('can-connect@0.5.5#helpers/helpers', function (require, exports, module) {
  10178. require('when/es6-shim/Promise');
  10179. var strReplacer = /\{([^\}]+)\}/g, isContainer = function (current) {
  10180. return /^f|^o/.test(typeof current);
  10181. }, arrayProto = Array.prototype;
  10182. var helpers;
  10183. module.exports = helpers = {
  10184. extend: function (d, s) {
  10185. for (var name in s) {
  10186. d[name] = s[name];
  10187. }
  10188. return d;
  10189. },
  10190. deferred: function () {
  10191. var def = {};
  10192. def.promise = new Promise(function (resolve, reject) {
  10193. def.resolve = resolve;
  10194. def.reject = reject;
  10195. });
  10196. return def;
  10197. },
  10198. each: function (obj, cb) {
  10199. for (var prop in obj) {
  10200. cb(obj[prop], prop);
  10201. }
  10202. return obj;
  10203. },
  10204. forEach: arrayProto.forEach || function (cb) {
  10205. var i = 0, len = this.length;
  10206. for (; i < len; i++) {
  10207. cb(this[i], i);
  10208. }
  10209. },
  10210. map: arrayProto.map || function (cb) {
  10211. var out = [], arr = this;
  10212. helpers.forEach.call(arr, function (o, i) {
  10213. out.push(cb(o, i, arr));
  10214. });
  10215. return out;
  10216. },
  10217. indexOf: arrayProto.indexOf || function (item) {
  10218. for (var i = 0, thisLen = this.length; i < thisLen; i++) {
  10219. if (this[i] === item) {
  10220. return i;
  10221. }
  10222. }
  10223. return -1;
  10224. },
  10225. getObject: function (prop, data, remove) {
  10226. var res = data[prop];
  10227. if (remove) {
  10228. delete data[prop];
  10229. }
  10230. return res;
  10231. },
  10232. sub: function (str, data, remove) {
  10233. var obs = [];
  10234. str = str || '';
  10235. obs.push(str.replace(strReplacer, function (whole, inside) {
  10236. var ob = helpers.getObject(inside, data, remove);
  10237. if (ob === undefined || ob === null) {
  10238. obs = null;
  10239. return '';
  10240. }
  10241. if (isContainer(ob) && obs) {
  10242. obs.push(ob);
  10243. return '';
  10244. }
  10245. return '' + ob;
  10246. }));
  10247. return obs === null ? obs : obs.length <= 1 ? obs[0] : obs;
  10248. },
  10249. keys: Object.keys || function () {
  10250. var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = !{ toString: null }.propertyIsEnumerable('toString'), dontEnums = [
  10251. 'toString',
  10252. 'toLocaleString',
  10253. 'valueOf',
  10254. 'hasOwnProperty',
  10255. 'isPrototypeOf',
  10256. 'propertyIsEnumerable',
  10257. 'constructor'
  10258. ], dontEnumsLength = dontEnums.length;
  10259. return function (obj) {
  10260. if (typeof obj !== 'object' && typeof obj !== 'function' || obj === null) {
  10261. throw new TypeError('Object.keys called on non-object');
  10262. }
  10263. var result = [];
  10264. for (var prop in obj) {
  10265. if (hasOwnProperty.call(obj, prop)) {
  10266. result.push(prop);
  10267. }
  10268. }
  10269. if (hasDontEnumBug) {
  10270. for (var i = 0; i < dontEnumsLength; i++) {
  10271. if (hasOwnProperty.call(obj, dontEnums[i])) {
  10272. result.push(dontEnums[i]);
  10273. }
  10274. }
  10275. }
  10276. return result;
  10277. };
  10278. }(),
  10279. defineProperty: function () {
  10280. try {
  10281. var tmp = {};
  10282. Object.defineProperty(tmp, 'foo', {});
  10283. return Object.defineProperty;
  10284. } catch (_) {
  10285. return function (obj, name, desc) {
  10286. if (desc.value) {
  10287. obj[name] = desc.value;
  10288. }
  10289. };
  10290. }
  10291. }(),
  10292. isArray: Array.isArray || function (arr) {
  10293. return Object.prototype.toString.call(arr) === '[object Array]';
  10294. },
  10295. bind: function () {
  10296. if (Function.prototype.bind) {
  10297. return function (fn, ctx) {
  10298. return fn.bind(ctx);
  10299. };
  10300. } else {
  10301. return function (fn, ctx) {
  10302. return function () {
  10303. return fn.apply(ctx, arguments);
  10304. };
  10305. };
  10306. }
  10307. }()
  10308. };
  10309. });
  10310. /*can-connect@0.5.5#can-connect*/
  10311. define('can-connect@0.5.5#can-connect', function (require, exports, module) {
  10312. var helpers = require('./helpers/');
  10313. var connect = function (behaviors, options) {
  10314. behaviors = helpers.map.call(behaviors, function (behavior, index) {
  10315. var sortedIndex;
  10316. if (typeof behavior === 'string') {
  10317. sortedIndex = helpers.indexOf.call(connect.order, behavior);
  10318. behavior = behaviorsMap[behavior];
  10319. } else if (behavior.isBehavior) {
  10320. } else {
  10321. behavior = connect.behavior(behavior);
  10322. }
  10323. return {
  10324. originalIndex: index,
  10325. sortedIndex: sortedIndex,
  10326. behavior: behavior
  10327. };
  10328. }).sort(function (b1, b2) {
  10329. if (b1.sortedIndex != null && b2.sortedIndex != null) {
  10330. return b1.sortedIndex - b2.sortedIndex;
  10331. }
  10332. return b1.originalIndex - b2.originalIndex;
  10333. });
  10334. behaviors = helpers.map.call(behaviors, function (b) {
  10335. return b.behavior;
  10336. });
  10337. var behavior = core(connect.behavior('options', function () {
  10338. return options;
  10339. })());
  10340. helpers.forEach.call(behaviors, function (behave) {
  10341. behavior = behave(behavior);
  10342. });
  10343. if (behavior.init) {
  10344. behavior.init();
  10345. }
  10346. return behavior;
  10347. };
  10348. connect.order = [
  10349. 'data-localstorage-cache',
  10350. 'data-url',
  10351. 'data-parse',
  10352. 'cache-requests',
  10353. 'data-combine-requests',
  10354. 'constructor',
  10355. 'constructor-store',
  10356. 'can-map',
  10357. 'fall-through-cache',
  10358. 'data-inline-cache',
  10359. 'data-worker',
  10360. 'data-callbacks-cache',
  10361. 'data-callbacks',
  10362. 'constructor-callbacks-once'
  10363. ];
  10364. connect.behavior = function (name, behavior) {
  10365. if (typeof name !== 'string') {
  10366. behavior = name;
  10367. name = undefined;
  10368. }
  10369. var behaviorMixin = function (base) {
  10370. var Behavior = function () {
  10371. };
  10372. Behavior.name = name;
  10373. Behavior.prototype = base;
  10374. var newBehavior = new Behavior();
  10375. var res = typeof behavior === 'function' ? behavior.apply(newBehavior, arguments) : behavior;
  10376. helpers.extend(newBehavior, res);
  10377. newBehavior.__behaviorName = name;
  10378. return newBehavior;
  10379. };
  10380. if (name) {
  10381. behaviorMixin.name = name;
  10382. behaviorsMap[name] = behaviorMixin;
  10383. }
  10384. behaviorMixin.isBehavior = true;
  10385. return behaviorMixin;
  10386. };
  10387. var behaviorsMap = {};
  10388. var core = connect.behavior('base', function (base) {
  10389. return {
  10390. id: function (instance) {
  10391. var ids = [], algebra = this.algebra;
  10392. if (algebra && algebra.clauses && algebra.clauses.id) {
  10393. for (var prop in algebra.clauses.id) {
  10394. ids.push(instance[prop]);
  10395. }
  10396. }
  10397. if (this.idProp && !ids.length) {
  10398. ids.push(instance[this.idProp]);
  10399. }
  10400. if (!ids.length) {
  10401. ids.push(instance.id);
  10402. }
  10403. return ids.length > 1 ? ids.join('@|@') : ids[0];
  10404. },
  10405. idProp: base.idProp || 'id',
  10406. listSet: function (list) {
  10407. return list[this.listSetProp];
  10408. },
  10409. listSetProp: '__listSet',
  10410. init: function () {
  10411. }
  10412. };
  10413. });
  10414. connect.base = core;
  10415. module.exports = connect;
  10416. });
  10417. /*can-define@0.7.17#list/list*/
  10418. define('can-define@0.7.17#list/list', function (require, exports, module) {
  10419. var Construct = require('can-construct');
  10420. var define = require('can-define');
  10421. var make = define.make;
  10422. var canBatch = require('can-event/batch/batch');
  10423. var Observation = require('can-observation');
  10424. var defineHelpers = require('../define-helpers/define-helpers');
  10425. var assign = require('can-util/js/assign/assign');
  10426. var each = require('can-util/js/each/each');
  10427. var isArray = require('can-util/js/is-array/is-array');
  10428. var makeArray = require('can-util/js/make-array/make-array');
  10429. var types = require('can-util/js/types/types');
  10430. var ns = require('can-util/namespace');
  10431. var splice = [].splice;
  10432. var identity = function (x) {
  10433. return x;
  10434. };
  10435. var makeFilterCallback = function (props) {
  10436. return function (item) {
  10437. for (var prop in props) {
  10438. if (item[prop] !== props[prop]) {
  10439. return false;
  10440. }
  10441. }
  10442. return true;
  10443. };
  10444. };
  10445. var DefineList = Construct.extend('DefineList', {
  10446. setup: function () {
  10447. if (DefineList) {
  10448. var prototype = this.prototype;
  10449. var itemsDefinition = prototype['*'];
  10450. delete prototype['*'];
  10451. define(prototype, prototype);
  10452. if (itemsDefinition) {
  10453. prototype['*'] = itemsDefinition;
  10454. itemsDefinition = define.getDefinitionOrMethod('*', itemsDefinition, {});
  10455. if (itemsDefinition.Type) {
  10456. this.prototype.__type = make.set.Type('*', itemsDefinition.Type, identity);
  10457. } else if (itemsDefinition.type) {
  10458. this.prototype.__type = make.set.type('*', itemsDefinition.type, identity);
  10459. }
  10460. }
  10461. }
  10462. }
  10463. }, {
  10464. setup: function (items) {
  10465. if (!this._define) {
  10466. Object.defineProperty(this, '_define', {
  10467. enumerable: false,
  10468. value: { definitions: {} }
  10469. });
  10470. Object.defineProperty(this, '_data', {
  10471. enumerable: false,
  10472. value: {}
  10473. });
  10474. }
  10475. define.setup.call(this, {}, false);
  10476. this._length = 0;
  10477. if (items) {
  10478. this.splice.apply(this, [
  10479. 0,
  10480. 0
  10481. ].concat(defineHelpers.toObject(this, items, [], DefineList)));
  10482. }
  10483. },
  10484. __type: define.types.observable,
  10485. _triggerChange: function (attr, how, newVal, oldVal) {
  10486. canBatch.trigger.call(this, {
  10487. type: '' + attr,
  10488. target: this
  10489. }, [
  10490. newVal,
  10491. oldVal
  10492. ]);
  10493. var index = +attr;
  10494. if (!~('' + attr).indexOf('.') && !isNaN(index)) {
  10495. if (how === 'add') {
  10496. canBatch.trigger.call(this, how, [
  10497. newVal,
  10498. index
  10499. ]);
  10500. canBatch.trigger.call(this, 'length', [this._length]);
  10501. } else if (how === 'remove') {
  10502. canBatch.trigger.call(this, how, [
  10503. oldVal,
  10504. index
  10505. ]);
  10506. canBatch.trigger.call(this, 'length', [this._length]);
  10507. } else {
  10508. canBatch.trigger.call(this, how, [
  10509. newVal,
  10510. index
  10511. ]);
  10512. }
  10513. }
  10514. },
  10515. get: function (index) {
  10516. if (arguments.length) {
  10517. Observation.add(this, '' + index);
  10518. return this[index];
  10519. } else {
  10520. return defineHelpers.serialize(this, 'get', []);
  10521. }
  10522. },
  10523. set: function (prop, value) {
  10524. if (typeof prop !== 'object') {
  10525. prop = isNaN(+prop) || prop % 1 ? prop : +prop;
  10526. if (typeof prop === 'number') {
  10527. if (typeof prop === 'number' && prop > this._length - 1) {
  10528. var newArr = new Array(prop + 1 - this._length);
  10529. newArr[newArr.length - 1] = value;
  10530. this.push.apply(this, newArr);
  10531. return newArr;
  10532. }
  10533. this.splice(prop, 1, value);
  10534. } else {
  10535. var defined = defineHelpers.defineExpando(this, prop, value);
  10536. if (!defined) {
  10537. this[prop] = value;
  10538. }
  10539. }
  10540. } else {
  10541. if (isArray(prop)) {
  10542. if (value) {
  10543. this.replace(prop);
  10544. } else {
  10545. this.splice.apply(this, [
  10546. 0,
  10547. prop.length
  10548. ].concat(prop));
  10549. }
  10550. } else {
  10551. each(prop, function (value, prop) {
  10552. this.set(prop, value);
  10553. }, this);
  10554. }
  10555. }
  10556. return this;
  10557. },
  10558. _items: function () {
  10559. var arr = [];
  10560. this._each(function (item) {
  10561. arr.push(item);
  10562. });
  10563. return arr;
  10564. },
  10565. _each: function (callback) {
  10566. for (var i = 0, len = this._length; i < len; i++) {
  10567. callback(this[i], i);
  10568. }
  10569. },
  10570. splice: function (index, howMany) {
  10571. var args = makeArray(arguments), added = [], i, len, listIndex, allSame = args.length > 2;
  10572. index = index || 0;
  10573. for (i = 0, len = args.length - 2; i < len; i++) {
  10574. listIndex = i + 2;
  10575. args[listIndex] = this.__type(args[listIndex], listIndex);
  10576. added.push(args[listIndex]);
  10577. if (this[i + index] !== args[listIndex]) {
  10578. allSame = false;
  10579. }
  10580. }
  10581. if (allSame && this._length <= added.length) {
  10582. return added;
  10583. }
  10584. if (howMany === undefined) {
  10585. howMany = args[1] = this._length - index;
  10586. }
  10587. var removed = splice.apply(this, args);
  10588. canBatch.start();
  10589. if (howMany > 0) {
  10590. this._triggerChange('' + index, 'remove', undefined, removed);
  10591. }
  10592. if (args.length > 2) {
  10593. this._triggerChange('' + index, 'add', added, removed);
  10594. }
  10595. canBatch.stop();
  10596. return removed;
  10597. },
  10598. serialize: function () {
  10599. return defineHelpers.serialize(this, 'serialize', []);
  10600. }
  10601. });
  10602. var getArgs = function (args) {
  10603. return args[0] && Array.isArray(args[0]) ? args[0] : makeArray(args);
  10604. };
  10605. each({
  10606. push: 'length',
  10607. unshift: 0
  10608. }, function (where, name) {
  10609. var orig = [][name];
  10610. DefineList.prototype[name] = function () {
  10611. var args = [], len = where ? this._length : 0, i = arguments.length, res, val;
  10612. while (i--) {
  10613. val = arguments[i];
  10614. args[i] = this.__type(val, i);
  10615. }
  10616. res = orig.apply(this, args);
  10617. if (!this.comparator || args.length) {
  10618. this._triggerChange('' + len, 'add', args, undefined);
  10619. }
  10620. return res;
  10621. };
  10622. });
  10623. each({
  10624. pop: 'length',
  10625. shift: 0
  10626. }, function (where, name) {
  10627. DefineList.prototype[name] = function () {
  10628. if (!this._length) {
  10629. return undefined;
  10630. }
  10631. var args = getArgs(arguments), len = where && this._length ? this._length - 1 : 0;
  10632. var res = [][name].apply(this, args);
  10633. this._triggerChange('' + len, 'remove', undefined, [res]);
  10634. return res;
  10635. };
  10636. });
  10637. assign(DefineList.prototype, {
  10638. indexOf: function (item, fromIndex) {
  10639. for (var i = fromIndex || 0, len = this.length; i < len; i++) {
  10640. if (this.get(i) === item) {
  10641. return i;
  10642. }
  10643. }
  10644. return -1;
  10645. },
  10646. join: function () {
  10647. Observation.add(this, 'length');
  10648. return [].join.apply(this, arguments);
  10649. },
  10650. reverse: function () {
  10651. var list = [].reverse.call(this._items());
  10652. return this.replace(list);
  10653. },
  10654. slice: function () {
  10655. Observation.add(this, 'length');
  10656. var temp = Array.prototype.slice.apply(this, arguments);
  10657. return new this.constructor(temp);
  10658. },
  10659. concat: function () {
  10660. var args = [];
  10661. each(makeArray(arguments), function (arg, i) {
  10662. args[i] = arg instanceof DefineList ? arg.get() : arg;
  10663. });
  10664. return new this.constructor(Array.prototype.concat.apply(this.get(), args));
  10665. },
  10666. forEach: function (cb, thisarg) {
  10667. var item;
  10668. for (var i = 0, len = this.length; i < len; i++) {
  10669. item = this.get(i);
  10670. if (cb.call(thisarg || item, item, i, this) === false) {
  10671. break;
  10672. }
  10673. }
  10674. return this;
  10675. },
  10676. replace: function (newList) {
  10677. this.splice.apply(this, [
  10678. 0,
  10679. this._length
  10680. ].concat(makeArray(newList || [])));
  10681. return this;
  10682. },
  10683. filter: function (callback, thisArg) {
  10684. var filteredList = [], self = this, filtered;
  10685. if (typeof callback === 'object') {
  10686. callback = makeFilterCallback(callback);
  10687. }
  10688. this.each(function (item, index, list) {
  10689. filtered = callback.call(thisArg | self, item, index, self);
  10690. if (filtered) {
  10691. filteredList.push(item);
  10692. }
  10693. });
  10694. return new this.constructor(filteredList);
  10695. },
  10696. map: function (callback, thisArg) {
  10697. var mappedList = [], self = this;
  10698. this.each(function (item, index, list) {
  10699. var mapped = callback.call(thisArg | self, item, index, self);
  10700. mappedList.push(mapped);
  10701. });
  10702. return new this.constructor(mappedList);
  10703. }
  10704. });
  10705. for (var prop in define.eventsProto) {
  10706. Object.defineProperty(DefineList.prototype, prop, {
  10707. enumerable: false,
  10708. value: define.eventsProto[prop],
  10709. writable: true
  10710. });
  10711. }
  10712. Object.defineProperty(DefineList.prototype, 'length', {
  10713. get: function () {
  10714. if (!this.__inSetup) {
  10715. Observation.add(this, 'length');
  10716. }
  10717. return this._length;
  10718. },
  10719. set: function (newVal) {
  10720. this._length = newVal;
  10721. },
  10722. enumerable: true
  10723. });
  10724. var oldIsListLike = types.isListLike;
  10725. types.isListLike = function (obj) {
  10726. return obj instanceof DefineList || oldIsListLike.apply(this, arguments);
  10727. };
  10728. DefineList.prototype.each = DefineList.prototype.forEach;
  10729. DefineList.prototype.attr = function (prop, value) {
  10730. console.warn('DefineMap::attr shouldn\'t be called');
  10731. if (arguments.length === 0) {
  10732. return this.get();
  10733. } else if (prop && typeof prop === 'object') {
  10734. return this.set.apply(this, arguments);
  10735. } else if (arguments.length === 1) {
  10736. return this.get(prop);
  10737. } else {
  10738. return this.set(prop, value);
  10739. }
  10740. };
  10741. DefineList.prototype.item = function (index, value) {
  10742. if (arguments.length === 1) {
  10743. return this.get(index);
  10744. } else {
  10745. return this.set(index, value);
  10746. }
  10747. };
  10748. DefineList.prototype.items = function () {
  10749. console.warn('DefineList::get should should be used instead of DefineList::items');
  10750. return this.get();
  10751. };
  10752. types.DefineList = DefineList;
  10753. types.DefaultList = DefineList;
  10754. module.exports = ns.DefineList = DefineList;
  10755. });
  10756. /*src/player-bio/config*/
  10757. define('src/player-bio/config', ['exports'], function (exports) {
  10758. 'use strict';
  10759. Object.defineProperty(exports, '__esModule', { value: true });
  10760. exports.default = {
  10761. playersUrl: '/modules/page.players-redesign/player-bio/data/players.json',
  10762. playerBioUrl: '/modules/page.players-redesign/player-bio/data/players/{id}/bio.json',
  10763. playerResultsUrl: '/modules/page.players-redesign/player-bio/data/players/{id}/{year}results.json',
  10764. playerStatsUrl: '/modules/page.players-redesign/player-bio/data/players/{id}/2016stat.json',
  10765. playerStat186Url: '/modules/page.players-redesign/player-bio/data/r/stats/current/186.json',
  10766. tourCode: 'r',
  10767. inPlayoffs: false
  10768. };
  10769. });
  10770. /*src/player-bio/models/players-model*/
  10771. define('src/player-bio/models/players-model', [
  10772. 'exports',
  10773. 'can-connect',
  10774. 'can-define/map/map',
  10775. 'can-define/list/list',
  10776. '../config',
  10777. 'jquery',
  10778. 'can-connect/constructor/constructor',
  10779. 'can-connect/can/map/map',
  10780. 'can-connect/data/parse/parse'
  10781. ], function (exports, _canConnect, _map, _list, _config, _jquery) {
  10782. 'use strict';
  10783. Object.defineProperty(exports, '__esModule', { value: true });
  10784. var _canConnect2 = _interopRequireDefault(_canConnect);
  10785. var _map2 = _interopRequireDefault(_map);
  10786. var _list2 = _interopRequireDefault(_list);
  10787. var _config2 = _interopRequireDefault(_config);
  10788. var _jquery2 = _interopRequireDefault(_jquery);
  10789. function _interopRequireDefault(obj) {
  10790. return obj && obj.__esModule ? obj : { default: obj };
  10791. }
  10792. var Player = _map2.default.extend({
  10793. playerId: {
  10794. type: 'string',
  10795. value: ''
  10796. },
  10797. name: {
  10798. type: 'string',
  10799. value: ''
  10800. },
  10801. country: {
  10802. type: 'string',
  10803. value: ''
  10804. }
  10805. });
  10806. var PlayerList = _list2.default.extend([{
  10807. player: {
  10808. type: Object,
  10809. Value: Player
  10810. }
  10811. }]);
  10812. (0, _canConnect2.default)([], {
  10813. Map: PlayerList,
  10814. getData: function getData(params) {
  10815. var url = pgatour.format(_config2.default.playersUrl, { id: params.id });
  10816. return new Promise(function (resolve, reject) {
  10817. _jquery2.default.get(url).then(resolve, reject);
  10818. });
  10819. },
  10820. parseInstanceData: function parseInstanceData(response) {
  10821. var data = JSON.parse(response);
  10822. return data.plrs.filter(function (player) {
  10823. return player.pr === _config2.default.tourCode;
  10824. }).map(function (player) {
  10825. return {
  10826. playerName: player.nameL + ',' + player.nameF,
  10827. playerId: player.pid,
  10828. countryCode: player.ct
  10829. };
  10830. });
  10831. }
  10832. });
  10833. exports.default = PlayerList;
  10834. });
  10835. /*src/player-bio/models/player-bio-model*/
  10836. define('src/player-bio/models/player-bio-model', [
  10837. 'exports',
  10838. 'can-connect',
  10839. 'can-define/map/map',
  10840. '../config',
  10841. 'jquery',
  10842. 'can-connect/constructor/constructor',
  10843. 'can-connect/can/map/map',
  10844. 'can-connect/data/parse/parse'
  10845. ], function (exports, _canConnect, _map, _config, _jquery) {
  10846. 'use strict';
  10847. Object.defineProperty(exports, '__esModule', { value: true });
  10848. var _canConnect2 = _interopRequireDefault(_canConnect);
  10849. var _map2 = _interopRequireDefault(_map);
  10850. var _config2 = _interopRequireDefault(_config);
  10851. var _jquery2 = _interopRequireDefault(_jquery);
  10852. function _interopRequireDefault(obj) {
  10853. return obj && obj.__esModule ? obj : { default: obj };
  10854. }
  10855. var PlayerBio = _map2.default.extend({
  10856. age: {
  10857. type: 'string',
  10858. value: ''
  10859. },
  10860. birthPlace: {
  10861. type: 'string',
  10862. value: ''
  10863. },
  10864. countryCode: {
  10865. type: 'string',
  10866. value: ''
  10867. },
  10868. height: {
  10869. type: 'string',
  10870. value: ''
  10871. },
  10872. heightMetric: {
  10873. type: 'string',
  10874. value: ''
  10875. },
  10876. playerId: {
  10877. type: 'string',
  10878. value: ''
  10879. },
  10880. school: {
  10881. type: 'string',
  10882. value: ''
  10883. },
  10884. turnedPro: {
  10885. type: 'string',
  10886. value: ''
  10887. },
  10888. weight: {
  10889. type: 'string',
  10890. value: ''
  10891. },
  10892. weightMetric: {
  10893. type: 'string',
  10894. value: ''
  10895. }
  10896. });
  10897. (0, _canConnect2.default)([], {
  10898. Map: PlayerBio,
  10899. getData: function getData(params) {
  10900. var url = pgatour.format(_config2.default.playerBioUrl, { id: params.id });
  10901. return new Promise(function (resolve, reject) {
  10902. _jquery2.default.get(url).then(resolve, reject);
  10903. });
  10904. },
  10905. parseInstanceData: function parseInstanceData(response) {
  10906. var data = JSON.parse(response);
  10907. var personalInfo = data.plrs[0].personalInfo;
  10908. var playerId = data.plrs[0].plrNum;
  10909. return {
  10910. playerId: playerId,
  10911. name: personalInfo.name.first + ' ' + personalInfo.name.last,
  10912. height: personalInfo.height,
  10913. heightMetric: personalInfo.heightMetric,
  10914. weight: personalInfo.weight,
  10915. weightMetric: personalInfo.weightMetric,
  10916. age: personalInfo.age,
  10917. school: personalInfo.education,
  10918. birthPlace: personalInfo.birthPlace,
  10919. turnedPro: personalInfo.trndProYear,
  10920. countryCode: '',
  10921. country: ''
  10922. };
  10923. }
  10924. });
  10925. exports.default = PlayerBio;
  10926. });
  10927. /*jspath@0.3.3#lib/jspath*/
  10928. (function () {
  10929. var SYNTAX = {
  10930. PATH: 1,
  10931. SELECTOR: 2,
  10932. OBJ_PRED: 3,
  10933. POS_PRED: 4,
  10934. LOGICAL_EXPR: 5,
  10935. COMPARISON_EXPR: 6,
  10936. MATH_EXPR: 7,
  10937. CONCAT_EXPR: 8,
  10938. UNARY_EXPR: 9,
  10939. POS_EXPR: 10,
  10940. LITERAL: 11
  10941. };
  10942. var parse = function () {
  10943. var TOKEN = {
  10944. ID: 1,
  10945. NUM: 2,
  10946. STR: 3,
  10947. BOOL: 4,
  10948. PUNCT: 5,
  10949. EOP: 6
  10950. }, MESSAGES = {
  10951. UNEXP_TOKEN: 'Unexpected token "%0"',
  10952. UNEXP_EOP: 'Unexpected end of path'
  10953. };
  10954. var path, idx, buf, len;
  10955. function parse(_path) {
  10956. path = _path.split('');
  10957. idx = 0;
  10958. buf = null;
  10959. len = path.length;
  10960. var res = parsePathConcatExpr(), token = lex();
  10961. if (token.type !== TOKEN.EOP) {
  10962. throwUnexpected(token);
  10963. }
  10964. return res;
  10965. }
  10966. function parsePathConcatExpr() {
  10967. var expr = parsePathConcatPartExpr(), operands;
  10968. while (match('|')) {
  10969. lex();
  10970. (operands || (operands = [expr])).push(parsePathConcatPartExpr());
  10971. }
  10972. return operands ? {
  10973. type: SYNTAX.CONCAT_EXPR,
  10974. args: operands
  10975. } : expr;
  10976. }
  10977. function parsePathConcatPartExpr() {
  10978. return match('(') ? parsePathGroupExpr() : parsePath();
  10979. }
  10980. function parsePathGroupExpr() {
  10981. expect('(');
  10982. var expr = parsePathConcatExpr();
  10983. expect(')');
  10984. var parts = [], part;
  10985. while (part = parsePredicate()) {
  10986. parts.push(part);
  10987. }
  10988. if (!parts.length) {
  10989. return expr;
  10990. } else if (expr.type === SYNTAX.PATH) {
  10991. expr.parts = expr.parts.concat(parts);
  10992. return expr;
  10993. }
  10994. parts.unshift(expr);
  10995. return {
  10996. type: SYNTAX.PATH,
  10997. parts: parts
  10998. };
  10999. }
  11000. function parsePredicate() {
  11001. if (match('[')) {
  11002. return parsePosPredicate();
  11003. }
  11004. if (match('{')) {
  11005. return parseObjectPredicate();
  11006. }
  11007. if (match('(')) {
  11008. return parsePathGroupExpr();
  11009. }
  11010. }
  11011. function parsePath() {
  11012. if (!matchPath()) {
  11013. throwUnexpected(lex());
  11014. }
  11015. var fromRoot = false, subst;
  11016. if (match('^')) {
  11017. lex();
  11018. fromRoot = true;
  11019. } else if (matchSubst()) {
  11020. subst = lex().val.substr(1);
  11021. }
  11022. var parts = [], part;
  11023. while (part = parsePathPart()) {
  11024. parts.push(part);
  11025. }
  11026. return {
  11027. type: SYNTAX.PATH,
  11028. fromRoot: fromRoot,
  11029. subst: subst,
  11030. parts: parts
  11031. };
  11032. }
  11033. function parsePathPart() {
  11034. return matchSelector() ? parseSelector() : parsePredicate();
  11035. }
  11036. function parseSelector() {
  11037. var selector = lex().val, token = lookahead(), prop;
  11038. if (match('*') || token.type === TOKEN.ID || token.type === TOKEN.STR) {
  11039. prop = lex().val;
  11040. }
  11041. return {
  11042. type: SYNTAX.SELECTOR,
  11043. selector: selector,
  11044. prop: prop
  11045. };
  11046. }
  11047. function parsePosPredicate() {
  11048. expect('[');
  11049. var expr = parsePosExpr();
  11050. expect(']');
  11051. return {
  11052. type: SYNTAX.POS_PRED,
  11053. arg: expr
  11054. };
  11055. }
  11056. function parseObjectPredicate() {
  11057. expect('{');
  11058. var expr = parseLogicalORExpr();
  11059. expect('}');
  11060. return {
  11061. type: SYNTAX.OBJ_PRED,
  11062. arg: expr
  11063. };
  11064. }
  11065. function parseLogicalORExpr() {
  11066. var expr = parseLogicalANDExpr(), operands;
  11067. while (match('||')) {
  11068. lex();
  11069. (operands || (operands = [expr])).push(parseLogicalANDExpr());
  11070. }
  11071. return operands ? {
  11072. type: SYNTAX.LOGICAL_EXPR,
  11073. op: '||',
  11074. args: operands
  11075. } : expr;
  11076. }
  11077. function parseLogicalANDExpr() {
  11078. var expr = parseEqualityExpr(), operands;
  11079. while (match('&&')) {
  11080. lex();
  11081. (operands || (operands = [expr])).push(parseEqualityExpr());
  11082. }
  11083. return operands ? {
  11084. type: SYNTAX.LOGICAL_EXPR,
  11085. op: '&&',
  11086. args: operands
  11087. } : expr;
  11088. }
  11089. function parseEqualityExpr() {
  11090. var expr = parseRelationalExpr();
  11091. while (match('==') || match('!=') || match('===') || match('!==') || match('^=') || match('^==') || match('$==') || match('$=') || match('*==') || match('*=')) {
  11092. expr = {
  11093. type: SYNTAX.COMPARISON_EXPR,
  11094. op: lex().val,
  11095. args: [
  11096. expr,
  11097. parseEqualityExpr()
  11098. ]
  11099. };
  11100. }
  11101. return expr;
  11102. }
  11103. function parseRelationalExpr() {
  11104. var expr = parseAdditiveExpr();
  11105. while (match('<') || match('>') || match('<=') || match('>=')) {
  11106. expr = {
  11107. type: SYNTAX.COMPARISON_EXPR,
  11108. op: lex().val,
  11109. args: [
  11110. expr,
  11111. parseRelationalExpr()
  11112. ]
  11113. };
  11114. }
  11115. return expr;
  11116. }
  11117. function parseAdditiveExpr() {
  11118. var expr = parseMultiplicativeExpr();
  11119. while (match('+') || match('-')) {
  11120. expr = {
  11121. type: SYNTAX.MATH_EXPR,
  11122. op: lex().val,
  11123. args: [
  11124. expr,
  11125. parseMultiplicativeExpr()
  11126. ]
  11127. };
  11128. }
  11129. return expr;
  11130. }
  11131. function parseMultiplicativeExpr() {
  11132. var expr = parseUnaryExpr();
  11133. while (match('*') || match('/') || match('%')) {
  11134. expr = {
  11135. type: SYNTAX.MATH_EXPR,
  11136. op: lex().val,
  11137. args: [
  11138. expr,
  11139. parseMultiplicativeExpr()
  11140. ]
  11141. };
  11142. }
  11143. return expr;
  11144. }
  11145. function parsePosExpr() {
  11146. if (match(':')) {
  11147. lex();
  11148. return {
  11149. type: SYNTAX.POS_EXPR,
  11150. toIdx: parseUnaryExpr()
  11151. };
  11152. }
  11153. var fromExpr = parseUnaryExpr();
  11154. if (match(':')) {
  11155. lex();
  11156. if (match(']')) {
  11157. return {
  11158. type: SYNTAX.POS_EXPR,
  11159. fromIdx: fromExpr
  11160. };
  11161. }
  11162. return {
  11163. type: SYNTAX.POS_EXPR,
  11164. fromIdx: fromExpr,
  11165. toIdx: parseUnaryExpr()
  11166. };
  11167. }
  11168. return {
  11169. type: SYNTAX.POS_EXPR,
  11170. idx: fromExpr
  11171. };
  11172. }
  11173. function parseUnaryExpr() {
  11174. if (match('!') || match('-')) {
  11175. return {
  11176. type: SYNTAX.UNARY_EXPR,
  11177. op: lex().val,
  11178. arg: parseUnaryExpr()
  11179. };
  11180. }
  11181. return parsePrimaryExpr();
  11182. }
  11183. function parsePrimaryExpr() {
  11184. var token = lookahead(), type = token.type;
  11185. if (type === TOKEN.STR || type === TOKEN.NUM || type === TOKEN.BOOL) {
  11186. return {
  11187. type: SYNTAX.LITERAL,
  11188. val: lex().val
  11189. };
  11190. }
  11191. if (matchPath()) {
  11192. return parsePath();
  11193. }
  11194. if (match('(')) {
  11195. return parseGroupExpr();
  11196. }
  11197. return throwUnexpected(lex());
  11198. }
  11199. function parseGroupExpr() {
  11200. expect('(');
  11201. var expr = parseLogicalORExpr();
  11202. expect(')');
  11203. return expr;
  11204. }
  11205. function match(val) {
  11206. var token = lookahead();
  11207. return token.type === TOKEN.PUNCT && token.val === val;
  11208. }
  11209. function matchPath() {
  11210. return matchSelector() || matchSubst() || match('^');
  11211. }
  11212. function matchSelector() {
  11213. var token = lookahead();
  11214. if (token.type === TOKEN.PUNCT) {
  11215. var val = token.val;
  11216. return val === '.' || val === '..';
  11217. }
  11218. return false;
  11219. }
  11220. function matchSubst() {
  11221. var token = lookahead();
  11222. return token.type === TOKEN.ID && token.val[0] === '$';
  11223. }
  11224. function expect(val) {
  11225. var token = lex();
  11226. if (token.type !== TOKEN.PUNCT || token.val !== val) {
  11227. throwUnexpected(token);
  11228. }
  11229. }
  11230. function lookahead() {
  11231. if (buf !== null) {
  11232. return buf;
  11233. }
  11234. var pos = idx;
  11235. buf = advance();
  11236. idx = pos;
  11237. return buf;
  11238. }
  11239. function advance() {
  11240. while (isWhiteSpace(path[idx])) {
  11241. ++idx;
  11242. }
  11243. if (idx >= len) {
  11244. return {
  11245. type: TOKEN.EOP,
  11246. range: [
  11247. idx,
  11248. idx
  11249. ]
  11250. };
  11251. }
  11252. var token = scanPunctuator();
  11253. if (token || (token = scanId()) || (token = scanString()) || (token = scanNumeric())) {
  11254. return token;
  11255. }
  11256. token = {
  11257. range: [
  11258. idx,
  11259. idx
  11260. ]
  11261. };
  11262. idx >= len ? token.type = TOKEN.EOP : token.val = path[idx];
  11263. throwUnexpected(token);
  11264. }
  11265. function lex() {
  11266. var token;
  11267. if (buf) {
  11268. idx = buf.range[1];
  11269. token = buf;
  11270. buf = null;
  11271. return token;
  11272. }
  11273. return advance();
  11274. }
  11275. function isDigit(ch) {
  11276. return '0123456789'.indexOf(ch) >= 0;
  11277. }
  11278. function isWhiteSpace(ch) {
  11279. return ch === ' ';
  11280. }
  11281. function isIdStart(ch) {
  11282. return ch === '$' || ch === '@' || ch === '_' || ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z';
  11283. }
  11284. function isIdPart(ch) {
  11285. return isIdStart(ch) || ch >= '0' && ch <= '9';
  11286. }
  11287. function scanId() {
  11288. var ch = path[idx];
  11289. if (!isIdStart(ch)) {
  11290. return;
  11291. }
  11292. var start = idx, id = ch;
  11293. while (++idx < len) {
  11294. ch = path[idx];
  11295. if (!isIdPart(ch)) {
  11296. break;
  11297. }
  11298. id += ch;
  11299. }
  11300. return id === 'true' || id === 'false' ? {
  11301. type: TOKEN.BOOL,
  11302. val: id === 'true',
  11303. range: [
  11304. start,
  11305. idx
  11306. ]
  11307. } : {
  11308. type: TOKEN.ID,
  11309. val: id,
  11310. range: [
  11311. start,
  11312. idx
  11313. ]
  11314. };
  11315. }
  11316. function scanString() {
  11317. if (path[idx] !== '"') {
  11318. return;
  11319. }
  11320. var start = ++idx, str = '', eosFound = false, ch;
  11321. while (idx < len) {
  11322. ch = path[idx++];
  11323. if (ch === '\\') {
  11324. ch = path[idx++];
  11325. } else if (ch === '"') {
  11326. eosFound = true;
  11327. break;
  11328. }
  11329. str += ch;
  11330. }
  11331. if (eosFound) {
  11332. return {
  11333. type: TOKEN.STR,
  11334. val: str,
  11335. range: [
  11336. start,
  11337. idx
  11338. ]
  11339. };
  11340. }
  11341. }
  11342. function scanNumeric() {
  11343. var start = idx, ch = path[idx], isFloat = ch === '.';
  11344. if (isFloat || isDigit(ch)) {
  11345. var num = ch;
  11346. while (++idx < len) {
  11347. ch = path[idx];
  11348. if (ch === '.') {
  11349. if (isFloat) {
  11350. return;
  11351. }
  11352. isFloat = true;
  11353. } else if (!isDigit(ch)) {
  11354. break;
  11355. }
  11356. num += ch;
  11357. }
  11358. return {
  11359. type: TOKEN.NUM,
  11360. val: isFloat ? parseFloat(num) : parseInt(num, 10),
  11361. range: [
  11362. start,
  11363. idx
  11364. ]
  11365. };
  11366. }
  11367. }
  11368. function scanPunctuator() {
  11369. var start = idx, ch1 = path[idx], ch2 = path[idx + 1];
  11370. if (ch1 === '.') {
  11371. if (isDigit(ch2)) {
  11372. return;
  11373. }
  11374. return path[++idx] === '.' ? {
  11375. type: TOKEN.PUNCT,
  11376. val: '..',
  11377. range: [
  11378. start,
  11379. ++idx
  11380. ]
  11381. } : {
  11382. type: TOKEN.PUNCT,
  11383. val: '.',
  11384. range: [
  11385. start,
  11386. idx
  11387. ]
  11388. };
  11389. }
  11390. if (ch2 === '=') {
  11391. var ch3 = path[idx + 2];
  11392. if (ch3 === '=') {
  11393. if ('=!^$*'.indexOf(ch1) >= 0) {
  11394. return {
  11395. type: TOKEN.PUNCT,
  11396. val: ch1 + ch2 + ch3,
  11397. range: [
  11398. start,
  11399. idx += 3
  11400. ]
  11401. };
  11402. }
  11403. } else if ('=!^$*><'.indexOf(ch1) >= 0) {
  11404. return {
  11405. type: TOKEN.PUNCT,
  11406. val: ch1 + ch2,
  11407. range: [
  11408. start,
  11409. idx += 2
  11410. ]
  11411. };
  11412. }
  11413. }
  11414. if (ch1 === ch2 && (ch1 === '|' || ch1 === '&')) {
  11415. return {
  11416. type: TOKEN.PUNCT,
  11417. val: ch1 + ch2,
  11418. range: [
  11419. start,
  11420. idx += 2
  11421. ]
  11422. };
  11423. }
  11424. if (':{}()[]^+-*/%!><|'.indexOf(ch1) >= 0) {
  11425. return {
  11426. type: TOKEN.PUNCT,
  11427. val: ch1,
  11428. range: [
  11429. start,
  11430. ++idx
  11431. ]
  11432. };
  11433. }
  11434. }
  11435. function throwUnexpected(token) {
  11436. if (token.type === TOKEN.EOP) {
  11437. throwError(token, MESSAGES.UNEXP_EOP);
  11438. }
  11439. throwError(token, MESSAGES.UNEXP_TOKEN, token.val);
  11440. }
  11441. function throwError(token, messageFormat) {
  11442. var args = Array.prototype.slice.call(arguments, 2), msg = messageFormat.replace(/%(\d)/g, function (_, idx) {
  11443. return args[idx] || '';
  11444. }), error = new Error(msg);
  11445. error.column = token.range[0];
  11446. throw error;
  11447. }
  11448. return parse;
  11449. }();
  11450. var translate = function () {
  11451. var body, vars, lastVarId, unusedVars;
  11452. function acquireVar() {
  11453. if (unusedVars.length) {
  11454. return unusedVars.shift();
  11455. }
  11456. var varName = 'v' + ++lastVarId;
  11457. vars.push(varName);
  11458. return varName;
  11459. }
  11460. function releaseVars() {
  11461. var args = arguments, i = args.length;
  11462. while (i--) {
  11463. unusedVars.push(args[i]);
  11464. }
  11465. }
  11466. function translate(ast) {
  11467. body = [];
  11468. vars = ['res'];
  11469. lastVarId = 0;
  11470. unusedVars = [];
  11471. translateExpr(ast, 'res', 'data');
  11472. body.unshift('var ', Array.isArray ? 'isArr = Array.isArray' : 'toStr = Object.prototype.toString, isArr = function(o) { return toStr.call(o) === "[object Array]"; }', ', concat = Array.prototype.concat', ',', vars.join(','), ';');
  11473. if (ast.type === SYNTAX.PATH) {
  11474. var lastPart = ast.parts[ast.parts.length - 1];
  11475. if (lastPart && lastPart.type === SYNTAX.POS_PRED && 'idx' in lastPart.arg) {
  11476. body.push('res = res[0];');
  11477. }
  11478. }
  11479. body.push('return res;');
  11480. return body.join('');
  11481. }
  11482. function translatePath(path, dest, ctx) {
  11483. var parts = path.parts, i = 0, len = parts.length;
  11484. body.push(dest, '=', path.fromRoot ? 'data' : path.subst ? 'subst.' + path.subst : ctx, ';', 'isArr(' + dest + ') || (' + dest + ' = [' + dest + ']);');
  11485. while (i < len) {
  11486. var item = parts[i++];
  11487. switch (item.type) {
  11488. case SYNTAX.SELECTOR:
  11489. item.selector === '..' ? translateDescendantSelector(item, dest, dest) : translateSelector(item, dest, dest);
  11490. break;
  11491. case SYNTAX.OBJ_PRED:
  11492. translateObjectPredicate(item, dest, dest);
  11493. break;
  11494. case SYNTAX.POS_PRED:
  11495. translatePosPredicate(item, dest, dest);
  11496. break;
  11497. case SYNTAX.CONCAT_EXPR:
  11498. translateConcatExpr(item, dest, dest);
  11499. break;
  11500. }
  11501. }
  11502. }
  11503. function translateSelector(sel, dest, ctx) {
  11504. if (sel.prop) {
  11505. var propStr = escapeStr(sel.prop), res = acquireVar(), i = acquireVar(), len = acquireVar(), curCtx = acquireVar(), j = acquireVar(), val = acquireVar(), tmpArr = acquireVar();
  11506. body.push(res, '= [];', i, '= 0;', len, '=', ctx, '.length;', tmpArr, '= [];', 'while(', i, '<', len, ') {', curCtx, '=', ctx, '[', i, '++];', 'if(', curCtx, '!= null) {');
  11507. if (sel.prop === '*') {
  11508. body.push('if(typeof ', curCtx, '=== "object") {', 'if(isArr(', curCtx, ')) {', res, '=', res, '.concat(', curCtx, ');', '}', 'else {', 'for(', j, ' in ', curCtx, ') {', 'if(', curCtx, '.hasOwnProperty(', j, ')) {', val, '=', curCtx, '[', j, '];');
  11509. inlineAppendToArray(res, val);
  11510. body.push('}', '}', '}', '}');
  11511. } else {
  11512. body.push(val, '=', curCtx, '[', propStr, '];');
  11513. inlineAppendToArray(res, val, tmpArr, len);
  11514. }
  11515. body.push('}', '}', dest, '=', len, '> 1 &&', tmpArr, '.length?', tmpArr, '.length > 1?', 'concat.apply(', res, ',', tmpArr, ') :', res, '.concat(', tmpArr, '[0]) :', res, ';');
  11516. releaseVars(res, i, len, curCtx, j, val, tmpArr);
  11517. }
  11518. }
  11519. function translateDescendantSelector(sel, dest, baseCtx) {
  11520. var prop = sel.prop, ctx = acquireVar(), curCtx = acquireVar(), childCtxs = acquireVar(), i = acquireVar(), j = acquireVar(), val = acquireVar(), len = acquireVar(), res = acquireVar();
  11521. body.push(ctx, '=', baseCtx, '.slice(),', res, '= [];', 'while(', ctx, '.length) {', curCtx, '=', ctx, '.shift();');
  11522. prop ? body.push('if(typeof ', curCtx, '=== "object" &&', curCtx, ') {') : body.push('if(typeof ', curCtx, '!= null) {');
  11523. body.push(childCtxs, '= [];', 'if(isArr(', curCtx, ')) {', i, '= 0,', len, '=', curCtx, '.length;', 'while(', i, '<', len, ') {', val, '=', curCtx, '[', i, '++];');
  11524. prop && body.push('if(typeof ', val, '=== "object") {');
  11525. inlineAppendToArray(childCtxs, val);
  11526. prop && body.push('}');
  11527. body.push('}', '}', 'else {');
  11528. if (prop) {
  11529. if (prop !== '*') {
  11530. body.push(val, '=', curCtx, '["' + prop + '"];');
  11531. inlineAppendToArray(res, val);
  11532. }
  11533. } else {
  11534. inlineAppendToArray(res, curCtx);
  11535. body.push('if(typeof ', curCtx, '=== "object") {');
  11536. }
  11537. body.push('for(', j, ' in ', curCtx, ') {', 'if(', curCtx, '.hasOwnProperty(', j, ')) {', val, '=', curCtx, '[', j, '];');
  11538. inlineAppendToArray(childCtxs, val);
  11539. prop === '*' && inlineAppendToArray(res, val);
  11540. body.push('}', '}');
  11541. prop || body.push('}');
  11542. body.push('}', childCtxs, '.length &&', ctx, '.unshift.apply(', ctx, ',', childCtxs, ');', '}', '}', dest, '=', res, ';');
  11543. releaseVars(ctx, curCtx, childCtxs, i, j, val, len, res);
  11544. }
  11545. function translateObjectPredicate(expr, dest, ctx) {
  11546. var resVar = acquireVar(), i = acquireVar(), len = acquireVar(), cond = acquireVar(), curItem = acquireVar();
  11547. body.push(resVar, '= [];', i, '= 0;', len, '=', ctx, '.length;', 'while(', i, '<', len, ') {', curItem, '=', ctx, '[', i, '++];');
  11548. translateExpr(expr.arg, cond, curItem);
  11549. body.push(convertToBool(expr.arg, cond), '&&', resVar, '.push(', curItem, ');', '}', dest, '=', resVar, ';');
  11550. releaseVars(resVar, i, len, curItem, cond);
  11551. }
  11552. function translatePosPredicate(item, dest, ctx) {
  11553. var arrayExpr = item.arg, fromIdx, toIdx;
  11554. if (arrayExpr.idx) {
  11555. var idx = acquireVar();
  11556. translateExpr(arrayExpr.idx, idx, ctx);
  11557. body.push(idx, '< 0 && (', idx, '=', ctx, '.length +', idx, ');', dest, '=', ctx, '[', idx, '] == null? [] : [', ctx, '[', idx, ']];');
  11558. releaseVars(idx);
  11559. return false;
  11560. } else if (arrayExpr.fromIdx) {
  11561. if (arrayExpr.toIdx) {
  11562. translateExpr(arrayExpr.fromIdx, fromIdx = acquireVar(), ctx);
  11563. translateExpr(arrayExpr.toIdx, toIdx = acquireVar(), ctx);
  11564. body.push(dest, '=', ctx, '.slice(', fromIdx, ',', toIdx, ');');
  11565. releaseVars(fromIdx, toIdx);
  11566. } else {
  11567. translateExpr(arrayExpr.fromIdx, fromIdx = acquireVar(), ctx);
  11568. body.push(dest, '=', ctx, '.slice(', fromIdx, ');');
  11569. releaseVars(fromIdx);
  11570. }
  11571. } else {
  11572. translateExpr(arrayExpr.toIdx, toIdx = acquireVar(), ctx);
  11573. body.push(dest, '=', ctx, '.slice(0,', toIdx, ');');
  11574. releaseVars(toIdx);
  11575. }
  11576. }
  11577. function translateExpr(expr, dest, ctx) {
  11578. switch (expr.type) {
  11579. case SYNTAX.PATH:
  11580. translatePath(expr, dest, ctx);
  11581. break;
  11582. case SYNTAX.CONCAT_EXPR:
  11583. translateConcatExpr(expr, dest, ctx);
  11584. break;
  11585. case SYNTAX.COMPARISON_EXPR:
  11586. translateComparisonExpr(expr, dest, ctx);
  11587. break;
  11588. case SYNTAX.MATH_EXPR:
  11589. translateMathExpr(expr, dest, ctx);
  11590. break;
  11591. case SYNTAX.LOGICAL_EXPR:
  11592. translateLogicalExpr(expr, dest, ctx);
  11593. break;
  11594. case SYNTAX.UNARY_EXPR:
  11595. translateUnaryExpr(expr, dest, ctx);
  11596. break;
  11597. case SYNTAX.LITERAL:
  11598. var val = expr.val;
  11599. body.push(dest, '=', typeof val === 'string' ? escapeStr(val) : val, ';');
  11600. break;
  11601. }
  11602. }
  11603. function translateComparisonExpr(expr, dest, ctx) {
  11604. var val1 = acquireVar(), val2 = acquireVar(), isVal1Array = acquireVar(), isVal2Array = acquireVar(), i = acquireVar(), j = acquireVar(), len1 = acquireVar(), len2 = acquireVar(), leftArg = expr.args[0], rightArg = expr.args[1];
  11605. body.push(dest, '= false;');
  11606. translateExpr(leftArg, val1, ctx);
  11607. translateExpr(rightArg, val2, ctx);
  11608. var isLeftArgPath = leftArg.type === SYNTAX.PATH, isRightArgLiteral = rightArg.type === SYNTAX.LITERAL;
  11609. body.push(isVal1Array, '=');
  11610. isLeftArgPath ? body.push('true;') : body.push('isArr(', val1, ');');
  11611. body.push(isVal2Array, '=');
  11612. isRightArgLiteral ? body.push('false;') : body.push('isArr(', val2, ');');
  11613. body.push('if(');
  11614. isLeftArgPath || body.push(isVal1Array, '&&');
  11615. body.push(val1, '.length === 1) {', val1, '=', val1, '[0];', isVal1Array, '= false;', '}');
  11616. isRightArgLiteral || body.push('if(', isVal2Array, '&&', val2, '.length === 1) {', val2, '=', val2, '[0];', isVal2Array, '= false;', '}');
  11617. body.push(i, '= 0;', 'if(', isVal1Array, ') {', len1, '=', val1, '.length;');
  11618. if (!isRightArgLiteral) {
  11619. body.push('if(', isVal2Array, ') {', len2, '=', val2, '.length;', 'while(', i, '<', len1, '&& !', dest, ') {', j, '= 0;', 'while(', j, '<', len2, ') {');
  11620. writeCondition(expr.op, [
  11621. val1,
  11622. '[',
  11623. i,
  11624. ']'
  11625. ].join(''), [
  11626. val2,
  11627. '[',
  11628. j,
  11629. ']'
  11630. ].join(''));
  11631. body.push(dest, '= true;', 'break;', '}', '++', j, ';', '}', '++', i, ';', '}', '}', 'else {');
  11632. }
  11633. body.push('while(', i, '<', len1, ') {');
  11634. writeCondition(expr.op, [
  11635. val1,
  11636. '[',
  11637. i,
  11638. ']'
  11639. ].join(''), val2);
  11640. body.push(dest, '= true;', 'break;', '}', '++', i, ';', '}');
  11641. isRightArgLiteral || body.push('}');
  11642. body.push('}');
  11643. if (!isRightArgLiteral) {
  11644. body.push('else if(', isVal2Array, ') {', len2, '=', val2, '.length;', 'while(', i, '<', len2, ') {');
  11645. writeCondition(expr.op, val1, [
  11646. val2,
  11647. '[',
  11648. i,
  11649. ']'
  11650. ].join(''));
  11651. body.push(dest, '= true;', 'break;', '}', '++', i, ';', '}', '}');
  11652. }
  11653. body.push('else {', dest, '=', binaryOperators[expr.op](val1, val2), ';', '}');
  11654. releaseVars(val1, val2, isVal1Array, isVal2Array, i, j, len1, len2);
  11655. }
  11656. function writeCondition(op, val1Expr, val2Expr) {
  11657. body.push('if(', binaryOperators[op](val1Expr, val2Expr), ') {');
  11658. }
  11659. function translateLogicalExpr(expr, dest, ctx) {
  11660. var conditionVars = [], args = expr.args, len = args.length, i = 0, val;
  11661. body.push(dest, '= false;');
  11662. switch (expr.op) {
  11663. case '&&':
  11664. while (i < len) {
  11665. conditionVars.push(val = acquireVar());
  11666. translateExpr(args[i], val, ctx);
  11667. body.push('if(', convertToBool(args[i++], val), ') {');
  11668. }
  11669. body.push(dest, '= true;');
  11670. break;
  11671. case '||':
  11672. while (i < len) {
  11673. conditionVars.push(val = acquireVar());
  11674. translateExpr(args[i], val, ctx);
  11675. body.push('if(', convertToBool(args[i], val), ') {', dest, '= true;', '}');
  11676. if (i++ + 1 < len) {
  11677. body.push('else {');
  11678. }
  11679. }
  11680. --len;
  11681. break;
  11682. }
  11683. while (len--) {
  11684. body.push('}');
  11685. }
  11686. releaseVars.apply(null, conditionVars);
  11687. }
  11688. function translateMathExpr(expr, dest, ctx) {
  11689. var val1 = acquireVar(), val2 = acquireVar(), args = expr.args;
  11690. translateExpr(args[0], val1, ctx);
  11691. translateExpr(args[1], val2, ctx);
  11692. body.push(dest, '=', binaryOperators[expr.op](convertToSingleValue(args[0], val1), convertToSingleValue(args[1], val2)), ';');
  11693. releaseVars(val1, val2);
  11694. }
  11695. function translateUnaryExpr(expr, dest, ctx) {
  11696. var val = acquireVar(), arg = expr.arg;
  11697. translateExpr(arg, val, ctx);
  11698. switch (expr.op) {
  11699. case '!':
  11700. body.push(dest, '= !', convertToBool(arg, val) + ';');
  11701. break;
  11702. case '-':
  11703. body.push(dest, '= -', convertToSingleValue(arg, val) + ';');
  11704. break;
  11705. }
  11706. releaseVars(val);
  11707. }
  11708. function translateConcatExpr(expr, dest, ctx) {
  11709. var argVars = [], args = expr.args, len = args.length, i = 0;
  11710. while (i < len) {
  11711. argVars.push(acquireVar());
  11712. translateExpr(args[i], argVars[i++], ctx);
  11713. }
  11714. body.push(dest, '= concat.call(', argVars.join(','), ');');
  11715. releaseVars.apply(null, argVars);
  11716. }
  11717. function escapeStr(s) {
  11718. return '\'' + s.replace(/\\/g, '\\\\').replace(/'/g, '\\\'') + '\'';
  11719. }
  11720. function inlineAppendToArray(res, val, tmpArr, len) {
  11721. body.push('if(', val, '!= null) {', 'if(isArr(', val, ')) {');
  11722. if (tmpArr) {
  11723. body.push(len, '> 1?');
  11724. inlinePushToArray(tmpArr, val);
  11725. body.push(':');
  11726. }
  11727. body.push(res, '=', res, '.length?', res, '.concat(', val, ') :', val, '.slice()', ';', '}', 'else {');
  11728. tmpArr && body.push('if(', tmpArr, '.length) {', res, '= concat.apply(', res, ',', tmpArr, ');', tmpArr, '= [];', '}');
  11729. inlinePushToArray(res, val);
  11730. body.push(';', '}', '}');
  11731. }
  11732. function inlinePushToArray(res, val) {
  11733. body.push(res, '.length?', res, '.push(', val, ') :', res, '[0] =', val);
  11734. }
  11735. function convertToBool(arg, varName) {
  11736. switch (arg.type) {
  11737. case SYNTAX.LOGICAL_EXPR:
  11738. return varName;
  11739. case SYNTAX.LITERAL:
  11740. return '!!' + varName;
  11741. case SYNTAX.PATH:
  11742. return varName + '.length > 0';
  11743. default:
  11744. return [
  11745. '(typeof ',
  11746. varName,
  11747. '=== "boolean"?',
  11748. varName,
  11749. ':',
  11750. 'isArr(',
  11751. varName,
  11752. ')?',
  11753. varName,
  11754. '.length > 0 : !!',
  11755. varName,
  11756. ')'
  11757. ].join('');
  11758. }
  11759. }