text: /**
   * @name suns.js
   * @author Kazuma MISHIMAGI <mishimagi_kazuma@cyberagent.co.jp>
   * copyright (c) Cyberagent Inc.
   * @overview Object extending utilities for node and browser (amd support)
   */
  
  /**
   * @name bucks.js
   * @author Kazuma MISHIMAGI <mishimagi_kazuma@cyberagent.co.jp>
   * copyright (c) Cyberagent Inc.
   * @overview Async chain utility for node and the browser. (amd support)
   */
  
  /**
   * @name logcafe.js
   * @author Kei Funagayama <funagayama_kei@cyberagent.co.jp>
   * copyright (c) Cyberagent Inc.
   * @overview browser logging.
   */
  
  /**
   * @license beez Copyright (c) Cyberagent Inc.
   * Available via the MIT License.
   */
  
  /* Zepto v1.0-1-ga3cab6c - polyfill zepto detect event ajax form fx - zeptojs.com/license */
  
  /**
   * @name index.js<beez-ua>
   * @author Kei Funagayama <funagayama_kei@cyberagent.co.jp>
   * copyright (c) Cyberagent Inc.
   * @overview UserAgent decision  for node and the browser. (amd support) fork zepto.js(http://zeptojs.com/)
   * @license MIT
   */
  
  /**
   * @name base.js<beez-mvcr>
   * @author Kei Funagayama <funagayama_kei@cyberagent.co.jp>
   * copyright (c) Cyberagent Inc.
   * @overview base class of managed object
   */
  
  /* JSONPath 0.8.0 - XPath for JSON
           *
           * Copyright (c) 2007 Stefan Goessner (goessner.net)
           * Licensed under the MIT (MIT-LICENSE.txt) licence.
           *
           * @license https://github.com/s3u/JSONPath
           */
  
  /**
   * @name base.js<beez-mvcr>
   * @author Kazuma MISHIMAGI <mishimagi_kazuma@cyberagent.co.jp">
   * copyright (c) Cyberagent Inc.
   * @overview base class of managed object
   */
  
  /** @license MIT License (c) 2012-2013 Cyberagent Inc. */
  
  !function(e){var t=Array.prototype.forEach,r={},n=function(e,n,i){if(void 0!==e&&null!==e)if(t&&e.forEach===t)e.forEach(n,i);else if(e.length===+e.length){for(var o=0,s=e.length;s>o;o++)if(n.call(i,e[o],o,e)===r)return}else for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&n.call(i,e[a],a,e)===r)return},i=function(e){return n(Array.prototype.slice.call(arguments,1),function(t){for(var r in t)e[r]=t[r]}),e},o=/__(super)+__/,s=function(e,t,r){var n;if("object"!=typeof r)throw new Error("typeof childCtorOrProto invalid. it should be Object (prototype object).");n=r&&Object.prototype.hasOwnProperty.call(r,"constructor")?r.constructor:new Function("parent","return function "+e+"(){ parent.apply(this, arguments); };")(t),i(n,t);var s=function(){this.constructor=n};s.prototype=t.prototype,n.prototype=new s,r&&i(n.prototype,r);for(var a in t)if(o.test(a)){var u=a.replace("super","supersuper");n[u]=t[a]}return n.__super__=t.prototype,n.__superCtor__=t,n},a=function g(e,t,r){if(r.length<1)return t;var n=r.shift(),i=s(e,t,n);return g(e,i,r)},u=function(e){var t="",r=Array.prototype.slice.apply(arguments);return"string"==typeof r[0]&&(t=r.shift(),t=t.replace(/\./g,"_")),e=r.shift(),a(t,e,r)},c=function(){var e=this,t=Array.prototype.slice.apply(arguments),r=[];return"string"==typeof t[0]&&r.push(t.shift()),r.push(e),r=r.concat(t),u.apply(this,r)},l=function(e,t,r){var n,s,a=typeof r;if("function"===a)s=r.prototype;else{if("object"!==a)throw new Error("typeof childCtorOrProto invalid. it should be Function or Object.");s=r}n="function"===a?new Function("parent, childCtor","return function "+e+"(){ parent.apply(this, arguments); childCtor.apply(this, arguments)};")(t,r):s&&Object.prototype.hasOwnProperty.call(s,"constructor")?s.constructor:new Function("parent","return function "+e+"(){ parent.apply(this, arguments); };")(t),i(n,t);var u=function(){this.constructor=n};u.prototype=t.prototype,n.prototype=new u,s&&i(n.prototype,s);for(var c in t)if(o.test(c)){var l=c.replace("super","supersuper");n[l]=t[c]}return n.__super__=t.prototype,n.__superCtor__=t,n},h=function p(e,t,r){if(r.length<1)return t;var n=r.shift(),i=l(e,t,n);return p(e,i,r)},d=function(e){var t="",r=Array.prototype.slice.apply(arguments);return"string"==typeof r[0]&&(t=r.shift(),t=t.replace(/\./g,"_")),e=r.shift(),h(t,e,r)},f={extend:u,extendThis:c,mixin:d,VERSION:"0.4.6"};"function"==typeof define&&define.amd?define("beez-core/suns",["require","exports","module"],function(){return f}):"undefined"!=typeof module&&module.exports?module.exports=f:e.suns=f}(this),function(){define("beez-core/error",["require","exports","module","beez-core/suns"],function(e){var t=e("beez-core/suns"),r=t.extend("beez.Error",Error,{constructor:function(e){Error.apply(this,arguments),Error.captureStackTrace(this,this.constructor),this.message=e}});return r.extend=t.extendThis,r})}(this),function(e){var t=function(){},r=Array.isArray||function(e){return"[object Array]"===e.toString()},n=function(e){return 0===e.length},i=function(e){e.stack?console.error(e.stack):e.message?console.error(e.message):console.error(e)},o=0,s=function(){return"__bucks__"+o++},a=function c(e){this._tasks=[],this._taskcount=0,this._results=[],this.callback=t,this.failure=t,this._alive=!0,this.__id=s(),c.living[this.__id]=this,this.initialize(e)};a.VERSION="0.8.2",a.DEBUG=!1,a.running={},a.living={},a._isOnError=!1,a.onError=function l(l){!function(e){a._onError=l,a._isOnError=e}(!0)},a.prototype={initialize:t,_normalizeTask:function(e){var t=e;if(e.length<3)t=function(t,r,n){var i=e.call(null,t,r);n.call(null,null,i)};else if(3===e.length)t=e;else{if(4!==e.length)throw new Error("args length invalid");t=function(t,r,n,i){e.call(null,t,r,n,i)}}return t},_normalizeSuccess:function(e){var t=e;if(e.length<2)t=function(t,r){var n=e(t);r(null,n)};else{if(2!==e.length)throw new Error("args length invalid");t=e}return t},_normalizeError:function(e){var t=e;if(e.length<2||3<e.length)throw new Error(e.name+": args length invalid. should be: onError(err, next)");return t},add:function(e){if(!this._alive)throw new Error("this bucks object already destroyed.");var t=this._normalizeTask(e);return this._tasks.push(t),this},then:function(e){var t=this._normalizeSuccess(e);return this.add(function(e,r,n){e?n(e):t(r,n)})},empty:function(){return this.then(function(){})},error:function(e){var t=this._normalizeError(e);return this.add(function(e,r,n){e?t(e,n):n(e,r)})},_iterator:function(e,t){if(!this._alive)throw new Error("this bucks object already destroyed.");t?this._results.push(t):this._results.push(null);var r=this._tasks.shift();if(!r)return this.destroy(e);try{var n=this;r(e,t,function(e,t){return n._iterator(e,t),this},this._taskcount++)}catch(o){if(!this._results){if(a.DEBUG&&i(o),!a._isOnError)throw o;a._onError(o,this)}this._iterator(o,null)}return this},debug:function(){return this},parallel:function(e){if(!r(e))throw new Error("tasks is not array.");if(n(e))return this.add(function(e,t,r){r(null,new u(0).resultObj)});for(var t=0,i=e.length;i>t;t++){var o=e[t];e[t]=this._normalizeTask(o)}return this.add(function(t,r,n){var i=new u(e.length);i.onFinish(function(e){for(var t,r=0,i=e.err.length;i>r;r++){var o=e.err[r];void 0!==o&&null!==o&&(t=o)}n(t,e)}),e.forEach(function(e,t){setTimeout(function(){(new a).add(e).end(function(e,r){e?i.successOne(t,e,null):i.successOne(t,null,r[0])})},0)})})},waterfall:function(e){if(!r(e))throw new Error("tasks is not array.");if(n(e))return this.add(function(e,t,r){r(null,[])});for(var t=0,i=e.length;i>t;t++)e[t]=this._normalizeTask(e[t]),this.add(e[t]);return this},delay:function(e){return this.add(function(t,r,n){setTimeout(function(){n(t,r)},e||0)})},dispose:t,destroy:function(e){if(!this._alive)return this;var r=this._results,n=this.callback,o=this.failure,s=this.dispose;this._tasks=null,this._taskcount=0,this._results=null,this.callback=t,this.failure=t,this.dispose=t,r.shift();try{if(n)n(e,r);else if(e)throw e}catch(u){if(o)try{o(u)}catch(c){if(!a._isOnError)throw c;a._onError(c,this)}else{if(a.DEBUG&&i(u),!a._isOnError)throw u;a._onError(u,this)}}finally{try{s.call(this)}catch(c){if(!a._isOnError)throw c;a._onError(c,this)}delete this._alive,delete a.running[this.__id],delete a.living[this.__id],delete this.__id}return this},end:function(e,t){if(e&&e.length<1)throw new Error("callback args length invalid. should be `callback(err, ress)` or `callback(err)`.");if(this.callback=e,this.failure=t,!this._tasks||!this._tasks.length){var r=new Error("task is empty. add(task) first. if theres no task to execute but end is desired, empty() may be useful");return this.destroy(r,null),e(r)}return a.running[this.__id]=this,this._iterator(),void 0}};var u=function(e){this._results=[],this._errors=[],this._waiting=e};u.prototype={onFinish:function(e){this._onFinish=e},successOne:function(e,t,r){this._errors[e]=t,this._results[e]=r,this._waiting--,this._waiting<=0&&this._onFinish.call(null,this.resultObj)}},u.prototype.__defineGetter__("resultObj",function(){return{err:this._errors,res:this._results}}),"function"==typeof define&&define.amd?define("beez-core/bucks",["require","exports","module"],function(){return a}):"undefined"!=typeof module&&module.exports?module.exports=a:e.Bucks=a}(this),function(e){var t=function(){},r=function(e,t){this.initialize(e,t)};r.prototype={initialize:function(e,r){this.category=e,this.config=r,this.level=this.config.level,this.config.separator&&(this.separator=this.config.separator||" "),this.level===this.LEVELS.TRACE||(this.level===this.LEVELS.DEBUG?this.trace=t:this.level===this.LEVELS.INFO?this.trace=this.debug=t:this.level===this.LEVELS.WARN?this.trace=this.debug=this.info=t:this.level===this.LEVELS.ERROR&&(this.trace=this.debug=this.info=this.warn=t))},LEVELS:{OFF:"OFF",TRACE:"TRACE",DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"},_exclude:function(){if(this.config.excludes&&0<this.config.excludes.length)for(var e=0;e<this.config.excludes.length;e++){var t=new RegExp("^"+this.config.excludes[e]);if(this.category.match(t))return!0}return!1},trace:function(){!this._exclude()&&console.debug(this.output("trace",arguments))},debug:function(){!this._exclude()&&console.debug(this.output("debug",arguments))},info:function(){!this._exclude()&&console.info(this.output("info",arguments))},warn:function(){!this._exclude()&&console.warn(this.output("warn",arguments))},error:function(){!this._exclude()&&console.error(this.output("error",arguments))},output:function(e,t){for(var r=Array.prototype.slice.call(t),n=0;n<r.length;n++)if(void 0===r[n])r[n]='"undefined"';else if(null===r[n])r[n]='"null"';else if(r[n]instanceof Error||"Error"===r[n].constructor.name){var i=r[n];r[n]=i.stack?i.stack:i.message}else"object"==typeof r[n]&&(r[n]=r[n].constructor.name+":"+JSON.stringify(r[n]));var o,s,a,u="",c=(new Error).stack;return c&&(o=c.split("\n"),o[3]?(s=o[3],a=s.indexOf("("),a>=0?(u=s.substring(a),")"!==u.charAt(u.length-1)&&(u="("+u+")")):u="("+s.replace(/[ ]*at /,"")+")"):o[2]&&(s=o[2],a=s.indexOf("@"),a>=0&&(u=s.substring(a+1),u=" ("+u+")"))),"["+e+"]["+this.category+"] "+r.join(this.separator)+" "+u}};var n=function(e){this.initialize(e)};n.prototype={initialize:function(e){this.config=e,this.loggers={}},setConfigure:function(e){return this.config=e,this},getLogger:function(e){return this.loggers[e]?this.loggers[e]:(this.loggers[e]=new r(e,this.config),this.loggers[e])}},n.VERSION="0.6.7","function"==typeof define&&define.amd?define("beez-core/logcafe",["require","exports","module"],function(){return n}):"undefined"!=typeof module&&module.exports?module.exports=n:e.LogCafe=n}(this),function(e){define("beez.core",["require","exports","module","beez-core/suns","beez-core/error","beez-core/bucks","beez-core/logcafe"],function(t,r,n){var i=e;if(i.beez)return i.beez;var o=t("beez-core/suns"),s=n.config()||{},a=t("beez-core/error"),u=t("beez-core/bucks");u.extend=o.extendThis;var c=t("beez-core/logcafe"),l=new c;l.setConfigure(s.logging||{level:"WARN",separator:" "});var h=function(e){return l.getLogger(e)},d=h("beez.core.index"),f=function(t,r,n){t&&(e.onerror=t),r&&u.onError(r),n&&(e.require.onError=n)},g={};if(s.defines&&(g=s.defines,g.globals))for(var p in g.globals)e[p]=g.globals[p],d.debug("Set the valueto the global scope.",p,":",e[p]);var m={root:i,global:i,config:s,defines:g,none:function(){},extend:o.extend,extendThis:o.extendThis,mixin:o.mixin,getLogger:h,onError:f,Error:a,Bucks:u};return i.beez=m,m})}(this),function(e){var t={VERSION:"0.8.1"};t.setup=function(t){if(!t&&e&&e.navigator&&e.navigator.userAgent&&(t=e.navigator.userAgent),!t)throw new Error("useragent setup error. useragent not found.");if(this.webkit=t.match(/WebKit\/([\d.]+)/),this.android=t.match(/(Android)\s+([\d.]+)/),this.android23=t.match(/(Android)\s+(2\.3)([\d.]+)/),this.android4=t.match(/(Android)\s+(4)([\d.]+)/),this.ipad=t.match(/(iPad).*OS\s([\d_]+)/),this.iphone=!this.ipad&&t.match(/(iPhone\sOS)\s([\d_]+)/),this.webos=t.match(/(webOS|hpwOS)[\s\/]([\d.]+)/),this.touchpad=this.webos&&t.match(/TouchPad/),this.kindle=t.match(/(Kindle)/),this.silk=t.match(/(Silk)/),this.blackberry=t.match(/(BlackBerry).*/),this.bb10=t.match(/(BB10).*Version\/([\d.]+)/),this.rimtabletos=t.match(/(RIM\sTablet\sOS)\s([\d.]+)/),this.playbook=t.match(/PlayBook/),this.chrome=t.match(/Chrome\/([\d.]+)/)||t.match(/CriOS\/([\d.]+)/),this.firefox=t.match(/Firefox\/([\d.]+)/),this.wii=t.match(/Nintendo (Wii);/),this.ds=t.match(/Nintendo (DS|3DS|DSi);/),this.ps3=t.match(/PLAYSTATION 3/),this.psp=t.match(/(PlayStation Portable)/),this.psvita=t.match(/(PlayStation Vita)/),this.windowsphone=t.match(/(Windows Phone |Windows Phone OS )([\d.]+)/),this.safari=t.match(/(Version)\/(\\d+)\\.(\\d+)(?:\\.(\\d+))?.*Safari\//),this.iphone5=!("undefined"!=typeof module&&module.exports)&&this.iphone&&screen&&320===screen.width&&568===screen.height,this.iphone3=this.iphone&&1===e.devicePixelRatio?!0:!1,this.browser={locale:void 0,lang:void 0,country:void 0},this.os={},this.webkit&&(this.browser.webkit=!0,this.browser.version=this.webkit[1]),this.android){this.os.android=!0,this.os.version=this.android[2];try{this.browser.locale=t.match(/(Android)\s(.+);\s([^;]+);/)[3],this.browser.lang=this.browser.locale.substring(0,2),this.browser.country=this.browser.locale.substring(3)}catch(r){}}this.iphone&&(this.os.ios=this.os.iphone=!0,this.os.version=this.iphone[2].replace(/_/g,"."));var n=null;this.os.version&&(n=this.os.version.substring(0,1));for(var i=3;10>i;i++)this["ios"+i]=n===""+i;this.ipad&&(this.os.ios=this.os.ipad=!0,this.os.version=this.ipad[2].replace(/_/g,".")),this.webos&&(this.os.webos=!0,this.os.version=this.webos[2]),this.touchpad&&(this.os.touchpad=!0),this.blackberry&&(this.os.blackberry=!0),this.bb10&&(this.os.bb10=!0,this.os.version=this.bb10[2]),this.rimtabletos&&(this.os.rimtabletos=!0,this.os.version=this.rimtabletos[2]),this.playbook&&(this.browser.playbook=!0),this.kindle&&(this.os.kindle=!0),this.silk&&(this.browser.silk=!0),!this.silk&&this.os.android&&t.match(/Kindle Fire/)&&(this.browser.silk=!0),this.chrome&&(this.browser.chrome=!0,this.browser.version=this.chrome[1]),this.firefox&&(this.browser.firefox=!0,this.browser.version=this.firefox[1]),(this.wii||this.ds)&&(this.os.nintendo=!0),this.windowsphone&&(this.browser.windowsphone=!0,this.browser.version=this.windowsphone[2]),this.os.tablet=!!(this.ipad||this.kindle||this.playbook||this.android&&!t.match(/Mobile/)||this.firefox&&t.match(/Tablet/)),this.os.phone=!(this.os.tablet||!(this.android||this.iphone||this.webos||this.blackberry||this.bb10||this.chrome&&t.match(/Android/)||this.chrome&&t.match(/CriOS\/([\d.]+)/)||this.firefox&&t.match(/Mobile/)||this.windowsphone&&t.match(/IEMobile/)))},"function"==typeof define&&define.amd?define("beez.ua",["require","exports","module"],function(){return t}):"undefined"!=typeof module&&module.exports?module.exports=t:(e.beez||(e.beez={}),e.beez.ua=t)}(this),function(){define("beez-utils/browser",["require","exports","module","beez.core","underscore","zepto","backbone","beez.ua"],function(e){var t=e("beez.core"),r=t.global||r;e("underscore");var n=e("zepto"),i=e("backbone"),o=t.Bucks.extend("beez.utils.BrowserAsync",{initialize:function(e){this.browser=e},dispose:function(){delete this.browser},hideAddress:function(e){return e=e||100,this.delay(e).then(function(){window.scroll(0,0)})}}),s={_prevOrientation:r.orientation,_initOrientation:r.orientation,initialize:function(){this.startHandleOrientation()},startHandleOrientation:function(){var e="onorientationchange"in window?"orientationchange":"resize",t=this;n(r).on(e,function(){var e=r.orientation;t._prevOrientation!==e&&(t.trigger("change:orientation",{prev:t._prevOrientation,current:e,init:t._initOrientation===e?!0:!1}),t._prevOrientation=e)})},getComputedStyle:function(e){return document.defaultView.getComputedStyle(e,"")},async:function(){return new o(this)},hideAddress:function(e){return new o(this).hideAddress(e)},getWindowSize:function(){return{width:window.innerWidth,height:window.innerHeight}},ua:{},getLanguage:function(){var e=navigator.language||navigator.browserLanguage||navigator.systemLanguage||navigator.userLanguage;return this.ua.android23&&a.browser.lang?a.browser.lang:e?e.substr(0,2):void 0}},a=e("beez.ua");a.setup(),s.ua=a;var u=t.extend("beez.utils.Browser",function(){},i.Events,s);return u})}(this),function(){define("beez-utils/uid",["require","exports","module"],function(){var e,t=function(){return e?e:e=this};return t.prototype.create=function(){var e=Math.floor(1e3*Math.random()),t=Date.now();return e+"_"+t.toString()},t})}(this),function(){define("beez-utils/timer",["require","exports","module","beez.core","underscore","beez-utils/uid"],function(e){var t=e("beez.core"),r=e("underscore");t.getLogger("timer");var n=e("beez-utils/uid"),i=new n,o="beez_utils_timer_id",s=function(){this.running=!1,this._callbacks={},this._timerId=0};return s.prototype={addTimeout:function(e,t,n){var s=i.create();e[o]=s;var a={timer_id:s,callback:e,interval:t,time:Date.now()+t,context:n,type:"timeout",canceller:function(){this.type="canceled"}};return r.bindAll.apply(this,[a].concat(r.methods(a))),this._callbacks[s]=a,this.start(),s},addInterval:function(e,t,n){var s=i.create();e[o]=s;var a={timer_id:s,callback:e,interval:t,time:Date.now()+t,context:n,type:"interval",canceller:function(){this.type="canceled"}};return r.bindAll.apply(this,[a].concat(r.methods(a))),this._callbacks[s]=a,this.start(),s},clearInterval:function(e){var t;t="function"==typeof e&&e[o]?e[o]:e;var r=this._callbacks[t];if(!r)throw new Error("no callback to clear");r.canceller()},clearTimeout:function(e){var t;t="function"==typeof e&&e[o]?e[o]:e;var r=this._callbacks[t];r&&r.canceller()},_tick:function(){var e=Date.now(),t=this;r.each(this._callbacks,function(r){return r.time<e&&("canceled"!==r.type&&(r.context?r.callback.call(null,r.context):r.callback.call()),"interval"!==r.type&&delete t._callbacks[r.timer_id],r.time=e+r.interval),!0}),r.keys(this._callbacks).length||this.stop()},start:function(){if(!this.running){this.running=!0;var e=this,t=function r(){e.running&&(e._tick(),e._timerId=setTimeout(r,100))};t()}},stop:function(){this.running=!1,clearTimeout(this._timerId)}},s})}(this),function(e){define("beez.utils",["require","exports","module","beez.core","underscore","beez-utils/browser","beez-utils/timer"],function t(r){var n=r("beez.core"),i=r("underscore"),o=n.getLogger("beez.utils");if(n.utils)return o.warn("beez.utils already defined."),n.utils;var t={initialize:function(){var t=r("beez-utils/browser"),i=r("beez-utils/timer");this.browser=new t,this.Timers=i,this.none=n.none,this.pixelRatio=e.devicePixelRatio||1},copyr:function a(e,t){for(var r in t){var n=e[r],o=t[r];i.isObject(n)&&!i.isArray(o)?a(e[r],t[r]):e[r]=t[r]}return e},is:function(e,t){var r=Object.prototype.toString.call(t).slice(8,-1);return void 0!==t&&null!==t&&r===e}},s=n.extend("beez.Utils",function(){return this.initialize()},t);return i.each(["Equal","Empty","Element","Arguments","Function","String","Number","Finite","Boolean","Date","RegExp","NaN","Null","Undefined"],function(e){s.prototype["is"+e]=i["is"+e]}),i.each(["Object","Array"],function(e){s.prototype["is"+e]=function(t){return this.is.apply(this,[e,t])}}),n.utils=new s,n.utils})}(this),function(){define("beez.i18n",["require","exports","module","beez.core","beez.utils","underscore","handlebars"],function e(t){var r=t("beez.core");t("beez.utils");var n=r.getLogger("beez.i18n"),i=t("underscore");if(r.i18n)return n.warn("beez.i18n is already loaded."),r.i18n;var e={initialize:function(e){this.lang={base:"en",use:void 0},this.message={},this.parseReg=new RegExp(/\{#{1}[(0-9a-zA-Z)]*\}/),this.lang.use=r.utils.browser.getLanguage(),e=e||{},e.lang=e.lang||{},e.lang.base&&(this.lang.base=e.lang.base),e.lang.use&&(this.lang.use=e.lang.use),this.lang.use||(this.lang.use=this.lang.base),e.message&&(this.message=e.message)},getCurrentLang:function(){return this.lang.use||this.lang.base},parse:function(e,t){var r=e.split(this.parseReg);if(1===r.length&&""===r[0])return e;var n="";return i.each(r,function(e,r){n+=e+(t[r]||"")}),n},__:function(e){return this.getMessage(e)},getMessage:function(e){var t=this.getCurrentLang();if(this.message[t]||(t=this.lang.base),!this.message[t])return"";var r=this.message[t][e]||"";!r&&this.message[this.lang.base]&&(r=this.message[this.lang.base][e]||"");var n=Array.prototype.slice.call(arguments,1);return this.parse(r,n)},add:function(e){return r.utils.copyr(this.message,e)},addMessage:function(e,t){return this.message[e]=this.message[e]||{},r.utils.copyr(this.message[e],t)},remove:function(e,t){var r=this.message[e];r&&r[t]?this.message[e][t]=null:r?this.message[e]=null:this.message={}},dispose:function(){delete this.lang,delete this.message,delete this.parseReg}},o=r.extend("beez.i18n",function(){return this.initialize.apply(this,arguments)},e);o.extend=r.extendThis,r.I18n=o,r.createI18n=function(e,t){return r.i18n&&r.i18n.dispose(),e||(e=o),r.i18n=new e(t),r.i18n};var s=t("handlebars");return s.registerHelper("__",function(){if(r.i18n){var e=Array.prototype.slice.call(arguments,0,arguments.length-1);return new s.SafeString(r.i18n.getMessage.apply(r.i18n,e))}return""}),s.registerHelper("__e",function(){if(r.i18n){var e=Array.prototype.slice.call(arguments,0,arguments.length-1);return r.i18n.getMessage.apply(r.i18n,e)}return""}),r.I18n})}(this),function(global){define("beez-mvcr/jsonpath",["require","exports","module","underscore"],function(require,exports,module){var _=require("underscore"),cache={},jsonPath=function jsonPath(obj,expr,arg,testManaged){var P={resultType:arg&&arg.resultType||"VALUE",flatten:arg&&arg.flatten||!1,wrap:arg&&arg.hasOwnProperty("wrap")?arg.wrap:!0,normalize:function(e){if(cache[e])return cache[e];var t=[],r=e.replace(/[\['](\??\(.*?\))[\]']/g,function(e,r){return"[#"+(t.push(r)-1)+"]"}).replace(/'?\.'?|\['?/g,";").replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,"").replace(/#([0-9]+)/g,function(e,r){return t[r]});return cache[e]=r,r},asPath:function(e){for(var t=e.split(";"),r="$",n=1,i=t.length;i>n;n++)r+=/^[0-9*]+$/.test(t[n])?"["+t[n]+"]":"['"+t[n]+"']";return r},store:function(e,t){return e&&("PATH"===P.resultType?P.result[P.result.length]=P.asPath(e):_.isArray(t)&&P.flatten?(P.result||(P.result=[]),_.isArray(P.result)||(P.result=[P.result]),P.result=P.result.concat(t)):P.result?(_.isArray(P.result)||(P.result=[P.result]),_.isArray(t)&&P.flatten?P.result=P.result.concat(t):P.result[P.result.length]=t):P.result=t),!!e},trace:function(e,t,r){if(e){var n=e.split(";"),i=n.shift();if(n=n.join(";"),t&&t.hasOwnProperty(i))P.trace(n,t[i],r+";"+i);else if("*"===i)P.walk(i,n,t,r,function(e,t,r,n,i){P.trace(e+";"+r,n,i)});else if(".."===i)P.trace(n,t,r),P.walk(i,n,t,r,function(e,t,r,n,i){"object"==typeof n[e]&&P.trace("..;"+r,n[e],i+";"+e)});else if(/,/.test(i))for(var o=i.split(/'?,'?/),s=0,a=o.length;a>s;s++)P.trace(o[s]+";"+n,t,r);else/^\(.*?\)$/.test(i)?P.trace(P.evaluate(i,t,r.substr(r.lastIndexOf(";")+1))+";"+n,t,r):/^\?\(.*?\)$/.test(i)?P.walk(i,n,t,r,function(e,t,r,n,i){P.evaluate(t.replace(/^\?\((.*?)\)$/,"$1"),n[e],e)&&P.trace(e+";"+r,n,i)}):/^(-?[0-9]*):(-?[0-9]*):?([0-9]*)$/.test(i)&&P.slice(i,n,t,r)}else t&&(_.isArray(t)||testManaged(t))&&P.store(r,t)},walk:function(e,t,r,n,i){if(r instanceof Array)for(var o=0,s=r.length;s>o;o++)o in r&&i(o,e,t,r,n);else if("object"==typeof r&&testManaged(r))for(var a in r)r.hasOwnProperty(a)&&i(a,e,t,r,n)},slice:function(e,t,r,n){if(r instanceof Array){var i=r.length,o=0,s=i,a=1;e.replace(/^(-?[0-9]*):(-?[0-9]*):?(-?[0-9]*)$/g,function(e,t,r,n){o=parseInt(t||o,10),s=parseInt(r||s,10),a=parseInt(n||a,10)}),o=0>o?Math.max(0,o+i):Math.min(i,o),s=0>s?Math.max(0,s+i):Math.min(i,s);for(var u=o;s>u;u+=a)P.trace(u+";"+t,r,n)}},evaluate:function(x,_v,_vname){try{return $&&_v&&eval(x)}catch(e){throw new SyntaxError("jsonPath: "+e.message+": "+x.replace(/\^/g,"_a"))}}};P.result=P.wrap===!0?[]:void 0;var $=obj;return expr&&obj&&("VALUE"===P.resultType||"PATH"===P.resultType)?(P.trace(P.normalize(expr).replace(/^\$;/,""),obj,"$"),!_.isArray(P.result)&&P.wrap&&(P.result=[P.result]),P.result?P.result:!1):void 0};return jsonPath})}(this),function(){define("beez-mvcr/base",["require","exports","module","beez.core","underscore","beez-mvcr/jsonpath"],function(e){var t=e("beez.core"),r=e("underscore"),n=e("beez-mvcr/jsonpath"),i=t.getLogger("beez.mvcr.base"),o=t.extend("beez.manager.ManagerBase",function(){},{constructor:function(e){this.objs={},this.objs[e]="$",this._idxProp=e||""},getIdx:function(e){return e[this._idxProp]},add:function(e,n){var i=this.get(e);if(!i)throw new t.Error("no parent exists. path: "+e);if(r.isArray(i))throw new t.Error("parent is Array. Specify one by using `[number]` selector. parent: "+i);if(r.isArray(n))r.each(n,function(t){t.prefix=e;var r=this.getIdx(t);i[r]||(i[r]=[]),i[r].push(t)},this);else{n.prefix=e;var o=this.getIdx(n);if(i[o])throw new t.Error("Obj: adding object to same parent with same index. Add obj as Array to add several objs into same index. idx: "+this.getIdx(n));i[o]=n}return this},remove:function(e){var t,n=this.get(e),i=[];n&&(r.isArray(n)||(n=[n]),r.each(n,function(e){var t=this.getChildrenAll(e);i=i.concat(t)},this),t=i.concat(n),r.each(t,function(e){this.deleteFromParent(e)},this),r.each(t,function(e){e.dispose&&e.dispose()}))},isAddable:function(e){return!!this.getIdx(e)},get:function(e){if(void 0===e||"string"!=typeof e)return void 0;if(/^\/$/.test(e))return this.objs;var t=this;e="$"+e.replace(/\//g,".");var r=n(this.objs,e,{wrap:!1},function(e){return t.isAddable(e)});return r?r:void 0},getParent:function(e){return r.isArray(e)?this.get(e[0].prefix):this.get(e.prefix)},deleteFromParent:function(e){if(e){var t=this.getParent(e);r.isArray(e)?delete t[this.getIdx(e[0])]:delete t[this.getIdx(e)]}},getChildren:function(e){var t=[],n=this,i=function o(e){r.each(e,function(e){e&&(r.isArray(e)?o(e):n.getIdx(e)&&t.push(e))})};return i(e),t},getChildrenAll:function(e){var t=[],n=this,o=function s(e){var o=e;r.isArray(e)||(o=r.values(e)),r.each(o,function(o){if(o)if(r.isArray(o))s(o);else if(n.getIdx(o)){if(!o.prefix||!o.manager)return i.warn("Manager ignore the Object haven't been manaegd.",o),void 0;if("$"!==e[n._idxProp]&&!r.isArray(e)&&o.getParent()[n._idxProp]!==e[n._idxProp])return i.warn("Manager ignore the Object haven't been manaegd.","Path that is managed:",n.pathOf(o),"Path to the specified:",n.pathOf(e)),void 0;s(o),t.push(o)}})};return o(e),t},pathOf:function(e){var n="";if(r.isArray(e)){if(r.isEmpty(e))throw new t.Error("pathOf: obj is empty array.");e=e[0]}if(n=e.prefix,!n)throw new t.Error("pathOf: object.prefix does not exist.");return n+(/^\/$/.test(n)?"":"/")+this.getIdx(e)},trace:function(){var e={},t=this.getChildrenAll(this.objs),n=this;return r.each(t,function(t){if(t){var i;i="/"===t.prefix?t.prefix+n.getIdx(t):t.prefix+"/"+n.getIdx(t),e[i]?(r.isArray(e[i])||(e[i]=[e[i]]),e[i].push(t)):e[i]=t}}),e},dispose:function(){delete this.objs,delete this._idxProp}}),s=t.extend("beez.mvcr.Base",function(){},{getParent:function(){return this.manager.getParent(this)},deleteFromParent:function(){return this.manager.deleteFromParent(this)},getChildren:function(){return this.manager.getChildren(this)},getChildrenAll:function(){return this.manager.getChildrenAll(this)},alias:function(e){return this.manager.add(e,this)}});return{ManagerBase:o,Base:s}})}(this),function(){define("beez-mvcr/model",["require","exports","module","beez.core","underscore","backbone","zepto","beez-mvcr/base"],function(e){var t=e("beez.core"),r=e("underscore"),n=e("backbone"),i=e("zepto"),o=e("beez-mvcr/base"),s=o.Base,a=o.ManagerBase,u=t.getLogger("beez.mvcr.model"),c=t.Bucks.extend("beez.mvcr.ModelManagerAsync",{initialize:function(e){this.manager=e,this.current=void 0,this.root=void 0},create:function(e,r,n,i){var o=this;return this.then(function(){var s=o.manager.create(e,r,n,i);return o.root=o.current=s,o.create=function(){throw new t.Error("create called more than once!")},s})},createCollection:function(e,r,n,i){var o=this;return this.then(function(){var s=o.manager.createCollection(e,r,n,i);return o.root=o.current=s,o.createCollection=function(){throw new t.Error("create called more than once!")},s})},child:function(e,n,i){var o=this;return this.then(function(){if(!o.root)throw new t.Error("No chain root exists. `create` first.");var s=o.manager.pathOf(o.current),a=o.manager.create(s,e,n,i);o.current=r.isArray(a)?a[0]:a})},parent:function(){var e=this;return this.then(function(){if(e.current=e.manager.getParent(e.current),!e.current)throw new t.Error("get parent failed")})},bro:function(e,t,r){return this.parent().child(e,t,r)},dispose:function(){u.debug("ModelManagerAsync dispose"),delete this.manager,delete this.current,this.root&&this.root.dispose&&this.root.dispose(),delete this.root}}),l=t.extend("beez.mvcr.ModelManager",a,{initialize:function(){this.constructor.__super__.initialize.call(this,"midx")},async:function(){return new c(this)},root:function p(e){var r=new e(this),p=this.get("/@");if(p)throw new t.Error("root already exists!");if("@"!==r.midx)throw new t.Error('roots midx must be "@"');return this.add("/",r),r},create:function(e,n,i,o){if(!n||!r.isArray(n)&&"function"!=typeof n){var s="Model does not exist / does not be funciton. Specified prefix: "+e;throw new t.Error(s)}if(n instanceof g)throw new t.Error("Collection specified.  Use #createCollection instead.");if(!e)throw new t.Error("No prefix specified. Creating:"+n.name);if(e.indexOf("/@")<0)throw new t.Error('prefix must started by "/@". Creating:'+n.name);if(!this.get(e))throw new t.Error("no parent exists. prefix: "+e+" ,  Please consider constructing in Controller and so on.");return r.isArray(n)?this._createArray(e,n,i,o):this._createObj(e,n,i,o)},_createObj:function(e,r,n,i){var o=new r(n,i,this);if(!this.isAddable(o))throw new t.Error("index does not exists in the Model. :"+o);return this.add(e,o),o},_createArray:function(e,n,i,o){i&&!r.isArray(i)&&(i=[i]),o&&!r.isArray(o)&&(o=[o]);var s=this,a=[];return r.each(n,function(e,t){var r=i?i[t]:void 0,n=o?o[t]:void 0;a.push(new e(r,n,s))}),r.each(a,function(e){if(!this.isAddable(e))throw new t.Error("index does not exist in the Model. :"+e)},this),this.add(e,a),a},createCollection:function(e,r,n,i){if(!r||"function"!=typeof r){var o="Collection does not exist / does not be funciton. Specified prefix: "+e;throw new t.Error(o)}if(!e)throw new t.Error("No prefix specified. Creating:"+r.name);if(e.indexOf("/@")<0)throw new t.Error('prefix must started by "/@". Creating:'+r.name);var s=new r(n,i,this);return this.add(e,s),s},_newAll:function(e,n,i){if(!e)throw new t.Error("ctor does not exist.");r.isArray(e)||(e=[e]),n&&!r.isArray(n)&&(n=[n]),i&&!r.isArray(i)&&(i=[i]);var o=[];return r.each(e,function(e,t){var r=n?n[t]:void 0,s=i?i[t]:void 0;o.push(new e(r,s))}),o},_decideBindedModel:function(e,n){var i,o,s;if(n)o=e;else{i=e,s=[],r.each(i,function(e){var t=this.getChildrenAll(e);s=s.concat(t)},this);var a=s.concat(i),u=r.reject(a,function(e){return e.isBinded()}),c=r.difference(a,u);r.each(c,function(e){throw new t.Error("a disposing model have some bindings. models cid: "+e.cid)}),o=u}return o},remove:function(e,t){u.debug("ModelManager remove");var n=this.get(e);return n?n.isCollection()?(this._decideBindedModel(n,!0).removeAll&&this._decideBindedModel(n,!0).removeAll(t),this.deleteFromParent(n),this):(n&&!r.isArray(n)&&(n=[n]),r.each(this._decideBindedModel(n),function(e){this.deleteFromParent(e)},this),r.each(this._decideBindedModel(n),function(e){e.dispose&&e.dispose()}),this):(u.debug("Path of unmanaged become subject to deletion, I was skipped. path:",e),this)},ajax:{sync:function(e,n){var o=t.config.ajax||{};r.defaults(n||(n={}),{type:e,emulateHTTP:!!o.emulateHTTP});var s=n.beforeSend||function(){};return!n.emulateHTTP||"PUT"!==e&&"DELETE"!==e&&"PATCH"!==e||(n.type="POST"),n.beforeSend=function(t){!n.emulateHTTP||"PUT"!==e&&"DELETE"!==e&&"PATCH"!==e||t.setRequestHeader("X-HTTP-Method-Override",e),s.apply(null,arguments)},i.ajax(n)},get:function(e){return this.sync("GET",e)},post:function(e){return this.sync("POST",e)},put:function(e){return this.sync("PUT",e)},"delete":function(e){return this.sync("DELETE",e)},patch:function(e){return this.sync("PATCH",e)}},dispose:function(){var e=this.getChildrenAll(this.objs);u.debug("ModelManager dispose"),r.each(e,function(e){e.dispose()}),delete this.urlRoot,l.__super__.dispose.apply(this,arguments)}}),h=t.Bucks.extend("beez.mvcr.ModelAsync",{initialize:function(e){this.model=e},fetch:function(e){var t=this.model;return this.then(function(n,i){e=e?r.clone(e):{},e.success=function(e,t){i(null,{model:e,res:t})},e.error=function(t,r){i(new Error(JSON.stringify({model:t,res:r,options:e})))},t.fetch(e)})},save:function(e,t,n){var i;null==e||r.isObject(e)?(i=e,n=t):null!=e&&((i={})[e]=t);var o=this.model;return this.then(function(e,t){n=n?r.clone(n):{},n.success=function(e,r){t(null,{model:e,res:r})
  },n.error=function(e,r){t(new Error(JSON.stringify({model:e,res:r,options:n})))},o.save(i,n)})},destroy:function(e){var t=this.model;return this.then(function(n,i){e=e?r.clone(e):{},e.success=function(e,t){i(null,{model:e,res:t})},e.error=function(t,r){i(new Error(JSON.stringify({model:t,res:r,options:e})))},t.destroy(e)})},dispose:function(){u.debug("ModelAsync dispose"),delete this.model}}),d=t.extend("beez.mvcr.Model",s,n.Model.prototype,{constructor:function(e,r){var n=Array.prototype.slice.call(arguments);r=r||{},r.urlRoot=r.urlRoot||t.config.url.api,(1===n.length&&n[0].objs||2===n.length&&n[1].objs||3===n.length&&n[2].objs)&&(this.manager=n[n.length-1]),this.manager||u.debug("Manager can't be managed this model."),d.__super__.constructor.call(this,e,r)},initialize:function(){d.__super__.initialize.apply(this,arguments)},midx:void 0,async:function(){return new h(this)},isCollection:function(){return!1},isModel:function(){return!0},isBinded:function(){if(this._events){var e,t,n,i,o;for(i=r.keys(this._events),e=0,t=i.length;t>e;e++)if(n=i[e],o=this._events[n],o&&o.length>0)return!0}return!1},dispose:function(){u.debug("Model dispose"),delete this.manager,delete this.cid,delete this.attributes,delete this.collection},remove:function(){throw new t.Error("Use Backbone.model.destroy() or Model.dipose() instead of this")}});d.extend=t.extendThis;var f=t.Bucks.extend("beez.mvcr.CollectionAsync",{initialize:function(e){this.collection=e},create:function(e,t){var r=this;return this.then(function(){return r.collection.create(e,t)})},remove:function(e,t){var r=this;return this.then(function(){return r.collection.remove(e,t)})},_reset:function(){var e=this;return this.then(function(){return e.collection._reset()})},dispose:function(){u.debug("CollectionAsync dispose"),delete this.collection}}),g=t.extend(s,n.Collection.prototype,{constructor:function(e,r,n){this.model||(this.model=d),this.urlRoot=function(){return t.config.url.api}(),this.manager=n;var i=arguments;3<=arguments.length&&(i=Array.prototype.slice.call(arguments,0,arguments.length-1)),g.__super__.constructor.apply(this,i)},initialize:function(){g.__super__.initialize.apply(this,arguments)},midx:void 0,async:function(){return new f(this)},isCollection:function(){return!0},isModel:function(){return!1},remove:function(e){return g.__super__.remove.apply(this,arguments),e=r.isArray(e)?e.slice():[e],r.each(e,function(e){e.dispose&&e.dispose()}),this},removeAll:function(e){return this.remove(this.models,e)},_reset:function(){this.length=0,r.each(this.models,function(e){e.dispose&&e.dispose()}),this.models=[],this._byId={}},isBinded:function(){if(this._events){var e,t,n,i,o;for(i=r.keys(this._events),e=0,t=i.length;t>e;e++)if(n=i[e],o=this._events[n],o&&o.length>0)return!0}return!1},dispose:function(){u.debug("Collection dispose"),r.each(this.models,function(e){e.dispose&&e.dispose()}),delete this.manager,delete this.comparator,delete this.length,delete this.models,delete this._byId}});return g.extend=t.extendThis,{Model:d,Collection:g,ModelManager:l,ModelManagerAsync:c}})}(this),function(){define("beez-mvcr/modic",["require","exports","module","beez.core","underscore","backbone","beez-mvcr/model"],function(e){var t=e("beez.core");e("underscore"),e("backbone");var r=e("beez-mvcr/model"),n=r.Model.extend("beez.mvcr.Modic",{midx:void 0,lRoot:function(){throw new t.Error("not allowed to use this function.")},url:function(){throw new t.Error("not allowed to use this function.")},async:function(){throw new t.Error("not allowed to use this function.")},fetch:function(){throw new t.Error("not allowed to use this function.")},save:function(){throw new t.Error("not allowed to use this function.")}});return{Modic:n}})}(this),function(){define("beez-mvcr/view",["require","exports","module","beez.core","underscore","backbone","beez-mvcr/base"],function(e){var t=e("beez.core"),r=e("underscore"),n=e("backbone"),i=e("beez-mvcr/base"),o=i.Base,s=i.ManagerBase,a=t.getLogger("beez.mvcr.view"),u=t.Bucks.extend("beez.mvcr.ViewManagerAsync",{initialize:function(e){this.manager=e},root:function d(d){var e=this;return this.then(function(){return e.manager.root(d)})},create:function(e,t,n){var i=this;return this.then(function(){var o=i.manager.create(e,t,n),s=r.isArray(o)?o[0]:o;return s})},child:function(e,t){var n=this;return this.then(function(i){var o=n.manager.pathOf(i),s=n.manager.create(o,e,t);return i=r.isArray(s)?s[0]:s})},parent:function(){var e=this;return this.then(function(r){var n=e.manager.getParent(r);if(n)throw new t.Error("get parent failed. current: "+r);return r=n})},bro:function(e,t){return this.parent().child(e,t)},dispose:function(){a.debug("ViewManagerAsync dispose"),delete this.manager,delete this.current,delete this.root}}),c=t.extend("beez.mvcr.ViewManager",s,{initialize:function(){this.constructor.__super__.initialize.call(this,"vidx")},async:function(){return new u(this)},root:function f(e){this.add("/",new function(){this.vidx="@"});var r=new e(this),n=this.getChildren(this.get("/@"));this.remove("/@");var f=this.get("/@");if(f)throw new t.Error("root already exists!");if("@"!==r.vidx)throw new t.Error('roots vidx must be "@"');this.add("/",r);for(var i=0;i<n.length;i++)this.add("/@",n[i]);return r},create:function(e,n,i){if(!n||!r.isArray(n)&&"function"!=typeof n)throw new t.Error("View does not exist / does not be funciton. Specified prefix: "+e);if(!e)throw new t.Error("No prefix specified. Creating:"+n.name);if(e.indexOf("/@")<0)throw new t.Error('prefix must started by "/@". Creating:'+n.name);if(!this.get(e))throw new t.Error("no parent exists. prefix: "+e+" ,  Please consider constructing view in Controller, or in #beforeOnce and so on.");return r.isArray(n)?this._createArray(e,n,i):this._createObj(e,n,i)},_createObj:function(e,r,n){var i=new r(this,n);if(!this.isAddable(i))throw new t.Error("index does not exists in the View. :"+i);return this.add(e,i),i},_createArray:function(e,n,i){var o=this;i&&!r.isArray(i)&&(i=[i]);var s=[];return r.each(n,function(e,t){var r=i?i[t]:void 0,n=new e(o,r);s.push(n)}),r.each(s,function(e){if(!this.isAddable(e))throw new t.Error("index does not exists in the View. :"+e)},this),this.add(e,s),s},remove:function(){c.__super__.remove.apply(this,arguments)},dispose:function(){var e=this.getChildrenAll(this.objs);a.debug("ViewManager dispose"),r.each(e,function(e){e.dispose()}),c.__super__.dispose.apply(this,arguments)}}),l=t.Bucks.extend("beez.mvcr.ViewAsync",{initialize:function(e){this._root=e},_render:function(e){return this.then(function(){return e}),e.state.isBeforeOnce||this.then(function(e,t){return e.visible?e.beforeOnce.length?(e.beforeOnce(function(){e.state.isBeforeOnce=!0,t(null,e)}),void 0):(e.beforeOnce(),e.state.isBeforeOnce=!0,t(null,e),void 0):(a.debug("view",e.vidx,"is not visible. skip `beforeOnce`."),t(null,e),void 0)}),this.then(function(e,t){return e.visible?e.before.length?(e.before(function(){t(null,e)}),void 0):(e.before(),t(null,e),void 0):(a.debug("view",e.vidx,"is not visible. skip `before`."),t(null,e),void 0)}),this.then(function(e,t){return e.visible?e.render.length?(e.render(function(){t(null,e)}),void 0):(e.render(),t(null,e),void 0):(a.debug("view",e.vidx,"is not visible. skip `render`."),t(null,e),void 0)}),this.then(function(e,t){return e.visible?e.after.length?(e.after(function(){t(null,e)}),void 0):(e.after(),t(null,e),void 0):(a.debug("view",e.vidx,"is not visible. skip `after`."),t(null,e),void 0)}),e.state.isAfterOnce||this.then(function(e,t){return e.visible?e.afterOnce.length?(e.afterOnce(function(){e.state.isAfterOnce=!0,t(null,e)}),void 0):(e.afterOnce(),e.state.isAfterOnce=!0,t(null,e),void 0):(a.debug("view",e.vidx,"is not visible. skip `afterOnce`."),t(null,e),void 0)}),this},_remove:function(e){return this.then(function(){return e.remove(),e})},show:function(e){if(!this._root)throw new t.Error("render root is not set. initialize renderer with root view parameter.");return this._show(this._root,e)},_show:function(e,t){if(void 0===t&&(t=!0),r.isArray(e)){if(r.isEmpty(e))return this;e.sort(function(e,t){return e.order<t.order?-1:e.order>t.order?1:0});var n=r.map(e,function(e){return function(r,n,i){if(r)throw r;(new l)._show(e,t).end(function(e){i(e,void 0)})}});this.waterfall(n)}else a.debug("showing",e.vidx),this._render(e,t);return t&&this.then(function(e,n){if(!e)return n(null,e);var i=e.getChildren();return r.isEmpty(i)?n(null,e):(new l)._show(i,t).end(n)}),this},hide:function(e){if(!this._root)throw new t.Error("render root is not set. initialize renderer with root view parameter.");return this._hide(this._root,e)},_hide:function(e,t){if(void 0===t&&(t=!0),r.isArray(e)){var n=r.map(e,function(e){return function(r,n,i){if(r)throw r;(new l)._hide(e,t).end(function(e){i(e,void 0)})}});this.waterfall(n)}else a.debug("hiding",e.vidx),this._remove(e);return t&&this.then(function(e,n){if(!e)return n(null,e);var i=e.getChildren();return r.isEmpty(i)?n(null,e):(new l)._hide(i,t).end(n)}),this},dispose:function(){a.debug("ViewAsync dispose"),delete this._root}}),h=t.extend("beez.mvcr.View",o,n.View.prototype,{constructor:function(){if(arguments.length<1)throw new t.Error("In order to create a View, requires one arguments.");this.manager=arguments[0],this.state={isBeforeOnce:!1,isAfterOnce:!1},this.visible=!0,h.__super__.constructor.apply(this,Array.prototype.slice.call(arguments,1))},initialize:function(){h.__super__.initialize.apply(this,arguments)},vidx:void 0,el:void 0,order:0,beforeOnce:t.none,before:t.none,after:t.none,afterOnce:t.none,async:function(){return new l(this)},isRendered:function(){return!!this.el&&!!this.el.parentElement},setVisible:function(e){if("boolean"!=typeof e)throw t.Error("typeof visible invalid. should be boolean.");return this.visible=e,this},dispose:function(){a.debug("View dispose"),this.remove(),h.__super__.undelegateEvents.apply(this,arguments),delete this.manager,delete this.state,delete this.visible,delete this.cid,delete this.options,delete this.$el,delete this.model,delete this.collection,delete this.el,delete this.attributes,delete this.className,delete this.tagName},remove:function(){h.__super__.remove.apply(this,arguments)}});return h.extend=t.extendThis,{View:h,ViewAsync:l,ViewManager:c,ViewManagerAsync:u}})}(this),function(){define("beez-mvcr/controller",["require","exports","module","beez.core","beez.mvcr","beez.i18n","underscore"],function(e){var t=e("beez.core");e("beez.mvcr"),e("beez.i18n");var r=t.getLogger("beez.mvcr.controller"),n=e("underscore"),i=t.Bucks.extend("beez.mvcr.ControllerManagerAsync",{initialize:function(e){this.manager=e},create:function(e,n){var i=this;return this.then(function(r,o){if(!n||"function"!=typeof n)throw new t.Error("Controller does not exist / does not be funciton. Specified name: "+e);if(i.manager.controllers[e])throw new t.Error("It is a singleton in the module. name:"+e);var s=new n;i.manager.controllers[e]=s,o(r,i.manager.controllers[e])}).then(function(e,t){e.loadCSS(function(){t(null,e)})}).then(function(e,t){e.loadI18n(function(n){n&&(r.error("i18n load error. ",n.message),r.debug(n.stack)),t(n,e)})})},dispose:function(){r.debug("ControllerManagerAsync dispose"),delete this.manager}}),o=t.extend("beez.mvcr.ControllerManager",function(){return this.initialize()},{initialize:function(){this.controllers={}},async:function(){return new i(this)},remove:function(e){var t=this.get(e);return t?(delete this.controllers[e],this):this},get:function(e){return this.controllers[e]},dispose:function(){r.debug("ControllerManager dispose"),delete this.controllers}}),s=t.extend("beez.mvcr.Controller",function(){this.initialize.apply(this,arguments)},{initialize:function(){},i18n:function(){},loadI18n:function(i){t.i18n||t.createI18n();var o=this;if(t.utils.is("Object",this.i18n)){var s=[],a=[];n.each(this.i18n,function(e,t){s.push(t),a.push(e)}),e(a,function(){for(var e=Array.prototype.slice.call(arguments),n=0;n<e.length;n++){var a={};a[s[n]]=e[n],t.i18n.add(a),r.debug("i18n file loaded. path:",o.i18n[n])}i&&i(null)},function(e){i&&i(e)})}else t.utils.is("Function",this.i18n)?(new t.Bucks).add(function(e,t,r){0<o.i18n.length?o.i18n(function(e,t){r(e,t)}):r(null,o.i18n())}).add(function(e,r){r&&t.i18n.add(r),i&&i(e,r)}).end():i&&i(new Error("The Controller.i18n, please be defined in Function."));return this},loadCSS:function(e){var r=this.css;if(!r||r.length<1)return e&&e();var i=n.map(r,function(e){return function(r,n,i){t.manager.css.async().load(e).end(function(e,t){i(r,t[0])},function(e){i(e)})}}),o=new t.Bucks;return o.parallel(i).end(function(t,r){e&&e(t,r)}),this},dispose:function(){r.debug("Controller dispose"),delete this.constructor.prototype.css}});return s.extend=t.extendThis,{Controller:s,ControllerManager:o,ControllerManagerAsync:i}})}(this),function(){define("beez-mvcr/router",["require","exports","module","beez.core","beez.mvcr","underscore","backbone"],function(e){var t=e("beez.core");e("beez.mvcr");var r=t.getLogger("beez.mvcr.router"),n=e("underscore"),i=e("backbone"),o={initialize:function(){this.router=void 0,this.started=!1},start:function(i,o){var s=this;if(this.started)throw new t.Error("Already been executed once. If you want to add a route, please refer to the function add().");var a=t.config.router||{},u=n.extend(a,i);if(r.debug("router.start",JSON.stringify(u)),this.router)return this;this.router=o||new t.Router;for(var c=n.keys(u),l=0;l<c.length;l++){var h=c[l],d=u[h];r.debug("router.route",h,JSON.stringify(d)),this.router.route(d.route,d.name,function(n){function i(){if(!u.hasOwnProperty(n))throw new t.Error("route map key does not exist. name: "+n);var i=u[n],o=arguments;r.debug("router.proxy",i),t.manager.c.get(i.xpath)||(r.debug("run controller firstBefore function. data:",i),s.router.firstBefore(i)),e([i.require],function(e){r.debug("controller.exec",i.xpath);var n=t.manager.c.get(i.xpath);if(n){if(!n[i.name])throw new t.Error('"'+i.name+'" to Controller I is undefined.');r.debug("run controller before function. data:",i),s.router.before(i,e),n[i.name].apply(n,o),r.debug("run controller after function. data:",i),s.router.after(i,e)}else t.manager.c.async().create(i.xpath,e).then(function(n){if(!n[i.name])throw new t.Error('"'+i.name+'" to Controller I is undefined.');r.debug("run controller before function. data:",i),s.router.before(i,e),n[i.name].apply(n,o),r.debug("run controller after function. data:",i),s.router.after(i,e)}).end()})}return i}(h))}this.started=!0},navigate:function(e,r){if(!this.started||!this.router)throw new t.Error('Initialization has not been performed even once. Please do a "start()".');return this.router.navigate(e,r)}},s=t.extend("beez.mvcr.RouterManager",function(){return this.initialize()},o),a=t.extend("beez.mvcr.Router",i.Router,{constructor:function(){a.__super__.constructor.apply(this,arguments)},initialize:function(){a.__super__.initialize.apply(this,arguments)},firstBefore:function(){},before:function(){},after:function(){}});return{Router:a,RouterManager:s}})}(this),function(){define("beez-mvcr/cssmanager",["require","exports","module","beez.core","underscore","zepto"],function(e){var t=e("beez.core"),r=t.getLogger("beez.mvcr.cssmanager"),n=e("underscore"),i=e("zepto"),o=function(e){var t=document.styleSheets,r=n.find(t,function(t){var r=t.href;return r&&-1!==r.indexOf(e)});return r&&r.rules&&r.rules.length>0},s=function(e){var t=document.styleSheets,r=n.find(t,function(t){var r=t.href;return r&&-1!==r.indexOf(e)});return!!r},a=t.Bucks.extend("beez.mvcr.CSSManagerAsync",{initialize:function(e){this.manager=e,this._path="",this._intervalId=void 0,this._timeoutId=void 0,this.INTERVAL=t.config.manager&&t.config.manager.css&&t.config.manager.css.interval||50,this.TIMEOUT=t.config.manager&&t.config.manager.css&&t.config.manager.css.timeout||1e4},load:function(e){var o=this,a=this._path=e;if(e.match(/^(http|https):\/\/.+$/)||(a=this._path=this.manager.name2path(e)),!a)return this.empty();if(this.manager.isLoaded(a))return r.debug("path: "+a+" already exists"),a=void 0,this.empty();var u='<link rel="stylesheet" href="'+n.escape(a)+'" ></link>';return i("head").append(u),this.then(function(e,n){o._intervalId=setInterval(function(){s(a)&&(o.abort(),r.debug("load finished. path: "+a),n())},o.INTERVAL),o._timeoutId=setTimeout(function(){o.abort(),n(new t.Error("loading timed out. path:"+a))},o.TIMEOUT)})},remove:function(e){var t=this;return this.then(function(){return t.manager.remove(e)})},abort:function(){clearTimeout(this._timeoutId),clearInterval(this._intervalId),delete this._timeoutId,delete this._intervalId,delete this.INTERVAL,delete this.TIMEOUT},dispose:function(){r.debug("CSSManagerAsync dispose"),delete this.manager,delete this._path,this.abort()}}),u=t.extend("beez.mvcr.CSSManager",function(){return this.initialize()},{initialize:function(){this._basePath="",t.config.url&&t.config.url.base&&(this._basePath=t.config.url.base,this._basePath.replace(/\/$/,""))},name2path:function(e){var t="";return t=this._basePath?0===e.indexOf("/")?this._basePath+e:this._basePath+"/"+e:e},async:function(){return new a(this)},remove:function(e){var t=i("link[rel=stylesheet]");return t.each(function(){-1!==this.href.indexOf(e)&&(r.debug("remove finished. name:",e,", path: "+this.href),i(this).remove())}),this},isExists:o,isLoaded:s,dispose:function(){r.debug("CSSManager dispose"),delete this._basePath}});return{CSSManager:u,CSSManagerAsync:a}})}(this),function(){define("beez-mvcr/imagemanager",["require","exports","module","beez.core","beez.utils","underscore","zepto"],function(e){var t=e("beez.core");e("beez.utils");var r=e("underscore"),n=e("zepto"),i=t.getLogger("beez.mvcr.imagemanager"),o="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAMAAAAoyzS7AAAABlBMVEX///8AAABVwtN+AAAAAXRSTlMAQObYZgAAAA1JREFUeNoBAgD9/wAAAAIAAVMrnDAAAAAASUVORK5CYII=",s=0,a=function(){return"__beez_manager_image_uid_"+s++},u=t.extend("beez.mvcr.ImagePool",function(e,t){return this.initialize(e,t)},{initialize:function(e,t){this.options=t||{},this.limit=e,this._total=0,this._num_used=0,this._using={},this._unused=[]},create:function(e){var r;if(e=e||{},this._unused.length>0)r=this._unused.pop();else{if(this.limit>0&&this._total>=this.limit)throw new t.Error("image pool limit exceeds!");r=new Image,r.__beez_manager_image_uid=a(),this._total++}e.crossOrigin?r.crossOrigin=e.crossOrigin:this.options.crossOrigin&&(r.crossOrigin=this.options.crossOrigin),this._num_used++,this._using[r.__beez_manager_image_uid]=r;var n=this;return r.release=function(){this.crossOrigin=null,this.src=o,n._using&&delete n._using[this.__beez_manager_image_uid],n._unused&&n._unused.push(this),n._num_used&&n._num_used--,delete this.release},r},living:function(){return this._num_used},peak:function(){return this._total},waiting:function(){return this._unused.length},dispose:function(){i.debug("ImangePool dispose");for(var e in this._using)this._using[e].release();for(delete this._using;this._unused.length>0;){var t=this._unused.pop();delete t.__beez_manager_image_uid}delete this._unused,delete this._num_used,delete this._total,delete this._limit}}),c=t.Bucks.extend("beez.mvcr.ImageManagerAsync",{initialize:function(e){this.imageManager=e},loadOne:function(e,r){var i=this.imageManager.create(r),o=this;return this.add(function(r,s,a){var u=n(i),c=function(){u.off(),a(null,i)},l=function(){var e=i.src;u.off(),i.release(),a(new t.Error("error on load image. src:"+e))},h=function(){var e=i.src;u.off(),i.release(),a(new t.Error("image loading aborted. src:"+e))};u.on("load",c),u.on("error",l),u.on("abort",h);var d=o.imageManager.imageUrl(e);i.src=d})},load:function(e,n){if(r.isString(e))e=[e];else if(!r.isArray(e))throw new t.Error("url can be String or Array of string.");if(n=n||{},!r.isArray(n)){if(!r.isObject(n))throw new t.Error("options can be Object or Array of object.");n=[n]}var i=this,o=r.map(e,function(e,t){return function(r,o,s){new c(i.imageManager).loadOne(e,n[t]).end(function(e,t){s(e,t[0])},function(e){s(e)})}});return this.parallel(o)},dispose:function(){delete this.imageManager}}),l=t.extend("beez.mvcr.ImageManager",function(e){return this.initialize(e)},{initialize:function(e){var t=e&&e.size?e.size:0,r=e&&e.pool?e.pool:{};this.pool=new u(t,r)},imageUrl:function(e){return e.replace("${ratio}",10*t.utils.pixelRatio)},create:function(e){return this.pool.create(e)},living:function(){return this.pool.living()},peak:function(){return this.pool.peak()},waiting:function(){return this.pool.waiting()},load:function(e,t){return new c(this).load(e,t)},loadOne:function(e,t){return new c(this).loadOne(e,t)},dispose:function(){i.debug("ImageManagerAsync dispose"),this.pool.dispose(),delete this.pool}});return{ImageManager:l,ImageManagerAsync:c}})}(this),function(){define("beez.mvcr",["require","exports","module","beez.core","handlebars","beez-mvcr/model","beez-mvcr/modic","beez-mvcr/view","beez-mvcr/controller","beez-mvcr/router","beez-mvcr/cssmanager","beez-mvcr/imagemanager","beez-mvcr/base","backbone","beez-mvcr/model","beez-mvcr/view","beez-mvcr/controller","beez-mvcr/router","beez-mvcr/cssmanager","beez-mvcr/imagemanager"],function e(t){var r=t("beez.core"),n=r.getLogger("beez.mvcr");if(r.mvcr)return n.debug("beez.mvcr already defined."),r.mvcr;var i=t("handlebars");r.getTemplate=function(e){return i.templates[e]};var e={initialize:function(){var e=t("beez-mvcr/model"),r=t("beez-mvcr/modic"),n=t("beez-mvcr/view"),i=t("beez-mvcr/controller"),o=t("beez-mvcr/router"),s=t("beez-mvcr/cssmanager"),a=t("beez-mvcr/imagemanager"),u=t("beez-mvcr/base");this.Model=e.Model,this.ModelManager=e.ModelManager,this.ModelManagerAsync=e.ModelManagerAsync,this.Collection=e.Collection,this.Modic=r.Modic,this.View=n.View,this.ViewAsync=n.ViewAsync,this.ViewManager=n.ViewManager,this.ViewManagerAsync=n.ViewManagerAsync,this.Controller=i.Controller,this.ControllerManager=i.ControllerManager,this.ControllerManagerAsync=i.ControllerManagerAsync,this.Router=o.Router,this.RouterManager=o.RouterManager,this.CSSManager=s.CSSManager,this.CSSManagerAsync=s.CSSManagerAsync,this.ImageManager=a.ImageManager,this.ImageManagerAsync=a.ImageManagerAsync,this.ManagerBase=u.ManagerBase,this.Base=u.Base}},o=r.extend("beez.MVCR",function(){return this.initialize()},e),s=new o;r.mvcr=s,r.Model=s.Model,r.Collection=s.Collection,r.Modic=s.Modic,r.View=s.View,r.Controller=s.Controller,r.Router=s.Router;var a=t("backbone");r.history=a.history;var u=r.config.manager||{},c={initialize:function(){this.started=!1,this.model=void 0,this.m=void 0,this.view=void 0,this.v=void 0,this.controller=void 0,this.c=void 0,this.router=void 0,this.r=void 0,this.css=void 0,this.image=void 0},start:function(e){if(this.started)return this;if(e=e||{},this.started=!0,e.model)this.model=e.model;else{var r=t("beez-mvcr/model");this.model=new r.ModelManager("midx")}if(this.m=this.model,e.view)this.view=e.view;else{var n=t("beez-mvcr/view");this.view=new n.ViewManager("vidx")}if(this.v=this.view,e.controller)this.controller=e.controller;else{var i=t("beez-mvcr/controller");this.controller=new i.ControllerManager}if(this.c=this.controller,e.router)this.router=e.router;else{var o=t("beez-mvcr/router");this.router=new o.RouterManager}if(this.r=this.router,e.css)this.css=e.css;else{var s=t("beez-mvcr/cssmanager");this.css=new s.CSSManager}if(e.image)this.image=e.image;else{var a=t("beez-mvcr/imagemanager");this.image=new a.ImageManager(u.image)}return this}},l=r.extend("beez.Manager",function(){return this.initialize()},c),h=new l;return s.manager=h,r.manager=s.manager,r.mvcr})}(this);var VERSION="0.9.8";"undefined"!=typeof module&&module.exports?exports.VERSION=VERSION:(VERSION=VERSION,function(){define("beez",["require","exports","module","beez.core","beez.mvcr","beez.utils","underscore","zepto","backbone","handlebars"],function(e){var t=e("beez.core");e("beez.mvcr"),e("beez.utils");var r={_:e("underscore"),$:e("zepto"),Backbone:e("backbone"),Handlebars:e("handlebars")};return t.vendor=r,t.VERSION=VERSION,t})}(this));