From 21176b0a31ac6d092399eec061f028dc7ecea16a Mon Sep 17 00:00:00 2001 From: apivan Date: Fri, 16 Feb 2024 14:42:26 +0700 Subject: [PATCH] Fix https://redmine.emweb.be/issues/12424 --- src/web/skeleton/Wt.js | 4 +++- src/web/skeleton/Wt.min.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/web/skeleton/Wt.js b/src/web/skeleton/Wt.js index 817742e01f..0eb676b445 100644 --- a/src/web/skeleton/Wt.js +++ b/src/web/skeleton/Wt.js @@ -2655,7 +2655,9 @@ window._$_APP_CLASS_$_ = new (function() { if (el.ed) { el.ed.save(); } - v = "" + el.value; + if (el.value) { + v = "" + el.value; + } } if (WT.hasFocus(el)) { diff --git a/src/web/skeleton/Wt.min.js b/src/web/skeleton/Wt.min.js index 0f8b43f492..d120594c50 100644 --- a/src/web/skeleton/Wt.min.js +++ b/src/web/skeleton/Wt.min.js @@ -15,4 +15,4 @@ _$_$if_DYNAMIC_JS_$_();window.JavaScriptFunction=1;window.JavaScriptConstructor= * Copyright (c) 2009 Matt Zabriskie * Released under the MIT and GPL licenses. */ -const s=e.value;"number"!=typeof n&&(n=-1);"number"!=typeof o&&(o=-1);n<0&&(n=0);o>s.length&&(o=s.length);oo&&(n=o);e.focus();if(i)for(let e=0;e=n&&e>=o);++e)if(l(s.charCodeAt(e))&&e+10||(13===e.keyCode||27===e.keyCode||32===e.keyCode||e.keyCode>46&&e.keyCode<112)};let c=null,d=null;this.isDblClick=function(e,t){if(e.wtClickTimeout&&Math.abs(e.wtE1.clientX-t.clientX)<3&&Math.abs(e.wtE1.clientY-t.clientY)<3){clearTimeout(e.wtClickTimeout);e.wtClickTimeout=null;e.wtE1=null;return!0}return!1};this.eventRepeat=function(t,n,o){e.stopRepeat();n=n||500;o=o||50;t();c=setTimeout((function(){c=null;t();d=setInterval(t,o)}),n)};this.stopRepeat=function(){if(c){clearTimeout(c);c=null}if(d){clearInterval(d);d=null}};let u=null,f=null;this.css=function(e,t){if(e.style[t])return e.style[t];if(e!==u){u=e;f=window.getComputedStyle?window.getComputedStyle(e,null):e.currentStyle?e.currentStyle:null}return f?f[t]:null};function p(e,t,n){if("auto"===e||null===e)return n;const o=t.exec(e),i=o&&2===o.length?o[1]:null;return i?parseFloat(i):n}this.parsePx=function(e){return p(e,/^\s*(-?\d+(?:\.\d+)?)\s*px\s*$/i,0)};this.parsePct=function(e,t){return p(e,/^\s*(-?\d+(?:\.\d+)?)\s*%\s*$/i,t)};this.px=function(t,n){return e.parsePx(e.css(t,n))};this.pxself=function(t,n){return e.parsePx(t.style[n])};this.pctself=function(t,n){return e.parsePct(t.style[n],0)};this.styleAttribute=function(e){function t(e){let t=e.search(/-./);for(;-1!==t;){const n=e.charAt(t+1).toUpperCase();t=(e=e.replace(/-./,n)).search(/-./)}return e}const n=["","-moz-","-webkit-","-o-","-ms-"],o=document.createElement("div");for(let i=0,s=n.length;io?o+1:""!==t.style.styleFloat?n-1:"auto"}return"auto"};this.hide=function(t){e.getElement(t).style.display="none"};this.inline=function(t){e.getElement(t).style.display="inline"};this.block=function(t){e.getElement(t).style.display="block"};this.show=function(t,n){e.getElement(t).style.display=n};let h=null;this.firedTarget=null;this.target=function(t){try{return e.firedTarget||t.target||t.srcElement}catch(e){return null}};function g(t){if(null===h)return null;t||(t=window.event);if(t){let n=e.target(t);for(;n&&n!==h;)n=n.parentNode;return n===h?null:h}return h}function m(t){const n=g(t);if(n&&!r){t||(t=window.event);r=!0;e.condCall(n,"onmousemove",t);r=!1;return!1}return!0}function y(t){const n=g(t);e.capture(null);if(n){t||(t=window.event);e.condCall(n,"onmouseup",t);e.cancelEvent(t,e.CancelPropagate);return!1}return!0}function b(t){const n=g(t);if(n&&!r){t||(t=window.event);r=!0;e.condCall(n,"ontouchmove",t);r=!1;return!1}return!0}function w(t){const n=g(t);e.capture(null);if(n){t||(t=window.event);e.condCall(n,"ontouchend",t);e.cancelEvent(t,e.CancelPropagate);return!1}return!0}let T=!1;function _(t){t.addEventListener("mousemove",m,!0);t.addEventListener("mouseup",y,!0);e.isGecko&&window.addEventListener("mouseout",(function(t){!t.relatedTarget&&e.hasTag(t.target,"HTML")&&y(t)}),!0)}function v(){if(T)return;T=!0;const e=document.body;_(e);!function(e){e.addEventListener("touchmove",b,!0);e.addEventListener("touchend",w,!0)}(e)}this.capture=function(e){v();if(h&&e)return;for(let e=0;e32768){o=document.createElement("style");n.parentNode.insertBefore(o,n);o.styleSheet.cssText=t}else o.styleSheet.cssText+=t}else{const e=document.createTextNode(t);n.appendChild(e)}};this.getCssRule=function(e,t){e=e.toLowerCase();if(document.styleSheets)for(let n=0;n0){const e=o[o.length-1];e.parentNode.insertBefore(n,e.nextSibling)}else document.body.appendChild(n)}};this.removeStyleSheet=function(e){document.querySelectorAll('link[rel=stylesheet][href~="'+e+'"]').forEach((function(e){e.remove()}));const t=document.styleSheets;for(let n=0;nf.x){n=p;a=0}else if(n+d>p+f.x){let o=g.scrollLeft;g===document.body&&(o=g.clientWidth-f.x);i=i-m.x+o;n=g.clientWidth-(i+e.px(t,"marginRight"));a=1}else{let o=g.scrollLeft;g===document.body&&(o=0);n=n-m.x+o;n-=e.px(t,"marginLeft");a=0}if(u>f.y){o=h;c=0}else if(o+u>h+f.y){s>h+f.y&&(s=h+f.y);let n=g.scrollTop;g===document.body&&(n=g.clientHeight-f.y);s=s-m.y+n;o=g.clientHeight-(s+e.px(t,"marginBottom")+e.px(t,"borderBottomWidth"));c=1}else{let n=g.scrollTop;g===document.body&&(n=0);o=(o=o-m.y+n)-e.px(t,"marginTop")+e.px(t,"borderTopWidth");c=0}t.style[r[a]]=n+"px";t.style[l[c]]=o+"px"};this.positionXY=function(t,n,o){const i=e.getElement(t);if(!e.isHidden(i)){i.style.display="block";e.fitToWindow(i,n,o,n,o)}};this.Horizontal=1;this.Vertical=2;this.positionAtWidget=function(t,n,o,i){const s=e.getElement(t),r=e.getElement(n);i||(i=0);if(!r||!s)return;const l=e.widgetPageCoordinates(r);let a,c,d,u;s.style.position="absolute";"none"===e.css(s,"display")&&(s.style.display="block");if(o===e.Horizontal){a=l.x+r.offsetWidth;c=l.y+i;d=l.x;u=l.y+r.offsetHeight-i}else{a=l.x;c=l.y+r.offsetHeight;d=l.x+r.offsetWidth;u=l.y}let f,p=r;s.parentNode.removeChild(s);for(f=p.parentNode;!f.classList.contains("Wt-domRoot")&&!f.wtReparentBarrier&&!("inline"!==e.css(f,"display")&&f.clientHeight>100&&("scroll"===getComputedStyle(f).overflowY||"scroll"===getComputedStyle(f).overflowX||f.scrollHeight>f.clientHeight&&"auto"===getComputedStyle(f).overflowY||f.scrollWidth>f.clientWidth&&"auto"===getComputedStyle(f).overflowX));f=f.parentNode)p=f;const h=e.css(f,"position");"absolute"!==h&&"relative"!==h&&(f.style.position="relative");f.appendChild(s);s.classList.add("wt-reparented");e.fitToWindow(s,a,c,d,u);s.style.visibility=""};this.hasFocus=function(e){try{return e===document.activeElement}catch(e){return!1}};this.progressed=function(t){const n=document,o=n.body,i=this.getElement("Wt-form");t.style.display=i.style.display;i.parentNode.replaceChild(t,i);o.removeEventListener?o.removeEventListener("click",delayClick,!0):o.detachEvent("click",delayClick);setTimeout((function(){for(let t=0,o=delayedClicks.length;t1&&(e=e.substring(1));const n=e.split("&");e="";for(let o=0,i=n.length;o=1&&"/"===n[n.length-1]){_$_$if_UGLY_INTERNAL_PATHS_$_();o=!0;_$_$endif_$_();_$_$ifnot_UGLY_INTERNAL_PATHS_$_();n=n.substring(0,n.length-1);_$_$endif_$_()}},removeSessionId:function(){let e=r.location.pathname;const t=e.indexOf(";jsessionid=");-1!==t&&(e=e.substring(0,t));const n=e+a(r.location.search,"wtd");r.history.replaceState(null,null,n)},navigate:function(s,r){e.resolveRelativeAnchors();t=s;const l=s.replace(/%/g,"%25").replace(/\+/g,"%2b").replace(/ /g,"%20").replace(/&/g,"%26");let c=n;0!==l.length&&(c+=(o?"?_=":"")+l);if(o){let e=a(window.location.search,"_");if(e.length>1){e.length>2&&"?"===e[0]&&"&"===e[1]&&(e=e.substring(1));-1===c.indexOf("?")?c+="?"+e.substring(1):c+="&"+e.substring(1)}}else c+=window.location.search;try{const e={};e.state=s||"";e.title=document.title;S();window.history.pushState(e,document.title,c)}catch(e){console.log(e.toString())}r&&i(s)},getCurrentState:function(){return t}}}();this.maxZIndex=function(){let t=0;document.querySelectorAll(".Wt-dialog, .modal, .modal-dialog").forEach((function(n){t=Math.max(t,e.css(n,"z-index"))}));return t};this.ResponseStatus={OK:0,Error:1,Timeout:2}});if(window._$_APP_CLASS_$_&&window._$_APP_CLASS_$_._p_)try{window._$_APP_CLASS_$_._p_.quit(null)}catch(e){}window._$_APP_CLASS_$_=new function(){const self=this,WT=_$_WT_CLASS_$_,UNDEFINED="undefined";let downX=0,downY=0;const deployUrl=_$_DEPLOY_PATH_$_;function saveDownPos(e){const t=WT.pageCoordinates(e);downX=t.x;downY=t.y}let currentHash=null;function onHashChange(){const e=_$_WT_CLASS_$_.history.getCurrentState();if((!(null!==e&&e.length>0)||e.startsWith("/"))&¤tHash!==e){currentHash=e;setTimeout((function(){update(null,"hash",null,!0)}),1)}}function setHash(e,t){if(currentHash!==e&&(currentHash||"/"!==e)){t||(currentHash=e);WT.history.navigate(e,t)}}const dragState={object:null,sourceId:null,mimeType:null,dropOffsetX:null,dragOffsetY:null,dropTarget:null,objectPrevStyle:null,xy:null};let touchTimer;const touchduration=1e3;function touchStart(e,t){touchTimer=setTimeout((function(){dragStart(e,t)}),touchduration)}function touchEnded(){touchTimer&&clearTimeout(touchTimer)}function dragStart(e,t){if(t.touches&&"vibrate"in navigator){navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate;navigator.vibrate&&navigator.vibrate(100)}if((t.ctrlKey||WT.button(t)>1)&&!t.touches)return!0;const n=WT.target(t);if(n&&"inline"!==WT.css(n,"display")&&(n.offsetWidth>n.clientWidth||n.offsetHeight>n.clientHeight)){const e=WT.widgetPageCoordinates(n),o=WT.pageCoordinates(t),i=o.x-e.x,s=o.y-e.y;if(i>n.clientWidth||s>n.clientHeight)return!0}const o=dragState;o.object=WT.getElement(e.getAttribute("dwid"));if(null===o.object)return!0;o.sourceId=e.getAttribute("dsid");o.objectPrevStyle={position:o.object.style.position,display:o.object.style.display,left:o.object.style.left,top:o.object.style.top,className:o.object.className,parent:o.object.parentNode,zIndex:o.object.zIndex};o.object.parentNode.removeChild(o.object);o.object.style.position="absolute";o.object.className=o.objectPrevStyle.className+"";o.object.style.zIndex="200000";document.body.appendChild(o.object);WT.capture(null);WT.capture(o.object);o.object.onmousemove=dragDrag;o.object.onmouseup=dragEnd;document.addEventListener("mousedown",dragAbort);window.addEventListener("mouseup",dragAbort);document.addEventListener("touchstart",dragAbort);o.object.ontouchmove=dragDrag;o.object.ontouchend=dragEnd;o.offsetX=-4;o.offsetY=-4;o.dropTarget=null;o.mimeType=e.getAttribute("dmt");o.xy=WT.pageCoordinates(t);WT.cancelEvent(t,WT.CancelPropagate);return!1}function dragDrag(e){e=e||window.event;if(null!==dragState.object){const t=dragState,n=WT.pageCoordinates(e);""!==t.object.style.display&&t.xy.x!==n.x&&t.xy.y!==n.y&&(t.object.style.display="");t.object.style.left=n.x-t.offsetX+"px";t.object.style.top=n.y-t.offsetY+"px";const o=t.dropTarget;let i;if(e.changedTouches){t.object.style.display="none";i=document.elementFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY);t.object.style.display=""}else{i=WT.target(e);if(i===t.object&&document.elementFromPoint){t.object.style.display="none";i=document.elementFromPoint(e.clientX,e.clientY);t.object.style.display=""}}const s="{"+t.mimeType+":";let r=null;t.dropTarget=null;for(;i;){r=i.getAttribute("amts");if(null!==r&&-1!==r.indexOf(s)){t.dropTarget=i;break}i=i.parentNode;if(!i.tagName||WT.hasTag(i,"HTML"))break}if(t.dropTarget!==o){if(t.dropTarget){const e=r.indexOf(s)+s.length,n=r.indexOf("}",e),o=r.substring(e,n);if(0!==o.length){t.dropTarget.setAttribute("dos",t.dropTarget.className);t.dropTarget.className=t.dropTarget.className+" "+o}}else t.object.styleClass="";if(null!==o){o.handleDragDrop&&o.handleDragDrop("end",t.object,e,"",s);const n=o.getAttribute("dos");null!==n&&(o.className=n)}}t.dropTarget?t.dropTarget.handleDragDrop?t.dropTarget.handleDragDrop("drag",t.object,e,"",s):t.object.className=t.objectPrevStyle.className+" Wt-valid-drop":t.object.className=t.objectPrevStyle.className+"";return!1}return!0}function dragAbort(){WT.capture(null);const e=dragState;if(e.object){document.body.removeChild(e.object);e.objectPrevStyle.parent.appendChild(e.object);e.object.style.zIndex=e.objectPrevStyle.zIndex;e.object.style.position=e.objectPrevStyle.position;e.object.style.display=e.objectPrevStyle.display;e.object.style.left=e.objectPrevStyle.left;e.object.style.top=e.objectPrevStyle.top;e.object.className=e.objectPrevStyle.className;e.object=null;touchTimer&&clearTimeout(touchTimer)}if(document.removeEventListener){document.removeEventListener("mousedown",dragAbort);window.removeEventListener("mouseup",dragAbort);document.removeEventListener("touchstart",dragAbort)}else{document.detachEvent("onmousedown",dragAbort);window.detachEvent("onmouseup",dragAbort)}}function dragEnd(e){e=e||window.event;WT.capture(null);const t=dragState;if(t.object){if(t.dropTarget){const n=t.dropTarget.getAttribute("dos");null!==n&&(t.dropTarget.className=n);t.dropTarget.handleDragDrop?t.dropTarget.handleDragDrop("drop",t.object,e,t.sourceId,t.mimeType):e.touches?emit(t.dropTarget,{name:"_drop2",eventObject:t.dropTarget,event:e},t.sourceId,t.mimeType):emit(t.dropTarget,{name:"_drop",eventObject:t.dropTarget,event:e},t.sourceId,t.mimeType)}dragAbort()}}function encodeTouches(e,t){let n="";for(let o=0,i=e.length;o0?"&e"+i:"&";let s=t+pendingEvents[i].data.join(t);pendingEvents[i].evAckId=_$_INDICATOR_TIMEOUT_$_){null===currentHideLoadingIndicator&&waitFeedback();return}const o=parseInt(n,10);o>t&&(t=o)}nextWsRqId=t+1;document.body.style.cursor="auto";if(null!==currentHideLoadingIndicator){try{currentHideLoadingIndicator()}catch(e){}currentHideLoadingIndicator=null}}const WebSocketUnknown=0,WebSocketConnecting=1,WebSocketAckConnect=2,WebSocketWorking=3,WebSocketUnavailable=4,websocket={state:WebSocketUnknown,socket:null,keepAlive:null,reconnectTries:0};let connectionMonitor=null;function setServerPush(e){serverPush=e}function doAutoJavaScript(){self._p_.autoJavaScript()}function doJavaScript(e){if(e){e="(function() {"+e+"})();";window.execScript?window.execScript(e):window.eval(e)}self===window._$_APP_CLASS_$_&&doAutoJavaScript()}function webSocketAckConnect(){nextWsRqId=0;pendingWsRequests={};websocket.socket.send("&signal=none&connected="+ackUpdateId);websocket.state=WebSocketWorking}function handleResponse(e,t,n){connectionMonitor&&connectionMonitor.onStatusChange("connectionStatus",e===WT.ResponseStatus.OK?1:0);if(!hasQuit)if(waitingForJavaScript)setTimeout((function(){handleResponse(e,t,n)}),50);else{if(pollTimer){clearTimeout(pollTimer);pollTimer=null}if(e===WT.ResponseStatus.OK){WT.resolveRelativeAnchors();_$_$if_CATCH_ERROR_$_();try{_$_$endif_$_();doJavaScript(t);_$_$if_CATCH_ERROR_$_()}catch(e){const n=e.stack||e.stacktrace,o=e.description||e.message,i={exception_code:e.code,exception_description:o,exception_js:t};i.stack=n;sendError(i,"Wt internal error; code: "+e.code+", description: "+o);throw e}_$_$endif_$_();n&&cancelFeedback(n)}else pendingEvents=sentEvents.concat(pendingEvents);sentEvents=[];responsePending=null;e===WT.ResponseStatus.OK?commErrors=0:e===WT.ResponseStatus.Error&&++commErrors;if(!hasQuit){websocket.state===WebSocketAckConnect&&webSocketAckConnect();if(serverPush&&!waitingForJavaScript||pendingEvents.length>0)if(e===WT.ResponseStatus.Error){const e=Math.min(12e4,500*Math.exp(commErrors));updateTimeout=setTimeout((function(){sendUpdate()}),e)}else null===updateTimeout&&sendUpdate()}}}function setSessionUrl(e){sessionUrl=-1!==e.indexOf("://")||"/"===e[0]?e:deployUrl+e;comm&&comm.setUrl(e)}setSessionUrl(_$_SESSION_URL_$_);comm=WT.initAjaxComm(sessionUrl,handleResponse);function doPollTimeout(){responsePending.abort();responsePending=null;pollTimer=null;hasQuit||sendUpdate()}function setConnectionMonitor(e){connectionMonitor=e;connectionMonitor.status={};connectionMonitor.status.connectionStatus=0;connectionMonitor.status.websocket=!1;connectionMonitor.onStatusChange=function(e,t){const n=connectionMonitor.status[e];if(n!==t){connectionMonitor.status[e]=t;connectionMonitor.onChange(e,n,t)}}}let updating=!1,updateTimeoutStart;function update(e,t,n,o){checkEventOverflow();if(!updating){updating=!0;WT.checkReleaseCapture(e,n);_$_$if_STRICTLY_SERIALIZED_EVENTS_$_();if(!responsePending){_$_$endif_$_();const i={},s=pendingEvents.length;i.object=e;i.signal=t;i.event=window.fakeEvent||n;i.feedback=o;i.evAckId=ackUpdateId;pendingEvents[s]=encodeEvent(i);scheduleUpdate();doJavaScript();_$_$if_STRICTLY_SERIALIZED_EVENTS_$_()}_$_$endif_$_();updating=!1}}function schedulePing(){websocket.keepAlive&&clearInterval(websocket.keepAlive);websocket.keepAlive=setInterval((function(){const e=websocket.socket;if(1===e.readyState)e.send("&signal=ping");else{clearInterval(websocket.keepAlive);websocket.keepAlive=null}}),_$_SERVER_PUSH_TIMEOUT_$_)}function scheduleUpdate(){if(hasQuit){if(!quitStr)return;if(confirm(quitStr)){document.location=document.location;quitStr=null;return}quitStr=null}else{_$_$if_WEB_SOCKETS_$_();if(websocket.state!==WebSocketUnavailable)if(typeof window.WebSocket===UNDEFINED)websocket.state=WebSocketUnavailable;else{let t=websocket.socket;if(null===t||t.readyState>1)if(null!==t&&websocket.state===WebSocketUnknown)websocket.state=WebSocketUnavailable;else{function e(){if(!hasQuit){++websocket.reconnectTries;const e=Math.min(12e4,500*Math.exp(websocket.reconnectTries));setTimeout((function(){scheduleUpdate()}),e)}}let n;if(-1!==sessionUrl.indexOf("://"))n="ws"+sessionUrl.substring(4);else{const i=sessionUrl.substring(sessionUrl.indexOf("?"));n="ws"+location.protocol.substring(4)+"//"+location.host+_$_WS_PATH_$_+i}n+="&request=ws";const o=_$_WS_ID_$_;o.length>0&&(n+="&wsid="+o);websocket.socket=t=new WebSocket(n);websocket.state=WebSocketConnecting;websocket.keepAlive&&clearInterval(websocket.keepAlive);websocket.keepAlive=null;t.onmessage=function(e){let t=null;if(websocket.state===WebSocketConnecting){if("connect"!==e.data){console.log("WebSocket: was expecting a connect?");console.log(e.data);return}if(null!==responsePending&&null!==pollTimer){clearTimeout(pollTimer);pollTimer=null;responsePending.abort();responsePending=null}responsePending||!WT.isEmptyObject(pendingWsRequests)?websocket.state=WebSocketAckConnect:webSocketAckConnect()}else{if(connectionMonitor){connectionMonitor.onStatusChange("websocket",!0);connectionMonitor.onStatusChange("connectionStatus",1)}websocket.state=WebSocketWorking;t=e.data}websocket.reconnectTries=0;null!==t&&handleResponse(WT.ResponseStatus.OK,t,null)};t.onerror=function(t){connectionMonitor&&connectionMonitor.onStatusChange("websocket",!1);3===websocket.reconnectTries&&websocket.state===WebSocketUnknown&&(websocket.state=WebSocketUnavailable);e()};t.onclose=function(t){connectionMonitor&&connectionMonitor.onStatusChange("websocket",!1);3===websocket.reconnectTries&&websocket.state===WebSocketUnknown&&(websocket.state=WebSocketUnavailable);e()};t.onopen=function(e){if(connectionMonitor){connectionMonitor.onStatusChange("websocket",!0);connectionMonitor.onStatusChange("connectionStatus",1)}schedulePing()}}if(1===t.readyState&&t.state===WebSocketWorking){schedulePing();sendUpdate();return}}_$_$endif_$_();if(null!==responsePending&&null!==pollTimer){clearTimeout(pollTimer);pollTimer=null;responsePending.abort();responsePending=null}if(null===responsePending)if(null===updateTimeout){updateTimeout=setTimeout((function(){sendUpdate()}),WT.updateDelay);updateTimeoutStart=(new Date).getTime()}else if(commErrors){clearTimeout(updateTimeout);updateTimeout=null;sendUpdate()}else{if((new Date).getTime()-updateTimeoutStart>WT.updateDelay){clearTimeout(updateTimeout);updateTimeout=null;sendUpdate()}}}}let ackUpdateId=_$_ACK_UPDATE_ID_$_,ackPuzzle=null;function responseReceived(e,t){ackPuzzle=t;ackUpdateId=e;comm.responseReceived(e)}function wsRqsDone(){for(let e=0;e0&&(n+="&Wt-params="+encodeURIComponent(i));if(pendingEvents.length>0){let i=_$_MAX_FORMDATA_SIZE_$_-n.length;o&&(i-=("&wsRqId="+nextWsRqId).length);const s=encodePendingEvents(i);e=s.feedback?setTimeout(o?wsWaitFeedback:waitFeedback,_$_INDICATOR_TIMEOUT_$_):null;n+=s.result;t=!1}else{n+="&signal=poll";e=null;t=!0}if(o){responsePending=null;if(!t){if(e){const t=nextWsRqId;pendingWsRequests[t]={time:Date.now(),tm:e};++nextWsRqId;n+="&wsRqId="+t}websocket.socket.send(n)}}else{if(responsePending)try{throw new Error("responsePending is true before comm.sendUpdate")}catch(e){const t=e.stack||e.stacktrace,n=e.description||e.message,o={exception_description:n};o.stack=t;sendError(o,"Wt internal error; description: "+n);throw e}pollTimer=t?setTimeout(doPollTimeout,_$_SERVER_PUSH_TIMEOUT_$_):null;responsePending=1;responsePending=comm.sendUpdate("request=jsupdate"+n,e,ackUpdateId,-1,t)}}function propagateSize(e,t,n){-1===t&&(t=e.offsetWidth);-1===n&&(n=e.offsetHeight);if(typeof e.wtWidth===UNDEFINED||e.wtWidth!==t||typeof e.wtHeight===UNDEFINED||e.wtHeight!==n){e.wtWidth=t;e.wtHeight=n;t>=0&&n>=0&&emit(e,"resized",Math.round(t),Math.round(n))}}function emit(e,t){checkEventOverflow();const n={},o=pendingEvents.length;n.signal="user";n.id="string"==typeof e?e:e===self?"app":e.id;if("object"==typeof t){n.name=t.name;n.object=t.eventObject;n.event=t.event}else{n.name=t;n.object=n.event=null}n.args=[];for(let e=2;e0&&pendingEvents.length>=_$_MAX_PENDING_EVENTS_$_){const e="too many pending events";sendError(e,"Wt internal error; description: "+e);pendingEvents=[];throw new Error(e)}}function addTimerEvent(e,t,n){const o=function(){const t=WT.getElement(e);if(t){if(-1!==n)t.timer=setTimeout(t.tm,n);else{t.timer=null;t.tm=null}t.onclick&&t.onclick()}},i=WT.getElement(e);i.timer&&clearTimeout(i.timer);i.timer=setTimeout(o,t);i.tm=o}const jsLibsLoaded={};let waitingForJavaScript=!1;function onJsLoad(e,t){setTimeout((function(){if(!0===jsLibsLoaded[e]){waitingForJavaScript=!1;t();!waitingForJavaScript&&serverPush&&sendUpdate()}else jsLibsLoaded[e]=t}),20);waitingForJavaScript=!0}function jsLoaded(e){if(!0!==jsLibsLoaded[e]){if(typeof jsLibsLoaded[e]!==UNDEFINED){waitingForJavaScript=!1;jsLibsLoaded[e]();!waitingForJavaScript&&serverPush&&sendUpdate()}jsLibsLoaded[e]=!0}}function loadScript(uri,symbol,tries){let loaded=!1,error=!1;function onerror(){if(!loaded&&!error){error=!0;const e=typeof tries===UNDEFINED?2:tries;if(e>1)loadScript(uri,symbol,e-1);else{const e={"error-description":"Fatal error: failed loading "+uri};sendError(e,e["error-description"]);quit(null)}}}function onload(){if(!loaded&&!error){loaded=!0;jsLoaded(uri)}}if(""!==symbol)try{loaded=!eval("typeof "+symbol+" === 'undefined'")}catch(e){loaded=!1}if(loaded)jsLoaded(uri);else{const e=document.createElement("script");e.setAttribute("src",uri);e.onload=onload;e.onerror=onerror;e.onreadystatechange=function(){const t=e.readyState;"loaded"===t?onerror():"complete"===t&&onload()};const t=document.getElementsByTagName("head")[0];t.appendChild(e)}}function ImagePreloader(e,t){this.callback=t;this.work=e.length;this.images=[];if(0===e.length)this.callback(this.images);else for(const t of e)this.preload(t)}ImagePreloader.prototype.preload=function(e){const t=new Image;this.images.push(t);t.onload=ImagePreloader.prototype.onload;t.onerror=ImagePreloader.prototype.onload;t.onabort=ImagePreloader.prototype.onload;t.imagePreloader=this;t.src=e};ImagePreloader.prototype.onload=function(){const e=this.imagePreloader;0==--e.work&&e.callback(e.images)};ImagePreloader.prototype.cancel=function(){const e=this.images;for(const t of e){t.onload=function(){};t.onerror=function(){};t.onabort=function(){}}this.callback=function(){}};function ArrayBufferPreloader(e,t){this.callback=t;this.work=e.length;this.arrayBuffers=[];if(0===e.length)t(this.arrayBuffers);else for(let t=0;ts.length&&(o=s.length);oo&&(n=o);e.focus();if(i)for(let e=0;e=n&&e>=o);++e)if(l(s.charCodeAt(e))&&e+10||(13===e.keyCode||27===e.keyCode||32===e.keyCode||e.keyCode>46&&e.keyCode<112)};let c=null,d=null;this.isDblClick=function(e,t){if(e.wtClickTimeout&&Math.abs(e.wtE1.clientX-t.clientX)<3&&Math.abs(e.wtE1.clientY-t.clientY)<3){clearTimeout(e.wtClickTimeout);e.wtClickTimeout=null;e.wtE1=null;return!0}return!1};this.eventRepeat=function(t,n,o){e.stopRepeat();n=n||500;o=o||50;t();c=setTimeout((function(){c=null;t();d=setInterval(t,o)}),n)};this.stopRepeat=function(){if(c){clearTimeout(c);c=null}if(d){clearInterval(d);d=null}};let u=null,f=null;this.css=function(e,t){if(e.style[t])return e.style[t];if(e!==u){u=e;f=window.getComputedStyle?window.getComputedStyle(e,null):e.currentStyle?e.currentStyle:null}return f?f[t]:null};function p(e,t,n){if("auto"===e||null===e)return n;const o=t.exec(e),i=o&&2===o.length?o[1]:null;return i?parseFloat(i):n}this.parsePx=function(e){return p(e,/^\s*(-?\d+(?:\.\d+)?)\s*px\s*$/i,0)};this.parsePct=function(e,t){return p(e,/^\s*(-?\d+(?:\.\d+)?)\s*%\s*$/i,t)};this.px=function(t,n){return e.parsePx(e.css(t,n))};this.pxself=function(t,n){return e.parsePx(t.style[n])};this.pctself=function(t,n){return e.parsePct(t.style[n],0)};this.styleAttribute=function(e){function t(e){let t=e.search(/-./);for(;-1!==t;){const n=e.charAt(t+1).toUpperCase();t=(e=e.replace(/-./,n)).search(/-./)}return e}const n=["","-moz-","-webkit-","-o-","-ms-"],o=document.createElement("div");for(let i=0,s=n.length;io?o+1:""!==t.style.styleFloat?n-1:"auto"}return"auto"};this.hide=function(t){e.getElement(t).style.display="none"};this.inline=function(t){e.getElement(t).style.display="inline"};this.block=function(t){e.getElement(t).style.display="block"};this.show=function(t,n){e.getElement(t).style.display=n};let h=null;this.firedTarget=null;this.target=function(t){try{return e.firedTarget||t.target||t.srcElement}catch(e){return null}};function g(t){if(null===h)return null;t||(t=window.event);if(t){let n=e.target(t);for(;n&&n!==h;)n=n.parentNode;return n===h?null:h}return h}function m(t){const n=g(t);if(n&&!r){t||(t=window.event);r=!0;e.condCall(n,"onmousemove",t);r=!1;return!1}return!0}function y(t){const n=g(t);e.capture(null);if(n){t||(t=window.event);e.condCall(n,"onmouseup",t);e.cancelEvent(t,e.CancelPropagate);return!1}return!0}function b(t){const n=g(t);if(n&&!r){t||(t=window.event);r=!0;e.condCall(n,"ontouchmove",t);r=!1;return!1}return!0}function w(t){const n=g(t);e.capture(null);if(n){t||(t=window.event);e.condCall(n,"ontouchend",t);e.cancelEvent(t,e.CancelPropagate);return!1}return!0}let T=!1;function _(t){t.addEventListener("mousemove",m,!0);t.addEventListener("mouseup",y,!0);e.isGecko&&window.addEventListener("mouseout",(function(t){!t.relatedTarget&&e.hasTag(t.target,"HTML")&&y(t)}),!0)}function v(){if(T)return;T=!0;const e=document.body;_(e);!function(e){e.addEventListener("touchmove",b,!0);e.addEventListener("touchend",w,!0)}(e)}this.capture=function(e){v();if(h&&e)return;for(let e=0;e32768){o=document.createElement("style");n.parentNode.insertBefore(o,n);o.styleSheet.cssText=t}else o.styleSheet.cssText+=t}else{const e=document.createTextNode(t);n.appendChild(e)}};this.getCssRule=function(e,t){e=e.toLowerCase();if(document.styleSheets)for(let n=0;n0){const e=o[o.length-1];e.parentNode.insertBefore(n,e.nextSibling)}else document.body.appendChild(n)}};this.removeStyleSheet=function(e){document.querySelectorAll('link[rel=stylesheet][href~="'+e+'"]').forEach((function(e){e.remove()}));const t=document.styleSheets;for(let n=0;nf.x){n=p;a=0}else if(n+d>p+f.x){let o=g.scrollLeft;g===document.body&&(o=g.clientWidth-f.x);i=i-m.x+o;n=g.clientWidth-(i+e.px(t,"marginRight"));a=1}else{let o=g.scrollLeft;g===document.body&&(o=0);n=n-m.x+o;n-=e.px(t,"marginLeft");a=0}if(u>f.y){o=h;c=0}else if(o+u>h+f.y){s>h+f.y&&(s=h+f.y);let n=g.scrollTop;g===document.body&&(n=g.clientHeight-f.y);s=s-m.y+n;o=g.clientHeight-(s+e.px(t,"marginBottom")+e.px(t,"borderBottomWidth"));c=1}else{let n=g.scrollTop;g===document.body&&(n=0);o=(o=o-m.y+n)-e.px(t,"marginTop")+e.px(t,"borderTopWidth");c=0}t.style[r[a]]=n+"px";t.style[l[c]]=o+"px"};this.positionXY=function(t,n,o){const i=e.getElement(t);if(!e.isHidden(i)){i.style.display="block";e.fitToWindow(i,n,o,n,o)}};this.Horizontal=1;this.Vertical=2;this.positionAtWidget=function(t,n,o,i){const s=e.getElement(t),r=e.getElement(n);i||(i=0);if(!r||!s)return;const l=e.widgetPageCoordinates(r);let a,c,d,u;s.style.position="absolute";"none"===e.css(s,"display")&&(s.style.display="block");if(o===e.Horizontal){a=l.x+r.offsetWidth;c=l.y+i;d=l.x;u=l.y+r.offsetHeight-i}else{a=l.x;c=l.y+r.offsetHeight;d=l.x+r.offsetWidth;u=l.y}let f,p=r;s.parentNode.removeChild(s);for(f=p.parentNode;!f.classList.contains("Wt-domRoot")&&!f.wtReparentBarrier&&!("inline"!==e.css(f,"display")&&f.clientHeight>100&&("scroll"===getComputedStyle(f).overflowY||"scroll"===getComputedStyle(f).overflowX||f.scrollHeight>f.clientHeight&&"auto"===getComputedStyle(f).overflowY||f.scrollWidth>f.clientWidth&&"auto"===getComputedStyle(f).overflowX));f=f.parentNode)p=f;const h=e.css(f,"position");"absolute"!==h&&"relative"!==h&&(f.style.position="relative");f.appendChild(s);s.classList.add("wt-reparented");e.fitToWindow(s,a,c,d,u);s.style.visibility=""};this.hasFocus=function(e){try{return e===document.activeElement}catch(e){return!1}};this.progressed=function(t){const n=document,o=n.body,i=this.getElement("Wt-form");t.style.display=i.style.display;i.parentNode.replaceChild(t,i);o.removeEventListener?o.removeEventListener("click",delayClick,!0):o.detachEvent("click",delayClick);setTimeout((function(){for(let t=0,o=delayedClicks.length;t1&&(e=e.substring(1));const n=e.split("&");e="";for(let o=0,i=n.length;o=1&&"/"===n[n.length-1]){_$_$if_UGLY_INTERNAL_PATHS_$_();o=!0;_$_$endif_$_();_$_$ifnot_UGLY_INTERNAL_PATHS_$_();n=n.substring(0,n.length-1);_$_$endif_$_()}},removeSessionId:function(){let e=r.location.pathname;const t=e.indexOf(";jsessionid=");-1!==t&&(e=e.substring(0,t));const n=e+a(r.location.search,"wtd");r.history.replaceState(null,null,n)},navigate:function(s,r){e.resolveRelativeAnchors();t=s;const l=s.replace(/%/g,"%25").replace(/\+/g,"%2b").replace(/ /g,"%20").replace(/&/g,"%26");let c=n;0!==l.length&&(c+=(o?"?_=":"")+l);if(o){let e=a(window.location.search,"_");if(e.length>1){e.length>2&&"?"===e[0]&&"&"===e[1]&&(e=e.substring(1));-1===c.indexOf("?")?c+="?"+e.substring(1):c+="&"+e.substring(1)}}else c+=window.location.search;try{const e={};e.state=s||"";e.title=document.title;S();window.history.pushState(e,document.title,c)}catch(e){console.log(e.toString())}r&&i(s)},getCurrentState:function(){return t}}}();this.maxZIndex=function(){let t=0;document.querySelectorAll(".Wt-dialog, .modal, .modal-dialog").forEach((function(n){t=Math.max(t,e.css(n,"z-index"))}));return t};this.ResponseStatus={OK:0,Error:1,Timeout:2}});if(window._$_APP_CLASS_$_&&window._$_APP_CLASS_$_._p_)try{window._$_APP_CLASS_$_._p_.quit(null)}catch(e){}window._$_APP_CLASS_$_=new function(){const self=this,WT=_$_WT_CLASS_$_,UNDEFINED="undefined";let downX=0,downY=0;const deployUrl=_$_DEPLOY_PATH_$_;function saveDownPos(e){const t=WT.pageCoordinates(e);downX=t.x;downY=t.y}let currentHash=null;function onHashChange(){const e=_$_WT_CLASS_$_.history.getCurrentState();if((!(null!==e&&e.length>0)||e.startsWith("/"))&¤tHash!==e){currentHash=e;setTimeout((function(){update(null,"hash",null,!0)}),1)}}function setHash(e,t){if(currentHash!==e&&(currentHash||"/"!==e)){t||(currentHash=e);WT.history.navigate(e,t)}}const dragState={object:null,sourceId:null,mimeType:null,dropOffsetX:null,dragOffsetY:null,dropTarget:null,objectPrevStyle:null,xy:null};let touchTimer;const touchduration=1e3;function touchStart(e,t){touchTimer=setTimeout((function(){dragStart(e,t)}),touchduration)}function touchEnded(){touchTimer&&clearTimeout(touchTimer)}function dragStart(e,t){if(t.touches&&"vibrate"in navigator){navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate;navigator.vibrate&&navigator.vibrate(100)}if((t.ctrlKey||WT.button(t)>1)&&!t.touches)return!0;const n=WT.target(t);if(n&&"inline"!==WT.css(n,"display")&&(n.offsetWidth>n.clientWidth||n.offsetHeight>n.clientHeight)){const e=WT.widgetPageCoordinates(n),o=WT.pageCoordinates(t),i=o.x-e.x,s=o.y-e.y;if(i>n.clientWidth||s>n.clientHeight)return!0}const o=dragState;o.object=WT.getElement(e.getAttribute("dwid"));if(null===o.object)return!0;o.sourceId=e.getAttribute("dsid");o.objectPrevStyle={position:o.object.style.position,display:o.object.style.display,left:o.object.style.left,top:o.object.style.top,className:o.object.className,parent:o.object.parentNode,zIndex:o.object.zIndex};o.object.parentNode.removeChild(o.object);o.object.style.position="absolute";o.object.className=o.objectPrevStyle.className+"";o.object.style.zIndex="200000";document.body.appendChild(o.object);WT.capture(null);WT.capture(o.object);o.object.onmousemove=dragDrag;o.object.onmouseup=dragEnd;document.addEventListener("mousedown",dragAbort);window.addEventListener("mouseup",dragAbort);document.addEventListener("touchstart",dragAbort);o.object.ontouchmove=dragDrag;o.object.ontouchend=dragEnd;o.offsetX=-4;o.offsetY=-4;o.dropTarget=null;o.mimeType=e.getAttribute("dmt");o.xy=WT.pageCoordinates(t);WT.cancelEvent(t,WT.CancelPropagate);return!1}function dragDrag(e){e=e||window.event;if(null!==dragState.object){const t=dragState,n=WT.pageCoordinates(e);""!==t.object.style.display&&t.xy.x!==n.x&&t.xy.y!==n.y&&(t.object.style.display="");t.object.style.left=n.x-t.offsetX+"px";t.object.style.top=n.y-t.offsetY+"px";const o=t.dropTarget;let i;if(e.changedTouches){t.object.style.display="none";i=document.elementFromPoint(e.changedTouches[0].clientX,e.changedTouches[0].clientY);t.object.style.display=""}else{i=WT.target(e);if(i===t.object&&document.elementFromPoint){t.object.style.display="none";i=document.elementFromPoint(e.clientX,e.clientY);t.object.style.display=""}}const s="{"+t.mimeType+":";let r=null;t.dropTarget=null;for(;i;){r=i.getAttribute("amts");if(null!==r&&-1!==r.indexOf(s)){t.dropTarget=i;break}i=i.parentNode;if(!i.tagName||WT.hasTag(i,"HTML"))break}if(t.dropTarget!==o){if(t.dropTarget){const e=r.indexOf(s)+s.length,n=r.indexOf("}",e),o=r.substring(e,n);if(0!==o.length){t.dropTarget.setAttribute("dos",t.dropTarget.className);t.dropTarget.className=t.dropTarget.className+" "+o}}else t.object.styleClass="";if(null!==o){o.handleDragDrop&&o.handleDragDrop("end",t.object,e,"",s);const n=o.getAttribute("dos");null!==n&&(o.className=n)}}t.dropTarget?t.dropTarget.handleDragDrop?t.dropTarget.handleDragDrop("drag",t.object,e,"",s):t.object.className=t.objectPrevStyle.className+" Wt-valid-drop":t.object.className=t.objectPrevStyle.className+"";return!1}return!0}function dragAbort(){WT.capture(null);const e=dragState;if(e.object){document.body.removeChild(e.object);e.objectPrevStyle.parent.appendChild(e.object);e.object.style.zIndex=e.objectPrevStyle.zIndex;e.object.style.position=e.objectPrevStyle.position;e.object.style.display=e.objectPrevStyle.display;e.object.style.left=e.objectPrevStyle.left;e.object.style.top=e.objectPrevStyle.top;e.object.className=e.objectPrevStyle.className;e.object=null;touchTimer&&clearTimeout(touchTimer)}if(document.removeEventListener){document.removeEventListener("mousedown",dragAbort);window.removeEventListener("mouseup",dragAbort);document.removeEventListener("touchstart",dragAbort)}else{document.detachEvent("onmousedown",dragAbort);window.detachEvent("onmouseup",dragAbort)}}function dragEnd(e){e=e||window.event;WT.capture(null);const t=dragState;if(t.object){if(t.dropTarget){const n=t.dropTarget.getAttribute("dos");null!==n&&(t.dropTarget.className=n);t.dropTarget.handleDragDrop?t.dropTarget.handleDragDrop("drop",t.object,e,t.sourceId,t.mimeType):e.touches?emit(t.dropTarget,{name:"_drop2",eventObject:t.dropTarget,event:e},t.sourceId,t.mimeType):emit(t.dropTarget,{name:"_drop",eventObject:t.dropTarget,event:e},t.sourceId,t.mimeType)}dragAbort()}}function encodeTouches(e,t){let n="";for(let o=0,i=e.length;o0?"&e"+i:"&";let s=t+pendingEvents[i].data.join(t);pendingEvents[i].evAckId=_$_INDICATOR_TIMEOUT_$_){null===currentHideLoadingIndicator&&waitFeedback();return}const o=parseInt(n,10);o>t&&(t=o)}nextWsRqId=t+1;document.body.style.cursor="auto";if(null!==currentHideLoadingIndicator){try{currentHideLoadingIndicator()}catch(e){}currentHideLoadingIndicator=null}}const WebSocketUnknown=0,WebSocketConnecting=1,WebSocketAckConnect=2,WebSocketWorking=3,WebSocketUnavailable=4,websocket={state:WebSocketUnknown,socket:null,keepAlive:null,reconnectTries:0};let connectionMonitor=null;function setServerPush(e){serverPush=e}function doAutoJavaScript(){self._p_.autoJavaScript()}function doJavaScript(e){if(e){e="(function() {"+e+"})();";window.execScript?window.execScript(e):window.eval(e)}self===window._$_APP_CLASS_$_&&doAutoJavaScript()}function webSocketAckConnect(){nextWsRqId=0;pendingWsRequests={};websocket.socket.send("&signal=none&connected="+ackUpdateId);websocket.state=WebSocketWorking}function handleResponse(e,t,n){connectionMonitor&&connectionMonitor.onStatusChange("connectionStatus",e===WT.ResponseStatus.OK?1:0);if(!hasQuit)if(waitingForJavaScript)setTimeout((function(){handleResponse(e,t,n)}),50);else{if(pollTimer){clearTimeout(pollTimer);pollTimer=null}if(e===WT.ResponseStatus.OK){WT.resolveRelativeAnchors();_$_$if_CATCH_ERROR_$_();try{_$_$endif_$_();doJavaScript(t);_$_$if_CATCH_ERROR_$_()}catch(e){const n=e.stack||e.stacktrace,o=e.description||e.message,i={exception_code:e.code,exception_description:o,exception_js:t};i.stack=n;sendError(i,"Wt internal error; code: "+e.code+", description: "+o);throw e}_$_$endif_$_();n&&cancelFeedback(n)}else pendingEvents=sentEvents.concat(pendingEvents);sentEvents=[];responsePending=null;e===WT.ResponseStatus.OK?commErrors=0:e===WT.ResponseStatus.Error&&++commErrors;if(!hasQuit){websocket.state===WebSocketAckConnect&&webSocketAckConnect();if(serverPush&&!waitingForJavaScript||pendingEvents.length>0)if(e===WT.ResponseStatus.Error){const e=Math.min(12e4,500*Math.exp(commErrors));updateTimeout=setTimeout((function(){sendUpdate()}),e)}else null===updateTimeout&&sendUpdate()}}}function setSessionUrl(e){sessionUrl=-1!==e.indexOf("://")||"/"===e[0]?e:deployUrl+e;comm&&comm.setUrl(e)}setSessionUrl(_$_SESSION_URL_$_);comm=WT.initAjaxComm(sessionUrl,handleResponse);function doPollTimeout(){responsePending.abort();responsePending=null;pollTimer=null;hasQuit||sendUpdate()}function setConnectionMonitor(e){connectionMonitor=e;connectionMonitor.status={};connectionMonitor.status.connectionStatus=0;connectionMonitor.status.websocket=!1;connectionMonitor.onStatusChange=function(e,t){const n=connectionMonitor.status[e];if(n!==t){connectionMonitor.status[e]=t;connectionMonitor.onChange(e,n,t)}}}let updating=!1,updateTimeoutStart;function update(e,t,n,o){checkEventOverflow();if(!updating){updating=!0;WT.checkReleaseCapture(e,n);_$_$if_STRICTLY_SERIALIZED_EVENTS_$_();if(!responsePending){_$_$endif_$_();const i={},s=pendingEvents.length;i.object=e;i.signal=t;i.event=window.fakeEvent||n;i.feedback=o;i.evAckId=ackUpdateId;pendingEvents[s]=encodeEvent(i);scheduleUpdate();doJavaScript();_$_$if_STRICTLY_SERIALIZED_EVENTS_$_()}_$_$endif_$_();updating=!1}}function schedulePing(){websocket.keepAlive&&clearInterval(websocket.keepAlive);websocket.keepAlive=setInterval((function(){const e=websocket.socket;if(1===e.readyState)e.send("&signal=ping");else{clearInterval(websocket.keepAlive);websocket.keepAlive=null}}),_$_SERVER_PUSH_TIMEOUT_$_)}function scheduleUpdate(){if(hasQuit){if(!quitStr)return;if(confirm(quitStr)){document.location=document.location;quitStr=null;return}quitStr=null}else{_$_$if_WEB_SOCKETS_$_();if(websocket.state!==WebSocketUnavailable)if(typeof window.WebSocket===UNDEFINED)websocket.state=WebSocketUnavailable;else{let t=websocket.socket;if(null===t||t.readyState>1)if(null!==t&&websocket.state===WebSocketUnknown)websocket.state=WebSocketUnavailable;else{function e(){if(!hasQuit){++websocket.reconnectTries;const e=Math.min(12e4,500*Math.exp(websocket.reconnectTries));setTimeout((function(){scheduleUpdate()}),e)}}let n;if(-1!==sessionUrl.indexOf("://"))n="ws"+sessionUrl.substring(4);else{const i=sessionUrl.substring(sessionUrl.indexOf("?"));n="ws"+location.protocol.substring(4)+"//"+location.host+_$_WS_PATH_$_+i}n+="&request=ws";const o=_$_WS_ID_$_;o.length>0&&(n+="&wsid="+o);websocket.socket=t=new WebSocket(n);websocket.state=WebSocketConnecting;websocket.keepAlive&&clearInterval(websocket.keepAlive);websocket.keepAlive=null;t.onmessage=function(e){let t=null;if(websocket.state===WebSocketConnecting){if("connect"!==e.data){console.log("WebSocket: was expecting a connect?");console.log(e.data);return}if(null!==responsePending&&null!==pollTimer){clearTimeout(pollTimer);pollTimer=null;responsePending.abort();responsePending=null}responsePending||!WT.isEmptyObject(pendingWsRequests)?websocket.state=WebSocketAckConnect:webSocketAckConnect()}else{if(connectionMonitor){connectionMonitor.onStatusChange("websocket",!0);connectionMonitor.onStatusChange("connectionStatus",1)}websocket.state=WebSocketWorking;t=e.data}websocket.reconnectTries=0;null!==t&&handleResponse(WT.ResponseStatus.OK,t,null)};t.onerror=function(t){connectionMonitor&&connectionMonitor.onStatusChange("websocket",!1);3===websocket.reconnectTries&&websocket.state===WebSocketUnknown&&(websocket.state=WebSocketUnavailable);e()};t.onclose=function(t){connectionMonitor&&connectionMonitor.onStatusChange("websocket",!1);3===websocket.reconnectTries&&websocket.state===WebSocketUnknown&&(websocket.state=WebSocketUnavailable);e()};t.onopen=function(e){if(connectionMonitor){connectionMonitor.onStatusChange("websocket",!0);connectionMonitor.onStatusChange("connectionStatus",1)}schedulePing()}}if(1===t.readyState&&t.state===WebSocketWorking){schedulePing();sendUpdate();return}}_$_$endif_$_();if(null!==responsePending&&null!==pollTimer){clearTimeout(pollTimer);pollTimer=null;responsePending.abort();responsePending=null}if(null===responsePending)if(null===updateTimeout){updateTimeout=setTimeout((function(){sendUpdate()}),WT.updateDelay);updateTimeoutStart=(new Date).getTime()}else if(commErrors){clearTimeout(updateTimeout);updateTimeout=null;sendUpdate()}else{if((new Date).getTime()-updateTimeoutStart>WT.updateDelay){clearTimeout(updateTimeout);updateTimeout=null;sendUpdate()}}}}let ackUpdateId=_$_ACK_UPDATE_ID_$_,ackPuzzle=null;function responseReceived(e,t){ackPuzzle=t;ackUpdateId=e;comm.responseReceived(e)}function wsRqsDone(){for(let e=0;e0&&(n+="&Wt-params="+encodeURIComponent(i));if(pendingEvents.length>0){let i=_$_MAX_FORMDATA_SIZE_$_-n.length;o&&(i-=("&wsRqId="+nextWsRqId).length);const s=encodePendingEvents(i);e=s.feedback?setTimeout(o?wsWaitFeedback:waitFeedback,_$_INDICATOR_TIMEOUT_$_):null;n+=s.result;t=!1}else{n+="&signal=poll";e=null;t=!0}if(o){responsePending=null;if(!t){if(e){const t=nextWsRqId;pendingWsRequests[t]={time:Date.now(),tm:e};++nextWsRqId;n+="&wsRqId="+t}websocket.socket.send(n)}}else{if(responsePending)try{throw new Error("responsePending is true before comm.sendUpdate")}catch(e){const t=e.stack||e.stacktrace,n=e.description||e.message,o={exception_description:n};o.stack=t;sendError(o,"Wt internal error; description: "+n);throw e}pollTimer=t?setTimeout(doPollTimeout,_$_SERVER_PUSH_TIMEOUT_$_):null;responsePending=1;responsePending=comm.sendUpdate("request=jsupdate"+n,e,ackUpdateId,-1,t)}}function propagateSize(e,t,n){-1===t&&(t=e.offsetWidth);-1===n&&(n=e.offsetHeight);if(typeof e.wtWidth===UNDEFINED||e.wtWidth!==t||typeof e.wtHeight===UNDEFINED||e.wtHeight!==n){e.wtWidth=t;e.wtHeight=n;t>=0&&n>=0&&emit(e,"resized",Math.round(t),Math.round(n))}}function emit(e,t){checkEventOverflow();const n={},o=pendingEvents.length;n.signal="user";n.id="string"==typeof e?e:e===self?"app":e.id;if("object"==typeof t){n.name=t.name;n.object=t.eventObject;n.event=t.event}else{n.name=t;n.object=n.event=null}n.args=[];for(let e=2;e0&&pendingEvents.length>=_$_MAX_PENDING_EVENTS_$_){const e="too many pending events";sendError(e,"Wt internal error; description: "+e);pendingEvents=[];throw new Error(e)}}function addTimerEvent(e,t,n){const o=function(){const t=WT.getElement(e);if(t){if(-1!==n)t.timer=setTimeout(t.tm,n);else{t.timer=null;t.tm=null}t.onclick&&t.onclick()}},i=WT.getElement(e);i.timer&&clearTimeout(i.timer);i.timer=setTimeout(o,t);i.tm=o}const jsLibsLoaded={};let waitingForJavaScript=!1;function onJsLoad(e,t){setTimeout((function(){if(!0===jsLibsLoaded[e]){waitingForJavaScript=!1;t();!waitingForJavaScript&&serverPush&&sendUpdate()}else jsLibsLoaded[e]=t}),20);waitingForJavaScript=!0}function jsLoaded(e){if(!0!==jsLibsLoaded[e]){if(typeof jsLibsLoaded[e]!==UNDEFINED){waitingForJavaScript=!1;jsLibsLoaded[e]();!waitingForJavaScript&&serverPush&&sendUpdate()}jsLibsLoaded[e]=!0}}function loadScript(uri,symbol,tries){let loaded=!1,error=!1;function onerror(){if(!loaded&&!error){error=!0;const e=typeof tries===UNDEFINED?2:tries;if(e>1)loadScript(uri,symbol,e-1);else{const e={"error-description":"Fatal error: failed loading "+uri};sendError(e,e["error-description"]);quit(null)}}}function onload(){if(!loaded&&!error){loaded=!0;jsLoaded(uri)}}if(""!==symbol)try{loaded=!eval("typeof "+symbol+" === 'undefined'")}catch(e){loaded=!1}if(loaded)jsLoaded(uri);else{const e=document.createElement("script");e.setAttribute("src",uri);e.onload=onload;e.onerror=onerror;e.onreadystatechange=function(){const t=e.readyState;"loaded"===t?onerror():"complete"===t&&onload()};const t=document.getElementsByTagName("head")[0];t.appendChild(e)}}function ImagePreloader(e,t){this.callback=t;this.work=e.length;this.images=[];if(0===e.length)this.callback(this.images);else for(const t of e)this.preload(t)}ImagePreloader.prototype.preload=function(e){const t=new Image;this.images.push(t);t.onload=ImagePreloader.prototype.onload;t.onerror=ImagePreloader.prototype.onload;t.onabort=ImagePreloader.prototype.onload;t.imagePreloader=this;t.src=e};ImagePreloader.prototype.onload=function(){const e=this.imagePreloader;0==--e.work&&e.callback(e.images)};ImagePreloader.prototype.cancel=function(){const e=this.images;for(const t of e){t.onload=function(){};t.onerror=function(){};t.onabort=function(){}}this.callback=function(){}};function ArrayBufferPreloader(e,t){this.callback=t;this.work=e.length;this.arrayBuffers=[];if(0===e.length)t(this.arrayBuffers);else for(let t=0;t