var $t = { lng: 'de-DE', dn: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], mn: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], ma: ['Jan', 'Feb', 'Mrz', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'], datepattern: '(0[1-9]|1[0-9]|2[0-9]|3[01]).(0[1-9]|1[012]).[0-9]{4}', datetimepattern: '(0[1-9]|1[0-9]|2[0-9]|3[01]).(0[1-9]|1[012]).[0-9]{4}\\s([0-5][0-9]):([0-5][0-9])', dateplaceholder: 'dd.MM.yyyy', datetimeplaceholder: 'dd.MM.yyyy HH:mm', dateformat: 'dd.MM.yyyy', datetimeformat: 'dd.MM.yyyy HH:mm', f1: 'Der Server hat einen Fehler gemeldet: \n', f2: 'Bitte versuchen Sie es erneut.', m0: 'Diese Internet-Seite benötigt einen html5-kompatiblen Browser.', m0b: 'Unterstützt werden bspw: Internet Explorer ab Version 10, Firefox ab Version 31, Chrome ab Version 31, Safari ab Version 7, Opera ab Version 27', m1: 'Dieser Datensatz ist momentan von jemand anderem zur Bearbeitung gesperrt.', m2: 'Diese Funktion ist zur Zeit nicht verfügbar', t1: 'Eingabe erforderlich.', t2: 'Eingabe ist nicht erforderlich.', true: 'Ja', false: 'Nein', alert: 'Hinweis', confirm: 'Bestätigen', open: 'Öffnen', 'not implemented': 'Diese Funktion in zur Zeit noch nicht verfügbar.', l0: 'Anmeldung', l1: 'Email / Anmeldename', l2: 'Email-Adresse / Anmeldename', l3: 'Passwort', l4: 'Benutzer', l5: 'Wird vom System ermittelt...', l6: 'Anmelden', l7: 'Passwort vergessen?', //l7a: 'Die Passwort vergessen Funktion wird aus Sicherheitsgründen auch dann einen erfolgreichen Versand bestätigen, wenn die Kombination aus Email-Adresse und Nachname nicht gefunden wurde.', l7a: 'Die "Passwort vergessen"-Funktion läuft in zwei Schritten ab:\n \nIm ersten Schritt wird eine SMS mit einem Code an die hinterlegte Mobilfunk-Nummer versandt.\nIm zweiten Schritt geben Sie bitte diesen Code in das Formular ein und übermitteln es erneut.\n \nIn beiden Schritten wird aus Sicherheitsgründen kein Fehler angezeigt und auch dann ein erfolgreicher Versand bestätigt, wenn die Kombination aus Email-Adresse und Nachname nicht gefunden wurde und/oder der code falsch ist.', l8: 'Keinen Account?', l9: 'Anmeldenamen der Email-Adresse wurde nicht erkannt.', l10: 'Nachname', l11: 'Email-Adresse', l12: 'Passwort zusenden', l13: 'Das Passwort wurde erfolgreich verschickt', l14: 'Das Passwort konnte nicht verschickt werden', l15: 'Sie sind nicht berechtigt, diese Funktion auszuführen.', l16: 'Sie müssen zunächst einen Account angeben.', l17: 'Die Kombination aus Anmeldenamen und Passwort konnte nicht bestätigt werden.', l18: 'Es gibt ein Problem mit dem Formular.\nEs kann momentan nicht verarbeitet und versendet werden.', name: 'Name', submit: 'Senden', cancel: 'Abbrechen', noop: 'Diese Funktion is noch nicht verfügar.' }; var t,e;t=self,e=()=>(()=>{var t={d:(e,s)=>{for(var i in s)t.o(s,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:s[i]})}};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"t",{value:!0})};var e,s={};t.r(s),t.d(s,{AbortError:()=>r,DefaultHttpClient:()=>H,HttpClient:()=>d,HttpError:()=>i,HttpResponse:()=>u,HttpTransportType:()=>F,HubConnection:()=>q,HubConnectionBuilder:()=>tt,HubConnectionState:()=>A,JsonHubProtocol:()=>Y,LogLevel:()=>e,MessageType:()=>x,NullLogger:()=>f,Subject:()=>U,TimeoutError:()=>n,TransferFormat:()=>B,VERSION:()=>p});class i extends Error{constructor(t,e){const s=new.target.prototype;super(`${t}: Status code '${e}'`),this.statusCode=e,this.__proto__=s}}class n extends Error{constructor(t="A timeout occurred."){const e=new.target.prototype;super(t),this.__proto__=e}}class r extends Error{constructor(t="An abort occurred."){const e=new.target.prototype;super(t),this.__proto__=e}}class o extends Error{constructor(t,e){const s=new.target.prototype;super(t),this.transport=e,this.errorType="UnsupportedTransportError",this.__proto__=s}}class h extends Error{constructor(t,e){const s=new.target.prototype;super(t),this.transport=e,this.errorType="DisabledTransportError",this.__proto__=s}}class c extends Error{constructor(t,e){const s=new.target.prototype;super(t),this.transport=e,this.errorType="FailedToStartTransportError",this.__proto__=s}}class a extends Error{constructor(t){const e=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=e}}class l extends Error{constructor(t,e){const s=new.target.prototype;super(t),this.innerErrors=e,this.__proto__=s}}class u{constructor(t,e,s){this.statusCode=t,this.statusText=e,this.content=s}}class d{get(t,e){return this.send({...e,method:"GET",url:t})}post(t,e){return this.send({...e,method:"POST",url:t})}delete(t,e){return this.send({...e,method:"DELETE",url:t})}getCookieString(t){return""}}!function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Information=2]="Information",t[t.Warning=3]="Warning",t[t.Error=4]="Error",t[t.Critical=5]="Critical",t[t.None=6]="None"}(e||(e={}));class f{constructor(){}log(t,e){}}f.instance=new f;const p="10.0.0";class w{static isRequired(t,e){if(null==t)throw new Error(`The '${e}' argument is required.`)}static isNotEmpty(t,e){if(!t||t.match(/^\s*$/))throw new Error(`The '${e}' argument should not be empty.`)}static isIn(t,e,s){if(!(t in e))throw new Error(`Unknown ${s} value: ${t}.`)}}class g{static get isBrowser(){return!g.isNode&&"object"==typeof window&&"object"==typeof window.document}static get isWebWorker(){return!g.isNode&&"object"==typeof self&&"importScripts"in self}static get isReactNative(){return!g.isNode&&"object"==typeof window&&void 0===window.document}static get isNode(){return"undefined"!=typeof process&&process.release&&"node"===process.release.name}}function m(t,e){let s="";return y(t)?(s=`Binary data of length ${t.byteLength}`,e&&(s+=`. Content: '${function(t){const e=new Uint8Array(t);let s="";return e.forEach((t=>{s+=`0x${t<16?"0":""}${t.toString(16)} `})),s.substring(0,s.length-1)}(t)}'`)):"string"==typeof t&&(s=`String data of length ${t.length}`,e&&(s+=`. Content: '${t}'`)),s}function y(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}async function v(t,s,i,n,r,o){const h={},[c,a]=$();h[c]=a,t.log(e.Trace,`(${s} transport) sending data. ${m(r,o.logMessageContent)}.`);const l=y(r)?"arraybuffer":"text",u=await i.post(n,{content:r,headers:{...h,...o.headers},responseType:l,timeout:o.timeout,withCredentials:o.withCredentials});t.log(e.Trace,`(${s} transport) request complete. Response status: ${u.statusCode}.`)}class b{constructor(t,e){this.i=t,this.h=e}dispose(){const t=this.i.observers.indexOf(this.h);t>-1&&this.i.observers.splice(t,1),0===this.i.observers.length&&this.i.cancelCallback&&this.i.cancelCallback().catch((t=>{}))}}class E{constructor(t){this.l=t,this.out=console}log(t,s){if(t>=this.l){const i=`[${(new Date).toISOString()}] ${e[t]}: ${s}`;switch(t){case e.Critical:case e.Error:this.out.error(i);break;case e.Warning:this.out.warn(i);break;case e.Information:this.out.info(i);break;default:this.out.log(i)}}}}function $(){let t="X-SignalR-User-Agent";return g.isNode&&(t="User-Agent"),[t,C(p,S(),g.isNode?"NodeJS":"Browser",k())]}function C(t,e,s,i){let n="Microsoft SignalR/";const r=t.split(".");return n+=`${r[0]}.${r[1]}`,n+=` (${t}; `,n+=e&&""!==e?`${e}; `:"Unknown OS; ",n+=`${s}`,n+=i?`; ${i}`:"; Unknown Runtime Version",n+=")",n}function S(){if(!g.isNode)return"";switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}function k(){if(g.isNode)return process.versions.node}function P(t){return t.stack?t.stack:t.message?t.message:`${t}`}class T extends d{constructor(e){if(super(),this.u=e,"undefined"==typeof fetch||g.isNode){const t=require;this.p=new(t("tough-cookie").CookieJar),"undefined"==typeof fetch?this.m=t("node-fetch"):this.m=fetch,this.m=t("fetch-cookie")(this.m,this.p)}else this.m=fetch.bind(function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==t.g)return t.g;throw new Error("could not find global")}());if("undefined"==typeof AbortController){const t=require;this.v=t("abort-controller")}else this.v=AbortController}async send(t){if(t.abortSignal&&t.abortSignal.aborted)throw new r;if(!t.method)throw new Error("No method defined.");if(!t.url)throw new Error("No url defined.");const s=new this.v;let o;t.abortSignal&&(t.abortSignal.onabort=()=>{s.abort(),o=new r});let h,c=null;if(t.timeout){const i=t.timeout;c=setTimeout((()=>{s.abort(),this.u.log(e.Warning,"Timeout from HTTP request."),o=new n}),i)}""===t.content&&(t.content=void 0),t.content&&(t.headers=t.headers||{},y(t.content)?t.headers["Content-Type"]="application/octet-stream":t.headers["Content-Type"]="text/plain;charset=UTF-8");try{h=await this.m(t.url,{body:t.content,cache:"no-cache",credentials:!0===t.withCredentials?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:s.signal})}catch(t){if(o)throw o;throw this.u.log(e.Warning,`Error from HTTP request. ${t}.`),t}finally{c&&clearTimeout(c),t.abortSignal&&(t.abortSignal.onabort=null)}if(!h.ok){const t=await I(h,"text");throw new i(t||h.statusText,h.status)}const a=I(h,t.responseType),l=await a;return new u(h.status,h.statusText,l)}getCookieString(t){let e="";return g.isNode&&this.p&&this.p.getCookies(t,((t,s)=>e=s.join("; "))),e}}function I(t,e){let s;switch(e){case"arraybuffer":s=t.arrayBuffer();break;case"text":default:s=t.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`)}return s}class _ extends d{constructor(t){super(),this.u=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new r):t.method?t.url?new Promise(((s,o)=>{const h=new XMLHttpRequest;h.open(t.method,t.url,!0),h.withCredentials=void 0===t.withCredentials||t.withCredentials,h.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===t.content&&(t.content=void 0),t.content&&(y(t.content)?h.setRequestHeader("Content-Type","application/octet-stream"):h.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const c=t.headers;c&&Object.keys(c).forEach((t=>{h.setRequestHeader(t,c[t])})),t.responseType&&(h.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{h.abort(),o(new r)}),t.timeout&&(h.timeout=t.timeout),h.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),h.status>=200&&h.status<300?s(new u(h.status,h.statusText,h.response||h.responseText)):o(new i(h.response||h.responseText||h.statusText,h.status))},h.onerror=()=>{this.u.log(e.Warning,`Error from HTTP request. ${h.status}: ${h.statusText}.`),o(new i(h.statusText,h.status))},h.ontimeout=()=>{this.u.log(e.Warning,"Timeout from HTTP request."),o(new n)},h.send(t.content)})):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class H extends d{constructor(t){if(super(),"undefined"!=typeof fetch||g.isNode)this.$=new T(t);else{if("undefined"==typeof XMLHttpRequest)throw new Error("No usable HttpClient found.");this.$=new _(t)}}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new r):t.method?t.url?this.$.send(t):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(t){return this.$.getCookieString(t)}}class D{static write(t){return`${t}${D.RecordSeparator}`}static parse(t){if(t[t.length-1]!==D.RecordSeparator)throw new Error("Message is incomplete.");const e=t.split(D.RecordSeparator);return e.pop(),e}}D.RecordSeparatorCode=30,D.RecordSeparator=String.fromCharCode(D.RecordSeparatorCode);class R{writeHandshakeRequest(t){return D.write(JSON.stringify(t))}parseHandshakeResponse(t){let e,s;if(y(t)){const i=new Uint8Array(t),n=i.indexOf(D.RecordSeparatorCode);if(-1===n)throw new Error("Message is incomplete.");const r=n+1;e=String.fromCharCode.apply(null,Array.prototype.slice.call(i.slice(0,r))),s=i.byteLength>r?i.slice(r).buffer:null}else{const i=t,n=i.indexOf(D.RecordSeparator);if(-1===n)throw new Error("Message is incomplete.");const r=n+1;e=i.substring(0,r),s=i.length>r?i.substring(r):null}const i=D.parse(e),n=JSON.parse(i[0]);if(n.type)throw new Error("Expected a handshake response from the server.");return[s,n]}}var x,A;!function(t){t[t.Invocation=1]="Invocation",t[t.StreamItem=2]="StreamItem",t[t.Completion=3]="Completion",t[t.StreamInvocation=4]="StreamInvocation",t[t.CancelInvocation=5]="CancelInvocation",t[t.Ping=6]="Ping",t[t.Close=7]="Close",t[t.Ack=8]="Ack",t[t.Sequence=9]="Sequence"}(x||(x={}));class U{constructor(){this.observers=[]}next(t){for(const e of this.observers)e.next(t)}error(t){for(const e of this.observers)e.error&&e.error(t)}complete(){for(const t of this.observers)t.complete&&t.complete()}subscribe(t){return this.observers.push(t),new b(this,t)}}class L{constructor(t,e,s){this.C=1e5,this.S=[],this.k=0,this.P=!1,this.T=1,this.I=0,this._=0,this.H=!1,this.D=t,this.R=e,this.C=s}async A(t){const e=this.D.writeMessage(t);let s=Promise.resolve();if(this.U(t)){this.k++;let t=()=>{},i=()=>{};y(e)?this._+=e.byteLength:this._+=e.length,this._>=this.C&&(s=new Promise(((e,s)=>{t=e,i=s}))),this.S.push(new N(e,this.k,t,i))}try{this.H||await this.R.send(e)}catch{this.L()}await s}N(t){let e=-1;for(let s=0;sthis.T?this.R.stop(new Error("Sequence ID greater than amount of messages we've received.")):this.T=t.sequenceId}L(){this.H=!0,this.P=!0}async B(){const t=0!==this.S.length?this.S[0].q:this.k+1;await this.R.send(this.D.writeMessage({type:x.Sequence,sequenceId:t}));const e=this.S;for(const t of e)await this.R.send(t.M);this.H=!1}X(t){null!=t||(t=new Error("Unable to reconnect to server."));for(const e of this.S)e.J(t)}U(t){switch(t.type){case x.Invocation:case x.StreamItem:case x.Completion:case x.StreamInvocation:case x.CancelInvocation:return!0;case x.Close:case x.Sequence:case x.Ping:case x.Ack:return!1}}O(){void 0===this.V&&(this.V=setTimeout((async()=>{try{this.H||await this.R.send(this.D.writeMessage({type:x.Ack,sequenceId:this.I}))}catch{}clearTimeout(this.V),this.V=void 0}),1e3))}}class N{constructor(t,e,s,i){this.M=t,this.q=e,this.j=s,this.J=i}}!function(t){t.Disconnected="Disconnected",t.Connecting="Connecting",t.Connected="Connected",t.Disconnecting="Disconnecting",t.Reconnecting="Reconnecting"}(A||(A={}));class q{static create(t,e,s,i,n,r,o){return new q(t,e,s,i,n,r,o)}constructor(t,s,i,n,r,o,h){this.K=0,this.G=()=>{this.u.log(e.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},w.isRequired(t,"connection"),w.isRequired(s,"logger"),w.isRequired(i,"protocol"),this.serverTimeoutInMilliseconds=null!=r?r:3e4,this.keepAliveIntervalInMilliseconds=null!=o?o:15e3,this.Y=null!=h?h:1e5,this.u=s,this.D=i,this.connection=t,this.Z=n,this.tt=new R,this.connection.onreceive=t=>this.et(t),this.connection.onclose=t=>this.st(t),this.it={},this.nt={},this.rt=[],this.ot=[],this.ht=[],this.ct=0,this.lt=!1,this.ut=A.Disconnected,this.dt=!1,this.ft=this.D.writeMessage({type:x.Ping})}get state(){return this.ut}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this.ut!==A.Disconnected&&this.ut!==A.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this.wt=this.gt(),this.wt}async gt(){if(this.ut!==A.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this.ut=A.Connecting,this.u.log(e.Debug,"Starting HubConnection.");try{await this.yt(),g.isBrowser&&window.document.addEventListener("freeze",this.G),this.ut=A.Connected,this.dt=!0,this.u.log(e.Debug,"HubConnection connected successfully.")}catch(t){return this.ut=A.Disconnected,this.u.log(e.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async yt(){this.vt=void 0,this.lt=!1;const t=new Promise(((t,e)=>{this.bt=t,this.Et=e}));await this.connection.start(this.D.transferFormat);try{let s=this.D.version;this.connection.features.reconnect||(s=1);const i={protocol:this.D.name,version:s};if(this.u.log(e.Debug,"Sending handshake request."),await this.$t(this.tt.writeHandshakeRequest(i)),this.u.log(e.Information,`Using HubProtocol '${this.D.name}'.`),this.Ct(),this.St(),this.kt(),await t,this.vt)throw this.vt;!!this.connection.features.reconnect&&(this.Pt=new L(this.D,this.connection,this.Y),this.connection.features.disconnected=this.Pt.L.bind(this.Pt),this.connection.features.resend=()=>{if(this.Pt)return this.Pt.B()}),this.connection.features.inherentKeepAlive||await this.$t(this.ft)}catch(t){throw this.u.log(e.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this.Ct(),this.Tt(),await this.connection.stop(t),t}}async stop(){const t=this.wt;this.connection.features.reconnect=!1,this.It=this._t(),await this.It;try{await t}catch(t){}}_t(t){if(this.ut===A.Disconnected)return this.u.log(e.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this.ut===A.Disconnecting)return this.u.log(e.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this.It;const s=this.ut;return this.ut=A.Disconnecting,this.u.log(e.Debug,"Stopping HubConnection."),this.Ht?(this.u.log(e.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this.Ht),this.Ht=void 0,this.Dt(),Promise.resolve()):(s===A.Connected&&this.Rt(),this.Ct(),this.Tt(),this.vt=t||new r("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}async Rt(){try{await this.xt(this.At())}catch{}}stream(t,...e){const[s,i]=this.Ut(e),n=this.Lt(t,e,i);let r;const o=new U;return o.cancelCallback=()=>{const t=this.Nt(n.invocationId);return delete this.it[n.invocationId],r.then((()=>this.xt(t)))},this.it[n.invocationId]=(t,e)=>{e?o.error(e):t&&(t.type===x.Completion?t.error?o.error(new Error(t.error)):o.complete():o.next(t.item))},r=this.xt(n).catch((t=>{o.error(t),delete this.it[n.invocationId]})),this.qt(s,r),o}$t(t){return this.kt(),this.connection.send(t)}xt(t){return this.Pt?this.Pt.A(t):this.$t(this.D.writeMessage(t))}send(t,...e){const[s,i]=this.Ut(e),n=this.xt(this.Mt(t,e,!0,i));return this.qt(s,n),n}invoke(t,...e){const[s,i]=this.Ut(e),n=this.Mt(t,e,!1,i);return new Promise(((t,e)=>{this.it[n.invocationId]=(s,i)=>{i?e(i):s&&(s.type===x.Completion?s.error?e(new Error(s.error)):t(s.result):e(new Error(`Unexpected message type: ${s.type}`)))};const i=this.xt(n).catch((t=>{e(t),delete this.it[n.invocationId]}));this.qt(s,i)}))}on(t,e){t&&e&&(t=t.toLowerCase(),this.nt[t]||(this.nt[t]=[]),-1===this.nt[t].indexOf(e)&&this.nt[t].push(e))}off(t,e){if(!t)return;t=t.toLowerCase();const s=this.nt[t];if(s)if(e){const i=s.indexOf(e);-1!==i&&(s.splice(i,1),0===s.length&&delete this.nt[t])}else delete this.nt[t]}onclose(t){t&&this.rt.push(t)}onreconnecting(t){t&&this.ot.push(t)}onreconnected(t){t&&this.ht.push(t)}et(t){if(this.Ct(),this.lt||(t=this.jt(t),this.lt=!0),t){const s=this.D.parseMessages(t,this.u);for(const t of s)if(!this.Pt||this.Pt.W(t))switch(t.type){case x.Invocation:this.Wt(t).catch((t=>{this.u.log(e.Error,`Invoke client method threw error: ${P(t)}`)}));break;case x.StreamItem:case x.Completion:{const s=this.it[t.invocationId];if(s){t.type===x.Completion&&delete this.it[t.invocationId];try{s(t)}catch(t){this.u.log(e.Error,`Stream callback threw error: ${P(t)}`)}}break}case x.Ping:break;case x.Close:{this.u.log(e.Information,"Close message received from server.");const s=t.error?new Error("Server returned an error on close: "+t.error):void 0;!0===t.allowReconnect?this.connection.stop(s):this.It=this._t(s);break}case x.Ack:this.Pt&&this.Pt.N(t);break;case x.Sequence:this.Pt&&this.Pt.F(t);break;default:this.u.log(e.Warning,`Invalid message type: ${t.type}.`)}}this.St()}jt(t){let s,i;try{[i,s]=this.tt.parseHandshakeResponse(t)}catch(t){const s="Error parsing handshake response: "+t;this.u.log(e.Error,s);const i=new Error(s);throw this.Et(i),i}if(s.error){const t="Server returned handshake error: "+s.error;this.u.log(e.Error,t);const i=new Error(t);throw this.Et(i),i}return this.u.log(e.Debug,"Server handshake complete."),this.bt(),i}kt(){this.connection.features.inherentKeepAlive||(this.K=(new Date).getTime()+this.keepAliveIntervalInMilliseconds,this.Tt())}St(){if(!this.connection.features||!this.connection.features.inherentKeepAlive){this.Ot=setTimeout((()=>this.serverTimeout()),this.serverTimeoutInMilliseconds);let t=this.K-(new Date).getTime();if(t<0)return void(this.ut===A.Connected&&this.Ft());void 0===this.Bt&&(t<0&&(t=0),this.Bt=setTimeout((async()=>{this.ut===A.Connected&&await this.Ft()}),t))}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async Wt(t){const s=t.target.toLowerCase(),i=this.nt[s];if(!i)return this.u.log(e.Warning,`No client method with the name '${s}' found.`),void(t.invocationId&&(this.u.log(e.Warning,`No result given for '${s}' method and invocation ID '${t.invocationId}'.`),await this.xt(this.Xt(t.invocationId,"Client didn't provide a result.",null))));const n=i.slice(),r=!!t.invocationId;let o,h,c;for(const i of n)try{const n=o;o=await i.apply(this,t.arguments),r&&o&&n&&(this.u.log(e.Error,`Multiple results provided for '${s}'. Sending error to server.`),c=this.Xt(t.invocationId,"Client provided multiple results.",null)),h=void 0}catch(t){h=t,this.u.log(e.Error,`A callback for the method '${s}' threw error '${t}'.`)}c?await this.xt(c):r?(h?c=this.Xt(t.invocationId,`${h}`,null):void 0!==o?c=this.Xt(t.invocationId,null,o):(this.u.log(e.Warning,`No result given for '${s}' method and invocation ID '${t.invocationId}'.`),c=this.Xt(t.invocationId,"Client didn't provide a result.",null)),await this.xt(c)):o&&this.u.log(e.Error,`Result given for '${s}' method but server is not expecting a result.`)}st(t){this.u.log(e.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this.ut}.`),this.vt=this.vt||t||new r("The underlying connection was closed before the hub handshake could complete."),this.bt&&this.bt(),this.Jt(t||new Error("Invocation canceled due to the underlying connection being closed.")),this.Ct(),this.Tt(),this.ut===A.Disconnecting?this.Dt(t):this.ut===A.Connected&&this.Z?this.zt(t):this.ut===A.Connected&&this.Dt(t)}Dt(t){if(this.dt){this.ut=A.Disconnected,this.dt=!1,this.Pt&&(this.Pt.X(null!=t?t:new Error("Connection closed.")),this.Pt=void 0),g.isBrowser&&window.document.removeEventListener("freeze",this.G);try{this.rt.forEach((e=>e.apply(this,[t])))}catch(s){this.u.log(e.Error,`An onclose callback called with error '${t}' threw error '${s}'.`)}}}async zt(t){const s=Date.now();let i=0,n=void 0!==t?t:new Error("Attempting to reconnect due to a unknown error."),r=this.Vt(i,0,n);if(null===r)return this.u.log(e.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),void this.Dt(t);if(this.ut=A.Reconnecting,t?this.u.log(e.Information,`Connection reconnecting because of error '${t}'.`):this.u.log(e.Information,"Connection reconnecting."),0!==this.ot.length){try{this.ot.forEach((e=>e.apply(this,[t])))}catch(s){this.u.log(e.Error,`An onreconnecting callback called with error '${t}' threw error '${s}'.`)}if(this.ut!==A.Reconnecting)return void this.u.log(e.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.")}for(;null!==r;){if(this.u.log(e.Information,`Reconnect attempt number ${i+1} will start in ${r} ms.`),await new Promise((t=>{this.Ht=setTimeout(t,r)})),this.Ht=void 0,this.ut!==A.Reconnecting)return void this.u.log(e.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");try{if(await this.yt(),this.ut=A.Connected,this.u.log(e.Information,"HubConnection reconnected successfully."),0!==this.ht.length)try{this.ht.forEach((t=>t.apply(this,[this.connection.connectionId])))}catch(t){this.u.log(e.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${t}'.`)}return}catch(t){if(this.u.log(e.Information,`Reconnect attempt failed because of error '${t}'.`),this.ut!==A.Reconnecting)return this.u.log(e.Debug,`Connection moved to the '${this.ut}' from the reconnecting state during reconnect attempt. Done reconnecting.`),void(this.ut===A.Disconnecting&&this.Dt());i++,n=t instanceof Error?t:new Error(t.toString()),r=this.Vt(i,Date.now()-s,n)}}this.u.log(e.Information,`Reconnect retries have been exhausted after ${Date.now()-s} ms and ${i} failed attempts. Connection disconnecting.`),this.Dt()}Vt(t,s,i){try{return this.Z.nextRetryDelayInMilliseconds({elapsedMilliseconds:s,previousRetryCount:t,retryReason:i})}catch(i){return this.u.log(e.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${s}) threw error '${i}'.`),null}}Jt(t){const s=this.it;this.it={},Object.keys(s).forEach((i=>{const n=s[i];try{n(null,t)}catch(s){this.u.log(e.Error,`Stream 'error' callback called with '${t}' threw error: ${P(s)}`)}}))}Tt(){this.Bt&&(clearTimeout(this.Bt),this.Bt=void 0)}Ct(){this.Ot&&clearTimeout(this.Ot)}Mt(t,e,s,i){if(s)return 0!==i.length?{target:t,arguments:e,streamIds:i,type:x.Invocation}:{target:t,arguments:e,type:x.Invocation};{const s=this.ct;return this.ct++,0!==i.length?{target:t,arguments:e,invocationId:s.toString(),streamIds:i,type:x.Invocation}:{target:t,arguments:e,invocationId:s.toString(),type:x.Invocation}}}qt(t,e){if(0!==t.length){e||(e=Promise.resolve());for(const s in t)t[s].subscribe({complete:()=>{e=e.then((()=>this.xt(this.Xt(s))))},error:t=>{let i;i=t instanceof Error?t.message:t&&t.toString?t.toString():"Unknown error",e=e.then((()=>this.xt(this.Xt(s,i))))},next:t=>{e=e.then((()=>this.xt(this.Kt(s,t))))}})}}Ut(t){const e=[],s=[];for(let i=0;i0)&&(e=!1,this.te=await this.Zt()),this.ee(t);const s=await this.Yt.send(t);return e&&401===s.statusCode&&this.Zt?(this.te=await this.Zt(),this.ee(t),await this.Yt.send(t)):s}ee(t){t.headers||(t.headers={}),this.te?t.headers[W.Authorization]=`Bearer ${this.te}`:this.Zt&&t.headers[W.Authorization]&&delete t.headers[W.Authorization]}getCookieString(t){return this.Yt.getCookieString(t)}}var F,B;!function(t){t[t.None=0]="None",t[t.WebSockets=1]="WebSockets",t[t.ServerSentEvents=2]="ServerSentEvents",t[t.LongPolling=4]="LongPolling"}(F||(F={})),function(t){t[t.Text=1]="Text",t[t.Binary=2]="Binary"}(B||(B={}));class X{constructor(){this.se=!1,this.onabort=null}abort(){this.se||(this.se=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this.se}}class J{get pollAborted(){return this.ie.aborted}constructor(t,e,s){this.$=t,this.u=e,this.ie=new X,this.ne=s,this.re=!1,this.onreceive=null,this.onclose=null}async connect(t,s){if(w.isRequired(t,"url"),w.isRequired(s,"transferFormat"),w.isIn(s,B,"transferFormat"),this.oe=t,this.u.log(e.Trace,"(LongPolling transport) Connecting."),s===B.Binary&&"undefined"!=typeof XMLHttpRequest&&"string"!=typeof(new XMLHttpRequest).responseType)throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[n,r]=$(),o={[n]:r,...this.ne.headers},h={abortSignal:this.ie.signal,headers:o,timeout:1e5,withCredentials:this.ne.withCredentials};s===B.Binary&&(h.responseType="arraybuffer");const c=`${t}&_=${Date.now()}`;this.u.log(e.Trace,`(LongPolling transport) polling: ${c}.`);const a=await this.$.get(c,h);200!==a.statusCode?(this.u.log(e.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this.he=new i(a.statusText||"",a.statusCode),this.re=!1):this.re=!0,this.ce=this.ae(this.oe,h)}async ae(t,s){try{for(;this.re;)try{const n=`${t}&_=${Date.now()}`;this.u.log(e.Trace,`(LongPolling transport) polling: ${n}.`);const r=await this.$.get(n,s);204===r.statusCode?(this.u.log(e.Information,"(LongPolling transport) Poll terminated by server."),this.re=!1):200!==r.statusCode?(this.u.log(e.Error,`(LongPolling transport) Unexpected response code: ${r.statusCode}.`),this.he=new i(r.statusText||"",r.statusCode),this.re=!1):r.content?(this.u.log(e.Trace,`(LongPolling transport) data received. ${m(r.content,this.ne.logMessageContent)}.`),this.onreceive&&this.onreceive(r.content)):this.u.log(e.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(t){this.re?t instanceof n?this.u.log(e.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this.he=t,this.re=!1):this.u.log(e.Trace,`(LongPolling transport) Poll errored after shutdown: ${t.message}`)}}finally{this.u.log(e.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this.le()}}async send(t){return this.re?v(this.u,"LongPolling",this.$,this.oe,t,this.ne):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this.u.log(e.Trace,"(LongPolling transport) Stopping polling."),this.re=!1,this.ie.abort();try{await this.ce,this.u.log(e.Trace,`(LongPolling transport) sending DELETE request to ${this.oe}.`);const t={},[s,n]=$();t[s]=n;const r={headers:{...t,...this.ne.headers},timeout:this.ne.timeout,withCredentials:this.ne.withCredentials};let o;try{await this.$.delete(this.oe,r)}catch(t){o=t}o?o instanceof i&&(404===o.statusCode?this.u.log(e.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this.u.log(e.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this.u.log(e.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this.u.log(e.Trace,"(LongPolling transport) Stop finished."),this.le()}}le(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this.he&&(t+=" Error: "+this.he),this.u.log(e.Trace,t),this.onclose(this.he)}}}class z{constructor(t,e,s,i){this.$=t,this.te=e,this.u=s,this.ne=i,this.onreceive=null,this.onclose=null}async connect(t,s){return w.isRequired(t,"url"),w.isRequired(s,"transferFormat"),w.isIn(s,B,"transferFormat"),this.u.log(e.Trace,"(SSE transport) Connecting."),this.oe=t,this.te&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this.te)}`),new Promise(((i,n)=>{let r,o=!1;if(s===B.Text){if(g.isBrowser||g.isWebWorker)r=new this.ne.EventSource(t,{withCredentials:this.ne.withCredentials});else{const e=this.$.getCookieString(t),s={};s.Cookie=e;const[i,n]=$();s[i]=n,r=new this.ne.EventSource(t,{withCredentials:this.ne.withCredentials,headers:{...s,...this.ne.headers}})}try{r.onmessage=t=>{if(this.onreceive)try{this.u.log(e.Trace,`(SSE transport) data received. ${m(t.data,this.ne.logMessageContent)}.`),this.onreceive(t.data)}catch(t){return void this.ue(t)}},r.onerror=t=>{o?this.ue():n(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},r.onopen=()=>{this.u.log(e.Information,`SSE connected to ${this.oe}`),this.de=r,o=!0,i()}}catch(t){return void n(t)}}else n(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}))}async send(t){return this.de?v(this.u,"SSE",this.$,this.oe,t,this.ne):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this.ue(),Promise.resolve()}ue(t){this.de&&(this.de.close(),this.de=void 0,this.onclose&&this.onclose(t))}}class V{constructor(t,e,s,i,n,r){this.u=s,this.Zt=e,this.fe=i,this.pe=n,this.$=t,this.onreceive=null,this.onclose=null,this.we=r}async connect(t,s){let i;return w.isRequired(t,"url"),w.isRequired(s,"transferFormat"),w.isIn(s,B,"transferFormat"),this.u.log(e.Trace,"(WebSockets transport) Connecting."),this.Zt&&(i=await this.Zt()),new Promise(((n,r)=>{let o;t=t.replace(/^http/,"ws");const h=this.$.getCookieString(t);let c=!1;if(g.isNode||g.isReactNative){const e={},[s,n]=$();e[s]=n,i&&(e[W.Authorization]=`Bearer ${i}`),h&&(e[W.Cookie]=h),o=new this.pe(t,void 0,{headers:{...e,...this.we}})}else i&&(t+=(t.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(i)}`);o||(o=new this.pe(t)),s===B.Binary&&(o.binaryType="arraybuffer"),o.onopen=s=>{this.u.log(e.Information,`WebSocket connected to ${t}.`),this.ge=o,c=!0,n()},o.onerror=t=>{let s=null;s="undefined"!=typeof ErrorEvent&&t instanceof ErrorEvent?t.error:"There was an error with the transport",this.u.log(e.Information,`(WebSockets transport) ${s}.`)},o.onmessage=t=>{if(this.u.log(e.Trace,`(WebSockets transport) data received. ${m(t.data,this.fe)}.`),this.onreceive)try{this.onreceive(t.data)}catch(t){return void this.ue(t)}},o.onclose=t=>{if(c)this.ue(t);else{let e=null;e="undefined"!=typeof ErrorEvent&&t instanceof ErrorEvent?t.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",r(new Error(e))}}}))}send(t){return this.ge&&this.ge.readyState===this.pe.OPEN?(this.u.log(e.Trace,`(WebSockets transport) sending data. ${m(t,this.fe)}.`),this.ge.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this.ge&&this.ue(void 0),Promise.resolve()}ue(t){this.ge&&(this.ge.onclose=()=>{},this.ge.onmessage=()=>{},this.ge.onerror=()=>{},this.ge.close(),this.ge=void 0),this.u.log(e.Trace,"(WebSockets transport) socket closed."),this.onclose&&(!this.me(t)||!1!==t.wasClean&&1e3===t.code?t instanceof Error?this.onclose(t):this.onclose():this.onclose(new Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)))}me(t){return t&&"boolean"==typeof t.wasClean&&"number"==typeof t.code}}class K{constructor(t,s={}){var i;if(this.ye=()=>{},this.features={},this.ve=1,w.isRequired(t,"url"),this.u=void 0===(i=s.logger)?new E(e.Information):null===i?f.instance:void 0!==i.log?i:new E(i),this.baseUrl=this.be(t),(s=s||{}).logMessageContent=void 0!==s.logMessageContent&&s.logMessageContent,"boolean"!=typeof s.withCredentials&&void 0!==s.withCredentials)throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");s.withCredentials=void 0===s.withCredentials||s.withCredentials,s.timeout=void 0===s.timeout?1e5:s.timeout;let n=null,r=null;if(g.isNode){const t=require;n=t("ws"),r=t("eventsource")}g.isNode||"undefined"==typeof WebSocket||s.WebSocket?g.isNode&&!s.WebSocket&&n&&(s.WebSocket=n):s.WebSocket=WebSocket,g.isNode||"undefined"==typeof EventSource||s.EventSource?g.isNode&&!s.EventSource&&void 0!==r&&(s.EventSource=r):s.EventSource=EventSource,this.$=new O(s.httpClient||new H(this.u),s.accessTokenFactory),this.ut="Disconnected",this.dt=!1,this.ne=s,this.onreceive=null,this.onclose=null}async start(t){if(t=t||B.Binary,w.isIn(t,B,"transferFormat"),this.u.log(e.Debug,`Starting connection with transfer format '${B[t]}'.`),"Disconnected"!==this.ut)return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this.ut="Connecting",this.Ee=this.yt(t),await this.Ee,"Disconnecting"===this.ut){const t="Failed to start the HttpConnection before stop() was called.";return this.u.log(e.Error,t),await this.It,Promise.reject(new r(t))}if("Connected"!==this.ut){const t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this.u.log(e.Error,t),Promise.reject(new r(t))}this.dt=!0}send(t){return"Connected"!==this.ut?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this.$e||(this.$e=new G(this.transport)),this.$e.send(t))}async stop(t){return"Disconnected"===this.ut?(this.u.log(e.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this.ut?(this.u.log(e.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this.It):(this.ut="Disconnecting",this.It=new Promise((t=>{this.ye=t})),await this._t(t),void await this.It)}async _t(t){this.Ce=t;try{await this.Ee}catch(t){}if(this.transport){try{await this.transport.stop()}catch(t){this.u.log(e.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this.Se()}this.transport=void 0}else this.u.log(e.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async yt(t){let s=this.baseUrl;this.Zt=this.ne.accessTokenFactory,this.$.Zt=this.Zt;try{if(this.ne.skipNegotiation){if(this.ne.transport!==F.WebSockets)throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");this.transport=this.ke(F.WebSockets),await this.Pe(s,t)}else{let e=null,i=0;do{if(e=await this.Te(s),"Disconnecting"===this.ut||"Disconnected"===this.ut)throw new r("The connection was stopped during negotiation.");if(e.error)throw new Error(e.error);if(e.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(e.url&&(s=e.url),e.accessToken){const t=e.accessToken;this.Zt=()=>t,this.$.te=t,this.$.Zt=void 0}i++}while(e.url&&i<100);if(100===i&&e.url)throw new Error("Negotiate redirection limit exceeded.");await this.Ie(s,this.ne.transport,e,t)}this.transport instanceof J&&(this.features.inherentKeepAlive=!0),"Connecting"===this.ut&&(this.u.log(e.Debug,"The HttpConnection connected successfully."),this.ut="Connected")}catch(t){return this.u.log(e.Error,"Failed to start the connection: "+t),this.ut="Disconnected",this.transport=void 0,this.ye(),Promise.reject(t)}}async Te(t){const s={},[n,r]=$();s[n]=r;const o=this._e(t);this.u.log(e.Debug,`Sending negotiation request: ${o}.`);try{const t=await this.$.post(o,{content:"",headers:{...s,...this.ne.headers},timeout:this.ne.timeout,withCredentials:this.ne.withCredentials});if(200!==t.statusCode)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${t.statusCode}'`));const e=JSON.parse(t.content);return(!e.negotiateVersion||e.negotiateVersion<1)&&(e.connectionToken=e.connectionId),e.useStatefulReconnect&&!0!==this.ne.He?Promise.reject(new a("Client didn't negotiate Stateful Reconnect but the server did.")):e}catch(t){let s="Failed to complete negotiation with the server: "+t;return t instanceof i&&404===t.statusCode&&(s+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this.u.log(e.Error,s),Promise.reject(new a(s))}}De(t,e){return e?t+(-1===t.indexOf("?")?"?":"&")+`id=${e}`:t}async Ie(t,s,i,n){let o=this.De(t,i.connectionToken);if(this.Re(s))return this.u.log(e.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=s,await this.Pe(o,n),void(this.connectionId=i.connectionId);const h=[],a=i.availableTransports||[];let u=i;for(const i of a){const a=this.xe(i,s,n,!0===(null==u?void 0:u.useStatefulReconnect));if(a instanceof Error)h.push(`${i.transport} failed:`),h.push(a);else if(this.Re(a)){if(this.transport=a,!u){try{u=await this.Te(t)}catch(t){return Promise.reject(t)}o=this.De(t,u.connectionToken)}try{return await this.Pe(o,n),void(this.connectionId=u.connectionId)}catch(t){if(this.u.log(e.Error,`Failed to start the transport '${i.transport}': ${t}`),u=void 0,h.push(new c(`${i.transport} failed: ${t}`,F[i.transport])),"Connecting"!==this.ut){const t="Failed to select transport before stop() was called.";return this.u.log(e.Debug,t),Promise.reject(new r(t))}}}}return h.length>0?Promise.reject(new l(`Unable to connect to the server with any of the available transports. ${h.join(" ")}`,h)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}ke(t){switch(t){case F.WebSockets:if(!this.ne.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new V(this.$,this.Zt,this.u,this.ne.logMessageContent,this.ne.WebSocket,this.ne.headers||{});case F.ServerSentEvents:if(!this.ne.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new z(this.$,this.$.te,this.u,this.ne);case F.LongPolling:return new J(this.$,this.u,this.ne);default:throw new Error(`Unknown transport: ${t}.`)}}Pe(t,e){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async s=>{let i=!1;if(this.features.reconnect){try{this.features.disconnected(),await this.transport.connect(t,e),await this.features.resend()}catch{i=!0}i&&this.Se(s)}else this.Se(s)}:this.transport.onclose=t=>this.Se(t),this.transport.connect(t,e)}xe(t,s,i,n){const r=F[t.transport];if(null==r)return this.u.log(e.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(!function(t,e){return!t||!!(e&t)}(s,r))return this.u.log(e.Debug,`Skipping transport '${F[r]}' because it was disabled by the client.`),new h(`'${F[r]}' is disabled by the client.`,r);if(!(t.transferFormats.map((t=>B[t])).indexOf(i)>=0))return this.u.log(e.Debug,`Skipping transport '${F[r]}' because it does not support the requested transfer format '${B[i]}'.`),new Error(`'${F[r]}' does not support ${B[i]}.`);if(r===F.WebSockets&&!this.ne.WebSocket||r===F.ServerSentEvents&&!this.ne.EventSource)return this.u.log(e.Debug,`Skipping transport '${F[r]}' because it is not supported in your environment.'`),new o(`'${F[r]}' is not supported in your environment.`,r);this.u.log(e.Debug,`Selecting transport '${F[r]}'.`);try{return this.features.reconnect=r===F.WebSockets?n:void 0,this.ke(r)}catch(t){return t}}Re(t){return t&&"object"==typeof t&&"connect"in t}Se(t){if(this.u.log(e.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this.ut}.`),this.transport=void 0,t=this.Ce||t,this.Ce=void 0,"Disconnected"!==this.ut){if("Connecting"===this.ut)throw this.u.log(e.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if("Disconnecting"===this.ut&&this.ye(),t?this.u.log(e.Error,`Connection disconnected with error '${t}'.`):this.u.log(e.Information,"Connection disconnected."),this.$e&&(this.$e.stop().catch((t=>{this.u.log(e.Error,`TransportSendQueue.stop() threw error '${t}'.`)})),this.$e=void 0),this.connectionId=void 0,this.ut="Disconnected",this.dt){this.dt=!1;try{this.onclose&&this.onclose(t)}catch(s){this.u.log(e.Error,`HttpConnection.onclose(${t}) threw error '${s}'.`)}}}else this.u.log(e.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`)}be(t){if(0===t.lastIndexOf("https://",0)||0===t.lastIndexOf("http://",0))return t;if(!g.isBrowser)throw new Error(`Cannot resolve '${t}'.`);const s=window.document.createElement("a");return s.href=t,this.u.log(e.Information,`Normalizing '${t}' to '${s.href}'.`),s.href}_e(t){const e=new URL(t);e.pathname.endsWith("/")?e.pathname+="negotiate":e.pathname+="/negotiate";const s=new URLSearchParams(e.searchParams);return s.has("negotiateVersion")||s.append("negotiateVersion",this.ve.toString()),s.has("useStatefulReconnect")?"true"===s.get("useStatefulReconnect")&&(this.ne.He=!0):!0===this.ne.He&&s.append("useStatefulReconnect","true"),e.search=s.toString(),e.toString()}}class G{constructor(t){this.Ae=t,this.Ue=[],this.Le=!0,this.Ne=new Q,this.qe=new Q,this.Me=this.je()}send(t){return this.We(t),this.qe||(this.qe=new Q),this.qe.promise}stop(){return this.Le=!1,this.Ne.resolve(),this.Me}We(t){if(this.Ue.length&&typeof this.Ue[0]!=typeof t)throw new Error(`Expected data to be of type ${typeof this.Ue} but was of type ${typeof t}`);this.Ue.push(t),this.Ne.resolve()}async je(){for(;;){if(await this.Ne.promise,!this.Le){this.qe&&this.qe.reject("Connection stopped.");break}this.Ne=new Q;const t=this.qe;this.qe=void 0;const e="string"==typeof this.Ue[0]?this.Ue.join(""):G.Oe(this.Ue);this.Ue.length=0;try{await this.Ae.send(e),t.resolve()}catch(e){t.reject(e)}}}static Oe(t){const e=t.map((t=>t.byteLength)).reduce(((t,e)=>t+e)),s=new Uint8Array(e);let i=0;for(const e of t)s.set(new Uint8Array(e),i),i+=e.byteLength;return s.buffer}}class Q{constructor(){this.promise=new Promise(((t,e)=>[this.j,this.Fe]=[t,e]))}resolve(){this.j()}reject(t){this.Fe(t)}}class Y{constructor(){this.name="json",this.version=2,this.transferFormat=B.Text}parseMessages(t,s){if("string"!=typeof t)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!t)return[];null===s&&(s=f.instance);const i=D.parse(t),n=[];for(const t of i){const i=JSON.parse(t);if("number"!=typeof i.type)throw new Error("Invalid payload.");switch(i.type){case x.Invocation:this.U(i);break;case x.StreamItem:this.Be(i);break;case x.Completion:this.Xe(i);break;case x.Ping:case x.Close:break;case x.Ack:this.Je(i);break;case x.Sequence:this.ze(i);break;default:s.log(e.Information,"Unknown message type '"+i.type+"' ignored.");continue}n.push(i)}return n}writeMessage(t){return D.write(JSON.stringify(t))}U(t){this.Ve(t.target,"Invalid payload for Invocation message."),void 0!==t.invocationId&&this.Ve(t.invocationId,"Invalid payload for Invocation message.")}Be(t){if(this.Ve(t.invocationId,"Invalid payload for StreamItem message."),void 0===t.item)throw new Error("Invalid payload for StreamItem message.")}Xe(t){if(t.result&&t.error)throw new Error("Invalid payload for Completion message.");!t.result&&t.error&&this.Ve(t.error,"Invalid payload for Completion message."),this.Ve(t.invocationId,"Invalid payload for Completion message.")}Je(t){if("number"!=typeof t.sequenceId)throw new Error("Invalid SequenceId for Ack message.")}ze(t){if("number"!=typeof t.sequenceId)throw new Error("Invalid SequenceId for Sequence message.")}Ve(t,e){if("string"!=typeof t||""===t)throw new Error(e)}}const Z={trace:e.Trace,debug:e.Debug,info:e.Information,information:e.Information,warn:e.Warning,warning:e.Warning,error:e.Error,critical:e.Critical,none:e.None};class tt{configureLogging(t){if(w.isRequired(t,"logging"),void 0!==t.log)this.logger=t;else if("string"==typeof t){const e=function(t){const e=Z[t.toLowerCase()];if(void 0!==e)return e;throw new Error(`Unknown log level: ${t}`)}(t);this.logger=new E(e)}else this.logger=new E(t);return this}withUrl(t,e){return w.isRequired(t,"url"),w.isNotEmpty(t,"url"),this.url=t,this.httpConnectionOptions="object"==typeof e?{...this.httpConnectionOptions,...e}:{...this.httpConnectionOptions,transport:e},this}withHubProtocol(t){return w.isRequired(t,"protocol"),this.protocol=t,this}withAutomaticReconnect(t){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return t?Array.isArray(t)?this.reconnectPolicy=new j(t):this.reconnectPolicy=t:this.reconnectPolicy=new j,this}withServerTimeout(t){return w.isRequired(t,"milliseconds"),this.Ke=t,this}withKeepAliveInterval(t){return w.isRequired(t,"milliseconds"),this.Ge=t,this}withStatefulReconnect(t){return void 0===this.httpConnectionOptions&&(this.httpConnectionOptions={}),this.httpConnectionOptions.He=!0,this.Y=null==t?void 0:t.bufferSize,this}build(){const t=this.httpConnectionOptions||{};if(void 0===t.logger&&(t.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const e=new K(this.url,t);return q.create(e,this.logger||f.instance,this.protocol||new Y,this.reconnectPolicy,this.Ke,this.Ge,this.Y)}}return Uint8Array.prototype.indexOf||Object.defineProperty(Uint8Array.prototype,"indexOf",{value:Array.prototype.indexOf,writable:!0}),Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:function(t,e){return new Uint8Array(Array.prototype.slice.call(this,t,e))},writable:!0}),Uint8Array.prototype.forEach||Object.defineProperty(Uint8Array.prototype,"forEach",{value:Array.prototype.forEach,writable:!0}),s})(),"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.signalR=e():t.signalR=e(); //# sourceMappingURL=signalr.min.js.map $.extend($t, { t1: 'Eingabe erforderlich', t2: 'Bitte überprüfen Sie Ihre Eingaben im Formular.', 'b0': 'Erstellt', 'b1': 'Zuletzt geändert', 'b2': 'von', 't12': 'Der Server hat einen Fehler zurückgegeben. Bitte versuchen Sie es erneut.', 't17': 'Eine Email mit einem Aktivierungs-Link wurde an deine Adresse versandt.', 't18': 'Ein Account mit deinem Namen existiert bereits. Dennoch erstellen?', 't19': 'Einträge sind entweder unngültig oder zu kurz.', 't20': 'Der Server hat einen Fehler gemeldet. Bitte versuch es erneut.', 't21': 'Der Zugang wurde nicht gefunden.', 't30a': 'Als erledigt markieren.', 't30b': 'Als unerledigt markieren.', 't55': 'Ein Email mit einem Aktivierungs-Link wurde an Ihre Adresse versandt.', 't56': 'Ein Zugang für diesen Namen besteht bereits. Trotzdem erstellen?', 't57': 'Ein bestehender Zugang wurde für diese Serie registriert.', 't60': 'Bitte geben Sie Email-Adresse an, die Sie hier hinterlegt haben.', 't61': 'Ihr Passwort wurde erfolgreich versandt.', 't62': 'Die angegebene Email-Adresse stimmt nicht mit der hier hinterlegten überein.', ov: 'Persönliche Übersicht', }); 'use strict'; var $v = { }; /*! loadCSS. [c]2020 Filament Group, Inc. MIT License */ (function(w){ "use strict"; /* exported loadCSS */ var loadCSS = function( href, before, media, attributes ){ // Arguments explained: // `href` [REQUIRED] is the URL for your CSS file. // `before` [OPTIONAL] is the element the script should use as a reference for injecting our stylesheet before // By default, loadCSS attempts to inject the link after the last stylesheet or script in the DOM. However, you might desire a more specific location in your document. // `media` [OPTIONAL] is the media type or query of the stylesheet. By default it will be 'all' // `attributes` [OPTIONAL] is the Object of attribute name/attribute value pairs to set on the stylesheet's DOM Element. var doc = w.document; var ss = doc.createElement( "link" ); var ref; if( before ){ ref = before; } else { var refs = ( doc.body || doc.getElementsByTagName( "head" )[ 0 ] ).childNodes; ref = refs[ refs.length - 1]; } var sheets = doc.styleSheets; // Set any of the provided attributes to the stylesheet DOM Element. if( attributes ){ for( var attributeName in attributes ){ if( attributes.hasOwnProperty( attributeName ) ){ ss.setAttribute( attributeName, attributes[attributeName] ); } } } ss.rel = "stylesheet"; ss.href = href; // temporarily set media to something inapplicable to ensure it'll fetch without blocking render ss.media = "only x"; // wait until body is defined before injecting link. This ensures a non-blocking load in IE11. function ready( cb ){ if( doc.body ){ return cb(); } setTimeout(function(){ ready( cb ); }); } // Inject link // Note: the ternary preserves the existing behavior of "before" argument, but we could choose to change the argument to "after" in a later release and standardize on ref.nextSibling for all refs // Note: `insertBefore` is used instead of `appendChild`, for safety re: http://www.paulirish.com/2011/surefire-dom-element-insertion/ ready( function(){ ref.parentNode.insertBefore( ss, ( before ? ref : ref.nextSibling ) ); }); // A method (exposed on return object for external use) that mimics onload by polling document.styleSheets until it includes the new sheet. var onloadcssdefined = function( cb ){ var resolvedHref = ss.href; var i = sheets.length; while( i-- ){ if( sheets[ i ].href === resolvedHref ){ return cb(); } } setTimeout(function() { onloadcssdefined( cb ); }); }; function loadCB(){ if( ss.addEventListener ){ ss.removeEventListener( "load", loadCB ); } ss.media = media || "all"; } // once loaded, set link's media back to `all` so that the stylesheet applies once it loads if( ss.addEventListener ){ ss.addEventListener( "load", loadCB); } ss.onloadcssdefined = onloadcssdefined; onloadcssdefined( loadCB ); return ss; }; // commonjs if( typeof exports !== "undefined" ){ exports.loadCSS = loadCSS; } else { w.loadCSS = loadCSS; } }( typeof global !== "undefined" ? global : this )); /*! onloadCSS. (onload callback for loadCSS) [c]2017 Filament Group, Inc. MIT License */ /* global navigator */ /* exported onloadCSS */ function onloadCSS(ss, options ) { options = options || {}; let f = function (si) { return new Promise((resolve, reject) => { let called, success = false; function newcbs() { if (!called) { called = true; resolve(true); } } function newcbe() { if (!called && callback) { called = true; resolve(false); } } if (ss.addEventListener) { si.addEventListener('load', newcb); } else if (ss.attachEvent) { si.attachEvent('onload', newcb); } // This code is for browsers that don’t support onload // No support for onload (it'll bind but never fire): // * Android 4.3 (Samsung Galaxy S4, Browserstack) // * Android 4.2 Browser (Samsung Galaxy SIII Mini GT-I8200L) // * Android 2.3 (Pantech Burst P9070) // Weak inference targets Android < 4.4 if ('isApplicationInstalled' in navigator && 'onloadcssdefined' in ss) { si.onloadcssdefined(newcb); } }); }; let fin = async function (success) { if (success === true && typeof options.success === 'function') { options.success(); } else if (success === true && typeof options.success === 'object' && options.success instanceof Promise) { await options.success(); } options.complete() } if (Array.isArray(ss)) { let total = ss.length; Promise.all(ss.map(f)).then(function (resolveValues) { var ok = resolveValues.reduce((sum, x) => sum + (x === true ? 1 : 0)); fin(total === ok); }); } else { f(ss); } } const isIE = /MSIE\/|Trident/ig.test(window.navigator.userAgent) || typeof window.document.documentMode !== 'undefined'; const isfileapi = (window.File && window.FileReader && window.FileList && window.Blob) ? true : false; var $ocms = { auth: {}, no: function (e) { e.stopPropagation(); }, vmin: function (f) { var w = $(window).width * (f || 1), h = $(window).height * (f || 1); return w < h ? w : h; }, rpx: function (rem) { return rem * parseFloat(getComputedStyle(document.documentElement).fontSize); }, pattern: { date_ger: '^(0?[1-9]|[12][0-9]|3[01])[\\.\\-](0?[1-9]|1[012])[\\.\\-]\\d{4}$', date_us: '^(0?[1-9]|1[012])[\\\\](0?[1-9]|[12][0-9]|3[01])[\\\\]\\d{4}$', date_serial: '\\d{4}[\\-]^(0?[1-9]|1[012])[\\-](0?[1-9]|[12][0-9]|3[01])$' }, rdm: function (ln) { var c = typeof ln === 'number' ? ln : (typeof ln === 'string' ? parseInt(ln) : 7); if (isNaN(c) === true || typeof c === 'undefined') { c = 7; } return Math.random().toString(36).substring(c); }, login: {}, t: { dn: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'], mn: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], ma: ['Jan', 'Feb', 'Mrz', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'] }, failure: function (jqXHR) { alert($t.f1 + '\n' + (jqXHR.internalText || '')); }, baseurl: '/do', url: (c) => ($ocms.baseurl + '/' + (c || '')).replace(/\/\//, '/'), cexi: null }; function deepCopy (inObject) { var outObject, value, key if (typeof inObject !== "object" || inObject === null) { return inObject // Return the value if inObject is not an object } // Create an array or object to hold the values outObject = Array.isArray(inObject) ? [] : {}; for (key in inObject) { value = inObject[key]; // Recursively (deep) copy for nested objects, including arrays outObject[key] = deepCopy(value); } return outObject; }; function fields_definition(p1, label_pl, flds) { this.label_sng = Array.isArray(p1) === true ? '' : p1 ||''; this.label_pl = Array.isArray(p1) === true ? '' : label_pl || ''; this.fields = Array.isArray(p1) === true ? p1 : (flds || []); this.itm = function (name) { for (var fi = 0; fi < this.fields.length; fi++) { if (this.fields[fi].name === name) { return this.fields[fi]; } } return null; } this.lbl = function (name) { var ld = {}, n = typeof name === 'string'; for (var fi = 0; fi < this.fields.length; fi++) { if (n ===true) { if (this.fields[fi].name === name) { return this.fields[fi]; } } else { ld[this.fields[fi].name] = this.fields[fi].label; } } return (n === true ? null : ld); } this.contains = function (name) { for (var fi = 0; fi < this.fields.length; fi++) { if (this.fields[fi].name === name) { return true; } } return false; } this.rem = function (name) { var r = false, f = function (nme) { for (var fi = 0; fi < this.fields.length; fi++) { if (this.fields[fi].name === nme) { this.fields.splice(fi, 1); r = true; break; } } } if (typeof (name) === 'string') { f.call(this, name); } else if (Array.isArray(name) === true) { for (var ai = 0; ai < name.length; ai++) { f.call(this, name[ai]); } } return r; } this.replace = function (name, newfield) { for (var fi = 0; fi < this.fields.length; fi++) { if (this.fields[fi].name === name) { this.fields.splice(fi, 1, newfield); return newfield; } } return null; } this.set = function (name, value, prop) { prop = prop || 'value'; for (var fi = 0; fi < this.fields.length; fi++) { /* loop through array */ if (this.fields[fi].name === name) { this.fields[fi][prop] = value; return this.fields[fi]; /* return if found = break loop */ } } return null; } this.sets = function (name, obj) { if (typeof obj === 'object' && Object.keys(obj).length > 0) { for (var fi = 0; fi < this.fields.length; fi++) { /* loop through array */ if (this.fields[fi].name === name) { $.extend(this.fields[fi], obj); return this.fields[fi]; /* return if found = break loop */ } } } return null; } this.applyValues = function (vals) { var t = this; $.each(vals || {}, function (ri, rx) { t.set(ri, rx); }); return t; } this.clone = function (names) { let c = []; if (Array.isArray(names || '')) { let value, key; for (key in (this.fields || [])) { value = this.fields[key]; if ((value.name ||'') !== '' && names.includes(value.name) === true) { // Recursively (deep) copy for nested objects, including arrays c.push(deepCopy(value)); } } } else { c = deepCopy(this.fields || []); } return new fields_definition(this.label_sng || '', this.label_pl || '', c); } } function rpx(rem) { return rem * parseFloat(getComputedStyle(document.documentElement).fontSize); } function vw(f) { return $(window).width() * (f || 1); } function vh(f) { return $(window).height() * (f || 1); } function hh() { return $('header:first').height() || 0; } function ne(inp, alt) { return (inp || '') === '' ? (alt || '') : inp; } function pad(i, n) { return (i || '').toString().padStart(n, '0').substr(-1 * n); } function twoDigitYear(y) { var n = parseInt(y, 10); return n + (n < 70 ? 2000 : 1900); } /* Parses dot-separated German short dates (dd.MM.yyyy / dd.MM.yy, optionally with a time part). Returns null if the string does not match, so callers can fall back to other parsing. */ function parseGermanDate(si) { var g = si.match(/^(\d{1,2})\.(\d{1,2})\.(\d{2}|\d{4})(?:[\sT](\d{1,2}):(\d{2})(?::(\d{2}))?)?$/); if (g === null) { return null; } var yr = g[3].length === 2 ? twoDigitYear(g[3]) : parseInt(g[3], 10); return new Date(yr, parseInt(g[2], 10) - 1, parseInt(g[1], 10), parseInt(g[4] || '0', 10), parseInt(g[5] || '0', 10), parseInt(g[6] || '0', 10)); } function parseISO(s) { let si = s || ''; if (si === '') { return null }; if (/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/.test(si) === true) { return new Date(si); } else { var gd = parseGermanDate(si); if (gd !== null) { return gd; } var b = si.split(/\D/); return new Date(b[0], b[1] - 1, b[2], b[3] || 0, b[4] || 0, b[5] || 0); } } function parseISOLocal(s) { let si = s || ''; if (si === '') { return null }; var gd = parseGermanDate(si); if (gd !== null) { return gd; } var b = si.split(/\D/); return new Date(b[0], b[1] - 1, b[2], b[3] || 0, b[4] || 0, b[5] || 0); } function fnum(i, style) { /* { style: 'decimal/currency/percent', currency: 'USD/EUR', currencyDisplay: 'symbol/code/name', minimumIntegerDigits: 1, minimumFractionDigits: 2, maximumFractionDigits: 3, useGrouping: true } */ return new Intl.NumberFormat(($t.lng || 'de-DE'), style || {}).format(i); } function fdt(i, fmt) { if (typeof i === 'undefined') { return ''; } try { var f = fmt || 'DD.MM.YYYY HH:mm'; if (f === 'dts') { f = 'yyyy-MM-dd'; } if (f === 'iso') { if (typeof i === 'string') { i = parseISO(i); } return i.toISOString(); } else if (typeof moment === 'function') { return (typeof i !== 'undefined' && (typeof i === 'string' && i !== '')) ? moment(i).format(f) : ''; } else { if (typeof i === 'string') { i = parseISO(i); } var pd = function (i, n) { var t = ('0000' + i.toString()); return t.slice(t.length - (n || 2)); } var t = f + ''; t = t.replace(/ddd/ig, ($t.dn || $ocms.t.dn)[i.getDay()]); t = t.replace(/dd/ig, pd(i.getDate())); t = t.replace(/MMMM/g, ($t.mn || $ocms.t.mn)[i.getMonth()]); t = t.replace(/MMM/g, ($t.ma || $ocms.t.ma)[i.getMonth()]); t = t.replace(/MM/g, pd(i.getMonth() + 1));//January is 0! t = t.replace(/yyyy/ig, pd(i.getFullYear(), 4)); t = t.replace(/yy/ig, pd(i.getFullYear())); t = t.replace(/hh/ig, pd(i.getHours())); t = t.replace(/mm/g, pd(i.getMinutes())); t = t.replace(/ss/ig, pd(i.getSeconds())); return t; } } catch (e) { return ''; } } Date.prototype.isValid = function () { return !isNaN(this); }; Date.prototype.format = function (fmt) { return fdt(this,fmt); }; Date.prototype.addDays = function (days) { this.setDate(this.getDate() + days); return this; }; Date.prototype.isBetween = function (date1, date2) { return this > date1 && this < date2; }; Date.prototype.diff = function (date1) { var diffTime = Math.abs(date1 - this), diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); return diffDays; }; Date.prototype.year = function () { return this.getFullYear(); }; Date.prototype.month = function () { return this.getMonth() + 1; }; Date.prototype.date = function () { return this.getDate(); }; String.prototype.ne = function (alt) { let t = (this || '').trim(); return t === '' ? (alt || '') : t; }; /* eine = extend if not empty */ String.prototype.eine = function(pre, su) { let t = (this || '').trim(); return t === '' ? '' : ((pre || '') + t + (su || '')); }; function jine(a, sep) { return a.map((v, i) => (v || '')).filter((v, i) => v !== '').join(sep) }; function parseDt(datestring, format, newformat) { datestring = (datestring || '').substr(0, format.length); var cvalid = function (fmt) { var result, reg = /[^yMdhms0-9]/ig, valid = true; while ((result = reg.exec(fmt)) !== null) { valid = valid && fmt.substr(result.index, 1) === datestring.substr(result.index, 1); } var vr = (datestring.length === fmt.length) && valid; if (vr === true) { vfmt = fmt; } return vr; }, vfmt = format, isvalid = datestring.length > 0 && format.split(';').some(cvalid); if (isvalid === true) { var ndt = [0, 0, 0, 0, 0, 0, 0], np = 'yMdhms'; var result, reg = /(mm{1,2}|dd{1,2}|MM{1,2}|(yy){2,4}|ss{1,2}|hh{1,2})(?!\w)/g, valid = true; while ((result = reg.exec(vfmt)) !== null) { ndt[np.indexOf(result[0].substr(0, 1))] = parseInt((result[0] === 'yy' ? '20' : '') + datestring.substr(result.index, result[0].length)) - (result[0].substr(0, 1) === 'M' ? 1 : 0); } var dt = new (Function.prototype.bind.apply(Date, [null].concat(ndt)))(); return (typeof newformat === 'string') ? fdt(dt, newformat) : dt; } else { return false; } } function bool(i, alt) { return typeof i === 'boolean' ? i : (typeof alt === 'boolean' ? alt : false); } function booln(i, alt) { var r = false; if (typeof i === 'boolean') { r = i; } else if (typeof i === 'number') { r = (i === 1); } else { r = (typeof alt === 'boolean' ? alt : false); } return r; } /* set getHash method, IE9 safe */ var h = (typeof window.location.hash === 'undefined'); $ocms.getHash = h ? function () { return document.URL.substr(document.URL.indexOf('#')); } : function () { return window.location.hash; }; $ocms.initNav = function () { $('body').click(function (e) { $('#toggle-nav').removeClass('active'); }); var nbtn = $('#toggle-nav'); $('.nav_menu').click(function (e) { if (nbtn.hasClass('active') === true) { e.stopPropagation(); } }); nbtn.click(function (e) { e.stopPropagation(); $(this).toggleClass('active'); }); }; $ocms.initScroll = function () { let hd = $('header'); let initialHeaderHeight = hd.height(), sec = $('main > section'); $(window).scroll(function (e) { let scrollTop = $(window).scrollTop(), b = $('body'); b.toggleClass('unfocus', scrollTop > (vh() - initialHeaderHeight * 1.2)); b.toggleClass('btb', scrollTop > (vh() * 0.5 - initialHeaderHeight)); }); }; $ocms.cf_reset = function () { return $('#contentframe').empty(); }; (function ($) { /* @description: jQuery - scrollTo * @author: Dr. Stefan Ott * @version: 1.0 */ $.fn.scrollTo = function (key) { if ($(this).length > 0) { var ost = $(this).offset().top || 0; if (ost > 0) { $('html, body').animate({ scrollTop: ost - hh() }, 2000); } } }; $.fn.ldng = function (onoff) { var st = true; if (typeof onoff === 'boolean') { st = onoff; } else if (typeof onoff === 'number') { st = onoff > 0; } return $(this).toggleClass('loading', st); }; if (typeof $.noop !== 'function') { $.noop = function () {}; } /* @description: determines if element has the attribute * @author: Dr. Stefan Ott * @version: 1.0 */ $.fn.hasAttr = function (AttName) { var attr = $(this).attr(AttName); return (typeof attr !== 'undefined' && attr !== false); }; $.fn.parseCssPx = function (key) { try { return parseFloat($(this).css(key).replace('px', '') || 0); } catch (e) { return 0.0; } }; /* @description: returns the higher value * @author: Dr. Stefan Ott * @version: 1.0 */ $.max = function (val1, val2) { if (isNaN(val1) && isNaN(val2)) { return null; } else if (isNaN(val1) && !isNaN(val2)) { return val2; } else if (!isNaN(val2) && isNaN(val2)) { return val1; } else if (val1 >= val2) { return val1; } else { return val2; } }; /* @description: returns the lower value * @author: Dr. Stefan Ott * @version: 1.0 */ $.min = function (val1, val2) { if (isNaN(val1) && isNaN(val2)) { return null; } else if (isNaN(val1) && !isNaN(val2)) { return val2; } else if (!isNaN(val2) && isNaN(val2)) { return val1; } else if (val1 <= val2) { return val1; } else { return val2; } }; /* @description: returns the value to the limit * @author: Dr. Stefan Ott * @version: 1.0 */ $.lim = function (val, lim) { if (isNaN(val)) { return null; } else if (isNaN(lim)) { return val; } else if (lim <= val) { return lim; } else { return val; } }; $.fn.enterKey = function (fnc) { return this.each(function () { $(this).keypress(function (ev) { var keycode = (ev.keyCode ? ev.keyCode : ev.which).toString(); if (keycode === '13') { fnc.call(this, ev); } }) }) }; })(jQuery); /*_________ ajax ________________________________________________*/ $ocms.defaultTimeout = 30000; /* 30s */ /* @description: processes jqXHR from Ajax response and adds new infos (needs to be called with jqXHR as context) * @author: Dr. Stefan Ott * @version: 2.0 */ $ocms.AjaxEX = function (textStatus) { var jqXHR = this; jqXHR.responseText = jqXHR.responseText || ''; var ic = jqXHR.getResponseHeader('x-ocms-code') || ''; jqXHR.internalCode = (ic !== '' && isNaN(ic) === false) ? parseInt(ic) : -1; jqXHR.isInternal = jqXHR.internalCode > -1; jqXHR.internalText = decodeURIComponent((jqXHR.getResponseHeader('x-ocms-desc') ||'').replace(/\+/g, '%20') || ''); var t = jqXHR.internalText || textStatus; var c = jqXHR.internalCode || jqXHR.status; jqXHR.logtext = t + ' (' + c + ')'; }; /* @description: custom jquery ajax post for simplification * @author: Dr. Stefan Ott * @version: 1.0 */ $ocms.postXTS = function (options) { $ocms.postXT.call(this, $.extend(options, { sync: true })); }; /* @description: custom jquery ajax post for simplification * @author: Dr. Stefan Ott * @version: 2.0 */ $ocms.postXT = function (options) { options = options || {}; options.trycount = options.trycount || 0; if ((options.url || '') === '') { return; } options.url = (options.url.indexOf('&yy=') !== -1) ? options.url : ((options.url.indexOf('?') > -1) ? (options.url + '&yy=' + (new Date()).getTime()) : (options.url + '?yy=' + (new Date()).getTime())); var context = options.context || this; options.context = context; options.retryLimit = options.retryLimit || 0; options.timeout = options.timeout || $ocms.defaultTimeout; if (options.timeout < 100) { options.timeout = options.timeout * 1000; } options.data = options.data || {}; options.contentType = options.contentType || 'multipart/form-data; charset=UTF-8'; options.islogin = typeof options.islogin === 'boolean' ? options.islogin : false; /* this is used to prevent loop */ switch (options.contentType) { case '': case 'json': options.contentType = 'application/json; charset=utf-8'; break; case 'form': options.contentType = 'application/x-www-form-urlencoded; charset=UTF-8'; break; case 'multi': options.contentType = 'multipart/form-data'; break; case 'text': options.contentType = 'text/plain; charset=UTF-8'; break; /* default = leave as defined */ } if (options.form instanceof jQuery) { options.data = options.form.serializeObject(); options.contentType = 'form-data'; } else if (options.lzw instanceof jQuery) { options.data.lzw = $.ccLZW(options.lzw.serializeAnything(true)).join(','); } var senddata; if ((options.contentType.substr(0, 19) === 'multipart/form-data' || options.contentType.substr(0, 9) === 'form-data') && options.data instanceof FormData === false) { options.contentType = false; var fd = new FormData(); $.each(options.files || [], function (fi, file) { fd.append('upload_file', file); }); $.each(options.data || {}, function (di, dx) { fd.append(di, dx); }); options.data = fd; options.processData = false; } else if (options.data instanceof FormData) { options.contentType = false; options.processData = false; } var ajo = { type: options.method || 'post', url: options.url, data: options.data, processData: typeof options.processData !== 'boolean' ? true : options.processData, contentType: options.contentType, cache: options.cache || false, timeout: options.timeout, beforeSend: function (jqXHR) { $(options.loading).ldng(); $('body').addClass('ldng'); if (typeof options.beforesend === 'function') { options.beforesend.apply(context, [jqXHR]); } }, success: function (response, textStatus, jqXHR) { if (response === 'false' || response === 'not authorized') { if (typeof options.error === 'function') { options.error.apply(context, [jqXHR, textStatus, response]); } if (typeof $.status === 'function') { $.status(textStatus + ' - ' + response); } } else { if (typeof options.success === 'function') { options.success.apply(context, [response, textStatus, jqXHR]); } } }, error: function (jqXHR, textStatus, response) { $ocms.AjaxEX.call(jqXHR, textStatus); if (options.url.indexOf('doc.ashx') !== -1 && options.url.indexOf('ftest') === -1) { return; } if (jqXHR.status === 401 && jqXHR.internalCode === 111 && options.islogin === false && typeof $ocms.login.dlg === 'function') { $ocms.login.dlg({ ajo: options }); } else if (textStatus === 'timeout' || jqXHR.status === 302) { options.tryCount++; if (options.tryCount <= options.retryLimit) { /* try again */ $ocms.postXT(options); return; } return; } /*if (typeof $.log === 'function' && (jqXHR.internalCode + '') !== '1101') { $.log('Server error: ' + jqXHR.logtext + '', 'error', options.url); }*/ if (typeof options.error === 'function') { options.error.apply(context, [jqXHR, textStatus, response]); } else if (typeof $ocms.failure === 'function') { $ocms.failure.apply(context, [jqXHR]); } else if (typeof $.status === 'function') { $.status('Server error: ' + textStatus + ' - ' + response + ''); } }, dataType: options.datatype || 'json', complete: function (jqXHR, textStatus) { if (typeof options.complete === 'function') { options.complete.apply(context, [jqXHR, textStatus]); } $(options.loading).ldng(0); $('body').removeClass('ldng'); let tm = $('body > .timer'); if (tm.length > 0) { let cec = new Date(jqXHR.getResponseHeader('ocms_cec') || ''), cex = new Date(jqXHR.getResponseHeader('ocms_cex') || ''); if (cec.isValid() && cex.isValid()) { let d = new Date(), dd = Math.abs(cex - cec); d.setMilliseconds(d.getMilliseconds() + dd); tm.data({ 'cex': d, 'ctt': dd }); $ocms.cex_timer(); } } }, context: context, async: true }; if (typeof options.sync === 'boolean') { ajo.async = (options.sync === false); } if ((typeof options.contentType === 'boolean' ? options.contentType === false : false) === true) { ajo.contentType = false; /* needed for file uploads */ } $.ajax(ajo); }; $ocms.cex_timer = function () { if (!$ocms.cexi) { $ocms.cexi = setInterval($ocms.cex_timer, 15000); } let tm = $('body > .timer'), c = tm.data('cex'), t = tm.data('ctt'), n = new Date(); if (c instanceof Date && c.isValid() && typeof t === 'number' && t > 0 && c > n) { let p = (Math.abs(n - c) / t * 100); tm.css('width', p.toString() + '%'); if (p < 98 && (!$ocms.cex_lp || Math.abs(n - $ocms.cex_lp) > 600000 )) { $ocms.postXT({ url: $ocms.url('ping'), success: () => { $ocms.cex_lp = n; }, timeout: 5000, error: () => { }}); } } }; $ocms.vbl_send = function (ev) { var options = ev.data || {}; if ((options.url || '') === '') { return; } var frm = $('#contentframe form:first'); var postoptions = { url: options.url, data: new FormData(), success: function (response) { if (typeof options.success === 'function') { options.success(response); } else if (typeof options.success === 'string') { alert(options.success); } }, error: function (jqXHR, textStatus, response) { if (typeof options.error === 'function') { options.error(response); } else if (typeof options.error === 'string') { alert(options.error); } }, complete: function () { frm.ldng(0); } }; var valid = true; frm.find('input').each(function () { var t = $(this), nm = t.nza('name'), val = t.val(), req = $(this).prop('required') || false; if (nm !== '') { var tv = (val !== '' || req === false); valid = valid && tv; if (tv === true) { postoptions.data.append(nm, val); t[0].setCustomValidity(''); } else if ($(this).nza('ocms-nvnote') !== '') { t[0].setCustomValidity($(this).nza('ocms-nvnote')); } } }); if (valid === true) { frm.ldng(1); $ocms.postXT.call(this, postoptions); } }; (function ($) { $.fn.nza = function (attributeName, alternative) { var attr = $(this).attr(attributeName); return (typeof attr !== 'undefined' && attr !== false) ? attr : (alternative || ''); }; $.fn.serializeObject = function (checkvalidity, options) { var rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i, rcheckableType = (/^(?:checkbox|radio)$/i); options = options || {}; var typedvalues = bool(options.typedvalues, false); var result = {}, c= $(this), inp = c.find(':input:not([nosend],[type="file"])').addBack(':input'), valid = true; $.each(inp.not('.tinymce').get(), function (i, ii) { var t = $(this), e = this, type = (this.type || '').toLowerCase(), req = t.prop('required') || false; if ((e.name && !t.is(':disabled') && rsubmittable.test(e.nodeName) && !rsubmitterTypes.test(type)) === true) { var val = t.val(), nme = e.name, dtf = t.nza('data-format').split(':'), pattern = t.nza('pattern') || '.*', cat = false; if (rcheckableType.test(type) === true) { val = e.checked ? (val !== '' ? val : 'true') : ''; } if (dtf[0].substr(0, 4) === 'date' && dtf.length > 1) { val = parseDt(val, dtf.slice(1).join(':')); /* should result in date object */ if (typeof val === 'boolean') { val = null; } if (val === null && t.prop('type').substr(0, 4) === 'date' && isNaN(new Date(t.val())) === false) { /* is can be parsed by Date object */ val = new Date(t.val()); } if (val instanceof Date === true && typeof val.getMonth === 'function') { /* if really a Date */ if (typedvalues === false) { val = fdt(val, dtf[0] === 'date' ? 'dts' : 'iso'); } /* if string result awaited, format to string */ } else { val = null; } } else if ((type === 'number' || dtf[0] === 'float' || dtf[0] === 'integer') && typedvalues === true) { let v, raw = String(val).replace(',', '.'); if (dtf[0] === 'integer') { v = parseInt(raw); } else { v = parseFloat(raw); } val = isNaN(v) ? val : v; } if (req === true && ((val === '' || val === null || typeof val === 'undefined') || (typeof val === 'string' && val.match(pattern) === null))) { if (cat === false && bool(checkvalidity, false) === true) { e.setCustomValidity(t.nza('ocms-nvnote', $ocms.t.inv || 'Invalid field')); } val = null; } else if (cat=== false && bool(checkvalidity, false) === true) { e.setCustomValidity(''); } if (typeof val !=='undefined' && val !== null && typeof val === 'string') { let node = result[nme]; if (typeof node !== 'undefined' && node !== null) { if (Array.isArray(node)) { node.push(val.replace(rCRLF, '\r\n')); } else { result[nme] = [node, val.replace(rCRLF, '\r\n')]; } } else { result[nme] = val.replace(rCRLF, '\r\n'); } } else if (typeof val !== 'undefined' && val !== null) { let node = result[nme]; if (typeof node !== 'undefined' && node !== null) { if (Array.isArray(node)) { node.push(val); } else { result[nme] = [node, val]; } } else { result[nme] = val; } } else { valid = false; } } }); inp.filter('.tinymce').each(function (ei, ex) { var t = $(this), e = this, type = (this.type || '').toLowerCase(), req = t.prop('required') || false try { var te = tinymce.get($(ex).attr('id')); if (te) { var enm = $(ex).attr('name'); var val = te.getContent(); if (req === false || (val || '') !== '') { result[enm] = val; } else { valid = false; } } } catch (ee) { $.noop(); } }); c.toggleClass('invalid', !valid); return valid ? result : null; }; $.fn.sendForm = function (url, success, options) { var form = $(this); options = options || {}; var postoptions = { url: url, success: function (response) { options.response = response; if (typeof success === 'function') { var _e = success(response); } form.closest('div.modal').remove(); }, error: function (jqXHR, textStatus, response) { if (typeof options.error === 'function') { options.error.call(this, jqXHR); } else { $ocms.failure.call(this, jqXHR); } }, complete: function () { form.ldng(0); if (typeof options.complete === 'function') { options.complete.call(this, jqXHR); } } }; var fle = form.find('input[type="file"]'); postoptions.data = new FormData(); if (fle.length > 0) { $.each(fle[0].files, function (key, value) { postoptions.data.append(key, value); postoptions.data.append('file_lastmodified', $ocms.isodt(value.lastModifiedDate)); }); } var formdata = form.serializeObject(); $.each(formdata || {}, function (di, dx) { postoptions.data.append(di, dx); }); form.ldng(); $ocms.postXT.call(this, postoptions); }; $.fn.checkValidity = function () { var t = $(this), valid = true; t.each(function (i,e) { valid = valid && e.checkValidity(); }); return valid; }; $.fn.wrap = function (cls, attr) { var t = $(this), n = $$.dc(cls).attr(attr || {}).insertAfter(t); t.append(n); return n; }; })(jQuery); $ocms.logout = function () { $ocms.postXT({ url: $ocms.url('logout'), complete: function () { window.location.reload(); } }); }; $ocms.login = { send: function (e) { e.preventDefault(); var f = $(this); if (f.find('#dbtn-confirm').hasClass('disabled') === true) { return false; } else { var qs = f.serializeObject(); qs.loginaccount = ne(qs.loginaccount, $ocms.auth.account || $ocms.auth.requestedaccount || ''); qs.loginaccount = ne(qs.loginaccount, $ocms.auth.account || $ocms.auth.requestedaccount || ''); if (ne(qs.loginaccount) === '' && bool($ocms.auth.accountrequired, true) === true ) { alert($t.l16); return false; } else { $ocms.postXT({ url: $ocms.url('login'), data: qs, success: function () { window.location.reload(); }}); return false; } } }, uichange: function () { let inp_ui = $(this), form = inp_ui.closest('form'), accountrequired = bool($ocms.auth.accountrequired, true); let loginaccount = ne(form.find('[name="loginaccount"]').val(), $ocms.auth.account || $ocms.auth.requestedaccount || ''); if (loginaccount !== '' || accountrequired === false) { var ul = form.find('[name="userlogin"]').empty().val(''); var un = form.find('[name="username"]').empty().val(''); var nsel = $('#dlg_userlogin_sel').empty().val(''); var ui = inp_ui.val() || ''; if (inp_ui.checkValidity() === false && ui === '') { return; } var ftbl = inp_ui.closest('table').ldng(); $ocms.postXT.call(this, { url: $ocms.url('auth'), data: { 'userinfo': ui, account: (loginaccount ||'') }, success: function (response, textStatus, jqXHR) { if (response.length === 1) { var sx = response[0]; ul.val(sx.login).change().attr('required', '').removeAttr('nosend'); un.val(sx.name).change().attr('required', '').show(); nsel.removeAttr('required').attr('nosend', '').hide(); } else if (response.length > 0) { un.hide().removeAttr('required'); ul.removeAttr('required').attr('nosend', ''); if (nsel.length === 0) { nsel = $('').attr({ name: 'userlogin', size: response.length, id: 'dlg_userlogin_sel', class: 'form-control', required: '' }).css({ width: '100%', 'max-width': '100%', padding: '2px' }).insertAfter(un); } $.each(response, function (ni, sx) { var io = $('').attr({ value: sx.login, style: 'padding-top: 2px; padding-bottom: 5px;', 'border-bottom': '1px solid #EEE;' }).text(sx.name).appendTo(nsel); if (ni % 2 === 0) { io.css({ 'background-color': '#F9F9F9' }); } }); nsel.attr('required', '').removeAttr('nosend'); } else { nsel.hide().attr('nosend', ''); un.attr('required', '').show(); ul.attr('required', '').removeAttr('nosend'); alert($t.l9); } }, error: function (jqXHR) { $ocms.failure.call(this, jqXHR); }, complete: function () { ftbl.ldng(0); } }); } else { alert($t.l18); } }, sendpassword: function (ev) { var d = $(''); var fb = d.find('.form-body'), code = null; d.find('form').submit(function (e) { e.preventDefault(); var qs = $(this).serializeObject(true), s2 = code === null, u = s2 ?'spwc':'spw'; $ocms.postXT.call(this, { url: $ocms.url(u), data: qs, complete: function () { if (s2) { fb.append('
Ihnen wurde ein Code per SMS zugesandt.
Bitte tragen Sie den hier ein:
'); code = $('
').appendTo(fb); } else { alert($t.l13); d.remove(); } }, error: () => { } /* prevent default */ }); return false; }); d.find('.modal-close').click(function () { d.remove(); }); var l17a = []; $.each($t.l7a.split('\n'), (i, t) => { Array.prototype.push.apply(l17a, [$('
'), $('').text(t)]); }); d.find('.modal-note').append($('').text($t.alert)).append(l17a); d.appendTo('body'); setTimeout(function () { $('.modal').find('input[name="lastname"]').focus(); }, 600); } }; var $$ = { s: function (ct) { return $('').text(ct); }, br: function () { return $('
'); }, sc: function (cls, ct) { return $('').addClass(cls).text(ct); }, td: function (param1, param2) { var td = $(''); if ((param1 instanceof jQuery) === true) { td.appendTo(param1); } else if (typeof param1 === 'object') { td.attr(param1); } else if (typeof param1 === 'string') { td.text(param1); } if (typeof param2 === 'object') { td.attr(param2); } else if (typeof param2 === 'string') { td.text(param2); } return td; }, th: function (param1, param2) { var th = $(''); if ((param1 instanceof jQuery) === true) { th.appendTo(param1); } else if (typeof param1 === 'object') { th.attr(param1); } else if (typeof param1 === 'string') { th.text(param1); } if (typeof param2 === 'object') { th.attr(param2); } else if (typeof param2 === 'string') { th.text(param2); } return th; }, tdc: function (cls, param1, param2) { return $$.td(param1, param2).addClass(cls); }, td2: function (ct) { var _td3 = $(''); if ($.type(ct) === 'string') { _td3.text(ct); } else if (ct instanceof jQuery) { _td3.append(ct); } else if (typeof ct === 'function') { ct.call(_td3); } else { _td3.html(' '); } return _td3; }, td3: function (ct) { var _td3 = $(''); if ($.type(ct) === 'string') { _td3.text(ct); } else if (ct instanceof jQuery) { _td3.append(ct); } else if (typeof ct === 'function') { ct.call(_td3); } else { _td3.html(' '); } return _td3; }, tdtr: function (ct, tbl) { var tr = $$.tr().appendTo(tbl); if ((ct instanceof jQuery) === true || typeof ct === 'string') { ct.appendTo($$.td().appendTo(tr)); } else if (Array.isArray(ct) === true) { $.each(ct, function (ci, cx) { $(cx).appendTo($$.td().appendTo(tr)); }); } return tr; }, tr: function (param1, param2) { var tr = $(''); if ((param1 instanceof jQuery) === true) { tr.appendTo(param1); } else if (typeof param1 === 'object') { tr.attr(param1); } if (typeof param2 === 'object') { tr.attr(param2); } return tr; }, trc: function (cls, param1) { var tr = $('').addClass(cls); if ((param1 instanceof jQuery) === true) { tr.appendTo(param1); } else if (typeof param1 === 'object') { tr.attr(param1); } return tr }, d: function (att) { return $('
').attr(att || {}); }, dc: function (cls, param1, param2, param3) { var d = $('
').addClass(cls); if ((param1 instanceof jQuery) === true) { d.appendTo(param1); } else if (typeof param1 === 'object') { d.attr(param1); } else if (typeof param1 === 'function') { d.click(param1); } else if (typeof param1 === 'string') { d.text(param1); } if (typeof param2 === 'string') { d.text(param2); } else if (typeof param2 === 'object') { d.attr(param2); } else if (typeof param2 === 'function') { d.click(param2); } if (typeof param3 === 'string') { d.text(param3); } else if (typeof param3 === 'object') { d.attr(param3); } else if (typeof param3 === 'function') { d.click(param3); } return d; }, df: function (att) { return $('
 
').attr(att || {}); }, opt: function (param1, param2, param3) { var d = $(''); if (typeof param1 === 'string') { d.attr('value', param1); } else if (typeof param1 === 'object') { d.attr(param1); } if (typeof param2 === 'string') { d.text(param2); } else if (typeof param2 === 'object') { d.attr(param2); } if (typeof param3 === 'object') { d.attr(param3); } return d; }, eOpt: function (selected) { var _eOpt = $(''); if (selected || false) { _eOpt.attr('selected', 'selected'); } return _eOpt; }, tbl: function (att) { return $('
').attr(att || {}); }, tblc: function (cls) { return $('
').addClass(cls); }, thead: function (tbl) { let h = $(''); if (tbl instanceof jQuery) { h.prependTo(tbl); } return h; }, tbody: function (tbl) { let b = $(''); if (tbl instanceof jQuery) { b.appendTo(tbl); } return b; }, tblset: function (att, parent) { let b = $$.tbl(att || {}); if (parent instanceof jQuery) { parent.append(b); } return { tbl: b, hd: $$.thead().appendTo(b), bdy: $$.tbody().appendTo(b) }; }, i: function (att) { return $('').attr(att || {}); }, img: function (src, att) { return $('').attr('src', src).attr(att || {}); }, sel: function (att) { return $('').attr(att || {}); }, btn: function (att) { return $('').attr(att || {}); }, a: function (att) { return $('').attr(att || {}); }, li: function (att) { return $('
  • ').attr(att || {}); }, ul: function (att) { return $('').attr(att || {}); }, nav: function (att) { return $('').attr(att || {}); }, lbl: function (ct, att) { var l = $(''); if (typeof ct === 'string') { l.text(ct); } if (typeof ct === 'object') { l.attr(ct); } else if (typeof att === 'object') { l.attr(att); } return l; }, txt: function (att) { return $('').attr(att || {}); }, 0: function (tag, att) { return $('<' + tag + '>').attr(att || {}); }, /* bootstrap */ bbtn: function (txt, cls) { return $$.btn({ type: 'button', class: 'btn' }).addClass(cls).text(txt); }, svg: (tag) => { return $(document.createElementNS('http://www.w3.org/2000/svg', tag)); } }; String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); }; String.prototype.left = function (n) { if ($.type(n) === 'string') { var i = this.indexOf(n); if (i > 0) return this.slice(0, i); else return ""; } else { return this.substring(0, n); } }; String.prototype.right = function (n) { if ($.type(n) === 'string') { var i = this.indexOf(n); if (i > 0) return this.substring(this.length - i); else return ""; } else { return this.substring(this.length - n); } }; Array.prototype.move = function (old_index, new_index) { if (new_index >= this.length) { var k = new_index - this.length; while ((k--) + 1) { this.push(undefined); } } this.splice(new_index, 0, this.splice(old_index, 1)[0]); return this; // for testing purposes }; function getMonday(d) { d = new Date(d); var day = d.getDay(), diff = d.getDate() - day + (day == 0 ? -6 : 1); // adjust when day is sunday return new Date(d.setDate(diff)); } (function ($) { $.fn.appendToIf = function (target, condition) { var t = $(this), c = (typeof condition === 'function' ? condition(t) : condition); if ((typeof c === 'boolean' ? c : true) === true) { t.appendTo(target); } return t; }; $.fn.appendIf = function (content, condition) { var t = $(this), c = (typeof condition === 'function' ? condition(t) : condition); if ((typeof c === 'boolean' ? c : true) === true) { t.append(content); } return t; }; $.fn.rwText = function (text, addtitle, options) { var tgt = $(this).empty(); options = $.extend({ wrap: true }, options); var sa = Array.isArray(text) === true ? text : (text == null ? '' : String(text)).split('\n'); $.each(sa, function (ti, tx) { if ((tx || '') !== '') { if (ti > 0) { tgt.append($$.br()); } tgt.append(options.wrap === true ? $$.s(tx) : tx); } }); if (addtitle || false) { tgt.attr('title', addtitle); } return tgt; }; $.fn.loadSel = function (url, data, complete) { if ($(this).prop('tagName').toUpperCase() === 'SELECT') { var sel = $(this); $ocms.postXT.call(this, { url: url, data: data || {}, success: function (response) { $.each(response, function () { sel.append($$.opt(response.value, response.text)); }); }, complete: function () { sel.ldng(0); if (typeof complete === 'function') { complete.call(sel); } } }); } }; $.fn.emptyWithEditors = function (parent) { var t = $(this); t.find(':input.tinymce').each(function (ei, ex) { try { var te = tinymce.get($(ex).attr('id')); if (te) { te.remove(); } } catch (ee) { $.noop(); } }); return t.empty(); }; $.fn.cssValue = function (styleName) { if (this.length > 0) { var cv = this.css(styleName) || ''; if (cv === '') { return 0; } else { var v, r = (/(^[\d\.]*)(\D{1,3}$)/ig).exec(cv); if (r !== null) { switch (r[2]) { case 'rem': return $ocms.rpx(parseFloat(r[1])); default: return parseFloat(r[1]); } } else if (isNaN(cv) === false) { return parseFloat(cv) } else { return 0; } } } else { return 0; } }; /* @description: gets very inner height excluding borders and padding */ $.fn.veryInnerHeight = function () { let c = (p) => $(this).cssValue(p); return ($(this).innerHeight() - c('padding-top') - c('padding-bottom')); }; /* @description: gets very inner width excluding borders and padding */ $.fn.veryInnerWidth = function () { let c = (p) => $(this).cssValue(p); return ($(this).innerWidth() - c('padding-left') - c('padding-right')); }; $.fn.marginWidth = function() { let c = (p) => $(this).cssValue(p); return (c('margin-left') + c('margin-right')); }; $.fn.marginHeight = function () { let c = (p) => $(this).cssValue(p); return (c('margin-top') + c('margin-bottom')); }; $.inArrayRegEx = function (search, array, start) { var regex = (($.type(search) === 'regexp') ? search : (new RegExp(search))); if (!array) return -1; start = start || 0; for (var i = start; i < array.length; i++) { if (regex.test(array[i])) { return i; } } return -1; }; /* @Desciption: Programmatically Lighten or Darken a hex color (or rgb, and blend colors) * @author: Pimp Trizkit * @source: internet http://stackoverflow.com/a/13542669 * * usage: * var color1 = "#FF343B"; * var color2 = "#343BFF"; * var color3 = "rgb(234,47,120)"; * var color4 = "rgb(120,99,248)"; * var shadedcolor1 = shadeBlend(0.75,color1); * var shadedcolor3 = shadeBlend(-0.5,color3); * var blendedcolor1 = shadeBlend(0.333,color1,color2); * var blendedcolor34 = shadeBlend(-0.8,color3,color4); // Same as using 0.8 */ $.shadeBlend = function (p, c0, c1) { var n = p < 0 ? p * -1 : p, u = Math.round, w = parseInt; var f, t; if (c0.length > 7) { f = c0.split(','); t = (c1 ? c1 : p < 0 ? 'rgb(0,0,0)' : 'rgb(255,255,255)').split(','); var R = w(f[0].slice(4)), G = w(f[1]), B = w(f[2]); return 'rgb(' + (u((w(t[0].slice(4)) - R) * n) + R) + ',' + (u((w(t[1]) - G) * n) + G) + ',' + (u((w(t[2]) - B) * n) + B) + ')'; } else { f = w(c0.slice(1), 16); t = w((c1 ? c1 : p < 0 ? '#000000' : '#FFFFFF').slice(1), 16); var R1 = f >> 16, G1 = f >> 8 & 0x00FF, B1 = f & 0x0000FF; return '#' + (0x1000000 + (u(((t >> 16) - R1) * n) + R1) * 0x10000 + (u(((t >> 8 & 0x00FF) - G1) * n) + G1) * 0x100 + (u(((t & 0x0000FF) - B1) * n) + B1)).toString(16).slice(1); } }; $.fn.IN = function (complete) { $(this).fadeIn(400, complete); return $(this); }; $.fn.OUT = function (complete) { $(this).fadeOut(400, complete); return $(this); }; $.fn.tooltip = function (mouse, tree) { var target = (typeof mouse === 'boolean' ? mouse : false) === true ? 'mouse' : false; var cascade = typeof tree === 'boolean' ? tree : false; var t = $(this); t.each(function () { var elem = cascade ? $(this).find('.tooltiptext') : $(this).children('.tooltiptext'); if ($(elem).length > 0) { elem.each(function () { var e = $(this), p = $(this).filter(':not(:empty)').parent(); p.qtip({ suppress: false, content: { text: e.clone() }, position: { target: target, adjust: { x: 2, y: 2 }, viewport: true }, events: { hidden: $ocms.tooltip_hidden }, show: { effect: false }, hide: { effect: false } }); e.remove() }); } else { $(this).qtip({ position: { target: target, adjust: { x: 2, y: 2 }, viewport: true }, events: { hidden: $ocms.tooltip_hidden }, effect: false }); } }); return t; }; $.fn.rC = function (arg) { return $(this).removeClass(arg); }; $.fn.aC = function (arg) { return $(this).addClass(arg); }; $.fn.tC = function (arg, state) { return $(this).toggleClass(arg, state); }; })(jQuery); function $lf(vis) { var ts = typeof vis === 'undefined' ? null : ((typeof vis === 'number' && vis !== 1) || (typeof cl === 'boolean' && vis === false)); return $('#listframe').tC('hd', ts).is('.hd'); }; function $nuf(e) { if (e) { e.stopPropagation(); } if ($(this).is('.disabled')) { return; } /* close any nav */ var f = function (nav) { nav.removeClass('vis').find('li.dropdown').removeClass('open').removeClass('vis').attr('aria-expanded', 'false'); } var p = $(this).parent('li.dropdown'); if (p.length > 0) { p.tC('open'), navs = p.is('.open') === true ? 'true' : 'false'; p.attr('aria-expanded', navs); /* close any other branch */ var thisnav = p.closest('nav'); thisnav.find('li.dropdown').not(p.parentsUntil('nav')).not(p).removeClass('open').attr('aria-expanded', 'false'); if (p.is('.open') === false) { p.find('li.dropdown').removeClass('open').attr('aria-expanded', 'false'); } f($('nav').not(thisnav)); } else { f($('nav')); } }; function $tbr() { $lf(0); return $('#topbar').ocmsmenu([]); }; //function $sbr(empty) { // return $('#sidebar').ocmsmenu([], empty); //}; function $lfr() { $('#sidebar').empty(); return $('#listframe').removeClass('fix').addClass('hd').empty(); }; function $cfr() { $tbr(); return $('#contentframe').empty(); }; function jObj(jsstr, key) { let jo = {}; if ((jsstr || '').substr(0, 1) === '{') { try { jo = JSON.parse(jsstr); } catch (e) { jo = {}; } } return jo[key] || ''; }; (function ($) { $.fn.ocmsmenu = function (menu, empty) { var tgt = $(this); $ocms.menu.call(tgt, menu, empty); return tgt; }; $.fn.activatemenu = function () { var tgt = $(this).filter('nav'); tgt.find('a').not('.on').addClass('on').click($nuf); tgt.find('.nav-btn').not('.on').addClass('on').click(function (e) { e.stopPropagation(); var t = $(this); $(t.attr('data-target')).tC(t.attr('data-toggle')); }); return tgt; }; })(jQuery); function string(inp, vals) { var ret = inp || '', rx; $.each(vals || [], function (vi, vx) { rx = new RegExp('\\{' + vi.toString() + '\\}', 'ig'); ret = ret.replace(rx, vx); }); return ret; }; function init_tooltip(mouse) { var target = (typeof mouse === 'boolean' ? mouse : false) === true ? 'mouse' : false; $('[title]').qtip({ position: { target: target, adjust: { x: 2, y: 2 }, viewport: true }, events: { hidden: $ocms.tooltip_hidden }, effect: false }); $('div.tooltiptext').each(function () { var p = $(this).filter(':not(:empty)').parent(); p.qtip({ suppress: false, content: { text: $(this).clone() }, position: { target: target, adjust: { x: 2, y: 2 }, viewport: true }, events: { hidden: $ocms.tooltip_hidden } }); }); } class ObjectArray extends Array { /** * Get whether the Array is empty * */ isEmpty() { return this[0].length === 0; } // built-in methods will use this as the constructor static get [Symbol.species]() { return Array; } /** * returns a new new array of items where function applied to currentvalue returns true * @param {function(currentValue[, index[, array]])} fnc */ filter(fnc) { if (typeof fnc === 'function') { return new ObjectArray(this[0].filter(fnc)); } else { return this; } } /** * removes items where function applied to currentvalue is true * changes the ObjectArray itself and returns it * @param {function(currentValue[, index[, array]])} fnc */ remove(fnc) { if (typeof fnc === 'function') { let i = this[0].findIndex(fnc); while (i > -1) { this[0].splice(i); i = this[0].findIndex(fnc); }; } else { return this; } } /** * sorts the ObjectArray using the Array.sort function and returns it * @param {function(element)} fnc */ sortBy(fnc) { if (typeof fnc === 'function') { this[0].sort(fnc); } return this; } /** * sorts the ObjectArray using the Array.sort function and String.localeCompare function and returns it * The compared strings are converted to upper case to make function case-insensitive * undefined values are treated as empty strings * @param {string} property */ sortString(property) { this[0].sort((a, b) => { let nameA = (a[property] || '').toString().toUpperCase(); // ignore upper and lowercase let nameB = (b[property] || '').toString().toUpperCase(); // ignore upper and lowercase console.debug(nameA.localeCompare(nameB)); return nameA.localeCompare(nameB); }); return this; } /** * sorts the ObjectArray using the Array.sort function and value comparison and returns it * empty or non-numeric values are identified by isNaN and put to End of array * @param {string} property */ sortNum(property) { this[0].sort((a, b) => { let nameA = a[property], nameB = b[property]; if ((isNaN(nameB) === true && isNaN(nameA) === false) || nameA < nameB) { return -1; } else if ((isNaN(nameB) === false && isNaN(nameA) === true) || nameA > nameB) { return 1; } else { // names must be equal return 0; } }); return this; } /** * sums the value of the objects parameter, if value is valid number * @param {string} property */ sum(property) { return this[0].reduce((accumulator, currentValue) => accumulator + (isNaN(currentValue[property]) === true ? 0 : currentValue[property]), 0) } /** * returns new object with array by named property value * @param {string} property */ groupBy(property) { return this[0].reduce(function (acc, obj) { let key = obj[property]; if (!acc[key]) { acc[key] = []; } acc[key].push(obj); return acc; }, {}); } /** * * @param {function(value, index, array)} fnc */ each(fnc) { if (typeof fnc === 'function') { let stop = false; this[0].forEach((value, index, array) =>{ if (stop === false) { let r = fnc(value, index, array); if (typeof r === 'boolean' && r === false) { stop = true; } } }); } } get toArray() { return this[0]; } } class NumArray extends Array { sum() { return this.reduce((accumulator, currentValue) => accumulator + currentValue); }; first() { return this[0]; }; last() { return this[this.length - 1]; }; average() { return this.sum() / this.length; }; range() { let self = this.map(x => x).sort(); /* do not change original */ return { min: self[0], max: self[this.length - 1] } }; // built-in methods will use this as the constructor static get [Symbol.species]() { return Array; } } (function () { $ocms.ocmsmenu = [ { lbl: '', id: 'm_home', ico: 'glyphicon glyphicon-home', fnc: 'init:home' } , { fnc: 'separator' } //, { fnc: 'separator' } //, { lbl: $t.m_efa, id: 'm_efa', fnc: 'init:efa' } ]; })(); (function ($ocms) { $ocms.multline = function (txt) { let s = txt.split('\n'), div = $$.d(); $.each(s, (si, sx) => { div.append($$.s(sx)); }); return div.html(); }; $ocms.tooltip_hidden = function (event, api) { /*console.log('%o', [event, api, this]);*/ $(this).remove(); api.rendered = false; }; /* Tests whether a string is a JSON/ISO-8601 date(-time) value as emitted by the backend's JSON serializer (e.g. Newtonsoft "2021-09-09T00:00:00[.fff][Z|+hh:mm]"). Deliberately NOT based on the native Date constructor, which guesses ambiguous formats (e.g. dotted dd.MM.yy strings) heuristically and inconsistently. */ $ocms.isJSONDateString = function (inp) { if (typeof inp !== 'string') { return false; } else { return /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?)?$/.test(inp); } } $ocms.failure = function (jqXHR) { if ((jqXHR.internalCode || -1) === 11110) { /* not authenticated */ $ocms.login.dlg(); } else { alert($t.f1 + '\n' + (jqXHR.internalText || '')); } } $ocms.getScript = function (def, success) { var cu = [], su = [], validstring = function (obj) { return (typeof obj === 'string' && (obj || '') !== ''); }, adddef = function (di, dx) { if (bool(dx.condition, true) === true) { if ((dx.script || '') !== '') { su.push({ url: dx.script, module: dx.module || '' }); } if (validstring(dx.css || '') === true) { cu.push(dx.css); } else if (Array.isArray(dx.css) === true) { Array.prototype.push.apply(cu, dx.css.filter(validstring)); } } }; if (validstring(def || '') === true) { su.push(def); } else if (Array.isArray(def) === true) { $.each(def, adddef); } else if (typeof def === 'object' && (def.script || '') !== '') { adddef(0, def); } let cssarray = []; $.each(cu, function (ci, cui) { if ((cui || '') !== '') { cssarray.push(loadCSS(cui)); } }); let spa = su.map( function (sx, si) { let url = sx.url, mdl = sx.module || ''; if (mdl === '') { let p = new Promise(function (resolve, reject) { try { (async function () { $.ajax({ url: url, dataType: 'script', success: function () { resolve(su); }, error: function () { reject(su) }, timeout: 30000 }); })(); } catch (e) { console.debug(e.message + '%o', e); } }); return p; } else { let p = $ocms.loadmodule(mdl, url, sx.alias); return p; } }); Promise.all(spa).then(success); }; $ocms.loadmodule = function (module, url, alias) { let p = new Promise(function (resolve, reject) { (async function () { try { let url2 = (url.startsWith('/') || url.startsWith('.') ? '' : '/') + url; import(url2).then(x => { $ocms[module] = x[alias ||'default']; resolve(module); }).catch(e2 => { console.debug(e2.message + '%o', e2); reject(module); }); } catch (e) { console.debug(e.message + '%o', e); } })() }); return p }; $ocms.ocms_auth = function (module, min, person_guid, fnc) { var r = false; if ($.isPlainObject($ocms.auth.modules) === false) { $ocms.auth.modules = {}; } var ma = 0; if ($ocms.auth.modules[module + (person_guid || '')] || false) { ma = $ocms.auth.modules[module + (person_guid || '')]; if (ma < 2 && (person_guid || '') === auth.guid) { ma = 2; } if (ma >= (min || 0)) { fnc(r); }; } else { $ocms.postXT({ url: $ocms.url('auth'), data: { module: module, person_guid: (person_guid || '') }, success: function (res) { ma = res[module]; $ocms.auth.modules[module + (person_guid || '')] = ma; if (ma < 2 && (person_guid || '') === $ocms.auth.person_guid) { ma = 2; } if (ma >= (min || 0)) { fnc(r); }; }, error: function (jqXHR) { $ocms.failure.call(this, jqXHR); } }); } }; $ocms.auth.locale = 'de'; $ocms.ocms_prepauth = function (modules, person_guid, fnc) { $ocms.postXT({ url: $ocms.url('auth'), data: { fn: 'csv', modules: modules, person_guid: (person_guid || '') }, success: function (res) { $ocms.ocms_regauth(res); }, error: function (jqXHR) { $ocms.failure.call(this, jqXHR); }, complete: function () { fnc(); } }); }; $ocms.ocms_regauth = function (object) { $.each(object || {}, function (module, res) { auth.modules[module] = parseInt(res); }); }; $ocms.init = function (ev) { var mdl = typeof ev === 'string' ? ev : ((ev.data || {}).fn || ''); if (mdl === '') { return; } else if (mdl === 'home') { $cfr(); $lfr(); $('#topbar').ocmsmenu([], true); $('#activemodule').text($t.ov); $ocms.ov.call($('#contentframe')); } else { $cfr(); $lfr(); $('#topbar').ocmsmenu([]); $ocms.postXT({ url: $ocms.url(mdl + '/auth'), success: function (auth) { if (typeof $ocms[mdl] === 'undefined') { $ocms[mdl] = {}; } $ocms[mdl].auth = auth; if (auth.manage > 0) { $ocms.getScript({ module: mdl, script: ['web/imdl', mdl, $ocms.auth.locale || 'de', 'js'].join('.'), css: ['web/imdl', mdl, 'css'].join('.'), condition: typeof $ocms[mdl].init2 !== 'function' }, function () { $ocms[mdl].init2(); }); } }, error: function () { $('#contentframe').empty(); } }); } }; $ocms.menuarray = function (itm) { this.array = []; this.sep = function () { if (this.length > 0 && this.array[array.length - 1].fnc !== 'separator') { this.push({ fnc: 'separator' }); } }; this.push = function (newitm) { if (typeof newitm === 'undefined') { return null; } else if (Array.isArray(newitm) === true) { Array.prototype.push.apply(this.array, newitm); } else if (typeof newitm === 'object') { this.array.push(newitm); } return newitm; }; this.unshift = function (newitm) { if (typeof newitm === 'undefined') { return null; } else if (Array.isArray(newitm) === true) { Array.prototype.unshift.apply(this.array, newitm); } else if (typeof newitm === 'object') { this.array.unshift(newitm); } return newitm; }; this.push(itm); }; $ocms.menu = function (menu, empty) { /* * create menu based on definition in form of [ { id: '', lbl: '', ico: '', fnc: function() { }, itm: [ ], data: {} } ] */ menu = menu || []; var bar = $(this).removeClass('vis'); if (bool(empty, true) === true && bar.is('#mainmenu') === false) { bar.empty(); } if (bool(empty, false) === false && bar.is('#sidebar,#topbar')) { menu.unshift({ id: 'sbctrl', glyph: 'glyphicon-th-list', aclass: 'fbtn', fnc: function () { $lf(); } }); $lf(0); } if ((menu || []).length === 0) { bar.empty().addClass('hd'); } else { bar.removeClass('hd'); var nav = bar.is('nav') === true ? bar : bar.children('nav'); if (nav.length !== 1) { nav = $('').tC('nv', bar.is('#sidebar')).tC('ctxt', bar.is('#topbar')).appendTo(bar); } var nul = $$.ul().appendTo(nav); var subi, subm = function (la, ix) { var li = $(this).addClass('dropdown submenu'); la.append($$.sc('caret dd')).addClass('dds dropdown-toggle').attr({ 'aria-expanded': 'false' }); if ((ix.ico || '') !== '') { la.prepend($$.sc('ico ' + ix.ico)); } var lul = $$.ul({ class: 'dropdown-menu', role: 'menu' }).appendTo(li); $.each(ix.itm || [], function (mi, mx) { subi.call(lul, mx); }); }; var dis = function (ix) { $(this).tC('disabled', (typeof ix.disabled === 'boolean' ? ix.disabled : (typeof ix.disabled === 'string' && ix.disabled === 'subs' && (ix.itm || []).length === 0 ? true : false))) }; subi = function (mx) { var ml = $$.li({ id: mx.id }).attr(mx.attr || {}).addClass(mx.lclass).appendTo($(this)), ma, role = (typeof mx.fnc === 'string' && mx.fnc !== '') ? mx.fnc.split(':')[0] : ''; if (role !== '' && role !== 'init') { ml.attr('role', role).appendIf($$.s(mx.lbl), ne(mx.lbl) !== ''); } else { ma = $$.a({ class: 'on', role: 'button' }).addClass(mx.aclass).appendTo(ml).append($$.s(mx.lbl)); dis.call(ma, mx); if ((mx.itm || []).length > 0) { subm.call(ml, ma, mx); } ma.click($nuf); if (typeof mx.fnc === 'function') { ma.click(mx.data || {}, mx.fnc); } else if (role === 'init') { ma.click($.extend({}, mx.data || {}, { fn: mx.fnc.split(':')[1] }), $ocms.init); } } }; $.each(menu, function (ii, ix) { var li = $$.li({ id: ix.id }).attr(ix.attr || {}).addClass(ix.lclass), la, role = (typeof ix.fnc === 'string' && ix.fnc !== '') ? ix.fnc.split(':')[0] : ''; if (role !== '' && role !== 'init') { li.attr('role', role).appendIf($$.s(ix.lbl), ne(ix.lbl) !== ''); } else { la = $$.a({ class: 'on', role: 'button' }).addClass(ix.aclass).appendTo(li); dis.call(la, ix); if ((ix.lbl || '') !== '') { la.append($$.s(ix.lbl)); } if ((ix.ico || '') !== '') { la.prepend($$.sc('ico ' + ix.ico)); } if ((ix.glyph || '') !== '') { la.prepend($$.sc('glyphicon ' + ix.glyph)); } if ((ix.itm || []).length > 0) { li.addClass('dropdown'); la.append($$.sc('caret dd')).addClass('dds dropdown-toggle').attr({ 'aria-expanded': 'false' }); var lul = $$.ul({ class: 'dropdown-menu', role: 'menu' }).appendTo(li); $.each(ix.itm || [], function (mi, mx) { subi.call(lul, mx); }); } if ((ix.sel || []).length > 0) { } else { la.click($nuf); if (typeof ix.fnc === 'function') { la.click(ix.data || {}, ix.fnc); } else if (role === 'init') { la.click($.extend({}, ix.data || {}, { fn: ix.fnc.split(':')[1] }), $ocms.init); } } } li.appendTo(nul); }); nav.activatemenu(); } }; /* DIALOGS & POPUPS ********************************************************************************************************************************/ $ocms.easytbl = (array, options) => { options = options || {}; let tbl = $$.tbl().addClass(options.class).css('border-collapse', 'collapse'), bdy = $$.tbody(tbl), basecss = (bool(options.frame, false) === true) ? { padding: '5px', border: '1px solid #727272' } : {}; if (Array.isArray(options.header) === true) { let hd = $$.thead(tbl); $.each(options.header, (hi, hx) => $$.th(hd).css(options.cellcss || basecss).rwText(hx)); } else if (bool(options.header, false) === true && (array || []).length > 0) { let hd = $$.thead(tbl); $.each(Object.keys(array[0]), (hi, hx) => $$.th(hd).css(options.cellcss || basecss).rwText(hx)); } $.each(array || [], (ai, ax) => { let tr = $$.tr(); $.each(ax, (bi, bx) => { bx = bx || ''; let td = $$.td(tr).css(options.cellcss || basecss); if (bx instanceof jQuery) { td.append(bx); } else if (typeof bx === 'string') { if (bx.substring(0, 1) === '<') { td.append(bx); } else { td.text(bx); } } }); tbl.append(tr); }); return tbl; }; $ocms.dlgtbl = (array, title, options) => { options = options || {}; let tbl = $ocms.easytbl(array, options) $ocms.dlg(tbl, $.extend({ title: title }, options)); }; $ocms.dlg = function (content, options) { options = options || {} let mexist = $('body > .modal').length > 0; let t = (n) => typeof options[n], f = (n) => t(n) === 'function'; if (bool(options.exclusive, true) === true && mexist === true) { alert($t.dbldlg || 'Es ist bereits ein Dialog geöffnet'); return; } let modal = $$.dc('modal', $('body')), dlg = $$.dc('modal-dialog', modal); if (isNaN(options.zindex) === false) { modal.css('zIndex', options.zindex); } else if (mexist === true) { modal.css('zIndex', parseInt($('body > .modal:last').cssValue('zIndex')) + 200); } if (isNaN(options.zindex_min) === false) { if (modal.cssValue('zIndex') < options.zindex_min) { modal.css('zIndex', options.zindex_min); } } if (t('size') === 'string') { dlg.addClass('sz' + ne(options.size)); } else if (Array.isArray(options.size)) { dlg.css('height', (options.size[0] || -1) < 0 ? null : options.size[0].toString() + 'px'); dlg.css('width', (options.size[1] || -1) < 0 ? null : options.size[1].toString() + 'px'); } let clbtn = $$.dc('modal-close').appendTo(dlg), ct = $$.dc('modal-content', dlg); let c = ct, hd, isform = bool(options.form, false); if (isform === true) { /* squeeze in a form */ c = $('
    ').appendTo(c); } if (ne(options.title) !== '') { hd = $$.dc('modal-header', c); $('

    ').text(options.title).appendTo(hd); } let bdy = $$.dc('modal-body', c), ft = $$.dc('modal-footer', c); if ((content instanceof jQuery) === true) { bdy.append(content); } let close = function (be) { if (!!be && typeof be.stopPropagation === 'function') { be.stopPropagation(); } dlg.removeClass('in'); if (f('closing')===true) { options.closing.call(c); } bdy.hide().emptyWithEditors(); modal.remove(); if (f('close') === true) { options.close.call(c); } }; if (c.find(':input[required]').length > 0) { $$.dc('note_required', ft).append($$.sc('ind_required', '*')).append($$.s($t.t1 || 'Eingabe erforderlich')); $$.dc('note_invalid', ft).append($$.s($t.t2 || 'Bitte überprüfen Sie Ihre Eingaben im Formular.')); } if (f('cancel') === true) { let ccb = $$.bbtn(options.cancelbutton || 'Abbrechen', 'cancel').attr({ type: 'button', role: 'cancel' }).appendTo(ft); ccb.click(function (e) { var r = options.cancel.call(c, e); e.stopPropagation(); close(); }); } if (f('confirm') === true) { let cfb = $$.bbtn(options.button || 'OK', 'confirm').attr({ type: bool(options.form, false) === true ? 'submit' : 'button', role: 'confirm' }).appendTo(ft); if (isform === true) { c.submit(function (e) { try { var r = options.confirm.call(c, e); } finally { e.preventDefault(); } return false; }); c.on('modal_submit', function () { var r = options.confirm.call(c, e); }); } else { cfb.click(function (e) { var r = options.confirm.call(c, e); e.stopPropagation(); }); c.on('modal_submit', function () { cfb.click() }); } } else if (isform === true) { c.submit(function (e) { e.preventDefault(); return false; }); } c.on('modal_close', function () { close(); }); clbtn.click(close); if (f('opening') === true) { options.opening.call(c); } dlg.addClass('in'); if (ne(options.mode).indexOf('maxbody') > -1) { bdy.css('min-height', (ct.height() - hd.outerHeight() - ft.outerHeight()).toString() + 'px'); } if (f('open') === true) { options.open.call(c); } return { hd: hd, bdy: bdy, ft: ft, ct: ct, dlg: dlg, c: c }; }; $ocms.mform = function (fields) { /* modal form */ let fb = $$.dc('form-body'); let flds = Array.isArray(fields) ? fields : (fields instanceof fields_definition ? fields.fields : []); /* EXAMPLE !! var flds = [ { name: 'userinfo', label: $t.l1, type: 'string', value: $ocms.auth.login, change: $ocms.login.uichange, required: true }, { name: 'userlogin', type: 'hidden', required: true, value: $ocms.auth.login }, { name: 'username', type: 'string', label: $t.l4, required: true, readonly: true, placeholder: $t.l5, value: $ocms.auth.fullname_rev }, { name: 'userpass', type: 'password', label: $t.l3, required: true, placeholder: $t.l3 }, ]; */ $.each(flds || [], function (ff, f) { let ftyp = f.type || ''; if (ftyp === 'ignore') { return true; } let fg = $$.dc('form-group', fb), id = f.id || 'dlg_' + (f.name || '') + (f.type === 'html' ? '_' + (((1 + Math.random()) * 0x10000) || 0).toString(16).substr(9) : ''); let lbl = $$.lbl(f.label || f.name, { for: id }).appendTo($$.dc('form-itm', fg)); let fi = $$.dc('form-itm', fg), inp = $$.i({ id: id, name: f.name, placeholder: f.placeholder, type: f.type }); switch (ftyp) { case 'email': f.pattern = ne(f.pattern, '[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}$'); break; case 'url': f.pattern = ne(f.pattern, 'https?://.+'); break; case 'number': f.pattern = ne(f.pattern, '[-+]?[0-9]*[.,]?[0-9]*'); inp.attr('type', 'text'); inp.attr('inputmode', 'decimal'); inp.attr('step', f.precision || 'any'); inp.attr('data-format', 'float'); break; case 'integer': case 'int': f.pattern = ne(f.pattern, '[-+]?[0-9]*'); inp.attr('type', 'number'); inp.attr('data-format', 'integer'); break; case 'date': var dbp = '|([0-9]{4}.(0[1-9]|1[012]).(0[1-9]|1[0-9]|2[0-9]|3[01]))' if (ne(f.pattern, $t.datepattern) !== '') { f.pattern = ne(f.pattern, '(' + $t.datepattern + ')' + dbp); } if (ne(f.placeholder, $t.dateplaceholder) !== '') { inp.attr('placeholder', ne(f.placeholder, $t.dateplaceholder)) } if (typeof f.value === 'string') { var dtv = f.value.substr(0, 10); f.value = inp.prop('type') !== 'date' ? fdt(dtv + 'T00:00:00', ne(f.dateformat, $t.dateformat)) : dtv; } inp.attr('data-format', 'date:' + ne(f.dateformat, $t.dateformat) + ';yyyy-MM-dd'); /* alternative format, bc some browsers internally use english standard */ break; case 'datetime': var dtbp = '|([0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])\\s([0-5][0-9]):([0-5][0-9]))' inp.attr('type', 'datetime-local'); if (ne(f.pattern, $t.datetimepattern) !== '') { f.pattern = ne(f.pattern, '(' + $t.datetimepattern + ')' + dtbp); } if (ne(f.placeholder, $t.datetimeplaceholder) !== '') { inp.attr('placeholder', ne(f.placeholder, $t.datetimeplaceholder)) } if (typeof f.value === 'string' && f.value.substr(10, 1) === 'T') { f.value = inp.prop('type').substr(0, 8) !== 'datetime' ? fdt(f.value, ne(f.datetimeformat, $t.datetimeformat)) : f.value; } inp.attr('data-format', 'datetime:' + ne(f.datetimeformat, $t.datetimeformat) + ';yyyy-MM-dd HH:mm:ss'); /* alternative format, bc some browsers internally use english standard */ break; case 'hidden': fg.addClass('hd'); break; case 'html': /* dropthrough by intention */ case 'text': inp = $$.txt({ id: id, name: f.name, placeholder: f.placeholder, type: f.type }); inp.tC('tinymce', f.type === 'html'); break; case 'bool': /* dropthrough by intention */ case 'boolean': f.url = [ { value: 'true', label: ($t || {}).true || 'Yes' }, { value: 'false', label: ($t || {}).false || 'No' } ]; if (typeof f.value === 'boolean') { f.value = f.value ? 'true' : 'false'; } /* dropthrough by intention */ case 'select': inp = $$.sel({ id: id, name: f.name, type: f.type }); if (bool(f.required, false) === false) { $$.eOpt().appendTo(inp); } try { var ffo = function (opt) { if (Array.isArray(opt) === true) { $.each(opt, function (oi, ox) { if (typeof ox === 'string') { $$.opt(ox, ox).appendTo(inp); } else if (Array.isArray(ox) === true) { $$.opt(ox[0], ox[1]).appendTo(inp); } else if (typeof ox === 'object') { $$.opt(ox.value, ox.label || ox.text).appendTo(inp); } }); } } if (Array.isArray(f.url) === true) { ffo(f.url); } else if (typeof f.url === 'function') { f.url.call(inp); } else if (typeof f.url === 'string') { $ocms.postXT({ url: f.url, success: ffo }); } } catch (eo) { $.noop(); } break; default: if (ne(f['max-length']) !== '') { inp.attr('max-length', f['max-length']); } } if (ne(f.pattern) !== '') { inp.attr('pattern', f.pattern); } inp.val(f.value).change(); inp.change(function () { $(this)[0].setCustomValidity(''); }); /* reset invalidity state on change */ inp.addClass('form-control').prop('required', bool(f.required, false)).prop('readonly', bool(f.readonly, false)).appendTo(fi); /* not too early so that inp can be replaced */ if (bool(f.required, false) === true) { lbl.append($$.sc('ind_required', '*')); } if (typeof f.attr === 'object') { inp.attr(f.attr); } if (typeof f.prop === 'object') { inp.prop(f.prop); } if (typeof f.class === 'string') { inp.addClass(f.class); } if (typeof f.change === 'function') { inp.change(f.change); if (bool(f.applychange, false) === true && typeof f.value !== 'undefined') { inp.change(); } } if ((f.note || '') !== '') { $$.dc('form-note', fi).rwText(f.note); } if (typeof f.complete === 'function') { f.complete.call(inp); } }); //let tinys = fb.find('.tinymce'); //if (tinys.length > 0) { // pa = [new Promise((resolve, reject) => { // $ocms.initMCE(tinys); // resolve(); // })]; // await Promise.all(pa); //} return fb; }; $ocms.initMCE = function (tgt, options) { //if ($vm.nl.option_individualized) { $vm.nl.nkit_custMCE_plugins.push('nkit_vm_variables'); } tgt = $(tgt); options = options || {}; try { let sets = { target: tgt[0], inline: false, width: options.width || '100%', statusbar: false, //valid_children: '+p[ph]', //custom_elements: 'ph', //extended_valid_elements: 'span[class,style,title],div[class,style,title]', document_base_url: window.location.origin + '/', //file_picker_callback: function (callback, value, meta) { // if (meta.filetype === 'image') { // $nkit.imageFilePicker(callback, value, meta); // } //}, content_style: 'ph:before {content: \'«\'; color: #BBB; font-style:italic; } ph:after {content: \'»\'; color: #BBB; font-style:italic; } ph { color: #AAA; font-style:italic; }', relative_urls: false, remove_script_host: false, //plugins: ($nkit.nkit_custMCE_plugins || []).join(' ') }; if (bool(options.hidemenu, false) === true) { sets.menubar = false; sets.menu = {}; } if (bool(options.hidetoolbar, false) === true) { sets.toolbar = false } $.extend(sets, options || {}); /* merge options into settings -> allows to overwrite these defaults */ tinymce.init(sets); } catch (e) { alert(e.message); } }; $ocms.dlgform = function (flds, options) { options = options || {}; let gf1 = $$.dc('frm').append($ocms.mform(flds || []).addClass('stacked')); if (options.addcontent instanceof jQuery) { gf1.append(options.addcontent); } let cfm; if (typeof options.submit === 'function') { cfm = options.submit; } else if (typeof options.success === 'function') { cfm = function (e) { var c = $(this).ldng(1); var qs = $.extend({ loginaccount: $ocms.auth.account || '' }, c.serializeObject(bool(options.checkvalidity, true), { typedvalues: bool(options.typedvalues, false) })); if ((options.url || '') !== ''){ $ocms.postXT({ url: options.url, data: qs, success: function (response) { options.success.call(this, response); c.trigger('modal_close'); }, error: function () { alert($t.l17); }, complete: function () { c.ldng(0); }, timeout: 60000 }); } else { options.success.call(this, qs); c.trigger('modal_close'); } }; } let opt = { form: true, title: options.title || '', button: options.button || $t.submit, confirm: cfm, size: options.size || [500, 600], open: function () { let c = $(this); let tinys = c.find('.tinymce'); if (tinys.length > 0) { $ocms.initMCE(tinys, options.tinymce || {}); } } }; let d = $ocms.dlg.call(this, gf1, opt); return d; }; $ocms.login.dlg = function (options) { options = options || {}; let flds = [ { name: 'userinfo', label: $t.l1, type: 'string', value: $ocms.auth.login, change: $ocms.login.uichange, required: true }, { name: 'userlogin', type: 'hidden', required: true, value: $ocms.auth.login }, { name: 'username', type: 'string', label: $t.l4, required: true, readonly: true, placeholder: $t.l5, value: $ocms.auth.fullname_rev }, { name: 'userpass', type: 'password', label: $t.l3, required: true, placeholder: $t.l3 }, ]; if (($ocms.auth.account || '') === '') { flds.unshift({ id: 'dlg_loginaccount', name: 'loginaccount', type: 'string', required: true, value: $ocms.auth.account }); } let gf1 = $$.dc('frm').append($ocms.mform(flds).addClass('stacked')); let f_submit = function (e) { var c = $(this).ldng(1); var qs = $.extend({ loginaccount: $ocms.auth.account || '' }, c.serializeObject()); $ocms.postXT({ url: '/vt/login', data: qs, success: function (response) { if (((response || {}).login || '') !== '') { c.trigger('modal_close'); $ocms.auth = response; /* try to resend the rejected post*/ if (typeof options.ajo === 'object') { options.ajo.islogin === true; /* prevent loop */ $.ajax(options.ajo); } } }, error: function () { alert($t.l17); }, complete: function () { c.ldng(0); }, timeout: 60000 }); }; let d = $ocms.dlg.call(this, gf1, { form: true, title: $t.l0, button: $t.submit, confirm: f_submit, size: [500, 600] }); let ah = $$.dc('modal-content').css('height', 'auto').attr('novalidate', 'true').append($$.dc('modal-header').appendIf($('

    ').text($ocms.auth.accountname), ($ocms.auth.accountname || '') !== '').append($('

    Vereinsmanager

    '))); d.dlg.prepend(ah); }; $ocms.addNoEntryInfo = function (txt) { $(this).append($$.dc('noentryinfo').text(txt || $t.t11)); }; })($ocms); if (!Element.prototype.matches) { Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; } if (!Element.prototype.closest) { Element.prototype.closest = function (s) { var el = this; do { if (Element.prototype.matches.call(el, s)) return el; el = el.parentElement || el.parentNode; } while (el !== null && el.nodeType === 1); return null; }; } (function (name, factory) { if (typeof window === "object") { // add to window window[name] = factory(); // add jquery plugin, if available if (typeof jQuery === "function") { jQuery.fn[name] = function (options) { return this.each(function () { new window[name](this, options); }); }; } } })("Sortable", function () { // get position of mouse/touch in relation to viewport var getPoint = function (e) { var _w = window, _b = document.body, _d = document.documentElement; var scrollX = Math.max(0, _w.pageXOffset || _d.scrollLeft || _b.scrollLeft || 0) - (_d.clientLeft || 0), scrollY = Math.max(0, _w.pageYOffset || _d.scrollTop || _b.scrollTop || 0) - (_d.clientTop || 0), pointX = e ? (Math.max(0, e.pageX || e.clientX || 0) - scrollX) : 0, pointY = e ? (Math.max(0, e.pageY || e.clientY || 0) - scrollY) : 0; return { x: pointX, y: pointY }; }; // class constructor var Factory = function (container, options) { if (container && container instanceof Element) { this._container = container; this._options = options || {}; /* nothing atm */ this._clickItem = null; this._dragItem = null; this._showDragItem = (typeof this._options.dragItem === 'boolean' && this._options.dragItem === false) ? false : true; this._hovItem = null; this._sortLists = []; this._click = {}; this._dragging = false; this._dragHandleClass = this._options.dragHandleClass || ''; this._parentident = this._options.parentident || ''; this._swapdone = typeof this._options.swapdone === "function" ? this._options.swapdone : null; this._onend = typeof this._options.onend === "function" ? this._options.onend : null; this._container.setAttribute("data-is-sortable", 1); this._container.classList.add("sortable"); this._container.style["position"] = "static"; window.addEventListener("mousedown", this._onPress.bind(this), true); window.addEventListener("touchstart", this._onPress.bind(this), true); window.addEventListener("mouseup", this._onRelease.bind(this), true); window.addEventListener("touchend", this._onRelease.bind(this), true); window.addEventListener("mousemove", this._onMove.bind(this), true); window.addEventListener("touchmove", this._onMove.bind(this), true); } }; // class prototype Factory.prototype = { constructor: Factory, // serialize order into array list toArray: function (attr) { attr = attr || "id"; var data = [], item = null, uniq = ""; for (var i = 0; i < this._container.children.length; ++i) { item = this._container.children[i], uniq = item.getAttribute(attr) || ""; uniq = uniq.replace(/[^0-9]+/gi, ""); data.push(uniq); } return data; }, // serialize order array into a string toString: function (attr, delimiter) { delimiter = delimiter || ":"; return this.toArray(attr).join(delimiter); }, // checks if mouse x/y is on top of an item _isOnTop: function (item, x, y) { var box = item.getBoundingClientRect(), isx = (x > box.left && x < (box.left + box.width)), isy = (y > box.top && y < (box.top + box.height)); return (isx && isy); }, // manipulate the className of an item (for browsers that lack classList support) _itemClass: function (item, task, cls) { var list = item.className.split(/\s+/), index = list.indexOf(cls); if (task === "add" && index == -1) { list.push(cls); item.className = list.join(" "); } else if (task === "remove" && index != -1) { list.splice(index, 1); item.className = list.join(" "); } }, // swap position of two item in sortable list container _swapItems: function (item1, item2) { var parent1 = item1.parentNode, parent2 = item2.parentNode; if (item2.className.indexOf('nosort') < 0) { if (parent1 !== parent2) { // move to new list parent2.insertBefore(item1, item2); } else { // sort is same list var temp = document.createElement("div"); parent1.insertBefore(temp, item1); parent2.insertBefore(item1, item2); parent1.insertBefore(item2, temp); parent1.removeChild(temp); } if (typeof this._swapdone === 'function') { this._swapdone(parent1, parent2, item1, item2); } } }, // update item position _moveItem: function (item, x, y) { item.style["-webkit-transform"] = "translateX( " + x + "px ) translateY( " + y + "px )"; item.style["-moz-transform"] = "translateX( " + x + "px ) translateY( " + y + "px )"; item.style["-ms-transform"] = "translateX( " + x + "px ) translateY( " + y + "px )"; item.style["transform"] = "translateX( " + x + "px ) translateY( " + y + "px )"; }, // make a temp fake item for dragging and add to container _makeDragItem: function (item) { this._trashDragItem(); this._sortLists = document.querySelectorAll("[data-is-sortable]"); this._clickItem = item; this._itemClass(this._clickItem, "add", "sortactive"); this._dragItem = document.createElement(item.tagName); this._dragItem.className = "dragging"; this._dragItem.innerHTML = item.innerHTML; this._dragItem.style["position"] = "absolute"; this._dragItem.style["z-index"] = "999"; this._dragItem.style["left"] = (item.offsetLeft || 0) + "px"; this._dragItem.style["top"] = (item.offsetTop || 0) + "px"; this._dragItem.style["width"] = (item.offsetWidth || 0) + "px"; if (this._showDragItem === true) { this._container.appendChild(this._dragItem); } }, // remove drag item that was added to container _trashDragItem: function () { if (this._dragItem && this._clickItem) { this._itemClass(this._clickItem, "remove", "sortactive"); this._clickItem = null; if (this._showDragItem === true) { this._container.removeChild(this._dragItem); } this._dragItem = null; } }, // on item press/drag _onPress: function (e) { if (!e) { return; } function op(tgt) { if (tgt && tgt.parentNode === this._container && (this._dragHandleClass === '' || e.target.className.indexOf(this._dragHandleClass) > -1) && tgt.className.indexOf("nosort") < 0) { e.preventDefault(); this._dragging = true; this._click = getPoint(e); this._makeDragItem(tgt); this._onMove(e); return true; } else { return false; } } if (op.call(this, e.target) === false && this._parentident !== '' && e.target.closest(this._parentident)) { op.call(this, e.target.closest(this._parentident)) } }, // on item release/drop _onRelease: function (e) { // Was THIS list mid-drag? (mouseup fires on every instance's window listener.) var wasDragging = this._dragging === true && this._clickItem !== null; this._dragging = false; this._trashDragItem(); // Fire a single "drag finished" callback so callers can commit the new order once, // reliably, on drop — rather than relying on the per-hover _swapdone during the drag. if (wasDragging && typeof this._onend === 'function') { this._onend(); } }, // on item drag/move _onMove: function (e) { if (this._dragItem && this._dragging) { e.preventDefault(); var point = getPoint(e); var container = this._container; // drag fake item if (this._showDragItem === true) { this._moveItem(this._dragItem, (point.x - this._click.x), (point.y - this._click.y)); } // keep an eye for other sortable lists and switch over to it on hover for (var a = 0; a < this._sortLists.length; ++a) { var subContainer = this._sortLists[a]; if (this._isOnTop(subContainer, point.x, point.y)) { container = subContainer; } } // container is empty, move clicked item over to it on hover if (this._isOnTop(container, point.x, point.y) && container.children.length === 0) { container.appendChild(this._clickItem); return; } // check if current drag item is over another item and swap places for (var b = 0; b < container.children.length; ++b) { var subItem = container.children[b]; if (subItem === this._clickItem || subItem === this._dragItem) { continue; } if (this._isOnTop(subItem, point.x, point.y)) { this._hovItem = subItem; if (subItem.className.indexOf('nosort') < 0) { this._dragItem.className = this._dragItem.className.replace(/\bnotgt\b/g, ''); this._swapItems(this._clickItem, subItem); } else { var arr = this._dragItem.className.split(' '); if (arr.indexOf('notgt') === -1) { this._dragItem.className += ' notgt'; } } } } } }, }; // export return Factory; }); //// helper init function //initSortable(list) { // var listObj = $(list); // var sortable = []; // listObj.each(function (i, d) { // sortable.push(new Sortable(d)); // }); //} (function ($) { $.fn.draggable = function (controlelement) { var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0; var elmnt = $(this), ce = controlelement instanceof jQuery ? controlelement : elmnt.find(controlelement); function dragMouseDown(e) { e.stopPropagation(); e.preventDefault(); // get the mouse cursor position at startup: pos3 = e.clientX; pos4 = e.clientY; document.onmouseup = closeDragElement; // call a function whenever the cursor moves: document.onmousemove = elementDrag; } function elementDrag(e) { e = e || window.event; e.preventDefault(); // calculate the new cursor position: pos1 = pos3 - e.clientX; pos2 = pos4 - e.clientY; pos3 = e.clientX; pos4 = e.clientY; // set the element's new position: elmnt.css('top', (elmnt.offset().top - pos2) + 'px'); elmnt.css('left', (elmnt.offset().left - pos1) + 'px'); } function closeDragElement() { // stop moving when mouse button is released: document.onmouseup = null; document.onmousemove = null; } if (typeof controlelement !== 'undefined' && ce.length > 0) { ce.mousedown(dragMouseDown).addClass('dctrl'); } else { elmnt.mousedown(dragMouseDown).addClass('dctrl'); } return $(this); } })(jQuery); $(document).ready(function () { $('html').click(function (e) { $nuf(); }); $('#listframe').click(function (e) { e.stopPropagation(); $nuf(); }); $('#mainmenu').ocmsmenu($ocms.ocmsmenu); $('#mainmenu').activatemenu(); //$ocms.init('cal'); }); $.extend($t, { m_inv: 'Rechnungen' , m_req: 'Aufträge' , m_rep: 'Berichte' , m_todo: 'ToDos' , m_bcd: 'BankBuchungen' , rsp: 'Passwort ändern' , pnm: 'Die Passwörter stimmen nicht überein' , cps: 'Das neue Passwort wurde gespeichert.' , pwr: 'Bitte wählen Sie ein starkes Passwort (min 8 Zeichen, davon jeweils min 2 Zahlen, kleine und große Buchstaben, Sonderzeichen sind optional).' , smsc: 'Sie beötigen für diese Funktion einen SMS-Code.\nSoll dieser nun versandt werden?' , wdc: 'Doppelt klicken, um die Box zu aktualisieren.' , wdg: {} }); $t.rspf = { sms: 'Der SMS-Code konnte nicht bestätigt werden', valid: 'Das alte Passwort ist nicht korrekt', requirements: 'Das Passwort entspricht nicht den Anforderungen.\n' + $t.pwr} $fd = { rsp: new fields_definition('', '', [ { name: 'opw', label: 'aktuelles Passwort', type: 'password', required: true, attr: { 'auto-complete': 'current-password' }} , { name: 'npw', label: 'neues Passwort', type: 'password', required: true, pattern: '(.{6,})', attr: { 'auto-complete': 'new-password' }} , { name: 'npwc', label: 'neues Passwort (Bestätigung)', type: 'password', required: true, attr: { 'auto-complete': 'new-password' }, note: $t.pwr} , { name: 'code', label: 'SMS-Code', type: 'string', required: true, attr: { 'auto-complete': 'one-time-code' }} ]) }; $ocms.init = function (ev) { var mdl = typeof ev === 'string' ? ev : ((ev.data || {}).fn || ''); if (mdl === '') { return; } else if (mdl === 'home') { $cfr(); $lfr(); $('#topbar').ocmsmenu([], true); $('#activemodule').text($t.ov); $fis.ov(); } else { $cfr(); $lfr(); $('#topbar').ocmsmenu([]); $ocms.postXT({ url: $ocms.url(mdl + '/auth'), success: function (auth) { if (typeof $ocms[mdl] === 'undefined') { $ocms[mdl] = {}; } $ocms[mdl].auth = auth; if (auth.manage > 0) { $ocms.getScript({ module: mdl, script: ['/web/fis', mdl, $ocms.auth.locale || 'de', 'js'].join('.'), css: ['/web/fis', mdl, 'css'].join('.'), condition: typeof $ocms[mdl].init2 !== 'function' }, function () { $ocms[mdl].init2(); }); } }, error: function () { $('#contentframe').empty(); } }); } }; var $fis = { auth: {} }; $fis.db = function () { $('#mainmenu_activemodule').text($t.ov); let cf = $(this).empty(), ovf = $$.d({ id: 'dashboard_frame' }).appendTo(cf); $ocms.postXT({ url: $ocms.url('wdg/my'), success: function (wx) { $.each(wx, function (ii, wi) { var wf = $$.dc('wdg_frame', ovf, { 'data-wdg': wi }).ldng(1); $ocms.wdg.call(wf, { wdg: wi }); }); }, loading: ovf }); }; $fis.ValidateEmail = function (mail) { if (/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(mail)) { return true; } else { return false; } }; $fis.cf = (reset) => { let cf = $('#contentframe'); if (bool(reset, false) === true) { cf.empty().rC('hd'); } return cf; } $fis.lf = (reset) => { let lf = $('#listframe'); if (bool(reset, false) === true) { lf.empty().aC('hd').rC('fix'); } return lf; }; $fis.frm_edit = function (resethd) { let cf = $fis.cf(false), cf2 = cf.children('.cfrm'), edf = cf.children('.edit_frm'); if (cf2.length < 1) { cf2 = $$.dc('cfrm hd').prependTo(cf); } else if (bool(resethd, false) === true) { cf2.empty(); } if (edf.length < 1) { edf = $$.dc('edit_frm').insertAfter(cf2); //must be before list } return edf.empty(); }; $fis.frm_list = function (resethd, remedit) { let cf = $fis.cf(false), cf2 = cf.children('.cfrm'), lf = cf.children('.list_frm'); if (cf2.length < 1) { cf2 = $$.dc('cfrm hd').prependTo(cf); } else if (bool(resethd, false) === true) { cf2.empty(); } if (bool(remedit, false) === true) { cf.children('.edit_frm').remove(); } if (lf.length < 1) { lf = $$.dc('list_frm').appendTo(cf); //must be after list } return lf.empty(); }; $fis.lfm = () => { let lf = $fis.lf(false) , h = lf.children('.lfrm'); if (h.length < 1) { h = $$.dc('lfrm').prependTo(lf); } return h; }; $fis.getAuth = (module, force) => { return new Promise((resolve, reject) => { if ($fis.auth[module] && bool(force, false) === false) { resolve($fis.auth[module] || -1); } else { $ocms.postXT({ url: $ocms.url('auth'), data: { module: module }, success: (response) => { $fis.auth[module] = response.auth || -1; resolve($fis.auth[module] || -1); }, error: () => { reject(); } }); } }); }; $fis.prepAuth = (modules) => { return new Promise((resolve, reject) => { $ocms.postXT({ url: $ocms.url('auth'), data: { module: modules, array: 1 }, success: (response) => { $.extend($fis.auth, response || {}); }, complete: () => { resolve(); } }); }); }; $fis.isAuth = (module, min) => { return ($fis.auth[module] || -1) >= (min || 1); }; $fis.resetPass = function (id, fds) { if (confirm($t.smsc)) { $ocms.postXT({ url: $ocms.url('account/sms'), data: { fn: 'pwc'} }); $ocms.dlgform($fd.rsp.clone(), { title: $t.rsp || '', submit: function (e) { var c = $(this).ldng(1); var qs = $.extend({ loginaccount: $ocms.auth.account || '' }, c.serializeObject(true, { typedvalues: true })); if ((qs.npw || '') !== (qs.npwc || '')) { c.find('input[name="npw"]:first')[0].setCustomValidity($t.pnm); } else { $ocms.postXT({ url: $ocms.url('account/changepassword'), data: qs, success: function (response) { alert($t.cps); c.trigger('modal_close'); }, error: function (x) { alert($t.rspf[x.getResponseHeader('x-ocms-std')]); }, complete: function () { c.ldng(0); }, timeout: 60000 }); } } }); } }; $fis.wdg = function (options) { let wf = $(this).empty(); $ocms.postXT({ url: $ocms.url('wdg/one'), data: { short_name: options.wdg }, timeout: 90000, success: function (response, textStatus, jqXHR) { let wi = options.wdg, wx = response[wi]; if (!wx) { wf.ldng(0); return; } let dbl = $.inArrayRegEx('dblwidth', wx.rendering_options) > -1, tiny = $.inArrayRegEx('tiny', wx.rendering_options) > -1; wf.toggleClass('dbl', dbl && !tiny).toggleClass('tny', tiny); let whd = $$.dc('wdg_hd', wf, { title: ne(wx.description, $t.wdc) }).toggleClass('dbl', dbl).text(ne(wx.name, options.wdg)).dblclick(function (ev) { ev.stopPropagation(); $fis.wdg.call(wf, { wdg: wi }); }); let wct = $$.dc('wdg_cnt', wf).toggleClass('dbl', dbl).hide(); let bgcolix = $.inArrayRegEx('bgcolor', wx.rendering_options); if (bgcolix > -1) { wct.css('backgroundColor', wx.rendering_options[bgcolix].toString().right(':')); } switch (wx.type) { case 'table': var tblset = $$.tblset({}, wct); var thr = $$.tr().appendTo(tblset.hd); var $cc = $t.wdg[wi.indexOf('wdg_ev_') >= 0 ? 'wdg_ev_' : wi] || {}; $.each(wx.columns, function (ci, col) { var cc = (!$cc[col]) ? col : $cc[col].label; var thc = $$.th().text(cc).appendTo(thr); }); $.each(wx.data, function (di, dx) { var tdr = $$.tr().appendTo(tblset.bdy); $.each(wx.columns, function (ci, col) { var tdc = $$.td().appendTo(tdr); if (dx[col] instanceof Date || $ocms.isJSONDateString(dx[col]) === true) { tdc.text(fdt(dx[col], $t.dateformat)); } else { tdc.rwText(dx[col]); } }); //if (dx.person_guid || false) { tdr.addClass('clickable').dblclick($.proxy($fis.i_vmm, tdr, dx.person_guid[1])); } }); if ($.inArray('firstrow_bold', wx.rendering_options) > -1) { thr.nextAll('tr:first').css('font-weight', 'bold'); } break; case 'ind': $$.dc('ind', wct).addClass('sts_' + (wx.data.status || '')).append([$$.dc('ind').text(wx.data.value), $$.lbl(wx.data.label)]); break; case 'image_url': wct.css('background', 'url(\'' + wx.url + '\') no-repeat center center transparent'); break; case 'image_base64': wct.css('background', 'url(\'data:image/png;base64,' + wx.image + '\') no-repeat center center transparent'); break; case 'html': wct.html(wx.html); if ($.inArray('reload_10min', wx.rendering_options) > -1) { var ifr = wct.find('iframe'); setTimeout(function () { ifr.attr('src', function (i, val) { return val; }); }, (10 * 60 * 1000)); } break; default: } if ($.inArray('reload_30min', wx.rendering_options) > -1 && wx.type !== 'html') { setTimeout(function () { $fis.wdg.call(wf, { wdg: wi }); }, (30 * 60 * 1000)); } wct.slideDown(150); }, error: function (jqXHR) { wf.slideUp(150); $fis.failure.call(this, jqXHR); }, complete: function () { wf.ldng(0); } }); }; $fis.ov = function () { //$('#mainmenu_activemodule').text(""); $fis.lf(true); let cf = $('#contentframe').empty(), ovf = $$.d({ id: 'dashboard_frame' }).appendTo(cf); $ocms.postXT({ url: $ocms.url('wdg/my'), success: function (wx) { $.each(wx, function (ii, wi) { var wf = $$.dc('wdg_frame', ovf, { 'data-wdg': wi }).ldng(1); $fis.wdg.call(wf, { wdg: wi }); }); }, loading: ovf }); }; $fis.notifications = { connection: null, init: function () { if (typeof signalR === 'undefined' || this.connection !== null || !$ocms.auth.useraccount_id) { return; } this.ensureFrame(); this.connection = new signalR.HubConnectionBuilder() .withUrl('/notifications') .withAutomaticReconnect() .build(); this.connection.on('notification', (notification) => { this.push(notification); }); // withAutomaticReconnect() only retries a connection that was successfully // established and later dropped — it does not retry a failed initial start() // (e.g. the server restarting mid-debug). Without this, a single failed start() // silently blackholes every notification for the rest of the page's lifetime. this.connection.onclose(() => { console.warn('Notification connection closed; retrying in 5s.'); this.connection = null; setTimeout(() => this.init(), 5000); }); this.start(); }, start: function () { this.connection.start().catch((err) => { console.warn('Notification connection failed to start; retrying in 5s.', err); this.connection = null; setTimeout(() => this.init(), 5000); }); }, ensureFrame: function () { if ($('#notification_frame').length < 1) { $('
    ', { id: 'notification_frame' }).appendTo($('footer:first').length ? 'footer:first' : 'body'); } }, push: function (notification) { this.ensureFrame(); notification = notification || {}; let item = $('
    ', { class: 'notification_item' }) .addClass((notification.severity || 'info').toLowerCase()) .append($('