{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n \n )\n },\n})\n"}}},{"rowIdx":79901,"cells":{"target":{"kind":"string","value":"ajax/libs/react-inlinesvg/0.5.1/react-inlinesvg.min.js"},"feat_repo_name":{"kind":"string","value":"holtkamp/cdnjs"},"text":{"kind":"string","value":"!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{var t;t=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:this,t.ReactInlineSVG=e()}}(function(){return function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u=\"function\"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error(\"Cannot find module '\"+a+\"'\");throw c.code=\"MODULE_NOT_FOUND\",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return o(n?n:e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var i=\"function\"==typeof require&&require,a=0;a2?n-2:0),o=2;o=400}var o=e(\"./request\"),i=e(\"./utils/extractResponseProps\");r.prototype.header=o.prototype.header,r.fromRequest=function(e){return new r(i(e))},t.exports=r},{\"./request\":14,\"./utils/extractResponseProps\":17}],16:[function(e,t,n){\"use strict\";t.exports=function(e){return function(){var t=Array.prototype.slice.call(arguments,0),n=function(){return e.apply(null,t)};setTimeout(n,0)}}},{}],17:[function(e,t,n){\"use strict\";var r=e(\"xtend\");t.exports=function(e){var t=e.xhr,n={request:e,xhr:t};try{var o,i,a,s={};if(t.getAllResponseHeaders)for(o=t.getAllResponseHeaders().split(\"\\n\"),i=0;i1)for(var n=1;n1?s-1:0),c=1;c0&&(\"production\"!==n.env.NODE_ENV?l(!g,\"There is an internal error in the React performance measurement code. Did not expect %s timer to start while %s timer is still in progress for %s instance.\",t,g||\"no\",e===b?\"the same\":\"another\"):void 0,E=c(),b=e,g=t)},onEndLifeCycleTimer:function(e,t){s(e),\"production\"!==n.env.NODE_ENV&&d&&v>0&&(\"production\"!==n.env.NODE_ENV?l(g===t,\"There is an internal error in the React performance measurement code. We did not expect %s timer to stop while %s timer is still in progress for %s instance. Please report this as a bug in React.\",t,g||\"no\",e===b?\"the same\":\"another\"):void 0,\ny.push({timerType:t,instanceID:e,duration:c()-E}),E=null,b=null,g=null),r(\"onEndLifeCycleTimer\",e,t)},onBeginReconcilerTimer:function(e,t){s(e),r(\"onBeginReconcilerTimer\",e,t)},onEndReconcilerTimer:function(e,t){s(e),r(\"onEndReconcilerTimer\",e,t)},onBeginProcessingChildContext:function(){r(\"onBeginProcessingChildContext\")},onEndProcessingChildContext:function(){r(\"onEndProcessingChildContext\")},onNativeOperation:function(e,t,n){s(e),r(\"onNativeOperation\",e,t,n)},onSetState:function(){r(\"onSetState\")},onSetDisplayName:function(e,t){s(e),r(\"onSetDisplayName\",e,t)},onSetChildren:function(e,t){s(e),r(\"onSetChildren\",e,t)},onSetOwner:function(e,t){s(e),r(\"onSetOwner\",e,t)},onSetText:function(e,t){s(e),r(\"onSetText\",e,t)},onMountRootComponent:function(e){s(e),r(\"onMountRootComponent\",e)},onMountComponent:function(e){s(e),r(\"onMountComponent\",e)},onUpdateComponent:function(e){s(e),r(\"onUpdateComponent\",e)},onUnmountComponent:function(e){s(e),r(\"onUnmountComponent\",e)}};if(\"production\"!==n.env.NODE_ENV){var w=e(\"./ReactInvalidSetStateWarningDevTool\"),_=e(\"./ReactNativeOperationHistoryDevtool\"),O=e(\"./ReactComponentTreeDevtool\");N.addDevtool(w),N.addDevtool(O),N.addDevtool(_);var D=u.canUseDOM&&window.location.href||\"\";/[?&]react_perf\\b/.test(D)&&N.beginProfiling()}t.exports=N}).call(this,e(\"_process\"))},{\"./ReactComponentTreeDevtool\":30,\"./ReactInvalidSetStateWarningDevTool\":37,\"./ReactNativeOperationHistoryDevtool\":38,_process:23,\"fbjs/lib/ExecutionEnvironment\":1,\"fbjs/lib/performanceNow\":9,\"fbjs/lib/warning\":11}],34:[function(e,t,n){(function(n){\"use strict\";var r,o,i=e(\"object-assign\"),a=e(\"./ReactCurrentOwner\"),s=e(\"fbjs/lib/warning\"),u=e(\"./canDefineProperty\"),c=\"function\"==typeof Symbol&&Symbol.for&&Symbol.for(\"react.element\")||60103,l={key:!0,ref:!0,__self:!0,__source:!0},p=function(e,t,r,o,i,a,s){var l={$$typeof:c,type:e,key:t,ref:r,props:s,_owner:a};return\"production\"!==n.env.NODE_ENV&&(l._store={},u?(Object.defineProperty(l._store,\"validated\",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,\"_self\",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(l,\"_source\",{configurable:!1,enumerable:!1,writable:!1,value:i})):(l._store.validated=!1,l._self=o,l._source=i),Object.freeze&&(Object.freeze(l.props),Object.freeze(l))),l};p.createElement=function(e,t,i){var u,f={},d=null,h=null,v=null,y=null;if(null!=t){\"production\"!==n.env.NODE_ENV?(\"production\"!==n.env.NODE_ENV?s(null==t.__proto__||t.__proto__===Object.prototype,\"React.createElement(...): Expected props argument to be a plain object. Properties defined in its prototype chain will be ignored.\"):void 0,h=!t.hasOwnProperty(\"ref\")||Object.getOwnPropertyDescriptor(t,\"ref\").get?null:t.ref,d=!t.hasOwnProperty(\"key\")||Object.getOwnPropertyDescriptor(t,\"key\").get?null:\"\"+t.key):(h=void 0===t.ref?null:t.ref,d=void 0===t.key?null:\"\"+t.key),v=void 0===t.__self?null:t.__self,y=void 0===t.__source?null:t.__source;for(u in t)t.hasOwnProperty(u)&&!l.hasOwnProperty(u)&&(f[u]=t[u])}var m=arguments.length-2;if(1===m)f.children=i;else if(m>1){for(var b=Array(m),E=0;E1){for(var b=Array(m),E=0;E.\")}var a=m[e]||(m[e]={});if(a[o])return null;a[o]=!0;var s={parentOrOwner:o,url:\" See https://fb.me/react-warning-keys for more information.\",childOwner:null};return t&&t._owner&&t._owner!==f.current&&(s.childOwner=\" It was passed a child from \"+t._owner.getName()+\".\"),s}function a(e,t){if(\"object\"==typeof e)if(Array.isArray(e))for(var n=0;n>\",O={array:i(\"array\"),bool:i(\"boolean\"),func:i(\"function\"),number:i(\"number\"),object:i(\"object\"),string:i(\"string\"),any:a(),arrayOf:s,element:u(),instanceOf:c,node:d(),objectOf:p,oneOf:l,oneOfType:f,shape:h};t.exports=O},{\"./ReactElement\":34,\"./ReactPropTypeLocationNames\":40,\"./getIteratorFn\":45,\"fbjs/lib/emptyFunction\":2}],43:[function(e,t,n){\"use strict\";t.exports=\"15.1.0\"},{}],44:[function(e,t,n){(function(e){\"use strict\";var n=!1;if(\"production\"!==e.env.NODE_ENV)try{Object.defineProperty({},\"x\",{get:function(){}}),n=!0}catch(e){}t.exports=n}).call(this,e(\"_process\"))},{_process:23}],45:[function(e,t,n){\"use strict\";function r(e){var t=e&&(o&&e[o]||e[i]);if(\"function\"==typeof t)return t}var o=\"function\"==typeof Symbol&&Symbol.iterator,i=\"@@iterator\";t.exports=r},{}],46:[function(e,t,n){(function(n){\"use strict\";function r(e){return o.isValidElement(e)?void 0:\"production\"!==n.env.NODE_ENV?i(!1,\"onlyChild must be passed a children with exactly one child.\"):i(!1),e}var o=e(\"./ReactElement\"),i=e(\"fbjs/lib/invariant\");t.exports=r}).call(this,e(\"_process\"))},{\"./ReactElement\":34,_process:23,\"fbjs/lib/invariant\":4}],47:[function(e,t,n){(function(n){\"use strict\";function r(e,t){return e&&\"object\"==typeof e&&null!=e.key?l.escape(e.key):t.toString(36)}function o(e,t,i,v){var y=typeof e;if(\"undefined\"!==y&&\"boolean\"!==y||(e=null),null===e||\"string\"===y||\"number\"===y||s.isValidElement(e))return i(v,e,\"\"===t?f+r(e,0):t),1;var m,b,E=0,g=\"\"===t?f:t+d;if(Array.isArray(e))for(var N=0;N\",e.firstChild&&\"http://www.w3.org/2000/svg\"===e.firstChild.namespaceURI}),g=(0,p.default)(function(){return((\"undefined\"!=typeof window&&null!==window?window.XMLHttpRequest:void 0)||(\"undefined\"!=typeof window&&null!==window?window.XDomainRequest:void 0))&&E()}),N=function(){var e=function(e){return\"(?:(?:\\\\s|\\\\:)\"+e+\")\"},t=new RegExp(\"(?:(\"+e(\"id\")+')=\"([^\"]+)\")|(?:('+e(\"href\")+\"|\"+e(\"role\")+\"|\"+e(\"arcrole\")+')=\"\\\\#([^\"]+)\")|(?:=\"url\\\\(\\\\#([^\\\\)]+)\\\\)\")',\"g\");return function(e,n){var r=function(e){return e+\"___\"+n};return e.replace(t,function(e,t,n,o,i,a){return n?t+'=\"'+r(n)+'\"':i?o+'=\"#'+r(i)+'\"':a?'=\"url(#'+r(a)+')\"':void 0})}}(),w=function(e){var t=void 0,n=0,r=void 0,o=void 0,i=void 0;if(!e)return n;for(r=0,o=0,i=e.length;i<=0?oi;r=i<=0?++o:--o)t=e.charCodeAt(r),n=(n<<5)-n+t,n&=n;return n},_=function(e){function t(e){var n;o(this,t);var r=i(this,Object.getPrototypeOf(t).call(this));return r.name=\"InlineSVGError\",r.isSupportedBrowser=!0,r.isConfigurationError=!1,r.isUnsupportedBrowserError=!1,r.message=e,n=r,i(r,n)}return a(t,e),t}(Error),O=function(e,t){var n=new _(e);return Object.keys(t).forEach(function(e){n[e]=t[e]}),n},D=function(e){var t=e;return null===t&&(t=\"Unsupported Browser\"),O(t,{isSupportedBrowser:!1,isUnsupportedBrowserError:!0})},R=function(e){return O(e,{isConfigurationError:!0})},x=function(e){function t(e){o(this,t);var n=i(this,Object.getPrototypeOf(t).call(this,e));return n.shouldComponentUpdate=y.shouldComponentUpdate,n.state={status:b.PENDING},n.handleLoad=n.handleLoad.bind(n),n}return a(t,e),s(t,[{key:\"componentWillMount\",value:function(){this.state.status===b.PENDING&&(this.props.supportTest()?this.props.src?this.setState({status:b.LOADING},this.load):this.fail(R(\"Missing source\")):this.fail(D()))}},{key:\"fail\",value:function(e){var t=this,n=e.isUnsupportedBrowserError?b.UNSUPPORTED:b.FAILED;this.setState({status:n},function(){\"function\"==typeof t.props.onError&&t.props.onError(e)})}},{key:\"handleLoad\",value:function(e,t){var n=this;return e?void this.fail(e):void this.setState({loadedText:t.text,status:b.LOADED},function(){return\"function\"==typeof n.props.onLoad?n.props.onLoad():null})}},{key:\"load\",value:function(){var e=this.props.src.match(/data:image\\/svg[^,]*?(;base64)?,(.*)/);return e?this.handleLoad(null,{text:e[1]?atob(e[2]):decodeURIComponent(e[2])}):m.get(this.props.src,this.handleLoad)}},{key:\"getClassName\",value:function(){var e=\"isvg \"+this.state.status;return this.props.className&&(e+=\" \"+this.props.className),e}},{key:\"processSVG\",value:function(e){return this.props.uniquifyIDs?N(e,w(this.props.src)):e}},{key:\"renderContents\",value:function(){switch(this.state.status){case b.UNSUPPORTED:return this.props.children;default:return this.props.preloader}}},{key:\"render\",value:function(){return this.props.wrapper({className:this.getClassName(),dangerouslySetInnerHTML:this.state.loadedText?{__html:this.processSVG(this.state.loadedText)}:void 0},this.renderContents())}}]),t}(c.default.Component);x.propTypes={children:c.default.PropTypes.node,className:c.default.PropTypes.string,onError:c.default.PropTypes.func,onLoad:c.default.PropTypes.func,preloader:c.default.PropTypes.func,src:c.default.PropTypes.string.isRequired,supportTest:c.default.PropTypes.func,uniquifyIDs:c.default.PropTypes.bool,wrapper:c.default.PropTypes.func},x.defaultProps={wrapper:c.default.DOM.span,supportTest:g,uniquifyIDs:!0},n.default=x,t.exports=n.default},{\"./shouldComponentUpdate\":54,httpplease:13,\"httpplease/plugins/oldiexdomain\":21,once:22,react:49}],54:[function(e,t,n){\"use strict\";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return!(0,s.default)(this.props,e)||!(0,s.default)(this.state,t)}function i(e,t,n){return!(0,s.default)(this.props,e)||!(0,s.default)(this.state,t)||!(0,s.default)(this.context,n)}Object.defineProperty(n,\"__esModule\",{value:!0}),n.shouldComponentUpdate=o,n.shouldComponentUpdateContext=i;var a=e(\"fbjs/lib/shallowEqual\"),s=r(a);n.default={shouldComponentUpdate:o,shouldComponentUpdateContext:i}},{\"fbjs/lib/shallowEqual\":10}]},{},[53])(53)});"}}},{"rowIdx":79902,"cells":{"target":{"kind":"string","value":"docs/src/examples/modules/Checkbox/States/index.js"},"feat_repo_name":{"kind":"string","value":"Semantic-Org/Semantic-UI-React"},"text":{"kind":"string","value":"import React from 'react'\nimport { Message } from 'semantic-ui-react'\n\nimport ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample'\nimport ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection'\n\nconst CheckboxStatesExamples = () => (\n \n \n \n \n Use{' '}\n \n defaultChecked\n {' '}\n as you normally would to set default form values.\n \n \n \n \n \n)\n\nexport default CheckboxStatesExamples\n"}}},{"rowIdx":79903,"cells":{"target":{"kind":"string","value":"app/components/MyProfileBox/index.js"},"feat_repo_name":{"kind":"string","value":"yoohan-dex/myBlog"},"text":{"kind":"string","value":"/**\n*\n* MyProfileBox\n*\n*/\n\nimport React from 'react';\n\nimport styles from './styles.css';\n\nfunction MyProfileBox() {\n return (\n
\n
\n );\n}\n\n\nexport default MyProfileBox;\n"}}},{"rowIdx":79904,"cells":{"target":{"kind":"string","value":"web/index.js"},"feat_repo_name":{"kind":"string","value":"mrcnc/spatialconnect-server"},"text":{"kind":"string","value":"import React from 'react';\nimport { render } from 'react-dom';\nimport { Provider } from 'react-redux';\nimport { createStore, applyMiddleware, combineReducers } from 'redux';\nimport thunk from 'redux-thunk';\nimport { createLogger } from 'redux-logger';\nimport { Router, Route, IndexRoute, browserHistory } from 'react-router';\nimport { syncHistoryWithStore, routerReducer, routerMiddleware } from 'react-router-redux';\nimport throttle from 'lodash/throttle';\nimport appReducer from './ducks';\nimport { loginPersistedUser } from './ducks/auth';\nimport AppContainer from './containers/AppContainer';\nimport { loadState, saveState, requireAuthentication } from './utils';\nimport HomeContainer from './containers/HomeContainer';\nimport SignUpContainer from './containers/SignUpContainer';\nimport SignInContainer from './containers/SignInContainer';\nimport DataStoresContainer from './containers/DataStoresContainer';\nimport FormsContainer from './containers/FormsContainer';\nimport FormDetailsContainer from './containers/FormDetailsContainer';\nimport DataStoresDetailsContainer from './containers/DataStoresDetailsContainer';\nimport DataContainer from './containers/DataContainer';\nimport TeamsContainer from './containers/TeamsContainer';\nimport TeamDetailsContainer from './containers/TeamDetailsContainer';\nimport MessageContainer from './containers/MessageContainer';\n\nimport './style/Globals.less';\n\n// combine all the reducers into a single reducing function\nconst rootReducer = combineReducers({\n sc: appReducer,\n routing: routerReducer,\n});\n\n// create the redux store that holds the state for this app\n// http://redux.js.org/docs/api/createStore.html\nconst middleware = routerMiddleware(browserHistory);\nconst store = createStore(\n rootReducer,\n applyMiddleware(middleware, thunk, createLogger()) // logger must be the last in the chain\n);\n\nconst persistedUser = loadState();\nconst token = persistedUser ? persistedUser.token : null;\nconst user = persistedUser ? persistedUser.user : null;\nif (token !== null && user !== null) {\n store.dispatch(loginPersistedUser(token, user));\n}\n\nstore.subscribe(\n throttle(() => {\n saveState({\n user: store.getState().sc.auth.user,\n token: store.getState().sc.auth.token,\n });\n }, 1000)\n);\n\n// create an enhanced history that syncs navigation events with the store\nconst history = syncHistoryWithStore(browserHistory, store);\n\n// wrap the App component with the react-redux Provider component to make the\n// store available to all container components without passing it down\n// explicitly as a prop\nrender(\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ,\n document.getElementById('root')\n);\n"}}},{"rowIdx":79905,"cells":{"target":{"kind":"string","value":"views/ios/main.js"},"feat_repo_name":{"kind":"string","value":"MervynFang/playwithreactnative"},"text":{"kind":"string","value":"/**\n* @Author: MervynFang\n* @Date: 2016,May,01 18:08:02\n* @Last modified by: Mervyn\n* @Last modified time: 2016,Aug,01 01:17:14\n*/\n\nimport React, { Component } from 'react';\n\nimport {\n StyleSheet,\n Text,\n View,\n Alert,\n ScrollView,\n Image,\n Platform,\n ToastAndroid,\n TouchableHighlight,\n TouchableOpacity\n} from 'react-native';\n\nimport {ImagePickerManager} from 'NativeModules';\nimport {Screen} from 'NativeModules';\n\nimport {MKButton, MKColor} from 'react-native-material-kit';\n\nimport {Cam} from './cam';\n\nimport {styles} from '../../styles/styles';\n\nconst BasicButton = MKButton.coloredFab()\n .withBackgroundColor(MKColor.Cyan)\n // .withText('Add Pic')\n // .withOnPress(() => {\n // this.selectImage();\n // })\n // .withShadowColor('black')\n .withStyle({\n width: 60,\n height: 60,\n borderRadius: 30,\n // todo 这里开了chrome debug 卡顿,不过也没有关系啦\n elevation: 0, // 去掉阴影\n })\n .build();\nconst MainButton = MKButton.coloredButton()\n .withBackgroundColor(MKColor.Cyan)\n .withStyle({\n width: 80,\n height: 80,\n borderRadius: 40,\n elevation: 0, // 去掉阴影\n })\n .build();\n\n\nclass Main extends Component {\n\n // state = {\n // selectedImage: null\n // };\n\n constructor(props) {\n super(props);\n this.state = {\n selectedImage: null, // 选中图片的路径\n imageData: null, // 图像的base64数据\n faceData: null, // 脸部的数据 json\n imageWidth: null, // 图片原来的宽度\n imageHeight: null, // 图片原来的高度\n regTag: 0 // 是否显示识别框\n };\n }\n\n selectImage() {\n const options = {\n title: 'Please select image',\n cancelButtonTitle: 'Cancel',\n takePhotoButtonTitle: 'Camera',\n chooseFromLibraryButtonTitle: 'Gallery',\n // quality: 0.5,\n // maxWidth: 300,\n // maxHeight: 300,\n allowsEditing: false,\n aspectX: 3, // android only - aspectX:aspectY, the cropping image's ratio of width to height\n aspectY: 4, // android only\n };\n\n ImagePickerManager.showImagePicker(options, (response) => {\n console.log('Response = ', response);\n\n if (response.didCancel) {\n console.log('User cancelled photo picker');\n // camera always be here\n }\n else if (response.error) {\n console.log('ImagePickerManager Error: ', response.error);\n\n }\n else if (response.customButton) {\n console.log('User tapped custom button: ', response.customButton);\n\n }\n else {\n // You can display the image using either:\n //const source = {uri: 'data:image/jpeg;base64,' + response.data, isStatic: true};\n\n var source, image;\n if (Platform.OS === 'android') {\n source = {uri: 'file://' + response.path, isStatic: true};\n console.log(source);\n image = response.data;\n } else {\n source = {uri: response.uri.replace('file://', ''), isStatic: true};\n }\n\n this.setState({\n selectedImage: source,\n imageData: image,\n imageWidth: response.width,\n imageHeight: response.height,\n regTag: 0\n });\n }\n });\n }\n \n getObject(obj) {\n let a = '';\n for(let i in this.state.selectedImage){\n a = a + i + ':' + this.state.selectedImage[i];\n }\n return a;\n }\n \n handleState() {\n this.setState({\n regTag: 1\n });\n }\n\n render() {\n return (\n \n \n {this.state.selectedImage === null\n ? \n Please select image\n \n : }\n \n \n {\n if (this.state.selectedImage === null) {\n ToastAndroid.show('Please select image', ToastAndroid.SHORT)\n } else {\n Alert.alert('Save to Gallery', 'Would you like to save to Gallery?', [\n {\n text: 'Cancel',\n onPress: () => ToastAndroid.show('Save fail', ToastAndroid.SHORT)\n },\n {\n text: 'OK',\n onPress: () => {\n ToastAndroid.show('Save succeed', ToastAndroid.SHORT);\n Screen.screenShot();\n }\n }\n ]);\n }\n }}>\n \n \n \n {\n // \n }\n \n {\n if (selectedImage === null) {\n ToastAndroid.show('Please select image', ToastAndroid.SHORT)\n } else {\n ToastAndroid.show('Intelegent Recognizing', ToastAndroid.SHORT)\n this.detectFace();\n }\n }\n }>\n \n \n \n \n \n \n \n \n \n );\n }\n}\n\nexport {Main};"}}},{"rowIdx":79906,"cells":{"target":{"kind":"string","value":"containerComponents/src/PersonList.js"},"feat_repo_name":{"kind":"string","value":"wandarkaf/React-Bible"},"text":{"kind":"string","value":"import React, { Component } from 'react';\n\nclass PersonList extends Component {\n render() {\n return
    {this.props.people.map(this.renderPerson)}
\n }\n\n renderPerson(person) {\n return
  • {person.name.first} {person.name.last}
  • \n }\n}\n\nexport default PersonList;\n"}}},{"rowIdx":79907,"cells":{"target":{"kind":"string","value":"src/js/schedule-app/components/filters/index.js"},"feat_repo_name":{"kind":"string","value":"DevFestNordeste/ne.devfest.com.br"},"text":{"kind":"string","value":"import React from 'react';\nimport Popover from 'react-popover';\n\nexport const FilterCheckbox = ({ checked, onChange, label, ...props }) => (\n \n)\n\nexport const EventTypeFilter = ({ types, onChange, filter }) => (\n
    \n {types.map(type => (\n onChange(type)}\n label={type}\n key={type}\n />\n ))}\n
    \n)\n\nexport const CategoryFilter = ({ categories, onChange, filter }) => (\n
    \n {categories.map(category => (\n onChange(category)}\n label={category}\n />\n ))}\n
    \n)\n\nexport class FilterBox extends React.Component {\n constructor(props) {\n super(props);\n this.onSubmit = this.onSubmit.bind(this);\n }\n\n onSubmit(e) {\n e.preventDefault();\n this.input.blur();\n }\n\n render() {\n const { value, onChange, onClick, isPopoverOpened, advancedFilters } = this.props;\n return (\n
    \n
    \n search\n this.input = input}\n value={value}\n onChange={onChange}\n placeholder=\"Pesquisar palestra, autor, sala, categoria...\"\n />\n \n \n \n \n
    \n );\n }\n}\n\n"}}},{"rowIdx":79908,"cells":{"target":{"kind":"string","value":"ajax/libs/js-data/2.2.3/js-data.js"},"feat_repo_name":{"kind":"string","value":"jdh8/cdnjs"},"text":{"kind":"string","value":"/*!\n * js-data\n * @version 2.2.3 - Homepage \n * @author Jason Dobry \n * @copyright (c) 2014-2015 Jason Dobry \n * @license MIT \n * \n * @overview Robust framework-agnostic data store.\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"JSData\"] = factory();\n\telse\n\t\troot[\"JSData\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar _datastoreIndex = __webpack_require__(1);\n\n\tvar _utils = __webpack_require__(2);\n\n\tvar _errors = __webpack_require__(3);\n\n\t/**\n\t * The library export.\n\t * - window.JSData\n\t * - require('js-data')\n\t * - define(['js-data', function (JSData) { ... }]);\n\t * - import JSData from 'js-data'\n\t */\n\tmodule.exports = {\n\t DS: _datastoreIndex['default'],\n\t DSUtils: _utils['default'],\n\t DSErrors: _errors['default'],\n\t createStore: function createStore(options) {\n\t return new _datastoreIndex['default'](options);\n\t },\n\t version: {\n\t full: '2.2.3',\n\t major: parseInt('2', 10),\n\t minor: parseInt('2', 10),\n\t patch: parseInt('3', 10),\n\t alpha: true ? 'false' : false,\n\t beta: true ? 'false' : false\n\t }\n\t};\n\n/***/ },\n/* 1 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\n\t/* jshint eqeqeq:false */\n\n\tvar _utils = __webpack_require__(2);\n\n\tvar _errors = __webpack_require__(3);\n\n\tvar _sync_methodsIndex = __webpack_require__(4);\n\n\tvar _async_methodsIndex = __webpack_require__(5);\n\n\tfunction lifecycleNoopCb(resource, attrs, cb) {\n\t cb(null, attrs);\n\t}\n\n\tfunction lifecycleNoop(resource, attrs) {\n\t return attrs;\n\t}\n\n\tfunction compare(_x, _x2, _x3, _x4) {\n\t var _again = true;\n\n\t _function: while (_again) {\n\t var orderBy = _x,\n\t index = _x2,\n\t a = _x3,\n\t b = _x4;\n\t def = cA = cB = undefined;\n\t _again = false;\n\n\t var def = orderBy[index];\n\t var cA = _utils['default'].get(a, def[0]),\n\t cB = _utils['default'].get(b, def[0]);\n\t if (_utils['default']._s(cA)) {\n\t cA = _utils['default'].upperCase(cA);\n\t }\n\t if (_utils['default']._s(cB)) {\n\t cB = _utils['default'].upperCase(cB);\n\t }\n\t if (def[1] === 'DESC') {\n\t if (cB < cA) {\n\t return -1;\n\t } else if (cB > cA) {\n\t return 1;\n\t } else {\n\t if (index < orderBy.length - 1) {\n\t _x = orderBy;\n\t _x2 = index + 1;\n\t _x3 = a;\n\t _x4 = b;\n\t _again = true;\n\t continue _function;\n\t } else {\n\t return 0;\n\t }\n\t }\n\t } else {\n\t if (cA < cB) {\n\t return -1;\n\t } else if (cA > cB) {\n\t return 1;\n\t } else {\n\t if (index < orderBy.length - 1) {\n\t _x = orderBy;\n\t _x2 = index + 1;\n\t _x3 = a;\n\t _x4 = b;\n\t _again = true;\n\t continue _function;\n\t } else {\n\t return 0;\n\t }\n\t }\n\t }\n\t }\n\t}\n\n\tvar Defaults = (function () {\n\t function Defaults() {\n\t _classCallCheck(this, Defaults);\n\t }\n\n\t _createClass(Defaults, [{\n\t key: 'errorFn',\n\t value: function errorFn(a, b) {\n\t if (this.error && typeof this.error === 'function') {\n\t try {\n\t if (typeof a === 'string') {\n\t throw new Error(a);\n\t } else {\n\t throw a;\n\t }\n\t } catch (err) {\n\t a = err;\n\t }\n\t this.error(this.name || null, a || null, b || null);\n\t }\n\t }\n\t }]);\n\n\t return Defaults;\n\t})();\n\n\tvar defaultsPrototype = Defaults.prototype;\n\n\tdefaultsPrototype.actions = {};\n\tdefaultsPrototype.afterCreate = lifecycleNoopCb;\n\tdefaultsPrototype.afterCreateCollection = lifecycleNoop;\n\tdefaultsPrototype.afterCreateInstance = lifecycleNoop;\n\tdefaultsPrototype.afterDestroy = lifecycleNoopCb;\n\tdefaultsPrototype.afterEject = lifecycleNoop;\n\tdefaultsPrototype.afterInject = lifecycleNoop;\n\tdefaultsPrototype.afterReap = lifecycleNoop;\n\tdefaultsPrototype.afterUpdate = lifecycleNoopCb;\n\tdefaultsPrototype.afterValidate = lifecycleNoopCb;\n\tdefaultsPrototype.allowSimpleWhere = true;\n\tdefaultsPrototype.basePath = '';\n\tdefaultsPrototype.beforeCreate = lifecycleNoopCb;\n\tdefaultsPrototype.beforeCreateCollection = lifecycleNoop;\n\tdefaultsPrototype.beforeCreateInstance = lifecycleNoop;\n\tdefaultsPrototype.beforeDestroy = lifecycleNoopCb;\n\tdefaultsPrototype.beforeEject = lifecycleNoop;\n\tdefaultsPrototype.beforeInject = lifecycleNoop;\n\tdefaultsPrototype.beforeReap = lifecycleNoop;\n\tdefaultsPrototype.beforeUpdate = lifecycleNoopCb;\n\tdefaultsPrototype.beforeValidate = lifecycleNoopCb;\n\tdefaultsPrototype.bypassCache = false;\n\tdefaultsPrototype.cacheResponse = !!_utils['default'].w;\n\tdefaultsPrototype.clearEmptyQueries = true;\n\tdefaultsPrototype.computed = {};\n\tdefaultsPrototype.defaultAdapter = 'http';\n\tdefaultsPrototype.debug = false;\n\tdefaultsPrototype.defaultValues = {};\n\tdefaultsPrototype.eagerEject = false;\n\t// TODO: Implement eagerInject in DS#create\n\tdefaultsPrototype.eagerInject = false;\n\tdefaultsPrototype.endpoint = '';\n\tdefaultsPrototype.error = console ? function (a, b, c) {\n\t return console[typeof console.error === 'function' ? 'error' : 'log'](a, b, c);\n\t} : false;\n\tdefaultsPrototype.fallbackAdapters = ['http'];\n\tdefaultsPrototype.findStrictCache = false;\n\tdefaultsPrototype.idAttribute = 'id';\n\tdefaultsPrototype.ignoredChanges = [/\\$/];\n\tdefaultsPrototype.instanceEvents = !!_utils['default'].w;\n\tdefaultsPrototype.keepChangeHistory = false;\n\tdefaultsPrototype.linkRelations = true;\n\tdefaultsPrototype.log = console ? function (a, b, c, d, e) {\n\t return console[typeof console.info === 'function' ? 'info' : 'log'](a, b, c, d, e);\n\t} : false;\n\n\tdefaultsPrototype.logFn = function (a, b, c, d) {\n\t var _this = this;\n\t if (_this.debug && _this.log && typeof _this.log === 'function') {\n\t _this.log(_this.name || null, a || null, b || null, c || null, d || null);\n\t }\n\t};\n\n\tdefaultsPrototype.maxAge = false;\n\tdefaultsPrototype.methods = {};\n\tdefaultsPrototype.notify = !!_utils['default'].w;\n\tdefaultsPrototype.omit = [];\n\tdefaultsPrototype.onConflict = 'merge';\n\tdefaultsPrototype.reapAction = !!_utils['default'].w ? 'inject' : 'none';\n\tdefaultsPrototype.reapInterval = !!_utils['default'].w ? 30000 : false;\n\tdefaultsPrototype.relationsEnumerable = false;\n\tdefaultsPrototype.resetHistoryOnInject = true;\n\tdefaultsPrototype.returnMeta = false;\n\tdefaultsPrototype.strategy = 'single';\n\tdefaultsPrototype.upsert = !!_utils['default'].w;\n\tdefaultsPrototype.useClass = true;\n\tdefaultsPrototype.useFilter = false;\n\tdefaultsPrototype.validate = lifecycleNoopCb;\n\tdefaultsPrototype.defaultFilter = function (collection, resourceName, params, options) {\n\t var filtered = collection;\n\t var where = null;\n\t var reserved = {\n\t skip: '',\n\t offset: '',\n\t where: '',\n\t limit: '',\n\t orderBy: '',\n\t sort: ''\n\t };\n\n\t params = params || {};\n\t options = options || {};\n\n\t if (_utils['default']._o(params.where)) {\n\t where = params.where;\n\t } else {\n\t where = {};\n\t }\n\n\t if (options.allowSimpleWhere) {\n\t _utils['default'].forOwn(params, function (value, key) {\n\t if (!(key in reserved) && !(key in where)) {\n\t where[key] = {\n\t '==': value\n\t };\n\t }\n\t });\n\t }\n\n\t if (_utils['default'].isEmpty(where)) {\n\t where = null;\n\t }\n\n\t if (where) {\n\t filtered = _utils['default'].filter(filtered, function (attrs) {\n\t var first = true;\n\t var keep = true;\n\t _utils['default'].forOwn(where, function (clause, field) {\n\t if (!_utils['default']._o(clause)) {\n\t clause = {\n\t '==': clause\n\t };\n\t }\n\t _utils['default'].forOwn(clause, function (term, op) {\n\t var expr = undefined;\n\t var isOr = op[0] === '|';\n\t var val = _utils['default'].get(attrs, field);\n\t op = isOr ? op.substr(1) : op;\n\t if (op === '==') {\n\t expr = val == term;\n\t } else if (op === '===') {\n\t expr = val === term;\n\t } else if (op === '!=') {\n\t expr = val != term;\n\t } else if (op === '!==') {\n\t expr = val !== term;\n\t } else if (op === '>') {\n\t expr = val > term;\n\t } else if (op === '>=') {\n\t expr = val >= term;\n\t } else if (op === '<') {\n\t expr = val < term;\n\t } else if (op === '<=') {\n\t expr = val <= term;\n\t } else if (op === 'isectEmpty') {\n\t expr = !_utils['default'].intersection(val || [], term || []).length;\n\t } else if (op === 'isectNotEmpty') {\n\t expr = _utils['default'].intersection(val || [], term || []).length;\n\t } else if (op === 'in') {\n\t if (_utils['default']._s(term)) {\n\t expr = term.indexOf(val) !== -1;\n\t } else {\n\t expr = _utils['default'].contains(term, val);\n\t }\n\t } else if (op === 'notIn') {\n\t if (_utils['default']._s(term)) {\n\t expr = term.indexOf(val) === -1;\n\t } else {\n\t expr = !_utils['default'].contains(term, val);\n\t }\n\t } else if (op === 'contains') {\n\t if (_utils['default']._s(val)) {\n\t expr = val.indexOf(term) !== -1;\n\t } else {\n\t expr = _utils['default'].contains(val, term);\n\t }\n\t } else if (op === 'notContains') {\n\t if (_utils['default']._s(val)) {\n\t expr = val.indexOf(term) === -1;\n\t } else {\n\t expr = !_utils['default'].contains(val, term);\n\t }\n\t }\n\t if (expr !== undefined) {\n\t keep = first ? expr : isOr ? keep || expr : keep && expr;\n\t }\n\t first = false;\n\t });\n\t });\n\t return keep;\n\t });\n\t }\n\n\t var orderBy = null;\n\n\t if (_utils['default']._s(params.orderBy)) {\n\t orderBy = [[params.orderBy, 'ASC']];\n\t } else if (_utils['default']._a(params.orderBy)) {\n\t orderBy = params.orderBy;\n\t }\n\n\t if (!orderBy && _utils['default']._s(params.sort)) {\n\t orderBy = [[params.sort, 'ASC']];\n\t } else if (!orderBy && _utils['default']._a(params.sort)) {\n\t orderBy = params.sort;\n\t }\n\n\t // Apply 'orderBy'\n\t if (orderBy) {\n\t (function () {\n\t var index = 0;\n\t _utils['default'].forEach(orderBy, function (def, i) {\n\t if (_utils['default']._s(def)) {\n\t orderBy[i] = [def, 'ASC'];\n\t } else if (!_utils['default']._a(def)) {\n\t throw new _errors['default'].IA('DS.filter(\"' + resourceName + '\"[, params][, options]): ' + _utils['default'].toJson(def) + ': Must be a string or an array!', {\n\t params: {\n\t 'orderBy[i]': {\n\t actual: typeof def,\n\t expected: 'string|array'\n\t }\n\t }\n\t });\n\t }\n\t });\n\t filtered = _utils['default'].sort(filtered, function (a, b) {\n\t return compare(orderBy, index, a, b);\n\t });\n\t })();\n\t }\n\n\t var limit = _utils['default']._n(params.limit) ? params.limit : null;\n\t var skip = null;\n\n\t if (_utils['default']._n(params.skip)) {\n\t skip = params.skip;\n\t } else if (_utils['default']._n(params.offset)) {\n\t skip = params.offset;\n\t }\n\n\t // Apply 'limit' and 'skip'\n\t if (limit && skip) {\n\t filtered = _utils['default'].slice(filtered, skip, Math.min(filtered.length, skip + limit));\n\t } else if (_utils['default']._n(limit)) {\n\t filtered = _utils['default'].slice(filtered, 0, Math.min(filtered.length, limit));\n\t } else if (_utils['default']._n(skip)) {\n\t if (skip < filtered.length) {\n\t filtered = _utils['default'].slice(filtered, skip);\n\t } else {\n\t filtered = [];\n\t }\n\t }\n\n\t if (filtered === collection) {\n\t return filtered.slice();\n\t } else {\n\t return filtered;\n\t }\n\t};\n\n\tvar DS = (function () {\n\t function DS(options) {\n\t _classCallCheck(this, DS);\n\n\t var _this = this;\n\t options = options || {};\n\n\t _this.store = {};\n\t _this.definitions = {};\n\t _this.adapters = {};\n\t _this.defaults = new Defaults();\n\t _this.observe = _utils['default'].observe;\n\t _utils['default'].forOwn(options, function (v, k) {\n\t if (k === 'omit') {\n\t _this.defaults.omit = v.concat(Defaults.prototype.omit);\n\t } else {\n\t _this.defaults[k] = v;\n\t }\n\t });\n\n\t var P = _utils['default'].Promise;\n\n\t if (P && !P.prototype.spread) {\n\t P.prototype.spread = function (cb) {\n\t return this.then(function (arr) {\n\t return cb.apply(this, arr);\n\t });\n\t };\n\t }\n\n\t _utils['default'].Events(_this);\n\t }\n\n\t _createClass(DS, [{\n\t key: 'getAdapterName',\n\t value: function getAdapterName(options) {\n\t var errorIfNotExist = false;\n\t options = options || {};\n\t if (_utils['default']._s(options)) {\n\t errorIfNotExist = true;\n\t options = {\n\t adapter: options\n\t };\n\t }\n\t if (this.adapters[options.adapter]) {\n\t return options.adapter;\n\t } else if (errorIfNotExist) {\n\t throw new Error(options.adapter + ' is not a registered adapter!');\n\t } else {\n\t return options.defaultAdapter;\n\t }\n\t }\n\t }, {\n\t key: 'getAdapter',\n\t value: function getAdapter(options) {\n\t options = options || {};\n\t return this.adapters[this.getAdapterName(options)];\n\t }\n\t }, {\n\t key: 'registerAdapter',\n\t value: function registerAdapter(name, Adapter, options) {\n\t var _this = this;\n\t options = options || {};\n\t if (_utils['default'].isFunction(Adapter)) {\n\t _this.adapters[name] = new Adapter(options);\n\t } else {\n\t _this.adapters[name] = Adapter;\n\t }\n\t if (options['default']) {\n\t _this.defaults.defaultAdapter = name;\n\t }\n\t }\n\t }, {\n\t key: 'is',\n\t value: function is(resourceName, instance) {\n\t var definition = this.definitions[resourceName];\n\t if (!definition) {\n\t throw new _errors['default'].NER(resourceName);\n\t }\n\t return instance instanceof definition[definition['class']];\n\t }\n\t }, {\n\t key: 'clear',\n\t value: function clear() {\n\t var _this2 = this;\n\n\t var ejected = {};\n\t _utils['default'].forOwn(this.definitions, function (definition) {\n\t var name = definition.name;\n\t ejected[name] = definition.ejectAll();\n\t _this2.store[name].completedQueries = {};\n\t _this2.store[name].queryData = {};\n\t });\n\t return ejected;\n\t }\n\t }]);\n\n\t return DS;\n\t})();\n\n\tvar dsPrototype = DS.prototype;\n\n\tdsPrototype.getAdapterName.shorthand = false;\n\tdsPrototype.getAdapter.shorthand = false;\n\tdsPrototype.registerAdapter.shorthand = false;\n\tdsPrototype.errors = _errors['default'];\n\tdsPrototype.utils = _utils['default'];\n\n\tfunction addMethods(target, obj) {\n\t _utils['default'].forOwn(obj, function (v, k) {\n\t target[k] = v;\n\t target[k].before = function (fn) {\n\t var orig = target[k];\n\t target[k] = function () {\n\t for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n\t args[_key] = arguments[_key];\n\t }\n\n\t return orig.apply(this, fn.apply(this, args) || args);\n\t };\n\t };\n\t });\n\t}\n\n\taddMethods(dsPrototype, _sync_methodsIndex['default']);\n\taddMethods(dsPrototype, _async_methodsIndex['default']);\n\n\texports['default'] = DS;\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* jshint eqeqeq:false */\n\n\t/**\n\t * Mix of ES6 and CommonJS module imports because the interop of Babel + Webpack + ES6 modules + CommonJS isn't very good.\n\t */\n\n\tvar _errors = __webpack_require__(3);\n\n\tvar BinaryHeap = __webpack_require__(7);\n\tvar forEach = __webpack_require__(8);\n\tvar slice = __webpack_require__(9);\n\tvar forOwn = __webpack_require__(13);\n\tvar contains = __webpack_require__(10);\n\tvar deepMixIn = __webpack_require__(14);\n\tvar pascalCase = __webpack_require__(19);\n\tvar remove = __webpack_require__(11);\n\tvar pick = __webpack_require__(15);\n\tvar _keys = __webpack_require__(16);\n\tvar sort = __webpack_require__(12);\n\tvar upperCase = __webpack_require__(20);\n\tvar get = __webpack_require__(17);\n\tvar set = __webpack_require__(18);\n\tvar observe = __webpack_require__(6);\n\tvar w = undefined;\n\tvar objectProto = Object.prototype;\n\tvar toString = objectProto.toString;\n\tvar P = undefined;\n\n\t/**\n\t * Attempt to detect the global Promise constructor.\n\t * JSData will still work without one, as long you do something like this:\n\t *\n\t * var JSData = require('js-data');\n\t * JSData.DSUtils.Promise = MyPromiseLib;\n\t */\n\ttry {\n\t P = Promise;\n\t} catch (err) {\n\t console.error('js-data requires a global Promise constructor!');\n\t}\n\n\tvar isArray = Array.isArray || function isArray(value) {\n\t return toString.call(value) == '[object Array]' || false;\n\t};\n\n\tvar isRegExp = function isRegExp(value) {\n\t return toString.call(value) == '[object RegExp]' || false;\n\t};\n\n\t// adapted from lodash.isString\n\tvar isString = function isString(value) {\n\t return typeof value == 'string' || value && typeof value == 'object' && toString.call(value) == '[object String]' || false;\n\t};\n\n\tvar isObject = function isObject(value) {\n\t return toString.call(value) == '[object Object]' || false;\n\t};\n\n\t// adapted from lodash.isDate\n\tvar isDate = function isDate(value) {\n\t return value && typeof value == 'object' && toString.call(value) == '[object Date]' || false;\n\t};\n\n\t// adapted from lodash.isNumber\n\tvar isNumber = function isNumber(value) {\n\t var type = typeof value;\n\t return type == 'number' || value && type == 'object' && toString.call(value) == '[object Number]' || false;\n\t};\n\n\t// adapted from lodash.isFunction\n\tvar isFunction = function isFunction(value) {\n\t return typeof value == 'function' || value && toString.call(value) === '[object Function]' || false;\n\t};\n\n\t// shorthand argument checking functions, using these shaves 1.18 kb off of the minified build\n\tvar isStringOrNumber = function isStringOrNumber(value) {\n\t return isString(value) || isNumber(value);\n\t};\n\tvar isStringOrNumberErr = function isStringOrNumberErr(field) {\n\t return new _errors['default'].IA('\"' + field + '\" must be a string or a number!');\n\t};\n\tvar isObjectErr = function isObjectErr(field) {\n\t return new _errors['default'].IA('\"' + field + '\" must be an object!');\n\t};\n\tvar isArrayErr = function isArrayErr(field) {\n\t return new _errors['default'].IA('\"' + field + '\" must be an array!');\n\t};\n\n\t// adapted from mout.isEmpty\n\tvar isEmpty = function isEmpty(val) {\n\t if (val == null) {\n\t // jshint ignore:line\n\t // typeof null == 'object' so we check it first\n\t return true;\n\t } else if (typeof val === 'string' || isArray(val)) {\n\t return !val.length;\n\t } else if (typeof val === 'object') {\n\t var result = true;\n\t forOwn(val, function () {\n\t result = false;\n\t return false; // break loop\n\t });\n\t return result;\n\t } else {\n\t return true;\n\t }\n\t};\n\n\t// Find the intersection between two arrays\n\tvar intersection = function intersection(array1, array2) {\n\t if (!array1 || !array2) {\n\t return [];\n\t }\n\t var result = [];\n\t var item = undefined;\n\t for (var i = 0, _length = array1.length; i < _length; i++) {\n\t item = array1[i];\n\t if (contains(result, item)) {\n\t continue;\n\t }\n\t if (contains(array2, item)) {\n\t result.push(item);\n\t }\n\t }\n\t return result;\n\t};\n\n\tvar filter = function filter(array, cb, thisObj) {\n\t var results = [];\n\t forEach(array, function (value, key, arr) {\n\t if (cb(value, key, arr)) {\n\t results.push(value);\n\t }\n\t }, thisObj);\n\t return results;\n\t};\n\n\t/**\n\t * Attempt to detect whether we are in the browser.\n\t */\n\ttry {\n\t w = window;\n\t w = {};\n\t} catch (e) {\n\t w = null;\n\t}\n\n\t/**\n\t * Event mixin. Usage:\n\t *\n\t * function handler() { ... }\n\t * Events(myObject);\n\t * myObject.on('foo', handler);\n\t * myObject.emit('foo', 'some', 'data');\n\t * myObject.off('foo', handler);\n\t */\n\tfunction Events(target) {\n\t var events = {};\n\t target = target || this;\n\t target.on = function (type, func, ctx) {\n\t events[type] = events[type] || [];\n\t events[type].push({\n\t f: func,\n\t c: ctx\n\t });\n\t };\n\t target.off = function (type, func) {\n\t var listeners = events[type];\n\t if (!listeners) {\n\t events = {};\n\t } else if (func) {\n\t for (var i = 0; i < listeners.length; i++) {\n\t if (listeners[i].f === func) {\n\t listeners.splice(i, 1);\n\t break;\n\t }\n\t }\n\t } else {\n\t listeners.splice(0, listeners.length);\n\t }\n\t };\n\t target.emit = function () {\n\t for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n\t args[_key] = arguments[_key];\n\t }\n\n\t var listeners = events[args.shift()] || [];\n\t if (listeners) {\n\t for (var i = 0; i < listeners.length; i++) {\n\t listeners[i].f.apply(listeners[i].c, args);\n\t }\n\t }\n\t };\n\t}\n\n\t/**\n\t * Lifecycle hooks that should support promises.\n\t */\n\tvar toPromisify = ['beforeValidate', 'validate', 'afterValidate', 'beforeCreate', 'afterCreate', 'beforeUpdate', 'afterUpdate', 'beforeDestroy', 'afterDestroy'];\n\n\t/**\n\t * Return whether \"prop\" is in the blacklist.\n\t */\n\tvar isBlacklisted = observe.isBlacklisted;\n\n\t// adapted from angular.copy\n\tvar copy = function copy(source, destination, stackSource, stackDest, blacklist) {\n\t if (!destination) {\n\t destination = source;\n\t if (source) {\n\t if (isArray(source)) {\n\t destination = copy(source, [], stackSource, stackDest, blacklist);\n\t } else if (isDate(source)) {\n\t destination = new Date(source.getTime());\n\t } else if (isRegExp(source)) {\n\t destination = new RegExp(source.source, source.toString().match(/[^\\/]*$/)[0]);\n\t destination.lastIndex = source.lastIndex;\n\t } else if (isObject(source)) {\n\t destination = copy(source, Object.create(Object.getPrototypeOf(source)), stackSource, stackDest, blacklist);\n\t }\n\t }\n\t } else {\n\t if (source === destination) {\n\t throw new Error('Cannot copy! Source and destination are identical.');\n\t }\n\n\t stackSource = stackSource || [];\n\t stackDest = stackDest || [];\n\n\t if (isObject(source)) {\n\t var index = stackSource.indexOf(source);\n\t if (index !== -1) {\n\t return stackDest[index];\n\t }\n\n\t stackSource.push(source);\n\t stackDest.push(destination);\n\t }\n\n\t var result = undefined;\n\t if (isArray(source)) {\n\t var i = undefined;\n\t destination.length = 0;\n\t for (i = 0; i < source.length; i++) {\n\t result = copy(source[i], null, stackSource, stackDest, blacklist);\n\t if (isObject(source[i])) {\n\t stackSource.push(source[i]);\n\t stackDest.push(result);\n\t }\n\t destination.push(result);\n\t }\n\t } else {\n\t if (isArray(destination)) {\n\t destination.length = 0;\n\t } else {\n\t forEach(destination, function (value, key) {\n\t delete destination[key];\n\t });\n\t }\n\t for (var key in source) {\n\t if (source.hasOwnProperty(key)) {\n\t if (isBlacklisted(key, blacklist)) {\n\t continue;\n\t }\n\t result = copy(source[key], null, stackSource, stackDest, blacklist);\n\t if (isObject(source[key])) {\n\t stackSource.push(source[key]);\n\t stackDest.push(result);\n\t }\n\t destination[key] = result;\n\t }\n\t }\n\t }\n\t }\n\t return destination;\n\t};\n\n\t// adapted from angular.equals\n\tvar equals = function equals(_x, _x2) {\n\t var _again = true;\n\n\t _function: while (_again) {\n\t var o1 = _x,\n\t o2 = _x2;\n\t t1 = t2 = length = key = keySet = undefined;\n\t _again = false;\n\n\t if (o1 === o2) {\n\t return true;\n\t }\n\t if (o1 === null || o2 === null) {\n\t return false;\n\t }\n\t if (o1 !== o1 && o2 !== o2) {\n\t return true;\n\t } // NaN === NaN\n\t var t1 = typeof o1,\n\t t2 = typeof o2,\n\t length,\n\t key,\n\t keySet;\n\t if (t1 == t2) {\n\t if (t1 == 'object') {\n\t if (isArray(o1)) {\n\t if (!isArray(o2)) {\n\t return false;\n\t }\n\t if ((length = o1.length) == o2.length) {\n\t // jshint ignore:line\n\t for (key = 0; key < length; key++) {\n\t if (!equals(o1[key], o2[key])) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t }\n\t } else if (isDate(o1)) {\n\t if (!isDate(o2)) {\n\t return false;\n\t }\n\t _x = o1.getTime();\n\t _x2 = o2.getTime();\n\t _again = true;\n\t continue _function;\n\t } else if (isRegExp(o1) && isRegExp(o2)) {\n\t return o1.toString() == o2.toString();\n\t } else {\n\t if (isArray(o2)) {\n\t return false;\n\t }\n\t keySet = {};\n\t for (key in o1) {\n\t if (key.charAt(0) === '$' || isFunction(o1[key])) {\n\t continue;\n\t }\n\t if (!equals(o1[key], o2[key])) {\n\t return false;\n\t }\n\t keySet[key] = true;\n\t }\n\t for (key in o2) {\n\t if (!keySet.hasOwnProperty(key) && key.charAt(0) !== '$' && o2[key] !== undefined && !isFunction(o2[key])) {\n\t return false;\n\t }\n\t }\n\t return true;\n\t }\n\t }\n\t }\n\t return false;\n\t }\n\t};\n\n\t/**\n\t * Given either an instance or the primary key of an instance, return the primary key.\n\t */\n\tvar resolveId = function resolveId(definition, idOrInstance) {\n\t if (isString(idOrInstance) || isNumber(idOrInstance)) {\n\t return idOrInstance;\n\t } else if (idOrInstance && definition) {\n\t return idOrInstance[definition.idAttribute] || idOrInstance;\n\t } else {\n\t return idOrInstance;\n\t }\n\t};\n\n\t/**\n\t * Given either an instance or the primary key of an instance, return the instance.\n\t */\n\tvar resolveItem = function resolveItem(resource, idOrInstance) {\n\t if (resource && (isString(idOrInstance) || isNumber(idOrInstance))) {\n\t return resource.index[idOrInstance] || idOrInstance;\n\t } else {\n\t return idOrInstance;\n\t }\n\t};\n\n\tvar isValidString = function isValidString(val) {\n\t return val != null && val !== ''; // jshint ignore:line\n\t};\n\n\tvar join = function join(items, separator) {\n\t separator = separator || '';\n\t return filter(items, isValidString).join(separator);\n\t};\n\n\tvar makePath = function makePath() {\n\t for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n\t args[_key2] = arguments[_key2];\n\t }\n\n\t var result = join(args, '/');\n\t return result.replace(/([^:\\/]|^)\\/{2,}/g, '$1/');\n\t};\n\n\texports['default'] = {\n\t Promise: P,\n\t /**\n\t * Method to wrap an \"options\" object so that it will inherit from\n\t * some parent object, such as a resource definition.\n\t */\n\t _: function _(parent, options) {\n\t var _this = this;\n\t parent = parent || {};\n\t options = options || {};\n\t if (options && options.constructor === parent.constructor) {\n\t return options;\n\t } else if (!isObject(options)) {\n\t throw new _errors['default'].IA('\"options\" must be an object!');\n\t }\n\t forEach(toPromisify, function (name) {\n\t if (typeof options[name] === 'function' && options[name].toString().indexOf('for (var _len = arg') === -1) {\n\t options[name] = _this.promisify(options[name]);\n\t }\n\t });\n\t // Dynamic constructor function\n\t var O = function Options(attrs) {\n\t var self = this;\n\t forOwn(attrs, function (value, key) {\n\t self[key] = value;\n\t });\n\t };\n\t // Inherit from some parent object\n\t O.prototype = parent;\n\t // Give us a way to get the original options back.\n\t O.prototype.orig = function () {\n\t var orig = {};\n\t forOwn(this, function (value, key) {\n\t orig[key] = value;\n\t });\n\t return orig;\n\t };\n\t return new O(options);\n\t },\n\t _n: isNumber,\n\t _s: isString,\n\t _sn: isStringOrNumber,\n\t _snErr: isStringOrNumberErr,\n\t _o: isObject,\n\t _oErr: isObjectErr,\n\t _a: isArray,\n\t _aErr: isArrayErr,\n\t compute: function compute(fn, field) {\n\t var _this = this;\n\t var args = [];\n\t forEach(fn.deps, function (dep) {\n\t args.push(get(_this, dep));\n\t });\n\t // compute property\n\t set(_this, field, fn[fn.length - 1].apply(_this, args));\n\t },\n\t contains: contains,\n\t copy: copy,\n\t deepMixIn: deepMixIn,\n\t diffObjectFromOldObject: observe.diffObjectFromOldObject,\n\t BinaryHeap: BinaryHeap,\n\t equals: equals,\n\t Events: Events,\n\t filter: filter,\n\t fillIn: function fillIn(target, obj) {\n\t forOwn(obj, function (v, k) {\n\t if (!(k in target)) {\n\t target[k] = v;\n\t }\n\t });\n\t return target;\n\t },\n\t forEach: forEach,\n\t forOwn: forOwn,\n\t fromJson: function fromJson(json) {\n\t return isString(json) ? JSON.parse(json) : json;\n\t },\n\t get: get,\n\t intersection: intersection,\n\t isArray: isArray,\n\t isBlacklisted: isBlacklisted,\n\t isEmpty: isEmpty,\n\t isFunction: isFunction,\n\t isObject: isObject,\n\t isNumber: isNumber,\n\t isString: isString,\n\t keys: _keys,\n\t makePath: makePath,\n\t observe: observe,\n\t omit: function omit(obj, bl) {\n\t var toRemove = [];\n\t forOwn(obj, function (v, k) {\n\t if (isBlacklisted(k, bl)) {\n\t toRemove.push(k);\n\t }\n\t });\n\t forEach(toRemove, function (k) {\n\t delete obj[k];\n\t });\n\t return obj;\n\t },\n\t pascalCase: pascalCase,\n\t pick: pick,\n\t // Turn the given node-style callback function into one that can return a promise.\n\t promisify: function promisify(fn, target) {\n\t var _this = this;\n\t if (!fn) {\n\t return;\n\t } else if (typeof fn !== 'function') {\n\t throw new Error('Can only promisify functions!');\n\t }\n\t return function () {\n\t for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n\t args[_key3] = arguments[_key3];\n\t }\n\n\t return new _this.Promise(function (resolve, reject) {\n\n\t args.push(function (err, result) {\n\t if (err) {\n\t reject(err);\n\t } else {\n\t resolve(result);\n\t }\n\t });\n\n\t try {\n\t var promise = fn.apply(target || this, args);\n\t if (promise && promise.then) {\n\t promise.then(resolve, reject);\n\t }\n\t } catch (err) {\n\t reject(err);\n\t }\n\t });\n\t };\n\t },\n\t remove: remove,\n\t set: set,\n\t slice: slice,\n\t sort: sort,\n\t toJson: JSON.stringify,\n\t updateTimestamp: function updateTimestamp(timestamp) {\n\t var newTimestamp = typeof Date.now === 'function' ? Date.now() : new Date().getTime();\n\t if (timestamp && newTimestamp <= timestamp) {\n\t return timestamp + 1;\n\t } else {\n\t return newTimestamp;\n\t }\n\t },\n\t upperCase: upperCase,\n\t // Return a copy of \"object\" with cycles removed.\n\t removeCircular: function removeCircular(object) {\n\t return (function rmCirc(value, ctx) {\n\t var i = undefined;\n\t var nu = undefined;\n\n\t if (typeof value === 'object' && value !== null && !(value instanceof Boolean) && !(value instanceof Date) && !(value instanceof Number) && !(value instanceof RegExp) && !(value instanceof String)) {\n\n\t // check if current object points back to itself\n\t var cur = ctx.cur;\n\t var parent = ctx.ctx;\n\t while (parent) {\n\t if (parent.cur === cur) {\n\t return undefined;\n\t }\n\t parent = parent.ctx;\n\t }\n\n\t if (isArray(value)) {\n\t nu = [];\n\t for (i = 0; i < value.length; i += 1) {\n\t nu[i] = rmCirc(value[i], { ctx: ctx, cur: value[i] });\n\t }\n\t } else {\n\t nu = {};\n\t forOwn(value, function (v, k) {\n\t nu[k] = rmCirc(value[k], { ctx: ctx, cur: value[k] });\n\t });\n\t }\n\t return nu;\n\t }\n\t return value;\n\t })(object, { ctx: null, cur: object });\n\t },\n\t resolveItem: resolveItem,\n\t resolveId: resolveId,\n\t respond: function respond(response, meta, options) {\n\t if (options.returnMeta === 'array') {\n\t return [response, meta];\n\t } else if (options.returnMeta === 'object') {\n\t return { response: response, meta: meta };\n\t } else {\n\t return response;\n\t }\n\t },\n\t w: w,\n\t // This is where the magic of relations happens.\n\t applyRelationGettersToTarget: function applyRelationGettersToTarget(store, definition, target) {\n\t this.forEach(definition.relationList, function (def) {\n\t var relationName = def.relation;\n\t var localField = def.localField;\n\t var localKey = def.localKey;\n\t var foreignKey = def.foreignKey;\n\t var localKeys = def.localKeys;\n\t var enumerable = typeof def.enumerable === 'boolean' ? def.enumerable : !!definition.relationsEnumerable;\n\t if (typeof def.link === 'boolean' ? def.link : !!definition.linkRelations) {\n\t delete target[localField];\n\t var prop = {\n\t enumerable: enumerable,\n\t set: function set() {}\n\t };\n\t if (def.type === 'belongsTo') {\n\t prop.get = function () {\n\t return get(this, localKey) ? definition.getResource(relationName).get(get(this, localKey)) : undefined;\n\t };\n\t } else if (def.type === 'hasMany') {\n\t prop.get = function () {\n\t var params = {};\n\t if (foreignKey) {\n\t params[foreignKey] = this[definition.idAttribute];\n\t return definition.getResource(relationName).defaultFilter.call(store, store.store[relationName].collection, relationName, params, { allowSimpleWhere: true });\n\t } else if (localKeys) {\n\t var keys = get(this, localKeys) || [];\n\t return definition.getResource(relationName).getAll(isArray(keys) ? keys : _keys(keys));\n\t }\n\t return undefined;\n\t };\n\t } else if (def.type === 'hasOne') {\n\t if (localKey) {\n\t prop.get = function () {\n\t return get(this, localKey) ? definition.getResource(relationName).get(get(this, localKey)) : undefined;\n\t };\n\t } else {\n\t prop.get = function () {\n\t var params = {};\n\t params[foreignKey] = this[definition.idAttribute];\n\t var items = params[foreignKey] ? definition.getResource(relationName).defaultFilter.call(store, store.store[relationName].collection, relationName, params, { allowSimpleWhere: true }) : [];\n\t if (items.length) {\n\t return items[0];\n\t }\n\t return undefined;\n\t };\n\t }\n\t }\n\t if (def.get) {\n\t (function () {\n\t var orig = prop.get;\n\t prop.get = function () {\n\t var _this2 = this;\n\n\t return def.get(definition, def, this, function () {\n\t for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n\t args[_key4] = arguments[_key4];\n\t }\n\n\t return orig.apply(_this2, args);\n\t });\n\t };\n\t })();\n\t }\n\t Object.defineProperty(target, def.localField, prop);\n\t }\n\t });\n\t }\n\t};\n\n/***/ },\n/* 3 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar _get = function get(_x, _x2, _x3) { var _again = true; _function: while (_again) { var object = _x, property = _x2, receiver = _x3; desc = parent = getter = undefined; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x = parent; _x2 = property; _x3 = receiver; _again = true; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };\n\n\tfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\n\tfunction _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; }\n\n\t/**\n\t * Thrown during a method call when an argument passed into the method is invalid.\n\t */\n\n\tvar IllegalArgumentError = (function (_Error) {\n\t _inherits(IllegalArgumentError, _Error);\n\n\t function IllegalArgumentError(message) {\n\t _classCallCheck(this, IllegalArgumentError);\n\n\t _get(Object.getPrototypeOf(IllegalArgumentError.prototype), 'constructor', this).call(this);\n\t if (typeof Error.captureStackTrace === 'function') {\n\t Error.captureStackTrace(this, this.constructor);\n\t }\n\t this.type = this.constructor.name;\n\t this.message = message;\n\t }\n\n\t return IllegalArgumentError;\n\t})(Error)\n\n\t/**\n\t * Thrown when an invariant is violated or unrecoverable error is encountered during execution.\n\t */\n\t;\n\n\tvar RuntimeError = (function (_Error2) {\n\t _inherits(RuntimeError, _Error2);\n\n\t function RuntimeError(message) {\n\t _classCallCheck(this, RuntimeError);\n\n\t _get(Object.getPrototypeOf(RuntimeError.prototype), 'constructor', this).call(this);\n\t if (typeof Error.captureStackTrace === 'function') {\n\t Error.captureStackTrace(this, this.constructor);\n\t }\n\t this.type = this.constructor.name;\n\t this.message = message;\n\t }\n\n\t return RuntimeError;\n\t})(Error)\n\n\t/**\n\t * Thrown when attempting to access or work with a non-existent resource.\n\t */\n\t;\n\n\tvar NonexistentResourceError = (function (_Error3) {\n\t _inherits(NonexistentResourceError, _Error3);\n\n\t function NonexistentResourceError(resourceName) {\n\t _classCallCheck(this, NonexistentResourceError);\n\n\t _get(Object.getPrototypeOf(NonexistentResourceError.prototype), 'constructor', this).call(this);\n\t if (typeof Error.captureStackTrace === 'function') {\n\t Error.captureStackTrace(this, this.constructor);\n\t }\n\t this.type = this.constructor.name;\n\t this.message = resourceName + ' is not a registered resource!';\n\t }\n\n\t return NonexistentResourceError;\n\t})(Error);\n\n\texports['default'] = {\n\t IllegalArgumentError: IllegalArgumentError,\n\t IA: IllegalArgumentError,\n\t RuntimeError: RuntimeError,\n\t R: RuntimeError,\n\t NonexistentResourceError: NonexistentResourceError,\n\t NER: NonexistentResourceError\n\t};\n\n/***/ },\n/* 4 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar _utils = __webpack_require__(2);\n\n\tvar _errors = __webpack_require__(3);\n\n\tvar NER = _errors['default'].NER;\n\tvar IA = _errors['default'].IA;\n\tvar R = _errors['default'].R;\n\n\tvar fakeId = 'DS_' + new Date().getTime();\n\n\tfunction diffIsEmpty(diff) {\n\t return !(_utils['default'].isEmpty(diff.added) && _utils['default'].isEmpty(diff.removed) && _utils['default'].isEmpty(diff.changed));\n\t}\n\n\tfunction check(fnName, resourceName, id, options) {\n\t var _this = this;\n\t var definition = _this.definitions[resourceName];\n\t options = options || {};\n\n\t id = _utils['default'].resolveId(definition, id);\n\t if (!definition) {\n\t throw new NER(resourceName);\n\t } else if (!_utils['default']._sn(id)) {\n\t throw _utils['default']._snErr('id');\n\t }\n\t id = id === fakeId ? undefined : id;\n\n\t options = _utils['default']._(definition, options);\n\n\n\t return { _this: _this, definition: definition, _resourceName: resourceName, _id: id, _options: options };\n\t}\n\n\texports['default'] = {\n\n\t // Return the changes for the given item, if any.\n\t //\n\t // @param resourceName The name of the type of resource of the item whose changes are to be returned.\n\t // @param id The primary key of the item whose changes are to be returned.\n\t // @param options Optional configuration.\n\t // @param options.ignoredChanges Array of strings or regular expressions of fields, the changes of which are to be ignored.\n\t // @returns The changes of the given item, if any.\n\t changes: function changes(resourceName, id, options) {\n\t var _check$call = check.call(this, 'changes', resourceName, id, options);\n\n\t var _this = _check$call._this;\n\t var definition = _check$call.definition;\n\t var _resourceName = _check$call._resourceName;\n\t var _id = _check$call._id;\n\t var _options = _check$call._options;\n\n\t var item = definition.get(_id);\n\t if (item) {\n\t var _ret = (function () {\n\t if (_utils['default'].w) {\n\t // force observation handler to be fired for item if there are changes and `Object.observe` is not available\n\t _this.store[_resourceName].observers[_id].deliver();\n\t }\n\n\t var ignoredChanges = _options.ignoredChanges || [];\n\t // add linked relations to list of ignored changes\n\t _utils['default'].forEach(definition.relationFields, function (field) {\n\t if (!_utils['default'].contains(ignoredChanges, field)) {\n\t ignoredChanges.push(field);\n\t }\n\t });\n\t // calculate changes\n\t var diff = _utils['default'].diffObjectFromOldObject(item, _this.store[_resourceName].previousAttributes[_id], _utils['default'].equals, ignoredChanges);\n\t // remove functions from diff\n\t _utils['default'].forOwn(diff, function (changeset, name) {\n\t var toKeep = [];\n\t _utils['default'].forOwn(changeset, function (value, field) {\n\t if (!_utils['default'].isFunction(value)) {\n\t toKeep.push(field);\n\t }\n\t });\n\t diff[name] = _utils['default'].pick(diff[name], toKeep);\n\t });\n\t // definitely ignore changes to linked relations\n\t _utils['default'].forEach(definition.relationFields, function (field) {\n\t delete diff.added[field];\n\t delete diff.removed[field];\n\t delete diff.changed[field];\n\t });\n\t return {\n\t v: diff\n\t };\n\t })();\n\n\t if (typeof _ret === 'object') return _ret.v;\n\t }\n\t },\n\n\t // Return the change history of the given item, if any.\n\t //\n\t // @param resourceName The name of the type of resource of the item whose change history is to be returned.\n\t // @param id The primary key of the item whose change history is to be returned.\n\t // @returns The change history of the given item, if any.\n\t changeHistory: function changeHistory(resourceName, id) {\n\t var _check$call2 = check.call(this, 'changeHistory', resourceName, id || fakeId);\n\n\t var _this = _check$call2._this;\n\t var definition = _check$call2.definition;\n\t var _resourceName = _check$call2._resourceName;\n\t var _id = _check$call2._id;\n\n\t var resource = _this.store[_resourceName];\n\n\t if (!definition.keepChangeHistory) {\n\t definition.errorFn('changeHistory is disabled for this resource!');\n\t } else {\n\t if (_resourceName) {\n\t var item = definition.get(_id);\n\t if (item) {\n\t return resource.changeHistories[_id];\n\t }\n\t } else {\n\t return resource.changeHistory;\n\t }\n\t }\n\t },\n\n\t // Re-compute the computed properties of the given item.\n\t //\n\t // @param resourceName The name of the type of resource of the item whose computed properties are to be re-computed.\n\t // @param instance The instance whose computed properties are to be re-computed.\n\t // @returns The item whose computed properties were re-computed.\n\t compute: function compute(resourceName, instance) {\n\t var _this = this;\n\t var definition = _this.definitions[resourceName];\n\n\t instance = _utils['default'].resolveItem(_this.store[resourceName], instance);\n\t if (!definition) {\n\t throw new NER(resourceName);\n\t } else if (!instance) {\n\t throw new R('Item not in the store!');\n\t } else if (!_utils['default']._o(instance) && !_utils['default']._sn(instance)) {\n\t throw new IA('\"instance\" must be an object, string or number!');\n\t }\n\n\n\t // re-compute all computed properties\n\t _utils['default'].forOwn(definition.computed, function (fn, field) {\n\t _utils['default'].compute.call(instance, fn, field);\n\t });\n\t return instance;\n\t },\n\n\t // Factory function to create an instance of the specified Resource.\n\t //\n\t // @param resourceName The name of the type of resource of which to create an instance.\n\t // @param attrs Hash of properties with which to initialize the instance.\n\t // @param options Optional configuration.\n\t // @param options.defaults Default values with which to initialize the instance.\n\t // @returns The new instance.\n\t createInstance: function createInstance(resourceName, attrs, options) {\n\t var definition = this.definitions[resourceName];\n\t var item = undefined;\n\n\t attrs = attrs || {};\n\n\t if (!definition) {\n\t throw new NER(resourceName);\n\t } else if (attrs && !_utils['default'].isObject(attrs)) {\n\t throw new IA('\"attrs\" must be an object!');\n\t }\n\n\t options = _utils['default']._(definition, options);\n\n\t // lifecycle\n\t options.beforeCreateInstance(options, attrs);\n\n\t // grab instance constructor function from Resource definition\n\t var Constructor = definition[definition['class']];\n\n\t // create instance\n\t item = new Constructor();\n\n\t // add default values\n\t if (options.defaultValues) {\n\t _utils['default'].deepMixIn(item, options.defaultValues);\n\t }\n\t _utils['default'].deepMixIn(item, attrs);\n\n\t // compute computed properties\n\t if (definition.computed) {\n\t definition.compute(item);\n\t }\n\t // lifecycle\n\t options.afterCreateInstance(options, item);\n\t return item;\n\t },\n\n\t // Create a new collection of the specified Resource.\n\t //\n\t // @param resourceName The name of the type of resource of which to create a collection\n\t // @param arr Possibly empty array of data from which to create the collection.\n\t // @param params The criteria by which to filter items. Will be passed to `DS#findAll` if `fetch` is called. See http://www.js-data.io/docs/query-syntax\n\t // @param options Optional configuration.\n\t // @param options.notify Whether to call the beforeCreateCollection and afterCreateCollection lifecycle hooks..\n\t // @returns The new collection.\n\t createCollection: function createCollection(resourceName, arr, params, options) {\n\t var _this = this;\n\t var definition = _this.definitions[resourceName];\n\n\t arr = arr || [];\n\t params = params || {};\n\n\t if (!definition) {\n\t throw new NER(resourceName);\n\t } else if (arr && !_utils['default'].isArray(arr)) {\n\t throw new IA('\"arr\" must be an array!');\n\t }\n\n\t options = _utils['default']._(definition, options);\n\n\n\t // lifecycle\n\t options.beforeCreateCollection(options, arr);\n\n\t // define the API for this collection\n\t Object.defineProperties(arr, {\n\t // Call DS#findAll with the params of this collection, filling the collection with the results.\n\t fetch: {\n\t value: function value(params, options) {\n\t var __this = this;\n\t __this.params = params || __this.params;\n\t return definition.findAll(__this.params, options).then(function (data) {\n\t if (data === __this) {\n\t return __this;\n\t }\n\t data.unshift(__this.length);\n\t data.unshift(0);\n\t __this.splice.apply(__this, data);\n\t data.shift();\n\t data.shift();\n\t if (data.$$injected) {\n\t _this.store[resourceName].queryData[_utils['default'].toJson(__this.params)] = __this;\n\t __this.$$injected = true;\n\t }\n\t return __this;\n\t });\n\t }\n\t },\n\t // params for this collection. See http://www.js-data.io/docs/query-syntax\n\t params: {\n\t value: params,\n\t writable: true\n\t },\n\t // name of the resource type of this collection\n\t resourceName: {\n\t value: resourceName\n\t }\n\t });\n\n\t // lifecycle\n\t options.afterCreateCollection(options, arr);\n\t return arr;\n\t },\n\t defineResource: __webpack_require__(27),\n\t digest: function digest() {\n\t this.observe.Platform.performMicrotaskCheckpoint();\n\t },\n\t eject: __webpack_require__(28),\n\t ejectAll: __webpack_require__(29),\n\t filter: __webpack_require__(30),\n\n\t // Return the item with the given primary key if its in the store.\n\t //\n\t // @param resourceName The name of the type of resource of the item to retrieve.\n\t // @param id The primary key of the item to retrieve.\n\t // @returns The item with the given primary key if it's in the store.\n\t ///\n\t get: function get(resourceName, id) {\n\t var _check$call3 = check.call(this, 'get', resourceName, id);\n\n\t // return the item if it exists\n\t var _this = _check$call3._this;\n\t var _resourceName = _check$call3._resourceName;\n\t var _id = _check$call3._id;\n\t return _this.store[_resourceName].index[_id];\n\t },\n\n\t // Return the items in the store that have the given primary keys.\n\t //\n\t // @param resourceName The name of the type of resource of the items to retrieve.\n\t // @param ids The primary keys of the items to retrieve.\n\t // @returns The items with the given primary keys if they're in the store.\n\t getAll: function getAll(resourceName, ids) {\n\t var _this = this;\n\t var definition = _this.definitions[resourceName];\n\t var resource = _this.store[resourceName];\n\t var collection = [];\n\n\t if (!definition) {\n\t throw new NER(resourceName);\n\t } else if (ids && !_utils['default']._a(ids)) {\n\t throw _utils['default']._aErr('ids');\n\t }\n\n\n\t if (_utils['default']._a(ids)) {\n\t // return just the items with the given primary keys\n\t var _length = ids.length;\n\t for (var i = 0; i < _length; i++) {\n\t if (resource.index[ids[i]]) {\n\t collection.push(resource.index[ids[i]]);\n\t }\n\t }\n\t } else {\n\t // most efficient of retrieving ALL items from the store\n\t collection = resource.collection.slice();\n\t }\n\n\t return collection;\n\t },\n\n\t // Return the whether the item with the given primary key has any changes.\n\t //\n\t // @param resourceName The name of the type of resource of the item.\n\t // @param id The primary key of the item.\n\t // @returns Whether the item with the given primary key has any changes.\n\t hasChanges: function hasChanges(resourceName, id) {\n\t var _check$call4 = check.call(this, 'hasChanges', resourceName, id);\n\n\t var definition = _check$call4.definition;\n\t var _id = _check$call4._id;\n\n\t return definition.get(_id) ? diffIsEmpty(definition.changes(_id)) : false;\n\t },\n\t inject: __webpack_require__(31),\n\n\t // Return the timestamp from the last time the item with the given primary key was changed.\n\t //\n\t // @param resourceName The name of the type of resource of the item.\n\t // @param id The primary key of the item.\n\t // @returns Timestamp from the last time the item was changed.\n\t lastModified: function lastModified(resourceName, id) {\n\t var _check$call5 = check.call(this, 'lastModified', resourceName, id || fakeId);\n\n\t var _this = _check$call5._this;\n\t var _resourceName = _check$call5._resourceName;\n\t var _id = _check$call5._id;\n\n\t var resource = _this.store[_resourceName];\n\n\t if (_id) {\n\t if (!(_id in resource.modified)) {\n\t resource.modified[_id] = 0;\n\t }\n\t return resource.modified[_id];\n\t }\n\t return resource.collectionModified;\n\t },\n\n\t // Return the timestamp from the last time the item with the given primary key was saved via an adapter.\n\t //\n\t // @param resourceName The name of the type of resource of the item.\n\t // @param id The primary key of the item.\n\t // @returns Timestamp from the last time the item was saved.\n\t lastSaved: function lastSaved(resourceName, id) {\n\t var _check$call6 = check.call(this, 'lastSaved', resourceName, id || fakeId);\n\n\t var _this = _check$call6._this;\n\t var _resourceName = _check$call6._resourceName;\n\t var _id = _check$call6._id;\n\n\t var resource = _this.store[_resourceName];\n\n\t if (!(_id in resource.saved)) {\n\t resource.saved[_id] = 0;\n\t }\n\t return resource.saved[_id];\n\t },\n\n\t // Return the previous attributes of the item with the given primary key before it was changed.\n\t //\n\t // @param resourceName The name of the type of resource of the item.\n\t // @param id The primary key of the item.\n\t // @returns The previous attributes of the item\n\t previous: function previous(resourceName, id) {\n\t var _check$call7 = check.call(this, 'previous', resourceName, id);\n\n\t var _this = _check$call7._this;\n\t var _resourceName = _check$call7._resourceName;\n\t var _id = _check$call7._id;\n\n\t var resource = _this.store[_resourceName];\n\n\t // return resource from cache\n\t return resource.previousAttributes[_id] ? _utils['default'].copy(resource.previousAttributes[_id]) : undefined;\n\t },\n\n\t // Revert all attributes of the item with the given primary key to their previous values.\n\t //\n\t // @param resourceName The name of the type of resource of the item.\n\t // @param id The primary key of the item.\n\t // @returns The reverted item\n\t revert: function revert(resourceName, id) {\n\t var _check$call8 = check.call(this, 'revert', resourceName, id);\n\n\t var _this = _check$call8._this;\n\t var definition = _check$call8.definition;\n\t var _resourceName = _check$call8._resourceName;\n\t var _id = _check$call8._id;\n\n\t return definition.inject(_this.previous(_resourceName, _id));\n\t }\n\t};\n\n/***/ },\n/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\texports['default'] = {\n\t create: __webpack_require__(32),\n\t destroy: __webpack_require__(33),\n\t destroyAll: __webpack_require__(34),\n\t find: __webpack_require__(35),\n\t findAll: __webpack_require__(36),\n\t loadRelations: __webpack_require__(37),\n\t reap: __webpack_require__(38),\n\t refresh: function refresh(resourceName, id, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\n\t return new DSUtils.Promise(function (resolve, reject) {\n\t var definition = _this.definitions[resourceName];\n\t id = DSUtils.resolveId(_this.definitions[resourceName], id);\n\t if (!definition) {\n\t reject(new _this.errors.NER(resourceName));\n\t } else if (!DSUtils._sn(id)) {\n\t reject(DSUtils._snErr('id'));\n\t } else {\n\t options = DSUtils._(definition, options);\n\t options.bypassCache = true;\n\t resolve(_this.get(resourceName, id));\n\t }\n\t }).then(function (item) {\n\t return item ? _this.find(resourceName, id, options) : item;\n\t });\n\t },\n\t refreshAll: function refreshAll(resourceName, params, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var definition = _this.definitions[resourceName];\n\t params = params || {};\n\n\t return new DSUtils.Promise(function (resolve, reject) {\n\t if (!definition) {\n\t reject(new _this.errors.NER(resourceName));\n\t } else if (!DSUtils._o(params)) {\n\t reject(DSUtils._oErr('params'));\n\t } else {\n\t options = DSUtils._(definition, options);\n\t options.bypassCache = true;\n\t resolve(_this.filter(resourceName, params, options));\n\t }\n\t }).then(function (existing) {\n\t options.bypassCache = true;\n\t return _this.findAll(resourceName, params, options).then(function (found) {\n\t DSUtils.forEach(existing, function (item) {\n\t if (found.indexOf(item) === -1) {\n\t definition.eject(item);\n\t }\n\t });\n\t return found;\n\t });\n\t });\n\t },\n\t save: __webpack_require__(39),\n\t update: __webpack_require__(40),\n\t updateAll: __webpack_require__(41)\n\t};\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/*\n\t * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n\t * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n\t * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n\t * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n\t * Code distributed by Google as part of the polymer project is also\n\t * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n\t */\n\n\t// Modifications\n\t// Copyright 2014-2015 Jason Dobry\n\t//\n\t// Summary of modifications:\n\t// Fixed use of \"delete\" keyword for IE8 compatibility\n\t// Exposed diffObjectFromOldObject on the exported object\n\t// Added the \"equals\" argument to diffObjectFromOldObject to be used to check equality\n\t// Added a way in diffObjectFromOldObject to ignore changes to certain properties\n\t// Removed all code related to:\n\t// - ArrayObserver\n\t// - ArraySplice\n\t// - PathObserver\n\t// - CompoundObserver\n\t// - Path\n\t// - ObserverTransform\n\n\t(function(global) {\n\t var testingExposeCycleCount = global.testingExposeCycleCount;\n\n\t // Detect and do basic sanity checking on Object/Array.observe.\n\t function detectObjectObserve() {\n\t if (typeof Object.observe !== 'function' ||\n\t typeof Array.observe !== 'function') {\n\t return false;\n\t }\n\n\t var records = [];\n\n\t function callback(recs) {\n\t records = recs;\n\t }\n\n\t var test = {};\n\t var arr = [];\n\t Object.observe(test, callback);\n\t Array.observe(arr, callback);\n\t test.id = 1;\n\t test.id = 2;\n\t delete test.id;\n\t arr.push(1, 2);\n\t arr.length = 0;\n\n\t Object.deliverChangeRecords(callback);\n\t if (records.length !== 5)\n\t return false;\n\n\t if (records[0].type != 'add' ||\n\t records[1].type != 'update' ||\n\t records[2].type != 'delete' ||\n\t records[3].type != 'splice' ||\n\t records[4].type != 'splice') {\n\t return false;\n\t }\n\n\t Object.unobserve(test, callback);\n\t Array.unobserve(arr, callback);\n\n\t return true;\n\t }\n\n\t var hasObserve = detectObjectObserve();\n\n\t var createObject = ('__proto__' in {}) ?\n\t function(obj) { return obj; } :\n\t function(obj) {\n\t var proto = obj.__proto__;\n\t if (!proto)\n\t return obj;\n\t var newObject = Object.create(proto);\n\t Object.getOwnPropertyNames(obj).forEach(function(name) {\n\t Object.defineProperty(newObject, name,\n\t Object.getOwnPropertyDescriptor(obj, name));\n\t });\n\t return newObject;\n\t };\n\n\t var MAX_DIRTY_CHECK_CYCLES = 1000;\n\n\t function dirtyCheck(observer) {\n\t var cycles = 0;\n\t while (cycles < MAX_DIRTY_CHECK_CYCLES && observer.check_()) {\n\t cycles++;\n\t }\n\t if (testingExposeCycleCount)\n\t global.dirtyCheckCycleCount = cycles;\n\n\t return cycles > 0;\n\t }\n\n\t function objectIsEmpty(object) {\n\t for (var prop in object)\n\t return false;\n\t return true;\n\t }\n\n\t function diffIsEmpty(diff) {\n\t return objectIsEmpty(diff.added) &&\n\t objectIsEmpty(diff.removed) &&\n\t objectIsEmpty(diff.changed);\n\t }\n\n\t function isBlacklisted(prop, bl) {\n\t if (!bl || !bl.length) {\n\t return false;\n\t }\n\t var matches;\n\t for (var i = 0; i < bl.length; i++) {\n\t if ((Object.prototype.toString.call(bl[i]) === '[object RegExp]' && bl[i].test(prop)) || bl[i] === prop) {\n\t return matches = prop;\n\t }\n\t }\n\t return !!matches;\n\t }\n\n\t function diffObjectFromOldObject(object, oldObject, equals, bl) {\n\t var added = {};\n\t var removed = {};\n\t var changed = {};\n\n\t for (var prop in oldObject) {\n\t var newValue = object[prop];\n\n\t if (isBlacklisted(prop, bl))\n\t continue;\n\n\t if (newValue !== undefined && (equals ? equals(newValue, oldObject[prop]) : newValue === oldObject[prop]))\n\t continue;\n\n\t if (!(prop in object)) {\n\t removed[prop] = undefined;\n\t continue;\n\t }\n\n\t if (equals ? !equals(newValue, oldObject[prop]) : newValue !== oldObject[prop])\n\t changed[prop] = newValue;\n\t }\n\n\t for (var prop in object) {\n\t if (prop in oldObject)\n\t continue;\n\n\t if (isBlacklisted(prop, bl))\n\t continue;\n\n\t added[prop] = object[prop];\n\t }\n\n\t if (Array.isArray(object) && object.length !== oldObject.length)\n\t changed.length = object.length;\n\n\t return {\n\t added: added,\n\t removed: removed,\n\t changed: changed\n\t };\n\t }\n\n\t var eomTasks = [];\n\t function runEOMTasks() {\n\t if (!eomTasks.length)\n\t return false;\n\n\t for (var i = 0; i < eomTasks.length; i++) {\n\t eomTasks[i]();\n\t }\n\t eomTasks.length = 0;\n\t return true;\n\t }\n\n\t var runEOM = hasObserve ? (function(){\n\t return function(fn) {\n\t return Promise.resolve().then(fn);\n\t }\n\t })() :\n\t (function() {\n\t return function(fn) {\n\t eomTasks.push(fn);\n\t };\n\t })();\n\n\t var observedObjectCache = [];\n\n\t function newObservedObject() {\n\t var observer;\n\t var object;\n\t var discardRecords = false;\n\t var first = true;\n\n\t function callback(records) {\n\t if (observer && observer.state_ === OPENED && !discardRecords)\n\t observer.check_(records);\n\t }\n\n\t return {\n\t open: function(obs) {\n\t if (observer)\n\t throw Error('ObservedObject in use');\n\n\t if (!first)\n\t Object.deliverChangeRecords(callback);\n\n\t observer = obs;\n\t first = false;\n\t },\n\t observe: function(obj, arrayObserve) {\n\t object = obj;\n\t if (arrayObserve)\n\t Array.observe(object, callback);\n\t else\n\t Object.observe(object, callback);\n\t },\n\t deliver: function(discard) {\n\t discardRecords = discard;\n\t Object.deliverChangeRecords(callback);\n\t discardRecords = false;\n\t },\n\t close: function() {\n\t observer = undefined;\n\t Object.unobserve(object, callback);\n\t observedObjectCache.push(this);\n\t }\n\t };\n\t }\n\n\t function getObservedObject(observer, object, arrayObserve) {\n\t var dir = observedObjectCache.pop() || newObservedObject();\n\t dir.open(observer);\n\t dir.observe(object, arrayObserve);\n\t return dir;\n\t }\n\n\t var UNOPENED = 0;\n\t var OPENED = 1;\n\t var CLOSED = 2;\n\n\t var nextObserverId = 1;\n\n\t function Observer() {\n\t this.state_ = UNOPENED;\n\t this.callback_ = undefined;\n\t this.target_ = undefined; // TODO(rafaelw): Should be WeakRef\n\t this.directObserver_ = undefined;\n\t this.value_ = undefined;\n\t this.id_ = nextObserverId++;\n\t }\n\n\t Observer.prototype = {\n\t open: function(callback, target) {\n\t if (this.state_ != UNOPENED)\n\t throw Error('Observer has already been opened.');\n\n\t addToAll(this);\n\t this.callback_ = callback;\n\t this.target_ = target;\n\t this.connect_();\n\t this.state_ = OPENED;\n\t return this.value_;\n\t },\n\n\t close: function() {\n\t if (this.state_ != OPENED)\n\t return;\n\n\t removeFromAll(this);\n\t this.disconnect_();\n\t this.value_ = undefined;\n\t this.callback_ = undefined;\n\t this.target_ = undefined;\n\t this.state_ = CLOSED;\n\t },\n\n\t deliver: function() {\n\t if (this.state_ != OPENED)\n\t return;\n\n\t dirtyCheck(this);\n\t },\n\n\t report_: function(changes) {\n\t try {\n\t this.callback_.apply(this.target_, changes);\n\t } catch (ex) {\n\t Observer._errorThrownDuringCallback = true;\n\t console.error('Exception caught during observer callback: ' +\n\t (ex.stack || ex));\n\t }\n\t },\n\n\t discardChanges: function() {\n\t this.check_(undefined, true);\n\t return this.value_;\n\t }\n\t }\n\n\t var collectObservers = !hasObserve;\n\t var allObservers;\n\t Observer._allObserversCount = 0;\n\n\t if (collectObservers) {\n\t allObservers = [];\n\t }\n\n\t function addToAll(observer) {\n\t Observer._allObserversCount++;\n\t if (!collectObservers)\n\t return;\n\n\t allObservers.push(observer);\n\t }\n\n\t function removeFromAll(observer) {\n\t Observer._allObserversCount--;\n\t }\n\n\t var runningMicrotaskCheckpoint = false;\n\n\t global.Platform = global.Platform || {};\n\n\t global.Platform.performMicrotaskCheckpoint = function() {\n\t if (runningMicrotaskCheckpoint)\n\t return;\n\n\t if (!collectObservers)\n\t return;\n\n\t runningMicrotaskCheckpoint = true;\n\n\t var cycles = 0;\n\t var anyChanged, toCheck;\n\n\t do {\n\t cycles++;\n\t toCheck = allObservers;\n\t allObservers = [];\n\t anyChanged = false;\n\n\t for (var i = 0; i < toCheck.length; i++) {\n\t var observer = toCheck[i];\n\t if (observer.state_ != OPENED)\n\t continue;\n\n\t if (observer.check_())\n\t anyChanged = true;\n\n\t allObservers.push(observer);\n\t }\n\t if (runEOMTasks())\n\t anyChanged = true;\n\t } while (cycles < MAX_DIRTY_CHECK_CYCLES && anyChanged);\n\n\t if (testingExposeCycleCount)\n\t global.dirtyCheckCycleCount = cycles;\n\n\t runningMicrotaskCheckpoint = false;\n\t };\n\n\t if (collectObservers) {\n\t global.Platform.clearObservers = function() {\n\t allObservers = [];\n\t };\n\t }\n\n\t function ObjectObserver(object) {\n\t Observer.call(this);\n\t this.value_ = object;\n\t this.oldObject_ = undefined;\n\t }\n\n\t ObjectObserver.prototype = createObject({\n\t __proto__: Observer.prototype,\n\n\t arrayObserve: false,\n\n\t connect_: function(callback, target) {\n\t if (hasObserve) {\n\t this.directObserver_ = getObservedObject(this, this.value_,\n\t this.arrayObserve);\n\t } else {\n\t this.oldObject_ = this.copyObject(this.value_);\n\t }\n\n\t },\n\n\t copyObject: function(object) {\n\t var copy = Array.isArray(object) ? [] : {};\n\t for (var prop in object) {\n\t copy[prop] = object[prop];\n\t };\n\t if (Array.isArray(object))\n\t copy.length = object.length;\n\t return copy;\n\t },\n\n\t check_: function(changeRecords, skipChanges) {\n\t var diff;\n\t var oldValues;\n\t if (hasObserve) {\n\t if (!changeRecords)\n\t return false;\n\n\t oldValues = {};\n\t diff = diffObjectFromChangeRecords(this.value_, changeRecords,\n\t oldValues);\n\t } else {\n\t oldValues = this.oldObject_;\n\t diff = diffObjectFromOldObject(this.value_, this.oldObject_);\n\t }\n\n\t if (diffIsEmpty(diff))\n\t return false;\n\n\t if (!hasObserve)\n\t this.oldObject_ = this.copyObject(this.value_);\n\n\t this.report_([\n\t diff.added || {},\n\t diff.removed || {},\n\t diff.changed || {},\n\t function(property) {\n\t return oldValues[property];\n\t }\n\t ]);\n\n\t return true;\n\t },\n\n\t disconnect_: function() {\n\t if (hasObserve) {\n\t this.directObserver_.close();\n\t this.directObserver_ = undefined;\n\t } else {\n\t this.oldObject_ = undefined;\n\t }\n\t },\n\n\t deliver: function() {\n\t if (this.state_ != OPENED)\n\t return;\n\n\t if (hasObserve)\n\t this.directObserver_.deliver(false);\n\t else\n\t dirtyCheck(this);\n\t },\n\n\t discardChanges: function() {\n\t if (this.directObserver_)\n\t this.directObserver_.deliver(true);\n\t else\n\t this.oldObject_ = this.copyObject(this.value_);\n\n\t return this.value_;\n\t }\n\t });\n\n\t var observerSentinel = {};\n\n\t var expectedRecordTypes = {\n\t add: true,\n\t update: true,\n\t 'delete': true\n\t };\n\n\t function diffObjectFromChangeRecords(object, changeRecords, oldValues) {\n\t var added = {};\n\t var removed = {};\n\n\t for (var i = 0; i < changeRecords.length; i++) {\n\t var record = changeRecords[i];\n\t if (!expectedRecordTypes[record.type]) {\n\t console.error('Unknown changeRecord type: ' + record.type);\n\t console.error(record);\n\t continue;\n\t }\n\n\t if (!(record.name in oldValues))\n\t oldValues[record.name] = record.oldValue;\n\n\t if (record.type == 'update')\n\t continue;\n\n\t if (record.type == 'add') {\n\t if (record.name in removed)\n\t delete removed[record.name];\n\t else\n\t added[record.name] = true;\n\n\t continue;\n\t }\n\n\t // type = 'delete'\n\t if (record.name in added) {\n\t delete added[record.name];\n\t delete oldValues[record.name];\n\t } else {\n\t removed[record.name] = true;\n\t }\n\t }\n\n\t for (var prop in added)\n\t added[prop] = object[prop];\n\n\t for (var prop in removed)\n\t removed[prop] = undefined;\n\n\t var changed = {};\n\t for (var prop in oldValues) {\n\t if (prop in added || prop in removed)\n\t continue;\n\n\t var newValue = object[prop];\n\t if (oldValues[prop] !== newValue)\n\t changed[prop] = newValue;\n\t }\n\n\t return {\n\t added: added,\n\t removed: removed,\n\t changed: changed\n\t };\n\t }\n\n\t // Export the observe-js object for **Node.js**, with backwards-compatibility\n\t // for the old `require()` API. Also ensure `exports` is not a DOM Element.\n\t // If we're in the browser, export as a global object.\n\n\t global.Observer = Observer;\n\t global.isBlacklisted = isBlacklisted;\n\t global.Observer.runEOM_ = runEOM;\n\t global.Observer.observerSentinel_ = observerSentinel; // for testing.\n\t global.Observer.hasObjectObserve = hasObserve;\n\t global.diffObjectFromOldObject = diffObjectFromOldObject;\n\t global.ObjectObserver = ObjectObserver;\n\n\t})(exports);\n\n\n/***/ },\n/* 7 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/*!\n\t * yabh\n\t * @version 1.1.0 - Homepage \n\t * @author Jason Dobry \n\t * @copyright (c) 2015 Jason Dobry \n\t * @license MIT \n\t * \n\t * @overview Yet another Binary Heap.\n\t */\n\t(function webpackUniversalModuleDefinition(root, factory) {\n\t\tif(true)\n\t\t\tmodule.exports = factory();\n\t\telse if(typeof define === 'function' && define.amd)\n\t\t\tdefine(\"yabh\", factory);\n\t\telse if(typeof exports === 'object')\n\t\t\texports[\"BinaryHeap\"] = factory();\n\t\telse\n\t\t\troot[\"BinaryHeap\"] = factory();\n\t})(this, function() {\n\treturn /******/ (function(modules) { // webpackBootstrap\n\t/******/ \t// The module cache\n\t/******/ \tvar installedModules = {};\n\n\t/******/ \t// The require function\n\t/******/ \tfunction __webpack_require__(moduleId) {\n\n\t/******/ \t\t// Check if module is in cache\n\t/******/ \t\tif(installedModules[moduleId])\n\t/******/ \t\t\treturn installedModules[moduleId].exports;\n\n\t/******/ \t\t// Create a new module (and put it into the cache)\n\t/******/ \t\tvar module = installedModules[moduleId] = {\n\t/******/ \t\t\texports: {},\n\t/******/ \t\t\tid: moduleId,\n\t/******/ \t\t\tloaded: false\n\t/******/ \t\t};\n\n\t/******/ \t\t// Execute the module function\n\t/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t/******/ \t\t// Flag the module as loaded\n\t/******/ \t\tmodule.loaded = true;\n\n\t/******/ \t\t// Return the exports of the module\n\t/******/ \t\treturn module.exports;\n\t/******/ \t}\n\n\n\t/******/ \t// expose the modules object (__webpack_modules__)\n\t/******/ \t__webpack_require__.m = modules;\n\n\t/******/ \t// expose the module cache\n\t/******/ \t__webpack_require__.c = installedModules;\n\n\t/******/ \t// __webpack_public_path__\n\t/******/ \t__webpack_require__.p = \"\";\n\n\t/******/ \t// Load entry module and return exports\n\t/******/ \treturn __webpack_require__(0);\n\t/******/ })\n\t/************************************************************************/\n\t/******/ ([\n\t/* 0 */\n\t/***/ function(module, exports, __webpack_require__) {\n\n\t\t/**\n\t\t * @method bubbleUp\n\t\t * @param {array} heap The heap.\n\t\t * @param {function} weightFunc The weight function.\n\t\t * @param {number} n The index of the element to bubble up.\n\t\t */\n\t\tfunction bubbleUp(heap, weightFunc, n) {\n\t\t var element = heap[n];\n\t\t var weight = weightFunc(element);\n\t\t // When at 0, an element can not go up any further.\n\t\t while (n > 0) {\n\t\t // Compute the parent element's index, and fetch it.\n\t\t var parentN = Math.floor((n + 1) / 2) - 1;\n\t\t var _parent = heap[parentN];\n\t\t // If the parent has a lesser weight, things are in order and we\n\t\t // are done.\n\t\t if (weight >= weightFunc(_parent)) {\n\t\t break;\n\t\t } else {\n\t\t heap[parentN] = element;\n\t\t heap[n] = _parent;\n\t\t n = parentN;\n\t\t }\n\t\t }\n\t\t}\n\n\t\t/**\n\t\t * @method bubbleDown\n\t\t * @param {array} heap The heap.\n\t\t * @param {function} weightFunc The weight function.\n\t\t * @param {number} n The index of the element to sink down.\n\t\t */\n\t\tvar bubbleDown = function bubbleDown(heap, weightFunc, n) {\n\t\t var length = heap.length;\n\t\t var node = heap[n];\n\t\t var nodeWeight = weightFunc(node);\n\n\t\t while (true) {\n\t\t var child2N = (n + 1) * 2,\n\t\t child1N = child2N - 1;\n\t\t var swap = null;\n\t\t if (child1N < length) {\n\t\t var child1 = heap[child1N],\n\t\t child1Weight = weightFunc(child1);\n\t\t // If the score is less than our node's, we need to swap.\n\t\t if (child1Weight < nodeWeight) {\n\t\t swap = child1N;\n\t\t }\n\t\t }\n\t\t // Do the same checks for the other child.\n\t\t if (child2N < length) {\n\t\t var child2 = heap[child2N],\n\t\t child2Weight = weightFunc(child2);\n\t\t if (child2Weight < (swap === null ? nodeWeight : weightFunc(heap[child1N]))) {\n\t\t swap = child2N;\n\t\t }\n\t\t }\n\n\t\t if (swap === null) {\n\t\t break;\n\t\t } else {\n\t\t heap[n] = heap[swap];\n\t\t heap[swap] = node;\n\t\t n = swap;\n\t\t }\n\t\t }\n\t\t};\n\n\t\tfunction BinaryHeap(weightFunc, compareFunc) {\n\t\t if (!weightFunc) {\n\t\t weightFunc = function (x) {\n\t\t return x;\n\t\t };\n\t\t }\n\t\t if (!compareFunc) {\n\t\t compareFunc = function (x, y) {\n\t\t return x === y;\n\t\t };\n\t\t }\n\t\t if (typeof weightFunc !== 'function') {\n\t\t throw new Error('BinaryHeap([weightFunc][, compareFunc]): \"weightFunc\" must be a function!');\n\t\t }\n\t\t if (typeof compareFunc !== 'function') {\n\t\t throw new Error('BinaryHeap([weightFunc][, compareFunc]): \"compareFunc\" must be a function!');\n\t\t }\n\t\t this.weightFunc = weightFunc;\n\t\t this.compareFunc = compareFunc;\n\t\t this.heap = [];\n\t\t}\n\n\t\tvar BHProto = BinaryHeap.prototype;\n\n\t\tBHProto.push = function (node) {\n\t\t this.heap.push(node);\n\t\t bubbleUp(this.heap, this.weightFunc, this.heap.length - 1);\n\t\t};\n\n\t\tBHProto.peek = function () {\n\t\t return this.heap[0];\n\t\t};\n\n\t\tBHProto.pop = function () {\n\t\t var front = this.heap[0];\n\t\t var end = this.heap.pop();\n\t\t if (this.heap.length > 0) {\n\t\t this.heap[0] = end;\n\t\t bubbleDown(this.heap, this.weightFunc, 0);\n\t\t }\n\t\t return front;\n\t\t};\n\n\t\tBHProto.remove = function (node) {\n\t\t var length = this.heap.length;\n\t\t for (var i = 0; i < length; i++) {\n\t\t if (this.compareFunc(this.heap[i], node)) {\n\t\t var removed = this.heap[i];\n\t\t var end = this.heap.pop();\n\t\t if (i !== length - 1) {\n\t\t this.heap[i] = end;\n\t\t bubbleUp(this.heap, this.weightFunc, i);\n\t\t bubbleDown(this.heap, this.weightFunc, i);\n\t\t }\n\t\t return removed;\n\t\t }\n\t\t }\n\t\t return null;\n\t\t};\n\n\t\tBHProto.removeAll = function () {\n\t\t this.heap = [];\n\t\t};\n\n\t\tBHProto.size = function () {\n\t\t return this.heap.length;\n\t\t};\n\n\t\tmodule.exports = BinaryHeap;\n\n\t/***/ }\n\t/******/ ])\n\t});\n\t;\n\n/***/ },\n/* 8 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\n\t /**\n\t * Array forEach\n\t */\n\t function forEach(arr, callback, thisObj) {\n\t if (arr == null) {\n\t return;\n\t }\n\t var i = -1,\n\t len = arr.length;\n\t while (++i < len) {\n\t // we iterate over sparse items since there is no way to make it\n\t // work properly on IE 7-8. see #64\n\t if ( callback.call(thisObj, arr[i], i, arr) === false ) {\n\t break;\n\t }\n\t }\n\t }\n\n\t module.exports = forEach;\n\n\n\n\n/***/ },\n/* 9 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\n\t /**\n\t * Create slice of source array or array-like object\n\t */\n\t function slice(arr, start, end){\n\t var len = arr.length;\n\n\t if (start == null) {\n\t start = 0;\n\t } else if (start < 0) {\n\t start = Math.max(len + start, 0);\n\t } else {\n\t start = Math.min(start, len);\n\t }\n\n\t if (end == null) {\n\t end = len;\n\t } else if (end < 0) {\n\t end = Math.max(len + end, 0);\n\t } else {\n\t end = Math.min(end, len);\n\t }\n\n\t var result = [];\n\t while (start < end) {\n\t result.push(arr[start++]);\n\t }\n\n\t return result;\n\t }\n\n\t module.exports = slice;\n\n\n\n\n/***/ },\n/* 10 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar indexOf = __webpack_require__(21);\n\n\t /**\n\t * If array contains values.\n\t */\n\t function contains(arr, val) {\n\t return indexOf(arr, val) !== -1;\n\t }\n\t module.exports = contains;\n\n\n\n/***/ },\n/* 11 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar indexOf = __webpack_require__(21);\n\n\t /**\n\t * Remove a single item from the array.\n\t * (it won't remove duplicates, just a single item)\n\t */\n\t function remove(arr, item){\n\t var idx = indexOf(arr, item);\n\t if (idx !== -1) arr.splice(idx, 1);\n\t }\n\n\t module.exports = remove;\n\n\n\n/***/ },\n/* 12 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\n\t /**\n\t * Merge sort (http://en.wikipedia.org/wiki/Merge_sort)\n\t */\n\t function mergeSort(arr, compareFn) {\n\t if (arr == null) {\n\t return [];\n\t } else if (arr.length < 2) {\n\t return arr;\n\t }\n\n\t if (compareFn == null) {\n\t compareFn = defaultCompare;\n\t }\n\n\t var mid, left, right;\n\n\t mid = ~~(arr.length / 2);\n\t left = mergeSort( arr.slice(0, mid), compareFn );\n\t right = mergeSort( arr.slice(mid, arr.length), compareFn );\n\n\t return merge(left, right, compareFn);\n\t }\n\n\t function defaultCompare(a, b) {\n\t return a < b ? -1 : (a > b? 1 : 0);\n\t }\n\n\t function merge(left, right, compareFn) {\n\t var result = [];\n\n\t while (left.length && right.length) {\n\t if (compareFn(left[0], right[0]) <= 0) {\n\t // if 0 it should preserve same order (stable)\n\t result.push(left.shift());\n\t } else {\n\t result.push(right.shift());\n\t }\n\t }\n\n\t if (left.length) {\n\t result.push.apply(result, left);\n\t }\n\n\t if (right.length) {\n\t result.push.apply(result, right);\n\t }\n\n\t return result;\n\t }\n\n\t module.exports = mergeSort;\n\n\n\n\n/***/ },\n/* 13 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar hasOwn = __webpack_require__(22);\n\tvar forIn = __webpack_require__(23);\n\n\t /**\n\t * Similar to Array/forEach but works over object properties and fixes Don't\n\t * Enum bug on IE.\n\t * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation\n\t */\n\t function forOwn(obj, fn, thisObj){\n\t forIn(obj, function(val, key){\n\t if (hasOwn(obj, key)) {\n\t return fn.call(thisObj, obj[key], key, obj);\n\t }\n\t });\n\t }\n\n\t module.exports = forOwn;\n\n\n\n\n/***/ },\n/* 14 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar forOwn = __webpack_require__(13);\n\tvar isPlainObject = __webpack_require__(24);\n\n\t /**\n\t * Mixes objects into the target object, recursively mixing existing child\n\t * objects.\n\t */\n\t function deepMixIn(target, objects) {\n\t var i = 0,\n\t n = arguments.length,\n\t obj;\n\n\t while(++i < n){\n\t obj = arguments[i];\n\t if (obj) {\n\t forOwn(obj, copyProp, target);\n\t }\n\t }\n\n\t return target;\n\t }\n\n\t function copyProp(val, key) {\n\t var existing = this[key];\n\t if (isPlainObject(val) && isPlainObject(existing)) {\n\t deepMixIn(existing, val);\n\t } else {\n\t this[key] = val;\n\t }\n\t }\n\n\t module.exports = deepMixIn;\n\n\n\n\n/***/ },\n/* 15 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar slice = __webpack_require__(9);\n\n\t /**\n\t * Return a copy of the object, filtered to only have values for the whitelisted keys.\n\t */\n\t function pick(obj, var_keys){\n\t var keys = typeof arguments[1] !== 'string'? arguments[1] : slice(arguments, 1),\n\t out = {},\n\t i = 0, key;\n\t while (key = keys[i++]) {\n\t out[key] = obj[key];\n\t }\n\t return out;\n\t }\n\n\t module.exports = pick;\n\n\n\n\n/***/ },\n/* 16 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar forOwn = __webpack_require__(13);\n\n\t /**\n\t * Get object keys\n\t */\n\t var keys = Object.keys || function (obj) {\n\t var keys = [];\n\t forOwn(obj, function(val, key){\n\t keys.push(key);\n\t });\n\t return keys;\n\t };\n\n\t module.exports = keys;\n\n\n\n\n/***/ },\n/* 17 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar isPrimitive = __webpack_require__(25);\n\n\t /**\n\t * get \"nested\" object property\n\t */\n\t function get(obj, prop){\n\t var parts = prop.split('.'),\n\t last = parts.pop();\n\n\t while (prop = parts.shift()) {\n\t obj = obj[prop];\n\t if (obj == null) return;\n\t }\n\n\t return obj[last];\n\t }\n\n\t module.exports = get;\n\n\n\n\n/***/ },\n/* 18 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar namespace = __webpack_require__(26);\n\n\t /**\n\t * set \"nested\" object property\n\t */\n\t function set(obj, prop, val){\n\t var parts = (/^(.+)\\.(.+)$/).exec(prop);\n\t if (parts){\n\t namespace(obj, parts[1])[parts[2]] = val;\n\t } else {\n\t obj[prop] = val;\n\t }\n\t }\n\n\t module.exports = set;\n\n\n\n\n/***/ },\n/* 19 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar toString = __webpack_require__(42);\n\tvar camelCase = __webpack_require__(43);\n\tvar upperCase = __webpack_require__(20);\n\t /**\n\t * camelCase + UPPERCASE first char\n\t */\n\t function pascalCase(str){\n\t str = toString(str);\n\t return camelCase(str).replace(/^[a-z]/, upperCase);\n\t }\n\n\t module.exports = pascalCase;\n\n\n\n/***/ },\n/* 20 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar toString = __webpack_require__(42);\n\t /**\n\t * \"Safer\" String.toUpperCase()\n\t */\n\t function upperCase(str){\n\t str = toString(str);\n\t return str.toUpperCase();\n\t }\n\t module.exports = upperCase;\n\n\n\n/***/ },\n/* 21 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\n\t /**\n\t * Array.indexOf\n\t */\n\t function indexOf(arr, item, fromIndex) {\n\t fromIndex = fromIndex || 0;\n\t if (arr == null) {\n\t return -1;\n\t }\n\n\t var len = arr.length,\n\t i = fromIndex < 0 ? len + fromIndex : fromIndex;\n\t while (i < len) {\n\t // we iterate over sparse items since there is no way to make it\n\t // work properly on IE 7-8. see #64\n\t if (arr[i] === item) {\n\t return i;\n\t }\n\n\t i++;\n\t }\n\n\t return -1;\n\t }\n\n\t module.exports = indexOf;\n\n\n\n/***/ },\n/* 22 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\n\t /**\n\t * Safer Object.hasOwnProperty\n\t */\n\t function hasOwn(obj, prop){\n\t return Object.prototype.hasOwnProperty.call(obj, prop);\n\t }\n\n\t module.exports = hasOwn;\n\n\n\n\n/***/ },\n/* 23 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar hasOwn = __webpack_require__(22);\n\n\t var _hasDontEnumBug,\n\t _dontEnums;\n\n\t function checkDontEnum(){\n\t _dontEnums = [\n\t 'toString',\n\t 'toLocaleString',\n\t 'valueOf',\n\t 'hasOwnProperty',\n\t 'isPrototypeOf',\n\t 'propertyIsEnumerable',\n\t 'constructor'\n\t ];\n\n\t _hasDontEnumBug = true;\n\n\t for (var key in {'toString': null}) {\n\t _hasDontEnumBug = false;\n\t }\n\t }\n\n\t /**\n\t * Similar to Array/forEach but works over object properties and fixes Don't\n\t * Enum bug on IE.\n\t * based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation\n\t */\n\t function forIn(obj, fn, thisObj){\n\t var key, i = 0;\n\t // no need to check if argument is a real object that way we can use\n\t // it for arrays, functions, date, etc.\n\n\t //post-pone check till needed\n\t if (_hasDontEnumBug == null) checkDontEnum();\n\n\t for (key in obj) {\n\t if (exec(fn, obj, key, thisObj) === false) {\n\t break;\n\t }\n\t }\n\n\n\t if (_hasDontEnumBug) {\n\t var ctor = obj.constructor,\n\t isProto = !!ctor && obj === ctor.prototype;\n\n\t while (key = _dontEnums[i++]) {\n\t // For constructor, if it is a prototype object the constructor\n\t // is always non-enumerable unless defined otherwise (and\n\t // enumerated above). For non-prototype objects, it will have\n\t // to be defined on this object, since it cannot be defined on\n\t // any prototype objects.\n\t //\n\t // For other [[DontEnum]] properties, check if the value is\n\t // different than Object prototype value.\n\t if (\n\t (key !== 'constructor' ||\n\t (!isProto && hasOwn(obj, key))) &&\n\t obj[key] !== Object.prototype[key]\n\t ) {\n\t if (exec(fn, obj, key, thisObj) === false) {\n\t break;\n\t }\n\t }\n\t }\n\t }\n\t }\n\n\t function exec(fn, obj, key, thisObj){\n\t return fn.call(thisObj, obj[key], key, obj);\n\t }\n\n\t module.exports = forIn;\n\n\n\n\n/***/ },\n/* 24 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\n\t /**\n\t * Checks if the value is created by the `Object` constructor.\n\t */\n\t function isPlainObject(value) {\n\t return (!!value && typeof value === 'object' &&\n\t value.constructor === Object);\n\t }\n\n\t module.exports = isPlainObject;\n\n\n\n\n/***/ },\n/* 25 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\n\t /**\n\t * Checks if the object is a primitive\n\t */\n\t function isPrimitive(value) {\n\t // Using switch fallthrough because it's simple to read and is\n\t // generally fast: http://jsperf.com/testing-value-is-primitive/5\n\t switch (typeof value) {\n\t case \"string\":\n\t case \"number\":\n\t case \"boolean\":\n\t return true;\n\t }\n\n\t return value == null;\n\t }\n\n\t module.exports = isPrimitive;\n\n\n\n\n/***/ },\n/* 26 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar forEach = __webpack_require__(8);\n\n\t /**\n\t * Create nested object if non-existent\n\t */\n\t function namespace(obj, path){\n\t if (!path) return obj;\n\t forEach(path.split('.'), function(key){\n\t if (!obj[key]) {\n\t obj[key] = {};\n\t }\n\t obj = obj[key];\n\t });\n\t return obj;\n\t }\n\n\t module.exports = namespace;\n\n\n\n\n/***/ },\n/* 27 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/*jshint evil:true, loopfunc:true*/\n\n\tvar _utils = __webpack_require__(2);\n\n\tvar _errors = __webpack_require__(3);\n\n\t/**\n\t * These are DS methods that will be proxied by instances. e.g.\n\t *\n\t * var store = new JSData.DS();\n\t * var User = store.defineResource('user');\n\t * var user = User.createInstance({ id: 1 });\n\t *\n\t * store.update(resourceName, id, attrs[, options]) // DS method\n\t * User.update(id, attrs[, options]) // DS method proxied on a Resource\n\t * user.DSUpdate(attrs[, options]) // DS method proxied on an Instance\n\t */\n\tvar instanceMethods = ['compute', 'eject', 'refresh', 'save', 'update', 'destroy', 'loadRelations', 'changeHistory', 'changes', 'hasChanges', 'lastModified', 'lastSaved', 'previous', 'revert'];\n\n\tmodule.exports = function defineResource(definition) {\n\t var _this = this;\n\t var definitions = _this.definitions;\n\n\t /**\n\t * This allows the name-only definition shorthand.\n\t * store.defineResource('user') is the same as store.defineResource({ name: 'user'})\n\t */\n\t if (_utils['default']._s(definition)) {\n\t definition = {\n\t name: definition.replace(/\\s/gi, '')\n\t };\n\t }\n\t if (!_utils['default']._o(definition)) {\n\t throw _utils['default']._oErr('definition');\n\t } else if (!_utils['default']._s(definition.name)) {\n\t throw new _errors['default'].IA('\"name\" must be a string!');\n\t } else if (definitions[definition.name]) {\n\t throw new _errors['default'].R(definition.name + ' is already registered!');\n\t }\n\n\t /**\n\t * Dynamic Resource constructor function.\n\t *\n\t * A Resource inherits from the defaults of the data store that created it.\n\t */\n\t function Resource(options) {\n\t this.defaultValues = {};\n\t this.methods = {};\n\t this.computed = {};\n\t _utils['default'].deepMixIn(this, options);\n\t var parent = _this.defaults;\n\t if (definition['extends'] && definitions[definition['extends']]) {\n\t parent = definitions[definition['extends']];\n\t }\n\t _utils['default'].fillIn(this.defaultValues, parent.defaultValues);\n\t _utils['default'].fillIn(this.methods, parent.methods);\n\t _utils['default'].fillIn(this.computed, parent.computed);\n\t this.endpoint = 'endpoint' in options ? options.endpoint : this.name;\n\t }\n\n\t try {\n\t var def;\n\n\t var _class;\n\n\t var _ret = (function () {\n\t // Resources can inherit from another resource instead of inheriting directly from the data store defaults.\n\t if (definition['extends'] && definitions[definition['extends']]) {\n\t // Inherit from another resource\n\t Resource.prototype = definitions[definition['extends']];\n\t } else {\n\t // Inherit from global defaults\n\t Resource.prototype = _this.defaults;\n\t }\n\t definitions[definition.name] = new Resource(definition);\n\n\t def = definitions[definition.name];\n\n\t def.getResource = function (resourceName) {\n\t return _this.definitions[resourceName];\n\t };\n\n\n\t if (!_utils['default']._s(def.idAttribute)) {\n\t throw new _errors['default'].IA('\"idAttribute\" must be a string!');\n\t }\n\n\t // Setup nested parent configuration\n\t if (def.relations) {\n\t def.relationList = [];\n\t def.relationFields = [];\n\t _utils['default'].forOwn(def.relations, function (relatedModels, type) {\n\t _utils['default'].forOwn(relatedModels, function (defs, relationName) {\n\t if (!_utils['default']._a(defs)) {\n\t relatedModels[relationName] = [defs];\n\t }\n\t _utils['default'].forEach(relatedModels[relationName], function (d) {\n\t d.type = type;\n\t d.relation = relationName;\n\t d.name = def.name;\n\t def.relationList.push(d);\n\t if (d.localField) {\n\t def.relationFields.push(d.localField);\n\t }\n\t });\n\t });\n\t });\n\t if (def.relations.belongsTo) {\n\t _utils['default'].forOwn(def.relations.belongsTo, function (relatedModel, modelName) {\n\t _utils['default'].forEach(relatedModel, function (relation) {\n\t if (relation.parent) {\n\t def.parent = modelName;\n\t def.parentKey = relation.localKey;\n\t def.parentField = relation.localField;\n\t }\n\t });\n\t });\n\t }\n\t if (typeof Object.freeze === 'function') {\n\t Object.freeze(def.relations);\n\t Object.freeze(def.relationList);\n\t }\n\t }\n\n\t // Create the wrapper class for the new resource\n\t _class = def['class'] = _utils['default'].pascalCase(def.name);\n\n\t try {\n\t if (typeof def.useClass === 'function') {\n\t eval('function ' + _class + '() { def.useClass.call(this); }');\n\t def[_class] = eval(_class);\n\t def[_class].prototype = (function (proto) {\n\t function Ctor() {}\n\n\t Ctor.prototype = proto;\n\t return new Ctor();\n\t })(def.useClass.prototype);\n\t } else {\n\t eval('function ' + _class + '() {}');\n\t def[_class] = eval(_class);\n\t }\n\t } catch (e) {\n\t def[_class] = function () {};\n\t }\n\n\t // Apply developer-defined instance methods\n\t _utils['default'].forOwn(def.methods, function (fn, m) {\n\t def[_class].prototype[m] = fn;\n\t });\n\n\t /**\n\t * var user = User.createInstance({ id: 1 });\n\t * user.set('foo', 'bar');\n\t */\n\t def[_class].prototype.set = function (key, value) {\n\t var _this2 = this;\n\n\t _utils['default'].set(this, key, value);\n\t def.compute(this);\n\t if (def.instanceEvents) {\n\t setTimeout(function () {\n\t _this2.emit('DS.change', def, _this2);\n\t }, 0);\n\t }\n\t def.handleChange(this);\n\t return this;\n\t };\n\n\t /**\n\t * var user = User.createInstance({ id: 1 });\n\t * user.get('id'); // 1\n\t */\n\t def[_class].prototype.get = function (key) {\n\t return _utils['default'].get(this, key);\n\t };\n\n\t if (def.instanceEvents) {\n\t _utils['default'].Events(def[_class].prototype);\n\t }\n\n\t // Setup the relation links\n\t _utils['default'].applyRelationGettersToTarget(_this, def, def[_class].prototype);\n\n\t var parentOmit = null;\n\t if (!def.hasOwnProperty('omit')) {\n\t parentOmit = def.omit;\n\t def.omit = [];\n\t } else {\n\t parentOmit = _this.defaults.omit;\n\t }\n\t def.omit = def.omit.concat(parentOmit || []);\n\n\t // Prepare for computed properties\n\t _utils['default'].forOwn(def.computed, function (fn, field) {\n\t if (_utils['default'].isFunction(fn)) {\n\t def.computed[field] = [fn];\n\t fn = def.computed[field];\n\t }\n\t if (def.methods && field in def.methods) {\n\t def.errorFn('Computed property \"' + field + '\" conflicts with previously defined prototype method!');\n\t }\n\t def.omit.push(field);\n\t var deps;\n\t if (fn.length === 1) {\n\t var match = fn[0].toString().match(/function.*?\\(([\\s\\S]*?)\\)/);\n\t deps = match[1].split(',');\n\t def.computed[field] = deps.concat(fn);\n\t fn = def.computed[field];\n\t if (deps.length) {\n\t def.errorFn('Use the computed property array syntax for compatibility with minified code!');\n\t }\n\t }\n\t deps = fn.slice(0, fn.length - 1);\n\t _utils['default'].forEach(deps, function (val, index) {\n\t deps[index] = val.trim();\n\t });\n\t fn.deps = _utils['default'].filter(deps, function (dep) {\n\t return !!dep;\n\t });\n\t });\n\n\t // add instance proxies of DS methods\n\t _utils['default'].forEach(instanceMethods, function (name) {\n\t def[_class].prototype['DS' + _utils['default'].pascalCase(name)] = function () {\n\t for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n\t args[_key] = arguments[_key];\n\t }\n\n\t args.unshift(this[def.idAttribute] || this);\n\t args.unshift(def.name);\n\t return _this[name].apply(_this, args);\n\t };\n\t });\n\n\t // manually add instance proxy for DS#create\n\t def[_class].prototype.DSCreate = function () {\n\t for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n\t args[_key2] = arguments[_key2];\n\t }\n\n\t args.unshift(this);\n\t args.unshift(def.name);\n\t return _this.create.apply(_this, args);\n\t };\n\n\t // Initialize store data for the new resource\n\t _this.store[def.name] = {\n\t collection: [],\n\t expiresHeap: new _utils['default'].BinaryHeap(function (x) {\n\t return x.expires;\n\t }, function (x, y) {\n\t return x.item === y;\n\t }),\n\t completedQueries: {},\n\t queryData: {},\n\t pendingQueries: {},\n\t index: {},\n\t modified: {},\n\t saved: {},\n\t previousAttributes: {},\n\t observers: {},\n\t changeHistories: {},\n\t changeHistory: [],\n\t collectionModified: 0\n\t };\n\n\t var resource = _this.store[def.name];\n\n\t // start the reaping\n\t if (def.reapInterval) {\n\t setInterval(function () {\n\t return def.reap();\n\t }, def.reapInterval);\n\t }\n\n\t // proxy DS methods with shorthand ones\n\t var fns = ['registerAdapter', 'getAdapterName', 'getAdapter', 'is', '!clear'];\n\t for (var key in _this) {\n\t if (typeof _this[key] === 'function') {\n\t fns.push(key);\n\t }\n\t }\n\n\t /**\n\t * Create the Resource shorthands that proxy DS methods. e.g.\n\t *\n\t * var store = new JSData.DS();\n\t * var User = store.defineResource('user');\n\t *\n\t * store.update(resourceName, id, attrs[, options]) // DS method\n\t * User.update(id, attrs[, options]) // DS method proxied on a Resource\n\t */\n\t _utils['default'].forEach(fns, function (key) {\n\t var k = key;\n\t if (k[0] === '!') {\n\t return;\n\t }\n\t if (_this[k].shorthand !== false) {\n\t def[k] = function () {\n\t for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n\t args[_key3] = arguments[_key3];\n\t }\n\n\t args.unshift(def.name);\n\t return _this[k].apply(_this, args);\n\t };\n\t def[k].before = function (fn) {\n\t var orig = def[k];\n\t def[k] = function () {\n\t for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n\t args[_key4] = arguments[_key4];\n\t }\n\n\t return orig.apply(def, fn.apply(def, args) || args);\n\t };\n\t };\n\t } else {\n\t def[k] = function () {\n\t for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n\t args[_key5] = arguments[_key5];\n\t }\n\n\t return _this[k].apply(_this, args);\n\t };\n\t }\n\t });\n\n\t def.beforeValidate = _utils['default'].promisify(def.beforeValidate);\n\t def.validate = _utils['default'].promisify(def.validate);\n\t def.afterValidate = _utils['default'].promisify(def.afterValidate);\n\t def.beforeCreate = _utils['default'].promisify(def.beforeCreate);\n\t def.afterCreate = _utils['default'].promisify(def.afterCreate);\n\t def.beforeUpdate = _utils['default'].promisify(def.beforeUpdate);\n\t def.afterUpdate = _utils['default'].promisify(def.afterUpdate);\n\t def.beforeDestroy = _utils['default'].promisify(def.beforeDestroy);\n\t def.afterDestroy = _utils['default'].promisify(def.afterDestroy);\n\n\t var defaultAdapter = undefined;\n\t if (def.hasOwnProperty('defaultAdapter')) {\n\t defaultAdapter = def.defaultAdapter;\n\t }\n\n\t // setup \"actions\"\n\t _utils['default'].forOwn(def.actions, function (action, name) {\n\t if (def[name] && !def.actions[name]) {\n\t throw new Error('Cannot override existing method \"' + name + '\"!');\n\t }\n\t action.request = action.request || function (config) {\n\t return config;\n\t };\n\t action.response = action.response || function (response) {\n\t return response;\n\t };\n\t action.responseError = action.responseError || function (err) {\n\t return _utils['default'].Promise.reject(err);\n\t };\n\t def[name] = function (id, options) {\n\t if (_utils['default']._o(id)) {\n\t options = id;\n\t }\n\t options = options || {};\n\t var adapter = def.getAdapter(action.adapter || defaultAdapter || 'http');\n\t var config = _utils['default'].deepMixIn({}, action);\n\t if (!options.hasOwnProperty('endpoint') && config.endpoint) {\n\t options.endpoint = config.endpoint;\n\t }\n\t if (typeof options.getEndpoint === 'function') {\n\t config.url = options.getEndpoint(def, options);\n\t } else {\n\t var args = [options.basePath || adapter.defaults.basePath || def.basePath, adapter.getEndpoint(def, _utils['default']._sn(id) ? id : null, options)];\n\t if (_utils['default']._sn(id)) {\n\t args.push(id);\n\t }\n\t args.push(action.pathname || name);\n\t config.url = _utils['default'].makePath.apply(null, args);\n\t }\n\t config.method = config.method || 'GET';\n\t _utils['default'].deepMixIn(config, options);\n\t return new _utils['default'].Promise(function (r) {\n\t return r(config);\n\t }).then(options.request || action.request).then(function (config) {\n\t return adapter.HTTP(config);\n\t }).then(options.response || action.response, options.responseError || action.responseError);\n\t };\n\t });\n\n\t // mix in events\n\t _utils['default'].Events(def);\n\n\t def.handleChange = function (data) {\n\t resource.collectionModified = _utils['default'].updateTimestamp(resource.collectionModified);\n\t if (def.notify) {\n\t setTimeout(function () {\n\t def.emit('DS.change', def, data);\n\t }, 0);\n\t }\n\t };\n\n\n\t return {\n\t v: def\n\t };\n\t })();\n\n\t if (typeof _ret === 'object') return _ret.v;\n\t } catch (err) {\n\t _this.defaults.errorFn(err);\n\t delete definitions[definition.name];\n\t delete _this.store[definition.name];\n\t throw err;\n\t }\n\t};\n\n/***/ },\n/* 28 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Eject an item from the store, if it is currently in the store.\n\t *\n\t * @param resourceName The name of the resource type of the item eject.\n\t * @param id The primary key of the item to eject.\n\t * @param options Optional configuration.\n\t * @param options.notify Whether to emit the \"DS.beforeEject\" and \"DS.afterEject\" events\n\t * @param options.clearEmptyQueries Whether to remove cached findAll queries that become empty as a result of this method call.\n\t * @returns The ejected item if one was ejected.\n\t */\n\tmodule.exports = function eject(resourceName, id, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var definition = _this.definitions[resourceName];\n\t var resource = _this.store[resourceName];\n\t var item = undefined;\n\t var found = false;\n\n\t id = DSUtils.resolveId(definition, id);\n\n\t if (!definition) {\n\t throw new _this.errors.NER(resourceName);\n\t } else if (!DSUtils._sn(id)) {\n\t throw DSUtils._snErr('id');\n\t }\n\n\t options = DSUtils._(definition, options);\n\n\n\t // find the item to eject\n\t for (var i = 0; i < resource.collection.length; i++) {\n\t if (resource.collection[i][definition.idAttribute] == id) {\n\t // jshint ignore:line\n\t item = resource.collection[i];\n\t // remove its expiration timestamp\n\t resource.expiresHeap.remove(item);\n\t found = true;\n\t break;\n\t }\n\t }\n\t if (found) {\n\t var _ret = (function () {\n\t // lifecycle\n\t definition.beforeEject(options, item);\n\t if (options.notify) {\n\t definition.emit('DS.beforeEject', definition, item);\n\t }\n\n\t // find the item in any ($$injected) cached queries\n\t var toRemove = [];\n\t DSUtils.forOwn(resource.queryData, function (items, queryHash) {\n\t if (items.$$injected) {\n\t DSUtils.remove(items, item);\n\t }\n\t // optionally remove any empty queries\n\t if (!items.length && options.clearEmptyQueries) {\n\t toRemove.push(queryHash);\n\t }\n\t });\n\n\t // clean up\n\t DSUtils.forEach(resource.changeHistories[id], function (changeRecord) {\n\t DSUtils.remove(resource.changeHistory, changeRecord);\n\t });\n\t DSUtils.forEach(toRemove, function (queryHash) {\n\t delete resource.completedQueries[queryHash];\n\t delete resource.queryData[queryHash];\n\t });\n\t if (DSUtils.w) {\n\t // stop observation\n\t resource.observers[id].close();\n\t }\n\t delete resource.observers[id];\n\t delete resource.index[id];\n\t delete resource.previousAttributes[id];\n\t delete resource.completedQueries[id];\n\t delete resource.pendingQueries[id];\n\t delete resource.changeHistories[id];\n\t delete resource.modified[id];\n\t delete resource.saved[id];\n\n\t // remove it from the store\n\t resource.collection.splice(i, 1);\n\t // collection has been modified\n\t definition.handleChange(item);\n\n\t // lifecycle\n\t definition.afterEject(options, item);\n\t if (options.notify) {\n\t definition.emit('DS.afterEject', definition, item);\n\t }\n\n\t return {\n\t v: item\n\t };\n\t })();\n\n\t if (typeof _ret === 'object') return _ret.v;\n\t }\n\t};\n\n/***/ },\n/* 29 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Eject a collection of items from the store, if any items currently in the store match the given criteria.\n\t *\n\t * @param resourceName The name of the resource type of the items eject.\n\t * @param params The criteria by which to match items to eject. See http://www.js-data.io/docs/query-syntax\n\t * @param options Optional configuration.\n\t * @returns The collection of items that were ejected, if any.\n\t */\n\tmodule.exports = function ejectAll(resourceName, params, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var definition = _this.definitions[resourceName];\n\t params = params || {};\n\n\t if (!definition) {\n\t throw new _this.errors.NER(resourceName);\n\t } else if (!DSUtils._o(params)) {\n\t throw DSUtils._oErr('params');\n\t }\n\n\n\t var resource = _this.store[resourceName];\n\t var queryHash = DSUtils.toJson(params);\n\n\t // get items that match the criteria\n\t var items = definition.filter(params);\n\n\t if (DSUtils.isEmpty(params)) {\n\t // remove all completed queries if ejecting all items\n\t resource.completedQueries = {};\n\t } else {\n\t // remove matching completed query, if any\n\t delete resource.completedQueries[queryHash];\n\t }\n\t // prepare to remove matching items\n\t DSUtils.forEach(items, function (item) {\n\t if (item && item[definition.idAttribute]) {\n\t definition.eject(item[definition.idAttribute], options);\n\t }\n\t });\n\t // collection has been modified\n\t definition.handleChange(items);\n\t return items;\n\t};\n\n/***/ },\n/* 30 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Return the subset of items currently in the store that match the given criteria.\n\t *\n\t * The actual filtering is delegated to DS#defaults.defaultFilter, which can be overridden by developers.\n\t *\n\t * @param resourceName The name of the resource type of the items to filter.\n\t * @param params The criteria by which to filter items. See http://www.js-data.io/docs/query-syntax\n\t * @param options Optional configuration.\n\t * @returns Matching items.\n\t */\n\tmodule.exports = function filter(resourceName, params, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var definition = _this.definitions[resourceName];\n\n\t if (!definition) {\n\t throw new _this.errors.NER(resourceName);\n\t } else if (params && !DSUtils._o(params)) {\n\t throw DSUtils._oErr('params');\n\t }\n\n\t // Protect against null\n\t params = params || {};\n\t options = DSUtils._(definition, options);\n\n\t // delegate filtering to DS#defaults.defaultFilter, which can be overridden by developers.\n\t return definition.defaultFilter.call(_this, _this.store[resourceName].collection, resourceName, params, options);\n\t};\n\n/***/ },\n/* 31 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar _utils = __webpack_require__(2);\n\n\tvar _errors = __webpack_require__(3);\n\n\t/**\n\t * This is a beast of a file, but it's where a significant portion of the magic happens.\n\t *\n\t * DS#inject makes up the core of how data gets into the store.\n\t */\n\n\t/**\n\t * This factory function produces an observer handler function tailor-made for the current item being injected.\n\t *\n\t * The observer handler is what allows computed properties and change tracking to function.\n\t *\n\t * @param definition Resource definition produced by DS#defineResource\n\t * @param resource Resource data as internally stored by the data store\n\t * @returns {Function} Observer handler function\n\t * @private\n\t */\n\tfunction makeObserverHandler(definition, resource) {\n\t var DS = this;\n\n\t // using \"var\" avoids a JSHint error\n\t var name = definition.name;\n\n\t /**\n\t * This will be called by observe-js when a new change record is available for the observed object\n\t *\n\t * @param added Change record for added properties\n\t * @param removed Change record for removed properties\n\t * @param changed Change record for changed properties\n\t * @param oldValueFn Function that can be used to get the previous value of a changed property\n\t * @param firstTime Whether this is the first time this function is being called for the given item. Will only be true once.\n\t */\n\t return function _react(added, removed, changed, oldValueFn, firstTime) {\n\t var target = this;\n\t var item = undefined;\n\n\t // Get the previous primary key of the observed item, in-case some knucklehead changed it\n\t var innerId = oldValueFn && oldValueFn(definition.idAttribute) ? oldValueFn(definition.idAttribute) : target[definition.idAttribute];\n\n\t // Ignore changes to relation links\n\t _utils['default'].forEach(definition.relationFields, function (field) {\n\t delete added[field];\n\t delete removed[field];\n\t delete changed[field];\n\t });\n\n\t // Detect whether there are actually any changes\n\t if (!_utils['default'].isEmpty(added) || !_utils['default'].isEmpty(removed) || !_utils['default'].isEmpty(changed) || firstTime) {\n\t item = DS.get(name, innerId);\n\n\t // update item and collection \"modified\" timestamps\n\t resource.modified[innerId] = _utils['default'].updateTimestamp(resource.modified[innerId]);\n\n\t if (item && definition.instanceEvents) {\n\t setTimeout(function () {\n\t item.emit('DS.change', definition, item);\n\t }, 0);\n\t }\n\n\t definition.handleChange(item);\n\n\t // Save a change record for the item\n\t if (definition.keepChangeHistory) {\n\t var changeRecord = {\n\t resourceName: name,\n\t target: item,\n\t added: added,\n\t removed: removed,\n\t changed: changed,\n\t timestamp: resource.modified[innerId]\n\t };\n\t resource.changeHistories[innerId].push(changeRecord);\n\t resource.changeHistory.push(changeRecord);\n\t }\n\t }\n\n\t // Recompute computed properties if any computed properties depend on changed properties\n\t if (definition.computed) {\n\t item = item || DS.get(name, innerId);\n\t _utils['default'].forOwn(definition.computed, function (fn, field) {\n\t var compute = false;\n\t // check if required fields changed\n\t _utils['default'].forEach(fn.deps, function (dep) {\n\t if (dep in added || dep in removed || dep in changed || !(field in item)) {\n\t compute = true;\n\t }\n\t });\n\t compute = compute || !fn.deps.length;\n\t if (compute) {\n\t _utils['default'].compute.call(item, fn, field);\n\t }\n\t });\n\t }\n\n\t if (definition.idAttribute in changed) {\n\t definition.errorFn('Doh! You just changed the primary key of an object! Your data for the \"' + name + '\" resource is now in an undefined (probably broken) state.');\n\t }\n\t };\n\t}\n\n\t/**\n\t * A recursive function for injecting data into the store.\n\t *\n\t * @param definition Resource definition produced by DS#defineResource\n\t * @param resource Resource data as internally stored by the data store\n\t * @param attrs The data to be injected. Will be an object or an array of objects.\n\t * @param options Optional configuration.\n\t * @returns The injected data\n\t * @private\n\t */\n\tfunction _inject(definition, resource, attrs, options) {\n\t var _this = this;\n\t var injected = undefined;\n\n\t if (_utils['default']._a(attrs)) {\n\t // have an array of objects, go ahead and inject each one individually and return the resulting array\n\t injected = [];\n\t for (var i = 0; i < attrs.length; i++) {\n\t injected.push(_inject.call(_this, definition, resource, attrs[i], options));\n\t }\n\t } else {\n\t // create the observer handler for the data to be injected\n\t var _react = makeObserverHandler.call(_this, definition, resource);\n\n\t // check if \"idAttribute\" is a computed property\n\t var c = definition.computed;\n\t var idA = definition.idAttribute;\n\t // compute the primary key if necessary\n\t if (c && c[idA]) {\n\t (function () {\n\t var args = [];\n\t _utils['default'].forEach(c[idA].deps, function (dep) {\n\t args.push(attrs[dep]);\n\t });\n\t attrs[idA] = c[idA][c[idA].length - 1].apply(attrs, args);\n\t })();\n\t }\n\n\t if (!(idA in attrs)) {\n\t // we cannot inject any object into the store that does not have a primary key!\n\t var error = new _errors['default'].R(definition.name + '.inject: \"attrs\" must contain the property specified by \"idAttribute\"!');\n\t options.errorFn(error);\n\t throw error;\n\t } else {\n\t try {\n\t (function () {\n\t // when injecting object that contain their nested relations, this code\n\t // will recursively inject them into their proper places in the data store.\n\t // Magic!\n\t _utils['default'].forEach(definition.relationList, function (def) {\n\t var relationName = def.relation;\n\t var relationDef = _this.definitions[relationName];\n\t var toInject = attrs[def.localField];\n\t if (toInject) {\n\t if (!relationDef) {\n\t throw new _errors['default'].R(definition.name + ' relation is defined but the resource is not!');\n\t }\n\t // handle injecting hasMany relations\n\t if (_utils['default']._a(toInject)) {\n\t (function () {\n\t var items = [];\n\t _utils['default'].forEach(toInject, function (toInjectItem) {\n\t if (toInjectItem !== _this.store[relationName].index[toInjectItem[relationDef.idAttribute]]) {\n\t try {\n\t var injectedItem = relationDef.inject(toInjectItem, options.orig());\n\t if (def.foreignKey) {\n\t _utils['default'].set(injectedItem, def.foreignKey, attrs[definition.idAttribute]);\n\t }\n\t items.push(injectedItem);\n\t } catch (err) {\n\t options.errorFn(err, 'Failed to inject ' + def.type + ' relation: \"' + relationName + '\"!');\n\t }\n\t }\n\t });\n\t })();\n\t } else {\n\t // handle injecting belongsTo and hasOne relations\n\t if (toInject !== _this.store[relationName].index[toInject[relationDef.idAttribute]]) {\n\t try {\n\t var _injected = relationDef.inject(attrs[def.localField], options.orig());\n\t if (def.foreignKey) {\n\t _utils['default'].set(_injected, def.foreignKey, attrs[definition.idAttribute]);\n\t }\n\t } catch (err) {\n\t options.errorFn(err, 'Failed to inject ' + def.type + ' relation: \"' + relationName + '\"!');\n\t }\n\t }\n\t }\n\t }\n\t });\n\n\t // primary key of item being injected\n\t var id = attrs[idA];\n\t // item being injected\n\t var item = definition.get(id);\n\t // 0 if the item is new, otherwise the previous last modified timestamp of the item\n\t var initialLastModified = item ? resource.modified[id] : 0;\n\n\t // item is new\n\t if (!item) {\n\t if (attrs instanceof definition[definition['class']]) {\n\t item = attrs;\n\t } else {\n\t item = new definition[definition['class']]();\n\t }\n\t // remove relation properties from the item, since those relations have been injected by now\n\t _utils['default'].forEach(definition.relationList, function (def) {\n\t delete attrs[def.localField];\n\t });\n\t // copy remaining properties to the injected item\n\t _utils['default'].deepMixIn(item, attrs);\n\n\t // add item to collection\n\t resource.collection.push(item);\n\t resource.changeHistories[id] = [];\n\n\t // If we're in the browser, start observation\n\t if (_utils['default'].w) {\n\t resource.observers[id] = new _this.observe.ObjectObserver(item);\n\t resource.observers[id].open(_react, item);\n\t }\n\n\t // index item\n\t resource.index[id] = item;\n\t // fire observation handler for the first time\n\t _react.call(item, {}, {}, {}, null, true);\n\t // save \"previous\" attributes of the injected item, for change diffs later\n\t resource.previousAttributes[id] = _utils['default'].copy(item, null, null, null, definition.relationFields);\n\t } else {\n\t // item is being re-injected\n\t // new properties take precedence\n\t if (options.onConflict === 'merge') {\n\t _utils['default'].deepMixIn(item, attrs);\n\t } else if (options.onConflict === 'replace') {\n\t _utils['default'].forOwn(item, function (v, k) {\n\t if (k !== definition.idAttribute) {\n\t if (!attrs.hasOwnProperty(k)) {\n\t delete item[k];\n\t }\n\t }\n\t });\n\t _utils['default'].forOwn(attrs, function (v, k) {\n\t if (k !== definition.idAttribute) {\n\t item[k] = v;\n\t }\n\t });\n\t }\n\n\t if (definition.resetHistoryOnInject) {\n\t // clear change history for item\n\t resource.previousAttributes[id] = _utils['default'].copy(item, null, null, null, definition.relationFields);\n\t if (resource.changeHistories[id].length) {\n\t _utils['default'].forEach(resource.changeHistories[id], function (changeRecord) {\n\t _utils['default'].remove(resource.changeHistory, changeRecord);\n\t });\n\t resource.changeHistories[id].splice(0, resource.changeHistories[id].length);\n\t }\n\t }\n\t if (_utils['default'].w) {\n\t // force observation callback to be fired if there are any changes to the item and `Object.observe` is not available\n\t resource.observers[id].deliver();\n\t }\n\t }\n\t // update modified timestamp of item\n\t resource.modified[id] = initialLastModified && resource.modified[id] === initialLastModified ? _utils['default'].updateTimestamp(resource.modified[id]) : resource.modified[id];\n\n\t // reset expiry tracking for item\n\t resource.expiresHeap.remove(item);\n\t var timestamp = new Date().getTime();\n\t resource.expiresHeap.push({\n\t item: item,\n\t timestamp: timestamp,\n\t expires: definition.maxAge ? timestamp + definition.maxAge : Number.MAX_VALUE\n\t });\n\n\t // final injected item\n\t injected = item;\n\t })();\n\t } catch (err) {\n\t options.errorFn(err, attrs);\n\t }\n\t }\n\t }\n\t return injected;\n\t}\n\n\t/**\n\t * Inject the given object or array of objects into the data store.\n\t *\n\t * @param resourceName The name of the type of resource of the data to be injected.\n\t * @param attrs Object or array of objects. Objects must contain a primary key.\n\t * @param options Optional configuration.\n\t * @param options.notify Whether to emit the \"DS.beforeInject\" and \"DS.afterInject\" events.\n\t * @returns The injected data.\n\t */\n\tmodule.exports = function inject(resourceName, attrs, options) {\n\t var _this = this;\n\t var definition = _this.definitions[resourceName];\n\t var resource = _this.store[resourceName];\n\t var injected = undefined;\n\n\t if (!definition) {\n\t throw new _errors['default'].NER(resourceName);\n\t } else if (!_utils['default']._o(attrs) && !_utils['default']._a(attrs)) {\n\t throw new _errors['default'].IA(resourceName + '.inject: \"attrs\" must be an object or an array!');\n\t }\n\n\t options = _utils['default']._(definition, options);\n\n\t // lifecycle\n\t options.beforeInject(options, attrs);\n\t if (options.notify) {\n\t definition.emit('DS.beforeInject', definition, attrs);\n\t }\n\n\t // start the recursive injection of data\n\t injected = _inject.call(_this, definition, resource, attrs, options);\n\n\t // collection was modified\n\t definition.handleChange(injected);\n\n\t // lifecycle\n\t options.afterInject(options, injected);\n\t if (options.notify) {\n\t definition.emit('DS.afterInject', definition, injected);\n\t }\n\n\t return injected;\n\t};\n\n/***/ },\n/* 32 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Using an adapter, create a new item.\n\t *\n\t * Generally a primary key will NOT be provided in the properties hash,\n\t * because the adapter's persistence layer should be generating one.\n\t *\n\t * @param resourceName The name of the type of resource of the new item.\n\t * @param attrs Hash of properties with which to create the new item.\n\t * @param options Optional configuration.\n\t * @param options.cacheResponse Whether the newly created item as returned by the adapter should be injected into the data store.\n\t * @param options.upsert If the properties hash contains a primary key, attempt to call DS#update instead.\n\t * @param options.notify Whether to emit the \"DS.beforeCreate\" and \"DS.afterCreate\" events.\n\t * @param options.beforeValidate Lifecycle hook.\n\t * @param options.validate Lifecycle hook.\n\t * @param options.afterValidate Lifecycle hook.\n\t * @param options.beforeCreate Lifecycle hook.\n\t * @param options.afterCreate Lifecycle hook.\n\t */\n\tmodule.exports = function create(resourceName, attrs, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var definition = _this.definitions[resourceName];\n\t var adapter = undefined;\n\n\t options = options || {};\n\t attrs = attrs || {};\n\n\t var rejectionError = undefined;\n\t if (!definition) {\n\t rejectionError = new _this.errors.NER(resourceName);\n\t } else if (!DSUtils._o(attrs)) {\n\t rejectionError = DSUtils._oErr('attrs');\n\t } else {\n\t options = DSUtils._(definition, options);\n\t if (options.upsert && DSUtils._sn(attrs[definition.idAttribute])) {\n\t return _this.update(resourceName, attrs[definition.idAttribute], attrs, options);\n\t }\n\t }\n\n\t return new DSUtils.Promise(function (resolve, reject) {\n\t if (rejectionError) {\n\t reject(rejectionError);\n\t } else {\n\t resolve(attrs);\n\t }\n\t })\n\t // start lifecycle\n\t .then(function (attrs) {\n\t return options.beforeValidate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t return options.validate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t return options.afterValidate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t return options.beforeCreate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t if (options.notify) {\n\t definition.emit('DS.beforeCreate', definition, attrs);\n\t }\n\t adapter = _this.getAdapterName(options);\n\t return _this.adapters[adapter].create(definition, DSUtils.omit(attrs, options.omit), options);\n\t }).then(function (attrs) {\n\t return options.afterCreate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t if (options.notify) {\n\t definition.emit('DS.afterCreate', definition, attrs);\n\t }\n\t if (options.cacheResponse) {\n\t // injected created intem into the store\n\t var created = _this.inject(definition.name, attrs, options.orig());\n\t var id = created[definition.idAttribute];\n\t // mark item's `find` query as completed, so a subsequent `find` call for this item will resolve immediately\n\t var resource = _this.store[resourceName];\n\t resource.completedQueries[id] = new Date().getTime();\n\t resource.saved[id] = DSUtils.updateTimestamp(resource.saved[id]);\n\t return created;\n\t } else {\n\t // just return an un-injected instance\n\t return _this.createInstance(resourceName, attrs, options);\n\t }\n\t }).then(function (item) {\n\t return DSUtils.respond(item, { adapter: adapter }, options);\n\t });\n\t};\n\n/***/ },\n/* 33 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Using an adapter, destroy an item.\n\t *\n\t * @param resourceName The name of the type of resource of the item to destroy.\n\t * @param id The primary key of the item to destroy.\n\t * @param options Optional configuration.\n\t * @param options.eagerEject Whether to eject the item from the store before the adapter operation completes, re-injecting if the adapter operation fails.\n\t * @param options.notify Whether to emit the \"DS.beforeDestroy\" and \"DS.afterDestroy\" events.\n\t * @param options.beforeDestroy Lifecycle hook.\n\t * @param options.afterDestroy Lifecycle hook.\n\t * @returns The primary key of the destroyed item.\n\t */\n\tmodule.exports = function destroy(resourceName, id, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var definition = _this.definitions[resourceName];\n\t var item = undefined;\n\t var adapter = undefined;\n\n\t return new DSUtils.Promise(function (resolve, reject) {\n\t id = DSUtils.resolveId(definition, id);\n\t if (!definition) {\n\t reject(new _this.errors.NER(resourceName));\n\t } else if (!DSUtils._sn(id)) {\n\t reject(DSUtils._snErr('id'));\n\t } else {\n\t // check if the item is in the store\n\t item = definition.get(id) || { id: id };\n\t options = DSUtils._(definition, options);\n\t resolve(item);\n\t }\n\t })\n\t // start lifecycle\n\t .then(function (attrs) {\n\t return options.beforeDestroy.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t if (options.notify) {\n\t definition.emit('DS.beforeDestroy', definition, attrs);\n\t }\n\t // don't wait for the adapter, remove the item from the store\n\t if (options.eagerEject) {\n\t definition.eject(id);\n\t }\n\t adapter = definition.getAdapter(options);\n\t return adapter.destroy(definition, id, options);\n\t }).then(function () {\n\t return options.afterDestroy.call(item, options, item);\n\t }).then(function (item) {\n\t if (options.notify) {\n\t definition.emit('DS.afterDestroy', definition, item);\n\t }\n\t // make sure the item is removed from the store\n\t definition.eject(id);\n\t return DSUtils.respond(id, { adapter: adapter }, options);\n\t })['catch'](function (err) {\n\t // rollback by re-injecting the item into the store\n\t if (options && options.eagerEject && item) {\n\t definition.inject(item, { notify: false });\n\t }\n\t return DSUtils.Promise.reject(err);\n\t });\n\t};\n\n/***/ },\n/* 34 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Using an adapter, destroy an item.\n\t *\n\t * @param resourceName The name of the type of resource of the item to destroy.\n\t * @param params The criteria by which to filter items to destroy. See http://www.js-data.io/docs/query-syntax\n\t * @param options Optional configuration.\n\t * @param options.eagerEject Whether to eject the items from the store before the adapter operation completes, re-injecting if the adapter operation fails.\n\t * @param options.notify Whether to emit the \"DS.beforeDestroy\" and \"DS.afterDestroy\" events.\n\t * @param options.beforeDestroy Lifecycle hook.\n\t * @param options.afterDestroy Lifecycle hook.\n\t * @returns The ejected items, if any.\n\t */\n\tmodule.exports = function destroyAll(resourceName, params, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var definition = _this.definitions[resourceName];\n\t var ejected = undefined,\n\t toEject = undefined,\n\t adapter = undefined;\n\n\t params = params || {};\n\n\t return new DSUtils.Promise(function (resolve, reject) {\n\t if (!definition) {\n\t reject(new _this.errors.NER(resourceName));\n\t } else if (!DSUtils._o(params)) {\n\t reject(DSUtils._oErr('attrs'));\n\t } else {\n\t options = DSUtils._(definition, options);\n\t resolve();\n\t }\n\t }).then(function () {\n\t // find items that are to be ejected from the store\n\t toEject = definition.defaultFilter.call(_this, resourceName, params);\n\t return options.beforeDestroy(options, toEject);\n\t }).then(function () {\n\t if (options.notify) {\n\t definition.emit('DS.beforeDestroy', definition, toEject);\n\t }\n\t // don't wait for the adapter, remove the items from the store\n\t if (options.eagerEject) {\n\t ejected = definition.ejectAll(params);\n\t }\n\t adapter = definition.getAdapterName(options);\n\t return _this.adapters[adapter].destroyAll(definition, params, options);\n\t }).then(function () {\n\t return options.afterDestroy(options, toEject);\n\t }).then(function () {\n\t if (options.notify) {\n\t definition.emit('DS.afterDestroy', definition, toEject);\n\t }\n\t // make sure items are removed from the store\n\t return ejected || definition.ejectAll(params);\n\t }).then(function (items) {\n\t return DSUtils.respond(items, { adapter: adapter }, options);\n\t })['catch'](function (err) {\n\t // rollback by re-injecting the items into the store\n\t if (options && options.eagerEject && ejected) {\n\t definition.inject(ejected, { notify: false });\n\t }\n\t return DSUtils.Promise.reject(err);\n\t });\n\t};\n\n/***/ },\n/* 35 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* jshint -W082 */\n\n\t/**\n\t * Using an adapter, retrieve a single item.\n\t *\n\t * @param resourceName The of the type of resource of the item to retrieve.\n\t * @param id The primary key of the item to retrieve.\n\t * @param options Optional configuration.\n\t * @param options.bypassCache Whether to ignore any cached item and force the retrieval through the adapter.\n\t * @param options.cacheResponse Whether to inject the found item into the data store.\n\t * @param options.strictCache Whether to only consider items to be \"cached\" if they were injected into the store as the result of `find` or `findAll`.\n\t * @param options.strategy The retrieval strategy to use.\n\t * @param options.findStrategy The retrieval strategy to use. Overrides \"strategy\".\n\t * @param options.fallbackAdapters Array of names of adapters to use if using \"fallback\" strategy.\n\t * @param options.findFallbackAdapters Array of names of adapters to use if using \"fallback\" strategy. Overrides \"fallbackAdapters\".\n\t * @returns The item.\n\t */\n\tmodule.exports = function find(resourceName, id, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var definition = _this.definitions[resourceName];\n\t var resource = _this.store[resourceName];\n\t var adapter = undefined;\n\n\t return new DSUtils.Promise(function (resolve, reject) {\n\t if (!definition) {\n\t reject(new _this.errors.NER(resourceName));\n\t } else if (!DSUtils._sn(id)) {\n\t reject(DSUtils._snErr('id'));\n\t } else {\n\t options = DSUtils._(definition, options);\n\n\t if (options.params) {\n\t options.params = DSUtils.copy(options.params);\n\t }\n\n\t if (options.bypassCache || !options.cacheResponse) {\n\t delete resource.completedQueries[id];\n\t }\n\t if ((!options.findStrictCache || id in resource.completedQueries) && definition.get(id) && !options.bypassCache) {\n\t // resolve immediately with the cached item\n\t resolve(definition.get(id));\n\t } else {\n\t // we're going to delegate to the adapter next\n\t delete resource.completedQueries[id];\n\t resolve();\n\t }\n\t }\n\t }).then(function (item) {\n\t if (!item) {\n\t if (!(id in resource.pendingQueries)) {\n\t var promise = undefined;\n\t var strategy = options.findStrategy || options.strategy;\n\n\t // try subsequent adapters if the preceeding one fails\n\t if (strategy === 'fallback') {\n\t (function () {\n\t var makeFallbackCall = function makeFallbackCall(index) {\n\t adapter = definition.getAdapterName((options.findFallbackAdapters || options.fallbackAdapters)[index]);\n\t return _this.adapters[adapter].find(definition, id, options)['catch'](function (err) {\n\t index++;\n\t if (index < options.fallbackAdapters.length) {\n\t return makeFallbackCall(index);\n\t } else {\n\t return DSUtils.Promise.reject(err);\n\t }\n\t });\n\t };\n\n\t promise = makeFallbackCall(0);\n\t })();\n\t } else {\n\t adapter = definition.getAdapterName(options);\n\t // just make a single attempt\n\t promise = _this.adapters[adapter].find(definition, id, options);\n\t }\n\n\t resource.pendingQueries[id] = promise.then(function (data) {\n\t // Query is no longer pending\n\t delete resource.pendingQueries[id];\n\t if (options.cacheResponse) {\n\t // inject the item into the data store\n\t var injected = definition.inject(data, options.orig());\n\t // mark the item as \"cached\"\n\t resource.completedQueries[id] = new Date().getTime();\n\t resource.saved[id] = DSUtils.updateTimestamp(resource.saved[id]);\n\t return injected;\n\t } else {\n\t // just return an un-injected instance\n\t return definition.createInstance(data, options.orig());\n\t }\n\t });\n\t }\n\t return resource.pendingQueries[id];\n\t } else {\n\t // resolve immediately with the item\n\t return item;\n\t }\n\t }).then(function (item) {\n\t return DSUtils.respond(item, { adapter: adapter }, options);\n\t })['catch'](function (err) {\n\t if (resource) {\n\t delete resource.pendingQueries[id];\n\t }\n\t return DSUtils.Promise.reject(err);\n\t });\n\t};\n\n/***/ },\n/* 36 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* jshint -W082 */\n\tfunction processResults(data, resourceName, queryHash, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var definition = _this.definitions[resourceName];\n\t var resource = _this.store[resourceName];\n\t var idAttribute = _this.definitions[resourceName].idAttribute;\n\t var date = new Date().getTime();\n\n\t data = data || [];\n\n\t // Query is no longer pending\n\t delete resource.pendingQueries[queryHash];\n\t resource.completedQueries[queryHash] = date;\n\n\t // Merge the new values into the cache\n\t var injected = definition.inject(data, options.orig());\n\n\t // Make sure each object is added to completedQueries\n\t if (DSUtils._a(injected)) {\n\t DSUtils.forEach(injected, function (item) {\n\t if (item) {\n\t var id = item[idAttribute];\n\t if (id) {\n\t resource.completedQueries[id] = date;\n\t resource.saved[id] = DSUtils.updateTimestamp(resource.saved[id]);\n\t }\n\t }\n\t });\n\t } else {\n\t options.errorFn('response is expected to be an array!');\n\t resource.completedQueries[injected[idAttribute]] = date;\n\t }\n\n\t return injected;\n\t}\n\n\t/**\n\t * Using an adapter, retrieve a collection of items.\n\t *\n\t * @param resourceName The name of the type of resource of the items to retrieve.\n\t * @param params The criteria by which to filter items to retrieve. See http://www.js-data.io/docs/query-syntax\n\t * @param options Optional configuration.\n\t * @param options.bypassCache Whether to ignore any cached query for these items and force the retrieval through the adapter.\n\t * @param options.cacheResponse Whether to inject the found items into the data store.\n\t * @returns The items.\n\t */\n\tmodule.exports = function findAll(resourceName, params, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var definition = _this.definitions[resourceName];\n\t var resource = _this.store[resourceName];\n\t var queryHash = undefined,\n\t adapter = undefined;\n\n\t return new DSUtils.Promise(function (resolve, reject) {\n\t params = params || {};\n\n\t if (!_this.definitions[resourceName]) {\n\t reject(new _this.errors.NER(resourceName));\n\t } else if (!DSUtils._o(params)) {\n\t reject(DSUtils._oErr('params'));\n\t } else {\n\t options = DSUtils._(definition, options);\n\t queryHash = DSUtils.toJson(params);\n\n\t if (options.params) {\n\t options.params = DSUtils.copy(options.params);\n\t }\n\n\t // force a new request\n\t if (options.bypassCache || !options.cacheResponse) {\n\t delete resource.completedQueries[queryHash];\n\t delete resource.queryData[queryHash];\n\t }\n\t if (queryHash in resource.completedQueries) {\n\t if (options.useFilter) {\n\t if (options.localKeys) {\n\t resolve(definition.getAll(options.localKeys, options.orig()));\n\t } else {\n\t // resolve immediately by filtering data from the data store\n\t resolve(definition.filter(params, options.orig()));\n\t }\n\t } else {\n\t // resolve immediately by returning the cached array from the previously made query\n\t resolve(resource.queryData[queryHash]);\n\t }\n\t } else {\n\t resolve();\n\t }\n\t }\n\t }).then(function (items) {\n\t if (!(queryHash in resource.completedQueries)) {\n\t if (!(queryHash in resource.pendingQueries)) {\n\t var promise = undefined;\n\t var strategy = options.findAllStrategy || options.strategy;\n\n\t // try subsequent adapters if the preceeding one fails\n\t if (strategy === 'fallback') {\n\t (function () {\n\t var makeFallbackCall = function makeFallbackCall(index) {\n\t adapter = definition.getAdapterName((options.findAllFallbackAdapters || options.fallbackAdapters)[index]);\n\t return _this.adapters[adapter].findAll(definition, params, options)['catch'](function (err) {\n\t index++;\n\t if (index < options.fallbackAdapters.length) {\n\t return makeFallbackCall(index);\n\t } else {\n\t return DSUtils.Promise.reject(err);\n\t }\n\t });\n\t };\n\n\t promise = makeFallbackCall(0);\n\t })();\n\t } else {\n\t adapter = definition.getAdapterName(options);\n\t // just make a single attempt\n\t promise = _this.adapters[adapter].findAll(definition, params, options);\n\t }\n\n\t resource.pendingQueries[queryHash] = promise.then(function (data) {\n\t // Query is no longer pending\n\t delete resource.pendingQueries[queryHash];\n\t if (options.cacheResponse) {\n\t // inject the items into the data store\n\t resource.queryData[queryHash] = processResults.call(_this, data, resourceName, queryHash, options);\n\t resource.queryData[queryHash].$$injected = true;\n\t return resource.queryData[queryHash];\n\t } else {\n\t DSUtils.forEach(data, function (item, i) {\n\t data[i] = definition.createInstance(item, options.orig());\n\t });\n\t return data;\n\t }\n\t });\n\t }\n\n\t return resource.pendingQueries[queryHash];\n\t } else {\n\t // resolve immediately with the items\n\t return items;\n\t }\n\t }).then(function (items) {\n\t return DSUtils.respond(items, { adapter: adapter }, options);\n\t })['catch'](function (err) {\n\t if (resource) {\n\t delete resource.pendingQueries[queryHash];\n\t }\n\t return DSUtils.Promise.reject(err);\n\t });\n\t};\n\n/***/ },\n/* 37 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\t/**\n\t * Load the specified relations for the given instance.\n\t *\n\t * @param resourceName The name of the type of resource of the instance for which to load relations.\n\t * @param instance The instance or the primary key of the instance.\n\t * @param relations An array of the relations to load.\n\t * @param options Optional configuration.\n\t * @returns The instance, now with its relations loaded.\n\t */\n\tmodule.exports = function loadRelations(resourceName, instance, relations, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var DSErrors = _this.errors;\n\n\t var definition = _this.definitions[resourceName];\n\n\t return new DSUtils.Promise(function (resolve, reject) {\n\t if (DSUtils._sn(instance)) {\n\t instance = definition.get(instance);\n\t }\n\n\t if (DSUtils._s(relations)) {\n\t relations = [relations];\n\t }\n\n\t relations = relations || [];\n\n\t if (!definition) {\n\t reject(new DSErrors.NER(resourceName));\n\t } else if (!DSUtils._o(instance)) {\n\t reject(new DSErrors.IA('\"instance(id)\" must be a string, number or object!'));\n\t } else if (!DSUtils._a(relations)) {\n\t reject(new DSErrors.IA('\"relations\" must be a string or an array!'));\n\t } else {\n\t (function () {\n\t var _options = DSUtils._(definition, options);\n\n\t var tasks = [];\n\n\t DSUtils.forEach(definition.relationList, function (def) {\n\t var relationName = def.relation;\n\t var relationDef = definition.getResource(relationName);\n\t var __options = DSUtils._(relationDef, options);\n\n\t // relations can be loaded based on resource name or field name\n\t if (!relations.length || DSUtils.contains(relations, relationName) || DSUtils.contains(relations, def.localField)) {\n\t var task = undefined;\n\t var params = {};\n\t if (__options.allowSimpleWhere) {\n\t params[def.foreignKey] = instance[definition.idAttribute];\n\t } else {\n\t params.where = {};\n\t params.where[def.foreignKey] = {\n\t '==': instance[definition.idAttribute]\n\t };\n\t }\n\n\t if (def.type === 'hasMany') {\n\t var orig = __options.orig();\n\t if (def.localKeys) {\n\t delete params[def.foreignKey];\n\t var keys = DSUtils.get(instance, def.localKeys) || [];\n\t keys = DSUtils._a(keys) ? keys : DSUtils.keys(keys);\n\t params.where = _defineProperty({}, relationDef.idAttribute, {\n\t 'in': keys\n\t });\n\t orig.localKeys = keys;\n\t }\n\t task = relationDef.findAll(params, orig);\n\t } else if (def.type === 'hasOne') {\n\t if (def.localKey && DSUtils.get(instance, def.localKey)) {\n\t task = relationDef.find(DSUtils.get(instance, def.localKey), __options.orig());\n\t } else if (def.foreignKey) {\n\t task = relationDef.findAll(params, __options.orig()).then(function (hasOnes) {\n\t return hasOnes.length ? hasOnes[0] : null;\n\t });\n\t }\n\t } else if (DSUtils.get(instance, def.localKey)) {\n\t task = relationDef.find(DSUtils.get(instance, def.localKey), __options.orig());\n\t }\n\n\t if (task) {\n\t tasks.push(task);\n\t }\n\t }\n\t });\n\n\t resolve(tasks);\n\t })();\n\t }\n\t }).then(function (tasks) {\n\t return DSUtils.Promise.all(tasks);\n\t }).then(function () {\n\t return instance;\n\t });\n\t};\n\n/***/ },\n/* 38 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Find expired items of the specified resource type and perform the configured action.\n\t *\n\t * @param resourceName The name of the type of resource of the items to reap.\n\t * @param options Optional configuration.\n\t * @returns The reaped items.\n\t */\n\tmodule.exports = function reap(resourceName, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var definition = _this.definitions[resourceName];\n\t var resource = _this.store[resourceName];\n\n\t return new DSUtils.Promise(function (resolve, reject) {\n\n\t if (!definition) {\n\t reject(new _this.errors.NER(resourceName));\n\t } else {\n\t options = DSUtils._(definition, options);\n\t if (!options.hasOwnProperty('notify')) {\n\t options.notify = false;\n\t }\n\t var items = [];\n\t var now = new Date().getTime();\n\t var expiredItem = undefined;\n\n\t // find the expired items\n\t while ((expiredItem = resource.expiresHeap.peek()) && expiredItem.expires < now) {\n\t items.push(expiredItem.item);\n\t delete expiredItem.item;\n\t resource.expiresHeap.pop();\n\t }\n\t resolve(items);\n\t }\n\t }).then(function (items) {\n\t // only hit lifecycle if there are items\n\t if (items.length) {\n\t definition.beforeReap(options, items);\n\t if (options.notify) {\n\t definition.emit('DS.beforeReap', definition, items);\n\t }\n\t }\n\n\t if (options.reapAction === 'inject') {\n\t (function () {\n\t var timestamp = new Date().getTime();\n\t DSUtils.forEach(items, function (item) {\n\t resource.expiresHeap.push({\n\t item: item,\n\t timestamp: timestamp,\n\t expires: definition.maxAge ? timestamp + definition.maxAge : Number.MAX_VALUE\n\t });\n\t });\n\t })();\n\t } else if (options.reapAction === 'eject') {\n\t DSUtils.forEach(items, function (item) {\n\t definition.eject(item[definition.idAttribute]);\n\t });\n\t } else if (options.reapAction === 'refresh') {\n\t var _ret2 = (function () {\n\t var tasks = [];\n\t DSUtils.forEach(items, function (item) {\n\t tasks.push(definition.refresh(item[definition.idAttribute]));\n\t });\n\t return {\n\t v: DSUtils.Promise.all(tasks)\n\t };\n\t })();\n\n\t if (typeof _ret2 === 'object') return _ret2.v;\n\t }\n\t return items;\n\t }).then(function (items) {\n\t // only hit lifecycle if there are items\n\t if (items.length) {\n\t definition.afterReap(options, items);\n\t if (options.notify) {\n\t definition.emit('DS.afterReap', definition, items);\n\t }\n\t }\n\t return items;\n\t });\n\t};\n\n/***/ },\n/* 39 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Save a single item in its present state.\n\t *\n\t * @param resourceName The name of the type of resource of the item.\n\t * @param id The primary key of the item.\n\t * @param options Optional congifuration.\n\t * @returns The item, now saved.\n\t */\n\tmodule.exports = function save(resourceName, id, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var DSErrors = _this.errors;\n\n\t var definition = _this.definitions[resourceName];\n\t var resource = _this.store[resourceName];\n\t var item = undefined,\n\t noChanges = undefined,\n\t adapter = undefined;\n\n\t return new DSUtils.Promise(function (resolve, reject) {\n\t id = DSUtils.resolveId(definition, id);\n\t if (!definition) {\n\t reject(new DSErrors.NER(resourceName));\n\t } else if (!DSUtils._sn(id)) {\n\t reject(DSUtils._snErr('id'));\n\t } else if (!definition.get(id)) {\n\t reject(new DSErrors.R('id \"' + id + '\" not found in cache!'));\n\t } else {\n\t item = definition.get(id);\n\t options = DSUtils._(definition, options);\n\t resolve(item);\n\t }\n\t })\n\t // start lifecycle\n\t .then(function (attrs) {\n\t return options.beforeValidate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t return options.validate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t return options.afterValidate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t return options.beforeUpdate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t if (options.notify) {\n\t definition.emit('DS.beforeUpdate', definition, attrs);\n\t }\n\t // only send changed properties to the adapter\n\t if (options.changesOnly) {\n\n\t if (DSUtils.w) {\n\t resource.observers[id].deliver();\n\t }\n\t var toKeep = [];\n\t var changes = definition.changes(id);\n\n\t for (var key in changes.added) {\n\t toKeep.push(key);\n\t }\n\t for (key in changes.changed) {\n\t toKeep.push(key);\n\t }\n\t changes = DSUtils.pick(attrs, toKeep);\n\t // no changes? no save\n\t if (DSUtils.isEmpty(changes)) {\n\t // no changes, return\n\t noChanges = true;\n\t return attrs;\n\t } else {\n\t attrs = changes;\n\t }\n\t }\n\t adapter = definition.getAdapterName(options);\n\t return _this.adapters[adapter].update(definition, id, DSUtils.omit(attrs, options.omit), options);\n\t }).then(function (data) {\n\t return options.afterUpdate.call(data, options, data);\n\t }).then(function (attrs) {\n\t if (options.notify) {\n\t definition.emit('DS.afterUpdate', definition, attrs);\n\t }\n\t if (noChanges) {\n\t // no changes, just return\n\t return attrs;\n\t } else if (options.cacheResponse) {\n\t // inject the reponse into the store, updating the item\n\t var injected = definition.inject(attrs, options.orig());\n\t var _id = injected[definition.idAttribute];\n\t // mark the item as \"saved\"\n\t resource.saved[_id] = DSUtils.updateTimestamp(resource.saved[_id]);\n\t if (!definition.resetHistoryOnInject) {\n\t resource.previousAttributes[_id] = DSUtils.copy(injected, null, null, null, definition.relationFields);\n\t }\n\t return injected;\n\t } else {\n\t // just return an instance\n\t return definition.createInstance(attrs, options.orig());\n\t }\n\t }).then(function (item) {\n\t return DSUtils.respond(item, { adapter: adapter }, options);\n\t });\n\t};\n\n/***/ },\n/* 40 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Update a single item using the supplied properties hash.\n\t *\n\t * @param resourceName The name of the type of resource of the item to update.\n\t * @param id The primary key of the item to update.\n\t * @param attrs The attributes with which to update the item.\n\t * @param options Optional configuration.\n\t * @returns The item, now updated.\n\t */\n\tmodule.exports = function update(resourceName, id, attrs, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var DSErrors = _this.errors;\n\n\t var definition = _this.definitions[resourceName];\n\t var adapter = undefined;\n\n\t return new DSUtils.Promise(function (resolve, reject) {\n\t id = DSUtils.resolveId(definition, id);\n\t if (!definition) {\n\t reject(new DSErrors.NER(resourceName));\n\t } else if (!DSUtils._sn(id)) {\n\t reject(DSUtils._snErr('id'));\n\t } else {\n\t options = DSUtils._(definition, options);\n\t resolve(attrs);\n\t }\n\t })\n\t // start lifecycle\n\t .then(function (attrs) {\n\t return options.beforeValidate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t return options.validate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t return options.afterValidate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t return options.beforeUpdate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t if (options.notify) {\n\t definition.emit('DS.beforeUpdate', definition, attrs);\n\t }\n\t adapter = definition.getAdapterName(options);\n\t return _this.adapters[adapter].update(definition, id, DSUtils.omit(attrs, options.omit), options);\n\t }).then(function (data) {\n\t return options.afterUpdate.call(data, options, data);\n\t }).then(function (attrs) {\n\t if (options.notify) {\n\t definition.emit('DS.afterUpdate', definition, attrs);\n\t }\n\t if (options.cacheResponse) {\n\t // inject the updated item into the store\n\t var injected = definition.inject(attrs, options.orig());\n\t var resource = _this.store[resourceName];\n\t var _id = injected[definition.idAttribute];\n\t // mark the item as \"saved\"\n\t resource.saved[_id] = DSUtils.updateTimestamp(resource.saved[_id]);\n\t if (!definition.resetHistoryOnInject) {\n\t resource.previousAttributes[_id] = DSUtils.copy(injected, null, null, null, definition.relationFields);\n\t }\n\t return injected;\n\t } else {\n\t // just return an instance\n\t return definition.createInstance(attrs, options.orig());\n\t }\n\t }).then(function (item) {\n\t return DSUtils.respond(item, { adapter: adapter }, options);\n\t });\n\t};\n\n/***/ },\n/* 41 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/**\n\t * Update a collection of items using the supplied properties hash.\n\t *\n\t * @param resourceName The name of the type of resource of the items to update.\n\t * @param attrs The attributes with which to update the item.\n\t * @param params The criteria by which to select items to update. See http://www.js-data.io/docs/query-syntax\n\t * @param options Optional configuration.\n\t * @returns The updated items.\n\t */\n\tmodule.exports = function updateAll(resourceName, attrs, params, options) {\n\t var _this = this;\n\t var DSUtils = _this.utils;\n\t var DSErrors = _this.errors;\n\n\t var definition = _this.definitions[resourceName];\n\t var adapter = undefined;\n\n\t return new DSUtils.Promise(function (resolve, reject) {\n\t if (!definition) {\n\t reject(new DSErrors.NER(resourceName));\n\t } else {\n\t options = DSUtils._(definition, options);\n\t resolve(attrs);\n\t }\n\t })\n\t // start lifecycle\n\t .then(function (attrs) {\n\t return options.beforeValidate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t return options.validate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t return options.afterValidate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t return options.beforeUpdate.call(attrs, options, attrs);\n\t }).then(function (attrs) {\n\t if (options.notify) {\n\t definition.emit('DS.beforeUpdate', definition, attrs);\n\t }\n\t adapter = definition.getAdapterName(options);\n\t return _this.adapters[adapter].updateAll(definition, DSUtils.omit(attrs, options.omit), params, options);\n\t }).then(function (data) {\n\t return options.afterUpdate.call(data, options, data);\n\t }).then(function (data) {\n\t if (options.notify) {\n\t definition.emit('DS.afterUpdate', definition, attrs);\n\t }\n\t var origOptions = options.orig();\n\t if (options.cacheResponse) {\n\t var _ret = (function () {\n\t // inject the updated items into the store\n\t var injected = definition.inject(data, origOptions);\n\t var resource = _this.store[resourceName];\n\t // mark the items as \"saved\"\n\t DSUtils.forEach(injected, function (i) {\n\t var id = i[definition.idAttribute];\n\t resource.saved[id] = DSUtils.updateTimestamp(resource.saved[id]);\n\t if (!definition.resetHistoryOnInject) {\n\t resource.previousAttributes[id] = DSUtils.copy(i, null, null, null, definition.relationFields);\n\t }\n\t });\n\t return {\n\t v: injected\n\t };\n\t })();\n\n\t if (typeof _ret === 'object') return _ret.v;\n\t } else {\n\t var _ret2 = (function () {\n\t // just return instances\n\t var instances = [];\n\t DSUtils.forEach(data, function (item) {\n\t instances.push(definition.createInstance(item, origOptions));\n\t });\n\t return {\n\t v: instances\n\t };\n\t })();\n\n\t if (typeof _ret2 === 'object') return _ret2.v;\n\t }\n\t }).then(function (items) {\n\t return DSUtils.respond(items, { adapter: adapter }, options);\n\t });\n\t};\n\n/***/ },\n/* 42 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t\n\n\t /**\n\t * Typecast a value to a String, using an empty string value for null or\n\t * undefined.\n\t */\n\t function toString(val){\n\t return val == null ? '' : val.toString();\n\t }\n\n\t module.exports = toString;\n\n\n\n\n/***/ },\n/* 43 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar toString = __webpack_require__(42);\n\tvar replaceAccents = __webpack_require__(44);\n\tvar removeNonWord = __webpack_require__(45);\n\tvar upperCase = __webpack_require__(20);\n\tvar lowerCase = __webpack_require__(46);\n\t /**\n\t * Convert string to camelCase text.\n\t */\n\t function camelCase(str){\n\t str = toString(str);\n\t str = replaceAccents(str);\n\t str = removeNonWord(str)\n\t .replace(/[\\-_]/g, ' ') //convert all hyphens and underscores to spaces\n\t .replace(/\\s[a-z]/g, upperCase) //convert first char of each word to UPPERCASE\n\t .replace(/\\s+/g, '') //remove spaces\n\t .replace(/^[A-Z]/g, lowerCase); //convert first char to lowercase\n\t return str;\n\t }\n\t module.exports = camelCase;\n\n\n\n/***/ },\n/* 44 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar toString = __webpack_require__(42);\n\t /**\n\t * Replaces all accented chars with regular ones\n\t */\n\t function replaceAccents(str){\n\t str = toString(str);\n\n\t // verifies if the String has accents and replace them\n\t if (str.search(/[\\xC0-\\xFF]/g) > -1) {\n\t str = str\n\t .replace(/[\\xC0-\\xC5]/g, \"A\")\n\t .replace(/[\\xC6]/g, \"AE\")\n\t .replace(/[\\xC7]/g, \"C\")\n\t .replace(/[\\xC8-\\xCB]/g, \"E\")\n\t .replace(/[\\xCC-\\xCF]/g, \"I\")\n\t .replace(/[\\xD0]/g, \"D\")\n\t .replace(/[\\xD1]/g, \"N\")\n\t .replace(/[\\xD2-\\xD6\\xD8]/g, \"O\")\n\t .replace(/[\\xD9-\\xDC]/g, \"U\")\n\t .replace(/[\\xDD]/g, \"Y\")\n\t .replace(/[\\xDE]/g, \"P\")\n\t .replace(/[\\xE0-\\xE5]/g, \"a\")\n\t .replace(/[\\xE6]/g, \"ae\")\n\t .replace(/[\\xE7]/g, \"c\")\n\t .replace(/[\\xE8-\\xEB]/g, \"e\")\n\t .replace(/[\\xEC-\\xEF]/g, \"i\")\n\t .replace(/[\\xF1]/g, \"n\")\n\t .replace(/[\\xF2-\\xF6\\xF8]/g, \"o\")\n\t .replace(/[\\xF9-\\xFC]/g, \"u\")\n\t .replace(/[\\xFE]/g, \"p\")\n\t .replace(/[\\xFD\\xFF]/g, \"y\");\n\t }\n\t return str;\n\t }\n\t module.exports = replaceAccents;\n\n\n\n/***/ },\n/* 45 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar toString = __webpack_require__(42);\n\t // This pattern is generated by the _build/pattern-removeNonWord.js script\n\t var PATTERN = /[^\\x20\\x2D0-9A-Z\\x5Fa-z\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF]/g;\n\n\t /**\n\t * Remove non-word chars.\n\t */\n\t function removeNonWord(str){\n\t str = toString(str);\n\t return str.replace(PATTERN, '');\n\t }\n\n\t module.exports = removeNonWord;\n\n\n\n/***/ },\n/* 46 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar toString = __webpack_require__(42);\n\t /**\n\t * \"Safer\" String.toLowerCase()\n\t */\n\t function lowerCase(str){\n\t str = toString(str);\n\t return str.toLowerCase();\n\t }\n\n\t module.exports = lowerCase;\n\n\n\n/***/ }\n/******/ ])\n});\n\n"}}},{"rowIdx":79909,"cells":{"target":{"kind":"string","value":"ajax/libs/can.js/4.0.0-pre.3/can.all.min.js"},"feat_repo_name":{"kind":"string","value":"seogi1004/cdnjs"},"text":{"kind":"string","value":"!function(e,t,n){var i=t.define,a=function(e){var n,i=e.split(\".\"),a=t;for(n=0;n0&&n-1 in e)}}),define(\"can-symbol\",[\"require\",\"exports\",\"module\",\"can-namespace\"],function(e,t,n){!function(e,t,n,i){var a,r=t(\"can-namespace\");if(\"undefined\"!=typeof Symbol&&\"function\"==typeof Symbol.for)a=Symbol;else{var o=0,s={},c={};(a=function(e){var t=\"@@symbol\"+o+++e,n={};return Object.defineProperties(n,{toString:{value:function(){return t}}}),n}).for=function(e){var t=s[e];return t||(t=s[e]=a(e),c[t]=e),t},a.keyFor=function(e){return c[e]},[\"hasInstance\",\"isConcatSpreadable\",\"iterator\",\"match\",\"prototype\",\"replace\",\"search\",\"species\",\"split\",\"toPrimitive\",\"toStringTag\",\"unscopables\"].forEach(function(e){a[e]=a.for(e)})}[\"isMapLike\",\"isListLike\",\"isValueLike\",\"isFunctionLike\",\"getOwnKeys\",\"getOwnKeyDescriptor\",\"proto\",\"getOwnEnumerableKeys\",\"hasOwnKey\",\"size\",\"getName\",\"getIdentity\",\"assignDeep\",\"updateDeep\",\"getValue\",\"setValue\",\"getKeyValue\",\"setKeyValue\",\"updateValues\",\"addValue\",\"removeValues\",\"apply\",\"new\",\"onValue\",\"offValue\",\"onKeyValue\",\"offKeyValue\",\"getKeyDependencies\",\"getValueDependencies\",\"keyHasDependencies\",\"valueHasDependencies\",\"onKeys\",\"onKeysAdded\",\"onKeysRemoved\"].forEach(function(e){a.for(\"can.\"+e)}),i.exports=r.Symbol=a}(0,e,0,n)}),define(\"can-util/js/is-iterable/is-iterable\",[\"require\",\"exports\",\"module\",\"can-symbol\"],function(e,t,n){\"use strict\";var i=e(\"can-symbol\");n.exports=function(e){return e&&!!e[i.iterator||i.for(\"iterator\")]}}),define(\"can-util/js/each/each\",[\"require\",\"exports\",\"module\",\"can-util/js/is-array-like/is-array-like\",\"can-util/js/is-iterable/is-iterable\",\"can-symbol\"],function(e,t,n){\"use strict\";var i=e(\"can-util/js/is-array-like/is-array-like\"),a=Object.prototype.hasOwnProperty,r=e(\"can-util/js/is-iterable/is-iterable\"),o=e(\"can-symbol\");n.exports=function(e,t,n){var s,c,l,u=0;if(e)if(i(e))for(c=e.length;u/g,\"&gt;\").replace(p,\"&#34;\").replace(f,\"&#39;\")},getObject:function(e,t){r.warn(\"string.getObject is deprecated, please use can-util/js/get/get instead.\");for(var n,a=(t=o(t)?t:[t||window]).length,s=0;s0&&n-1 in e)}}}),define(\"can-reflect/reflections/type/type\",[\"require\",\"exports\",\"module\",\"can-symbol\",\"can-reflect/reflections/helpers\"],function(e,t,n){function i(e){var t=typeof e;return null==e||\"function\"!==t&&\"object\"!==t}function a(e){if(!e||\"object\"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(t===Object.prototype||null===t)return!0;var n=p.call(t,\"constructor\")&&t.constructor;return\"function\"==typeof n&&n instanceof n&&f.call(n)===h}var r,o=e(\"can-symbol\"),s=e(\"can-reflect/reflections/helpers\"),c=Object.getOwnPropertyNames(function(){}.prototype),l=Object.getPrototypeOf(function(){}.prototype),u=s.makeGetFirstSymbolValue([\"can.new\",\"can.apply\"]),d=s.makeGetFirstSymbolValue([\"can.onValue\",\"can.onKeyValue\",\"can.onKeys\",\"can.onKeysAdded\"]);if(\"undefined\"!=typeof Symbol&&\"function\"==typeof Symbol.for)r=function(e){return\"symbol\"==typeof e};else{r=function(e){return\"object\"==typeof e&&!Array.isArray(e)&&\"@@symbol\"===e.toString().substr(0,\"@@symbol\".length)}}var p=Object.prototype.hasOwnProperty,f=Function.prototype.toString,h=f.call(Object);n.exports={isConstructorLike:function(e){var t=e[o.for(\"can.new\")];if(void 0!==t)return t;if(\"function\"!=typeof e)return!1;var n=e.prototype;if(!n)return!1;if(l!==Object.getPrototypeOf(n))return!0;var i=Object.getOwnPropertyNames(n);if(i.length===c.length){for(var a=0,r=i.length;a=0&&e.splice(n,1)})}}};l.get=l.getKeyValue,l.set=l.setKeyValue,l.delete=l.deleteKeyValue,n.exports=l}),define(\"can-reflect/reflections/observe/observe\",[\"require\",\"exports\",\"module\",\"can-symbol\"],function(e,t,n){function i(e,t){return function(n,i,a,o){var s=n[r.for(e)];return void 0!==s?s.call(n,i,a,o):this[t].apply(this,arguments)}}function a(e,t){return function(n){var i=n[r.for(e)];if(void 0!==i){var a=o.call(arguments,1);return i.apply(n,a)}throw new Error(t)}}var r=e(\"can-symbol\"),o=[].slice;n.exports={onKeyValue:i(\"can.onKeyValue\",\"onEvent\"),offKeyValue:i(\"can.offKeyValue\",\"offEvent\"),onKeys:a(\"can.onKeys\",\"can-reflect: can not observe an onKeys event\"),onKeysAdded:a(\"can.onKeysAdded\",\"can-reflect: can not observe an onKeysAdded event\"),onKeysRemoved:a(\"can.onKeysRemoved\",\"can-reflect: can not unobserve an onKeysRemoved event\"),getKeyDependencies:a(\"can.getKeyDependencies\",\"can-reflect: can not determine dependencies\"),keyHasDependencies:a(\"can.keyHasDependencies\",\"can-reflect: can not determine if this has key dependencies\"),onValue:a(\"can.onValue\",\"can-reflect: can not observe value change\"),offValue:a(\"can.offValue\",\"can-reflect: can not unobserve value change\"),getValueDependencies:a(\"can.getValueDependencies\",\"can-reflect: can not determine dependencies\"),valueHasDependencies:a(\"can.valueHasDependencies\",\"can-reflect: can not determine if value has dependencies\"),onEvent:function(e,t,n,i){if(e){var a=e[r.for(\"can.onEvent\")];if(void 0!==a)return a.call(e,t,n,i);e.addEventListener&&e.addEventListener(t,n,i)}},offEvent:function(e,t,n,i){if(e){var a=e[r.for(\"can.offEvent\")];if(void 0!==a)return a.call(e,t,n,i);e.removeEventListener&&e.removeEventListener(t,n,i)}},setPriority:function(e,t){if(e){var n=e[r.for(\"can.setPriority\")];if(void 0!==n)return n.call(e,t),!0}return!1},getPriority:function(e){if(e){var t=e[r.for(\"can.getPriority\")];if(void 0!==t)return t.call(e)}}}}),define(\"can-reflect/reflections/shape/shape\",[\"require\",\"exports\",\"module\",\"can-symbol\",\"can-reflect/reflections/get-set/get-set\",\"can-reflect/reflections/type/type\",\"can-reflect/reflections/helpers\"],function(e,t,n){function i(e){return!!d.isPrimitive(e)||!w(e)&&(d.isBuiltIn(e)&&!d.isPlainObject(e))}function a(e,t){return function(n,a){if(i(n))return n;var r;a&&!b&&(b={unwrap:new a,serialize:new a},r=!0);var o;if(d.isValueLike(n))o=this[e](u.getValue(n));else{var s=d.isIteratorLike(n)||d.isMoreListLikeThanMapLike(n);if(o=s?[]:{},b){if(b[e].has(n))return b[e].get(n);b[e].set(n,o)}for(var c=0,l=t.length;c=i.length)return n||r(a,{index:t,deleteCount:i.length-t+1,insert:[]}),!1;var s=i[t];d.isPrimitive(e)||d.isPrimitive(s)||!1===k(e)?r(a,{index:t,deleteCount:1,insert:[s]}):this.updateDeep(e,s)},this),i.length>o&&r(a,{index:o+1,deleteCount:0,insert:i.slice(o+1)});for(var s=0,c=a.length;s\";if(r.isMoreListLikeThanMapLike(e))return n+\"[]\";if(r.isMapLike(e))return n+\"{}\"}}}var a=e(\"can-symbol\"),r=e(\"can-reflect/reflections/type/type\"),o=a.for(\"can.getName\");n.exports={setName:function(e,t){if(\"function\"!=typeof t){var n=t;t=function(){return n}}Object.defineProperty(e,o,{value:t})},getName:i}}),define(\"can-reflect/types/map\",[\"require\",\"exports\",\"module\",\"can-reflect/reflections/shape/shape\",\"can-symbol\"],function(e,t,n){var i=e(\"can-reflect/reflections/shape/shape\"),a=e(\"can-symbol\");\"undefined\"!=typeof Map&&(i.assignSymbols(Map.prototype,{\"can.getOwnEnumerableKeys\":Map.prototype.keys,\"can.setKeyValue\":Map.prototype.set,\"can.getKeyValue\":Map.prototype.get,\"can.deleteKeyValue\":Map.prototype.delete,\"can.hasOwnKey\":Map.prototype.has}),\"function\"!=typeof Map.prototype.keys&&(Map.prototype.keys=Map.prototype[a.for(\"can.getOwnEnumerableKeys\")]=function(){var e=[],t=0;return this.forEach(function(t,n){e.push(n)}),{next:function(){return{value:e[t],done:t++===e.length}}}})),\"undefined\"!=typeof WeakMap&&i.assignSymbols(WeakMap.prototype,{\"can.getOwnEnumerableKeys\":function(){throw new Error(\"can-reflect: WeakMaps do not have enumerable keys.\")},\"can.setKeyValue\":WeakMap.prototype.set,\"can.getKeyValue\":WeakMap.prototype.get,\"can.deleteKeyValue\":WeakMap.prototype.delete,\"can.hasOwnKey\":WeakMap.prototype.has})}),define(\"can-reflect/types/set\",[\"require\",\"exports\",\"module\",\"can-reflect/reflections/shape/shape\",\"can-symbol\"],function(e,t,n){var i=e(\"can-reflect/reflections/shape/shape\"),a=e(\"can-symbol\");\"undefined\"!=typeof Set&&(i.assignSymbols(Set.prototype,{\"can.isMoreListLikeThanMapLike\":!0,\"can.updateValues\":function(e,t,n){t!==n&&i.each(t,function(e){this.delete(e)},this),i.each(n,function(e){this.add(e)},this)},\"can.size\":function(){return this.size}}),\"function\"!=typeof Set.prototype[a.iterator]&&(Set.prototype[a.iterator]=function(){var e=[],t=0;return this.forEach(function(t){e.push(t)}),{next:function(){return{value:e[t],done:t++===e.length}}}})),\"undefined\"!=typeof WeakSet&&i.assignSymbols(WeakSet.prototype,{\"can.isListLike\":!0,\"can.isMoreListLikeThanMapLike\":!0,\"can.updateValues\":function(e,t,n){t!==n&&i.each(t,function(e){this.delete(e)},this),i.each(n,function(e){this.add(e)},this)},\"can.size\":function(){throw new Error(\"can-reflect: WeakSets do not have enumerable keys.\")}})}),define(\"can-reflect\",[\"require\",\"exports\",\"module\",\"can-reflect/reflections/call/call\",\"can-reflect/reflections/get-set/get-set\",\"can-reflect/reflections/observe/observe\",\"can-reflect/reflections/shape/shape\",\"can-reflect/reflections/type/type\",\"can-reflect/reflections/get-name/get-name\",\"can-namespace\",\"can-reflect/types/map\",\"can-reflect/types/set\"],function(e,t,n){var i=e(\"can-reflect/reflections/call/call\"),a=e(\"can-reflect/reflections/get-set/get-set\"),r=e(\"can-reflect/reflections/observe/observe\"),o=e(\"can-reflect/reflections/shape/shape\"),s=e(\"can-reflect/reflections/type/type\"),c=e(\"can-reflect/reflections/get-name/get-name\"),l=e(\"can-namespace\"),u={};[i,a,r,o,s,c].forEach(function(e){for(var t in e)if(u[t]=e[t],\"function\"==typeof e[t]){var n=Object.getOwnPropertyDescriptor(e[t],\"name\");(!n||n.writable&&n.configurable)&&Object.defineProperty(e[t],\"name\",{value:\"canReflect.\"+t})}}),e(\"can-reflect/types/map\"),e(\"can-reflect/types/set\"),n.exports=l.Reflect=u}),define(\"can-globals/can-globals-proto\",[\"require\",\"exports\",\"module\",\"can-reflect\"],function(e,t,n){!function(e,t,n,i){\"use strict\";function a(e,t){var n=this.eventHandlers[e];if(n)for(var i=n.slice(),a=0;a=0&&n.handlers.splice(i,1),0===n.handlers.length&&(n.observer.disconnect(),r.clean.call(t,\"globalObserverData\"))}}},f=function(e){var t=e.toLowerCase()+\"Nodes\",n=function(){var e=a().documentElement,n=r.get.call(e,t+\"MutationData\");return n||(n={name:t,handlers:[],afterHandlers:[],hander:null},o()&&r.set.call(e,t+\"MutationData\",n)),n},i=function(){var e=n();return 0!==e.handlers.length&&0!==e.afterHandlers.length||(e.handler=function(n){var i=new c;n.forEach(function(n){s(n[t],function(t){var n=t.getElementsByTagName&&l(t.getElementsByTagName(\"*\")),a=d(t,e,i);if(n&&!a)for(var r,o=0;void 0!==(r=n[o]);o++)d(r,e,i)})})},this.add(e.handler)),e},f=function(){var e=a().documentElement,i=n();0===i.handlers.length&&0===i.afterHandlers.length&&(this.remove(i.handler),r.clean.call(e,t+\"MutationData\"))},h=function(e,t){p[\"on\"+e]=function(e){i.call(this)[t].push(e)},p[\"off\"+e]=function(e){var i=n(),a=i[t].indexOf(e);a>=0&&i[t].splice(a,1),f.call(this)}};!function(e){h(e,\"handlers\"),h(\"After\"+e,\"afterHandlers\")}(u.capitalize(t))};f(\"added\"),f(\"removed\"),i.exports=p}(0,e,0,n)}),define(\"can-util/dom/data/data\",[\"require\",\"exports\",\"module\",\"can-dom-data-state\",\"can-util/dom/mutation-observer/document/document\"],function(e,t,n){\"use strict\";var i=e(\"can-dom-data-state\"),a=e(\"can-util/dom/mutation-observer/document/document\"),r=function(){return i.delete.call(this)},o=0,s=function(e){0===(o-=r.call(e)?1:0)&&a.offAfterRemovedNodes(s)};n.exports={getCid:i.getCid,cid:i.cid,expando:i.expando,clean:i.clean,get:i.get,set:function(e,t){0===o&&a.onAfterRemovedNodes(s),o+=i.set.call(this,e,t)?1:0},delete:r}}),define(\"can-util/dom/class-name/class-name\",function(e,t,n){\"use strict\";var i=function(e){return this.classList?this.classList.contains(e):!!this.className.match(new RegExp(\"(\\\\s|^)\"+e+\"(\\\\s|$)\"))};n.exports={has:i,add:function(e){this.classList?this.classList.add(e):i.call(this,e)||(this.className+=\" \"+e)},remove:function(e){if(this.classList)this.classList.remove(e);else if(i.call(this,e)){var t=new RegExp(\"(\\\\s|^)\"+e+\"(\\\\s|$)\");this.className=this.className.replace(t,\" \")}}}}),define(\"can-globals/is-browser-window/is-browser-window\",[\"require\",\"exports\",\"module\",\"can-globals/can-globals-instance\"],function(e,t,n){!function(e,t,n,i){\"use strict\";var a=t(\"can-globals/can-globals-instance\");a.define(\"isBrowserWindow\",function(){return\"undefined\"!=typeof window&&\"undefined\"!=typeof document&&\"undefined\"==typeof SimpleDOM}),i.exports=a.makeExport(\"isBrowserWindow\")}(0,e,0,n)}),define(\"can-util/dom/events/events\",[\"require\",\"exports\",\"module\",\"can-globals/document/document\",\"can-globals/is-browser-window/is-browser-window\",\"can-util/js/is-plain-object/is-plain-object\",\"can-log/dev/dev\"],function(e,t,n){!function(e,t,n,i){\"use strict\";function a(e,t){var n=s(t)?\"inserted\"===t.type||\"removed\"===t.type:\"inserted\"===t||\"removed\"===t,i=!!e.disabled;return n&&i}var r=t(\"can-globals/document/document\"),o=t(\"can-globals/is-browser-window/is-browser-window\"),s=t(\"can-util/js/is-plain-object/is-plain-object\"),c=!1,l=t(\"can-log/dev/dev\");i.exports={addEventListener:function(){this.addEventListener.apply(this,arguments)},removeEventListener:function(){this.removeEventListener.apply(this,arguments)},canAddEventListener:function(){return this.nodeName&&(1===this.nodeType||9===this.nodeType)||this===window},dispatch:function(e,t,n){var i,o=c&&a(this,e),s=(this.ownerDocument||r()).createEvent(\"HTMLEvents\"),u=\"string\"==typeof e;if(s.initEvent(u?e:e.type,void 0===n||n,!1),!u)for(var d in e)void 0===s[d]&&(s[d]=e[d]);return!0===this.disabled&&\"fix_synthetic_events_on_disabled_test\"!==s.type&&l.warn(\"can-util/dom/events::dispatch: Dispatching a synthetic event on a disabled is problematic in FireFox and Internet Explorer. We recommend avoiding this if at all possible. see https://github.com/canjs/can-util/issues/294\"),s.args=t,o&&(this.disabled=!1),i=this.dispatchEvent(s),o&&(this.disabled=!0),i}},function(){if(o()){var e=\"fix_synthetic_events_on_disabled_test\",t=document.createElement(\"input\");t.disabled=!0;var n=setTimeout(function(){c=!0},50),a=function a(){clearTimeout(n),i.exports.removeEventListener.call(t,e,a)};i.exports.addEventListener.call(t,e,a);try{i.exports.dispatch.call(t,e,[],!1)}catch(e){a(),c=!0}}}()}(0,e,0,n)}),define(\"can-queues/queue-state\",function(e,t,n){n.exports={lastTask:null}}),define(\"can-queues/queue\",[\"require\",\"exports\",\"module\",\"can-queues/queue-state\",\"can-util/js/dev/dev\"],function(e,t,n){function i(){}var a=e(\"can-queues/queue-state\"),r=e(\"can-util/js/dev/dev\"),o=function(e,t){this.callbacks=Object.assign({onFirstTask:i,onComplete:function(){a.lastTask=null}},t||{}),this.name=e,this.index=0,this.tasks=[],this._log=!1};o.noop=i,o.prototype.enqueue=function(e,t,n,i){var a=this.tasks.push({fn:e,context:t,args:n,meta:i||{}});this._logEnqueue(this.tasks[a-1]),1===a&&this.callbacks.onFirstTask(this)},o.prototype._logEnqueue=function(e){if(e.meta.stack=this,e.meta.parentTask=a.lastTask,!0===this._log||\"enqueue\"===this._log){var t=e.meta.log?e.meta.log.concat(e):[e.fn.name,e];r.log.apply(r,[this.name+\" enqueuing:\"].concat(t))}},o.prototype._logFlush=function(e){if(!0===this._log||\"flush\"===this._log){var t=e.meta.log?e.meta.log.concat(e):[e.fn.name,e];r.log.apply(r,[this.name+\" running :\"].concat(t))}a.lastTask=e},o.prototype.flush=function(){for(;this.indexe.index){var t=e.tasks[e.index++];this._logFlush(t),this.tasksRemaining--,this.taskMap.delete(t.fn),t.fn.apply(t.context,t.args)}else this.curPriorityIndex++}},a.prototype.flushQueuedTask=function(e){var t=this.taskMap.get(e);if(t){var n=t.meta.priority||0,i=this.taskContainersByPriority[n],a=i.tasks.indexOf(t,i.index);a>=0&&(i.tasks.splice(a,1),this._logFlush(t),this.tasksRemaining--,this.taskMap.delete(t.fn),t.fn.apply(t.context,t.args))}},a.prototype.getTaskContainerAndUpdateRange=function(e){var t=e.meta.priority||0;return tthis.curPriorityMax&&(this.curPriorityMax=t),this.taskContainersByPriority[t]||(this.taskContainersByPriority[t]={tasks:[],index:0})},a.prototype.tasksRemainingCount=function(){return this.tasksRemaining},n.exports=a}),define(\"can-queues/completion-queue\",[\"require\",\"exports\",\"module\",\"can-queues/queue\"],function(e,t,n){var i=e(\"can-queues/queue\"),a=function(){i.apply(this,arguments),this.flushCount=0};(a.prototype=Object.create(i.prototype)).flush=function(){if(this.flushCount>0);else{for(this.flushCount++;this.index0},number:function(){return g},data:function(){return i}},enqueueByQueue:function(e,t,n,i,a){e&&(i=i||y,b.batch.start(),[\"notify\",\"derive\",\"domUI\",\"mutate\"].forEach(function(r){var o=b[r+\"Queue\"],s=e[r];void 0!==s&&s.forEach(function(e){var r=i&&i(e,t,n);r.reasonLog=a,o.enqueue(e,t,n,r)})}),b.batch.stop())},stack:function(){for(var e=d.lastTask,t=[];e;)t.unshift(e),e=e.meta.parentTask;return t},logStack:function(){this.stack().forEach(function(e){var t=e.meta&&e.meta.log?e.meta.log:[e.fn.name,e];c.log.apply(c,[e.meta.stack.name+\" ran task:\"].concat(t))})},taskCount:function(){return a.tasks.length+r.tasks.length+o.tasks.length+s.tasks.length},flush:function(){a.flush()},log:function(){a.log.apply(a,arguments),r.log.apply(r,arguments),o.log.apply(o,arguments),s.log.apply(s,arguments)}};if(f.queues)throw new Error(\"You can't have two versions of can-queues, check your dependencies\");n.exports=f.queues=b}),define(\"can-key-tree\",[\"require\",\"exports\",\"module\",\"can-reflect\"],function(e,t,n){function i(e){return e===Object.prototype||\"[object Object]\"!==Object.prototype.toString.call(e)&&-1!==Object.prototype.toString.call(e).indexOf(\"[object \")}function a(e,t,n,i){if(e)if(i===n){if(!s.isMoreListLikeThanMapLike(e))throw new Error(\"can-key-tree: Map types are not supported yet.\");s.addValues(t,s.toArray(e))}else s.each(e,function(e){a(e,t,n+1,i)})}function r(e,t,n){if(n===t){if(!s.isMoreListLikeThanMapLike(e))throw new Error(\"can-key-tree: Map types are not supported yet.\");s.removeValues(e,s.toArray(e))}else s.each(e,function(i,a){r(i,t+1,n),s.deleteKeyValue(e,a)})}function o(e,t){if(0===t)return s.size(e);if(0===s.size(e))return 0;var n=0;return s.each(e,function(e){n+=o(e,t-1)}),n}var s=e(\"can-reflect\"),c=function(e,t){this.callbacks=t||{},this.treeStructure=e;var n=e[0];s.isConstructorLike(n)?this.root=new n:this.root=n};c.prototype.add=function(e){if(e.length>this.treeStructure.length)throw new Error(\"can-key-tree: Can not add path deeper than tree.\");for(var t=this.root,n=0===s.size(this.root),a=0;a=0&&0===s.size(t);i--)t=n[i],s.deleteKeyValue(t,e[i]);return this.callbacks.onEmpty&&0===s.size(this.root)&&this.callbacks.onEmpty.call(this),!0},c.prototype.size=function(){return o(this.root,this.treeStructure.length-1)},n.exports=c}),define(\"can-observation-recorder\",[\"require\",\"exports\",\"module\",\"can-namespace\"],function(e,t,n){var i=e(\"can-namespace\"),a=[],r={stack:a,makeDependenciesRecorder:function(){return{traps:null,keyDependencies:new Map,valueDependencies:new Set,ignore:0}},start:function(){a.push({traps:null,keyDependencies:new Map,valueDependencies:new Set,ignore:0})},stop:function(){return a.pop()},add:function(e,t){var n=a[a.length-1];if(n&&0===n.ignore)if(n.traps)n.traps.push([e,t]);else if(void 0===t)n.valueDependencies.add(e);else{var i=n.keyDependencies.get(e);i||(i=new Set,n.keyDependencies.set(e,i)),i.add(t)}},addMany:function(e){var t=a[a.length-1];if(t)if(t.traps)t.traps.push.apply(t.traps,e);else for(var n=0,i=e.length;n0&&a.updateChildrenAndSelf(this),this.value):this.func.call(this.context)},dependencyChange:function(e,t){!0===this.bound&&c.deriveQueue.enqueue(this.update,this,[],{priority:this.options.priority,log:[s.getName(this.update)]},[s.getName(e),\"changed\"])},update:function(){if(!0===this.bound){var e=this.value;if(this.oldValue=null,this.start(),e!==this.value)return\"function\"==typeof this._log&&this._log(e,this.value),c.enqueueByQueue(this.handlers.getNode([]),this,[this.value,e],null,[s.getName(this),\"changed to\",this.value,\"from\",e]),!0}},start:function(){this.bound=!0,this.oldDependencies=this.newDependencies,u.start(),this.value=this.func.call(this.context),this.newDependencies=u.stop(),d.updateObservations(this)},stop:function(){this.bound=!1,d.stopObserving(this.newDependencies,this.onDependencyChange),this.newDependencies=u.makeDependenciesRecorder()},hasDependencies:function(){var e=this.newDependencies;return this.bound?e.valueDependencies.size+e.keyDependencies.size>0:void 0},log:function(){var e=function(e){return\"string\"==typeof e?JSON.stringify(e):e};this._log=function(t,n){f.log(s.getName(this),\"\\n is \",e(n),\"\\n was \",e(t))}}}),s.assignSymbols(a.prototype,{\"can.onValue\":function(e,t){this.handlers.add([t||\"mutate\",e])},\"can.offValue\":function(e,t){this.handlers.delete([t||\"mutate\",e])},\"can.getValue\":a.prototype.get,\"can.isValueLike\":!0,\"can.isMapLike\":!1,\"can.isListLike\":!1,\"can.valueHasDependencies\":a.prototype.hasDependencies,\"can.getValueDependencies\":function(){if(!0===this.bound)return this.newDependencies},\"can.getPriority\":function(){return this.options.priority},\"can.setPriority\":function(e){this.options.priority=e},\"can.getName\":function(){return s.getName(this.constructor)+\"<\"+s.getName(this.func)+\">\"}});var h=p.for(\"can.getValueDependencies\");a.updateChildrenAndSelf=function(e){if(e.update&&!0===c.deriveQueue.isEnqueued(e.update))return c.deriveQueue.flushQueuedTask(e.update),!0;if(e[h]){var t=!1;return(e[h]().valueDependencies||[]).forEach(function(e){a.updateChildrenAndSelf(e)&&(t=!0)}),t}return!1},a.add=u.add,a.addAll=u.addMany,a.ignore=u.ignore,a.trap=u.trap,a.trapsCount=u.trapsCount,a.isRecording=u.isRecording;var v,m=function(){},g=function(){for(var e=0,t=v.length;e1?(r=o.pop(),e=i.read(e,o,a).value,o.push(r)):r=o[0];var s=h(e,r.key);i.valueReadersMap.isValueLike.test(s,o.length-1,o,a)?i.valueReadersMap.isValueLike.write(s,n,a):(i.valueReadersMap.isValueLike.test(e,o.length-1,o,a)&&(e=e[d]()),i.propertyReadersMap.map.test(e)?i.propertyReadersMap.map.write(e,r.key,n,a):i.propertyReadersMap.object.test(e)&&(i.propertyReadersMap.object.write(e,r.key,n,a),a.observation&&a.observation.update()))}}).propertyReaders,function(e){i.propertyReadersMap[e.name]=e}),o(i.valueReaders,function(e){i.valueReadersMap[e.name]=e}),i.set=i.write,n.exports=i}),define(\"can-util/dom/dispatch/dispatch\",[\"require\",\"exports\",\"module\",\"can-util/dom/events/events\"],function(e,t,n){\"use strict\";var i=e(\"can-util/dom/events/events\");n.exports=function(){return i.dispatch.apply(this,arguments)}}),define(\"can-util/dom/matches/matches\",function(e,t,n){\"use strict\";var i=function(e){return e.matches||e.webkitMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector};n.exports=function(){var e=i(this);return!!e&&e.apply(this,arguments)}}),define(\"can-util/js/is-empty-object/is-empty-object\",function(e,t,n){\"use strict\";n.exports=function(e){for(var t in e)return!1;return!0}}),define(\"can-util/dom/events/delegate/delegate\",[\"require\",\"exports\",\"module\",\"can-util/dom/events/events\",\"can-util/dom/data/data\",\"can-util/dom/matches/matches\",\"can-util/js/each/each\",\"can-util/js/is-empty-object/is-empty-object\"],function(e,t,n){\"use strict\";var i=e(\"can-util/dom/events/events\"),a=e(\"can-util/dom/data/data\"),r=e(\"can-util/dom/matches/matches\"),o=e(\"can-util/js/each/each\"),s=e(\"can-util/js/is-empty-object/is-empty-object\"),c=\"delegateEvents\",l=function(e){return\"focus\"===e||\"blur\"===e},u=function(e){var t=a.get.call(this,c)[e.type],n=[];if(t){var i=[];o(t,function(e){i.push(e)});var s=e.target;do{i.forEach(function(e){r.call(s,e[0].selector)&&n.push({target:s,delegates:e})}),s=s.parentNode}while(s&&s!==e.currentTarget)}var l=e.stopPropagation;e.stopPropagation=function(){l.apply(this,arguments),this.cancelBubble=!0};for(var u=0;u2&&(r.warn(\"Arguments to dispatch should be an array, not multiple arguments.\"),t=Array.prototype.slice.call(arguments,1)),t&&!Array.isArray(t)&&(r.warn(\"Arguments to dispatch should be an array.\"),t=[t]),!this.__inSetup){\"string\"==typeof e&&(e={type:e}),e.reasonLog||(e.reasonLog=[c.getName(this),\"dispatched\",'\"'+e+'\"',\"with\"].concat(t)),e.makeMeta||(e.makeMeta=function(e){return{log:[c.getName(e)]}});var n=p(this);\"function\"==typeof n._log&&n._log.call(this,e,t);var a=i(this).getNode([e.type]);if(a){if(s.batch.start(),a.onKeyValue&&s.enqueueByQueue(a.onKeyValue,this,t,e.makeMeta,e.reasonLog),a.event){e.batchNum=s.batch.number();var o=[e].concat(t);s.enqueueByQueue(a.event,this,o,e.makeMeta,e.reasonLog)}s.batch.stop()}}},addEventListener:function(e,t,n){i(this).add([e,\"event\",n||\"mutate\",t])},removeEventListener:function(e,t,n){i(this).delete([e,\"event\",n||\"mutate\",t])}},h=l.for(\"can.onKeyValue\"),v=l.for(\"can.offKeyValue\"),m=l.for(\"can.onEvent\"),g=l.for(\"can.offEvent\"),y=l.for(\"can.onValue\"),b=l.for(\"can.offValue\");f.on=function(e,t,n){if(d.canAddEventListener.call(this))d[\"string\"==typeof t?\"addDelegateListener\":\"addEventListener\"].call(this,e,t,n);else if(\"addEventListener\"in this)this.addEventListener(e,t,n);else if(this[h])c.onKeyValue(this,e,t,n);else if(this[m])this[m](e,t,n);else{if(e||!this[y])throw new Error(\"can-control: Unable to bind \"+e);c.onValue(this,t)}},f.off=function(e,t,n){if(d.canAddEventListener.call(this))d[\"string\"==typeof t?\"removeDelegateListener\":\"removeEventListener\"].call(this,e,t,n);else if(\"removeEventListener\"in this)this.removeEventListener(e,t,n);else if(this[v])c.offKeyValue(this,e,t,n);else if(this[g])this[g](e,t,n);else{if(e||!this[b])throw new Error(\"can-control: Unable to unbind \"+e);c.offValue(this,t)}};var w={\"can.onKeyValue\":function(e,t,n){i(this).add([e,\"onKeyValue\",n||\"mutate\",t])},\"can.offKeyValue\":function(e,t,n){i(this).delete([e,\"onKeyValue\",n||\"mutate\",t])}},k=function(e){return o(e,f),c.assignSymbols(e,w),e};o(k,f),a(k,\"start\",function(){console.warn(\"use can-queues.batch.start()\"),s.batch.start()}),a(k,\"stop\",function(){console.warn(\"use can-queues.batch.stop()\"),s.batch.stop()}),a(k,\"flush\",function(){console.warn(\"use can-queues.flush()\"),s.flush()}),a(k,\"afterPreviousEvents\",function(e){console.warn(\"don't use afterPreviousEvents\"),s.mutateQueue.enqueue(function(){s.mutateQueue.enqueue(e)}),s.flush()}),a(k,\"after\",function(e){console.warn(\"don't use after\"),s.mutateQueue.enqueue(e),s.flush()}),n.exports=k}),define(\"can-simple-map\",[\"require\",\"exports\",\"module\",\"can-construct\",\"can-event-queue\",\"can-queues\",\"can-util/js/each/each\",\"can-observation-recorder\",\"can-reflect\",\"can-log/dev/dev\",\"can-symbol\"],function(e,t,n){var i=e(\"can-construct\"),a=e(\"can-event-queue\"),r=e(\"can-queues\"),o=e(\"can-util/js/each/each\"),s=e(\"can-observation-recorder\"),c=e(\"can-reflect\"),l=e(\"can-log/dev/dev\"),u=e(\"can-symbol\"),d=function(e){var t=u.for(\"can.meta\"),n=e[t];return n||(n={},c.setKeyValue(e,t,n)),n},p=i.extend(\"SimpleMap\",{setup:function(e){this._data={},this.attr(e)},attr:function(e,t){var n=this;if(0===arguments.length){s.add(this,\"__keys\");var i={};return o(this._data,function(e,t){s.add(this,t),i[t]=e},this),i}if(arguments.length>1){var a=this._data.hasOwnProperty(e),l=this._data[e];this._data[e]=t,r.batch.start(),a||this.dispatch(\"__keys\",[]),\"function\"==typeof this._log&&this._log(e,t,l),this.dispatch({type:e,reasonLog:[c.getName(this)+\"'s\",e,\"changed to\",t,\"from\",l]},[t,l]),r.batch.stop()}else{if(\"object\"!=typeof e)return\"constructor\"!==e?(s.add(this,e),this._data[e]):this.constructor;r.batch.start(),c.eachKey(e,function(e,t){n.attr(t,e)}),r.batch.stop()}},serialize:function(){return c.serialize(this,Map)},get:function(){return this.attr.apply(this,arguments)},set:function(){return this.attr.apply(this,arguments)},log:function(e){var t=function(e){return\"string\"==typeof e?JSON.stringify(e):e},n=d(this);n.allowedLogKeysSet=n.allowedLogKeysSet||new Set,e&&n.allowedLogKeysSet.add(e),this._log=function(i,a,r,o){e&&!n.allowedLogKeysSet.has(i)||l.log(c.getName(this),\"\\n key \",t(i),\"\\n is \",t(a),\"\\n was \",t(r))}}});a(p.prototype),c.assignSymbols(p.prototype,{\"can.isMapLike\":!0,\"can.isListLike\":!1,\"can.isValueLike\":!1,\"can.getKeyValue\":p.prototype.get,\"can.setKeyValue\":p.prototype.set,\"can.deleteKeyValue\":function(e){return this.attr(e,void 0)},\"can.getOwnEnumerableKeys\":function(){return s.add(this,\"__keys\"),Object.keys(this._data)},\"can.assignDeep\":function(e){r.batch.start(),c.assignMap(this,e),r.batch.stop()},\"can.updateDeep\":function(e){r.batch.start(),c.updateMap(this,e),r.batch.stop()},\"can.keyHasDependencies\":function(e){return!1},\"can.getKeyDependencies\":function(e){},\"can.getName\":function(){return c.getName(this.constructor)+\"{}\"}}),n.exports=p}),define(\"can-view-scope/reference-map\",[\"require\",\"exports\",\"module\",\"can-simple-map\"],function(e,t,n){var i=e(\"can-simple-map\").extend({});n.exports=i}),define(\"can-util/js/single-reference/single-reference\",[\"require\",\"exports\",\"module\",\"can-cid\"],function(e,t,n){!function(e,t,n,i){function a(e,t){return(t?o(e)+\":\"+t:o(e))||e}var r,o=t(\"can-cid\");r={set:function(e,t,n,i){e[a(t,i)]=n},getAndDelete:function(e,t,n){var i=a(t,n),r=e[i];return delete e[i],r}},i.exports=r}(0,e,0,n)}),define(\"can-view-scope/make-compute-like\",[\"require\",\"exports\",\"module\",\"can-util/js/single-reference/single-reference\",\"can-reflect\"],function(e,t,n){var i=e(\"can-util/js/single-reference/single-reference\"),a=e(\"can-reflect\"),r=function(e){return arguments.length?a.setValue(this,e):a.getValue(this)};n.exports=function(e){var t=r.bind(e);return t.on=t.bind=t.addEventListener=function(n,a){var r=function(e,n){a.call(t,{type:\"change\"},e,n)};i.set(a,this,r),e.on(r)},t.off=t.unbind=t.removeEventListener=function(t,n){e.off(i.getAndDelete(n,this))},a.assignSymbols(t,{\"can.getValue\":function(){return a.getValue(e)},\"can.setValue\":function(t){return a.setValue(e,t)},\"can.onValue\":function(t,n){return a.onValue(e,t,n)},\"can.offValue\":function(t,n){return a.offValue(e,t,n)},\"can.valueHasDependencies\":function(){return a.valueHasDependencies(e)},\"can.getPriority\":function(){return a.getPriority(e)},\"can.setPriority\":function(t){a.setPriority(e,t)},\"can.isValueLike\":!0,\"can.isFunctionLike\":!1}),t.isComputed=!0,t}}),define(\"can-view-scope/compute_data\",[\"require\",\"exports\",\"module\",\"can-observation\",\"can-stache-key\",\"can-util/js/assign/assign\",\"can-reflect\",\"can-symbol\",\"can-key-tree\",\"can-queues\",\"can-observation-recorder\",\"can-cid/set/set\",\"can-view-scope/make-compute-like\"],function(e,t,n){\"use strict\";var i=e(\"can-observation\"),a=e(\"can-stache-key\"),r=e(\"can-util/js/assign/assign\"),o=e(\"can-reflect\"),s=e(\"can-symbol\"),c=e(\"can-key-tree\"),l=e(\"can-queues\"),u=e(\"can-observation-recorder\"),d=e(\"can-cid/set/set\"),p=e(\"can-view-scope/make-compute-like\"),f=u.ignore(o.getValue.bind(o)),h=u.ignore(function(e){if(e.reads&&1===e.reads.length){var t=e.root;return t&&t[s.for(\"can.getValue\")]&&(t=o.getValue(t)),t&&o.isObservableLike(t)&&o.isMapLike(t)&&\"function\"!=typeof t[e.reads[0].key]&&t}}),v=function(e){return e&&\"number\"==typeof e.batchNum&&\"string\"==typeof e.type},m=function(e,t,n){this.startingScope=e,this.key=t,this.options=r({observation:this.observation},n);var a;this.read=this.read.bind(this),this.dispatch=this.dispatch.bind(this),Object.defineProperty(this.read,\"name\",{value:\"{{\"+this.key+\"}}::ScopeKeyData.read\"}),Object.defineProperty(this.dispatch,\"name\",{value:o.getName(this)+\".dispatch\"}),this.handlers=new c([Object,Array],{onFirst:this.setup.bind(this),onEmpty:this.teardown.bind(this)}),a=this.observation=new i(this.read,this),this.fastPath=void 0,this.root=void 0,this.initialValue=void 0,this.reads=void 0,this.setRoot=void 0;var s=new d;s.add(a),this.dependencies={valueDependencies:s}};m.prototype={constructor:m,dispatch:function(e){var t=this.value;this.value=e,l.enqueueByQueue(this.handlers.getNode([]),this,[e,t],null,[o.getName(this),\"changed to\",e,\"from\",t])},setup:function(){this.bound=!0,o.onValue(this.observation,this.dispatch,\"notify\");var e=h(this);e&&this.toFastPath(e),this.value=f(this.observation)},teardown:function(){this.bound=!1,o.offValue(this.observation,this.dispatch,\"notify\"),this.toSlowPath()},set:function(e){var t=this.root||this.setRoot;t?a.write(t,this.reads,e,this.options):this.startingScope.set(this.key,e,this.options)},get:function(){return u.isRecording()&&(u.add(this),this.bound||i.temporarilyBind(this)),!0===this.bound?this.value:this.observation.get()},on:function(e,t){this.handlers.add([t||\"mutate\",e])},off:function(e,t){this.handlers.delete([t||\"mutate\",e])},toFastPath:function(e){var t=this,n=this.observation;this.fastPath=!0,n.dependencyChange=function(n,a){if(v(a))throw\"no event objects!\";return n===e&&\"function\"!=typeof a?this.newVal=a:t.toSlowPath(),i.prototype.dependencyChange.apply(this,arguments)},n.start=function(){this.value=this.newVal}},toSlowPath:function(){this.observation.dependencyChange=i.prototype.dependencyChange,this.observation.start=i.prototype.start,this.fastPath=!1},read:function(){if(this.root)return a.read(this.root,this.reads,this.options).value;var e=this.startingScope.read(this.key,this.options);return this.scope=e.scope,this.reads=e.reads,this.root=e.rootObserve,this.setRoot=e.setRoot,this.initialValue=e.value},hasDependencies:function(){return o.valueHasDependencies(this.observation)}},o.assignSymbols(m.prototype,{\"can.getValue\":m.prototype.get,\"can.setValue\":m.prototype.set,\"can.onValue\":m.prototype.on,\"can.offValue\":m.prototype.off,\"can.valueHasDependencies\":m.prototype.hasDependencies,\"can.getValueDependencies\":function(){return this.dependencies},\"can.getPriority\":function(){return o.getPriority(this.observation)},\"can.setPriority\":function(e){o.setPriority(this.observation,e)},\"can.getName\":function(){return o.getName(this.constructor)+\"{{\"+this.key+\"}}\"}}),Object.defineProperty(m.prototype,\"compute\",{get:function(){var e=p(this);return Object.defineProperty(this,\"compute\",{value:e,writable:!1,configurable:!1}),e},configurable:!0}),n.exports=function(e,t,n){return new m(e,t,n||{args:[]})}}),define(\"can-util/js/log/log\",[\"require\",\"exports\",\"module\",\"can-log\"],function(e,t,n){\"use strict\";n.exports=e(\"can-log\")}),define(\"can-view-scope\",[\"require\",\"exports\",\"module\",\"can-stache-key\",\"can-observation\",\"can-view-scope/reference-map\",\"can-view-scope/compute_data\",\"can-util/js/assign/assign\",\"can-util/js/each/each\",\"can-namespace\",\"can-util/js/dev/dev\",\"can-reflect\",\"can-util/js/log/log\"],function(e,t,n){function i(e,t,n){this._context=e,this._parent=t,this._meta=n||{},this.__cache={}}function a(e,t,n){e.helpers||e.partials||e.tags||(e={helpers:e}),i.call(this,e,t,n)}var r=e(\"can-stache-key\"),o=e(\"can-observation\"),s=e(\"can-view-scope/reference-map\"),c=e(\"can-view-scope/compute_data\"),l=e(\"can-util/js/assign/assign\"),u=e(\"can-util/js/each/each\"),d=e(\"can-namespace\"),p=e(\"can-util/js/dev/dev\"),f=e(\"can-reflect\"),h=e(\"can-util/js/log/log\");l(i,{read:r.read,Refs:s,refsScope:function(){return new i(new this.Refs)},keyInfo:function(e){var t={};return t.isDotSlash=\"./\"===e.substr(0,2),t.isThisDot=\"this.\"===e.substr(0,5),t.isThisAt=\"this@\"===e.substr(0,5),t.isInCurrentContext=t.isDotSlash||t.isThisDot||t.isThisAt,t.isInParentContext=\"../\"===e.substr(0,3),t.isCurrentContext=\".\"===e||\"this\"===e,t.isParentContext=\"..\"===e,t.isContextBased=t.isInCurrentContext||t.isInParentContext||t.isCurrentContext||t.isParentContext,t}}),l(i.prototype,{add:function(e,t){return e!==this._context?new this.constructor(e,this,t):this},read:function(e,t){if(\"%root\"===e)return{value:this.getRoot()};if(\"%scope\"===e)return{value:this};var n=i.keyInfo(e);if(n.isContextBased&&this._meta.notContext)return this._parent.read(e,t);var a;if(n.isInCurrentContext)a=!0,e=n.isDotSlash?e.substr(2):e.substr(5);else{if(n.isInParentContext||n.isParentContext){for(var o=this._parent;o._meta.notContext;)o=o._parent;return n.isParentContext?r.read(o._context,[],t):o.read(e.substr(3)||\".\",t)}if(n.isCurrentContext)return r.read(this._context,[],t)}var s=r.reads(e);return\"*\"===s[0].key.charAt(0)?this.getRefs()._read(s,t,!0):this._read(s,t,a)},_read:function(e,t,n){for(var i,a,s,c,u,d=this,p=[],f=-1,h=l({foundObservable:function(t,n){a=t,s=e.slice(n)},earlyExit:function(t,n){(n>f||n===f&&\"object\"==typeof t&&e[n].key in t)&&(u=a,c=s,f=n)}},t),v=o.isRecording();d;){if(null!==(i=d._context)&&(\"object\"==typeof i||\"function\"==typeof i)){var m=o.trap(),g=r.read(i,e,h),y=m();if(void 0!==g.value)return!y.length&&v?(a=g.parent,s=e.slice(e.length-1)):o.addAll(y),{scope:d,rootObserve:a,value:g.value,reads:s};p.push.apply(p,y)}d=n?null:d._parent}return o.addAll(p),{setRoot:u,reads:c,value:void 0}},get:function(e,t){return t=l({isArgument:!0},t),this.read(e,t).value},peek:o.ignore(function(e,t){return this.get(e,t)}),peak:o.ignore(function(e,t){return p.warn(\"peak is deprecated, please use peek instead\"),this.peek(e,t)}),getScope:function(e){for(var t=this;t;){if(e(t))return t;t=t._parent}},getContext:function(e){var t=this.getScope(e);return t&&t._context},getRefs:function(){var e,t=this.getScope(function(t){return e=t,t._context instanceof i.Refs});return t||(e._parent=i.refsScope(),t=e._parent),t},getRoot:function(){for(var e=this,t=this;e._parent;)t=e,e=e._parent;return e._context instanceof i.Refs&&(e=t),e._context},set:function(e,t,n){n=n||{};var a=i.keyInfo(e);if(a.isCurrentContext)return f.setValue(this._context,t);if(a.isInParentContext||a.isParentContext){for(var o=this._parent;o._meta.notContext;)o=o._parent;return a.isParentContext?f.setValue(o._context,t):o.set(e.substr(3)||\".\",t,n)}var s,c,l=e.lastIndexOf(\".\"),u=e.lastIndexOf(\"/\");if(u>l?(s=e.substring(0,u),c=e.substring(u+1,e.length)):-1!==l?(s=e.substring(0,l),c=e.substring(l+1,e.length)):(s=\".\",c=e),\"*\"===e.charAt(0))r.write(this.getRefs()._context,e,t,n);else{var d=this.read(s,n).value;if(void 0===d)return void p.error(\"Attempting to set a value at \"+e+\" where \"+s+\" is undefined.\");r.write(d,c,t,n)}},attr:o.ignore(function(e,t,n){return h.warn(\"can-view-scope::attr is deprecated, please use peek, get or set\"),n=l({isArgument:!0},n),2===arguments.length?this.set(e,t,n):this.get(e,n)}),computeData:function(e,t){return c(this,e,t)},compute:function(e,t){return this.computeData(e,t).compute},cloneFromRef:function(){for(var e,t,n=[],a=this;a;){if((e=a._context)instanceof i.Refs){t=a._parent;break}n.unshift(e),a=a._parent}return t?(u(n,function(e){t=t.add(e)}),t):this}}),(a.prototype=new i).constructor=a,i.Options=a,d.view=d.view||{},n.exports=d.view.Scope=i}),define(\"can-simple-observable/log\",[\"require\",\"exports\",\"module\",\"can-log/dev/dev\",\"can-reflect\"],function(e,t,n){function i(e){return\"string\"==typeof e?JSON.stringify(e):e}var a=e(\"can-log/dev/dev\"),r=e(\"can-reflect\");n.exports=function(){this._log=function(e,t){a.log(r.getName(this),\"\\n is \",i(t),\"\\n was \",i(e))}}}),define(\"can-simple-observable\",[\"require\",\"exports\",\"module\",\"can-reflect\",\"can-observation-recorder\",\"can-namespace\",\"can-key-tree\",\"can-queues\",\"can-simple-observable/log\"],function(e,t,n){function i(e){this.handlers=new s([Object,Array]),this.value=e}var a=e(\"can-reflect\"),r=e(\"can-observation-recorder\"),o=e(\"can-namespace\"),s=e(\"can-key-tree\"),c=e(\"can-queues\");i.prototype={constructor:i,get:function(){return r.add(this),this.value},set:function(e){var t=this.value;this.value=e,c.enqueueByQueue(this.handlers.getNode([]),this,[e,t],null,[a.getName(this),\"changed to\",e,\"from\",t]),\"function\"==typeof this._log&&this._log(t,e)},on:function(e,t){this.handlers.add([t||\"mutate\",e])},off:function(e,t){this.handlers.delete([t||\"mutate\",e])},log:e(\"can-simple-observable/log\")},a.assignSymbols(i.prototype,{\"can.getValue\":i.prototype.get,\"can.setValue\":i.prototype.set,\"can.onValue\":i.prototype.on,\"can.offValue\":i.prototype.off,\"can.isMapLike\":!1,\"can.valueHasDependencies\":function(){return!0},\"can.getName\":function(){var e=this.value;return e=\"object\"!=typeof e||null===e?JSON.stringify(e):\"\",a.getName(this.constructor)+\"<\"+e+\">\"}}),n.exports=o.SimpleObservable=i}),define(\"can-simple-observable/settable/settable\",[\"require\",\"exports\",\"module\",\"can-reflect\",\"can-observation-recorder\",\"can-simple-observable\",\"can-observation\",\"can-key-tree\",\"can-queues\",\"can-simple-observable/log\"],function(e,t,n){function i(e,t,n){function i(){return e.call(t,this.lastSetValue.get())}this.handlers=new c([Object,Array],{onFirst:this.setup.bind(this),onEmpty:this.teardown.bind(this)}),this.lastSetValue=new o(n),this.handler=this.handler.bind(this),a.assignSymbols(this,{\"can.getName\":function(){return a.getName(this.constructor)+\"<\"+a.getName(e)+\">\"}}),Object.defineProperty(this.handler,\"name\",{value:a.getName(this)+\".handler\"}),Object.defineProperty(i,\"name\",{value:a.getName(e)+\"::\"+a.getName(this.constructor)}),this.observation=new s(i,this)}var a=e(\"can-reflect\"),r=e(\"can-observation-recorder\"),o=e(\"can-simple-observable\"),s=e(\"can-observation\"),c=e(\"can-key-tree\"),l=e(\"can-queues\"),u=e(\"can-simple-observable/log\"),d=r.ignore(a.getValue.bind(a));(i.prototype={handler:function(e){var t=this.value;this.value=e,\"function\"==typeof this._log&&this._log(t,e),l.enqueueByQueue(this.handlers.getNode([]),this,[e,t],function(){return{}})},setup:function(){this.bound=!0,a.onValue(this.observation,this.handler,\"notify\"),this.value=d(this.observation)},teardown:function(){this.bound=!1,a.offValue(this.observation,this.handler,\"notify\")},set:function(e){e!==this.lastSetValue.get()&&this.lastSetValue.set(e)},get:function(){return r.isRecording()&&(r.add(this),this.bound||s.temporarilyBind(this)),!0===this.bound?this.value:this.observation.get()},on:function(e,t){this.handlers.add([t||\"mutate\",e])},off:function(e,t){this.handlers.delete([t||\"mutate\",e])},hasDependencies:function(){return a.valueHasDependencies(this.observation)},getValueDependencies:function(){return a.getValueDependencies(this.observation)},log:u}).constructor=i,a.assignSymbols(i.prototype,{\"can.getValue\":i.prototype.get,\"can.setValue\":i.prototype.set,\"can.onValue\":i.prototype.on,\"can.offValue\":i.prototype.off,\"can.isMapLike\":!1,\"can.getPriority\":function(){return a.getPriority(this.observation)},\"can.setPriority\":function(e){a.setPriority(this.observation,e)},\"can.valueHasDependencies\":i.prototype.hasDependencies,\"can.getValueDependencies\":i.prototype.getValueDependencies}),n.exports=i}),define(\"can-stache/src/key-observable\",[\"require\",\"exports\",\"module\",\"can-simple-observable/settable/settable\",\"can-stache-key\"],function(e,t,n){function i(e,t){t=\"\"+t,this.key=t,this.root=e,a.call(this,function(){return r.get(this,t)},e)}var a=e(\"can-simple-observable/settable/settable\"),r=e(\"can-stache-key\");(i.prototype=Object.create(a.prototype)).set=function(e){r.set(this.root,this.key,e)},n.exports=i}),define(\"can-stache/src/utils\",[\"require\",\"exports\",\"module\",\"can-view-scope\",\"can-observation\",\"can-stache-key\",\"can-reflect\",\"can-stache/src/key-observable\",\"can-util/js/is-array-like/is-array-like\"],function(e,t,n){var i=e(\"can-view-scope\"),a=e(\"can-observation\"),r=e(\"can-stache-key\"),o=e(\"can-reflect\"),s=e(\"can-stache/src/key-observable\"),c=e(\"can-util/js/is-array-like/is-array-like\"),l=i.Options,u=function(){};n.exports={isArrayLike:c,emptyHandler:function(){},jsonParse:function(e){return\"'\"===e[0]?e.substr(1,e.length-2):\"undefined\"===e?void 0:JSON.parse(e)},mixins:{last:function(){return this.stack[this.stack.length-1]},add:function(e){this.last().add(e)},subSectionDepth:function(){return this.stack.length-1}},convertToScopes:function(e,t,n,i,a,r,o){e.fn=a?this.makeRendererConvertScopes(a,t,n,i,o):u,e.inverse=r?this.makeRendererConvertScopes(r,t,n,i,o):u,e.isSection=!(!a&&!r)},makeRendererConvertScopes:function(e,t,n,r,o){var s=function(n,i,a){return e(n||t,i,a)},c=function(e,a,o){return void 0===e||e instanceof i||(e=t?t.add(e):i.refsScope().add(e||{})),void 0===a||a instanceof l||(a=n.add(a)),s(e,a||n,o||r)};return o?c:a.ignore(c)},getItemsStringContent:function(e,t,n,i){for(var a=\"\",c=r.get(e,\"length\"),l=o.isObservableLike(e),u=0;u]*>\"),d=new RegExp(\"\\\\{\\\\{(![\\\\s\\\\S]*?!|[\\\\s\\\\S]*?)\\\\}\\\\}\\\\}?\",\"g\"),p=/\\s/,f=new RegExp(\"[A-Za-z0-9]\"),h=a(\"area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed\"),v=a(\"altGlyph,altGlyphDef,altGlyphItem,animateColor,animateMotion,animateTransform,clipPath,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,foreignObject,glyphRef,linearGradient,radialGradient,textPath\"),m=a(\"colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr\"),g=a(\"script\"),y=\"start,end,close,attrStart,attrEnd,attrValue,chars,comment,special,done\".split(\",\"),b={\"{\":\"}\",\"(\":\")\"},w=function(){},k=function(e,t,n){function a(e,n){var i;if(n)for(n=v[n]?n:n.toLowerCase(),i=V.length-1;i>=0&&V[i]!==n;i--);else i=0;if(void 0===e?V.length>0&&(t.filename?c.warn(t.filename+\": expected closing tag \"):c.warn(\"expected closing tag \")):(i<0||i!==V.length-1)&&(V.length>0?t.filename?c.warn(t.filename+\":\"+b+\": unexpected closing tag \"+e+\" expected \"):c.warn(b+\": unexpected closing tag \"+e+\" expected \"):t.filename?c.warn(t.filename+\":\"+b+\": unexpected closing tag \"+e):c.warn(b+\": unexpected closing tag \"+e)),i>=0){for(var a=V.length-1;a>=i;a--)t.close&&t.close(V[a],b);V.length=i}}if(\"object\"==typeof e)return r(e,t);var s=[];t=t||{},n&&i(y,function(e){var n=t[e]||w;t[e]=function(){if(!1!==n.apply(this,arguments)){var t=arguments.length;void 0===arguments[t-1]&&(t=arguments.length-1),t=arguments.length,s.push({tokenType:e,args:[].slice.call(arguments,0,t)})}}});var l,p,f,b,x=t.magicMatch||d,j=t.magicStart||\"{{\",E=function(){C&&(t.chars&&t.chars(C,b),b+=o(C)),C=\"\"},V=[],O=e,C=\"\";for(b=1,V.last=function(){return this[this.length-1]};e;){if(p=!0,V.last()&&g[V.last()])e=e.replace(new RegExp(\"([\\\\s\\\\S]*?)]*>\"),function(e,n){return n=n.replace(/|/g,\"$1$2\"),t.chars&&t.chars(n,b),b+=o(n),\"\"}),a(\"\",V.last());else{if(0===e.indexOf(\"\\x3c!--\"))(l=e.indexOf(\"--\\x3e\"))>=0&&(E(),t.comment&&t.comment(e.substring(4,l),b),b+=o(e.substring(0,l+3)),e=e.substring(l+3),p=!1);else if(0===e.indexOf(\"s.valueStart?t.attrValue(e.substring(s.valueStart,i),n):s.inName&&s.nameStart\");if(-1===t||!f.test(e[1]))return null;var n,i,a,r=\"\",o=\"\",s=e.substring(0,t+1),c=\"/\"===s[s.length-2],l=s.search(p);return c?(o=\"/\",i=s.substring(1,s.length-2).trim()):i=s.substring(1,s.length-1).trim(),-1===l?n=i:(l--,n=i.substring(0,l),r=i.substring(l)),a=[s,n,r,o],{match:a,html:e.substring(s.length)}},n.exports=s.HTMLParser=k}),define(\"can-util/js/set-immediate/set-immediate\",[\"require\",\"exports\",\"module\",\"can-globals/global/global\"],function(e,t,n){!function(e,t,n,i){\"use strict\";var e=t(\"can-globals/global/global\")();i.exports=e.setImmediate||function(e){return setTimeout(e,0)}}(function(){return this}(),e,0,n)}),define(\"can-util/dom/child-nodes/child-nodes\",function(e,t,n){\"use strict\";n.exports=function(e){var t=e.childNodes;if(\"length\"in t)return t;for(var n=e.firstChild,i=[];n;)i.push(n),n=n.nextSibling;return i}}),define(\"can-util/dom/contains/contains\",function(e,t,n){\"use strict\";n.exports=function(e){return this.contains(e)}}),define(\"can-util/dom/mutate/mutate\",[\"require\",\"exports\",\"module\",\"can-util/js/make-array/make-array\",\"can-util/js/set-immediate/set-immediate\",\"can-cid\",\"can-globals/mutation-observer/mutation-observer\",\"can-util/dom/child-nodes/child-nodes\",\"can-util/dom/contains/contains\",\"can-util/dom/dispatch/dispatch\",\"can-globals/document/document\",\"can-util/dom/data/data\"],function(e,t,n){!function(e,t,n,i){\"use strict\";var a,r=t(\"can-util/js/make-array/make-array\"),o=t(\"can-util/js/set-immediate/set-immediate\"),s=t(\"can-cid\"),c=t(\"can-globals/mutation-observer/mutation-observer\"),l=t(\"can-util/dom/child-nodes/child-nodes\"),u=t(\"can-util/dom/contains/contains\"),d=t(\"can-util/dom/dispatch/dispatch\"),p=t(\"can-globals/document/document\"),f=t(\"can-util/dom/data/data\"),h={inserted:function(e,t){return u.call(e,t)},removed:function(e,t){return!u.call(e,t)}},v=function(e,t,n,i,a){if(e.length)for(var o,c,l,u=0;void 0!==(l=e[u]);u++)if(c=s(l),l.getElementsByTagName&&n(t,l)&&!a[c]){a[c]=!0,o=r(l.getElementsByTagName(\"*\")),d.call(l,i,[],!1),\"removed\"===i&&f.delete.call(l);for(var p,h=0;void 0!==(p=o[h]);h++)a[c=s(p)]||(d.call(p,i,[],!1),\"removed\"===i&&f.delete.call(p),a[c]=!0)}},m=function(){var e=a;a=null;var t=e[0][1][0],n=p()||t.ownerDocument||t,i=n.contains?n:n.documentElement,r={inserted:{},removed:{}};e.forEach(function(e){v(e[1],i,h[e[0]],e[0],r[e[0]])})},g=function(e,t){if(!c()&&e.length){var n=e[0],i=p()||n.ownerDocument||n,r=i.contains?i:i.documentElement;h.inserted(r,n)&&(a||(a=[],o(m)),a.push([t,e]))}};i.exports={appendChild:function(e){if(c())this.appendChild(e);else{var t;t=11===e.nodeType?r(l(e)):[e],this.appendChild(e),g(t,\"inserted\")}},insertBefore:function(e,t,n){if(c())this.insertBefore(e,t);else{var i;i=11===e.nodeType?r(l(e)):[e],this.insertBefore(e,t),g(i,\"inserted\")}},removeChild:function(e){c()?this.removeChild(e):(g([e],\"removed\"),this.removeChild(e))},replaceChild:function(e,t){if(c())this.replaceChild(e,t);else{var n;n=11===e.nodeType?r(l(e)):[e],g([t],\"removed\"),this.replaceChild(e,t),g(n,\"inserted\")}},inserted:function(e){g(e,\"inserted\")},removed:function(e){g(e,\"removed\")}}}(0,e,0,n)}),define(\"can-cid/map/map\",[\"require\",\"exports\",\"module\",\"can-cid\",\"can-cid/helpers\"],function(e,t,n){\"use strict\";var i,a=e(\"can-cid\").get,r=e(\"can-cid/helpers\");\"undefined\"!=typeof Map?i=Map:((i=function(){this.values={}}).prototype.set=function(e,t){this.values[a(e)]={key:e,value:t}},i.prototype.delete=function(e){var t=a(e)in this.values;return t&&delete this.values[a(e)],t},i.prototype.forEach=function(e,t){r.each(this.values,function(n){return e.call(t||this,n.value,n.key,this)},this)},i.prototype.has=function(e){return a(e)in this.values},i.prototype.get=function(e){var t=this.values[a(e)];return t&&t.value},i.prototype.clear=function(){return this.values={}},Object.defineProperty(i.prototype,\"size\",{get:function(){var e=0;return r.each(this.values,function(){e++}),e}})),n.exports=i}),define(\"can-util/js/cid-map/cid-map\",[\"require\",\"exports\",\"module\",\"can-cid/map/map\"],function(e,t,n){!function(e,t,n,i){\"use strict\";i.exports=t(\"can-cid/map/map\")}(0,e,0,n)}),define(\"can-view-nodelist\",[\"require\",\"exports\",\"module\",\"can-util/js/make-array/make-array\",\"can-util/js/each/each\",\"can-namespace\",\"can-util/dom/mutate/mutate\",\"can-util/js/cid-map/cid-map\"],function(e,t,n){var i=e(\"can-util/js/make-array/make-array\"),a=e(\"can-util/js/each/each\"),r=e(\"can-namespace\"),o=e(\"can-util/dom/mutate/mutate\"),s=e(\"can-util/js/cid-map/cid-map\"),c=new s,l=[].splice,u=[].push,d=function(e){for(var t=0,n=0,i=e.length;n=0&&(n=i.value),1===e.length?o.replaceChild.call(i,t,e[0]):(h.after(e,t),h.remove(e)),void 0!==n&&(i.value=n)},remove:function(e){var t=e[0]&&e[0].parentNode;a(e,function(e){o.removeChild.call(t,e)})},nodeMap:c};n.exports=r.nodeLists=h}),define(\"can-util/dom/fragment/fragment\",[\"require\",\"exports\",\"module\",\"can-globals/document/document\",\"can-util/dom/child-nodes/child-nodes\"],function(e,t,n){!function(e,t,n,i){\"use strict\";var a=t(\"can-globals/document/document\"),r=t(\"can-util/dom/child-nodes/child-nodes\"),o=/^\\s*<(\\w+)[^>]*>/,s={}.toString,c=function(e,t,n){void 0===t&&(t=o.test(e)&&RegExp.$1),e&&\"[object Function]\"===s.call(e.replace)&&(e=e.replace(/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:]+)[^>]*)\\/>/gi,\"<$1>\"));var i=n.createElement(\"div\"),a=n.createElement(\"div\");\"tbody\"===t||\"tfoot\"===t||\"thead\"===t||\"colgroup\"===t?(a.innerHTML=\"\"+e+\"
    \",i=3===a.firstChild.nodeType?a.lastChild:a.firstChild):\"col\"===t?(a.innerHTML=\"\"+e+\"
    \",i=3===a.firstChild.nodeType?a.lastChild:a.firstChild.firstChild):\"tr\"===t?(a.innerHTML=\"\"+e+\"
    \",i=3===a.firstChild.nodeType?a.lastChild:a.firstChild.firstChild):\"td\"===t||\"th\"===t?(a.innerHTML=\"\"+e+\"
    \",i=3===a.firstChild.nodeType?a.lastChild:a.firstChild.firstChild.firstChild):\"option\"===t?(a.innerHTML=\"\",i=3===a.firstChild.nodeType?a.lastChild:a.firstChild):i.innerHTML=\"\"+e;var c={},l=r(i);c.length=l.length;for(var u=0;ue&&s>t;){if(!r(n[o],i[s]))return[{index:t,deleteCount:o-e+1,insert:a.call(i,t,s+1)}];o--,s--}return[{index:t,deleteCount:o-e+1,insert:a.call(i,t,s+1)}]}var a=[].slice,r=function(e,t){return e===t};n.exports=function(e,t,n){n=n||r;for(var o=0,s=0,c=e.length,l=t.length,u=[];o
    ',r=t[i]=n.childNodes[0].attributes[0]),(o=r.cloneNode()).value=a,e.setAttributeNode(o))}}return function(e,t,n){e.setAttribute(t,n)}}(),trigger:function(e,t,n){if(s.get.call(e,\"canHasAttributesBindings\"))return t=t.toLowerCase(),a(function(){u.call(e,{type:\"attributes\",attributeName:t,target:e,oldValue:n,bubbles:!1},[])})},get:function(e,t){t=t.toLowerCase();var n=D.special[t],i=n&&n.get,a=w(n);return\"function\"==typeof i&&a.call(e)?i.call(e):e.getAttribute(t)},remove:function(e,t){t=t.toLowerCase();var n;d()||(n=D.get(e,t));var i=D.special[t],a=i&&i.set,r=i&&i.remove,o=w(i);\"function\"==typeof r&&o.call(e)?r.call(e):\"function\"==typeof a&&o.call(e)?a.call(e,void 0):e.removeAttribute(t),d()||null==n||D.trigger(e,t,n)},has:function(){var e=r()&&document.createElement(\"div\");return e&&e.hasAttribute?function(e,t){return e.hasAttribute(t)}:function(e,t){return null!==e.getAttribute(t)}}()},S=l.addEventListener;l.addEventListener=function(e,t){var n=D.special[e];if(n&&n.addEventListener){var i=n.addEventListener.call(this,e,t,S),a=s.get.call(this,\"attrTeardowns\");return a||s.set.call(this,\"attrTeardowns\",a={}),a[e]||(a[e]=[]),void a[e].push({teardown:i,handler:t})}return S.apply(this,arguments)};var T=l.removeEventListener;l.removeEventListener=function(e,t){var n=D.special[e];{if(!n||!n.addEventListener)return T.apply(this,arguments);var i=s.get.call(this,\"attrTeardowns\");if(i&&i[e]){for(var a=i[e],r=0,o=a.length;r)` to debug this template\"),s.allowDebugger||a.warn(\"Forgotten {{debugger}} helper\"))},evaluateArgs:o,resolveValue:r,__testing:s}}),define(\"can-stache/src/truthy-observable\",[\"require\",\"exports\",\"module\",\"can-observation\",\"can-reflect\"],function(e,t,n){var i=e(\"can-observation\"),a=e(\"can-reflect\");n.exports=function(e){return new i(function(){return!!a.getValue(e)})}}),define(\"can-stache/helpers/core\",[\"require\",\"exports\",\"module\",\"can-view-live\",\"can-view-nodelist\",\"can-stache/src/utils\",\"can-util/js/is-function/is-function\",\"can-util/js/base-url/base-url\",\"can-util/js/join-uris/join-uris\",\"can-util/js/each/each\",\"can-util/js/assign/assign\",\"can-util/js/is-iterable/is-iterable\",\"can-util/js/dev/dev\",\"can-symbol\",\"can-reflect\",\"can-util/js/is-empty-object/is-empty-object\",\"can-stache/helpers/-debugger\",\"can-stache/src/key-observable\",\"can-observation\",\"can-stache/src/truthy-observable\",\"can-util/dom/data/data\"],function(e,t,n){var i=e(\"can-view-live\"),a=e(\"can-view-nodelist\"),r=e(\"can-stache/src/utils\"),o=e(\"can-util/js/is-function/is-function\"),s=e(\"can-util/js/base-url/base-url\"),c=e(\"can-util/js/join-uris/join-uris\"),l=e(\"can-util/js/each/each\"),u=e(\"can-util/js/assign/assign\"),d=e(\"can-util/js/is-iterable/is-iterable\"),p=e(\"can-util/js/dev/dev\"),f=e(\"can-symbol\"),h=e(\"can-reflect\"),v=e(\"can-util/js/is-empty-object/is-empty-object\"),m=e(\"can-stache/helpers/-debugger\").helper,g=e(\"can-stache/src/key-observable\"),y=e(\"can-observation\"),b=e(\"can-stache/src/truthy-observable\"),w=e(\"can-util/dom/data/data\"),k=function(e){return e&&\"function\"==typeof e.fn&&\"function\"==typeof e.inverse},x=f.for(\"can.getValue\"),j=f.for(\"can.isValueLike\"),L=function(e){return e&&e[j]&&e[x]?e[x]():e},E={each:function(e){var t,n,o,s,c=[].slice.call(arguments),u=c.pop(),f=c.length,m=u.exprData.argExprs,y=u.exprData.hashExprs,b=L(e);if((2===f||3===f&&\"as\"===m[1].key)&&(\"string\"!=typeof(t=c[f-1])&&(t=m[f-1].key),p.warn(\"can-stache: Using the `as` keyword is deprecated in favor of hash expressions. https://canjs.com/doc/can-stache.helpers.each.html\"),p.warn(\"can-stache: Do not use `{{#\"+u.nodeList.expression+\"}}`, instead use `{{#\"+u.nodeList.expression.split(\" \")[0]+\" \"+u.nodeList.expression.split(\" \")[1]+\" \"+t+\"=value}}`\")),v(y)||(n={},l(y,function(e,t){n[e.key]=t})),(h.isObservableLike(b)&&h.isListLike(b)||r.isArrayLike(b)&&e.isComputed)&&!u.stringOnly)return function(r){var o=[r];o.expression=\"live.list\",a.register(o,null,u.nodeList,!0),a.update(u.nodeList,[r]);i.list(r,e,function(e,i,a){var r={\"%index\":i};return t&&(r[t]=e),v(n)||(n.value&&(r[n.value]=e),n.index&&(r[n.index]=i)),u.fn(u.scope.add(r,{notContext:!0}).add(e),u.options,a)},u.context,r.parentNode,o,function(e,t){return u.inverse(u.scope.add(e),u.options,t)})};var w,k=b;if(k&&r.isArrayLike(k))return w=r.getItemsFragContent(k,u,u.scope,t),u.stringOnly?w.join(\"\"):w;if(d(k))return w=[],l(k,function(e,i){o={\"%key\":i},t&&(o[t]=e),v(n)||(n.value&&(o[n.value]=e),n.key&&(o[n.key]=i)),w.push(u.fn(u.scope.add(o,{notContext:!0}).add(e)))}),u.stringOnly?w.join(\"\"):w;if(h.isObservableLike(k)&&h.isMapLike(k))return w=[],h.each(k,function(e,n){var i=new g(k,n);o={\"%key\":n},t&&(o[t]=k[n]),w.push(u.fn(u.scope.add(o,{notContext:!0}).add(i)))}),u.stringOnly?w.join(\"\"):w;if(k instanceof Object){w=[];for(s in k)o={\"%key\":s},t&&(o[t]=k[s]),w.push(u.fn(u.scope.add(o,{notContext:!0}).add(k[s])));return u.stringOnly?w.join(\"\"):w}},\"%index\":function(e,t){t||(t=e,e=0);var n=t.scope.peek(\"%index\");return\"\"+((o(n)?n():n)+e)},if:function(e,t){return(e&&e.isComputed?h.getValue(new b(e)):!!L(e))?t.fn(t.scope||this):t.inverse(t.scope||this)},is:function(){var e,t,n=arguments[arguments.length-1];if(arguments.length-2<=0)return n.inverse();var i=arguments;return new y(function(){for(var n=0;n0&&t!==e)return!1;e=t}return!0}).get()?n.fn():n.inverse()},eq:function(){return E.is.apply(this,arguments)},unless:function(e,t){return E.if.apply(this,[e,u(u({},t),{fn:t.inverse,inverse:t.fn})])},with:function(e,t){var n=e;return t?(e=L(e),t.hash&&!v(t.hash)&&(n=t.scope.add(t.hash).add(n))):(t=e,e=!0,n=t.hash),t.fn(n||{})},log:function(e){var t=[];l(arguments,function(e){k(e)||t.push(e)}),\"undefined\"!=typeof console&&console.log&&(t.length?console.log.apply(console,t):console.log(e.context))},data:function(e){var t=2===arguments.length?this:arguments[1];return function(n){w.set.call(n,e,t||this.context)}},switch:function(e,t){L(e);var n=!1,i=t.helpers.add({case:function(t,i){if(!n&&L(e)===L(t))return n=!0,i.fn(i.scope||this)},default:function(e){if(!n)return e.fn(e.scope||this)}});return t.fn(t.scope,i)},joinBase:function(e){var t=[].slice.call(arguments),n=t.pop(),i=t.map(function(e){var t=L(e);return o(t)?t():t}).join(\"\"),a=n.helpers.peek(\"helpers.module\"),r=a?a.uri:void 0;if(\".\"===i[0]&&r)return c(r,i);var l=\"undefined\"!=typeof System&&(System.renderingBaseURL||System.baseURL)||s();return\"/\"!==i[0]&&\"/\"!==l[l.length-1]&&(l+=\"/\"),c(l,i)}};E.eachOf=E.each,E.debugger=m;var V=function(e,t){E[e]&&p.warn(\"The helper \"+e+\" has already been registered.\"),E[e]=t},O=function(e){return function(){var t=[];return l(arguments,function(e){for(;e&&e.isComputed;)e=e();t.push(e)}),e.apply(this,t)}};n.exports={registerHelper:V,registerSimpleHelper:function(e,t){V(e,O(t))},getHelper:function(e,t){var n=t&&t.get&&t.get(\"helpers.\"+e,{proxyMethods:!1});if(n||(n=E[e]),n)return{fn:n}},resolve:L,resolveHash:function(e){var t={};for(var n in e)t[n]=L(e[n]);return t},looksLikeOptions:k}}),define(\"can-util/js/last/last\",function(e,t,n){\"use strict\";n.exports=function(e){return e&&e[e.length-1]}}),define(\"can-simple-observable/setter/setter\",[\"require\",\"exports\",\"module\",\"can-reflect\",\"can-observation\",\"can-key-tree\",\"can-simple-observable/settable/settable\"],function(e,t,n){function i(e,t){this.handlers=new o([Object,Array],{onFirst:this.setup.bind(this),onEmpty:this.teardown.bind(this)}),this.setter=t,this.observation=new r(e),this.handler=this.handler.bind(this),a.assignSymbols(this,{\"can.getName\":function(){return a.getName(this.constructor)+\"<\"+a.getName(e)+\">\"}}),Object.defineProperty(this.handler,\"name\",{value:a.getName(this)+\".handler\"})}var a=e(\"can-reflect\"),r=e(\"can-observation\"),o=e(\"can-key-tree\"),s=e(\"can-simple-observable/settable/settable\");(i.prototype=Object.create(s.prototype)).constructor=i,i.prototype.set=function(e){this.setter(e)},i.prototype.hasDependencies=function(){return a.valueHasDependencies(this.observation)},a.assignSymbols(i.prototype,{\"can.setValue\":i.prototype.set,\"can.valueHasDependencies\":i.prototype.hasDependencies}),n.exports=i}),define(\"can-stache/src/expression\",[\"require\",\"exports\",\"module\",\"can-stache-key\",\"can-stache/src/utils\",\"can-stache/helpers/core\",\"can-util/js/each/each\",\"can-util/js/is-empty-object/is-empty-object\",\"can-util/js/dev/dev\",\"can-util/js/assign/assign\",\"can-util/js/last/last\",\"can-reflect\",\"can-symbol\",\"can-observation\",\"can-simple-observable/setter/setter\",\"can-view-scope/make-compute-like\"],function(e,t,n){var i=e(\"can-stache-key\"),a=e(\"can-stache/src/utils\"),r=e(\"can-stache/helpers/core\"),o=e(\"can-util/js/each/each\"),s=e(\"can-util/js/is-empty-object/is-empty-object\"),c=e(\"can-util/js/dev/dev\"),l=e(\"can-util/js/assign/assign\"),u=e(\"can-util/js/last/last\"),d=e(\"can-reflect\"),p=e(\"can-symbol\"),f=e(\"can-observation\"),h=e(\"can-simple-observable/setter/setter\"),v=e(\"can-view-scope/make-compute-like\"),m=p.for(\"can-stache.sourceText\"),g=function(e,t,n){var i=t.computeData(e,n);return f.temporarilyBind(i),i},y=function(e){return e[p.for(\"can.valueHasDependencies\")]?d.valueHasDependencies(e):e.computeInstance.hasDependencies},b=function(e,t,n,i){var a=g(e,t,i),o={value:a};if(void 0===a.initialValue){\"@\"===e.charAt(0)&&(e=e.substr(1));var s=r.getHelper(e,n);o.helper=s&&s.fn}return o},w=function(e,t,n,a){var r=function(){return(\"\"+d.getValue(e)).replace(\".\",\"\\\\.\")},o=new h(function(){return i.get(d.getValue(t),r())},function(e){i.write(d.getValue(t),i.reads(r()),e)});return f.temporarilyBind(o),o},k=function(e){return e instanceof C||e instanceof E?e:new C(e)},x=function(e){return d.isObservableLike(e)?!1===d.valueHasDependencies(e)?d.getValue(e):e.compute?e.compute:v(e):e},j=function(e){return e?e.isComputed?e:e.compute?e.compute:v(e):e},L=function(e,t){this.root=t,this.key=e};L.prototype.value=function(e,t){var n=this.root?this.root.value(e,t):e.peek(\".\");return w(this.key.value(e,t),n,0,0)},L.prototype.sourceText=function(){return this.rootExpr?this.rootExpr.sourceText()+\"[\"+this.key+\"]\":\"[\"+this.key+\"]\"};var E=function(e){this._value=e};E.prototype.value=function(){return this._value},E.prototype.sourceText=function(){return JSON.stringify(this._value)};var V=function(e,t,n){this.key=e,this.rootExpr=t,d.setKeyValue(this,m,n)};V.prototype.value=function(e,t){if(this.rootExpr)return w(this.key,this.rootExpr.value(e,t),0,0);var n=b(this.key,e,t);return this.isHelper=n.helper&&!n.helper.callAsMethod,n.helper||n.value},V.prototype.sourceText=function(){return this[m]?this[m]:this.rootExpr?this.rootExpr.sourceText()+\".\"+this.key:this.key};var O=function(e,t){V.apply(this,arguments)};O.prototype.value=function(e,t){return this.rootExpr?w(this.key,this.rootExpr.value(e,t),0,0):g(this.key,e,t)},O.prototype.sourceText=V.prototype.sourceText;var C=function(e,t){this.expr=e,this.modifiers=t||{},this.isCompute=!1};C.prototype.value=function(){return this.expr.value.apply(this.expr,arguments)},C.prototype.sourceText=function(){return(this.modifiers.compute?\"~\":\"\")+this.expr.sourceText()};var _=function(e){this.hashExprs=e};_.prototype.value=function(e,t){var n={};for(var i in this.hashExprs){var a=k(this.hashExprs[i]),r=a.value.apply(a,arguments);n[i]={call:!a.modifiers||!a.modifiers.compute,value:r}}return new f(function(){var e={};for(var t in n)e[t]=n[t].call?d.getValue(n[t].value):x(n[t].value);return e})},_.prototype.sourceText=function(){var e=[];return o(this.hashExprs,function(t,n){e.push(n+\"=\"+t.sourceText())}),e.join(\" \")};var D=function(e,t){this.methodExpr=e,this.argExprs=t.map(k)};D.prototype.args=function(e,t){for(var n=[],i=0,a=this.argExprs.length;i0&&-1===e.indexOf(this.stack[t].type);)t--;return this.stack[t]},firstParent:function(e){for(var t=this.stack.length-2;t>0&&-1===e.indexOf(this.stack[t].type);)t--;return this.stack[t]},popUntil:function(e){for(;-1===e.indexOf(this.top().type)&&!this.isRootTop();)this.stack.pop();return this.top()},addTo:function(e,t){var n=this.popUntil(e);H(n).children.push(t)},addToAndPush:function(e,t){this.addTo(e,t),this.stack.push(t)},push:function(e){this.stack.push(e)},topLastChild:function(){return u(this.top().children)},replaceTopLastChild:function(e){var t=H(this.top()).children;return t.pop(),t.push(e),e},replaceTopLastChildAndPush:function(e){this.replaceTopLastChild(e),this.stack.push(e)},replaceTopAndPush:function(e){var t;return this.top()===this.root?t=H(this.top()).children:(this.stack.pop(),t=H(this.top()).children),t.pop(),t.push(e),this.stack.push(e),e}});var F=function(e){var t=e.lastIndexOf(\"./\"),n=e.lastIndexOf(\".\");if(n>t)return e.substr(0,n)+\"@\"+e.substr(n+1);var i=-1===t?0:t+2,a=e.charAt(i);return\".\"===a||\"@\"===a?e.substr(0,i)+\"@\"+e.substr(i+1):e.substr(0,i)+\"@\"+e.substr(i)},z=function(e){return\"Lookup\"===e.type&&(d.setKeyValue(e,m,e.key),e.key=F(e.key)),e},U=function(e){var t=e.top();if(t&&\"Lookup\"===t.type){var n=e.stack[e.stack.length-2];\"Helper\"!==n.type&&n&&e.replaceTopAndPush({type:\"Helper\",method:t})}},W={toComputeOrValue:x,convertKeyToLookup:F,Literal:E,Lookup:V,ScopeLookup:O,Arg:C,Hash:function(){},Hashes:_,Call:D,Helper:N,HelperLookup:S,HelperScopeLookup:T,Bracket:L,SetIdentifier:function(e){this.value=e},tokenize:function(e){var t=[];return(e.trim()+\" \").replace(M,function(e,n){A.test(n)?(t.push(n[0]),t.push(n.slice(1))):t.push(n)}),t},lookupRules:{default:function(e,t,n){var i=(\"Helper\"!==t||e.root?\"\":\"Helper\")+(n?\"Scope\":\"\")+\"Lookup\";return W[i]},method:function(e,t,n){return O}},methodRules:{default:function(e){return\"Call\"===e.type?D:N},call:function(e){return D}},parse:function(e,t){t=t||{};var n=this.ast(e);return t.lookupRule||(t.lookupRule=\"default\"),\"string\"==typeof t.lookupRule&&(t.lookupRule=W.lookupRules[t.lookupRule]),t.methodRule||(t.methodRule=\"default\"),\"string\"==typeof t.methodRule&&(t.methodRule=W.methodRules[t.methodRule]),this.hydrateAst(n,t,t.baseMethodType||\"Helper\")},hydrateAst:function(e,t,n,i){var a;if(\"Lookup\"===e.type)return new(t.lookupRule(e,n,i))(e.key,e.root&&this.hydrateAst(e.root,t,n),e[m]);if(\"Literal\"===e.type)return new E(e.value);if(\"Arg\"===e.type)return new C(this.hydrateAst(e.children[0],t,n,i),{compute:!0});if(\"Hash\"===e.type)throw new Error(\"\");if(\"Hashes\"===e.type)return a={},o(e.children,function(e){a[e.prop]=this.hydrateAst(e.children[0],t,n,!0)},this),new _(a);if(\"Call\"===e.type||\"Helper\"===e.type){a={};var r=[],s=e.children,c=t.methodRule(e);if(s)for(var l=0;l0?o.addTo([\"Helper\",\"Call\",\"Bracket\"],{type:\"Literal\",value:a.jsonParse(s)}):\"Bracket\"===i.type&&i.children&&i.children.length>0?o.addTo([\"Helper\",\"Call\",\"Hash\"],{type:\"Literal\",value:a.jsonParse(s)}):o.addTo([\"Helper\",\"Call\",\"Hash\",\"Bracket\"],{type:\"Literal\",value:a.jsonParse(s)});else if(P.test(s))r=o.topLastChild(),i=o.first([\"Helper\",\"Call\",\"Hash\",\"Bracket\"]),r&&(\"Call\"===r.type||\"Bracket\"===r.type)&&I(s)?o.replaceTopLastChildAndPush({type:\"Lookup\",root:r,key:s.slice(1)}):\"Bracket\"===i.type?i.children&&i.children.length>0?\"Helper\"===o.first([\"Helper\",\"Call\",\"Hash\",\"Arg\"]).type&&\".\"!==s[0]?o.addToAndPush([\"Helper\"],{type:\"Lookup\",key:s}):o.replaceTopAndPush({type:\"Lookup\",key:s.slice(1),root:i}):o.addToAndPush([\"Bracket\"],{type:\"Lookup\",key:s}):(U(o),o.addToAndPush([\"Helper\",\"Call\",\"Hash\",\"Arg\",\"Bracket\"],{type:\"Lookup\",key:s}));else if(\"~\"===s)U(o),o.addToAndPush([\"Helper\",\"Call\",\"Hash\"],{type:\"Arg\",key:s});else if(\"(\"===s){if(\"Lookup\"!==(n=o.top()).type)throw new Error(\"Unable to understand expression \"+e.join(\"\"));o.replaceTopAndPush({type:\"Call\",method:z(n)})}else\")\"===s?o.popTo([\"Call\"]):\",\"===s?o.popUntil([\"Call\"]):\"[\"===s?(n=o.top(),!(r=o.topLastChild())||\"Call\"!==r.type&&\"Bracket\"!==r.type?\"Lookup\"===n.type||\"Bracket\"===n.type?o.replaceTopAndPush({type:\"Bracket\",root:n}):\"Call\"===n.type?o.addToAndPush([\"Call\"],{type:\"Bracket\"}):\" \"===n?(o.popUntil([\"Lookup\"]),U(o),o.addToAndPush([\"Helper\",\"Call\",\"Hash\"],{type:\"Bracket\"})):o.replaceTopAndPush({type:\"Bracket\"}):o.replaceTopAndPush({type:\"Bracket\",root:r})):\"]\"===s?o.pop():\" \"===s&&o.push(s)}return o.root.children[0]}};n.exports=W}),define(\"can-util/dom/document/document\",[\"require\",\"exports\",\"module\",\"can-globals/document/document\"],function(e,t,n){!function(e,t,n,i){\"use strict\";i.exports=t(\"can-globals/document/document\")}(0,e,0,n)}),define(\"can-view-model\",[\"require\",\"exports\",\"module\",\"can-util/dom/data/data\",\"can-simple-map\",\"can-namespace\",\"can-util/dom/document/document\",\"can-util/js/is-array-like/is-array-like\",\"can-reflect\"],function(e,t,n){\"use strict\";var i=e(\"can-util/dom/data/data\"),a=e(\"can-simple-map\"),r=e(\"can-namespace\"),o=e(\"can-util/dom/document/document\"),s=e(\"can-util/js/is-array-like/is-array-like\"),c=e(\"can-reflect\");n.exports=r.viewModel=function(e,t,n){var r;if(\"string\"==typeof e?e=o().querySelector(e):s(e)&&!e.nodeType&&(e=e[0]),c.isObservableLike(t)&&c.isMapLike(t))return i.set.call(e,\"viewModel\",t);switch((r=i.get.call(e,\"viewModel\"))||(r=new a,i.set.call(e,\"viewModel\",r)),arguments.length){case 0:case 1:return r;case 2:return c.getKeyValue(r,t);default:return c.setKeyValue(r,t,n),e}}}),define(\"can-dom-events/helpers/util\",[\"require\",\"exports\",\"module\",\"can-globals/document/document\",\"can-globals/is-browser-window/is-browser-window\"],function(e,t,n){!function(e,t,n,i){\"use strict\";function a(e){return e.ownerDocument||s()}function r(e){if(!e||!e.nodeName)return e===window;var t=e.nodeType;return t===Node.DOCUMENT_NODE||t===Node.ELEMENT_NODE}function o(e,t){var n=t.type,i=\"inserted\"===n||\"removed\"===n,a=!!e.disabled;return i&&a}var s=t(\"can-globals/document/document\"),c=t(\"can-globals/is-browser-window/is-browser-window\"),l=!1;!function(){if(c()){var e=\"fix_synthetic_events_on_disabled_test\",t=document.createElement(\"input\");t.disabled=!0;var n=setTimeout(function(){l=!0},50),i=function i(){clearTimeout(n),t.removeEventListener(e,i)};t.addEventListener(e,i);try{var a=document.create(\"HTMLEvents\");a.initEvent(e,!1),t.dispatchEvent(a)}catch(e){i(),l=!0}}}(),i.exports={createEvent:function(e,t,n,i){var r,o=a(e).createEvent(\"HTMLEvents\");if(\"string\"==typeof t)r=t;else{r=t.type;for(var s in t)void 0===o[s]&&(o[s]=t[s])}return void 0===n&&(n=!0),o.initEvent(r,n,i),o},addDomContext:function(e,t){return r(e)&&(t=Array.prototype.slice.call(t,0)).unshift(e),t},removeDomContext:function(e,t){return r(e)||(e=(t=Array.prototype.slice.call(t,0)).shift()),{context:e,args:t}},isDomEventTarget:r,getTargetDocument:a,forceEnabledForDispatch:function(e,t){return l&&o(e,t)}}}(0,e,0,n)}),define(\"can-dom-events/helpers/add-event-compat\",[\"require\",\"exports\",\"module\",\"can-dom-events/helpers/util\"],function(e,t,n){\"use strict\";function i(e){return!!(e&&e.addEventListener&&e.removeEventListener&&e.dispatch)}function a(e){return\"function\"==typeof e.addEvent}var r=e(\"can-dom-events/helpers/util\"),o=r.addDomContext,s=r.removeDomContext;n.exports=function(e,t,n){if(!i(e))throw new Error(\"addEventCompat() must be passed can-dom-events or can-util/dom/events/events\");if(n=n||t.defaultEventType,a(e))return e.addEvent(t,n);var r=e._compatRegistry;if(r||(r=e._compatRegistry={}),r[n])return function(){};r[n]=t;var c={addEventListener:function(){var t=s(this,arguments);return e.addEventListener.apply(t.context,t.args)},removeEventListener:function(){var t=s(this,arguments);return e.removeEventListener.apply(t.context,t.args)},dispatch:function(){var t=s(this,arguments),n=t.args[0],i=\"object\"==typeof n?n.args:[];return t.args.splice(1,0,i),e.dispatch.apply(t.context,t.args)}},l=!0,u=e.addEventListener,d=e.addEventListener=function(e){if(l&&e===n){var i=o(this,arguments);t.addEventListener.apply(c,i)}return u.apply(this,arguments)},p=e.removeEventListener,f=e.removeEventListener=function(e){if(l&&e===n){var i=o(this,arguments);t.removeEventListener.apply(c,i)}return p.apply(this,arguments)};return function(){l=!1,r[n]=null,e.addEventListener===d&&(e.addEventListener=u),e.removeEventListener===f&&(e.removeEventListener=p)}}}),define(\"can-event-dom-enter\",[\"require\",\"exports\",\"module\",\"can-dom-data-state\",\"can-cid\"],function(e,t,n){\"use strict\";function i(e){var t=\"Enter\"===e.key,n=13===e.keyCode;return t||n}function a(e,t){return e+\":\"+c(t)}function r(e,t,n,i){var r=a(t,n);s.set.call(e,r,i)}function o(e,t,n){var i=a(t,n),r=s.get.call(e,i);return r&&s.clean.call(e,i),r}var s=e(\"can-dom-data-state\"),c=e(\"can-cid\");n.exports={defaultEventType:\"enter\",addEventListener:function(e,t,n){var a=function(e){if(i(e))return n.apply(this,arguments)};r(e,t,n,a),this.addEventListener(e,\"keyup\",a)},removeEventListener:function(e,t,n){var i=o(e,t,n);i&&this.removeEventListener(e,\"keyup\",i)}}}),define(\"can-event-dom-enter/compat\",[\"require\",\"exports\",\"module\",\"can-dom-events/helpers/add-event-compat\",\"can-event-dom-enter\"],function(e,t,n){var i=e(\"can-dom-events/helpers/add-event-compat\"),a=e(\"can-event-dom-enter\");n.exports=function(e,t){return i(e,a,t)}}),define(\"can-dom-events/helpers/make-event-registry\",function(e,t,n){\"use strict\";function i(){this._registry={}}n.exports=function(){return new i},i.prototype.has=function(e){return!!this._registry[e]},i.prototype.get=function(e){return this._registry[e]},i.prototype.add=function(e,t){if(!e)throw new Error(\"An EventDefinition must be provided\");if(\"function\"!=typeof e.addEventListener)throw new TypeError(\"EventDefinition addEventListener must be a function\");if(\"function\"!=typeof e.removeEventListener)throw new TypeError(\"EventDefinition removeEventListener must be a function\");if(\"string\"!=typeof(t=t||e.defaultEventType))throw new TypeError(\"Event type must be a string, not \"+t);if(this.has(t))throw new Error('Event \"'+t+'\" is already registered');this._registry[t]=e;var n=this;return function(){n._registry[t]=void 0}}}),define(\"can-dom-events\",[\"require\",\"exports\",\"module\",\"can-namespace\",\"can-dom-events/helpers/util\",\"can-dom-events/helpers/make-event-registry\"],function(e,t,n){!function(e,t,n,i){\"use strict\";var a=t(\"can-namespace\"),r=t(\"can-dom-events/helpers/util\"),o={_eventRegistry:t(\"can-dom-events/helpers/make-event-registry\")(),addEvent:function(e,t){return this._eventRegistry.add(e,t)},addEventListener:function(e,t){if(o._eventRegistry.has(t))return o._eventRegistry.get(t).addEventListener.apply(o,arguments);var n=Array.prototype.slice.call(arguments,1);return e.addEventListener.apply(e,n)},removeEventListener:function(e,t){if(o._eventRegistry.has(t))return o._eventRegistry.get(t).removeEventListener.apply(o,arguments);var n=Array.prototype.slice.call(arguments,1);return e.removeEventListener.apply(e,n)},dispatch:function(e,t,n,i){var a=r.createEvent(e,t,n,i),o=r.forceEnabledForDispatch(e,a);o&&(e.disabled=!1);var s=e.dispatchEvent(a);return o&&(e.disabled=!0),s}};i.exports=a.domEvents=o}(0,e,0,n)}),define(\"can-event-dom-radiochange\",[\"require\",\"exports\",\"module\",\"can-dom-data-state\",\"can-globals/document/document\",\"can-dom-events\",\"can-cid/map/map\"],function(e,t,n){!function(e,t,n,i){\"use strict\";function a(e){return e.ownerDocument||g().documentElement}function r(e){return\"can-event-radiochange:\"+e+\":registry\"}function o(e){return\"can-event-radiochange:\"+e+\":listener\"}function s(e,t){var n=r(t),i=m.get.call(e,n);return i||(i=new b,m.set.call(e,n,i)),i}function c(e){for(;e&&\"FORM\"!==e.nodeName;)e=e.parentNode;return e}function l(e,t){var n=e.getAttribute(\"name\");return n&&n===t.getAttribute(\"name\")&&c(e)===c(t)}function u(e){return\"INPUT\"===e.nodeName&&\"radio\"===e.type}function d(e,t){s(a(t),e).forEach(function(n){l(t,n)&&y.dispatch(n,e)})}function p(e,t,n){var i=o(t);if(!m.get.call(e,i)){var a=function(e){var n=e.target;u(n)&&d(t,n)};n.addEventListener(e,\"change\",a),m.set.call(e,i,a)}}function f(e,t,n){var i=o(t),a=m.get.call(e,i);a&&(s(e,t).size>0||(n.removeEventListener(e,\"change\",a),m.clean.call(e,i)))}function h(e,t,n){if(!u(t))throw new Error(\"Listeners for \"+e+\" must be radio inputs\");var i=a(t);s(i,e).set(t,t),p(i,e,n)}function v(e,t,n){var i=a(t);s(i,e).delete(t),f(i,e,n)}var m=t(\"can-dom-data-state\"),g=t(\"can-globals/document/document\"),y=t(\"can-dom-events\"),b=t(\"can-cid/map/map\");i.exports={defaultEventType:\"radiochange\",addEventListener:function(e,t,n){h(t,e,this),e.addEventListener(t,n)},removeEventListener:function(e,t,n){v(t,e,this),e.removeEventListener(t,n)}}}(0,e,0,n)}),define(\"can-event-dom-radiochange/compat\",[\"require\",\"exports\",\"module\",\"can-dom-events/helpers/add-event-compat\",\"can-event-dom-radiochange\"],function(e,t,n){var i=e(\"can-dom-events/helpers/add-event-compat\"),a=e(\"can-event-dom-radiochange\");n.exports=function(e,t){return i(e,a,t)}}),define(\"can-stache-bindings\",[\"require\",\"exports\",\"module\",\"can-stache/src/expression\",\"can-view-callbacks\",\"can-view-scope\",\"can-view-model\",\"can-stache-key\",\"can-observation\",\"can-simple-observable\",\"can-util/js/assign/assign\",\"can-util/js/make-array/make-array\",\"can-util/js/each/each\",\"can-util/js/dev/dev\",\"can-util/dom/events/events\",\"can-util/dom/events/removed/removed\",\"can-util/dom/data/data\",\"can-util/dom/attr/attr\",\"can-stache/helpers/core\",\"can-symbol\",\"can-reflect\",\"can-util/js/single-reference/single-reference\",\"can-attribute-encoder\",\"can-queues\",\"can-simple-observable/setter/setter\",\"can-view-scope/make-compute-like\",\"can-event-dom-enter/compat\",\"can-event-dom-radiochange/compat\"],function(e,t,n){function i(e){if(void 0!==e.special.on)return e.tokens[e.special.on+1]}function a(e){var t={tokens:[],special:{}};return e.split(\":\").forEach(function(e){H[e]?t.special[e]=t.tokens.push(e)-1:t.tokens.push(e)}),t}var r=e(\"can-stache/src/expression\"),o=e(\"can-view-callbacks\"),s=e(\"can-view-scope\"),c=e(\"can-view-model\"),l=e(\"can-stache-key\"),u=e(\"can-observation\"),d=e(\"can-simple-observable\"),p=e(\"can-util/js/assign/assign\"),f=e(\"can-util/js/make-array/make-array\"),h=e(\"can-util/js/each/each\"),v=e(\"can-util/js/dev/dev\"),m=e(\"can-util/dom/events/events\");e(\"can-util/dom/events/removed/removed\");var g=e(\"can-util/dom/data/data\"),y=e(\"can-util/dom/attr/attr\"),b=e(\"can-stache/helpers/core\"),w=e(\"can-symbol\"),k=e(\"can-reflect\"),x=e(\"can-util/js/single-reference/single-reference\"),j=e(\"can-attribute-encoder\"),L=e(\"can-queues\"),E=e(\"can-simple-observable/setter/setter\"),V=e(\"can-view-scope/make-compute-like\");e(\"can-event-dom-enter/compat\")(m),e(\"can-event-dom-radiochange/compat\")(m);var O={on:function(e,t,n){m.canAddEventListener.call(this)?m.addEventListener.call(this,e,t,n):k.onKeyValue(this,e,t,n)},off:function(e,t,n){m.canAddEventListener.call(this)?m.removeEventListener.call(this,e,t,n):k.offKeyValue(this,e,t,n)},one:function(e,t,n){var i=function(){return O.off.call(this,e,i,n),t.apply(this,arguments)};return O.on.call(this,e,i,n),this}},C=function(){},_=w.for(\"can.getValue\"),D=w.for(\"can.setValue\"),S=w.for(\"can.onValue\"),T=w.for(\"can.offValue\"),N=function(){throw new Error(\"can-stache-bindings - you can not have contextual bindings ( this:from='value' ) and key bindings ( prop:from='value' ) on one element.\")},P=function(e,t){var n=t.bindingInfo.parentToChild&&\"viewModel\"===t.bindingInfo.child;if(!n)return e;var i=t.bindingInfo.childName;if(n&&(\"this\"===i||\".\"===i)){if(!e.isSettingViewModel&&!e.isSettingOnViewModel)return{isSettingViewModel:!0,initialViewModelData:void 0};N()}else{if(!e.isSettingViewModel)return{isSettingOnViewModel:!0,initialViewModelData:e.initialViewModelData};N()}},M={viewModel:function(e,t,n,i,a){var r,o={},s=[],c={},l={},u=p({},i),d={isSettingOnViewModel:!1,isSettingViewModel:!1,initialViewModelData:i||{}},v=!1;if(h(f(e.attributes),function(n){var i=z(n,e,{templateType:t.templateType,scope:t.scope,semaphore:o,getViewModel:function(){return r},attributeViewModelBindings:u,alreadyUpdatedChild:!0,nodeList:t.parentNodeList,favorViewModel:!0});i&&(d=P(d,i),v=!0,i.onCompleteBinding&&(i.bindingInfo.parentToChild&&void 0!==i.value&&(d.isSettingViewModel?d.initialViewModelData=i.value:d.initialViewModelData[Q(i.bindingInfo.childName)]=i.value),s.push(i.onCompleteBinding)),c[n.name]=i.onTeardown)}),!a||v){r=n(d.initialViewModelData,v);for(var g=0,y=s.length;g=0&&(i=s.get(n.substr(u+\":by:\".length)),n=n.substr(0,u))}var d=function(n){var i=e.getAttribute(j.encode(a));if(i){var o=c(e),s=r.parse(i,{lookupRule:function(){return r.Lookup},methodRule:\"call\"});if(!(s instanceof r.Call))throw new Error(\"can-stache-bindings: Event bindings must be a call expression. Make sure you have a () in \"+t.attributeName+\"=\"+JSON.stringify(i));var u,d,p,f=t.scope.add({\"%element\":this,\"%event\":n,\"%viewModel\":o,\"%scope\":t.scope,\"%context\":t.scope._context,\"%arguments\":arguments},{notContext:!0}),h=f.read(s.methodExpr.key,{isArgument:!0});if(!h.value){var m=l.reads(s.methodExpr.key).map(function(e){return e.key}).join(\".\");return(d=b.getHelper(m))?(u=s.args(f,null)(),\"function\"==typeof(p=d.fn.apply(f.peek(\".\"),u))&&p(e),p):(v.warn(\"can-stache-bindings: \"+a+\" couldn't find method named \"+s.methodExpr.key,{element:e,scope:t.scope}),null)}u=s.args(f,null)(),L.batch.start(),L.notifyQueue.enqueue(h.value,h.parent,u,{reasonLog:[e,n,a+\"=\"+i]}),L.batch.stop()}},p=function(e){var t=e.attributeName===a,n=!this.getAttribute(a);t&&n&&h()},f=function(e){h()},h=function(){O.off.call(i,n,d),O.off.call(e,\"attributes\",p),O.off.call(e,\"removed\",f)};O.on.call(i,n,d),O.on.call(e,\"attributes\",p),O.on.call(e,\"removed\",f)}};o.attr(/[\\w\\.:]+:to$/,M.data),o.attr(/[\\w\\.:]+:from$/,M.data),o.attr(/[\\w\\.:]+:bind$/,M.data),o.attr(/[\\w\\.:]+:to:on:[\\w\\.:]+/,M.data),o.attr(/[\\w\\.:]+:from:on:[\\w\\.:]+/,M.data),o.attr(/[\\w\\.:]+:bind:on:[\\w\\.:]+/,M.data),o.attr(/on:[\\w\\.:]+/,M.event);var A={viewModelOrAttribute:function(e,t,n,i,a,r,o){return g.get.call(e,\"viewModel\")?this.viewModel.apply(this,arguments):this.attribute.apply(this,arguments)},scope:function(e,t,n,i,a,o){if(n){if(a)return r.parse(n,{baseMethodType:\"Call\"}).value(t,new s.Options({}));var c=new u(function(){});return c[D]=function(e){t.set(Q(n),e)},c}return new d},viewModel:function(e,t,n,i,a,r,o){function s(){var e=i.getViewModel();return l.read(e,p,{}).value}var c=Q(n),u=\".\"===n||\"this\"===n,p=u?[]:l.reads(n);return Object.defineProperty(s,\"name\",{value:\"viewModel.\"+n}),new E(s,function(e){var t=i.getViewModel();if(r){var n=k.getKeyValue(t,c);k.isObservableLike(n)?k.setValue(n,e):k.setKeyValue(t,c,new d(k.getValue(r)))}else u?k.setValue(t,e):k.setKeyValue(t,c,e)})},attribute:function(e,t,n,i,a,r,o){if(!o){o=\"change\";var s=\"INPUT\"===e.nodeName&&\"radio\"===e.type,c=\"checked\"===n&&!i.legacyBindings;s&&c&&(o=\"radiochange\"),y.special[n]&&y.special[n].addEventListener&&(o=n)}var l=\"select\"===e.nodeName.toLowerCase(),d=function(){return y.get(e,n)};\"value\"===n&&l&&e.multiple&&(n=\"values\");var p=new u(d);return p[D]=function(t){return i.legacyBindings&&l&&\"selectedIndex\"in e&&\"value\"===n?y.setAttrOrProp(e,n,null==t?\"\":t):y.setAttrOrProp(e,n,t),t},p[_]=d,p[S]=function(t){var n=function(){t(d())};x.set(t,this,n),\"radiochange\"===o&&O.on.call(e,\"change\",n),O.on.call(e,o,n)},p[T]=function(t){var n=x.getAndDelete(t,this);\"radiochange\"===o&&O.off.call(e,\"change\",n),O.off.call(e,o,n)},p}},q={childToParent:function(e,t,n,i,a,r,o){function s(o){if(!i[a])if(t&&t[_]){var s=k.valueHasDependencies(t);s&&k.getValue(t)===o||k.setValue(t,o),r&&s&&k.getValue(t)!==k.getValue(n)&&(i[a]=(i[a]||0)+1,L.batch.start(),k.setValue(n,k.getValue(t)),L.mutateQueue.enqueue(function(){--i[a]},null,[],{}),L.batch.stop())}else if(k.isMapLike(t)){var c=e.getAttribute(a);v.warn(\"can-stache-bindings: Merging \"+a+\" into \"+c+\" because its parent is non-observable\"),k.eachKey(t,function(e){k.deleteKeyValue(t,e)}),k.setValue(t,o&&o.serialize?o.serialize():o,!0)}}return Object.defineProperty(s,\"name\",{value:\"update \"+o.parent+\".\"+o.parentName+\" of <\"+e.nodeName.toLowerCase()+\">\"}),n&&n[_]&&k.onValue(n,s,\"mutate\"),s},parentToChild:function(e,t,n,i,a,r){var o=function(e){i[a]=(i[a]||0)+1,L.batch.start(),k.setValue(n,e),L.mutateQueue.enqueue(function(){--i[a]},null,[],{}),L.batch.stop()};return Object.defineProperty(o,\"name\",{value:\"update \"+r.child+\".\"+r.childName+\" of <\"+e.nodeName.toLowerCase()+\">\"}),t&&t[_]&&k.onValue(t,o,\"mutate\"),o}},K=String.prototype.startsWith||function(e){return 0===this.indexOf(e)},R={to:{childToParent:!0,parentToChild:!1,syncChildWithParent:!1},from:{childToParent:!1,parentToChild:!0,syncChildWithParent:!1},bind:{childToParent:!0,parentToChild:!0,syncChildWithParent:!0}},I=[],H={vm:!0,on:!0};h(R,function(e,t){I.push(t),H[t]=!0});var B=function(e,t){return e.indexOf(\"vm\")>=0?\"viewModel\":e.indexOf(\"el\")>=0?\"attribute\":t?\"viewModel\":\"viewModelOrAttribute\"},F=function(e,t,n,r,o){var s,c,l,u=j.decode(e.name),d=e.value||\"\",f=a(u);if(I.forEach(function(e){if(void 0!==f.special[e]&&f.special[e]>0)return c=e,l=f.special[e],!1}),c){var h=i(f),v=!h;return s=p({parent:\"scope\",child:B(f.tokens,o),childName:f.tokens[l-1],childEvent:h,bindingAttributeName:u,parentName:d,initializeValues:v},R[c]),\"~\"===d.trim().charAt(0)&&(s.stickyParentToChild=!0),s}},z=function(e,t,n){var i=F(e,n.attributeViewModelBindings,n.templateType,t.nodeName.toLowerCase(),n.favorViewModel);if(i){i.alreadyUpdatedChild=n.alreadyUpdatedChild,n.initializeValues&&(i.initializeValues=!0);var a,r,o=A[i.parent](t,n.scope,i.parentName,n,i.parentToChild,void 0,void 0,i),s=A[i.child](t,n.scope,i.childName,n,i.childToParent,i.stickyParentToChild&&o,i.childEvent,i);n.nodeList&&(o&&k.setPriority(o,n.nodeList.nesting+1),s&&k.setPriority(s,n.nodeList.nesting+1)),i.parentToChild&&(r=q.parentToChild(t,o,s,n.semaphore,i.bindingAttributeName,i));var c=function(){i.childToParent?a=q.childToParent(t,o,s,n.semaphore,i.bindingAttributeName,i.syncChildWithParent,i):i.stickyParentToChild&&s[S]&&k.onValue(s,C,\"mutate\"),i.initializeValues&&U(i,s,o,r,a)},l=function(){W(o,r),W(s,a),W(s,C)};return\"viewModel\"===i.child?{value:i.stickyParentToChild?V(o):k.getValue(o),onCompleteBinding:c,bindingInfo:i,onTeardown:l}:(c(),{bindingInfo:i,onTeardown:l})}},U=function(e,t,n,i,a){var r=!1;e.parentToChild&&!e.childToParent||(!e.parentToChild&&e.childToParent?r=!0:void 0===k.getValue(t)||void 0===k.getValue(n)&&(r=!0)),r?a(k.getValue(t)):e.alreadyUpdatedChild||i(k.getValue(n))},W=function(e,t){e&&e[_]&&\"function\"==typeof t&&k.offValue(e,t,\"mutate\")},Q=function(e){return e.replace(/@/g,\"\")};n.exports={behaviors:M,getBindingInfo:F}}),define(\"can-component\",[\"require\",\"exports\",\"module\",\"can-component/control/control\",\"can-namespace\",\"can-construct\",\"can-stache-bindings\",\"can-view-scope\",\"can-view-callbacks\",\"can-view-nodelist\",\"can-util/dom/data/data\",\"can-util/dom/mutate/mutate\",\"can-util/dom/child-nodes/child-nodes\",\"can-util/dom/dispatch/dispatch\",\"can-util/js/string/string\",\"can-reflect\",\"can-util/js/each/each\",\"can-util/js/assign/assign\",\"can-util/js/is-function/is-function\",\"can-util/js/log/log\",\"can-util/js/dev/dev\",\"can-util/js/make-array/make-array\",\"can-util/js/is-empty-object/is-empty-object\",\"can-simple-observable\",\"can-simple-map\",\"can-util/dom/events/inserted/inserted\",\"can-util/dom/events/removed/removed\",\"can-view-model\",\"can-globals/document/document\"],function(e,t,n){!function(e,t,n,i){function a(e,t,n){var i;f.set.call(e,\"preventDataBindings\",!0);var a=l.behaviors.viewModel(e,n,function(e){return i=new V(e)},void 0,!0);return a?w(w({},t),{teardown:a,scope:t.scope.add(i)}):t}function r(e,t,n,i,r){var o=n.options._context;return function n(s,c){var l=r(s)||c.subtemplate,u=l!==c.subtemplate;if(l){delete o.tags[e];var d;d=u?i.toLightContent?a(s,{scope:c.scope.cloneFromRef(),options:c.options},c):a(s,t,c):a(s,c,c);var f=p.register([s],function(){d.teardown&&d.teardown()},c.parentNodeList||!0,!1);f.expression=\"\";var h=l(d.scope,d.options,f),m=L(v(h));p.replace(f,h),p.update(f,m),o.tags[e]=n}}}var o=t(\"can-component/control/control\"),s=t(\"can-namespace\"),c=t(\"can-construct\"),l=t(\"can-stache-bindings\"),u=t(\"can-view-scope\"),d=t(\"can-view-callbacks\"),p=t(\"can-view-nodelist\"),f=t(\"can-util/dom/data/data\"),h=t(\"can-util/dom/mutate/mutate\"),v=t(\"can-util/dom/child-nodes/child-nodes\"),m=t(\"can-util/dom/dispatch/dispatch\"),g=t(\"can-util/js/string/string\"),y=t(\"can-reflect\"),b=t(\"can-util/js/each/each\"),w=t(\"can-util/js/assign/assign\"),k=t(\"can-util/js/is-function/is-function\"),x=t(\"can-util/js/log/log\"),j=t(\"can-util/js/dev/dev\"),L=t(\"can-util/js/make-array/make-array\"),E=t(\"can-util/js/is-empty-object/is-empty-object\"),V=t(\"can-simple-observable\"),O=t(\"can-simple-map\");t(\"can-util/dom/events/inserted/inserted\"),t(\"can-util/dom/events/removed/removed\"),t(\"can-view-model\");var C=t(\"can-globals/document/document\"),_=c.extend({setup:function(){if(c.setup.apply(this,arguments),_){var e=this;E(this.prototype.events)||(this.Control=o.extend(this.prototype.events)),this.prototype.viewModel&&y.isConstructorLike(this.prototype.viewModel)&&j.warn(\"can-component: Assigning a DefineMap or constructor type to the viewModel property may not be what you intended. Did you mean ViewModel instead? More info: https://canjs.com/doc/can-component.prototype.ViewModel.html\");var t=this.prototype.viewModel||this.prototype.scope;if(t&&this.prototype.ViewModel)throw new Error(\"Cannot provide both a ViewModel and a viewModel property\");var n=g.capitalize(g.camelize(this.prototype.tag))+\"VM\";this.prototype.ViewModel?\"function\"==typeof this.prototype.ViewModel?this.ViewModel=this.prototype.ViewModel:this.ViewModel=O.extend(n,this.prototype.ViewModel):t?\"function\"==typeof t?y.isObservableLike(t.prototype)&&y.isMapLike(t.prototype)?this.ViewModel=t:this.viewModelHandler=t:y.isObservableLike(t)&&y.isMapLike(t)?(x.warn(\"can-component: \"+this.prototype.tag+\" is sharing a single map across all component instances\"),this.viewModelInstance=t):this.ViewModel=O.extend(n,t):this.ViewModel=O.extend(n,{}),this.prototype.template&&(x.warn(\"can-component.prototype.template: is deprecated and will be removed in a future release. Use can-component.prototype.view\"),this.renderer=this.prototype.template),this.prototype.view&&(this.renderer=this.prototype.view),d.tag(this.prototype.tag,function(t,n){new e(t,n)}),this.prototype.autoMount&&b(C().getElementsByTagName(this.prototype.tag),function(t){f.get.call(t,\"viewModel\")||new e(t,{scope:new u,options:new u.Options({}),templates:{},subtemplate:null})})}}},{setup:function(e,t){var n,i,a,o=this,s=[];if(!f.get.call(e,\"preventDataBindings\")){var c=t.setupBindings||function(e,n,i){return l.behaviors.viewModel(e,t,n,i)};a=c(e,function(i){var a=o.constructor.ViewModel,r=o.constructor.viewModelHandler,s=o.constructor.viewModelInstance;if(r){var c=r.call(o,i,t.scope,e);y.isObservableLike(c)&&y.isMapLike(c)?s=c:a=y.isObservableLike(c.prototype)&&y.isMapLike(c.prototype)?c:O.extend(c)}return a&&(s=new o.constructor.ViewModel(i)),n=s,s},{})}this.viewModel=n,f.set.call(e,\"viewModel\",n),f.set.call(e,\"preventDataBindings\",!0);var d={helpers:{},tags:{}};b(this.helpers||{},function(e,t){k(e)&&(d.helpers[t]=e.bind(n))}),this.constructor.Control&&(this._control=new this.constructor.Control(e,{scope:this.viewModel,viewModel:this.viewModel,destroy:function(){for(var e=0,t=s.length;e\",s.push(function(){p.unregister(L)}),i=g(w.scope,w.options,L),h.appendChild.call(e,i),p.update(L,v(e))}});i.exports=s.Component=_}(0,e,0,n)}),define(\"can-simple-observable/async/async\",[\"require\",\"exports\",\"module\",\"can-simple-observable\",\"can-observation\",\"can-key-tree\",\"can-queues\",\"can-simple-observable/settable/settable\",\"can-reflect\",\"can-observation-recorder\"],function(e,t,n){function i(e,t,n){function i(){return this.resolveCalled=!1,e.call(t,this.lastSetValue.get(),!0===this.bound?this.resolve:void 0)}this.handlers=new o([Object,Array],{onFirst:this.setup.bind(this),onEmpty:this.teardown.bind(this)}),this.resolve=this.resolve.bind(this),this.lastSetValue=new a(n),this.handler=this.handler.bind(this),l.assignSymbols(this,{\"can.getName\":function(){return l.getName(this.constructor)+\"<\"+l.getName(e)+\">\"}}),Object.defineProperty(this.handler,\"name\",{value:l.getName(this)+\".handler\"}),Object.defineProperty(i,\"name\",{value:l.getName(e)+\"::\"+l.getName(this.constructor)}),this.observation=new r(i,this)}var a=e(\"can-simple-observable\"),r=e(\"can-observation\"),o=e(\"can-key-tree\"),s=e(\"can-queues\"),c=e(\"can-simple-observable/settable/settable\"),l=e(\"can-reflect\"),u=e(\"can-observation-recorder\");(i.prototype=Object.create(c.prototype)).constructor=i,i.prototype.handler=function(e){void 0!==e&&c.prototype.handler.apply(this,arguments)};var d=u.ignore(l.getValue.bind(l));i.prototype.setup=function(){this.bound=!0,l.onValue(this.observation,this.handler,\"notify\"),this.resolveCalled||(this.value=d(this.observation))},i.prototype.resolve=function(e){this.resolveCalled=!0;var t=this.value;this.value=e,\"function\"==typeof this._log&&this._log(t,e),s.enqueueByQueue(this.handlers.getNode([]),this,[e,t],function(){return{}})},n.exports=i}),define(\"can-util/js/defaults/defaults\",function(e,t,n){\"use strict\";n.exports=function(e){for(var t=arguments.length,n=1;nthis._length-1){var n=new Array(e+1-this._length);return n[n.length-1]=t,this.push.apply(this,n),n}this.splice(e,1,t)}else u.defineExpando(this,e,t)||(this[e]=t);else l.warn(\"can-define/list/list.prototype.set is deprecated; please use can-define/list/list.prototype.assign or can-define/list/list.prototype.update instead\"),y.isListLike(e)?t?this.replace(e):y.assignList(this,e):y.assignMap(this,e);return this},assign:function(e){return y.isListLike(e)?y.assignList(this,e):y.assignMap(this,e),this},update:function(e){return y.isListLike(e)?y.updateList(this,e):y.updateMap(this,e),this},assignDeep:function(e){return y.isListLike(e)?y.assignDeepList(this,e):y.assignDeepMap(this,e),this},updateDeep:function(e){return y.isListLike(e)?y.updateDeepList(this,e):y.updateDeepMap(this,e),this},_items:function(){var e=[];return this._each(function(t){e.push(t)}),e},_each:function(e){for(var t=0,n=this._length;t2,l=this._length;for(e=e||0,n=0,i=r.length-2;n0&&this._triggerChange(\"\"+e,\"remove\",void 0,u),r.length>2&&this._triggerChange(\"\"+e,\"add\",s,u),this.dispatch(\"length\",[this._length,l]),o.batch.stop(),u},serialize:function(){return y.serialize(this,k)},log:function(e){var t=this,n=function(e){return\"string\"==typeof e?JSON.stringify(e):e},i=p(t),a=i.allowedLogKeysSet||new Set;i.allowedLogKeysSet=a,e&&a.add(e),i._log=function(i,r){var o=i.type;\"can.onPatches\"===o||e&&!a.has(o)||(\"add\"===o||\"remove\"===o?d.log(y.getName(t),\"\\n how \",n(o),\"\\n what \",n(r[0]),\"\\n index \",n(r[1])):d.log(y.getName(t),\"\\n key \",n(o),\"\\n is \",n(r[0]),\"\\n was \",n(r[1])))}}}),D=function(e){return e[0]&&Array.isArray(e[0])?e[0]:m(e)};v({push:\"length\",unshift:0},function(e,t){var n=[][t];_.prototype[t]=function(){for(var t,i,a=[],r=e?this._length:0,s=arguments.length;s--;)i=arguments[s],a[s]=this.__type(i,s);return L=!0,t=n.apply(this,a),L=!1,this.comparator&&!a.length||(o.batch.start(),this._triggerChange(\"\"+r,\"add\",a,void 0),this.dispatch(\"length\",[this._length,r]),o.batch.stop()),t}}),v({pop:\"length\",shift:0},function(e,t){var n=[][t];_.prototype[t]=function(){if(this._length){var t,i=D(arguments),a=e&&this._length?this._length-1:0,r=this._length?this._length:0;return L=!0,t=n.apply(this,i),L=!1,o.batch.start(),this._triggerChange(\"\"+a,\"remove\",void 0,[t]),this.dispatch(\"length\",[this._length,r]),o.batch.stop(),t}}}),v({map:3,filter:3,reduce:4,reduceRight:4,every:3,some:3},function(e,t){_.prototype[t]=function(){var n=this,i=[].slice.call(arguments,0),a=i[0],r=i[e-1]||n;\"object\"==typeof a&&(a=V(a)),i[0]=function(){var t=[].slice.call(arguments,0);return t[e-3]=n.get(t[e-2]),a.apply(r,t)};var o=Array.prototype[t].apply(this,i);return\"map\"===t?new _(o):\"filter\"===t?new n.constructor(o):o}}),f(_.prototype,{indexOf:function(e,t){for(var n=t||0,i=this.length;n=0;n--)if(this.get(n)===e)return n;return-1},join:function(){return s.add(this,\"length\"),[].join.apply(this,arguments)},reverse:function(){var e=[].reverse.call(this._items());return this.replace(e)},slice:function(){s.add(this,\"length\");var e=Array.prototype.slice.apply(this,arguments);return new this.constructor(e)},concat:function(){var e=[];return v(arguments,function(t){y.isListLike(t)?(Array.isArray(t)?t:m(t)).forEach(function(t){e.push(this.__type(t))},this):e.push(this.__type(t))},this),new this.constructor(Array.prototype.concat.apply(m(this),e))},forEach:function(e,t){for(var n,i=0,a=this.length;ithis._length-1){var t=new Array(e-this._length);this.push.apply(this,t)}else this.splice(e)},enumerable:!0}),Object.defineProperty(_.prototype,\"each\",{enumerable:!1,writable:!0,value:_.prototype.forEach}),_.prototype.attr=function(e,t){return c.warn(\"DefineMap::attr shouldn't be called\"),0===arguments.length?this.get():e&&\"object\"==typeof e?this.set.apply(this,arguments):1===arguments.length?this.get(e):this.set(e,t)},_.prototype.item=function(e,t){return 1===arguments.length?this.get(e):this.set(e,t)},_.prototype.items=function(){return c.warn(\"DefineList::get should should be used instead of DefineList::items\"),this.get()},y.assignSymbols(_.prototype,{\"can.isMoreListLikeThanMapLike\":!0,\"can.isMapLike\":!0,\"can.isListLike\":!0,\"can.isValueLike\":!1,\"can.getKeyValue\":_.prototype.get,\"can.setKeyValue\":_.prototype.set,\"can.onKeyValue\":function(e,t,n){var i;return isNaN(e)?O.apply(this,arguments):(i=function(){t(this[e])},Object.defineProperty(i,\"name\",{value:\"translationHandler(\"+e+\")::\"+y.getName(this)+\".onKeyValue('length',\"+y.getName(t)+\")\"}),x.set(t,this,i,e),O.call(this,\"length\",i,n))},\"can.offKeyValue\":function(e,t,n){var i;return isNaN(e)?C.apply(this,arguments):(i=x.getAndDelete(t,this,e),C.call(this,\"length\",i,n))},\"can.deleteKeyValue\":function(e){if(\"number\"==typeof(e=isNaN(+e)||e%1?e:+e))this.splice(e,1);else{if(\"length\"===e||\"_length\"===e)return;this.set(e,void 0)}return this},\"can.assignDeep\":function(e){o.batch.start(),y.assignList(this,e),o.batch.stop()},\"can.updateDeep\":function(e){o.batch.start(),this.replace(e),o.batch.stop()},\"can.keyHasDependencies\":function(e){return!!(this._computed&&this._computed[e]&&this._computed[e].compute)},\"can.getKeyDependencies\":function(e){var t;return this._computed&&this._computed[e]&&this._computed[e].compute&&((t={}).valueDependencies=new w,t.valueDependencies.add(this._computed[e].compute)),t},\"can.splice\":function(e,t,n){this.splice.apply(this,[e,t].concat(n))},\"can.onPatches\":function(e,t){this[b.for(\"can.onKeyValue\")](\"can.onPatches\",e,t)},\"can.offPatches\":function(e,t){this[b.for(\"can.offKeyValue\")](\"can.onPatches\",e,t)},\"can.getName\":function(){return y.getName(this.constructor)+\"[]\"}}),y.setKeyValue(_.prototype,b.iterator,function(){var e=-1;return\"number\"!=typeof this._length&&(this._length=0),{next:function(){return e++,{value:this[e],done:e>=this._length}}.bind(this)}}),a.DefineList=_,n.exports=g.DefineList=_}),define(\"can-view-target\",[\"require\",\"exports\",\"module\",\"can-util/dom/child-nodes/child-nodes\",\"can-util/dom/attr/attr\",\"can-util/js/each/each\",\"can-util/js/make-array/make-array\",\"can-util/dom/document/document\",\"can-util/dom/mutate/mutate\",\"can-namespace\",\"can-globals/mutation-observer/mutation-observer\"],function(e,t,n){!function(e,t,n,i){function a(e,t,n,i){var a,r,o,s,c,u=n,d=typeof e,p=function(){return a||(a={path:n,callbacks:[]},t.push(a),u=[]),a};if(\"object\"===d){if(e.tag){if(r=b&&e.namespace?i.createElementNS(e.namespace,e.tag):i.createElement(e.tag),e.attrs)for(var h in e.attrs){var v=e.attrs[h];\"function\"==typeof v?p().callbacks.push({callback:v}):l.setAttribute(r,h,v)}if(e.attributes)for(s=0,c=e.attributes.length;s\";var t,n,i=e.cloneNode(!0),a=\"\"===i.innerHTML;return a?((e=document.createDocumentFragment()).appendChild(document.createTextNode(\"foo-bar\")),(t=v())?((n=new t(function(){})).observe(document.documentElement,{childList:!0,subtree:!0}),i=e.cloneNode(!0),n.disconnect()):i=e.cloneNode(!0),1===i.childNodes.length):a}(),b=\"undefined\"!=typeof document&&!!document.createElementNS,w=y?function(e){return e.cloneNode(!0)}:function(e){var t,n=e.ownerDocument;if(1===e.nodeType?t=\"http://www.w3.org/1999/xhtml\"!==e.namespaceURI&&b&&n.createElementNS?n.createElementNS(e.namespaceURI,e.nodeName):n.createElement(e.nodeName):3===e.nodeType?t=n.createTextNode(e.nodeValue):8===e.nodeType?t=n.createComment(e.nodeValue):11===e.nodeType&&(t=n.createDocumentFragment()),e.attributes){var i=d(e.attributes);u(i,function(e){e&&e.specified&&l.setAttribute(t,e.nodeName||e.name,e.nodeValue||e.value)})}if(e&&e.firstChild)for(var a=e.firstChild;a;)t.appendChild(w(a)),a=a.nextSibling;return t};s.keepsTextNodes=g,s.cloneNode=w,h.view=h.view||{},i.exports=h.view.target=s}(0,e,0,n)}),define(\"can-stache/src/mustache_core\",[\"require\",\"exports\",\"module\",\"can-view-live\",\"can-view-nodelist\",\"can-observation\",\"can-stache/src/utils\",\"can-stache/src/expression\",\"can-util/dom/frag/frag\",\"can-util/dom/attr/attr\",\"can-symbol\",\"can-reflect\"],function(e,t,n){var i=e(\"can-view-live\"),a=e(\"can-view-nodelist\"),r=e(\"can-observation\"),o=e(\"can-stache/src/utils\"),s=e(\"can-stache/src/expression\"),c=e(\"can-util/dom/frag/frag\"),l=e(\"can-util/dom/attr/attr\"),u=e(\"can-symbol\"),d=e(\"can-reflect\"),p=/(?:(^|\\r?\\n)(\\s*)(\\{\\{([\\s\\S]*)\\}\\}\\}?)([^\\S\\n\\r]*)($|\\r?\\n))|(\\{\\{([\\s\\S]*)\\}\\}\\}?)/g,f=/(\\s*)(\\{\\{\\{?)(-?)([\\s\\S]*?)(-?)(\\}\\}\\}?)(\\s*)/g,h=function(){},v={expression:s,makeEvaluator:function(e,t,n,i,a,r,l,u){if(\"^\"===i){var p=r;r=l,l=p}var f,h;if(a instanceof s.Call){if(h={context:e.peek(\".\"),scope:e,nodeList:n,exprData:a,helpersScope:t},o.convertToScopes(h,e,t,n,r,l,u),f=a.value(e,t,h),a.isHelper)return f}else if(a instanceof s.Bracket){if(f=a.value(e),a.isHelper)return f}else if(a instanceof s.Lookup){if(f=a.value(e),a.isHelper)return f}else if(a instanceof s.Helper&&a.methodExpr instanceof s.Bracket){if(f=a.methodExpr.value(e),a.isHelper)return f}else{var v={isArgument:!0,args:[e.peek(\".\"),e],asCompute:!0},m=a.helperAndValue(e,t,v,n,r,l,u),g=m.helper;if(f=m.value,g)return a.evaluator(g,e,t,v,n,r,l,u)}return i?\"#\"===i||\"^\"===i?(h={},o.convertToScopes(h,e,t,n,r,l,u),function(){var n=d.getValue(f);if(\"function\"==typeof n)return n;if(\"string\"!=typeof n&&o.isArrayLike(n)){var i=d.isObservableLike(n)&&d.isListLike(n);return(i?n.attr(\"length\"):n.length)?u?o.getItemsStringContent(n,i,h,t):c(o.getItemsFragContent(n,h,e)):h.inverse(e,t)}return n?h.fn(n||e,t):h.inverse(e,t)}):void 0:f},makeLiveBindingPartialRenderer:function(e,t){var n,o=(e=e.trim()).split(/\\s+/).shift();return o!==e&&(n=v.expression.parse(e)),function(e,s,l){var u=[this];u.expression=\">\"+o,a.register(u,null,l||!0,t.directlyNested);var p=new r(function(){var t=o;if(n&&1===n.argExprs.length){var i=d.getValue(n.argExprs[0].value(e,s));void 0===i?dev.warn(\"The context (\"+n.argExprs[0].key+\") you passed into thepartial (\"+o+\") is not defined in the scope!\"):e=e.add(i)}var a,l=s.peek(\"partials.\"+t);if(l=l||s.inlinePartials&&s.inlinePartials[t])a=function(){return l.render?l.render(e,s,u):l(e,s)};else{var p=e.read(t,{isArgument:!0}).value;if(null===p||!p&&\"*\"===t[0])return c(\"\");p&&(t=p),a=function(){return\"function\"==typeof t?t(e,s,u):v.getTemplateById(t)(e,s,u)}}var f=r.ignore(a)();return c(f)});d.setPriority(p,u.nesting),i.html(this,p,this.parentNode,u)}},makeStringBranchRenderer:function(e,t){var n=v.expression.parse(t),i=e+t;n instanceof s.Helper||n instanceof s.Call||(n=new s.Helper(n,[],{}));var a=function(t,a,r,o){var s=t.__cache[i];!e&&s||(s=m(t,a,null,e,n,r,o,!0),e||(t.__cache[i]=s));var c;return null==(c=s[u.for(\"can.onValue\")]?d.getValue(s):s())?\"\":\"\"+c};return a.exprData=n,a},makeLiveBindingBranchRenderer:function(e,t,n){var o=v.expression.parse(t);o instanceof s.Helper||o instanceof s.Call||o instanceof s.Bracket||o instanceof s.Lookup||(o=new s.Helper(o,[],{}));var p=function(s,p,f,v,g){var y=[this];y.expression=t,a.register(y,null,f||!0,n.directlyNested);var b,w=m(s,p,y,e,o,v,g,n.tag);if(w[u.for(\"can.onValue\")]?b=w:(Object.defineProperty(w,\"name\",{value:\"{{\"+t+\"}}\"}),b=new r(w,null,{isObservable:!1})),!1===d.setPriority(b,y.nesting))throw new Error(\"can-stache unable to set priority on observable\");d.onValue(b,h);var k=d.getValue(b);\"function\"==typeof k?r.ignore(k)(this):d.valueHasDependencies(b)?n.attr?i.attr(this,n.attr,b):n.tag?i.attrs(this,b):n.text&&\"object\"!=typeof k?i.text(this,b,this.parentNode,y):i.html(this,b,this.parentNode,y):n.attr?l.set(this,n.attr,k):n.tag?i.attrs(this,k):n.text&&\"string\"==typeof k?this.nodeValue=k:null!=k&&a.replace([this],c(k,this.ownerDocument)),d.offValue(b,h)};return p.exprData=o,p},splitModeFromExpression:function(e,t){var n=(e=e.trim()).charAt(0);return\"#/{&^>!<\".indexOf(n)>=0?e=e.substr(1).trim():n=null,\"{\"===n&&t.node&&(n=null),{mode:n,expression:e}},cleanLineEndings:function(e){return e.replace(p,function(e,t,n,i,a,r,o,s,c,l){r=r||\"\",t=t||\"\",n=n||\"\";var u=g(a||c,{});return s||\">{\".indexOf(u.mode)>=0?e:\"^#!/\".indexOf(u.mode)>=0?(n=t+n&&\" \")+i+(0!==l&&o.length?t+\"\\n\":\"\"):n+i+r+(n.length||0!==l?t+\"\\n\":\"\")})},cleanWhitespaceControl:function(e){return e.replace(f,function(e,t,n,i,a,r,o,s,c){return\"-\"===i&&(t=\"\"),\"-\"===r&&(s=\"\"),t+n+a+o+s})},Options:o.Options,getTemplateById:function(){}},m=v.makeEvaluator,g=v.splitModeFromExpression;n.exports=v}),define(\"can-stache/src/html_section\",[\"require\",\"exports\",\"module\",\"can-view-target\",\"can-view-scope\",\"can-observation\",\"can-stache/src/utils\",\"can-stache/src/mustache_core\",\"can-util/dom/document/document\",\"can-util/js/assign/assign\",\"can-util/js/last/last\"],function(e,t,n){var i=e(\"can-view-target\"),a=e(\"can-view-scope\"),r=e(\"can-observation\"),o=e(\"can-stache/src/utils\"),s=e(\"can-stache/src/mustache_core\"),c=e(\"can-util/dom/document/document\"),l=e(\"can-util/js/assign/assign\"),u=e(\"can-util/js/last/last\"),d=\"undefined\"!=typeof document&&function(){var e=c().createElement(\"div\");return function(t){return-1===t.indexOf(\"&\")?t.replace(/\\r\\n/g,\"\\n\"):(e.innerHTML=t,0===e.childNodes.length?\"\":e.childNodes.item(0).nodeValue)}}(),p=function(){this.stack=[new f]};p.scopify=function(e){return r.ignore(function(t,n,i){return t instanceof a||(t=a.refsScope().add(t||{})),n instanceof s.Options||(n=new s.Options(n||{})),e(t,n,i)})},l(p.prototype,o.mixins),l(p.prototype,{startSubSection:function(e){var t=new f(e);return this.stack.push(t),t},endSubSectionAndReturnRenderer:function(){if(this.last().isEmpty())return this.stack.pop(),null;var e=this.endSection();return e.compiled.hydrate.bind(e.compiled)},startSection:function(e){var t=new f(e);this.last().add(t.targetCallback),this.stack.push(t)},endSection:function(){return this.last().compile(),this.stack.pop()},inverse:function(){this.last().inverse()},compile:function(){var e=this.stack.pop().compile();return r.ignore(function(t,n,i){return t instanceof a||(t=a.refsScope().add(t||{})),n instanceof s.Options||(n=new s.Options(n||{})),e.hydrate(t,n,i)})},push:function(e){this.last().push(e)},pop:function(){return this.last().pop()},removeCurrentNode:function(){this.last().removeCurrentNode()}});var f=function(e){this.data=\"targetData\",this.targetData=[],this.targetStack=[];var t=this;this.targetCallback=function(n,i,a){e.call(this,n,i,a,t.compiled.hydrate.bind(t.compiled),t.inverseCompiled&&t.inverseCompiled.hydrate.bind(t.inverseCompiled))}};l(f.prototype,{inverse:function(){this.inverseData=[],this.data=\"inverseData\"},push:function(e){this.add(e),this.targetStack.push(e)},pop:function(){return this.targetStack.pop()},add:function(e){\"string\"==typeof e&&(e=d(e)),this.targetStack.length?u(this.targetStack).children.push(e):this[this.data].push(e)},compile:function(){return this.compiled=i(this.targetData,c()),this.inverseData&&(this.inverseCompiled=i(this.inverseData,c()),delete this.inverseData),this.targetStack=this.targetData=null,this.compiled},removeCurrentNode:function(){return this.children().pop()},children:function(){return this.targetStack.length?u(this.targetStack).children:this[this.data]},isEmpty:function(){return!this.targetData.length}}),p.HTMLSection=f,n.exports=p}),define(\"can-stache/src/text_section\",[\"require\",\"exports\",\"module\",\"can-view-live\",\"can-stache/src/utils\",\"can-util/dom/attr/attr\",\"can-util/js/assign/assign\",\"can-reflect\",\"can-observation\"],function(e,t,n){var i=e(\"can-view-live\"),a=e(\"can-stache/src/utils\"),r=e(\"can-util/dom/attr/attr\"),o=e(\"can-util/js/assign/assign\"),s=e(\"can-reflect\"),c=e(\"can-observation\"),l=function(){},u=function(){this.stack=[new p]};o(u.prototype,a.mixins),o(u.prototype,{startSection:function(e){var t=new p;this.last().add({process:e,truthy:t}),this.stack.push(t)},endSection:function(){this.stack.pop()},inverse:function(){this.stack.pop();var e=new p;this.last().last().falsey=e,this.stack.push(e)},compile:function(e){var t=this.stack[0].compile();return Object.defineProperty(t,\"name\",{value:\"textSectionRenderer<\"+e.tag+\".\"+e.attr+\">\"}),function(n,a){function o(){return t(n,a)}Object.defineProperty(o,\"name\",{value:\"textSectionRender<\"+e.tag+\".\"+e.attr+\">\"});var u=new c(o,null,{isObservable:!1});s.onValue(u,l);var d=s.getValue(u);s.valueHasDependencies(u)?(e.textContentOnly?i.text(this,u):e.attr?i.attr(this,e.attr,u):i.attrs(this,u,n,a),s.offValue(u,l)):e.textContentOnly?this.nodeValue=d:e.attr?r.set(this,e.attr,d):i.attrs(this,d)}}});var d=function(e,t,n){return function(i,a){return e.call(this,i,a,t,n)}},p=function(){this.values=[]};o(p.prototype,{add:function(e){this.values.push(e)},last:function(){return this.values[this.values.length-1]},compile:function(){for(var e=this.values,t=e.length,n=0;n0&&(p=!0)},special:function(e){p=!0}},!0),imports:r,dynamicImports:o,ases:s,exports:s}}}),define(\"can-util/js/import/import\",[\"require\",\"exports\",\"module\",\"can-util/js/is-function/is-function\",\"can-globals/global/global\"],function(e,t,n){!function(e,t,n,i){\"use strict\";var a=t(\"can-util/js/is-function/is-function\"),e=t(\"can-globals/global/global\")();i.exports=function(t,n){return new Promise(function(i,r){try{\"object\"==typeof e.System&&a(e.System.import)?e.System.import(t,{name:n}).then(i,r):e.define&&e.define.amd?e.require([t],function(e){i(e)}):e.require?i(e.require(t)):i()}catch(e){r(e)}})}}(function(){return this}(),e,0,n)}),define(\"can-stache\",[\"require\",\"exports\",\"module\",\"can-view-parser\",\"can-view-callbacks\",\"can-stache/src/html_section\",\"can-stache/src/text_section\",\"can-stache/src/mustache_core\",\"can-stache/helpers/core\",\"can-stache/helpers/converter\",\"can-stache/src/intermediate_and_imports\",\"can-stache/src/utils\",\"can-attribute-encoder\",\"can-util/js/dev/dev\",\"can-namespace\",\"can-util/dom/document/document\",\"can-util/js/assign/assign\",\"can-util/js/last/last\",\"can-util/js/import/import\",\"can-view-target\",\"can-view-nodelist\"],function(e,t,n){function i(e){var t={};\"string\"==typeof e&&(e=c.cleanWhitespaceControl(e),e=c.cleanLineEndings(e));var n=new o,i={node:null,attr:null,sectionElementStack:[],text:!1,namespaceStack:[],textContentOnly:null},l=function(e,n,a){if(\">\"===n)e.add(c.makeLiveBindingPartialRenderer(a,u()));else if(\"/\"===n){if(\"<\"===e.last().startedWith?(t[a]=e.endSubSectionAndReturnRenderer(),e.removeCurrentNode()):e.endSection(),e instanceof o){var r=i.sectionElementStack[i.sectionElementStack.length-1].tag;\"\"!==a&&a!==r&&f.warn(\"unexpected closing tag {{/\"+a+\"}} expected {{/\"+r+\"}}\"),i.sectionElementStack.pop()}}else if(\"else\"===n)e.inverse();else{var s=e instanceof o?c.makeLiveBindingBranchRenderer:c.makeStringBranchRenderer;if(\"{\"===n||\"&\"===n)e.add(s(null,a,u()));else if(\"#\"===n||\"^\"===n||\"<\"===n){var l=s(n,a,u());if(e.startSection(l),e.last().startedWith=n,e instanceof o){var d=\"function\"==typeof l.exprData.closingTag?l.exprData.closingTag():\"\";i.sectionElementStack.push({type:\"section\",tag:d})}}else e.add(s(null,a,u({text:!0})))}},u=function(e){var t=i.sectionElementStack[i.sectionElementStack.length-1],n={tag:i.node&&i.node.tag,attr:i.attr&&i.attr.name,directlyNested:!i.sectionElementStack.length||(\"section\"===t.type||\"custom\"===t.type),textContentOnly:!!i.textContentOnly};return e?m(n,e):n},h=function(e,t){e.attributes||(e.attributes=[]),e.attributes.unshift(t)};a(e,{start:function(e,t){var n=k[e];n&&!t&&i.namespaceStack.push(n),i.node={tag:e,children:[],namespace:n||g(i.namespaceStack)}},end:function(e,t){var a=r.tag(e);t?(n.add(i.node),a&&h(i.node,function(t,n,i){r.tagHandler(this,e,{scope:t,options:n,subtemplate:null,templateType:\"stache\",parentNodeList:i})})):(n.push(i.node),i.sectionElementStack.push({type:a?\"custom\":null,tag:a?null:e,templates:{}}),a?n.startSubSection():x[e]&&(i.textContentOnly=new s)),i.node=null},close:function(e){k[e]&&i.namespaceStack.pop();var t,a=r.tag(e);a&&(t=n.endSubSectionAndReturnRenderer()),x[e]&&(n.last().add(i.textContentOnly.compile(u())),i.textContentOnly=null);var o=n.pop();if(a)if(\"can-template\"===e)i.sectionElementStack[i.sectionElementStack.length-2].templates[o.attrs.name]=d(t),n.removeCurrentNode();else{var s=i.sectionElementStack[i.sectionElementStack.length-1];h(o,function(n,i,a){r.tagHandler(this,e,{scope:n,options:i,subtemplate:t?d(t):t,templateType:\"stache\",parentNodeList:a,templates:s.templates})})}i.sectionElementStack.pop()},attrStart:function(e){i.node.section?i.node.section.add(e+'=\"'):i.attr={name:e,value:\"\"}},attrEnd:function(e){if(i.node.section)i.node.section.add('\" ');else{i.node.attrs||(i.node.attrs={}),i.node.attrs[i.attr.name]=i.attr.section?i.attr.section.compile(u()):i.attr.value;var t=r.attr(e),n=p.decode(e);weirdAttribute=!!b.test(n)||!!w.test(n),weirdAttribute&&!t&&f.warn(\"unknown attribute binding \"+n+\". Is can-stache-bindings imported?\"),t&&(i.node.attributes||(i.node.attributes=[]),i.node.attributes.push(function(n,i,a){t(this,{attributeName:e,scope:n,options:i,nodeList:a})})),i.attr=null}},attrValue:function(e){var t=i.node.section||i.attr.section;t?t.add(e):i.attr.value+=e},chars:function(e){(i.textContentOnly||n).add(e)},special:function(e){var t=c.splitModeFromExpression(e,i),a=t.mode,r=t.expression;if(\"else\"!==r){if(\"!\"!==a)if(i.node&&i.node.section)l(i.node.section,a,r),0===i.node.section.subSectionDepth()&&(i.node.attributes.push(i.node.section.compile(u())),delete i.node.section);else if(i.attr)i.attr.section||(i.attr.section=new s,i.attr.value&&i.attr.section.add(i.attr.value)),l(i.attr.section,a,r);else if(i.node)if(i.node.attributes||(i.node.attributes=[]),a){if(\"#\"!==a&&\"^\"!==a)throw new Error(a+\" is currently not supported within a tag.\");i.node.section||(i.node.section=new s),l(i.node.section,a,r)}else i.node.attributes.push(c.makeLiveBindingBranchRenderer(null,r,u()));else l(i.textContentOnly||n,a,r)}else{(i.attr&&i.attr.section?i.attr.section:i.node&&i.node.section?i.node.section:i.textContentOnly||n).inverse()}},comment:function(e){n.add({comment:e})},done:function(){}});var v=n.compile(),y=o.scopify(function(e,n,i){return Object.keys(t).length&&(n.inlinePartials=n.inlinePartials||{},m(n.inlinePartials,t)),e.set(\"*self\",y),v.apply(this,arguments)});return y}var a=e(\"can-view-parser\"),r=e(\"can-view-callbacks\"),o=e(\"can-stache/src/html_section\"),s=e(\"can-stache/src/text_section\"),c=e(\"can-stache/src/mustache_core\"),l=e(\"can-stache/helpers/core\");e(\"can-stache/helpers/converter\");var u=e(\"can-stache/src/intermediate_and_imports\"),d=e(\"can-stache/src/utils\").makeRendererConvertScopes,p=e(\"can-attribute-encoder\"),f=e(\"can-util/js/dev/dev\"),h=e(\"can-namespace\"),v=e(\"can-util/dom/document/document\"),m=e(\"can-util/js/assign/assign\"),g=e(\"can-util/js/last/last\"),y=e(\"can-util/js/import/import\");e(\"can-view-target\"),e(\"can-view-nodelist\"),r.tag(\"content\",function(e,t){return t.scope});var b=/[{(].*[)}]/,w=/^on:|(:to|:from|:bind)$|.*:to:on:.*/,k={svg:\"http://www.w3.org/2000/svg\",g:\"http://www.w3.org/2000/svg\"},x={style:!0,script:!0};m(i,l),i.safeString=function(e){return{toString:function(){return e}}},i.async=function(e){var t=u(e),n=t.imports.map(function(e){return y(e)});return Promise.all(n).then(function(){return i(t.intermediate)})};var j={};i.from=c.getTemplateById=function(e){if(!j[e]){var t=v().getElementById(e);j[e]=i(t.innerHTML)}return j[e]},i.registerPartial=function(e,t){j[e]=\"string\"==typeof t?i(t):t},n.exports=h.stache=i}),define(\"can-debug\",[\"require\",\"exports\",\"module\",\"can-namespace\",\"can-symbol\",\"can-reflect\"],function(e,t,n){function i(e,t){var n=2===arguments.length,o={obj:e,key:t,keyDependencies:{},valueDependencies:[],name:c.getName(e),value:n?c.getKeyValue(e,t):c.getValue(e)},s=n?a(e,t):r(e);return s?(s.keyDependencies&&c.each(s.keyDependencies,function(e,t){c.each(e,function(e){o.keyDependencies[e]=i(t,e)})}),s.valueDependencies&&c.each(s.valueDependencies,function(e){o.valueDependencies.push(i(e))}),o):o}function a(e,t){if(e[l])return c.getKeyDependencies(e,t)}function r(e){if(e[u])return c.getValueDependencies(e)}var o=e(\"can-namespace\"),s=e(\"can-symbol\"),c=e(\"can-reflect\"),l=s.for(\"can.getKeyDependencies\"),u=s.for(\"can.getValueDependencies\");i.logWhatChangesMe=function(e,t){var n=function(e){return\"string\"==typeof e?JSON.stringify(e):e},a=function e(t){var i=[t.name,null!=t.key?\".\"+t.key:\"\"];console.group(i.join(\"\")),console.log(\"value \",n(t.value)),console.log(\"object \",t.obj),c.each(t.keyDependencies,e),c.each(t.valueDependencies,e),console.groupEnd()};return a(2===arguments.length?i(e,t):i(e))},n.exports=o.debug=i}),define(\"can\",[\"require\",\"exports\",\"module\",\"can-util/namespace\",\"can-component\",\"can-define/map/map\",\"can-define/list/list\",\"can-stache\",\"can-stache-bindings\",\"can-debug\"],function(e,t,n){!function(e,t,n,i){var a=t(\"can-util/namespace\");t(\"can-component\"),t(\"can-define/map/map\"),t(\"can-define/list/list\"),t(\"can-stache\"),t(\"can-stache-bindings\"),t(\"can-debug\"),i.exports=a}(0,e,0,n)}),define(\"can-util/js/omit/omit\",function(e,t,n){\"use strict\";n.exports=function(e,t){var n={};for(var i in e)t.indexOf(i)<0&&(n[i]=e[i]);return n}}),define(\"can-param\",[\"require\",\"exports\",\"module\",\"can-namespace\"],function(e,t,n){function i(e,t,n){if(Array.isArray(t))for(var a=0,r=t.length;a=200&&i.status<300?o.resolve(h(i,e)):o.reject(i)):e.progress&&e.progress(++a)}catch(e){o.reject(e)}};var u=e.url,v=null,m=e.type.toUpperCase(),g=e.contentType===f.json,y=\"POST\"===m||\"PUT\"===m;!y&&e.data&&(u+=\"?\"+(g?JSON.stringify(e.data):c(e.data))),i.open(m,u);var b=e.crossDomain&&-1!==[\"GET\",\"POST\",\"HEAD\"].indexOf(m);if(y){v=g&&!b?\"object\"==typeof e.data?JSON.stringify(e.data):e.data:c(e.data);var w=g&&!b?\"application/json\":\"application/x-www-form-urlencoded\";i.setRequestHeader(\"Content-Type\",w)}else i.setRequestHeader(\"Content-Type\",e.contentType);return b||i.setRequestHeader(\"X-Requested-With\",\"XMLHttpRequest\"),i.send(v),l}}(0,e,0,n)}),define(\"can-util/dom/ajax/ajax\",[\"require\",\"exports\",\"module\",\"can-log/dev/dev\",\"can-ajax\"],function(e,t,n){\"use strict\";e(\"can-log/dev/dev\").warn(\"js/ajax/ajax is deprecated; please use can-ajax instead: https://github.com/canjs/can-ajax\"),n.exports=e(\"can-ajax\")}),define(\"can-globals/location/location\",[\"require\",\"exports\",\"module\",\"can-globals/global/global\",\"can-globals/can-globals-instance\"],function(e,t,n){!function(e,t,n,i){\"use strict\";t(\"can-globals/global/global\");var a=t(\"can-globals/can-globals-instance\");a.define(\"location\",function(){return a.getKeyValue(\"global\").location}),i.exports=a.makeExport(\"location\")}(0,e,0,n)}),define(\"can-globals\",[\"require\",\"exports\",\"module\",\"can-globals/can-globals-instance\",\"can-globals/global/global\",\"can-globals/document/document\",\"can-globals/location/location\",\"can-globals/mutation-observer/mutation-observer\",\"can-globals/is-browser-window/is-browser-window\"],function(e,t,n){!function(e,t,n,i){\"use strict\";var a=t(\"can-globals/can-globals-instance\");t(\"can-globals/global/global\"),t(\"can-globals/document/document\"),t(\"can-globals/location/location\"),t(\"can-globals/mutation-observer/mutation-observer\"),t(\"can-globals/is-browser-window/is-browser-window\"),i.exports=a}(0,e,0,n)}),define(\"can-util/dom/mutation-observer/mutation-observer\",[\"require\",\"exports\",\"module\",\"can-globals\"],function(e,t,n){!function(e,t,n,i){\"use strict\";var a=t(\"can-globals\");i.exports=function(e){return void 0!==e&&a.setKeyValue(\"MutationObserver\",function(){return e}),a.getKeyValue(\"MutationObserver\")}}(0,e,0,n)}),define(\"can-util/dom/dom\",[\"require\",\"exports\",\"module\",\"can-util/dom/ajax/ajax\",\"can-util/dom/attr/attr\",\"can-util/dom/child-nodes/child-nodes\",\"can-util/dom/class-name/class-name\",\"can-util/dom/contains/contains\",\"can-util/dom/data/data\",\"can-util/dom/dispatch/dispatch\",\"can-util/dom/document/document\",\"can-util/dom/events/events\",\"can-util/dom/frag/frag\",\"can-util/dom/fragment/fragment\",\"can-util/dom/is-of-global-document/is-of-global-document\",\"can-util/dom/matches/matches\",\"can-util/dom/mutate/mutate\",\"can-util/dom/mutation-observer/mutation-observer\"],function(e,t,n){!function(e,t,n,i){\"use strict\";i.exports={ajax:t(\"can-util/dom/ajax/ajax\"),attr:t(\"can-util/dom/attr/attr\"),childNodes:t(\"can-util/dom/child-nodes/child-nodes\"),className:t(\"can-util/dom/class-name/class-name\"),contains:t(\"can-util/dom/contains/contains\"),data:t(\"can-util/dom/data/data\"),dispatch:t(\"can-util/dom/dispatch/dispatch\"),document:t(\"can-util/dom/document/document\"),events:t(\"can-util/dom/events/events\"),frag:t(\"can-util/dom/frag/frag\"),fragment:t(\"can-util/dom/fragment/fragment\"),isOfGlobalDocument:t(\"can-util/dom/is-of-global-document/is-of-global-document\"),matches:t(\"can-util/dom/matches/matches\"),mutate:t(\"can-util/dom/mutate/mutate\"),mutationObserver:t(\"can-util/dom/mutation-observer/mutation-observer\")}}(0,e,0,n)}),define(\"can-util/js/is-browser-window/is-browser-window\",[\"require\",\"exports\",\"module\",\"can-globals/is-browser-window/is-browser-window\"],function(e,t,n){!function(e,t,n,i){\"use strict\";i.exports=t(\"can-globals/is-browser-window/is-browser-window\")}(0,e,0,n)}),define(\"can-util/js/is-node/is-node\",function(e,t,n){!function(e,t,n,i){\"use strict\";i.exports=function(){return\"object\"==typeof process&&\"[object process]\"==={}.toString.call(process)}}(0,0,0,n)}),define(\"can-util/js/is-promise/is-promise\",[\"require\",\"exports\",\"module\",\"can-reflect\"],function(e,t,n){\"use strict\";var i=e(\"can-reflect\");n.exports=function(e){return i.isPromise(e)}}),define(\"can-util/js/is-string/is-string\",[\"require\",\"exports\",\"module\",\"can-log/dev/dev\"],function(e,t,n){\"use strict\";var i=e(\"can-log/dev/dev\"),a=!1;n.exports=function(e){return a||(i.warn('js/is-string/is-string is deprecated; use typeof x === \"string\"'),a=!0),\"string\"==typeof e}}),define(\"can-util/js/is-web-worker/is-web-worker\",function(e,t,n){!function(e,t,n,i){\"use strict\";i.exports=function(){return\"undefined\"!=typeof WorkerGlobalScope&&this instanceof WorkerGlobalScope}}(0,0,0,n)}),define(\"can-util/js/js\",[\"require\",\"exports\",\"module\",\"can-assign\",\"can-cid\",\"can-util/js/deep-assign/deep-assign\",\"can-util/js/dev/dev\",\"can-util/js/diff/diff\",\"can-util/js/each/each\",\"can-util/js/global/global\",\"can-util/js/import/import\",\"can-util/js/is-array/is-array\",\"can-util/js/is-array-like/is-array-like\",\"can-util/js/is-browser-window/is-browser-window\",\"can-util/js/is-empty-object/is-empty-object\",\"can-util/js/is-function/is-function\",\"can-util/js/is-node/is-node\",\"can-util/js/is-plain-object/is-plain-object\",\"can-util/js/is-promise/is-promise\",\"can-util/js/is-string/is-string\",\"can-util/js/is-web-worker/is-web-worker\",\"can-util/js/join-uris/join-uris\",\"can-util/js/last/last\",\"can-util/js/make-array/make-array\",\"can-util/js/omit/omit\",\"can-util/js/set-immediate/set-immediate\",\"can-util/js/string/string\",\"can-types\"],function(e,t,n){!function(e,t,n,i){\"use strict\";i.exports={assign:t(\"can-assign\"),cid:t(\"can-cid\"),deepAssign:t(\"can-util/js/deep-assign/deep-assign\"),dev:t(\"can-util/js/dev/dev\"),diff:t(\"can-util/js/diff/diff\"),each:t(\"can-util/js/each/each\"),global:t(\"can-util/js/global/global\"),import:t(\"can-util/js/import/import\"),isArray:t(\"can-util/js/is-array/is-array\"),isArrayLike:t(\"can-util/js/is-array-like/is-array-like\"),isBrowserWindow:t(\"can-util/js/is-browser-window/is-browser-window\"),isEmptyObject:t(\"can-util/js/is-empty-object/is-empty-object\"),isFunction:t(\"can-util/js/is-function/is-function\"),isNode:t(\"can-util/js/is-node/is-node\"),isPlainObject:t(\"can-util/js/is-plain-object/is-plain-object\"),isPromise:t(\"can-util/js/is-promise/is-promise\"),isString:t(\"can-util/js/is-string/is-string\"),isWebWorker:t(\"can-util/js/is-web-worker/is-web-worker\"),joinURIs:t(\"can-util/js/join-uris/join-uris\"),last:t(\"can-util/js/last/last\"),makeArray:t(\"can-util/js/make-array/make-array\"),omit:t(\"can-util/js/omit/omit\"),setImmediate:t(\"can-util/js/set-immediate/set-immediate\"),string:t(\"can-util/js/string/string\"),types:t(\"can-types\")}}(0,e,0,n)}),define(\"can-util\",[\"require\",\"exports\",\"module\",\"can-util/js/deep-assign/deep-assign\",\"can-util/js/omit/omit\",\"can-namespace\",\"can-util/dom/dom\",\"can-util/js/js\"],function(e,t,n){var i=e(\"can-util/js/deep-assign/deep-assign\"),a=e(\"can-util/js/omit/omit\"),r=e(\"can-namespace\");n.exports=i(r,e(\"can-util/dom/dom\"),a(e(\"can-util/js/js\"),[\"cid\",\"types\"]))}),define(\"can-construct-super\",[\"require\",\"exports\",\"module\",\"can-util\",\"can-construct\"],function(e,t,n){!function(e,t,n,i){var a=t(\"can-util\"),r=t(\"can-construct\"),o=Object.prototype.hasOwnProperty,s=a.isFunction,c=/xyz/.test(function(){return this.xyz})?/\\b_super\\b/:/.*/,l=[\"get\",\"set\"],u=function(e,t,n){return function(){var i,a=!1,r=d(this),s=r._super;o.call(this,\"_super\")&&(a=!0,i=this._super,delete this._super),r._super=e[t];var c=n.apply(this,arguments);return r._super=s,a&&(this._super=i),c}};r._defineProperty=function(e,t,n,i){var r=Object.getOwnPropertyDescriptor(t,n);r&&a.each(l,function(e){s(r[e])&&s(i[e])?i[e]=u(r,e,i[e]):s(i[e])||(i[e]=r[e])}),Object.defineProperty(e,n,i)};var d=Object.getPrototypeOf||function(e){return e.__proto__},p=Object.getPropertyDescriptor||function(e,t){if(t in e){for(var n=Object.getOwnPropertyDescriptor(e,t),i=d(e);void 0===n&&null!==i;)n=Object.getOwnPropertyDescriptor(i,t),i=d(i);return n}};r._overwrite=function(e,t,n,i){var a=p(t,n),r=a&&a.value;Object.defineProperty(e,n,{value:s(i)&&s(r)&&c.test(i)?u(t,n,i):i,configurable:!0,enumerable:!0,writable:!0})},i.exports=r}(0,e,0,n)}),define(\"can/ecosystem\",[\"require\",\"exports\",\"module\",\"can-util/namespace\",\"can-construct-super\"],function(e,t,n){var i=e(\"can-util/namespace\");e(\"can-construct-super\"),n.exports=i}),define(\"can/legacy\",[\"require\",\"exports\",\"module\",\"can-util/namespace\",\"can-view-model\"],function(e,t,n){var i=e(\"can-util/namespace\");e(\"can-view-model\"),n.exports=i}),define(\"can/all\",[\"require\",\"exports\",\"module\",\"can-util/namespace\",\"can\",\"can/ecosystem\",\"can/legacy\"],function(e,t,n){var i=e(\"can-util/namespace\");e(\"can\"),e(\"can/ecosystem\"),e(\"can/legacy\"),n.exports=i}),function(e){e._define=e.define,e.define=e.define.orig}(\"object\"==typeof self&&self.Object==Object?self:window);"}}},{"rowIdx":79910,"cells":{"target":{"kind":"string","value":"ajax/libs/react-router/0.9.0/react-router.min.js"},"feat_repo_name":{"kind":"string","value":"ppoffice/cdnjs"},"text":{"kind":"string","value":"!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{var f;\"undefined\"!=typeof window?f=window:\"undefined\"!=typeof global?f=global:\"undefined\"!=typeof self&&(f=self),f.ReactRouter=e()}}(function(){var define;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=\"function\"==typeof require&&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}for(var i=\"function\"==typeof require&&require,o=0;o component should not be rendered directly. You may be missing a wrapper around your list of routes.\")}});module.exports=Route},{\"../utils/withoutProperties\":30}],9:[function(_dereq_,module){function makeMatch(route,params){return{route:route,params:params}}function getRootMatch(matches){return matches[matches.length-1]}function findMatches(path,routes,defaultRoute,notFoundRoute){for(var route,params,matches=null,i=0,len=routes.length;len>i;++i){if(route=routes[i],matches=findMatches(path,route.props.children,route.props.defaultRoute,route.props.notFoundRoute),null!=matches){var rootParams=getRootMatch(matches).params;return params=route.props.paramNames.reduce(function(params,paramName){return params[paramName]=rootParams[paramName],params},{}),matches.unshift(makeMatch(route,params)),matches}if(params=Path.extractParams(route.props.path,path))return[makeMatch(route,params)]}return defaultRoute&&(params=Path.extractParams(defaultRoute.props.path,path))?[makeMatch(defaultRoute,params)]:notFoundRoute&&(params=Path.extractParams(notFoundRoute.props.path,path))?[makeMatch(notFoundRoute,params)]:matches}function hasMatch(matches,match){return matches.some(function(m){if(m.route!==match.route)return!1;for(var property in m.params)if(m.params[property]!==match.params[property])return!1;return!0})}function updateMatchComponents(matches,refs){for(var component,i=0;component=refs.__activeRoute__;)matches[i++].component=component,refs=component.refs}function computeNextState(component,transition,callback){if(component.state.path===transition.path)return callback();var currentMatches=component.state.matches,nextMatches=component.match(transition.path);warning(nextMatches,'No route matches path \"'+transition.path+'\". Make sure you have somewhere in your routes'),nextMatches||(nextMatches=[]);var fromMatches,toMatches;currentMatches.length?(updateMatchComponents(currentMatches,component.refs),fromMatches=currentMatches.filter(function(match){return!hasMatch(nextMatches,match)}),toMatches=nextMatches.filter(function(match){return!hasMatch(currentMatches,match)})):(fromMatches=[],toMatches=nextMatches);var query=Path.extractQuery(transition.path)||{};runTransitionFromHooks(fromMatches,transition,function(error){return error||transition.isAborted?callback(error):void runTransitionToHooks(toMatches,transition,query,function(error){if(error||transition.isAborted)return callback(error);var matches=currentMatches.slice(0,currentMatches.length-fromMatches.length).concat(toMatches),rootMatch=getRootMatch(matches),params=rootMatch&&rootMatch.params||{},routes=matches.map(function(match){return match.route});callback(null,{path:transition.path,matches:matches,activeRoutes:routes,activeParams:params,activeQuery:query})})})}function runTransitionFromHooks(matches,transition,callback){var hooks=reversedArray(matches).map(function(match){return function(){var handler=match.route.props.handler;if(!transition.isAborted&&handler.willTransitionFrom)return handler.willTransitionFrom(transition,match.component);var promise=transition.promise;return delete transition.promise,promise}});runHooks(hooks,callback)}function runTransitionToHooks(matches,transition,query,callback){var hooks=matches.map(function(match){return function(){var handler=match.route.props.handler;!transition.isAborted&&handler.willTransitionTo&&handler.willTransitionTo(transition,match.params,query);var promise=transition.promise;return delete transition.promise,promise}});runHooks(hooks,callback)}function runHooks(hooks,callback){try{var promise=hooks.reduce(function(promise,hook){return promise?promise.then(hook):hook()},null)}catch(error){return callback(error)}promise?promise.then(function(){setTimeout(callback)},function(error){setTimeout(function(){callback(error)})}):callback()}function returnNull(){return null}function computeHandlerProps(matches,query){var handler=returnNull,props={ref:null,params:null,query:null,activeRouteHandler:handler,key:null};return reversedArray(matches).forEach(function(match){var route=match.route;props=Route.getUnreservedProps(route.props),props.ref=\"__activeRoute__\",props.params=match.params,props.query=query,props.activeRouteHandler=handler,route.props.addHandlerKey&&(props.key=Path.injectParams(route.props.path,match.params)),handler=function(props,addedProps){if(arguments.length>2&&\"undefined\"!=typeof arguments[2])throw new Error(\"Passing children to a route handler is not supported\");return route.props.handler(copyProperties(props,addedProps))}.bind(this,props)}),props}var React=\"undefined\"!=typeof window?window.React:\"undefined\"!=typeof global?global.React:null,warning=_dereq_(\"react/lib/warning\"),invariant=_dereq_(\"react/lib/invariant\"),canUseDOM=_dereq_(\"react/lib/ExecutionEnvironment\").canUseDOM,copyProperties=_dereq_(\"react/lib/copyProperties\"),PathStore=_dereq_(\"../stores/PathStore\"),HashLocation=_dereq_(\"../locations/HashLocation\"),reversedArray=_dereq_(\"../utils/reversedArray\"),Transition=_dereq_(\"../utils/Transition\"),Redirect=_dereq_(\"../utils/Redirect\"),Path=_dereq_(\"../utils/Path\"),Route=_dereq_(\"./Route\"),BrowserTransitionHandling={handleTransitionError:function(component,error){throw error},handleAbortedTransition:function(component,transition){var reason=transition.abortReason;reason instanceof Redirect?component.replaceWith(reason.to,reason.params,reason.query):component.goBack()}},ServerTransitionHandling={handleTransitionError:function(){},handleAbortedTransition:function(){}},TransitionHandling=canUseDOM?BrowserTransitionHandling:ServerTransitionHandling,ActiveContext=_dereq_(\"../mixins/ActiveContext\"),LocationContext=_dereq_(\"../mixins/LocationContext\"),RouteContext=_dereq_(\"../mixins/RouteContext\"),ScrollContext=_dereq_(\"../mixins/ScrollContext\"),Routes=React.createClass({displayName:\"Routes\",mixins:[ActiveContext,LocationContext,RouteContext,ScrollContext],propTypes:{initialPath:React.PropTypes.string,onChange:React.PropTypes.func},getInitialState:function(){return{matches:[]}},componentWillMount:function(){this.handlePathChange(this.props.initialPath)},componentDidMount:function(){PathStore.addChangeListener(this.handlePathChange)},componentWillUnmount:function(){PathStore.removeChangeListener(this.handlePathChange)},handlePathChange:function(_path){var path=_path||PathStore.getCurrentPath(),actionType=PathStore.getCurrentActionType();if(this.state.path!==path){this.state.path&&this.recordScroll(this.state.path);var self=this;this.dispatch(path,function(error,transition){error?TransitionHandling.handleTransitionError(self,error):transition.isAborted?TransitionHandling.handleAbortedTransition(self,transition):(self.updateScroll(path,actionType),self.props.onChange&&self.props.onChange.call(self))})}},match:function(path){return findMatches(Path.withoutQuery(path),this.getRoutes(),this.props.defaultRoute,this.props.notFoundRoute)},dispatch:function(path,callback){var transition=new Transition(this,path),self=this;computeNextState(this,transition,function(error,nextState){return error||null==nextState?callback(error,transition):void self.setState(nextState,function(){callback(null,transition)})})},getHandlerProps:function(){return computeHandlerProps(this.state.matches,this.state.activeQuery)},getActiveComponent:function(){return this.refs.__activeRoute__},getCurrentPath:function(){return this.state.path},makePath:function(to,params,query){var path;if(Path.isAbsolute(to))path=Path.normalize(to);else{var namedRoutes=this.getNamedRoutes(),route=namedRoutes[to];invariant(route,'Unable to find a route named \"'+to+'\". Make sure you have a defined somewhere in your '),path=route.props.path}return Path.withQuery(Path.injectParams(path,params),query)},makeHref:function(to,params,query){var path=this.makePath(to,params,query);return this.getLocation()===HashLocation?\"#\"+path:path},transitionTo:function(to,params,query){var location=this.getLocation();invariant(location,\"You cannot use transitionTo without a location\"),location.push(this.makePath(to,params,query))},replaceWith:function(to,params,query){var location=this.getLocation();invariant(location,\"You cannot use replaceWith without a location\"),location.replace(this.makePath(to,params,query))},goBack:function(){var location=this.getLocation();invariant(location,\"You cannot use goBack without a location\"),location.pop()},render:function(){var match=this.state.matches[0];return null==match?null:match.route.props.handler(this.getHandlerProps())},childContextTypes:{currentPath:React.PropTypes.string,makePath:React.PropTypes.func.isRequired,makeHref:React.PropTypes.func.isRequired,transitionTo:React.PropTypes.func.isRequired,replaceWith:React.PropTypes.func.isRequired,goBack:React.PropTypes.func.isRequired},getChildContext:function(){return{currentPath:this.getCurrentPath(),makePath:this.makePath,makeHref:this.makeHref,transitionTo:this.transitionTo,replaceWith:this.replaceWith,goBack:this.goBack}}});module.exports=Routes},{\"../locations/HashLocation\":12,\"../mixins/ActiveContext\":15,\"../mixins/LocationContext\":18,\"../mixins/RouteContext\":20,\"../mixins/ScrollContext\":21,\"../stores/PathStore\":22,\"../utils/Path\":23,\"../utils/Redirect\":25,\"../utils/Transition\":26,\"../utils/reversedArray\":28,\"./Route\":8,\"react/lib/ExecutionEnvironment\":40,\"react/lib/copyProperties\":41,\"react/lib/invariant\":43,\"react/lib/warning\":49}],10:[function(_dereq_,module){var copyProperties=_dereq_(\"react/lib/copyProperties\"),Dispatcher=_dereq_(\"flux\").Dispatcher,LocationDispatcher=copyProperties(new Dispatcher,{handleViewAction:function(action){this.dispatch({source:\"VIEW_ACTION\",action:action})}});module.exports=LocationDispatcher},{flux:32,\"react/lib/copyProperties\":41}],11:[function(_dereq_,module,exports){exports.DefaultRoute=_dereq_(\"./components/DefaultRoute\"),exports.Link=_dereq_(\"./components/Link\"),exports.NotFoundRoute=_dereq_(\"./components/NotFoundRoute\"),exports.Redirect=_dereq_(\"./components/Redirect\"),exports.Route=_dereq_(\"./components/Route\"),exports.Routes=_dereq_(\"./components/Routes\"),exports.ActiveState=_dereq_(\"./mixins/ActiveState\"),exports.CurrentPath=_dereq_(\"./mixins/CurrentPath\"),exports.Navigation=_dereq_(\"./mixins/Navigation\")},{\"./components/DefaultRoute\":4,\"./components/Link\":5,\"./components/NotFoundRoute\":6,\"./components/Redirect\":7,\"./components/Route\":8,\"./components/Routes\":9,\"./mixins/ActiveState\":16,\"./mixins/CurrentPath\":17,\"./mixins/Navigation\":19}],12:[function(_dereq_,module){function getHashPath(){return window.location.hash.substr(1)}function ensureSlash(){var path=getHashPath();return\"/\"===path.charAt(0)?!0:(HashLocation.replace(\"/\"+path),!1)}function onHashChange(){if(ensureSlash()){{getHashPath()}LocationDispatcher.handleViewAction({type:_actionType||LocationActions.POP,path:getHashPath()}),_actionType=null}}var _actionType,invariant=_dereq_(\"react/lib/invariant\"),canUseDOM=_dereq_(\"react/lib/ExecutionEnvironment\").canUseDOM,LocationActions=_dereq_(\"../actions/LocationActions\"),LocationDispatcher=_dereq_(\"../dispatchers/LocationDispatcher\"),getWindowPath=_dereq_(\"../utils/getWindowPath\"),_isSetup=!1,HashLocation={setup:function(){_isSetup||(invariant(canUseDOM,\"You cannot use HashLocation in an environment with no DOM\"),ensureSlash(),LocationDispatcher.handleViewAction({type:LocationActions.SETUP,path:getHashPath()}),window.addEventListener?window.addEventListener(\"hashchange\",onHashChange,!1):window.attachEvent(\"onhashchange\",onHashChange),_isSetup=!0)},teardown:function(){window.removeEventListener?window.removeEventListener(\"hashchange\",onHashChange,!1):window.detachEvent(\"onhashchange\",onHashChange),_isSetup=!1},push:function(path){_actionType=LocationActions.PUSH,window.location.hash=path},replace:function(path){_actionType=LocationActions.REPLACE,window.location.replace(getWindowPath()+\"#\"+path)},pop:function(){_actionType=LocationActions.POP,window.history.back()},toString:function(){return\"\"}};module.exports=HashLocation},{\"../actions/LocationActions\":1,\"../dispatchers/LocationDispatcher\":10,\"../utils/getWindowPath\":27,\"react/lib/ExecutionEnvironment\":40,\"react/lib/invariant\":43}],13:[function(_dereq_,module){function onPopState(){LocationDispatcher.handleViewAction({type:LocationActions.POP,path:getWindowPath()})}var invariant=_dereq_(\"react/lib/invariant\"),canUseDOM=_dereq_(\"react/lib/ExecutionEnvironment\").canUseDOM,LocationActions=_dereq_(\"../actions/LocationActions\"),LocationDispatcher=_dereq_(\"../dispatchers/LocationDispatcher\"),getWindowPath=_dereq_(\"../utils/getWindowPath\"),_isSetup=!1,HistoryLocation={setup:function(){_isSetup||(invariant(canUseDOM,\"You cannot use HistoryLocation in an environment with no DOM\"),LocationDispatcher.handleViewAction({type:LocationActions.SETUP,path:getWindowPath()}),window.addEventListener?window.addEventListener(\"popstate\",onPopState,!1):window.attachEvent(\"popstate\",onPopState),_isSetup=!0)},teardown:function(){window.removeEventListener?window.removeEventListener(\"popstate\",onPopState,!1):window.detachEvent(\"popstate\",onPopState),_isSetup=!1},push:function(path){window.history.pushState({path:path},\"\",path),LocationDispatcher.handleViewAction({type:LocationActions.PUSH,path:getWindowPath()})},replace:function(path){window.history.replaceState({path:path},\"\",path),LocationDispatcher.handleViewAction({type:LocationActions.REPLACE,path:getWindowPath()})},pop:function(){window.history.back()},toString:function(){return\"\"}};module.exports=HistoryLocation},{\"../actions/LocationActions\":1,\"../dispatchers/LocationDispatcher\":10,\"../utils/getWindowPath\":27,\"react/lib/ExecutionEnvironment\":40,\"react/lib/invariant\":43}],14:[function(_dereq_,module){var invariant=_dereq_(\"react/lib/invariant\"),canUseDOM=_dereq_(\"react/lib/ExecutionEnvironment\").canUseDOM,LocationActions=_dereq_(\"../actions/LocationActions\"),LocationDispatcher=_dereq_(\"../dispatchers/LocationDispatcher\"),getWindowPath=_dereq_(\"../utils/getWindowPath\"),RefreshLocation={setup:function(){invariant(canUseDOM,\"You cannot use RefreshLocation in an environment with no DOM\"),LocationDispatcher.handleViewAction({type:LocationActions.SETUP,path:getWindowPath()})},push:function(path){window.location=path},replace:function(path){window.location.replace(path)},pop:function(){window.history.back()},toString:function(){return\"\"}};module.exports=RefreshLocation},{\"../actions/LocationActions\":1,\"../dispatchers/LocationDispatcher\":10,\"../utils/getWindowPath\":27,\"react/lib/ExecutionEnvironment\":40,\"react/lib/invariant\":43}],15:[function(_dereq_,module){function routeIsActive(activeRoutes,routeName){return activeRoutes.some(function(route){return route.props.name===routeName})}function paramsAreActive(activeParams,params){for(var property in params)if(String(activeParams[property])!==String(params[property]))return!1;return!0}function queryIsActive(activeQuery,query){for(var property in query)if(String(activeQuery[property])!==String(query[property]))return!1;return!0}var React=\"undefined\"!=typeof window?window.React:\"undefined\"!=typeof global?global.React:null,copyProperties=_dereq_(\"react/lib/copyProperties\"),ActiveContext={propTypes:{initialActiveState:React.PropTypes.object},getDefaultProps:function(){return{initialActiveState:{}}},getInitialState:function(){var state=this.props.initialActiveState;return{activeRoutes:state.activeRoutes||[],activeParams:state.activeParams||{},activeQuery:state.activeQuery||{}}},getActiveRoutes:function(){return this.state.activeRoutes.slice(0)},getActiveParams:function(){return copyProperties({},this.state.activeParams)},getActiveQuery:function(){return copyProperties({},this.state.activeQuery)},isActive:function(routeName,params,query){var isActive=routeIsActive(this.state.activeRoutes,routeName)&&paramsAreActive(this.state.activeParams,params);return query?isActive&&queryIsActive(this.state.activeQuery,query):isActive},childContextTypes:{activeRoutes:React.PropTypes.array.isRequired,activeParams:React.PropTypes.object.isRequired,activeQuery:React.PropTypes.object.isRequired,isActive:React.PropTypes.func.isRequired},getChildContext:function(){return{activeRoutes:this.getActiveRoutes(),activeParams:this.getActiveParams(),activeQuery:this.getActiveQuery(),isActive:this.isActive}}};module.exports=ActiveContext},{\"react/lib/copyProperties\":41}],16:[function(_dereq_,module){var React=\"undefined\"!=typeof window?window.React:\"undefined\"!=typeof global?global.React:null,ActiveState={contextTypes:{activeRoutes:React.PropTypes.array.isRequired,activeParams:React.PropTypes.object.isRequired,activeQuery:React.PropTypes.object.isRequired,isActive:React.PropTypes.func.isRequired},getActiveRoutes:function(){return this.context.activeRoutes},getActiveParams:function(){return this.context.activeParams},getActiveQuery:function(){return this.context.activeQuery},isActive:function(to,params,query){return this.context.isActive(to,params,query)}};module.exports=ActiveState},{}],17:[function(_dereq_,module){var React=\"undefined\"!=typeof window?window.React:\"undefined\"!=typeof global?global.React:null,CurrentPath={contextTypes:{currentPath:React.PropTypes.string.isRequired},getCurrentPath:function(){return this.context.currentPath}};module.exports=CurrentPath},{}],18:[function(_dereq_,module){var React=\"undefined\"!=typeof window?window.React:\"undefined\"!=typeof global?global.React:null,invariant=_dereq_(\"react/lib/invariant\"),canUseDOM=_dereq_(\"react/lib/ExecutionEnvironment\").canUseDOM,HashLocation=_dereq_(\"../locations/HashLocation\"),HistoryLocation=_dereq_(\"../locations/HistoryLocation\"),RefreshLocation=_dereq_(\"../locations/RefreshLocation\"),supportsHistory=_dereq_(\"../utils/supportsHistory\"),NAMED_LOCATIONS={none:null,hash:HashLocation,history:HistoryLocation,refresh:RefreshLocation},LocationContext={propTypes:{location:function(props,propName,componentName){var location=props[propName];return\"string\"!=typeof location||location in NAMED_LOCATIONS?void 0:new Error('Unknown location \"'+location+'\", see '+componentName)}},getDefaultProps:function(){return{location:canUseDOM?HashLocation:null}},getInitialState:function(){var location=this.props.location;return\"string\"==typeof location&&(location=NAMED_LOCATIONS[location]),location!==HistoryLocation||supportsHistory()||(location=RefreshLocation),{location:location}},componentWillMount:function(){var location=this.getLocation();invariant(null==location||canUseDOM,\"Cannot use location without a DOM\"),location&&location.setup&&location.setup()},getLocation:function(){return this.state.location},childContextTypes:{location:React.PropTypes.object},getChildContext:function(){return{location:this.getLocation()}}};module.exports=LocationContext},{\"../locations/HashLocation\":12,\"../locations/HistoryLocation\":13,\"../locations/RefreshLocation\":14,\"../utils/supportsHistory\":29,\"react/lib/ExecutionEnvironment\":40,\"react/lib/invariant\":43}],19:[function(_dereq_,module){var React=\"undefined\"!=typeof window?window.React:\"undefined\"!=typeof global?global.React:null,Navigation={contextTypes:{makePath:React.PropTypes.func.isRequired,makeHref:React.PropTypes.func.isRequired,transitionTo:React.PropTypes.func.isRequired,replaceWith:React.PropTypes.func.isRequired,goBack:React.PropTypes.func.isRequired},makePath:function(to,params,query){return this.context.makePath(to,params,query)},makeHref:function(to,params,query){return this.context.makeHref(to,params,query)},transitionTo:function(to,params,query){this.context.transitionTo(to,params,query)},replaceWith:function(to,params,query){this.context.replaceWith(to,params,query)},goBack:function(){this.context.goBack()}};module.exports=Navigation},{}],20:[function(_dereq_,module){function processRoute(route,container,namedRoutes){var props=route.props;invariant(React.isValidClass(props.handler),'The handler for the \"%s\" route must be a valid React class',props.name||props.path);var parentPath=container&&container.props.path||\"/\";if(!props.path&&!props.name||props.isDefault||props.catchAll)props.path=parentPath,props.catchAll&&(props.path+=\"*\");else{var path=props.path||props.name;Path.isAbsolute(path)||(path=Path.join(parentPath,path)),props.path=Path.normalize(path)}if(props.paramNames=Path.extractParamNames(props.path),container&&Array.isArray(container.props.paramNames)&&container.props.paramNames.forEach(function(paramName){invariant(-1!==props.paramNames.indexOf(paramName),'The nested route path \"%s\" is missing the \"%s\" parameter of its parent path \"%s\"',props.path,paramName,container.props.path)}),props.name){var existingRoute=namedRoutes[props.name];invariant(!existingRoute||route===existingRoute,'You cannot use the name \"%s\" for more than one route',props.name),namedRoutes[props.name]=route}return props.catchAll?(invariant(container,\" must have a parent \"),invariant(null==container.props.notFoundRoute,\"You may not have more than one per \"),container.props.notFoundRoute=route,null):props.isDefault?(invariant(container,\" must have a parent \"),invariant(null==container.props.defaultRoute,\"You may not have more than one per \"),container.props.defaultRoute=route,null):(props.children=processRoutes(props.children,route,namedRoutes),route)}function processRoutes(children,container,namedRoutes){var routes=[];return React.Children.forEach(children,function(child){(child=processRoute(child,container,namedRoutes))&&routes.push(child)}),routes}var React=\"undefined\"!=typeof window?window.React:\"undefined\"!=typeof global?global.React:null,invariant=_dereq_(\"react/lib/invariant\"),Path=_dereq_(\"../utils/Path\"),RouteContext={getInitialState:function(){var namedRoutes={};return{routes:processRoutes(this.props.children,this,namedRoutes),namedRoutes:namedRoutes}},getRoutes:function(){return this.state.routes},getNamedRoutes:function(){return this.state.namedRoutes},getRouteByName:function(routeName){return this.state.namedRoutes[routeName]||null},childContextTypes:{routes:React.PropTypes.array.isRequired,namedRoutes:React.PropTypes.object.isRequired},getChildContext:function(){return{routes:this.getRoutes(),namedRoutes:this.getNamedRoutes()}}};module.exports=RouteContext},{\"../utils/Path\":23,\"react/lib/invariant\":43}],21:[function(_dereq_,module){function getWindowScrollPosition(){return invariant(canUseDOM,\"Cannot get current scroll position without a DOM\"),{x:window.scrollX,y:window.scrollY}}var React=\"undefined\"!=typeof window?window.React:\"undefined\"!=typeof global?global.React:null,invariant=_dereq_(\"react/lib/invariant\"),canUseDOM=_dereq_(\"react/lib/ExecutionEnvironment\").canUseDOM,ImitateBrowserBehavior=_dereq_(\"../behaviors/ImitateBrowserBehavior\"),ScrollToTopBehavior=_dereq_(\"../behaviors/ScrollToTopBehavior\"),NAMED_SCROLL_BEHAVIORS={none:null,browser:ImitateBrowserBehavior,imitateBrowser:ImitateBrowserBehavior,scrollToTop:ScrollToTopBehavior},ScrollContext={propTypes:{scrollBehavior:function(props,propName,componentName){var behavior=props[propName];return\"string\"!=typeof behavior||behavior in NAMED_SCROLL_BEHAVIORS?void 0:new Error('Unknown scroll behavior \"'+behavior+'\", see '+componentName)}},getDefaultProps:function(){return{scrollBehavior:canUseDOM?ImitateBrowserBehavior:null}},getInitialState:function(){var behavior=this.props.scrollBehavior;return\"string\"==typeof behavior&&(behavior=NAMED_SCROLL_BEHAVIORS[behavior]),{scrollBehavior:behavior}},componentWillMount:function(){var behavior=this.getScrollBehavior();invariant(null==behavior||canUseDOM,\"Cannot use scroll behavior without a DOM\"),null!=behavior&&(this._scrollPositions={})},recordScroll:function(path){this._scrollPositions&&(this._scrollPositions[path]=getWindowScrollPosition())},updateScroll:function(path,actionType){var behavior=this.getScrollBehavior(),position=this._scrollPositions[path];behavior&&position&&behavior.updateScrollPosition(position,actionType)},getScrollBehavior:function(){return this.state.scrollBehavior},childContextTypes:{scrollBehavior:React.PropTypes.object},getChildContext:function(){return{scrollBehavior:this.getScrollBehavior()}}};module.exports=ScrollContext},{\"../behaviors/ImitateBrowserBehavior\":2,\"../behaviors/ScrollToTopBehavior\":3,\"react/lib/ExecutionEnvironment\":40,\"react/lib/invariant\":43}],22:[function(_dereq_,module){function notifyChange(){_events.emit(CHANGE_EVENT)}var _currentPath,_currentActionType,EventEmitter=_dereq_(\"events\").EventEmitter,LocationActions=_dereq_(\"../actions/LocationActions\"),LocationDispatcher=_dereq_(\"../dispatchers/LocationDispatcher\"),CHANGE_EVENT=\"change\",_events=new EventEmitter,PathStore={addChangeListener:function(listener){_events.addListener(CHANGE_EVENT,listener)},removeChangeListener:function(listener){_events.removeListener(CHANGE_EVENT,listener)},removeAllChangeListeners:function(){_events.removeAllListeners(CHANGE_EVENT)},getCurrentPath:function(){return _currentPath},getCurrentActionType:function(){return _currentActionType},dispatchToken:LocationDispatcher.register(function(payload){var action=payload.action;switch(action.type){case LocationActions.SETUP:case LocationActions.PUSH:case LocationActions.REPLACE:case LocationActions.POP:_currentPath!==action.path&&(_currentPath=action.path,_currentActionType=action.type,notifyChange())}})};module.exports=PathStore},{\"../actions/LocationActions\":1,\"../dispatchers/LocationDispatcher\":10,events:31}],23:[function(_dereq_,module){function encodeURL(url){return encodeURIComponent(url).replace(/%20/g,\"+\")}function decodeURL(url){return decodeURIComponent(url.replace(/\\+/g,\" \"))}function encodeURLPath(path){return String(path).split(\"/\").map(encodeURL).join(\"/\")}function compilePattern(pattern){if(!(pattern in _compiledPatterns)){var paramNames=[],source=pattern.replace(paramMatcher,function(match,paramName){return paramName?(paramNames.push(paramName),\"([^/?#]+)\"):\"*\"===match?(paramNames.push(\"splat\"),\"(.*?)\"):\"\\\\\"+match});_compiledPatterns[pattern]={matcher:new RegExp(\"^\"+source+\"$\",\"i\"),paramNames:paramNames}}return _compiledPatterns[pattern]}var invariant=_dereq_(\"react/lib/invariant\"),merge=_dereq_(\"qs/lib/utils\").merge,qs=_dereq_(\"qs\"),paramMatcher=/:([a-zA-Z_$][a-zA-Z0-9_$]*)|[*.()\\[\\]\\\\+|{}^$]/g,queryMatcher=/\\?(.+)/,_compiledPatterns={},Path={extractParamNames:function(pattern){return compilePattern(pattern).paramNames},extractParams:function(pattern,path){var object=compilePattern(pattern),match=decodeURL(path).match(object.matcher);if(!match)return null;var params={};return object.paramNames.forEach(function(paramName,index){params[paramName]=match[index+1]}),params},injectParams:function(pattern,params){params=params||{};var splatIndex=0;return pattern.replace(paramMatcher,function(match,paramName){paramName=paramName||\"splat\",invariant(null!=params[paramName],'Missing \"'+paramName+'\" parameter for path \"'+pattern+'\"');var segment;return\"splat\"===paramName&&Array.isArray(params[paramName])?(segment=params[paramName][splatIndex++],invariant(null!=segment,\"Missing splat # \"+splatIndex+' for path \"'+pattern+'\"')):segment=params[paramName],encodeURLPath(segment)})},extractQuery:function(path){var match=decodeURL(path).match(queryMatcher);return match&&qs.parse(match[1])},withoutQuery:function(path){return path.replace(queryMatcher,\"\")},withQuery:function(path,query){var existingQuery=Path.extractQuery(path);existingQuery&&(query=query?merge(existingQuery,query):existingQuery);\nvar queryString=query&&qs.stringify(query);return queryString?Path.withoutQuery(path)+\"?\"+queryString:path},isAbsolute:function(path){return\"/\"===path.charAt(0)},normalize:function(path){return path.replace(/^\\/*/,\"/\")},join:function(a,b){return a.replace(/\\/*$/,\"/\")+b}};module.exports=Path},{qs:35,\"qs/lib/utils\":39,\"react/lib/invariant\":43}],24:[function(_dereq_,module){var Promise=_dereq_(\"when/lib/Promise\");module.exports=Promise},{\"when/lib/Promise\":50}],25:[function(_dereq_,module){function Redirect(to,params,query){this.to=to,this.params=params,this.query=query}module.exports=Redirect},{}],26:[function(_dereq_,module){function Transition(routesComponent,path){this.routesComponent=routesComponent,this.path=path,this.abortReason=null,this.isAborted=!1}var mixInto=_dereq_(\"react/lib/mixInto\"),Promise=_dereq_(\"./Promise\"),Redirect=_dereq_(\"./Redirect\");mixInto(Transition,{abort:function(reason){this.abortReason=reason,this.isAborted=!0},redirect:function(to,params,query){this.abort(new Redirect(to,params,query))},wait:function(value){this.promise=Promise.resolve(value)},retry:function(){this.routesComponent.replaceWith(this.path)}}),module.exports=Transition},{\"./Promise\":24,\"./Redirect\":25,\"react/lib/mixInto\":48}],27:[function(_dereq_,module){function getWindowPath(){return window.location.pathname+window.location.search}module.exports=getWindowPath},{}],28:[function(_dereq_,module){function reversedArray(array){return array.slice(0).reverse()}module.exports=reversedArray},{}],29:[function(_dereq_,module){function supportsHistory(){var ua=navigator.userAgent;return-1===ua.indexOf(\"Android 2.\")&&-1===ua.indexOf(\"Android 4.0\")||-1===ua.indexOf(\"Mobile Safari\")||-1!==ua.indexOf(\"Chrome\")?window.history&&\"pushState\"in window.history:!1}module.exports=supportsHistory},{}],30:[function(_dereq_,module){function withoutProperties(object,properties){var result={};for(var property in object)object.hasOwnProperty(property)&&!properties[property]&&(result[property]=object[property]);return result}module.exports=withoutProperties},{}],31:[function(_dereq_,module){function EventEmitter(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function isFunction(arg){return\"function\"==typeof arg}function isNumber(arg){return\"number\"==typeof arg}function isObject(arg){return\"object\"==typeof arg&&null!==arg}function isUndefined(arg){return void 0===arg}module.exports=EventEmitter,EventEmitter.EventEmitter=EventEmitter,EventEmitter.prototype._events=void 0,EventEmitter.prototype._maxListeners=void 0,EventEmitter.defaultMaxListeners=10,EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||0>n||isNaN(n))throw TypeError(\"n must be a positive number\");return this._maxListeners=n,this},EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(this._events||(this._events={}),\"error\"===type&&(!this._events.error||isObject(this._events.error)&&!this._events.error.length))throw er=arguments[1],er instanceof Error?er:TypeError('Uncaught, unspecified \"error\" event.');if(handler=this._events[type],isUndefined(handler))return!1;if(isFunction(handler))switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:for(len=arguments.length,args=new Array(len-1),i=1;len>i;i++)args[i-1]=arguments[i];handler.apply(this,args)}else if(isObject(handler)){for(len=arguments.length,args=new Array(len-1),i=1;len>i;i++)args[i-1]=arguments[i];for(listeners=handler.slice(),len=listeners.length,i=0;len>i;i++)listeners[i].apply(this,args)}return!0},EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError(\"listener must be a function\");if(this._events||(this._events={}),this._events.newListener&&this.emit(\"newListener\",type,isFunction(listener.listener)?listener.listener:listener),this._events[type]?isObject(this._events[type])?this._events[type].push(listener):this._events[type]=[this._events[type],listener]:this._events[type]=listener,isObject(this._events[type])&&!this._events[type].warned){var m;m=isUndefined(this._maxListeners)?EventEmitter.defaultMaxListeners:this._maxListeners,m&&m>0&&this._events[type].length>m&&(this._events[type].warned=!0,console.error(\"(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.\",this._events[type].length),\"function\"==typeof console.trace&&console.trace())}return this},EventEmitter.prototype.on=EventEmitter.prototype.addListener,EventEmitter.prototype.once=function(type,listener){function g(){this.removeListener(type,g),fired||(fired=!0,listener.apply(this,arguments))}if(!isFunction(listener))throw TypeError(\"listener must be a function\");var fired=!1;return g.listener=listener,this.on(type,g),this},EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError(\"listener must be a function\");if(!this._events||!this._events[type])return this;if(list=this._events[type],length=list.length,position=-1,list===listener||isFunction(list.listener)&&list.listener===listener)delete this._events[type],this._events.removeListener&&this.emit(\"removeListener\",type,listener);else if(isObject(list)){for(i=length;i-->0;)if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}if(0>position)return this;1===list.length?(list.length=0,delete this._events[type]):list.splice(position,1),this._events.removeListener&&this.emit(\"removeListener\",type,listener)}return this},EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[type]&&delete this._events[type],this;if(0===arguments.length){for(key in this._events)\"removeListener\"!==key&&this.removeAllListeners(key);return this.removeAllListeners(\"removeListener\"),this._events={},this}if(listeners=this._events[type],isFunction(listeners))this.removeListener(type,listeners);else for(;listeners.length;)this.removeListener(type,listeners[listeners.length-1]);return delete this._events[type],this},EventEmitter.prototype.listeners=function(type){var ret;return ret=this._events&&this._events[type]?isFunction(this._events[type])?[this._events[type]]:this._events[type].slice():[]},EventEmitter.listenerCount=function(emitter,type){var ret;return ret=emitter._events&&emitter._events[type]?isFunction(emitter._events[type])?1:emitter._events[type].length:0}},{}],32:[function(_dereq_,module){module.exports.Dispatcher=_dereq_(\"./lib/Dispatcher\")},{\"./lib/Dispatcher\":33}],33:[function(_dereq_,module){\"use strict\";function Dispatcher(){this.$Dispatcher_callbacks={},this.$Dispatcher_isPending={},this.$Dispatcher_isHandled={},this.$Dispatcher_isDispatching=!1,this.$Dispatcher_pendingPayload=null}var invariant=_dereq_(\"./invariant\"),_lastID=1,_prefix=\"ID_\";Dispatcher.prototype.register=function(callback){var id=_prefix+_lastID++;return this.$Dispatcher_callbacks[id]=callback,id},Dispatcher.prototype.unregister=function(id){invariant(this.$Dispatcher_callbacks[id],\"Dispatcher.unregister(...): `%s` does not map to a registered callback.\",id),delete this.$Dispatcher_callbacks[id]},Dispatcher.prototype.waitFor=function(ids){invariant(this.$Dispatcher_isDispatching,\"Dispatcher.waitFor(...): Must be invoked while dispatching.\");for(var ii=0;iii;++i){var part=parts[i],pos=-1===part.indexOf(\"]=\")?part.indexOf(\"=\"):part.indexOf(\"]=\")+1;if(-1===pos)obj[Utils.decode(part)]=\"\";else{var key=Utils.decode(part.slice(0,pos)),val=Utils.decode(part.slice(pos+1));obj[key]=obj[key]?[].concat(obj[key]).concat(val):val}}return obj},internals.parseObject=function(chain,val,options){if(!chain.length)return val;var root=chain.shift(),obj={};if(\"[]\"===root)obj=[],obj=obj.concat(internals.parseObject(chain,val,options));else{var cleanRoot=\"[\"===root[0]&&\"]\"===root[root.length-1]?root.slice(1,root.length-1):root,index=parseInt(cleanRoot,10);!isNaN(index)&&root!==cleanRoot&&index<=options.arrayLimit?(obj=[],obj[index]=internals.parseObject(chain,val,options)):obj[cleanRoot]=internals.parseObject(chain,val,options)}return obj},internals.parseKeys=function(key,val,options){if(key){var parent=/^([^\\[\\]]*)/,child=/(\\[[^\\[\\]]*\\])/g,segment=parent.exec(key);if(!Object.prototype.hasOwnProperty(segment[1])){var keys=[];segment[1]&&keys.push(segment[1]);for(var i=0;null!==(segment=child.exec(key))&&ii;++i){var key=keys[i],newObj=internals.parseKeys(key,tempObj[key],options);obj=Utils.merge(obj,newObj)}return Utils.compact(obj)}},{\"./utils\":39}],38:[function(_dereq_,module){var Utils=_dereq_(\"./utils\"),internals={delimiter:\"&\"};internals.stringify=function(obj,prefix){if(Utils.isBuffer(obj)?obj=obj.toString():obj instanceof Date?obj=obj.toISOString():null===obj&&(obj=\"\"),\"string\"==typeof obj||\"number\"==typeof obj||\"boolean\"==typeof obj)return[encodeURIComponent(prefix)+\"=\"+encodeURIComponent(obj)];var values=[];for(var key in obj)obj.hasOwnProperty(key)&&(values=values.concat(internals.stringify(obj[key],prefix+\"[\"+key+\"]\")));return values},module.exports=function(obj,options){options=options||{};var delimiter=\"undefined\"==typeof options.delimiter?internals.delimiter:options.delimiter,keys=[];for(var key in obj)obj.hasOwnProperty(key)&&(keys=keys.concat(internals.stringify(obj[key],key)));return keys.join(delimiter)}},{\"./utils\":39}],39:[function(_dereq_,module,exports){exports.arrayToObject=function(source){for(var obj={},i=0,il=source.length;il>i;++i)\"undefined\"!=typeof source[i]&&(obj[i]=source[i]);return obj},exports.merge=function(target,source){if(!source)return target;if(Array.isArray(source)){for(var i=0,il=source.length;il>i;++i)\"undefined\"!=typeof source[i]&&(target[i]=\"object\"==typeof target[i]?exports.merge(target[i],source[i]):source[i]);return target}if(Array.isArray(target)){if(\"object\"!=typeof source)return target.push(source),target;target=exports.arrayToObject(target)}for(var keys=Object.keys(source),k=0,kl=keys.length;kl>k;++k){var key=keys[k],value=source[key];target[key]=value&&\"object\"==typeof value&&target[key]?exports.merge(target[key],value):value}return target},exports.decode=function(str){try{return decodeURIComponent(str.replace(/\\+/g,\" \"))}catch(e){return str}},exports.compact=function(obj,refs){if(\"object\"!=typeof obj||null===obj)return obj;refs=refs||[];var lookup=refs.indexOf(obj);if(-1!==lookup)return refs[lookup];if(refs.push(obj),Array.isArray(obj)){for(var compacted=[],i=0,l=obj.length;l>i;++i)\"undefined\"!=typeof obj[i]&&compacted.push(obj[i]);return compacted}for(var keys=Object.keys(obj),i=0,il=keys.length;il>i;++i){var key=keys[i];obj[key]=exports.compact(obj[key],refs)}return obj},exports.isRegExp=function(obj){return\"[object RegExp]\"===Object.prototype.toString.call(obj)},exports.isBuffer=function(obj){return\"undefined\"!=typeof Buffer?Buffer.isBuffer(obj):!1}},{}],40:[function(_dereq_,module){\"use strict\";var canUseDOM=!(\"undefined\"==typeof window||!window.document||!window.document.createElement),ExecutionEnvironment={canUseDOM:canUseDOM,canUseWorkers:\"undefined\"!=typeof Worker,canUseEventListeners:canUseDOM&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:canUseDOM&&!!window.screen,isInWorker:!canUseDOM};module.exports=ExecutionEnvironment},{}],41:[function(_dereq_,module){function copyProperties(obj,a,b,c,d,e,f){obj=obj||{};for(var v,args=[a,b,c,d,e],ii=0;args[ii];){v=args[ii++];for(var k in v)obj[k]=v[k];v.hasOwnProperty&&v.hasOwnProperty(\"toString\")&&\"undefined\"!=typeof v.toString&&obj.toString!==v.toString&&(obj.toString=v.toString)}return obj}module.exports=copyProperties},{}],42:[function(_dereq_,module){function makeEmptyFunction(arg){return function(){return arg}}function emptyFunction(){}var copyProperties=_dereq_(\"./copyProperties\");copyProperties(emptyFunction,{thatReturns:makeEmptyFunction,thatReturnsFalse:makeEmptyFunction(!1),thatReturnsTrue:makeEmptyFunction(!0),thatReturnsNull:makeEmptyFunction(null),thatReturnsThis:function(){return this},thatReturnsArgument:function(arg){return arg}}),module.exports=emptyFunction},{\"./copyProperties\":41}],43:[function(_dereq_,module){\"use strict\";var invariant=function(condition,format,a,b,c,d,e,f){if(!condition){var error;if(void 0===format)error=new Error(\"Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.\");else{var args=[a,b,c,d,e,f],argIndex=0;error=new Error(\"Invariant Violation: \"+format.replace(/%s/g,function(){return args[argIndex++]}))}throw error.framesToPop=1,error}};module.exports=invariant},{}],44:[function(_dereq_,module){\"use strict\";var invariant=_dereq_(\"./invariant\"),keyMirror=function(obj){var key,ret={};invariant(obj instanceof Object&&!Array.isArray(obj));for(key in obj)obj.hasOwnProperty(key)&&(ret[key]=key);return ret};module.exports=keyMirror},{\"./invariant\":43}],45:[function(_dereq_,module){\"use strict\";var mergeInto=_dereq_(\"./mergeInto\"),merge=function(one,two){var result={};return mergeInto(result,one),mergeInto(result,two),result};module.exports=merge},{\"./mergeInto\":47}],46:[function(_dereq_,module){\"use strict\";var invariant=_dereq_(\"./invariant\"),keyMirror=_dereq_(\"./keyMirror\"),MAX_MERGE_DEPTH=36,isTerminal=function(o){return\"object\"!=typeof o||null===o},mergeHelpers={MAX_MERGE_DEPTH:MAX_MERGE_DEPTH,isTerminal:isTerminal,normalizeMergeArg:function(arg){return void 0===arg||null===arg?{}:arg},checkMergeArrayArgs:function(one,two){invariant(Array.isArray(one)&&Array.isArray(two))},checkMergeObjectArgs:function(one,two){mergeHelpers.checkMergeObjectArg(one),mergeHelpers.checkMergeObjectArg(two)},checkMergeObjectArg:function(arg){invariant(!isTerminal(arg)&&!Array.isArray(arg))},checkMergeIntoObjectArg:function(arg){invariant(!(isTerminal(arg)&&\"function\"!=typeof arg||Array.isArray(arg)))},checkMergeLevel:function(level){invariant(MAX_MERGE_DEPTH>level)},checkArrayStrategy:function(strategy){invariant(void 0===strategy||strategy in mergeHelpers.ArrayStrategies)},ArrayStrategies:keyMirror({Clobber:!0,IndexByIndex:!0})};module.exports=mergeHelpers},{\"./invariant\":43,\"./keyMirror\":44}],47:[function(_dereq_,module){\"use strict\";function mergeInto(one,two){if(checkMergeIntoObjectArg(one),null!=two){checkMergeObjectArg(two);for(var key in two)two.hasOwnProperty(key)&&(one[key]=two[key])}}var mergeHelpers=_dereq_(\"./mergeHelpers\"),checkMergeObjectArg=mergeHelpers.checkMergeObjectArg,checkMergeIntoObjectArg=mergeHelpers.checkMergeIntoObjectArg;module.exports=mergeInto},{\"./mergeHelpers\":46}],48:[function(_dereq_,module){\"use strict\";var mixInto=function(constructor,methodBag){var methodName;for(methodName in methodBag)methodBag.hasOwnProperty(methodName)&&(constructor.prototype[methodName]=methodBag[methodName])};module.exports=mixInto},{}],49:[function(_dereq_,module){\"use strict\";var emptyFunction=_dereq_(\"./emptyFunction\"),warning=emptyFunction;module.exports=warning},{\"./emptyFunction\":42}],50:[function(_dereq_,module){!function(define){\"use strict\";define(function(_dereq_){var makePromise=_dereq_(\"./makePromise\"),Scheduler=_dereq_(\"./Scheduler\"),async=_dereq_(\"./async\");return makePromise({scheduler:new Scheduler(async)})})}(\"function\"==typeof define&&define.amd?define:function(factory){module.exports=factory(_dereq_)})},{\"./Scheduler\":52,\"./async\":53,\"./makePromise\":54}],51:[function(_dereq_,module){!function(define){\"use strict\";define(function(){function Queue(capacityPow2){this.head=this.tail=this.length=0,this.buffer=new Array(1<i;++i)newBuffer[i]=buffer[i];else{for(capacity=buffer.length,len=this.tail;capacity>head;++i,++head)newBuffer[i]=buffer[head];for(head=0;len>head;++i,++head)newBuffer[i]=buffer[head]}this.buffer=newBuffer,this.head=0,this.tail=this.length},Queue})}(\"function\"==typeof define&&define.amd?define:function(factory){module.exports=factory()})},{}],52:[function(_dereq_,module){!function(define){\"use strict\";define(function(_dereq_){function Scheduler(async){this._async=async,this._queue=new Queue(15),this._afterQueue=new Queue(5),this._running=!1;var self=this;this.drain=function(){self._drain()}}function runQueue(queue){for(;queue.length>0;)queue.shift().run()}var Queue=_dereq_(\"./Queue\");return Scheduler.prototype.enqueue=function(task){this._add(this._queue,task)},Scheduler.prototype.afterQueue=function(task){this._add(this._afterQueue,task)},Scheduler.prototype._drain=function(){runQueue(this._queue),this._running=!1,runQueue(this._afterQueue)},Scheduler.prototype._add=function(queue,task){queue.push(task),this._running||(this._running=!0,this._async(this.drain))},Scheduler})}(\"function\"==typeof define&&define.amd?define:function(factory){module.exports=factory(_dereq_)})},{\"./Queue\":51}],53:[function(_dereq_,module){!function(define){\"use strict\";define(function(_dereq_){var nextTick,MutationObs;return nextTick=\"undefined\"!=typeof process&&null!==process&&\"function\"==typeof process.nextTick?function(f){process.nextTick(f)}:(MutationObs=\"function\"==typeof MutationObserver&&MutationObserver||\"function\"==typeof WebKitMutationObserver&&WebKitMutationObserver)?function(document,MutationObserver){function run(){var f=scheduled;scheduled=void 0,f()}var scheduled,el=document.createElement(\"div\"),o=new MutationObserver(run);return o.observe(el,{attributes:!0}),function(f){scheduled=f,el.setAttribute(\"class\",\"x\")}}(document,MutationObs):function(cjsRequire){var vertx;try{vertx=cjsRequire(\"vertx\")}catch(ignore){}if(vertx){if(\"function\"==typeof vertx.runOnLoop)return vertx.runOnLoop;if(\"function\"==typeof vertx.runOnContext)return vertx.runOnContext}var capturedSetTimeout=setTimeout;return function(t){capturedSetTimeout(t,0)}}(_dereq_)})}(\"function\"==typeof define&&define.amd?define:function(factory){module.exports=factory(_dereq_)})},{}],54:[function(_dereq_,module){!function(define){\"use strict\";define(function(){return function(environment){function Promise(resolver,handler){this._handler=resolver===Handler?handler:init(resolver)}function init(resolver){function promiseResolve(x){handler.resolve(x)}function promiseReject(reason){handler.reject(reason)}function promiseNotify(x){handler.notify(x)}var handler=new Pending;try{resolver(promiseResolve,promiseReject,promiseNotify)}catch(e){promiseReject(e)}return handler}function resolve(x){return isPromise(x)?x:new Promise(Handler,new Async(getHandler(x)))}function reject(x){return new Promise(Handler,new Async(new Rejected(x)))}function never(){return foreverPendingPromise}function defer(){return new Promise(Handler,new Pending)}function all(promises){function settleAt(i,x,resolver){this[i]=x,0===--pending&&resolver.become(new Fulfilled(this))}var i,h,x,s,resolver=new Pending,pending=promises.length>>>0,results=new Array(pending);for(i=0;i0)){unreportRemaining(promises,i+1,h),resolver.become(h);break}results[i]=h.value,--pending}else results[i]=x,--pending;else--pending;return 0===pending&&resolver.become(new Fulfilled(results)),new Promise(Handler,resolver)}function unreportRemaining(promises,start,rejectedHandler){var i,h,x;for(i=start;i0||\"function\"!=typeof onRejected&&0>state)return new this.constructor(Handler,parent);var p=this._beget(),child=p._handler;return parent.chain(child,parent.receiver,onFulfilled,onRejected,arguments.length>2?arguments[2]:void 0),p},Promise.prototype[\"catch\"]=function(onRejected){return this.then(void 0,onRejected)},Promise.prototype._beget=function(){var parent=this._handler,child=new Pending(parent.receiver,parent.join().context);return new this.constructor(Handler,child)},Promise.all=all,Promise.race=race,Handler.prototype.when=Handler.prototype.become=Handler.prototype.notify=Handler.prototype.fail=Handler.prototype._unreport=Handler.prototype._report=noop,Handler.prototype._state=0,Handler.prototype.state=function(){return this._state},Handler.prototype.join=function(){for(var h=this;void 0!==h.handler;)h=h.handler;return h},Handler.prototype.chain=function(to,receiver,fulfilled,rejected,progress){this.when({resolver:to,receiver:receiver,fulfilled:fulfilled,rejected:rejected,progress:progress})},Handler.prototype.visit=function(receiver,fulfilled,rejected,progress){this.chain(failIfRejected,receiver,fulfilled,rejected,progress)},Handler.prototype.fold=function(f,z,c,to){this.visit(to,function(x){f.call(c,z,x,this)},to.reject,to.notify)},inherit(Handler,FailIfRejected),FailIfRejected.prototype.become=function(h){h.fail()};var failIfRejected=new FailIfRejected;inherit(Handler,Pending),Pending.prototype._state=0,Pending.prototype.resolve=function(x){this.become(getHandler(x))},Pending.prototype.reject=function(x){this.resolved||this.become(new Rejected(x))},Pending.prototype.join=function(){if(!this.resolved)return this;for(var h=this;void 0!==h.handler;)if(h=h.handler,h===this)return this.handler=cycle();return h},Pending.prototype.run=function(){var q=this.consumers,handler=this.join();this.consumers=void 0;for(var i=0;i t );\n\t\t}\n\t}\n\treturn true;\n}\n\n/** Return a wrapper that calls sub.methodName() and exposes\n * this : tree\n * this._local : tree.ext.EXTNAME\n * this._super : base.methodName()\n */\nfunction _makeVirtualFunction(methodName, tree, base, extension, extName){\n\t// $.ui.fancytree.debug(\"_makeVirtualFunction\", methodName, tree, base, extension, extName);\n\t// if(rexTestSuper && !rexTestSuper.test(func)){\n\t// // extension.methodName() doesn't call _super(), so no wrapper required\n\t// return func;\n\t// }\n\t// Use an immediate function as closure\n\tvar proxy = (function(){\n\t\tvar prevFunc = tree[methodName], // org. tree method or prev. proxy\n\t\t\tbaseFunc = extension[methodName], //\n\t\t\t_local = tree.ext[extName],\n\t\t\t_super = function(){\n\t\t\t\treturn prevFunc.apply(tree, arguments);\n\t\t\t},\n\t\t\t_superApply = function(args){\n\t\t\t\treturn prevFunc.apply(tree, args);\n\t\t\t};\n\n\t\t// Return the wrapper function\n\t\treturn function(){\n\t\t\tvar prevLocal = tree._local,\n\t\t\t\tprevSuper = tree._super,\n\t\t\t\tprevSuperApply = tree._superApply;\n\n\t\t\ttry{\n\t\t\t\ttree._local = _local;\n\t\t\t\ttree._super = _super;\n\t\t\t\ttree._superApply = _superApply;\n\t\t\t\treturn baseFunc.apply(tree, arguments);\n\t\t\t}finally{\n\t\t\t\ttree._local = prevLocal;\n\t\t\t\ttree._super = prevSuper;\n\t\t\t\ttree._superApply = prevSuperApply;\n\t\t\t}\n\t\t};\n\t})(); // end of Immediate Function\n\treturn proxy;\n}\n\n/**\n * Subclass `base` by creating proxy functions\n */\nfunction _subclassObject(tree, base, extension, extName){\n\t// $.ui.fancytree.debug(\"_subclassObject\", tree, base, extension, extName);\n\tfor(var attrName in extension){\n\t\tif(typeof extension[attrName] === \"function\"){\n\t\t\tif(typeof tree[attrName] === \"function\"){\n\t\t\t\t// override existing method\n\t\t\t\ttree[attrName] = _makeVirtualFunction(attrName, tree, base, extension, extName);\n\t\t\t}else if(attrName.charAt(0) === \"_\"){\n\t\t\t\t// Create private methods in tree.ext.EXTENSION namespace\n\t\t\t\ttree.ext[extName][attrName] = _makeVirtualFunction(attrName, tree, base, extension, extName);\n\t\t\t}else{\n\t\t\t\t$.error(\"Could not override tree.\" + attrName + \". Use prefix '_' to create tree.\" + extName + \"._\" + attrName);\n\t\t\t}\n\t\t}else{\n\t\t\t// Create member variables in tree.ext.EXTENSION namespace\n\t\t\tif(attrName !== \"options\"){\n\t\t\t\ttree.ext[extName][attrName] = extension[attrName];\n\t\t\t}\n\t\t}\n\t}\n}\n\n\nfunction _getResolvedPromise(context, argArray){\n\tif(context === undefined){\n\t\treturn $.Deferred(function(){this.resolve();}).promise();\n\t}else{\n\t\treturn $.Deferred(function(){this.resolveWith(context, argArray);}).promise();\n\t}\n}\n\n\nfunction _getRejectedPromise(context, argArray){\n\tif(context === undefined){\n\t\treturn $.Deferred(function(){this.reject();}).promise();\n\t}else{\n\t\treturn $.Deferred(function(){this.rejectWith(context, argArray);}).promise();\n\t}\n}\n\n\nfunction _makeResolveFunc(deferred, context){\n\treturn function(){\n\t\tdeferred.resolveWith(context);\n\t};\n}\n\n\nfunction _getElementDataAsDict($el){\n\t// Evaluate 'data-NAME' attributes with special treatment for 'data-json'.\n\tvar d = $.extend({}, $el.data()),\n\t\tjson = d.json;\n\tdelete d.fancytree; // added to container by widget factory\n\tif( json ) {\n\t\tdelete d.json;\n\t\t//
  • is already returned as object (http://api.jquery.com/data/#data-html5)\n\t\td = $.extend(d, json);\n\t}\n\treturn d;\n}\n\n\n// TODO: use currying\nfunction _makeNodeTitleMatcher(s){\n\ts = s.toLowerCase();\n\treturn function(node){\n\t\treturn node.title.toLowerCase().indexOf(s) >= 0;\n\t};\n}\n\n\nfunction _makeNodeTitleStartMatcher(s){\n\tvar reMatch = new RegExp(\"^\" + s, \"i\");\n\treturn function(node){\n\t\treturn reMatch.test(node.title);\n\t};\n}\n\nvar i,\n\tFT = null, // initialized below\n\tENTITY_MAP = {\"&\": \"&amp;\", \"<\": \"&lt;\", \">\": \"&gt;\", \"\\\"\": \"&quot;\", \"'\": \"&#39;\", \"/\": \"&#x2F;\"},\n\tIGNORE_KEYCODES = { 16: true, 17: true, 18: true },\n\tSPECIAL_KEYCODES = {\n\t\t8: \"backspace\", 9: \"tab\", 10: \"return\", 13: \"return\",\n\t\t// 16: null, 17: null, 18: null, // ignore shift, ctrl, alt\n\t\t19: \"pause\", 20: \"capslock\", 27: \"esc\", 32: \"space\", 33: \"pageup\",\n\t\t34: \"pagedown\", 35: \"end\", 36: \"home\", 37: \"left\", 38: \"up\",\n\t\t39: \"right\", 40: \"down\", 45: \"insert\", 46: \"del\", 59: \";\", 61: \"=\",\n\t\t96: \"0\", 97: \"1\", 98: \"2\", 99: \"3\", 100: \"4\", 101: \"5\", 102: \"6\",\n\t\t103: \"7\", 104: \"8\", 105: \"9\", 106: \"*\", 107: \"+\", 109: \"-\", 110: \".\",\n\t\t111: \"/\", 112: \"f1\", 113: \"f2\", 114: \"f3\", 115: \"f4\", 116: \"f5\",\n\t\t117: \"f6\", 118: \"f7\", 119: \"f8\", 120: \"f9\", 121: \"f10\", 122: \"f11\",\n\t\t123: \"f12\", 144: \"numlock\", 145: \"scroll\", 173: \"-\", 186: \";\", 187: \"=\",\n\t\t188: \",\", 189: \"-\", 190: \".\", 191: \"/\", 192: \"`\", 219: \"[\", 220: \"\\\\\",\n\t\t221: \"]\", 222: \"'\"},\n\tMOUSE_BUTTONS = { 0: \"\", 1: \"left\", 2: \"middle\", 3: \"right\" },\n\t//boolean attributes that can be set with equivalent class names in the LI tags\n\tCLASS_ATTRS = \"active expanded focus folder hideCheckbox lazy selected unselectable\".split(\" \"),\n\tCLASS_ATTR_MAP = {},\n\t//\tTop-level Fancytree node attributes, that can be set by dict\n\tNODE_ATTRS = \"expanded extraClasses folder hideCheckbox key lazy refKey selected title tooltip unselectable\".split(\" \"),\n\tNODE_ATTR_MAP = {},\n\t// Attribute names that should NOT be added to node.data\n\tNONE_NODE_DATA_MAP = {\"active\": true, \"children\": true, \"data\": true, \"focus\": true};\n\nfor(i=0; i\n * For lazy nodes, null or undefined means 'not yet loaded'. Use an empty array\n * to define a node that has no children.\n * @property {boolean} expanded Use isExpanded(), setExpanded() to access this property.\n * @property {string} extraClasses Addtional CSS classes, added to the node's `&lt;span>`\n * @property {boolean} folder Folder nodes have different default icons and click behavior.
    \n * Note: Also non-folders may have children.\n * @property {string} statusNodeType null or type of temporarily generated system node like 'loading', or 'error'.\n * @property {boolean} lazy True if this node is loaded on demand, i.e. on first expansion.\n * @property {boolean} selected Use isSelected(), setSelected() to access this property.\n * @property {string} tooltip Alternative description used as hover banner\n */\nfunction FancytreeNode(parent, obj){\n\tvar i, l, name, cl;\n\n\tthis.parent = parent;\n\tthis.tree = parent.tree;\n\tthis.ul = null;\n\tthis.li = null; //
  • tag\n\tthis.statusNodeType = null; // if this is a temp. node to display the status of its parent\n\tthis._isLoading = false; // if this node itself is loading\n\tthis._error = null; // {message: '...'} if a load error occured\n\tthis.data = {};\n\n\t// TODO: merge this code with node.toDict()\n\t// copy attributes from obj object\n\tfor(i=0, l=NODE_ATTRS.length; i= 0, \"insertBefore must be an existing child\");\n\t\t\t// insert nodeList after children[pos]\n\t\t\tthis.children.splice.apply(this.children, [pos, 0].concat(nodeList));\n\t\t}\n\t\tif( !this.parent || this.parent.ul || this.tr ){\n\t\t\t// render if the parent was rendered (or this is a root node)\n\t\t\tthis.render();\n\t\t}\n\t\tif( this.tree.options.selectMode === 3 ){\n\t\t\tthis.fixSelection3FromEndNodes();\n\t\t}\n\t\treturn firstNode;\n\t},\n\t/**\n\t * Append or prepend a node, or append a child node.\n\t *\n\t * This a convenience function that calls addChildren()\n\t *\n\t * @param {NodeData} node node definition\n\t * @param {string} [mode=child] 'before', 'after', 'firstChild', or 'child' ('over' is a synonym for 'child')\n\t * @returns {FancytreeNode} new node\n\t */\n\taddNode: function(node, mode){\n\t\tif(mode === undefined || mode === \"over\"){\n\t\t\tmode = \"child\";\n\t\t}\n\t\tswitch(mode){\n\t\tcase \"after\":\n\t\t\treturn this.getParent().addChildren(node, this.getNextSibling());\n\t\tcase \"before\":\n\t\t\treturn this.getParent().addChildren(node, this);\n\t\tcase \"firstChild\":\n\t\t\t// Insert before the first child if any\n\t\t\tvar insertBefore = (this.children ? this.children[0] : null);\n\t\t\treturn this.addChildren(node, insertBefore);\n\t\tcase \"child\":\n\t\tcase \"over\":\n\t\t\treturn this.addChildren(node);\n\t\t}\n\t\t_assert(false, \"Invalid mode: \" + mode);\n\t},\n\t/**\n\t * Append new node after this.\n\t *\n\t * This a convenience function that calls addNode(node, 'after')\n\t *\n\t * @param {NodeData} node node definition\n\t * @returns {FancytreeNode} new node\n\t */\n\tappendSibling: function(node){\n\t\treturn this.addNode(node, \"after\");\n\t},\n\t/**\n\t * Modify existing child nodes.\n\t *\n\t * @param {NodePatch} patch\n\t * @returns {$.Promise}\n\t * @see FancytreeNode#addChildren\n\t */\n\tapplyPatch: function(patch) {\n\t\t// patch [key, null] means 'remove'\n\t\tif(patch === null){\n\t\t\tthis.remove();\n\t\t\treturn _getResolvedPromise(this);\n\t\t}\n\t\t// TODO: make sure that root node is not collapsed or modified\n\t\t// copy (most) attributes to node.ATTR or node.data.ATTR\n\t\tvar name, promise, v,\n\t\t\tIGNORE_MAP = { children: true, expanded: true, parent: true }; // TODO: should be global\n\n\t\tfor(name in patch){\n\t\t\tv = patch[name];\n\t\t\tif( !IGNORE_MAP[name] && !$.isFunction(v)){\n\t\t\t\tif(NODE_ATTR_MAP[name]){\n\t\t\t\t\tthis[name] = v;\n\t\t\t\t}else{\n\t\t\t\t\tthis.data[name] = v;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Remove and/or create children\n\t\tif(patch.hasOwnProperty(\"children\")){\n\t\t\tthis.removeChildren();\n\t\t\tif(patch.children){ // only if not null and not empty list\n\t\t\t\t// TODO: addChildren instead?\n\t\t\t\tthis._setChildren(patch.children);\n\t\t\t}\n\t\t\t// TODO: how can we APPEND or INSERT child nodes?\n\t\t}\n\t\tif(this.isVisible()){\n\t\t\tthis.renderTitle();\n\t\t\tthis.renderStatus();\n\t\t}\n\t\t// Expand collapse (final step, since this may be async)\n\t\tif(patch.hasOwnProperty(\"expanded\")){\n\t\t\tpromise = this.setExpanded(patch.expanded);\n\t\t}else{\n\t\t\tpromise = _getResolvedPromise(this);\n\t\t}\n\t\treturn promise;\n\t},\n\t/** Collapse all sibling nodes.\n\t * @returns {$.Promise}\n\t */\n\tcollapseSiblings: function() {\n\t\treturn this.tree._callHook(\"nodeCollapseSiblings\", this);\n\t},\n\t/** Copy this node as sibling or child of `node`.\n\t *\n\t * @param {FancytreeNode} node source node\n\t * @param {string} [mode=child] 'before' | 'after' | 'child'\n\t * @param {Function} [map] callback function(NodeData) that could modify the new node\n\t * @returns {FancytreeNode} new\n\t */\n\tcopyTo: function(node, mode, map) {\n\t\treturn node.addNode(this.toDict(true, map), mode);\n\t},\n\t/** Count direct and indirect children.\n\t *\n\t * @param {boolean} [deep=true] pass 'false' to only count direct children\n\t * @returns {int} number of child nodes\n\t */\n\tcountChildren: function(deep) {\n\t\tvar cl = this.children, i, l, n;\n\t\tif( !cl ){\n\t\t\treturn 0;\n\t\t}\n\t\tn = cl.length;\n\t\tif(deep !== false){\n\t\t\tfor(i=0, l=n; i= 2 (prepending node info)\n\t *\n\t * @param {*} msg string or object or array of such\n\t */\n\tdebug: function(msg){\n\t\tif( this.tree.options.debugLevel >= 2 ) {\n\t\t\tArray.prototype.unshift.call(arguments, this.toString());\n\t\t\tconsoleApply(\"log\", arguments);\n\t\t}\n\t},\n\t/** Deprecated.\n\t * @deprecated since 2014-02-16. Use resetLazy() instead.\n\t */\n\tdiscard: function(){\n\t\tthis.warn(\"FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead.\");\n\t\treturn this.resetLazy();\n\t},\n\t// TODO: expand(flag)\n\t/**Find all nodes that contain `match` in the title.\n\t *\n\t * @param {string | function(node)} match string to search for, of a function that\n\t * returns `true` if a node is matched.\n\t * @returns {FancytreeNode[]} array of nodes (may be empty)\n\t * @see FancytreeNode#findAll\n\t */\n\tfindAll: function(match) {\n\t\tmatch = $.isFunction(match) ? match : _makeNodeTitleMatcher(match);\n\t\tvar res = [];\n\t\tthis.visit(function(n){\n\t\t\tif(match(n)){\n\t\t\t\tres.push(n);\n\t\t\t}\n\t\t});\n\t\treturn res;\n\t},\n\t/**Find first node that contains `match` in the title (not including self).\n\t *\n\t * @param {string | function(node)} match string to search for, of a function that\n\t * returns `true` if a node is matched.\n\t * @returns {FancytreeNode} matching node or null\n\t * @example\n\t * fat text\n\t */\n\tfindFirst: function(match) {\n\t\tmatch = $.isFunction(match) ? match : _makeNodeTitleMatcher(match);\n\t\tvar res = null;\n\t\tthis.visit(function(n){\n\t\t\tif(match(n)){\n\t\t\t\tres = n;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t\treturn res;\n\t},\n\t/* Apply selection state (internal use only) */\n\t_changeSelectStatusAttrs: function (state) {\n\t\tvar changed = false;\n\n\t\tswitch(state){\n\t\tcase false:\n\t\t\tchanged = ( this.selected || this.partsel );\n\t\t\tthis.selected = false;\n\t\t\tthis.partsel = false;\n\t\t\tbreak;\n\t\tcase true:\n\t\t\tchanged = ( !this.selected || !this.partsel );\n\t\t\tthis.selected = true;\n\t\t\tthis.partsel = true;\n\t\t\tbreak;\n\t\tcase undefined:\n\t\t\tchanged = ( this.selected || !this.partsel );\n\t\t\tthis.selected = false;\n\t\t\tthis.partsel = true;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t_assert(false, \"invalid state: \" + state);\n\t\t}\n\t\t// this.debug(\"fixSelection3AfterLoad() _changeSelectStatusAttrs()\", state, changed);\n\t\tif( changed ){\n\t\t\tthis.renderStatus();\n\t\t}\n\t\treturn changed;\n\t},\n\t/**\n\t * Fix selection status, after this node was (de)selected in multi-hier mode.\n\t * This includes (de)selecting all children.\n\t */\n\tfixSelection3AfterClick: function() {\n\t\tvar flag = this.isSelected();\n\n//\t\tthis.debug(\"fixSelection3AfterClick()\");\n\n\t\tthis.visit(function(node){\n\t\t\tnode._changeSelectStatusAttrs(flag);\n\t\t});\n\t\tthis.fixSelection3FromEndNodes();\n\t},\n\t/**\n\t * Fix selection status for multi-hier mode.\n\t * Only end-nodes are considered to update the descendants branch and parents.\n\t * Should be called after this node has loaded new children or after\n\t * children have been modified using the API.\n\t */\n\tfixSelection3FromEndNodes: function() {\n//\t\tthis.debug(\"fixSelection3FromEndNodes()\");\n\t\t_assert(this.tree.options.selectMode === 3, \"expected selectMode 3\");\n\n\t\t// Visit all end nodes and adjust their parent's `selected` and `partsel`\n\t\t// attributes. Return selection state true, false, or undefined.\n\t\tfunction _walk(node){\n\t\t\tvar i, l, child, s, state, allSelected,someSelected,\n\t\t\t\tchildren = node.children;\n\n\t\t\tif( children && children.length ){\n\t\t\t\t// check all children recursively\n\t\t\t\tallSelected = true;\n\t\t\t\tsomeSelected = false;\n\n\t\t\t\tfor( i=0, l=children.length; i= 1 (prepending node info)\n\t *\n\t * @param {*} msg string or object or array of such\n\t */\n\tinfo: function(msg){\n\t\tif( this.tree.options.debugLevel >= 1 ) {\n\t\t\tArray.prototype.unshift.call(arguments, this.toString());\n\t\t\tconsoleApply(\"info\", arguments);\n\t\t}\n\t},\n\t/** Return true if node is active (see also FancytreeNode#isSelected).\n\t * @returns {boolean}\n\t */\n\tisActive: function() {\n\t\treturn (this.tree.activeNode === this);\n\t},\n\t/** Return true if node is a direct child of otherNode.\n\t * @param {FancytreeNode} otherNode\n\t * @returns {boolean}\n\t */\n\tisChildOf: function(otherNode) {\n\t\treturn (this.parent && this.parent === otherNode);\n\t},\n\t/** Return true, if node is a direct or indirect sub node of otherNode.\n\t * @param {FancytreeNode} otherNode\n\t * @returns {boolean}\n\t */\n\tisDescendantOf: function(otherNode) {\n\t\tif(!otherNode || otherNode.tree !== this.tree){\n\t\t\treturn false;\n\t\t}\n\t\tvar p = this.parent;\n\t\twhile( p ) {\n\t\t\tif( p === otherNode ){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tp = p.parent;\n\t\t}\n\t\treturn false;\n\t},\n\t/** Return true if node is expanded.\n\t * @returns {boolean}\n\t */\n\tisExpanded: function() {\n\t\treturn !!this.expanded;\n\t},\n\t/** Return true if node is the first node of its parent's children.\n\t * @returns {boolean}\n\t */\n\tisFirstSibling: function() {\n\t\tvar p = this.parent;\n\t\treturn !p || p.children[0] === this;\n\t},\n\t/** Return true if node is a folder, i.e. has the node.folder attribute set.\n\t * @returns {boolean}\n\t */\n\tisFolder: function() {\n\t\treturn !!this.folder;\n\t},\n\t/** Return true if node is the last node of its parent's children.\n\t * @returns {boolean}\n\t */\n\tisLastSibling: function() {\n\t\tvar p = this.parent;\n\t\treturn !p || p.children[p.children.length-1] === this;\n\t},\n\t/** Return true if node is lazy (even if data was already loaded)\n\t * @returns {boolean}\n\t */\n\tisLazy: function() {\n\t\treturn !!this.lazy;\n\t},\n\t/** Return true if node is lazy and loaded. For non-lazy nodes always return true.\n\t * @returns {boolean}\n\t */\n\tisLoaded: function() {\n\t\treturn !this.lazy || this.hasChildren() !== undefined; // Also checks if the only child is a status node\n\t},\n\t/** Return true if children are currently beeing loaded, i.e. a Ajax request is pending.\n\t * @returns {boolean}\n\t */\n\tisLoading: function() {\n\t\treturn !!this._isLoading;\n\t},\n\t/**\n\t * @deprecated since v2.4.0: Use isRootNode() instead\n\t */\n\tisRoot: function() {\n\t\treturn this.isRootNode();\n\t},\n\t/** Return true if this is the (invisible) system root node.\n\t * @returns {boolean}\n\t */\n\tisRootNode: function() {\n\t\treturn (this.tree.rootNode === this);\n\t},\n\t/** Return true if node is selected, i.e. has a checkmark set (see also FancytreeNode#isActive).\n\t * @returns {boolean}\n\t */\n\tisSelected: function() {\n\t\treturn !!this.selected;\n\t},\n\t/** Return true if this node is a temporarily generated system node like\n\t * 'loading', or 'error' (node.statusNodeType contains the type).\n\t * @returns {boolean}\n\t */\n\tisStatusNode: function() {\n\t\treturn !!this.statusNodeType;\n\t},\n\t/** Return true if this a top level node, i.e. a direct child of the (invisible) system root node.\n\t * @returns {boolean}\n\t */\n\tisTopLevel: function() {\n\t\treturn (this.tree.rootNode === this.parent);\n\t},\n\t/** Return true if node is lazy and not yet loaded. For non-lazy nodes always return false.\n\t * @returns {boolean}\n\t */\n\tisUndefined: function() {\n\t\treturn this.hasChildren() === undefined; // also checks if the only child is a status node\n\t},\n\t/** Return true if all parent nodes are expanded. Note: this does not check\n\t * whether the node is scrolled into the visible part of the screen.\n\t * @returns {boolean}\n\t */\n\tisVisible: function() {\n\t\tvar i, l,\n\t\t\tparents = this.getParentList(false, false);\n\n\t\tfor(i=0, l=parents.length; i= 0; i--){\n\t\t\t// that.debug(\"pushexpand\" + parents[i]);\n\t\t\tdeferreds.push(parents[i].setExpanded(true, opts));\n\t\t}\n\t\t$.when.apply($, deferreds).done(function(){\n\t\t\t// All expands have finished\n\t\t\t// that.debug(\"expand DONE\", scroll);\n\t\t\tif( scroll ){\n\t\t\t\tthat.scrollIntoView(effects).done(function(){\n\t\t\t\t\t// that.debug(\"scroll DONE\");\n\t\t\t\t\tdfd.resolve();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tdfd.resolve();\n\t\t\t}\n\t\t});\n\t\treturn dfd.promise();\n\t},\n\t/** Move this node to targetNode.\n\t * @param {FancytreeNode} targetNode\n\t * @param {string} mode
    \n\t *      'child': append this node as last child of targetNode.\n\t *               This is the default. To be compatble with the D'n'd\n\t *               hitMode, we also accept 'over'.\n\t *      'before': add this node as sibling before targetNode.\n\t *      'after': add this node as sibling after targetNode.
    \n\t * @param {function} [map] optional callback(FancytreeNode) to allow modifcations\n\t */\n\tmoveTo: function(targetNode, mode, map) {\n\t\tif(mode === undefined || mode === \"over\"){\n\t\t\tmode = \"child\";\n\t\t}\n\t\tvar pos,\n\t\t\tprevParent = this.parent,\n\t\t\ttargetParent = (mode === \"child\") ? targetNode : targetNode.parent;\n\n\t\tif(this === targetNode){\n\t\t\treturn;\n\t\t}else if( !this.parent ){\n\t\t\tthrow \"Cannot move system root\";\n\t\t}else if( targetParent.isDescendantOf(this) ){\n\t\t\tthrow \"Cannot move a node to its own descendant\";\n\t\t}\n\t\t// Unlink this node from current parent\n\t\tif( this.parent.children.length === 1 ) {\n\t\t\tif( this.parent === targetParent ){\n\t\t\t\treturn; // #258\n\t\t\t}\n\t\t\tthis.parent.children = this.parent.lazy ? [] : null;\n\t\t\tthis.parent.expanded = false;\n\t\t} else {\n\t\t\tpos = $.inArray(this, this.parent.children);\n\t\t\t_assert(pos >= 0);\n\t\t\tthis.parent.children.splice(pos, 1);\n\t\t}\n\t\t// Remove from source DOM parent\n//\t\tif(this.parent.ul){\n//\t\t\tthis.parent.ul.removeChild(this.li);\n//\t\t}\n\n\t\t// Insert this node to target parent's child list\n\t\tthis.parent = targetParent;\n\t\tif( targetParent.hasChildren() ) {\n\t\t\tswitch(mode) {\n\t\t\tcase \"child\":\n\t\t\t\t// Append to existing target children\n\t\t\t\ttargetParent.children.push(this);\n\t\t\t\tbreak;\n\t\t\tcase \"before\":\n\t\t\t\t// Insert this node before target node\n\t\t\t\tpos = $.inArray(targetNode, targetParent.children);\n\t\t\t\t_assert(pos >= 0);\n\t\t\t\ttargetParent.children.splice(pos, 0, this);\n\t\t\t\tbreak;\n\t\t\tcase \"after\":\n\t\t\t\t// Insert this node after target node\n\t\t\t\tpos = $.inArray(targetNode, targetParent.children);\n\t\t\t\t_assert(pos >= 0);\n\t\t\t\ttargetParent.children.splice(pos+1, 0, this);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthrow \"Invalid mode \" + mode;\n\t\t\t}\n\t\t} else {\n\t\t\ttargetParent.children = [ this ];\n\t\t}\n\t\t// Parent has no
      tag yet:\n//\t\tif( !targetParent.ul ) {\n//\t\t\t// This is the parent's first child: create UL tag\n//\t\t\t// (Hidden, because it will be\n//\t\t\ttargetParent.ul = document.createElement(\"ul\");\n//\t\t\ttargetParent.ul.style.display = \"none\";\n//\t\t\ttargetParent.li.appendChild(targetParent.ul);\n//\t\t}\n//\t\t// Issue 319: Add to target DOM parent (only if node was already rendered(expanded))\n//\t\tif(this.li){\n//\t\t\ttargetParent.ul.appendChild(this.li);\n//\t\t}^\n\n\t\t// Let caller modify the nodes\n\t\tif( map ){\n\t\t\ttargetNode.visit(map, true);\n\t\t}\n\t\t// Handle cross-tree moves\n\t\tif( this.tree !== targetNode.tree ) {\n\t\t\t// Fix node.tree for all source nodes\n//\t\t\t_assert(false, \"Cross-tree move is not yet implemented.\");\n\t\t\tthis.warn(\"Cross-tree moveTo is experimantal!\");\n\t\t\tthis.visit(function(n){\n\t\t\t\t// TODO: fix selection state and activation, ...\n\t\t\t\tn.tree = targetNode.tree;\n\t\t\t}, true);\n\t\t}\n\n\t\t// A collaposed node won't re-render children, so we have to remove it manually\n\t\t// if( !targetParent.expanded ){\n\t\t// prevParent.ul.removeChild(this.li);\n\t\t// }\n\n\t\t// Update HTML markup\n\t\tif( !prevParent.isDescendantOf(targetParent)) {\n\t\t\tprevParent.render();\n\t\t}\n\t\tif( !targetParent.isDescendantOf(prevParent) && targetParent !== prevParent) {\n\t\t\ttargetParent.render();\n\t\t}\n\t\t// TODO: fix selection state\n\t\t// TODO: fix active state\n\n/*\n\t\tvar tree = this.tree;\n\t\tvar opts = tree.options;\n\t\tvar pers = tree.persistence;\n\n\n\t\t// Always expand, if it's below minExpandLevel\n//\t\ttree.logDebug (\"%s._addChildNode(%o), l=%o\", this, ftnode, ftnode.getLevel());\n\t\tif ( opts.minExpandLevel >= ftnode.getLevel() ) {\n//\t\t\ttree.logDebug (\"Force expand for %o\", ftnode);\n\t\t\tthis.bExpanded = true;\n\t\t}\n\n\t\t// In multi-hier mode, update the parents selection state\n\t\t// DT issue #82: only if not initializing, because the children may not exist yet\n//\t\tif( !ftnode.data.isStatusNode() && opts.selectMode==3 && !isInitializing )\n//\t\t\tftnode._fixSelectionState();\n\n\t\t// In multi-hier mode, update the parents selection state\n\t\tif( ftnode.bSelected && opts.selectMode==3 ) {\n\t\t\tvar p = this;\n\t\t\twhile( p ) {\n\t\t\t\tif( !p.hasSubSel )\n\t\t\t\t\tp._setSubSel(true);\n\t\t\t\tp = p.parent;\n\t\t\t}\n\t\t}\n\t\t// render this node and the new child\n\t\tif ( tree.bEnableUpdate )\n\t\t\tthis.render();\n\n\t\treturn ftnode;\n\n*/\n\t},\n\t/** Set focus relative to this node and optionally activate.\n\t *\n\t * @param {number} where The keyCode that would normally trigger this move,\n\t *\t\te.g. `$.ui.keyCode.LEFT` would collapse the node if it\n\t * is expanded or move to the parent oterwise.\n\t * @param {boolean} [activate=true]\n\t * @returns {$.Promise}\n\t */\n\t// navigate: function(where, activate) {\n\t// \tconsole.time(\"navigate\")\n\t// \tthis._navigate(where, activate)\n\t// \tconsole.timeEnd(\"navigate\")\n\t// },\n\tnavigate: function(where, activate) {\n\t\tvar i, parents,\n\t\t\thandled = true,\n\t\t\tKC = $.ui.keyCode,\n\t\t\tsib = null;\n\n\t\t// Navigate to node\n\t\tfunction _goto(n){\n\t\t\tif( n ){\n\t\t\t\ttry { n.makeVisible(); } catch(e) {} // #272\n\t\t\t\t// Node may still be hidden by a filter\n\t\t\t\tif( ! $(n.span).is(\":visible\") ) {\n\t\t\t\t\tn.debug(\"Navigate: skipping hidden node\");\n\t\t\t\t\tn.navigate(where, activate);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\treturn activate === false ? n.setFocus() : n.setActive();\n\t\t\t}\n\t\t}\n\n\t\tswitch( where ) {\n\t\t\tcase KC.BACKSPACE:\n\t\t\t\tif( this.parent && this.parent.parent ) {\n\t\t\t\t\t_goto(this.parent);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase KC.LEFT:\n\t\t\t\tif( this.expanded ) {\n\t\t\t\t\tthis.setExpanded(false);\n\t\t\t\t\t_goto(this);\n\t\t\t\t} else if( this.parent && this.parent.parent ) {\n\t\t\t\t\t_goto(this.parent);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase KC.RIGHT:\n\t\t\t\tif( !this.expanded && (this.children || this.lazy) ) {\n\t\t\t\t\tthis.setExpanded();\n\t\t\t\t\t_goto(this);\n\t\t\t\t} else if( this.children && this.children.length ) {\n\t\t\t\t\t_goto(this.children[0]);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase KC.UP:\n\t\t\t\tsib = this.getPrevSibling();\n\t\t\t\t// #359: skip hidden sibling nodes, preventing a _goto() recursion\n\t\t\t\twhile( sib && !$(sib.span).is(\":visible\") ) {\n\t\t\t\t\tsib = sib.getPrevSibling();\n\t\t\t\t}\n\t\t\t\twhile( sib && sib.expanded && sib.children && sib.children.length ) {\n\t\t\t\t\tsib = sib.children[sib.children.length - 1];\n\t\t\t\t}\n\t\t\t\tif( !sib && this.parent && this.parent.parent ){\n\t\t\t\t\tsib = this.parent;\n\t\t\t\t}\n\t\t\t\t_goto(sib);\n\t\t\t\tbreak;\n\t\t\tcase KC.DOWN:\n\t\t\t\tif( this.expanded && this.children && this.children.length ) {\n\t\t\t\t\tsib = this.children[0];\n\t\t\t\t} else {\n\t\t\t\t\tparents = this.getParentList(false, true);\n\t\t\t\t\tfor(i=parents.length-1; i>=0; i--) {\n\t\t\t\t\t\tsib = parents[i].getNextSibling();\n\t\t\t\t\t\t// #359: skip hidden sibling nodes, preventing a _goto() recursion\n\t\t\t\t\t\twhile( sib && !$(sib.span).is(\":visible\") ) {\n\t\t\t\t\t\t\tsib = sib.getNextSibling();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif( sib ){ break; }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t_goto(sib);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\thandled = false;\n\t\t}\n\t},\n\t/**\n\t * Remove this node (not allowed for system root).\n\t */\n\tremove: function() {\n\t\treturn this.parent.removeChild(this);\n\t},\n\t/**\n\t * Remove childNode from list of direct children.\n\t * @param {FancytreeNode} childNode\n\t */\n\tremoveChild: function(childNode) {\n\t\treturn this.tree._callHook(\"nodeRemoveChild\", this, childNode);\n\t},\n\t/**\n\t * Remove all child nodes and descendents. This converts the node into a leaf.
      \n\t * If this was a lazy node, it is still considered 'loaded'; call node.resetLazy()\n\t * in order to trigger lazyLoad on next expand.\n\t */\n\tremoveChildren: function() {\n\t\treturn this.tree._callHook(\"nodeRemoveChildren\", this);\n\t},\n\t/**\n\t * This method renders and updates all HTML markup that is required\n\t * to display this node in its current state.
      \n\t * Note:\n\t *
        \n\t *
      • It should only be neccessary to call this method after the node object\n\t * was modified by direct access to its properties, because the common\n\t * API methods (node.setTitle(), moveTo(), addChildren(), remove(), ...)\n\t * already handle this.\n\t *
      • {@link FancytreeNode#renderTitle} and {@link FancytreeNode#renderStatus}\n\t * are implied. If changes are more local, calling only renderTitle() or\n\t * renderStatus() may be sufficient and faster.\n\t *
      • If a node was created/removed, node.render() must be called on the parent.\n\t *
      \n\t *\n\t * @param {boolean} [force=false] re-render, even if html markup was already created\n\t * @param {boolean} [deep=false] also render all descendants, even if parent is collapsed\n\t */\n\trender: function(force, deep) {\n\t\treturn this.tree._callHook(\"nodeRender\", this, force, deep);\n\t},\n\t/** Create HTML markup for the node's outer (expander, checkbox, icon, and title).\n\t * @see Fancytree_Hooks#nodeRenderTitle\n\t */\n\trenderTitle: function() {\n\t\treturn this.tree._callHook(\"nodeRenderTitle\", this);\n\t},\n\t/** Update element's CSS classes according to node state.\n\t * @see Fancytree_Hooks#nodeRenderStatus\n\t */\n\trenderStatus: function() {\n\t\treturn this.tree._callHook(\"nodeRenderStatus\", this);\n\t},\n\t/**\n\t * Remove all children, collapse, and set the lazy-flag, so that the lazyLoad\n\t * event is triggered on next expand.\n\t */\n\tresetLazy: function() {\n\t\tthis.removeChildren();\n\t\tthis.expanded = false;\n\t\tthis.lazy = true;\n\t\tthis.children = undefined;\n\t\tthis.renderStatus();\n\t},\n\t/** Schedule activity for delayed execution (cancel any pending request).\n\t * scheduleAction('cancel') will only cancel a pending request (if any).\n\t * @param {string} mode\n\t * @param {number} ms\n\t */\n\tscheduleAction: function(mode, ms) {\n\t\tif( this.tree.timer ) {\n\t\t\tclearTimeout(this.tree.timer);\n// this.tree.debug(\"clearTimeout(%o)\", this.tree.timer);\n\t\t}\n\t\tthis.tree.timer = null;\n\t\tvar self = this; // required for closures\n\t\tswitch (mode) {\n\t\tcase \"cancel\":\n\t\t\t// Simply made sure that timer was cleared\n\t\t\tbreak;\n\t\tcase \"expand\":\n\t\t\tthis.tree.timer = setTimeout(function(){\n\t\t\t\tself.tree.debug(\"setTimeout: trigger expand\");\n\t\t\t\tself.setExpanded(true);\n\t\t\t}, ms);\n\t\t\tbreak;\n\t\tcase \"activate\":\n\t\t\tthis.tree.timer = setTimeout(function(){\n\t\t\t\tself.tree.debug(\"setTimeout: trigger activate\");\n\t\t\t\tself.setActive(true);\n\t\t\t}, ms);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tthrow \"Invalid mode \" + mode;\n\t\t}\n// this.tree.debug(\"setTimeout(%s, %s): %s\", mode, ms, this.tree.timer);\n\t},\n\t/**\n\t *\n\t * @param {boolean | PlainObject} [effects=false] animation options.\n\t * @param {object} [options=null] {topNode: null, effects: ..., parent: ...} this node will remain visible in\n\t * any case, even if `this` is outside the scroll pane.\n\t * @returns {$.Promise}\n\t */\n\tscrollIntoView: function(effects, options) {\n\t\tif( options !== undefined && _isNode(options) ) {\n\t\t\tthis.warn(\"scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead.\");\n\t\t\toptions = {topNode: options};\n\t\t}\n\t\t// this.$scrollParent = (this.options.scrollParent === \"auto\") ? $ul.scrollParent() : $(this.options.scrollParent);\n\t\t// this.$scrollParent = this.$scrollParent.length ? this.$scrollParent || this.$container;\n\n\t\tvar topNodeY, nodeY, horzScrollbarHeight, containerOffsetTop,\n\t\t\topts = $.extend({\n\t\t\t\teffects: (effects === true) ? {duration: 200, queue: false} : effects,\n\t\t\t\tscrollOfs: this.tree.options.scrollOfs,\n\t\t\t\tscrollParent: this.tree.options.scrollParent || this.tree.$container,\n\t\t\t\ttopNode: null\n\t\t\t}, options),\n\t\t\tdfd = new $.Deferred(),\n\t\t\tthat = this,\n\t\t\tnodeHeight = $(this.span).height(),\n\t\t\t$container = $(opts.scrollParent),\n\t\t\ttopOfs = opts.scrollOfs.top || 0,\n\t\t\tbottomOfs = opts.scrollOfs.bottom || 0,\n\t\t\tcontainerHeight = $container.height(),// - topOfs - bottomOfs,\n\t\t\tscrollTop = $container.scrollTop(),\n\t\t\t$animateTarget = $container,\n\t\t\tisParentWindow = $container[0] === window,\n\t\t\ttopNode = opts.topNode || null,\n\t\t\tnewScrollTop = null;\n\n\t\t// this.debug(\"scrollIntoView(), scrollTop=\", scrollTop, opts.scrollOfs);\n//\t\t_assert($(this.span).is(\":visible\"), \"scrollIntoView node is invisible\"); // otherwise we cannot calc offsets\n\t\tif( !$(this.span).is(\":visible\") ) {\n\t\t\t// We cannot calc offsets for hidden elements\n\t\t\tthis.warn(\"scrollIntoView(): node is invisible.\");\n\t\t\treturn _getResolvedPromise();\n\t\t}\n\t\tif( isParentWindow ) {\n\t\t\tnodeY = $(this.span).offset().top;\n\t\t\ttopNodeY = (topNode && topNode.span) ? $(topNode.span).offset().top : 0;\n\t\t\t$animateTarget = $(\"html,body\");\n\n\t\t} else {\n\t\t\t_assert($container[0] !== document && $container[0] !== document.body, \"scrollParent should be an simple element or `window`, not document or body.\");\n\n\t\t\tcontainerOffsetTop = $container.offset().top,\n\t\t\tnodeY = $(this.span).offset().top - containerOffsetTop + scrollTop; // relative to scroll parent\n\t\t\ttopNodeY = topNode ? $(topNode.span).offset().top - containerOffsetTop + scrollTop : 0;\n\t\t\thorzScrollbarHeight = Math.max(0, ($container.innerHeight() - $container[0].clientHeight));\n\t\t\tcontainerHeight -= horzScrollbarHeight;\n\t\t}\n\n\t\t// this.debug(\" scrollIntoView(), nodeY=\", nodeY, \"containerHeight=\", containerHeight);\n\t\tif( nodeY < (scrollTop + topOfs) ){\n\t\t\t// Node is above visible container area\n\t\t\tnewScrollTop = nodeY - topOfs;\n\t\t\t// this.debug(\" scrollIntoView(), UPPER newScrollTop=\", newScrollTop);\n\n\t\t}else if((nodeY + nodeHeight) > (scrollTop + containerHeight - bottomOfs)){\n\t\t\tnewScrollTop = nodeY + nodeHeight - containerHeight + bottomOfs;\n\t\t\t// this.debug(\" scrollIntoView(), LOWER newScrollTop=\", newScrollTop);\n\t\t\t// If a topNode was passed, make sure that it is never scrolled\n\t\t\t// outside the upper border\n\t\t\tif(topNode){\n\t\t\t\t_assert(topNode.isRoot() || $(topNode.span).is(\":visible\"), \"topNode must be visible\");\n\t\t\t\tif( topNodeY < newScrollTop ){\n\t\t\t\t\tnewScrollTop = topNodeY - topOfs;\n\t\t\t\t\t// this.debug(\" scrollIntoView(), TOP newScrollTop=\", newScrollTop);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(newScrollTop !== null){\n\t\t\t// this.debug(\" scrollIntoView(), SET newScrollTop=\", newScrollTop);\n\t\t\tif(opts.effects){\n\t\t\t\topts.effects.complete = function(){\n\t\t\t\t\tdfd.resolveWith(that);\n\t\t\t\t};\n\t\t\t\t$animateTarget.stop(true).animate({\n\t\t\t\t\tscrollTop: newScrollTop\n\t\t\t\t}, opts.effects);\n\t\t\t}else{\n\t\t\t\t$animateTarget[0].scrollTop = newScrollTop;\n\t\t\t\tdfd.resolveWith(this);\n\t\t\t}\n\t\t}else{\n\t\t\tdfd.resolveWith(this);\n\t\t}\n\t\treturn dfd.promise();\n\t},\n\n\t/**Activate this node.\n\t * @param {boolean} [flag=true] pass false to deactivate\n\t * @param {object} [opts] additional options. Defaults to {noEvents: false}\n\t * @returns {$.Promise}\n\t */\n\tsetActive: function(flag, opts){\n\t\treturn this.tree._callHook(\"nodeSetActive\", this, flag, opts);\n\t},\n\t/**Expand or collapse this node. Promise is resolved, when lazy loading and animations are done.\n\t * @param {boolean} [flag=true] pass false to collapse\n\t * @param {object} [opts] additional options. Defaults to {noAnimation: false, noEvents: false}\n\t * @returns {$.Promise}\n\t */\n\tsetExpanded: function(flag, opts){\n\t\treturn this.tree._callHook(\"nodeSetExpanded\", this, flag, opts);\n\t},\n\t/**Set keyboard focus to this node.\n\t * @param {boolean} [flag=true] pass false to blur\n\t * @see Fancytree#setFocus\n\t */\n\tsetFocus: function(flag){\n\t\treturn this.tree._callHook(\"nodeSetFocus\", this, flag);\n\t},\n\t/**Select this node, i.e. check the checkbox.\n\t * @param {boolean} [flag=true] pass false to deselect\n\t */\n\tsetSelected: function(flag){\n\t\treturn this.tree._callHook(\"nodeSetSelected\", this, flag);\n\t},\n\t/**Mark a lazy node as 'error', 'loading', or 'ok'.\n\t * @param {string} status 'error', 'ok'\n\t * @param {string} [message]\n\t * @param {string} [details]\n\t */\n\tsetStatus: function(status, message, details){\n\t\treturn this.tree._callHook(\"nodeSetStatus\", this, status, message, details);\n\t},\n\t/**Rename this node.\n\t * @param {string} title\n\t */\n\tsetTitle: function(title){\n\t\tthis.title = title;\n\t\tthis.renderTitle();\n\t},\n\t/**Sort child list by title.\n\t * @param {function} [cmp] custom compare function(a, b) that returns -1, 0, or 1 (defaults to sort by title).\n\t * @param {boolean} [deep=false] pass true to sort all descendant nodes\n\t */\n\tsortChildren: function(cmp, deep) {\n\t\tvar i,l,\n\t\t\tcl = this.children;\n\n\t\tif( !cl ){\n\t\t\treturn;\n\t\t}\n\t\tcmp = cmp || function(a, b) {\n\t\t\tvar x = a.title.toLowerCase(),\n\t\t\t\ty = b.title.toLowerCase();\n\t\t\treturn x === y ? 0 : x > y ? 1 : -1;\n\t\t\t};\n\t\tcl.sort(cmp);\n\t\tif( deep ){\n\t\t\tfor(i=0, l=cl.length; i\";\n\t},\n\t/** Call fn(node) for all child nodes.
      \n\t * Stop iteration, if fn() returns false. Skip current branch, if fn() returns \"skip\".
      \n\t * Return false if iteration was stopped.\n\t *\n\t * @param {function} fn the callback function.\n\t * Return false to stop iteration, return \"skip\" to skip this node and\n\t * its children only.\n\t * @param {boolean} [includeSelf=false]\n\t * @returns {boolean}\n\t */\n\tvisit: function(fn, includeSelf) {\n\t\tvar i, l,\n\t\t\tres = true,\n\t\t\tchildren = this.children;\n\n\t\tif( includeSelf === true ) {\n\t\t\tres = fn(this);\n\t\t\tif( res === false || res === \"skip\" ){\n\t\t\t\treturn res;\n\t\t\t}\n\t\t}\n\t\tif(children){\n\t\t\tfor(i=0, l=children.length; i\n\t * Note: If you need this method, you probably should consider to review\n\t * your architecture! Recursivley loading nodes is a perfect way for lazy\n\t * programmers to flood the server with requests ;-)\n\t *\n\t * @param {function} [fn] optional callback function.\n\t * Return false to stop iteration, return \"skip\" to skip this node and\n\t * its children only.\n\t * @param {boolean} [includeSelf=false]\n\t * @returns {$.Promise}\n\t */\n\tvisitAndLoad: function(fn, includeSelf, _recursion) {\n\t\tvar dfd, res, loaders,\n\t\t\tnode = this;\n\n\t\t// node.debug(\"visitAndLoad\");\n\t\tif( fn && includeSelf === true ) {\n\t\t\tres = fn(node);\n\t\t\tif( res === false || res === \"skip\" ) {\n\t\t\t\treturn _recursion ? res : _getResolvedPromise();\n\t\t\t}\n\t\t}\n\t\tif( !node.children && !node.lazy ) {\n\t\t\treturn _getResolvedPromise();\n\t\t}\n\t\tdfd = new $.Deferred();\n\t\tloaders = [];\n\t\t// node.debug(\"load()...\");\n\t\tnode.load().done(function(){\n\t\t\t// node.debug(\"load()... done.\");\n\t\t\tfor(var i=0, l=node.children.length; i\n\t * Stop iteration, if fn() returns false.
      \n\t * Return false if iteration was stopped.\n\t *\n\t * @param {function} fn the callback function.\n\t * Return false to stop iteration, return \"skip\" to skip this node and children only.\n\t * @param {boolean} [includeSelf=false]\n\t * @returns {boolean}\n\t */\n\tvisitParents: function(fn, includeSelf) {\n\t\t// Visit parent nodes (bottom up)\n\t\tif(includeSelf && fn(this) === false){\n\t\t\treturn false;\n\t\t}\n\t\tvar p = this.parent;\n\t\twhile( p ) {\n\t\t\tif(fn(p) === false){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tp = p.parent;\n\t\t}\n\t\treturn true;\n\t},\n\t/** Write warning to browser console (prepending node info)\n\t *\n\t * @param {*} msg string or object or array of such\n\t */\n\twarn: function(msg){\n\t\tArray.prototype.unshift.call(arguments, this.toString());\n\t\tconsoleApply(\"warn\", arguments);\n\t}\n};\n\n\n/* *****************************************************************************\n * Fancytree\n */\n/**\n * Construct a new tree object.\n *\n * @class Fancytree\n * @classdesc The controller behind a fancytree.\n * This class also contains 'hook methods': see {@link Fancytree_Hooks}.\n *\n * @param {Widget} widget\n *\n * @property {FancytreeOptions} options\n * @property {FancytreeNode} rootNode\n * @property {FancytreeNode} activeNode\n * @property {FancytreeNode} focusNode\n * @property {jQueryObject} $div\n * @property {object} widget\n * @property {object} ext\n * @property {object} data\n * @property {object} options\n * @property {string} _id\n * @property {string} statusClassPropName\n * @property {string} ariaPropName\n * @property {string} nodeContainerAttrName\n * @property {string} $container\n * @property {FancytreeNode} lastSelectedNode\n */\nfunction Fancytree(widget) {\n\tthis.widget = widget;\n\tthis.$div = widget.element;\n\tthis.options = widget.options;\n\tif( this.options ) {\n\t\tif( $.isFunction(this.options.lazyload ) && !$.isFunction(this.options.lazyLoad) ) {\n\t\t\tthis.options.lazyLoad = function() {\n\t\t\t\tFT.warn(\"The 'lazyload' event is deprecated since 2014-02-25. Use 'lazyLoad' (with uppercase L) instead.\");\n\t\t\t\treturn widget.options.lazyload.apply(this, arguments);\n\t\t\t};\n\t\t}\n\t\tif( $.isFunction(this.options.loaderror) ) {\n\t\t\t$.error(\"The 'loaderror' event was renamed since 2014-07-03. Use 'loadError' (with uppercase E) instead.\");\n\t\t}\n\t\tif( this.options.fx !== undefined ) {\n\t\t\tFT.warn(\"The 'fx' options was replaced by 'toggleEffect' since 2014-11-30.\");\n\t\t}\n\t}\n\tthis.ext = {}; // Active extension instances\n\t// allow to init tree.data.foo from
      \n\tthis.data = _getElementDataAsDict(this.$div);\n\tthis._id = $.ui.fancytree._nextId++;\n\tthis._ns = \".fancytree-\" + this._id; // append for namespaced events\n\tthis.activeNode = null;\n\tthis.focusNode = null;\n\tthis._hasFocus = null;\n\tthis.lastSelectedNode = null;\n\tthis.systemFocusElement = null;\n\tthis.lastQuicksearchTerm = \"\";\n\tthis.lastQuicksearchTime = 0;\n\n\tthis.statusClassPropName = \"span\";\n\tthis.ariaPropName = \"li\";\n\tthis.nodeContainerAttrName = \"li\";\n\n\t// Remove previous markup if any\n\tthis.$div.find(\">ul.fancytree-container\").remove();\n\n\t// Create a node without parent.\n\tvar fakeParent = { tree: this },\n\t\t$ul;\n\tthis.rootNode = new FancytreeNode(fakeParent, {\n\t\ttitle: \"root\",\n\t\tkey: \"root_\" + this._id,\n\t\tchildren: null,\n\t\texpanded: true\n\t});\n\tthis.rootNode.parent = null;\n\n\t// Create root markup\n\t$ul = $(\"
        \", {\n\t\t\"class\": \"ui-fancytree fancytree-container\"\n\t}).appendTo(this.$div);\n\tthis.$container = $ul;\n\tthis.rootNode.ul = $ul[0];\n\n\tif(this.options.debugLevel == null){\n\t\tthis.options.debugLevel = FT.debugLevel;\n\t}\n\t// Add container to the TAB chain\n\t// See http://www.w3.org/TR/wai-aria-practices/#focus_activedescendant\n\tthis.$container.attr(\"tabindex\", this.options.tabbable ? \"0\" : \"-1\");\n\tif(this.options.aria){\n\t\tthis.$container\n\t\t\t.attr(\"role\", \"tree\")\n\t\t\t.attr(\"aria-multiselectable\", true);\n\t}\n}\n\n\nFancytree.prototype = /** @lends Fancytree# */{\n\t/* Return a context object that can be re-used for _callHook().\n\t * @param {Fancytree | FancytreeNode | EventData} obj\n\t * @param {Event} originalEvent\n\t * @param {Object} extra\n\t * @returns {EventData}\n\t */\n\t_makeHookContext: function(obj, originalEvent, extra) {\n\t\tvar ctx, tree;\n\t\tif(obj.node !== undefined){\n\t\t\t// obj is already a context object\n\t\t\tif(originalEvent && obj.originalEvent !== originalEvent){\n\t\t\t\t$.error(\"invalid args\");\n\t\t\t}\n\t\t\tctx = obj;\n\t\t}else if(obj.tree){\n\t\t\t// obj is a FancytreeNode\n\t\t\ttree = obj.tree;\n\t\t\tctx = { node: obj, tree: tree, widget: tree.widget, options: tree.widget.options, originalEvent: originalEvent };\n\t\t}else if(obj.widget){\n\t\t\t// obj is a Fancytree\n\t\t\tctx = { node: null, tree: obj, widget: obj.widget, options: obj.widget.options, originalEvent: originalEvent };\n\t\t}else{\n\t\t\t$.error(\"invalid args\");\n\t\t}\n\t\tif(extra){\n\t\t\t$.extend(ctx, extra);\n\t\t}\n\t\treturn ctx;\n\t},\n\t/* Trigger a hook function: funcName(ctx, [...]).\n\t *\n\t * @param {string} funcName\n\t * @param {Fancytree|FancytreeNode|EventData} contextObject\n\t * @param {any} [_extraArgs] optional additional arguments\n\t * @returns {any}\n\t */\n\t_callHook: function(funcName, contextObject, _extraArgs) {\n\t\tvar ctx = this._makeHookContext(contextObject),\n\t\t\tfn = this[funcName],\n\t\t\targs = Array.prototype.slice.call(arguments, 2);\n\t\tif(!$.isFunction(fn)){\n\t\t\t$.error(\"_callHook('\" + funcName + \"') is not a function\");\n\t\t}\n\t\targs.unshift(ctx);\n//\t\tthis.debug(\"_hook\", funcName, ctx.node && ctx.node.toString() || ctx.tree.toString(), args);\n\t\treturn fn.apply(this, args);\n\t},\n\t/* Check if current extensions dependencies are met and throw an error if not.\n\t *\n\t * This method may be called inside the `treeInit` hook for custom extensions.\n\t *\n\t * @param {string} extension name of the required extension\n\t * @param {boolean} [required=true] pass `false` if the extension is optional, but we want to check for order if it is present\n\t * @param {boolean} [before] `true` if `name` must be included before this, `false` otherwise (use `null` if order doesn't matter)\n\t * @param {string} [message] optional error message (defaults to a descriptve error message)\n\t */\n\t_requireExtension: function(name, required, before, message) {\n\t\tbefore = !!before;\n\t\tvar thisName = this._local.name,\n\t\t\textList = this.options.extensions,\n\t\t\tisBefore = $.inArray(name, extList) < $.inArray(thisName, extList),\n\t\t\tisMissing = required && this.ext[name] == null,\n\t\t\tbadOrder = !isMissing && before != null && (before !== isBefore);\n\n\t\t_assert(thisName && thisName !== name);\n\n\t\tif( isMissing || badOrder ){\n\t\t\tif( !message ){\n\t\t\t\tif( isMissing || required ){\n\t\t\t\t\tmessage = \"'\" + thisName + \"' extension requires '\" + name + \"'\";\n\t\t\t\t\tif( badOrder ){\n\t\t\t\t\t\tmessage += \" to be registered \" + (before ? \"before\" : \"after\") + \" itself\";\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tmessage = \"If used together, `\" + name + \"` must be registered \" + (before ? \"before\" : \"after\") + \" `\" + thisName + \"`\";\n\t\t\t\t}\n\t\t\t}\n\t\t\t$.error(message);\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t},\n\t/** Activate node with a given key and fire focus and activate events.\n\t *\n\t * A prevously activated node will be deactivated.\n\t * If activeVisible option is set, all parents will be expanded as necessary.\n\t * Pass key = false, to deactivate the current node only.\n\t * @param {string} key\n\t * @returns {FancytreeNode} activated node (null, if not found)\n\t */\n\tactivateKey: function(key) {\n\t\tvar node = this.getNodeByKey(key);\n\t\tif(node){\n\t\t\tnode.setActive();\n\t\t}else if(this.activeNode){\n\t\t\tthis.activeNode.setActive(false);\n\t\t}\n\t\treturn node;\n\t},\n\t/** (experimental)\n\t *\n\t * @param {Array} patchList array of [key, NodePatch] arrays\n\t * @returns {$.Promise} resolved, when all patches have been applied\n\t * @see TreePatch\n\t */\n\tapplyPatch: function(patchList) {\n\t\tvar dfd, i, p2, key, patch, node,\n\t\t\tpatchCount = patchList.length,\n\t\t\tdeferredList = [];\n\n\t\tfor(i=0; i= 2 (prepending tree name)\n\t *\n\t * @param {*} msg string or object or array of such\n\t */\n\tdebug: function(msg){\n\t\tif( this.options.debugLevel >= 2 ) {\n\t\t\tArray.prototype.unshift.call(arguments, this.toString());\n\t\t\tconsoleApply(\"log\", arguments);\n\t\t}\n\t},\n\t// TODO: disable()\n\t// TODO: enable()\n\t// TODO: enableUpdate()\n\n\t/** Find the next visible node that starts with `match`, starting at `startNode`\n\t * and wrap-around at the end.\n\t *\n\t * @param {string|function} match\n\t * @param {FancytreeNode} [startNode] defaults to first node\n\t * @returns {FancytreeNode} matching node or null\n\t */\n\tfindNextNode: function(match, startNode, visibleOnly) {\n\t\tvar stopNode = null,\n\t\t\tparentChildren = startNode.parent.children,\n\t\t\tmatchingNode = null,\n\t\t\twalkVisible = function(parent, idx, fn) {\n\t\t\t\tvar i, grandParent,\n\t\t\t\t\tparentChildren = parent.children,\n\t\t\t\t\tsiblingCount = parentChildren.length,\n\t\t\t\t\tnode = parentChildren[idx];\n\t\t\t\t// visit node itself\n\t\t\t\tif( node && fn(node) === false ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t// visit descendants\n\t\t\t\tif( node && node.children && node.expanded ) {\n\t\t\t\t\tif( walkVisible(node, 0, fn) === false ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// visit subsequent siblings\n\t\t\t\tfor( i = idx + 1; i < siblingCount; i++ ) {\n\t\t\t\t\tif( walkVisible(parent, i, fn) === false ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// visit parent's subsequent siblings\n\t\t\t\tgrandParent = parent.parent;\n\t\t\t\tif( grandParent ) {\n\t\t\t\t\treturn walkVisible(grandParent, grandParent.children.indexOf(parent) + 1, fn);\n\t\t\t\t} else {\n\t\t\t\t\t// wrap-around: restart with first node\n\t\t\t\t\treturn walkVisible(parent, 0, fn);\n\t\t\t\t}\n\t\t\t};\n\n\t\tmatch = (typeof match === \"string\") ? _makeNodeTitleStartMatcher(match) : match;\n\t\tstartNode = startNode || this.getFirstChild();\n\n\t\twalkVisible(startNode.parent, parentChildren.indexOf(startNode), function(node){\n\t\t\t// Stop iteration if we see the start node a second time\n\t\t\tif( node === stopNode ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tstopNode = stopNode || node;\n\t\t\t// Ignore nodes hidden by a filter\n\t\t\tif( ! $(node.span).is(\":visible\") ) {\n\t\t\t\tnode.debug(\"quicksearch: skipping hidden node\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Test if we found a match, but search for a second match if this\n\t\t\t// was the currently active node\n\t\t\tif( match(node) ) {\n\t\t\t\t// node.debug(\"quicksearch match \" + node.title, startNode);\n\t\t\t\tmatchingNode = node;\n\t\t\t\tif( matchingNode !== startNode ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn matchingNode;\n\t},\n\t// TODO: fromDict\n\t/**\n\t * Generate INPUT elements that can be submitted with html forms.\n\t *\n\t * In selectMode 3 only the topmost selected nodes are considered, unless\n\t * `opts.stopOnParents: false` is passed.\n\t *\n\t * @param {boolean | string} [selected=true] Pass false to disable, pass a string to overide the field name (default: 'ft_ID[]')\n\t * @param {boolean | string} [active=true] Pass false to disable, pass a string to overide the field name (default: 'ft_ID_active')\n\t * @param {object} [opts] default { stopOnParents: true }\n\t */\n\tgenerateFormElements: function(selected, active, opts) {\n\t\t// TODO: test case\n\t\topts = opts || {};\n\n\t\tvar nodeList,\n\t\t\tselectedName = (typeof selected === \"string\") ? selected : \"ft_\" + this._id + \"[]\",\n\t\t\tactiveName = (typeof active === \"string\") ? active : \"ft_\" + this._id + \"_active\",\n\t\t\tid = \"fancytree_result_\" + this._id,\n\t\t\t$result = $(\"#\" + id),\n\t\t\tstopOnParents = this.options.selectMode === 3 && opts.stopOnParents !== false;\n\n\t\tif($result.length){\n\t\t\t$result.empty();\n\t\t}else{\n\t\t\t$result = $(\"
        \", {\n\t\t\t\tid: id\n\t\t\t}).hide().insertAfter(this.$container);\n\t\t}\n\t\tif(selected !== false){\n\t\t\tnodeList = this.getSelectedNodes(stopOnParents);\n\t\t\t$.each(nodeList, function(idx, node){\n\t\t\t\t$result.append($(\"\", {\n\t\t\t\t\ttype: \"checkbox\",\n\t\t\t\t\tname: selectedName,\n\t\t\t\t\tvalue: node.key,\n\t\t\t\t\tchecked: true\n\t\t\t\t}));\n\t\t\t});\n\t\t}\n\t\tif(active !== false && this.activeNode){\n\t\t\t$result.append($(\"\", {\n\t\t\t\ttype: \"radio\",\n\t\t\t\tname: activeName,\n\t\t\t\tvalue: this.activeNode.key,\n\t\t\t\tchecked: true\n\t\t\t}));\n\t\t}\n\t},\n\t/**\n\t * Return the currently active node or null.\n\t * @returns {FancytreeNode}\n\t */\n\tgetActiveNode: function() {\n\t\treturn this.activeNode;\n\t},\n\t/** Return the first top level node if any (not the invisible root node).\n\t * @returns {FancytreeNode | null}\n\t */\n\tgetFirstChild: function() {\n\t\treturn this.rootNode.getFirstChild();\n\t},\n\t/**\n\t * Return node that has keyboard focus or null.\n\t * @returns {FancytreeNode}\n\t */\n\tgetFocusNode: function() {\n\t\treturn this.focusNode;\n\t},\n\t/**\n\t * Return node with a given key or null if not found.\n\t * @param {string} key\n\t * @param {FancytreeNode} [searchRoot] only search below this node\n\t * @returns {FancytreeNode | null}\n\t */\n\tgetNodeByKey: function(key, searchRoot) {\n\t\t// Search the DOM by element ID (assuming this is faster than traversing all nodes).\n\t\t// $(\"#...\") has problems, if the key contains '.', so we use getElementById()\n\t\tvar el, match;\n\t\tif(!searchRoot){\n\t\t\tel = document.getElementById(this.options.idPrefix + key);\n\t\t\tif( el ){\n\t\t\t\treturn el.ftnode ? el.ftnode : null;\n\t\t\t}\n\t\t}\n\t\t// Not found in the DOM, but still may be in an unrendered part of tree\n\t\t// TODO: optimize with specialized loop\n\t\t// TODO: consider keyMap?\n\t\tsearchRoot = searchRoot || this.rootNode;\n\t\tmatch = null;\n\t\tsearchRoot.visit(function(node){\n// window.console.log(\"getNodeByKey(\" + key + \"): \", node.key);\n\t\t\tif(node.key === key) {\n\t\t\t\tmatch = node;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}, true);\n\t\treturn match;\n\t},\n\t/** Return the invisible system root node.\n\t * @returns {FancytreeNode}\n\t */\n\tgetRootNode: function() {\n\t\treturn this.rootNode;\n\t},\n\t/**\n\t * Return an array of selected nodes.\n\t * @param {boolean} [stopOnParents=false] only return the topmost selected\n\t * node (useful with selectMode 3)\n\t * @returns {FancytreeNode[]}\n\t */\n\tgetSelectedNodes: function(stopOnParents) {\n\t\tvar nodeList = [];\n\t\tthis.rootNode.visit(function(node){\n\t\t\tif( node.selected ) {\n\t\t\t\tnodeList.push(node);\n\t\t\t\tif( stopOnParents === true ){\n\t\t\t\t\treturn \"skip\"; // stop processing this branch\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn nodeList;\n\t},\n\t/** Return true if the tree control has keyboard focus\n\t * @returns {boolean}\n\t */\n\thasFocus: function(){\n\t\treturn !!this._hasFocus;\n\t},\n\t/** Write to browser console if debugLevel >= 1 (prepending tree name)\n\t * @param {*} msg string or object or array of such\n\t */\n\tinfo: function(msg){\n\t\tif( this.options.debugLevel >= 1 ) {\n\t\t\tArray.prototype.unshift.call(arguments, this.toString());\n\t\t\tconsoleApply(\"info\", arguments);\n\t\t}\n\t},\n/*\n\tTODO: isInitializing: function() {\n\t\treturn ( this.phase==\"init\" || this.phase==\"postInit\" );\n\t},\n\tTODO: isReloading: function() {\n\t\treturn ( this.phase==\"init\" || this.phase==\"postInit\" ) && this.options.persist && this.persistence.cookiesFound;\n\t},\n\tTODO: isUserEvent: function() {\n\t\treturn ( this.phase==\"userEvent\" );\n\t},\n*/\n\n\t/**\n\t * Make sure that a node with a given ID is loaded, by traversing - and\n\t * loading - its parents. This method is ment for lazy hierarchies.\n\t * A callback is executed for every node as we go.\n\t * @example\n\t * tree.loadKeyPath(\"/_3/_23/_26/_27\", function(node, status){\n\t * if(status === \"loaded\") {\n\t * console.log(\"loaded intermiediate node \" + node);\n\t * }else if(status === \"ok\") {\n\t * node.activate();\n\t * }\n\t * });\n\t *\n\t * @param {string | string[]} keyPathList one or more key paths (e.g. '/3/2_1/7')\n\t * @param {function} callback callback(node, status) is called for every visited node ('loading', 'loaded', 'ok', 'error')\n\t * @returns {$.Promise}\n\t */\n\tloadKeyPath: function(keyPathList, callback, _rootNode) {\n\t\tvar deferredList, dfd, i, path, key, loadMap, node, root, segList,\n\t\t\tsep = this.options.keyPathSeparator,\n\t\t\tself = this;\n\n\t\tif(!$.isArray(keyPathList)){\n\t\t\tkeyPathList = [keyPathList];\n\t\t}\n\t\t// Pass 1: handle all path segments for nodes that are already loaded\n\t\t// Collect distinct top-most lazy nodes in a map\n\t\tloadMap = {};\n\n\t\tfor(i=0; i