/*!
 * ASP.NET SignalR JavaScript Library v2.0.0
 * http://signalr.net/
 *
 * Copyright (C) Microsoft Corporation. All rights reserved.
 *
 */
(function(n,t,i){"use strict";function w(t,i){var u,f;if(n.isArray(t)){for(u=t.length-1;u>=0;u--)f=t[u],n.type(t)==="object"||n.type(f)==="string"&&r.transports[f]||(i.log("Invalid transport: "+f+", removing it from the transports list."),t.splice(u,1));t.length===0&&(i.log("No transports remain within the specified transport array."),t=null)}else if(n.type(t)==="object"||r.transports[t]||t==="auto"){if(t==="auto"&&r._.ieVersion<=8)return["longPolling"]}else i.log("Invalid transport: "+t.toString()+"."),t=null;return t}function b(n){return n==="http:"?80:n==="https:"?443:void 0}function l(n,t){return t.match(/:\d+$/)?t:t+":"+b(n)}function k(t,i){var u=this,r=[];u.tryBuffer=function(i){return t.state===n.signalR.connectionState.connecting?(r.push(i),!0):!1};u.drain=function(){if(t.state===n.signalR.connectionState.connected)while(r.length>0)i(r.shift())};u.clear=function(){r=[]}}var f={nojQuery:"jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.",noTransportOnInit:"No transport could be initialized successfully. Try specifying a different transport or none at all for auto initialization.",errorOnNegotiate:"Error during negotiation request.",stoppedWhileLoading:"The connection was stopped during page load.",stoppedWhileNegotiating:"The connection was stopped during the negotiate request.",errorParsingNegotiateResponse:"Error parsing negotiate response.",protocolIncompatible:"You are using a version of the client that isn't compatible with the server. Client version {0}, server version {1}.",sendFailed:"Send failed.",parseFailed:"Failed at parsing response: {0}",longPollFailed:"Long polling request failed.",eventSourceFailedToConnect:"EventSource failed to connect.",eventSourceError:"Error raised by EventSource",webSocketClosed:"WebSocket closed.",pingServerFailedInvalidResponse:"Invalid ping response when pinging server: '{0}'.",pingServerFailed:"Failed to ping server.",pingServerFailedStatusCode:"Failed to ping server.  Server responded with status code {0}, stopping the connection.",pingServerFailedParse:"Failed to parse ping server response, stopping the connection.",noConnectionTransport:"Connection is in an invalid state, there is no transport active."};if(typeof n!="function")throw new Error(f.nojQuery);var r,h,s=t.document.readyState==="complete",e=n(t),c="__Negotiate Aborted__",u={onStart:"onStart",onStarting:"onStarting",onReceived:"onReceived",onError:"onError",onConnectionSlow:"onConnectionSlow",onReconnecting:"onReconnecting",onReconnect:"onReconnect",onStateChanged:"onStateChanged",onDisconnect:"onDisconnect"},a=function(n,i){if(i!==!1){var r;typeof t.console!="undefined"&&(r="["+(new Date).toTimeString()+"] SignalR: "+n,t.console.debug?t.console.debug(r):t.console.log&&t.console.log(r))}},o=function(t,i,r){return i===t.state?(t.state=r,n(t).triggerHandler(u.onStateChanged,[{oldState:i,newState:r}]),!0):!1},v=function(n){return n.state===r.connectionState.disconnected},y=function(i){var f=i._.config,e=function(t){n(i).triggerHandler(u.onError,[t])};!f.pingIntervalId&&f.pingInterval&&(i._.pingIntervalId=t.setInterval(function(){r.transports._logic.pingServer(i).fail(e)},f.pingInterval))},p=function(n){var i,u;n._.configuredStopReconnectingTimeout||(u=function(n){n.log("Couldn't reconnect within the configured timeout ("+n.disconnectTimeout+"ms), disconnecting.");n.stop(!1,!1)},n.reconnecting(function(){var n=this;n.state===r.connectionState.reconnecting&&(i=t.setTimeout(function(){u(n)},n.disconnectTimeout))}),n.stateChanged(function(n){n.oldState===r.connectionState.reconnecting&&t.clearTimeout(i)}),n._.configuredStopReconnectingTimeout=!0)};r=function(n,t,i){return new r.fn.init(n,t,i)};r._={defaultContentType:"application/x-www-form-urlencoded; charset=UTF-8",ieVersion:function(){var i,n;return t.navigator.appName==="Microsoft Internet Explorer"&&(n=/MSIE ([0-9]+\.[0-9]+)/.exec(t.navigator.userAgent),n&&(i=t.parseFloat(n[1]))),i}(),error:function(n,t){var i=new Error(n);return i.source=t,i},transportError:function(n,t,r){var u=this.error(n,r);return u.transport=t?t.name:i,u},format:function(){for(var t=arguments[0],n=0;n<arguments.length-1;n++)t=t.replace("{"+n+"}",arguments[n+1]);return t},firefoxMajorVersion:function(n){var t=n.match(/Firefox\/(\d+)/);return!t||!t.length||t.length<2?0:parseInt(t[1],10)}};r.events=u;r.resources=f;r.ajaxDefaults={processData:!0,timeout:null,async:!0,global:!1,cache:!1};r.changeState=o;r.isDisconnecting=v;r.connectionState={connecting:0,connected:1,reconnecting:2,disconnected:4};r.hub={start:function(){throw new Error("SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/js'><\/script>.");}};e.load(function(){s=!0});r.fn=r.prototype={init:function(t,i,r){var f=n(this);this.url=t;this.qs=i;this._={connectingMessageBuffer:new k(this,function(n){f.triggerHandler(u.onReceived,[n])}),onFailedTimeoutHandle:null};typeof r=="boolean"&&(this.logging=r)},_parseResponse:function(n){var t=this;return n?t.ajaxDataType==="text"?t.json.parse(n):n:n},json:t.JSON,isCrossDomain:function(i,r){var u;return(i=n.trim(i),i.indexOf("http")!==0)?!1:(r=r||t.location,u=t.document.createElement("a"),u.href=i,u.protocol+l(u.protocol,u.host)!==r.protocol+l(r.protocol,r.host))},ajaxDataType:"text",contentType:"application/json; charset=UTF-8",logging:!1,state:r.connectionState.disconnected,keepAliveData:{},clientProtocol:"1.3",reconnectDelay:2e3,transportConnectTimeout:0,disconnectTimeout:3e4,keepAliveWarnAt:2/3,start:function(i,h){var l=this,a={pingInterval:3e5,waitForPageLoad:!0,transport:"auto",jsonp:!1},d,v=l._deferral||n.Deferred(),b=t.document.createElement("a"),k,g;if(l._deferral=v,!l.json)throw new Error("SignalR: No JSON parser found. Please ensure json2.js is referenced before the SignalR.js file if you need to support clients without native JSON parsing support, e.g. IE<8.");if(n.type(i)==="function"?h=i:n.type(i)==="object"&&(n.extend(a,i),n.type(a.callback)==="function"&&(h=a.callback)),a.transport=w(a.transport,l),!a.transport)throw new Error("SignalR: Invalid transport(s) specified, aborting start.");return(l._.config=a,!s&&a.waitForPageLoad===!0)?(l._.deferredStartHandler=function(){l.start(i,h)},e.bind("load",l._.deferredStartHandler),v.promise()):l.state===r.connectionState.connecting?v.promise():o(l,r.connectionState.disconnected,r.connectionState.connecting)===!1?(v.resolve(l),v.promise()):(p(l),b.href=l.url,b.protocol&&b.protocol!==":"?(l.protocol=b.protocol,l.host=b.host,l.baseUrl=b.protocol+"//"+b.host):(l.protocol=t.document.location.protocol,l.host=t.document.location.host,l.baseUrl=l.protocol+"//"+l.host),l.wsProtocol=l.protocol==="https:"?"wss://":"ws://",a.transport==="auto"&&a.jsonp===!0&&(a.transport="longPolling"),this.isCrossDomain(l.url)&&(l.log("Auto detected cross domain url."),a.transport==="auto"&&(a.transport=["webSockets","longPolling"]),typeof a.withCredentials=="undefined"&&(a.withCredentials=!0),a.jsonp||(a.jsonp=!n.support.cors,a.jsonp&&l.log("Using jsonp because this browser doesn't support CORS.")),l.contentType=r._.defaultContentType),l.withCredentials=a.withCredentials,l.ajaxDataType=a.jsonp?"jsonp":"text",n(l).bind(u.onStart,function(){n.type(h)==="function"&&h.call(l);v.resolve(l)}),d=function(i,s){var w=r._.error(f.noTransportOnInit);if(s=s||0,s>=i.length){n(l).triggerHandler(u.onError,[w]);v.reject(w);l.stop();return}if(l.state!==r.connectionState.disconnected){var c=i[s],h=n.type(c)==="object"?c:r.transports[c],a=!1,p=function(){a||(a=!0,t.clearTimeout(l._.onFailedTimeoutHandle),h.stop(l),d(i,s+1))};if(l.transport=h,c.indexOf("_")===0){d(i,s+1);return}try{l._.onFailedTimeoutHandle=t.setTimeout(function(){l.log(h.name+" timed out when trying to connect.");p()},l.transportConnectTimeout);h.start(l,function(){var i=r._.firefoxMajorVersion(t.navigator.userAgent)>=11,f=!!l.withCredentials&&i;l.state!==r.connectionState.disconnected&&(a||(a=!0,t.clearTimeout(l._.onFailedTimeoutHandle),h.supportsKeepAlive&&l.keepAliveData.activated&&r.transports._logic.monitorKeepAlive(l),y(l),o(l,r.connectionState.connecting,r.connectionState.connected),l._.connectingMessageBuffer.drain(),n(l).triggerHandler(u.onStart),e.bind("unload",function(){l.log("Window unloading, stopping the connection.");l.stop(f)}),i&&e.bind("beforeunload",function(){t.setTimeout(function(){l.stop(f)},0)})))},p)}catch(b){l.log(h.name+" transport threw '"+b.message+"' when attempting to start.");p()}}},k=l.url+"/negotiate",g=function(t,i){var e=r._.error(f.errorOnNegotiate,t);n(i).triggerHandler(u.onError,e);v.reject(e);i.stop()},n(l).triggerHandler(u.onStarting),k=r.transports._logic.prepareQueryString(l,k),k=r.transports._logic.addQs(k,{clientProtocol:l.clientProtocol}),l.log("Negotiating with '"+k+"'."),l._.negotiateRequest=n.ajax(n.extend({},n.signalR.ajaxDefaults,{xhrFields:{withCredentials:l.withCredentials},url:k,type:"GET",contentType:l.contentType,data:{},dataType:l.ajaxDataType,error:function(n,t){t!==c?g(n,l):v.reject(r._.error(f.stoppedWhileNegotiating))},success:function(t){var i,e,h,o=[],s=[];try{i=l._parseResponse(t)}catch(c){g(r._.error(f.errorParsingNegotiateResponse,c),l);return}if(e=l.keepAliveData,l.appRelativeUrl=i.Url,l.id=i.ConnectionId,l.token=i.ConnectionToken,l.webSocketServerUrl=i.WebSocketServerUrl,l.disconnectTimeout=i.DisconnectTimeout*1e3,l.transportConnectTimeout=l.transportConnectTimeout+i.TransportConnectTimeout*1e3,i.KeepAliveTimeout?(e.activated=!0,e.timeout=i.KeepAliveTimeout*1e3,e.timeoutWarning=e.timeout*l.keepAliveWarnAt,e.checkInterval=(e.timeout-e.timeoutWarning)/3):e.activated=!1,!i.ProtocolVersion||i.ProtocolVersion!==l.clientProtocol){h=r._.error(r._.format(f.protocolIncompatible,l.clientProtocol,i.ProtocolVersion));n(l).triggerHandler(u.onError,[h]);v.reject(h);return}n.each(r.transports,function(n){if(n==="webSockets"&&!i.TryWebSockets)return!0;s.push(n)});n.isArray(a.transport)?n.each(a.transport,function(){var t=this;(n.type(t)==="object"||n.type(t)==="string"&&n.inArray(""+t,s)>=0)&&o.push(n.type(t)==="string"?""+t:t)}):n.type(a.transport)==="object"||n.inArray(a.transport,s)>=0?o.push(a.transport):o=s;d(o)}})),v.promise())},starting:function(t){var i=this;return n(i).bind(u.onStarting,function(){t.call(i)}),i},send:function(n){var t=this;if(t.state===r.connectionState.disconnected)throw new Error("SignalR: Connection must be started before data can be sent. Call .start() before .send()");if(t.state===r.connectionState.connecting)throw new Error("SignalR: Connection has not been fully initialized. Use .start().done() or .start().fail() to run logic after the connection has started.");return t.transport.send(t,n),t},received:function(t){var i=this;return n(i).bind(u.onReceived,function(n,r){i._.connectingMessageBuffer.tryBuffer(r)||t.call(i,r)}),i},stateChanged:function(t){var i=this;return n(i).bind(u.onStateChanged,function(n,r){t.call(i,r)}),i},error:function(t){var i=this;return n(i).bind(u.onError,function(n,r){t.call(i,r)}),i},disconnected:function(t){var i=this;return n(i).bind(u.onDisconnect,function(){t.call(i)}),i},connectionSlow:function(t){var i=this;return n(i).bind(u.onConnectionSlow,function(){t.call(i)}),i},reconnecting:function(t){var i=this;return n(i).bind(u.onReconnecting,function(){t.call(i)}),i},reconnected:function(t){var i=this;return n(i).bind(u.onReconnect,function(){t.call(i)}),i},stop:function(i,h){var l=this,a=l._deferral;if(l._.deferredStartHandler&&e.unbind("load",l._.deferredStartHandler),delete l._deferral,delete l._.config,delete l._.deferredStartHandler,!s&&(!l._.config||l._.config.waitForPageLoad===!0)){l.log("Stopping connection prior to negotiate.");a&&a.reject(r._.error(f.stoppedWhileLoading));return}if(l.state!==r.connectionState.disconnected){try{l.log("Stopping connection.");t.clearTimeout(l._.onFailedTimeoutHandle);t.clearInterval(l._.pingIntervalId);l.transport&&(h!==!1&&l.transport.abort(l,i),l.transport.supportsKeepAlive&&l.keepAliveData.activated&&r.transports._logic.stopMonitoringKeepAlive(l),l.transport.stop(l),l.transport=null);l._.negotiateRequest&&(l._.negotiateRequest.abort(c),delete l._.negotiateRequest);n(l).triggerHandler(u.onDisconnect);delete l.messageId;delete l.groupsToken;delete l.id;delete l._.pingIntervalId;l._.connectingMessageBuffer.clear()}finally{o(l,l.state,r.connectionState.disconnected)}return l}},log:function(n){a(n,this.logging)}};r.fn.init.prototype=r.fn;r.noConflict=function(){return n.connection===r&&(n.connection=h),r};n.connection&&(h=n.connection);n.connection=n.signalR=r})(window.jQuery,window),function(n,t){"use strict";function f(u){var e=u.keepAliveData,o,s;u.state===i.connectionState.connected&&(o=new Date,o.setTime(o-e.lastKeepAlive),s=o.getTime(),s>=e.timeout?(u.log("Keep alive timed out.  Notifying transport that connection has been lost."),u.transport.lostConnection(u)):s>=e.timeoutWarning?e.userNotified||(u.log("Keep alive has been missed, connection may be dead/slow."),n(u).triggerHandler(r.onConnectionSlow),e.userNotified=!0):e.userNotified=!1);e.monitoring&&t.setTimeout(function(){f(u)},e.checkInterval)}function o(n){return n.state===i.connectionState.connected||n.state===i.connectionState.reconnecting}function s(n,i){var r=n.indexOf("?")!==-1?"&":"?";return i&&(n+=r+"connectionData="+t.encodeURIComponent(i)),n}var i=n.signalR,r=n.signalR.events,e=n.signalR.changeState,u;i.transports={};u=i.transports._logic={pingServer:function(t){var e,f,r=n.Deferred();return t.transport?(e=t.transport.name==="webSockets"?"":t.baseUrl,f=e+t.appRelativeUrl+"/ping",f=u.prepareQueryString(t,f),n.ajax(n.extend({},n.signalR.ajaxDefaults,{xhrFields:{withCredentials:t.withCredentials},url:f,type:"GET",contentType:t.contentType,data:{},dataType:t.ajaxDataType,success:function(n){var u;try{u=t._parseResponse(n)}catch(f){r.reject(i._.transportError(i.resources.pingServerFailedParse,t.transport,f));t.stop();return}u.Response==="pong"?r.resolve():r.reject(i._.transportError(i._.format(i.resources.pingServerFailedInvalidResponse,n.responseText),t.transport))},error:function(n){n.status===401||n.status===403?(r.reject(i._.transportError(i._.format(i.resources.pingServerFailedStatusCode,n.status),t.transport,n)),t.stop()):r.reject(i._.transportError(i.resources.pingServerFailed,t.transport,n))}}))):r.reject(i._.transportError(i.resources.noConnectionTransport,t.transport)),r.promise()},prepareQueryString:function(n,t){return t=u.addQs(t,n.qs),s(t,n.data)},addQs:function(t,i){var r=t.indexOf("?")!==-1?"&":"?",u;if(!i)return t;if(typeof i=="object")return t+r+n.param(i);if(typeof i=="string")return u=i.charAt(0),(u==="?"||u==="&")&&(r=""),t+r+i;throw new Error("Query string property must be either a string or object.");},getUrl:function(n,i,r,f){var s=i==="webSockets"?"":n.baseUrl,e=s+n.appRelativeUrl,o="transport="+i+"&connectionToken="+t.encodeURIComponent(n.token);return n.groupsToken&&(o+="&groupsToken="+t.encodeURIComponent(n.groupsToken)),r?(e+=f?"/poll":"/reconnect",n.messageId&&(o+="&messageId="+t.encodeURIComponent(n.messageId))):e+="/connect",e+="?"+o,e=u.prepareQueryString(n,e),e+("&tid="+Math.floor(Math.random()*11))},maximizePersistentResponse:function(n){return{MessageId:n.C,Messages:n.M,Initialized:typeof n.S!="undefined"?!0:!1,Disconnect:typeof n.D!="undefined"?!0:!1,ShouldReconnect:typeof n.T!="undefined"?!0:!1,LongPollDelay:n.L,GroupsToken:n.G}},updateGroups:function(n,t){t&&(n.groupsToken=t)},stringifySend:function(n,t){return typeof t=="string"||typeof t=="undefined"||t===null?t:n.json.stringify(t)},ajaxSend:function(f,e){var h=u.stringifySend(f,e),o=f.url+"/send?transport="+f.transport.name+"&connectionToken="+t.encodeURIComponent(f.token),s=function(t,u){n(u).triggerHandler(r.onError,[i._.transportError(i.resources.sendFailed,u.transport,t),e])};return o=u.prepareQueryString(f,o),n.ajax(n.extend({},n.signalR.ajaxDefaults,{xhrFields:{withCredentials:f.withCredentials},url:o,type:f.ajaxDataType==="jsonp"?"GET":"POST",contentType:i._.defaultContentType,dataType:f.ajaxDataType,data:{data:h},success:function(t){var i;if(t){try{i=f._parseResponse(t)}catch(u){s(u,f);f.stop();return}n(f).triggerHandler(r.onReceived,[i])}},error:function(n,t){t!=="abort"&&t!=="parsererror"&&s(n,f)}}))},ajaxAbort:function(i,r){if(typeof i.transport!="undefined"){r=typeof r=="undefined"?!0:r;var f=i.url+"/abort?transport="+i.transport.name+"&connectionToken="+t.encodeURIComponent(i.token);f=u.prepareQueryString(i,f);n.ajax(n.extend({},n.signalR.ajaxDefaults,{xhrFields:{withCredentials:i.withCredentials},url:f,async:r,timeout:1e3,type:"POST",contentType:i.contentType,dataType:i.ajaxDataType,data:{}}));i.log("Fired ajax abort async = "+r+".")}},tryInitialize:function(n,t){n.Initialized&&t()},processMessages:function(t,i,f){var e,o=n(t);if(t.transport&&t.transport.supportsKeepAlive&&t.keepAliveData.activated&&this.updateKeepAlive(t),i){if(e=this.maximizePersistentResponse(i),e.Disconnect){t.log("Disconnect command received from server.");t.stop(!1,!1);return}this.updateGroups(t,e.GroupsToken);e.MessageId&&(t.messageId=e.MessageId);e.Messages&&(n.each(e.Messages,function(n,t){o.triggerHandler(r.onReceived,[t])}),u.tryInitialize(e,f))}},monitorKeepAlive:function(t){var i=t.keepAliveData,u=this;i.monitoring?t.log("Tried to monitor keep alive but it's already being monitored."):(i.monitoring=!0,u.updateKeepAlive(t),t.keepAliveData.reconnectKeepAliveUpdate=function(){u.updateKeepAlive(t)},n(t).bind(r.onReconnect,t.keepAliveData.reconnectKeepAliveUpdate),t.log("Now monitoring keep alive with a warning timeout of "+i.timeoutWarning+" and a connection lost timeout of "+i.timeout+"."),f(t))},stopMonitoringKeepAlive:function(t){var i=t.keepAliveData;i.monitoring&&(i.monitoring=!1,n(t).unbind(r.onReconnect,t.keepAliveData.reconnectKeepAliveUpdate),t.keepAliveData={},t.log("Stopping the monitoring of the keep alive."))},updateKeepAlive:function(n){n.keepAliveData.lastKeepAlive=new Date},ensureReconnectingState:function(t){return e(t,i.connectionState.connected,i.connectionState.reconnecting)===!0&&n(t).triggerHandler(r.onReconnecting),t.state===i.connectionState.reconnecting},clearReconnectTimeout:function(n){n&&n._.reconnectTimeout&&(t.clearTimeout(n._.reconnectTimeout),delete n._.reconnectTimeout)},reconnect:function(n,r){var u=i.transports[r],f=this;o(n)&&!n._.reconnectTimeout&&(n._.reconnectTimeout=t.setTimeout(function(){u.stop(n);f.ensureReconnectingState(n)&&(n.log(r+" reconnecting."),u.start(n))},n.reconnectDelay))},handleParseFailure:function(t,u,f,e){t.state===i.connectionState.connecting?(t.log("Failed to parse server response while attempting to connect."),e()):(n(t).triggerHandler(r.onError,[i._.transportError(i._.format(i.resources.parseFailed,u),t.transport,f)]),t.stop())},foreverFrame:{count:0,connections:{}}}}(window.jQuery,window),function(n,t){"use strict";var r=n.signalR,u=n.signalR.events,f=n.signalR.changeState,i=r.transports._logic;r.transports.webSockets={name:"webSockets",supportsKeepAlive:!0,send:function(n,t){var r=i.stringifySend(n,t);n.socket.send(r)},start:function(e,o,s){var h,c=!1,l=this,a=!o,v=n(e);if(!t.WebSocket){s();return}e.socket||(h=e.webSocketServerUrl?e.webSocketServerUrl:e.wsProtocol+e.host,h+=i.getUrl(e,this.name,a),e.log("Connecting to websocket endpoint '"+h+"'."),e.socket=new t.WebSocket(h),e.socket.onopen=function(){c=!0;e.log("Websocket opened.");i.clearReconnectTimeout(e);f(e,r.connectionState.reconnecting,r.connectionState.connected)===!0&&v.triggerHandler(u.onReconnect)},e.socket.onclose=function(t){if(this===e.socket){if(c)typeof t.wasClean!="undefined"&&t.wasClean===!1?(n(e).triggerHandler(u.onError,[r._.transportError(r.resources.webSocketClosed,e.transport,t)]),e.log("Unclean disconnect from websocket: "+t.reason||"[no reason given].")):e.log("Websocket closed.");else{s?s():a&&l.reconnect(e);return}l.reconnect(e)}},e.socket.onmessage=function(t){var r,f=n(e);try{r=e._parseResponse(t.data)}catch(h){i.handleParseFailure(e,t.data,h,s);return}r&&(n.isEmptyObject(r)||r.M?i.processMessages(e,r,o):f.triggerHandler(u.onReceived,[r]))})},reconnect:function(n){i.reconnect(n,this.name)},lostConnection:function(n){this.reconnect(n)},stop:function(n){i.clearReconnectTimeout(n);n.socket&&(n.log("Closing the Websocket."),n.socket.close(),n.socket=null)},abort:function(n,t){i.ajaxAbort(n,t)}}}(window.jQuery,window),function(n,t){"use strict";var i=n.signalR,u=n.signalR.events,f=n.signalR.changeState,r=i.transports._logic;i.transports.serverSentEvents={name:"serverSentEvents",supportsKeepAlive:!0,timeOut:3e3,start:function(e,o,s){var h=this,c=!1,l=n(e),a=!o,v,y;if(e.eventSource&&(e.log("The connection already has an event source. Stopping it."),e.stop()),!t.EventSource){s&&(e.log("This browser doesn't support SSE."),s());return}v=r.getUrl(e,this.name,a);try{e.log("Attempting to connect to SSE endpoint '"+v+"'.");e.eventSource=new t.EventSource(v)}catch(p){e.log("EventSource failed trying to connect with error "+p.Message+".");s?s():(l.triggerHandler(u.onError,[i._.transportError(i.resources.eventSourceFailedToConnect,e.transport,p)]),a&&h.reconnect(e));return}a&&(y=t.setTimeout(function(){c===!1&&e.eventSource.readyState!==t.EventSource.OPEN&&h.reconnect(e)},h.timeOut));e.eventSource.addEventListener("open",function(){e.log("EventSource connected.");y&&t.clearTimeout(y);r.clearReconnectTimeout(e);c===!1&&(c=!0,f(e,i.connectionState.reconnecting,i.connectionState.connected)===!0&&l.triggerHandler(u.onReconnect))},!1);e.eventSource.addEventListener("message",function(n){var t;if(n.data!=="initialized"){try{t=e._parseResponse(n.data)}catch(i){r.handleParseFailure(e,n.data,i,s);return}r.processMessages(e,t,o)}},!1);e.eventSource.addEventListener("error",function(n){if(this===e.eventSource){if(!c){s&&s();return}e.log("EventSource readyState: "+e.eventSource.readyState+".");n.eventPhase===t.EventSource.CLOSED?(e.log("EventSource reconnecting due to the server connection ending."),h.reconnect(e)):(e.log("EventSource error."),l.triggerHandler(u.onError,[i._.transportError(i.resources.eventSourceError,e.transport,n)]))}},!1)},reconnect:function(n){r.reconnect(n,this.name)},lostConnection:function(n){this.reconnect(n)},send:function(n,t){r.ajaxSend(n,t)},stop:function(n){r.clearReconnectTimeout(n);n&&n.eventSource&&(n.log("EventSource calling close()."),n.eventSource.close(),n.eventSource=null,delete n.eventSource)},abort:function(n,t){r.ajaxAbort(n,t)}}}(window.jQuery,window),function(n,t){"use strict";var r=n.signalR,f=n.signalR.events,e=n.signalR.changeState,i=r.transports._logic,u=function(){var u=null,f=1e3,i=0;return{prevent:function(){r._.ieVersion<=8&&(i===0&&(u=t.setInterval(function(){var t=n("<iframe style='position:absolute;top:0;left:0;width:0;height:0;visibility:hidden;' src=''><\/iframe>");n("body").append(t);t.remove();t=null},f)),i++)},cancel:function(){i===1&&t.clearInterval(u);i>0&&i--}}}();r.transports.foreverFrame={name:"foreverFrame",supportsKeepAlive:!0,iframeClearThreshold:50,start:function(r,f,e){var c=this,s=i.foreverFrame.count+=1,h,o=n("<iframe data-signalr-connection-id='"+r.id+"' style='position:absolute;top:0;left:0;width:0;height:0;visibility:hidden;' src=''><\/iframe>");if(t.EventSource){e&&(r.log("This browser supports SSE, skipping Forever Frame."),e());return}u.prevent();h=i.getUrl(r,this.name);h+="&frameId="+s;n("body").append(o);o.prop("src",h);i.foreverFrame.connections[s]=r;r.log("Binding to iframe's readystatechange event.");o.bind("readystatechange",function(){n.inArray(this.readyState,["loaded","complete"])>=0&&(r.log("Forever frame iframe readyState changed to "+this.readyState+", reconnecting."),c.reconnect(r))});r.frame=o[0];r.frameId=s;f&&(r.onSuccess=function(){r.log("Iframe transport started.");f();delete r.onSuccess})},reconnect:function(n){var r=this;t.setTimeout(function(){if(n.frame&&i.ensureReconnectingState(n)){var u=n.frame,t=i.getUrl(n,r.name,!0)+"&frameId="+n.frameId;n.log("Updating iframe src to '"+t+"'.");u.src=t}},n.reconnectDelay)},lostConnection:function(n){this.reconnect(n)},send:function(n,t){i.ajaxSend(n,t)},receive:function(t,u){var f;i.processMessages(t,u,t.onSuccess);t.state===n.signalR.connectionState.connected&&(t.frameMessageCount=(t.frameMessageCount||0)+1,t.frameMessageCount>r.transports.foreverFrame.iframeClearThreshold&&(t.frameMessageCount=0,f=t.frame.contentWindow||t.frame.contentDocument,f&&f.document&&n("body",f.document).empty()))},stop:function(t){var r=null;if(u.cancel(),t.frame){if(t.frame.stop)t.frame.stop();else try{r=t.frame.contentWindow||t.frame.contentDocument;r.document&&r.document.execCommand&&r.document.execCommand("Stop")}catch(f){t.log("Error occured when stopping foreverFrame transport. Message = "+f.message+".")}n(t.frame).remove();delete i.foreverFrame.connections[t.frameId];t.frame=null;t.frameId=null;delete t.frame;delete t.frameId;delete t.onSuccess;delete t.frameMessageCount;t.log("Stopping forever frame.")}},abort:function(n,t){i.ajaxAbort(n,t)},getConnection:function(n){return i.foreverFrame.connections[n]},started:function(t){e(t,r.connectionState.reconnecting,r.connectionState.connected)===!0&&n(t).triggerHandler(f.onReconnect)}}}(window.jQuery,window),function(n,t){"use strict";var r=n.signalR,u=n.signalR.events,e=n.signalR.changeState,f=n.signalR.isDisconnecting,i=r.transports._logic;r.transports.longPolling={name:"longPolling",supportsKeepAlive:!1,reconnectDelay:3e3,start:function(o,s,h){var a=this,v=function(){v=n.noop;o.log("LongPolling connected.");s();h=null},y=function(){return h?(h(),h=null,o.log("LongPolling failed to connect."),!0):!1},c=o._,l=0,p=function(i){t.clearTimeout(c.reconnectTimeoutId);c.reconnectTimeoutId=null;e(i,r.connectionState.reconnecting,r.connectionState.connected)===!0&&(i.log("Raising the reconnect event"),n(i).triggerHandler(u.onReconnect))},w=36e5;o.pollXhr&&(o.log("Polling xhr requests already exists, aborting."),o.stop());o.messageId=null;c.reconnectTimeoutId=null;c.pollTimeoutId=t.setTimeout(function(){(function e(s,h){var d=s.messageId,g=d===null,b=!g,nt=!h,k=i.getUrl(s,a.name,b,nt);f(s)!==!0&&(o.log("Opening long polling request to '"+k+"'."),s.pollXhr=n.ajax(n.extend({},n.signalR.ajaxDefaults,{xhrFields:{withCredentials:o.withCredentials},url:k,type:"GET",dataType:o.ajaxDataType,contentType:o.contentType,success:function(r){var h,w=0,u,a;o.log("Long poll complete.");l=0;try{h=o._parseResponse(r)}catch(b){i.handleParseFailure(s,r,b,y);return}(c.reconnectTimeoutId!==null&&p(s),h&&(u=i.maximizePersistentResponse(h)),i.processMessages(s,h,v),u&&n.type(u.LongPollDelay)==="number"&&(w=u.LongPollDelay),u&&u.Disconnect)||f(s)!==!0&&(a=u&&u.ShouldReconnect,!a||i.ensureReconnectingState(s))&&(w>0?c.pollTimeoutId=t.setTimeout(function(){e(s,a)},w):e(s,a))},error:function(f,h){if(t.clearTimeout(c.reconnectTimeoutId),c.reconnectTimeoutId=null,h==="abort"){o.log("Aborted xhr request.");return}if(!y()){if(l++,o.state!==r.connectionState.reconnecting&&(o.log("An error occurred using longPolling. Status = "+h+".  Response = "+f.responseText+"."),n(s).triggerHandler(u.onError,[r._.transportError(r.resources.longPollFailed,o.transport,f)])),!i.ensureReconnectingState(s))return;c.pollTimeoutId=t.setTimeout(function(){e(s,!0)},a.reconnectDelay)}}})),b&&h===!0&&(c.reconnectTimeoutId=t.setTimeout(function(){p(s)},Math.min(1e3*(Math.pow(2,l)-1),w))))})(o)},250)},lostConnection:function(){throw new Error("Lost Connection not handled for LongPolling");},send:function(n,t){i.ajaxSend(n,t)},stop:function(n){t.clearTimeout(n._.pollTimeoutId);t.clearTimeout(n._.reconnectTimeoutId);delete n._.pollTimeoutId;delete n._.reconnectTimeoutId;n.pollXhr&&(n.pollXhr.abort(),n.pollXhr=null,delete n.pollXhr)},abort:function(n,t){i.ajaxAbort(n,t)}}}(window.jQuery,window),function(n,t){"use strict";function u(n){return n+o}function h(n,t,i){for(var f=n.length,u=[],r=0;r<f;r+=1)n.hasOwnProperty(r)&&(u[r]=t.call(i,n[r],r,n));return u}function c(t){return n.isFunction(t)?null:n.type(t)==="undefined"?null:t}function f(n){for(var t in n)if(n.hasOwnProperty(t))return!0;return!1}function e(n,t){var i=n._.invocationCallbacks,r,u;f(i)&&n.log("Clearing hub invocation callbacks with error: "+t+".");n._.invocationCallbackId=0;delete n._.invocationCallbacks;n._.invocationCallbacks={};for(u in i)r=i[u],r.method.call(r.scope,{E:t})}function r(n,t){return new r.fn.init(n,t)}function i(t,r){var u={qs:null,logging:!1,useDefaultPath:!0};return n.extend(u,r),(!t||u.useDefaultPath)&&(t=(t||"")+"/signalr"),new i.fn.init(t,u)}var o=".hubProxy",s=n.signalR;r.fn=r.prototype={init:function(n,t){this.state={};this.connection=n;this.hubName=t;this._={callbackMap:{}}},hasSubscriptions:function(){return f(this._.callbackMap)},on:function(t,i){var r=this,f=r._.callbackMap;return t=t.toLowerCase(),f[t]||(f[t]={}),f[t][i]=function(n,t){i.apply(r,t)},n(r).bind(u(t),f[t][i]),r},off:function(t,i){var e=this,o=e._.callbackMap,r;return t=t.toLowerCase(),r=o[t],r&&(r[i]?(n(e).unbind(u(t),r[i]),delete r[i],f(r)||delete o[t]):i||(n(e).unbind(u(t)),delete o[t])),e},invoke:function(t){var i=this,r=i.connection,e=n.makeArray(arguments).slice(1),o=h(e,c),f={H:i.hubName,M:t,A:o,I:r._.invocationCallbackId},u=n.Deferred(),l=function(t){var f=i._maximizeHubResponse(t),o,e;n.extend(i.state,f.State);f.Error?(f.StackTrace&&r.log(f.Error+"\n"+f.StackTrace+"."),o=f.IsHubException?"HubException":"Exception",e=s._.error(f.Error,o),e.data=f.ErrorData,u.rejectWith(i,[e])):u.resolveWith(i,[f.Result])};return r._.invocationCallbacks[r._.invocationCallbackId.toString()]={scope:i,method:l},r._.invocationCallbackId+=1,n.isEmptyObject(i.state)||(f.S=i.state),r.send(f),u.promise()},_maximizeHubResponse:function(n){return{State:n.S,Result:n.R,Id:n.I,IsHubException:n.H,Error:n.E,StackTrace:n.T,ErrorData:n.D}}};r.fn.init.prototype=r.fn;i.fn=i.prototype=n.connection();i.fn.init=function(i,r){var o={qs:null,logging:!1,useDefaultPath:!0},f=this;n.extend(o,r);n.signalR.fn.init.call(f,i,o.qs,o.logging);f.proxies={};f._.invocationCallbackId=0;f._.invocationCallbacks={};f.received(function(t){var i,o,r,e,s,h;t&&(typeof t.I!="undefined"?(r=t.I.toString(),e=f._.invocationCallbacks[r],e&&(f._.invocationCallbacks[r]=null,delete f._.invocationCallbacks[r],e.method.call(e.scope,t))):(i=this._maximizeClientHubInvocation(t),f.log("Triggering client hub event '"+i.Method+"' on hub '"+i.Hub+"'."),s=i.Hub.toLowerCase(),h=i.Method.toLowerCase(),o=this.proxies[s],n.extend(o.state,i.State),n(o).triggerHandler(u(h),[i.Args])))});f.error(function(n,i){var u,r,e;if((!f.transport||f.transport.name!=="webSockets")&&i){try{if(u=t.JSON.parse(i),!u.I)return}catch(o){return}r=u.I;e=f._.invocationCallbacks[r];e.method.call(e.scope,{E:n});f._.invocationCallbacks[r]=null;delete f._.invocationCallbacks[r]}});f.reconnecting(function(){f.transport&&f.transport.name==="webSockets"&&e(f,"Connection started reconnecting before invocation result was received.")});f.disconnected(function(){e(f,"Connection was disconnected before invocation result was received.")})};i.fn._maximizeClientHubInvocation=function(n){return{Hub:n.H,Method:n.M,Args:n.A,State:n.S}};i.fn._registerSubscribedHubs=function(){var t=this;t._subscribedToHubs||(t._subscribedToHubs=!0,t.starting(function(){var i=[];n.each(t.proxies,function(n){this.hasSubscriptions()&&(i.push({name:n}),t.log("Client subscribed to hub '"+n+"'."))});i.length===0&&t.log("No hubs have been subscribed to.  The client will not receive data from hubs.  To fix, declare at least one client side function prior to connection start for each hub you wish to subscribe to.");t.data=t.json.stringify(i)}))};i.fn.createHubProxy=function(n){n=n.toLowerCase();var t=this.proxies[n];return t||(t=r(this,n),this.proxies[n]=t),this._registerSubscribedHubs(),t};i.fn.init.prototype=i.fn;n.hubConnection=i}(window.jQuery,window),function(n){n.signalR.version="2.0.0"}(window.jQuery);
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox"  aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","Ａ":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ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":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","Ｗ":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","Ｘ":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Ｙ":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Ｚ":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","ａ":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","ｂ":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","ｃ":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","ｄ":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","ǳ":"dz","ǆ":"dz","ⓔ":"e","ｅ":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","ｆ":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","ｇ":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","ｈ":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","ｉ":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","ｊ":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","ｋ":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","ｌ":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","ǉ":"lj","ⓜ":"m","ｍ":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","ｎ":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ŉ":"n","ꞑ":"n","ꞥ":"n","ǌ":"nj","ⓞ":"o","ｏ":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","ｐ":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","ｑ":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","ｒ":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","ｓ":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","ｔ":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","ｕ":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","ｖ":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","ｗ":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","ｘ":"x","ẋ":"x","ẍ":"x","ⓨ":"y","ｙ":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","ｚ":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");
if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=i.text===b.term;if(k||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var l=e.createTag(b);if(null!=l){var m=e.option(l);m.attr("data-select2-tag",!0),e.addOptions([m]),e.insertTag(g,l)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b),d=g.$element.find("option").filter(function(){return a(this).val()===c.id});if(!d.length){var e=g.option(c);e.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([e])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return 0>=e?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;i>h;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),(null==a||0===a.length)&&(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null;
},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if(b=b||{},"object"==typeof b)return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});;
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var Joove;
(function (Joove) {
    var Widgets;
    (function (Widgets) {
        var SimpleSelectProvider = /** @class */ (function (_super) {
            __extends(SimpleSelectProvider, _super);
            function SimpleSelectProvider() {
                return _super !== null && _super.apply(this, arguments) || this;
            }
            return SimpleSelectProvider;
        }(Joove.BaseAngularProvider));
        Widgets.SimpleSelectProvider = SimpleSelectProvider;
        function ngSimpleSelect($timeout, $interval, ngRadio) {
            return {
                priority: 1001,
                require: "?ngModel",
                restrict: "AE",
                scope: {
                    val: "=ngVal",
                    txt: "=ngTxt",
                    model: "=ngModel",
                    owner: "=ngOwner",
                    datesetType: "=jooveDatesetType",
                    type: "=ngType",
                    id: "=ngId",
                    isSearchable: "=ngSearchable",
                    dontAddEmptyValue: "=ngDontallowemptyvalue",
                    itemDataType: "=ngDatatype",
                    fromMasterForm: "=ngMaster",
                    searchEverywhere: "=ngSearchEverywhere",
                    orientation: "=ngOrientation",
                    contextDepth: "=ngContextDepth",
                    notNull: "=ngNotNull"
                },
                link: function ($scope, $element, $attrs, ngModelCtrl) {
                    if (Joove.Common.directiveScopeIsReady($element))
                        return;
                    Joove.Common.setDirectiveScope($element, $scope);
                    $scope.datesetType = parseInt($scope.datesetType);
                    $scope.selectedItems = [];
                    $scope.controlType = GetSelectionBoxType($scope.type);
                    $scope.control = GetControl($scope, $element);
                    $scope.selectedItemKeys = [];
                    $scope.options = [];
                    $scope.bindingType = $element.attr("data-binding-type");
                    $scope.dataLoaded = false;
                    $scope.requestInitialValueOnly = $scope.bindingType != null && $scope.control.IsManual();
                    $scope.refreshDataFromServerOnFocus = false;
                    var serverSideElementId = Joove.Core.getElementName($element);
                    $scope.contextIsReady = function () {
                        if ($scope.contextDepth == null)
                            return true;
                        var indexes = Joove.Common.getIndexesOfControl($element).indexes;
                        return indexes != null && indexes.length === $scope.contextDepth;
                    };
                    $scope.$on("$destroy", function () {
                        var uniqueName = SelectionControl.GetControlUniqueName($scope, $element, $scope.model);
                        var selectedItem = $scope.control.FindOptionObjectByValue($scope.model);
                        if (selectedItem != null) {
                            window[uniqueName] = selectedItem;
                        }
                        else {
                            delete window[uniqueName];
                        }
                    });
                    $scope.fetchData = function (requestInfo, attemptNumber, cb) {
                        attemptNumber = attemptNumber || 0;
                        $scope.dataLoaded = false;
                        // if context is ready, request data
                        if ($scope.contextIsReady()) {
                            $timeout(function () {
                                Joove.DatasourceManager.fetch($element, serverSideElementId, requestInfo, {
                                    success: function (datasourceResponse) {
                                        $scope.options = datasourceResponse.Data;
                                        $scope.nullOptionAvailable = false;
                                        if ($scope.control.IsManual()) {
                                            $scope.refreshDataFromServerOnFocus = false;
                                            $scope.dataLoaded = true;
                                            $scope.nullOptionAvailable = $scope.options.filter(function (o) { return o._key == null; }).length > 0;
                                            $scope.control.SetDefaultValue($scope.options.filter(function (o) { return o._default; })[0]);
                                            RefreshUI(cb, true);
                                            Joove.Logger.debug("$scope.fetchData(Manual)", $scope.options.length);
                                        }
                                        else if ($scope.control.IsViewModelBindend() && Joove.DatasourceManager.couldUseFetchViewModelDataseClientSideHandler($element, $scope.fromMasterForm)) {
                                            RefreshUI(cb, true);
                                            Joove.Logger.debug("$scope.fetchData(ViewModel)", $scope.options.length);
                                        }
                                        else {
                                            RefreshUI(cb, false);
                                            Joove.Logger.debug("$scope.fetchData(Dataset)", $scope.options.length);
                                        }
                                    }
                                }, [], $scope.fromMasterForm);
                            });
                        } // else allow 500ms for context to bind (10 * 50ms timeout)
                        else if (attemptNumber <= 10) {
                            setTimeout(function () { $scope.fetchData(requestInfo, ++attemptNumber); }, 50);
                        }
                    };
                    $scope.control.RegisterEventListeners();
                    $element.addClass("jb-initialized");
                    if ($scope.control.IsManual()) {
                        $scope.fetchData(null, null, function () {
                            RemoveInitialValues(serverSideElementId, $element);
                        });
                    }
                    $timeout(function () {
                        var oldValue = window[SelectionControl.GetControlUniqueName($scope, $element, $scope.model)];
                        if (oldValue != null) {
                            Joove.Logger.debug("Retrieve old value(" + $element.attr("jb-id") + ")");
                            populateOptions([oldValue], true);
                            $scope.control.UpdateSelection($scope.model, true);
                            $scope.refreshDataFromServerOnFocus = true;
                            $scope.requestInitialValueOnly = false;
                        }
                        else {
                            Joove.Logger.debug("Initial DS fetch(" + $element.attr("jb-id") + ")");
                            $scope.fetchData(null, null, function () {
                                RemoveInitialValues(serverSideElementId, $element);
                            });
                        }
                        Joove.Logger.debug("Register $scope.$watch(" + $element.attr("jb-id") + ")");
                        $scope.$watch("model", function (value) {
                            if (value != null) {
                                Joove.Logger.debug("Watch " + $element.attr("jb-id"), value);
                            }
                            $scope.control.UpdateSelection(value);
                        });
                    });
                    Joove.DatasourceManager.watchDependencies(SelectionControl.GetScope($scope), $element, function () {
                        Joove.Logger.debug("DatasourceManager.watchDependencies", $element.attr("jb-id"));
                        $scope.fetchData(null, null, function () {
                            $scope.refreshDataFromServerOnFocus = false;
                            RemoveInitialValues(serverSideElementId, $element);
                        });
                    });
                    Joove.Common.markDirectiveScopeAsReady($element);
                    function populateOptions(options, force) {
                        if (force === void 0) { force = false; }
                        if (!force && $scope.dataLoaded === false)
                            return;
                        // Collection is empty, early exit here
                        if (options == null || options.length === 0) {
                            $scope.model = null;
                            $scope.control.ClearOptions(true);
                            SelectionControl.ApplyDefaultSelection($scope, $element);
                            $scope.control.Refresh();
                            return;
                        }
                        $scope.control.PopulateOptions(options);
                    }
                    function RefreshUI(cb, slowdown) {
                        if (slowdown) {
                            $timeout(function () { populateOptions($scope.options); });
                            $scope.dataLoaded = true;
                        }
                        else {
                            $scope.dataLoaded = true;
                            populateOptions($scope.options);
                        }
                        cb && cb();
                        Joove.Core.applyScope($scope);
                    }
                    ;
                    function RemoveInitialValues(name, $control) {
                        Joove.DatasourceManager.removeInitialValue(name, $control);
                    }
                    function GetManualDatasetOptions(serverSideElementId) {
                        var dataContainerVariableName = "dataFor" + serverSideElementId;
                        if ($scope.fromMasterForm === true) {
                            dataContainerVariableName += "Master";
                        }
                        return window[dataContainerVariableName];
                    }
                }
            };
        }
        Widgets.ngSimpleSelect = ngSimpleSelect;
        angular
            .module("ngSimpleSelect", [])
            .provider("ngSimpleSelect", new SimpleSelectProvider())
            .directive("ngSimpleSelect", ["$timeout", "$interval", "ngSimpleSelect", ngSimpleSelect]);
        var SelectionControl = /** @class */ (function () {
            function SelectionControl($scope, $element) {
                this.$scope = $scope;
                this.$element = $element;
                this.optionElementsToOptionObjects = {};
                this.defaultText = window._resourcesManager.getComboBoxDefaultText($element, $scope.fromMasterForm);
            }
            SelectionControl.prototype.SetDefaultValue = function (option) {
                this.defaultOption = option;
            };
            SelectionControl.prototype.GetDefaultValue = function () {
                return this.defaultOption || "?";
            };
            SelectionControl.prototype.PopulateOptions = function (options, clear) {
                if (clear === void 0) { clear = true; }
                if (clear) {
                    this.ClearOptions(false);
                    this.optionElementsToOptionObjects = {};
                }
                // Create Option Elements
                for (var i = 0; i < options.length; i++) {
                    var option = options[i];
                    var val = this.GetOptionProperty(option, this.$scope.val);
                    var txt = this.GetOptionProperty(option, this.$scope.txt);
                    if (option.isDefault) {
                        val = option.value;
                        txt = option.label;
                    }
                    if (Joove.Common.stringIsNullOrEmpty(txt)) {
                        txt = window._resourcesManager.getGlobalResource("RES_SITE_NullValue");
                    }
                    var $options = this.PopulateOption(val, txt);
                    $options.$valueHolder.data("instance", option);
                    var optionKey = (new Date().getMilliseconds() + i).toString();
                    this.optionElementsToOptionObjects[optionKey] = option;
                    if (this.$scope.val === "$this") {
                        if (!option.isDefault && Joove.Common.keyHasDefaultValue(option._key)) {
                            $options.$valueHolder.data("value", option);
                            $options.$valueHolder.attr("value", option._clientKey);
                        }
                        else {
                            // Value is the object it self
                            $options.$valueHolder.data("value", option);
                            $options.$valueHolder.attr("value", option._key);
                        }
                    }
                    else {
                        // Value is an object's property
                        $options.$valueHolder.data("value", val);
                    }
                    $options.$valueHolder.attr("jb-option-id", optionKey);
                    // Append Element
                    this.$element.append($options.$option);
                    // Honour Radio Button Orientation
                    if (this.$scope.controlType === SelectionBoxType.RadioButton) {
                        this.$element.append(this.$scope.orientation === "HORIZONTAL" ? "&nbsp;&nbsp;&nbsp;" : "<br/>");
                    }
                }
                this.$scope.control.Refresh();
                // Trigger selection update
                this.$scope.control.UpdateSelection(this.$scope.model);
            };
            SelectionControl.prototype.OnChange = function ($valueHolderElement) {
                if ($valueHolderElement.length === 0) {
                    SelectionControl.UpdateScopeAndModelKeys(this.$scope, this.$element, null, null);
                }
                else {
                    var value = $valueHolderElement.data("value");
                    var needsUpdate = value != null && typeof (value._key) != "undefined";
                    if (needsUpdate) {
                        Joove.Logger.debug("OnChange-UpdateObject", $valueHolderElement, value);
                        SelectionControl.UpdateObject(this.$scope, this.$element, value, value._key);
                    }
                    else {
                        Joove.Logger.debug("OnChange-UpdateScopeAndModelKeys", $valueHolderElement, value);
                        SelectionControl.UpdateScopeAndModelKeys(this.$scope, this.$element, value, value);
                    }
                }
            };
            SelectionControl.prototype.UpdateSelection = function (value, force) {
                if (force === void 0) { force = false; }
                if (!force && this.$scope.dataLoaded === false)
                    return;
                if (this.UpdateValueMatchesToAvailableOptions(value)) {
                    if (this.IsNotNull() && this.IsManual() && this.GetDefaultValue() != null) {
                        this.SetModelValue(this.GetDefaultValue()._key);
                    }
                    else if (this.$scope.dontAddEmptyValue) {
                        var firstOptionValue = this.$element.find("option:first").data("value");
                        if (firstOptionValue != null) {
                            this.SetModelValue(firstOptionValue);
                        }
                    }
                    return;
                }
                this.SetValue(value);
                this.UpdateInitialValue();
            };
            SelectionControl.prototype.OnValueChanged = function ($valueHolderElement) {
                this.$scope.control.OnChange($valueHolderElement);
                Joove.Core.applyScope(SelectionControl.GetScope(this.$scope));
                Joove.Logger.debug("OnValueChanged", $($valueHolderElement).attr('jb-id'));
                if (this.$scope.controlType === SelectionBoxType.Dropdown) {
                    SelectionControl.RemoveEmptyOptions(this.$element);
                }
            };
            SelectionControl.prototype.SetModelValue = function (value, selectedItem) {
                var modelPath = this.$element.attr("ng-model");
                var parts = modelPath.split(".");
                var last = parts[parts.length - 1];
                if (selectedItem != null)
                    delete selectedItem.$id; // This ID is used by deserialization on backend side, probably is safe to ignore it.
                var reconstructor = new Joove.ReferencesReconstructor();
                reconstructor.addFreshInstance(selectedItem);
                reconstructor.reconstructReferences(Joove.Common.getModel());
                if (parts[0] != "model") {
                    Joove.Core.setBoClassPropertyFromInstance(last, this.$scope.owner, value);
                }
                else {
                    var currentPointer_1 = Joove.Common.getModel();
                    if (parts.length == 2) {
                        currentPointer_1[parts[1]] = value;
                    }
                    else {
                        parts.forEach(function (part, index) {
                            if (index == 0)
                                return;
                            if (index < parts.length - 1) {
                                currentPointer_1 = currentPointer_1[part];
                            }
                            else {
                                Joove.Core.setBoClassPropertyFromInstance(last, currentPointer_1, value);
                            }
                        });
                    }
                }
            };
            SelectionControl.prototype.IsNotNull = function () {
                return SelectionControl.IsNotNull(this.$scope);
            };
            SelectionControl.prototype.ValueMatchesToAvailableOptions = function (value) {
                return this.FindOptionInstanceByValue(value) != Joove.DatasourceManager.NO_VALUE;
            };
            SelectionControl.prototype.FindOptionInstanceByValue = function (value) {
                if (value == null) {
                    return this.$scope.nullOptionAvailable === true
                        ? null
                        : Joove.DatasourceManager.NO_VALUE;
                }
                var searchByKey = typeof (value._key) != "undefined";
                var $options = this.$element.find(".value-holder");
                for (var i = 0; i < $options.length; i++) {
                    var $opt = $options.eq(i);
                    var currentValue = $opt.data("value");
                    if (currentValue == null)
                        continue;
                    if (searchByKey) {
                        if (currentValue._key === value._key)
                            return currentValue;
                    }
                    else {
                        if (Joove.Comparator.IsEqual(currentValue, value, this.$scope.bindingType)) {
                            return currentValue;
                        }
                    }
                }
                return Joove.DatasourceManager.NO_VALUE;
            };
            SelectionControl.prototype.FindOptionObjectByValue = function (value) {
                if (value == null)
                    return Joove.DatasourceManager.NO_VALUE;
                var searchByKey = typeof (value._key) != "undefined";
                var $options = this.$element.find(".value-holder");
                for (var i = 0; i < $options.length; i++) {
                    var $opt = $options.eq(i);
                    var currentOption = this.optionElementsToOptionObjects[$opt.attr("jb-option-id")];
                    if (currentOption == null)
                        continue;
                    var currentValue = (this.$scope.val === "$this") ? currentOption :
                        this.GetOptionProperty(currentOption, this.$scope.val);
                    if (currentValue == null)
                        continue;
                    if (currentOption.isDefault) {
                        currentValue = currentOption.value;
                    }
                    if (searchByKey) {
                        if (currentValue._key === value._key)
                            return currentOption;
                    }
                    else {
                        if (Joove.Comparator.IsEqual(currentValue, value, this.$scope.bindingType)) {
                            return currentOption;
                        }
                    }
                }
                return Joove.DatasourceManager.NO_VALUE;
            };
            SelectionControl.prototype.GetRelativeProperty = function (prop) {
                return prop.replace("$this.", "").replace("this.", "");
            };
            SelectionControl.prototype.GetOptionProperty = function (option, prop) {
                var propRelative = this.GetRelativeProperty(prop);
                if (option != null && Joove.Common.valueIsPrimitive(option) && prop === "_key") {
                    return option;
                }
                var parts = propRelative.split(".");
                var current = option;
                for (var i = 0; i < parts.length; i++) {
                    if (parts[i].length == 0) {
                        continue;
                    }
                    var currentOption = current[parts[i]];
                    if (currentOption == null) {
                        return null;
                    }
                    current = currentOption;
                }
                return current;
            };
            SelectionControl.prototype.GetDefaultOption = function (label, value) {
                return {
                    isDefault: true,
                    value: value,
                    label: label
                };
            };
            SelectionControl.prototype.HasDefaultOptions = function (items) {
                var defaultItem = items.filter(function (item) { return item.isDefault; });
                if (defaultItem.length <= 0)
                    return false;
                return items.filter(function (item) { return item.isDefault; })[0] != null;
            };
            SelectionControl.prototype.IsManual = function () {
                return this.$scope.datesetType === Joove.DataSourceTypes.MANUAL;
            };
            SelectionControl.prototype.IsViewModelBindend = function () {
                return this.$scope.datesetType === Joove.DataSourceTypes.VIEWMODEL;
            };
            SelectionControl.prototype.SetValue = function (value) {
                var val = SelectionControl.GetKey(value);
                Joove.Logger.debug("SetValue(" + this.$element.attr("jb-id") + ")");
                var $target = this.$element.find("[value='" + val + "']");
                this.$scope.control.UpdateValue(val);
                var selectedInstance = $target.data("instance");
                if (selectedInstance != null) {
                    var selectedKey = typeof (selectedInstance._key) == "undefined"
                        ? selectedInstance
                        : selectedInstance._key;
                    this.$scope.selectedItems = [selectedInstance];
                    this.$scope.selectedItemKeys = [selectedKey];
                }
                SelectionControl.UpdateKeysInModel(this.$scope, this.$element);
            };
            SelectionControl.prototype.UpdateValueMatchesToAvailableOptions = function (value) {
                var _this = this;
                if (this.$scope.control.ValueMatchesToAvailableOptions(value) === false) {
                    // When updating data on a dropdown that does not have its full recordset loaded
                    // before assigning default value, we must fetch the data first.
                    // This is not very good performance wise, but it's a rare case not worth
                    // spending resources optimizing it, at least for the moment...
                    if (value != null && this.$scope.refreshDataFromServerOnFocus) {
                        // allow DOM creation for 250ms
                        setTimeout(function () {
                            // check again
                            if (_this.$scope.control.ValueMatchesToAvailableOptions(value))
                                return;
                            // if still no match, request data and try to update selection
                            _this.$scope.fetchData(null, null, function () {
                                _this.$scope.refreshDataFromServerOnFocus = false;
                                _this.UpdateSelection(value);
                            });
                        }, 250);
                    }
                    else {
                        SelectionControl.ApplyDefaultSelection(this.$scope, this.$element);
                    }
                    return true;
                }
                return false;
            };
            SelectionControl.IsNotNull = function ($scope) {
                if ($scope.notNull == null)
                    return false;
                return $scope.notNull;
            };
            SelectionControl.RemoveEmptyOptions = function ($element) {
                setTimeout(function () {
                    $element.find("option:not(.value-holder)").remove();
                    $element.trigger("select2:updated");
                }, 50);
            };
            SelectionControl.UpdateTitle = function ($element, $target) {
                if ($target === void 0) { $target = null; }
                if ($element == null)
                    return;
                var title = $element.attr('title');
                if (title == null || title.trim() == "")
                    return;
                if ($target == null) {
                    $target = $element.next().find("span.selection span.select2-selection span.select2-selection__rendered");
                }
                if ($target == null)
                    return;
                $target.attr('title', title);
            };
            SelectionControl.ApplyDefaultSelection = function ($scope, $element) {
                SelectionControl.RemoveEmptyOptions($element);
                if ($scope.controlType === SelectionBoxType.Dropdown) {
                    var defaultValue = SelectionControl.IsNotNull($scope)
                        ? $scope.control.GetDefaultValue()
                        : $element.children().eq(0).attr("value");
                    $element.val(defaultValue);
                    $element.trigger("select2:updated");
                    //Select2 doesn't always detect the changes in the original select element. The following forces
                    //the Select2 text to be refreshed
                    var $renderedSelection = $element.next().find("span.selection span.select2-selection span.select2-selection__rendered");
                    $renderedSelection.text($element.find("option:selected").text());
                }
                else {
                    $element.find("input").removeAttr("checked");
                }
                $scope.selectedItems = [];
                $scope.selectedItemKeys = [];
                SelectionControl.UpdateKeysInModel($scope, $element);
                return;
            };
            SelectionControl.GetControlUniqueName = function ($scope, $element, model) {
                var name = "Dropdown_" + Joove.Common.getIndexesOfControl($element).indexes + "_" + $element.attr("jb-id") + "_" + SelectionControl.GetKey(model);
                if ($scope.fromMasterForm === true) {
                    name = "Master_" + name;
                }
                return name;
            };
            SelectionControl.UpdateKeysInModel = function ($scope, $element) {
                Joove.DatasourceManager.updateSelectedKeysInModel(String($scope.id), $scope.selectedItemKeys, false, Joove.Common.getIndexesOfControl($element).indexes, $scope.fromMasterForm);
            };
            SelectionControl.UpdateObject = function ($scope, $element, value, key) {
                if (Joove.Common.keyHasDefaultValue(key)) {
                    SelectionControl.UpdateScopeAndModelKeys($scope, $element, value, value._clientKey);
                    return;
                }
                var targetController = $scope.fromMasterForm === true
                    ? window._context.currentMasterPageController
                    : window._context.currentController;
                if ($scope.control.IsViewModelBindend()) {
                    var item = Joove.DatasourceManager.fetchItemFromViewModelDataset($element, key, $scope.fromMasterForm);
                    SelectionControl.UpdateScopeAndModelKeys($scope, $element, item, key);
                    Joove.Logger.debug("UpdateObject: Skip call to server because dropdown consumes ViewModel DS.", value, item, key);
                }
                else {
                    Joove.Core.executeControllerActionNew({
                        controller: targetController,
                        action: "UpdateInstance",
                        verb: "POST",
                        queryData: [],
                        postData: { keys: key.toString(), dataType: Joove.DatasourceManager.getDtoTypeFromControl($element) },
                        cb: function (data) {
                            SelectionControl.UpdateScopeAndModelKeys($scope, $element, Joove.Common.modelToJson(data), key);
                        }
                    });
                }
            };
            SelectionControl.UpdateScopeAndModelKeys = function ($scope, $element, selectedObject, selectedKey) {
                if ($scope.bindingType === "bool") {
                    selectedObject = String(selectedObject) === "true";
                }
                if (selectedKey == "?" || (selectedObject != null && selectedObject.isDefault == true && selectedObject.value == "?")) {
                    selectedObject = null;
                    selectedKey = null;
                }
                $scope.selectedItems = selectedObject == null ? [] : [selectedObject];
                $scope.selectedItemKeys = selectedKey == null ? [] : [selectedKey];
                $scope.model = selectedObject;
                SelectionControl.UpdateKeysInModel($scope, $element);
                if ($scope.owner != undefined) {
                    $scope.control.SetModelValue(selectedObject, selectedObject);
                }
                SelectionControl.GetScope($scope).$apply();
                Joove.DatasourceManager.invokeOnChangeHandler($element);
            };
            SelectionControl.GetScope = function ($scope) {
                return $scope.fromMasterForm === true
                    ? Joove.Common.getMasterScope()
                    : Joove.Common.getScope();
            };
            SelectionControl.GetKey = function (value) {
                if (value == null)
                    return null;
                if (typeof (value._key) == "undefined")
                    return value;
                return Joove.Common.keyHasDefaultValue(value._key) ? value._clientKey : value._key;
            };
            return SelectionControl;
        }());
        Widgets.SelectionControl = SelectionControl;
        var DropdownControl = /** @class */ (function (_super) {
            __extends(DropdownControl, _super);
            function DropdownControl() {
                return _super !== null && _super.apply(this, arguments) || this;
            }
            DropdownControl.prototype.PopulateOptions = function (options, clear) {
                if (clear === void 0) { clear = true; }
                // 'Please Select' Option for DropDown
                if (!this.$scope.dontAddEmptyValue) {
                    if (!this.IsNotNull() && !this.HasDefaultOptions(options)) {
                        options.unshift(this.GetDefaultOption(this.defaultText, "?"));
                    }
                }
                _super.prototype.PopulateOptions.call(this, options, clear);
            };
            DropdownControl.prototype.PopulateOption = function (val, txt) {
                var $option = $("<option class='value-holder' class='' value='" + val + "'>" + txt + "</option>");
                var $valueHolder = $option;
                return {
                    $option: $option,
                    $valueHolder: $valueHolder
                };
            };
            DropdownControl.prototype.ClearOptions = function (redraw) {
                var _this = this;
                return new Promise(function (resolve, reject) {
                    _this.$element.empty();
                    var options = (_this.IsNotNull()) ? [] : [_this.GetDefaultOption(_this.defaultText, "?")];
                    if (redraw) {
                        _this.PopulateOptions(options, false);
                    }
                    return true;
                });
            };
            DropdownControl.prototype.OnChange = function (value) {
                _super.prototype.OnChange.call(this, value);
            };
            DropdownControl.prototype.UpdateInitialValue = function () {
                var $renderedSelection = this.$element.next().find("span.selection span.select2-selection span.select2-selection__rendered");
                $renderedSelection.text(this.$element.find("option:selected").text());
                SelectionControl.UpdateTitle(this.$element, $renderedSelection);
            };
            DropdownControl.prototype.UpdateValue = function (value) {
                if (this.$scope.bindingType === "bool") {
                    this.$element.val(value.toString());
                }
                else if (this.$scope.nullOptionAvailable === true && value == null) {
                    this.$element.val("null");
                }
                else {
                    this.$element.val(value);
                }
                SelectionControl.RemoveEmptyOptions(this.$element);
                var $renderedSelection = this.$element.next().find("span.selection span.select2-selection span.select2-selection__rendered");
                SelectionControl.UpdateTitle(this.$element, $renderedSelection);
            };
            DropdownControl.prototype.Refresh = function () {
                var _this = this;
                SelectionControl.RemoveEmptyOptions(this.$element);
                if (this.$element.hasClass("select2-enabled")) {
                    this.$element.trigger("select2:updated");
                    SelectionControl.UpdateTitle(this.$element);
                }
                else {
                    var noDataText_1 = window._resourcesManager.getComboBoxNoDataText(this.$element, this.$scope.fromMasterForm);
                    this.$element.addClass("select2-enabled");
                    var options = {
                        "language": {
                            "noResults": function () {
                                return noDataText_1;
                            }
                        },
                        "placeholder": this.defaultText,
                        "minimumResultsForSearch": -1,
                        "width": "100%"
                    };
                    if (this.$scope.isSearchable) {
                        delete options["minimumResultsForSearch"];
                    }
                    this.$element.select2(options);
                    var $select2Container = this.$element.next();
                    //Get the CSS Classes (user-data-classes) from the "select" object of the Container and copy them to the DIV element
                    if ($select2Container.length > 0 && $select2Container.context != null) {
                        var userDataClassesString = $select2Container.context.getAttribute("user-data-classes");
                        if (userDataClassesString != null) {
                            for (var i = 0; i < $select2Container.length; i++) {
                                $select2Container[i].className += "  " + userDataClassesString;
                            }
                        }
                    } /* else if ($chosenContainer.length === 0 && $chosenContainer.context != null
                                    //chosen plugin is not supported for mobile browsers so we need to override the default css
                                    //visibility value in such cases
                                    && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
                                    $element.attr("style", "visibility: visible !important");
                                }*/
                    this.$element.on("select2:updated", function () {
                        var isDisabled = _this.$element.is(":disabled");
                        var isReadonly = _this.$element.is("[readonly='readonly']");
                        // Make Readonly
                        if (isReadonly || isDisabled) {
                            _this.$element.prop("disabled", true);
                        }
                        else {
                            _this.$element.prop("disabled", false);
                        }
                        // Transfer classes from original element to select2 container
                        window._themeManager
                            .transferClassesOfStateToOtherElement(_this.$element, $select2Container, Joove.ThemeManager.States.Required);
                        window._themeManager
                            .transferClassesOfStateToOtherElement(_this.$element, $select2Container, Joove.ThemeManager.States.Readonly);
                        window._themeManager
                            .transferClassesOfStateToOtherElement(_this.$element, $select2Container, Joove.ThemeManager.States.Disabled);
                        window._themeManager
                            .transferRemovalOfClassesOfStateToOtherElement(_this.$element, $select2Container, Joove.ThemeManager.States.RequiredEmpty);
                        SelectionControl.UpdateTitle(_this.$element);
                    });
                    $select2Container.on("click", function () {
                        var $resultsContainer = jQuery("span.select2-container .select2-results ul");
                        if (_this.$scope.refreshDataFromServerOnFocus) {
                            $resultsContainer.hide();
                            _this.$scope.refreshDataFromServerOnFocus = false;
                            var loadingElement = jQuery("<span class='select2-loading-element' style='display: block; text-align:center; padding: 7px;'><i class='glyphicon glyphicon-refresh spin' style='font-size: 20px; opacity: 0.7'></i></span>");
                            jQuery("span.select2-container .select2-results").append(loadingElement);
                            setTimeout(function () {
                                _this.$scope.fetchData(null, null, function () {
                                    $resultsContainer.show();
                                    jQuery("span.select2-container .select2-results .select2-loading-element")
                                        .remove();
                                    _this.$element.select2("close");
                                    setTimeout(function () { _this.$element.select2("open"); }, 150);
                                });
                            }, 250);
                        }
                    });
                    this.$element.trigger("select2:updated");
                    // If original element has a hide cf applied, before chosen has been initialized
                    // manualy hide it!
                    // TODO: add a callback function array to this scope
                    // so that we could apply a variety of actions to the chosen container after 
                    // its initialization.
                    if (this.$element.hasClass("cf-hidden")) {
                        $select2Container.hide();
                    }
                }
            };
            DropdownControl.prototype.RegisterEventListeners = function () {
                var _this = this;
                this.$element.on("change", function () {
                    _this.OnValueChanged(_this.$element.find(":selected").eq(0));
                });
            };
            return DropdownControl;
        }(SelectionControl));
        Widgets.DropdownControl = DropdownControl;
        var RadioButtonControl = /** @class */ (function (_super) {
            __extends(RadioButtonControl, _super);
            function RadioButtonControl() {
                return _super !== null && _super.apply(this, arguments) || this;
            }
            RadioButtonControl.prototype.Refresh = function () {
            };
            RadioButtonControl.prototype.UpdateValue = function (value) {
                var attributeValue = value;
                if (this.$scope.bindingType === "bool") {
                    attributeValue = value.toString();
                }
                else if (this.$scope.nullOptionAvailable === true && value == null) {
                    attributeValue = "null";
                }
                var $target = this.$element.find("[value='" + attributeValue + "']");
                $target.prop("checked", true);
            };
            RadioButtonControl.prototype.UpdateInitialValue = function () {
            };
            RadioButtonControl.prototype.ClearOptions = function (redraw) {
                var _this = this;
                return new Promise(function (resolve, reject) {
                    _this.$element.empty();
                    return true;
                });
            };
            RadioButtonControl.prototype.RegisterEventListeners = function () {
                var _this = this;
                this.$element.on("click", "[jb-type='OptionButtonEntryContainer']", function () {
                    _this.OnValueChanged(_this.$element.find("input:checked"));
                });
            };
            RadioButtonControl.prototype.PopulateOption = function (val, txt) {
                var $option = window.$entryContainerTemplate.clone(true);
                if (this.$scope.nullOptionAvailable === true && val == null) {
                    val = "null";
                }
                $option.find('[jb-type="OptionButtonEntry"]')
                    .addClass("value-holder")
                    .attr("name", this.$scope.id + "_" + Joove.Common.getIndexesOfControl(this.$element).indexes)
                    .attr("value", val)
                    .prop("disabled", (this.$element.attr("readonly") != null || this.$element.hasClass("jb-disabled") === true));
                $option.find('[jb-type="OptionButtonEntryCaption"]').text(txt);
                var $valueHolder = $option.find(".value-holder");
                return {
                    $option: $option,
                    $valueHolder: $valueHolder
                };
            };
            RadioButtonControl.prototype.PopulateOptions = function (options, clear) {
                if (clear === void 0) { clear = true; }
                var $template = this.$element.find("[jb-type='OptionButtonEntryContainer']").eq(0);
                window.$entryContainerTemplate = $template.clone(true);
                $template.remove();
                _super.prototype.PopulateOptions.call(this, options, clear);
            };
            RadioButtonControl.prototype.OnChange = function (value) {
                _super.prototype.OnChange.call(this, value);
            };
            return RadioButtonControl;
        }(SelectionControl));
        Widgets.RadioButtonControl = RadioButtonControl;
        var TypeaheadControl = /** @class */ (function (_super) {
            __extends(TypeaheadControl, _super);
            function TypeaheadControl() {
                return _super !== null && _super.apply(this, arguments) || this;
            }
            TypeaheadControl.prototype.Refresh = function () {
            };
            TypeaheadControl.prototype.UpdateInitialValue = function () {
            };
            TypeaheadControl.prototype.ClearOptions = function (redraw) {
                return new Promise(function (resolve, reject) {
                    return true;
                });
            };
            TypeaheadControl.prototype.RegisterEventListeners = function () {
                var _this = this;
                this.$element.bind("typeahead:select", function (ev, suggestion) {
                    _this.OnValueChanged(TypeaheadControl.GetValue(ev));
                });
                this.$element.on("change", function (ev) {
                    _this.OnValueChanged(TypeaheadControl.GetValue(ev));
                });
            };
            TypeaheadControl.prototype.UpdateValue = function (value) {
                $(".tt-input", this.$element).val(value);
            };
            TypeaheadControl.prototype.PopulateOption = function (val, txt) {
                return null;
            };
            TypeaheadControl.prototype.PopulateOptions = function (items, clear) {
                if (clear === void 0) { clear = true; }
                var options = {
                    hint: true,
                    highlight: true,
                    minLength: 1
                };
                var ds = {
                    name: "items",
                    displayKey: this.GetRelativeProperty(this.$scope.val),
                    source: this.GetDataset(items)
                };
                if (this.$placeholder != null) {
                    this.$placeholder.typeahead('destroy');
                }
                this.$placeholder = $(".typeahead", this.$element).typeahead(options, ds);
                this.$scope.control.UpdateSelection(this.$scope.model);
            };
            TypeaheadControl.prototype.OnChange = function (value) {
                this.$scope.model = value;
                if (this.$scope.owner != undefined) {
                    this.SetModelValue(value);
                }
                SelectionControl.GetScope(this.$scope).$apply();
            };
            TypeaheadControl.prototype.ValueMatchesToAvailableOptions = function (value) {
                if (this.$scope.controlType === SelectionBoxType.Typeahead)
                    return true;
                return false;
            };
            TypeaheadControl.GetValue = function (ev) {
                return $(ev.target).typeahead("val");
            };
            TypeaheadControl.prototype.GetDataset = function (items) {
                var datumTokenizer = Bloodhound.tokenizers
                    .obj.whitespace(this.GetRelativeProperty(this.$scope.val));
                var engine = new Bloodhound({
                    initialize: true,
                    identify: this.GetDatasetKey,
                    dupDetector: this.Equals,
                    datumTokenizer: datumTokenizer,
                    queryTokenizer: Bloodhound.tokenizers.whitespace,
                    local: items
                });
                return engine;
            };
            TypeaheadControl.prototype.Equals = function (a, b) {
                return a._key === b._key;
            };
            TypeaheadControl.prototype.GetDatasetKey = function (item) {
                if (item == null)
                    return null;
                return item._key;
            };
            TypeaheadControl.prototype.IsObject = function () {
                //console.log(this.$scope.itemDataType);
                //console.log(this.IsManual());
                return true;
            };
            TypeaheadControl.prototype.PrepareItems = function (items) {
                var parsedItems = [];
                for (var i = 0; i < items.length; i++) {
                    var item = items[i];
                    if (item != null && Joove.Common.valueIsPrimitive(item)) {
                        parsedItems.push(item);
                    }
                    else {
                        parsedItems.push(this.GetOptionProperty(item, this.$scope.val));
                    }
                }
                return parsedItems;
            };
            return TypeaheadControl;
        }(SelectionControl));
        Widgets.TypeaheadControl = TypeaheadControl;
        var SelectionBoxType;
        (function (SelectionBoxType) {
            SelectionBoxType[SelectionBoxType["Dropdown"] = 0] = "Dropdown";
            SelectionBoxType[SelectionBoxType["RadioButton"] = 1] = "RadioButton";
            SelectionBoxType[SelectionBoxType["Typeahead"] = 2] = "Typeahead";
        })(SelectionBoxType = Widgets.SelectionBoxType || (Widgets.SelectionBoxType = {}));
        function GetSelectionBoxType(type) {
            switch (type) {
                case "SELECT":
                    return SelectionBoxType.Dropdown;
                case "RADIO":
                    return SelectionBoxType.RadioButton;
                case "TYPEAHEAD":
                    return SelectionBoxType.Typeahead;
                default:
                    return SelectionBoxType.Dropdown;
            }
        }
        Widgets.GetSelectionBoxType = GetSelectionBoxType;
        function GetControl($scope, $element) {
            switch ($scope.controlType) {
                case SelectionBoxType.Dropdown:
                    return new DropdownControl($scope, $element);
                case SelectionBoxType.Typeahead:
                    return new TypeaheadControl($scope, $element);
                case SelectionBoxType.RadioButton:
                    return new RadioButtonControl($scope, $element);
                default:
                    return null;
            }
        }
        Widgets.GetControl = GetControl;
    })(Widgets = Joove.Widgets || (Joove.Widgets = {}));
})(Joove || (Joove = {}));
;
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var Joove;
(function (Joove) {
    var Widgets;
    (function (Widgets) {
        var JooveDatasourceGridProvider = /** @class */ (function (_super) {
            __extends(JooveDatasourceGridProvider, _super);
            function JooveDatasourceGridProvider() {
                return _super !== null && _super.apply(this, arguments) || this;
            }
            return JooveDatasourceGridProvider;
        }(Joove.BaseAngularProvider));
        function jooveDsGrid($timeout, $interval, $compile, jooveDsGrid) {
            var defaultOptions = {
                pageSize: 10
            };
            return {
                priority: 1001,
                restrict: "AE",
                scope: true,
                link: function ($scope, $table, $attrs, ngModelCtrl) {
                    Joove.Common.setDirectiveScope($table, $scope);
                    var ngMaster = $attrs.ngMaster;
                    if (ngMaster != null && ngMaster.trim && ngMaster.trim().toLowerCase() == "true") {
                        $scope.fromMasterForm = true;
                    }
                    var formScope = $scope.fromMasterForm ? Joove.Common.getMasterScope() : Joove.Common.getScope();
                    var securityTimeout;
                    var _tools = {
                        updateVisiblePages: function (page) {
                            var visiblePages = [];
                            for (var i = 0; i < $scope.$totalPages; i++) {
                                if (i === 0 || // first
                                    i === $scope.$totalPages - 1 || // last
                                    i === $scope.$currentPage || // current
                                    i === $scope.$currentPage - 1 || // prev
                                    i === $scope.$currentPage + 1) { // next
                                    visiblePages.push(i);
                                }
                                else {
                                    if (i === 1) {
                                        visiblePages.push(-1); // ... for all prev pages
                                    }
                                    else if (i === $scope.$totalPages - 2) {
                                        visiblePages.push(-2); // ... for all next pages
                                    }
                                }
                            }
                            $scope.$visiblePagerPages = visiblePages;
                        },
                        gridChanged: function (dontMakeFormDirty) {
                            clearTimeout(securityTimeout);
                            dontMakeFormDirty = true; // force this since for the moment DS Grids are readonly
                            securityTimeout = setTimeout(function () {
                                Joove.Core.onChange($table, null, dontMakeFormDirty);
                            }, 45);
                        },
                        init: function () {
                            $scope.$mobileThreshold = parseInt($table.attr("data-mobile-width"));
                            $scope.$cardMode = false;
                            $scope.$gotoPage(0, true, true);
                            $scope.$dataSetName = Joove.DatasourceManager.getDataSetNameFromControl($table);
                            //$("[jb-clear-filters='" + $scope.$dataSetName + "']").on("click", () => {
                            //    _tools.clearAllFilters();
                            //});
                            //$("[jb-apply-filters='" + $scope.$dataSetName + "']").on("click", () => {                            
                            //    $scope.$gotoPage(0, true, true);
                            //});
                            $table.find("[joove-ds-sort]").after("<span style='font-size: 22px; visibility: hidden' class='order-by-mark-placeholder'>⇩</span>");
                            $(window).on("resize", function () {
                                _tools.onResize();
                            });
                            setTimeout(function () {
                                _tools.onResize();
                            }, 500);
                        },
                        scrollToTop: function () {
                            var $fieldSet = $table.closest("[jb-type='FieldSet']").get(0);
                            if ($fieldSet == null)
                                return;
                            $fieldSet.scrollIntoView({ behavior: "smooth", block: "start" });
                        },
                        onResize: function () {
                            if ($scope.$mobileThreshold == null ||
                                isNaN($scope.$mobileThreshold) === true ||
                                $scope.$mobileThreshold < 0) {
                                return;
                            }
                            var newCardMode = $(window).width() < $scope.$mobileThreshold;
                            if ($scope.$cardMode == newCardMode)
                                return;
                            $scope.$cardMode = newCardMode;
                            Joove.Core.applyScope($scope);
                        },
                        getOrderMark: function (dir) {
                            if (dir == Joove.OrderByDirections.DESC) {
                                return "<span style='font-size: 22px' class='order-by-mark order-mark-desc'>⇩</span>";
                            }
                            else if (dir == Joove.OrderByDirections.ASC) {
                                return "<span style='font-size: 22px' class='order-by-mark order-mark-asc'>⇧</span>";
                            }
                            else {
                                return null;
                            }
                        },
                        clearAllFilters: function () {
                            $scope._helper.clearAllFilters();
                            var filterTextBox = $table.find("[joove-ds-filter]");
                            if (filterTextBox.length > 0) {
                                filterTextBox.val("");
                            }
                            else {
                                $("[joove-ds-filter-for='" + $attrs.jooveDataset + "']").val("");
                            }
                            $scope.$refresh();
                        }
                    };
                    $scope.$watchCollection("$collection", function (newValue, oldValue) {
                        if (Joove.Common.collectionsAreEqual(newValue, oldValue))
                            return;
                        _tools.updateVisiblePages();
                        _tools.gridChanged(false);
                    });
                    var options = JSON.parse($attrs.joovegridoptions);
                    $scope.$pageSize = parseInt(options.pageSize);
                    if (isNaN($scope.$pageSize)) {
                        $scope.$pageSize = defaultOptions.pageSize;
                    }
                    $scope._helper = new JooveGridHelper($table, $scope.$pageSize, $scope.fromMasterForm);
                    $scope._helper.hideParentFieldSet();
                    $scope.$visiblePagerPages = [];
                    $scope.$currentPage = -1;
                    $scope.$clearFilters = function (e) {
                        _tools.clearAllFilters();
                    };
                    $scope.$applyFilters = function (e) {
                        $scope.$gotoPage(0, true, true);
                    };
                    $scope.$add = function (item) {
                        console.error("Datasource Grid -ADD- not implemented");
                        //$model().push(item || {});
                        //$scope.$gotoLastPage();
                    };
                    $scope.$remove = function (item) {
                        if (options.confirm === true) {
                            window._popUpManager.question(window._resourcesManager
                                .getGlobalResource("RES_WEBFORM_GenericConfirmationQuestion"), "", function () {
                                $scope.$doRemove(item);
                                $scope.$digest();
                            });
                        }
                        else {
                            $scope.$doRemove(item);
                        }
                    };
                    $scope.$doRemove = function (item) {
                        console.error("Datasource Grid -REMOVE- not implemented");
                        //var model = $model();
                        //for (let i = 0; i < getCollectionCount(); i++) {
                        //    if (item === model[i]) {
                        //        model.splice(i, 1);
                        //        break;
                        //    }
                        //}
                        //$scope.$gotoPage($scope.$currentPage);
                    };
                    $scope.$nextPage = function () {
                        $scope.$gotoPage($scope.$currentPage + 1);
                    };
                    $scope.$prevPage = function () {
                        $scope.$gotoPage($scope.$currentPage - 1);
                    };
                    $scope.$gotoLastPage = function () {
                        $scope.$gotoPage(Math.ceil($scope.$totalRows / $scope.$pageSize) - 1);
                    };
                    $scope.$gotoFirstPage = function () {
                        $scope.$gotoPage(0);
                    };
                    $scope.$gotoPage = function (page, offTheRecord, force) {
                        if (page < 0)
                            return;
                        if (page > $scope.$totalPages - 1)
                            page = $scope.$totalPages - 1;
                        if ($scope.$currentPage == page && force !== true)
                            return;
                        $scope.$currentPage = page;
                        $scope._helper.status.currentPage = page;
                        $scope.$refresh(function (data) {
                            _tools.updateVisiblePages();
                        });
                        //if (!offTheRecord) {
                        //    gridChanged(true);
                        //}
                        //do not scroll on page refresh
                        if (force !== true) {
                            _tools.scrollToTop();
                        }
                        //if ($scope.$cardMode === true) {
                        //}
                    };
                    $scope.$refresh = function (cb) {
                        $scope._helper.fetchData(function (resp) {
                            $scope.$totalRows = resp.TotalRows;
                            $scope.$totalPages = Math.ceil($scope.$totalRows / $scope.$pageSize);
                            $scope.$collection = resp.Data;
                            if ($scope._helper.status.currentPage < 0) {
                                $scope._helper.status.currentPage = 0;
                            }
                            if ($scope.$currentPage < 0) {
                                $scope.$currentPage = 0;
                            }
                            Joove.Core.applyScope($scope);
                            _tools.gridChanged(true);
                            setTimeout(function () {
                                window._ruleEngine.applyDataSetRulesResult(resp.RuleEvaluations);
                            }, 10);
                            $scope._helper.refreshImages();
                            cb && cb(resp);
                        });
                    };
                    $scope.$addFilter = function (e, columnName, filterOp, rowOp, overwriteExisting, autoApply) {
                        var value = $(e.target).val();
                        var filterOpEnum = Joove.DatasourceManager.parseStringToFilterOperator(filterOp);
                        var rowOpEnum = Joove.DatasourceManager.parseStringToRowOperator(rowOp);
                        $scope._helper.clearGlobalFilter();
                        $table.find("[joove-ds-global-filter]").val("");
                        $scope._helper.addFilter(columnName, value, filterOpEnum, rowOpEnum, overwriteExisting, FilterType.Simple);
                        if (autoApply === true) {
                            $scope.$gotoPage(0, true, true);
                        }
                    };
                    $scope.$globalFilter = function (e, autoApply) {
                        var value = $(e.target).val();
                        $table.find("[joove-ds-filter]:not([joove-ds-global-filter])").val("");
                        if ($scope._helper.globalFilterChanged(value) === false)
                            return;
                        $scope._helper.globalFilter(value);
                        if (autoApply === true) {
                            $scope.$gotoPage(0, true, true);
                        }
                    };
                    $scope.$sortBy = function (e, columnName) {
                        var $el = $(e.target);
                        var orderDirectionData = $el.data("ordeBy");
                        var orderByEnum = Joove.OrderByDirections.NONE;
                        if (orderDirectionData == "ASC") {
                            orderByEnum = Joove.OrderByDirections.DESC;
                            $el.data("ordeBy", "DESC");
                        }
                        else if (orderDirectionData == "DESC") {
                            orderByEnum = Joove.OrderByDirections.NONE;
                            $el.data("ordeBy", "NONE");
                        }
                        else if (orderDirectionData == "NONE" || orderDirectionData == null) {
                            orderByEnum = Joove.OrderByDirections.ASC;
                            $el.data("ordeBy", "ASC");
                        }
                        $(".order-by-mark").remove();
                        var $mark = _tools.getOrderMark(orderByEnum);
                        if ($mark != null) {
                            $el.after($mark);
                        }
                        $scope._helper.addOrderBy(columnName, orderByEnum, true);
                        $scope.$gotoPage(0, true, true);
                    };
                    $timeout(function () {
                        _tools.init();
                    });
                    Joove.DatasourceManager.watchDependencies(formScope, $table, function () {
                        $scope.$refresh();
                    });
                    Joove.Common.markDirectiveScopeAsReady($table);
                }
            };
        }
        angular
            .module("jooveDsGrid", [])
            .provider("jooveDsGrid", new JooveDatasourceGridProvider())
            .directive("jooveDsGrid", [
            "$timeout",
            "$interval",
            "$compile",
            "jooveDsGrid",
            jooveDsGrid
        ]);
        var FilterType;
        (function (FilterType) {
            FilterType[FilterType["Global"] = 0] = "Global";
            FilterType[FilterType["Simple"] = 1] = "Simple";
        })(FilterType = Widgets.FilterType || (Widgets.FilterType = {}));
        var DataSourceGridFilter = /** @class */ (function (_super) {
            __extends(DataSourceGridFilter, _super);
            function DataSourceGridFilter() {
                return _super !== null && _super.apply(this, arguments) || this;
            }
            return DataSourceGridFilter;
        }(Joove.FilterInfo));
        Widgets.DataSourceGridFilter = DataSourceGridFilter;
        var JooveGridHelper = /** @class */ (function () {
            function JooveGridHelper($el, pageSize, fromMasterForm) {
                this.parentIsVisible = true;
                this.hideTimeout = 150;
                this.fromMasterForm = false;
                this.status = {
                    filterBy: [],
                    orderBy: [],
                    currentPage: 0,
                    pageSize: pageSize,
                    columns: Joove.DatasourceManager.getDataSetColumnInfoFromControl($el)
                };
                this.$element = $el;
                this.fromMasterForm = fromMasterForm;
            }
            JooveGridHelper.prototype.hideParentFieldSet = function () {
                this.$element.closest("[jb-type='FieldSet']").css("opacity", "0");
                this.parentIsVisible = false;
            };
            JooveGridHelper.prototype.showParentFieldSet = function () {
                var _this = this;
                setTimeout(function () {
                    _this.$element.closest("[jb-type='FieldSet']").css("opacity", "1");
                    _this.parentIsVisible = true;
                }, this.hideTimeout);
            };
            JooveGridHelper.prototype.refreshImages = function () {
                var elements = $("[jb-type='ImageBox']", this.$element);
                var ids = [];
                elements.each(function (index) {
                    var id = $(this).attr('jb-id');
                    if (ids.indexOf(id) == -1) {
                        ids.add(id);
                    }
                });
                if (ids.length > 0) {
                    window._commander.imageRefresh(ids);
                }
            };
            JooveGridHelper.prototype.prepareRequest = function () {
                var startRow = this.status.currentPage * this.status.pageSize;
                if (startRow < 0) {
                    startRow = 0;
                }
                var request = new Joove.DatasourceRequest(this.$element, startRow, this.status.pageSize, this.status.filterBy, this.status.orderBy);
                return request;
            };
            JooveGridHelper.prototype.fetchData = function (cb) {
                var _this = this;
                var self = this;
                var requestInfo = this.prepareRequest();
                Joove.DatasourceManager.fetchDatasource(this.$element, Joove.Core.getElementName(this.$element), requestInfo, {
                    success: function (response) {
                        cb && cb(response);
                        if (_this.parentIsVisible == true)
                            return;
                        _this.showParentFieldSet();
                    },
                    error: function () {
                        console.error("Error fetching grid datasource");
                    }
                }, self.fromMasterForm);
            };
            JooveGridHelper.prototype.globalFilterChanged = function (newValue) {
                return this.lastGlobalFilter != newValue;
            };
            JooveGridHelper.prototype.globalFilter = function (value) {
                this.clearAllFilters();
                this.lastGlobalFilter = value;
                if (value == null || value.trim().length == 0)
                    return;
                for (var i = 0; i < this.status.columns.length; i++) {
                    var current = this.status.columns[i];
                    if (current.searchable !== true)
                        continue;
                    this.addFilter(current.name, value, Joove.FilterOperators.LIKE, Joove.RowOperators.OR, true, FilterType.Global);
                }
            };
            JooveGridHelper.prototype.clearAllFilters = function () {
                this.status.filterBy = [];
            };
            JooveGridHelper.prototype.clearGlobalFilter = function () {
                var indexesToSplice = [];
                var filtersToRemain = [];
                for (var i = 0; i < this.status.filterBy.length; i++) {
                    var current = this.status.filterBy[i];
                    if (current.type != FilterType.Global) {
                        filtersToRemain.push(current);
                    }
                }
                this.status.filterBy = filtersToRemain;
            };
            JooveGridHelper.prototype.addFilter = function (columnName, value, filterOp, rowOp, overwriteExisting, type) {
                var column = this.getColumnInfoByName(columnName);
                if (overwriteExisting === true) {
                    var indexToSplice = -1;
                    for (var i = 0; i < this.status.filterBy.length; i++) {
                        var current = this.status.filterBy[i];
                        if (current.column.name == columnName) {
                            indexToSplice = i;
                            break;
                        }
                    }
                    if (indexToSplice > -1) {
                        this.status.filterBy.splice(indexToSplice, 1);
                    }
                }
                var filter = new DataSourceGridFilter(column, value, rowOp, filterOp, null);
                filter.type = type;
                this.status.filterBy.push(filter);
            };
            JooveGridHelper.prototype.addOrderBy = function (columnName, direction, removeOthers) {
                var indexToSplice = -1;
                if (removeOthers == true) {
                    this.status.orderBy = [];
                }
                else {
                    for (var i = 0; i < this.status.orderBy.length; i++) {
                        var current = this.status.orderBy[i];
                        if (current.column.name == columnName) {
                            indexToSplice = i;
                            break;
                        }
                    }
                    if (indexToSplice > -1) {
                        this.status.orderBy.splice(indexToSplice, 1);
                    }
                }
                if (direction == Joove.OrderByDirections.NONE)
                    return;
                var column = this.getColumnInfoByName(columnName);
                this.status.orderBy.push(new Joove.OrderByInfo(column, direction));
            };
            JooveGridHelper.prototype.getColumnInfoByName = function (name) {
                for (var i = 0; i < this.status.columns.length; i++) {
                    var current = this.status.columns[i];
                    if (current.name == name)
                        return current;
                }
                return null;
            };
            return JooveGridHelper;
        }());
        Widgets.JooveGridHelper = JooveGridHelper;
    })(Widgets = Joove.Widgets || (Joove.Widgets = {}));
})(Joove || (Joove = {}));
;
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var Joove;
(function (Joove) {
    var Widgets;
    (function (Widgets) {
        var JbImage = /** @class */ (function (_super) {
            __extends(JbImage, _super);
            function JbImage() {
                return _super !== null && _super.apply(this, arguments) || this;
            }
            return JbImage;
        }(Joove.BaseAngularProvider));
        function jbImage($timeout, $interval, ngRadio) {
            return {
                priority: 1001,
                restrict: "AE",
                require: "ngModel",
                scope: {
                    model: "=ngModel",
                    fromServer: "=jbFromServer",
                    canUpload: "=?jbUpload",
                    maximizeOnClick: "=?jbThumbnail",
                    imageType: "=jbImageType",
                    source: "=?ngAttrSrc",
                    imageFolder: "@jbImageFolder",
                    accept: "=?jbAccept",
                    dontMakeFormDirty: "=jbDoesntMakeFormDirty"
                },
                link: function ($scope, $element, $attrs, ngModelCtrl) {
                    if (Joove.Common.directiveScopeIsReady($element))
                        return;
                    $element.on("load", function () {
                        $element.removeClass("broken-image");
                    });
                    $element.on("load", function () {
                        $element.removeClass("broken-image");
                    });
                    $element.on("error", function () {
                        $element.addClass("broken-image");
                    });
                    Joove.Common.setDirectiveScope($element, $scope);
                    var name = Joove.Core.getElementName($element);
                    $scope.$uploadButton = null;
                    $scope.getDataToSend = function () {
                        var model = Joove.Common.getModel();
                        return Joove.Core.prepareDataForFileAction($element, model);
                    };
                    $scope.download = function (thumbnail, cb) {
                        var postData = {
                            model: $scope.getDataToSend(),
                            indexes: Joove.Common.getIndexesOfControl($element).key,
                            useThumbnail: thumbnail
                        };
                        Joove.Core.executeControllerAction(Joove.Core.getControllerForElement($element, false), name + "_Download", "POST", [], postData, null, function (data) { cb && cb(data); }, null, null, function (data) { console.log("Error loading image!", data); });
                    };
                    $scope.upload = function () {
                        var postData = $scope.getDataToSend();
                        var files = $scope.$uploadButton.get(0).files;
                        if ($scope.maxSize != null && $scope.maxSize > 0) {
                            for (var i = 0; i < files.length; i++) {
                                var file = files[0];
                                if (file.size > $scope.maxSize) {
                                    var msg = window._resourcesManager.getTooLargeFileMessage(file.name, file.size, $scope.maxSize);
                                    window._popUpManager.error("", msg);
                                    return;
                                }
                            }
                        }
                        Joove.Core.uploadFile({
                            files: files,
                            withProgressBar: false,
                            model: postData,
                            indexesKey: Joove.Common.getIndexesOfControl($element).key,
                            $element: $element,
                            onSuccess: function (data) {
                                $scope.fullSizeData = null;
                                if (data.Type != "FileUpload")
                                    return;
                                if (data.Legacy == true) {
                                    $scope.model = data.Data.FileName;
                                }
                                else {
                                    $scope.model = data;
                                }
                                $scope.setImage(data.ImageData);
                                $scope.$apply();
                            },
                            onError: function () {
                                $scope.setNotFoundImage();
                            }
                        });
                    };
                    $scope.setImage = function (imageData) {
                        if (imageData == null || imageData.length == null || imageData.length === 0) {
                            $scope.setNotFoundImage();
                        }
                        else {
                            var previousImage = $element.get(0);
                            var previousBroken_1 = $element.hasClass("broken-image");
                            var previousIncomplete_1 = previousImage.complete === false;
                            var previousSrc_1 = previousImage.src;
                            $element.attr("src", "data:image/jpeg;base64," + imageData);
                            setTimeout(function () {
                                if (previousIncomplete_1 == true || previousBroken_1 == true) {
                                    return;
                                }
                                var hadImage = (previousSrc_1 && previousSrc_1.trim && previousSrc_1.trim().length > 0);
                                if (hadImage == false) {
                                    return;
                                }
                                var currentImage = $element.get(0);
                                var currentBroken = $element.hasClass("broken-image");
                                if (currentImage.complete === false || currentBroken == true) {
                                    return;
                                }
                                if (previousSrc_1 != currentImage.src) {
                                    var dontMakeFormDirty = $scope.dontMakeFormDirty;
                                    if (previousSrc_1 == "data:image/jpeg;base64," + getNotFoundImageData()) {
                                        dontMakeFormDirty = true;
                                    }
                                    Joove.Core.onChange(currentImage, null, dontMakeFormDirty);
                                }
                            }, 50);
                        }
                    };
                    $scope.createUploadButton = function () {
                        var uniqTempId = Joove.Common.createRandomId(25);
                        var $container = $("<div class=\"image_upload_button\"></div>");
                        if ($scope.accept == null || $scope.accept.trim() == "") {
                            $scope.accept = "image/*";
                        }
                        $scope.$uploadButton = $("<input type='file' accept=\"" + $scope.accept + "\" jb-id='" + name + "UploadButton' id='" + uniqTempId + "'/>");
                        $scope.$label = $("<label for=\"" + uniqTempId + "\"><span class=\"fileattachment_progress\"><span class=\"fileattachment_progress_inner\"></span></span></label>");
                        $scope.$labelContent = $("<span class=\"fileattachment_content\">" + window._resourcesManager.getImageUploadTitle() + "</span>");
                        $scope.$label.prepend($scope.$labelContent);
                        $container.append($scope.$uploadButton);
                        $container.append($scope.$label);
                        $element.after($container);
                        $scope.$uploadButton.on("change", $scope.upload);
                    };
                    //This will fix those images that have a harcoded source (i.e. filesystem image in the form of src='/Resources/MyImage.png'), 
                    //but the Image itself is missing
                    $element.bind("error", function () {
                        $scope.setNotFoundImage();
                    });
                    //Set the Default image, if its was given
                    $scope.setDefaultFoundImage = function () {
                        var defaultPath = $element.attr("data-default-image") || "";
                        if (defaultPath.trim && defaultPath.trim() != "") {
                            $element.attr("src", defaultPath);
                            return true;
                        }
                        return false;
                    };
                    function getNotFoundImageData() {
                        return "iVBORw0KGgoAAAANSUhEUgAAAfQAAAFqCAYAAADsuqi5AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkk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RdHR0AACuXbsmvfrqq1//z//5P//rRqPx9RaC/fLhw4f/+G/+zb95s1AotBxSwMd76/f29iIWi91p8Vsv79u37/9WFMXT791IwWDQc+9RrVZjw0UMdPokXddbblhs24YsywgEAle3+/XZ6Erdnf0+MjLS9lB3A0JRFHR0dEBVVbzzzjvhP/zDP/zX9+7d+6VWQv348eP/22c/+1lks9mW7yfLspBKpR56uT7xePxOMBhsedb4RgsEAle9rEcXBAG6rrPhIgY6faIxD3tZf25ZFjRNg9/vv4YdsK/04kp9o7rfZ2dnWwr1SCSy4lB3g12WZXR1daFer+PKlSu//Pbbb7td8CsK9pdeemlo165dKz7H/akegxo8bGsrSVLdy4FCG+xiIBC4qmlayz0L7np0no9ODHR6gmEYg41Gw3Ogb4f159s11E+fPt1Spb747wyHw0gmk3jnnXfCf/Inf/J/mKaprSDUL8+H+r+XZRn1er2lSr1Wq3Vi/gS4VtTr9USrk8s2C7/f7ynQG40GDMPgenRioNOCYV3XT3jZUMZxnIXZ1DvJVqzUvYS6u6VvV1cX7t69i8uXL/9uvV6PryTU0+n0X3/uc5972Mpxn4qiYGpqKunhkrw8OTn5xWq1CknaeqtxNU1ruWfBnemu6/oJcMc4YqDTogq917KslgNdFEUEAoEdec12Qvf74mBPp9OYmprCt7/97QvNZnNFlfrnP//539y1axeKxeKK7q1AIICJiQncu3fv77Zapd+6desLW/XAmEAg0PJr4i5DNAyjly0YMdBpgZfJNbZtQ5IkaJp2badet63Y/e411G3bRjqdxuTkJL7zne/87kq/7/Of//x3Lcta0aQv9zm9++67f9+2bWmFof7yj3/84//53r17iEQiW/I+0jTtmiRJnjbF4cQ4YqDTExqNhucZ7qqqvocdMCFuO4W6l+73xaF++/ZtfP/73//9lVTp+/fv/7N9+/atqEp3HAeRSASTk5N48803X3UD+3lhfufOnb//gx/84DNel39tAhdVVX3P60z3RqPBBowY6PRkoHtp3GVZhiRJEzv9+i0O9ddee23Th/rZs2c9V+oAkEql8N5770k3b948s4JQx6c//ek/EwRhRYH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SiQQSiQSrcSIGOtHGVe2NRmMwm80OFYtFlMvlhWVVsixzMt08d0974ONlgeFwGNFoFMlkcvE+6wxyIgY60eYJ90KhMFQsFhf2N7csC6IoQpblHVO927aNZrMJ27YXDsUJhUKIRqOIxWIMcSIGOtHWCXfbtsOlUmmoVCr1VioV1Go1GIYBx3EWtnXd6O1T22GpbWtVVUUgEHBPl5uIRCKXtvnRsUQMdKKdVL1XKpVTlUolXK1Woes6DMNY2HZ1pdu3bmRwL94q1g1vn88HVVXh9/vdEC+HQqE3WIUTMdCJdkTAW5bVW6vVTtbr9UH3BLPFp5gt3rvd3U/d3bd94U3cptBf3BbYtr0Q3E8/B/dUOE3ToGkaAoEA/H7/aCAQuLpoQhsDnIiBTrRzA34+TMO6rp+YP7I03Gg0YBjGwglo7pGri0O3HRZ/WHCPQnVPdVNV1T3trayq6jVN06491X3OACdioBPRSoJ+vooON5vN3mazOWiaZq9lWRHTNMOWZT0R8pZlPfcHP31C23yAl30+X0mSpAlZlkdlWZ54xjGsDG4iBjoRrXXorxLDmoiBTkRERBuF21kREREx0ImIiIiBTkRERAx0IiIiYqATEREx0ImIiIiBTkRERAx0IiIiYqATEREx0ImIiIiBTkRERAx0IiIiYqATEREx0ImIiIiBTkRERAx0IiIiYqATEREx0ImIiIiBTkRERAx0IiIiYqATEREx0ImIiIiBTkRERAx0IiIiYqATEREx0ImIiIiBTkRERAx0IiIiYqATEREx0ImIiIiBTkRERAx0IiIiYqATEREx0ImIiIiBTkRERAx0IiIiYqATEREx0ImIiIiBTkRERAx0IiIiYqATEREx0ImIiIiBTkRERAx0IiIiYqATERERA52IiIiBTkRERAx0IiIiYqATERERA52IiIiBTkRERAx0IiIiYqATERERA52IiIiBTkRERAx0IiIiYqATERERA52IiGi7+v8HAFqLuvQmDWEbAAAAAElFTkSuQmCC";
                    }
                    //Set the Default image, if given. Otherwise, set the hardcoded "Not Found" one
                    $scope.setNotFoundImage = function () {
                        if ($scope.setDefaultFoundImage() === false) {
                            $scope.setImage(getNotFoundImageData());
                        }
                    };
                    $scope.showFullSize = function () {
                        if ($scope.fullSizeData == null) {
                            $scope.download(false, function (data) {
                                $scope.fullSizeData = data;
                                $scope.showFullSize();
                            });
                        }
                        else {
                            var $fullImg = $("<img src='data:image/jpeg;base64," + $scope.fullSizeData + "' style='max-width: 100%; max-height: 100%; position: relative; top: 50%; transform: translateY(-50%);'/>").appendTo("body");
                            window._popUpManager.showCustomPopUp({
                                name: $element.attr("jb-id"),
                                title: $element.attr("title"),
                                width: "85%",
                                height: "85%",
                                destroyOnHide: true,
                                $elementContent: $fullImg,
                                cancelButton: true,
                                onShowCallback: function ($popUp) {
                                    $popUp.find("[jb-type='ModalBody']").css("text-align", "center");
                                },
                                dismissible: true
                            });
                        }
                    };
                    $scope.afterInit = function () {
                        if ($scope.canUpload == true) {
                            $scope.createUploadButton();
                        }
                        if ($scope.maximizeOnClick == true) {
                            $element.on("click", function () {
                                $scope.showFullSize();
                            });
                        }
                    };
                    $scope.init = function () {
                        if ($scope.fromServer == true) {
                            $scope.setNotFoundImage();
                            var hasFolder = $scope.imageFolder != null && $scope.imageFolder.trim() != "";
                            var hasModel = $scope.model != null && $scope.model.trim != null && $scope.model.trim() != "";
                            //If serving from FileSystem, lets get the image's URL and get on with it
                            if ($scope.imageType == "filesystem" && hasModel === true && hasFolder === true) {
                                var folder = $scope.imageFolder;
                                var defaultPath = $element.attr("data-default-image") || "";
                                $element.attr("src", "" + window._context.siteRoot + window._context.currentController + "/DownloadFileByPath?path=" + folder + $scope.model + "&defaultPath=" + defaultPath);
                            }
                            else {
                                var initInterval = setInterval(function () {
                                    if (Joove.Common.parentGridsAreReady($element) === true) {
                                        clearInterval(initInterval);
                                        new Joove.ElementViewPortObserver({
                                            $element: $element,
                                            interval: 1000,
                                            stopWhenEnters: true,
                                            onEnter: function () {
                                                $scope.download(true, function (data) {
                                                    $scope.setImage(data);
                                                });
                                            }
                                        }).start();
                                    }
                                }, 100);
                            }
                        }
                        $scope.afterInit();
                    };
                    $scope.init();
                    Joove.Common.markDirectiveScopeAsReady($element);
                }
            };
        }
        angular
            .module("jbImage", [])
            .provider("jbImage", new JbImage())
            .directive("jbImage", ["$timeout", "$interval", "jbImage", jbImage]);
    })(Widgets = Joove.Widgets || (Joove.Widgets = {}));
})(Joove || (Joove = {}));
;
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var Joove;
(function (Joove) {
    var Widgets;
    (function (Widgets) {
        var JbMap = /** @class */ (function (_super) {
            __extends(JbMap, _super);
            function JbMap() {
                return _super !== null && _super.apply(this, arguments) || this;
            }
            return JbMap;
        }(Joove.BaseAngularProvider));
        var MapEvents;
        (function (MapEvents) {
            MapEvents[MapEvents["BoundsChanged"] = "bounds_changed"] = "BoundsChanged";
            MapEvents[MapEvents["CenterChanged"] = "center_changed"] = "CenterChanged";
            MapEvents[MapEvents["Click"] = "click"] = "Click";
            MapEvents[MapEvents["DoubleClick"] = "dblclick"] = "DoubleClick";
            MapEvents[MapEvents["RightClick"] = "rightclick"] = "RightClick";
            MapEvents[MapEvents["Drag"] = "drag"] = "Drag";
            MapEvents[MapEvents["DragStart"] = "dragstart"] = "DragStart";
            MapEvents[MapEvents["DragEnd"] = "dragend"] = "DragEnd";
            MapEvents[MapEvents["HeadingChanged"] = "heading_changed"] = "HeadingChanged";
            MapEvents[MapEvents["Idle"] = "idle"] = "Idle";
            MapEvents[MapEvents["MapTypeIdChanged"] = "maptypeid_changed"] = "MapTypeIdChanged";
            MapEvents[MapEvents["MouseMove"] = "mousemove"] = "MouseMove";
            MapEvents[MapEvents["MouseOut"] = "mouseout"] = "MouseOut";
            MapEvents[MapEvents["MouseOver"] = "mouseover"] = "MouseOver";
            MapEvents[MapEvents["ProjectionChanged"] = "projection_changed"] = "ProjectionChanged";
            MapEvents[MapEvents["Resize"] = "resize"] = "Resize";
            MapEvents[MapEvents["TilesLoaded"] = "tilesloaded"] = "TilesLoaded";
            MapEvents[MapEvents["TiltChanged"] = "tilt_changed"] = "TiltChanged";
            MapEvents[MapEvents["ZoomChanged"] = "zoom_changed"] = "ZoomChanged";
        })(MapEvents = Widgets.MapEvents || (Widgets.MapEvents = {}));
        var MapDataLayerEvents;
        (function (MapDataLayerEvents) {
            MapDataLayerEvents[MapDataLayerEvents["AddFeature"] = "addfeature"] = "AddFeature";
            MapDataLayerEvents[MapDataLayerEvents["Click"] = "click"] = "Click";
            MapDataLayerEvents[MapDataLayerEvents["DoubleClick"] = "dblclick"] = "DoubleClick";
            MapDataLayerEvents[MapDataLayerEvents["MouseDown"] = "mousedown"] = "MouseDown";
            MapDataLayerEvents[MapDataLayerEvents["MouseOut"] = "mouseout"] = "MouseOut";
            MapDataLayerEvents[MapDataLayerEvents["MouseOver"] = "mouseover"] = "MouseOver";
            MapDataLayerEvents[MapDataLayerEvents["MouseUp"] = "mouseup"] = "MouseUp";
            MapDataLayerEvents[MapDataLayerEvents["RemoveFeature"] = "removefeature"] = "RemoveFeature";
            MapDataLayerEvents[MapDataLayerEvents["RemoveProperty"] = "removeproperty"] = "RemoveProperty";
            MapDataLayerEvents[MapDataLayerEvents["RightClick"] = "rightclick"] = "RightClick";
            MapDataLayerEvents[MapDataLayerEvents["SetGeometry"] = "setgeometry"] = "SetGeometry";
            MapDataLayerEvents[MapDataLayerEvents["SetProperty"] = "setproperty"] = "SetProperty";
        })(MapDataLayerEvents = Widgets.MapDataLayerEvents || (Widgets.MapDataLayerEvents = {}));
        var MapControlStyle = /** @class */ (function () {
            function MapControlStyle(name, style, isType, isDefault) {
                this.name = name;
                this.style = style;
                this.isType = isType;
                this.isDefault = isDefault;
            }
            Object.defineProperty(MapControlStyle.prototype, "key", {
                get: function () {
                    return this.name.replace(/([^a-z0-9]+)/gi, '_');
                },
                enumerable: true,
                configurable: true
            });
            return MapControlStyle;
        }());
        Widgets.MapControlStyle = MapControlStyle;
        var MapControl = /** @class */ (function () {
            function MapControl(element, options) {
                this.autoBoundInProgress = false;
                this.isInitialized = false;
                this.unregisteredMapEvents = [];
                this.unregisteredMapDataLayerEvents = [];
                this._fromMasterPage = false; // TODO!!!
                this.$element = element;
                this.options = options;
                this.symbols = new Array();
                this.mapFeatures = new Array();
                this.mapEventListeners = new Dictionary();
                this.mapEventFunctions = new Dictionary();
                this.mapDataLayerEventListeners = new Dictionary();
                this.mapDataLayerEventFunctions = new Dictionary();
                this.customStyles = new Array();
                MapControl.instancesDic[Joove.Core.getElementName(this.$element)] = this;
                this.init();
            }
            Object.defineProperty(MapControl.prototype, "customTypeKeys", {
                get: function () {
                    var keys = [];
                    var types = this.customStyles.filter(function (style) { return (style.isType); });
                    for (var i = 0; i < types.length; i++) {
                        keys.push(types[i].key);
                    }
                    return keys;
                },
                enumerable: true,
                configurable: true
            });
            Object.defineProperty(MapControl.prototype, "defaultStyle", {
                get: function () {
                    var defaultStyles = this.customStyles.filter(function (style) { return (!style.isType && style.isDefault); });
                    return defaultStyles.length > 0 ? defaultStyles[0].style : [];
                },
                enumerable: true,
                configurable: true
            });
            MapControl.prototype.init = function () {
                var _this = this;
                if (typeof (google) == "undefined" || typeof (google.maps) == "undefined" || this.$element.is(":visible") == false) {
                    setTimeout(function () {
                        _this.init();
                    }, 400);
                }
                else {
                    //Extract all custom styles
                    for (var i = 0; i < this.options.customStyles.length; i++) {
                        this.customStyles.push(new MapControlStyle(this.options.customStyles[i].name, this.options.customStyles[i].styleObject, this.options.customStyles[i].isType === true, this.options.customStyles[i].isDefault === true));
                    }
                    //Initialize map
                    this.map = new google.maps.Map(this.$element.get(0), {
                        zoom: this.options.zoom ? this.options.zoom : 1,
                        minZoom: 3,
                        center: new google.maps.LatLng(this.options.centerCoords.lat ? this.options.centerCoords.lat : 0, this.options.centerCoords.lng ? this.options.centerCoords.lng : 0),
                        mapTypeControlOptions: {
                            mapTypeIds: this.options.googleLayers.concat(this.customTypeKeys)
                        },
                        styles: this.defaultStyle
                    });
                    var self = this;
                    google.maps.event.addListener(this.map, 'bounds_changed', function () {
                        if (self.autoBoundInProgress && this.getZoom() > 7) {
                            this.setZoom(7);
                        }
                        self.autoBoundInProgress = false;
                    });
                    //Initialize symbols
                    this.symbols["arrow"] = {
                        path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW
                    };
                    //Initialize directions services
                    this.directionsService = new google.maps.DirectionsService;
                    this.directionsRenderer = new google.maps.DirectionsRenderer;
                    //Set custom style buttons
                    var customStyleTypes = this.customStyles.filter(function (style) { return (style.isType); });
                    for (var i = 0; i < customStyleTypes.length; i++) {
                        this.map.mapTypes.set(customStyleTypes[i].key, new google.maps.StyledMapType(customStyleTypes[i].style, { name: customStyleTypes[i].name }));
                        if (customStyleTypes[i].isDefault) {
                            this.map.setMapTypeId(customStyleTypes[i].key);
                        }
                    }
                    //Set google-provided layers
                    for (var i = 0; i < this.options.googleLayers.length; i++) {
                        switch (this.options.googleLayers[i]) {
                            case "bicycle":
                                var bicycleLayer = new google.maps.BicyclingLayer();
                                bicycleLayer.setMap(this.map);
                                break;
                            case "transit":
                                var transitLayer = new google.maps.TransitLayer();
                                transitLayer.setMap(this.map);
                                break;
                            case "traffic":
                                var trafficLayer = new google.maps.TrafficLayer();
                                trafficLayer.setMap(this.map);
                                break;
                        }
                    }
                    //Set events
                    //this.addMapDataLayerEvent();
                    //Set built-in functionalities
                    this.highlightLinesOnHover();
                    this.hidePartialViewOnMapChange();
                    //Request data
                    this.getData(true);
                    setTimeout(function () {
                        //Because center/zoom don't work on new map constructor
                        if (_this.options.centerCoords.lat !== null && _this.options.centerCoords.lng !== null) {
                            _this.map.setCenter(new google.maps.LatLng(_this.options.centerCoords.lat ? _this.options.centerCoords.lat : 0, _this.options.centerCoords.lng ? _this.options.centerCoords.lng : 0));
                        }
                        _this.map.setZoom(_this.options.zoom);
                        //For random gray map needing resize to refresh/redraw itself
                        google.maps.event.trigger(_this.map, "resize");
                    }, 777);
                    this.isInitialized = true;
                    //Register requested events that were added before initialization was complete
                    for (var i = 0; i < this.unregisteredMapEvents.length; i++) {
                        this.addMapEvent(this.unregisteredMapEvents[i].type, this.unregisteredMapEvents[i].name, this.unregisteredMapEvents[i].callback);
                    }
                    for (var i = 0; i < this.unregisteredMapDataLayerEvents.length; i++) {
                        this.addMapDataLayerEvent(this.unregisteredMapDataLayerEvents[i].type, this.unregisteredMapDataLayerEvents[i].name, this.unregisteredMapDataLayerEvents[i].callback);
                    }
                }
            };
            /********* Map visual *********/
            MapControl.prototype.setZoom = function (zoomLevel) {
                this.map.setZoom(zoomLevel);
            };
            MapControl.prototype.getFeatureBounds = function () {
                var bounds = new google.maps.LatLngBounds();
                for (var i = 0; i < this.mapFeatures.length; i++) {
                    var currentFeatureGeometry;
                    currentFeatureGeometry = this.mapFeatures[i].getGeometry();
                    currentFeatureGeometry.forEachLatLng(function (latlng) {
                        bounds.extend(new google.maps.LatLng(latlng.lat(), latlng.lng()));
                    });
                }
                return bounds;
            };
            MapControl.prototype.showRelatedPartialView = function (lat, lng) {
                var partialViewElement = $("[jb-type='PartialView'][jb-partial-name='" + this.options.relatedPartialView + "']");
                if (partialViewElement.length === 0)
                    return;
                var topRight = this.map.getProjection().fromLatLngToPoint(this.map.getBounds().getNorthEast());
                var bottomLeft = this.map.getProjection().fromLatLngToPoint(this.map.getBounds().getSouthWest());
                var scale = Math.pow(2, this.map.getZoom());
                var worldPoint = this.map.getProjection().fromLatLngToPoint(new google.maps.LatLng(lat, lng));
                var clickedPoint = new google.maps.Point(Math.round((worldPoint.x - bottomLeft.x) * scale), Math.round((worldPoint.y - topRight.y) * scale));
                var viewportWidth = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
                var viewportHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
                var mapOffset = this.$element.offset();
                var horizontalScroll = $(window).scrollLeft();
                var verticalScroll = $(window).scrollTop();
                var partialViewY = /*mapOffset.top + */ clickedPoint.y;
                var partialViewX = /*mapOffset.left + */ clickedPoint.x;
                if (partialViewY - verticalScroll >= Math.round(viewportHeight / 2)) {
                    partialViewY = partialViewElement.parent().height() - partialViewY;
                    partialViewElement.css("bottom", partialViewY + "px");
                    partialViewElement.css("top", "");
                }
                else {
                    partialViewElement.css("top", partialViewY + "px");
                    partialViewElement.css("bottom", "");
                }
                if (partialViewX - horizontalScroll >= Math.round(viewportWidth / 2)) {
                    partialViewX = partialViewElement.parent().width() - partialViewX;
                    partialViewElement.css("right", partialViewX + "px");
                    partialViewElement.css("left", "");
                }
                else {
                    partialViewElement.css("left", partialViewX + "px");
                    partialViewElement.css("right", "");
                }
                partialViewElement.css("position", "absolute");
                partialViewElement.css("z-index", "100");
                partialViewElement.show();
            };
            /********* Map data *********/
            MapControl.prototype.prepareRequest = function () {
                if (this.options.groupBy == null)
                    return null;
                var groupColumn = new Joove.ColumnInfo(this.options.groupBy.member, this.options.groupBy.dataType);
                var groupInfo = new Joove.GroupByInfo(groupColumn, Joove.GroupState.EXPANDED, false, true);
                var request = new Joove.DatasourceRequest(this.$element, 0, 99999);
                request.filters = [];
                request.groupBy = [groupInfo];
                request.aggregators = [];
                for (var i = 0; i < this.options.values.length; i++) {
                    var current = this.options.values[i];
                    request.aggregators.push({
                        column: current.member,
                        type: current.type
                    });
                }
                return request;
            };
            MapControl.prototype.getData = function (fitToContent, tryNum) {
                var _this = this;
                if (tryNum === void 0) { tryNum = 0; }
                if (!this.isInitialized) {
                    if (tryNum == null) {
                        tryNum = 0;
                    }
                    if (tryNum > 10) {
                        return;
                    }
                    setTimeout(function () {
                        _this.getData(fitToContent, tryNum++);
                    }, 100);
                    return;
                }
                var requestInfo = this.prepareRequest();
                Joove.DatasourceManager.fetchDatasource(this.$element, Joove.Core.getElementName(this.$element), requestInfo, {
                    success: function (response) {
                        var featuresToRemove = _this.mapFeatures.slice();
                        _this._storedData = response.Data; //Save the response for possible re-use
                        _this.mapFeatures = _this.map.data.addGeoJson(response.Data);
                        setTimeout(function () { _this.clearData(featuresToRemove); }, 300);
                        _this.applyStyle();
                        if (fitToContent === true) {
                            _this.fitToContent();
                        }
                    },
                    error: function () {
                        console.error("Error fetching map datasource");
                    }
                }, this._fromMasterPage);
            };
            MapControl.prototype.applyStyle = function () {
                var _this = this;
                this.map.data.setStyle(function (feature) {
                    var style = feature.getProperty("style");
                    switch (style["animation"]) {
                        case "google.maps.Animation.DROP":
                            style["animation"] = google.maps.Animation.DROP;
                            break;
                        case "google.maps.Animation.BOUNCE":
                            style["animation"] = google.maps.Animation.BOUNCE;
                            break;
                    }
                    if (style["arrowSymbol"] === true) {
                        style["icons"] = [{
                                icon: _this.symbols["arrow"],
                                offset: '100%'
                            }];
                    }
                    return style;
                });
            };
            MapControl.prototype.displayDirections = function (from, to, travelMode) {
                if (!this.isInitialized)
                    return;
                var self = this;
                this.directionsService.route({
                    origin: from,
                    destination: to,
                    travelMode: travelMode
                }, function (response, status) {
                    if (status === google.maps.DirectionsStatus.OK) {
                        self.clearDirections();
                        self.directionsRenderer.setMap(self.map);
                        self._storedDirections = response;
                        self.directionsRenderer.setDirections(response);
                    }
                    else {
                        console.log("MAP CONTROL ERROR: Directions request failed due to " + status);
                    }
                });
            };
            MapControl.prototype.clearData = function (features) {
                if (!this.isInitialized)
                    return;
                if (features == undefined || features.length == undefined)
                    return;
                for (var i = features.length - 1; i >= 0; i--) {
                    this.map.data.remove(features.splice(i, 1)[0]);
                }
            };
            MapControl.prototype.clearDirections = function () {
                if (!this.isInitialized)
                    return;
                this.directionsRenderer.setMap(null);
            };
            MapControl.prototype.refreshData = function () {
                var _this = this;
                if (!this.isInitialized)
                    return;
                if (this._storedData != null) {
                    var featuresToRemove = this.mapFeatures.slice();
                    this.mapFeatures = this.map.data.addGeoJson(this._storedData);
                    setTimeout(function () { _this.clearData(featuresToRemove); }, 300);
                    this.applyStyle();
                }
            };
            MapControl.prototype.refreshDirections = function () {
                if (!this.isInitialized)
                    return;
                if (this._storedDirections != null) {
                    this.clearDirections();
                    this.directionsRenderer.setMap(this.map);
                    this.directionsRenderer.setDirections(this._storedDirections);
                }
            };
            /********* Map events *********/
            MapControl.prototype.addMapEvent = function (eventType, name, callback) {
                //If the map is not initialized add the event to the unregistered events array
                //which will be processed after initialization
                if (!this.isInitialized) {
                    this.unregisteredMapEvents.push({ "type": eventType, "name": name, "callback": callback });
                    return;
                }
                var eventName = MapEvents[eventType];
                var key = eventName + "_" + name;
                if (this.mapEventListeners.containsKey(key)) {
                    console.log("Found listener with key: " + key + " Removing...");
                    google.maps.event.removeListener(this.mapEventListeners.item(key));
                    this.mapEventListeners.remove(key);
                    this.mapEventFunctions.remove(key);
                }
                var listener = google.maps.event.addListener(this.map, eventType.toString(), callback);
                this.mapEventListeners.add(key, listener);
                this.mapEventFunctions.add(key, callback);
                console.log("Added listener: " + key);
            };
            MapControl.prototype.addMapDataLayerEvent = function (eventType, name, callback) {
                //If the map is not initialized add the event to the unregistered events array
                //which will be processed after initialization
                if (!this.isInitialized) {
                    this.unregisteredMapDataLayerEvents.push({ "type": eventType, "name": name, "callback": callback });
                    return;
                }
                var eventName = MapDataLayerEvents[eventType];
                var key = eventName + "_" + name;
                if (this.mapDataLayerEventListeners.containsKey(key)) {
                    console.log("Found data layer listener with key: " + key + " Removing...");
                    this.mapDataLayerEventListeners.item(key).remove();
                    this.mapDataLayerEventListeners.remove(key);
                    this.mapDataLayerEventFunctions.remove(key);
                }
                var listener = this.map.data.addListener(eventType.toString(), function (event) { callback(event); });
                this.mapDataLayerEventListeners.add(key, listener);
                this.mapDataLayerEventFunctions.add(key, callback);
                console.log("Added listener: " + key);
            };
            /********* Built-in functionalities *********/
            MapControl.prototype.highlightLinesOnHover = function () {
                var _this = this;
                this.addMapDataLayerEvent(MapDataLayerEvents.MouseOver, "autohighlight", function (event) {
                    _this.map.data.revertStyle();
                    var style = event.feature.getProperty("style");
                    if (style !== undefined) {
                        var strokeWeight = style["strokeWeight"];
                        console.log(strokeWeight);
                        if (strokeWeight !== undefined) {
                            _this.map.data.overrideStyle(event.feature, { strokeWeight: strokeWeight * 2 });
                        }
                    }
                });
                this.addMapDataLayerEvent(MapDataLayerEvents.MouseOut, "autohighlight", function () {
                    _this.map.data.revertStyle();
                });
            };
            MapControl.prototype.hidePartialViewOnMapChange = function () {
                var _this = this;
                var hidePartial = function (event) {
                    var $partialViewElement = $("[jb-type='PartialView'][jb-partial-name='" + _this.options.relatedPartialView + "']");
                    if ($partialViewElement.length === 0)
                        return;
                    $partialViewElement.hide();
                };
                this.addMapEvent(MapEvents.BoundsChanged, "hide-partial_bounds", hidePartial);
                this.addMapEvent(MapEvents.ZoomChanged, "hide-partial_zoom", hidePartial);
            };
            MapControl.prototype.fitToContent = function () {
                if (this.mapFeatures != null && this.mapFeatures.length > 0) {
                    this.autoBoundInProgress = true;
                    this.map.fitBounds(this.getFeatureBounds());
                }
            };
            MapControl.instancesDic = {};
            return MapControl;
        }());
        Widgets.MapControl = MapControl;
        function jbMap(jbMap) {
            return {
                restrict: "AE",
                scope: {
                    opts: "=?jbMapOptions",
                },
                link: function ($scope, $element) {
                    if (Joove.Common.directiveScopeIsReady($element))
                        return;
                    Joove.Common.setDirectiveScope($element, $scope);
                    $scope.map = new MapControl($element, $scope.opts);
                    Joove.Common.markDirectiveScopeAsReady($element);
                }
            };
        }
        angular.module("jbMap", [])
            .provider("jbMap", new JbMap())
            .directive("jbMap", ["jbMap", jbMap]);
        var Dictionary = /** @class */ (function () {
            function Dictionary() {
                this._items = {};
                this._count = 0;
            }
            Dictionary.prototype.containsKey = function (key) {
                return this._items.hasOwnProperty(key);
            };
            Dictionary.prototype.count = function () {
                return this._count;
            };
            Dictionary.prototype.add = function (key, value) {
                this._items[key] = value;
                this._count++;
            };
            Dictionary.prototype.remove = function (key) {
                var val = this._items[key];
                delete this._items[key];
                this._count--;
                return val;
            };
            Dictionary.prototype.item = function (key) {
                return this._items[key];
            };
            Dictionary.prototype.keys = function () {
                var keySet = [];
                for (var prop in this._items) {
                    if (this._items.hasOwnProperty(prop)) {
                        keySet.push(prop);
                    }
                }
                return keySet;
            };
            Dictionary.prototype.values = function () {
                var values = [];
                for (var prop in this._items) {
                    if (this._items.hasOwnProperty(prop)) {
                        values.push(this._items[prop]);
                    }
                }
                return values;
            };
            return Dictionary;
        }());
        Widgets.Dictionary = Dictionary;
    })(Widgets = Joove.Widgets || (Joove.Widgets = {}));
})(Joove || (Joove = {}));
;
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
// Copyright (c) . All rights reserved.
// Licensed under the . See LICENSE file in the project root for full license information.
// This was autogenerated by zAppDev.
var DigicircMatchmaking;
(function (DigicircMatchmaking) {
    var ViewModels;
    (function (ViewModels) {
        var SearchForm;
        (function (SearchForm) {
            var SearchFormViewModel = /** @class */ (function (_super) {
                __extends(SearchFormViewModel, _super);
                function SearchFormViewModel() {
                    return _super.call(this) || this;
                }
                SearchFormViewModel._lightCast = function (instance) {
                    if (instance == null)
                        return;
                    if (instance.SelectedActor != null)
                        instance.SelectedActor = SelectedActor_ActorViewModel._lightCast(instance.SelectedActor);
                    if (instance.Query != null)
                        instance.Query = Query_SearchQueryViewModel._lightCast(instance.Query);
                    return instance;
                };
                SearchFormViewModel._initializeFrom = function (original, ignoreReadOnlyProperties, context) {
                    if (ignoreReadOnlyProperties === void 0) { ignoreReadOnlyProperties = false; }
                    if (context === void 0) { context = new Joove.DTOHelper(); }
                    if (original == null)
                        return null;
                    // if (context.Has(original)) {
                    //    return context.Get(original);
                    // }
                    var result = new SearchFormViewModel();
                    if (context != null && context.fillDb == true) {
                        context.addToDb(original);
                    }
                    result._hydrateSearchFormViewModel(original, ignoreReadOnlyProperties, context);
                    // context.Add(original, result);
                    return result;
                };
                SearchFormViewModel.prototype._hydrateSearchFormViewModel = function (original, ignoreReadOnlyProperties, context) {
                    if (context === void 0) { context = new Joove.DTOHelper(); }
                    if (original == null)
                        return;
                    this._hydrateMasterPageViewModel(original, ignoreReadOnlyProperties, context);
                    if (original._key !== undefined)
                        this._key = original._key;
                    if (original._clientKey !== undefined)
                        this._clientKey = original._clientKey;
                    if (original._originalTypeClassName !== undefined)
                        this._originalTypeClassName = original._originalTypeClassName;
                    if (original._typeHash !== undefined)
                        this._typeHash = original._typeHash;
                    if (original.SelectedMode !== undefined)
                        this.SelectedMode = original.SelectedMode;
                    if (original.SelectedActor !== undefined)
                        this.SelectedActor = SelectedActor_ActorViewModel._initializeFrom(original.SelectedActor, ignoreReadOnlyProperties, context);
                    if (original.Query !== undefined)
                        this.Query = Query_SearchQueryViewModel._initializeFrom(original.Query, ignoreReadOnlyProperties, context);
                    if (original.DropdownCountryDataSet__InitialSelection !== undefined)
                        this.DropdownCountryDataSet__InitialSelection = original.DropdownCountryDataSet__InitialSelection;
                    if (original.DropdownBox__InitialSelection !== undefined)
                        this.DropdownBox__InitialSelection = original.DropdownBox__InitialSelection;
                    this.DropdownCountryDataSetSelectedItemKeys = original.DropdownCountryDataSetSelectedItemKeys;
                    this.DropdownBoxSelectedItemKeys = original.DropdownBoxSelectedItemKeys;
                    this.OptionButtonSelectedItemKeys = original.OptionButtonSelectedItemKeys;
                    this.NewMapSelectedItemKeys = original.NewMapSelectedItemKeys;
                    this.TableSelectedItemKeys = original.TableSelectedItemKeys;
                    this._reduceData = function (ignoreReadOnlyProperties) {
                        var reduced = SearchFormViewModel._initializeFrom(this, ignoreReadOnlyProperties);
                        SearchFormViewModel._deleteDropDownInitialValues(reduced);
                        return reduced;
                    };
                }; /* end _initializeFrom() */
                SearchFormViewModel.prototype._reduceData = function (ignoreReadOnlyProperties) {
                    var reduced = SearchFormViewModel._initializeFrom(this, ignoreReadOnlyProperties);
                    SearchFormViewModel._deleteDropDownInitialValues(reduced);
                    return reduced;
                };
                SearchFormViewModel._deleteDropDownInitialValues = function (reduced) {
                    if (reduced == null)
                        return;
                    delete reduced.DropdownCountryDataSet__InitialSelection;
                    delete reduced.DropdownBox__InitialSelection;
                    DigicircMatchmaking.ViewModels.MasterPage.MasterPageViewModel._deleteDropDownInitialValues(reduced);
                };
                return SearchFormViewModel;
            }(DigicircMatchmaking.ViewModels.MasterPage.MasterPageViewModel));
            SearchForm.SearchFormViewModel = SearchFormViewModel;
            var SelectedActor_ActorViewModel = /** @class */ (function (_super) {
                __extends(SelectedActor_ActorViewModel, _super);
                function SelectedActor_ActorViewModel() {
                    return _super.call(this) || this;
                }
                SelectedActor_ActorViewModel._lightCast = function (instance) {
                    if (instance == null)
                        return;
                    return instance;
                };
                SelectedActor_ActorViewModel._initializeFrom = function (original, ignoreReadOnlyProperties, context) {
                    if (ignoreReadOnlyProperties === void 0) { ignoreReadOnlyProperties = false; }
                    if (context === void 0) { context = new Joove.DTOHelper(); }
                    if (original == null)
                        return null;
                    // if (context.Has(original)) {
                    //    return context.Get(original);
                    // }
                    var result = new SelectedActor_ActorViewModel();
                    if (context != null && context.fillDb == true) {
                        context.addToDb(original);
                    }
                    result._hydrateSelectedActor_ActorViewModel(original, ignoreReadOnlyProperties, context);
                    // context.Add(original, result);
                    return result;
                };
                SelectedActor_ActorViewModel.prototype._hydrateSelectedActor_ActorViewModel = function (original, ignoreReadOnlyProperties, context) {
                    if (context === void 0) { context = new Joove.DTOHelper(); }
                    if (original == null)
                        return;
                    if (original._key !== undefined)
                        this._key = original._key;
                    if (original._clientKey !== undefined)
                        this._clientKey = original._clientKey;
                    if (original._originalTypeClassName !== undefined)
                        this._originalTypeClassName = original._originalTypeClassName;
                    if (original._typeHash !== undefined)
                        this._typeHash = original._typeHash;
                    if (original._versionTimestamp !== undefined)
                        this._versionTimestamp = original._versionTimestamp;
                    if (original.Description !== undefined)
                        this.Description = original.Description;
                    if (original.Email !== undefined)
                        this.Email = original.Email;
                    if (original.Id !== undefined)
                        this.Id = original.Id;
                    if (original.Name !== undefined)
                        this.Name = original.Name;
                    if (original.Url !== undefined)
                        this.Url = original.Url;
                    this._reduceData = function (ignoreReadOnlyProperties) {
                        var reduced = SelectedActor_ActorViewModel._initializeFrom(this, ignoreReadOnlyProperties);
                        return reduced;
                    };
                }; /* end _initializeFrom() */
                SelectedActor_ActorViewModel.prototype._reduceData = function (ignoreReadOnlyProperties) {
                    var reduced = SelectedActor_ActorViewModel._initializeFrom(this, ignoreReadOnlyProperties);
                    return reduced;
                };
                return SelectedActor_ActorViewModel;
            }(BaseClass.ViewModel));
            SearchForm.SelectedActor_ActorViewModel = SelectedActor_ActorViewModel;
            var Query_SearchQueryViewModel = /** @class */ (function (_super) {
                __extends(Query_SearchQueryViewModel, _super);
                function Query_SearchQueryViewModel() {
                    var _this = _super.call(this) || this;
                    _this.ActorNames = new Array();
                    return _this;
                }
                Query_SearchQueryViewModel._lightCast = function (instance) {
                    if (instance == null)
                        return;
                    if (instance.SelectedCountry != null)
                        instance.SelectedCountry = Query_SearchQuery_SelectedCountry_CountryViewModel._lightCast(instance.SelectedCountry);
                    if (instance.SelectedSector != null)
                        instance.SelectedSector = Query_SearchQuery_SelectedSector_SectorTypeViewModel._lightCast(instance.SelectedSector);
                    if (instance.ActorNames != null) {
                        for (var i = 0; i < instance.ActorNames.length; i++) {
                            instance.ActorNames[i] = Query_SearchQuery_ActorNames_ActorNamesViewModel._lightCast(instance.ActorNames[i]);
                        }
                    }
                    return instance;
                };
                Query_SearchQueryViewModel._initializeFrom = function (original, ignoreReadOnlyProperties, context) {
                    if (ignoreReadOnlyProperties === void 0) { ignoreReadOnlyProperties = false; }
                    if (context === void 0) { context = new Joove.DTOHelper(); }
                    if (original == null)
                        return null;
                    // if (context.Has(original)) {
                    //    return context.Get(original);
                    // }
                    var result = new Query_SearchQueryViewModel();
                    if (context != null && context.fillDb == true) {
                        context.addToDb(original);
                    }
                    result._hydrateQuery_SearchQueryViewModel(original, ignoreReadOnlyProperties, context);
                    // context.Add(original, result);
                    return result;
                };
                Query_SearchQueryViewModel.prototype._hydrateQuery_SearchQueryViewModel = function (original, ignoreReadOnlyProperties, context) {
                    if (context === void 0) { context = new Joove.DTOHelper(); }
                    if (original == null)
                        return;
                    if (original._key !== undefined)
                        this._key = original._key;
                    if (original._clientKey !== undefined)
                        this._clientKey = original._clientKey;
                    if (original._originalTypeClassName !== undefined)
                        this._originalTypeClassName = original._originalTypeClassName;
                    if (original._typeHash !== undefined)
                        this._typeHash = original._typeHash;
                    if (original.AdvanceSearch !== undefined)
                        this.AdvanceSearch = original.AdvanceSearch;
                    if (original.GetSearchTerm !== undefined)
                        this.GetSearchTerm = original.GetSearchTerm;
                    if (original.SearchTerm !== undefined)
                        this.SearchTerm = original.SearchTerm;
                    if (original.SelectedMode !== undefined)
                        this.SelectedMode = original.SelectedMode;
                    if (original.ShowAllData !== undefined)
                        this.ShowAllData = original.ShowAllData;
                    if (original.ShowSavedPage !== undefined)
                        this.ShowSavedPage = original.ShowSavedPage;
                    if (original.SelectedCountry !== undefined)
                        this.SelectedCountry = Query_SearchQuery_SelectedCountry_CountryViewModel._initializeFrom(original.SelectedCountry, ignoreReadOnlyProperties, context);
                    if (original.SelectedSector !== undefined)
                        this.SelectedSector = Query_SearchQuery_SelectedSector_SectorTypeViewModel._initializeFrom(original.SelectedSector, ignoreReadOnlyProperties, context);
                    if (original.ActorNames != null) {
                        for (var i = 0; i < original.ActorNames.length; i++) {
                            this.ActorNames.push(Query_SearchQuery_ActorNames_ActorNamesViewModel._initializeFrom(original.ActorNames[i], ignoreReadOnlyProperties, context));
                        }
                    }
                    this._reduceData = function (ignoreReadOnlyProperties) {
                        var reduced = Query_SearchQueryViewModel._initializeFrom(this, ignoreReadOnlyProperties);
                        return reduced;
                    };
                }; /* end _initializeFrom() */
                Query_SearchQueryViewModel.prototype._reduceData = function (ignoreReadOnlyProperties) {
                    var reduced = Query_SearchQueryViewModel._initializeFrom(this, ignoreReadOnlyProperties);
                    return reduced;
                };
                return Query_SearchQueryViewModel;
            }(BaseClass.ViewModel));
            SearchForm.Query_SearchQueryViewModel = Query_SearchQueryViewModel;
            var Query_SearchQuery_SelectedCountry_CountryViewModel = /** @class */ (function (_super) {
                __extends(Query_SearchQuery_SelectedCountry_CountryViewModel, _super);
                function Query_SearchQuery_SelectedCountry_CountryViewModel() {
                    return _super.call(this) || this;
                }
                Query_SearchQuery_SelectedCountry_CountryViewModel._lightCast = function (instance) {
                    if (instance == null)
                        return;
                    return instance;
                };
                Query_SearchQuery_SelectedCountry_CountryViewModel._initializeFrom = function (original, ignoreReadOnlyProperties, context) {
                    if (ignoreReadOnlyProperties === void 0) { ignoreReadOnlyProperties = false; }
                    if (context === void 0) { context = new Joove.DTOHelper(); }
                    if (original == null)
                        return null;
                    // if (context.Has(original)) {
                    //    return context.Get(original);
                    // }
                    var result = new Query_SearchQuery_SelectedCountry_CountryViewModel();
                    if (context != null && context.fillDb == true) {
                        context.addToDb(original);
                    }
                    result._hydrateQuery_SearchQuery_SelectedCountry_CountryViewModel(original, ignoreReadOnlyProperties, context);
                    // context.Add(original, result);
                    return result;
                };
                Query_SearchQuery_SelectedCountry_CountryViewModel.prototype._hydrateQuery_SearchQuery_SelectedCountry_CountryViewModel = function (original, ignoreReadOnlyProperties, context) {
                    if (context === void 0) { context = new Joove.DTOHelper(); }
                    if (original == null)
                        return;
                    if (original._key !== undefined)
                        this._key = original._key;
                    if (original._clientKey !== undefined)
                        this._clientKey = original._clientKey;
                    if (original._originalTypeClassName !== undefined)
                        this._originalTypeClassName = original._originalTypeClassName;
                    if (original._typeHash !== undefined)
                        this._typeHash = original._typeHash;
                    if (original._versionTimestamp !== undefined)
                        this._versionTimestamp = original._versionTimestamp;
                    if (original.Id !== undefined)
                        this.Id = original.Id;
                    if (original.Name !== undefined)
                        this.Name = original.Name;
                    if (original.ShortName !== undefined)
                        this.ShortName = original.ShortName;
                    this._reduceData = function (ignoreReadOnlyProperties) {
                        var reduced = Query_SearchQuery_SelectedCountry_CountryViewModel._initializeFrom(this, ignoreReadOnlyProperties);
                        return reduced;
                    };
                }; /* end _initializeFrom() */
                Query_SearchQuery_SelectedCountry_CountryViewModel.prototype._reduceData = function (ignoreReadOnlyProperties) {
                    var reduced = Query_SearchQuery_SelectedCountry_CountryViewModel._initializeFrom(this, ignoreReadOnlyProperties);
                    return reduced;
                };
                return Query_SearchQuery_SelectedCountry_CountryViewModel;
            }(BaseClass.ViewModel));
            SearchForm.Query_SearchQuery_SelectedCountry_CountryViewModel = Query_SearchQuery_SelectedCountry_CountryViewModel;
            var Query_SearchQuery_SelectedSector_SectorTypeViewModel = /** @class */ (function (_super) {
                __extends(Query_SearchQuery_SelectedSector_SectorTypeViewModel, _super);
                function Query_SearchQuery_SelectedSector_SectorTypeViewModel() {
                    return _super.call(this) || this;
                }
                Query_SearchQuery_SelectedSector_SectorTypeViewModel._lightCast = function (instance) {
                    if (instance == null)
                        return;
                    return instance;
                };
                Query_SearchQuery_SelectedSector_SectorTypeViewModel._initializeFrom = function (original, ignoreReadOnlyProperties, context) {
                    if (ignoreReadOnlyProperties === void 0) { ignoreReadOnlyProperties = false; }
                    if (context === void 0) { context = new Joove.DTOHelper(); }
                    if (original == null)
                        return null;
                    // if (context.Has(original)) {
                    //    return context.Get(original);
                    // }
                    var result = new Query_SearchQuery_SelectedSector_SectorTypeViewModel();
                    if (context != null && context.fillDb == true) {
                        context.addToDb(original);
                    }
                    result._hydrateQuery_SearchQuery_SelectedSector_SectorTypeViewModel(original, ignoreReadOnlyProperties, context);
                    // context.Add(original, result);
                    return result;
                };
                Query_SearchQuery_SelectedSector_SectorTypeViewModel.prototype._hydrateQuery_SearchQuery_SelectedSector_SectorTypeViewModel = function (original, ignoreReadOnlyProperties, context) {
                    if (context === void 0) { context = new Joove.DTOHelper(); }
                    if (original == null)
                        return;
                    if (original._key !== undefined)
                        this._key = original._key;
                    if (original._clientKey !== undefined)
                        this._clientKey = original._clientKey;
                    if (original._originalTypeClassName !== undefined)
                        this._originalTypeClassName = original._originalTypeClassName;
                    if (original._typeHash !== undefined)
                        this._typeHash = original._typeHash;
                    if (original.Code !== undefined)
                        this.Code = original.Code;
                    if (original.Id !== undefined)
                        this.Id = original.Id;
                    if (original.Value !== undefined)
                        this.Value = original.Value;
                    this._reduceData = function (ignoreReadOnlyProperties) {
                        var reduced = Query_SearchQuery_SelectedSector_SectorTypeViewModel._initializeFrom(this, ignoreReadOnlyProperties);
                        return reduced;
                    };
                }; /* end _initializeFrom() */
                Query_SearchQuery_SelectedSector_SectorTypeViewModel.prototype._reduceData = function (ignoreReadOnlyProperties) {
                    var reduced = Query_SearchQuery_SelectedSector_SectorTypeViewModel._initializeFrom(this, ignoreReadOnlyProperties);
                    return reduced;
                };
                return Query_SearchQuery_SelectedSector_SectorTypeViewModel;
            }(BaseClass.ViewModel));
            SearchForm.Query_SearchQuery_SelectedSector_SectorTypeViewModel = Query_SearchQuery_SelectedSector_SectorTypeViewModel;
            var Query_SearchQuery_ActorNames_ActorNamesViewModel = /** @class */ (function (_super) {
                __extends(Query_SearchQuery_ActorNames_ActorNamesViewModel, _super);
                function Query_SearchQuery_ActorNames_ActorNamesViewModel() {
                    return _super.call(this) || this;
                }
                Query_SearchQuery_ActorNames_ActorNamesViewModel._lightCast = function (instance) {
                    if (instance == null)
                        return;
                    return instance;
                };
                Query_SearchQuery_ActorNames_ActorNamesViewModel._initializeFrom = function (original, ignoreReadOnlyProperties, context) {
                    if (ignoreReadOnlyProperties === void 0) { ignoreReadOnlyProperties = false; }
                    if (context === void 0) { context = new Joove.DTOHelper(); }
                    if (original == null)
                        return null;
                    // if (context.Has(original)) {
                    //    return context.Get(original);
                    // }
                    var result = new Query_SearchQuery_ActorNames_ActorNamesViewModel();
                    if (context != null && context.fillDb == true) {
                        context.addToDb(original);
                    }
                    result._hydrateQuery_SearchQuery_ActorNames_ActorNamesViewModel(original, ignoreReadOnlyProperties, context);
                    // context.Add(original, result);
                    return result;
                };
                Query_SearchQuery_ActorNames_ActorNamesViewModel.prototype._hydrateQuery_SearchQuery_ActorNames_ActorNamesViewModel = function (original, ignoreReadOnlyProperties, context) {
                    if (context === void 0) { context = new Joove.DTOHelper(); }
                    if (original == null)
                        return;
                    if (original._key !== undefined)
                        this._key = original._key;
                    if (original._clientKey !== undefined)
                        this._clientKey = original._clientKey;
                    if (original._originalTypeClassName !== undefined)
                        this._originalTypeClassName = original._originalTypeClassName;
                    if (original._typeHash !== undefined)
                        this._typeHash = original._typeHash;
                    if (original.Id !== undefined)
                        this.Id = original.Id;
                    if (original.Name !== undefined)
                        this.Name = original.Name;
                    this._reduceData = function (ignoreReadOnlyProperties) {
                        var reduced = Query_SearchQuery_ActorNames_ActorNamesViewModel._initializeFrom(this, ignoreReadOnlyProperties);
                        return reduced;
                    };
                }; /* end _initializeFrom() */
                Query_SearchQuery_ActorNames_ActorNamesViewModel.prototype._reduceData = function (ignoreReadOnlyProperties) {
                    var reduced = Query_SearchQuery_ActorNames_ActorNamesViewModel._initializeFrom(this, ignoreReadOnlyProperties);
                    return reduced;
                };
                return Query_SearchQuery_ActorNames_ActorNamesViewModel;
            }(BaseClass.ViewModel));
            SearchForm.Query_SearchQuery_ActorNames_ActorNamesViewModel = Query_SearchQuery_ActorNames_ActorNamesViewModel;
        })(SearchForm = ViewModels.SearchForm || (ViewModels.SearchForm = {}));
    })(ViewModels = DigicircMatchmaking.ViewModels || (DigicircMatchmaking.ViewModels = {}));
})(DigicircMatchmaking || (DigicircMatchmaking = {}));
;
// Copyright (c) . All rights reserved.
// Licensed under the . See LICENSE file in the project root for full license information.
// This was autogenerated by zAppDev.
var directiveScopeReadyLimit = 10;
var directiveScopeReadyTimeout = 200;
var DigicircMatchmaking;
(function (DigicircMatchmaking) {
    var Controllers;
    (function (Controllers) {
        var BubbleConditionalFormattings = function (controlName) {
            return [];
        };
        var BubbleDataValidations = function (controlName) {
            return [];
        };
        var BubbleCalculatedExpressions = function (controlName) {
            return [];
        };
        var BubbleController = /** @class */ (function () {
            function BubbleController(normalToPartialModelMappingStructure) {
                this._normalToPartialModelMappingStructure = normalToPartialModelMappingStructure;
            }
            BubbleController.prototype.IncludePartialMethods = function ($scope, controls, $timeout) {
                var _this = this;
                window["scope_Bubble"] = $scope;
                if ($scope._partialModelStructure == null) {
                    $scope._partialModelStructure = {};
                }
                for (var key in this._normalToPartialModelMappingStructure) {
                    var value = this._normalToPartialModelMappingStructure[key];
                    $scope._partialModelStructure[key] = value;
                }
                //$scope._partialModelStructure = this._normalToPartialModelMappingStructure;
                $.connection['eventsHub'].on('forcePageReload', function () {
                    window.onbeforeunload = null;
                    setTimeout(function () {
                        window.location.reload();
                    }, 3000);
                });
                // Events
                $scope.eventCallbacks.Bubble = {
                    Icon1Clicked: function (e, DataItem, _parents) {
                        if (e != null) {
                            e.stopPropagation();
                            e.preventDefault();
                        }
                        if (_this.timeoutDelayLockIcon1Clicked != null) {
                            $timeout.cancel(_this.timeoutDelayLockIcon1Clicked);
                        }
                        _this.timeoutDelayLockIcon1Clicked = $timeout(function () {
                            Joove.Common.setControlKeyPressed(e, 0);
                            Joove.Common.setLastClickedElement(e);
                            Joove.Validation.Manager.validateFormAndExecute(function () {
                                var controlName = $(e.currentTarget || e.target).closest("[jb-type='PartialView']").attr("jb-id");
                                $scope.actions.Bubble.Close(controlName, null, null, e);
                            }, { groups: [Joove.Validation.Constants.ALL_GROUPS], withDataValidationsCheck: false, withRequiredFieldsCheck: false });
                        }, 0);
                    },
                    ButtonClicked: function (e, DataItem, _parents) {
                        if (e != null) {
                            e.stopPropagation();
                            e.preventDefault();
                        }
                        if (_this.timeoutDelayLockButtonClicked != null) {
                            $timeout.cancel(_this.timeoutDelayLockButtonClicked);
                        }
                        _this.timeoutDelayLockButtonClicked = $timeout(function () {
                            Joove.Common.setControlKeyPressed(e, 0);
                            Joove.Common.setLastClickedElement(e);
                            Joove.Validation.Manager.validateFormAndExecute(function () {
                                var controlName = $(e.currentTarget || e.target).closest("[jb-type='PartialView']").attr("jb-id");
                                $scope.actions.Bubble.RedirectToActorForm(controlName, null, null, e);
                            }, { groups: [Joove.Validation.Constants.ALL_GROUPS], withDataValidationsCheck: false, withRequiredFieldsCheck: false });
                        }, 0);
                    },
                };
                // Rules
                window._ruleEngine.addDataValidations(Joove.JbRule.createRulesForPartialControls(controls, BubbleDataValidations));
                window._ruleEngine.addConditionalFormattings(Joove.JbRule.createRulesForPartialControls(controls, BubbleConditionalFormattings));
                window._ruleEngine.addCalculatedExpressions(Joove.JbRule.createRulesForPartialControls(controls, BubbleCalculatedExpressions));
            };
            return BubbleController;
        }());
        Controllers.BubbleController = BubbleController;
        ;
        angular.module("Application").controller("BubbleController", ["$scope", "$timeout", BubbleController]);
    })(Controllers = DigicircMatchmaking.Controllers || (DigicircMatchmaking.Controllers = {}));
})(DigicircMatchmaking || (DigicircMatchmaking = {}));
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __generator = (this && this.__generator) || function (thisArg, body) {
    var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
    return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
    function verb(n) { return function (v) { return step([n, v]); }; }
    function step(op) {
        if (f) throw new TypeError("Generator is already executing.");
        while (_) try {
            if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
            if (y = 0, t) op = [0, t.value];
            switch (op[0]) {
                case 0: case 1: t = op; break;
                case 4: _.label++; return { value: op[1], done: false };
                case 5: _.label++; y = op[1]; op = [0]; continue;
                case 7: op = _.ops.pop(); _.trys.pop(); continue;
                default:
                    if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                    if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                    if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                    if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                    if (t[2]) _.ops.pop();
                    _.trys.pop(); continue;
            }
            op = body.call(thisArg, _);
        } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
        if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
    }
};
// Copyright (c) . All rights reserved.
// Licensed under the . See LICENSE file in the project root for full license information.
// This was autogenerated by zAppDev.
var directiveScopeReadyLimit = 10;
var directiveScopeReadyTimeout = 200;
$(document).keyup(function (e) {
    if (e.which === 13 && Joove.Common.eventPreventsDefaultFormAction(e) === false && !$(e.target).parent().hasClass("search-element")) {
        window._popUpManager.previouslyFocusedElement = document.activeElement;
        $(":focus").blur();
        Joove.Core.getScope().eventCallbacks.ButtonClicked(e);
    }
});
var directiveScopeReadyCounter_NewMap = 1;
var directiveScopeReadyInterval_NewMap = setInterval(function () {
    if (Joove.Common.directiveScopeIsReady($("[jb-id='NewMap']"))) {
        var mapNewMap = Joove.Common.getDirectiveScope($("[jb-id='NewMap']")).map;
        mapNewMap.addMapDataLayerEvent(Joove.Widgets.MapDataLayerEvents.Click, "NewMap_Click", function (event) {
            var boundObject = event.feature.getProperty("boundObject");
            window.$actions.TestBubble(boundObject);
            mapNewMap.showRelatedPartialView(event.latLng.lat(), event.latLng.lng());
        });
        clearInterval(directiveScopeReadyInterval_NewMap);
    }
    if (directiveScopeReadyCounter_NewMap > directiveScopeReadyLimit) {
        clearInterval(directiveScopeReadyInterval_NewMap);
    }
    directiveScopeReadyCounter_NewMap++;
}, directiveScopeReadyTimeout);
window.onbeforeunload = function (e) {
    if (window._context.isDirty) {
        var msg = window._resourcesManager.getGlobalResource("RES_WEBFORM_DirtyMessage");
        e.returnValue = msg; // Gecko, Trident, Chrome 34+
        return msg;
    }
};
var DigicircMatchmaking;
(function (DigicircMatchmaking) {
    var Controllers;
    (function (Controllers) {
        var _this = this;
        var SearchFormConditionalFormattings = [
            new Joove.JbRule({
                name: "ViewModeConditional",
                type: Joove.RuleTypes.ConditionalFormatting,
                isDataSetRule: false,
                evaluatedAtServer: false,
                contextControlName: null,
                condition: function (_parents) { return __awaiter(_this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        return [2 /*return*/, Joove.Common.nullSafe(function () { return window["scope_SearchForm"].model.Query.SelectedMode; }, "") == "map"];
                    });
                }); },
                evaluationTimes: [Joove.EvaluationTimes.OnLoad, Joove.EvaluationTimes.OnChange],
                isRelatedToDataValidation: false
            }),
            new Joove.JbRule({
                name: "HideOnSimpleSearchConditional",
                type: Joove.RuleTypes.ConditionalFormatting,
                isDataSetRule: false,
                evaluatedAtServer: false,
                contextControlName: null,
                condition: function (_parents) { return __awaiter(_this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        return [2 /*return*/, Joove.Common.nullSafe(function () { return window["scope_SearchForm"].model.Query.AdvanceSearch; }, false)];
                    });
                }); },
                evaluationTimes: [Joove.EvaluationTimes.OnLoad, Joove.EvaluationTimes.OnSubmit, Joove.EvaluationTimes.OnChange],
                isRelatedToDataValidation: false
            }),
            new Joove.JbRule({
                name: "HideIfCountryIsEmptyConditional",
                type: Joove.RuleTypes.ConditionalFormatting,
                isDataSetRule: true,
                evaluatedAtServer: false,
                contextControlName: 'Table',
                getContext: function (indexes) {
                    var model = window["scope_SearchForm"].model;
                    var parents = [];
                    try {
                        parents.push(Joove.Common.getDirectiveScope($("[jb-id='Table']")).$collection);
                    }
                    catch (e) {
                        parents.push({});
                    }
                    return parents;
                },
                condition: function (_parents) { return __awaiter(_this, void 0, void 0, function () {
                    return __generator(this, function (_a) {
                        return [2 /*return*/, Joove.Common.nullSafe(function () { return _parents[0].Address; }, null) != null || Joove.Common.nullSafe(function () { return _parents[0].Address.Country; }, null) != null];
                    });
                }); },
                evaluationTimes: [Joove.EvaluationTimes.OnLoad, Joove.EvaluationTimes.OnSubmit, Joove.EvaluationTimes.OnChange],
                isRelatedToDataValidation: false
            }),
        ];
        var SearchFormDataValidations = [];
        var SearchFormCalculatedExpressions = [];
        // Manual Data for OptionButton
        window["dataForOptionButton"] = [{
                _key: "list",
                _text: window._resourcesManager.getRadioButtonManualValueDisplay('ViewMode', '1', false, null),
                _default: true
            }, {
                _key: "map",
                _text: window._resourcesManager.getRadioButtonManualValueDisplay('ViewMode', '0', false, null),
                _default: false
            }];
        // Datasets Column Info
        Controllers.CountryDataSet_ColumnInfo = [new Joove.ColumnInfo("Name", "string", null, false),
            new Joove.ColumnInfo("original", "Country", null, false)];
        window["CountryDataSet_ColumnInfo"] = Controllers.CountryDataSet_ColumnInfo;
        Controllers.SectorTypeDataset_ColumnInfo = [new Joove.ColumnInfo("Value", "string", null, false),
            new Joove.ColumnInfo("original", "SectorType", null, false)];
        window["SectorTypeDataset_ColumnInfo"] = Controllers.SectorTypeDataset_ColumnInfo;
        Controllers.ViewMode_ColumnInfo = [new Joove.ColumnInfo("Value", "string", null, true)];
        window["ViewMode_ColumnInfo"] = Controllers.ViewMode_ColumnInfo;
        Controllers.ActorDataSet1_ColumnInfo = [new Joove.ColumnInfo("Address.Latitude", "double", null, false),
            new Joove.ColumnInfo("Address.Longitude", "double", null, false),
            new Joove.ColumnInfo("ActorLogo", "FileData", null, false),
            new Joove.ColumnInfo("Name", "string", null, false),
            new Joove.ColumnInfo("ShortDescription", "string", null, false),
            new Joove.ColumnInfo("EntityType.Value", "string", null, false),
            new Joove.ColumnInfo("Address.Country.Name", "string", null, false)];
        window["ActorDataSet1_ColumnInfo"] = Controllers.ActorDataSet1_ColumnInfo;
        // Datasets Projection Shemas
        window["DropdownCountryDataSet_ProjectionScema"] = {};
        window["DropdownBox_ProjectionScema"] = {};
        window["NewMap_ProjectionScema"] = { Query: { SearchQueryKey: '',
                ActorNames: { Id: '',
                    Name: {}
                },
                ShowAllData: {}
            }
        };
        window["Table_ProjectionScema"] = { Query: { SearchQueryKey: '',
                ActorNames: { Id: '',
                    Name: {}
                },
                ShowAllData: {}
            }
        };
        var PartialViewPartialModelStructure = /** @class */ (function () {
            function PartialViewPartialModelStructure() {
            }
            Object.defineProperty(PartialViewPartialModelStructure.prototype, "Actor", {
                get: function () { return window["scope_Bubble"].model.SelectedActor; },
                set: function (__val) {
                    window["scope_Bubble"].model.SelectedActor = __val;
                },
                enumerable: true,
                configurable: true
            });
            ;
            ;
            return PartialViewPartialModelStructure;
        }()); //end class PartialViewPartialModelStructure
        var SearchFormController = /** @class */ (function () {
            function SearchFormController($scope, $timeout) {
                this.$scope = $scope;
                this.controllerActionFinished = function (resetDirty) {
                    //window.scope_SearchForm.model = window.scope_SearchForm.dehydrate();
                    //window.scope_MasterPage.model = window.scope_SearchForm.model;
                    DigicircMatchmaking.ViewModels.SearchForm.SearchFormViewModel._lightCast(window.scope_SearchForm.model);
                    // Joove.Common.applyScope(window.scope_SearchForm);
                    if (resetDirty) {
                        window._context.isDirty = false;
                    }
                    window._ruleEngine.update(Joove.EvaluationTimes.OnChange);
                };
                window.scope_SearchForm = $scope;
                $scope.$onControlChanged = function (event, newValue, dontMakeDirty) {
                    Joove.Core.onChange(event.target, newValue, dontMakeDirty);
                };
                $scope.dehydrate = function (context) {
                    if (context === void 0) { context = null; }
                    return DigicircMatchmaking.ViewModels.SearchForm.SearchFormViewModel._initializeFrom($scope.model, context);
                };
                $scope._validationsMaster = window.scope_MasterPage._validations;
                $scope._validations = { summary: [],
                };
                this.init($scope, $timeout);
                $timeout(function () {
                    window._ruleEngine.update(Joove.EvaluationTimes.OnLoad, null, function () {
                        $("body").fadeIn(200);
                    });
                });
            }
            SearchFormController.prototype.init = function ($scope, $timeout) {
                var _this = this;
                $scope.model = DigicircMatchmaking.ViewModels.SearchForm.SearchFormViewModel._initializeFrom(window.viewDTO.Model);
                window.scope_MasterPage.model = $scope.model;
                new Joove.ReferencesReconstructor().reconstructReferences($scope.model);
                $scope.trackObject = function (obj) { return Joove.Common.trackObject(obj); };
                //}
                $.connection['eventsHub'].on('__connectedEvent');
                $.connection['eventsHub'].on('forcePageReload', function () {
                    window.onbeforeunload = null;
                    setTimeout(function () {
                        window.location.reload();
                    }, 3000);
                });
                $.connection.hub.start(function () {
                    Joove.Common.getScope().connectedToSignals();
                    Joove.Common.getMasterScope().connectedToSignals();
                });
                $scope.connectedToSignals = function () {
                };
                // Event Listeners
                $scope.events = {};
                $scope.expressions = {};
                // Dataset Handler
                $scope.datasets = {};
                // Controller actions
                $scope.actions = {
                    Index: function (_cb, _modalOptions, _e) { return __awaiter(_this, void 0, void 0, function () {
                        return __generator(this, function (_a) {
                            Joove.Common.autocompleteFix();
                            Joove.Core.executeRedirectControllerAction("SearchForm", "Index", "GET", [], {}, _modalOptions);
                            return [2 /*return*/];
                        });
                    }); },
                    FromBack: function (id, _cb, _modalOptions, _e) { return __awaiter(_this, void 0, void 0, function () {
                        return __generator(this, function (_a) {
                            Joove.Common.autocompleteFix();
                            Joove.Core.executeRedirectControllerAction("SearchForm", "FromBack", "GET", [id], {}, _modalOptions);
                            return [2 /*return*/];
                        });
                    }); },
                    ChangeMode: function (_cb, _modalOptions, _e) { return __awaiter(_this, void 0, void 0, function () {
                        return __generator(this, function (_a) {
                            Joove.Common.autocompleteFix();
                            Joove.Core.executeControllerActionNew({
                                verb: 'POST', controller: 'SearchForm', action: 'ChangeMode',
                                queryData: [], postData: { 'model': $scope.model },
                                cb: _cb, modalOptions: _modalOptions, event: _e
                            });
                            return [2 /*return*/];
                        });
                    }); },
                    TestBubble: function (actor, _cb, _modalOptions, _e) { return __awaiter(_this, void 0, void 0, function () {
                        var _this = this;
                        var implementation, spamHelper;
                        return __generator(this, function (_a) {
                            switch (_a.label) {
                                case 0:
                                    Joove.Common.autocompleteFix();
                                    implementation = function () { return __awaiter(_this, void 0, void 0, function () {
                                        return __generator(this, function (_a) {
                                            window["scope_SearchForm"].model.SelectedActor = actor;
                                            return [2 /*return*/];
                                        });
                                    }); };
                                    spamHelper = new Joove.SpamControlHelper(_e);
                                    spamHelper.Disable();
                                    return [4 /*yield*/, implementation()];
                                case 1:
                                    _a.sent();
                                    spamHelper.Enable();
                                    this.controllerActionFinished(false);
                                    return [2 /*return*/];
                            }
                        });
                    }); },
                    Search: function (_cb, _modalOptions, _e) { return __awaiter(_this, void 0, void 0, function () {
                        return __generator(this, function (_a) {
                            Joove.Common.autocompleteFix();
                            window._context.isDirty = false;
                            Joove.Core.executeControllerActionNew({
                                verb: 'POST', controller: 'SearchForm', action: 'Search',
                                queryData: [], postData: { 'model': $scope.model },
                                cb: _cb, modalOptions: _modalOptions, event: _e
                            });
                            return [2 /*return*/];
                        });
                    }); },
                    SearchGraph: function (_cb, _modalOptions, _e) { return __awaiter(_this, void 0, void 0, function () {
                        return __generator(this, function (_a) {
                            Joove.Common.autocompleteFix();
                            Joove.Core.executeControllerActionNew({
                                verb: 'POST', controller: 'SearchForm', action: 'SearchGraph',
                                queryData: [], postData: { 'model': $scope.model },
                                cb: _cb, modalOptions: _modalOptions, event: _e
                            });
                            return [2 /*return*/];
                        });
                    }); },
                    NewSearch: function (_cb, _modalOptions, _e) { return __awaiter(_this, void 0, void 0, function () {
                        return __generator(this, function (_a) {
                            Joove.Common.autocompleteFix();
                            Joove.Core.executeControllerActionNew({
                                verb: 'POST', controller: 'SearchForm', action: 'NewSearch',
                                queryData: [], postData: { 'model': $scope.model },
                                cb: _cb, modalOptions: _modalOptions, event: _e
                            });
                            return [2 /*return*/];
                        });
                    }); },
                    Refresh: function (_cb, _modalOptions, _e) { return __awaiter(_this, void 0, void 0, function () {
                        var _this = this;
                        var implementation, spamHelper;
                        return __generator(this, function (_a) {
                            switch (_a.label) {
                                case 0:
                                    Joove.Common.autocompleteFix();
                                    implementation = function () { return __awaiter(_this, void 0, void 0, function () {
                                        return __generator(this, function (_a) {
                                            Joove.Common.nullSafe(function () { return window._commander.gridRefresh(["Table"]); }, null);
                                            eval("setTimeout(function(){_commander.gridGotoFirstPage(['Table']);},50);");
                                            eval("setTimeout(function(){ window._commander.imageRefresh(['lblLogods']) }, 200);");
                                            return [2 /*return*/];
                                        });
                                    }); };
                                    spamHelper = new Joove.SpamControlHelper(_e);
                                    spamHelper.Disable();
                                    return [4 /*yield*/, implementation()];
                                case 1:
                                    _a.sent();
                                    spamHelper.Enable();
                                    this.controllerActionFinished(false);
                                    return [2 /*return*/];
                            }
                        });
                    }); },
                    Reset: function (_cb, _modalOptions, _e) { return __awaiter(_this, void 0, void 0, function () {
                        return __generator(this, function (_a) {
                            Joove.Common.autocompleteFix();
                            Joove.Core.executeControllerActionNew({
                                verb: 'POST', controller: 'SearchForm', action: 'Reset',
                                queryData: [], postData: { 'model': $scope.model },
                                cb: _cb, modalOptions: _modalOptions, event: _e
                            });
                            return [2 /*return*/];
                        });
                    }); },
                    Action: function (_cb, _modalOptions, _e) { return __awaiter(_this, void 0, void 0, function () {
                        var _this = this;
                        var implementation, spamHelper;
                        return __generator(this, function (_a) {
                            switch (_a.label) {
                                case 0:
                                    Joove.Common.autocompleteFix();
                                    implementation = function () { return __awaiter(_this, void 0, void 0, function () {
                                        return __generator(this, function (_a) {
                                            return [2 /*return*/];
                                        });
                                    }); };
                                    spamHelper = new Joove.SpamControlHelper(_e);
                                    spamHelper.Disable();
                                    return [4 /*yield*/, implementation()];
                                case 1:
                                    _a.sent();
                                    spamHelper.Enable();
                                    this.controllerActionFinished(false);
                                    return [2 /*return*/];
                            }
                        });
                    }); },
                    GoToActorForm: function (id, _cb, _modalOptions, _e) { return __awaiter(_this, void 0, void 0, function () {
                        var _this = this;
                        var implementation, spamHelper;
                        return __generator(this, function (_a) {
                            switch (_a.label) {
                                case 0:
                                    Joove.Common.autocompleteFix();
                                    implementation = function () { return __awaiter(_this, void 0, void 0, function () {
                                        return __generator(this, function (_a) {
                                            eval("_commander.gridSaveState(['Table']);");
                                            Joove.Common.nullSafe(function () { return Joove.Core.executeRedirectControllerAction("ActorViewForm", "Show", "GET", [id], {}, _modalOptions); }, null);
                                            return [2 /*return*/];
                                        });
                                    }); };
                                    spamHelper = new Joove.SpamControlHelper(_e);
                                    spamHelper.Disable();
                                    return [4 /*yield*/, implementation()];
                                case 1:
                                    _a.sent();
                                    spamHelper.Enable();
                                    this.controllerActionFinished(false);
                                    return [2 /*return*/];
                            }
                        });
                    }); },
                };
                //Partial Bubble Event Listeners
                $scope.events.Bubble = {};
                $scope.expressions.Bubble = {};
                // Partial Bubble Dataset Handler
                $scope.datasets.Bubble = {};
                //Partial Bubble actions
                $scope.actions.Bubble = {
                    RedirectToActorForm: function (_partialControlName, _cb, _modalOptions, _e) { return __awaiter(_this, void 0, void 0, function () {
                        var _this = this;
                        var implementation, spamHelper;
                        return __generator(this, function (_a) {
                            switch (_a.label) {
                                case 0:
                                    Joove.Common.autocompleteFix();
                                    implementation = function () { return __awaiter(_this, void 0, void 0, function () {
                                        return __generator(this, function (_a) {
                                            Joove.Common.nullSafe(function () { return Joove.Core.executeRedirectControllerAction("ActorViewForm", "Show", "GET", [Joove.Common.nullSafe(function () { return window["scope_Bubble"]._partialModelStructure[_partialControlName].Actor.Id; }, 0)], {}, _modalOptions); }, null);
                                            return [2 /*return*/];
                                        });
                                    }); };
                                    spamHelper = new Joove.SpamControlHelper(_e);
                                    spamHelper.Disable();
                                    return [4 /*yield*/, implementation()];
                                case 1:
                                    _a.sent();
                                    spamHelper.Enable();
                                    this.controllerActionFinished(true);
                                    return [2 /*return*/];
                            }
                        });
                    }); },
                    Close: function (_partialControlName, _cb, _modalOptions, _e) { return __awaiter(_this, void 0, void 0, function () {
                        var _this = this;
                        var implementation, spamHelper;
                        return __generator(this, function (_a) {
                            switch (_a.label) {
                                case 0:
                                    Joove.Common.autocompleteFix();
                                    implementation = function () { return __awaiter(_this, void 0, void 0, function () {
                                        return __generator(this, function (_a) {
                                            eval("$(\"[jb-type='PartialView'][jb-partial-name='Bubble']\").hide()");
                                            return [2 /*return*/];
                                        });
                                    }); };
                                    spamHelper = new Joove.SpamControlHelper(_e);
                                    spamHelper.Disable();
                                    return [4 /*yield*/, implementation()];
                                case 1:
                                    _a.sent();
                                    spamHelper.Enable();
                                    this.controllerActionFinished(false);
                                    return [2 /*return*/];
                            }
                        });
                    }); },
                };
                // Events
                $scope.eventCallbacks = {
                    ButtonClicked: function (e, DataItem, _parents) {
                        if (e != null) {
                            e.stopPropagation();
                            e.preventDefault();
                        }
                        if (_this.timeoutDelayLockButtonClicked != null) {
                            $timeout.cancel(_this.timeoutDelayLockButtonClicked);
                        }
                        _this.timeoutDelayLockButtonClicked = $timeout(function () {
                            Joove.Common.setControlKeyPressed(e, 0);
                            Joove.Common.setLastClickedElement(e);
                            Joove.Validation.Manager.validateFormAndExecute(function () {
                                $scope.actions.NewSearch(null, null, e);
                            }, { groups: [Joove.Validation.Constants.ALL_GROUPS], withDataValidationsCheck: false, withRequiredFieldsCheck: false });
                        }, 0);
                    },
                    Button2Clicked: function (e, DataItem, _parents) {
                        if (e != null) {
                            e.stopPropagation();
                            e.preventDefault();
                        }
                        if (_this.timeoutDelayLockButton2Clicked != null) {
                            $timeout.cancel(_this.timeoutDelayLockButton2Clicked);
                        }
                        _this.timeoutDelayLockButton2Clicked = $timeout(function () {
                            Joove.Common.setControlKeyPressed(e, 0);
                            Joove.Common.setLastClickedElement(e);
                            Joove.Validation.Manager.validateFormAndExecute(function () {
                                $scope.actions.Reset(null, null, e);
                            }, { groups: [Joove.Validation.Constants.ALL_GROUPS], withDataValidationsCheck: false, withRequiredFieldsCheck: false });
                        }, 0);
                    },
                    OptionButtonOnChange: function (e, DataItem, _parents) {
                        if (_this.timeoutDelayLockOptionButtonOnChange != null) {
                            $timeout.cancel(_this.timeoutDelayLockOptionButtonOnChange);
                        }
                        _this.timeoutDelayLockOptionButtonOnChange = $timeout(function () {
                            if (e.target) {
                                Joove.Core.onChange(e.target, null, true);
                            }
                            else {
                                Joove.Core.onChange($("[jb-id='" + e + "']").get(0), null, true);
                            }
                            Joove.Validation.Manager.validateFormAndExecute(function () {
                                $scope.actions.ChangeMode(null, null, e);
                            }, { groups: [Joove.Validation.Constants.ALL_GROUPS], withDataValidationsCheck: false, withRequiredFieldsCheck: false });
                        }, 0);
                    },
                    Row11Clicked: function (e, DataItem, _parents) {
                        if (e != null) {
                            e.stopPropagation();
                            e.preventDefault();
                        }
                        if (_this.timeoutDelayLockRow11Clicked != null) {
                            $timeout.cancel(_this.timeoutDelayLockRow11Clicked);
                        }
                        _this.timeoutDelayLockRow11Clicked = $timeout(function () {
                            Joove.Common.setControlKeyPressed(e, 0);
                            Joove.Common.setLastClickedElement(e);
                            Joove.Validation.Manager.validateFormAndExecute(function () {
                                $scope.actions.GoToActorForm(Joove.Common.nullSafe(function () { return _parents[0].Id; }, 0), null, null, e);
                            }, { groups: [Joove.Validation.Constants.ALL_GROUPS], withDataValidationsCheck: false, withRequiredFieldsCheck: false });
                        }, 0);
                    },
                };
                // Rules
                window._ruleEngine.addDataValidations(SearchFormDataValidations);
                window._ruleEngine.addConditionalFormattings(SearchFormConditionalFormattings);
                window._ruleEngine.addCalculatedExpressions(SearchFormCalculatedExpressions);
                window._commander.executeCommands(window.viewDTO.ClientCommands);
                window.viewDTO.ClientCommands = [];
                new DigicircMatchmaking.Controllers.BubbleController({
                    'PartialView': new PartialViewPartialModelStructure(),
                }).IncludePartialMethods($scope, ["PartialView"], $timeout);
                Joove.Common.setNumberLocalizationSettings();
                Joove.DeveloperApi.init($scope, window.scope_MasterPage);
                window.$formExtend && window.$formExtend();
                window.$onFormLoaded && window.$onFormLoaded();
            };
            return SearchFormController;
        }());
        angular.module("Application").controller("SearchFormController", ["$scope", "$timeout", SearchFormController]);
    })(Controllers = DigicircMatchmaking.Controllers || (DigicircMatchmaking.Controllers = {}));
})(DigicircMatchmaking || (DigicircMatchmaking = {}));
;
