UNPKG

nest-parrot

Version:
2 lines 260 kB
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=b:"function"==typeof define&&define.amd?define("parrot",["jquery","jsface","moment","react","react-dom"],b):b(a,jQuery,jsface,moment,React,ReactDOM)}("undefined"!=typeof window?window:this,function(a,b,c,d,e,f,g){var h=a.$pt,i={};a.$pt=i;b.browser,b.deparam;return i.noConflict=function(){return a.$pt=h,i},function(a){var b={console:function(){for(var b=function(){},c=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],d=c.length,e=a.console=a.console||{};d--;){var f=c[d];e[f]||(e[f]=b)}a.console=a.console?a.console:e},string:function(){void 0===String.prototype.upperFirst&&(String.prototype.upperFirst=function(){return 1==this.length?this.toUpperCase():this.substring(0,1).toUpperCase()+this.substring(1)}),String.prototype.endsWith||(String.prototype.endsWith=function(a,b){var c=this.toString();(void 0===b||b>c.length)&&(b=c.length),b-=a.length;var d=c.indexOf(a,b);return-1!==d&&d===b}),String.prototype.startsWith||(String.prototype.startsWith=function(a){return this.slice(0,a.length)===a}),String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}),void 0===String.prototype.isEmpty&&(String.prototype.isEmpty=function(){return 0===this.length}),void 0===String.prototype.isBlank&&(String.prototype.isBlank=function(){return 0===this.trim().length}),void 0===String.prototype.format&&(String.prototype.format=function(a){return this.replace(/%(\d+)/g,function(b,c){return a[--c]})}),void 0===String.prototype.currencyFormat&&(String.prototype.currencyFormat=function(a){return a=a||0,(1*this).toFixed(a).replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")}),void 0===String.prototype.padLeft&&(String.prototype.padLeft=function(a,b){var c=0,d=this?this:"";for(b=b||"0",c=d.length;c<a;)d=b+d,c++;return d}),void 0===String.prototype.padRight&&(String.prototype.padRight=function(a,b){var c=0,d=this?this:"";for(b=b||"0",c=d.length;c<a;)d+=b,c++;return d}),void 0===String.prototype.movePointLeft&&(String.prototype.movePointLeft=function(a){var b,c,d,e,f,g;return e=".",g="",b=this?this:"",a<=0?b:(f=b.split("."),c=f[0]?f[0]:"",d=f[1]?f[1]:"","-"==c.slice(0,1)&&(c=c.slice(1),g="-"),c.length<=a&&(e="0.",c=c.padLeft(a)),g+c.slice(0,-a)+e+c.slice(-a)+d)}),void 0===String.prototype.movePointRight&&(String.prototype.movePointRight=function(a){var b,c,d,e,f,g;if(e=".",b=this?this:"",a<=0)return b;f=b.split("."),c=f[0]?f[0]:"",d=f[1]?f[1]:"",d.length<=a&&(e="",d=d.padRight(a)),"-"==c.slice(0,1)?(c=c.slice(1),g="-"):g="",0==c&&(c="");var h=(c+d.slice(0,a)).replace(/^0+/,"");return h.isEmpty()&&(h="0"),g+h+e+d.slice(a,d.length)})},number:function(){},array:function(){Array.prototype.find||(Array.prototype.find=function(a){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof a)throw new TypeError("predicate must be a function");for(var b,c=Object(this),d=c.length>>>0,e=arguments[1],f=0;f<d;f++)if(b=c[f],a.call(e,b,f,c))return b}),Array.prototype.findIndex||(Array.prototype.findIndex=function(a){if(null===this)throw new TypeError("Array.prototype.findIndex called on null or undefined");if("function"!=typeof a)throw new TypeError("predicate must be a function");for(var b,c=Object(this),d=c.length>>>0,e=arguments[1],f=0;f<d;f++)if(b=c[f],a.call(e,b,f,c))return f;return-1})}};b.console(),b.string(),b.number(),b.array()}(a),function(a,b){function c(a){document.activeElement&&document.activeElement===a||a.focus()}a.fn.caret=function(a){var d,e,f,g,h=this[0],i="true"===h.contentEditable;if(0==arguments.length){if(b.getSelection){if(i){c(h);var j=b.getSelection();return j.rangeCount?(e=j.getRangeAt(0),f=e.cloneRange(),f.selectNodeContents(h),f.setEnd(e.endContainer,e.endOffset),f.toString().length):0}return h.selectionStart}if(document.selection){if(c(h),i)return e=document.selection.createRange(),f=document.body.createTextRange(),f.moveToElementText(h),f.setEndPoint("EndToEnd",e),f.text.length;for(a=0,d=h.createTextRange(),f=document.selection.createRange().duplicate(),g=f.getBookmark(),d.moveToBookmark(g);0!==d.moveStart("character",-1);)a++;return a}return 0}return-1==a&&(a=this[i?"text":"val"]().length),b.getSelection?i?(c(h),b.getSelection().collapse(h.firstChild,a)):h.setSelectionRange(a,a):document.body.createTextRange&&(d=document.body.createTextRange(),d.moveToElementText(h),d.moveStart("character",a),d.collapse(!0),d.select()),i||c(h),a}}(b,a),function(a){var b=a.$pt;null==b&&(b={},a.$pt=b);var c=function(a,b){this.value=a,this.message=b,this.toString=function(){return this.value+": "+this.message}};b.createComponentException=function(a,b){return new c(a,b)};var d={};b.messages=d,b.defineMessage=function(a,c){return d[a]=c,b},b.getMessage=function(a){var b=d[a];return null==b?null:b},b.__messagesDomain={};var e=function(a,c,d){var e=b.createComponentException(b.ComponentConstants.Err_Incorrect_Messages_Format,"Message [%1] has conflict type in source and target.".format([a]));throw e.source=c,e.target=d,e},f=function(a,b,c){Object.keys(a).forEach(function(d){var g=a[d],h=b[d];"object"!=typeof g||Array.isArray(g)?"object"!=typeof h||Array.isArray(h)?(h&&(console.error("Message [%1] exists in target.".format([c?c+"."+d:d])),console.log("source message: ",a),console.log("target message: ",b)),b[d]=g):e(c?c+"."+d:d,g,h):h?"object"!=typeof h||Array.isArray(h)?e(c?c+"."+d:d,g,h):f(g,h,c?c+"."+d:d):(b[d]={},f(g,b[d],c?c+"."+d:d))})};b.installMessages=function(a,c,d){if("object"!=typeof c)throw b.createComponentException(b.ComponentConstants.Err_Incorrect_Messages_Format,"Messages must be an JSON object.");if(null==a||"string"!=typeof a||a.isBlank())throw b.createComponentException(b.ComponentConstants.Err_Incorrect_Messages_Format,"Domain of messages must be a string.");console.log("Start to install messages on domain ["+a+"].");var e=d||b.messages;f(c,e),b.__messagesDomain[a]||(b.__messagesDomain[a]={domain:a,messages:[]}),b.__messagesDomain[a].messages.push({target:e,json:c}),console.log("End of install messages on domain ["+a+"].")};var g=function(a,b,c){Object.keys(a).forEach(function(d){var f=a[d],h=b[d];"object"!=typeof f||Array.isArray(f)?"object"!=typeof h||Array.isArray(h)?delete b[d]:e(c?c+"."+d:d,f,h):h&&("object"!=typeof h||Array.isArray(h)?e(c?c+"."+d:d,f,h):(g(f,h,c?c+"."+d:d),0==Object.keys(h).length&&delete b[d]))})};b.uninstallMessages=function(a,c){if(null==a||"string"!=typeof a||a.isBlank())throw b.createComponentException(b.ComponentConstants.Err_Incorrect_Messages_Format,"Domain of messages must be a string.");console.log("Start to uninstall messages on domain ["+a+"].");var d=c||b.messages,e=b.__messagesDomain[a];e&&(e.messages=e.messages.map(function(a){return a.target===d?(g(a.json,d),null):a}).filter(function(a){return null!=a}),0==e.messages.length&&delete b.__messagesDomain[a]),console.log("End of uninstall messages on domain ["+a+"].")},b.Components={},b.exposeComponents=function(a){Object.keys(b.Components).forEach(function(c){a[c]=b.Components[c]})},b.ComponentConstants={Text:"text",TextInJSON:{type:"text",label:!0,popover:!0,renderError:!0,delay:1e3},TextArea:"textarea",Select:"select",Check:"check",ArrayCheck:"acheck",Toggle:"toggle",Radio:"radio",Table:{type:"table",label:!1,popover:!1,renderError:!1},Tree:{type:"tree",label:!1,popover:!1,renderError:!1},SelectTree:"seltree",Date:"date",Search:"search",Button:{type:"button",label:!1,popover:!1,renderError:!1},Tab:{type:"tab",label:!1,popover:!1,renderError:!1},ArrayTab:{type:"atab",label:!1,popover:!1,renderError:!1},Panel:{type:"panel",label:!1,popover:!1,renderError:!1},ArrayPanel:{type:"apanel",label:!1,popover:!1,renderError:!1},Label:{type:"label",label:!1},Form:{type:"form",label:!1,popover:!1,renderError:!1},ButtonFooter:{type:"buttonfooter",label:!1,popover:!1,renderError:!1},File:"file",Nothing:{type:"nothing",label:!1},Default_Date_Format:"YYYY/MM/DD HH:mm:ss.SSS",CODETABLE_PARENT_VALUE_KEY:"value",CODETABLE_SENDER_PROXY:null,CODETABLE_RECEIVER_PROXY:null,CODETABLE_REMOTE_PROXY:null,ERROR_POPOVER:!0,Err_Unsupported_Component:"PT-00001",Err_Unuspported_Column_Sort:"PT-00002",Err_Search_Text_Trigger_Digits_Not_Defined:"PT-00003",Err_Tab_Index_Out_Of_Bound:"PT-00004",Err_Incorrect_Messages_Format:"PT-00005",Http_Status:{0:"Browser Error",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Application Exception"}},b.parseJSON=function(a){return null==a?null:"string"==typeof a?JSON.parse(a):a},b.isVisibleOnAuth=function(a){return!0},b.markFuncAsWrap=function(a){return a&&(a.wrap=!0),a},function(){"use strict";function c(b){void 0===b&&(b=a.navigator.userAgent),b=b.toLowerCase();var c=/(edge)\/([\w.]+)/.exec(b)||/(opr)[\/]([\w.]+)/.exec(b)||/(chrome)[ \/]([\w.]+)/.exec(b)||/(iemobile)[\/]([\w.]+)/.exec(b)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(b)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(b)||/(webkit)[ \/]([\w.]+)/.exec(b)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(b)||/(msie) ([\w.]+)/.exec(b)||b.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(b)||b.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(b)||[],d=/(ipad)/.exec(b)||/(ipod)/.exec(b)||/(windows phone)/.exec(b)||/(iphone)/.exec(b)||/(kindle)/.exec(b)||/(silk)/.exec(b)||/(android)/.exec(b)||/(win)/.exec(b)||/(mac)/.exec(b)||/(linux)/.exec(b)||/(cros)/.exec(b)||/(playbook)/.exec(b)||/(bb)/.exec(b)||/(blackberry)/.exec(b)||[],e={},f={browser:c[5]||c[3]||c[1]||"",version:c[2]||c[4]||"0",versionNumber:c[4]||c[2]||"0",platform:d[0]||""};if(f.browser&&(e[f.browser]=!0,e.version=f.version,e.versionNumber=parseInt(f.versionNumber,10)),f.platform&&(e[f.platform]=!0),(e.android||e.bb||e.blackberry||e.ipad||e.iphone||e.ipod||e.kindle||e.playbook||e.silk||e["windows phone"])&&(e.mobile=!0),(e.cros||e.mac||e.linux||e.win)&&(e.desktop=!0),(e.chrome||e.opr||e.safari)&&(e.webkit=!0),e.rv||e.iemobile){var g="msie";f.browser=g,e[g]=!0}if(e.edge){delete e.edge;var h="msedge";f.browser=h,e[h]=!0}if(e.safari&&e.blackberry){var i="blackberry";f.browser=i,e[i]=!0}if(e.safari&&e.playbook){var j="playbook";f.browser=j,e[j]=!0}if(e.bb){var k="blackberry";f.browser=k,e[k]=!0}if(e.opr){var l="opera";f.browser=l,e[l]=!0}if(e.safari&&e.android){var m="android";f.browser=m,e[m]=!0}if(e.safari&&e.kindle){var n="kindle";f.browser=n,e[n]=!0}if(e.safari&&e.silk){var o="silk";f.browser=o,e[o]=!0}return e.name=f.browser,e.platform=f.platform,e}a.jQBrowser=c(a.navigator.userAgent),a.jQBrowser.uaMatch=c,b.browser=a.jQBrowser}();var h=a;b.getService=function(a,b){var c=a||h,d=b||"$service";return c[d]||(c[d]={}),c[d]}}(a),function(a,b,c){var d=a.$pt;null==d&&(d={},a.$pt=d),d.AjaxConstants={ContentType:{POST:"application/json; charset=UTF-8",GET:"application/json; charset=UTF-8",DELETE:"application/json; charset=UTF-8",PUT:"application/json; charset=UTF-8"},Stringify:{POST:!0,GET:!1,DELETE:!1,PUT:!0}};var e=function(a){var c=a.url,e=a.done,f=a.fail,g=a.quiet;delete a.url,delete a.done,delete a.fail,!0===g||d.Components.NOnRequestModal.getOnRequestModal().show();var h=function(){!0===g||d.Components.NOnRequestModal.getOnRequestModal().hide()};return b.ajax(c,a).done(function(a,b,c){if(void 0!==e&&null!==e)try{e(a,b,c)}catch(g){console.error(g),console.error(a),console.error(b),console.error(c);var f="Unknown error occurred, see console for more information.";f=g?g.stack?g.stack:g.toString?g.toString():f:f,d.Components.NExceptionModal.getExceptionModal().show("Javascript Error",f)}}).fail(function(a,b,c){if(void 0!==f&&null!==f){var e=null;if(null!=(e="function"==typeof f?f:f[""+a.status]))try{e(a,b,c)}catch(h){console.error(h),console.error(data),console.error(b),console.error(a);var g="Unknown error occurred, see console for more information.";g=h?h.stack?h.stack:h.toString?h.toString():g:g,d.Components.NExceptionModal.getExceptionModal().show("Javascript Error",g)}else d.Components.NExceptionModal.getExceptionModal().show(""+a.status,a.responseText)}else d.Components.NExceptionModal.getExceptionModal().show(""+a.status,a.responseText)}).always(function(){h()})},f=function(a,b){return!0===b||!1!==b&&!0===a};d.internalDoPost=d.doPost=function(a,c,g){return g=g||{},f(d.AjaxConstants.Stringify.POST,g.stringify)&&(c="string"==typeof c?c:JSON.stringify(c)),e(b.extend({method:"POST",dataType:"json",contentType:d.AjaxConstants.ContentType.POST},g,{url:a,data:c}))},d.doPut=function(a,c,g){return g=g||{},f(d.AjaxConstants.Stringify.PUT,g.stringify)&&(c="string"==typeof c?c:JSON.stringify(c)),e(b.extend({method:"PUT",dataType:"json",contentType:d.AjaxConstants.ContentType.PUT},g,{url:a,data:c}))},d.doGet=function(a,c,g){return g=g||{},f(d.AjaxConstants.Stringify.GET,g.stringify)&&(c="string"==typeof c?c:JSON.stringify(c)),e(b.extend({method:"GET",dataType:"json",contentType:d.AjaxConstants.ContentType.GET},g,{url:a,data:c}))},d.doDelete=function(a,c,g){return g=g||{},f(d.AjaxConstants.Stringify.DELETE,g.stringify)&&(c="string"==typeof c?c:JSON.stringify(c)),e(b.extend({method:"DELETE",dataType:"json",contentType:d.AjaxConstants.ContentType.DELETE},g,{url:a,data:c}))},d.relocatePage=function(c,d){var e=c;d&&(-1!=e.indexOf("?")?e+="&"+b.param(d):e+="?"+b.param(d)),a.location=e},d.getUrlData=function(c){var d="";if(void 0!==c){if(null==c||c.isBlank())return{};d=c}else{if(null==(d=a.location.search)||d.isBlank()||"?"==d.trim())return{};d=d.substring(1)}return b.deparam(d)},d.mock=function(){b.mockjax&&b.mockjax.apply(b,arguments)};var g={context:"",urls:{}};d.routes=g,d.defineWebContext=function(a){return g.context=a,d},d.defineURL=function(b,c){return null!=g.urls[b]&&a.console.warn("URL["+b+"="+g.urls[b]+"] was replaced by ["+g.context+c+"]"),g.urls[b]=c,d},d.getURL=function(a){var b=g.urls[a];return null==b?null:g.context+b}}(a,b,b.deparam),function(a,b,c){var d=a.$pt;null==d&&(d={},a.$pt=d);var e=c.Class({constructor:function(a){this._otherId=a},sort:function(a){var b=this;a.sort(function(a,c){if(b._otherId){if(a.id==b._otherId)return 1;if(c.id==b._otherId)return-1}return a.text<c.text?-1:a.text>c.text?1:0})}}),f=c.Class({constructor:function(a,b,c){null==a||Array.isArray(a)?(this._local=!0,this._initArray=a):(this._local=!1,this._url=a.url,this._postData=a.data,this._sendProxy=a.proxy,this._receiveProxy=a.receiver),this._renderer=b,this._sorter=c},isInitialized:function(){return!0===this._initialized},isRemote:function(){return!1===this._local},isRemoteButNotInitialized:function(){return this.isRemote()&&!this.isInitialized()},initializeRemote:function(){return this.isRemoteButNotInitialized()?(this._loading||(this._loading=this.__loadRemoteCodes(!0).always(function(){delete this._loading,this._allLoaded=!0}.bind(this))),this._loading):b.Deferred(function(a){a.resolve()}).promise()},setAsRemoteInitialized:function(){return this._codes=this._codes?this._codes:[],this._map=this._map?this._map:{},this._initialized=!0,this},getRenderer:function(){return this._renderer},__initCodesArray:function(a,b,c){this._codes=a,null==this._codes&&(this._codes=[]);var d={},e=function(a){b&&(a.text=b(a),a.children&&a.children.forEach(e))};if(this._codes.forEach(function(a){d[a.id]=a,e(a)}),this._map=d,c){var f=function(a){c.sort(a),a.forEach(function(a){a.children&&f(a.children)})};f(this._codes)}return this},__loadRemoteCodes:function(b){var c=this,e=this.__getSendProxy();return(e?e.call(this,{url:this._url,data:this._postData,quiet:!0,async:null!=b&&b}):d.doPost(this._url,this._postData,{quiet:!0,async:null!=b&&b})).done(function(a){var b=a,d=c.__getReceiveProxy();d&&(b=d.call(c,b)),c.__initCodesArray(b,c._renderer,c._sorter)}).fail(function(b,d,e){c.__initCodesArray(null,c._renderer,c._sorter),a.console.error("Status:"+d+", error:"+e)}).always(function(){c._initialized=!0})},__getSendProxy:function(){return this._sendProxy||d.ComponentConstants.CODETABLE_SENDER_PROXY||d.ComponentConstants.CODETABLE_REMOTE_PROXY},__getReceiveProxy:function(){return this._receiveProxy||d.ComponentConstants.CODETABLE_RECEIVER_PROXY},__getCodes:function(){return void 0!==this._codes&&!0===this._initialized||(this._local?(this.__initCodesArray(this._initArray,this._renderer,this._sorter),delete this._initArray,this._initialized=!0):this.__loadRemoteCodes()),this._codes},__getMap:function(){return this.__getCodes(),this._map},filter:function(a){if("function"==typeof a)return this.__getCodes().filter(a);var b=a.value;return this.__loadRemoteCodeSegment(b),this.__getCodes().filter(function(c){return this.__setParentValueAsLoaded(c[a.name]),c[a.name]==b}.bind(this))},isSegmentLoaded:function(a){return!this.__needLoadFromRemote(a)},loadRemoteCodeSegment:function(a){if(this.__needLoadFromRemote(a)){this.__rebuildPostData(a);var c=this.__holdExistedCodes();return this.__loadRemoteCodes(!0).done(function(){this.__setParentValueAsLoaded(a)}.bind(this)).always(function(){this.__mergeAll(c)}.bind(this))}return b.Deferred(function(a){a.resolve()}).promise()},__needLoadFromRemote:function(a){return!(this._local||this._allLoaded||this._loadedKeys&&!0===this._loadedKeys[a+""])},__rebuildPostData:function(a){var c={};return c[this.parentValueKey()]=a,this._postData?this._postData=b.extend({},this._postData,c):this._postData=c,this},__holdExistedCodes:function(){return{codes:null!=this._codes?this._codes:[],map:null!=this._map?this._map:{}}},__mergeAll:function(a){return this._codes.push.apply(this._codes,a.codes),this._map=b.extend(a.map,this._map),this},__setParentValueAsLoaded:function(a){return this._loadedKeys||(this._loadedKeys={}),this._loadedKeys[a+""]=!0,this},__loadRemoteCodeSegment:function(a){if(this.__needLoadFromRemote(a)){this.__rebuildPostData(a);var b=this.__holdExistedCodes();this.__loadRemoteCodes(),this.__setParentValueAsLoaded(a),this.__mergeAll(b)}return this},get:function(a){var b=this.__getMap()[a];return null==b?null:b},getText:function(a){var b=this.get(a);return null==b?null:b.text},list:function(){return this.__getCodes()},listAllChildren:function(){var a={},b=function(c){a[c.id]=c,c.children&&c.children.forEach(function(a){b(a)})};return this.list().forEach(function(a){b(a)}),a},listWithHierarchyKeys:function(a){var b=a&&a.separator?a.separator:"|",c=a&&null!=a.rootId?a.rootId:"0",d={},e=function(a,c){d[c+b+a.id]=a,a.children&&a.children.forEach(function(d){e(d,c+b+a.id)})};return this.list().forEach(function(a){e(a,c)}),d},some:function(a){return this.__getCodes().some(a)},map:function(a){return this.__getCodes().map(a)},name:function(a){return a?(this.__name=a,this):this.__name},parentValueKey:function(a){return a?(this.__parentValueKey=a,this):this.__parentValueKey?this.__parentValueKey:d.ComponentConstants.CODETABLE_PARENT_VALUE_KEY}});d.createDefaultCodeTableSorter=function(a){return new e(a)},d.createCodeTable=function(a,b,c){return new f(a,b,c)},d.extendCodeTable=function(a){return c.Class(f,a)}}(a,b,c),function(a,b,c,d){var e=a.$pt;null==e&&(e={},a.$pt=e),e.BUILD_PROPERTY_VISITOR=!0,e.PROPERTY_SEPARATOR="_",e.cloneJSON=function(a){return b.extend(!0,{},a)},e.mergeObject=function(a){var c,d,f,g,h,i,j=a.deep,k=a.target?a.target:{},l=Array.isArray(a.sources)?a.sources:[a.sources],m=0,n=l.length;for("object"==typeof k||b.isFunction(k)||(k={});m<n;m++)if(null!=(c=l[m]))for(d in c)f=k[d],g=c[d],k!==g&&(j&&g&&(b.isPlainObject(g)||(h=b.isArray(g)))?(h?(h=!1,i=[]):i=f&&b.isPlainObject(f)?f:{},k[d]=e.mergeObject({deep:j,target:i,sources:[g]})):void 0!==g&&(k[d]=g));return k},e.getValueFromJSON=function(a,b){if(-1!=b.indexOf(e.PROPERTY_SEPARATOR)){var c=b.split(e.PROPERTY_SEPARATOR),d=a,f=null,g=c.map(function(a){return null==d?null:(f=d[a],d=f,f)});return g[g.length-1]}return a[b]},e.setValueIntoJSON=function(a,b,c){if(-1==b.indexOf(e.PROPERTY_SEPARATOR))a[b]=c;else{for(var d=b.split(e.PROPERTY_SEPARATOR),f=a,g=0,h=d.length-1;g<h;g++)null==f[d[g]]&&(f[d[g]]={}),f=f[d[g]];f[d[d.length-1]]=c}return e};var f=d.Class({constructor:function(){this.__errors={},this.__models={},this.__startKeyIndex=1},push:function(a,b){return this.__errors[this.__startKeyIndex]=b,this.__models[this.__startKeyIndex]=a,this.__startKeyIndex++,this},remove:function(a){var b=this;return Object.keys(this.__models).forEach(function(c){b.__models[c]==a&&(delete b.__models[c],delete b.__errors[c])}),this},hasError:function(){return 0!==Object.keys(this.__models).length},getError:function(a){var b=Object.keys(this.__models).map(function(b){return this.__models[b]==a?this.__errors[b]:null}.bind(this)).filter(function(a){return null!=a});return 0===b.length?null:b[0]}});e.createTableValidationResult=function(){return new f},e.defineMessage("validate.required",'"%1" is Required.'),e.defineMessage("validate.length",'Length of "%1" should be %2.'),e.defineMessage("validate.length.max",'Length of "%1" cannot be more than %2.'),e.defineMessage("validate.length.min",'Length of "%1" cannot be less than %2.'),e.defineMessage("validate.size.max",'Size of "%1" cannot be more than %2.'),e.defineMessage("validate.size.min",'Size of "%1" cannot be less than %2.'),e.defineMessage("validate.date.before",'Value of "%1" must be before than %2.'),e.defineMessage("validate.date.after",'Value of "%1" must be after than %2.'),e.ValidateRules={required:function(a,b,c){return!1===c||(null!=b&&!(b+"").toString().isEmpty()||e.getMessage("validate.required"))},length:function(a,b,c){return null==b||0==(b+"").length||((b+"").length!=c?e.getMessage("validate.length").format(["%1",""+c]):void 0)},maxlength:function(a,b,c){return null==b||0==(b+"").length||((b+"").length>c?e.getMessage("validate.length.max").format(["%1",""+c]):void 0)},minlength:function(a,b,c){return null==b||0==(b+"").length||((b+"").length<c?e.getMessage("validate.length.min").format(["%1",""+c]):void 0)},maxsize:function(a,b,c){return null==b||0==b.length||(b.length>c?e.getMessage("validate.size.max").format(["%1",""+c]):void 0)},minsize:function(a,b,c){return!(null==b||b.length<c)||e.getMessage("validate.size.min").format(["%1",""+c])},before:function(a,b,c){return e.ValidateRules.__dateCompare(b,a,c,e.ValidateRules.__beforeSpecial)},__beforeSpecial:function(a,b,c,d,f){var g=e.ValidateRules.__convertToMomentValue(c,b,d);return!(null!==g&&a.unix()>g.unix())||("string"==typeof c?e.getMessage("validate.date.before").format(["%1",f||c]):e.getMessage("validate.date.before").format(["%1",g.format(d)]))},after:function(a,b,c){return e.ValidateRules.__dateCompare(b,a,c,e.ValidateRules.__afterSpecial)},__afterSpecial:function(a,b,c,d,f){var g=e.ValidateRules.__convertToMomentValue(c,b,d);return!(null!==g&&a.unix()<g.unix())||("string"==typeof c?e.getMessage("validate.date.after").format(["%1",f||c]):e.getMessage("validate.date.after").format(["%1",g.format(d)]))},__convertToMomentValue:function(a,b,d){var e=null;return"now"===a?e=c():void 0!==a.unix?e=a:"function"==typeof a?e=a():void 0!==b.get(a)?null!==b.get(a)&&(e=c(b.get(a),d)):e=c(a,d),e},__dateCompare:function(a,b,d,f){if(null==a)return!0;var g="string"==typeof d.format?d.format:e.ComponentConstants.Default_Date_Format,h=d.rule?d.rule:d,i=d.rule?d.label:null,j=c(a,g),k=[];if(Array.isArray(h))for(var l=0,m=h.length;l<m;l++){var n=h[l],o=i?i[l]:null;k.push(f(j,b,n,g,o))}else k.push(f(j,b,h,g,i));var p=k.filter(function(a){return!0!==a});return 0===p.length||(1==p.length?p[0]:p)},table:function(a,b,c,d){if(null==b||0==b.length)return!0;var f=e.createTableValidationResult(),g=e.createModelValidator(c);return b.forEach(function(b){var c=e.createModel(b,g);c.useBaseAsCurrent(),c.parent(a),d?c.validateByPhase(d):c.validate();var h=c.getError();0!==Object.keys(h).length?f.push(b,h):f.remove(b)}),!f.hasError()||f}};var g=d.Class({constructor:function(a,c){Array.isArray(a)?(this.__validator={},b.extend.apply(b,[!0,this.__validator].concat(a))):this.__validator=a,this.__rules=c,void 0===this.__rules?this.__rules=e.ValidateRules:this.__rules=b.extend(!0,e.ValidateRules,c)},getConfig:function(a){return a?this.__validator[a]:this.__validator},getRule:function(a){return this.__rules[a]},_validateByPhase:function(a,b,c,d,e,f){var g=null;if("function"==typeof e)g=e.call(this,a,b,d,f);else{if(Array.isArray(e)){var h=this,i=e.map(function(e){return h._validateByPhase(a,b,c,d,e,f)}),j=[];return i.forEach(function(a){null!=a&&(Array.isArray(a)?a.forEach(function(a){j.push(a)}):j.push(a))}),j}var k=e,l=!0;if(null!=d&&e._phase)if(k=e.rule,Array.isArray(e._phase)){var m=e._phase.some(function(a){return a==d});m||(l=!1)}else e._phase!=d&&(l=!1);else e._phase&&(k=e.rule);if(l&&e._when){k=e.rule;e._when.call(this,a)||(l=!1)}l&&(g="function"==typeof k?k.call(this,a,b,d,f):this.getRule(c).call(this,a,b,k,d,f))}return g},validateByPhase:function(a,b,c){var d=this,e=null;if(c){var f=this.getConfig(c);if(null==f)return!0;e=Object.keys(f).map(function(e){var g=f[e],h=a.get(c),i=d._validateByPhase(a,h,e,b,g,c);return null!=i&&!0!==i?i:null});var g=[];return e.forEach(function(a){null!=a&&(Array.isArray(a)?a.forEach(function(a){g.push(a)}):g.push(a))}),0===g.length||g}return e={},Object.keys(this.getConfig()).forEach(function(c){var f=d.validateByPhase(a,b,c);!0!==f&&(e[c]=f)}),e},validate:function(a,b){return this.validateByPhase(a,null,b)},isRequired:function(a,b){var c=this.getConfig(a);if(null==c||null==c.required)return!1;if(!0===c.required)return!0;if(null==b)return!1;var d=Array.isArray(b)?b:[b],e=Array.isArray(c.required)?c.required:[c.required];return d.some(function(a){return e.some(function(b){return-1!=(Array.isArray(b._phase)?b._phase:[b._phase]).indexOf(a)&&!0===b.rule})})}});e.createModelValidator=function(a,b){return new g(a,b)};var h={constructor:function(a,b){this.__base=a,this.__model=e.mergeObject({deep:!0,sources:a}),this.__validator=b,this.__validateResults={},this.__changed=!1},name:function(a){return a?(this.__name=a,this):this.__name},parent:function(a){return void 0!==a?(this.__parent=a,this):this.__parent},isChanged:function(){return this.__changed},getOriginalModel:function(){return this.__base},getCurrentModel:function(){return this.__model},useBaseAsCurrent:function(){return this.__model=this.__base,this},mergeCurrentModel:function(a){return this.__model=e.mergeObject({deep:!0,target:this.__model,sources:a}),this},applyCurrentToBase:function(){return this.__base=e.mergeObject({deep:!0,target:{},sources:this.__model}),this.__changed=!1,this},getValidator:function(){return this.__validator},setValidator:function(a,b){return this.__validator=a,b&&(this.__validateResults={}),this},get:function(a){return e.getValueFromJSON(this.__model,a)},set:function(a,b){var c=this.get(a);if(typeof c!=typeof b||c!=b)return e.setValueIntoJSON(this.__model,a,b),this.__changed=!0,this.fireEvent({model:this,id:a,old:c,new:b,time:"post",type:"change"}),this},addListener:function(a,b,c,d){return a||(a="--all"),a instanceof RegExp?this.__addRegExpListener(a,b,c,d):this.__addListener(a,b,c,d)},__addRegExpListener:function(a,b,c,d){void 0===this.__regExpListeners&&(this.__regExpListeners={});var e=b+"-"+c,f=this.__regExpListeners[e];return void 0===f&&(f=[],this.__regExpListeners[e]=f),-1==f.findIndex(function(b){return b.listener===d&&b.regexp.toString()==a.toString()})&&f.push({regexp:a,listener:d}),this},__addListener:function(a,b,c,d){void 0===this.__listeners&&(this.__listeners={});var e=a+"-"+b+"-"+c,f=this.__listeners[e];return void 0===f&&(f=[],this.__listeners[e]=f),-1==f.findIndex(function(a){return a===d})&&f.push(d),this},addPostChangeListener:function(a,b){return this.addListener(a,"post","change",b)},addPostAddListener:function(a,b){return this.addListener(a,"post","add",b)},addPostRemoveListener:function(a,b){return this.addListener(a,"post","remove",b)},addPostValidateListener:function(a,b){return this.addListener(a,"post","validate",b)},removeListener:function(a,b,c,d){return a||(a="--all"),a instanceof RegExp?this.__removeRegExpListener(a,b,c,d):this.__removeListener(a,b,c,d)},__removeRegExpListener:function(a,b,c,d){if(void 0!==this.__regExpListeners){var e=this.__regExpListeners[b+"-"+c];if(null!=e){var f=e.findIndex(function(b){return b.listener===d&&b.regexp.toString()==a.toString()});-1!=f&&e.splice(f,1)}}return this},__removeListener:function(a,b,c,d){if(void 0!==this.__listeners){var e=this.__listeners[a+"-"+b+"-"+c];if(null!=e){var f=e.findIndex(function(a){return a===d});-1!=f&&e.splice(f,1)}}return this},removePostChangeListener:function(a,b){return this.removeListener(a,"post","change",b)},removePostAddListener:function(a,b){return this.removeListener(a,"post","add",b)},removePostRemoveListener:function(a,b){return this.removeListener(a,"post","remove",b)},removePostValidateListener:function(a,b){return this.removeListener(a,"post","validate",b)},fireEvent:function(a){var b=[],c=a.id+"-"+a.time+"-"+a.type,d=this.__listeners?this.__listeners[c]:null;null!=d&&0!=d.length&&b.push.apply(b,d),c="--all-"+a.time+"-"+a.type,d=this.__listeners?this.__listeners[c]:null,null!=d&&0!=d.length&&b.push.apply(b,d),c=a.time+"-"+a.type,null!=(d=this.__regExpListeners?this.__regExpListeners[c]:null)&&0!=d.length&&d.forEach(function(c){a.id.match(c.regexp)&&b.push.apply(b,[c.listener])});var e=this;return b.forEach(function(b){b.call(e,a)}),this},firePostChangeEvent:function(a,b,c){return this.fireEvent({model:this,id:a,old:b,new:c||this.get(a),time:"post",type:"change"})},firePostAddEvent:function(a,b){var c=this.get(a);return this.fireEvent({model:this,id:a,array:c,index:b,old:null,new:c[b],type:"add",time:"post"})},firePostRemoveEvent:function(a,b,c){return this.fireEvent({model:this,id:a,array:this.get(a),index:c,old:b,new:null,type:"remove",time:"post"})},firePostValidateEvent:function(a){return this.fireEvent({model:this,id:a,time:"post",type:"validate"})},reset:function(){return this.__model=e.mergeObject({deep:!0,sources:this.__base}),this.__validateResults={},this.__changed=!1,this},clearValidateResults:function(a){return a?delete this.__validateResults[a]:this.__validateResults={},this},validateByPhase:function(a,b){var c=this.getValidator();if(void 0===c||null===c)return this;if(b){var d=c.validateByPhase(this,a,b);!0!==d?this.__validateResults[b]=d:delete this.__validateResults[b],this.__mergeErrorToParent().fireEvent({model:this,id:b,time:"post",type:"validate"})}else{this.__validateResults=c.validateByPhase(this,a),this.__mergeErrorToParent();var e=this;Object.keys(this.__validateResults?this.__validateResults:{}).forEach(function(a){e.fireEvent({model:e,id:a,time:"post",type:"validate"})})}return this},__mergeErrorToParent:function(){if(null==this.__parent)return this;var a=this.__parent.getCurrentModel();return Object.keys(a).forEach(function(b){var c=a[b];c==this.__model?this.__parent.mergeError(this.hasError()?this.getError():null,b):Array.isArray(c)&&c.forEach(function(a){if(a==this.__model){var c=this.__parent.getError(b),d=c?c.findIndex(function(a){return"string"!=typeof a}):-1;if(this.hasError()){var f=null;-1==d?(f=e.createTableValidationResult(),c||(c=[]),c.push(f)):(f=c[d],f.remove(a)),f.push(a,this.__validateResults),this.__parent.mergeError(c,b)}else-1!=d&&c[d].remove(a)}}.bind(this))}.bind(this)),this.__parent.__mergeErrorToParent(),this},validate:function(a){return this.validateByPhase(null,a)},isRequired:function(a,b){var c=this.getValidator();return null!=c&&c.isRequired(a,b)},getError:function(a){return a?this.__validateResults[a]:this.__validateResults },hasError:function(a){return a?null!=this.__validateResults[a]:0!=Object.keys(this.__validateResults).length},mergeError:function(a,b){return b?a?this.__validateResults[b]=a:delete this.__validateResults[b]:this.__validateResults=a||{},this},remove:function(a,b){var c=this.get(a);if(null==c||0==c.length)return this;var d=c.findIndex(function(a){return a===b});return-1!=d&&(c.splice(d,1),this.__changed=!0,this.fireEvent({model:this,id:a,array:c,index:d,old:b,new:null,type:"remove",time:"post"})),this},add:function(a,b,c){var d=this.get(a);return null==d&&(d=[],this.__model[a]=d),-1==d.findIndex(function(a){return a===b})&&(null==c?(d.push(b),c=d.length-1):(c>=d.length&&(c=d.length),d.splice(c,0,b)),this.__changed=!0,this.fireEvent({model:this,id:a,array:d,index:c,old:null,new:b,type:"add",time:"post"})),this},update:function(a,b,c){var d=this.get(a);if(null==d)return this;var e=d.findIndex(function(a){return a===b});return-1!=e&&(d.splice(e,1,c),this.__changed=!0,this.fireEvent({model:this,id:a,array:d,index:e,old:b,new:c,type:"change",time:"post"})),this}};e.createModel=function(a,c){var f=null;Array.isArray(a)?(f={},b.extend.apply(b,[!0,f].concat(a))):f=null==a?{}:a;var g={};return e.BUILD_PROPERTY_VISITOR&&Object.keys(f).forEach(function(a){var b=a.upperFirst();g["get"+b]=function(){return this.get(a)},g["set"+b]=function(b){this.set(a,b)}}),new(d.Class(b.extend(g,h)))(f,c)}}(a,b,d,c),function(a,b,c,d){var e=a.$pt;null==e&&(e={},a.$pt=e);var g=c.Class({$static:{DEFAULT_POSITION:{},DEFAULT_ROW:9999,DEFAULT_COLUMN:9999,DEFAULT_WIDTH:3,DEFAULT_COMPONENT:{type:e.ComponentConstants.Text}},constructor:function(a,b){this.__id=a,b.base&&(b=Array.isArray(b.base)?e.mergeObject({deep:!0,target:{},sources:b.base.concat(b)}):e.mergeObject({deep:!0,target:{},sources:[b.base,b]})),this.__dataId=b.dataId?b.dataId:this.__id,this.__cell=b},unwrapValueWhenIsAFunc:function(a,b,c){return"function"==typeof a&&(b||!0===a.wrap)?a.call(c||this):a},getDefinition:function(){return this.__cell},getId:function(){return this.__id},getDataId:function(){return this.__dataId},getPosition:function(){return this.__cell.pos?this.__cell.pos:g.DEFAULT_POSITION},getRowIndex:function(){var a=this.getPosition().row;return null==a?g.DEFAULT_ROW:a},getColumnIndex:function(){var a=this.getPosition().col;return null==a?g.DEFAULT_COLUMN:a},getWidth:function(){var a=this.getPosition().width;return null==a?g.DEFAULT_WIDTH:a},getSection:function(){var a=this.getPosition().section;return null!=a?a:i.DEFAULT_KEY},getCard:function(){var a=this.getPosition().card;return null!=a?a:j.DEFAULT_KEY},getComponentType:function(){var a=this.getComponentOption("type");return a=null==a?e.ComponentConstants.TextInJSON:a,"string"==typeof a?{type:a,label:!0,popover:!0}:a},getComponentOption:function(a,b,c){if(a){if(void 0===b&&(b=null),this.__cell.comp){var d=this.__cell.comp[a];return d=this.unwrapValueWhenIsAFunc(d,!1,c),void 0===d?b:d}return b}return this.__cell.comp?this.__cell.comp:{}},getLabel:function(a){return this.unwrapValueWhenIsAFunc(this.__cell.label,!0,a)},getLabelCSS:function(a){return this.getAdditionalCSS("label",a)},getCellCSS:function(a){return this.getAdditionalCSS("cell",a)},getComponentCSS:function(a){return this.getAdditionalCSS("comp",a)},isAdditionalCSSDefined:function(a){return a?null!=this.__cell.css&&null!=this.__cell.css[a]:null!=this.__cell.css},getAdditionalCSS:function(a,b){if(a){var c=this.isAdditionalCSSDefined(a)?this.__cell.css[a]:"",d=c?c.split(" "):[],f={};return d.forEach(function(a){a&&!a.isBlank()&&(f[a.trim()]=!0)}),null==b||b.isBlank()||(f[b.trim()]=!0),e.LayoutHelper.classSet(f)}return this.isAdditionalCSSDefined()?this.__cell.css:{}},getEventMonitor:function(a){if(!a)return this.__cell.evt?this.__cell.evt:{};if(!this.__cell||!this.__cell.evt)return null;var b=this.__cell.evt[a];if(b)return b;var c=Object.keys(this.__cell.evt).find(function(b){return b.toLowerCase()===a.toLowerCase()});return c?this.__cell.evt[c]:void 0},getValidationPhase:function(){return this.__cell&&this.__cell.validate?this.transformValidationPhase(this.__cell.validate):null},transformValidationPhase:function(a){return null==a||"string"==typeof a||"function"==typeof a?a:a.phase?this.transformValidationPhase(a.phase):null},getValidationOption:function(a,b){if("phase"===a)return this.getValidationPhase();if(this.__cell&&this.__cell.validate){var c=this.__cell.validate;return"string"==typeof c||"function"==typeof c?b:void 0===c[a]?b:c[a]}return b}});e.createCellLayout=function(a,b){return new g(a,b)};var h=c.Class({constructor:function(a){this.__rowIndex=a},getRowIndex:function(){return this.__rowIndex},addCell:function(a){void 0===this.__cells&&(this.__cells=[]);var b=this.__cells.findIndex(function(b){return b.getId()==a.getId()});return-1==b?this.__cells.push(a):this.__cells.splice(b,1,a),this.__cells.sort(function(a,b){return a.getColumnIndex()-b.getColumnIndex()}),this},getCells:function(){return this.__cells}});e.createRowLayout=function(a,b){var c=new h(a);return b&&(Array.isArray(b)?b.forEach(function(a){c.addCell(a)}):c.addCell(b)),c};var i=c.Class({$static:{DEFAULT_KEY:"_defaultSection",DEFAULT_ROW_INDEX:9999,DEFAULT_COLUMN_INDEX:9999,DEFAULT_WIDTH:12},constructor:function(a,b,c){this.__layout={};var d=this;null==a&&(a={}),Object.keys(a).forEach(function(b){"layout"!=b&&(d.__layout[b]=a[b])}),this.__id=b,this.__parent=c,this.__all={},this.__rows={};var e=a.layout;e&&Object.keys(e).forEach(function(a){e[a].getCellCSS?d.addCell(e[a]):d.addCell(new g(a,e[a]))})},hasCell:function(){return 0!=Object.keys(this.__all).length},addCell:function(a){this.__all[a.getId()]=a;var b=a.getRowIndex(),c=this.__rows[b];return void 0===c&&(c=e.createRowLayout(b),this.__rows[b]=c),c.addCell(a),this.__sortRows(),this},__sortRows:function(){this.__rowsArray=[];var a=this.__rowsArray,b=this.__rows;Object.keys(b).forEach(function(c){a.push(b[c])}),a.sort(function(a,b){return a.getRowIndex()-b.getRowIndex()})},getRowIndex:function(){return null==this.__layout||null==this.__layout.row?i.DEFAULT_ROW_INDEX:this.__layout.row},getColumnIndex:function(){return null==this.__layout||null==this.__layout.col?i.DEFAULT_COLUMN_INDEX:this.__layout.col},getWidth:function(){return null==this.__layout||null==this.__layout.width?i.DEFAULT_WIDTH:this.__layout.width},getStyle:function(){return null==this.__layout||null==this.__layout.style?"default":this.__layout.style},getCSS:function(){return null==this.__layout||null==this.__layout.css?null:this.__layout.css},getLabel:function(){return null==this.__layout||null==this.__layout.label?null:this.__layout.label},isCollapsible:function(){return null!=this.__layout&&null!=this.__layout.collapsible&&!0===this.__layout.collapsible},getCollapsedLabel:function(){return null!=this.__layout&&null!=this.__layout.collapsedLabel&&this.__layout.collapsedLabel},isExpanded:function(){return null==this.__layout||null==this.__layout.expanded||!1!==this.__layout.expanded},getExpandedLabel:function(){return null==this.__layout||null==this.__layout.expandedLabel?null:this.__layout.expandedLabel},hasCheckInTitle:function(){return this.__layout&&null!=this.__layout.checkInTitle},getCheckInTitleValue:function(a){var b=this.getCheckInTitleDataId();return b?a.get(b):null},getCheckInTitleDataId:function(){if(!this.hasCheckInTitle())return null;var a=this.__layout.checkInTitle;return a?a.data:null},getCheckInTitleLabel:function(){if(!this.hasCheckInTitle())return null;var a=this.__layout.checkInTitle;return a?a.label:null},getCheckInTitleCollapsible:function(){if(!this.hasCheckInTitle())return null;var a=this.__layout.checkInTitle;return a?a.collapsible:null},getCheckInTitleOption:function(){if(!this.hasCheckInTitle())return null;var a=b.extend({},this.__layout.checkInTitle);return delete a.collapsible,delete a.label,delete a.data,a},getVisible:function(){return this.__layout.visible},getId:function(){return this.__id},getRows:function(){return this.__rowsArray},getCell:function(a){return this.__all[a]},getCells:function(){return this.__all},getParentCard:function(){return this.__parent}});e.createSectionLayout=function(a,b,c){return new i(a,b,c)};var j=c.Class({$static:{DEFAULT_KEY:"_defaultCard",DEFAULT_CARD_INDEX:9999},constructor:function(a,c){var d=this;this.__layout=b.extend({},a),this.__id=c,this.__all={},this.__sections={},this.__layout._sections&&Object.keys(this.__layout._sections).forEach(function(a){var c=e.createSectionLayout(d.__layout._sections[a],a,d);c.hasCell()&&(d.__sections[a]=c,b.extend(d.__all,c.getCells()),d.__sortSections())})},hasCell:function(){return 0!=Object.keys(this.__all).length},addCell:function(a){this.__all[a.getId()]=a;var b=a.getSection(),c=this.__sections[b];if(null==c){var d=this.__layout._sections?this.__layout._sections[b]:null;c=e.createSectionLayout(d,b,this),this.__sections[b]=c}return c.addCell(a),this.__sortSections(),this},__sortSections:function(){this.__sectionsArray=[];var a=this.__sectionsArray,b=this.__sections;Object.keys(b).forEach(function(c){a.push(b[c])}),a.sort(function(a,b){var c=a.getRowIndex(),d=b.getRowIndex();return c==d?a.getColumnIndex()-b.getColumnIndex():c-d})},getIndex:function(){return null==this.__layout.index?j.DEFAULT_CARD_INDEX:this.__layout.index},getLabel:function(){return this.__layout.label},getIcon:function(){return this.__layout.icon},hasBadge:function(){return null!=this.__layout.badge},getBadgeId:function(){return this.__layout.badge},getBadgeRender:function(){return this.__layout.badgeRender},getId:function(){return this.__id},isActive:function(){return!0===this.__layout.active},setActive:function(a){return this.__layout.active=a,this},isBackable:function(){return!1!==this.__layout.backable},getRightButtons:function(){return this.__layout.rightButtons?this.__layout.rightButtons:[]},getLeftButtons:function(){return this.__layout.leftButtons?this.__layout.leftButtons:[]},getFinishButton:function(){return this.__layout.finishButton},getSections:function(){return this.__sectionsArray},getCells:function(){return this.__all},getCell:function(a){return this.__all[a]}});e.createCardLayout=function(a,b){return new j(a,b)};var k=c.Class({constructor:function(a){this.__all={};var b=this.__mergeLayouts(a),c=this.__createDefaultCard(b);delete b._cards,delete b._freeCard,delete b._cardButtonShown,delete b._sections;var d=this.__readCells(b,c,this.__all);this.__sortCards(d)},__mergeLayouts:function(a){return 1==a.length?b.extend(!0,{},a[0]):b.extend.apply(b,[].concat(!0,{},a))},__createDefaultCard:function(a){var b=a._cards;return this.__freeCard=a._freeCard,this.__cardButtonShown=a._cardButtonShown,null==b&&(b={},b[j.DEFAULT_KEY]={_sections:{}},null==a._sections?b[j.DEFAULT_KEY]._sections[i.DEFAULT_KEY]={}:b[j.DEFAULT_KEY]._sections=a._sections),b},__readCells:function(a,c,d){var e={};return Object.keys(c).forEach(function(a){var f=new j(c[a],a);f.hasCell()&&(e[a]=f,b.extend(d,f.getCells()))}),Object.keys(a).forEach(function(b){var f=new g(b,a[b]);d[f.getId()]=f;var h=f.getCard(),i=e[h];if(null==i){var k=c[h];i=new j(k,h),e[h]=i}i.addCell(f)}),e},__sortCards:function(a){this.__cardsArray=[];var b=this.__cardsArray;Object.keys(a).forEach(function(c){b.push(a[c])}),this.__cardsArray.sort(function(a,b){return a.getIndex()-b.getIndex()})},getCards:function(){return this.__cardsArray},isFreeCard:function(){return!0===this.__freeCard},isCardButtonShown:function(){return!1!==this.__cardButtonShown},getCell:function(a){return this.__all[a]},getCells:function(){return this.__all}});e.createFormLayout=function(a){return new k(Array.prototype.slice.call(arguments))};var l=c.Class({constructor:function(a){this.__columns=a.slice(0)},columns:function(){return this.__columns},get:function(a){return this.__columns[a]},push:function(a){this.__columns.push(a)},splice:function(a,b,c){this.__columns.splice(a,b,c)},map:function(a){return this.__columns.map(a)},forEach:function(a){this.__columns.forEach(a)},length:function(){return this.__columns.length},some:function(a){return this.__columns.some(a)}});e.createTableColumnLayout=function(a){return new l(a)};var m={getInitialState:function(){return{}},executePointcutBefore:function(a){a&&a.before&&a.before.apply(this,Array.prototype.slice.call(arguments,1))},executePointcutAfter:function(a){a&&a.after&&a.after.apply(this,Array.prototype.slice.call(arguments,1))},installBaseMonitors:function(){if(this.executePointcutBefore.apply(this,arguments),this.addPostChangeListener(this.onModelChanged),this.isArrayData&&this.isArrayData()&&(this.addPostAddListener(this.onModelChanged),this.addPostRemoveListener(this.onModelChanged)),this.addPostValidateListener(this.onModelValidateChanged),this.getDependencyOptions){var a=this.getDependencyOptions();a&&this.addDependencyMonitor(this.getDependencies(a))}this.addEnableDependencyMonitor(),this.addVisibleDependencyMonitor(),this.registerToComponentCentral(),this.executePointcutAfter.apply(this,arguments)},uninstallBaseMonitors:function(){if(this.executePointcutBefore.apply(this,arguments),this.removePostChangeListener(this.onModelChanged),this.isArrayData&&this.isArrayData()&&(this.removePostAddListener(this.onModelChanged),this.removePostRemoveListener(this.onModelChanged)),this.removePostValidateListener(this.onModelValidateChanged),this.getDependencyOptions){var a=this.getDependencyOptions();a&&this.removeDependencyMonitor(this.getDependencies(a))}this.removeEnableDependencyMonitor(),this.removeVisibleDependencyMonitor(),this.unregisterFromComponentCentral(),this.executePointcutAfter.apply(this,arguments)},componentWillUpdate:function(a,b){this.uninstallBaseMonitors({before:this.beforeWillUpdate,after:this.afterWillUpdate},a,b)},componentDidUpdate:function(a,b){this.installBaseMonitors({before:this.beforeDidUpdate,after:this.afterDidUpdate},a,b)},componentDidMount:function(){this.installBaseMonitors({before:this.beforeDidMount,after:this.afterDidMount})},componentWillUnmount:function(){this.uninstallBaseMonitors({before:this.beforeWillUnmount,after:this.afterWillUnmount})},onModelChanged:function(){this.forceUpdate()},onModelValidateChanged:function(a){this.forceUpdate()},getModel:function(){return this.useFormModel()?this.getFormModel():this.getInnerModel()},useFormModel:function(){return!0===this.getComponentOption("useFormModel")},getFormModel:function(){return this.props.model},getInnerModel:function(){var a=this.getComponentOption("model");return a||this.getFormModel()},getValueFromModel:function(){return this.getModel().get(this.getDataId())},setValueToModel:function(a){this.getModel().set(this.getDataId(),a)},getLayout:function(){return this.props.layout},isViewMode:function(){var a=this.state?this.state.isViewMode:null;return null==a?!0===this.props.view||!0===this.getComponentOption("view"):a},setViewMode:function(a){this.setState({isViewMode:a})},renderInViewMode:function(){var a=e.LayoutHelper.getComponentViewModeRenderer(this.getLayout().getComponentType());if(a)return a.call(this,this.getModel(),this.getLayout(),this.props.direction,!0);var c=null;c=this.getTextInViewMode?this.getTextInViewMode():this.getValueFromModel();var f=e.createCellLayout(this.getId(),b.extend(!0,{},{comp:this.getComponentOption(),css:this.getAdditionalCSS("view")},{label:c,dataId:this.getDataId(),comp:{type:e.ComponentConstants.Label,textFromModel:!1}})),g=e.LayoutHelper.transformParameters(this.getModel(),f,this.props.direction,!0);return g.ref="viewLabel",d.createElement(e.Components.NLabel,g)},getId:function(){return this.getLayout().getId()},getDataId:function(){return this.getLayout().getDataId()},getComponentCSS:function(a){return this.getLayout().getComponentCSS(a)},getAdditionalCSS:function(a,b){return this.getLayout().getAdditionalCSS(a,b)},getComponentOption:function(a,b){var c=this.getLayout().getComponentOption(a,b,this);return null==c&&null!=this.props.defaultOptions&&(c=this.props.defaultOptions[a]),void 0===c?null:c},getComponentCentralId:function(){return this.getComponentOption("centralId")},registerToComponentCentral:function(){var a=this.getComponentCentralId();a&&e.LayoutHelper.registerComponent(a,this)},unregisterFromComponentCentral:function(){var a=this.getComponentCentralId();a&&e.LayoutHelper.unregisterComponent(a,this)},getEventMonitor:function(a){return this.getLayout().getEventMonitor(a)},notifyEvent:function(a){var b=a.type,c=this.getEventMonitor(b);c&&c.call(this,a)},getComponentRuleValue:function(a,b){return this.getRuleValue(this.getComponentOption(a),b)},getRuleValue:function(a,b,c){return null===a?b:!0===a||!1===a?a:a.when.call(this,c||this.getModel(),this.getValueFromModel())},getComponentRuleDependencies:function(a){return this.getRuleDependencies(this.getComponentOption(a))},getRuleDependencies:function(a){return null===a||void 0===a.depends||null===a.depends?[]:Array.isArray(a.depends)?a.depends:[a.depends]},isEnabled:function(){return!!this.isViewMode()||this.getComponentRuleValue("enabled",!0)},isVisible:function(){var a=e.isVisibleOnAuth(this);if(!1===a)return!1;if(a=this.getComponentRuleValue("visible",!0)){var b=this.getComponentOption("view");this.isViewMode()?a="edit"==b!=1:this.isViewMode()||(a="view"==b!=1)}return a},isMobile:function(){return!0===e.browser.mobile},isMobilePhone:function(){return this.isMobile()&&b("body").width()<768},isRequiredSignNeeded:function(){return this.getComponentRuleValue("required",!1)},getDependencies:function(a){var b=[];Array.isArray(a)||(a=[a]);var c=this;return a.forEach(function(a){b.push.apply(b,c.getComponentRuleDependencies(a))}),b},addVisibleDependencyMonitor:function(){this.addDependencyMonitor(this.getDependencies("visible"))},addEnableDependencyMonitor:function(){this.addDependencyMonitor(this.getDependencies("enabled"))},removeVisibleDependencyMonitor:function(){this.removeDependencyMonitor(this.getDependencies("visible"))},removeEnableDependencyMonitor:function(){this.removeDependencyMonitor(this.getDependencies("enabled"))},addRequiredDependencyMonitor:function(){this.addDependencyMonitor(this.getDepende