var OmniFaces=OmniFaces||{EVENT:"omnifaces.event",VIEW_STATE_PARAM:"javax.faces.ViewState",CLIENT_WINDOW_PARAM:"javax.faces.ClientWindow"}; OmniFaces.Util=function(d,e){function k(a,b,c,f,h){f=f.replace(/^\s+|\s+$/g,"").split(/\s+/);for(var d=0;dd||d>=g.length)){var a=g[d],b=e.createElement("script"),c=e.head||e.documentElement;b.async=!0;b.src=a.url;b.setAttribute("crossorigin","anonymous");b.onerror=function(){a.error()};b.onload=b.onreadystatechange=function(f,c){if(c||!b.readyState||/loaded|complete/.test(b.readyState)){b.onload=b.onreadystatechange=null;if(c)b.onerror();else a.success();b=null;k(d+1)}};a.begin();c.insertBefore(b,null)}}var g=[];return{add:function(e,a,b,c){g.push({url:e, begin:d.resolveFunction(a),success:d.resolveFunction(b),error:d.resolveFunction(c)});1==g.length&&d.addOnloadListener(function(){k(0)})}}}(OmniFaces.Util,document); OmniFaces.Unload=function(d,e,k,g){var h,a,b={init:function(c){if(k.XMLHttpRequest){if(null==h){var f=d.getFacesForm();if(!f){k.jsf&&"Development"!=jsf.getProjectStage()||!k.console||!console.error||console.error("OmniFaces @ViewScoped: cannot find a JSF form in the document. Unload will not work. Either add a JSF form, or use @RequestScoped instead.");return}d.addEventListener(k,k.onbeforeunload?"unload":"beforeunload",function(){if(a)b.reenable();else try{var c=f.action,d=OmniFaces.EVENT+"\x3dunload\x26id\x3d"+ h+"\x26"+OmniFaces.VIEW_STATE_PARAM+"\x3d"+encodeURIComponent(f[OmniFaces.VIEW_STATE_PARAM].value);if(e.sendBeacon)e.sendBeacon(c,new Blob([d],{type:"application/x-www-form-urlencoded"}));else{var g=new XMLHttpRequest;g.open("POST",c,!1);g.setRequestHeader("X-Requested-With","XMLHttpRequest");g.setRequestHeader("Content-Type","application/x-www-form-urlencoded");g.send(d)}}catch(p){}});d.addSubmitListener(function(){b.disable()})}h=c;a=!1}},disable:function(){a=!0},reenable:function(){a=!1}};return b}(OmniFaces.Util, navigator,window,document); OmniFaces.Push=function(d,e){function k(a,b,d,e,g,h){var c,f,k=this;k.open=function(){c&&1==c.readyState||(c=new WebSocket(a),c.onopen=function(a){null==f&&d(b);f=0},c.onmessage=function(a){var c=JSON.parse(a.data);e(c,b,a);if((a=h[c])&&a.length)for(c=0;ca){a=b.name;var c;d.mojarra&&(c=g.form.enctype,g.form.enctype="application/x-www-form-urlencoded");g.type="text";g.type="file";a={fileName:a};a[OmniFaces.EVENT]="validationFailed";jsf.ajax.request(g.id,k,a);c&&(g.form.enctype=c);return!1}}return!0}}}(window,document); OmniFaces.Form=function(d,e){d.addOnloadListener(function(){if(e.jsf){var d=jsf.getViewState;jsf.getViewState=function(e){var g=d(e);if("true"!=e.attributes["data-partialsubmit"])return g;var a=jsf.ajax.request.arguments?jsf.ajax.request.arguments[2].execute:null;if(!a||-1!=a.indexOf("@form")||-1!=a.indexOf("@all"))return g;var b=[];-1==a.indexOf("@none")&&(b=a.replace("@this",jsf.ajax.request.arguments[0].id).split(" ").map(encodeURIComponent),b.push(encodeURIComponent(e.id)));b.push(OmniFaces.VIEW_STATE_PARAM); b.push(OmniFaces.CLIENT_WINDOW_PARAM);var c=[];g.replace(/([^=&]+)=([^&]*)/g,function(a,d,e){-1