text: /*
  
   jquery.struts2.js
  
   Integration of jquery and jquery ui with struts 2
   for ajax, widget and interactions support in struts 2
  
   Requires use of jQuery.
   Tested with jQuery 2.1 and jQuery UI 1.11
  
   Copyright (c) 2008 Eric Chijioke (obinna a-t g mail dot c o m)
   Copyright (c) 2010 - 2015 Johannes Geppert http://www.jgeppert.com
  
   Dual licensed under the MIT and GPL licenses:
     http://www.opensource.org/licenses/mit-license.php
     http://www.gnu.org/licenses/gpl.html
  
  */
  'use strict';(function(f,v){f.struts2_jquery={debug:!1,debugPrefix:"[struts2_jquery] ",ajaxhistory:!1,loadAtOnce:!1,local:"en",gridLocal:"en",timeLocal:"en",datatablesLocal:"en",minSuffix:".min",historyelements:{},forms:{},scriptCache:{},styleCache:{},defaults:{indicator:"",loadingText:null,errorText:null},handler:{load:"_s2j_container_load",form:"_s2j_form_submit",effect:"_s2j_effects"},currentXhr:{},log:function(b){this.debug&&(b=this.debugPrefix+b,window.console&&window.console.log?window.console.log(b):
  window.opera&&window.opera.postError&&window.opera.postError(b))},escId:function(b){return"#"+b.replace(/(:|\.)/g,"\\$1")},addParam:function(b,a){return 0<b.indexOf("?")?b+"\x26"+a:b+"?"+a},changeParam:function(b,a,d){b=b.split("?");var e=b[1].split("\x26"),c=[],g;for(g=0;g<e.length;g++)c=e[g].split("\x3d"),c[0]===a&&(e[g]=c[0]+"\x3d"+d);return b[0]+"?"+e.join("\x26")},require:function(b,a,d){var e=this,c,g;c=a||function(){};g=d||null;null!==g||f.scriptPath?null===g&&f.scriptPath&&(g=f.scriptPath):
  g="";"string"===typeof b&&(b=b.split(","));f.each(b,function(a,b){b=e.addParam(b,"s2j\x3d"+f.struts2_jquery.version);f.struts2_jquery.scriptCache[b]||(e.log("load require script "+(g+b)),f.ajax({type:"GET",scriptCharset:"UTF-8",url:g+b,success:c,dataType:"script",cache:!0,async:!1}),f.struts2_jquery.scriptCache[b]=!0)})},requireCss:function(b,a){if(!this.styleCache[b]){var d,e;d=a||null;null!==d||f.scriptPath?null===d&&f.scriptPath&&(d=f.scriptPath):d="";this.log("load require css "+(d+b));e=document.createElement("link");
  e.setAttribute("rel","stylesheet");e.setAttribute("type","text/css");e.setAttribute("href",d+b);document.getElementsByTagName("head")[0].appendChild(e);this.styleCache[b]=!0}},hideIndicator:function(b){b&&f(this.escId(b)).hide();""!==this.defaults.indicator&&f(this.escId(this.defaults.indicator)).hide()},showIndicator:function(b){b&&f(this.escId(b)).show();""!==this.defaults.indicator&&f(this.escId(this.defaults.indicator)).show()},abortReq:function(b){(b=this.currentXhr[b])&&null!==b&&4>b.readyState&&
  b.abort()},validateForm:function(b,a){var d=this,e=!0,c={};d.loadAtOnce||d.require("js/plugins/jquery.form"+d.minSuffix+".js");c.type="POST";c.data={"struts.enableJSONValidation":!0,"struts.validateOnly":!0};c.url=a.href&&"#"!==a.href?a.href:b[0].action;a.hrefparameter&&(c.url=c.url+"?"+a.hrefparameter);c.cache=!1;c.async=!1;c.complete=function(c,h){var k=f(b[0]),l=c.responseText;f.isFunction(a.validateFunction)?l&&10<l.length&&(e=!1,l="/*"===l.substring(0,2)?f.parseJSON(l.substring(2,l.length-2)):
  f.parseJSON(l),a.validateFunction(k,l)):void 0!==StrutsUtils&&(StrutsUtils.clearValidationErrors(b[0]),l="/*"===l.substring(0,2)?StrutsUtils.getValidationErrors(l):StrutsUtils.getValidationErrors(f.parseJSON(l)),l.fieldErrors||l.errors)&&(StrutsUtils.showValidationErrors(b[0],l),e=!1);d.log("form validation : "+e)};b.ajaxSubmit(c);return e},addForms:function(b,a){var d=this;b&&(d.loadAtOnce||d.require("js/plugins/jquery.form"+d.minSuffix+".js"),f.each(b.split(","),function(b,c){var g=f(d.escId(c)).formSerialize();
  a=d.addParam(a,g)}));return a},pubTops:function(b,a,d){var e=this;return d?function(c,g){var f={};f.event=c;f.ui=g;e.publishTopic(b,d,f);e.publishTopic(b,a,f)}:null},subscribeTopics:function(b,a,d,e){a&&b&&f.each(a.split(","),function(a,f){b.isSubscribed(f)&&b.destroyTopic(f);b.subscribe(f,d,e)})},publishTopic:function(b,a,d){var e=this;a&&f.each(a.split(","),function(a,f){e.log("publish topic : "+f);b.publish(f,b,d)})},pubSuc:function(b,a,d,e,c,g){var h=this,k=f(b),l,m,n=null,p=0,t=!1;return function(b,
  e,u){var q={};q.data=b;q.status=e;q.request=u;if("html"===c&&!f.isArray(b)&&!f.isPlainObject(b))k.html(b);else if("value"===c)k.val(f.trim(b));else if("select"===c||"radio"===c||"checkbox"===c)if("select"===c?k[0].length=0:k.children().remove(),f.isPlainObject(b)||f.isArray(b))l=-1,"select"===c&&(g.headerkey&&g.headervalue&&(n=f('\x3coption value\x3d"'+g.headerkey+'"\x3e'+g.headervalue+"\x3c/option\x3e"),g.value===g.headervalue&&n.prop("selected",!0),n.appendTo(k)),g.emptyoption&&f("\x3coption\x3e\x3c/option\x3e").appendTo(k)),
  null!==b[g.list]&&(f.isArray(b[g.list])||(t=!0),f.each(b[g.list],function(a,d){var e,h,r,q,s;if("radio"===c||"checkbox"===c)e=g.name;t?(h=d,r=a):void 0!==g.listkey&&void 0!==g.listvalue?(h=d[g.listvalue],r=d[g.listkey],void 0!==g.listtitle&&(q=d[g.listtitle])):(h=b[g.list][p],r=b[g.list][p]);void 0!==g.value&&g.value==r&&(s=!0);"select"===c?(n=f('\x3coption value\x3d"'+r+'"\x3e'+h+"\x3c/option\x3e"),s&&n.prop("selected",!0),void 0!==q&&n.prop("title",q),n.appendTo(k)):(m=++l,"radio"===c?n=f('\x3cinput name\x3d"'+
  e+'" type\x3d"radio" id\x3d"'+e+m+'" value\x3d"'+r+'"\x3e\x3c/input\x3e'):"checkbox"===c&&(n=f('\x3cinput name\x3d"'+e+'" type\x3d"checkbox" id\x3d"'+e+m+'" value\x3d"'+r+'"\x3e\x3c/input\x3e')),s&&n.prop("checked",!0),k.append(n),k.append(f('\x3clabel id\x3d"'+e+m+'label" for\x3d"'+e+m+'"\x3e'+h+"\x3c/label\x3e")));p++}));d&&(h.publishTopic(k,d,q),h.publishTopic(k,a,q))}},pubCom:function(b,a,d,e,c,g){var h=this,k=f.struts2_jquery_ui,l=f(b);return function(b,n){var p={};p.request=b;p.status=n;h.hideIndicator(c);
  h.publishTopic(l,d,p);h.publishTopic(l,a,p);e||(e=g.id);e&&f.each(e.split(","),function(a,b){f(h.escId(b)).publish("_sj_div_effect_"+b+g.id,g)});k&&g.resizable&&k.resizable(l,g)}},pubErr:function(b,a,d,e,c){var g=this,h=f(b);return d||e?function(b,f,m){var n={};n.request=b;n.status=f;n.error=m;if("html"===c||"value"===c)e&&"false"!==e?h.html(e):null!==g.defaults.errorText&&h.html(g.defaults.errorText);g.publishTopic(h,d,n);g.publishTopic(h,a,n)}:null},preBind:null,postBind:null,bind:function(b,a){var d,
  e;if(b&&(d=f(b),b=d[0],e=b.tagName.toLowerCase(),a.tagname=e,"function"!==typeof this.preBind||this.preBind(d))&&(a.jqueryaction||(a.jqueryaction=e),this.log("bind "+a.jqueryaction+" on "+a.id),this[a.jqueryaction](d,a),this.postBind&&"function"===typeof this.postBind))return this.postBind(b)},jqueryaction:function(b,a){b&&a&&(this[b]=a)},history:function(b,a,d){var e=this,c={};c.target=d;c.topic=a;b.bind("click",c,function(b){e.historyelements[b.data.target]=b.data.topic;e.lasttopic=a;f.bbq.pushState(e.historyelements);
  return!1});f(window).bind("hashchange",c,function(a){var b=a.getState(a.data.target)||"";f.each(a.fragment.split("\x26"),function(c,d){var m=d.split("\x3d");e.historyelements[m[0]]!==m[1]&&m[1]!==e.lasttopic&&(e.lasttopic=b,f.publish(m[1],a.data.options))})})},action:function(b,a,d,e){var c=this,g="_sj_action_"+a.id,h=a.href,k={};a.actionTopic=g;if(null===h||""===h)a.href="#";k.effect=a.effect;k.effectoptions=a.effectoptions;k.effectmode=a.effectmode;k.oneffect=a.oneffect;k.effectduration=a.effectduration;
  a.datatype&&!a.targets&&"json"===a.datatype&&(a.targets="false");a.targets?f.each(a.targets.split(","),function(e,h){k.targets=h;var n=f(c.escId(h));0===n.length&&(n=b);c.subscribeTopics(n,g+h,d,a);c.subscribeTopics(n,"_sj_div_effect_"+h+a.id,c.handler.effect,k);c.ajaxhistory&&c.history(b,g+h,h)}):(k.targets=a.id,c.subscribeTopics(f(c.escId(a.id)),"_sj_div_effect_"+a.id+a.id,c.handler.effect,k),(a.onbef||a.oncom||a.onsuc||a.onerr)&&c.subscribeTopics(b,g,d,a));"a"===e&&b.click(function(){a.targets&&
  f.each(a.targets.split(","),function(a,c){b.publish(g+c)});if(a.preventAction)return!1})},container:function(b,a){var d=this,e="_s2j_div_load_"+a.id,c="_s2j_div_effect_"+a.id,g=f.struts2_jquery_ui,h={},k=b,l="click";d.log("container : "+a.id);d.action(b,a,d.handler.load,"div");a.formids&&!a.type||a.href&&"#"!==a.href?("#"!==a.href?(d.subscribeTopics(b,a.reloadtopics,d.handler.load,a),d.subscribeTopics(b,a.listentopics,d.handler.load,a),d.subscribeTopics(b,e,d.handler.load,a),a.bindon&&(a.events?f.each(a.events.split(","),
  function(b,c){f("#"+a.bindon).publishOnEvent(c,e,a)}):f("#"+a.bindon).publishOnEvent("click",e,a))):a.formids&&(d.loadAtOnce||d.require("js/plugins/jquery.form"+d.minSuffix+".js"),a.targets=a.id,d.formsubmit(b,a,e)),a.deferredloading||(a.delay?setTimeout(function(){b.publish(e,a)},a.delay):b.publish(e,a)),a.updatefreq&&(a.delay?setTimeout(function(){setInterval(function(){b.publish(e,a)},a.updatefreq)},a.delay):setInterval(function(){b.publish(e,a)},a.updatefreq))):(a.id&&a.effect&&(h.targets=a.id,
  h.effect=a.effect,h.effectoptions=a.effectoptions,h.effectduration=a.effectduration,d.subscribeTopics(b,c+a.id+a.id,d.handler.effect,h)),a.events||a.bindon?(a.bindon&&(k=f(d.escId(a.bindon))),a.events&&(l=a.events),f.each(l.split(","),function(b,d){a.onbef&&f.each(a.onbef.split(","),function(a,b){k.publishOnEvent(d,b)});k.publishOnEvent(d,c+a.id+a.id,a);a.oncom&&f.each(a.oncom.split(","),function(a,b){k.publishOnEvent(d,b)})})):(a.onbef&&f.each(a.onbef.split(","),function(c,d){b.publish(d,a)}),b.publish(c+
  a.id+a.id,a),a.oncom&&f.each(a.oncom.split(","),function(c,d){b.publish(d,a)})),g&&a.resizable&&g.resizable(b,a));g&&a.draggable&&g.draggable(b,a);g&&a.droppable&&g.droppable(b,a);g&&a.selectable&&g.selectable(b,a);g&&a.sortable&&g.sortable(b,a);a.onblurtopics&&f.each(a.onblurtopics.split(","),function(a,c){b.blur(function(){d.publishTopic(b,c,{})})});a.onfocustopics&&f.each(a.onfocustopics.split(","),function(a,c){b.focus(function(){d.publishTopic(b,c,{})})});a.oncha&&a.type&&("text"===a.type?b.keyup(function(){d.publishTopic(b,
  a.oncha,{})}):"select"===a.type&&(b.change(function(){d.publishTopic(b,a.oncha,{})}),b.select(function(){d.publishTopic(b,a.onselecttopics,{})})))},anchor:function(b,a){var d=this,e="_s2j_form_topic_"+a.id;d.log("anchor : "+a.id);a.onclick&&f.each(a.onclick.split(","),function(c,d){b.publishOnEvent("click",d,a)});a.opendialog&&f.struts2_jquery_ui.opendialog(b,a);a.button&&f.struts2_jquery_ui.jquerybutton(b,a);a.href&&"#"!==a.href||!a.formids?(d.action(b,a,d.handler.load,"a"),a.targets&&(a.reloadtopic||
  a.listentopics)&&f.each(a.targets.split(","),function(b,e){var h=f(d.escId(e));d.subscribeTopics(h,a.reloadtopics,d.handler.load,a);d.subscribeTopics(h,a.listentopics,d.handler.load,a)})):d.formsubmit(b,a,e)},select:function(b,a){var d="_s2j_topic_load_"+a.id;this.log("select : "+a.id);this.loadAtOnce||this.require("js/plugins/jquery.form"+this.minSuffix+".js");a.href&&"#"!==a.href&&(this.subscribeTopics(b,a.reloadtopics,this.handler.load,a),this.subscribeTopics(b,a.listentopics,this.handler.load,
  a),this.subscribeTopics(b,d,this.handler.load,a),a.deferredloading||b.publish(d,a));a.oncha&&f.each(a.oncha.split(","),function(a,c){b.publishOnEvent("change",c)});a.autocomplete&&(this.loadAtOnce||this.require(["js/base/widget"+this.minSuffix+".js","js/base/position"+this.minSuffix+".js","js/base/menu"+this.minSuffix+".js","js/base/button"+this.minSuffix+".js","js/base/autocomplete"+this.minSuffix+".js"]),this.requireCss("themes/s2j-combobox.css"),this.require(["js/plugins/jquery.combobox"+this.minSuffix+
  ".js"]),b.combobox(a))},button:function(b,a){var d=this,e="_s2j_form_topic_"+a.id,c,g;a.preventAction=!0;a.opendialog&&f.struts2_jquery_ui.opendialog(b,a);a.button&&f.struts2_jquery_ui.jquerybutton(b,a);a.href&&"#"!==a.href&&void 0===a.formids?a.href&&"#"!==a.href?(d.action(b,a,d.handler.load,"a"),a.targets&&f.each(a.targets.split(","),function(b,c){d.subscribeTopics(f(d.escId(c)),a.reloadtopics,d.handler.load,a);d.subscribeTopics(f(d.escId(c)),a.listentopics,d.handler.load,a)})):(c=b.parents("form:first")[0],
  void 0!==c?(c=f(c),g=c.attr("id"),void 0===g&&(g="s2jqform"+Math.floor(1E4*Math.random()),c.attr("id",g)),a.formids=g,d.formsubmit(b,a,e)):(d.action(b,a,d.handler.load,"a"),a.targets&&f.each(a.targets.split(","),function(b,c){d.subscribeTopics(f(d.escId(c)),a.reloadtopics,d.handler.load,a);d.subscribeTopics(f(d.escId(c)),a.listentopics,d.handler.load,a)}))):d.formsubmit(b,a,e);a.onclick&&f.each(a.onclick.split(","),function(a,c){b.publishOnEvent("click",c)});b.removeAttr("name")},formsubmit:function(b,
  a,d){var e=this,c={};a.actionTopic=d;e.log("formsubmit : "+a.id);e.loadAtOnce||e.require("js/plugins/jquery.form"+e.minSuffix+".js");a.targets?(e.subscribeTopics(b,a.reloadtopics,e.handler.form,a),e.subscribeTopics(b,a.listentopics,e.handler.form,a),e.subscribeTopics(b,d,e.handler.form,a),f.each(a.targets.split(","),function(c,h){e.subscribeTopics(f(e.escId(h)),"_sj_div_effect_"+h+a.id,e.handler.effect,a);e.ajaxhistory&&e.history(b,d,h)}),f.each(a.formids.split(","),function(a,b){f(e.escId(b)).bind("submit",
  function(a){a.preventDefault()})}),b.click(function(){b.publish(d);return!1})):(b.click(function(c){var d=f(e.escId(a.formids)),k={formvalidate:!0};c.preventDefault();a.validate&&(k.formvalidate=e.validateForm(d,a),a.onaftervalidation&&f.each(a.onaftervalidation.split(","),function(a,c){b.publish(c,b,k)}));k.formvalidate&&(a.href&&"#"!=a.href&&(d[0].action=a.href),d.submit());return!1}),a.listentopics&&(c.formids=a.formids,c.validate=a.validate,b.subscribe(a.listentopics,function(c){var d=f(e.escId(c.data.formids)),
  k={formvalidate:!0};c.data.validate&&(k.formvalidate=e.validateForm(d,a),a.onaftervalidation&&f.each(a.onaftervalidation.split(","),function(a,c){b.publish(c,b,k)}));k.formvalidate&&(a.href&&"#"!=a.href&&(d[0].action=a.href),d.submit())},c)))}};f.subscribeHandler(f.struts2_jquery.handler.load,function(b,a){var d=f.struts2_jquery,e=f(b.target),c;c={};var g=!1,h,k,l="html",m={};a&&f.extend(c,a);b.data&&f.extend(c,b.data);d.lasttopic=c.actionTopic;h=c.indicatorid;k=c.onalw;g=null===c.disabled?g:c.disabled;
  g=e.prop("disabled");b.originalEvent&&(g=f(b.originalEvent.currentTarget).prop("disabled"));if(!0!==g&&c){d.showIndicator(h);c.type&&("text"===c.type?l="value":"select"===c.type?l="select":"checkbox"===c.type?l="checkbox":"radio"===c.type&&(l="radio"));if("html"===l||"value"===l)c.datatype&&"json"===c.datatype||(c.loadingtext&&"false"!==c.loadingtext?"html"===l?e.html(c.loadingtext):e.val(c.loadingtext):null!==d.defaults.loadingText&&("html"===l?e.html(d.defaults.loadingText):e.val(d.defaults.loadingText)));
  m.success=d.pubSuc(b.target,k,c.onsuc,h,l,c);m.complete=d.pubCom(b.target,k,c.oncom,c.targets,h,c);m.error=d.pubErr(b.target,k,c.onerr,c.errortext,l);c.href&&(m.url=c.href,m.data="",c.hrefparameter&&(m.data=c.hrefparameter),m.type=c.requesttype?c.requesttype:"POST",c.formids&&(d.loadAtOnce||d.require("js/plugins/jquery.form"+d.minSuffix+".js"),f.each(c.formids.split(","),function(a,b){var c=f(d.escId(b)).formSerialize();m.data=""!==m.data?m.data+"\x26"+c:c})),m.dataType=c.datatype?c.datatype:"html",
  m.data||(m.data={}),c.options=m,c.options.submit=!0,d.publishTopic(e,k,c),d.publishTopic(e,c.onbef,c),c.options.submit&&(c=e.attr("id"),d.abortReq(e.attr("id")),d.currentXhr[c]=f.ajax(m)))}});f.subscribeHandler(f.struts2_jquery.handler.form,function(b,a){var d=f.struts2_jquery,e=f(b.target),c={},g={},h,k;a&&f.extend(c,a);b.data&&f.extend(c,b.data);d.lasttopic=c.actionTopic;h=c.indicatorid;k=c.onalw;c.href&&"#"!==c.href&&(g.url=c.href,c.hrefparameter&&(g.url=g.url+"?"+c.hrefparameter));c.clearform&&
  (g.clearForm=!0);c.iframe&&(g.iframe=!0);c.resetform&&(g.resetForm=!0);c.replaceTarget&&(g.replaceTarget=!0);c.timeout&&(g.timeout=parseInt(c.timeout,10));g.dataType=c.datatype?c.datatype:null;g.target="";c.targets&&f.each(c.targets.split(","),function(a,b){e=f(d.escId(b));g.target=""===g.target?d.escId(b):g.target+",#"+d.escId(b)});g.beforeSubmit=function(a,b,g){var p={};p.formData=a;p.form=b;p.options=g;p.options.submit=!0;d.publishTopic(e,k,p);c.onbef&&f.each(c.onbef.split(","),function(a,b){e.publish(b,
  e,p)});c.validate&&p.options.submit&&(p.options.submit=d.validateForm(b,c),p.formvalidate=p.options.submit,c.onaftervalidation&&f.each(c.onaftervalidation.split(","),function(a,b){e.publish(b,e,p)}));p.options.submit&&(d.showIndicator(h),c.datatype&&"json"===c.datatype||(c.loadingtext&&"false"!==c.loadingtext?f.each(c.targets.split(","),function(a,b){f(d.escId(b)).html(c.loadingtext)}):null!==d.defaults.loadingText&&f.each(c.targets.split(","),function(a,b){f(d.escId(b)).html(d.defaults.loadingText)})));
  return p.options.submit};g.success=d.pubSuc(e,k,c.onsuc,h,"form",c);g.complete=d.pubCom(e,k,c.oncom,c.targets,h,c);g.error=d.pubErr(e,k,c.onerr,c.errortext,"html");f.each(c.formids.split(","),function(a,b){d.log("submit form : "+b);f(d.escId(b)).ajaxSubmit(g)});return!1});f.subscribeHandler(f.struts2_jquery.handler.effect,function(b,a){var d=f.struts2_jquery,e={},c={},g=2E3,h=null,k=null;f.extend(e,b.data);if(e.targets&&e.effect){e.effectoptions&&(c=e.effectoptions);e.effectduration&&(g=e.effectduration);
  e.oneffect&&(f.each(e.targets.split(","),function(a,b){f.subscribe(f(d.escId(b)),e.oneffect,e)}),h=function(){f.each(e.targets.split(","),function(a,b){d.publishTopic(f(d.escId(b)),e.oneffect,e)})});if(!d.loadAtOnce){var l=["js/base/effect"+d.minSuffix+".js","js/base/effect-"+e.effect+d.minSuffix+".js"];"scale"!==e.effect&&"puff"!==e.effect||l.push("js/base/effect-size"+d.minSuffix+".js");"puff"===e.effect&&l.push("js/base/effect-scale"+d.minSuffix+".js");d.require(l)}d.log("effect "+e.effect+" for "+
  e.targets);f.each(e.targets.split(","),function(a,b){k=f(d.escId(b));e.effectmode&&"none"!==e.effectmode?"show"===e.effectmode?k.show(e.effect,c,g,h):"hide"===e.effectmode?k.hide(e.effect,c,g,h):"toggle"===e.effectmode&&k.toggle(e.effect,c,g,h):k.effect(e.effect,c,g,h)})}})})(jQuery);