-
Notifications
You must be signed in to change notification settings - Fork 13
/
web-atoms.min.js
2 lines (2 loc) · 164 KB
/
web-atoms.min.js
1
2
function mapLibrary(n,t,i){var u=n.indexOf("."),r;return u==-1?(r=t[n],r||(r=i,t[n]=r),r):(r=mapLibrary(n.substr(0,u),t,{}),mapLibrary(n.substr(u+1),r,i))}function createProperty(n,t,i){return t?function(){return this[n]}:function(t){if(i){var r=this[n];r!=t&&(this[n]=t,Atom.refresh(this,i))}else this[n]=t}}function classCreator(n,t,i,r,u){var o=t?t.constructor:null,h=i||function(){},c=u,e=null,s,a,f;if(o){e=u?function(){for(var t in c)this["_"+t]=c[t];o.apply(this,arguments);this.__typeName=n;h.apply(this,arguments)}:function(){o.apply(this,arguments);this.__typeName=n;h.apply(this,arguments)};s=o.prototype;for(f in s)r[f]||s.hasOwnProperty(f)&&(a=Object.getOwnPropertyDescriptor(s,f),a?Object.defineProperty(r,f,a):r[f]=s[f])}else e=u?function(){this.__typeName=n;for(var t in c)this["_"+t]=c[t];h.apply(this,arguments)}:function(){this.__typeName=n;h.apply(this,arguments)};if(u)for(f in u)r["get_"+f]||(r["get_"+f]=createProperty("_"+f,!0)),r["set_"+f]||(r["set_"+f]=createProperty("_"+f));for(f in r)if(/^get\_/.test(f)){var v=r[f],l=f.substr(4),y=r["set_"+l];Object.defineProperty(r,l,{get:v,set:y?createProperty("_"+l,!1,l):undefined,enumerable:!0,configurable:!0})}return e.__typeName=n,o&&(e.__baseType=o),e.prototype=r,e.prototype.constructor=e,r.hasOwnProperty("toString")||(e.prototype.toString=function(){return n}),mapLibrary(/\./.test(n)?n:"WebAtoms."+n,window,e),e}function classCreatorEx(n){return classCreator(n.name,n.base,n.start,n.methods,n.properties)}window.createClass=classCreatorEx;window.classCreatorEx=classCreatorEx,function(n){typeof define=="function"&&define.amd?define(["jquery"],n):typeof exports=="object"?n(require("jquery")):n(jQuery)}(function(n){var t=navigator.userAgent,u=/iphone/i.test(t),f=/chrome/i.test(t),i=/android/i.test(t),r;n.mask={definitions:{"9":"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"};n.fn.extend({caret:function(n,t){var i;if(this.length!==0&&!this.is(":hidden"))return typeof n=="number"?(t=typeof t=="number"?t:n,this.each(function(){this.setSelectionRange?this.setSelectionRange(n,t):this.createTextRange&&(i=this.createTextRange(),i.collapse(!0),i.moveEnd("character",t),i.moveStart("character",n),i.select())})):(this[0].setSelectionRange?(n=this[0].selectionStart,t=this[0].selectionEnd):document.selection&&document.selection.createRange&&(i=document.selection.createRange(),n=0-i.duplicate().moveStart("character",-1e5),t=n+i.text.length),{begin:n,end:t})},unmask:function(){return this.trigger("unmask")},mask:function(t,e){var y,l,o,c,h,a,s,p,v;return!t&&this.length>0?(y=n(this[0]),v=y.data(n.mask.dataName),v?v():undefined):(e=n.extend({autoclear:n.mask.autoclear,placeholder:n.mask.placeholder,completed:null},e),l=n.mask.definitions,o=[],c=s=t.length,h=null,n.each(t.split(""),function(n,t){t=="?"?(s--,c=n):l[t]?(o.push(new RegExp(l[t])),h===null&&(h=o.length-1),n<c&&(a=o.length-1)):o.push(null)}),this.trigger("unmask").each(function(){function tt(){if(e.completed){for(var n=h;n<=a;n++)if(o[n]&&y[n]===w(n))return;e.completed.call(v)}}function w(n){return n<e.placeholder.length?e.placeholder.charAt(n):e.placeholder.charAt(0)}function b(n){while(++n<s&&!o[n]);return n}function ft(n){while(--n>=0&&!o[n]);return n}function it(n,t){var r,i;if(!(n<0)){for(r=n,i=b(t);r<s;r++)if(o[r]){if(i<s&&o[r].test(y[i]))y[r]=y[i],y[i]=w(i);else break;i=b(i)}d();v.caret(Math.max(h,n))}}function et(n){for(var r,u,t=n,i=w(n);t<s;t++)if(o[t])if(r=b(t),u=y[t],y[t]=i,r<s&&o[r].test(u))i=u;else break}function ot(){var t=v.val(),n=v.caret(),i;if(t.length<p.length){for(k(!0);n.begin>0&&!o[n.begin-1];)n.begin--;if(n.begin===0)while(n.begin<h&&!o[n.begin])n.begin++;v.caret(n.begin,n.begin)}else{for(i=k(!0);n.begin<s&&!o[n.begin];)n.begin++;v.caret(n.begin,n.begin)}tt()}function rt(){k();v.val()!=nt&&v.change()}function st(n){if(!v.prop("readonly")){var i=n.which||n.keyCode,f,r,t;p=v.val();i===8||i===46||u&&i===127?(f=v.caret(),r=f.begin,t=f.end,t-r==0&&(r=i!==46?ft(r):t=b(r-1),t=i===46?b(t):t),g(r,t),it(r,t-1),n.preventDefault()):i===13?rt.call(this,n):i===27&&(v.val(nt),v.caret(0,k()),n.preventDefault())}}function ht(t){var f,r,u,e,h,c;v.prop("readonly")||(f=t.which||t.keyCode,r=v.caret(),t.ctrlKey||t.altKey||t.metaKey||f<32)||f&&f!==13&&(r.end-r.begin!=0&&(g(r.begin,r.end),it(r.begin,r.end-1)),u=b(r.begin-1),u<s&&(e=String.fromCharCode(f),o[u].test(e)&&(et(u),y[u]=e,d(),h=b(u),i?(c=function(){n.proxy(n.fn.caret,v,h)()},setTimeout(c,0)):v.caret(h),r.begin<=a&&tt())),t.preventDefault())}function g(n,t){for(var i=n;i<t&&i<s;i++)o[i]&&(y[i]=w(i))}function d(){v.val(y.join(""))}function k(n){for(var r=v.val(),u=-1,f,t=0,i=0;t<s;t++)if(o[t]){for(y[t]=w(t);i++<r.length;)if(f=r.charAt(i-1),o[t].test(f)){y[t]=f;u=t;break}if(i>r.length){g(t+1,s);break}}else y[t]===r.charAt(i)&&i++,t<c&&(u=t);return n?d():u+1<c?e.autoclear||y.join("")===ut?(v.val()&&v.val(""),g(0,s)):d():(d(),v.val(v.val().substring(0,u+1))),c?t:h}var v=n(this),y=n.map(t.split(""),function(n,t){if(n!="?")return l[n]?w(t):n}),ut=y.join(""),nt=v.val();v.data(n.mask.dataName,function(){return n.map(y,function(n,t){return o[t]&&n!=w(t)?n:null}).join("")});v.one("unmask",function(){v.off(".mask").removeData(n.mask.dataName)}).on("focus.mask",function(){if(!v.prop("readonly")){clearTimeout(r);var n;nt=v.val();n=k();r=setTimeout(function(){v.get(0)===document.activeElement&&(d(),n==t.replace("?","").length?v.caret(0,n):v.caret(n))},10)}}).on("blur.mask",rt).on("keydown.mask",st).on("keypress.mask",ht).on("input.mask paste.mask",function(){v.prop("readonly")||setTimeout(function(){var n=k(!0);v.caret(n);tt()},0)});if(f&&i)v.off("input.mask").on("input.mask",ot);k()}))}})}),function(n){function wt(n,t){var i,n,f,o,s;if(n)if(n.constructor==String)location.href=n;else if(i=n,i.isMVVMAtomCommand&&i.execute(this),i.atomControl)i=i.atomControl,i.refresh?i.refresh(this.get_scope(),this):r.alert("no default action defined");else if(i._element)i.refresh(this.get_scope(),this);else if(typeof i=="function")i.call(this,this.get_scope(),this,t);else{if(i.length){for(ae=new e(i);ae.next();)this.invokeAction(ae.current(),t);return}if(n=i.timeOut||i.timeout,n){f=this;o=100;n.hasOwnProperty("length")&&n.length>1&&(o=n[0],n=n[1]);setTimeout(function(){f.invokeAction(n)},o);return}if(this.set_merge(i),n=i.confirm,n){s="Are you sure?";n.hasOwnProperty("length")&&(n.length>1?(s=n[0],n=n[1]):n=n[0]);var f=this,h=n,c=t;r.confirm(s,function(){f.invokeAction(h,c)})}if(n=i.alert,n&&r.alert(n),n=i.next,n){this.invokeAction(n,t);return}n=i.control;n&&ft[n].refresh();n=i.window;n&&u.AtomWindow.openNewWindow({url:n,localScope:!1,opener:this,scope:this.get_scope()});n=i.localWindow;n&&u.AtomWindow.openNewWindow({url:n,localScope:!0,opener:this,scope:this.get_scope()})}}function bt(n,t){function i(n){this._handler=n;var i=this;this.invoke=function(){try{i._handler.apply(i,i.args)}catch(n){console&&console.log(n)}finally{i.timeout=0;i.pending=!1}};this.handler=function(){i.pending||(i.pending=!0,i.args=arguments,i.timeout&&clearTimeout(i.timeout),i.timeout=setTimeout(i.invoke,t||500))}}var r=new i(n);return r.handler}var i=n.$,h=n.document,k={jsonML:{}},u={},y,p,d,rt,w,ut,c,e,r,a,ct,lt,et,ot,f,nt,tt,g,t,s,at,vt,ft,yt,it,st,b,pt,ht;n.WebAtoms=u;n.Templates=k;y=k.jsonML;y["WebAtoms.AtomAutoCompleteBox.template"]=[["input",{"data-atom-presenter":"selectionBox",disabled:"disabled",type:"text","data-atom-init":"t1"}],["input",{"data-atom-presenter":"inputBox",type:"text",autocomplete:"off",autocorrect:"off","data-atom-init":"t2"}],["div",{"data-atom-presenter":"itemsPresenter","class":"atom-list-box",style:"position: absolute; z-index: 100;","data-atom-init":"t3"},["div",{"data-atom-template":"itemTemplate",style:"min-width:100px;","data-atom-init":"t4"}]]];y["WebAtoms.AtomCalendar.itemTemplate"]=[["div",{"data-atom-template":"itemTemplate","data-atom-init":"t5"},["span",{"data-atom-init":"t6"}]]];y["WebAtoms.AtomCalendar.template"]=[["section",{"class":"calendar"},["header",{},["button",{"class":"prev","data-atom-init":"t7"}],["select",{"data-atom-type":"AtomComboBox","class":"month","data-atom-init":"t8"}],["select",{"data-atom-type":"AtomComboBox","class":"year","data-atom-init":"t9"}],["button",{"class":"next","data-atom-init":"t10"}]],["ul",{"class":"days"},["li",{"class":"weekend"},"S"],["li",{},"M"],["li",{},"T"],["li",{},"W"],["li",{},"T"],["li",{},"F"],["li",{"class":"weekend"},"S"]],["section",{"class":"day-list","data-atom-presenter":"itemsPresenter"},]]];y["WebAtoms.AtomCheckBoxList.itemTemplate"]=[["div",{"data-atom-template":"itemTemplate"},["input",{type:"checkbox","data-atom-init":"t13"}],["span",{"data-atom-init":"t14"}]]];y["WebAtoms.AtomDataPager.template"]=[["button",{"class":"atom-pager-first-button",style:"float:left","data-atom-init":"t15"},"First"],["span",{style:"text-align:left"},["button",{"class":"atom-pager-prev-button","data-atom-init":"t16"},"Prev"],["span",{},"Goto: Page"],["select",{"data-atom-type":"AtomComboBox","data-atom-init":"t17"},],["button",{"class":"atom-pager-next-button","data-atom-init":"t18"},"Next"]],["button",{"class":"atom-pager-last-button",style:"float:right","data-atom-init":"t19"},"Last"]];y["WebAtoms.AtomDateField.popupTemplate"]=[["div",{"class":"atom-date-popup","data-atom-init":"t20"},["div",{"class":"atom-date-list-box"},["div",{"class":"calendar","data-atom-presenter":"calendarPresenter"},["select",{"data-atom-type":"AtomComboBox","class":"month","data-atom-init":"t22"}],["select",{"data-atom-type":"AtomNumberComboBox","class":"year","data-atom-init":"t23"}],["div",{"class":"days"},["span",{"class":"weekend-header"},"S"],["span",{},"M"],["span",{},"T"],["span",{},"W"],["span",{},"T"],["span",{},"F"],["span",{"class":"weekend-header"},"S"]],["div",{"class":"day-list","data-atom-type":"AtomItemsControl","data-atom-presenter":"itemsPresenter","data-atom-init":"t24"},["div",{"data-atom-template":"itemTemplate","data-atom-init":"t25"},["span",{"data-atom-init":"t26"}]]]]]]];y["WebAtoms.AtomDateField.template"]=[["div",{"class":"date-label","data-atom-init":"t27"}]];y["WebAtoms.AtomDateListBox.template"]=[["div",{"class":"atom-date-list-box"},["div",{"class":"calendar"},["select",{"data-atom-type":"AtomComboBox","class":"month","data-atom-init":"t28"}],["select",{"data-atom-type":"AtomComboBox","class":"year","data-atom-init":"t29"}],["div",{"class":"days"},["span",{"class":"weekend-header"},"S"],["span",{},"M"],["span",{},"T"],["span",{},"W"],["span",{},"T"],["span",{},"F"],["span",{"class":"weekend-header"},"S"]],["div",{"class":"day-list","data-atom-presenter":"itemsPresenter"},["div",{"data-atom-template":"itemTemplate","data-atom-init":"t31"},["span",{"data-atom-init":"t32"}]]]],["div",{"class":"list","data-atom-type":"AtomListBox","data-atom-init":"t33"},["div",{"data-atom-template":"itemTemplate","data-atom-init":"t34"},]]]];y["WebAtoms.AtomItemsControl.itemTemplate"]=[["span",{"data-atom-init":"t35"},"Item"]];y["WebAtoms.AtomLinkBar.itemTemplate"]=[["li",{"data-atom-init":"t36"},["a",{"data-atom-init":"t37"},]]];y["WebAtoms.AtomLinkBar.menuTemplate"]=[["ul",{"class":"menu","data-atom-type":"AtomLinkBar","data-atom-init":"t38"},["li",{"data-atom-template":"itemTemplate"},["a",{"data-atom-init":"t40"}]]]];y["WebAtoms.AtomNavigatorList.detailTemplate"]=[["iframe",{"class":"atom-navigator-list-iframe","data-atom-template":"detailTemplate","data-atom-init":"t41"}]];y["WebAtoms.AtomNavigatorList.template"]=[["div",{"data-atom-type":"AtomViewStack","data-atom-init":"t42"},["div",{"data-atom-type":"AtomDockPanel","data-atom-presenter":"gridPanel"},["div",{"data-atom-dock":"Fill","data-atom-presenter":"gridPresenter","class":"atom-navigator-list-grid"},]],["div",{"data-atom-presenter":"detailView","data-atom-type":"AtomDockPanel","data-atom-init":"t45"},["div",{"data-atom-dock":"Top","data-atom-presenter":"detailHeaderToolbar"},["input",{type:"button",value:"Back",style:"float: left","data-atom-init":"t47"}]]],["div",{"data-atom-presenter":"newView","data-atom-type":"AtomDockPanel","data-atom-init":"t48"},["div",{"data-atom-dock":"Top","data-atom-presenter":"newHeaderToolbar"},["input",{type:"button",value:"Back",style:"float: left","data-atom-init":"t50"}]]]]];y["WebAtoms.AtomRadioButtonList.itemTemplate"]=[["span",{},["input",{type:"radio","data-atom-name":"{$owner.groupName}","data-atom-init":"t51"}],["span",{"data-atom-init":"t52"}]]];y["WebAtoms.AtomSortableColumn.template"]=[["span",{"data-atom-init":"t53"}]];y["WebAtoms.AtomTabControl.template"]=[["div",{"data-atom-type":"AtomDockPanel"},["ul",{"data-atom-dock":"Top","data-atom-type":"AtomToggleButtonBar","data-atom-init":"t55"},["li",{"data-atom-template":"itemTemplate","data-atom-init":"t56"}]],["div",{"data-atom-dock":"Fill","data-atom-type":"AtomViewStack","data-atom-presenter":"itemsPresenter","data-atom-init":"t57"},]]];y["WebAtoms.AtomTimeEditor.template"]=[["span",{},"Hour:"],["input",{type:"number",min:"0",max:"12","data-atom-init":"t58"}],["span",{},"Minute:"],["input",{type:"number",min:"0",max:"59","data-atom-init":"t59"}],["ul",{"data-atom-type":"AtomToggleButtonBar","data-atom-init":"t60"},["li",{"data-atom-template":"itemTemplate","data-atom-init":"t61"}]]];y["WebAtoms.AtomToggleButtonBar.itemTemplate"]=[["li",{"data-atom-init":"t62"},]];y["WebAtoms.AtomWizard.template"]=[["div",{"data-atom-dock":"Fill","data-atom-type":"AtomViewStack","data-atom-presenter":"viewPresenter","data-atom-init":"t63"},],["div",{"data-atom-dock":"Bottom","class":"atom-wizard-command-bar"},["button",{"class":"atom-wizard-back-button","data-atom-init":"t65"},["span",{"data-atom-init":"t66"}]],["button",{"class":"atom-wizard-next-button","data-atom-init":"t67"},["span",{"data-atom-init":"t68"}]]]];y["WebAtoms.AtomYesNoCustom.template"]=[["ul",{"data-atom-type":"AtomYesNoControl","data-atom-presenter":"yesNo","data-atom-init":"t69"}],["input",{style:"vertical-align:top",type:"text","data-atom-presenter":"input","data-atom-init":"t70"}]];y["WebAtoms.AtomApplication.busyTemplate"]=[["div",{style:"position:absolute;left:0px;top:0px;z-index:10000; display:none","data-atom-init":"t71"},["div",{"class":"atom-busy-window",style:"position:absolute","data-atom-init":"t72"},["div",{"class":"atom-busy-image","data-atom-init":"t73"}],["div",{"data-atom-init":"t74"}],["div",{style:"height:3px; background-color:green","data-atom-init":"t75"}]]]];y["WebAtoms.AtomForm.errorTemplate"]=[["section",{"data-atom-type":"AtomItemsControl",style:"overflow:auto","data-atom-init":"t76"},["div",{"data-atom-template":"itemTemplate"},["span",{"data-atom-init":"t78"}]]]];y["WebAtoms.AtomFormGridLayout.fieldTemplate"]=[["table",{"class":"atom-form-grid-row","data-atom-type":"AtomFormField","data-atom-init":"t79"},["tbody",{},["tr",{},["td",{"class":"atom-form-grid-label","data-atom-init":"t80"}],["td",{"class":"atom-form-grid-required","data-atom-init":"t81"},"*"],["td",{"class":"atom-form-grid-content","data-atom-presenter":"contentPresenter","data-atom-init":"t82"},],["td",{"data-atom-init":"t83"},]]]]];y["WebAtoms.AtomFormLayout.fieldTemplate"]=[["tr",{"data-atom-type":"AtomFormField"},["td",{"class":"atom-form-label","data-atom-init":"t85"},["label",{"data-atom-init":"t86"}]],["td",{"class":"atom-form-required","data-atom-init":"t87"},],["td",{"class":"atom-form-content","data-atom-presenter":"contentPresenter"},["span",{style:"background-color:red;color:white; display:inline-block;float:right","data-atom-init":"t89"}]]]];y["WebAtoms.AtomFormVerticalLayout.fieldTemplate"]=[["tr",{"data-atom-type":"AtomFormField"},["td",{},["div",{"class":"atom-field-header"},["span",{"class":"atom-form-label","data-atom-init":"t91"}],["span",{"class":"atom-form-required","data-atom-init":"t92"}]],["div",{"class":"atom-form-content","data-atom-presenter":"contentPresenter","data-atom-init":"t93"}],["div",{"class":"atom-form-error","data-atom-init":"t94"}]]]];y["WebAtoms.AtomWindow.alertTemplate"]=[["div",{"class":"atom-alert","data-atom-dock":"Fill"},["pre",{"data-atom-init":"t96"},],["div",{"class":"buttons","data-atom-init":"t97"},["button",{"class":"ok","data-atom-init":"t98"},"Ok"],["button",{"class":"yes","data-atom-init":"t99"},"Yes"],["button",{"class":"no","data-atom-init":"t100"},"No"]]]];y["WebAtoms.AtomWindow.frameTemplate"]=[["div",{"class":"atom-window-background","data-atom-init":"t101"},["div",{"class":"atom-window","data-atom-presenter":"windowDiv",style:"position:absolute","data-atom-type":"AtomDockPanel","data-atom-init":"t102"},["div",{"class":"atom-window-title","data-atom-dock":"Top","data-atom-presenter":"windowTitleDiv","data-atom-init":"t103"}],["div",{"class":"atom-window-close-button","data-atom-presenter":"windowCloseButton","data-atom-init":"t104"}]]]];y["WebAtoms.AtomWindow.windowTemplate"]=[["iframe",{"class":"atom-window-frame","data-atom-presenter":"iframe","data-atom-init":"t105"},]];u.PageSetup=u.PageSetup||{},function(){this.t1=function(n){this.bind(n,"styleDisplay",[["isPopupOpen"]],0,function(n){return n?"":"none"});this.bind(n,"value",["selectedText"])};this.t2=function(n){this.bind(n,"placeholder",["placeholder"]);this.bind(n,"value",["displayLabel"],!0,null,"keyup")};this.t3=function(n){this.bind(n,"styleLeft",[["offsetLeft"]],0,function(n){return n+2+"px"});this.bind(n,"styleTop",[["offsetTop"]],0,function(n){return n+24+"px"});this.bind(n,"styleDisplay",[["isPopupOpen"]],0,function(n){return n?"block":"none"})};this.t4=function(n){this.setLocalValue("text",r.get(this,"data")[r.get(this,"templateParent.labelPath")],n)};this.t5=function(n){this.bind(n,"class",[["data","isWeekEnd"],["data","isOtherMonth"],["data","isToday"],["scope","itemSelected"]],0,function(n,t,i,r){return{weekend:n,other:t,today:i,selected:r}})};this.t6=function(n){this.bind(n,"text",["data","label"])};this.t7=function(n){this.setLocalValue("eventClick",r.get(this,"prevMonthCommand"),n);b.text(n,"<")};this.t8=function(n){this.setLocalValue("items",a.monthList,n);this.bind(n,"value",["templateParent","month"],!0)};this.t9=function(n){this.bind(n,"items",[["value"],["templateParent","startYear"],["value"],["templateParent","endYear"]],0,function(n,t,i,u){return r.range(n+t,i+u)});this.bind(n,"value",["templateParent","year"],!0)};this.t10=function(n){this.setLocalValue("eventClick",r.get(this,"nextMonthCommand"),n);b.text(n,">")};this.t13=function(n){this.bind(n,"checked",["scope","itemSelected"],!0)};this.t14=function(n){this.setLocalValue("text",r.get(this,"data")[r.get(this,"templateParent.labelPath")],n)};this.t15=function(n){this.bind(n,"isEnabled",[["pages","length"],["currentPage"]],0,function(n,t){return n>1&&t});this.setLocalValue("eventClick",r.get(this,"goFirstCommand"),n)};this.t16=function(n){this.setLocalValue("eventClick",r.get(this,"goPrevCommand"),n);this.bind(n,"isEnabled",["currentPage"])};this.t17=function(n){this.bind(n,"items",["atomParent","pages"]);this.bind(n,"value",["atomParent","currentPage"],!0)};this.t18=function(n){this.setLocalValue("eventClick",r.get(this,"goNextCommand"),n);this.bind(n,"isEnabled",[["currentPage"],["pages","length"]],0,function(n,t){return n<t-1})};this.t19=function(n){this.setLocalValue("eventClick",r.get(this,"goLastCommand"),n);this.bind(n,"isEnabled",[["pages","length"],["currentPage"],["pages","length"]],0,function(n,t,i){return n>1&&t<i-1})};this.t20=function(n){this.bind(n,"styleLeft",[["offsetLeft"]],0,function(n){return n+"px"});this.bind(n,"styleTop",[["offsetTop"]],0,function(n){return n+25+"px"});this.bind(n,"class",[["isOpen"]],0,function(n){return n?"popup-open":"popup-closed"})};this.t22=function(n){this.setLocalValue("items",a.monthList,n);this.bind(n,"value",["templateParent","month"],!0)};this.t23=function(n){this.bind(n,"startNumber",[["templateParent","currentYear"],["templateParent","startYear"]],0,function(n,t){return n+t});this.bind(n,"endNumber",[["templateParent","currentYear"],["templateParent","endYear"]],0,function(n,t){return n+t});this.bind(n,"value",["templateParent","year"],!0)};this.t24=function(n){this.bind(n,"items",["templateParent","items"])};this.t25=function(n){this.setLocalValue("eventClick",r.get(this,"templateParent.templateParent.toggleDateCommand"),n);this.bind(n,"class",[["data","isWeekEnd"],["data","isOtherMonth"],["data","isToday"],["templateParent","templateParent","selectedItems"],["data","value"]],0,function(n,t,i,u,f){return{"list-item":!0,weekend:n,other:t,today:i,selected:r.query(u).any({value:f})}})};this.t26=function(n){this.bind(n,"text",["data","label"])};this.t27=function(n){this.bind(n,"class",[["isOpen"]],0,function(n){return n?"date-label-open":"date-label-closed"});this.bind(n,"eventClick",[["isOpen"]],0,function(n){return{owner:{isOpen:!n}}});this.bind(n,"text",[["selectedItem"],["selectedItem","dateLabel"]],0,function(n,t){return n?t:"SELECT"})};this.t28=function(n){this.setLocalValue("items",a.monthList,n);this.bind(n,"value",["templateParent","month"],!0)};this.t29=function(n){this.bind(n,"items",[["value"],["templateParent","startYear"],["value"],["templateParent","endYear"]],0,function(n,t,i,u){return r.range(n+t,i+u)});this.bind(n,"value",["templateParent","year"],!0)};this.t31=function(n){this.setLocalValue("eventClick",r.get(this,"templateParent.toggleDateCommand"),n);this.bind(n,"data",[["templateParent","items"],["scope","itemIndex"]],0,function(n,t){return n[t]});this.bind(n,"class",[["data","isWeekEnd"],["data","isOtherMonth"],["data","isToday"],["templateParent","selectedItems"],["data","value"]],0,function(n,t,i,u,f){return{"list-item":!0,weekend:n,other:t,today:i,selected:r.query(u).any({value:f})}})};this.t32=function(n){this.bind(n,"text",["data","label"])};this.t33=function(n){this.bind(n,"items",["templateParent","selectedItems"]);this.setLocalValue("labelPath","dateLabel",n);this.setLocalValue("valuePath","date",n);this.bind(n,"value",["templateParent","visibleDate"],!0)};this.t34=function(n){this.setLocalValue("text",r.get(this,"data.dateLabel"),n)};this.t35=function(n){this.bind(n,"text",[["data"],["atomParent","labelPath"]],0,function(n,t){return n[t]})};this.t36=function(n){this.setLocalValue("class",r.get(this,"data")[r.get(this,"templateParent.itemsPath")]?r.get(this,"data")[r.get(this,"templateParent.itemsPath")].length?"sub-menu":"":"",n)};this.t37=function(n){this.setLocalValue("href",r.get(this,"data")[r.get(this,"atomParent.valuePath")],n);this.setLocalValue("target",r.get(this,"data")[r.get(this,"atomParent.targetPath")],n);this.setLocalValue("text",r.get(this,"data")[r.get(this,"atomParent.labelPath")],n)};this.t38=function(n){this.bind(n,"items",[["data"],["templateParent","itemsPath"]],0,function(n,t){return n[t]});this.setLocalValue("menuTemplate",r.get(this,"templateParent.menuTemplate"),n);this.setLocalValue("menuDirection","vertical",n)};this.t40=function(n){this.setLocalValue("href",r.get(this,"data")[r.get(this,"templateParent.valuePath")],n);this.setLocalValue("text",r.get(this,"data")[r.get(this,"templateParent.labelPath")],n);this.setLocalValue("target",r.get(this,"data.target"),n);this.setLocalValue("eventClick",r.get(this,"data.action"),n)};this.t41=function(n){this.bind(n,"src",[["templateParent","displayMode"],["templateParent","displayMode"],["templateParent","newUrl"],["templateParent","detailUrl"]],0,function(n,t,i,r){return n==1?t==2?i:r:"about:none"})};this.t42=function(n){this.bind(n,"selectedIndex",["atomParent","displayMode"])};this.t45=function(n){this.bind(n,"data",["templateParent","selectedItem"])};this.t47=function(n){this.bind(n,"eventClick",["templateParent","backCommand"])};this.t48=function(n){this.bind(n,"data",["templateParent","newItemCopy"])};this.t50=function(n){this.bind(n,"eventClick",["templateParent","cancelAddCommand"])};this.t51=function(n){this.bind(n,"checked",["scope","itemSelected"],!0)};this.t52=function(n){this.setLocalValue("text",r.get(this,"data.label"),n)};this.t53=function(n){this.bind(n,"text",["label"])};this.t55=function(n){this.setLocalValue("showTabs","true",n);this.bind(n,"labelPath",["templateParent","labelPath"]);this.bind(n,"items",["templateParent","items"]);this.bind(n,"selectedIndex",["templateParent","selectedIndex"],!0)};this.t56=function(n){this.bind(n,"text",["data"])};this.t57=function(n){this.bind(n,"selectedIndex",["templateParent","selectedIndex"])};this.t58=function(n){this.bind(n,"value",["hours"],!0)};this.t59=function(n){this.bind(n,"value",["minutes"],!0)};this.t60=function(n){this.setLocalValue("items",[{label:"AM",value:"AM"},{label:"PM",value:"PM"}],n);this.bind(n,"value",["templateParent","ap"],!0)};this.t61=function(n){this.setLocalValue("text",r.get(this,"data.label"),n)};this.t62=function(n){this.setLocalValue("text",r.get(this,"data")[r.get(this,"atomParent.labelPath")],n)};this.t63=function(n){this.bind(n,"selectedIndex",["templateParent","currentStep"],!0)};this.t65=function(n){this.bind(n,"isEnabled",["canMoveBack"]);this.setLocalValue("eventClick",r.get(this,"goPrevCommand"),n);this.bind(n,"styleVisibility",[["currentStep"]],0,function(n){return n?"visible":"hidden"})};this.t66=function(n){this.bind(n,"text",["prevLabel"])};this.t67=function(n){this.bind(n,"class",[["nextClass"],["isLastStep"]],0,function(n,t){return n||(t?"finish-button":"")});this.setLocalValue("eventClick",r.get(this,"nextCommand"),n);this.bind(n,"isEnabled",["nextCommand"])};this.t68=function(n){this.bind(n,"text",[["isLastStep"],["finishLabel"],["nextLabel"]],0,function(n,t,i){return n?t:i})};this.t69=function(n){this.bind(n,"value",["templateParent","hasValue"],!0)};this.t70=function(n){this.bind(n,"isEnabled",["hasValue"]);this.bind(n,"placeholder",["placeholder"])};this.t71=function(n){this.bind(n,"styleWidth",[["appWidth"]],0,function(n){return n+"px"});this.bind(n,"styleHeight",[["appHeight"]],0,function(n){return n+"px"});this.bind(n,"styleDisplay",[["isBusy"]],0,function(n){return n?"block":"none"})};this.t72=function(n){this.bind(n,"styleLeft",[["appWidth"]],0,function(n){return n/2-100+"px"});this.bind(n,"styleTop",[["appHeight"]],0,function(n){return n/2-25+"px"})};this.t73=function(n){b.absPos(n,"12,12,36,36")};this.t74=function(n){b.absPos(n,"56,24,145,null");this.bind(n,"text",[["busyMessage"]],0,function(n){return n||"Loading..."})};this.t75=function(n){b.absPos(n,"0,48");this.bind(n,"styleDisplay",[["isBusy"],["progress"]],0,function(n,t){return n&&t?"block":"none"});this.bind(n,"styleWidth",[["progress"]],0,function(n){return n+"%"})};this.t76=function(n){this.setLocalValue("items",r.get(this,"data"),n)};this.t78=function(n){this.setLocalValue("text",r.get(this,"data.label"),n)};this.t79=function(n){this.bind(n,"class",["fieldClass"]);this.bind(n,"styleDisplay",[["fieldVisible"]],0,function(n){return n?"":"none"})};this.t80=function(n){this.bind(n,"text",["label"]);this.bind(n,"styleMinWidth",[["atomParent","minLabelWidth"],["atomParent","minLabelWidth"]],0,function(n,t){return n?t+"px":undefined})};this.t81=function(n){this.bind(n,"class",[["required"]],0,function(n){return n?"atom-form-grid-required":"atom-form-grid-not-required"})};this.t82=function(n){this.bind(n,"class",[["error"]],0,function(n){return n?"atom-data-error":""})};this.t83=function(n){this.bind(n,"class",[["error"]],0,function(n){return n?"atom-data-error":""});this.bind(n,"text",[["error"]],0,function(n){return n||""});this.bind(n,"styleDisplay",[["error"]],0,function(n){return n?"":"none"})};this.t85=function(n){this.bind(n,"styleMinWidth",[["atomParent","minLabelWidth"]],0,function(n){return n||undefined})};this.t86=function(n){this.setLocalValue("for",r.get(this,"fieldId"),n);this.bind(n,"text",["label"])};this.t87=function(n){this.bind(n,"text",[["required"]],0,function(n){return n?"*":""})};this.t89=function(n){this.bind(n,"text",[["errors"]],0,function(n){return r.csv(n,"label")||""})};this.t91=function(n){this.bind(n,"text",["label"])};this.t92=function(n){this.bind(n,"text",[["required"]],0,function(n){return n?"*":""})};this.t93=function(n){this.bind(n,"class",[["error"]],0,function(n){return n?"atom-data-error":""})};this.t94=function(n){this.bind(n,"text",[["errors"]],0,function(n){return r.csv(n,"label")||""})};this.t96=function(n){this.setLocalValue("text",r.get(this,"data.Message"),n)};this.t97=function(n){this.setLocalValue("class",r.get(this,"data.Confirm")?"confirm-buttons":"alert-buttons",n)};this.t98=function(n){this.setLocalValue("eventClick",r.get(this,"templateParent.closeCommand"),n)};this.t99=function(n){this.setLocalValue("eventClick",[{data:{ConfirmValue:!0}},r.get(this,"templateParent.closeCommand")],n)};this.t100=function(n){this.setLocalValue("eventClick",r.get(this,"templateParent.closeCommand"),n)};this.t101=function(n){this.bind(n,"styleWidth",[["appScope","owner","bodyWidth"]],0,function(n){return n+"px"});this.bind(n,"styleHeight",[["appScope","owner","appHeight"]],0,function(n){return n+"px"});this.bind(n,"styleDisplay",[["isOpen"]],0,function(n){return n?"block":"none"})};this.t102=function(n){this.bind(n,"styleWidth",[["atomParent","windowWidth"]],0,function(n){return n+"px"});this.bind(n,"styleHeight",[["atomParent","windowHeight"]],0,function(n){return n+"px"});this.bind(n,"styleLeft",[["appScope","owner","bodyWidth"],["atomParent","windowWidth"]],0,function(n,t){return(n-t)/2+"px"});this.bind(n,"styleTop",[["appScope","owner","bodyHeight"],["atomParent","windowHeight"]],0,function(n,t){return(n-t)/2+"px"})};this.t103=function(n){this.bind(n,"text",["atomParent","title"])};this.t104=function(n){this.setLocalValue("eventClick",r.get(this,"atomParent.cancelCommand"),n)};this.t105=function(n){this.setLocalValue("src",r.get(this,"templateParent.url"),n)}}.call(u.PageSetup,n,u);p={};n.$x=p;p.stop=function(n,t){return function(){if(n)throw new Error(t);}};p.stopIf=n.stop;p.timeout=function(n,t){return function(){var i=this;setTimeout(function(){i.invokeAction(t)},n)}};p.invoke=function(n,t,i){return function(){var r={},u;i!==undefined?(u={},u[t]=i,r[n]=u):r[n]=t;this.invokeAction(r)}};p.data=function(n,t){return p.invoke("data",n,t)};p.scope=function(n,t){return p.invoke("scope",n,t)};p.localScope=function(n,t){return p.invoke("localScope",n,t)};p.appScope=function(n,t){return p.invoke("appScope",n,t)};p.owner=function(n,t){return p.invoke("owner",n,t)};p.if=function(n,t){return n?t:null};p.isValid=function(n,t){return function(){t===undefined&&(n=o,n=this);n.validate();var i=this.get_errors();if(i&&i.length){r.alert(r.mapJoin(i,"label","\n"));return}this.invokeAction(t)}};p.alert=function(n){return function(){r.alert(n)}};p.focus=function(n){return function(){var t=n._element||n;t.focus()}};p.clearErrors=function(t){return function(){n.errors.clear(t._element||t,!0)}};p.confirm=function(n,t){return function(){var i=this;return r.confirm(n,function(){i.invokeAction(t)})}};p.window=function(n,t,i,r){var f=n,s=this,o,e;arguments.length>1?(f={path:n,prop:t,next:r},i&&(o=f.prop||{},o.data=i,f.prop=o)):f={prop:f,path:f.path,next:f.next,scope:f.scope};f.prop=f.prop||{};for(e in f)f.hasOwnProperty(e)&&(/path|prop|next|scope/.test(e)||(f.prop[e]=f[e]));return function(){u.AtomWindow.openNewWindow({url:f,scope:this.get_scope(),opener:this})}};p.localWindow=function(n,t,i,r){var f=n,e;arguments.length>1&&(f={path:n,prop:t,next:r,scope:i});f.prop=f.prop||{};for(e in f)f.hasOwnProperty(e)&&(/path|prop|next|scope/.test(e)||(f.prop[e]=f[e]));return function(){u.AtomWindow.openNewWindow({url:f,scope:this.get_scope(),localScope:!0,opener:this})}};p.reveal=function(){return function(){}},function(n){var i=function(n){this.a=n;this.i=-1},t,r,u;i.prototype={next:function(){return this.i++,this.i<this.a.length},current:function(){return this.a[this.i]}};t={truef:function(){return!0},falsef:function(){return!1},get:function(n,i){var r,u;if(n)return(r=i.indexOf("."),r===-1)?n[i]:(u=i.substr(0,r),i=i.substr(r+1),t.get(n[u],i))},escapeRegex:function(n,i,r,u){if(!i)return{test:t.falsef};var f=i.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return n&&(f=n+f),r&&(f=f+r),new RegExp(f,u)},compare:function(n,r){var u;switch(n){case"==":case"=":return function(n){return n==r};case"<=":return function(n){return n<=r};case">=":return function(n){return n>=r};case"<":return function(n){return n<r};case">":return function(n){return n>r};case"between":return function(n){return n>=r[0]&&n<=r[1]};case"equals":return r=t.escapeRegex("^",r,"$","i"),function(n){return n?r.test(n):!r};case"contains":return r=t.escapeRegex("",r,"","i"),function(n){return n?r.test(n):!1};case"startswith":return r=t.escapeRegex("^",r,"","i"),function(n){return n?r.test(n):!r};case"endswith":return r=t.escapeRegex("",r,"$","i"),function(n){return n?r.test(n):!r};case"equals":return r=t.escapeRegex("^",r,"$"),function(n){return n?r.test(n):!r};case"containscs":return r=t.escapeRegex("",r,""),function(n){return n?r.test(n):!1};case"startswithcs":return r=t.escapeRegex("^",r,""),function(n){return n?r.test(n):!r};case"endswithcs":return r=t.escapeRegex("",r,"$"),function(n){return n?r.test(n):!r};case"~":return function(n){return r.test(n)};case"in":return function(n){var t,u;if(!n)return!1;for(t=new i(r);t.next();)if(u=t.current(),u==n)return!0;return!1};case"has":return function(n){var t,u;if(!n)return!1;for(t=new i(n);t.next();)if(u=t.current(),u==r)return!0;return!1};case"any":return u=t.filter(r),function(n){var t,r;if(!n)return!1;for(t=new i(n);t.next();)if(r=t.current(),u(r))return!0;return!1};case"all":return u=t.filter(r),function(n){if(!n)return!1;for(var t=new i(n);t.next();)if(!u(item))return!1;return!0};default:return function(){return!1}}},isString:function(n){return typeof n=="string"||n instanceof String},sort:function(n){if(!t.isString(n))return n;var i=n.split(",");return i=i.map(function(n){var t=n.split(" "),i=t[1]||"asc";return{field:t[0],desc:/desc/i.test(i),cs:/^cs/i.test(i)}}),function(n,r){var e,h;if(n==null||n==undefined)return r==null||r==undefined?0:1;if(r==null||r==undefined)return 1;for(e=0;e<i.length;e++){var o=i[e],s=o.field,u=n[s],f=r[s];if(o.desc&&(h=u,u=f,f=h),u!=f){if(!u)return f?-1:0;if(!f)return u?1:0;if(t.isString(u)){if(o.cs)return u.localeCompare(f);if(u=u.toLowerCase(),f=f.toLowerCase(),u==f)continue;return u.localeCompare(f)}}}return 0}},build:function(n,i,r,u,f){var s,a,o,v,e,l,h,c;if(i==="$or"){s=t.filter(r,!0);n.push(function(n){return s(n)});return}if(i==="$and"){s=t.filter(r,!1);n.push(function(n){return s(n)});return}if(i==="$not"){a=t.filter(r,f);n.push(function(n){return!a(n)});return}o=i.split(" ");o.length===1&&(o=i.split(":"));v=o[0];e="==";o.length===2&&(e=o[1]);l=function(n){return t.get(n,v)};e.indexOf("!")!==0?(h=t.compare(e,r),c=function(n){var t=l(n);return h(t)},n.push(c)):(e=e.substr(1),h=t.compare(e,r),c=function(n){var t=l(n);return!h(t)},n.push(c))},filter:function(n,r){var f,u,e;if(n===!1)return t.falsef;if(!n)return t.truef;f=[];for(u in n)n.hasOwnProperty(u)&&(e=n[u],t.build(f,u,e,n,r));return function(n){for(var t=new i(f),e=[],o,u;t.next();)if(o=t.current(),u=o(n),e.push(u),u){if(r)return!0}else if(!r)return!1;for(t=new i(e);t.next();)if(!t.current())return!1;return!0}}};n.$f=t.filter;Array.prototype.filter||(Array.prototype.filter=function(n){for(var i,r=[],t=0;t<this.length;t++)i=this[t],n(i,t)&&r.push(i);return r});r=Array.prototype.filter;Array.prototype.filter=function(n){return n instanceof Function||typeof n=="function"?r.call(this,n):r.call(this,$f(n))};u=Array.prototype.sort;Array.prototype.sort=function(n){var i=t.sort(n);return u.call(this,i)};n.AtomFilter=t}(n);d={debug:!1,baseUrl:"",log:"",ajax:{versionUrl:!0,versionKey:"__wav",version:(new Date).toDateString(),headers:{}}};n.AtomConfig=d;rt=function(t){n.console&&console.log(t);d.log+=t+"\r\n"};n.log=rt;w={browserName:"",version:"1.0",majorVersion:1,isMobile:!1,userAgent:"",detect:function(){var o=navigator.appVersion,n=navigator.userAgent;this.userAgent=n;var r=navigator.appName,i=""+parseFloat(navigator.appVersion),u=parseInt(navigator.appVersion,10),e,t,f;(t=n.indexOf("Opera"))!=-1?(r="Opera",i=n.substring(t+6),(t=n.indexOf("Version"))!=-1&&(i=n.substring(t+8))):(t=n.indexOf("MSIE"))!=-1?(r="Microsoft Internet Explorer",i=n.substring(t+5)):(t=n.indexOf("Chrome"))!=-1?(r="Chrome",i=n.substring(t+7)):(t=n.indexOf("Safari"))!=-1?(r="Safari",this.isMobile=n.indexOf("iPhone")!=-1,i=n.substring(t+7),(t=n.indexOf("Version"))!=-1&&(i=n.substring(t+8))):(t=n.indexOf("Firefox"))!=-1?(r="Firefox",i=n.substring(t+8)):(e=n.lastIndexOf(" ")+1)<(t=n.lastIndexOf("/"))&&(r=n.substring(e,t),i=n.substring(t+1),r.toLowerCase()==r.toUpperCase()&&(r=navigator.appName));(f=i.indexOf(";"))!=-1&&(i=i.substring(0,f));(f=i.indexOf(" "))!=-1&&(i=i.substring(0,f));u=parseInt(""+i,10);isNaN(u)&&(i=""+parseFloat(navigator.appVersion),u=parseInt(navigator.appVersion,10));this.browserName=r;this.majorVersion=u;this.isMobile=/android|mobile|ios|iphone/gi.test(n)},isFF:!1,isChrome:!1,isIE:!1,isSafari:!1,isMac:!1,init:function(){this.isMac=/mac os x/gi.test(this.userAgent)&&!/iphone|ipad/gi.test(this.userAgent);switch(this.browserName){case"Firefox":this.supportsUpload=this.majorVersion>=4;this.isFF=!0;break;case"Chrome":this.supportsUpload=this.majorVersion>=6;this.isChrome=!0;break;case"Microsoft Internet Explorer":this.supportsUpload=this.majorVersion>=10;this.isIE=!0;break;case"Safari":this.isSafari=!0;this.isMobile||(this.supportsUpload=this.majorVersion>=5)}this.supportsFlash=!this.isMobile}};n.AtomBrowser=w;w.detect();w.init();ut={ecache:{},becache:{},parse:function(n){var t=this.becache[n];if(t)return t;var r=[],u=[],f=n.replace(/(?:(\$)(window|localViewModel|viewModel|appScope|scope|data|owner|localScope))(?:\.[a-zA-Z_][a-zA-Z_0-9]*(\()?)*/gi,function(n){var i="v"+(r.length+1),t;return n=n.indexOf("$owner.")==0?n.substr(7):n.indexOf("owner.")==0?n.substr(6):n.substr(1),n=n.split("."),t="",n=n.filter(function(n){return n.endsWith("(")?(t="."+n,!1):!0}),r.push(n),u.push(i),"("+i+")"+t}),i="return "+f+";",e=i;try{i=ut.compile(u,i)}catch(o){throw new Error("Error executing \n"+e+"\nOriginal: "+n+"\r\n"+o);}return t={length:u.length,method:i,path:r,original:f},this.becache[n]=t,t},compile:function(n,t){var r=n.join("-")+":"+t,i=this.ecache[r];return i?i:(n.push("Atom"),n.push("AtomPromise"),n.push("$x"),i=new Function(n,t),this.ecache[r]=i,i)}};n.AtomEvaluator=ut;c=null;w.isIE&&w.majorVersion<9?(c=function(n){this.index=-1;this.nextItem=n.firstChild;this.findNext();this.item=null},c.prototype={findNext:function(){for(var n=this.nextItem;n&&n.nodeType!==1;)n=n.nextSibling;this.nextItem=n;this.index++},isFirst:function(){return this.index===1},isLast:function(){return this.item&&!this.nextItem},next:function(){return(this.item=this.nextItem,!this.item)?!1:(this.nextItem=this.item.nextSibling,this.findNext(),this.item?!0:!1)},current:function(){return this.item}},n.ChildEnumerator=c):(c=function(n){this.nextItem=n.firstElementChild;this.item=null;this.first=!0},c.prototype={isFirst:function(){return!this.item.previousElementSibling},isLast:function(){return this.item&&!this.nextItem},next:function(){return(this.item=this.nextItem,!this.item)?!1:(this.nextItem=this.item.nextElementSibling,this.item?!0:!1)},current:function(){return this.item}},n.ChildEnumerator=c);e=function(){return classCreator("AtomEnumerator",null,function(n){this._array=n;this.i=-1},{next:function(){return this.i=this.i+1,this.i<this._array.length},current:function(){return this._array[this.i]},currentIndex:function(){return this.i},isFirst:function(){return this.i==0},isLast:function(){return this.i==this._array.length-1},reset:function(){this.i=-1}})}();n.AtomEnumerator=e;r={version:{text:"2.1.127",major:2,minor:1,build:127},refreshWindowCommand:function(){location.reload(!0)},time:function(){return(new Date).getTime()},get:function(n,i){var u=i.indexOf("."),f;return u!=-1?(f=i.substr(0,u),n=t.getValue(n,f),i=i.substr(u+1),r.get(n,i)):t.getValue(n,i)},set:function(n,i,u){var f,e;if(n){if(f=i.indexOf("."),f!=-1)return e=i.substr(0,f),n=t.getValue(n,e),i=i.substr(f+1),r.set(n,i,u);t.setValue(n,i,u)}},csv:function(n,t,i){var u,f,o;for(i||(i=", "),u=[],f=new e(n);f.next();)o=f.current(),u.push(r.get(o,t));return u.join(i)},range:function(n,t,i){var u=[],r;for(i=i||1,r=n;r<=t;r+=i)u.push({label:r,value:r});return u},merge:function(n,i,u,f){var o,e;if(n){if(o=f?t.getClone(i):i,u)for(e in o)r.set(n,e,t.getValue(o,e));else for(e in o)n[e]=o[e];return n}},url:function(n,t,i){var e=n,f=[],o,u,r;if(t){for(u in t)if(t.hasOwnProperty(u)){if(r=t[u],r===undefined)continue;if(r===null)continue;r&&r.constructor!=String&&typeof r=="object"&&(r=JSON.stringify(r));f.push(u+"="+encodeURIComponent(r))}f.length&&(o=e.indexOf("?"),e+=o==-1?"?":"&");e+=f.join("&")}if(i){f=[];for(u in i)if(i.hasOwnProperty(u)){if(r=i[u],r===undefined||r===null)continue;f.push(u+"="+encodeURIComponent(r))}f.length&&(e+="#"+f.join("&"))}return e},encodeParameters:function(n){var u=[],i,t,r;for(i in n)i.indexOf("_")!=0&&(t=n[i],t!==undefined)&&t!==null&&(r=typeof t,r=="string"||r=="number"||r=="boolean")&&u.push(i+"="+encodeURIComponent(t));return u.join("&")},tableLayout:function(n,t,i){return new u.AtomTableLayout(n,t,i)},toDash:function(n){return n.replace(/([A-Z])/g,function(n){return"-"+n.toLowerCase()})},secureUrl:function(){for(var t,n="",i=0;i<arguments.length;i++){if(t=arguments[i],t===null||t===undefined)return undefined;n+=t}return/^\/\//.test(n)?h.location.protocol+n:("https:"==h.location.protocol&&(n=n.replace(/http\:\/\//,"https://")),n)},showError:function(n){r.alert(n)}};r.mapJoin=function(n,t,r){var f,o,s,u;if(r=r||"\n",n&&n.length){for(f="",o=null,t&&(o=i.isFunction(t)?t:function(n){return n[t]}),s=new e(n);s.next();)(u=s.current(),u)&&(o&&(u=o(u)),u)&&(f&&(f+=r),f+=u);return f}return""};r.resolve=function(n,t){var h=!t,c,u,i,f,o;if(!n)return n;if(h&&(t=new s,t.list=[],t.done=function(i){r.remove(t.list,i);t.list.length==0&&t.pushValue(n)}),c=typeof n,c=="object")if(typeof n.length!="undefined"){for(u=0;u<n.length;u++)if(i=n[u],i){if(f=n,o=u,i instanceof s||i.constructor==s){t.list.push(i);i.failed(function(n){t.done(n)});i.then(function(n){f[o]=n.value();t.done(n)});continue}r.resolve(i,t)}}else for(u in n)if(i=n[u],i){if(i instanceof s||i.constructor==s){t.list.push(i);i.failed(function(n){t.done(n)});f=n;o=u;i.then(function(n){f[o]=n.value();t.done(n)});continue}r.resolve(i,t)}if(t.list.length){if(h)t.onInvoke(function(){for(var n=new e(t.list);n.next();)n.current().invoke(t._invoker)});return t}return n};n.Atom=r,function(){for(var t,f=/\+/g,e=/([^&=]+)=?([^&]*)/g,i=function(n){return decodeURIComponent(n.replace(f," "))},o=n.location.search.substring(1),u={};t=e.exec(o);)u[i(t[1])]=i(t[2]);r.pageQuery=u}();a={zoneOffsetMinutes:(new Date).getTimezoneOffset(),zoneOffset:(new Date).getTimezoneOffset()*6e4,toLocalTime:function(n){return n.toJSON()},m_names:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],setTime:function(n,t){var i,r,f,u;return!n||!t?n:(i=t.split(":"),r=parseInt(i[0]),i=i[1].split(" "),f=parseInt(i[0]),i[1]=="PM"&&r!=12&&(r+=12),u=new Date(n.getFullYear(),n.getMonth(),n.getDate()),u.setHours(r),u.setMinutes(f),u)},toMMDDYY:function(n){var t=n.getMonth()+1,u=n.getFullYear(),i=n.getDate(),r="";return r+=t>9?t:"0"+t,r+="/"+(i>9?i:"0"+i),r+("/"+u)},toShortDateString:function(n){if(!n)return"";if(n.constructor==String)if(/^\/date\(/gi.test(n))n=n.substr(6),n=new Date(parseInt(n,10));else throw new Error("Invalid date format "+n);return this.m_names[n.getMonth()]+" "+n.getDate()+", "+n.getFullYear()},toDateTimeString:function(n){if(!n)return"";n.constructor==String&&(n=n.substr(6),n=new Date(parseInt(n,10)));var t=a.toShortDateString(n);return t+" - "+a.toTimeString(n)},toTimeString:function(n){var i,r,t;return(n=a.parse(n),!n)?"":(i=n.getHours(),r="AM",i==12?r="PM":i>12&&(i=i-12,r="PM"),t=n.getMinutes(),t<10?t="0"+t:(t=t+"",t.length==1&&(t=t+"0")),i+":"+t+" "+r)},smartDate:function(n){var t,i,r;if(!n)return null;if(t=a.parse(n),i=new Date,i.getFullYear()===t.getFullYear()&&i.getMonth()===t.getMonth()){r=i.getDate()-t.getDate();switch(r){case-1:return"Tomorrow ("+a.toTimeString(t)+")";case 0:return"Today ("+a.toTimeString(t)+")";case 1:return"Yesterday ("+a.toTimeString(t)+")"}}return a.toDateTimeString(t)},smartDateUTC:function(n){return a.smartDate(n)},jsonDate:function(n){var t=a.parse(n);return{Year:t.getFullYear(),Month:t.getMonth()+1,Date:t.getDate(),Hours:t.getHours(),Minutes:t.getMinutes(),Seconds:t.getSeconds(),Offset:a.zoneOffsetMinutes}},toUTC:function(n){if(!n)return"";n=a.parse(n);return new Date(n.getTime()+a.zoneOffset)},parse:function(n){var u;if(!n)return null;if(n.constructor!==String)return n;if(/^\/date\([\-0-9]+\)\//gi.test(n))n=new Date(parseInt(n.substr(6),10));else{if(/^\/dateiso/gi.test(n)){n=n.substr(9);n=n.substr(0,n.length-1);var r=n.split("T"),t=r[0],i=r[1];return t=t.split("-"),i=i.split(":"),u=new Date(t[0],parseInt(t[1])-1,t[2],i[0],i[1],parseFloat(i[2])),new Date(u.getTime()+a.zoneOffset)}n=Date.parse(n)}return n}};n.AtomDate=a;a.monthList=[{label:"January",value:1},{label:"February",value:2},{label:"March",value:3},{label:"April",value:4},{label:"May",value:5},{label:"June",value:6},{label:"July",value:7},{label:"August",value:8},{label:"September",value:9},{label:"October",value:10},{label:"November",value:11},{label:"December",value:12}];ct={toFileSize:function(n){return n?(n.constructor==String&&(n=parseInt(n,10)),n>1073741824)?Math.round(n/1073741824)+" GB":n>1048576?Math.round(n/1048576)+" MB":n>1024?Math.round(n/1024)+" KB":n+" B":""}};n.AtomFileSize=ct;lt={toSmallPhoneString:function(n){var t,i;if(!n)return"";t=n.split(":",6);i=t[2];i="("+(/^\+/.test(i)?"":"+")+t[2]+") ";var r=t[3],u=t[4],f=t[5];return r?i+r:""},toPhoneString:function(n){var i;if(!n)return"";var t=n.split(":",6),e="(+"+t[2]+") ",r=t[3],u=t[4],f=t[5];return r?(i=e+r,u&&(i+=" (ext: "+u+")"),f&&(i+=" ("+f+")"),i):""}};n.AtomPhone=lt;$f.get=r.get;$f.compileSelect=function(n){return n?n.constructor==String?function(t){return r.get(t,n)}:function(t){var f={},i,u;for(i in n)u=n[i],i=JSON.stringify(i),f[i]=u?r.get(t,u):r.get(t,i);return f}:function(n){return n}};et={firstOrDefault:function(n){for(var i=$f(n),t;this.next();)if(t=this.current(),i(t))return t;return null},first:function(n){for(var i=$f(n),t;this.next();)if(t=this.current(),i(t))return t;throw new Error("Item not found in collection");},where:function(n){for(var r=$f(n),i=[],t;this.next();)t=this.current(),r(t)&&i.push(t);return new e(i)},toArray:function(){for(var n=[];this.next();)n.push(this.current());return n},any:function(n){return this.firstOrDefault(n)?!0:!1},select:function(n){for(var r=$f.compileSelect(n),t=[],i;this.next();)i=this.current(),t.push(r(i));return new e(t)},join:function(n){for(var t=[];this.next();)t.push(this.current());return t.join(n)},count:function(n){if(n)return this.where(n).count();for(var t=0;this.next();)t++;return t},sum:function(n){for(var i=0,u=this,t;u.next();)t=u.current(),n&&(t=r.get(t,n)),i+=+(t||0);return i},groupBy:function(n){for(var s=$f.compileSelect(n),u=this,f={},e=[];u.next();){var o=u.current(),i=s(o),t=f[i];t||(t=[],f[i]=t,e.push({key:i,items:t}));t.push(o)}return r.query(e)}};n.AtomQuery=et;for(ot in et)e.prototype[ot]=et[ot];r.query=function(n){return n.length!==undefined?new e(n):n};f={nodeValue:w.isIE&&w.majorVersion<9?"nodeValue":"value",attributeMap:function(n,t){var r,i,u={},o=new e(n.attributes);if(t){while(o.next())r=o.current(),i=r.nodeName,/^data\-/i.test(i)&&(i=i.substr(5)),t.test(i)&&(t.lastIndex=0,u[i]={value:r[f.nodeValue],node:r});return u}while(o.next())r=o.current(),i=r.nodeName,/^data\-/i.test(i)&&(i=i.substr(5)),u[i]={value:r[f.nodeValue],node:r};return u},attr:function(n,t,i){if(i!==undefined)return/^(atom|style)\-/.test(t)&&(t="data-"+t),n.setAttribute(t,i),i;return n.getAttribute("data-"+t)||n.getAttribute(t)},removeAttr:function(n,t){n.removeAttribute(t);n.removeAttribute("data-"+t)},getAtomType:function(n){return f.attr(n,"atom-type")},cloneNode:w.isIE&&w.majorVersion<8?function(t){for(var s=n.document,r=s.createElement(t.nodeName),h=new e(t.attributes),u,c,o,i,l;h.next();){u=h.current();try{if(c=u.nodeName,o=u[f.nodeValue],!o)continue;r.setAttribute(c,o)}catch(a){}}for(i=t.firstChild;i;)i.nodeType==3?(l=s.createTextNode(i.nodeValue),r.appendChild(l)):i.nodeType==1&&r.appendChild(f.cloneNode(i)),i=i.nextSibling;return r}:function(n){return n.cloneNode(!0)},findPresenter:function(n){for(var r=new c(n),t,u,i;r.next();){if(t=r.current(),u=f.attr(t,"atom-presenter"),u)return t;if(i=f.findPresenter(t),i)return i}return null},parseUrl:function(n){for(var i={},o=n.split("&"),r=new e(o);r.next();){var u=r.current().split("="),s=u[0],t=u[1];t&&(t=decodeURIComponent(t));t=f.parseValue(t);i[s]=t}return i},parseValue:function(n){var t;return/^[0-9]+$/.test(n)?(t=parseInt(n,10),isNaN(t)||(n=t),n):/^[0-9]+\.[0-9]+/gi.test(n)?(t=parseFloat(n),isNaN(t)||(n=t),n):/true/.test(n)?!0:/false/.test(n)?!1:n},cancelEvent:function(n){var t=n.target;if(!t||!/input/gi.test(t.nodeName)||!/checkbox/gi.test(t.type))return n.preventDefault?n.preventDefault():n.stop(),n.returnValue=!1,n.stopPropagation(),!1},assignID:function(n){return n.id||(n.id="__waID"+f.getNewIndex()),n.id},atomParent:function(t){return t.atomControl?t.atomControl:t===h||t===n||!t.parentNode?null:f.atomParent(t._logicalParent||t.parentNode)},toNumber:function(n){return n?n.constructor==String?parseFloat(n):n:0},isNode:function(t){try{if(n.XMLHttpRequest&&t instanceof XMLHttpRequest)return!0}catch(i){}return t===n||t===h?!0:typeof Node=="object"?t instanceof Node:typeof t=="object"&&typeof t.nodeType=="number"&&typeof t.nodeName=="string"},createDelegate:function(n,t){return this.getDelegate(n,t,!0)},getDelegate:function(n,t,i){var r,u,f;if(t&&t.constructor!=String)throw new Error("methodName has to be string");if(r=n.__delegates,!r){if(!i)return null;r={};n.__delegates=r}if(u=r[t],!u){if(!i)return null;if(f=n[t],!f)throw new Error("method "+t+" not found");u=function(){return f.apply(n,arguments)};r[t]=u}return u},__index:1e3,getNewIndex:function(){return this.__index=this.__index+1,this.__index},contains:function(n,t){for(var r=n.length,i=0,i=0;i<r;i++)if(n[i]==t)return!0;return!1},removeAllChildren:function(n){while(n.hasChildNodes()){var t=n.lastChild;if(!t)break;t.atomControl&&(t.atomControl.dispose(),delete t.atomControl);i(t).remove()}},isWebkit:function(){return n.navigator.userAgent.toLowerCase().indexOf("webkit")==-1?!1:!0},isWeirdControl:function(n){return n.nodeName=="BUTTON"||n.nodeName=="SELECT"||n.nodeName=="INPUT"&&n.getAttribute("type")=="submit"},parseCSS:function(n,t){var i=parseInt(n.css(t),10);return isNaN(i)?0:i},setItemRect:function(n,t,i){var r=n.css("box-sizing")=="border-box",u=this.parseCSS(n,"marginLeft"),o=this.parseCSS(n,"marginRight"),f=this.parseCSS(n,"marginTop"),s=this.parseCSS(n,"marginBottom"),e=this.isWeirdControl(t);i.width&&(i.width-=u+o,r||e||(i.width-=this.parseCSS(n,"borderLeftWidth")+this.parseCSS(n,"borderRightWidth"),i.width-=this.parseCSS(n,"paddingLeft")+this.parseCSS(n,"paddingRight")),i.width<0&&(i.width=0),t.style.width=i.width+"px");i.height&&(i.height-=f+s,r||e||(i.height-=this.parseCSS(n,"borderTopWidth")+this.parseCSS(n,"borderBottomWidth"),i.height-=this.parseCSS(n,"paddingTop")+this.parseCSS(n,"paddingBottom")),i.height<0&&(i.height=0),t.style.height=i.height+"px");i.left&&(i.left+=u,t.style.left=i.left+"px");i.top&&(i.top+=f,t.style.top=i.top+"px")},getPresenterOwner:function(n,t){var i,r;if(n._presenters)for(i=new e(n._presenters);i.next();)if(r=i.current(),r==t)return n;return this.getPresenterOwner(n.get_atomParent(),t)},createCss:function(n){var t,i,r;if(!n)return"";if(n.constructor==String)return n;t=[];for(i in n)(r=n[i],r)&&t.push(i);return t.join(" ")},createControl:function(n,t,i,r){if(!n.atomControl){if(t?t.constructor==String&&(t=u[t]):(t=f.getAtomType(n),t=u[t]),t){var e=new t(n);return i&&(e._data=i),r&&(e._scope=r),e.createChildren(),i&&e.init(),e}return null}}};n.AtomUI=f;f.isIE7=n.navigator.userAgent.indexOf("MSIE 7.0")!=-1;f.isIE8=n.navigator.userAgent.indexOf("MSIE 8.0")!=-1;n.AtomUri=function(n){var i,u="",o="",t=n.split("?");i=t[0];t.length==2?(u=t[1]||"",t=u.split("#"),u=t[0],o=t[1]||""):(t=i.split("#"),i=t[0],o=t[1]||"");var s=location.protocol,e=location.host,h=location.port,r=i.indexOf("//");r!==-1&&(s=i.substr(0,r),i=i.substr(r+2),r=i.indexOf("/"),r!==-1&&(e=i.substr(0,r),i=i.substr(r+1),t=e.split(":"),t.length>1&&(e=t[0],h=t[1])));this.host=e;this.protocol=s;this.port=h;this.path=i;this.query=f.parseUrl(u);this.hash=f.parseUrl(o)};nt={stack:[],startOrder:2e3,show:function(n,t,r,u){if(t.style.zOrder=this.startOrder++,r==0){var f=i(n).offset();t.style.position="absolute";t.style.left=f.left+"px";t.style.top=f.top+i(n).outerHeight(!0)+"px"}t.style.visibility="visible";this.stack.push({parent:n,element:t,removeHandler:u})},peek:function(){var n=null;return this.stack.length>0&&(n=this.stack[this.stack.length-1]),n},hide:function(n){var i=this.peek(),t;i&&i.element===n&&(n.style.visibility="hidden",t=this.stack.pop(),t.removeHandler&&t.removeHandler(t.element))},clicked:function(n){var i=n.target,t=nt.peek();if(t){while(i&&i!=t.element&&i!=t.parent)i=i.parentNode;i!=t.element&&i!=t.parent&&(t.element.style.visibility="hidden",this.stack.pop(),t.removeHandler&&t.removeHandler(t.element))}}};n.AtomPopup=nt;n.simulateParentClick=function(){var n=null,t;try{n=frameElement}catch(i){return}n&&parent&&(t=parent.$,t(frameElement).click(),n.simulateParentClick&&n.simulateParentClick())};i(n).click(function(t){nt.clicked(t);n.simulateParentClick()});Array.prototype.enumerator=function(){return new e(this)};Array.prototype.indexOf||(Array.prototype.indexOf=function(n){for(var t=0,t=0;t<this.length;t++)if(n==this[t])return t;return-1});tt={split:function(n,t){t&&t.constructor==String&&(t=i.trim(t));for(var o=n.split(t),u=[],f=new e(o),r;f.next();)r=f.current(),r&&r.constructor==String&&(r=i.trim(r)),u.push(r);return u},getValues:function(n,t){var u,i=n,r;if(t)for(i=[],r=new e(n);r.next();)u=r.current(),i.push(u[t]);return i},intersect:function(n,t,i){for(var u=[],f=new e(i),o,r;f.next();)o=f.current(),r=this.getMatch(n,t,o),r!=undefined&&u.push(r);return u},getMatch:function(n,t,i){for(var f=new e(n),r,u;f.next();)if(r=f.current(),u=r,t&&(u=r[t]),u==i)return r},remove:function(n,t){for(var i=new e(n),r;i.next();)if(r=i.current(),r==t){n.splice(i.currentIndex(),1);return}}};n.AtomArray=tt;g=function(){return classCreator("WebAtoms.AtomScope",null,function(n,i,r){this.owner=n;this.parent=i;r&&(this.__application=r);this.__application==this.owner&&(this._v=0,this.refreshCommand=function(){appScope._v=appScope._v+1;t.refreshValue(appScope,"_v")});this._refreshValue=function(n){t.refreshValue(this,n);this.__application===this.owner&&this.__application._onRefreshValue(this,n)}},{setValue:function(n,i,r){if(t.getValue(this,n)==i){r&&this._refreshValue(n);return}var u=this["set_"+n];u?u.apply(this,[i]):this[n]=i;this._refreshValue(n)}})}();t={getClone:function(n){var u={},r,i,f;if(typeof n=="object"){typeof n.length!="undefined"&&(u=[]);for(r in n)if(i=n[r],i!==undefined){if(i===null){u[r]=null;continue}/^\_\$\_/gi.test(r)||(f=typeof i,f=="object"?u[r]=i.constructor==Date?"/DateISO("+a.toLocalTime(i)+")/":t.getClone(i):f=="string"?u[r]=i:f=="number"?u[r]=i:f=="boolean"?u[r]=i==!0?!0:!1:f=="date"&&(u[r]=i.getTime()))}}return u},setValue:function(n,i,r){var u,f;(n||r!==undefined)&&(u=t.getValue(n,i),u!==r)&&(f=n["set_"+i],f?f.apply(n,[r]):n[i]=r,t.refreshValue(n,i,u,r))},refreshValue:function(n,i){var r=t.get_WatchHandler(n,i),u,f;if(r!=undefined&&r!=null){for(u=new e(r);u.next();)f=u.current(),f(n,i);n._$_watcher&&n._$_watcher._onRefreshValue(n,i)}},getValue:function(n,t){if(n==null)return null;var i=n["get_"+t];return i?i.apply(n):n[t]},add_WatchHandler:function(n,i,r){if(n!=null){var u=t.get_WatchHandler(n,i);u.push(r)}},get_WatchHandler:function(n,t){var i,r;return n==null?null:(i=n._$_handlers,i||(i={},n._$_handlers=i),r=i[t],(r==undefined||r==null)&&(r=[],i[t]=r),r)},remove_WatchHandler:function(n,t,i){var r,u;if(n!=null&&n._$_handlers!==undefined&&n._$_handlers!==null&&(r=n._$_handlers[t],r!=undefined&&r!=null))for(u=new e(r);u.next();)if(u.current()==i){r.splice(u.currentIndex(),1);return}},invokeItemsEvent:function(n,i,r,u){var o=t.get_WatchHandler(n,"_items"),f,s;if(o){for(f=new e(o);f.next();)s=f.current(),s(i,r,u);n._$_watcher&&n._$_watcher._onRefreshItems(n,i,r,u);t.refreshValue(n,"length")}},clear:function(n){n.length=0;t.invokeItemsEvent(n,"refresh",0,null)},addItem:function(n,i){var r=n.length;n.push(i);t.invokeItemsEvent(n,"add",r,i)},insertItem:function(n,i,r){n.splice(i,0,r);t.invokeItemsEvent(n,"add",i,r)},addItems:function(n,i){for(var r=new e(i);r.next();)t.addItem(n,r.current())},removeItem:function(n,i){var r=n.indexOf(i);r!=-1&&(n.splice(r,1),t.invokeItemsEvent(n,"remove",r,i))},removeAtIndex:function(n,i){if(i!=-1){var r=n[i];n.splice(i,1);t.invokeItemsEvent(n,"remove",i,r)}},refreshItems:function(n){t.invokeItemsEvent(n,"refresh",-1,null)},add_CollectionChanged:function(n,i){if(n!=null){var r=t.get_WatchHandler(n,"_items");r.push(i)}},remove_CollectionChanged:function(n,t){var u,i,r;if(n!=null&&n._$_handlers&&(u="_items",i=n._$_handlers[u],i!=undefined&&i!=null))for(r=new e(i);r.next();)if(r.current()==t){i.splice(r.currentIndex(),1);return}},setError:function(n,i,r){var u=t.getValue(n,"__errors");u||t.setValue(n,"__errors",{});t.setValue(u,i,r)}};n.AtomBinder=t;r.clone=t.getClone;r.add=t.addItem;r.insert=t.insertItem;r.remove=t.removeItem;r.refresh=t.refreshValue;r.refreshArray=t.refreshItems;r.clearArray=t.clear,function(){return classCreator("WebAtoms.AtomComponent",null,function(){this._eventHandlers=[]},{bindEvent:function(n,r,u,e,o){var h,s;n!=null&&(typeof u=="function"&&(o=u),o=o||f.createDelegate(this,u),h={element:n,name:r,methodName:u,handler:o},e&&(h.key=e),f.isNode(n)?i(n).bind(r,null,o):n.addEventListener?n.addEventListener(r,o,!1):(s=n["add_"+r],s==null?(s=t["add_"+r],e?s.apply(t,[n,e,o]):s.apply(t,[n,o])):s.apply(n,[o])),this._eventHandlers.push(h))},unbindEvent:function(n,r,u,o){for(var c=new e(this._eventHandlers),l=[],h,s;c.next();)(s=c.current(),n&&n!==s.element)||r&&r!==s.name||u&&u!==s.methodName||o&&o!==s.key||(f.isNode(s.element)?i(s.element).unbind(s.name,s.handler):s.element.removeEventListener?s.element.removeEventListener(r,s.handler,!1):(h=s.element["remove_"+s.name],h==null?(h=t["remove_"+s.name],s.key?h.apply(t,[s.element,s.key,s.handler]):h.apply(t,[s.element,s.handler])):h.apply(s.element,[s.handler])),l.push(s));if(l.length==this._eventHandlers.length)this._eventHandlers.length=0;else for(c=new e(l);c.next();)s=c.current(),tt.remove(this._eventHandlers,s)},init:function(){},dispose:function(){this.unbindEvent(null,null,null);this.__delegates&&(this.__delegates=null)}})}();s=function(){this._success=[];this._failed=[];this._cached=!1;this._process=null;this._calls=0;this._showProgress=!0;this._showError=!0;var n=this;this.success=function(){n.onSuccess.apply(n,arguments)};this.error=function(){n.onError.apply(n,arguments)}};n.AtomPromise=s;s.prototype={onSuccess:function(n){var i,t;for(this._value=n,this._process&&(this._value=this._process(this._value)),i=this._success,t=0;t<i.length;t++)i[t](this)},onError:function(){var t,n;for(this.errors=arguments,t=this._failed,n=0;n<t.length;n++)t[n](this)},then:function(n){return this._success.push(n),this},process:function(n){return this._process=n,this},failed:function(n){return this._failed.push(n),this},value:function(n){if(n!==undefined){this._value=n;return}return this._value},onInvoke:function(n){return this._invoke=n,this},invoke:function(){if(!this._persist)return this.invokePromise(),this;var n=this;return this.promiseTimeout=setTimeout(function(){n.invokePromise()},100),this},invokePromise:function(){if(this.promiseTimeout=null,this._showProgress&&(atomApplication.setBusy(!0),this._calls===0)){var n=function(){atomApplication.setBusy(!1)};this.then(n);this.failed(n)}return this._calls++,this._invoke(this),this},pushValue:function(n){var t=this;this._cached=!0;setTimeout(function(){t.onSuccess.apply(t,[n])},1)},showProgress:function(n){return this._showProgress=n,this},showError:function(n){return this._showError=n,this},persist:function(n){return this._persist=n===undefined?!0:n,this},abort:function(){if(this.promiseTimeout){clearTimeout(this.promiseTimeout);this.promiseTimeout=null;return}this._failed.length=0;this._success.length=0;this._showProgress&&atomApplication.setBusy(!1);this.handle&&this.handle.abort()}};s.getUrl=function(n){var t=location.href,i=t.indexOf("#");return i!==-1&&(t=t.substr(0,i)),n?(i=t.lastIndexOf("/"),i!==-1&&(t=t.substr(0,i+1)),/^(http|https)\:\/\//gi.test(n))?n:/^\//gi.test(n)?n:/^\./gi.test(n)?(n=n.substr(1),/\/$/gi.test(t)&&/^\//gi.test(n)&&(n=n.substr(1)),t+n):t+n:t};at=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*))(?:Z|(\+|-)([\d|:]*))?$/;s.parseDates=function(n){var u,t,i,r;if(!n)return n;if(u=typeof n,u==="object"){if(typeof n.length!="undefined"){for(t=0;t<n.length;t++)n[t]=s.parseDates(n[t]);return n}for(i in n)(r=n[i],r)&&(n[i]=s.parseDates(r))}if(typeof n=="string"||n.constructor===String){if(/^\/date\(/gi.test(n)&&/\)\/$/gi.test(n))return a.parse(n);if(at.test(n))return new Date(n)}return n};s.ajax=function(n,u,f){var o=new s,k,v,y,p,h,a,g,w,nt,b,tt,c,l;if(f||(f={type:"GET",dataType:"text",data:null}),d.ajax.versionUrl&&f.versionUrl!==undefined&&f.versionUrl&&(u=u||{},u[d.ajax.versionKey]=d.ajax.version),f.success=o.success,f.error=o.error,f.cache===undefined&&(f.cache=!1),k=n,v=d.ajax.headers,v){f.headers||(f.headers={});for(c in v)l=v[c],f.headers[c]=l,d.debug&&rt("Header set: "+c+"="+l)}if(y=d.ajax.statusCode,y){p=f.statusCode||{};for(c in y)l=y[c],p[c]||(p[c]=l);f.statusCode=p}if(h=f,a=h.data,a&&(h.data=t.getClone(a)),g=d.ajax.jsonPostEncode,g?h=g(h):h.data={formModel:JSON.stringify(h.data)},w=h.attachments,w&&w.length){for(nt=new FormData,b=new e(w);b.next();)nt.append("file"+b.currentIndex(),b.current());if(a)for(c in a)nt.append(c,a[c]);h.type="POST";h.xhr=function(){var n=i.ajaxSettings.xhr();return n.upload&&n.upload.addEventListener("progress",function(n){if(n.lengthComputable){var i=Math.round(n.loaded*100/n.total);t.setValue(atomApplication,"progress",i)}},!1),n};h.cache=!1;h.contentType=!1;h.processData=!1}if(u){if(tt={},!h.sendRawQueryString)for(c in u){if(l=u[c],l&&typeof l=="object"){if(l=JSON.stringify(t.getClone(l)),l===undefined)continue;if(l===null)continue}tt[c]=l}k=r.url(n,tt)}if(n)o.onInvoke(function(){o.handle=i.ajax(k,h)});return o.failed(function(){var n=o.errors[0].responseText,t;n||n&&o.errors[2]==="Internal Server Error"||(t=o.errors[2],t&&(n=t));o.error={msg:n};o._showError&&o.error.msg&&r.alert(o.error.msg)}),o.then(function(n){var t=n.value();t=s.parseDates(t);t&&t.items&&t.merge&&(t.items.total=t.total,t=t.items,n.value(t))}),o.showError(!0),o.showProgress(!0),o};s.get=function(n,t,i){return i=i||{},i.type=i.type||"get",i.dataType=i.dataType||"text",s.ajax(n,t,i,"get")};s.plugins={};s.json=function(n,t,i){var r,u,f;return i=i||{},i.type=i.type||"get",i.dataType=i.dataType||"json",r=null,u=n.indexOf("://"),u!==-1&&(f=n.substr(0,u),/http|https/i.test(f)||(n=n.substr(u+3),r=s.plugins[f])),r=r||s.ajax,r(n,t,i,"json")};s.cache={};s.cacheInProgress={};s.cachedPromise=function(t,i){var r=s.cache[t];if(!r&&n.sessionStorage&&(r=n.sessionStorage["__AP"+t],r&&(r=JSON.parse(r),s.cache[t]=r)),r){i.onInvoke(function(){i.pushValue(r)});return i}return i.then(function(i){s.cache[t]=i.value();n.sessionStorage&&(n.sessionStorage["__AP"+t]=JSON.stringify(i.value()))}),i};s.cachedJson=function(n,t,i){var e=new Date,f=d.ajax.version,r=d.ajax.versionKey+"="+f,u;return n.indexOf("?")===-1?r="?"+r:/\&$/.test(n)||(r="&"+r),n+=r,i=i||{},i.cache=!0,i.ifModified=!0,i.versionUrl=!1,u=s.ajax(n,t,i,"json"),s.cachedPromise(n,u)};s.configCache={};s.configLabel=function(n,t,i){var r;if(t===null||t===undefined)return"";i=i||{};var o=i.valuePath||"value",u=i.labelPath||"label",f=i.isNumber||!1;f&&typeof t!="number"&&(t=parseFloat(t));r=new s;r.onInvoke(function(){var i=s.configCache[n],h;if(i){i=i[t];i=i?i[u]:"";r.pushValue(i);return}h=s.cachedJson(n);h.then(function(i){for(var c="",h={},a=new e(i.value()),l;a.next();)l=a.current(),c=l[o],f&&typeof c!="number"&&(c=parseFloat(c)),h[c]=l;s.configCache[n]=h;h=h[t];h=h?h[u]:"";r.pushValue(h)});h.invoke()});return r};s.prototype.insertItem=function(n,t,i){return this.then(function(r){var u=r.value();u._$_itemInserted||(i&&(u=u[i]),n===-1?u.push(t):u.splice(n||0,0,t),u._$_itemInserted=!0)})};s.prototype.toNativePromise=function(){var n=this;return new Promise(function(t,i){var r=n;r.showProgress(!1);r.invoke();r.then(function(n){t(n.value())}).failed(function(n){i(n)})})};vt={list:function(){},add:function(){},remove:function(){},clear:function(){},set:function(){},get:function(){}};s.plugins["local-storage"]=function(n,t,i){var r=n.split("/"),f=r[0],e=r[1],u=new s;u.onInvoke(function(n){var r=vt,u=r[e](f,t,i.data);n.pushValue(u)});return u},function(n){return classCreatorEx({name:"WebAtoms.AtomBinding",base:n,start:function(n,t,r,u,f,o,s,h){var l,a,v,c;if(this.element=t,this.control=n,this.vf=s,this.key=r,this.events=h,i.isArray(u)){for(this.pathList=[],this.path=[],c=new e(u);c.next();){if(l=c.current(),!i.isArray(l)){this.path.push({path:l,value:null});continue}for(a=new e(l),v=[];a.next();)v.push({path:a.current(),value:null});this.pathList.push(v)}this.path.length?this.pathList=null:this.path=null}else for(c=new e(u.split(".")),this.path=[];c.next();)this.path.push({path:c.current(),value:null});this.twoWays=f;this.jq=o;this._isUpdating=!1},methods:{onPropChanged:function(){var n;if(this.path!=null&&this.path.length!=0){for(var f=new e(this.path),r=this.control,u=null;f.next();){if(u=f.current(),u.value=r,!r)return;f.isLast()||(r=t.getValue(r,u.path))}if(n=null,this.jq)switch(this.key){case"valueAsDate":n=this.element.valueAsDate;break;case"checked":n=this.element.checked?!0:!1;break;default:n=i(this.element).val()}else n=t.getValue(this.control,this.key);t.setValue(r,u.path,n)}},onDataChanged:function(){var t,i,r,n;if(!this._isUpdating&&arguments!==undefined&&arguments.length!=0)if(i=this.control,this.pathList){for(n=[],t=new e(this.pathList);t.next();)n.push(this.evaluate(i,t.current()));for(t=new e(n);t.next();)if(t.current()===undefined)return;this.setValue(n)}else r=this.path,n=this.evaluate(i,r),n!==undefined&&this.setValue(n)},evaluate:function(n,r){for(var f=null,u=null,o=new e(r),s;n&&o.next();)u=o.current(),f=t.getValue(n,u.path),/scope|appScope|atomParent|templateParent|localScope/gi.test(u.path)||(s=this,u.value?u.value!=n&&(this.unbindEvent(u.value,"WatchHandler",null,u.path),this.bindEvent(n,"WatchHandler","onDataChanged",u.path)):this.bindEvent(n,"WatchHandler","onDataChanged",u.path)),u.value=n,n=f;return f===undefined&&d.debug&&rt("Undefined:"+this.control._element.id+" -> "+i.map(r,function(n){return n.path}).join(".")),f},onValChanged:function(){var n=this;u.dispatcher.callLater(function(){n.onPropChanged(null,null)})},setup:function(){if(this.twoWays)if(this.jq){if(this.bindEvent(this.element,"change","onValChanged"),this.bindEvent(this.element,"blur","onValChanged"),this.events)for(var n=new e(this.events.split(","));n.next();)this.bindEvent(this.element,n.current(),"onValChanged")}else this.bindEvent(this.control,"WatchHandler","onPropChanged",this.key);this.onDataChanged(this,null)},setValue:function(n){!this.pathList&&this.vf&&(n=[n]);this.vf&&(n.push(r),n.push(s),n.push(p),n=this.vf.apply(this,n));n instanceof s&&(n._persist=!0);this._lastValue=n;this._isUpdating=!0;this.control.setLocalValue(this.key,n,this.element,!0);this._isUpdating=!1}}})}(u.AtomComponent.prototype);ft={};n.allControls=ft,function(t){return classCreator("WebAtoms.AtomDispatcher",t,function(){this._paused=!1;this.head=null;this.tail=null;this.onTimeout=function(){if(!this._paused&&this.head){var t=this.head;this.head=t.next;t.next=null;this.head||(this.tail=null);t();n.setTimeout(this._onTimeout,1)}};var t=this;this._onTimeout=function(){t.onTimeout()}},{pause:function(){this._paused=!0},start:function(){this._paused=!1;n.setTimeout(this._onTimeout,1)},callLater:function(n){this.tail?(this.tail.next=n,this.tail=n):(this.head=n,this.tail=n);this._paused||this.start()},setupControls:function(){var n=i("[data-atom-type],[atom-type]").first()[0],t,r,e;(n.atomControl==undefined||n.atomControl==null)&&(t=f.getAtomType(n),i(n).removeAttr("atom-type"),i(n).removeAttr("data-atom-type"),r=new u[t](n),r.setup(),e=this,this.callLater(function(){e.callLater(function(){var n=atomApplication._element;(n.style.visibility=="hidden"||i(n).css("visibility")=="hidden")&&(n.style.visibility="visible",n.atomControl.updateUI())})}))}})}();u.dispatcher=new u.AtomDispatcher;yt=function(){return createClass({name:"AtomValidator",start:function(n){this.value=n;this.list={};this.errors=[]},methods:{dispose:function(){this.value=null;this.errors=null;this.list=null},set:function(n,t){this.list[n]=t},reset:function(){this.errors=null;this.invoke(!0);this.refresh()},clear:function(){this.errors=[]},invoke:function(n){var t,r,u,f;if(this.refreshing||!n&&this.errors)return this.errors;if(t=[],u=this.list.invalid,u!==undefined)return u?(r=u(),r&&(i.isArray(r)?t=t.concat(r):t.push(r)),this.errors=t,t):(this.errors=t,t);for(f in this.list)(r=this.list[f],r)&&(r=r(),r&&(i.isArray(r)?t=t.concat(r):t.push(r)));return t.length?(this.errors=t,t):null},refresh:function(n){var i,r;if(!this.refreshing){this.refreshing=!0;try{n=n||this.value;i=n.atomControl;i&&t.refreshValue(i,"errors")}finally{this.refreshing=!1}r=n._logicalParent||n.parentNode;r&&this.refresh(r)}}}})}(n);n.errors={set:function(n,t,i){var r=n.atomValidator;r||(r=new yt(n),n.atomValidator=r);r.set(t,i)},clear:function(n,t){var r=n.atomValidator,i;if(r&&r.clear(),this.refresh(n),t)for(i=new c(n);i.next();)this.clear(i.current(),t)},get:function(n,t){var i=[],e=n.atomValidator,r,f,u;if(e&&(r=e.invoke(),r&&r.length&&(i=i.concat(r.filter(function(n){return n}).map(function(t){return{label:t,value:n}}))),i&&i.length))return i;if(t)for(f=new c(n);f.next();)u=this.get(f.current(),t),u&&u.length&&(i=i.concat(u));return i},refresh:function(n){var t=n.atomValidator;t&&t.refresh()},reset:function(n){var t=n.atomValidator;t&&t.reset()},validate:function(n){var i=n.atomValidator,t,r;if(i){i.reset();return}for(t=new c(n);t.next();)r=t.current(),this.validate(r)}};it=n.errors,function(t){return classCreator("WebAtoms.AtomUIComponent",t,function(){},{get_owner:function(){return this},get_appScope:function(){return appScope},get_scope:function(){if(this._scope===undefined){var n=this.get_atomParent(this._element._logicalParent||this._element.parentNode);return n?n._localScope||n.get_scope():appScope}return this._scope},get_localScope:function(){if(this._localScope===undefined){var n=this.get_atomParent(this._element._logicalParent||this._element.parentNode);if(n)return n.get_localScope();throw new Error("Local Scope does not exist");}return this._localScope},set_scope:function(t){var u=this._localScope||this.get_scope(),i,r;for(i in t){if(/^(application|owner|app|parent)$/gi.test(i))throw new Error("Invalid name for the scope property");(r=t[i],u!=n.appScope||n.atomApplication._ready||i.indexOf("_")!=0&&r!==undefined&&r!==null&&/string|number|boolean/i.test(typeof r)&&(atomApplication._defaultScope[i]=r),u[i]===undefined)&&(u[i]=r)}},get_name:function(){return this._name},getTemplate:function(n){var t=this["_"+n];return t!==undefined&&t!==null?t:(t=k.get(this.constructor,n),!t)?null:(this["_"+n]=t,t)}},{next:null,value:undefined})}(u.AtomComponent.prototype);k.compiled={};k.compileElement=function(n){var i=new e(n),t,r,u;if(i.next(),t=i.current(),r=h.createElement(t),!i.next())return r;if(t=i.current(),t)for(u in t)r.setAttribute(u,t[u]);while(i.next()){if(t=i.current(),!t)break;t.constructor==String?r.appendChild(h.createTextNode(t)):r.appendChild(k.compileElement(t))}return r};k.compileJsonML=function(n){if(n.length==1)return k.compileElement(n[0]);for(var t=[],i=new e(n);i.next();)t.push(k.compileElement(i.current()));return t};k.compile=function(n,t,r){var u=h.createElement("div");return u.innerHTML=r,i(u).children().length==1&&(r=f.cloneNode(u.firstElementChild||u.children[0])),r};k.get=function(n,t){var r=n.__typeName+"."+t,i=this.compiled[r];return i?i:(i=k.jsonML[r],i?i=k.compileJsonML(i):n.__baseType&&(i=k.get(n.__baseType,t)),!i)?null:(this.compiled[r]=i,i)};k.compileType=function(n){var r=n.__typeName,u=r.split("."),t,f,o,e,i;if(u=u[u.length-1],t=this.compiled[r],t)return t;if(t={},f=this[r]||this[u],f)for(i in f)t[i]=this.compile(n,i,f[i]);if(n.__baseType){o=this.compileType(n.__baseType);for(e in o)t[e]||(t[e]=o[e])}return this.compiled[r]=t,i=this,delete i[r],delete i[u],t};st={"{":function(n,i,u,f){var o,c,l,h;if(u=u.substr(1,u.length-2),o=ut.parse(u),o.path)for(c=new e(o.path),u=[];c.next();){for(l=new e(c.current()),h=n;l.next();)h=t.getValue(h,l.current());u.push(h)}else u=[u];u.push(r);u.push(s);u.push(p);u=o.method.apply(null,u);n.setLocalValue(i,u,f)},"[":function(n,i,r,u){r=r.substr(1,r.length-2);var f=ut.parse(r);f.length==0?(r=eval(r),t.setValue(n,i,r)):f.length==1&&f.path[0]==f.original?n.bind(u,i,r,!1):n.bind(u,i,f.path,!1,f.method)},"$[":function(n,t,i,r){var f=i.lastIndexOf("]"),u=null;f<i.length-1&&(u=i.substr(f+2),u=u.substr(0,u.length-1));i=i.substr(0,f);i=i.substr(2);/^(@|\$)/g.test(i)&&(i=i.substr(1));n.bind(r,t,i,!0,null,u)},"^[":function(n,t,i,r){i=i.substr(2,i.length-3);/^(@|\$)/g.test(i)&&(i=i.substr(1));n.bind(r,t,i,!0,null,"keyup,keydown,keypress,blur,click")}};b={any:function(n,t,i){f.attr(n,i,t)},isEnabled:function(n,t){t?f.removeAttr(n,"disabled"):f.attr(n,"disabled","disabled")},checked:function(n,t){n.checked!=t&&(n.checked=t?!0:!1)},value:function(n,t){/date|datetime/gi.test(n.type)?n.valueAsDate=a.parse(t):i(n).val(t)},src:function(n,t){t&&/http\:\/\//i.test(t)&&(t=t.substr(5));f.attr(n,"src",t)},valueAsDate:function(n,t){n.valueAsDate=a.parse(t)},text:function(n,t){n.innerHTML="";var i=h.createTextNode(t);n.appendChild(i)},error:function(n,t){var i=t;typeof i!="function"&&(i=function(){return t});it.set(n,"error",i)},validate:function(n){var e=n.control,i=n.element,f=n.key,o=n.value,t=n.eventName,s=n.valueFunction,h=function(){var t=s.call(e,i);return n.validator(t)},u;if(o){if(it.set(i,f,h),t)for(u=r.query(t.split(","));u.next();)t=u.current(),e.bindEvent(i,t,function(){it.reset(i)},f)}else if(it.set(i,f,null),t)for(u=r.query(t.split(","));u.next();)t=u.current(),e.unbindEvent(i,t,null,f)},invalid:function(n,t){var r=this;b.validate({value:t,key:"invalid",valueFunction:function(){return t},validator:function(n){return n&&i.isArray(n)?n.join(","):n},control:this,element:n});this._created&&it.reset(n)},required:function(n,t){if(this._element==n&&this.get_value){t?this.bind(this._element,"invalid",[["value"]],!1,function(n){return n?null:"Required"}):this.clearBinding(this._element,"invalid");return}if(/input|textarea|select/i.test(n.tagName)){var r=function(){return i(n).val()},u=function(n){return n?null:"Required"};b.validate({control:this,element:n,key:"required",value:t,eventName:"change,blur",valueFunction:r,validator:u})}},regex:function(n,t){var r=function(){return i(n).val()},u=function(n){var i=t;return(typeof i=="string"||i.constructor==String)&&(/^\//.test(i)||/(\/)|(\/i)$/.test(i)||(i="/"+i+"/"),i=eval(i)),i.test(n)?null:"Invalid"};b.validate({control:this,element:n,value:t,key:"regex",eventName:"change,blur",valueFunction:r,validator:u})},dataType:function(n,t){var r=function(){return i(n).val()},u=function(n){var i=null,r="Invalid";return/email/i.test(t)&&(i=/^(([^<>()\[\]\\.,;:\s@\"]+(\.[^<>()\[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,r="Invalid email"),i.test(n)?null:r};b.validate({control:this,element:n,value:t,key:"dataType",eventName:"change,blur",valueFunction:r,validator:u})},mask:function(n,t){t?t.constructor===String?i(n).mask(t):i(n).mask(t.mask,t.settings):i(n).unmask()},html:function(n,t){n.innerHTML=t},absPos:function(n,t){b.setPosition(!0,n,t)},relPos:function(n,t){b.setPosition(!1,n,t)},"class":function(n,t){n.atomClass&&i(n).removeClass(n.atomClass);t&&(t=f.createCss(t),t&&i(n).addClass(t),n.atomClass=t)},setPosition:function(n,t,i){var r=i,e,o,u,f;r.constructor==String&&(r=eval("["+r+"]"));t.style.position=n?"absolute":"relative";e=r[0];o=r[1];e!==null&&(t.style.left=e+"px");o!==null&&(t.style.top=o+"px");r.length>2&&(u=r[2],f=r[3],u!==undefined&&u!==null&&(t.style.width=u+"px"),f!==undefined&&f!==null&&(t.style.height=f+"px"))}};n.AtomProperties=b,function(o){return classCreatorEx({name:"WebAtoms.AtomControl",base:o,start:function(n){n.atomControl=this;this._element=n;this.dispatcher=u.dispatcher;this.bindings=[];this._isVisible=!0;var t=n.id;t&&appScope&&(/^\_\_waID/.test(t)||(appScope[t]=this));f.assignID(n);ft[t]=this},properties:{layout:null,loadNext:null,next:null,merge:undefined,value:undefined},methods:{set_merge:function(n){var t,i,f,u;if((this._mergeData2=null,n)&&(t=n.data,t&&(r.merge(this.get_data(),t,!0),this._mergeData2=t),t=n.scope,t&&r.merge(this.get_scope(),t,!0),t=n.appScope,t&&r.merge(this.get_appScope(),t,!0),t=n.localScope,t&&r.merge(this.get_localScope(),t,!0),t=n.owner,t&&r.merge(this,t,!0),i=n.timeOut||n.timeout,i)){f=this;u=100;i.hasOwnProperty("length")&&i.length>1&&(u=i[0],i=i[1]);setTimeout(function(){f.set_merge(i)},u);return}},invokeAction:function(n,t){try{wt.call(this,n,t)}catch(i){r.alert(i);console.error&&console.error(i)}},refresh:function(){},get_element:function(){return this._element},clearBinding:function(n,t){for(var i=new e(this.bindings),r,u=[];i.next();)(r=i.current(),n&&r.element!=n)||t&&r.key!=t||(r.dispose(),u.push(r));for(i=new e(u);i.next();)tt.remove(this.bindings,i.current())},addBinding:function(n,t,i,r,f,e,o,s){this.clearBinding(t,i);var h=new u.AtomBinding(n,t,i,r,f,e,o,s);this.bindings.push(h);h.setup()},get_errors:function(){return n.errors.get(this._element,!0)},get_atomParent:function(t){if(t==null)if(this._element._logicalParent||this._element.parentNode)t=this._element._logicalParent||this._element.parentNode;else return null;return t.atomControl?t.atomControl:t===h||t===n||!t.parentNode?null:this.get_atomParent(t._logicalParent||t.parentNode)},get_templateParent:function(n){if(n||(n=this._element),n._templateParent)return n._templateParent;var t=n._logicalParent||n.parentNode;if(!t)throw new Error("Could not find templateParent");return this.get_templateParent(n._logicalParent||n.parentNode)},get_localViewModel:function(){if(this._localViewModel===undefined){var n=this.get_atomParent(this._element._logicalParent||this._element.parentNode);if(n)return n.get_localViewModel()}return this._localViewModel},set_localViewModel:function(n){function i(n){for(var f=new c(n),t,u;f.next();){if(t=f.current(),t.atomControl&&t.atomControl._created){if(u=t.atomControl,u._localViewModel!==undefined)continue;r.refresh(u,"localViewModel")}i(t)}}var t=this._localViewModel;t&&t.dispose&&t.dispose();this._localViewModel=n;i(this._element)},get_viewModel:function(){if(this._viewModel===undefined){var n=this.get_atomParent(this._element._logicalParent||this._element.parentNode);if(n)return n.get_viewModel()}return this._viewModel},set_viewModel:function(n){function i(n){for(var f=new c(n),t,u;f.next();){if(t=f.current(),t.atomControl&&t.atomControl._created){if(u=t.atomControl,u._viewModel!==undefined)continue;r.refresh(u,"viewModel")}i(t)}}var t=this._viewModel;t&&t.dispose&&t.dispose();this._viewModel=n;i(this._element)},get_data:function(){if(this._data===undefined){var n=this.get_atomParent(this._element._logicalParent||this._element.parentNode);if(n)return n.get_data()}return this._data},set_data:function(n){this._data=n;this.mergeData();this.updateChildBindings(this._element)},validate:function(){it.validate(this._element)},mergeData:function(){this._mergeData2&&r.merge(this.get_data(),this._mergeData2,!0)},updateChildBindings:function(n){for(var u=new c(n),i,r;u.next();){if(i=u.current(),i.atomControl&&i.atomControl._created){if(r=i.atomControl,r._data!==undefined)continue;t.refreshValue(r,"data");r.mergeData()}this.updateChildBindings(i)}},initProperties:function(){if(!this._disposed){var n=this.get_element();this.setProperties(n);this._created=!0;this.onCreated();this.onLoaded()}},createChildren:function(){var n,u,o,r,t;this.onCreateChildren(this._element);if(n=this.getTemplate("template"),n&&(u=new c(this._element),!u.next())){if(n.constructor==String)this._element.innerHTML=n,o=this,i(this._element).children().each(function(){this._templateParent=o});else if(f.isNode(n))n=f.cloneNode(n),n._templateParent=this,this._element.appendChild(n);else for(r=new e(n);r.next();)t=r.current(),t=f.cloneNode(t),t._templateParent=this,this._element.appendChild(t);this.onCreateChildren(this._element)}},onCreateChildren:function(n){for(var s=new c(n),t,i,r,u,e,h,o;s.next();){if(t=s.current(),i=f.attributeMap(t,/^atom\-(template|presenter|type|template\-name)$/gi),r=i["atom-template"],r){t.removeAttributeNode(r.node);n.templateOwner=!0;this["_"+r.value]=t;n.removeChild(t);continue}if(u=i["atom-template-name"],u){t.removeAttributeNode(u.node);this._scopeTemplates=this._scopeTemplates||{};this._scopeTemplates[u.value]=t;n.removeChild(t);continue}if(e=i["atom-presenter"],e&&(h=f.getPresenterOwner(this,e.value),h["_"+e.value]=t),o=i["atom-type"],o)f.createControl(t,o.value);else this.onCreateChildren(t)}},onLoaded:function(){},onUpdateUI:function(){this._layout?this._layout.doLayout(this._element):this.updateChildUI(this.get_element())},updateUI:function(){var n=this;this.dispatcher.callLater(function(){n.onUpdateUI()})},updateChildUI:function(n){var i,t;for(n||(n=this._element),i=new c(n);i.next();){if(t=i.current(),t.atomControl){t.atomControl.updateUI();continue}this.updateChildUI(t)}},onCreated:function(){this.updateUI()},setProperties:function(n){var t,o,r,b=n.attributes,f=new e(b),s=[],y="value",h,l,p,a,v;for(w.isIE&&w.majorVersion<9&&(y="nodeValue"),h={},l=null;f.next();){if(r=f.current(),t=r.nodeName,o=r[y],t==="data-atom-init"){l=o;s.push(r);continue}if(/^data\-atom/.test(t)&&(t=t.substr(5)),!/^atomControl$/g.test(t)){if(/^atom\-type$/.test(t)){s.push(r);continue}/^(atom|bind|style|event)\-/g.test(t)&&(/^(style|event)\-/g.test(t)||(t=t.substr(5)),o)&&(/(^style$|dock)/.test(t)||s.push(r),t=i.camelCase(t),h[t]=o)}}l&&(p=u.PageSetup[l],p.call(this,n));for(t in h)this.setValue(t,h[t],!0,n);for(f=new e(s);f.next();)n.removeAttributeNode(f.current());for(a=new c(n);a.next();)(v=a.current(),v.atomControl)||this.setProperties(v)},setValue:function(n,t,i,r){if(t&&t.constructor==String){var f=t[0],u=st[f];if(u){u(this,n,t,r);return}if(f+=t[1],u=st[f],u){u(this,n,t,r);return}}this.setLocalValue(n,t,r)},setLocalValue:function(n,i,r,u){var o,e,h,l,f,a,c;if(i!==undefined){if(i&&i instanceof s){r._promisesQueue=r._promisesQueue||{};o=r._promisesQueue[n];o&&o.abort();r._promisesQueue[n]=i;i._persist&&(this._promises=this._promises||{},this._promises[n]=i);e=this;i.then(function(t){r._promisesQueue[n]==t&&(r._promisesQueue[n]=null);r._promisesQueue[n]=null;e.setLocalValue(n,t.value(),r,!0);e._loadNext&&e.invokeAction(e._loadNext)});i.failed(function(t){r._promisesQueue[n]==t&&(r._promisesQueue[n]=null)});i.invoke();return}if(this._element==r&&(h=this["set_"+n],h!=null)){if(u&&(l=t.getValue(this,n),l==i))return;h.apply(this,[i]);u&&t.refreshValue(this,n);return}if(/^style/g.test(n)&&n.length>5){f=n.substr(5);f=String.fromCharCode(f.charCodeAt(0)).toLowerCase()+f.substr(1);r.style[f]=i;return}if(/^event/g.test(n)&&n.length>5){f=n.substr(5);f=String.fromCharCode(f.charCodeAt(0)).toLowerCase()+f.substr(1);a=this;this.unbindEvent(r,f);this.bindEvent(r,f,null,null,function(n){a.invokeAction(i,n)});return}c=b[n]||b.any;c&&c.call(this,r||this._element,i,n)}},bind:function(t,i,r,u,f,e){var s,c,o,h;if(r==null){this.clearBinding(t,i);return}s=this;r&&r.constructor==String&&/^window\./g.test(r)&&(s=n);c=this.get_element();o=c!=t;o||(h=this["get_"+i],(h==undefined||h==null)&&(o=!0));switch(i){case"value":/input/gi.test(t.nodeName)&&(o=!0);this.addBinding(s,t,"value",r,u,o,f,e);break;case"text":this.addBinding(s,t,"text",r,!1,!0,f,e);break;default:this.addBinding(s,t,i,r,u,o,f,e)}},onInitialized:function(){},init:function(){var l,e,r,s,a,h;o.init.apply(this,arguments);var i=this.get_element(),c=f.attributeMap(i,/^atom\-(name|local\-scope)$/gi),n=c["atom-name"];if(n?(i.removeAttributeNode(n.node),n=n.value):(l=i.id,/^\_\_waID/.test(l)||(n=i.id)),n){if(/^(app|window|owner|scope|localScope|parent)$/gi.test(n))throw new Error("Invalid Control Name '"+n+"'");r=this.get_scope();t.setValue(r,n,this);this._name=n}if(ls=c["atom-local-scope"],ls&&(this._localScope=new g(this,this.get_scope(),atomApplication),this._scope=this._localScope,this._name&&(this._localScope[this._name]=this),i.removeAttributeNode(ls.node)),e=this._scopeTemplates,e){r=this.get_scope();for(s in e)a=e[s],t.setValue(r,s,a)}h=this;u.dispatcher.callLater(function(){h.initProperties()});this.initChildren(this._element);u.dispatcher.callLater(function(){h.onInitialized()})},dispose:function(n){var r,t,u;if(n){r=n.atomControl;r?r.dispose():(this.clearBinding(n),this.disposeChildren(n));i(n).remove();return}n=this._element;t=this._viewModel;t&&t.dispose&&(t.dispose(),this._viewModel=null);t=this._localViewModel;t&&t.dispose&&(t.dispose(),this._localViewModel=null);this._disposed=!0;this.disposeChildren(n);this.clearBinding();this.bindings.length=0;u=n.atomValidator;u&&(u.dispose(),n.atomValidator=undefined);o.dispose.apply(this,arguments)},disposeChildren:function(n){for(var u=w.isIE&&w.majorVersion<9,r=new c(n),t;r.next();)t=r.current(),t.atomControl?(t.atomControl.dispose(),u?t.atomControl=undefined:delete t.atomControl):(this.clearBinding(t),this.unbindEvent(t),this.disposeChildren(t));try{n.innerHTML=""}catch(f){i(n).html("")}},get_innerTemplate:function(){return this._template},set_innerTemplate:function(n){if(this._template!==n||!this._created){if(!this._created){var t=this;u.dispatcher.callLater(function(){t.set_innerTemplate(n)});return}this._template=n;this.disposeChildren(this._element);this.createChildren();this.setProperties(this._element);this.initChildren(this._element);this.updateUI()}},initChildren:function(n){for(var f=new c(n),t,o,s=[],u;f.next();){if(t=f.current(),t.nodeName=="SCRIPT"){if(u=i.trim(t.innerHTML),/^\(\{/.test(u)&&/\}\)$/.test(u))try{u=new Function("return "+u+";")();this.set_scope(u)}catch(h){rt(JSON.stringify(h));r.alert(JSON.stringify(h))}s.push(t);continue}o=t.atomControl;o?o.init():this.initChildren(t)}for(f=new e(s);f.next();)n.removeChild(f.current())}}})}(u.AtomUIComponent.prototype),function(o){return classCreatorEx({name:"WebAtoms.AtomItemsControl",base:o,start:function(){this._selectedItems=[];this._selectedElements=[];this._selectedIndexSet=!1;this._onUIChanged=!1;this._itemsPresenter=null;this._itemsPanel=null;this._presenters=["itemsPresenter","virtualContainer"];this._childItemType=u.AtomControl},properties:{allowSelectFirst:!1,allowMultipleSelection:!1,uiVirtualize:!1,defaultValue:null,autoScrollToSelection:!1,selectAll:undefined,labelPath:"label",valuePath:"value",sortPath:null,valueSeparator:null,postData:null,errorNext:null,postUrl:null,confirm:!1,confirmMessage:null,filter:null,items:null,itemTemplate:null},methods:{get_postData:function(){return this._postData||this.get_selectedItem()},get_allValues:function(){if(this._valueSeparator&&this._valuePath){for(var n=[],i=this._valuePath,u=function(n){return n[i]},t=r.query(this.get_dataItems());t.next();)n.push(u(t.current()));return n.join(this._valueSeparator)}},get_value:function(){var n,t;return this._allowMultipleSelection?(n=this._selectedItems,n.length==0)?this._value!==undefined?this._value:null:(n=tt.getValues(n,this._valuePath),this._valueSeparator&&(n=n.join(this._valueSeparator)),n):(t=this.get_selectedItem(),!t)?this._value!==undefined?this._value:null:(this._valuePath&&(t=t[this._valuePath]),t)},set_value:function(n){var r,u,i;if(this._value=n,n===undefined||n===null){t.clear(this._selectedItems);return}for(r=this.get_dataItems(),this._allowMultipleSelection&&this._valueSeparator?(n.constructor!=String&&(n=""+n),n=tt.split(n,this._valueSeparator)):n=[n],u=tt.intersect(r,this._valuePath,n),this._selectedItems.length=0,i=new e(u);i.next();)this._selectedItems.push(i.current());t.refreshItems(this._selectedItems)},set_sortPath:function(n){if(this._sortPath=n,n)this.onCollectionChangedInternal("refresh",-1,null)},set_selectAll:function(n){var i,r;if(n!==undefined&&n!==null){if(this._selectedItems.length=0,i=this.get_dataItems(),n&&i)for(r=new e(i);r.next();)this._selectedItems.push(r.current());this._selectAll=!0;t.refreshItems(this._selectedItems)}},refresh:function(){this._promises&&this._promises.items&&this._promises.items.invoke()},set_defaultValue:function(n){this.get_value()||t.setValue(this,"value",n)},invokePost:function(){var u,n,f,i,e;if(this._onUIChanged){if(u=this.get_errors(),u.length)return r.alert(u.join("\n")),!1;if(!this._confirm||confirm(this._confirmMessage)){if(!this._postUrl){this.invokeAction(this._next);return}(n=this.get_postData(),n!==null&&n!==undefined)&&(n=t.getClone(n),f=this,i=s.json(this._postUrl,null,{type:"POST",data:n}),i.then(function(){f.invokeNext()}),e=this._errorNext,e&&i.failed(function(){f.invokeAction(e)}),i.invoke())}}},invokeNext:function(){this.invokeAction(this._next)},set_filter:function(n){if(n!=this._filter&&(this._filter=n,this._filteredItems=null,this.hasItems()))this.onCollectionChangedInternal("refresh",-1,null)},isSelected:function(n){for(var t=new e(this._selectedItems),i=null;t.next();)if(i=t.current(),i==n)return!0;return!1},get_dataItems:function(){var t=this._items,u,f,o,s,h,c;if(this.hasItems()){if(u=this._filter,u){if(f=[],typeof u=="object")f=r.query(t).where(u).toArray();else for(o=new e(t);o.next();)s=o.current(),u(s,o.currentIndex())&&f.push(s);this._filteredItems=f;t=f}return h=this._sortPath,h&&(c=n.AtomFilter.sort(h),t=t.sort(c)),t}return i(this._itemsPresenter).children()},getIndexOfDataItem:function(n){if(n==null)return-1;for(var i=this.get_dataItems(),t=new e(i);t.next();)if(t.current()==n)return t.currentIndex();return-1},getDataItemAtIndex:function(n){return n==-1?null:this.get_dataItems()[n]},get_childAtomControls:function(){for(var r=this._itemsPresenter||this._element,t=[],i=new c(r),n;i.next();)(n=i.current(),n=!n||n.atomControl,n)&&t.push(n);return t},get_selectedChild:function(){var i=this.get_selectedItem(),n,t;if(!this.hasItems())return i;for(n=new c(this._itemsPresenter);n.next();)if(t=n.current(),t.atomControl.get_data()==i)return t;return null},set_allowSelectFirst:function(n){n=n?n!="false":n;this._allowSelectFirst=n},get_selectedItem:function(){return this._selectedItems.length>0?this._selectedItems[0]:null},set_selectedItem:function(n){n?(this._selectedItems.length=1,this._selectedItems[0]=n):this._selectedItems.length=0;t.refreshItems(this._selectedItems)},get_selectedItems:function(){return this._selectedItems},set_selectedItems:function(){throw new Error("Not yet implemented");},get_selectedIndex:function(){var n=this.get_selectedItem();return this.getIndexOfDataItem(n)},set_selectedIndex:function(n){t.setValue(this,"selectedItem",this.getDataItemAtIndex(n))},updateChildSelections:function(){},bringSelectionIntoView:function(){var r,u,t,n,o;if(!this._allowSelectFirst||this.get_selectedIndex()!=0){if(this._uiVirtualize){if(r=this.get_selectedIndex(),!this._ready){u=this;setTimeout(function(){u.bringSelectionIntoView()},1e3);return}var s=this._avgHeight,f=i(this._virtualContainer),e=f.innerHeight(),h=Math.ceil(e/s),l=h*this._columns,a=Math.floor(r/l);f.scrollTop(a*e);return}for(t=new c(this._itemsPresenter);t.next();)if(n=t.current(),o=n.atomControl?n.atomControl.get_data():n,this.isSelected(o)){n.scrollIntoView();return}}},updateSelectionBindings:function(){t.refreshValue(this,"value");t.refreshValue(this,"selectedItem");t.refreshValue(this,"selectedItems");t.refreshValue(this,"selectedIndex");this._selectedItems.length||this._selectAll===!0&&(this._selectAll=!1,t.refreshValue(this,"selectAll"))},onSelectedItemsChanged:function(n,t,i){this._onUIChanged||(this.updateChildSelections(n,t,i),this._autoScrollToSelection&&this.bringSelectionIntoView());this.updateSelectionBindings();this.updateUI();this.invokePost()},hasItems:function(){return this._items!=undefined&&this._items!=null},get_items:function(){return this._items},set_items:function(n){var t=this;if(this._items&&this.unbindEvent(this._items,"CollectionChanged",null),this._items=n,this._filteredItems=null,n!=null){this.bindEvent(this._items,"CollectionChanged",function(){t.onCollectionChangedInternal.apply(t,arguments)});this.onCollectionChangedInternal("refresh",-1,null)}},set_itemTemplate:function(n){this._itemTemplate=n;this.onCollectionChangedInternal("refresh",-1,null)},onCollectionChangedInternal:function(n,i,u){if(this._created){r.refresh(this,"allValues");var f=this.get_value();if(this.hasItems()){this.onCollectionChanged(n,i,u);f||this._allowSelectFirst||t.clear(this._selectedItems)}if(f!=null){if(this.set_value(f),this.get_selectedIndex()!=-1)return;this._value=undefined}this.selectDefault()}},selectDefault:function(){if(this._allowSelectFirst&&this.get_dataItems().length>0){this.set_selectedIndex(0);return}this.updateSelectionBindings()},onScroll:function(){this.scrollTimeout&&clearTimeout(this.scrollTimeout);var n=this;this.scrollTimeout=setTimeout(function(){n.scrollTimeout=0;n.onVirtualCollectionChanged()},10)},validateScroller:function(){var e,o,s,t,r;if(!this._scrollerSetup){var n=this._itemsPresenter,f=this._element,u=this._virtualContainer;if(!u)if(n==f||/table/i.test(f.nodeName))throw new Error("virtualContainer presenter not found, you must put itemsPresenter inside a virtualContainer in order for Virtualization to work");else u=this._virtualContainer=this._element;e=i(u);e.css({overflow:"auto"});this.bindEvent(u,"scroll","onScroll");o=i(n);o.css({overflow:"hidden"});s=/tbody/i.test(n.nodeName);s?(t=h.createElement("TR"),r=h.createElement("TR")):(t=h.createElement("DIV"),r=h.createElement("DIV"));i(t).addClass("sticky first-child").css({posiiton:"relative",height:0,width:"100%",clear:"both"});i(r).addClass("sticky last-child").css({posiiton:"relative",height:0,width:"100%",clear:"both"});this._firstChild=t;this._lastChild=r;n.appendChild(t);n.appendChild(r);this._training=!0;this._scrollerSetup=!0}},postVirtualCollectionChanged:function(){var n=this;u.dispatcher.callLater(function(){n.onVirtualCollectionChanged()})},resetVirtulContainer:function(){this._itemsPresenter&&this.disposeChildren(this._itemsPresenter);this._firstChild=null;this._lastChild=null;this._scrollerSetup=!1;this._scopes=null;this.unbindEvent(this._virtualContainer,"scroll")},onVirtualCollectionChanged:function(){var tt=this._itemsPresenter,p=this.get_dataItems(),r,a,o,f,w,ht,ct,lt,g,nt,gt,n,y,vt;if(!p.length){this.resetVirtulContainer();return}this.validateScroller();var ii=i(tt),h=this._firstChild,c=this._lastChild,it=i(h),rt=i(c),l=this._virtualContainer,yt=i(l),ut=yt.innerHeight(),ri=l.scrollHeight;if(isNaN(ut)||ut<=0||ri<=0){w=this;setTimeout(function(){w.onVirtualCollectionChanged()},1e3);return}var ui=yt.innerWidth(),s=this._avgHeight,b=this._avgWidth,fi=l.scrollHeight-it.outerHeight()-rt.outerHeight(),ci=ii.innerWidth(),pt=this.get_scope(),ei=this._element,n=new e(p);if(this._training){if(ut>=fi){if(r=c.previousElementSibling,a=0,r!=h)for(o=r.atomControl.get_data();n.next();)if(n.current()==o)break;n.next()&&(o=n.current(),f=this.createChildElement(pt,null,o,n),tt.insertBefore(f,c),this.applyItemStyle(f,o,n.isFirst(),n.isLast()),this.postVirtualCollectionChanged())}else{for(var v=0,r=h.nextElementSibling,wt=0,bt=0;r!=c;)v++,wt+=i(r).outerHeight(!0),bt+=i(r).outerWidth(!0),r=r.nextElementSibling;s=wt/v;b=bt/v;v--;this._avgHeight=s;this._avgWidth=b;var k=Math.floor(ui/b),ft=Math.ceil(p.length/k),et=Math.ceil(v/k);console.log({avgWidth:b,avgHeight:s,totalVisibleItems:v,allRows:ft,columns:k});this._allRows=ft;this._columns=k;this._visibleRows=et;this._visibleHeight=et*s;rt.css({height:(ft-et+1)*s+"px"});this._training=!1;this._ready=!0;this.postVirtualCollectionChanged()}return}if(w=this,this.lastScrollTop=l.scrollTop,!this._isChanging){this._isChanging=!0;var oi=Math.floor(this._visibleHeight/s),ot=this._visibleRows*this._columns,a=Math.floor(l.scrollTop/this._visibleHeight),si=a*ot;if(si>=p.length){this._isChanging=!1;return}var st=(Math.max(a,0)+3)*ot-1,d=Math.max(0,a*ot),r=h.nextElementSibling,kt=h.nextElementSibling,dt=c.previousElementSibling;if(kt!=dt&&(ht=kt.atomControl.get_scope().itemIndex,ct=dt.atomControl.get_scope().itemIndex,console.log({firstVisibleIndex:ht,firstIndex:d,lastVisibleIndex:ct,lastIndex:st}),d>=ht&&st<=ct)){console.log("All items are visible...");this._isChanging=!1;return}for(lt=[],g={};r!=c;)nt=r,r=r.nextElementSibling,gt=nt.atomControl.get_scope().itemIndex,g[gt]=nt,lt.push(nt);for(u.dispatcher.pause(),n=new e(p),y=0;y<d;y++)n.next();var ni=h,hi=null,ti=[];for(y=d;y<=st;y++){if(!n.next())break;var at=n.currentIndex(),o=n.current(),f=g[at];f&&ei.atomControl.get_data()==o?g[at]=null:f=this.createChildElement(pt,null,o,n);f.before=ni;ti.push(f);ni=f;this.applyItemStyle(f,o,n.isFirst(),n.isLast());hi=at}vt=(this._allRows-oi*3)*s-a*this._visibleHeight;console.log("last child height = "+vt);u.dispatcher.callLater(function(){for(var r=it.height(),i=a*w._visibleHeight,u=i-r,f=l.scrollTop,t=new e(ti),n;t.next();)n=t.current(),tt.insertBefore(n,n.before.nextElementSibling),n.before=null;for(it.css({height:i}),t=new e(lt);t.next();)n=t.current(),n.before||n.atomControl.dispose(),n.remove();rt.css({height:vt});console.log("Old: "+f+" Diff: "+u+" Old Height: "+r+" Height: "+i);w._isChanging=!1});u.dispatcher.start();t.refreshValue(this,"childAtomControls")}},onCollectionChanged:function(n,r,o){var v,a,s,l,h,y,p,d,w,b,nt;if(/reset|refresh/i.test(n)&&this.resetVirtulContainer(),/remove/gi.test(n)){for(l=new c(this._itemsPresenter);l.next();)if(h=l.current(),h.atomControl&&h.atomControl.get_data()==o){h.atomControl.dispose();i(h).remove();break}this.updateUI();return}if(this._uiVirtualize){this.onVirtualCollectionChanged();return}if(v=this.get_scope(),a=this.getTemplate("itemTemplate"),a&&(a=f.getAtomType(a),a&&(this._childItemType=a)),/add/gi.test(n)){for(u.dispatcher.pause(),s=new e(this._items),l=new c(this._itemsPresenter);s.next();){if(l.next(),h=l.current(),s.currentIndex()==r){y=this.createChildElement(v,this._itemsPresenter,o,s,h);this.applyItemStyle(y,o,s.isFirst(),s.isLast());break}if(s.isLast()){y=this.createChildElement(v,this._itemsPresenter,o,s);this.applyItemStyle(y,o,s.isFirst(),s.isLast());break}}u.dispatcher.start();this.updateUI();return}p=this._itemsPresenter;d=this.get_dataItems();this.disposeChildren(p);u.dispatcher.pause();var g=this.get_dataItems(!0),k=[],s=new e(g);for(this.getTemplate("itemTemplate");s.next();)w=s.current(),b=this.createChildElement(v,p,w,s),k.push(b),this.applyItemStyle(b,w,s.isFirst(),s.isLast());nt=this;u.dispatcher.callLater(function(){for(var r=[],t=new c(p),u,n;t.next();)n=t.current(),u=k.filter(function(t){return n==t}),u.pop()!=n&&r.push(n);for(t=new e(r);t.next();)n=t.current(),n.atomControl&&n.atomControl.dispose(),i(n).remove()});u.dispatcher.start();t.refreshValue(this,"childAtomControls")},set_innerTemplate:function(){this._itemsPresenter=this._element;o.set_innerTemplate.apply(this,arguments);this.onCollectionChangedInternal("mode",-1,null)},applyItemStyle:function(){},createChildElement:function(n,t,i,r,e){var s=f.cloneNode(this._itemTemplate),h,o,c,l;return s._logicalParent=t||this._itemsPresenter,s._templateParent=this,s._isDirty=!0,t&&u.dispatcher.callLater(function(){e?t.insertBefore(s,e):t.appendChild(s)}),h=r?r.currentIndex():-1,o=null,this._uiVirtualize?(c=this._scopes||{},this._scopes=c,o=c[h]||new g(this,n,n.__application),c[h]=o):o=new g(this,n,n.__application),r&&(o.itemIsFirst=r.isFirst(),o.itemIsLast=r.isLast(),o.itemIndex=h,o.itemExpanded=!1,o.data=i,o.get_itemSelected=function(){return o.owner.isSelected(i)},o.set_itemSelected=function(){o.owner.toggleSelection(i,!0)}),l=f.createControl(s,this._childItemType,i,o),s},toggleSelection:function(n){this._onUIChanged=!0;this._value=undefined;this._allowMultipleSelection?f.contains(this._selectedItems,n)?t.removeItem(this._selectedItems,n):t.addItem(this._selectedItems,n):(this._selectedItems.length=1,this._selectedItems[0]=n,t.refreshItems(this._selectedItems));this._onUIChanged=!1},onUpdateUI:function(){var n,i,r;for(o.onUpdateUI.call(this),this._uiVirtualize&&this.onVirtualCollectionChanged(),n=new c(this._itemsPresenter);n.next();)(i=n.current(),i.atomControl)&&(r=i.atomControl.get_data(),t.refreshValue(i.atomControl.get_scope(),"itemSelected"),this.applyItemStyle(i,r,n.isFirst(),n.isLast()))},onCreated:function(){if(this._items)this.onCollectionChangedInternal("refresh",-1,null);var n=this;this.dispatcher.callLater(function(){n._autoScrollToSelection&&n.bringSelectionIntoView()})},dispose:function(){this.resetVirtulContainer();o.dispose.call(this)},init:function(){var r=this.get_element(),i,n;this._itemsPresenter||(this._itemsPresenter=this._element);i=this;this.bindEvent(this._selectedItems,"CollectionChanged",function(){i.onSelectedItemsChanged.apply(i,arguments)});o.init.apply(this,arguments);n=this;this.removeItemCommand=function(i,r){if(r){var u=r.get_data();t.removeItem(n._items,u)}};this.removeSelectedCommand=function(){for(var r=n.get_selectedItems().slice(0),i=new e(r);i.next();)t.removeItem(n.get_items(),i.current())};this.removeAllCommand=function(){t.clear(n.get_items())}}}})}(u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomButton",base:n,start:function(n){this._sendData=!1;i(n).addClass("atom-button")},properties:{sendData:!1,validationRoot:null,command:null,commandParameter:null,invalid:null},methods:{onClickHandler:function(n){var s,o,e,u;if(f.cancelEvent(n),this._command)return s=this,setTimeout(function(){s._command.execute(s._commandParameter)}),!1;if((o=this._validationRoot,o&&(o.validate(),e=o.get_errors(),e.length))||(e=this.get_errors(),e.length))return r.alert(r.mapJoin(e,"label")),!1;if(this._next){if(u=this._invalid,u&&(i.isArray(u)&&(u=u.join()),u)){alert(u);return}this._sendData&&this._next&&t.setValue(this._next,"data",this.get_data());this.invokeAction(this._next)}return!1},init:function(){var t=this._element;this.bindEvent(t,"click","onClickHandler");this.bind(t,"isEnabled",[["command"],["command","enabled"]],0,function(n,t){return n?t:!0});n.init.apply(this)}}})}(u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomListBox",base:n,start:function(){this._labelPath="label";this._valuePath="value";this._autoScrollToSelection=!1},properties:{autoSelectOnClick:!0},methods:{setClass:function(){var n=i(this._element);n.addClass("atom-list-box")},onClick:function(n){if(this._autoSelectOnClick)this.onSelectItem(null,null,n)},get_itemWidth:function(){if(!this._items||!this._items.length)return 0;var n=i(this._element).innerWidth();return n/this._items.length},applyItemStyle:function(n,t,r,u){var f=i(n);(f.removeClass("selected-item list-item first-item last-item"),t)&&(f.addClass("list-item"),r&&f.addClass("first-item"),u&&f.addClass("last-item"),this.isSelected(t)&&f.addClass("selected-item"))},onCreated:function(){this.bindEvent(this._itemsPresenter,"click","onClick");n.onCreated.call(this)},invokePost:function(){this.get_selectedIndex()!=-1&&n.invokePost.apply(this,arguments)},onSelectItem:function(n,t,i){for(var e=i?i.target:null,o=this._itemsPresenter,r=e||t._element,s=/checkbox/i.test(r.type),u,f;r.parentNode!=null&&r.parentNode!=o;)r=r.parentNode;if(r!=h)if(u=r,this.hasItems()&&(u=r.atomControl.get_data()),s){f=this._allowMultipleSelection;try{this._allowMultipleSelection=!0;this.toggleSelection(u)}finally{this._allowMultipleSelection=f}}else this.toggleSelection(u)},updateChildSelections:function(){var t=this._element,i;/select/i.test(t.tagName)?(i=this.get_selectedIndex(),t.selectedIndex!=i&&u.dispatcher.callLater(function(){t.selectedIndex=i})):n.updateChildSelections.apply(this,arguments)},init:function(){this.setClass();n.init.call(this);var i=this,r=this._element;/select/i.test(r.tagName)&&(this.set_allowSelectFirst(!0),this.bindEvent(r,"change",function(){t.setValue(i,"selectedIndex",r.selectedIndex)}));this.selectCommand=function(){i.onSelectItem.apply(i,arguments)};this.selectAllCommand=function(){i.set_selectAll(!0)};this.clearSelectionCommand=function(){i.set_selectedIndex(-1)}}}})}(u.AtomItemsControl.prototype),function(r){return classCreatorEx({name:"WebAtoms.AtomAutoCompleteBox",base:r,start:function(n){i(n).addClass("atom-auto-complete-box");this._presenters=["itemsPresenter","inputBox","selectionBox"];this._mouseCapture=0},properties:{isPopupOpen:!1,autoOpen:!1,selectedText:"",placeholder:undefined,keyPressed:undefined,displayLabel:undefined},methods:{get_offsetLeft:function(){return i(this._element).offset().left},get_offsetTop:function(){return i(this._element).offset().top},get_offsetWidth:function(){return i(this._inputBox).offset().width},set_itemsUrl:function(n){var t="[ !$owner.keyPressed ? undefined : AtomPromise.json('"+n+"').showProgress(false) ]";this.setValue("items",t,!0,this._element)},set_isPopupOpen:function(i){if(this._isPopupOpen=i,i){t.refreshValue(this,"offsetTop");t.refreshValue(this,"offsetLeft");t.refreshValue(this,"offsetWidth");var r=this;this.trySelect();this.bindEvent(n,"click",function(){r.onWindowClick.apply(r,arguments)})}else this.unbindEvent(n,"click")},onSelectedItemsChanged:function(){this._onUIChanged&&this._selectedItems.length>0&&this.refreshLabel();r.onSelectedItemsChanged.apply(this,arguments)},onClick:function(){r.onClick.apply(this,arguments);this._backupValue=this.get_value();this.refreshLabel();this._backupLabel=this.get_displayLabel();t.setValue(this,"keyPressed",!1);t.setValue(this,"isPopupOpen",!1)},restoreSelection:function(){t.setValue(this,"isPopupOpen",!1);this._backupValue?(t.setValue(this,"value",this._backupValue),t.setValue(this,"displayLabel",this._backupLabel),this._backupValue=null):t.setValue(this,"selectedIndex",-1)},onKeyUp:function(n){var i,r;t.setValue(this,"isPopupOpen",!0);switch(n.keyCode){case 27:t.setValue(this,"keyPressed",!1);this.restoreSelection();return;case 13:return t.setValue(this,"keyPressed",!1),t.setValue(this,"isPopupOpen",!1),this._backupValue=this.get_value(),this.refreshLabel(),this._backupLabel=this.get_displayLabel(),f.cancelEvent(n);case 37:break;case 38:t.setValue(this,"keyPressed",!1);this.moveSelection(!0);return;case 39:break;case 40:t.setValue(this,"keyPressed",!1);this.moveSelection(!1);return;default:i=this;this.dispatcher.callLater(function(){i.trySelect()})}this.oldTimeout&&clearTimeout(this.oldTimeout);r=this;this.oldTimeout=setTimeout(function(){t.setValue(r,"keyPressed",!0)},500)},trySelect:function(){var r,n;if(this._items&&this._items.length!=0){var u=new e(this._items),f=this._labelPath,i=this._displayLabel;for(i&&(i=i.toLowerCase());u.next();)if(r=u.current(),n=r,f&&(n=n[f]),n.toLowerCase().indexOf(i)==0){t.setValue(this,"selectedItem",r);t.setValue(this,"selectedText",n);this.bringSelectionIntoView();return}}},moveSelection:function(n){if(this._items&&this._items.length){var i=this.get_selectedIndex();i==-1&&(this.backupLabel=this.get_displayLabel());i=n?i-1:i+1;n&&i==-2&&(i=this._items.length-1);n||i!=this._items.length||(i=-1);t.setValue(this,"selectedIndex",i);i==-1?t.setValue(this,"displayLabel",this.backupLabel||""):this.refreshLabel()}},refreshLabel:function(){var i=this.get_selectedItem(),n=i;n&&this._labelPath&&(n=n[this._labelPath]);t.setValue(this,"displayLabel",n||"")},onWindowClick:function(n){for(var i=this._element,r=this._itemsPresenter,t=n.target;t.parentNode!=null&&t!=i&&t!=r;)t=t.parentNode;t!=i&&t!=r&&this.restoreSelection()},onInputFocus:function(){this._autoOpen&&(this._backupValue=this.get_value(),this._backupLabel=this.get_displayLabel(),t.setValue(this,"isPopupOpen",!0),i(this._inputBox).select())},onInputBlur:function(){if(!this._mouseCapture){var n=this;setTimeout(function(){n._isPopupOpen&&(t.setValue(n,"isPopupOpen",!1),n.restoreSelection())},10)}},onCreated:function(){this._itemsPresenter._logicalParent=this._element;i(this._itemsPresenter).remove();h.body.appendChild(this._itemsPresenter);i(this._itemsPresenter).addClass("auto-complete-popup");r.onCreated.apply(this,arguments);this.bindEvent(this._itemsPresenter,"mouseover","onMouseOver");this.bindEvent(this._itemsPresenter,"mouseout","onMouseOut")},onMouseOver:function(){this._mouseCapture++},onMouseOut:function(){var n=this;setTimeout(function(){n._mouseCapture--},1e3)},init:function(){r.init.apply(this,arguments);this.bindEvent(this._inputBox,"focus","onInputFocus");this.bindEvent(this._inputBox,"blur","onInputBlur");this.bindEvent(this._inputBox,"keyup","onKeyUp")},dispose:function(){this._itemsPresenter&&(this.disposeChildren(this._itemsPresenter),i(this._itemsPresenter).remove(),this._itemsPresenter=null);r.dispose.call(this)}}})}(u.AtomListBox.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomComboBox",base:n,start:function(){this._labelPath="label";this._valuePath="value";this._allowSelectFirst=!0},methods:{invokePost:function(){this.get_selectedIndex()>0&&n.invokePost.apply(this,arguments)},invokeNext:function(){n.invokeNext.apply(this,arguments);this._postUrl&&(t.setValue(this,"selectedIndex",0),this.updateChildSelections())},onSelectionChanged:function(){this._onUIChanged=!0;var n=this.get_element();this.set_selectedIndex(n.selectedIndex);this._onUIChanged=!1},updateChildSelections:function(){var n=this._element;n.selectedIndex=this.get_selectedIndex()},onCollectionChanged:function(){var u=this.get_element(),f=this.get_dataItems(),r;u.options.length=f.length;for(var i=new e(f),o=this._labelPath,s=this._valuePath,t=null,n=null,h=this.get_value();i.next();)r=i.current(),t=r,n=r,o&&(t=t[o]),s&&(n=n[s]),u.options[i.currentIndex()]=new Option(t,n,!1,n==h)},verifyTemplates:function(){},init:function(){var t=this.get_element();this.bindEvent(t,"change","onSelectionChanged");n.init.apply(this,arguments)}}})}(u.AtomItemsControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomDateListBox",base:n,start:function(){this._monthList=a.monthList;var n=new Date;this._month=n.getMonth()+1;this._year=n.getFullYear();this._selectedItems=[];this._presenters=["itemsPresenter"];this._startYear=-5;this._endYear=10;this._currentYear=(new Date).getFullYear();this._value=null},properties:{month:0,year:0,selectedItems:[],startYear:-5,endYear:0,currentYear:0,monthList:null,items:undefined,month:null,visibleDate:undefined},methods:{set_month:function(n){this._month=n;this.updateList()},set_year:function(n){this._year=n;this.updateList()},set_visibleDate:function(n){n&&(this._visibleDate=n,this._year=n.getFullYear(),this._month=n.getMonth()+1,this.updateList(),t.refreshValue(this,"year"),t.refreshValue(this,"month"))},init:function(){n.init.apply(this);var t=this;this.toggleDateCommand=function(){t.toggleDate.apply(t,arguments)}},onLoaded:function(){var o=this.getTemplate("itemTemplate"),h=this.get_scope(),c=this._itemsPresenter,n=this.getTemplate("itemTemplate"),s,t,r,e,l;if(n&&(n=f.getAtomType(n),n||(n=u.AtomControl)),this.updateList(),o)for(s=this._items,t=0;t<42;t++)r=f.cloneNode(o),r._templateParent=this,e=new g(this,h,atomApplication),e.itemIndex=t,i(c).append(r),l=f.createControl(r,n,s[t],e)},toggleDate:function(n,r){var u=r.get_data(),f=i.inArray(u.value,i.map(this._selectedItems,function(n){return n.value}));f>-1?t.removeAtIndex(this._selectedItems,f):t.addItem(this._selectedItems,u);t.refreshValue(this,"value");t.refreshValue(this,"selectedItems");this.invokeAction(this._next)},getItemClass:function(n){var u=i.inArray(n.value,i.map(this._selectedItems,function(n){return n.value}))>-1,r=n.date.getDay(),f=r==0||r==6,t="atom-date-list-box-day-list-item ";return t+=f?"atom-date-list-box-weekend ":"",t+=u?"atom-date-list-box-selected ":"atom-date-list-box-item ",t+(this._month==n.date.getMonth()+1?"":"atom-date-list-box-day-list-item-other")},set_value:function(n){var e,i,r,u,f;if(n!==undefined){if(this._selectedItems.length=0,n!==null)for(e=n.split(","),i=0;i<e.length;i++)(r=e[i],r)&&(u=r.split("/"),f=new Date(parseInt(u[2],10),parseInt(u[0],10)-1,parseInt(u[1],10)),this._selectedItems.push({date:f,dateLabel:a.toShortDateString(f),value:r,label:f.getDate()}));this._created&&(t.refreshItems(this._selectedItems),t.refreshValue(this,"value"),t.refreshValue(this,"selectedItems"))}},get_value:function(){return i.map(this._selectedItems,function(n){return n.value}).join(",")},updateList:function(){var r;if(this._month&&this._year){var e=new Date,v=new Date(this._year,this._month-1,1),i=new Date(this._year,this._month-1,1);i.getDay()&&(r=i.getDay()-1,r=-r,i.setDate(r));for(var s=i.getMonth(),h=i.getFullYear(),o=[],u=0,c=this._month-1,u=0;u<42;u++){var l=u+i.getDate(),n=new Date(h,s,l),f=n.getDay();f=f==0||f==6;o.push({label:n.getDate(),isWeekEnd:f,isToday:e.getDate()==n.getDate()&&e.getMonth()==n.getMonth()&&e.getFullYear()==n.getFullYear(),isOtherMonth:n.getMonth()!=c,dateLabel:a.toShortDateString(n),value:a.toMMDDYY(n),date:n})}this._items=o;t.refreshValue(this,"items");t.refreshValue(this,"selectedItems");this._created&&t.refreshValue(this,"value")}}}})}(u.AtomControl.prototype),function(t){var r=n.AtomUI;return classCreatorEx({name:"WebAtoms.AtomDockPanel",base:t,start:function(n){i(n).addClass("atom-dock-panel")},properties:{resizeOnChildResized:!1,contentWidth:0},methods:{resizeChild:function(n){n.atomControl?n.atomControl.updateUI():this.updateChildUI(n)},calculateSize:function(){var o=this.get_element(),f=i(o),n={width:f.width(),height:f.height()},t,e,u,s,h;if(!this._resizeOnChildResized)return n;for(t=0,e=new c(o);e.next();){u=e.current();s=r.attr(u,"atom-dock");switch(s){case"Bottom":case"Fill":case"Top":h=w.isIE&&w.majorVersion<10?u.offsetHeight:i(u).outerHeight(!0);t+=h}}return n.height<t&&(n.height=t,f.height(n.height)),n},onUpdateUI:function(){var w=this.get_element(),g=i(w),a=0,v=parseInt(i(w).css("paddingTop"),10),k=this.calculateSize(),y=k.height,s=k.width,d,t,n,p,o,b,h,l,f,u;for(this._contentWidth&&(a=(s-this._contentWidth)/2,s=this._contentWidth),d=[],o={top:[],bottom:[],left:[],right:[],fill:[]},isScriptOrStyle=/script|style/i,b=new c(w);b.next();)if((h=b.current(),!isScriptOrStyle.test(h.tagName))&&(l=i(h),l.css("display")!="none")&&l.css("visibility")!="hidden"){if(l.is(".dock-left,[dock$='Left']")){o.left.push(h);continue}if(l.is(".dock-right,[dock$='Right']")){o.right.push(h);continue}if(l.is("header,.dock-top,[dock$='Top']")){o.top.push(h);continue}if(l.is("footer,.dock-bottom,[dock$='Bottom']")){o.bottom.push(h);continue}if(l.is("section,.dock-fill,[dock$='Fill']")){o.fill.push(h);continue}}for(t=new e(o.top);t.next();)n=t.current(),u=i(n),p=u.outerHeight(!0),r.setItemRect(u,n,{top:v,left:a,width:s}),v+=p,y-=p,this.resizeChild(n);for(t=new e(o.bottom.reverse());t.next();)n=t.current(),u=i(n),p=u.outerHeight(!0),y-=p,r.setItemRect(u,n,{left:a,top:v+y,width:s}),this.resizeChild(n);for(t=new e(o.left);t.next();)n=t.current(),u=i(n),f=u.outerWidth(!0),s-=f,r.setItemRect(u,n,{top:v,left:a,height:y}),a+=f,this.resizeChild(n);for(t=new e(o.right.reverse());t.next();)n=t.current(),u=i(n),f=u.outerWidth(!0),s-=f,r.setItemRect(u,n,{left:s+a,top:v,height:y}),this.resizeChild(n);for(t=new e(o.fill);t.next();)n=t.current(),u=i(n),f=u.css("max-width"),f&&(f=parseFloat(f),f>0&&(s=f)),r.setItemRect(u,n,{left:a,top:v,width:s,height:y}),this.resizeChild(n)}}})}(u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomPostButton",base:n,start:function(){},properties:{postData:null,postResult:null,postError:null,postUrl:null,next:null,errorNext:null,confirm:!1,confirmMessage:null,mergeData:null,errorNext:null},methods:{get_postData:function(){return this._postData||this.get_data()},onClickHandler:function(n){var t=this._invalid,u;if(t&&(i.isArray(t)&&(t=t.join()),t)){alert(t);return}if(this._confirm){u=this;r.confirm(this._confirmMessage,function(){u.onConfirmed(n)});return}this.onConfirmed(n)},onConfirmed:function(){var e,u,f,o,h,l;if(!this._postUrl){n.onClickHandler.apply(this,arguments);return}if((e=this._validationRoot,e&&(e.validate(),u=e.get_errors(),u.length))||(u=this.get_errors(),u.length))return r.alert(r.mapJoin(u,"label")),!1;if(f=this.get_postData(),f!==null&&f!==undefined){if(o=this._mergeData,o)for(h in o)f[h]=o[h];var i=this,a=function(n){t.setValue(i,"postResult",n.value());i.invokeAction(i._next)},c=s.json(this._postUrl,null,{type:"POST",data:f});c.then(a);l=this._errorNext;l&&c.failed(function(n){t.setValue(i,"postError",n);i.invokeAction(i,l)});c.invoke()}}}})}(u.AtomButton.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomToggleButtonBar",base:n,start:function(){this._allowSelectFirst=!0;this._allowMultipleSelection=!1;this._showTabs=!1;this._autoScrollToSelection=!1},properties:{showTabs:!1},methods:{setClass:function(){var n=i(this._element);n.removeClass("atom-tab-bar atom-toggle-button-bar");n.addClass(this._showTabs?"atom-tab-bar":"atom-toggle-button-bar")},set_showTabs:function(n){this._showTabs=n;this.setClass()}}})}(u.AtomListBox.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomViewStack",base:n,start:function(){this._swipeDirection="left-right"},properties:{selectedIndex:-1,previousIndex:-1,swipeDirection:"left-right"},methods:{bringSelectionIntoView:function(){},set_swipeDirection:function(n){var t=this._swipeDirection;t&&i(this._element).removeClass(t);this._swipeDirection=n;n&&i(this._element).addClass(n)},set_selectedIndex:function(n){if(this._isAnimating){var t=this;setTimeout(function(){t.set_selectedIndex(n)},50);return}n!=this._selectedIndex&&(this._previousIndex=this._selectedIndex,this._selectedIndex=n,this.updateUI())},get_selectedChild:function(){return this._selectedChild},onUpdateUI:function(){var y=this._element,b=new c(y),p=this.get_selectedIndex(),s=this._previousIndex,k=u.dispatcher,e,d,n,o,h,l,r,g,t,w,v;for(k.pause(),e=-1,d=this;b.next();)e=e+1,h=b.current(),l=i(h),l.addClass("view-stack-child"),s==-1&&l.addClass("hidden"),e==p?n=h:e==s?o=h:l.addClass("hidden");if(n)if(r=i(y).innerWidth(),g=i(y).innerHeight(),this._selectedChild=n,t=i(n),f.setItemRect(t,n,{width:r,height:g}),w=n.atomControl,w&&w.updateUI(),o&&o!=n){var d=this,a=i(o),nt=this._swipeDirection;nt!=null&&/none/i.test(nt)?(a.addClass("hidden"),t.removeClass("hidden")):(v=[n,o],i(v).removeClass("hidden"),this._isAnimating=!0,p<s?t.css("left",-r):t.css("left",r),i(v).addClass("animate-left-property"),setTimeout(function(){t.css("left",0);p<s?a.css("left",r):a.css("left",-r);setTimeout(function(){d._isAnimating=!1;i(v).removeClass("animate-left-property");a.addClass("hidden")},800)},50))}else t.removeClass("hidden");k.start()},init:function(){var r=this.get_element(),t=i(r);t.addClass("atom-view-stack");n.init.call(this);r.parentNode.atomControl||t.addClass("atom-view-stack-fill");t.addClass(this._swipeDirection)}}})}(u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomForm",base:n,start:function(){this._success=null;this._submit=null;this._errors=null;this._attachments=null},properties:{method:"POST",result:null,errorNext:null,mergeData:null,mergeResult:!0,postUrl:null,postData:null,successMessage:null,clearData:!1,errorTemplate:null},methods:{createFormLayout:function(){},preparePostData:function(){var r=this.get_element(),i=this._postData||this.get_data(),n=this._mergeData,t;if(n)for(t in n)i[t]=n[t];return i},onSubmit:function(){var n,f,u,e;if(this.validate(),n=this.get_errors(),n.length){f=h.getElementsByTagName("label");this.invokeAction({localWindow:{path:this.getTemplate("errorTemplate"),prop:{data:n.map(function(n){var t=r.query(f).firstOrDefault({control:n.value});return t&&(n.label=i(t).text()+" ("+n.label+")"),n}),title:"Form Errors"}}});return}var o=this.preparePostData(),c=s.getUrl(this._postUrl),t=s.json(c,{_tv:r.time()},{type:this.get_method(),data:o});t.then(this._success);u=this._errorNext;u&&(e=this,t.failed(function(){e.invokeAction(u)}));t.invoke()},onSuccess:function(n){var u=n.value(),f,i;if(t.setValue(this,"result",u),this._mergeResult){f=this.get_data();for(i in u)t.setValue(f,i,u[i])}if(this._clearData){f=this.get_data();for(i in this._clearData)t.setValue(f,i,u[i])}this._successMessage&&r.alert(this._successMessage);this.invokeAction(this._next)},onKeyUp:function(n){if((!n.target||!n.target.nodeName||!/textarea/gi.test(n.target.nodeName))&&n.keyCode==13){var t=this;/input/gi.test(n.target.nodeName)&&i(n.target).change();u.dispatcher.callLater(function(){t.onSubmit()})}},init:function(){var t,r;n.init.call(this);t=this;this._success=function(){t.onSuccess.apply(t,arguments)};this._submit=function(){u.dispatcher.callLater(function(){t.onSubmit.apply(t,arguments)})};r=this.get_element();this.submitCommand=this._submit;/form/i.test(this._element.nodeName)?this.bindEvent(r,"submit",function(n){return n&&n.preventDefault(),t.submitCommand(),!1}):(this.bindEvent(r,"keyup","onKeyUp"),i(r).find("input[type=submit]").bind("click",null,this._submit),i(r).find("button[type=submit]").bind("click",null,this._submit))}}})}(u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomFormLayout",base:n,start:function(){this._useTable=!0;this._errorItems=[];this._minLabelWidth=0},properties:{minLabelWidth:0},methods:{createField:function(n,t){var l=!1,r=f.attributeMap(t,/^(atom\-(init|type|label|field\-(visible|class)))$/i),s=r["atom-type"],i,e,h,a,o,v;if(s){r["atom-type"]=null;switch(s.value){case"AtomFormField":l=!0;break;case"AtomFormGridLayout":case"AtomFormTab":return n.appendChild(t),f.createControl(t,s.value)}}if(i=f.cloneNode(this._fieldTemplate),e=f.findPresenter(i),e){if(l)for(h=new c(t);h.next();)e.appendChild(h.current());else e.appendChild(t);f.removeAttr(e,"atom-presenter")}else i.contentElement=t;n.appendChild(i);for(a in r)(o=r[a],o)&&(t.removeAttributeNode(o.node),i.setAttributeNode(o.node));return r=f.attributeMap(t,/^atom\-required$/i),v=f.assignID(t),f.attr(i,"atom-field-id",v),r["atom-required"]&&f.attr(i,"atom-required","true"),f.createControl(i,u.AtomFieldType)},createChildren:function(){var n=this._element,r,t,u,o;for(i(n).addClass("atom-form"),r=new e(i(n).children()),t=h.createElement("TABLE"),i(t).addClass("atom-form-table"),u=h.createElement("TBODY"),f.removeAllChildren(n),n.appendChild(t),t.appendChild(u),this.getTemplate("fieldTemplate");r.next();)(o=r.current(),o)&&this.createField(u,o)}}})}(u.AtomControl.prototype),function(){return classCreatorEx({name:"WebAtoms.AtomLayout",start:function(){},methods:{doLayout:function(){}}})}(),function(n){return classCreatorEx({name:"WebAtoms.AtomWindow",base:n,start:function(){this._presenters=["windowDiv","windowTitleDiv","windowCloseButton","iframe","windowPlaceholder"]},properties:{opener:null,openerData:null,windowTemplate:null,isOpen:!1,windowHeight:300,windowWidth:500,url:undefined,title:undefined,windowUrl:undefined,cancelNext:undefined},methods:{get_openerData:function(){var n=this.get_opener();if(n)return n.get_data()},onCloseCommand:function(){t.setValue(this,"isOpen",!1);var i=this._value,n=this;this._value=null;u.dispatcher.callLater(function(){t.setValue(n,"value",i);n.invokeAction(n._next);n.disposeChildren(n._element)})},onCancelCommand:function(){t.setValue(this,"isOpen",!1);var n=this;u.dispatcher.callLater(function(){n.invokeAction(n._cancelNext);n.disposeChildren(n._element)})},refresh:function(n,t){this.openWindow(n,t)},openWindow:function(n,r){var s=this.getTemplate("frameTemplate"),h,o,c;s=f.cloneNode(s);var a=i(s),l=a.find("[data-atom-presenter=windowDiv],[atom-presenter=windowDiv]").get(0),v=a.find("[data-atom-presenter=windowTitleDiv],[atom-presenter=windowTitleDiv]").get(0),e=this.getTemplate("windowTemplate");if(i(e).addClass("atom-window-template"),f.attr(e,"atom-dock")||f.attr(e,"atom-dock","Fill"),e.length)for(h=0;h<e.length;h++)l.appendChild(e[h]);else l.appendChild(e);o=this.getTemplate("commandTemplate");o&&(f.attr(o,"atom-dock","Bottom"),o.setAttribute("class","atom-wizard-command-bar"),l.appendChild(o));this.set_innerTemplate(s);this._iframe&&(this._iframe.atomWindow=this);r&&(this._opener=r,t.refreshValue(this,"opener"),t.refreshValue(this,"openerData"));c=this;u.dispatcher.callLater(function(){var n,r;if(t.setValue(c,"isOpen",!0),!c._url&&(n=i(c._windowPlaceholder).find("input"),n.length>0)){r=n.get(0);try{r.focus()}catch(u){}}})},init:function(){i(this._element).addClass("atom-window-placeholder");n.init.call(this);var t=this;this.closeCommand=function(){t.onCloseCommand.apply(t,arguments)};this.cancelCommand=function(){t.onCancelCommand.apply(t,arguments)};this.openCommand=function(){t.openWindow.apply(t,arguments)};u.dispatcher.callLater(function(){var n=t._element;n._logicalParent||(n._logicalParent=n.parentNode,i(n).remove(),h.body.appendChild(n))})}}})}(u.AtomControl.prototype);u.AtomWindow.openNewWindow=function(n){var c=h.createElement("DIV"),v=f.assignID(c),e,t,s,l,o,a;n.localScope&&c.setAttribute("data-atom-local-scope","true");c._logicalParent=n.opener;h.body.appendChild(c);e=f.createControl(c,u.AtomWindow);t=n.url;t.length!==undefined?(n.next=t[1],n.url=t[0],t=new AtomUri(n.url)):(t={path:t.path,query:t.prop,hash:t.scope},n.url.next&&(n.next=n.url.next));e._next=[n.next||{},function(){u.dispatcher.callLater(function(){e.dispose();i(c).remove()})}];s=t.path;f.isNode(s)||(s=r.get(n.scope,t.path),s||(s=r.get(appScope,t.path)));l=i(f.cloneNode(s));o=l.children("[atom-template=commandTemplate],[data-atom-template=commandTemplate]").get(0);o&&(f.removeAttr(o,"atom-template"),e._commandTemplate=o,i(o).remove());o=l.children("[atom-template=windowTemplate],[data-atom-template=windowTemplate]").get(0);o?(f.removeAttr(o,"atom-template"),e._windowTemplate=o):(f.removeAttr(s,"atom-template"),e._windowTemplate=s);n.localScope&&n.opener&&(a=n.opener.get_data(),e._data=a);e.init();u.dispatcher.callLater(function(){var o=e.get_scope(),f=t.hash,u;for(var i in f)f.hasOwnProperty(i)&&r.set(o,i,f[i]);u=t.query;for(i in u)u.hasOwnProperty(i)&&r.set(e,i,u[i]);e.openWindow(n.scope,n.opener)})},function(n){return classCreatorEx({name:"WebAtoms.AtomCalendar",base:n,start:function(n){i(n).addClass("atom-calendar");var t=new Date;this._month=t.getMonth()+1;this._year=t.getFullYear();this._startYear=-5;this._endYear=10;this._currentYear=(new Date).getFullYear();this._value=null},properties:{month:0,year:0,startYear:-5,endYear:0,currentYear:0,visibleDate:undefined},methods:{set_month:function(n){this._month=n;this.updateCalendar()},set_year:function(n){this._year=n;this.updateCalendar()},set_visibleDate:function(n){n&&n!=this._visibleDate&&(this._visibleDate=n,this._year=n.getFullYear(),this._month=n.getMonth()+1,this.updateCalendar(),t.refreshValue(this,"year"),t.refreshValue(this,"month"))},onCreated:function(){n.onCreated.call(this);var t=this;u.dispatcher.callLater(function(){t.updateCalendar()})},applyItemStyle:function(){},updateCalendar:function(){var r;if(this._created){var e=new Date,v=new Date(this._year,this._month-1,1),i=new Date(this._year,this._month-1,1);i.getDay()&&(r=i.getDay()-1,r=-r,i.setDate(r));for(var s=i.getMonth(),h=i.getFullYear(),o=[],u=0,c=this._month-1,u=0;u<42;u++){var l=u+i.getDate(),n=new Date(h,s,l),f=n.getDay();f=f==0||f==6;o.push({label:n.getDate(),isWeekEnd:f,isToday:e.getDate()==n.getDate()&&e.getMonth()==n.getMonth()&&e.getFullYear()==n.getFullYear(),isOtherMonth:n.getMonth()!=c,dateLabel:a.toShortDateString(n),value:a.toMMDDYY(n),date:n})}t.setValue(this,"items",o)}},changeMonth:function(n){var i=this._month;i+=n;i>12&&(i=1,r.set(this,"year",this._year+1));i==0&&(r.set(this,"year",this._year-1),i=12);t.setValue(this,"month",i)},init:function(){n.init.call(this);var t=this;this.nextMonthCommand=function(){t.changeMonth(1)};this.prevMonthCommand=function(){t.changeMonth(-1)}}}})}(u.AtomListBox.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomCheckBoxList",base:n,start:function(){this._allowMultipleSelection=!0;this._valueSeparator=", ";this._dataElements=[]},methods:{init:function(){n.init.call(this);i(this._element).addClass("atom-check-box-list")}}})}(u.AtomItemsControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomDataPager",base:n,properties:{itemsPath:"items",totalPath:"total",pageSize:25,currentPage:0,items:null,total:0,pages:[]},start:function(){this._presenters=["pageList"];var n=this,i=t;this.goFirstCommand=function(){i.setValue(n,"currentPage",0)};this.goLastCommand=function(){i.setValue(n,"currentPage",n._pages.length-1)};this.goNextCommand=function(){i.setValue(n,"currentPage",n.get_currentPage()+1)};this.goPrevCommand=function(){i.setValue(n,"currentPage",n.get_currentPage()-1)}},methods:{preparePages:function(){var f,i,n;if(this._items&&this._total&&this._pageSize){var e=this._items.length,u=this._total,r=Math.ceil(u/this._pageSize);if(r!=this._pages.length){for(f=this._pageSize,i=[],n=0;n<r;n++)i.push({value:n,label:n+1});t.setValue(this,"pages",i)}}},set_items:function(n){if((n!=this._items&&this._items&&this.unbindEvent(this._items,"CollectionChanged","onCollectionChangedInternal"),n)&&(this._items=n,n!=null&&this._created)){this.bindEvent(this._items,"CollectionChanged","onCollectionChangedInternal");this.onCollectionChangedInternal("refresh",-1,null)}},onCollectionChangedInternal:function(){var n=this._items,i;n.length===undefined?(i=n[this._itemsPath],t.setValue(this,"total",n[this._totalPath]),t.setValue(this,"value",i)):(n.total&&t.setValue(this,"total",n.total),t.setValue(this,"value",n));this.preparePages()},onCreated:function(){if(this._items){this.bindEvent(this._items,"CollectionChanged","onCollectionChangedInternal");this.onCollectionChangedInternal("refresh",-1,null)}},set_currentPage:function(n){this._currentPage=n;t.refreshValue(this,"pageStart")},get_pageStart:function(){return this._currentPage*this._pageSize},set_pageSize:function(n){this._pageSize=n;this.preparePages()},set_total:function(n){this._total!=n&&(this._total=n)},init:function(){i(this._element).addClass("atom-data-pager");n.init.apply(this,arguments)}}})}(u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomDateControl",base:n,start:function(){},properties:{startYear:-1,endYear:10},methods:{resetYears:function(){var i=this._year,t=new Date,f=t.getFullYear(),e,r,u,n;for(f+=this._startYear,e=t.getFullYear()+this._endYear,r=this._value,r||(r=t),i.options.length=0,u=1,i.options[0]=new Option("Select","",!1,!1),t=(this._value||new Date).getFullYear(),n=f;n<=e;n++)i.options[u]=new Option(n,n,!1,t==n),u++},set_value:function(n){n&&n.constructor==String&&(n=new Date(parseInt(n.substr(6))));this._value=n;this.setDate()},setDate:function(){if(this._value){var n=this._value,t=n.getMonth()+1,i=n.getDate(),r=n.getFullYear();this.setComboValue(this._month,t);this.setComboValue(this._year,r);this.setComboValue(this._date,i)}},setComboValue:function(n,t){for(var i=new e(n.options);i.next();)if(i.current().value==t){n.selectedIndex=i.currentIndex();break}},set_startYear:function(n){this._startYear=n;this.resetYears()},set_endYear:function(n){this._endYear=n;this.resetYears()},onDataChange:function(){var n=i(this._year).val(),u=i(this._month).val(),f=i(this._date).val(),e;try{n&&u&&f?(e=new Date(n,u-1,f,9,0,0),this._value=e):this._value=null}catch(o){r.alert(o)}t.refreshValue(this,"value")},setMonths:function(){var u=a.monthList,i=this._month.options,n,r;for(i.length=0,n=new e(u),i[0]=new Option("Select","",!1,!1);n.next();)r=n.current(),i[n.currentIndex()+1]=new Option(r.label,r.value,!1,!1);this.setDate();t.refreshValue(this,"value")},init:function(){var i=this._element,r,t;for(this._date=h.createElement("SELECT"),this._month=h.createElement("SELECT"),this._year=h.createElement("SELECT"),i.style.height="25px",i.appendChild(this._date),i.appendChild(this._month),i.appendChild(this._year),r=this._date.options,r[0]=new Option("Select","",!1,!1),t=1;t<32;t++)r[t]=new Option(t,t,!1,!1);this.resetYears();this.bindEvent(this._date,"change","onDataChange");this.bindEvent(this._month,"change","onDataChange");this.bindEvent(this._year,"change","onDataChange");this.setMonths();n.init.apply(this,arguments)}}})}(u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomDateField",base:n,start:function(n){this._presenters=["calendarPresenter","itemsPresenter"];i(n).addClass("atom-date-field")},properties:{isOpen:!1,time:"9:00 AM"},methods:{get_offsetLeft:function(){return i(this._element).offset().left},get_offsetTop:function(){return i(this._element).offset().top},onPopupRemoved:function(){t.setValue(this,"isOpen",!1)},set_isOpen:function(n){if(this._isOpen=n,n){this.getTemplate("popupTemplate");this.popup=f.cloneNode(this._popupTemplate);this.popup._logicalParent=this._element;this.popup._templateParent=this;h.body.appendChild(this.popup);this.onCreateChildren(this.popup);this.setProperties(this.popup);this.initChildren(this.popup);var u=this;this._refreshInterval=setInterval(function(){t.refreshValue(u,"offsetLeft");t.refreshValue(u,"offsetTop")});nt.show(this._element,this.popup,-1,function(){r.set(u,"isOpen",!1)})}else this._refreshInterval&&clearInterval(this._refreshInterval),this.popup&&(this.disposeChildren(this.popup),i(this.popup).remove(),this.popup=null)},dispose:function(){this.set_isOpen(!1);n.dispose.call(this)},get_isOpen:function(){return this._isOpen},get_selectedItem:function(){return this._selectedItems.length?this._selectedItems[0]:null},set_time:function(n){if(!this._set_timeCalled){if(this._set_timeCalled=!0,n){this._time=n;var i=a.setTime(this.get_value(),n);t.setValue(this,"value",i)}this._set_timeCalled=!1}},set_value:function(n){n=a.parse(n);this._value=n;t.setValue(this,"time",a.toTimeString(n));this._selectedItems.length=0;n&&(this._selectedItems.push({date:n,dateLabel:a.toShortDateString(n),value:a.toMMDDYY(n),label:n.getDate()}),this.set_visibleDate(n));this._created&&(t.refreshItems(this._selectedItems),t.refreshValue(this,"value"),t.refreshValue(this,"selectedItem"),t.refreshValue(this,"selectedItems"))},get_value:function(){return this._selectedItems.length?this._selectedItems[0].date:this._value},toggleDate:function(n,i){var r=i.get_data();this._selectedItems.length=0;t.addItem(this._selectedItems,r);t.refreshValue(this,"value");t.refreshValue(this,"selectedItem");t.refreshValue(this,"selectedItems");t.setValue(this,"isOpen",!1)}}})}(u.AtomDateListBox.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomDeleteButton",base:n,start:function(){this._confirm=!0;this._confirmMessage="Are you sure you want to delete this item?"},methods:{},properties:{}})}(u.AtomPostButton.prototype),function(n){return createClass({name:"WebAtoms.AtomFrameView",base:n,start:function(n){var t=this;i(n).addClass("atom-frame-view");this._items=[];this._layout=u.AtomViewBoxLayout.defaultInstance;this.backCommand=function(){t.onBackCommand.apply(t,arguments)}},properties:{url:"",replaceUrl:"",layout:null,items:[],removeOnBack:!0},methods:{set_replaceUrl:function(n){var i=new e(this._items),t;for(this.set_url(n);i.next();)t=i.current(),t.url!=n&&this.replaceItemWithUrl(t)},set_url:function(n){var o,i,a,t,l;if(n){if(/replace\:/.test(n)){this.set_replaceUrl(n.substr(8));this._url=n;return}var s=n.indexOf("?"),e=n,h="",c=this;if(s!==-1&&(e=n.substr(0,s),h=n.substr(s+1)),o=this._items,i=r.query(o).firstOrDefault({url:e}),i)r.set(this,"selectedIndex",i.index),this.updateUI();else{if(a=r.get(this,"scope"),t=a[e],!t){console&&console.error&&console.error("Page Template "+t+" not found");return}t=f.cloneNode(t);t._logicalParent=this._element;i={url:e,index:o.length,opener:this._url,element:t};r.add(o,i);l=f.createControl(t,f.getAtomType(t)||u.AtomControl);i.control=l;u.dispatcher.callLater(function(){l.init();c._element.appendChild(t);r.set(c,"selectedIndex",i.index);c.updateUI()})}h&&this.invokeAction({appScope:f.parseUrl(h)});this._url=n}},replaceItemWithUrl:function(n,t){if(t&&this.set_url(t),n){var i=this;setTimeout(function(){i.removeItem(n)},1e3)}},removeItem:function(n){r.remove(this._items,n);n.control.dispose();i(n.element).remove();for(var t=new e(this._items);t.next();)n=t.current(),n.index=t.currentIndex()},onBackCommand:function(){var n=this._selectedIndex,t,i;n&&(t=r.query(this._items).firstOrDefault({index:n}),t&&(i=this,n=n-1,r.set(this,"selectedIndex",n),i._removeOnBack&&this.replaceItemWithUrl(t,t.opener)))},init:function(){n.init.call(this);var i=this,t=this._url;t&&u.dispatcher.callLater(function(){i.set_url(t)})}}})}(u.AtomViewStack.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomLinkBar",base:n,start:function(){this._allowSelectFirst=!1;var n=this;this.openMenuCommand=function(){n.openMenu.apply(n,arguments)}},properties:{itemsPath:"items",selectCurrent:!0,targetPath:"",menuTemplate:null,menuDirection:"horizontal"},methods:{setClass:function(){var n=i(this._element);n.removeClass("atom-tab-bar atom-link-bar");n.addClass(this._showTabs?"atom-tab-bar":"atom-link-bar")},set_menuDirection:function(n){var t=i(this._element);t.removeClass("vertical horizontal");t.addClass(n);this._menuDirection=n},onClick:function(){},openMenu:function(n){var s=n.target,o=this.get_atomParent(s),e,i,r;o!=null&&(e=o.get_data(),e[this._itemsPath])&&(i=this._subMenu,i?nt.hide(i._element):(r=this.getTemplate("menuTemplate"),i=f.cloneNode(r),i._templateParent=this,i.style.position="absolute",h.body.appendChild(i),r=f.getAtomType(r)||u.AtomControl,i=f.createControl(i,r,e),this._subMenu=i),t.setValue(i,"data",e),nt.show(o._element,i._element,0),f.cancelEvent(n))},selectDefault:function(){this._items&&this._selectCurrent&&(this._value||(t.setValue(this,"value",location.pathname),this.get_selectedIndex()==-1&&this.selectItem(this._items),this.updateSelectionBindings()))},selectItem:function(n,i){for(var f=new e(n),o=this._valuePath,s=location.pathname.toLowerCase(),r,u;f.next();)if(r=f.current(),u=r,o&&(u=u[o]),u){if(s==u.toLowerCase())return i||t.setValue(this,"selectedItem",r),!0;if(r.links&&this.selectItem(r.links,!0))return t.setValue(this,"selectedItem",r),!0}return!1},dispose:function(){this._subMenu&&(this._subMenu.dispose(),this._subMenu=null);n.dispose.apply(this,arguments)},init:function(){n.init.apply(this,arguments);this.bindEvent(this._element,"click","openMenuCommand");this.set_menuDirection("horizontal")}}})}(u.AtomToggleButtonBar.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomMultiButtonList",base:n,start:function(){this._dataElements=[]},properties:{labelPath:"label",valuePath:"value",options:null,isRadio:!1,items:null},methods:{set_options:function(n){if(this._options=n,n)this.onCollectionChangedInternal("refresh",-1,null)},set_value:function(n){this._value=n;this.updateSelections()},set_items:function(n){if(this._items&&this.unbindEvent(this._items,"CollectionChanged","onCollectionChangedInternal"),this._items=n,n!=null){this.bindEvent(this._items,"CollectionChanged","onCollectionChangedInternal");this.onCollectionChangedInternal("refresh",-1,null)}},onCollectionChangedInternal:function(n,t,i){var r=this.get_value();this.onCollectionChanged(n,t,i);this.set_value(r)},onCollectionChanged:function(){var n,t,i;if(this._items&&this._options){for(this._dataElements=[],this.unbindEvent(null,"change","onDataChange"),n=new e(this._items),t=this.get_scope();n.next();)i=n.current(),this.createChildElement(t,this._element,i);this.updateUI()}},updateSelections:function(){var f,r,n,t,o,u;if(this._dataElements&&this._dataElements.length!=0){for(n=new e(this._dataElements);n.next();)f=n.current(),f.checked=!1;if(this._value)for(o=this._value.split(","),n.reset();n.next();)for(u=n.current(),r=new e(o);r.next();)t=r.current(),t=i.trim(t),u.value==t&&(u.checked=!0)}},onDataChange:function(){for(var r=new e(this._dataElements),u=[],n,f;r.next();)n=r.current(),f=i(n).val(),n.checked&&u.push(f);this._value=u.join(", ");t.refreshValue(this,"value")},createChildElement:function(n,t,r){var u=h.createElement("SPAN"),a,s,y,p,c,w,o,b;for(t.appendChild(u),t=u,u=h.createElement("SPAN"),a=this.get_labelPath(),s=this.get_valuePath(),l=r,v=r,a&&(l=r[a]),s&&(v=r[s]),y=null,this._isRadio&&(y="_g"+f.getNewIndex()),t.appendChild(u),p=new e(this._options);p.next();)c=p.current(),s&&(c=c[s]),w=v+"."+c,o=h.createElement("INPUT"),this._isRadio?(f.attr(o,"type","radio"),f.attr(o,"name",y)):f.attr(o,"type","checkbox"),i(o).val(w),u.appendChild(o),this.bindEvent(o,"change","onDataChange"),this._dataElements.push(o);u=h.createElement("SPAN");t.appendChild(u);b=h.createTextNode(l);u.appendChild(b)}}})}(u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomNavigatorList",base:n,start:function(){this._displayMode=0;this._presenters=["gridPanel","gridPresenter","itemsPresenter","detailHeaderPresenter","newHeaderPresenter","detailPresenter","newPresenter","newView","detailView","newHeaderToolbar","detailHeaderToolbar"];this._layout=new u.AtomViewBoxLayout;this._newItem={}},properties:{autoShowDetail:!0,currentPage:null,pageSize:undefined,newItem:null,newUrl:null,detailUrl:null,displayMode:null},methods:{get_newItemCopy:function(){return this._newItemCopy},onBackCommand:function(){t.setValue(this,"displayMode",0);this.updateDisplayMode();t.setValue(this,"selectedIndex",-1)},onCancelAddNewCommand:function(){this.onBackCommand();t.refreshValue(this,"newItemCopy");this.refresh()},onAddCommand:function(){t.setValue(this,"selectedIndex",-1);t.setValue(this,"displayMode",2);var n=this._newItem||{};this._newItemCopy=t.getClone(n);t.refreshValue(this,"newItemCopy");this.updateDisplayMode()},onSelectedItemsChanged:function(){n.onSelectedItemsChanged.apply(this,arguments);this._autoShowDetail&&this.showDetailCommand()},addTemplate:function(n,t,i){if(i){n.appendChild(t);t._templateParent=this;this.onCreateChildren(n);this.initChildren(n)}else{n.appendChild(t);t._templateParent=this;this.onCreateChildren(n)}},updateDisplayMode:function(){var e=this._displayMode;if(e==0){this._detailPresenter&&(this._detailView.atomControl.dispose(this._detailPresenter),this._detailPresenter=null);this._newPresenter&&(this._newView.atomControl.dispose(this._newPresenter),this._newPresenter=null);this._detailHeaderPresenter&&(this._detailView.atomControl.dispose(this._detailHeaderPresenter),this._detailHeaderPresenter=null);this._newHeaderPresenter&&(this._newView.atomControl.dispose(this._newHeaderPresenter),this._newHeaderPresenter=null);return}var i=null,t=this.getTemplate("detailTemplate"),r=null,n,u="";e==1?(i=this._detailView,r=this._detailHeaderToolbar,n=this.getTemplate("detailHeaderTemplate"),u="_detail"):(i=this._newView,r=this._newHeaderToolbar,n=this.getTemplate("newHeaderTemplate"),u="_new");r&&n&&(n=f.cloneNode(n),this.addTemplate(r,n,!0),this[u+"HeaderPresenter"]=n);i&&t&&(t=f.cloneNode(t),this.addTemplate(i,t,!0),this[u+"Presenter"]=t)},createChildren:function(){var u,o,e,t,r;n.createChildren.call(this);this.getTemplate("gridTemplate");this.getTemplate("detailTemplate");this.getTemplate("searchTemplate");this.getTemplate("detailHeaderTemplate");this.getTemplate("newHeaderTemplate");this.getTemplate("headerTemplate");this.getTemplate("footerTemplate");u=this.get_scope();this._newView.atomControl._scope=new g(this,u);this._detailView.atomControl._scope=new g(this,u);o=f.cloneNode(this._gridTemplate);this.addTemplate(this._gridPresenter,o);e=this._detailTemplate;f.attr(e,"atom-dock")||f.attr(e,"atom-dock","Fill");this._headerTemplate&&(t=f.cloneNode(this._headerTemplate),t.setAttribute("atom-dock","Top"),i(t).addClass("atom-navigator-list-header"),t._templateParent=this,this.addTemplate(this._gridPanel,t));this._footerTemplate&&(r=f.cloneNode(this._footerTemplate),r.setAttribute("atom-dock","Bottom"),i(r).addClass("atom-navigator-list-footer"),this.addTemplate(this._gridPanel,r))},init:function(){n.init.call(this);var i=this;this.backCommand=function(){i.onBackCommand.apply(i,arguments)};this.addCommand=function(){i.onAddCommand.apply(i,arguments)};this.cancelAddCommand=function(){i.onCancelAddNewCommand.apply(i,arguments)};this.showDetailCommand=function(){var n=i.get_selectedItem();n&&(t.setValue(i,"displayMode",1),i.updateDisplayMode())}}}})}(u.AtomListBox.prototype),function(t){var i=n.AtomUI;return classCreatorEx({name:"WebAtoms.AtomNumberComboBox",base:t,start:function(){},properties:{showPrompt:!1,startNumber:undefined,endNumber:undefined,step:1},methods:{set_startNumber:function(n){this._startNumber=n;this.resetNumbers()},set_endNumber:function(n){this._endNumber=n;this.resetNumbers()},set_step:function(n){n&&(this._step=n,this.resetNumbers())},onLoaded:function(){this.resetNumbers()},resetNumbers:function(){if(this._created&&this._startNumber!==undefined&&this._endNumber!==undefined){var n=i.toNumber(this._startNumber),r=i.toNumber(this._endNumber),u=i.toNumber(this._step),t=[];for(this._showPrompt&&t.push({label:"Select",value:0});n<=r;n+=u)t.push({label:n,value:n});this.set_items(t)}}}})}(u.AtomComboBox.prototype),function(i){var f=n.document,r=n.$;return classCreatorEx({name:"WebAtoms.AtomPhoneControl",base:i,start:function(){this._value=""},properties:{countries:[{label:"(US +1)",code:1,country:"US",format:"999-999-9999"},{label:"(CA +1)",code:1,country:"CA",format:"999-999-9999"},{label:"(IN +91)",code:91,country:"IN",format:"99-99-999999"},{label:"(UK +44)",code:44,country:"UK",format:"999-999-9999"},]},methods:{set_value:function(n){this._value=n;this._countries&&this.setupValues()},set_required:function(n){if(!this.num){var t=this;u.dispatcher.callLater(function(){t.set_required(n)});return}this._required=n;n?b.required.call(this,this.num,!0):b.required.call(this,this.num,!1)},get_required:function(){return this._required},setupValues:function(){var u,t;if(!this._value){r(this.num).val("");r(this.ext).val("");r(this.msg).val("");return}for(var n=this._value.split(":",6),f=n[1],i=new e(this._countries);i.next();)if(u=i.current(),u.country==f){this.cs.selectedIndex=i.currentIndex();break}t=(n[3]||"").split(".").join("-");t=="--"&&(t="");r(this.num).val(t);r(this.ext).val(n[4]);r(this.msg).val(n[5]);this.onFormat()},onDataChange:function(){var n="v2:",f=this.cs.selectedIndex,u=this._countries[f],i;n+=u.country+":"+u.code;i=r(this.num).val().split("-").join(".");n+=":"+i;n+=":"+r(this.ext).val();n+=":"+r(this.msg).val();this._value=i?n:"";t.refreshValue(this,"value")},set_countries:function(n){this._countries=n;this.onFormat()},onCountryChange:function(){this.onDataChange();this.onFormat()},onFormat:function(){var i,u,o,t,f,n;if(!this._isFormatting){for(this._isFormatting=!0,i=this._countries,u=this.cs.options,u.length=i.length,o=this.cs.selectedIndex,t=new e(i);t.next();)n=t.current(),n.valueIndex||(n.label=n.label,n.valueIndex=t.currentIndex()),u[t.currentIndex()]=new Option(n.label,n.valueIndex,!1,!1);(this.setupValues(),this.cs.selectedIndex=o,f=this.cs,f.selectedIndex!=-1)&&(n=this._countries[f.selectedIndex],n.format?r(this.num).mask(n.format):r(this.num).unmask(),this._isFormatting=!1)}},init:function(){var n,t,e;this.cs=f.createElement("SELECT");this.num=f.createElement("INPUT");this.num.type="text";this.ext=f.createElement("INPUT");this.ext.type="text";r(this.ext).attr("placeholder","Ext.");this.msg=f.createElement("INPUT");this.msg.type="text";r(this.msg).attr("placeholder","Message");n=this.get_element();n.appendChild(this.cs);n.appendChild(this.num);n.appendChild(this.ext);n.appendChild(this.msg);t=this;this.onKeyUpLater=function(n){var i=n;t.onDataChange(i)};this.bindEvent(this.cs,"change","onCountryChange");this.bindEvent(this.num,"change","onDataChange");this.bindEvent(this.num,"keyup","onKeyUpLater");this.bindEvent(this.num,"keypress","onKeyUpLater");this.bindEvent(this.ext,"change","onDataChange");this.bindEvent(this.msg,"change","onDataChange");r(this._element).addClass("atom-phone-control");r(this.num).addClass("atom-pc-num");r(this.msg).addClass("atom-pc-msg");r(this.cs).addClass("atom-pc-cs");r(this.ext).addClass("atom-pc-ext");i.init.call(this);e=this;u.dispatcher.callLater(function(){e.onFormat()})}}})}(u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomRadioButtonList",base:n,start:function(){this._allowMultipleSelection=!1},properties:{groupName:""},methods:{init:function(){this._groupName="__g"+f.getNewIndex();n.init.call(this)}}})}(u.AtomItemsControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomSortableColumn",base:n,start:function(){},properties:{direction:"",defaultDirection:"",label:"",sortField:null},methods:{set_direction:function(n){this._direction=n;var t=i(this._element);t.removeClass("atom-sort-asc atom-sort-desc");n&&t.addClass("atom-sort-"+n.toLowerCase())},set_value:function(n){this._value=n;this.refreshUI()},refreshUI:function(){if(this._value){if(this._value.indexOf(this._sortField)==-1){t.setValue(this,"direction","");return}this._value.lastIndexOf("desc")!=this._value.length-4?t.setValue(this,"direction","asc"):t.setValue(this,"direction","desc")}},onClick:function(){this._direction?this._direction=="asc"?t.setValue(this,"direction","desc"):t.setValue(this,"direction","asc"):t.setValue(this,"direction",this._defaultDirection);t.setValue(this,"value",this._sortField+" "+this._direction)},init:function(){n.init.call(this);this.bindEvent(this._element,"click","onClick");i(this._element).addClass("atom-column")},onUpdateUI:function(){this.refreshUI()}}})}(u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomTabButtonBar",base:n,start:function(){this._allowMultipleSelection=!1;this._showTabs=!0},methods:{}})}(u.AtomLinkBar.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomTabControl",base:n,start:function(){this._presenters=["itemsPresenter"];this._layout=u.AtomViewBoxLayout.defaultInstance;this.selectedIndex=0;this.labelPath="label"},properties:{items:null},methods:{createChildren:function(){var i,t,r,u;if(n.createChildren.call(this),this._itemsPresenter!=this._element){for(i=[],t=new c(this._element);t.next();)r=t.current(),this._element.removeChild(r),i.push(r);if(this._template){u=f.cloneNode(this._template);u._templateParent=this;this._element.appendChild(u);this.onCreateChildren(this._element)}for(t=new e(i);t.next();)this._itemsPresenter.appendChild(t.current());if(this._template)this.onCreateChildren(this._itemsPresenter)}}}})}(u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomTimePicker",base:n,start:function(){rt("AtomTimePicker is Depricated !!!, use AtomTimeEditor")},properties:{displayLabel:"9:00 AM"},methods:{init:function(){var r,t,u,f,i;for(this._autoOpen=!0,r=[],t=0;t<=23;t++)u="AM",f=t,t>11&&(u="PM",t>12&&(f=t-12)),i=f+":00 "+u,r.push({label:i,value:i}),i=f+":30 "+u,r.push({label:i,value:i});this._items=r;n.init.call(this)}}})}(u.AtomAutoCompleteBox.prototype);pt=function(n){this._self=n;this._updating=!1;this.update=function(n){if(!this._updating)try{this._updating=!0;n.apply(this._self)}finally{this._updating=!1}}},function(n){var u=/^([0-1]?[0-9]|2[0-3]):[0-5][0-9] [ap][m]$/i;return classCreatorEx({name:"WebAtoms.AtomTimeEditor",base:n,start:function(n){i(n).addClass("atom-time-editor");this._updater=new pt(this)},properties:{time:"10:00",ap:"AM",value:"10:00 AM"},methods:{get_hours24:function(){var t=this._time.split(":"),n=parseInt(t[0]||"0");return this._ap=="PM"&&n!=12&&(n+=12),n},set_hours24:function(n){this.setTime(n,this.get_minutes(),!0)},get_hours:function(){var n=this._time.split(":");return parseInt(n[0]||"0")},get_minutes:function(){var n=this._time.split(":");return parseInt(n[1]||"0")},setTime:function(n,i,r){var u=this.get_ap();r&&(n>12?(n-=12,u="PM"):u="AM");n=""+n;n.length==1&&(n="0"+n);i=i+"";i.length==1&&(i="0"+i);t.setValue(this,"value",n+":"+i+" "+u)},set_hours:function(n){this.setTime(n,this.get_minutes())},set_minutes:function(n){this.setTime(this.get_hours(),n)},set_value:function(n){this._updater.update(function(){if(this._value!=n){if(!u.test(n))throw new Error("Unknown time format, expecting ##:## AM");this._value=n;n=n.split(" ");this._time=n[0];this._ap=n[1].toUpperCase();this.refreshProperties()}})},refreshProperties:function(){r.refresh(this,"value");r.refresh(this,"time");r.refresh(this,"ap");r.refresh(this,"hours");r.refresh(this,"hours24");r.refresh(this,"minutes")},set_time:function(n){this.set_value(n+" "+this._ap)},set_ap:function(n){this.set_value(this._time+" "+n)},get_value:function(){return this._time+" "+this._ap}}})}(u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomUploadButton",base:n,start:function(n){if(/input/gi.test(n.nodeName)&&/file/gi.test(f.attr(n,"type"))){this._filePresenter=n;return}var t=this._filePresenter=h.createElement("input");f.attr(t,"type","file");i(t).css({left:"-500px",position:"absolute",top:"0"});h.body.appendChild(this._filePresenter)},properties:{fileTypes:undefined,accept:"*/*",capture:"",progress:0},methods:{set_accept:function(n){if(this._accept=n,n){var t=this._filePresenter;t&&f.attr(t,"accept",n)}},set_capture:function(n){if(this._capture=n,n){var t=this._filePresenter;t&&f.attr(t,"capture",n)}},onClickHandler:function(n){(!this._confirm||confirm(this._confirmMessage))&&this._postUrl&&this._filePresenter!=this._element&&(i(this._filePresenter).trigger("click"),f.cancelEvent(n))},onFileSelected:function(){var i=this.get_postData(),r,s,n,u,f,o;if(i!==null&&i!==undefined){if(r=this._mergeData,r)for(s in r)i[s]=r[s];if(n=this._xhr,!n){n=new XMLHttpRequest;u=n.upload;try{n.timeout=36e5}catch(h){}this.bindEvent(u,"progress","onProgress");this.bindEvent(u,"timeout","onError");this.bindEvent(u,"error","onError");this.bindEvent(n,"load","onComplete");this.bindEvent(n,"error","onError");this.bindEvent(n,"timeout","onError");this._xhr=n}for(f=new FormData,o=new e(this._filePresenter.files);o.next();)f.append("file"+o.currentIndex(),o.current());f.append("formModel",JSON.stringify(t.getClone(i)));n.open("POST",this._postUrl);n.send(f);atomApplication.setBusy(!0,"Uploading...")}},set_progress:function(n){this._progress=n;n&&t.setValue(atomApplication,"progress",n)},onError:function(n){atomApplication.setBusy(!1,"Uploading...");this.unbindEvent(this._xhr);this._xhr=null;this._lastError=n;r.alert("Upload failed")},onProgress:function(n){if(n.lengthComputable){var i=Math.round(n.loaded*100/n.total);t.setValue(this,"progress",i)}},onComplete:function(n){atomApplication.setBusy(!1,"Uploading...");if(n.target)if(n.target.status==200)this._value=n.target.responseText;else{r.alert(n.target.statusText);return}else this._value=n.result;this.unbindEvent(this._xhr);this._xhr=null;t.refreshValue(this,"value");this.invokeAction(this._next,n)},init:function(){n.init.call(this);var t=this._filePresenter;this.bindEvent(t,"change","onFileSelected")}}})}(u.AtomPostButton.prototype),function(n,t){return classCreatorEx({name:"WebAtoms.AtomViewBox",base:t,start:function(){this._layout=n.AtomViewBoxLayout.defaultInstance},methods:{}})}(u,u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomWizard",base:n,start:function(){this._presenters=["viewPresenter"]},properties:{currentStep:null,nextLabel:"Next",nextClass:"",buttons:null,prevLabel:"Back",finishLabel:"Finish",canMoveBack:!0,canMoveNext:!0,steps:0,isLastStep:!1},methods:{set_currentStep:function(n){var i,r;this._currentStep=n;i=this._buttons;i&&i.length&&(r=i[n],t.setValue(this,"nextLabel",r.label),t.setValue(this,"nextClass",r.styleClass));t.refreshValue(this,"isLastStep")},get_isLastStep:function(){return this._currentStep==this._steps-1},createWizard:function(){var e=this._viewPresenter,n,i,s,h;this.disposeChildren(e);for(var l=this._viewTemplate,r=0,o=new c(l);o.next();)r++,n=f.cloneNode(o.current()),e.appendChild(n),i=f.getAtomType(n),i||(i="AtomViewBox",f.attr(n,"data-atom-type",i)),s=f.getAtomType(n)||u.AtomControl,h=f.createControl(n,s),h.init();t.setValue(this,"steps",r);r&&t.setValue(this,"currentStep",0)},init:function(){i(this._element).addClass("atom-wizard");n.init.call(this);var r=this,u=this._viewPresenter;this.goNextCommand=function(n,i,u){r.get_isLastStep()?(r.invokeAction(r._next,u),t.setValue(r,"canMoveBack",!1)):t.setValue(r,"currentStep",r._currentStep+1)};this.goPrevCommand=function(){t.setValue(r,"currentStep",r._currentStep-1)};this.resetCommand=function(){r.createWizard();t.setValue(r,"currentStep",0);t.setValue(r,"canMoveBack",!0)};this.createWizard();this.nextCommand=function(n,t,i){var f=u.atomControl.get_selectedChild().atomControl;if(f._next){f.invokeAction(f._next);return}r.goNextCommand(n,t,i)}}}})}(u.AtomDockPanel.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomYesNoControl",base:n,start:function(){this._allowSelectFirst=!1;this._items=[{label:"Yes",value:!0},{label:"No",value:!1}]},methods:{}})}(u.AtomToggleButtonBar.prototype),function(r){return classCreatorEx({name:"WebAtoms.AtomYesNoCustom",base:r,start:function(){this._presenters=["yesNo","input"];this._hasValue=!1},properties:{hasValue:!1,placeholder:null},methods:{set_hasValue:function(n){this._hasValue=n;n||t.setValue(this,"value","")},set_value:function(n){this._value=n;t.setValue(this,"hasValue",n?!0:!1);this._onUIChanged||i(this._input).val(n)},onValueChange:function(){this._onUIChanged=!0;var n=i(this._input).val();t.setValue(this,"value",n);this._onUIChanged=!1},onUpdateUI:function(){if(i(this._input).addClass("atom-yes-no-custom-input"),this._placeholder){f.attr(this._input,"placeholder",this._placeholder);var t=n.placeHolderFixer;t&&t.refresh()}},init:function(){r.init.call(this);this._yesNo=this._yesNo.atomControl;var n=this._input;this.bindEvent(n,"change","onValueChange")}}})}(u.AtomControl.prototype);n.appScope=n.appScope||{};this.atomApplication=null,function(e){return classCreator("WebAtoms.AtomApplication",e,function(t){var o,u,r,s,e,h;if(i(t).removeClass("atom-dock-panel"),i(t).addClass("atom-application"),this._scope=new g(this,null,this),n.model&&(n.appScope.model=n.model,this._data=n.model),n.appScope){o=this._scope;r=n.appScope;for(e in r)o[e]=r[e]}if(n.appScope=this._scope,n.atomApplication=this,this.busyCount=0,u=location.hash,u=u?u.substr(1):u,u){r=f.parseUrl(u);this._hash=location.hash;s=this._scope;this._defaultHash=r;for(e in r)h=r[e],s[e]=h}else this._hash=location.hash;this._defaultScope={}},{get_title:function(){return h.title},set_title:function(n){h.title=n},get_isBusy:function(){return this.busyCount},setBusy:function(n,i){n?this.busyCount++:this.busyCount--;i!==undefined?(i||(i=""),t.setValue(this,"busyMessage",i)):t.setValue(this,"busyMessage","Loading...");t.refreshValue(this,"isBusy")},updateUI:function(){e.updateUI.call(this);t.refreshValue(this,"appWidth");t.refreshValue(this,"appHeight");t.refreshValue(this,"bodyWidth");t.refreshValue(this,"bodyHeight")},onUpdateUI:function(){this._renderAsPage||e.onUpdateUI.call(this)},get_appWidth:function(){return i(this._element).width()},get_appHeight:function(){return i(this._element).height()},get_bodyWidth:function(){return i(h.body).width()},get_bodyHeight:function(){return i(h.body).height()},onHashChanged:function(){var e,i,u,o,h,n,s;if(!this._noHashRefresh){if(e=this._scope,i=location.hash,i||(i="#"),this._noHashRefresh=!0,i=i.substr(1),u=f.parseUrl(i),this._created){o=this._defaultScope;for(n in o)h=o[n],u[n]===undefined&&(u[n]=h);for(n in u)s=u[n],e[n]!=s&&t.setValue(e,n,s)}else r.merge(e,u);this._noHashRefresh=!1}},invokeUpdateUI:function(){var i=this,t=this;n.setTimeout(function(){return t.updateUI()},5)},onRefreshValue:function(){var f,n,i,r;if(!this._noHashRefresh&&this._ready){var e=this._defaultScope,u=t.getClone(this._defaultHash||{}),o=this._scope;for(n in o)if(i=o[n],e.hasOwnProperty(n)){if(i==e[n])continue;u[n]=i}else{if(n.indexOf("_")==0)continue;if(i===undefined||i===null)continue;if(!/string|number|boolean/i.test(typeof i))continue;u[n]=i}f=[];for(n in u)i=u[n],f.push({key:n,value:i});(r="#"+f.map(function(n){return n.key+"="+encodeURIComponent(n.value)}).join("&"),r!=location.hash)&&(r!="#"||location.hash)&&(this._noHashRefresh=!0,history&&history.pushState?history.pushState({},h.title,location.href.split("#")[0]+r):location.href=r,this._noHashRefresh=!1)}},onInitialized:function(){var r,u;this._ready=!0;e.onInitialized.call(this);this._renderAsPage||i(this._element).addClass("atom-dock-application");w.isIE&&w.majorVersion<8?(r=this,setInterval(function(){r.onCheckHash()},1e3),this._lastHash=location.hash):(u=n.onhashchange?"onhashchange":"hashchange",this.bindEvent(n,u,"onHashChanged"));t.refreshValue(this,"appHeight");t.refreshValue(this,"bodyHeight")},createChildren:function(){if(e.createChildren.call(this),this.getTemplate("busyTemplate"),this._busyTemplate){this._element.appendChild(this._busyTemplate);this.onCreateChildren(this._busyTemplate)}},onCreated:function(){e.onCreated.call(this);this._next&&u.dispatcher.callLater(function(){n.atomApplication.invokeAction(n.atomApplication._next)})},onCheckHash:function(){this._lastHash!=location.hash&&(this.onHashChanged(),this._lastHash=location.hash)},onCloseCommand:function(){if(parent){var n=frameElement.atomWindow;n._value=this._value;n.onCloseCommand()}},setup:function(){this.createChildren();this.init()},init:function(){this.bindEvent(n,"resize","invokeUpdateUI");var t=this;this._onRefreshValue=bt(function(){t.onRefreshValue.apply(t,arguments)});this._scope._$_watcher=this;e.init.call(this);this.closeCommand=function(){t.onCloseCommand.apply(t,arguments)}}},{renderAsPage:!1,busyMessage:"",progress:0})}(u.AtomDockPanel.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomAutoPostForm",base:n,start:function(){},properties:{isBusy:!1,postError:null},methods:{pushPost:function(n){if(!this._isBusy){this._pushPostTimeout&&clearTimeout(this._pushPostTimeout);n||(n=1e3);var t=this;this._pushPostTimeout=setTimeout(function(){u.dispatcher.callLater(function(){t.onSubmit()})},n)}},onSubmit:function(){var r,u;if((this._pushPostTimeout=0,!this._isBusy)&&this.isValid()&&(r=this.preparePostData(),r)&&(u=JSON.stringify(t.getClone(r)),!this._cachedData||u!=this._cachedData)){this._cachedData=u;var n=this,f=s.getUrl(this._postUrl),i=s.json(f,null,{type:"POST",data:r}).then(n._success);i.failed(function(){n._isBusy=!1;n._postError=i.error.msg;t.refreshValue(n,"isBusy");t.refreshValue(n,"postError")});i.showProgress(!1);i.showError(!1);i.invoke()}},onCreated:function(){n.onCreated.apply(this,arguments);var i=this.preparePostData();i&&(this._cachedData=JSON.stringify(t.getClone(i)))},onSuccess:function(){n.onSuccess.apply(this,arguments);this._isBusy=!1;t.refreshValue(this,"isBusy")},onKeyUp:function(n){(this.pushPost(),n.target&&n.target.nodeName&&/textarea/gi.test(n.target.nodeName))||n.keyCode==13&&this.onSubmit()},init:function(){n.init.call(this);var t=this;this.pushPostHandler=function(){t.pushPost(1e3)};this.bindEvent(this._element,"click",this.pushPostHandler);i(this._element).find("input,select,textarea").bind("change",null,this.pushPostHandler)}}})}(u.AtomForm.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomFormField",base:n,start:function(){this._presenters=["contentPresenter"]},properties:{label:undefined,fieldId:undefined,fieldClass:undefined,required:!1,fieldVisible:!0},methods:{set_fieldVisible:function(n){this._fieldVisible=n;i(this._element).css("display",n?"":"none")},set_fieldClass:function(n){this._fieldClass=n;this.setLocalValue("class",n,this._element)},onCreated:function(){this.setup()},setup:function(){this._created&&(this._contentPresenter&&this._contentPresenter.appendChild(this._element.contentElement),t.refreshValue(this,"fieldClass"))}}})}(u.AtomControl.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomFormGridLayout",base:n,start:function(){},properties:{minLabelWidth:100,cellSpacing:5,label:""},methods:{onUpdateUI:function(){t.refreshValue(this,"controlWidth");t.refreshValue(this,"controlHeight");n.onUpdateUI.apply(this,arguments)},get_controlWidth:function(){return i(this._element.parentNode).innerWidth()},get_controlHeight:function(){return i(this._element.parentNode).innerHeight()},createChildren:function(){var o=this._element,w,n,it,r,l,a,b,k,s,u,d,t,v,y,p,tt;for(i(o).addClass("atom-form-grid"),s=i(o).children(),w=new e(s),f.removeAllChildren(o),n=h.createElement("DIV"),i(n).addClass("atom-form-grid-container"),o.appendChild(n),it=f.attr(this._element,"atom-min-label-width"),this.getTemplate("fieldTemplate");w.next();){if(r=w.current(),l=f.attr(r,"atom-type"),l=="AtomFormRow"){for(a=h.createElement("TABLE"),n.appendChild(a),i(a).addClass("atom-form-grid-row"),b=h.createElement("TBODY"),a.appendChild(b),k=h.createElement("TR"),b.appendChild(k),s=i(r).children(),u=new e(s);u.next();)d=h.createElement("TD"),k.appendChild(d),this.createField(d,u.current());continue}if(l=="AtomFormTabControl"||l=="AtomTabControl"){t=h.createElement("ul");t.setAttribute("atom-type","AtomToggleButtonBar");v=f.assignID(t);t.setAttribute("atom-name",v);t.setAttribute("atom-show-tabs","true");y=h.createElement("li");t.appendChild(y);y.setAttribute("atom-text","{$data.label}");y.setAttribute("atom-template","itemTemplate");this.createField(n,t);for(var rt=ft[v],u=new c(r),g=[],nt=0;u.next();)p=u.current(),i(p).remove(),p.setAttribute("style-display","[$scope."+v+".selectedIndex == "+nt+" ? '' : 'none']"),tt=this.createField(n,p),g.push(tt),nt++;rt.set_items(g);continue}this.createField(n,r)}}}})}(u.AtomFormLayout.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomFormTab",base:n,start:function(){},methods:{}})}(u.AtomFormGridLayout.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomFormNoLayout",base:n,start:function(){},methods:{}})}(u.AtomForm.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomFormVerticalLayout",base:n,start:function(){},methods:{}})}(u.AtomFormLayout.prototype),function(n){return classCreatorEx({name:"WebAtoms.AtomTableLayout",base:n,start:function(n,t,i){this._cellWidth=t;this._cellHeight=i;this._columns=n},methods:{doLayout:function(n){var u=new e(i(n).children()),t,s=0,f=0,r=Math.ceil(u._array.length/this._columns)-1,o=r,h=this._columns*this._cellWidth,c=this._cellHeight*(r+1);for(n.style.position="relative",n.style.width=h+"px",n.style.height=c+"px",n.maxRows=r;u.next();)t=u.current(),t.style.position="absolute",t.style.left=s+"px",t.style.top=f+"px",t.style.width=this._cellWidth+"px",o<=0?(o=r,s+=this._cellWidth+10,f=0):(o--,f+=this._cellHeight)}}})}(u.AtomLayout.prototype);ht=function(n){return classCreatorEx({name:"WebAtoms.AtomViewBoxLayout",base:n,start:function(){},methods:{doLayout:function(n){for(var r={width:i(n).innerWidth()+"px",height:i(n).innerHeight()+"px"},u=new c(n),t;u.next();)t=u.current(),t.style.width=r.width,t.style.height=r.height,t.atomControl&&t.atomControl.updateUI()}}})}(u.AtomLayout.prototype);ht.defaultInstance=new ht;r.confirm=function(n,t){var o={Message:n,ConfirmValue:!1,Confirm:t?!0:!1},e=h.createElement("DIV"),r;h.body.appendChild(e);r=f.createControl(e,u.AtomWindow,o);r.set_windowWidth(380);r.set_windowHeight(120);r.set_windowTemplate(r.getTemplate("alertTemplate"));r.set_title(t?"Message":"Confirm");r.set_next(function(){r.dispose();i(e).remove();o.ConfirmValue&&t&&t()});r.refresh()};r.alert=n.__chromeCSP?function(n){r.confirm(n,null)}:function(n){alert(n)};i(h).ready(function(){var n=u.dispatcher;n.setupControls();n.start()});i(n).on("unload",function(){function n(t){if(t)if(t.atomControl)t.atomControl.dispose();else for(var i=new c(t);i.next();)n(i.current())}n(h.body)})}(window);
//# sourceMappingURL=web-atoms.min.js.map