!function(e){e.su=e.su||{},e.ajaxSetup({type:"POST",cache:!0,success:function(e,t,s){},error:function(e,t,s){}}),e.su.format={},e.su.format.capitalize=function(e){return e=e.toLowerCase(),e.replace(/\b(\w)|\s(\w)/g,function(e){return e.toUpperCase()})},e.su.Record=function(){var e={};this.getData=function(){return e},this.setData=function(t){e=t}},e.su.getAttrObject=function(e,t){if(!(t=t.replace(/[\{,\}]/g,"")))return"";if("true"===t)return!0;if("false"===t)return!1;if(/^\d+$/.test(t))return parseInt(t,10);for(var s=t.split("."),i=e,r=0,n=s.length;r=0&&e<10?"0"+Math.floor(e):e.toString()},s=new Date,i="",r=e(function(e){return e.getFullYear()+t(e.getMonth()+1)+t(e.getDay())}(s),16),n=e(function(e){return t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())+t(parseInt(e.getMilliseconds()/10,10))}(s),16),a=0;a<9;a++)i+=Math.floor(16*Math.random()).toString(16);for(i+=r,i+=n;i.length<32;)i+=Math.floor(16*Math.random()).toString(16);return function(e){return e.slice(0,8)+"-"+e.slice(8,12)+"-"+e.slice(12,16)+"-"+e.slice(16,20)+"-"+e.slice(20)}(i)},e.su.clone=function(t){var s,i;switch(Object.prototype.toString.call(t)){case"[object Array]":for(s=[],i=0;i0;s--)if(document.all){if(" "!=e.slice(s,s+1))break}else if(" "!=e[s])break;return s0;){if(-1==(s=r.indexOf(";"))){if(i=r,!0===e(i))return-1==(s=i.indexOf("="))?null:t(i.slice(s+1))}else if(i=r.slice(0,s),!0===e(i))return-1==(s=i.indexOf("="))?null:t(i.slice(s+1));r=r.slice(s+1)}return null},e.su.getObjectLength=function(e){var t=0;if(e)for(var s in e)e.hasOwnProperty(s)&&t++;return t},e.su.isIe=new Function("return !-[1,];")(),e.su.getBrowseVersion=function(){var e,t={},s=navigator.userAgent.toLowerCase();return(e=s.match(/msie ([\d.]+)/))?(t.browse="ie",t.version=e[1]):(e=s.match(/firefox\/([\d.]+)/))?(t.browse="firefox",t.version=e[1]):(e=s.match(/chrome\/([\d.]+)/))?(t.browse="chrome",t.version=e[1]):(e=s.match(/opera.([\d.]+)/))?(t.browse="opera",t.version=e[1]):(e=s.match(/version\/([\d.]+).*safari/))&&(t.browse="safari",t.version=e[1]),t},e.su.apply=function(t,s,i){if(i&&e.su.apply(t,i),t&&s&&"object"==typeof s){var r;for(r in s)s.hasOwnProperty(r)&&(t[r]=s[r])}return t},e.su.keyHandler=function(e){return e.toString().replace(/[\/\.\:\s\(\)]/g,"_")}}(jQuery),function(e){e.su.Base=function(){var t=function(){};return e.su.apply(t,{$className:"SU.Base",$isClass:!0,create:function(){return e.su.create.apply(e.su,[this].concat(Array.prototype.slice.call(arguments,0)))},extend:function(t){var s,i,r,n,a,o,l=t.prototype,c=function(){};if(c.prototype=l,i=this.prototype=new c,i.self=this,this.superclass=i.superclass=l,!t.$isClass){s=e.su.Base.prototype;for(r in s)r in i&&(i[r]=s[r])}if(o=l.$inheritableStatics)for(r=0,n=o.length;r0)for(e=0;e=0;n--){var a=r.eventDealer.eventInfo[e][n];a.fn==t&&a.scope==s&&r.eventDealer.eventInfo[e].splice(n,1)}}},e.prototype.one=function(e,t,s){var i=this;s=s||i,i.eventDealer.eventInfo[e]?i.eventDealer.eventInfo[e].push({fn:t,scope:s,once:!0}):i.eventDealer.eventInfo[e]=[{fn:t,scope:s,once:!0}]},e.prototype.fireEvent=function(e,t){var s=this;s.eventDealer;var i=s.eventDealer.eventInfo[e];if(i)for(var r=i.slice(0),n=0;n=0&&this.getView(t).createChildrenWidgets();else for(var s in this.view)this.view.hasOwnProperty(s)&&this.getView(this.view[s]).createChildrenWidgets()},r=function(t){var s,i=e.Deferred(),r=this,n=[];if(this.fireEvent("before_render"),t)e.inArray(t,this.view)>=0&&e.when(this.getView(t).render()).done(function(){o.call(r),r.fireEvent("after_render"),i.resolve()});else{for(s=0;s");1==n.length?e(t).on(s,i[r].effectiveHandler):(2!==n.length&&console.error("bindEvent error, incorrect selector format"),e(n[0]).delegate(n[1],s,i[r].effectiveHandler))}})})},l=function(){e.each(this.domEventsMap,function(t,s){e.each(s,function(s,i){for(var r=0;r");1==n.length?e(t).off(s,i[r].effectiveHandler):(2!==n.length&&console.error("bindEvent error, incorrect selector format"), e(n[0]).undelegate(n[1],s,i[r].effectiveHandler))}})})},c=function(){this.initViews(),this.initModels(),this.initStores(),this.initViewData()};return s.prototype.launch=function(t){i.call(this),e.when(r.call(this)).done(t)},s.prototype.initViews=function(){var t,s=this,i=this.settings;if(this.view=[],i.view)for(var r=0;r");1==o.length?e(i).on(r,a):(2!==o.length&&console.error("bindEvent error, incorrect selector format"),e(o[0]).delegate(o[1],r,a)),this.domEventsMap[i]||(this.domEventsMap[i]={}),this.domEventsMap[i][r]||(this.domEventsMap[i][r]=[]),this.domEventsMap[i][r].push({effectiveHandler:a,handler:n})}},s.prototype.unControl=function(t){var s=this;for(var i in t)if(t.hasOwnProperty(i))for(var r in t[i])if(t[i].hasOwnProperty(r)){var n=i.split("=>"),a=t[i][r];if("string"==typeof a){if(!s[a])throw new Error('No method named "'+a+'"');a=s[a]}if(this.domEventsMap[i]&&this.domEventsMap[i][r])for(var o=this.domEventsMap[i][r].length-1;o>=0;o--)if(this.domEventsMap[i][r][o].handler==a){if(1==n.length)e(i).off(r,this.domEventsMap[i][r][o].effectiveHandler);else{if(2!==n.length){console.error("bindEvent error, incorrect selector format");break}e(n[0]).undelegate(n[1],r,this.domEventsMap[i][r][o].effectiveHandler)}this.domEventsMap[i][r].splice(o,1);break}}},s.prototype.listen=function(t){var s=this;for(var i in t)if(t.hasOwnProperty(i)){var r=e.su.getAttrObject(this.data,i);if(!r){var n=i.split(".");"views"===n[0]&&this.data.views[n[1]]&&void 0!==n[2]&&(r=this.data.views[n[1]][n[2]]=new e.su.DataFieldBind(new e.su.Model.DataField))}for(var a in t[i])if(t[i].hasOwnProperty(a)){var o=t[i][a];if("string"==typeof o){if(!s[o])throw new Error('No method named "'+o+'"');o=s[o]}r.addListener(a,o,s),this.dataEventsMap[i]||(this.dataEventsMap[i]={}),this.dataEventsMap[i][a]||(this.dataEventsMap[i][a]=[]),this.dataEventsMap[i][a].push(o)}}},s.prototype.unListen=function(t){var s,i=this;for(var r in t)if(t.hasOwnProperty(r)){var n=e.su.getAttrObject(this.data,r);for(var a in t[r])if(t[r].hasOwnProperty(a)){var o=t[r][a];if("string"==typeof o){if(!i[o])throw new Error('No method named "'+o+'"');o=i[o]}this.dataEventsMap[r]&&this.dataEventsMap[r][a]&&(s=e.inArray(o,this.dataEventsMap[r][a]))>=0&&(n.removeListener(a,o,i),this.dataEventsMap[r][a].splice(s,1))}}},s.prototype.addModel=function(t){var s;e.isArray(t)||(t=[t]);for(var i=0,r=t.length;i=0?e.su.storeManager.get(t):null},s.prototype.getModel=function(t){return e.inArray(t,this.model)>=0?e.su.modelManager.get(t):null},s.prototype.getView=function(t){return e.inArray(t,this.view)>=0?e.su.viewManager.get(t):null},s.prototype.viewsEffective=function(){for(var e=0;e=0){if(this.effectiveViewDatas[t])for(var s=0;s=0?e.su.moduleManager.query(t):null},r.prototype.destroy=function(){this.fireEvent("ev_before_destroy",[this]),r.superclass.destroy.call(this),this.data.deps={},this.services={}},r.EVENT=s,r.STATUS=i,r}()}(jQuery),function(){function e(){return this.msg||this.message}$.su.Error=function(t){"string"==typeof t&&(t={msg:t});var s=new Error;return $.su.apply(s,t),s.message=s.message||s.msg,s.toString=e,s},$.su.apply($.su.Error,{ignore:!1,raise:function(e){if(e=e||{},"string"==typeof e&&(e={msg:e}),!0!==this.handle(e))throw new $.su.Error(e)},handle:function(){return this.ignore}})}(),$.su.raise=function(){$.su.Error.raise.apply($.su.Error,arguments)},function(e){e.su.Router=function(){var t=function(){e.su.Observable.call(this),this.routerList={},this.modelsMap={},this._fileLoading=[],this._fileLoaded=[],this._fileLoadedHandlerMap={},this.addListener("ev_file_loaded",function(e,t){for(var s=this._fileLoadedHandlerMap[t];s&&s.length;)s.shift()()})};e.su.inherit(e.su.Observable,t);var s=function(e,t){this._fileLoadedHandlerMap[e]?this._fileLoadedHandlerMap[e].push(t):this._fileLoadedHandlerMap[e]=[t]};return t.prototype.loadFile=function(t,i){var r=this;e.inArray(t,this._fileLoaded)>=0?i():e.inArray(t,this._fileLoading)>=0?!!i&&s.call(r,t,i):(!!i&&s.call(r,t,i),e.getScript(t).done(function(){var s=e.inArray(t,r._fileLoading);r._fileLoading.splice(s,1),r._fileLoaded.push(t),r.fireEvent("ev_file_loaded",[t])}).fail(function(e,s,i){"parsererror"===s&&console.error("load file error: ",t,"\n",i)}),this._fileLoading.push(t))},t.prototype.set=function(t){var t=t;e.isEmptyObject(t)||(e.each(t,function(e,t){"string"==typeof t.controller&&(t.controller={_default:t.controller}),"string"==typeof t.view&&(t.view={_default:t.view})}),this.routerList=t)},t.prototype.setItem=function(t,s){this.routerList[t]?e.extend(!0,this.routerList[t],s):this.routerList[t]=s,"string"==typeof this.routerList[t].controller&&(this.routerList[t].controller={_default:this.routerList[t].controller}),"string"==typeof this.routerList[t].view&&(this.routerList[t].view={_default:this.routerList[t].view})},t.prototype.query=function(e){return this.routerList[e]},t.prototype.loadController=function(e,t,s){var i,r,n=e;"function"==typeof t?r=t:(i=t,r=s);var a=this.routerList[n];i?a.controller[i]&&this.loadFile.call(this,a.controller[i],r):this.loadFile.call(this,a.controller._default,r)},t.prototype.loadView=function(t,s,i){var r,n,a=t;"function"==typeof s?n=s:(r=s,n=i);var o=this.routerList[a];r?o.view[r]&&e.get(o.view[r]).done(n):e.get(o.view._default).done(n)},t.prototype.setModelsPath=function(e){for(var t in e)e.hasOwnProperty(t)&&(this.modelsMap[t]=e[t])},t.prototype.loadModel=function(e,t){if(!this.modelsMap[e])throw new Error('Model "'+e+'" has not declare file path');this.loadFile.call(this,this.modelsMap[e],t)},t}()}(jQuery);