@olenbetong/appframe-core 2.3.1 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -435,7 +435,7 @@ function saveSettings(setting, value, article) {
435
435
  }
436
436
 
437
437
  // src/index.ts
438
- var version = "2.3.1";
438
+ var version = "2.3.2";
439
439
  export {
440
440
  SessionHandler,
441
441
  UserSession,
@@ -462,7 +462,7 @@ function saveSettings(setting, value, article) {
462
462
  }
463
463
 
464
464
  // src/index.ts
465
- var version = "2.3.1";
465
+ var version = "2.3.2";
466
466
  export {
467
467
  SessionHandler,
468
468
  UserSession,
@@ -1,2 +1,2 @@
1
- var N=Object.defineProperty;var A=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var m=(t,e,n)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,I=(t,e)=>{for(var n in e||(e={}))U.call(e,n)&&m(t,n,e[n]);if(A)for(var n of A(e))H.call(e,n)&&m(t,n,e[n]);return t};var a=(t,e,n)=>(m(t,typeof e!="symbol"?e+"":e,n),n);window.addEventListener("error",t=>{var e,n,r,o,i,l,s;try{let d={error:(r=(n=(e=t.error)==null?void 0:e.message)!=null?n:t.message)!=null?r:null,file:t.filename,line:(o=t.lineno)!=null?o:0,column:(i=t.colno)!=null?i:0,stack:(s=(l=t.error)==null?void 0:l.stack)!=null?s:null};fetch("/data/Logger/LogError",{body:JSON.stringify(d),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"})}catch(d){}});function p(t){return{all:t=t||new Map,on:function(e,n){var r=t.get(e);r?r.push(n):t.set(e,[n])},off:function(e,n){var r=t.get(e);r&&(n?r.splice(r.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var r=t.get(e);r&&r.slice().map(function(o){o(n)}),(r=t.get("*"))&&r.slice().map(function(o){o(e,n)})}}}var u=class{constructor(){a(this,"eventHandler",p())}authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(e,n){try{let r=new Promise(i=>{let l=()=>{this.eventHandler.off("onAuthenticated",l),e==null||e(),i()};this.eventHandler.on("onAuthenticated",l)}),o=document.querySelector("dialog.session-expired-dialog");if(o)await r;else{o=document.createElement("dialog"),o.className="session-expired-dialog",o.style.display="flex",o.style.padding="0",o.style.left="50%",o.style.transform="translateX(-50%)";let i="/login?ReturnUrl=%2fapi/sessionexpired/remove";n!=="RequireTwoFactor"?await fetch("/logout",{method:"POST"}):i="/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove",o.innerHTML=`<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="${i}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(o),o.showModal(),await r,o.remove()}}catch(r){window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(e,n){return this.eventHandler.on(e,n)}detachEvent(e,n){return this.eventHandler.off(e,n)}};var y=class extends u{constructor(n){super();a(this,"amDesignator","a.m.");a(this,"dayNames",["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]);a(this,"dayNamesShort",["sun","mon","tue","wed","thu","fri","sat"]);a(this,"decimalSeparator",".");a(this,"domain","OB");a(this,"email");a(this,"formats");a(this,"groupSeparator",null);a(this,"integratedSecurity",!1);a(this,"isDeveloper",!1);a(this,"login","");a(this,"loginType");a(this,"monthNames",["january","february","march","april","may","june","july","august","september","october","november","december",""]);a(this,"monthNamesShort",["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""]);a(this,"name");a(this,"pmDesignator","p.m.");a(this,"shortDateFormat","dd.MM.yyyy");a(this,"culture","en-GB");a(this,"uiculture","en-GB");this.formats={},Object.assign(this,n)}};function Y(t){return D(t).substring(0,10)}function D(t){let e=new Date(t);return e.setUTCFullYear(t.getFullYear()),e.setUTCMonth(t.getMonth()),e.setUTCDate(t.getDate()),e.setUTCHours(t.getHours()),e.setUTCMinutes(t.getMinutes()),e.toISOString().replace("Z","")}function h(t,e){return new Promise(function(n,r){try{let o=URL.createObjectURL(t),i=document.body,l=document.createElement("a");l.setAttribute("download",e),l.href=o,i.append(l),l.click(),i.removeChild(l),setTimeout(function(){URL.revokeObjectURL(o),n()},250)}catch(o){r(o)}})}async function ne(t,{fileName:e,signal:n,onProgress:r}){var l;function o(s){typeof r=="function"&&r(I({},s))}let i=0;o({status:"requested"});try{let s=await fetch(t);if(!s.ok||!s.body){if((l=s.headers.get("content-type"))!=null&&l.includes("application/json")){let c=await s.json();if(c.error)throw new Error(c.error)}throw new Error(`${s.status} ${s.statusText}`)}try{let c=s.body.getReader(),$=new ReadableStream({start:function(v){function z(){return c.read().then(function(g){if(g.done){v.close();return}return i+=g.value.length,o({bytesReceived:i,status:"downloading"}),v.enqueue(g.value),z()})}return z()}});s=new Response($)}catch(c){}let d=await s.blob();o({bytesReceived:i,status:"downloaded"}),await h(d,e),o({bytesReceived:i,status:"completed"})}catch(s){n!=null&&n.aborted?o({status:"cancelled"}):o({error:s.message,status:"error"})}}function f(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var _=/^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;function w(t){var e=t.toString().match(_);if(e===null)throw new TypeError("Unable to parse function!");return{name:e[1],args:e[2].split(","),body:e[3]}}function L(){}L.prototype=Object.create(null);var R=L;function x(t,e){if(typeof t=="object"){if(typeof e=="string"){let n=e.split(".");return x(t,n)}else if(Array.isArray(e)){let n=t;for(let r=0;r<e.length;r++)n=n[e[r]]=n[e[r]]||new R;return n}}}function j(t,e){if(arguments.length!==2)throw new Error("Incorrect number of arguments passed to the expose function!");if(Array.isArray(e))for(let n of e){let{name:r}=w(n);if(r)j(t,n);else throw new Error("Unable to detect name of function! Name it, or only supply one function and include name in first parameter.")}else{let n,r;if(typeof e=="function"&&(n=w(e).name),typeof t=="string"){let o=t.split(".");n||(n=o[o.length-1],o=o.slice(0,o.length-1)),r=x(window,o)}else if(n&&(typeof t=="object"||typeof t=="function"))r=t;else throw new TypeError("Invalid typeof parameter 'name', or unable to parse pValue!");f(r,n)?console.warn([t,n].join(".")+" is already defined!"):r[n]=e}}var q={xs:64,sm:128,md:256,lg:512,xl:void 0};function M(t,e,n,r="xs"){if(t&&typeof t=="object")return M(t.primKey,t.login,t.hash,t.size);if(!t||!n)return"";let o=q[r];return`/api/data/blob/EmployeesLookup/${t}/Image/${e}${e?".":""}${n}.jpg${o?`?width=${o}`:""}`}async function P(t){try{let e=await fetch(`/api/user/localize/new/${af.article.id}`,{body:JSON.stringify({text:t}),headers:{Accept:"application/json; */*","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},method:"POST"});if(e.ok)return await e.json()}catch(e){}return t}function S(t,e){var n;if(typeof t=="string"&&t.trim().length===0)return t;if(!(t===void 0||t===""||t===null))if(((n=af==null?void 0:af.article)==null?void 0:n.i18n)!==void 0){if(!f(af.article.i18n,t)){af.article.i18n[t]=t;let r=P(t).then(o=>(af.article.i18n[t]=o,o));if(e)return r}return af.article.i18n[t]}else return t}function C(t,...e){if(!Array.isArray(t)||t.length!==e.length+1)throw TypeError("Method 'localize' must be used as a tag function");let n=t.map((o,i)=>i===t.length-1?o:`${o}$${i}`).join(""),r=S(n);return e.forEach((o,i)=>{r=r.replace("$"+i,o)}),r}function T(t){var e;return[((e=af==null?void 0:af.article)==null?void 0:e.id)||"","common",t].join(".")}var b=class{isPersisted(){return!0}getLocalStorageKey(e,n){return n?["common",e].join("."):T(e)}get(e,n,r){let o=this.getLocalStorageKey(e,r),i=localStorage.getItem(o);return i!==null?JSON.parse(i):n}set(e,n,r){localStorage.setItem(this.getLocalStorageKey(e,r),JSON.stringify(n))}remove(e,n){let r=this.getLocalStorageKey(e,n);return localStorage.getItem(r)!==null?(localStorage.removeItem(r),!0):!1}clear(){let e=T("");for(let n in localStorage)n.slice(0,e.length)===e&&localStorage.removeItem(n)}},O=new b;function E(t){return`${t||af.article.id}.${af.userSession.login}`}function Se(t,e){if(!(af!=null&&af.userSession))return null;let n=E(e),r=JSON.parse(localStorage.getItem(n)||"{}");return t?r[t]||null:r}function be(t,e,n){if(!(af!=null&&af.userSession))return;let r=E(n),o=JSON.parse(localStorage.getItem(r)||"{}");typeof e<"u"?o[t]=e:o=t,localStorage.setItem(r,JSON.stringify(o))}var Ie="2.3.1";export{u as SessionHandler,y as UserSession,h as downloadBlob,ne as downloadRequest,j as expose,S as getLocalizedString,Se as getSettings,M as getUserImage,f as has,O as localStorage,C as localize,p as mitt,be as saveSettings,Y as toLocalISODate,D as toLocalISODateTime,Ie as version};
1
+ var N=Object.defineProperty;var A=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var m=(t,e,n)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,I=(t,e)=>{for(var n in e||(e={}))U.call(e,n)&&m(t,n,e[n]);if(A)for(var n of A(e))H.call(e,n)&&m(t,n,e[n]);return t};var a=(t,e,n)=>(m(t,typeof e!="symbol"?e+"":e,n),n);window.addEventListener("error",t=>{var e,n,r,o,i,l,s;try{let d={error:(r=(n=(e=t.error)==null?void 0:e.message)!=null?n:t.message)!=null?r:null,file:t.filename,line:(o=t.lineno)!=null?o:0,column:(i=t.colno)!=null?i:0,stack:(s=(l=t.error)==null?void 0:l.stack)!=null?s:null};fetch("/data/Logger/LogError",{body:JSON.stringify(d),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"})}catch(d){}});function p(t){return{all:t=t||new Map,on:function(e,n){var r=t.get(e);r?r.push(n):t.set(e,[n])},off:function(e,n){var r=t.get(e);r&&(n?r.splice(r.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var r=t.get(e);r&&r.slice().map(function(o){o(n)}),(r=t.get("*"))&&r.slice().map(function(o){o(e,n)})}}}var u=class{constructor(){a(this,"eventHandler",p())}authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(e,n){try{let r=new Promise(i=>{let l=()=>{this.eventHandler.off("onAuthenticated",l),e==null||e(),i()};this.eventHandler.on("onAuthenticated",l)}),o=document.querySelector("dialog.session-expired-dialog");if(o)await r;else{o=document.createElement("dialog"),o.className="session-expired-dialog",o.style.display="flex",o.style.padding="0",o.style.left="50%",o.style.transform="translateX(-50%)";let i="/login?ReturnUrl=%2fapi/sessionexpired/remove";n!=="RequireTwoFactor"?await fetch("/logout",{method:"POST"}):i="/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove",o.innerHTML=`<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="${i}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(o),o.showModal(),await r,o.remove()}}catch(r){window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(e,n){return this.eventHandler.on(e,n)}detachEvent(e,n){return this.eventHandler.off(e,n)}};var y=class extends u{constructor(n){super();a(this,"amDesignator","a.m.");a(this,"dayNames",["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]);a(this,"dayNamesShort",["sun","mon","tue","wed","thu","fri","sat"]);a(this,"decimalSeparator",".");a(this,"domain","OB");a(this,"email");a(this,"formats");a(this,"groupSeparator",null);a(this,"integratedSecurity",!1);a(this,"isDeveloper",!1);a(this,"login","");a(this,"loginType");a(this,"monthNames",["january","february","march","april","may","june","july","august","september","october","november","december",""]);a(this,"monthNamesShort",["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""]);a(this,"name");a(this,"pmDesignator","p.m.");a(this,"shortDateFormat","dd.MM.yyyy");a(this,"culture","en-GB");a(this,"uiculture","en-GB");this.formats={},Object.assign(this,n)}};function Y(t){return D(t).substring(0,10)}function D(t){let e=new Date(t);return e.setUTCFullYear(t.getFullYear()),e.setUTCMonth(t.getMonth()),e.setUTCDate(t.getDate()),e.setUTCHours(t.getHours()),e.setUTCMinutes(t.getMinutes()),e.toISOString().replace("Z","")}function h(t,e){return new Promise(function(n,r){try{let o=URL.createObjectURL(t),i=document.body,l=document.createElement("a");l.setAttribute("download",e),l.href=o,i.append(l),l.click(),i.removeChild(l),setTimeout(function(){URL.revokeObjectURL(o),n()},250)}catch(o){r(o)}})}async function ne(t,{fileName:e,signal:n,onProgress:r}){var l;function o(s){typeof r=="function"&&r(I({},s))}let i=0;o({status:"requested"});try{let s=await fetch(t);if(!s.ok||!s.body){if((l=s.headers.get("content-type"))!=null&&l.includes("application/json")){let c=await s.json();if(c.error)throw new Error(c.error)}throw new Error(`${s.status} ${s.statusText}`)}try{let c=s.body.getReader(),$=new ReadableStream({start:function(v){function z(){return c.read().then(function(g){if(g.done){v.close();return}return i+=g.value.length,o({bytesReceived:i,status:"downloading"}),v.enqueue(g.value),z()})}return z()}});s=new Response($)}catch(c){}let d=await s.blob();o({bytesReceived:i,status:"downloaded"}),await h(d,e),o({bytesReceived:i,status:"completed"})}catch(s){n!=null&&n.aborted?o({status:"cancelled"}):o({error:s.message,status:"error"})}}function f(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var _=/^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;function w(t){var e=t.toString().match(_);if(e===null)throw new TypeError("Unable to parse function!");return{name:e[1],args:e[2].split(","),body:e[3]}}function L(){}L.prototype=Object.create(null);var R=L;function x(t,e){if(typeof t=="object"){if(typeof e=="string"){let n=e.split(".");return x(t,n)}else if(Array.isArray(e)){let n=t;for(let r=0;r<e.length;r++)n=n[e[r]]=n[e[r]]||new R;return n}}}function j(t,e){if(arguments.length!==2)throw new Error("Incorrect number of arguments passed to the expose function!");if(Array.isArray(e))for(let n of e){let{name:r}=w(n);if(r)j(t,n);else throw new Error("Unable to detect name of function! Name it, or only supply one function and include name in first parameter.")}else{let n,r;if(typeof e=="function"&&(n=w(e).name),typeof t=="string"){let o=t.split(".");n||(n=o[o.length-1],o=o.slice(0,o.length-1)),r=x(window,o)}else if(n&&(typeof t=="object"||typeof t=="function"))r=t;else throw new TypeError("Invalid typeof parameter 'name', or unable to parse pValue!");f(r,n)?console.warn([t,n].join(".")+" is already defined!"):r[n]=e}}var q={xs:64,sm:128,md:256,lg:512,xl:void 0};function M(t,e,n,r="xs"){if(t&&typeof t=="object")return M(t.primKey,t.login,t.hash,t.size);if(!t||!n)return"";let o=q[r];return`/api/data/blob/EmployeesLookup/${t}/Image/${e}${e?".":""}${n}.jpg${o?`?width=${o}`:""}`}async function P(t){try{let e=await fetch(`/api/user/localize/new/${af.article.id}`,{body:JSON.stringify({text:t}),headers:{Accept:"application/json; */*","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},method:"POST"});if(e.ok)return await e.json()}catch(e){}return t}function S(t,e){var n;if(typeof t=="string"&&t.trim().length===0)return t;if(!(t===void 0||t===""||t===null))if(((n=af==null?void 0:af.article)==null?void 0:n.i18n)!==void 0){if(!f(af.article.i18n,t)){af.article.i18n[t]=t;let r=P(t).then(o=>(af.article.i18n[t]=o,o));if(e)return r}return af.article.i18n[t]}else return t}function C(t,...e){if(!Array.isArray(t)||t.length!==e.length+1)throw TypeError("Method 'localize' must be used as a tag function");let n=t.map((o,i)=>i===t.length-1?o:`${o}$${i}`).join(""),r=S(n);return e.forEach((o,i)=>{r=r.replace("$"+i,o)}),r}function T(t){var e;return[((e=af==null?void 0:af.article)==null?void 0:e.id)||"","common",t].join(".")}var b=class{isPersisted(){return!0}getLocalStorageKey(e,n){return n?["common",e].join("."):T(e)}get(e,n,r){let o=this.getLocalStorageKey(e,r),i=localStorage.getItem(o);return i!==null?JSON.parse(i):n}set(e,n,r){localStorage.setItem(this.getLocalStorageKey(e,r),JSON.stringify(n))}remove(e,n){let r=this.getLocalStorageKey(e,n);return localStorage.getItem(r)!==null?(localStorage.removeItem(r),!0):!1}clear(){let e=T("");for(let n in localStorage)n.slice(0,e.length)===e&&localStorage.removeItem(n)}},O=new b;function E(t){return`${t||af.article.id}.${af.userSession.login}`}function Se(t,e){if(!(af!=null&&af.userSession))return null;let n=E(e),r=JSON.parse(localStorage.getItem(n)||"{}");return t?r[t]||null:r}function be(t,e,n){if(!(af!=null&&af.userSession))return;let r=E(n),o=JSON.parse(localStorage.getItem(r)||"{}");typeof e<"u"?o[t]=e:o=t,localStorage.setItem(r,JSON.stringify(o))}var Ie="2.3.2";export{u as SessionHandler,y as UserSession,h as downloadBlob,ne as downloadRequest,j as expose,S as getLocalizedString,Se as getSettings,M as getUserImage,f as has,O as localStorage,C as localize,p as mitt,be as saveSettings,Y as toLocalISODate,D as toLocalISODateTime,Ie as version};
2
2
  //# sourceMappingURL=af.common.legacy.min.js.map
@@ -1,2 +1,2 @@
1
- window.addEventListener("error",e=>{try{let t={error:e.error?.message??e.message??null,file:e.filename,line:e.lineno??0,column:e.colno??0,stack:e.error?.stack??null};fetch("/data/Logger/LogError",{body:JSON.stringify(t),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"})}catch{}});function d(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(o){o(n)}),(r=e.get("*"))&&r.slice().map(function(o){o(t,n)})}}}var s=class{eventHandler=d();authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,n){try{let r=new Promise(a=>{let i=()=>{this.eventHandler.off("onAuthenticated",i),t?.(),a()};this.eventHandler.on("onAuthenticated",i)}),o=document.querySelector("dialog.session-expired-dialog");if(o)await r;else{o=document.createElement("dialog"),o.className="session-expired-dialog",o.style.display="flex",o.style.padding="0",o.style.left="50%",o.style.transform="translateX(-50%)";let a="/login?ReturnUrl=%2fapi/sessionexpired/remove";n!=="RequireTwoFactor"?await fetch("/logout",{method:"POST"}):a="/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove",o.innerHTML=`<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="${a}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(o),o.showModal(),await r,o.remove()}}catch{window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(t,n){return this.eventHandler.on(t,n)}detachEvent(t,n){return this.eventHandler.off(t,n)}};var f=class extends s{amDesignator="a.m.";dayNames=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];dayNamesShort=["sun","mon","tue","wed","thu","fri","sat"];decimalSeparator=".";domain="OB";email;formats;groupSeparator=null;integratedSecurity=!1;isDeveloper=!1;login="";loginType;monthNames=["january","february","march","april","may","june","july","august","september","october","november","december",""];monthNamesShort=["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""];name;pmDesignator="p.m.";shortDateFormat="dd.MM.yyyy";culture="en-GB";uiculture="en-GB";constructor(t){super(),this.formats={},Object.assign(this,t)}};function C(e){return R(e).substring(0,10)}function R(e){let t=new Date(e);return t.setUTCFullYear(e.getFullYear()),t.setUTCMonth(e.getMonth()),t.setUTCDate(e.getDate()),t.setUTCHours(e.getHours()),t.setUTCMinutes(e.getMinutes()),t.toISOString().replace("Z","")}function g(e,t){return new Promise(function(n,r){try{let o=URL.createObjectURL(e),a=document.body,i=document.createElement("a");i.setAttribute("download",t),i.href=o,a.append(i),i.click(),a.removeChild(i),setTimeout(function(){URL.revokeObjectURL(o),n()},250)}catch(o){r(o)}})}async function J(e,{fileName:t,signal:n,onProgress:r}){function o(i){typeof r=="function"&&r({...i})}let a=0;o({status:"requested"});try{let i=await fetch(e);if(!i.ok||!i.body){if(i.headers.get("content-type")?.includes("application/json")){let l=await i.json();if(l.error)throw new Error(l.error)}throw new Error(`${i.status} ${i.statusText}`)}try{let l=i.body.getReader(),L=new ReadableStream({start:function(w){function x(){return l.read().then(function(c){if(c.done){w.close();return}return a+=c.value.length,o({bytesReceived:a,status:"downloading"}),w.enqueue(c.value),x()})}return x()}});i=new Response(L)}catch{}let I=await i.blob();o({bytesReceived:a,status:"downloaded"}),await g(I,t),o({bytesReceived:a,status:"completed"})}catch(i){n?.aborted?o({status:"cancelled"}):o({error:i.message,status:"error"})}}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var j=/^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;function m(e){var t=e.toString().match(j);if(t===null)throw new TypeError("Unable to parse function!");return{name:t[1],args:t[2].split(","),body:t[3]}}function b(){}b.prototype=Object.create(null);var S=b;function p(e,t){if(typeof e=="object"){if(typeof t=="string"){let n=t.split(".");return p(e,n)}else if(Array.isArray(t)){let n=e;for(let r=0;r<t.length;r++)n=n[t[r]]=n[t[r]]||new S;return n}}}function v(e,t){if(arguments.length!==2)throw new Error("Incorrect number of arguments passed to the expose function!");if(Array.isArray(t))for(let n of t){let{name:r}=m(n);if(r)v(e,n);else throw new Error("Unable to detect name of function! Name it, or only supply one function and include name in first parameter.")}else{let n,r;if(typeof t=="function"&&(n=m(t).name),typeof e=="string"){let o=e.split(".");n||(n=o[o.length-1],o=o.slice(0,o.length-1)),r=p(window,o)}else if(n&&(typeof e=="object"||typeof e=="function"))r=e;else throw new TypeError("Invalid typeof parameter 'name', or unable to parse pValue!");u(r,n)?console.warn([e,n].join(".")+" is already defined!"):r[n]=t}}var T={xs:64,sm:128,md:256,lg:512,xl:void 0};function E(e,t,n,r="xs"){if(e&&typeof e=="object")return E(e.primKey,e.login,e.hash,e.size);if(!e||!n)return"";let o=T[r];return`/api/data/blob/EmployeesLookup/${e}/Image/${t}${t?".":""}${n}.jpg${o?`?width=${o}`:""}`}async function $(e){try{let t=await fetch(`/api/user/localize/new/${af.article.id}`,{body:JSON.stringify({text:e}),headers:{Accept:"application/json; */*","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},method:"POST"});if(t.ok)return await t.json()}catch{}return e}function y(e,t){if(typeof e=="string"&&e.trim().length===0)return e;if(!(e===void 0||e===""||e===null))if(af?.article?.i18n!==void 0){if(!u(af.article.i18n,e)){af.article.i18n[e]=e;let n=$(e).then(r=>(af.article.i18n[e]=r,r));if(t)return n}return af.article.i18n[e]}else return e}function N(e,...t){if(!Array.isArray(e)||e.length!==t.length+1)throw TypeError("Method 'localize' must be used as a tag function");let n=e.map((o,a)=>a===e.length-1?o:`${o}$${a}`).join(""),r=y(n);return t.forEach((o,a)=>{r=r.replace("$"+a,o)}),r}function z(e){return[af?.article?.id||"","common",e].join(".")}var h=class{isPersisted(){return!0}getLocalStorageKey(t,n){return n?["common",t].join("."):z(t)}get(t,n,r){let o=this.getLocalStorageKey(t,r),a=localStorage.getItem(o);return a!==null?JSON.parse(a):n}set(t,n,r){localStorage.setItem(this.getLocalStorageKey(t,r),JSON.stringify(n))}remove(t,n){let r=this.getLocalStorageKey(t,n);return localStorage.getItem(r)!==null?(localStorage.removeItem(r),!0):!1}clear(){let t=z("");for(let n in localStorage)n.slice(0,t.length)===t&&localStorage.removeItem(n)}},U=new h;function A(e){return`${e||af.article.id}.${af.userSession.login}`}function le(e,t){if(!af?.userSession)return null;let n=A(t),r=JSON.parse(localStorage.getItem(n)||"{}");return e?r[e]||null:r}function ue(e,t,n){if(!af?.userSession)return;let r=A(n),o=JSON.parse(localStorage.getItem(r)||"{}");typeof t<"u"?o[e]=t:o=e,localStorage.setItem(r,JSON.stringify(o))}var ge="2.3.1";export{s as SessionHandler,f as UserSession,g as downloadBlob,J as downloadRequest,v as expose,y as getLocalizedString,le as getSettings,E as getUserImage,u as has,U as localStorage,N as localize,d as mitt,ue as saveSettings,C as toLocalISODate,R as toLocalISODateTime,ge as version};
1
+ window.addEventListener("error",e=>{try{let t={error:e.error?.message??e.message??null,file:e.filename,line:e.lineno??0,column:e.colno??0,stack:e.error?.stack??null};fetch("/data/Logger/LogError",{body:JSON.stringify(t),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"})}catch{}});function d(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(o){o(n)}),(r=e.get("*"))&&r.slice().map(function(o){o(t,n)})}}}var s=class{eventHandler=d();authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,n){try{let r=new Promise(a=>{let i=()=>{this.eventHandler.off("onAuthenticated",i),t?.(),a()};this.eventHandler.on("onAuthenticated",i)}),o=document.querySelector("dialog.session-expired-dialog");if(o)await r;else{o=document.createElement("dialog"),o.className="session-expired-dialog",o.style.display="flex",o.style.padding="0",o.style.left="50%",o.style.transform="translateX(-50%)";let a="/login?ReturnUrl=%2fapi/sessionexpired/remove";n!=="RequireTwoFactor"?await fetch("/logout",{method:"POST"}):a="/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove",o.innerHTML=`<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="${a}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(o),o.showModal(),await r,o.remove()}}catch{window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(t,n){return this.eventHandler.on(t,n)}detachEvent(t,n){return this.eventHandler.off(t,n)}};var f=class extends s{amDesignator="a.m.";dayNames=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];dayNamesShort=["sun","mon","tue","wed","thu","fri","sat"];decimalSeparator=".";domain="OB";email;formats;groupSeparator=null;integratedSecurity=!1;isDeveloper=!1;login="";loginType;monthNames=["january","february","march","april","may","june","july","august","september","october","november","december",""];monthNamesShort=["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""];name;pmDesignator="p.m.";shortDateFormat="dd.MM.yyyy";culture="en-GB";uiculture="en-GB";constructor(t){super(),this.formats={},Object.assign(this,t)}};function C(e){return R(e).substring(0,10)}function R(e){let t=new Date(e);return t.setUTCFullYear(e.getFullYear()),t.setUTCMonth(e.getMonth()),t.setUTCDate(e.getDate()),t.setUTCHours(e.getHours()),t.setUTCMinutes(e.getMinutes()),t.toISOString().replace("Z","")}function g(e,t){return new Promise(function(n,r){try{let o=URL.createObjectURL(e),a=document.body,i=document.createElement("a");i.setAttribute("download",t),i.href=o,a.append(i),i.click(),a.removeChild(i),setTimeout(function(){URL.revokeObjectURL(o),n()},250)}catch(o){r(o)}})}async function J(e,{fileName:t,signal:n,onProgress:r}){function o(i){typeof r=="function"&&r({...i})}let a=0;o({status:"requested"});try{let i=await fetch(e);if(!i.ok||!i.body){if(i.headers.get("content-type")?.includes("application/json")){let l=await i.json();if(l.error)throw new Error(l.error)}throw new Error(`${i.status} ${i.statusText}`)}try{let l=i.body.getReader(),L=new ReadableStream({start:function(w){function x(){return l.read().then(function(c){if(c.done){w.close();return}return a+=c.value.length,o({bytesReceived:a,status:"downloading"}),w.enqueue(c.value),x()})}return x()}});i=new Response(L)}catch{}let I=await i.blob();o({bytesReceived:a,status:"downloaded"}),await g(I,t),o({bytesReceived:a,status:"completed"})}catch(i){n?.aborted?o({status:"cancelled"}):o({error:i.message,status:"error"})}}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var j=/^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;function m(e){var t=e.toString().match(j);if(t===null)throw new TypeError("Unable to parse function!");return{name:t[1],args:t[2].split(","),body:t[3]}}function b(){}b.prototype=Object.create(null);var S=b;function p(e,t){if(typeof e=="object"){if(typeof t=="string"){let n=t.split(".");return p(e,n)}else if(Array.isArray(t)){let n=e;for(let r=0;r<t.length;r++)n=n[t[r]]=n[t[r]]||new S;return n}}}function v(e,t){if(arguments.length!==2)throw new Error("Incorrect number of arguments passed to the expose function!");if(Array.isArray(t))for(let n of t){let{name:r}=m(n);if(r)v(e,n);else throw new Error("Unable to detect name of function! Name it, or only supply one function and include name in first parameter.")}else{let n,r;if(typeof t=="function"&&(n=m(t).name),typeof e=="string"){let o=e.split(".");n||(n=o[o.length-1],o=o.slice(0,o.length-1)),r=p(window,o)}else if(n&&(typeof e=="object"||typeof e=="function"))r=e;else throw new TypeError("Invalid typeof parameter 'name', or unable to parse pValue!");u(r,n)?console.warn([e,n].join(".")+" is already defined!"):r[n]=t}}var T={xs:64,sm:128,md:256,lg:512,xl:void 0};function E(e,t,n,r="xs"){if(e&&typeof e=="object")return E(e.primKey,e.login,e.hash,e.size);if(!e||!n)return"";let o=T[r];return`/api/data/blob/EmployeesLookup/${e}/Image/${t}${t?".":""}${n}.jpg${o?`?width=${o}`:""}`}async function $(e){try{let t=await fetch(`/api/user/localize/new/${af.article.id}`,{body:JSON.stringify({text:e}),headers:{Accept:"application/json; */*","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},method:"POST"});if(t.ok)return await t.json()}catch{}return e}function y(e,t){if(typeof e=="string"&&e.trim().length===0)return e;if(!(e===void 0||e===""||e===null))if(af?.article?.i18n!==void 0){if(!u(af.article.i18n,e)){af.article.i18n[e]=e;let n=$(e).then(r=>(af.article.i18n[e]=r,r));if(t)return n}return af.article.i18n[e]}else return e}function N(e,...t){if(!Array.isArray(e)||e.length!==t.length+1)throw TypeError("Method 'localize' must be used as a tag function");let n=e.map((o,a)=>a===e.length-1?o:`${o}$${a}`).join(""),r=y(n);return t.forEach((o,a)=>{r=r.replace("$"+a,o)}),r}function z(e){return[af?.article?.id||"","common",e].join(".")}var h=class{isPersisted(){return!0}getLocalStorageKey(t,n){return n?["common",t].join("."):z(t)}get(t,n,r){let o=this.getLocalStorageKey(t,r),a=localStorage.getItem(o);return a!==null?JSON.parse(a):n}set(t,n,r){localStorage.setItem(this.getLocalStorageKey(t,r),JSON.stringify(n))}remove(t,n){let r=this.getLocalStorageKey(t,n);return localStorage.getItem(r)!==null?(localStorage.removeItem(r),!0):!1}clear(){let t=z("");for(let n in localStorage)n.slice(0,t.length)===t&&localStorage.removeItem(n)}},U=new h;function A(e){return`${e||af.article.id}.${af.userSession.login}`}function le(e,t){if(!af?.userSession)return null;let n=A(t),r=JSON.parse(localStorage.getItem(n)||"{}");return e?r[e]||null:r}function ue(e,t,n){if(!af?.userSession)return;let r=A(n),o=JSON.parse(localStorage.getItem(r)||"{}");typeof t<"u"?o[e]=t:o=e,localStorage.setItem(r,JSON.stringify(o))}var ge="2.3.2";export{s as SessionHandler,f as UserSession,g as downloadBlob,J as downloadRequest,v as expose,y as getLocalizedString,le as getSettings,E as getUserImage,u as has,U as localStorage,N as localize,d as mitt,ue as saveSettings,C as toLocalISODate,R as toLocalISODateTime,ge as version};
2
2
  //# sourceMappingURL=af.common.min.js.map
@@ -476,6 +476,6 @@ var af;
476
476
  }
477
477
 
478
478
  // src/index.ts
479
- var version = "2.3.1";
479
+ var version = "2.3.2";
480
480
  return __toCommonJS(src_exports);
481
481
  })();
@@ -500,6 +500,6 @@ af.common = (() => {
500
500
  }
501
501
 
502
502
  // src/index.ts
503
- var version = "2.3.1";
503
+ var version = "2.3.2";
504
504
  return __toCommonJS(src_exports);
505
505
  })();
@@ -1,2 +1,2 @@
1
- var af=af||{};af.common=(()=>{var g=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames,L=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var x=(t,e,n)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,j=(t,e)=>{for(var n in e||(e={}))R.call(e,n)&&x(t,n,e[n]);if(L)for(var n of L(e))C.call(e,n)&&x(t,n,e[n]);return t};var O=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},k=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of P(e))!R.call(t,r)&&r!==n&&g(t,r,{get:()=>e[r],enumerable:!(o=M(e,r))||o.enumerable});return t};var F=t=>k(g({},"__esModule",{value:!0}),t);var a=(t,e,n)=>(x(t,typeof e!="symbol"?e+"":e,n),n);var Y={};O(Y,{SessionHandler:()=>u,UserSession:()=>p,downloadBlob:()=>y,downloadRequest:()=>J,expose:()=>v,getLocalizedString:()=>h,getSettings:()=>V,getUserImage:()=>N,has:()=>d,localStorage:()=>D,localize:()=>U,mitt:()=>m,saveSettings:()=>W,toLocalISODate:()=>B,toLocalISODateTime:()=>T,version:()=>G});window.addEventListener("error",t=>{var e,n,o,r,i,l,s;try{let f={error:(o=(n=(e=t.error)==null?void 0:e.message)!=null?n:t.message)!=null?o:null,file:t.filename,line:(r=t.lineno)!=null?r:0,column:(i=t.colno)!=null?i:0,stack:(s=(l=t.error)==null?void 0:l.stack)!=null?s:null};fetch("/data/Logger/LogError",{body:JSON.stringify(f),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"})}catch(f){}});function m(t){return{all:t=t||new Map,on:function(e,n){var o=t.get(e);o?o.push(n):t.set(e,[n])},off:function(e,n){var o=t.get(e);o&&(n?o.splice(o.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var o=t.get(e);o&&o.slice().map(function(r){r(n)}),(o=t.get("*"))&&o.slice().map(function(r){r(e,n)})}}}var u=class{constructor(){a(this,"eventHandler",m())}authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(e,n){try{let o=new Promise(i=>{let l=()=>{this.eventHandler.off("onAuthenticated",l),e==null||e(),i()};this.eventHandler.on("onAuthenticated",l)}),r=document.querySelector("dialog.session-expired-dialog");if(r)await o;else{r=document.createElement("dialog"),r.className="session-expired-dialog",r.style.display="flex",r.style.padding="0",r.style.left="50%",r.style.transform="translateX(-50%)";let i="/login?ReturnUrl=%2fapi/sessionexpired/remove";n!=="RequireTwoFactor"?await fetch("/logout",{method:"POST"}):i="/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove",r.innerHTML=`<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="${i}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(r),r.showModal(),await o,r.remove()}}catch(o){window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(e,n){return this.eventHandler.on(e,n)}detachEvent(e,n){return this.eventHandler.off(e,n)}};var p=class extends u{constructor(n){super();a(this,"amDesignator","a.m.");a(this,"dayNames",["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]);a(this,"dayNamesShort",["sun","mon","tue","wed","thu","fri","sat"]);a(this,"decimalSeparator",".");a(this,"domain","OB");a(this,"email");a(this,"formats");a(this,"groupSeparator",null);a(this,"integratedSecurity",!1);a(this,"isDeveloper",!1);a(this,"login","");a(this,"loginType");a(this,"monthNames",["january","february","march","april","may","june","july","august","september","october","november","december",""]);a(this,"monthNamesShort",["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""]);a(this,"name");a(this,"pmDesignator","p.m.");a(this,"shortDateFormat","dd.MM.yyyy");a(this,"culture","en-GB");a(this,"uiculture","en-GB");this.formats={},Object.assign(this,n)}};function B(t){return T(t).substring(0,10)}function T(t){let e=new Date(t);return e.setUTCFullYear(t.getFullYear()),e.setUTCMonth(t.getMonth()),e.setUTCDate(t.getDate()),e.setUTCHours(t.getHours()),e.setUTCMinutes(t.getMinutes()),e.toISOString().replace("Z","")}function y(t,e){return new Promise(function(n,o){try{let r=URL.createObjectURL(t),i=document.body,l=document.createElement("a");l.setAttribute("download",e),l.href=r,i.append(l),l.click(),i.removeChild(l),setTimeout(function(){URL.revokeObjectURL(r),n()},250)}catch(r){o(r)}})}async function J(t,{fileName:e,signal:n,onProgress:o}){var l;function r(s){typeof o=="function"&&o(j({},s))}let i=0;r({status:"requested"});try{let s=await fetch(t);if(!s.ok||!s.body){if((l=s.headers.get("content-type"))!=null&&l.includes("application/json")){let c=await s.json();if(c.error)throw new Error(c.error)}throw new Error(`${s.status} ${s.statusText}`)}try{let c=s.body.getReader(),q=new ReadableStream({start:function(A){function I(){return c.read().then(function(w){if(w.done){A.close();return}return i+=w.value.length,r({bytesReceived:i,status:"downloading"}),A.enqueue(w.value),I()})}return I()}});s=new Response(q)}catch(c){}let f=await s.blob();r({bytesReceived:i,status:"downloaded"}),await y(f,e),r({bytesReceived:i,status:"completed"})}catch(s){n!=null&&n.aborted?r({status:"cancelled"}):r({error:s.message,status:"error"})}}function d(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var K=/^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;function S(t){var e=t.toString().match(K);if(e===null)throw new TypeError("Unable to parse function!");return{name:e[1],args:e[2].split(","),body:e[3]}}function E(){}E.prototype=Object.create(null);var $=E;function b(t,e){if(typeof t=="object"){if(typeof e=="string"){let n=e.split(".");return b(t,n)}else if(Array.isArray(e)){let n=t;for(let o=0;o<e.length;o++)n=n[e[o]]=n[e[o]]||new $;return n}}}function v(t,e){if(arguments.length!==2)throw new Error("Incorrect number of arguments passed to the expose function!");if(Array.isArray(e))for(let n of e){let{name:o}=S(n);if(o)v(t,n);else throw new Error("Unable to detect name of function! Name it, or only supply one function and include name in first parameter.")}else{let n,o;if(typeof e=="function"&&(n=S(e).name),typeof t=="string"){let r=t.split(".");n||(n=r[r.length-1],r=r.slice(0,r.length-1)),o=b(window,r)}else if(n&&(typeof t=="object"||typeof t=="function"))o=t;else throw new TypeError("Invalid typeof parameter 'name', or unable to parse pValue!");d(o,n)?console.warn([t,n].join(".")+" is already defined!"):o[n]=e}}var Z={xs:64,sm:128,md:256,lg:512,xl:void 0};function N(t,e,n,o="xs"){if(t&&typeof t=="object")return N(t.primKey,t.login,t.hash,t.size);if(!t||!n)return"";let r=Z[o];return`/api/data/blob/EmployeesLookup/${t}/Image/${e}${e?".":""}${n}.jpg${r?`?width=${r}`:""}`}async function X(t){try{let e=await fetch(`/api/user/localize/new/${af.article.id}`,{body:JSON.stringify({text:t}),headers:{Accept:"application/json; */*","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},method:"POST"});if(e.ok)return await e.json()}catch(e){}return t}function h(t,e){var n;if(typeof t=="string"&&t.trim().length===0)return t;if(!(t===void 0||t===""||t===null))if(((n=af==null?void 0:af.article)==null?void 0:n.i18n)!==void 0){if(!d(af.article.i18n,t)){af.article.i18n[t]=t;let o=X(t).then(r=>(af.article.i18n[t]=r,r));if(e)return o}return af.article.i18n[t]}else return t}function U(t,...e){if(!Array.isArray(t)||t.length!==e.length+1)throw TypeError("Method 'localize' must be used as a tag function");let n=t.map((r,i)=>i===t.length-1?r:`${r}$${i}`).join(""),o=h(n);return e.forEach((r,i)=>{o=o.replace("$"+i,r)}),o}function H(t){var e;return[((e=af==null?void 0:af.article)==null?void 0:e.id)||"","common",t].join(".")}var z=class{isPersisted(){return!0}getLocalStorageKey(e,n){return n?["common",e].join("."):H(e)}get(e,n,o){let r=this.getLocalStorageKey(e,o),i=localStorage.getItem(r);return i!==null?JSON.parse(i):n}set(e,n,o){localStorage.setItem(this.getLocalStorageKey(e,o),JSON.stringify(n))}remove(e,n){let o=this.getLocalStorageKey(e,n);return localStorage.getItem(o)!==null?(localStorage.removeItem(o),!0):!1}clear(){let e=H("");for(let n in localStorage)n.slice(0,e.length)===e&&localStorage.removeItem(n)}},D=new z;function _(t){return`${t||af.article.id}.${af.userSession.login}`}function V(t,e){if(!(af!=null&&af.userSession))return null;let n=_(e),o=JSON.parse(localStorage.getItem(n)||"{}");return t?o[t]||null:o}function W(t,e,n){if(!(af!=null&&af.userSession))return;let o=_(n),r=JSON.parse(localStorage.getItem(o)||"{}");typeof e<"u"?r[t]=e:r=t,localStorage.setItem(o,JSON.stringify(r))}var G="2.3.1";return F(Y);})();
1
+ var af=af||{};af.common=(()=>{var g=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames,L=Object.getOwnPropertySymbols;var R=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;var x=(t,e,n)=>e in t?g(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,j=(t,e)=>{for(var n in e||(e={}))R.call(e,n)&&x(t,n,e[n]);if(L)for(var n of L(e))C.call(e,n)&&x(t,n,e[n]);return t};var O=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},k=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of P(e))!R.call(t,r)&&r!==n&&g(t,r,{get:()=>e[r],enumerable:!(o=M(e,r))||o.enumerable});return t};var F=t=>k(g({},"__esModule",{value:!0}),t);var a=(t,e,n)=>(x(t,typeof e!="symbol"?e+"":e,n),n);var Y={};O(Y,{SessionHandler:()=>u,UserSession:()=>p,downloadBlob:()=>y,downloadRequest:()=>J,expose:()=>v,getLocalizedString:()=>h,getSettings:()=>V,getUserImage:()=>N,has:()=>d,localStorage:()=>D,localize:()=>U,mitt:()=>m,saveSettings:()=>W,toLocalISODate:()=>B,toLocalISODateTime:()=>T,version:()=>G});window.addEventListener("error",t=>{var e,n,o,r,i,l,s;try{let f={error:(o=(n=(e=t.error)==null?void 0:e.message)!=null?n:t.message)!=null?o:null,file:t.filename,line:(r=t.lineno)!=null?r:0,column:(i=t.colno)!=null?i:0,stack:(s=(l=t.error)==null?void 0:l.stack)!=null?s:null};fetch("/data/Logger/LogError",{body:JSON.stringify(f),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"})}catch(f){}});function m(t){return{all:t=t||new Map,on:function(e,n){var o=t.get(e);o?o.push(n):t.set(e,[n])},off:function(e,n){var o=t.get(e);o&&(n?o.splice(o.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var o=t.get(e);o&&o.slice().map(function(r){r(n)}),(o=t.get("*"))&&o.slice().map(function(r){r(e,n)})}}}var u=class{constructor(){a(this,"eventHandler",m())}authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(e,n){try{let o=new Promise(i=>{let l=()=>{this.eventHandler.off("onAuthenticated",l),e==null||e(),i()};this.eventHandler.on("onAuthenticated",l)}),r=document.querySelector("dialog.session-expired-dialog");if(r)await o;else{r=document.createElement("dialog"),r.className="session-expired-dialog",r.style.display="flex",r.style.padding="0",r.style.left="50%",r.style.transform="translateX(-50%)";let i="/login?ReturnUrl=%2fapi/sessionexpired/remove";n!=="RequireTwoFactor"?await fetch("/logout",{method:"POST"}):i="/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove",r.innerHTML=`<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="${i}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(r),r.showModal(),await o,r.remove()}}catch(o){window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(e,n){return this.eventHandler.on(e,n)}detachEvent(e,n){return this.eventHandler.off(e,n)}};var p=class extends u{constructor(n){super();a(this,"amDesignator","a.m.");a(this,"dayNames",["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]);a(this,"dayNamesShort",["sun","mon","tue","wed","thu","fri","sat"]);a(this,"decimalSeparator",".");a(this,"domain","OB");a(this,"email");a(this,"formats");a(this,"groupSeparator",null);a(this,"integratedSecurity",!1);a(this,"isDeveloper",!1);a(this,"login","");a(this,"loginType");a(this,"monthNames",["january","february","march","april","may","june","july","august","september","october","november","december",""]);a(this,"monthNamesShort",["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""]);a(this,"name");a(this,"pmDesignator","p.m.");a(this,"shortDateFormat","dd.MM.yyyy");a(this,"culture","en-GB");a(this,"uiculture","en-GB");this.formats={},Object.assign(this,n)}};function B(t){return T(t).substring(0,10)}function T(t){let e=new Date(t);return e.setUTCFullYear(t.getFullYear()),e.setUTCMonth(t.getMonth()),e.setUTCDate(t.getDate()),e.setUTCHours(t.getHours()),e.setUTCMinutes(t.getMinutes()),e.toISOString().replace("Z","")}function y(t,e){return new Promise(function(n,o){try{let r=URL.createObjectURL(t),i=document.body,l=document.createElement("a");l.setAttribute("download",e),l.href=r,i.append(l),l.click(),i.removeChild(l),setTimeout(function(){URL.revokeObjectURL(r),n()},250)}catch(r){o(r)}})}async function J(t,{fileName:e,signal:n,onProgress:o}){var l;function r(s){typeof o=="function"&&o(j({},s))}let i=0;r({status:"requested"});try{let s=await fetch(t);if(!s.ok||!s.body){if((l=s.headers.get("content-type"))!=null&&l.includes("application/json")){let c=await s.json();if(c.error)throw new Error(c.error)}throw new Error(`${s.status} ${s.statusText}`)}try{let c=s.body.getReader(),q=new ReadableStream({start:function(A){function I(){return c.read().then(function(w){if(w.done){A.close();return}return i+=w.value.length,r({bytesReceived:i,status:"downloading"}),A.enqueue(w.value),I()})}return I()}});s=new Response(q)}catch(c){}let f=await s.blob();r({bytesReceived:i,status:"downloaded"}),await y(f,e),r({bytesReceived:i,status:"completed"})}catch(s){n!=null&&n.aborted?r({status:"cancelled"}):r({error:s.message,status:"error"})}}function d(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var K=/^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;function S(t){var e=t.toString().match(K);if(e===null)throw new TypeError("Unable to parse function!");return{name:e[1],args:e[2].split(","),body:e[3]}}function E(){}E.prototype=Object.create(null);var $=E;function b(t,e){if(typeof t=="object"){if(typeof e=="string"){let n=e.split(".");return b(t,n)}else if(Array.isArray(e)){let n=t;for(let o=0;o<e.length;o++)n=n[e[o]]=n[e[o]]||new $;return n}}}function v(t,e){if(arguments.length!==2)throw new Error("Incorrect number of arguments passed to the expose function!");if(Array.isArray(e))for(let n of e){let{name:o}=S(n);if(o)v(t,n);else throw new Error("Unable to detect name of function! Name it, or only supply one function and include name in first parameter.")}else{let n,o;if(typeof e=="function"&&(n=S(e).name),typeof t=="string"){let r=t.split(".");n||(n=r[r.length-1],r=r.slice(0,r.length-1)),o=b(window,r)}else if(n&&(typeof t=="object"||typeof t=="function"))o=t;else throw new TypeError("Invalid typeof parameter 'name', or unable to parse pValue!");d(o,n)?console.warn([t,n].join(".")+" is already defined!"):o[n]=e}}var Z={xs:64,sm:128,md:256,lg:512,xl:void 0};function N(t,e,n,o="xs"){if(t&&typeof t=="object")return N(t.primKey,t.login,t.hash,t.size);if(!t||!n)return"";let r=Z[o];return`/api/data/blob/EmployeesLookup/${t}/Image/${e}${e?".":""}${n}.jpg${r?`?width=${r}`:""}`}async function X(t){try{let e=await fetch(`/api/user/localize/new/${af.article.id}`,{body:JSON.stringify({text:t}),headers:{Accept:"application/json; */*","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},method:"POST"});if(e.ok)return await e.json()}catch(e){}return t}function h(t,e){var n;if(typeof t=="string"&&t.trim().length===0)return t;if(!(t===void 0||t===""||t===null))if(((n=af==null?void 0:af.article)==null?void 0:n.i18n)!==void 0){if(!d(af.article.i18n,t)){af.article.i18n[t]=t;let o=X(t).then(r=>(af.article.i18n[t]=r,r));if(e)return o}return af.article.i18n[t]}else return t}function U(t,...e){if(!Array.isArray(t)||t.length!==e.length+1)throw TypeError("Method 'localize' must be used as a tag function");let n=t.map((r,i)=>i===t.length-1?r:`${r}$${i}`).join(""),o=h(n);return e.forEach((r,i)=>{o=o.replace("$"+i,r)}),o}function H(t){var e;return[((e=af==null?void 0:af.article)==null?void 0:e.id)||"","common",t].join(".")}var z=class{isPersisted(){return!0}getLocalStorageKey(e,n){return n?["common",e].join("."):H(e)}get(e,n,o){let r=this.getLocalStorageKey(e,o),i=localStorage.getItem(r);return i!==null?JSON.parse(i):n}set(e,n,o){localStorage.setItem(this.getLocalStorageKey(e,o),JSON.stringify(n))}remove(e,n){let o=this.getLocalStorageKey(e,n);return localStorage.getItem(o)!==null?(localStorage.removeItem(o),!0):!1}clear(){let e=H("");for(let n in localStorage)n.slice(0,e.length)===e&&localStorage.removeItem(n)}},D=new z;function _(t){return`${t||af.article.id}.${af.userSession.login}`}function V(t,e){if(!(af!=null&&af.userSession))return null;let n=_(e),o=JSON.parse(localStorage.getItem(n)||"{}");return t?o[t]||null:o}function W(t,e,n){if(!(af!=null&&af.userSession))return;let o=_(n),r=JSON.parse(localStorage.getItem(o)||"{}");typeof e<"u"?r[t]=e:r=t,localStorage.setItem(o,JSON.stringify(r))}var G="2.3.2";return F(Y);})();
2
2
  //# sourceMappingURL=af.common.legacy.min.js.map
@@ -1,2 +1,2 @@
1
- var af;(af||={}).common=(()=>{var p=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var D=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},_=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of U(t))!H.call(e,o)&&o!==n&&p(e,o,{get:()=>t[o],enumerable:!(r=N(t,o))||r.enumerable});return e};var k=e=>_(p({},"__esModule",{value:!0}),e);var K={};D(K,{SessionHandler:()=>s,UserSession:()=>d,downloadBlob:()=>f,downloadRequest:()=>M,expose:()=>w,getLocalizedString:()=>g,getSettings:()=>F,getUserImage:()=>I,has:()=>u,localStorage:()=>j,localize:()=>L,mitt:()=>c,saveSettings:()=>B,toLocalISODate:()=>q,toLocalISODateTime:()=>v,version:()=>J});window.addEventListener("error",e=>{try{let t={error:e.error?.message??e.message??null,file:e.filename,line:e.lineno??0,column:e.colno??0,stack:e.error?.stack??null};fetch("/data/Logger/LogError",{body:JSON.stringify(t),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"})}catch{}});function c(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(o){o(n)}),(r=e.get("*"))&&r.slice().map(function(o){o(t,n)})}}}var s=class{eventHandler=c();authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,n){try{let r=new Promise(a=>{let i=()=>{this.eventHandler.off("onAuthenticated",i),t?.(),a()};this.eventHandler.on("onAuthenticated",i)}),o=document.querySelector("dialog.session-expired-dialog");if(o)await r;else{o=document.createElement("dialog"),o.className="session-expired-dialog",o.style.display="flex",o.style.padding="0",o.style.left="50%",o.style.transform="translateX(-50%)";let a="/login?ReturnUrl=%2fapi/sessionexpired/remove";n!=="RequireTwoFactor"?await fetch("/logout",{method:"POST"}):a="/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove",o.innerHTML=`<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="${a}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(o),o.showModal(),await r,o.remove()}}catch{window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(t,n){return this.eventHandler.on(t,n)}detachEvent(t,n){return this.eventHandler.off(t,n)}};var d=class extends s{amDesignator="a.m.";dayNames=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];dayNamesShort=["sun","mon","tue","wed","thu","fri","sat"];decimalSeparator=".";domain="OB";email;formats;groupSeparator=null;integratedSecurity=!1;isDeveloper=!1;login="";loginType;monthNames=["january","february","march","april","may","june","july","august","september","october","november","december",""];monthNamesShort=["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""];name;pmDesignator="p.m.";shortDateFormat="dd.MM.yyyy";culture="en-GB";uiculture="en-GB";constructor(t){super(),this.formats={},Object.assign(this,t)}};function q(e){return v(e).substring(0,10)}function v(e){let t=new Date(e);return t.setUTCFullYear(e.getFullYear()),t.setUTCMonth(e.getMonth()),t.setUTCDate(e.getDate()),t.setUTCHours(e.getHours()),t.setUTCMinutes(e.getMinutes()),t.toISOString().replace("Z","")}function f(e,t){return new Promise(function(n,r){try{let o=URL.createObjectURL(e),a=document.body,i=document.createElement("a");i.setAttribute("download",t),i.href=o,a.append(i),i.click(),a.removeChild(i),setTimeout(function(){URL.revokeObjectURL(o),n()},250)}catch(o){r(o)}})}async function M(e,{fileName:t,signal:n,onProgress:r}){function o(i){typeof r=="function"&&r({...i})}let a=0;o({status:"requested"});try{let i=await fetch(e);if(!i.ok||!i.body){if(i.headers.get("content-type")?.includes("application/json")){let l=await i.json();if(l.error)throw new Error(l.error)}throw new Error(`${i.status} ${i.statusText}`)}try{let l=i.body.getReader(),$=new ReadableStream({start:function(b){function S(){return l.read().then(function(m){if(m.done){b.close();return}return a+=m.value.length,o({bytesReceived:a,status:"downloading"}),b.enqueue(m.value),S()})}return S()}});i=new Response($)}catch{}let E=await i.blob();o({bytesReceived:a,status:"downloaded"}),await f(E,t),o({bytesReceived:a,status:"completed"})}catch(i){n?.aborted?o({status:"cancelled"}):o({error:i.message,status:"error"})}}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var P=/^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;function y(e){var t=e.toString().match(P);if(t===null)throw new TypeError("Unable to parse function!");return{name:t[1],args:t[2].split(","),body:t[3]}}function z(){}z.prototype=Object.create(null);var A=z;function h(e,t){if(typeof e=="object"){if(typeof t=="string"){let n=t.split(".");return h(e,n)}else if(Array.isArray(t)){let n=e;for(let r=0;r<t.length;r++)n=n[t[r]]=n[t[r]]||new A;return n}}}function w(e,t){if(arguments.length!==2)throw new Error("Incorrect number of arguments passed to the expose function!");if(Array.isArray(t))for(let n of t){let{name:r}=y(n);if(r)w(e,n);else throw new Error("Unable to detect name of function! Name it, or only supply one function and include name in first parameter.")}else{let n,r;if(typeof t=="function"&&(n=y(t).name),typeof e=="string"){let o=e.split(".");n||(n=o[o.length-1],o=o.slice(0,o.length-1)),r=h(window,o)}else if(n&&(typeof e=="object"||typeof e=="function"))r=e;else throw new TypeError("Invalid typeof parameter 'name', or unable to parse pValue!");u(r,n)?console.warn([e,n].join(".")+" is already defined!"):r[n]=t}}var C={xs:64,sm:128,md:256,lg:512,xl:void 0};function I(e,t,n,r="xs"){if(e&&typeof e=="object")return I(e.primKey,e.login,e.hash,e.size);if(!e||!n)return"";let o=C[r];return`/api/data/blob/EmployeesLookup/${e}/Image/${t}${t?".":""}${n}.jpg${o?`?width=${o}`:""}`}async function O(e){try{let t=await fetch(`/api/user/localize/new/${af.article.id}`,{body:JSON.stringify({text:e}),headers:{Accept:"application/json; */*","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},method:"POST"});if(t.ok)return await t.json()}catch{}return e}function g(e,t){if(typeof e=="string"&&e.trim().length===0)return e;if(!(e===void 0||e===""||e===null))if(af?.article?.i18n!==void 0){if(!u(af.article.i18n,e)){af.article.i18n[e]=e;let n=O(e).then(r=>(af.article.i18n[e]=r,r));if(t)return n}return af.article.i18n[e]}else return e}function L(e,...t){if(!Array.isArray(e)||e.length!==t.length+1)throw TypeError("Method 'localize' must be used as a tag function");let n=e.map((o,a)=>a===e.length-1?o:`${o}$${a}`).join(""),r=g(n);return t.forEach((o,a)=>{r=r.replace("$"+a,o)}),r}function R(e){return[af?.article?.id||"","common",e].join(".")}var x=class{isPersisted(){return!0}getLocalStorageKey(t,n){return n?["common",t].join("."):R(t)}get(t,n,r){let o=this.getLocalStorageKey(t,r),a=localStorage.getItem(o);return a!==null?JSON.parse(a):n}set(t,n,r){localStorage.setItem(this.getLocalStorageKey(t,r),JSON.stringify(n))}remove(t,n){let r=this.getLocalStorageKey(t,n);return localStorage.getItem(r)!==null?(localStorage.removeItem(r),!0):!1}clear(){let t=R("");for(let n in localStorage)n.slice(0,t.length)===t&&localStorage.removeItem(n)}},j=new x;function T(e){return`${e||af.article.id}.${af.userSession.login}`}function F(e,t){if(!af?.userSession)return null;let n=T(t),r=JSON.parse(localStorage.getItem(n)||"{}");return e?r[e]||null:r}function B(e,t,n){if(!af?.userSession)return;let r=T(n),o=JSON.parse(localStorage.getItem(r)||"{}");typeof t<"u"?o[e]=t:o=e,localStorage.setItem(r,JSON.stringify(o))}var J="2.3.1";return k(K);})();
1
+ var af;(af||={}).common=(()=>{var p=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var D=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},_=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of U(t))!H.call(e,o)&&o!==n&&p(e,o,{get:()=>t[o],enumerable:!(r=N(t,o))||r.enumerable});return e};var k=e=>_(p({},"__esModule",{value:!0}),e);var K={};D(K,{SessionHandler:()=>s,UserSession:()=>d,downloadBlob:()=>f,downloadRequest:()=>M,expose:()=>w,getLocalizedString:()=>g,getSettings:()=>F,getUserImage:()=>I,has:()=>u,localStorage:()=>j,localize:()=>L,mitt:()=>c,saveSettings:()=>B,toLocalISODate:()=>q,toLocalISODateTime:()=>v,version:()=>J});window.addEventListener("error",e=>{try{let t={error:e.error?.message??e.message??null,file:e.filename,line:e.lineno??0,column:e.colno??0,stack:e.error?.stack??null};fetch("/data/Logger/LogError",{body:JSON.stringify(t),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"})}catch{}});function c(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(o){o(n)}),(r=e.get("*"))&&r.slice().map(function(o){o(t,n)})}}}var s=class{eventHandler=c();authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,n){try{let r=new Promise(a=>{let i=()=>{this.eventHandler.off("onAuthenticated",i),t?.(),a()};this.eventHandler.on("onAuthenticated",i)}),o=document.querySelector("dialog.session-expired-dialog");if(o)await r;else{o=document.createElement("dialog"),o.className="session-expired-dialog",o.style.display="flex",o.style.padding="0",o.style.left="50%",o.style.transform="translateX(-50%)";let a="/login?ReturnUrl=%2fapi/sessionexpired/remove";n!=="RequireTwoFactor"?await fetch("/logout",{method:"POST"}):a="/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove",o.innerHTML=`<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="${a}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(o),o.showModal(),await r,o.remove()}}catch{window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(t,n){return this.eventHandler.on(t,n)}detachEvent(t,n){return this.eventHandler.off(t,n)}};var d=class extends s{amDesignator="a.m.";dayNames=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];dayNamesShort=["sun","mon","tue","wed","thu","fri","sat"];decimalSeparator=".";domain="OB";email;formats;groupSeparator=null;integratedSecurity=!1;isDeveloper=!1;login="";loginType;monthNames=["january","february","march","april","may","june","july","august","september","october","november","december",""];monthNamesShort=["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""];name;pmDesignator="p.m.";shortDateFormat="dd.MM.yyyy";culture="en-GB";uiculture="en-GB";constructor(t){super(),this.formats={},Object.assign(this,t)}};function q(e){return v(e).substring(0,10)}function v(e){let t=new Date(e);return t.setUTCFullYear(e.getFullYear()),t.setUTCMonth(e.getMonth()),t.setUTCDate(e.getDate()),t.setUTCHours(e.getHours()),t.setUTCMinutes(e.getMinutes()),t.toISOString().replace("Z","")}function f(e,t){return new Promise(function(n,r){try{let o=URL.createObjectURL(e),a=document.body,i=document.createElement("a");i.setAttribute("download",t),i.href=o,a.append(i),i.click(),a.removeChild(i),setTimeout(function(){URL.revokeObjectURL(o),n()},250)}catch(o){r(o)}})}async function M(e,{fileName:t,signal:n,onProgress:r}){function o(i){typeof r=="function"&&r({...i})}let a=0;o({status:"requested"});try{let i=await fetch(e);if(!i.ok||!i.body){if(i.headers.get("content-type")?.includes("application/json")){let l=await i.json();if(l.error)throw new Error(l.error)}throw new Error(`${i.status} ${i.statusText}`)}try{let l=i.body.getReader(),$=new ReadableStream({start:function(b){function S(){return l.read().then(function(m){if(m.done){b.close();return}return a+=m.value.length,o({bytesReceived:a,status:"downloading"}),b.enqueue(m.value),S()})}return S()}});i=new Response($)}catch{}let E=await i.blob();o({bytesReceived:a,status:"downloaded"}),await f(E,t),o({bytesReceived:a,status:"completed"})}catch(i){n?.aborted?o({status:"cancelled"}):o({error:i.message,status:"error"})}}function u(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var P=/^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;function y(e){var t=e.toString().match(P);if(t===null)throw new TypeError("Unable to parse function!");return{name:t[1],args:t[2].split(","),body:t[3]}}function z(){}z.prototype=Object.create(null);var A=z;function h(e,t){if(typeof e=="object"){if(typeof t=="string"){let n=t.split(".");return h(e,n)}else if(Array.isArray(t)){let n=e;for(let r=0;r<t.length;r++)n=n[t[r]]=n[t[r]]||new A;return n}}}function w(e,t){if(arguments.length!==2)throw new Error("Incorrect number of arguments passed to the expose function!");if(Array.isArray(t))for(let n of t){let{name:r}=y(n);if(r)w(e,n);else throw new Error("Unable to detect name of function! Name it, or only supply one function and include name in first parameter.")}else{let n,r;if(typeof t=="function"&&(n=y(t).name),typeof e=="string"){let o=e.split(".");n||(n=o[o.length-1],o=o.slice(0,o.length-1)),r=h(window,o)}else if(n&&(typeof e=="object"||typeof e=="function"))r=e;else throw new TypeError("Invalid typeof parameter 'name', or unable to parse pValue!");u(r,n)?console.warn([e,n].join(".")+" is already defined!"):r[n]=t}}var C={xs:64,sm:128,md:256,lg:512,xl:void 0};function I(e,t,n,r="xs"){if(e&&typeof e=="object")return I(e.primKey,e.login,e.hash,e.size);if(!e||!n)return"";let o=C[r];return`/api/data/blob/EmployeesLookup/${e}/Image/${t}${t?".":""}${n}.jpg${o?`?width=${o}`:""}`}async function O(e){try{let t=await fetch(`/api/user/localize/new/${af.article.id}`,{body:JSON.stringify({text:e}),headers:{Accept:"application/json; */*","Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},method:"POST"});if(t.ok)return await t.json()}catch{}return e}function g(e,t){if(typeof e=="string"&&e.trim().length===0)return e;if(!(e===void 0||e===""||e===null))if(af?.article?.i18n!==void 0){if(!u(af.article.i18n,e)){af.article.i18n[e]=e;let n=O(e).then(r=>(af.article.i18n[e]=r,r));if(t)return n}return af.article.i18n[e]}else return e}function L(e,...t){if(!Array.isArray(e)||e.length!==t.length+1)throw TypeError("Method 'localize' must be used as a tag function");let n=e.map((o,a)=>a===e.length-1?o:`${o}$${a}`).join(""),r=g(n);return t.forEach((o,a)=>{r=r.replace("$"+a,o)}),r}function R(e){return[af?.article?.id||"","common",e].join(".")}var x=class{isPersisted(){return!0}getLocalStorageKey(t,n){return n?["common",t].join("."):R(t)}get(t,n,r){let o=this.getLocalStorageKey(t,r),a=localStorage.getItem(o);return a!==null?JSON.parse(a):n}set(t,n,r){localStorage.setItem(this.getLocalStorageKey(t,r),JSON.stringify(n))}remove(t,n){let r=this.getLocalStorageKey(t,n);return localStorage.getItem(r)!==null?(localStorage.removeItem(r),!0):!1}clear(){let t=R("");for(let n in localStorage)n.slice(0,t.length)===t&&localStorage.removeItem(n)}},j=new x;function T(e){return`${e||af.article.id}.${af.userSession.login}`}function F(e,t){if(!af?.userSession)return null;let n=T(t),r=JSON.parse(localStorage.getItem(n)||"{}");return e?r[e]||null:r}function B(e,t,n){if(!af?.userSession)return;let r=T(n),o=JSON.parse(localStorage.getItem(r)||"{}");typeof t<"u"?o[e]=t:o=e,localStorage.setItem(r,JSON.stringify(o))}var J="2.3.2";return k(K);})();
2
2
  //# sourceMappingURL=af.common.min.js.map
package/es/index.js CHANGED
@@ -13,4 +13,4 @@ export { default as localStorage } from "./localStorage.js";
13
13
  export { default as SessionHandler } from "./SessionHandler.js";
14
14
  export { UserSession };
15
15
  export * from "./settings.js";
16
- export const version = "2.3.1";
16
+ export const version = "2.3.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/appframe-core",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Javascript libraries to utilize the Appframe framework",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -46,7 +46,7 @@
46
46
  "mitt": "^3.0.0"
47
47
  },
48
48
  "devDependencies": {
49
- "chalk": "^5.0.1"
49
+ "chalk": "^5.1.2"
50
50
  },
51
- "gitHead": "1305f1e71ed33b486606deb000310fe09e6629e8"
51
+ "gitHead": "cd1250e1e7607255c038c12fc086f4c9529b1262"
52
52
  }