-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathjquerymy.min.js
2 lines (2 loc) · 63.3 KB
/
jquerymy.min.js
1
2
/*jQuery.my 1.3.4, (c) 2024 ermouth*/
!function(x){var a="1.3.4",b=window.URL||window.webkitURL,c=!document.addEventListener,d=((window.navigator.language||window.navigator.userLanguage||"en")+"").split("-")[0].toLowerCase(),e="{yyyy}-{MM}-{dd}",f="{HH}:{mm}",g="object",h="data",i="array",j="string",k="function",l="change",m=/^this\./,n=Object.isArray,o=Object.isBoolean,p=Object.isString,q=Object.isObject,r=Object.isNumber,s=Object.isRegExp,t=Object.isFunction,u=function(x){return null!=x&&typeof x==g&&t(x.then)},v=U(x,"my.f.repo")?x.my.f.repo():{_src:{},_name:"Default manifest cache"},w=U(x,"my.f.restyles")?x.my.f.restyles():{},y=Object.merge,z=Object.clone,A=Object.keys,B=x.extend,C=x.Deferred,D=x.type,E=null,F=function(x){return null!=x},G=x.ajax,H=ax,I=Date.now,J=tx,K={vals:{".my-form":function(x,a){if(x&&x.my){var b=x.my(h);return Object.equal(b,a)?b:x.my(h,a,!0)}return a||E},".hasDatepicker":function(x,a){F(a)&&x.datepicker("setDate",""==a?a:Date.create(a));var b=x.datepicker("getDate");return b?b.format(e):""},".my-tags":function(x,a){return F(a)&&(p(a)||r(a)?x.tags(h,[a+""]):n(a)&&x.tags(h,a)),x.tags(h)},".ui-draggable":function(x,a){if(F(a)&&q(a)){var b={};isNaN(a.left)||(b.left=(+a.left).ceil(2)+"px"),isNaN(a.top)||(b.top=(+a.top).ceil(2)+"px"),(b.left||b.top)&&x.css(b)}var c=x.position();return{left:a&&!isNaN(a.left)?(+a.left).ceil(2):c.left.ceil(2),top:a&&!isNaN(a.top)?(+a.top).ceil(2):c.top.ceil(2)}},".my-form-list":function(a,b){var c,d,e,f,g,h=(a.data("formlist")||{}).generator||{},i=h.selector||">.my-form",j=!!h.merge,k=h.template||"<div></div>",l=/\{/.test(k),m=h.hash||Y,o=h.id||Y,p=h.ext,q=h.delay||50,r="ui-sortable",s="."+r+"-placeholder",t=(a.is("."+r),!!a.children(s).length),u=[],v=[],w=I(),y=a.find(i);if(F(b)&&n(b)){if(t)return b;if(d=[],e={},y.each(function(a){var b,c=x(this),f=c.data("my");f&&(d.push(f.data),!j&&(b=c.data("formlist"))&&(e[b.oid]=f.data))}),!T(d,b,"==")){var z=[],A=[],B={},C={};for(v=[],c=0;c<b.length;c++)A[c]=o(b[c],c)+"",B[A[c]]=c,z[c]=(o!==m?m(b[c],c):A[c])+"";for(y.each(function(){var a=x(this),c=(a.data("formlist")||{}).oid;c&&Q(B,c)&&(j||b[B[c]]===e[c])?C[c]=x(this):a.hasClass("my-form")?a.my("remove",!0):a.remove()}),c=0;c<b.length;c++)Q(C,A[c])?(f=C[A[c]].detach().appendTo(a),u.push(f.my("data")),z[c]!==(f.data("formlist")||{}).hash&&(j&&u.last()!==b[c]&&h.merge(u.last(),b[c]),v.push(f))):((f=x(l?k.assign(b[c]):k).appendTo(a)).data("formlist",{list:b[c],index:c,hash:z[c],oid:A[c]}),ux.call(f,bx(h.parent,h.manifest,b[c],c,b,a),b[c]).then(function(x){x.on("change.my",E.debounce(q/1.3))}.fill(f)),u.push(f.my("data")));if(v.length&&p){for(c=0;c<v.length;c++)G(v[c]);v=[]}return d=e=null,u}return e=null,d}if(y.length){if(w-h.stamp>1.4*q||w-h.stamp>100||!h.stashed||h.stashed.length!==y.length-(t?1:0)){t&&(g=a.find(">."+r+"-helper"));var D=0;for(y.each(function(a,b){var c,d,e,f=x(b),h=!1;t&&f.hasClass(r+"-helper")||(t&&f.hasClass(r+"-placeholder")&&(f=g),c=f.data("my"),d=f.data("formlist"),c&&d&&(u.push(c.data),D!=d.index&&(d.index=D,h=!0),p&&(e=m(c.data,D)+"")!==d.hash&&(d.hash=e,h=!0),D+=1,h&&v.push(f)))}),c=0;c<v.length;c++)G(v[c]);v=[],h.stamp=w,h.stashed=u}else u=h.stashed.slice(0);return u}return b||[];function E(){var b,c,d=x(this),e=d.data("my");e&&(c=(b=d.data("formlist")).index,b.hash=m(e.data,c)+"",b.oid=o!==m?o(e.data,c)+"":b.hash),a.trigger("check.my")}function G(x){x.data("my").locktill+q/1.3<w&&x.my("redraw")}},"input[type=date]":function(x,a){var b;return F(a)?(b=""!=a?Date.create(a).format(e):"",p(b)&&!/Invalid/.test(b)&&x.val(b),b):""!=(b=x.val())?Date.create(b).format(e):""},"input[type=time]":function(x,a){var b;return F(a)?(b=""!=a?Date.create(a).format(f):"",p(b)&&!/Invalid/.test(b)&&x.val(b),b):""!=(b=x.val())?Date.create(b).format(f):""},input:{"[type='text'],[type='number'],[type='button'],[type='range'],[type='hidden'],:not([type])":{".ui-slider-input":function(x,a){F(a)&&x.val(a).slider("refresh")},"div.select2-container+input":function(x,a){return F(a)&&JSON.stringify(a)!==JSON.stringify(x.select2("val"))&&x.select2("val",n(a)?a:[a]),x.select2("val")},"":function(x,a){F(a)&&x.val(a+"")}},"[type='password'],[type='tel'],[type='email'],[type='search']":function(x,a){F(a)&&x.val(a+"")},":radio":function(a,b){var c=-1;if(F(b)){a.each(function(a){var d=x(this).val();b+""==d+""&&(c=a)});var d=a.eq(0).checkboxradio;if(d&&a.each(function(a){var b=x(this);c!=a&&b.is(":checked")&&b.prop("checked",!1).checkboxradio("refresh")}),c>-1){var e=a.eq(c);e.is(":checked")||(e.prop("checked",!0),d&&e.checkboxradio("refresh"))}else d||a.each(function(){x(this).prop("checked",!1)})}if(-1==c)for(var f=0;f<a.length;f++)a.eq(f).is(":checked")&&(c=f);return-1!=c?a.eq(c).val():""},":checkbox":function(a,b){var c=b,d=[];if(F(c)){n(c)||(c=[b]);var e=!!a.eq(0).checkboxradio;a.each(function(a){var b=x(this),f=b.val(),g=b.is(":checked");-1!=c.indexOf(f)?(d.push(f),g||b.prop("checked",!0)):g&&b.prop("checked",!1),e&&b.checkboxradio("refresh")})}else a.each(function(){var a=x(this);a.is(":checked")&&d.push(a.val())});return d}},select:{".ui-slider-switch":function(x,a){F(a)&&(x.val(a+""),x.slider("refresh"))},"div.select2-container+select":{"[multiple]":function(x,a){return F(a)&&x.select2("val",n(a)?a:[a]),x.select2("val")},"":function(x,a){return F(a)&&x.select2("val",a+""),x.select2("val")}},".select2-hidden-accessible":{"[multiple]":function(x,a){return F(a)&&JSON.stringify(a)!==JSON.stringify(x.select2("val"))&&x.val(n(a)?a:[a]).trigger("change.select2"),x.select2("val")},"":function(x,a){return F(a)&&x.val(a+"").trigger("change.select2"),x.val()}},"[multiple]":function(x,a){return F(a)&&(x.val(a,[]),x.selectmenu&&(x.data("uiSelectmenu")||x.data("selectmenu"))&&x.selectmenu("refresh",!0)),x.val()||[]},"":function(x,a){F(a)&&(x.val(a+""),x.selectmenu&&(x.data("uiSelectmenu")||x.data("selectmenu"))&&x.selectmenu("refresh",!0))}},textarea:{".my-cleditor":function(x,a){return F(a)&&x.val(a).cleditor()[0].updateFrame(),x.val()},"div.redactor_box textarea,.redactor":function(x,a){var b=x.hasClass("my-redactor-9");return F(a)?(b?x.redactor("set",a):x.setCode(a,!1),a):b?x.redactor("get"):x.getCode()},".my-codemirror":function(x,a){return F(a)?(x[0].nextSibling.CodeMirror.setValue(a),a):x[0].nextSibling.CodeMirror.getValue()},"":function(x,a){F(a)&&x.val(a+"")}},"fieldset,form,section,footer,aside,.my-container":function(x,a){var b=S(x[0],0).sort(),c=a;return F(a)&&(p(a)&&(c=a.split(/[,\s]+/).compact(!0)),n(c)&&(c.sort(),c.join(" ")!==b.join(" ")&&(x.attr("css",c.join(" ")),b=c))),b},"div,span":{".ui-slider":function(x,a){return F(a)&&x.slider("option",x.slider("option","values")?"values":"value",L.clone(a)),L.clone(x.slider("option","values")||x.slider("option","value")||0)},".ui-buttonset":function(a,b){if(F(b)){if(""==b){var c=E;if(a.find(":radio").each(function(){c=(x(this).val()||x(this).button("option","label"))==b?x(this):c}),c)return c.attr("checked",!0),a.buttonset("refresh"),b}}else{var d=a.find(":radio:checked");if(d.length&&d.button)return d.val()||d.button("option","label")}return a.find(":radio:checked").attr("checked",!1),a.buttonset("refresh"),""},".ace_editor":function(x,a){return F(a)&&ace.edit(x[0]).setValue(a),ace.edit(x[0]).getValue(a)},"":function(x,a){return F(a)&&x.html(a),x.html()}},"a,p,li,td,th,h1,h2,h3,h4,h5,h6,pre,code":function(x,a){return F(a)&&x.html(a),x.html()},img:function(x,a){return F(a)&&x.attr("src",a),x.attr("src")||""},"":function(x,a){return F(a)&&x.html(a),x.html()||x.text()||x.val()+""||""}},msg:{"":{en:"Invalid input",ru:"Неверное значение"},formError:{en:"Form error",ru:"Ошибка формы"},initFailed:{en:'<p class="my-error">Form init failed</p>',ru:'<p class="my-error">Ошибка инициализации формы</p>'},badInput:{en:"Invalid input",ru:"Неверное значение"},patternMismatch:{en:"Pattern mismatch",ru:"Не соответствует шаблону"},rangeOverflow:{en:"Over maximum",ru:"Больше максимума"},rangeUnderflow:{en:"Under minimum",ru:"Меньше минимума"},stepMismatch:{en:"Step mismatch",ru:"Не кратно шагу"},tooLong:{en:"Too long",ru:"Слишком длинно"},typeMismatch:{en:"Invalid type",ru:"Неверный тип"},valueMissing:{en:"Required",ru:"Обязательное поле"}},events:{".hasDatepicker":"change.my check.my",".my-form,.my-tags":"change.my check.my",".ui-slider":"slide.my check.my","div.redactor_box textarea":"redactor.my check.my",".my-codemirror":"codemirror.my check.my",".ace_editor":"ace.my check.my",".my-form-list":"sortupdate.my check.my",".ui-sortable":"sortchange.my sortupdate.my check.my",".ui-draggable":"drag.my dragstop.my check.my","a, .pseudolink, input[type=button], button":"click.my","img, :radio, :checkbox":"click.my check.my","div.select2-container+input,div.select2-container+select,.select2-hidden-accessible":"change.my check.my input.my",".ui-buttonset,input, select, textarea":"blur.my change.my check.my"+("Micro"===navigator.appName.to(5)?" keyup.my":" input.my"),"":"check.my"},containers:{"*[data-role='fieldcontain'] *":{"input,textarea,select,button,:radio":function(x){return x.parents('[data-role="fieldcontain"]').eq(0)}},"div.redactor_box textarea":function(x){return x.parents("div.redactor_box").eq(0).parent()},".my-tags,.hasDatepicker,.ui-widget,input,textarea,select,button":{".my-cleditor":function(x){return x.parents("div.cleditorMain").eq(0).parent()},"":function(a){var b=a[0].parentNode,c=b.nodeName;return/^(div|span|a|p|form|fieldset|li|ul|td|th|h\d)$/i.test(c)?x(b):a.parents("div,span,a,p,form,fieldset,li,ul,td,th,h1,h2,h3,h4,h5,h6").eq(0)}},"":function(x){return x}},offon:{".ace_editor":function(x,a){ace.edit(a[0]).setReadOnly(x)},".ui-selectable":function(x,a){jx(a,"selectable",x)},".ui-slider":function(x,a){jx(a,"slider",x)},".ui-draggable":function(x,a){jx(a,"draggable",x)},".ui-buttonset":function(x,a){jx(a,"buttonset",x)},".hasDatepicker":function(x,a){jx(a,"datepicker",x)},".my-form":function(x,a){a.my("disabled",!!x)},"div.select2-container+input,div.select2-container+select":function(x,a){jx(a,"select2",x)},".select2-hidden-accessible":function(x,a){a.prop("disabled",!!x)},".my-cleditor":function(x,a){a.cleditor()[0].disable(!!x)},"":function(x,a){a.attr("disabled",!!x)}},destroy:{".hasDatepicker":function(x){x.datepicker("destroy")},".ui-slider":function(x){x.slider("destroy")},".ui-sortable":{".my-form-list":function(a){a.find(">.my-form").each(function(){x(this).my("remove")}),a.removeClass("my-form-list"),a.sortable("destroy")},"":function(x){x.sortable("destroy")}},".my-form-list":function(a){a.find(">.my-form").each(function(){x(this).my("remove")})},".ui-draggable":function(x){x.draggable("destroy")},".my-redactor-8":function(x){x.destroyEditor(),x.removeClass("my-redactor-8")},"div.select2-container+input,div.select2-container+select,.select2-hidden-accessible":function(x){x.select2("destroy")},".my-form":function(x){x.my("remove")},textarea:{".my-codemirror":function(x){x[0].nextSibling.CodeMirror.toTextArea(),x.removeClass("my-codemirror")}}}};K.params={container:function(x){return yx(x,K.containers)(x)},change:E,recalcDepth:2,delay:0,strict:!1,restyle:-1,locale:d,messages:Object.map(K.msg,function(x,a){return a[d]||a.en}),errorTip:".my-error-tip",errorCss:"my-error",animate:0,effect:function(x,a,b){if(a)return x.fadeIn(b);x.fadeOut(b)},remember:0,silent:!1,history:{},historyDelay:100,loader:function(x,a){var b=C(),c=H(x+"");return c?b.resolve(c):b.reject(null),b.promise()},ajaxTimeout:1e4},Date.prototype.toJSON=function(){return this.toISOString()},RegExp.prototype.toJSON=function(){return"new RegExp("+this.toString()+")"};var L={con:P,clone:function(x){return x.clone?x.clone():x},indom:R,jquix:jx,overlap:$,patch:Z,kickoff:_,sdbmCode:Y,tojson:Ax,fromjson:function(x){var a=JSON.parse(x);return Bx(a),a},unjson:function(x){return Bx(x),x},mask:nx,unmask:ox,getref:U,repo:function(){return v},restyles:function(){return w},blob2base64:function(x,a,b){var c=new FileReader;c.onload=function(){a(b?c.result:c.result.split(",")[1])},c.readAsDataURL(x)},base642blob:function(x,a,b){for(var c=atob(x),d=c.length,e=new ArrayBuffer(d),f=new Uint8Array(e),g=0;g<d;g++)f[g]=c.charCodeAt(g);var h=new Blob([f],{type:b||"application/octet-stream"});if(!t(a))return h;a(h)},base64:function(a,b,c){var d=null,e=p(a)?a:x.my.tojson(a),f=p(c)?"data:"+c+";base64,":"";if(b){try{d=decodeURIComponent(escape(window.atob(e)))}catch(x){d=null}if(null!==d&&/(^".*"$)|(^\[.*\]$)|(^\{.*\}$)/.test(d))try{d=L.fromjson(d)}catch(x){d=null}return d}return f+window.btoa((!0===c?"":"")+unescape(encodeURIComponent(e)))},css2json:function(x){var a="";return(x+"").replace(/\/\*[\s\S]+\*\//gm,"").replace(/@charset[^;]+;/gim,"").replace(/[\n\t\s]+/g," ").replace(/\s*@media[^{]*\{/g,function(x){return x.to(-1).trim()+"ᴥ"}).replace(/\}/g,"}ᴥ").replace(/^\n+/g,"").replace(/[\n\s]+$/g,"").split("ᴥ").compact(!0).reduce(function(x,b){var c,d,e,f=b.trim();return"}"==f?a="":/^[^{]+\{[^\}]+\}$/.test(f)?(d=" "+(c=f.to(-1).split("{"))[0].trim(),";"!=(e=c[1].trim()).last()&&(e+=";"),a?x[a][d]=(x[a][d]||"")+e:x[d]=(x[d]||"")+e):/^@media/.test(f)&&(x[f]={},a=f),x},{})},tmpl:function(){},_s2css:vx,_normUI:qx},M={container:function(x){return yx(x,K.containers)(x)},data:function(x,a){var b=this;return q(x)&&(b.my().data=$(b.my().data,x),this.my("redraw",a)),b.my().data},disabled:function(x){var a=this,b=a.my();if(b)return x==E?b.disabled:(x?(A(b.ui).forEach(function(x){var b=xx(a,x),c=b.my();c&&(c.predisabled=c.disabled),ix(!0,b,":disabled")}),a.addClass("my-disabled")):(A(b.ui).forEach(function(x){var b=xx(a,x),c=b.my();c&&ix(c.predisabled,b,":disabled")}),a.removeClass("my-disabled"),a.my("redraw")),void 0)},errors:function(){var a=x(this).my().errors||{},b={};return A(a).forEach(function(x){var c=a[x];(typeof c==j&&""!=c||q(c)&&Object.size(c))&&(b[x]=c)}),b},find:function(x){var a=this,b=a.my();return b&&b.root&&(a=b.root),a.find(x)},history:function(x,a){return lx(x,this.my().params,a)},id:function(x,a){if(p(x))return H(x,a);var b=this.my();return b&&b.id?b.id:E},index:function(){return((this.my().root&&!this.my().ddata?this.my().root:this).data("formlist")||{}).index},indom:function(){return R(this)},init:ux,insert:function(x,a){var b,c,d=this.hasClass("my-form-list")?this:this.my().root||this,e=d.hasClass("my-form-list")?d:d.parent(".my-form-list"),f=(d.data("formlist")||{}).index,g=a,h=e.data("formlist").generator;if(null==f&&(f=0),b=m.test(h.bind)?U(e.my().manifest,h.bind.replace(m,"")):U(e.my().data,h.bind),!q(g))if(q(h.manifest))g=z(h.manifest.data,!0)||{};else{if(e===d)throw"No data to insert, cannot guess when manifest is a function.";g=z(d.my().manifest.data,!0)}if("before"===x)c=f;else if("after"===x)c=f+1;else{if(isNaN(x))throw"Invalid position for insertion";c=(1*x).clamp(0,b.length)}b.add(g,c),e.trigger("redraw")},manifest:function(x){return"json"==x?L.tojson(this.my().manifest):this.my().manifest},promise:function(x){return t(x)&&this.my().promise.then(x),this.my().promise},radio:function(x,a){this.trigger("radio",p(x)?{channel:x,message:a}:x)},redraw:function(x,a){var b=this,c=b.my(),d=2;return c&&q(c.ui)&&(d=c.params.recalcDepth,Object.keys(c.ui).forEach(function(a){var c=xx(b,a);zx(c,x?E:void 0,d),x||(c.hasClass("my-form")&&c.my("redraw"),c.hasClass("my-form-list")?c.trigger("redraw"):c.trigger("check.my"))}),!a&&x&&b.trigger(l)),b},remove:function(x){var a,b,c,d,e,f,g,h,i=this;if(!this.my())return E;if(this.my().root&&!this.my().ddata&&(i=this.my().root),e=(c=i.my()).data,g=c.cid,h=c.mid,i.unbind(".my"),q(c)&&c.manifest&&t(c.manifest.die))try{c.manifest.die.call(c.manifest,i,c.manifest)}catch(x){}if(a=c.style)if("1"==a.data("count"))try{a.remove()}catch(x){}else a.data("count",a.data("count")-1);if(b=c.localStyle)try{delete w[g],b.remove()}catch(x){}if(window.URL&&(d=c.locFiles)&&d.length)for(var j=0;j<d.length;j++)try{URL.revokeObjectURL(d[j])}catch(x){}if((f=(c||{}).ui)&&A(f).forEach(function(x){var a,b,c,d=xx(i,x);if((b=d.data("modal"))&&(b.cancel(),d.removeData("modal")),b=d.data("modals"))for(c in b)b[c]&&b[c].cancel();d.unbind(".my");try{a=yx(d,K.destroy),t(a)&&a(d)}catch(x){}d.removeData("formlist").removeData("myval").removeData("my")}),x&&i.hasClass("my-form"))i.remove();else if(i.data("formlist")&&i.hasClass("my-form")){var k=i.parents(".my-form-list").eq(0);i.remove(),k.trigger("check")}else i.removeData("formlist").removeData("myval").removeData("my").removeClass("my-form");return i.removeClass("my-form-"+g+" my-manifest-"+h),e},reset:function(){try{_(this.my().data,this.my().initial),this.my("redraw")}catch(x){return!1}return!0},restyle:function(a){var b,c,d=[],e=this.hasClass("my-form")?this:this.parents(".my-form").eq(0);if(e.length&&e.is(":visible")){for((c=(e.data("my")||{}).cid)&&d.push(c),a||xx(e,".my-restyle",!0).each(function(){var a=(x(this).data("my")||{}).cid;a&&d.push(a)}),b=0;b<d.length;b++)if(w[d[b]])try{w[d[b]]()}catch(x){}return!!d.length}return!1},ui:function(x){var a,b=this,c=b.my(),d=[];if(!c)return E;if(!q(x))return c.ui;for(A(x).forEach(function(x){d.push(x)}),c.ui=qx($(c.ui,x)),a=0;a<d.length;a++)fx(xx(b,d[a],!0),b,c.ui[d[a]],d[a]);return A(x).forEach(function(x){xx(b,x).trigger("check")}),c.ui},undo:function(x){var a,b=this,c=b.my(),d=c.params.history,e=A(d).sort(),f=1*(parseInt(x)||0);return!e.length||f<0?E:(c.params.errors&&c.params.errors.values().compact(!0).length?Object.equal(c.data,c.lastCorrect)||(f+=1):Object.equal(d[e.last()],c.data)&&(f+=1),(a=lx(f,c.params,!0))&&(_(b.my().data,a),b.my("redraw")),b.my().data)},val:function(x){return kx(this,x)},valid:function(){var a=x(this).my().errors,b=0;return A(a).forEach(function(x){b||(a[x]&&p(a[x])||q(a[x])&&A(a[x]).length)&&b++}),!b},version:function(){return a}},N=Object.keys(M);return x.my||(x.my={}),B(x.my,{f:x.extend({},L),tojson:L.tojson,fromjson:L.fromjson,radio:function(a,b){gx(x(document),p(a)?{channel:a,message:b}:a)},rules:K,locale:function(x){if(!p(x))return d;d=x.toLowerCase(),K.params.locale=d},ajax:function(x){return t(x)?G=x:G.apply(this,S(arguments,0))},cache:function(x,a){return t(x)?H=x:H(x,a)},now:function(x){if(!t(x))return I();I=x},require:function(x){return t(x)?J=x:J.apply(this,S(arguments,0))},chain:function(){var x=1,a=1e3,b=[],c=!1,d=function(c,d,f){b.push([c,d||x,f||a]),e()};return d.delay=function(a){return isNaN(a)||(x=(a-0).clamp(0,1e6)),x},d.timeout=function(x){return isNaN(x)||(a=(x-0).clamp(1,1e6)),a},d.start=function(){c=!0,e()},d.stop=function(){c=!1},d;function e(){if(b.length&&c){var x,a=b.shift(),d=function(){e.delay(a[1])}.once();try{x=a[0]()}catch(x){d()}u(x)?(x.then(d,d),d.delay(a[1])):d()}}}(),version:function(){return a}}),x.my.incache=Object.create(v),x.my.version.toString=function(){return a},x.fn.my=function(a){var b;if(void 0===a)return this.data("my");if(p(a)&&"{"==a.substr(0,1)){try{b=JSON.parse(a)}catch(x){}if(b)return M.init.apply(this,[b].add(S(arguments,1)))}return p(a)&&M[a]?M[a].apply(this,S(arguments,1)):p(a)&&H(a,"exist")?M.init.apply(this,arguments):typeof a!==g&&a?(x.error("Method "+a+" does not exist on jQuery.my"),void 0):M.init.apply(this,arguments)},x(window).off(".my").on("radio.my",function(a,b){a.stopPropagation(),gx(x(document),b)}).on("resize.my",function(){A(w).forEach(function(x){try{w[x]()}catch(x){}})}.debounce(67)),void 0;function O(){window.console&&console.error.apply(console,arguments)}function P(){window.console&&console.log.apply(console,arguments)}function Q(x,a){return"hasOwnProperty"!=a?x.hasOwnProperty(a):!!("hasOwnProperty"in x)}function R(a){return x.contains(document.documentElement,a[0])}function S(x,a){return Array.prototype.slice.call(x,a||0)}function T(x,a,b){var c=0,d=x.length,e=!0;if(x===a)return"===";if("==="==b)return"";if(d!=a.length)return"";for(;c<d&&e;c++)e=x[c]===a[c];if(e)return"==";if("=="==b)return"";for(e=!0;c<d&&e;c++)e=Object.equal(x[c],a[c]);return e?"=":""}function U(x,a){return(p(a)?a.split("."):n(a)?a:[""]).reduce(function(x,a){if(null!=x){if(/=/.test(a)){var b=a.split("=",2);return q(x)?Object.values(x).find(function(x){return!(!q(x)&&!n(x))&&x[b[0]]==b[1]}):n(x)?x.find(function(x){return!(!q(x)&&!n(x))&&x[b[0]]==b[1]}):void 0}if(null!=x[a])return x[a]}},x)}function V(x){var a=x.my();return a?a.root?a.root.my():a:null}function W(x){var a={},b=function(){return null};return p(x)?x.split(/[,\s]+/).compact(!0).unique().map(function(x){a[x]=b}):n(x)?x.compact(!0).unique().map(function(x){a[x]=b}):q(x)&&A(x).forEach(function(b){t(x[b])?a[b]=x[b]:a[b]=function(){return x[b]}}),a}function X(x){var a,b=x,c={};if(p(b)&&(b=b.split(/[,\s]+/)),n(b)){for(b=b.compact(!0),a=0;a<b.length;a++)c[b[a]]=!0;return c}return q(b)?x:null}function Y(x){for(var a=JSON.stringify(x),b=0,c=0;c<a.length;c++)b=a.charCodeAt(c)+(b<<6)+(b<<16)-b;return(1e11+b).toString(36)}function Z(x,a){return A(a).forEach(function(b){q(a[b])?Q(x,b)?Z(x[b],a[b]):x[b]=z(a[b],!0):Q(x,b)||(n(a[b])?x[b]=a[b].clone(!0):x[b]=a[b])}),x}function $(x,a){return x?a?y(x,a,!1,b):x:{};function b(x,a,c){return null==c?a:q(c)?y(a,c,!1,b):c}}function _(x,a){return A(x).forEach(function(a){delete x[a]}),"object"==typeof a&&y(x,a,!0),x}function xx(a,b,c){return/^[#\.][a-z0-9_\-]{1,31}$/i.test(b)?x(c?a[0].querySelectorAll(b):a[0].querySelector(b)):c||/:/.test(b)||/^[a-z]{1,31}[\[\.\#][a-z]/i.test(b)?a.find(b):a.find(b).eq(0)}function ax(x,a){var b,c;return p(x)?(b=x,c=U(q(a)?a:v,b),"exist"===a?q(c):c?z(c,!0):null):q(x)?(c=cx(x,a),q(c)?c:null):void 0===x?v._src:null===x?Object.reject(v,/^_/):null}function bx(x,a){var b,c;if(q(a))return a;if(p(a)){if(null==(b=U(x,a))&&(b=z(v._src[a],!0)),null==b&&(b=U(v,a),q(b)&&q(b._self)?b=z(b._self,!0):q(b)&&(b=z(b,!0))),null==b&&U(x,"params.cache")&&(c=U(x,"params.cache"),t(c)?b=c(a):q(c)&&(b=H(a,c)),q(b)&&(q(b._self)&&(b=z(b._self,!0)),y(b,{params:{cache:c}},!0))),null!=b&&q(b))return(c=c||U(x,"params.cache"))&&y(b,{params:{cache:c}},!0),b;throw"Component "+a+" not found."}return t(a)?a.apply(x,S(arguments,2)):null}function cx(a,b){var d,e,f,g,h,i=b||v,j=a;if(!(q(i)&&q(j)&&q(j.ui)&&p(j.id)))return"Can’t save manifest into cache, invalid arguments.";Q(i,"_src")||(i._src={}),f=j.id;try{j=z(a,!0)}catch(x){return"Can’t save circular-referencing object into cache."}try{(!j.params||j.params&&!j.params.strict)&&Bx(j,!0)}catch(x){return"Invalid manifest, parse error."}if(d=dx(j),p(d))return O(d),d;if(y(j,{params:{strict:!0}},!0),i._src[f]=j,g=nx(i,f)){if(g.params&&g.params.protect)return"Can’t save manifest into cache over protected one.";g._self&&delete g._self,x.extend(!0,i,ox("",f))}return x.extend(!0,i,ox(j,f)),(e=Object.keys(i._src).filter(function(x){return x.startsWith(f+".")})).sort(),e.forEach(function(a){var b;(b=nx(i,a))&&(b._self&&delete b._self,x.extend(!0,i,ox("",a))),x.extend(!0,i,ox(i._src[a],a))}),h=U(i,f),c?h._self=i._src[f]:Object.defineProperty(h,"_self",{get:function(){return i._src[f]},set:function(){throw"Can’t change manifest cache entry directly."},enumerable:!1,configurable:!0}),h}function dx(x){var a=[];return q(x.files)?(A(x.files).forEach(function(c){var d=x.files[c];if(!q(d))return"Non-object member "+c+" in files section.";if(p(d.data)&&!d.url)if(b)try{L.base642blob(d.data,function(x){d.blob=x,d.url=b.createObjectURL(d.blob)},d.content_type||d.mime),a.push(c)}catch(x){return"Invalid base64 data in files/"+c+"."}else d.url="data:"+(d.content_type||d.mime)+";base64,"+d.data,a.push(c)}),a):[]}function ex(x,a,b,c){var d,e=[],f=b.bind,g=D(f);return g==k?f.call(V(c).manifest,x,a,c):g===j||g===i?g!==j||/\./.test(f)?("this"==(e=g===j?f.split("."):f)[0]?(d=V(c).manifest,e.shift()):d=x,px(d,a,e,!0)):(a!=E?x[f]=a:void 0===x[f]&&(x[f]=E),x[f]):E}function fx(a,b,c,d){var e,f,g,h,i=b.my(),j=(i||{}).params,k=c,o=null,s=0,v=i.manifest,w=0|a.length;return i?(h=c.delay,w?(k.init!=E&&(e=rx(v,k.init,a,i)),u(e)?(s+=1,o=C(),e.then(z,function(x,a){A("Init of "+d+" failed: "+x,a)})):z()):P("Not found "+d+" selector.",b),o):(O("Failed to find $root building "+d+" selector."),null);function z(){var b=null,c=k.manifest;if(t(c)||q(c)&&q(c.ui)?g=c:p(c)&&(g=bx(v,c.replace(m,""))),g&&p(k.bind)){var e=U(m.test(k.bind)?v:i.data,k.bind.replace(m,""));if(null===o&&(o=C()),n(e)||k.list){a.addClass("my-form-list");var f="",h=">*";if(/^<.+>$/.test(k.list)?f=k.list:h=k.list||h,!f){var l=">*"==h?x(a[0].children):xx(a,h,!0);f="<div></div>",l.length&&(f=x(f).append(l.eq(0).clone(!0)).html(),l.eq(0).remove())}a.data("formlist")||a.data("formlist",{}),a.data("formlist").generator={manifest:g,delay:(k.delay||j.delay||10)/1.3,template:f,selector:h,parent:v,bind:k.bind,merge:t(k.merge)?k.merge.bind(v):!!k.merge&&$,hash:t(k.hash)?k.hash.bind(v):p(k.hash)?D.fill(void 0,k.hash):n(k.hash)?F.fill(void 0,k.hash.slice(0)):null,id:t(k.id)?k.id.bind(v):p(k.id)?D.fill(void 0,k.id):n(k.id)?F.fill(void 0,k.id.slice(0)):null,ext:!(!k.id&&!k.hash),stamp:0},a.on("insert.my",function(a,b){a.stopPropagation();var c={what:void 0,where:0};null==b?c.where=1e6:q(b)?y(c,b):(p(b)||r(b))&&(c.where=b),x(a.target).my("insert",c.where,c.what)}),a.on("remove.my",function(a){a.stopPropagation(),x(a.target).my("remove")})}else try{b=ux.call(a,bx(v,g),q(e)?e:void 0)}catch(x){A("$.my subform init of "+d+" failed: "+x.message,x.stack)}}u(b)?b.then(G,function(x,a){A("Init of subform "+d+" failed with error: "+x,a)}):G()}function A(x,a){O(x,a),o&&o.reject(x,a)}function D(x,a){var b=U(x,a)||"";return"string"==typeof b?b:Y(b)}function F(x,a){return Y(nx(x,a))}function G(){a.each(function(){var e,g,m,n=x(this),o=n[0].nodeName,p=!1;if("TEXTAREA"==o&&(g=(m=n[0].nextSibling)&&m.CodeMirror?m.CodeMirror:null)&&n.addClass("my-codemirror"),e=k.events||yx(n,K.events),n.hasClass("my-form")?B(n.data("my"),{dui:k,root:b,selector:d,dparams:j,devents:e,ddata:i.data,container:j.container(n),derrors:i.errors,single:!0}):(n.data("my",{events:e,selector:d,initial:f,previous:f,root:b,container:j.container(n),id:i.id,ui:k,data:i.data,params:j,errors:i.errors,single:1==w}),c._update=k.delay?zx.debounce(k.delay):E,p=!0),p)if(n.cleditor&&n.parent().hasClass("cleditorMain")){var q=n.cleditor()[0];if(q&&q.$frame&&q.$frame[0]){n.addClass("my-cleditor"),B(n.data("my"),{container:j.container(n)});var r,s=function(x){n.val(x).trigger(l)},t=Number.random(1e5,1e6-1);x(q.$frame[0]).attr("id","cleditCool"+t),r=document.frames?document.frames["cleditCool"+t].document:x("#cleditCool"+t)[0].contentWindow.document;var u=x(r).find("body");x(r).on("keyup.my",function(){s(x(this).find("body").html())}),n.parent().find("div.cleditorToolbar").on("click.my mouseup.my",function(){s(u.html())}),x("body").on("click","div.cleditorPopup",function(){s(u.html())})}}else if("TEXTAREA"==o&&n.parent().hasClass("redactor_box")){var v,y="my-redactor-9";try{v=n.getEditor(),y="my-redactor-8"}catch(x){v=n.redactor("getEditor")}v&&(n.addClass(y),v.on("input.my keyup.my blur.my",function(x){x.trigger("redactor")}.fill(n)))}else n.hasClass("ace_editor")?ace.edit(a[0]).on(l,function(x){x.trigger("ace")}.fill(n)):g&&g.on(l,function(x){x.trigger("codemirror")}.fill(n));n.my()._changed=hx.debounce(h),n.my()._recalc=sx.debounce(h),n.on(e,function(x){x.type==l&&x.stopPropagation(),p&&(i.locktill=I()+c.delay),n.my()._changed(n,b,c,j)}),/check(\.my)?/.test(e+"")||n.on("check.my",function(x){return n.my()._changed(n,b,c,j,!0),!1}),p||n.off("redraw.my"),n.on("recalc.my, redraw.my",function(x){x.stopPropagation(),n.my()._recalc(n,b,c,j)})}),o&&o.resolve()}}function gx(a,b){q(b)&&b.channel&&b.message&&xx(a,".my-listen-"+Y(b.channel),!0).each(function(){var a,c,d=x(this),e=d.data("my");if(e&&e.ui.listen&&t(e.ui.listen[b.channel])){a=e.ui.listen[b.channel];try{c=a.call(e.manifest||e.root.my().manifest,e.data,b.message,d)}catch(x){O("Listener failed",x.message,x.stack)}void 0!==c&&(null===c?d.trigger("check"):c&&d.trigger("recalc"))}})}function hx(x,a,b,c,d){var e,f=x.data("my");f&&(f.disabled?f.ddata||zx(x,E,b.recalcDepth||c.recalcDepth):(lx(f.ddata||f.data,f.dparams||f.params),d||(e=f.single?x:xx(a,f.selector)),zx(x,d?E:kx(e,E),b.recalcDepth||c.recalcDepth),c.change&&c.change.call(x)))}function ix(a,b,c){var d=c.compact(),e=d.replace(/:disabled/g,""),f=e!==d,g="self:"==e.substr(0,5);return g&&(e=e.replace(/^self:/g,"")),b.each(function(){var c=x(this),d=c.my();(!g&&d?d.container:c).toggleClass(e,!!a),f&&void 0!==d&&!!a!=!!d.disabled&&(c.my().disabled=!!a,d._disable||(c.my()._disable=yx(b,K.offon).fill(void 0,b)),d._disable(!!a))}),b}function jx(x,a,b){return x[a](b?"disable":"enable")}function kx(x,a){var b,c,d=x.data("myval");return d||(c=yx(x,K.vals),t(c)&&(void 0===(b=c(x,E))?x.data("myval",function(x,a){return E!=a&&c(x,a),x.val()}.fill(x,void 0)):x.data("myval",c.fill(x,void 0))),d=x.data("myval")),t(d)?(((b=d())!==a&&(0==a||0==b)||b!=a||q(a))&&(b=d(a)),b):E}function lx(x,a,b,c){var d,e,f,g,h,i,j,k,m,n=a;if(!q(n)||isNaN(g=n.remember)||!q(d=n.history))return E;if(q(x)&&g){if(i=z(x,!0),j=I(),(f=A(d).sort()).length&&(j-f.last()<n.historyDelay||Object.equal(d[f.last()],i)))return E;if(n.history[j]=i,f.push(j),f.length>=2*g){for(m={},e=g;e<2*g;e++)m[f[e]]=d[f[e]];a.history=m}return c||n.form.trigger(l),n.history[f.last()]}if(!isNaN(x)||x===E){if((h=parseInt(x)||0)<0)return E;if(h>=(f=A(d).sort()).length&&(h=f.length-1),k=z(n.history[f[f.length-h-1]],!0),b){for(m={},e=0;e<f.length-h-1;e++)m[f[e]]=d[f[e]];a.history=m}return c||n.form.trigger(l),k}return c||n.form.trigger(l),E}function mx(x,a){if(!q(x))return!1;var b=x,c=p(a)?a:d,e=b.lang,f={};return!(!e||!q(e.en))&&(e._LANG==c||(c=q(e[c])?c:"en",e._LANG=c,Object.keys(e[c]).forEach(g.fill(void 0,void 0,c,f)),"en"!=c&&Object.keys(e.en).forEach(g.fill(void 0,void 0,"en",f)),!0));function g(x,a,c,d){var g;f[x]||x.length<3&&x.to(1).toLowerCase()==x.to(1)||(t(e[c][x])?(g=e[c][x].bind(b),e[x]=g,e[x].toString=g,e[x].assign=function(){for(var x=[],a=0,b="";a<arguments.length;a++)x.push(arguments[a]);return b=g.apply(null,x),p(b)?b.assign.apply(b,x):b}):e[x]=e[c][x],f[x]=!0)}}function nx(x,a){if(!q(x))return null;var b,c=a;if(p(c))return U(x,c);if(n(c)){b=[];for(var d=0;d<c.length;d++)b[d]=p(c[d])&&U(x,c[d])||null;return b}if(q(c))return e(x,c);function e(x,a){if(!q(a))return{};var b={};return A(a).forEach(function(c){!q(a[c])&&Q(x,c)?b[c]=z(x[c],!0):Q(x,c)&&(q(x[c])?b[c]=e(x[c],a[c]):b[c]=z(x[c],!0))}),b}}function ox(x,a,b){var c,d,e;if(null==b?(c={},d=x,e=a):(c=x,d=a,e=b),q(d)&&q(e))return nx(d,e);if(p(e)&&(e=[e],d=[d]),!n(e)||!n(c)&&!q(c))return null;if(q(d)&&(d=e.reduce(function(x,a){return x.push(U(d,a)),x},[])),n(d)&&n(e)){for(var f=0;f<e.length;f++)null!=d[f]&&px(c,d[f],e[f]);return c}return null}function px(x,a,b,c){var d,e,f,g,h=0;if(p(b)&&!/\./.test(b))null!=a&&(x[b]=a);else for(d=x,g=(e=n(b)?b:(b+"").split(".")).length-1;h<=g;h++)if(h===g){if(c)return E!=a?d[e[h]]=a:void 0===d[e[h]]&&(d[e[h]]=E),d[e[h]];d[e[h]]=a}else 0===h?(d=x[e[0]],f=x):(f=f[e[h-1]],d=d[e[h]]),(null==d||!q(d)&&(n(d)&&!isNaN(e[h+1])&&+e[h]>-1))&&(d=f[e[h]]={});return x}function qx(x,a,b){var c=q(a)?a:null,d=b||(c?c.params:null)||{delay:0},e={css:!0,check:!0,manifest:!0,list:!0,hash:!0,id:!0},f=/\s?[,;]\s?/,g=/,\s*|\s+/g;if(d.normalized)return x;for(var h,l,o=A(x||{}),p=[],r=0;r<o.length;r++)(h=typeof(B=x[z=o[r]]))==j||h==k?B=x[z]={bind:B}:(B.recalc&&!n(B.recalc)&&(typeof B.recalc==j?B.recalc=B.recalc.split(f).compact(!0).unique():B.recalc=[]),null==B.bind&&(B.bind=function(){}),B.listen&&(l=W(B.listen),B.listen=Object.size(l)?l:void 0),B.events&&(n(B.events)?B.events=B.events.join(" "):B.events=(B.events+"").replace(g," ")),Q(B,"watch")&&p.push(z)),B.delay=isNaN(+B.delay)?d.delay:+B.delay;var s;for(r=0;r<p.length;r++){B=x[z=p[r]],s=x[z].watch,(h=D(s))==j?s=s.split(f).compact(!0).unique():h!=i&&(s=[]);for(var t,u,v,w={},y=0;y<s.length;y++)!w[u=s[y]]&&(t=x[u])&&(w[u]=!0,(v=t.recalc)?-1==v.indexOf(z)&&t.recalc.push(z):t.recalc=[z])}if(null!==c){var z,B,C;for(r=0;r<o.length;r++){B=x[o[r]];var E=A(B);for(y=0;y<E.length;y++)e[z=E[y]]&&typeof B[z]==j&&null!=(C=U(c,B[z].replace(m,"")))&&typeof C!=j&&(B[z]=C)}}return x}function rx(x,a,b,c){var d;if(p(a)){if(void 0===(d=U(x,a)))return b.html(a.assign(c.data)),null}else d=a;if(t(d))return d.apply(x,S(arguments,2));if(n(d))try{b.formgen(d)}catch(x){}return null}function sx(x,a,b,c){var d=x.my();if(d&&!d.disabled){var e=xx(a,d.selector);e.hasClass("my-form")?e.my("redraw"):zx(x,e.hasClass("my-form-list")?U(e.my().data,e.data("formlist").generator.bind):E,b.recalcDepth||c.recalcDepth)}}function tx(a,b){var c=C(),d=[],e={},f=[],g=B(!0,{ajaxTimeout:1e4,loader:K.params.loader},b||{}),h={ref:null,ajax:{type:"GET",async:!0,timeout:g.ajaxTimeout}};if(q(a))if(n(a.require)){a.require,a.require.forEach(function(x){if(p(x))e[x]=r(x);else if(q(x)){var a=[];A(x).forEach(function(b){var c=null;!0===x[b]?e[b]=r(b):p(x[b])||q(x[b])?c=j(x[b],b):n(x[b])&&(c=[],x[b].forEach(function(x){if(p(x)||q(x)){var a=j(x,b);a&&c.push(a)}}),c.length||(c=null)),c&&!(e[b]=r(b))&&a.add(c)}),a.length&&d.push(a)}});var i=-1;l()}else c.resolve(a);else c.reject(["Invalid manifest."]);return c.promise();function j(a,b){var c;return p(a)?/[\/]/.test(a)?(c=B(!0,{},h,{ref:b,ajax:{url:a}}),m.test(b)&&(c.ajax.dataType="json")):a.length&&(c=B(!0,{},h,{ref:b,ajax:a})):q(a)&&((c=B(!0,{},h,{ref:b,ajax:x.extend(!0,{},Object.select(a,["accepts","async","cache","data","dataType","headers","xhrFields","password","timeout","type","url","username"]))})).ajax.url||(c=null)),c}function k(){c.reject(f)}function l(){var x=d[i+=1];if(x)o(x).then(l).fail(k);else{var b=s(e),g=A(Object.findAll(b,function(x,a){return!a}));g.length&&f.push((1==g.length?"Key "+g[0]+" is":"Keys "+g.join(", ")+" are")+" not present after all."),f.length?k():c.resolve(a)}}function o(x){var b,c,d=!1,e=C(),h=x.length;for(c=0;c<h;c++)b=x[c],(p(b.ajax)?g.loader:G)(b.ajax).then(function(x,b){m.test(b.ref)&&(null!=x?B(!0,a,ox(x,b.ref.from(5))):(d=!0,f.push("Invalid data for ‘"+b.ref+"’ resource."))),i()}.fill(void 0,b)).fail(function(x,a){f.push("Failed to load ‘"+a.ref+"’ resource."),d=!0,i()}.fill(void 0,b));return e.promise();function i(){h-=1,d?e.reject():h<.5&&e.resolve()}}function r(x){var b=!1;return m.test(x)?null!=U(a,x.from(5))&&(b=!0):null!=U(window,x)&&(b=!0),b}function s(x){return A(x).forEach(function(a){!1===x[a]&&(x[a]=r(a))}),x}}function ux(a,e,f){var g,i,j,k,l,m,o,r,s,v,y,z,D,F,G={},I={},L=null,M=[],N={},Q=C(),R=!1,S=function(){},T="my-form-init",V="std",$="",_={};if(p(a)){if(!(g=H(a)))return Q.reject("No manifest with id "+a+" found in repo."),Q.promise();q(f)&&q(e)?(g=B(g,e),i=f):i=e,V="repo"}else g=a,i=e;if(!g)return this;s=q(i)&&"repo"!=V?B(!0,{},g):g;var ax=this.eq(0),bx=ax.my();return q(bx)&&bx.id&&bx.ui?(P("jQuery.my is already bound.",ax),ax.my("ui",s.ui),ax.my(h,s.data),Q.resolve(ax.my(h)).promise()):((r=s.params||{}).strict||t(s.init)||Bx(r=B(!0,{},r)),r=B(!0,{},K.params,r),Q.fail(function(){ax.removeClass(y+" "+v)}),B(ax,Q.promise()),q(i)?(I=Z(i,s.data||{}),s.data=I):I=s.data||{},G.data=I,ax.data("my",{data:I,params:r,promise:Q.promise(),locktill:0}),ax.addClass(T),s.inherit&&hx(s),n(s.require)?J(s,r).then(cx).fail(function(x){jx(),yx("Linker of the ‘require’ property failed.",x)}):cx(),Q.then(ix),ax);function cx(){var x=!0;jx(),G.files&&(x=nx()),x&&(lx(),px())}function hx(x){var a=X(x.inherit);if(!Object.size(a))return null;var b=ax.parents(".my-form").eq(0);if(!b.length)return null;var c=b.data("my");if(!c||!c.manifest)return null;var d=c.manifest,e=d.expose,f=!e;A(a).forEach(function(b){if(f||e[b]){var c=U(d,b);null!=c&&(/\./.test(b)||p(a[b])?B(!0,s,ox(c,p(a[b])?a[b]:b)):x[b]=c)}})}function ix(){A(N).forEach(function(x){A(o[x].listen).forEach(function(a){N[x].addClass("my-listen-"+Y(a))})}),G.radio&&ax.on("radio.my",function(x,a){var b,c;if(q(a)&&a.channel&&a.message&&t(G.radio[a.channel])){b=G.radio[a.channel];try{c=b.call(G,x,a)}catch(x){O("Radio handler for form "+l+" failed",x.message,x.stack)}void 0!==c&&(x.stopPropagation(),c&&gx(ax,a))}})}function jx(){r.strict||t(s.init)||Bx(s,!0),G=B(!0,G,Object.reject(s,["data"])),o=qx(B(!0,{},s.ui||{}),G,r),G.radio&&(G.radio=W(G.radio)),G.expose&&(G.expose=X(G.expose)),k=Number.random(268435456,4294967295).toString(16),j=s.id||"my"+k,l=Y(j),G.id=j,r.form=ax,s.params&&s.params.depth&&(r.recalcDepth=s.params.depth),Object.keys(G).forEach(function(x){"function"==typeof G[x]&&(G[x]=G[x].bind(G))}),c?G.my=wx(ax):Object.defineProperty(G,"my",{get:function(){return null==L&&(L=wx(ax)),L},enumerable:!1}),s.error&&(p(G.error)?S=function(x,a){return G.error.assign(B({message:x+"",err:a+""},G))}:t(s.error)&&(S=function(x,a){m=null;try{m=s.error.call(G,x,a)}catch(x){m=r.messages.initFailed}return m})),G.lang&&mx(G,r.locale||d),B(ax.data("my"),{id:j,cid:k,mid:l,errors:{},ui:o,disabled:!1,manifest:G,locFiles:[],modals:{},radio:{}}),ax.addClass("my-form"),v="my-manifest-"+l,y="my-form-"+k,ax.addClass(y+" "+v)}function lx(a){if(G.style&&(!a||ax.is(":visible"))){var b=vx(ax,G);b&&b[0].length&&!a&&((z=x("style#"+v)).length||(z=x(c(b[0],v)).appendTo(x("body"))),z.data("count",+z.data("count")+1),ax.data("my").style=z),b&&b[1].length&&((D=x("style#"+y)).length?a&&(x(c(b[1],y)).replaceAll(D),D=x("style#"+y)):(D=x(c(b[1],y)).appendTo(x("body")),r.restyle>-1&&!w[k]&&(w[k]=function(){lx(!0)}.debounce(r.restyle)),ax.data("my").restyle=lx.fill(!0).debounce(0)),ax.data("my").localStyle=D,a||ax.addClass("my-restyle"))}function c(x,a){var b="\n",c=/@keyframes/,d=!1,e=b+x.map(function(x){return/^\s*@/.test(x)||"}"==x?(c.test(x)?d=!0:"}"==x&&(d=!1),x):((d?"":"."+a)+x).replace(/\s+/g," ")}).join(b)+b;return'<style id="'+a+'" data-count="0">'+e+"</style>"}}function nx(){var x,a,c=!0;if(a=dx(G),p(a))yx("Error decoding base64 to local Blob/URL",a),c=!1;else{if(b)for(x=0;x<a.length;x++)M.push(G.files[a[x]].url);M.length&&(ax.data("my").locFiles=M)}return c}function px(){if(s.init!=E){$=ax.find(">*").clone();try{F=rx(G,s.init,ax,s)}catch(x){return yx(p(x)?x:x.message,x.stack),ax}}if(u(F)?F.then(function(){sx()},function(x,a){yx(x,a)}):sx(),!R){if(!ax.my())return yx("Internal error initializing controls.",""),ax;ax.data("my").initial=B(!0,{},I),x.mobile&&x.mobile.changePage(x.mobile.activePage)}}function sx(){var x={},a=Object.keys(o),b=a.length;function c(a){R||(x[a]=kx(xx(ax,a),E),(b-=1)<1&&tx(x))}b<1?ux():(ax.addClass(T),a.forEach(function(x){if(!R){var a=xx(ax,x),b=fx(a,ax,o[x],x);_[x]=a,u(b)?b.then(c.fill(x)).fail(function(a,b){yx("Error building "+x+", "+a,b)}):R||c(x)}}))}function tx(x){A(o).forEach(function(a){if(!R){var b,c=o[a],d=_[a];if(d.length){c.listen&&(N[a]=d.eq(0));try{null===(b=ex(I,null,c,d))&&null!=x[a]&&ex(I,x[a],c,d)}catch(x){O("Transient fail linking "+a+' of form $(".my-form-'+k+'")',x.message,x.stack)}try{null!=b&&kx(d,b),d.eq(0).trigger("check.my")}catch(x){yx("Error linking "+a,x.message)}}}}),R||ux()}function ux(){ax.removeClass(T),ax.on("recalc.my, redraw.my",function(x){x.stopPropagation(),ax.my("redraw")}),$=null,Q.resolve(I)}function yx(x,a){var b;if(R=!0,O("Form "+j+" failed to initialize.",x,a),Object.keys(_).forEach(function(x){delete _[x]}),ax.removeClass(T),b=S(x,a),p(b)||q(b)&&b.jquery?ax.html(b):!0===b&&ax.html($),r.silent)Q.resolve(I);else{if(!ax.my().ddata){if(ax.removeData("my"),ax.removeClass("my-form"),z)if("1"==z.data("count"))try{z.remove()}catch(x){}else z.data("count",z.data("count")-1);if(D)try{delete w[k],D.remove()}catch(x){}}Q.reject("Form "+j+" failed to initialize: "+x,a)}}}function vx(x,a){var b=[],c=[],d=a;return q(d)&&q(d.style)?(e(a.style,"",b,c),[b,c]):"";function e(b,c,d,g){var h,i,j,k,l=b,m=/@/.test(c),o=c.split("@")[0],r=t(l);if(m&&(r?g:d).push("@"+c.split("@")[1].trim()+" {"),p(l)&&(/[\r\n]/.test(l)||l.split("}",3).length>2?l=L.css2json(l):d.push(o+(/\{/.test(l)?l:"{"+l+"}"))),n(l)&&l.length)for(h=0;h<l.length;h++)e(l[h],o,d,g);else if(q(l))for(j=A(l),h=0;h<j.length;h++)for(k=f(o,j[h]),i=0;i<k.length;i++)e(l[j[h]],k[i],d,g);else if(t(l))try{e(l.call(a,x,a),o,g,g)}catch(x){}m&&(r?g:d).push("}")}function f(x,a){var b,c="",d=a+"";return(" "===d.to(1)||/^[a-z]/i.test(d))&&(c=" "),(b=d.split(/\s*,\s{0,}/).compact(!0)).length||b.push(""),b.map(function(a){return x+c+a})}}function wx(a){function b(b,c,d){var e=b?p(b)?xx(a,b):x(b):a;if(R(e))return e.trigger(c,d)}var c={ajax:function(){return G.apply(this,S(arguments))},cancel:b.fill(void 0,"cancel"),check:b.fill(void 0,"check"),commit:b.fill(void 0,"commit"),insert:function(x,a,c){var d="insert",e=!0;if(q(c)?b(x,d,{where:a,what:c}):p(x)?null==a&&null==c?b(a,d):q(a)?b(x,d,{where:1e6,what:a}):e=!1:q(x)&&(x.where&&x.what?b(null,d,x):b(null,d,{where:1e6,what:x})),!e)throw"Invalid insert"},modal:function(x,b){var c,d;return p(x)?(c=xx(a,x),(d=b).root||(d.root=a)):(c=a,d=x),c.modal(d)},now:I,parent:function(x){var b=a.parents(".my-form");return b.length?b.eq(0).my("manifest"):null},recalc:b.fill(void 0,"recalc"),root:function(){return a},trigger:b,val:function(x){return M.val.apply(xx(a,x),S(arguments,1))}};return N.forEach(function(x){"init"==x||c[x]||(c[x]=M[x].bind(a))}),c}function yx(x,a){var b=E,c=0,d="";return e(x,a,1),b;function e(x,a,f){A(a).forEach(function(g){if(null==b&&""!=g&&x.is(g)){d=d+(d?" ### ":"")+g;var h=a[g],i=q(h);if(f>c&&null!=h&&!i)return b=h,c=f,void 0;i&&e(x,h,f+1)}}),null==b&&null!=a[""]&&!q(a[""])&&f>c&&(b=a[""],c=f)}}function zx(x,a,b){var c,d,e,f,g,h,i,j,k,l=!1,m=!1,n=x,o=n.my(),q="";if(o){if(h=o.selector,(i=o.root).hasClass("my-form-init"))return{};if(j=xx(i,h),(l=x.hasClass("my-form"))?(c=x,d=o.ddata,e=o.dui,f=o.dparams):(c=o.container,d=o.data,e=o.ui,f=o.params),e.bind!=E){if(g=F(a)?a:kx(j,ex(d,E,e,j)),E!=e.check){q="Unknown error";try{q=Gx(d,g,e,j)}catch(x){O("Error "+x.message+" in .check validator for "+h,i,x.stack)}}var r=f.errorCss,u="ui-state-error";try{E!=a&&(g=kx(j,ex(d,a,e,j)))}catch(x){q=f.messages.formError||"Error"}if(E!=e.check)if(m=x.hasClass("my-form-list"),""==q&&(l||m||c.hasClass(r)))l?o.derrors[h]="":o.errors[h]="",c.removeClass(r),c.attr("title")&&c.attr("title",""),l||m||f.effect(xx(c,f.errorTip),!1,f.animate/2),n.removeClass(u),xx(n,".ui-widget").removeClass(u);else if(q){if(l)o.derrors[h]=q;else if(m)o.errors[h]=q;else{c.addClass(r),o.errors[h]=q;var v=xx(c,f.errorTip);v.length?f.effect(v.addClass(r).html(p(q)?q:"Error"),!0,f.animate):c.attr("title",(p(q)?q:"Error").stripTags())}n.hasClass("hasDatepicker")&&(n.is("input")?n.addClass(u):xx(n,".ui-widget").addClass(u)),n.hasClass("ui-slider")&&n.addClass(u)}}var w=a==E?g:a;e.css&&A(e.css).forEach(function(x){var a=e.css[x];s(a)?ix(a.test(w),j,x):t(a)&&ix(a.call(i.my().manifest,d,w,j),j,x)});var y,z,C=e.recalc,D=[],G={};if(b&&e.recalc&&i.my()){for(k=i.my().ui,y=0;y<C.length;y++)C[y]&&p(C[y])&&(z=C[y].compact())&&k[z]&&(k[z].recalc?-1===D.indexOf(z)&&D.push(z):G[z]=!0);for(y=0;y<D.length;y++)G=B(!0,G,zx(xx(i,D[y]),E,b-1));if(a!==E)return A(G).forEach(function(x){!0===G[x]&&x!=h&&(k[x].delay&&!k[x].recalc&&k[x]._update?k[x]._update(xx(i,x),E,b-1):zx(xx(i,x),E,b-1))}),{}}return G||{}}}function Ax(x,a,b){var c=$({maxWidth:80,tabChars:"",keyGap:" ",valueGap:" ",chain:!0,tinyObjLen:12,tabSubst:" ",allowFns:!0,allowJS:!1,alignJS:!0},"o"==N(a)?a:{});bx(a)&&(c.tabChars=a),cx(b)&&b>0&&(c.maxWidth=b);var d=cx(c.maxWidth)?_(c.maxWidth,8,1e4):80,e=bx(c.keyGap)?c.keyGap:" ",f=xx(e),g=bx(c.valueGap)?c.valueGap:" ",h=xx(g),i=c.tabSubst,j=bx(c.tabChars)?c.tabChars:"",k=/\t/.test(j+g+e),l=j.length,m=xx(j),n=!!c.allowFns,o=(c.untabFns,!!c.allowJS),p=!!c.alignJS,q="",r=[],s="",t=x,u=N(x),v=0,w=0,y=null,z=null,A=null,B="",C=0,D=0;if(!S(u))return null==u?void 0:P(O(x,null," ").replace(/,\n\s*/g,",").replace(/\n(\s)*/g,""));L(u);for(var E=r.length-1;E>0;E--)r[r[E].up].ctr+=1;var F;for(E=1;E<r.length-1;E++)G=r[E],F=r[E+1],(G.up==F.up&&F.t||!G.t&&F&&F.t&&F.up==r[G.up].up)&&(G.len+=1+h,G.val+=","+g),null===G.key||S(G.t)||(G.len+=f),w<G.lvl&&(w=G.lvl),o&&"f"==G.t&&(G.br=!0,G.val.indexOf("\n")>-1&&G.lvl>1&&r[G.up].ctr>1&&(G.len+=d));for(E=r.length-1;E>0;E--)r[r[E].up].len+=r[E].len;var G,H,I,J=Array(r.length);for(E=0;E<r.length;E++)if(G=r[E],I=E,J[E]=E,E&&S(G.t)&&G.len<=c.tinyObjLen){G.t="e",G.ctr=-1;do{H=r[++E],G.val+=(null!==H.key?H.key+":"+e:"")+H.val,r[E]=null}while(r[E+1]&&r[E+1].up>=I)}return(r=r.reduce(function(x,a){return null!==a&&x.push(a),x},[])).forEach(function(x,a){J[x.i]=a,a&&(x.up=J[x.up],x.i=a)}),q=Z(j,w+1),K(0),s;function K(x,a){a=!!a;var b,g=r[x],h=x+1,i="";if(s+=(a||!x?"":R(g.lvl))+(null!==g.key?g.key+":"+e:"")+g.val,!a&&g.lvl&&g.len<=d-(g.lvl-D)*m)for(var j=1;r[h]&&r[h].up>=x;h++)S((b=r[h]).t)&&(j+=1),s+=(null!==b.key?b.key+":"+e:"")+T(b,-j);else if("o"==g.t)for(;r[h]&&r[h].up==x;h++)if(b=r[h],a&&!b.t)c.chain?(s+=r[b.up].ctr>1||h-b.up==2?R(b.lvl):"",s+=b.val,D&&1==r[b.up].ctr&&h-b.up>2&&(D-=1)):s+=R(b.lvl)+b.val;else if(S(b.t))if(c.chain&&1==g.ctr&&b.lvl>1){var k=1;for(j=0;1==r[h-k].ctr&&k<=D+1&&!r[h-k].br;k++)j+=null==r[h-k].key?1:r[h-k].key.length+f+2;(j+=b.key.length+f+2+(b.lvl-k+1)*m)<=d-l?(D+=1,h=K(h,a=!0)):(D&&(r[h-1].br=!0),h=K(h,a=!1))}else h=K(h);else s+=R(b.lvl)+(null!==b.key?b.key+":"+e:"")+T(b);else if("a"==g.t)for(;r[h]&&r[h].up==x;h++)(b=r[h]).t&&!S(b.t)?b.br?(s+=i+R(b.lvl)+T(b),i=""):i.length?'"<'==b.val.substr(0,2)||xx(i)+b.len>d+1?(s+=i,i=R(b.lvl)+b.val):i+=b.val:i=R(b.lvl)+b.val:b.t?(s+=i,i="",h=K(h)):(s+=i+R(b.lvl)+b.val,i="");return h-1}function L(x){u=x,C=null==A?1:A.length+4+f,B="o"==x?"{":"[";M();y=r.length-1,v+=1;for(var a=y,b=z=u,c=t,d="o"==x?Object.keys(c):c,e=d.length,g=0;g<e;g++)A="o"==x?d[g]:null,B=c["o"==x?A:g],S(u=N(B))||"a"!=x&&void 0===B?"a"!=x&&void 0===B||(t=B,"o"!=u&&"a"!=u||L(u)):("u"==u&&(B=null),B=P(O(B)),"o"==x&&void 0!==B?(C=A.length+3+(B+"").length,M()):"a"==x&&(void 0===B&&(B="null"),C=(B+"").length,M()));y=a,z=b,u="",v-=1,A=null,C=1,B="o"==x?"}":"]",M(),null!=a&&(y=r[a].up,z=r[a].upt)}function M(){var x=null===A||o&&/^[a-zа-яα-ω$_][a-zа-яα-ω$_0-9]*$/i.test(A)&&!/^(async|break|c(ase|atch|lass|onst|ontinue)|de(bugger|fault|lete)|do|e(val|lse|num|xport|xtends)|Infinity)$/.test(A)&&!/^(arguments|f(alse|inally|or|unction)|i(f|mplements|mport|n(|stanceof|terface))|let|NaN|new|null|while|with)$/.test(A)&&!/^(p(ackage|rivate|rotected|ublic)|return|static|super|switch|t(his|hrow|rue|ry|ypeof)|undefined|var|void|yield)$/.test(A)?A:x=P(O(A));return r.push({i:r.length,lvl:v,up:y,upt:z,t:u,key:x,val:B,len:C,ctr:-1,br:!1}),r[r.length-1]}function N(x){var a=(typeof x)[0];return null==x?"u":"s"==a||"f"==a?a:"n"==a?isNaN(x)||!isFinite(x)?"u":a:ax(x)?"a":"[object Object]"==Y(x)&&"hasOwnProperty"in x?"o":"e"}function O(x,a,b){return o&&"f"==N(x)?p?V(Q(x)):Q(x):o&&dx(x)?x.toString():JSON.stringify(x,function(x,a){return"f"==N(a)?p?V(Q(a)):Q(a):a},b)}function P(x){return null==x?x:x.replace(/<\/scri/gi,"<\\u002fscri")}function Q(x){var a=x.toString();if(n&&/^[\r\n\s\t]*(async[\r\n\s\t]+)?function/.test(a))return a=W(a),o?a:P(a)}function R(x){return l?"\n"+q.substr(0,_(x-D,0,1e4)*l):""}function S(x){return bx(x)?"o"==x||"a"==x:null!=x&&("o"==x.t||"a"==x.t)}function T(x,a){return p&&"f"==x.t?U(x.val,x.lvl+(a||0)):x.val}function U(x,a){if(X(x))return x;var b=m?R(a):"\n";return x.match(/^.*$/gm).map(function(x,a){return a?b+x:x}).join("")}function V(x){if(X(x))return x;var a=x.match(/^.*$/gm),b=i.length||2;if(a.length<2)return x;var c=a[a.length-1].replace(/\t/g,i).match(/^\s*/)[0].length;return c?a.map(function(x){var a=0,d=!1;return x.split("").map(function(x){return"\t"!=x&&" "!=x&&(d=!0),d?x:(a+="\t"==x?b:1)<=c?"":(d=!0,x)}).join("")}).join("\n"):x}function W(x){var a=/\)([\s\n\r\t]+?|\/{1,10}.*?\*\/|\/\/[^\n\r]{0,200}[\n\r]){0,20}?\{/,b=x.split(a,1)[0],c="async"==b.substr(0,5),d=b.substr(c?14:8).replace(/[\s\n\r\t]+?|\/{1,10}.*?\*\/|\/\/[^\n\r]{0,200}[\n\r]/g,"")+")",e="{"+x.substr(b.length).replace(a,"").replace(/}[^}]+$/,"}");return((c?"async ":"")+"function "+d).replace(/function\sanonymous/,"function ")+" "+e}function X(x){return!bx(x)||x.indexOf("`")>-1}function Y(x){return Object.prototype.toString.call(x)}function Z(x,a){for(var b="",c=0;c<a;c++)b+=x;return b}function $(x,a){return Object.keys(a).forEach(function(b){x[b]=a[b]}),x}function _(x,a,b){return Math.min(Math.max(x,a),b)}function xx(x){return k?x.replace(/\t/g,i).length:x.length}function ax(x){return Array.isArray(x)}function bx(x){return"s"==N(x)}function cx(x){return"n"==N(x)}function dx(x){return!ax(x)&&"[object RegExp]"==Y(x)}}function Bx(x,a){var b=!a;A(x).forEach(function(a){Cx(a,x,b)})}function Cx(x,a,b){var c,d,e,f="";if(b||!/^(data|files|require)$/.test(x))if(c=a[x],f=D(c),/^(ob|ar)/.test(f))Bx(c);else{if("string"!=f)return;if(/^function(\(|[\s\n\t]+)/.test(c)){if(null==(d=c.match(/^function([\s\n\t]+[\wа-яА-Яα-ωΑ-Ω_$][\wа-яА-Яα-ωΑ-Ω\d_$]*)?[\s\n\t]*\(([^\)]*)\)\s*\{([\s\S]*)\}[\s\n\r\t]*$/))||4!=d.length)return;"function"==typeof(e=Dx(d[1]?d[1].replace(/[\s\n\t]/g,""):"",d[2],d[3]))?a[x]=e:O("Invalid function in XJSON, skipped",e.message,e.stack,c)}else if(/^async\sfunction(\(|[\s\n\t]+)/.test(c)){if(null==(d=c.match(/^async\sfunction([\s\n\t]+[\wа-яА-Яα-ωΑ-Ω_$][\wа-яА-Яα-ωΑ-Ω\d_$]*)?[\s\n\t]*\(([^\)]*)\)\s*\{([\s\S]*)\}[\s\n\r\t]*$/))||4!=d.length)return;Ex(d[1]?d[1].replace(/[\s\n\t]/g,""):"",d[2],d[3]),"function"==typeof e?a[x]=e:O("Invalid function in XJSON, skipped",e.message,e.stack,c)}else if(/^new\sRegExp\(/.test(c)&&")"==c.substr(-1)){if(null==(d=c.match(/^new\sRegExp\s*\(\/([\s\S]+)\/([a-z]*)\)$/))||3!=d.length)return;"function"==typeof(e=Fx(d[1],d[2])).test?a[x]=e:O("Invalid RegExp in XJSON, skipped",e.message,e.stack,c)}}}function Dx(x,a,b){var c;try{c=new Function("","return (function "+x+"("+a+"){"+b+"});")()}catch(x){c={message:x.message,stack:x.stack}}return c}function Ex(x,a,b){var c;try{c=new Function("","return (async function "+x+"("+a+"){"+b+"});")()}catch(x){c={message:x.message,stack:x.stack}}return c}function Fx(x,a){var b;try{b=new RegExp(x,a)}catch(x){b={message:x.message,stack:x.stack}}return b}function Gx(a,b,c,d){var e,f,g,h=c.check,i=0;if(h!=E){var j=V(d).params.messages,k=c.error,l=k||j.patternMismatch||j[""]||"Error";if(d.length&&Object.prototype.hasOwnProperty.call(d[0],"validity")&&!d[0].validity.valid){var m=d[0].validationMessage+"";return""!==m?m.substr(0,1).toUpperCase()+m.substr(1):(e=d[0].validity,A(e).forEach(function(x){""===m&&"valid"!=x&&o(e[x])&&e[x]&&j[x]&&(m=j[x])}),m||k)}switch(D(h).substr(0,1)){case"f":return null==(g=h.call(V(d).manifest,a,b,d))?"":g;case"r":return h.test(b+"")?"":l;case"a":return h.indexOf(b)>-1?"":l;case"s":return b==h?"":l;case"o":return h[b]?"":l;case"b":return d.hasClass("my-form-list")?(f=d.data("listSrc")||d.data("my").listSrc||">*",g={},i=0,(">*"==f?x(d[0].children):xx(d,f,!0)).each(function(a){var b=x(this);b.hasClass("ui-sortable-placeholder")||(b.data("my")&&!b.my("valid")&&(g[i]=b.my("errors")),i+=1)}),g):d.hasClass("my-form")&&h?d.my("valid")?"":d.my("errors"):""}return j.formError||"Error"}return""}}(jQuery),function(x){var a=x.extend,b="string",c="function",d=Object.isArray,e=(Object.isBoolean,Object.isString),f=Object.isObject,g=(Object.isNumber,Object.isRegExp,Object.isFunction,Object.keys),h='<input type="',i={tmpl:{num:h+'number" {ext}/>',inp:h+'text" {ext}/>',sli:h+'range" {ext}/>',dat:h+'date" {ext}/>',btn:h+'button" {ext}/>',pwd:h+'password" {ext}/>',but:"<button {ext}>{txt}</button>",div:"<div {ext}>{txt}</div>",spn:"<span {ext}>{txt}</span>",sel:"<select {ext}>{txt}</select>",mul:'<select {ext} multiple="multiple">{txt}</select>',txt:"<textarea {ext}>{txt}</textarea>",err:' <span class="my-error-tip {class}" style="{style}">{txt}</span>',msg:'<div class="my-error-tip {class}" style="{style}">{txt}</div>',val:function(x){if(!d(x.vals))return"";var b=a({style:"",css:""},x);return b.txt=x.vals.reduce(function(x,a){return x+"<span class=\"my-shortcut\" onclick=\"$(this).parents('.my-row').find('input,textarea').val($(this).text()).trigger('blur')\">"+a+"</span> "}," "),'<span class="my-shortcuts {css}" style="{style}">{txt}</span>'.assign(b)},"":"<{_tag} {ext}>{txt}</{_tag}>"},txt:{sel:function(x){if(!x.vals)return"";var a=k(x.vals);return g(a).reduce(function(x,b){return x+'<option value="'+b+'">'+a[b]+"</option>"},"")}},params:{styles:{num:"width:30%;",dat:"width:30%;",inp:"width:100%",pwd:"width:100%",txt:"width:100%;max-width:100%;min-height:1px;word-break:break-word;",err:"display:none",msg:"display:none"},alias:{number:"num",date:"dat",slider:"sli",textarea:"txt",input:"inp",span:"spn",select:"select",vals:"val"},row:"",rowTag:"div",rowCss:"my-row",label:"",labelTag:"span",labelCss:"my-label"},defaults:{id:"",class:"",style:"",placeholder:"",value:"",rows:1},attnames:{css:"class",plc:"placeholder",val:"value",txt:"",vals:"",tip:"title"}};function j(x,h,j){if(e(h))return x+h;if(f(h))return a(!0,j,h),x;if(d(h)&&h.length>1&&e(h[1])){for(var k,l,m,n,o,p,q,r=h[0],s="",t=1;t<h.length;){if(e(h[t]))if(m=(n=h[t].replace(/\s/g,"")).split(/[\.#]/i),l=j.alias[m[0]]||m[0],k=n.substr(m[0].length),/^[a-z0-9]+(#[a-z0-9\-_]+)?(\.[a-z0-9\-_]+)*$/i.test(n)){p=i.tmpl[l]||i.tmpl[""],o={style:"",class:"",txt:""},q="";var u=f(h[t+1]);u&&g(h[t+=1]).forEach(function(x){""!=i.attnames[x]&&(o[i.attnames[x]||x]=h[t][x])}),o.style||o.class||!j.styles[l]||(o.style=j.styles[l]),o.id||"#"!=k.to(1)||(o.id=k.from(1).split(".")[0]),!o.class&&/\./.test(k)&&(o.class=("#"==k.to(1)?k.substr(o.id.length+1):k).split(".").compact(!0).join(" ")),g(o).forEach(function(x){q+=x+'="'+o[x]+'" '}),u&&g(h[t]).forEach(function(x){""===i.attnames[x]&&(o[x]=h[t][x])}),o.ext=q,!o.txt&&i.txt[l]&&(o.txt=i.txt[l](o)),o._tag=l,s+=typeof p==c?p(o)||"":typeof p==b?p.assign(o):""}else s+=h[t];t+=1}return s&&(s="<"+j.rowTag+' class="'+j.rowCss+'" '+(j.row?'style="width:'+j.row+"; ":"")+(j.label&&r?"padding-left:"+j.label+"; ":"")+'">'+(r?"<"+j.labelTag+' class="'+j.labelCss+'" '+(j.label?'style="display:inline-block;width:'+j.label+";margin-left:-"+j.label+'" ':"")+">"+r+"</"+j.labelTag+">":"")+s+"</"+j.rowTag+">"),x+s}return x}function k(x){var a=x;if(e(a)&&(a=a.split(/[\s,]/).compact(!0)),d(a)){for(var b={},c=0;c<a.length;c++){var h=a[c];if(f(h)){var i=g(h);1==i.length?b[i[0]]=h[i[0]]+"":b[h.id||h.key||h.name||""]=h.text||h.value||h.title||""}else b[h]=h+""}a=b}return f(a)?a:{}}function l(b,c){var g={},h=e(b)?b.lines().map(function(x){return x.replace(/^[\t\s]*/,"")}):b;return d(h)?(a(!0,g,i.params,c||{}),h.length?h.reduce(j.fill(void 0,void 0,g),""):""):f(h)?(x.extend(i,h),void 0):""}var m={init:function(a,b){return x(this).html(l(a,b))}};x.my||(x.my={}),x.my.formgen=l,x.fn.formgen=function(a){return e(a)&&m[a]?m[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?(x.error("Method "+a+" does not exist on jQuery.formgen"),void 0):m.init.apply(this,arguments)}}(jQuery),function(x){var a,b,c={},d="body",e=!1,f=x.extend,g={},h=x.my.f.indom,i=(Object.isArray,Object.isBoolean),j=Object.isString,k=Object.isObject,l=Object.isNumber,m=(Object.isRegExp,Object.isFunction);if(x.fn.modal&&m(x().emulateTransitionEnd)&&(b=x.fn.modal),x(document).off(".modal"),x(document).on("keydown.modal",function(x){var a,b,c=x.keyCode;if(!1!==e&&(13===c||27===c)){if(a=(b=e.data("modal")).form,27==c&&(b.esc||Object.equal(a.data("my").initial,a.my("data"))))return e.modal(!0),!1;if(13==c&&b.enter)return function(x){x.modal()}.fill(e).delay(50),!1}}),m(x.my.f.getref(x,"my.modal.parent"))){var n=x.my.f.getref(x,"my.modal.parent")().attr("id");n&&(d="#"+n)}function o(a,b,c,d){var e,g,h,i,l,m,n;if("object"==typeof b&&b.jquery)b.is("img")&&(m=b,l=b.attr("alt")||b.attr("title")||b.data("text")||"",g=m[0].naturalWidth||m[0].width,(e=m[0].naturalHeight||m[0].height)<1&&(e=1),g<1&&(g=1),i=x(window).width()-90,(h=x(window).height()-90)<e&&(g=g*(h/e)|0,e=h),i<g&&(e=e*(i/(g=i))|0),n=g<300?300:g,f(a,{source:"image",manifest:{init:function(x){x.html(this.HTML),x.on("click.my","img:eq(0)",function(){x.trigger("cancel")})},HTML:'<img src="" class="db" style="max-width:'+g+"px;max-height:"+e+'px"><h4 class="mt10"></h4>',ui:{"img:eq(0)":"img",h4:{bind:"text",css:{hide:function(x,a){return!a}}}}},data:{img:m.attr("src"),text:l},esc:!0,screen:!0,width:d||n,focus:!1,global:!0,z:"1995"},c));else if(k(b)&&b.manifest)f(a,b,c);else{if(!j(b))return null;f(a,{source:"html",manifest:{init:function(x){x.html(this.HTML)},HTML:b,ui:{"div:eq(0)":function(){}}},data:{},esc:!0,focus:!1,width:d},c)}return a}c.modal=function(a,b,c){var f,g={},h=x(d),j=h.find(">.my-modal-proxy"),k={global:!0,screen:!0,done:m(b)?b:void 0,z:"1995"};return i(a)||null==a?j.modal(a):(f=x.Deferred(),o(g,a,k,c)?e?f.reject("Locked").promise():(j.length||(j=x('<div class="my-modal-proxy"></div>').prependTo(h)).css({position:"absolute",top:"0",left:"0",margin:"0",padding:"0",width:"1px",height:"0"}),j.modal(g)):f.reject("Invalid data").promise())},c.modal.loading=function(a){x(d).find(">.my-modal").toggleClass("my-modal-loading",!!a)},c.modal.parent=function(a){if(!a||!x(a).length)return x(d);d=a},c.modal.parentBack=function(b){if(!b||!x(b).length)return x(a||d);a=b},c.modal.visible=function(){return!!e},x.my||(x.my={}),x.my.modal=c.modal,x.fn.modal=function(c,n,p){if(b){if(void 0===c&&void 0===n&&void 0===p)return b.call(this);if(k(c)&&(c.hasOwnProperty("backdrop")||c.hasOwnProperty("keyborad")||c.hasOwnProperty("show")))return b.call(this,c,n);if(j(c)&&/^(toggle|show|hide|handleUpdate)$/.test(c))return b.call(this,c,n)}var q,r,s,t,u,v,w=x.Deferred(),y={},z=this,A=0,B=m(n)?n:function(){return!1},C=k(c)?c:{},D=z.data("modal");if(f(z,w.promise()),D){if(null==c||i(c))return E(c),z;if(C)return I("Locked"),z}return z.is(":visible")?(C=o(y,c,{}))?C.global&&e?(I("Locked"),z):((D=f({type:"DOM",source:"manifest",form:null,modal:null,root:null,bgroot:null,caller:z,manifest:{},data:{},global:!1,screen:!1,drag:!1,focus:!0,close:!0,silent:!0,esc:!1,enter:!1,bound:!1,hardClose:!0,nose:"",width:p||300,height:null,x:"0",y:"0",z:"1901",background:"white",css:"",animate:200},C,{promise:w.promise(),cid:Number.random(268435456,4294967295).toString(16)})).done=m(D.done)?D.done:B,j(D.align)&&D.align&&(D.x=(D.align.match(/(left|right):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0],D.y=(D.align.match(/(top|bottom):\-?\d+(\.\d+)?(%|px)?/g)||["0"])[0]),D.width=1*(x.my.f.getref(j(D.manifest)?x.my.cache(D.manifest):D.manifest,"params.width")||D.width),D.type="DOM",z.hasClass("my-form")?(D.type="form",D.root=D.root||z):z.data("my")?(D.type="control",D.root=D.root||z.my().root):(D.root=D.root||z.parents(".my-form").eq(0),D.root.length||(D.root=x(d))),D.global?(D.root=x(d),D.bgroot=x(a||d)):D.bgroot=D.bgroot?x(D.bgroot):D.root,(s=D.root).data("modals")||s.data("modals",{}),F(),q=x('<div class="my-modal my-modal-init my-modal-'+(D.global?"fullscreen ":"overlay ")+D.css+(D.nose?" nose-"+D.nose:"")+'"></div>'),D.root.find(">.my-modal").length?q.insertAfter(D.root.find(">.my-modal").last()):q.prependTo(D.root),q.addClass("my-modal-"+D.cid),A=q.outerWidth(),q.hide(),q.html('<div class="my-modal-form"></div>'),r=q.find(".my-modal-form"),D.close&&x(j(D.close)?D.close:'<div class="my-modal-close" title="Close">×</div>').prependTo(q).on("click.my",function(){E(D.hardClose)}).css({"z-index":("+"===(D.z+"").to(1)?"+":"")+(1*D.z+1)}),t=D.bgroot.find(">.my-modal-screen"),D.screen&&(t.length||(t=x('<div class="my-modal-screen" style="display:none;"></div>').prependTo(D.bgroot)),D.esc&&t.on("click.my"+D.cid,function(){z.modal(!0)}),t.toggleClass("my-modal-screen-global",!!D.global)),z.data("modal",D),D.silent&&q.on("change.my",function(){return!1}),q.css({display:"block",height:"none",opacity:"0.005","z-index":D.z,width:"auto"}),D.global?q.css({position:"fixed",left:"50%",top:D.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":D.z,width:"auto","margin-left":"-"+((D.width+A)/2).round(0)+"px"}):q.css({position:"absolute",left:D.pos.vx+"px",top:D.pos.vy+"px",display:"block",height:"none",opacity:"0.005","z-index":D.z,width:"auto"}),r.my(D.manifest,D.data).then(function(){var a,b,c;if(f(D,{form:r,bg:t,cancel:function(){E(!0)},commit:function(){E()}}),q.data("modal",D),D.height=q.outerHeight(),"manifest"!==D.source&&(D.width=q.width()),F(),q.css({top:D.pos.vy+"px"}),G(!0),q.removeClass("my-modal-init"),s.data("modals")[D.cid]=D,g[D.cid]=w,r.on("commit.my",function(){return D.commit.delay(30),!1}).on("cancel.my",function(){return D.cancel.delay(30),!1}),q.on("layout.my",function(){G()}.debounce(30)),D.global&&(e=z,x(document.body).css({overflow:"hidden"})),D.global||!D.esc&&!D.enter||r.on("keydown.my",function(a){var b=a.keyCode;return 27==b&&D.esc?(D.cancel(),!1):13==b&&D.enter&&!x(a.target).is("textarea")?(D.commit.delay(50),!1):void 0}),!0===D.focus?(b=!1,c=D.manifest.ui,Object.keys(c||{}).forEach(function(x){if(!b){var a=r.find(x);a.length&&a.is("input, textarea, button")&&(b=!0,a.focus())}})):j(D.focus)&&r.find(D.focus).focus(),(a=r.find("img").filter(function(){return""!=x(this).attr("src")})).length){var d=function(){"manifest"!==D.source&&q.css({width:"auto"}),G()}.after(a.length);a.each(function(){x(this).bind("load",d)})}D.drag&&x.fn.draggable&&(j(D.drag)?q.draggable({handle:D.drag}):q.draggable(),D.nose&&q.on("dragstart.my",function(){q.removeClass("nose-"+D.nose)})),q.on("mousedown.my",function(a){var b=[],c=x(a.currentTarget),d=c.parent(),e=+c.css("z-index"),f=e;d.length&&(d.find(">.my-modal").each(function(c,d){var g=+x(d).css("z-index")||0;d!=a.currentTarget&&g>=e&&b.push([g,x(d)]),g>f&&(f=g)}),b.forEach(function(x){x[1].css("z-index",x[0]-1+"")}),c.css("z-index",f+""))}),w.notify("Ready")}).fail(function(x){try{H()}catch(x){}z.data("modal",null),w.reject(x)}),z):(I("Invalid data"),z):(I("Object must be visible"),z);function E(x){if(r=D.form,t=D.bg,s=D.root,B=D.done,u=r.my("data"),v=!1,x){try{B.call(r.my("manifest"),null,null)}catch(x){}try{h(r)&&H()}catch(x){}if(h(z)&&z.removeData("modal"),g[D.cid])try{g[D.cid].reject("Cancelled")}catch(x){}delete g[D.cid],D=null}else{try{v=B.call(r.my("manifest"),r.my("valid")?null:r.my("errors"),u)}catch(x){}if(!v){try{h(r)&&H()}catch(x){}h(z)&&z.removeData("modal"),function(){if(g[D.cid])try{g[D.cid].resolve(u)}catch(x){}delete g[D.cid],D=null}.delay(0)}}}function F(){var a,b,c=window,d=!!D.global,e=s.offset(),f=z.offset(),g=s.scrollTop();D.pos={px:e.left,py:e.top,pw:s.outerWidth(),ph:s.outerHeight(),ox:f.left,oy:f.top,ow:z.outerWidth(),oh:z.outerHeight(),ww:b,wh:a};var h=1*(D.x.match(/\-?\d+(\.\d+)?/)||[0])[0],i=1*(D.y.match(/\-?\d+(\.\d+)?/)||[0])[0],j=D.x.has("left")?-1:D.x.has("right")?1:0,k=D.y.has("top")?-1:D.y.has("bottom")?1:0,m=D.pos.ox+D.pos.ow/2-D.pos.px,n=D.pos.oy+D.pos.oh/2-D.pos.py;if(d&&(D.pos.wh=a=c.innerHeight||x(c).height(),D.pos.ww=b=c.innerWidth||x(c).width(),m=b/2,n=a/2.5),h=D.x.has("%")?D.pos.ow/100*h:h,i=D.y.has("%")?D.pos.oh/100*i:i,D.pos.pix=m,D.pos.piy=n,m=m+j*(D.pos.ow/2)+h*(j>0?-1:1)-(D.width+A)*(j+1)/2,d?(n=(a-D.height-20)/3)<10&&(n=10):n=n+k*(D.pos.oh/2)+i*(k>0?-1:1)-(D.height||0)*(k+1)/2,m=m.round(1),n=(n+g).round(1),D.pos.vx=m,D.pos.vy=n,!1!==D.bound&&!D.global){var o=(l(D.bound)?D.bound:0).clamp(-100,100);D.pos.pw-2*o<D.width+A?D.pos.vx=-(D.width+A-D.pos.pw)/2:D.pos.vx+D.width+A>D.pos.pw-o?D.pos.vx=D.pos.pw-o-D.width-A:D.pos.vx<o&&(D.pos.vx=o),D.pos.ph-2*o<D.height?(D.pos.vy=o,D.height=D.pos.ph-2*o):D.pos.vy+D.height>D.pos.ph-o?D.pos.vy=D.pos.ph-o-D.height:D.pos.vy<o&&(D.pos.vy=o)}}function G(a){if(a||(D.height=q.outerHeight(),"manifest"!==D.source&&(D.width=q.width()),F()),q.css({width:D.width+A+"px",display:"block"}),D.global)q.css({left:"50%","margin-left":"-"+((D.width+A)/2).round(0)+"px"});else if(q.css({left:D.pos.vx+"px"}),D.nose){x("style#my-modal-style-"+D.cid).length||q.append('<style id="my-modal-style-'+D.cid+'"></style>');var b="",c=x("style#my-modal-style-"+D.cid);"top"==D.nose||"bottom"==D.nose?(b+="div.my-modal-"+D.cid+".nose-"+D.nose+":before {left:"+(D.pos.ox-D.pos.px+D.pos.ow/2-D.pos.vx)+"px!important;}",c.text(b)):"left"!=D.nose&&"right"!=D.nose||(b+="div.my-modal-"+D.cid+".nose-"+D.nose+":before {top:"+(D.pos.oy-D.pos.py+D.pos.oh/2-D.pos.vy)+"px!important;}",c.text(b))}D.screen?D.global?(t.css({top:0,left:0,width:"100%",height:"100%",display:"block",position:"fixed","z-index":D.z-1}),j(D.screen)?t.css({background:D.screen?D.screen:"rgba(18,41,72,0.88)"}):t.css({background:D.screen?"rgba(18,41,72,0.88)":""})):t.css({top:0,left:0,position:"absolute",width:t.parent().outerWidth()+"px",height:t.parent().outerHeight()+"px",display:"block",background:j(D.screen)?D.screen:"rgba(255,255,255,0.6)","z-index":D.z-1}):t.length&&t.hide(),D.height>D.pos.wh?(q.height(D.pos.wh-30),r.css({"overflow-y":"scroll"})):r.css({"overflow-y":""}),q.animate({top:D.pos.vy+"px",opacity:"1"},D.animate)}function H(){try{r.my("remove")}catch(x){}try{s.data("modals")[D.cid]=null}catch(x){}r.parent().off(".my").remove(),h(t)&&t.off(".my"+D.cid),D.screen&&h(t)&&function(x){x&&e||t.hide(),x&&!e&&t.css({background:"rgba(18,41,72,0.88)"})}.delay(50,D.global),D.global&&(e=!1,x(document.body).css({overflow:""}))}function I(x){try{B(null,null)}catch(x){}(function(){w.reject(x)}).delay(0)}}}(jQuery);