@olenbetong/appframe-core 2.1.2 → 2.3.0

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.
@@ -119,6 +119,20 @@ var UserSession = class extends SessionHandler {
119
119
  }
120
120
  };
121
121
 
122
+ // src/date.ts
123
+ function toLocalISODate(date) {
124
+ return toLocalISODateTime(date).substring(0, 10);
125
+ }
126
+ function toLocalISODateTime(date) {
127
+ let newDate = new Date(date);
128
+ newDate.setUTCFullYear(date.getFullYear());
129
+ newDate.setUTCMonth(date.getMonth());
130
+ newDate.setUTCDate(date.getDate());
131
+ newDate.setUTCHours(date.getHours());
132
+ newDate.setUTCMinutes(date.getMinutes());
133
+ return newDate.toISOString().replace("Z", "");
134
+ }
135
+
122
136
  // src/downloadBlob.ts
123
137
  function downloadBlob(blob, fileName) {
124
138
  return new Promise(function(resolve, reject) {
@@ -275,6 +289,22 @@ function expose(name, value) {
275
289
  }
276
290
  }
277
291
 
292
+ // src/getUserImage.ts
293
+ var sizeMap = {
294
+ xs: 64,
295
+ sm: 128,
296
+ md: 256,
297
+ lg: 512,
298
+ xl: void 0
299
+ };
300
+ function getUserImage({ primKey, login, hash, size = "xs" }) {
301
+ if (!primKey || !hash) {
302
+ return "";
303
+ }
304
+ let sizePx = sizeMap[size];
305
+ return `/api/data/blob/EmployeesLookup/${primKey}/Image/${login}${login ? "." : ""}${hash}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
306
+ }
307
+
278
308
  // src/getLocalizedString.ts
279
309
  async function fetchLocalizedString(text) {
280
310
  try {
@@ -402,7 +432,7 @@ function saveSettings(setting, value, article) {
402
432
  }
403
433
 
404
434
  // src/index.ts
405
- var version = "2.1.2";
435
+ var version = "2.3.0";
406
436
  export {
407
437
  SessionHandler,
408
438
  UserSession,
@@ -411,10 +441,13 @@ export {
411
441
  expose,
412
442
  getLocalizedString,
413
443
  getSettings,
444
+ getUserImage,
414
445
  has,
415
446
  localStorage_default as localStorage,
416
447
  localize,
417
448
  mitt_default as mitt,
418
449
  saveSettings,
450
+ toLocalISODate,
451
+ toLocalISODateTime,
419
452
  version
420
453
  };
@@ -143,6 +143,20 @@ var UserSession = class extends SessionHandler {
143
143
  }
144
144
  };
145
145
 
146
+ // src/date.ts
147
+ function toLocalISODate(date) {
148
+ return toLocalISODateTime(date).substring(0, 10);
149
+ }
150
+ function toLocalISODateTime(date) {
151
+ let newDate = new Date(date);
152
+ newDate.setUTCFullYear(date.getFullYear());
153
+ newDate.setUTCMonth(date.getMonth());
154
+ newDate.setUTCDate(date.getDate());
155
+ newDate.setUTCHours(date.getHours());
156
+ newDate.setUTCMinutes(date.getMinutes());
157
+ return newDate.toISOString().replace("Z", "");
158
+ }
159
+
146
160
  // src/downloadBlob.ts
147
161
  function downloadBlob(blob, fileName) {
148
162
  return new Promise(function(resolve, reject) {
@@ -300,6 +314,22 @@ function expose(name, value) {
300
314
  }
301
315
  }
302
316
 
317
+ // src/getUserImage.ts
318
+ var sizeMap = {
319
+ xs: 64,
320
+ sm: 128,
321
+ md: 256,
322
+ lg: 512,
323
+ xl: void 0
324
+ };
325
+ function getUserImage({ primKey, login, hash, size = "xs" }) {
326
+ if (!primKey || !hash) {
327
+ return "";
328
+ }
329
+ let sizePx = sizeMap[size];
330
+ return `/api/data/blob/EmployeesLookup/${primKey}/Image/${login}${login ? "." : ""}${hash}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
331
+ }
332
+
303
333
  // src/getLocalizedString.ts
304
334
  async function fetchLocalizedString(text) {
305
335
  try {
@@ -429,7 +459,7 @@ function saveSettings(setting, value, article) {
429
459
  }
430
460
 
431
461
  // src/index.ts
432
- var version = "2.1.2";
462
+ var version = "2.3.0";
433
463
  export {
434
464
  SessionHandler,
435
465
  UserSession,
@@ -438,10 +468,13 @@ export {
438
468
  expose,
439
469
  getLocalizedString,
440
470
  getSettings,
471
+ getUserImage,
441
472
  has,
442
473
  localStorage_default as localStorage,
443
474
  localize,
444
475
  mitt_default as mitt,
445
476
  saveSettings,
477
+ toLocalISODate,
478
+ toLocalISODateTime,
446
479
  version
447
480
  };
@@ -1,2 +1,2 @@
1
- var _=Object.defineProperty;var L=Object.getOwnPropertySymbols;var $=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var p=(t,e,r)=>e in t?_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,R=(t,e)=>{for(var r in e||(e={}))$.call(e,r)&&p(t,r,e[r]);if(L)for(var r of L(e))H.call(e,r)&&p(t,r,e[r]);return t};var a=(t,e,r)=>(p(t,typeof e!="symbol"?e+"":e,r),r);window.addEventListener("error",t=>{var e,r,n,o,i,l,s;try{let d={error:(n=(r=(e=t.error)==null?void 0:e.message)!=null?r:t.message)!=null?n: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 m(t){return{all:t=t||new Map,on:function(e,r){var n=t.get(e);n?n.push(r):t.set(e,[r])},off:function(e,r){var n=t.get(e);n&&(r?n.splice(n.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var n=t.get(e);n&&n.slice().map(function(o){o(r)}),(n=t.get("*"))&&n.slice().map(function(o){o(e,r)})}}}var c=class{constructor(){a(this,"eventHandler",m())}authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(e,r){try{let n=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 n;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";r!=="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 n,o.remove()}}catch(n){window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(e,r){return this.eventHandler.on(e,r)}detachEvent(e,r){return this.eventHandler.off(e,r)}};var y=class extends c{constructor(r){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,r)}};function h(t,e){return new Promise(function(r,n){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),r()},250)}catch(o){n(o)}})}async function G(t,{fileName:e,signal:r,onProgress:n}){var l;function o(s){typeof n=="function"&&n(R({},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 u=await s.json();if(u.error)throw new Error(u.error)}throw new Error(`${s.status} ${s.statusText}`)}try{let u=s.body.getReader(),O=new ReadableStream({start:function(v){function A(){return u.read().then(function(g){if(g.done){v.close();return}return i+=g.value.length,o({bytesReceived:i,status:"downloading"}),v.enqueue(g.value),A()})}return A()}});s=new Response(O)}catch(u){}let d=await s.blob();o({bytesReceived:i,status:"downloaded"}),await h(d,e),o({bytesReceived:i,status:"completed"})}catch(s){r!=null&&r.aborted?o({status:"cancelled"}):o({error:s.message,status:"error"})}}function f(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var I=/^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(I);if(e===null)throw new TypeError("Unable to parse function!");return{name:e[1],args:e[2].split(","),body:e[3]}}function j(){}j.prototype=Object.create(null);var E=j;function S(t,e){if(typeof t=="object"){if(typeof e=="string"){let r=e.split(".");return S(t,r)}else if(Array.isArray(e)){let r=t;for(let n=0;n<e.length;n++)r=r[e[n]]=r[e[n]]||new E;return r}}}function z(t,e){if(arguments.length!==2)throw new Error("Incorrect number of arguments passed to the expose function!");if(Array.isArray(e))for(let r of e){let{name:n}=w(r);if(n)z(t,r);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 r,n;if(typeof e=="function"&&(r=w(e).name),typeof t=="string"){let o=t.split(".");r||(r=o[o.length-1],o=o.slice(0,o.length-1)),n=S(window,o)}else if(r&&(typeof t=="object"||typeof t=="function"))n=t;else throw new TypeError("Invalid typeof parameter 'name', or unable to parse pValue!");f(n,r)?console.warn([t,r].join(".")+" is already defined!"):n[r]=e}}async function q(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 b(t,e){var r;if(typeof t=="string"&&t.trim().length===0)return t;if(!(t===void 0||t===""||t===null))if(((r=af==null?void 0:af.article)==null?void 0:r.i18n)!==void 0){if(!f(af.article.i18n,t)){af.article.i18n[t]=t;let n=q(t).then(o=>(af.article.i18n[t]=o,o));if(e)return n}return af.article.i18n[t]}else return t}function P(t,...e){if(!Array.isArray(t)||t.length!==e.length+1)throw TypeError("Method 'localize' must be used as a tag function");let r=t.map((o,i)=>i===t.length-1?o:`${o}$${i}`).join(""),n=b(r);return e.forEach((o,i)=>{n=n.replace("$"+i,o)}),n}function N(t){var e;return[((e=af==null?void 0:af.article)==null?void 0:e.id)||"","common",t].join(".")}var x=class{isPersisted(){return!0}getLocalStorageKey(e,r){return r?["common",e].join("."):N(e)}get(e,r,n){let o=this.getLocalStorageKey(e,n),i=localStorage.getItem(o);return i!==null?JSON.parse(i):r}set(e,r,n){localStorage.setItem(this.getLocalStorageKey(e,n),JSON.stringify(r))}remove(e,r){let n=this.getLocalStorageKey(e,r);return localStorage.getItem(n)!==null?(localStorage.removeItem(n),!0):!1}clear(){let e=N("");for(let r in localStorage)r.slice(0,e.length)===e&&localStorage.removeItem(r)}},U=new x;function T(t){return`${t||af.article.id}.${af.userSession.login}`}function pe(t,e){if(!(af!=null&&af.userSession))return null;let r=T(e),n=JSON.parse(localStorage.getItem(r)||"{}");return t?n[t]||null:n}function me(t,e,r){if(!(af!=null&&af.userSession))return;let n=T(r),o=JSON.parse(localStorage.getItem(n)||"{}");typeof e<"u"?o[t]=e:o=t,localStorage.setItem(n,JSON.stringify(o))}var Se="2.1.2";export{c as SessionHandler,y as UserSession,h as downloadBlob,G as downloadRequest,z as expose,b as getLocalizedString,pe as getSettings,f as has,U as localStorage,P as localize,m as mitt,me as saveSettings,Se as version};
1
+ var $=Object.defineProperty;var L=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var p=(t,e,r)=>e in t?$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,z=(t,e)=>{for(var r in e||(e={}))N.call(e,r)&&p(t,r,e[r]);if(L)for(var r of L(e))H.call(e,r)&&p(t,r,e[r]);return t};var a=(t,e,r)=>(p(t,typeof e!="symbol"?e+"":e,r),r);window.addEventListener("error",t=>{var e,r,n,o,i,l,s;try{let d={error:(n=(r=(e=t.error)==null?void 0:e.message)!=null?r:t.message)!=null?n: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 m(t){return{all:t=t||new Map,on:function(e,r){var n=t.get(e);n?n.push(r):t.set(e,[r])},off:function(e,r){var n=t.get(e);n&&(r?n.splice(n.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var n=t.get(e);n&&n.slice().map(function(o){o(r)}),(n=t.get("*"))&&n.slice().map(function(o){o(e,r)})}}}var u=class{constructor(){a(this,"eventHandler",m())}authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(e,r){try{let n=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 n;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";r!=="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 n,o.remove()}}catch(n){window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(e,r){return this.eventHandler.on(e,r)}detachEvent(e,r){return this.eventHandler.off(e,r)}};var y=class extends u{constructor(r){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,r)}};function G(t){return U(t).substring(0,10)}function U(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(r,n){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),r()},250)}catch(o){n(o)}})}async function te(t,{fileName:e,signal:r,onProgress:n}){var l;function o(s){typeof n=="function"&&n(z({},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(),O=new ReadableStream({start:function(v){function A(){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),A()})}return A()}});s=new Response(O)}catch(c){}let d=await s.blob();o({bytesReceived:i,status:"downloaded"}),await h(d,e),o({bytesReceived:i,status:"completed"})}catch(s){r!=null&&r.aborted?o({status:"cancelled"}):o({error:s.message,status:"error"})}}function f(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var D=/^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(D);if(e===null)throw new TypeError("Unable to parse function!");return{name:e[1],args:e[2].split(","),body:e[3]}}function R(){}R.prototype=Object.create(null);var T=R;function x(t,e){if(typeof t=="object"){if(typeof e=="string"){let r=e.split(".");return x(t,r)}else if(Array.isArray(e)){let r=t;for(let n=0;n<e.length;n++)r=r[e[n]]=r[e[n]]||new T;return r}}}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 r of e){let{name:n}=w(r);if(n)j(t,r);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 r,n;if(typeof e=="function"&&(r=w(e).name),typeof t=="string"){let o=t.split(".");r||(r=o[o.length-1],o=o.slice(0,o.length-1)),n=x(window,o)}else if(r&&(typeof t=="object"||typeof t=="function"))n=t;else throw new TypeError("Invalid typeof parameter 'name', or unable to parse pValue!");f(n,r)?console.warn([t,r].join(".")+" is already defined!"):n[r]=e}}var _={xs:64,sm:128,md:256,lg:512,xl:void 0};function ge({primKey:t,login:e,hash:r,size:n="xs"}){if(!t||!r)return"";let o=_[n];return`/api/data/blob/EmployeesLookup/${t}/Image/${e}${e?".":""}${r}.jpg${o?`?width=${o}`:""}`}async function q(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 r;if(typeof t=="string"&&t.trim().length===0)return t;if(!(t===void 0||t===""||t===null))if(((r=af==null?void 0:af.article)==null?void 0:r.i18n)!==void 0){if(!f(af.article.i18n,t)){af.article.i18n[t]=t;let n=q(t).then(o=>(af.article.i18n[t]=o,o));if(e)return n}return af.article.i18n[t]}else return t}function M(t,...e){if(!Array.isArray(t)||t.length!==e.length+1)throw TypeError("Method 'localize' must be used as a tag function");let r=t.map((o,i)=>i===t.length-1?o:`${o}$${i}`).join(""),n=S(r);return e.forEach((o,i)=>{n=n.replace("$"+i,o)}),n}function E(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,r){return r?["common",e].join("."):E(e)}get(e,r,n){let o=this.getLocalStorageKey(e,n),i=localStorage.getItem(o);return i!==null?JSON.parse(i):r}set(e,r,n){localStorage.setItem(this.getLocalStorageKey(e,n),JSON.stringify(r))}remove(e,r){let n=this.getLocalStorageKey(e,r);return localStorage.getItem(n)!==null?(localStorage.removeItem(n),!0):!1}clear(){let e=E("");for(let r in localStorage)r.slice(0,e.length)===e&&localStorage.removeItem(r)}},P=new b;function I(t){return`${t||af.article.id}.${af.userSession.login}`}function Se(t,e){if(!(af!=null&&af.userSession))return null;let r=I(e),n=JSON.parse(localStorage.getItem(r)||"{}");return t?n[t]||null:n}function be(t,e,r){if(!(af!=null&&af.userSession))return;let n=I(r),o=JSON.parse(localStorage.getItem(n)||"{}");typeof e<"u"?o[t]=e:o=t,localStorage.setItem(n,JSON.stringify(o))}var ze="2.3.0";export{u as SessionHandler,y as UserSession,h as downloadBlob,te as downloadRequest,j as expose,S as getLocalizedString,Se as getSettings,ge as getUserImage,f as has,P as localStorage,M as localize,m as mitt,be as saveSettings,G as toLocalISODate,U as toLocalISODateTime,ze as version};
2
2
  //# sourceMappingURL=af.common.legacy.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/errorHandler.ts", "../../../../node_modules/mitt/src/index.ts", "../../src/SessionHandler.ts", "../../src/UserSession.ts", "../../src/downloadBlob.ts", "../../src/downloadRequest.ts", "../../src/has.ts", "../../src/parseFunc.ts", "../../src/Namespace.ts", "../../src/requireNamespace.ts", "../../src/expose.ts", "../../src/getLocalizedString.ts", "../../src/localize.ts", "../../src/localStorage.ts", "../../src/settings.ts", "../../src/index.ts"],
4
- "sourcesContent": ["window.addEventListener(\"error\", (event) => {\n try {\n // Try to avoid error-logging-loop\n const data = {\n error: event.error?.message ?? event.message ?? null,\n file: event.filename,\n line: event.lineno ?? 0,\n column: event.colno ?? 0,\n stack: event.error?.stack ?? null,\n };\n\n fetch(\"/data/Logger/LogError\", {\n body: JSON.stringify(data),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json; charset=utf-8\",\n \"X-Requested-With\": \"XMLHttpRequest\",\n },\n method: \"POST\",\n });\n } catch (ex) {\n // ignore\n }\n});\n", "export type EventType = string | symbol;\n\n// An event handler can take an optional event argument\n// and should not return a value\nexport type Handler<T = unknown> = (event: T) => void;\nexport type WildcardHandler<T = Record<string, unknown>> = (\n\ttype: keyof T,\n\tevent: T[keyof T]\n) => void;\n\n// An array of all currently registered event handlers for a type\nexport type EventHandlerList<T = unknown> = Array<Handler<T>>;\nexport type WildCardEventHandlerList<T = Record<string, unknown>> = Array<WildcardHandler<T>>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<\n\tkeyof Events | '*',\n\tEventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>\n>;\n\nexport interface Emitter<Events extends Record<EventType, unknown>> {\n\tall: EventHandlerMap<Events>;\n\n\ton<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;\n\ton(type: '*', handler: WildcardHandler<Events>): void;\n\n\toff<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;\n\toff(type: '*', handler: WildcardHandler<Events>): void;\n\n\temit<Key extends keyof Events>(type: Key, event: Events[Key]): void;\n\temit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt<Events extends Record<EventType, unknown>>(\n\tall?: EventHandlerMap<Events>\n): Emitter<Events> {\n\ttype GenericEventHandler =\n\t\t| Handler<Events[keyof Events]>\n\t\t| WildcardHandler<Events>;\n\tall = all || new Map();\n\n\treturn {\n\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `'*'` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<Key extends keyof Events>(type: Key, handler: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.push(handler);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tall!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * If `handler` is omitted, all handlers of the given type are removed.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from, or `'*'`\n\t\t * @param {Function} [handler] Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\tif (handler) {\n\t\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tall!.set(type, []);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `'*'` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing '*' handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {\n\t\t\tlet handlers = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as EventHandlerList<Events[keyof Events]>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(evt!);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\thandlers = all!.get('*');\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as WildCardEventHandlerList<Events>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(type, evt!);\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\n", "import mitt, { Emitter, Handler } from \"mitt\";\n\ntype SessionHandlerEvent = \"onExpired\" | \"onAuthenticated\";\n\nexport default class SessionHandler {\n private eventHandler: Emitter<{ onAuthenticated: void; onExpired: void }> = mitt();\n\n authenticated() {\n this.eventHandler.emit(\"onAuthenticated\");\n }\n\n async expired(callback?: () => void, type?: \"RequireTwoFactor\"): Promise<void> {\n try {\n let authPromise = new Promise<void>((resolve) => {\n let eventHandler = () => {\n this.eventHandler.off(\"onAuthenticated\", eventHandler);\n callback?.();\n resolve();\n };\n\n this.eventHandler.on(\"onAuthenticated\", eventHandler);\n });\n\n let dialog: HTMLDialogElement | null = document.querySelector(\"dialog.session-expired-dialog\");\n if (!dialog) {\n dialog = document.createElement(\"dialog\");\n dialog.className = \"session-expired-dialog\";\n dialog.style.display = \"flex\";\n dialog.style.padding = \"0\";\n dialog.style.left = \"50%\";\n dialog.style.transform = \"translateX(-50%)\";\n\n let link = \"/login?ReturnUrl=%2fapi/sessionexpired/remove\";\n if (type !== \"RequireTwoFactor\") {\n await fetch(\"/logout\", { method: \"POST\" });\n } else {\n link = \"/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove\";\n }\n\n dialog.innerHTML = `<iframe sandbox=\"allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms\" src=\"${link}\" style=\"border:0;width:min(500px,100vw);height:min(700px, 100vh);\"></iframe>`;\n document.body.append(dialog);\n dialog.showModal();\n await authPromise;\n dialog.remove();\n } else {\n await authPromise;\n }\n } catch (_) {\n window.location.href = `/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(\n window.location.search\n )}`;\n }\n }\n\n attachEvent(eventName: SessionHandlerEvent, handler: Handler) {\n return this.eventHandler.on(eventName, handler);\n }\n\n detachEvent(eventName: SessionHandlerEvent, handler: Handler) {\n return this.eventHandler.off(eventName, handler);\n }\n}\n", "import SessionHandler from \"./SessionHandler.js\";\n\nexport class UserSession extends SessionHandler {\n amDesignator: string = \"a.m.\";\n dayNames: string[] = [\"sunday\", \"monday\", \"tuesday\", \"wednesday\", \"thursday\", \"friday\", \"saturday\"];\n dayNamesShort: string[] = [\"sun\", \"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\"];\n decimalSeparator: string = \".\";\n domain: string = \"OB\";\n email: string | null | undefined;\n formats: undefined | Record<string, string>;\n groupSeparator: string | null = null;\n integratedSecurity: boolean = false;\n isDeveloper: boolean = false;\n login: string = \"\";\n loginType: string | undefined;\n monthNames: string[] = [\"january\", \"february\", \"march\", \"april\", \"may\", \"june\", \"july\", \"august\", \"september\", \"october\", \"november\", \"december\", \"\"];\n monthNamesShort: string[] = [\"jan\", \"feb\", \"mar\", \"apr\", \"may\", \"jun\", \"jul\", \"augt\", \"sep\", \"oct\", \"nov\", \"dec\", \"\"];\n name: string | undefined;\n pmDesignator: string = \"p.m.\";\n shortDateFormat: string = \"dd.MM.yyyy\";\n culture: string = \"en-GB\";\n uiculture: string = \"en-GB\";\n\n constructor(userData: any) {\n super();\n this.formats = {};\n Object.assign(this, userData);\n }\n}\n", "export function downloadBlob(blob: Blob | MediaSource, fileName: string) {\n return new Promise<void>(function (resolve, reject) {\n try {\n const url = URL.createObjectURL(blob);\n const parent = document.body;\n const anchor = document.createElement(\"a\");\n anchor.setAttribute(\"download\", fileName);\n anchor.href = url;\n parent.append(anchor);\n anchor.click();\n parent.removeChild(anchor);\n\n setTimeout(function () {\n URL.revokeObjectURL(url);\n resolve();\n }, 250);\n } catch (ex) {\n reject(ex);\n }\n });\n}\n", "import { downloadBlob } from \"./downloadBlob.js\";\n\nexport type DownloadItem = {\n status: \"cancelled\" | \"error\" | \"requested\" | \"downloading\" | \"downloaded\" | \"completed\";\n bytesReceived?: number;\n error?: string;\n};\n\nexport type DownloadParameters = {\n signal?: AbortSignal;\n fileName: string;\n onProgress?: (progress: DownloadItem) => void;\n};\n\nexport async function downloadRequest(request: Request, { fileName, signal, onProgress }: DownloadParameters) {\n function reportProgress(progress: DownloadItem) {\n if (typeof onProgress === \"function\") {\n onProgress({ ...progress });\n }\n }\n\n let bytesReceived = 0;\n\n reportProgress({ status: \"requested\" });\n\n try {\n let response = await fetch(request);\n\n if (!response.ok || !response.body) {\n if (response.headers.get(\"content-type\")?.includes(\"application/json\")) {\n let data = await response.json();\n if (data.error) {\n throw new Error(data.error);\n }\n }\n throw new Error(`${response.status} ${response.statusText}`);\n }\n\n try {\n const reader = response.body.getReader();\n const stream = new ReadableStream({\n start: function (controller) {\n function pump(): Promise<void> {\n return reader.read().then(function (read) {\n if (read.done) {\n controller.close();\n return;\n }\n\n bytesReceived += read.value.length;\n reportProgress({ bytesReceived, status: \"downloading\" });\n controller.enqueue(read.value);\n\n return pump();\n });\n }\n\n return pump();\n },\n });\n\n response = new Response(stream);\n } catch (error) {}\n\n const blob = await response.blob();\n\n reportProgress({ bytesReceived, status: \"downloaded\" });\n\n await downloadBlob(blob, fileName);\n\n reportProgress({ bytesReceived, status: \"completed\" });\n } catch (err) {\n if (signal?.aborted) {\n reportProgress({ status: \"cancelled\" });\n } else {\n reportProgress({ error: (err as Error).message, status: \"error\" });\n }\n }\n}\n", "export function has(\n obj: any,\n key: string | number | symbol\n): boolean {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n", "const funcRegex = /^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)*)\\}$/;\n\nexport function parseFunc(func: Function) {\n var match = func.toString().match(funcRegex);\n if (match === null) {\n throw new TypeError(\"Unable to parse function!\");\n }\n return { name: match[1], args: match[2].split(\",\"), body: match[3] };\n}\n", "function Namespace() {}\nNamespace.prototype = Object.create(null);\n\nexport default Namespace;\n", "import Namespace from \"./Namespace.js\";\n\nexport function requireNamespace(\n root: any,\n namespace: string | Array<string>\n): any {\n if (typeof root === \"object\") {\n if (typeof namespace === \"string\") {\n let path = namespace.split(\".\");\n\n return requireNamespace(root, path);\n } else if (Array.isArray(namespace)) {\n let current: any = root;\n for (let i = 0; i < namespace.length; i++) {\n current = current[namespace[i]] =\n current[namespace[i]] || new (Namespace as any)();\n }\n\n return current;\n }\n }\n}\n", "import { has } from \"./has.js\";\nimport { parseFunc } from \"./parseFunc.js\";\nimport { requireNamespace } from \"./requireNamespace.js\";\n\n/**\n * Expose a value to a potentially deeply nested global variable\n * @param name {string | object} Either a dot-separated path to the global variable, or an object to expose the value on\n * @param value {object | Function | Function[]} The value(s) to expose\n */\nexport function expose(name: object | string, value: object | Function | Function[]): void {\n if (arguments.length !== 2) {\n throw new Error(\"Incorrect number of arguments passed to the expose function!\");\n }\n\n if (Array.isArray(value)) {\n for (let func of value) {\n const { name: funcName } = parseFunc(func);\n\n if (funcName) {\n expose(name, func); // Expose func on namespace found in pName\n } else {\n throw new Error(\n \"Unable to detect name of function! Name it, or only supply one function and include name in first parameter.\"\n );\n }\n }\n } else {\n let keyName: string | undefined;\n let namespace;\n\n if (typeof value === \"function\") {\n keyName = parseFunc(value).name;\n }\n\n if (typeof name === \"string\") {\n let pathParts = name.split(\".\");\n\n if (!keyName) {\n keyName = pathParts[pathParts.length - 1];\n pathParts = pathParts.slice(0, pathParts.length - 1);\n }\n\n namespace = requireNamespace(window, pathParts);\n } else if (keyName && (typeof name === \"object\" || typeof name === \"function\")) {\n namespace = name;\n } else {\n throw new TypeError(\"Invalid typeof parameter 'name', or unable to parse pValue!\");\n }\n\n if (has(namespace, keyName)) {\n // If class is already defined, warn or show an alert\n console.warn([name, keyName].join(\".\") + \" is already defined!\");\n } else {\n namespace[keyName] = value;\n }\n }\n}\n", "import { has } from \"./has\";\n\nasync function fetchLocalizedString(text: string) {\n try {\n let response = await fetch(`/api/user/localize/new/${af.article.id}`, {\n body: JSON.stringify({ text }),\n headers: {\n Accept: \"application/json; */*\",\n \"Content-Type\": \"application/json\",\n \"X-Requested-With\": \"XMLHttpRequest\",\n },\n method: \"POST\",\n });\n\n if (response.ok) {\n return (await response.json()) as string;\n }\n } catch (error) {}\n\n return text;\n}\nexport function getLocalizedStringAsync(string: undefined | null): undefined | null;\nexport function getLocalizedStringAsync(string: string): Promise<string>;\nexport function getLocalizedStringAsync(string: string | undefined | null) {\n if (!string) return string;\n\n return getLocalizedString(string, true);\n}\n\nexport function getLocalizedString(string: undefined | null): undefined | null;\nexport function getLocalizedString(string: string): string;\nexport function getLocalizedString(string: string, wait: false): string;\nexport function getLocalizedString(string: string, wait: true): Promise<string>;\nexport function getLocalizedString(string: undefined | null, wait: true): undefined | null;\nexport function getLocalizedString(\n string: string | undefined | null,\n wait?: boolean\n): string | undefined | null | Promise<string> {\n if (typeof string === \"string\" && string.trim().length === 0) {\n return string;\n }\n\n if (string === undefined || string === \"\" || string === null) {\n return;\n }\n\n if (af?.article?.i18n !== undefined) {\n if (!has(af.article.i18n, string)) {\n af.article.i18n[string] = string;\n\n let promise = fetchLocalizedString(string).then((text) => {\n af.article.i18n[string] = text;\n return text;\n });\n\n if (wait) {\n return promise;\n }\n }\n\n return af.article.i18n[string];\n } else {\n return string;\n }\n}\n", "import { getLocalizedString } from \"./getLocalizedString.js\";\n\n/**\n * Localization function for tagged templates. Replaces the arguments\n * with $n, where n is the index, before asking Appframe to translate\n * the string.\n * \n * For example, if you call localize`Page ${2} or ${5}`, the string\n * \"Page $0 of $1\" will be sent to Appframe, and for norwegian,\n * \"Side 2 av 5\" will be returned.\n * \n * @param stringParts \n * @param args \n * @returns Translated string\n */\nexport function localize(stringParts: TemplateStringsArray, ...args: any[]): string {\n if (!Array.isArray(stringParts) || stringParts.length !== args.length + 1) {\n throw TypeError(\"Method 'localize' must be used as a tag function\");\n }\n\n let stringToLocalize = stringParts.map((s, i) => (i === stringParts.length - 1 ? s : `${s}\\$${i}`)).join(\"\");\n let localized = getLocalizedString(stringToLocalize);\n\n args.forEach((arg, index) => {\n localized = localized.replace(\"$\" + index, arg);\n })\n\n return localized;\n}", "function getLocalKey(key: string): string {\n return [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n isPersisted() {\n return true;\n }\n\n getLocalStorageKey(key: string, global?: boolean) {\n return global ? [\"common\", key].join(\".\") : getLocalKey(key);\n }\n\n get(key: string, defaultValue: unknown, global?: boolean) {\n const lsKey = this.getLocalStorageKey(key, global);\n const value = localStorage.getItem(lsKey);\n\n return value !== null ? JSON.parse(value) : defaultValue;\n }\n\n set(key: string, value: unknown, global?: boolean) {\n localStorage.setItem(\n this.getLocalStorageKey(key, global),\n JSON.stringify(value)\n );\n }\n\n remove(key: string, global?: boolean) {\n const lsKey = this.getLocalStorageKey(key, global);\n if (localStorage.getItem(lsKey) !== null) {\n localStorage.removeItem(lsKey);\n return true;\n } else {\n return false;\n }\n }\n\n clear() {\n const baseKey = getLocalKey(\"\");\n\n for (let key in localStorage) {\n if (key.slice(0, baseKey.length) === baseKey) {\n localStorage.removeItem(key);\n }\n }\n }\n}\n\nexport default new LocalStorage();\n", "function getKey(article?: string) {\n const articleKey = article || af.article.id;\n return `${articleKey}.${af.userSession.login}`;\n}\n\nexport function getSettings<T>(setting: string, article?: string): T | null {\n if (!af?.userSession) return null;\n\n const key = getKey(article);\n const settings = JSON.parse(localStorage.getItem(key) || \"{}\");\n\n if (setting) {\n return settings[setting] || null;\n }\n\n return settings;\n}\n\nexport function saveSettings<T>(\n setting: string,\n value: T | null,\n article?: string\n): void {\n if (!af?.userSession) return;\n\n const key = getKey(article);\n let userSettings = JSON.parse(localStorage.getItem(key) || \"{}\");\n\n if (typeof value !== \"undefined\") {\n userSettings[setting] = value;\n } else {\n userSettings = setting;\n }\n\n localStorage.setItem(key, JSON.stringify(userSettings));\n}\n", "import \"./errorHandler.js\";\n\nimport { UserSession } from \"./UserSession.js\";\n\nexport { default as mitt } from \"mitt\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport * from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport { localize } from \"./localize.js\";\nexport * from \"./has.js\";\nexport { default as localStorage } from \"./localStorage.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport * from \"./settings.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n var __VERSION__: string;\n var __DEV__: number;\n var af: AfCore;\n\n interface Window {\n af: AfCore;\n }\n}\n\nexport interface AfArticle {\n hostName: string;\n i18n: Record<string, string>;\n id: string;\n}\n\nexport interface AfCore {\n article: AfArticle;\n common?: {\n getLocalizedString?: (string: string) => string;\n };\n controls?: {\n alert?: (message: string, callback?: () => void) => void;\n confirm?: (options: {\n title: string;\n message: string;\n buttons: string[];\n callback: (button: number) => void;\n }) => void;\n };\n userSession: UserSession;\n}\n"],
5
- "mappings": "6YAAA,OAAO,iBAAiB,QAAUA,GAAU,CAA5C,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,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MA,GACnC,aAAa,WAAWP,CAAG,CAGjC,CACF,EAEOQ,EAAQ,IAAIN,EChDnB,SAASO,EAAOC,EAAkB,CAEhC,MAAO,GADYA,GAAW,GAAG,QAAQ,MACjB,GAAG,YAAY,OACzC,CAEO,SAASC,GAAeC,EAAiBF,EAA4B,CAC1E,GAAI,EAAC,aAAI,aAAa,OAAO,KAE7B,IAAMG,EAAMJ,EAAOC,CAAO,EACpBI,EAAW,KAAK,MAAM,aAAa,QAAQD,CAAG,GAAK,IAAI,EAE7D,OAAID,EACKE,EAASF,IAAY,KAGvBE,CACT,CAEO,SAASC,GACdH,EACAI,EACAN,EACM,CACN,GAAI,EAAC,aAAI,aAAa,OAEtB,IAAMG,EAAMJ,EAAOC,CAAO,EACtBO,EAAe,KAAK,MAAM,aAAa,QAAQJ,CAAG,GAAK,IAAI,EAE3D,OAAOG,EAAU,IACnBC,EAAaL,GAAWI,EAExBC,EAAeL,EAGjB,aAAa,QAAQC,EAAK,KAAK,UAAUI,CAAY,CAAC,CACxD,CCnBO,IAAMC,GAAU",
6
- "names": ["event", "_a", "_b", "_c", "_d", "_e", "_f", "_g", "data", "ex", "all", "Map", "on", "type", "handler", "handlers", "get", "push", "set", "off", "splice", "indexOf", "emit", "evt", "slice", "map", "SessionHandler", "__publicField", "mitt_default", "callback", "type", "authPromise", "resolve", "eventHandler", "dialog", "link", "_", "eventName", "handler", "UserSession", "SessionHandler", "userData", "__publicField", "downloadBlob", "blob", "fileName", "resolve", "reject", "url", "parent", "anchor", "ex", "downloadRequest", "request", "fileName", "signal", "onProgress", "_a", "reportProgress", "progress", "__spreadValues", "bytesReceived", "response", "data", "reader", "stream", "controller", "pump", "read", "error", "blob", "downloadBlob", "err", "has", "obj", "key", "funcRegex", "parseFunc", "func", "match", "Namespace", "Namespace_default", "requireNamespace", "root", "namespace", "path", "current", "i", "Namespace_default", "expose", "name", "value", "func", "funcName", "parseFunc", "keyName", "namespace", "pathParts", "requireNamespace", "has", "fetchLocalizedString", "text", "response", "error", "getLocalizedString", "string", "wait", "_a", "has", "promise", "fetchLocalizedString", "text", "localize", "stringParts", "args", "stringToLocalize", "s", "localized", "getLocalizedString", "arg", "index", "getLocalKey", "key", "_a", "LocalStorage", "global", "defaultValue", "lsKey", "value", "baseKey", "localStorage_default", "getKey", "article", "getSettings", "setting", "key", "settings", "saveSettings", "value", "userSettings", "version"]
3
+ "sources": ["../../src/errorHandler.ts", "../../../../node_modules/mitt/src/index.ts", "../../src/SessionHandler.ts", "../../src/UserSession.ts", "../../src/date.ts", "../../src/downloadBlob.ts", "../../src/downloadRequest.ts", "../../src/has.ts", "../../src/parseFunc.ts", "../../src/Namespace.ts", "../../src/requireNamespace.ts", "../../src/expose.ts", "../../src/getUserImage.ts", "../../src/getLocalizedString.ts", "../../src/localize.ts", "../../src/localStorage.ts", "../../src/settings.ts", "../../src/index.ts"],
4
+ "sourcesContent": ["window.addEventListener(\"error\", (event) => {\n try {\n // Try to avoid error-logging-loop\n const data = {\n error: event.error?.message ?? event.message ?? null,\n file: event.filename,\n line: event.lineno ?? 0,\n column: event.colno ?? 0,\n stack: event.error?.stack ?? null,\n };\n\n fetch(\"/data/Logger/LogError\", {\n body: JSON.stringify(data),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json; charset=utf-8\",\n \"X-Requested-With\": \"XMLHttpRequest\",\n },\n method: \"POST\",\n });\n } catch (ex) {\n // ignore\n }\n});\n", "export type EventType = string | symbol;\n\n// An event handler can take an optional event argument\n// and should not return a value\nexport type Handler<T = unknown> = (event: T) => void;\nexport type WildcardHandler<T = Record<string, unknown>> = (\n\ttype: keyof T,\n\tevent: T[keyof T]\n) => void;\n\n// An array of all currently registered event handlers for a type\nexport type EventHandlerList<T = unknown> = Array<Handler<T>>;\nexport type WildCardEventHandlerList<T = Record<string, unknown>> = Array<WildcardHandler<T>>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<\n\tkeyof Events | '*',\n\tEventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>\n>;\n\nexport interface Emitter<Events extends Record<EventType, unknown>> {\n\tall: EventHandlerMap<Events>;\n\n\ton<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;\n\ton(type: '*', handler: WildcardHandler<Events>): void;\n\n\toff<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;\n\toff(type: '*', handler: WildcardHandler<Events>): void;\n\n\temit<Key extends keyof Events>(type: Key, event: Events[Key]): void;\n\temit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt<Events extends Record<EventType, unknown>>(\n\tall?: EventHandlerMap<Events>\n): Emitter<Events> {\n\ttype GenericEventHandler =\n\t\t| Handler<Events[keyof Events]>\n\t\t| WildcardHandler<Events>;\n\tall = all || new Map();\n\n\treturn {\n\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `'*'` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<Key extends keyof Events>(type: Key, handler: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.push(handler);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tall!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * If `handler` is omitted, all handlers of the given type are removed.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from, or `'*'`\n\t\t * @param {Function} [handler] Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\tif (handler) {\n\t\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tall!.set(type, []);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `'*'` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing '*' handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {\n\t\t\tlet handlers = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as EventHandlerList<Events[keyof Events]>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(evt!);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\thandlers = all!.get('*');\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as WildCardEventHandlerList<Events>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(type, evt!);\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\n", "import mitt, { Emitter, Handler } from \"mitt\";\n\ntype SessionHandlerEvent = \"onExpired\" | \"onAuthenticated\";\n\nexport default class SessionHandler {\n private eventHandler: Emitter<{ onAuthenticated: void; onExpired: void }> = mitt();\n\n authenticated() {\n this.eventHandler.emit(\"onAuthenticated\");\n }\n\n async expired(callback?: () => void, type?: \"RequireTwoFactor\"): Promise<void> {\n try {\n let authPromise = new Promise<void>((resolve) => {\n let eventHandler = () => {\n this.eventHandler.off(\"onAuthenticated\", eventHandler);\n callback?.();\n resolve();\n };\n\n this.eventHandler.on(\"onAuthenticated\", eventHandler);\n });\n\n let dialog: HTMLDialogElement | null = document.querySelector(\"dialog.session-expired-dialog\");\n if (!dialog) {\n dialog = document.createElement(\"dialog\");\n dialog.className = \"session-expired-dialog\";\n dialog.style.display = \"flex\";\n dialog.style.padding = \"0\";\n dialog.style.left = \"50%\";\n dialog.style.transform = \"translateX(-50%)\";\n\n let link = \"/login?ReturnUrl=%2fapi/sessionexpired/remove\";\n if (type !== \"RequireTwoFactor\") {\n await fetch(\"/logout\", { method: \"POST\" });\n } else {\n link = \"/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove\";\n }\n\n dialog.innerHTML = `<iframe sandbox=\"allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms\" src=\"${link}\" style=\"border:0;width:min(500px,100vw);height:min(700px, 100vh);\"></iframe>`;\n document.body.append(dialog);\n dialog.showModal();\n await authPromise;\n dialog.remove();\n } else {\n await authPromise;\n }\n } catch (_) {\n window.location.href = `/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(\n window.location.search\n )}`;\n }\n }\n\n attachEvent(eventName: SessionHandlerEvent, handler: Handler) {\n return this.eventHandler.on(eventName, handler);\n }\n\n detachEvent(eventName: SessionHandlerEvent, handler: Handler) {\n return this.eventHandler.off(eventName, handler);\n }\n}\n", "import SessionHandler from \"./SessionHandler.js\";\n\nexport class UserSession extends SessionHandler {\n amDesignator: string = \"a.m.\";\n dayNames: string[] = [\"sunday\", \"monday\", \"tuesday\", \"wednesday\", \"thursday\", \"friday\", \"saturday\"];\n dayNamesShort: string[] = [\"sun\", \"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\"];\n decimalSeparator: string = \".\";\n domain: string = \"OB\";\n email: string | null | undefined;\n formats: undefined | Record<string, string>;\n groupSeparator: string | null = null;\n integratedSecurity: boolean = false;\n isDeveloper: boolean = false;\n login: string = \"\";\n loginType: string | undefined;\n monthNames: string[] = [\"january\", \"february\", \"march\", \"april\", \"may\", \"june\", \"july\", \"august\", \"september\", \"october\", \"november\", \"december\", \"\"];\n monthNamesShort: string[] = [\"jan\", \"feb\", \"mar\", \"apr\", \"may\", \"jun\", \"jul\", \"augt\", \"sep\", \"oct\", \"nov\", \"dec\", \"\"];\n name: string | undefined;\n pmDesignator: string = \"p.m.\";\n shortDateFormat: string = \"dd.MM.yyyy\";\n culture: string = \"en-GB\";\n uiculture: string = \"en-GB\";\n\n constructor(userData: any) {\n super();\n this.formats = {};\n Object.assign(this, userData);\n }\n}\n", "export function toLocalISODate(date: Date) {\n return toLocalISODateTime(date).substring(0, 10);\n}\n\nexport function toLocalISODateTime(date: Date) {\n let newDate = new Date(date);\n newDate.setUTCFullYear(date.getFullYear());\n newDate.setUTCMonth(date.getMonth());\n newDate.setUTCDate(date.getDate());\n newDate.setUTCHours(date.getHours());\n newDate.setUTCMinutes(date.getMinutes());\n\n return newDate.toISOString().replace(\"Z\", \"\");\n}\n", "export function downloadBlob(blob: Blob | MediaSource, fileName: string) {\n return new Promise<void>(function (resolve, reject) {\n try {\n const url = URL.createObjectURL(blob);\n const parent = document.body;\n const anchor = document.createElement(\"a\");\n anchor.setAttribute(\"download\", fileName);\n anchor.href = url;\n parent.append(anchor);\n anchor.click();\n parent.removeChild(anchor);\n\n setTimeout(function () {\n URL.revokeObjectURL(url);\n resolve();\n }, 250);\n } catch (ex) {\n reject(ex);\n }\n });\n}\n", "import { downloadBlob } from \"./downloadBlob.js\";\n\nexport type DownloadItem = {\n status: \"cancelled\" | \"error\" | \"requested\" | \"downloading\" | \"downloaded\" | \"completed\";\n bytesReceived?: number;\n error?: string;\n};\n\nexport type DownloadParameters = {\n signal?: AbortSignal;\n fileName: string;\n onProgress?: (progress: DownloadItem) => void;\n};\n\nexport async function downloadRequest(request: Request, { fileName, signal, onProgress }: DownloadParameters) {\n function reportProgress(progress: DownloadItem) {\n if (typeof onProgress === \"function\") {\n onProgress({ ...progress });\n }\n }\n\n let bytesReceived = 0;\n\n reportProgress({ status: \"requested\" });\n\n try {\n let response = await fetch(request);\n\n if (!response.ok || !response.body) {\n if (response.headers.get(\"content-type\")?.includes(\"application/json\")) {\n let data = await response.json();\n if (data.error) {\n throw new Error(data.error);\n }\n }\n throw new Error(`${response.status} ${response.statusText}`);\n }\n\n try {\n const reader = response.body.getReader();\n const stream = new ReadableStream({\n start: function (controller) {\n function pump(): Promise<void> {\n return reader.read().then(function (read) {\n if (read.done) {\n controller.close();\n return;\n }\n\n bytesReceived += read.value.length;\n reportProgress({ bytesReceived, status: \"downloading\" });\n controller.enqueue(read.value);\n\n return pump();\n });\n }\n\n return pump();\n },\n });\n\n response = new Response(stream);\n } catch (error) {}\n\n const blob = await response.blob();\n\n reportProgress({ bytesReceived, status: \"downloaded\" });\n\n await downloadBlob(blob, fileName);\n\n reportProgress({ bytesReceived, status: \"completed\" });\n } catch (err) {\n if (signal?.aborted) {\n reportProgress({ status: \"cancelled\" });\n } else {\n reportProgress({ error: (err as Error).message, status: \"error\" });\n }\n }\n}\n", "export function has(\n obj: any,\n key: string | number | symbol\n): boolean {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n", "const funcRegex = /^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)*)\\}$/;\n\nexport function parseFunc(func: Function) {\n var match = func.toString().match(funcRegex);\n if (match === null) {\n throw new TypeError(\"Unable to parse function!\");\n }\n return { name: match[1], args: match[2].split(\",\"), body: match[3] };\n}\n", "function Namespace() {}\nNamespace.prototype = Object.create(null);\n\nexport default Namespace;\n", "import Namespace from \"./Namespace.js\";\n\nexport function requireNamespace(\n root: any,\n namespace: string | Array<string>\n): any {\n if (typeof root === \"object\") {\n if (typeof namespace === \"string\") {\n let path = namespace.split(\".\");\n\n return requireNamespace(root, path);\n } else if (Array.isArray(namespace)) {\n let current: any = root;\n for (let i = 0; i < namespace.length; i++) {\n current = current[namespace[i]] =\n current[namespace[i]] || new (Namespace as any)();\n }\n\n return current;\n }\n }\n}\n", "import { has } from \"./has.js\";\nimport { parseFunc } from \"./parseFunc.js\";\nimport { requireNamespace } from \"./requireNamespace.js\";\n\n/**\n * Expose a value to a potentially deeply nested global variable\n * @param name {string | object} Either a dot-separated path to the global variable, or an object to expose the value on\n * @param value {object | Function | Function[]} The value(s) to expose\n */\nexport function expose(name: object | string, value: object | Function | Function[]): void {\n if (arguments.length !== 2) {\n throw new Error(\"Incorrect number of arguments passed to the expose function!\");\n }\n\n if (Array.isArray(value)) {\n for (let func of value) {\n const { name: funcName } = parseFunc(func);\n\n if (funcName) {\n expose(name, func); // Expose func on namespace found in pName\n } else {\n throw new Error(\n \"Unable to detect name of function! Name it, or only supply one function and include name in first parameter.\"\n );\n }\n }\n } else {\n let keyName: string | undefined;\n let namespace;\n\n if (typeof value === \"function\") {\n keyName = parseFunc(value).name;\n }\n\n if (typeof name === \"string\") {\n let pathParts = name.split(\".\");\n\n if (!keyName) {\n keyName = pathParts[pathParts.length - 1];\n pathParts = pathParts.slice(0, pathParts.length - 1);\n }\n\n namespace = requireNamespace(window, pathParts);\n } else if (keyName && (typeof name === \"object\" || typeof name === \"function\")) {\n namespace = name;\n } else {\n throw new TypeError(\"Invalid typeof parameter 'name', or unable to parse pValue!\");\n }\n\n if (has(namespace, keyName)) {\n // If class is already defined, warn or show an alert\n console.warn([name, keyName].join(\".\") + \" is already defined!\");\n } else {\n namespace[keyName] = value;\n }\n }\n}\n", "export type ImageSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport interface getUserImageOptions {\n /**\n * Prim key of the record in atbl_Personnel_Employees\n */\n primKey: string | null;\n /**\n * Person ID of the employee\n */\n login: string | null;\n /**\n * The value of the ImageHash column in atbl_Personnel_Employees\n */\n hash: string | number | null;\n /**\n * The image will be resized according to this value. Default is 'xs':\n * - xs: 64px\n * - sm: 128px\n * - md: 256px\n * - lg: 512px\n * - xl: image is not resized\n */\n size?: ImageSize;\n}\n\nconst sizeMap: Record<ImageSize, number | undefined> = {\n xs: 64,\n sm: 128,\n md: 256,\n lg: 512,\n xl: undefined,\n};\n\n/**\n * Returns the absolute path of a users profile picture. Uses the EmployeesLookup\n * data resource to enable caching across applications.\n *\n * If one of primKey or hash are not provided, or are null, an empty string will be returned.\n */\nexport function getUserImage({ primKey, login, hash, size = \"xs\" }: getUserImageOptions) {\n if (!primKey || !hash) {\n return \"\";\n }\n\n let sizePx = sizeMap[size];\n return `/api/data/blob/EmployeesLookup/${primKey}/Image/${login}${login ? \".\" : \"\"}${hash}.jpg${\n sizePx ? `?width=${sizePx}` : \"\"\n }`;\n}\n", "import { has } from \"./has\";\n\nasync function fetchLocalizedString(text: string) {\n try {\n let response = await fetch(`/api/user/localize/new/${af.article.id}`, {\n body: JSON.stringify({ text }),\n headers: {\n Accept: \"application/json; */*\",\n \"Content-Type\": \"application/json\",\n \"X-Requested-With\": \"XMLHttpRequest\",\n },\n method: \"POST\",\n });\n\n if (response.ok) {\n return (await response.json()) as string;\n }\n } catch (error) {}\n\n return text;\n}\nexport function getLocalizedStringAsync(string: undefined | null): undefined | null;\nexport function getLocalizedStringAsync(string: string): Promise<string>;\nexport function getLocalizedStringAsync(string: string | undefined | null) {\n if (!string) return string;\n\n return getLocalizedString(string, true);\n}\n\nexport function getLocalizedString(string: undefined | null): undefined | null;\nexport function getLocalizedString(string: string): string;\nexport function getLocalizedString(string: string, wait: false): string;\nexport function getLocalizedString(string: string, wait: true): Promise<string>;\nexport function getLocalizedString(string: undefined | null, wait: true): undefined | null;\nexport function getLocalizedString(\n string: string | undefined | null,\n wait?: boolean\n): string | undefined | null | Promise<string> {\n if (typeof string === \"string\" && string.trim().length === 0) {\n return string;\n }\n\n if (string === undefined || string === \"\" || string === null) {\n return;\n }\n\n if (af?.article?.i18n !== undefined) {\n if (!has(af.article.i18n, string)) {\n af.article.i18n[string] = string;\n\n let promise = fetchLocalizedString(string).then((text) => {\n af.article.i18n[string] = text;\n return text;\n });\n\n if (wait) {\n return promise;\n }\n }\n\n return af.article.i18n[string];\n } else {\n return string;\n }\n}\n", "import { getLocalizedString } from \"./getLocalizedString.js\";\n\n/**\n * Localization function for tagged templates. Replaces the arguments\n * with $n, where n is the index, before asking Appframe to translate\n * the string.\n * \n * For example, if you call localize`Page ${2} or ${5}`, the string\n * \"Page $0 of $1\" will be sent to Appframe, and for norwegian,\n * \"Side 2 av 5\" will be returned.\n * \n * @param stringParts \n * @param args \n * @returns Translated string\n */\nexport function localize(stringParts: TemplateStringsArray, ...args: any[]): string {\n if (!Array.isArray(stringParts) || stringParts.length !== args.length + 1) {\n throw TypeError(\"Method 'localize' must be used as a tag function\");\n }\n\n let stringToLocalize = stringParts.map((s, i) => (i === stringParts.length - 1 ? s : `${s}\\$${i}`)).join(\"\");\n let localized = getLocalizedString(stringToLocalize);\n\n args.forEach((arg, index) => {\n localized = localized.replace(\"$\" + index, arg);\n })\n\n return localized;\n}", "function getLocalKey(key: string): string {\n return [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n isPersisted() {\n return true;\n }\n\n getLocalStorageKey(key: string, global?: boolean) {\n return global ? [\"common\", key].join(\".\") : getLocalKey(key);\n }\n\n get(key: string, defaultValue: unknown, global?: boolean) {\n const lsKey = this.getLocalStorageKey(key, global);\n const value = localStorage.getItem(lsKey);\n\n return value !== null ? JSON.parse(value) : defaultValue;\n }\n\n set(key: string, value: unknown, global?: boolean) {\n localStorage.setItem(\n this.getLocalStorageKey(key, global),\n JSON.stringify(value)\n );\n }\n\n remove(key: string, global?: boolean) {\n const lsKey = this.getLocalStorageKey(key, global);\n if (localStorage.getItem(lsKey) !== null) {\n localStorage.removeItem(lsKey);\n return true;\n } else {\n return false;\n }\n }\n\n clear() {\n const baseKey = getLocalKey(\"\");\n\n for (let key in localStorage) {\n if (key.slice(0, baseKey.length) === baseKey) {\n localStorage.removeItem(key);\n }\n }\n }\n}\n\nexport default new LocalStorage();\n", "function getKey(article?: string) {\n const articleKey = article || af.article.id;\n return `${articleKey}.${af.userSession.login}`;\n}\n\nexport function getSettings<T>(setting: string, article?: string): T | null {\n if (!af?.userSession) return null;\n\n const key = getKey(article);\n const settings = JSON.parse(localStorage.getItem(key) || \"{}\");\n\n if (setting) {\n return settings[setting] || null;\n }\n\n return settings;\n}\n\nexport function saveSettings<T>(\n setting: string,\n value: T | null,\n article?: string\n): void {\n if (!af?.userSession) return;\n\n const key = getKey(article);\n let userSettings = JSON.parse(localStorage.getItem(key) || \"{}\");\n\n if (typeof value !== \"undefined\") {\n userSettings[setting] = value;\n } else {\n userSettings = setting;\n }\n\n localStorage.setItem(key, JSON.stringify(userSettings));\n}\n", "import \"./errorHandler.js\";\n\nimport { UserSession } from \"./UserSession.js\";\n\nexport { default as mitt } from \"mitt\";\nexport * from \"./date.js\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport * from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport * from \"./getUserImage.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport { localize } from \"./localize.js\";\nexport * from \"./has.js\";\nexport { default as localStorage } from \"./localStorage.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport * from \"./settings.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n var __VERSION__: string;\n var __DEV__: number;\n var af: AfCore;\n\n interface Window {\n af: AfCore;\n }\n}\n\nexport interface AfArticle {\n hostName: string;\n i18n: Record<string, string>;\n id: string;\n}\n\nexport interface AfCore {\n article: AfArticle;\n common?: {\n getLocalizedString?: (string: string) => string;\n };\n controls?: {\n alert?: (message: string, callback?: () => void) => void;\n confirm?: (options: {\n title: string;\n message: string;\n buttons: string[];\n callback: (button: number) => void;\n }) => void;\n };\n userSession: UserSession;\n}\n"],
5
+ "mappings": "6YAAA,OAAO,iBAAiB,QAAUA,GAAU,CAA5C,IAAAC,EAAAC,EAAAC,EAAAC,E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BO,EAAe,KAAK,MAAM,aAAa,QAAQJ,CAAG,GAAK,IAAI,EAE3D,OAAOG,EAAU,IACnBC,EAAaL,GAAWI,EAExBC,EAAeL,EAGjB,aAAa,QAAQC,EAAK,KAAK,UAAUI,CAAY,CAAC,CACxD,CCjBO,IAAMC,GAAU",
6
+ "names": ["event", "_a", "_b", "_c", "_d", "_e", "_f", "_g", "data", "ex", "all", "Map", "on", "type", "handler", "handlers", "get", "push", "set", "off", "splice", "indexOf", "emit", "evt", "slice", "map", "SessionHandler", "__publicField", "mitt_default", "callback", "type", "authPromise", "resolve", "eventHandler", "dialog", "link", "_", "eventName", "handler", "UserSession", "SessionHandler", "userData", "__publicField", "toLocalISODate", "date", "toLocalISODateTime", "newDate", "downloadBlob", "blob", "fileName", "resolve", "reject", "url", "parent", "anchor", "ex", "downloadRequest", "request", "fileName", "signal", "onProgress", "_a", "reportProgress", "progress", "__spreadValues", "bytesReceived", "response", "data", "reader", "stream", "controller", "pump", "read", "error", "blob", "downloadBlob", "err", "has", "obj", "key", "funcRegex", "parseFunc", "func", "match", "Namespace", "Namespace_default", "requireNamespace", "root", "namespace", "path", "current", "i", "Namespace_default", "expose", "name", "value", "func", "funcName", "parseFunc", "keyName", "namespace", "pathParts", "requireNamespace", "has", "sizeMap", "getUserImage", "primKey", "login", "hash", "size", "sizePx", "fetchLocalizedString", "text", "response", "error", "getLocalizedString", "string", "wait", "_a", "has", "promise", "fetchLocalizedString", "text", "localize", "stringParts", "args", "stringToLocalize", "s", "localized", "getLocalizedString", "arg", "index", "getLocalKey", "key", "_a", "LocalStorage", "global", "defaultValue", "lsKey", "value", "baseKey", "localStorage_default", "getKey", "article", "getSettings", "setting", "key", "settings", "saveSettings", "value", "userSettings", "version"]
7
7
  }
@@ -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 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 D(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(),j=new ReadableStream({start:function(w){function b(){return l.read().then(function(u){if(u.done){w.close();return}return a+=u.value.length,o({bytesReceived:a,status:"downloading"}),w.enqueue(u.value),b()})}return b()}});i=new Response(j)}catch{}let R=await i.blob();o({bytesReceived:a,status:"downloaded"}),await g(R,t),o({bytesReceived:a,status:"completed"})}catch(i){n?.aborted?o({status:"cancelled"}):o({error:i.message,status:"error"})}}function c(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var E=/^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 p(e){var t=e.toString().match(E);if(t===null)throw new TypeError("Unable to parse function!");return{name:t[1],args:t[2].split(","),body:t[3]}}function S(){}S.prototype=Object.create(null);var x=S;function m(e,t){if(typeof e=="object"){if(typeof t=="string"){let n=t.split(".");return m(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 x;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}=p(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=p(t).name),typeof e=="string"){let o=e.split(".");n||(n=o[o.length-1],o=o.slice(0,o.length-1)),r=m(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!");c(r,n)?console.warn([e,n].join(".")+" is already defined!"):r[n]=t}}async function z(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(!c(af.article.i18n,e)){af.article.i18n[e]=e;let n=z(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 A(e){return[af?.article?.id||"","common",e].join(".")}var h=class{isPersisted(){return!0}getLocalStorageKey(t,n){return n?["common",t].join("."):A(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=A("");for(let n in localStorage)n.slice(0,t.length)===t&&localStorage.removeItem(n)}},T=new h;function L(e){return`${e||af.article.id}.${af.userSession.login}`}function ne(e,t){if(!af?.userSession)return null;let n=L(t),r=JSON.parse(localStorage.getItem(n)||"{}");return e?r[e]||null:r}function re(e,t,n){if(!af?.userSession)return;let r=L(n),o=JSON.parse(localStorage.getItem(r)||"{}");typeof t<"u"?o[e]=t:o=e,localStorage.setItem(r,JSON.stringify(o))}var se="2.1.2";export{s as SessionHandler,f as UserSession,g as downloadBlob,D as downloadRequest,v as expose,y as getLocalizedString,ne as getSettings,c as has,T as localStorage,N as localize,d as mitt,re as saveSettings,se 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 M(e){return T(e).substring(0,10)}function T(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 K(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(),R=new ReadableStream({start:function(w){function x(){return l.read().then(function(u){if(u.done){w.close();return}return a+=u.value.length,o({bytesReceived:a,status:"downloading"}),w.enqueue(u.value),x()})}return x()}});i=new Response(R)}catch{}let z=await i.blob();o({bytesReceived:a,status:"downloaded"}),await g(z,t),o({bytesReceived:a,status:"completed"})}catch(i){n?.aborted?o({status:"cancelled"}):o({error:i.message,status:"error"})}}function c(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 p(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 m(e,t){if(typeof e=="object"){if(typeof t=="string"){let n=t.split(".");return m(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}=p(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=p(t).name),typeof e=="string"){let o=e.split(".");n||(n=o[o.length-1],o=o.slice(0,o.length-1)),r=m(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!");c(r,n)?console.warn([e,n].join(".")+" is already defined!"):r[n]=t}}var E={xs:64,sm:128,md:256,lg:512,xl:void 0};function te({primKey:e,login:t,hash:n,size:r="xs"}){if(!e||!n)return"";let o=E[r];return`/api/data/blob/EmployeesLookup/${e}/Image/${t}${t?".":""}${n}.jpg${o?`?width=${o}`:""}`}async function I(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(!c(af.article.i18n,e)){af.article.i18n[e]=e;let n=I(e).then(r=>(af.article.i18n[e]=r,r));if(t)return n}return af.article.i18n[e]}else return e}function O(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 A(e){return[af?.article?.id||"","common",e].join(".")}var h=class{isPersisted(){return!0}getLocalStorageKey(t,n){return n?["common",t].join("."):A(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=A("");for(let n in localStorage)n.slice(0,t.length)===t&&localStorage.removeItem(n)}},$=new h;function L(e){return`${e||af.article.id}.${af.userSession.login}`}function le(e,t){if(!af?.userSession)return null;let n=L(t),r=JSON.parse(localStorage.getItem(n)||"{}");return e?r[e]||null:r}function ce(e,t,n){if(!af?.userSession)return;let r=L(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.0";export{s as SessionHandler,f as UserSession,g as downloadBlob,K as downloadRequest,v as expose,y as getLocalizedString,le as getSettings,te as getUserImage,c as has,$ as localStorage,O as localize,d as mitt,ce as saveSettings,M as toLocalISODate,T as toLocalISODateTime,ge as version};
2
2
  //# sourceMappingURL=af.common.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../src/errorHandler.ts", "../../../../node_modules/mitt/src/index.ts", "../../src/SessionHandler.ts", "../../src/UserSession.ts", "../../src/downloadBlob.ts", "../../src/downloadRequest.ts", "../../src/has.ts", "../../src/parseFunc.ts", "../../src/Namespace.ts", "../../src/requireNamespace.ts", "../../src/expose.ts", "../../src/getLocalizedString.ts", "../../src/localize.ts", "../../src/localStorage.ts", "../../src/settings.ts", "../../src/index.ts"],
4
- "sourcesContent": ["window.addEventListener(\"error\", (event) => {\n try {\n // Try to avoid error-logging-loop\n const data = {\n error: event.error?.message ?? event.message ?? null,\n file: event.filename,\n line: event.lineno ?? 0,\n column: event.colno ?? 0,\n stack: event.error?.stack ?? null,\n };\n\n fetch(\"/data/Logger/LogError\", {\n body: JSON.stringify(data),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json; charset=utf-8\",\n \"X-Requested-With\": \"XMLHttpRequest\",\n },\n method: \"POST\",\n });\n } catch (ex) {\n // ignore\n }\n});\n", "export type EventType = string | symbol;\n\n// An event handler can take an optional event argument\n// and should not return a value\nexport type Handler<T = unknown> = (event: T) => void;\nexport type WildcardHandler<T = Record<string, unknown>> = (\n\ttype: keyof T,\n\tevent: T[keyof T]\n) => void;\n\n// An array of all currently registered event handlers for a type\nexport type EventHandlerList<T = unknown> = Array<Handler<T>>;\nexport type WildCardEventHandlerList<T = Record<string, unknown>> = Array<WildcardHandler<T>>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<\n\tkeyof Events | '*',\n\tEventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>\n>;\n\nexport interface Emitter<Events extends Record<EventType, unknown>> {\n\tall: EventHandlerMap<Events>;\n\n\ton<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;\n\ton(type: '*', handler: WildcardHandler<Events>): void;\n\n\toff<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;\n\toff(type: '*', handler: WildcardHandler<Events>): void;\n\n\temit<Key extends keyof Events>(type: Key, event: Events[Key]): void;\n\temit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt<Events extends Record<EventType, unknown>>(\n\tall?: EventHandlerMap<Events>\n): Emitter<Events> {\n\ttype GenericEventHandler =\n\t\t| Handler<Events[keyof Events]>\n\t\t| WildcardHandler<Events>;\n\tall = all || new Map();\n\n\treturn {\n\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `'*'` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<Key extends keyof Events>(type: Key, handler: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.push(handler);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tall!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * If `handler` is omitted, all handlers of the given type are removed.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from, or `'*'`\n\t\t * @param {Function} [handler] Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\tif (handler) {\n\t\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tall!.set(type, []);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `'*'` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing '*' handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {\n\t\t\tlet handlers = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as EventHandlerList<Events[keyof Events]>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(evt!);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\thandlers = all!.get('*');\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as WildCardEventHandlerList<Events>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(type, evt!);\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\n", "import mitt, { Emitter, Handler } from \"mitt\";\n\ntype SessionHandlerEvent = \"onExpired\" | \"onAuthenticated\";\n\nexport default class SessionHandler {\n private eventHandler: Emitter<{ onAuthenticated: void; onExpired: void }> = mitt();\n\n authenticated() {\n this.eventHandler.emit(\"onAuthenticated\");\n }\n\n async expired(callback?: () => void, type?: \"RequireTwoFactor\"): Promise<void> {\n try {\n let authPromise = new Promise<void>((resolve) => {\n let eventHandler = () => {\n this.eventHandler.off(\"onAuthenticated\", eventHandler);\n callback?.();\n resolve();\n };\n\n this.eventHandler.on(\"onAuthenticated\", eventHandler);\n });\n\n let dialog: HTMLDialogElement | null = document.querySelector(\"dialog.session-expired-dialog\");\n if (!dialog) {\n dialog = document.createElement(\"dialog\");\n dialog.className = \"session-expired-dialog\";\n dialog.style.display = \"flex\";\n dialog.style.padding = \"0\";\n dialog.style.left = \"50%\";\n dialog.style.transform = \"translateX(-50%)\";\n\n let link = \"/login?ReturnUrl=%2fapi/sessionexpired/remove\";\n if (type !== \"RequireTwoFactor\") {\n await fetch(\"/logout\", { method: \"POST\" });\n } else {\n link = \"/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove\";\n }\n\n dialog.innerHTML = `<iframe sandbox=\"allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms\" src=\"${link}\" style=\"border:0;width:min(500px,100vw);height:min(700px, 100vh);\"></iframe>`;\n document.body.append(dialog);\n dialog.showModal();\n await authPromise;\n dialog.remove();\n } else {\n await authPromise;\n }\n } catch (_) {\n window.location.href = `/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(\n window.location.search\n )}`;\n }\n }\n\n attachEvent(eventName: SessionHandlerEvent, handler: Handler) {\n return this.eventHandler.on(eventName, handler);\n }\n\n detachEvent(eventName: SessionHandlerEvent, handler: Handler) {\n return this.eventHandler.off(eventName, handler);\n }\n}\n", "import SessionHandler from \"./SessionHandler.js\";\n\nexport class UserSession extends SessionHandler {\n amDesignator: string = \"a.m.\";\n dayNames: string[] = [\"sunday\", \"monday\", \"tuesday\", \"wednesday\", \"thursday\", \"friday\", \"saturday\"];\n dayNamesShort: string[] = [\"sun\", \"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\"];\n decimalSeparator: string = \".\";\n domain: string = \"OB\";\n email: string | null | undefined;\n formats: undefined | Record<string, string>;\n groupSeparator: string | null = null;\n integratedSecurity: boolean = false;\n isDeveloper: boolean = false;\n login: string = \"\";\n loginType: string | undefined;\n monthNames: string[] = [\"january\", \"february\", \"march\", \"april\", \"may\", \"june\", \"july\", \"august\", \"september\", \"october\", \"november\", \"december\", \"\"];\n monthNamesShort: string[] = [\"jan\", \"feb\", \"mar\", \"apr\", \"may\", \"jun\", \"jul\", \"augt\", \"sep\", \"oct\", \"nov\", \"dec\", \"\"];\n name: string | undefined;\n pmDesignator: string = \"p.m.\";\n shortDateFormat: string = \"dd.MM.yyyy\";\n culture: string = \"en-GB\";\n uiculture: string = \"en-GB\";\n\n constructor(userData: any) {\n super();\n this.formats = {};\n Object.assign(this, userData);\n }\n}\n", "export function downloadBlob(blob: Blob | MediaSource, fileName: string) {\n return new Promise<void>(function (resolve, reject) {\n try {\n const url = URL.createObjectURL(blob);\n const parent = document.body;\n const anchor = document.createElement(\"a\");\n anchor.setAttribute(\"download\", fileName);\n anchor.href = url;\n parent.append(anchor);\n anchor.click();\n parent.removeChild(anchor);\n\n setTimeout(function () {\n URL.revokeObjectURL(url);\n resolve();\n }, 250);\n } catch (ex) {\n reject(ex);\n }\n });\n}\n", "import { downloadBlob } from \"./downloadBlob.js\";\n\nexport type DownloadItem = {\n status: \"cancelled\" | \"error\" | \"requested\" | \"downloading\" | \"downloaded\" | \"completed\";\n bytesReceived?: number;\n error?: string;\n};\n\nexport type DownloadParameters = {\n signal?: AbortSignal;\n fileName: string;\n onProgress?: (progress: DownloadItem) => void;\n};\n\nexport async function downloadRequest(request: Request, { fileName, signal, onProgress }: DownloadParameters) {\n function reportProgress(progress: DownloadItem) {\n if (typeof onProgress === \"function\") {\n onProgress({ ...progress });\n }\n }\n\n let bytesReceived = 0;\n\n reportProgress({ status: \"requested\" });\n\n try {\n let response = await fetch(request);\n\n if (!response.ok || !response.body) {\n if (response.headers.get(\"content-type\")?.includes(\"application/json\")) {\n let data = await response.json();\n if (data.error) {\n throw new Error(data.error);\n }\n }\n throw new Error(`${response.status} ${response.statusText}`);\n }\n\n try {\n const reader = response.body.getReader();\n const stream = new ReadableStream({\n start: function (controller) {\n function pump(): Promise<void> {\n return reader.read().then(function (read) {\n if (read.done) {\n controller.close();\n return;\n }\n\n bytesReceived += read.value.length;\n reportProgress({ bytesReceived, status: \"downloading\" });\n controller.enqueue(read.value);\n\n return pump();\n });\n }\n\n return pump();\n },\n });\n\n response = new Response(stream);\n } catch (error) {}\n\n const blob = await response.blob();\n\n reportProgress({ bytesReceived, status: \"downloaded\" });\n\n await downloadBlob(blob, fileName);\n\n reportProgress({ bytesReceived, status: \"completed\" });\n } catch (err) {\n if (signal?.aborted) {\n reportProgress({ status: \"cancelled\" });\n } else {\n reportProgress({ error: (err as Error).message, status: \"error\" });\n }\n }\n}\n", "export function has(\n obj: any,\n key: string | number | symbol\n): boolean {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n", "const funcRegex = /^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)*)\\}$/;\n\nexport function parseFunc(func: Function) {\n var match = func.toString().match(funcRegex);\n if (match === null) {\n throw new TypeError(\"Unable to parse function!\");\n }\n return { name: match[1], args: match[2].split(\",\"), body: match[3] };\n}\n", "function Namespace() {}\nNamespace.prototype = Object.create(null);\n\nexport default Namespace;\n", "import Namespace from \"./Namespace.js\";\n\nexport function requireNamespace(\n root: any,\n namespace: string | Array<string>\n): any {\n if (typeof root === \"object\") {\n if (typeof namespace === \"string\") {\n let path = namespace.split(\".\");\n\n return requireNamespace(root, path);\n } else if (Array.isArray(namespace)) {\n let current: any = root;\n for (let i = 0; i < namespace.length; i++) {\n current = current[namespace[i]] =\n current[namespace[i]] || new (Namespace as any)();\n }\n\n return current;\n }\n }\n}\n", "import { has } from \"./has.js\";\nimport { parseFunc } from \"./parseFunc.js\";\nimport { requireNamespace } from \"./requireNamespace.js\";\n\n/**\n * Expose a value to a potentially deeply nested global variable\n * @param name {string | object} Either a dot-separated path to the global variable, or an object to expose the value on\n * @param value {object | Function | Function[]} The value(s) to expose\n */\nexport function expose(name: object | string, value: object | Function | Function[]): void {\n if (arguments.length !== 2) {\n throw new Error(\"Incorrect number of arguments passed to the expose function!\");\n }\n\n if (Array.isArray(value)) {\n for (let func of value) {\n const { name: funcName } = parseFunc(func);\n\n if (funcName) {\n expose(name, func); // Expose func on namespace found in pName\n } else {\n throw new Error(\n \"Unable to detect name of function! Name it, or only supply one function and include name in first parameter.\"\n );\n }\n }\n } else {\n let keyName: string | undefined;\n let namespace;\n\n if (typeof value === \"function\") {\n keyName = parseFunc(value).name;\n }\n\n if (typeof name === \"string\") {\n let pathParts = name.split(\".\");\n\n if (!keyName) {\n keyName = pathParts[pathParts.length - 1];\n pathParts = pathParts.slice(0, pathParts.length - 1);\n }\n\n namespace = requireNamespace(window, pathParts);\n } else if (keyName && (typeof name === \"object\" || typeof name === \"function\")) {\n namespace = name;\n } else {\n throw new TypeError(\"Invalid typeof parameter 'name', or unable to parse pValue!\");\n }\n\n if (has(namespace, keyName)) {\n // If class is already defined, warn or show an alert\n console.warn([name, keyName].join(\".\") + \" is already defined!\");\n } else {\n namespace[keyName] = value;\n }\n }\n}\n", "import { has } from \"./has\";\n\nasync function fetchLocalizedString(text: string) {\n try {\n let response = await fetch(`/api/user/localize/new/${af.article.id}`, {\n body: JSON.stringify({ text }),\n headers: {\n Accept: \"application/json; */*\",\n \"Content-Type\": \"application/json\",\n \"X-Requested-With\": \"XMLHttpRequest\",\n },\n method: \"POST\",\n });\n\n if (response.ok) {\n return (await response.json()) as string;\n }\n } catch (error) {}\n\n return text;\n}\nexport function getLocalizedStringAsync(string: undefined | null): undefined | null;\nexport function getLocalizedStringAsync(string: string): Promise<string>;\nexport function getLocalizedStringAsync(string: string | undefined | null) {\n if (!string) return string;\n\n return getLocalizedString(string, true);\n}\n\nexport function getLocalizedString(string: undefined | null): undefined | null;\nexport function getLocalizedString(string: string): string;\nexport function getLocalizedString(string: string, wait: false): string;\nexport function getLocalizedString(string: string, wait: true): Promise<string>;\nexport function getLocalizedString(string: undefined | null, wait: true): undefined | null;\nexport function getLocalizedString(\n string: string | undefined | null,\n wait?: boolean\n): string | undefined | null | Promise<string> {\n if (typeof string === \"string\" && string.trim().length === 0) {\n return string;\n }\n\n if (string === undefined || string === \"\" || string === null) {\n return;\n }\n\n if (af?.article?.i18n !== undefined) {\n if (!has(af.article.i18n, string)) {\n af.article.i18n[string] = string;\n\n let promise = fetchLocalizedString(string).then((text) => {\n af.article.i18n[string] = text;\n return text;\n });\n\n if (wait) {\n return promise;\n }\n }\n\n return af.article.i18n[string];\n } else {\n return string;\n }\n}\n", "import { getLocalizedString } from \"./getLocalizedString.js\";\n\n/**\n * Localization function for tagged templates. Replaces the arguments\n * with $n, where n is the index, before asking Appframe to translate\n * the string.\n * \n * For example, if you call localize`Page ${2} or ${5}`, the string\n * \"Page $0 of $1\" will be sent to Appframe, and for norwegian,\n * \"Side 2 av 5\" will be returned.\n * \n * @param stringParts \n * @param args \n * @returns Translated string\n */\nexport function localize(stringParts: TemplateStringsArray, ...args: any[]): string {\n if (!Array.isArray(stringParts) || stringParts.length !== args.length + 1) {\n throw TypeError(\"Method 'localize' must be used as a tag function\");\n }\n\n let stringToLocalize = stringParts.map((s, i) => (i === stringParts.length - 1 ? s : `${s}\\$${i}`)).join(\"\");\n let localized = getLocalizedString(stringToLocalize);\n\n args.forEach((arg, index) => {\n localized = localized.replace(\"$\" + index, arg);\n })\n\n return localized;\n}", "function getLocalKey(key: string): string {\n return [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n isPersisted() {\n return true;\n }\n\n getLocalStorageKey(key: string, global?: boolean) {\n return global ? [\"common\", key].join(\".\") : getLocalKey(key);\n }\n\n get(key: string, defaultValue: unknown, global?: boolean) {\n const lsKey = this.getLocalStorageKey(key, global);\n const value = localStorage.getItem(lsKey);\n\n return value !== null ? JSON.parse(value) : defaultValue;\n }\n\n set(key: string, value: unknown, global?: boolean) {\n localStorage.setItem(\n this.getLocalStorageKey(key, global),\n JSON.stringify(value)\n );\n }\n\n remove(key: string, global?: boolean) {\n const lsKey = this.getLocalStorageKey(key, global);\n if (localStorage.getItem(lsKey) !== null) {\n localStorage.removeItem(lsKey);\n return true;\n } else {\n return false;\n }\n }\n\n clear() {\n const baseKey = getLocalKey(\"\");\n\n for (let key in localStorage) {\n if (key.slice(0, baseKey.length) === baseKey) {\n localStorage.removeItem(key);\n }\n }\n }\n}\n\nexport default new LocalStorage();\n", "function getKey(article?: string) {\n const articleKey = article || af.article.id;\n return `${articleKey}.${af.userSession.login}`;\n}\n\nexport function getSettings<T>(setting: string, article?: string): T | null {\n if (!af?.userSession) return null;\n\n const key = getKey(article);\n const settings = JSON.parse(localStorage.getItem(key) || \"{}\");\n\n if (setting) {\n return settings[setting] || null;\n }\n\n return settings;\n}\n\nexport function saveSettings<T>(\n setting: string,\n value: T | null,\n article?: string\n): void {\n if (!af?.userSession) return;\n\n const key = getKey(article);\n let userSettings = JSON.parse(localStorage.getItem(key) || \"{}\");\n\n if (typeof value !== \"undefined\") {\n userSettings[setting] = value;\n } else {\n userSettings = setting;\n }\n\n localStorage.setItem(key, JSON.stringify(userSettings));\n}\n", "import \"./errorHandler.js\";\n\nimport { UserSession } from \"./UserSession.js\";\n\nexport { default as mitt } from \"mitt\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport * from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport { localize } from \"./localize.js\";\nexport * from \"./has.js\";\nexport { default as localStorage } from \"./localStorage.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport * from \"./settings.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n var __VERSION__: string;\n var __DEV__: number;\n var af: AfCore;\n\n interface Window {\n af: AfCore;\n }\n}\n\nexport interface AfArticle {\n hostName: string;\n i18n: Record<string, string>;\n id: string;\n}\n\nexport interface AfCore {\n article: AfArticle;\n common?: {\n getLocalizedString?: (string: string) => string;\n };\n controls?: {\n alert?: (message: string, callback?: () => void) => void;\n confirm?: (options: {\n title: string;\n message: string;\n buttons: string[];\n callback: (button: number) => void;\n }) => void;\n };\n userSession: UserSession;\n}\n"],
5
- "mappings": "AAAA,OAAO,iBAAiB,QAAUA,GAAU,CAC1C,GAAI,CAEF,IAAMC,EAAO,CACX,MAAOD,EAAM,OAAO,SAAWA,EAAM,SAAW,KAChD,KAAMA,EAAM,SACZ,KAAMA,EAAM,QAAU,EACtB,OAAQA,EAAM,OAAS,EACvB,MAAOA,EAAM,OAAO,OAAS,IAC/B,EAEA,MAAM,wBAAyB,CAC7B,KAAM,KAAK,UAAUC,CAAI,EACzB,QAAS,CACP,OAAQ,mBACR,eAAgB,kCAChB,mBAAoB,gBACtB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AAKE,CAAM,EAC3CG,EAAQ,aAAa,QAAQD,CAAK,EAExC,OAAOC,IAAU,KAAO,KAAK,MAAMA,CAAK,EAAIF,CAC9C,CAEA,IAAIH,EAAaK,EAAgBH,EAAkB,CACjD,aAAa,QACX,KAAK,mBAAmBF,EAAKE,CAAM,EACnC,KAAK,UAAUG,CAAK,CACtB,CACF,CAEA,OAAOL,EAAaE,EAAkB,CACpC,IAAME,EAAQ,KAAK,mBAAmBJ,EAAKE,CAAM,EACjD,OAAI,aAAa,QAAQE,CAAK,IAAM,MAClC,aAAa,WAAWA,CAAK,EACtB,IAEA,EAEX,CAEA,OAAQ,CACN,IAAME,EAAUP,EAAY,EAAE,EAE9B,QAASC,KAAO,aACVA,EAAI,MAAM,EAAGM,EAAQ,MAAM,IAAMA,GACnC,aAAa,WAAWN,CAAG,CAGjC,CACF,EAEOO,EAAQ,IAAIN,EChDnB,SAASO,EAAOC,EAAkB,CAEhC,MAAO,GADYA,GAAW,GAAG,QAAQ,MACjB,GAAG,YAAY,OACzC,CAEO,SAASC,GAAeC,EAAiBF,EAA4B,CAC1E,GAAI,CAAC,IAAI,YAAa,OAAO,KAE7B,IAAMG,EAAMJ,EAAOC,CAAO,EACpBI,EAAW,KAAK,MAAM,aAAa,QAAQD,CAAG,GAAK,IAAI,EAE7D,OAAID,EACKE,EAASF,IAAY,KAGvBE,CACT,CAEO,SAASC,GACdH,EACAI,EACAN,EACM,CACN,GAAI,CAAC,IAAI,YAAa,OAEtB,IAAMG,EAAMJ,EAAOC,CAAO,EACtBO,EAAe,KAAK,MAAM,aAAa,QAAQJ,CAAG,GAAK,IAAI,EAE3D,OAAOG,EAAU,IACnBC,EAAaL,GAAWI,EAExBC,EAAeL,EAGjB,aAAa,QAAQC,EAAK,KAAK,UAAUI,CAAY,CAAC,CACxD,CCnBO,IAAMC,GAAU",
6
- "names": ["event", "data", "all", "Map", "on", "type", "handler", "handlers", "get", "push", "set", "off", "splice", "indexOf", "emit", "evt", "slice", "map", "SessionHandler", "mitt_default", "callback", "type", "authPromise", "resolve", "eventHandler", "dialog", "link", "eventName", "handler", "UserSession", "SessionHandler", "userData", "downloadBlob", "blob", "fileName", "resolve", "reject", "url", "parent", "anchor", "ex", "downloadRequest", "request", "fileName", "signal", "onProgress", "reportProgress", "progress", "bytesReceived", "response", "data", "reader", "stream", "controller", "pump", "read", "blob", "downloadBlob", "err", "has", "obj", "key", "funcRegex", "parseFunc", "func", "match", "Namespace", "Namespace_default", "requireNamespace", "root", "namespace", "path", "current", "i", "Namespace_default", "expose", "name", "value", "func", "funcName", "parseFunc", "keyName", "namespace", "pathParts", "requireNamespace", "has", "fetchLocalizedString", "text", "response", "getLocalizedString", "string", "wait", "has", "promise", "fetchLocalizedString", "text", "localize", "stringParts", "args", "stringToLocalize", "s", "i", "localized", "getLocalizedString", "arg", "index", "getLocalKey", "key", "LocalStorage", "global", "defaultValue", "lsKey", "value", "baseKey", "localStorage_default", "getKey", "article", "getSettings", "setting", "key", "settings", "saveSettings", "value", "userSettings", "version"]
3
+ "sources": ["../../src/errorHandler.ts", "../../../../node_modules/mitt/src/index.ts", "../../src/SessionHandler.ts", "../../src/UserSession.ts", "../../src/date.ts", "../../src/downloadBlob.ts", "../../src/downloadRequest.ts", "../../src/has.ts", "../../src/parseFunc.ts", "../../src/Namespace.ts", "../../src/requireNamespace.ts", "../../src/expose.ts", "../../src/getUserImage.ts", "../../src/getLocalizedString.ts", "../../src/localize.ts", "../../src/localStorage.ts", "../../src/settings.ts", "../../src/index.ts"],
4
+ "sourcesContent": ["window.addEventListener(\"error\", (event) => {\n try {\n // Try to avoid error-logging-loop\n const data = {\n error: event.error?.message ?? event.message ?? null,\n file: event.filename,\n line: event.lineno ?? 0,\n column: event.colno ?? 0,\n stack: event.error?.stack ?? null,\n };\n\n fetch(\"/data/Logger/LogError\", {\n body: JSON.stringify(data),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json; charset=utf-8\",\n \"X-Requested-With\": \"XMLHttpRequest\",\n },\n method: \"POST\",\n });\n } catch (ex) {\n // ignore\n }\n});\n", "export type EventType = string | symbol;\n\n// An event handler can take an optional event argument\n// and should not return a value\nexport type Handler<T = unknown> = (event: T) => void;\nexport type WildcardHandler<T = Record<string, unknown>> = (\n\ttype: keyof T,\n\tevent: T[keyof T]\n) => void;\n\n// An array of all currently registered event handlers for a type\nexport type EventHandlerList<T = unknown> = Array<Handler<T>>;\nexport type WildCardEventHandlerList<T = Record<string, unknown>> = Array<WildcardHandler<T>>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<\n\tkeyof Events | '*',\n\tEventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>\n>;\n\nexport interface Emitter<Events extends Record<EventType, unknown>> {\n\tall: EventHandlerMap<Events>;\n\n\ton<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;\n\ton(type: '*', handler: WildcardHandler<Events>): void;\n\n\toff<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;\n\toff(type: '*', handler: WildcardHandler<Events>): void;\n\n\temit<Key extends keyof Events>(type: Key, event: Events[Key]): void;\n\temit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt<Events extends Record<EventType, unknown>>(\n\tall?: EventHandlerMap<Events>\n): Emitter<Events> {\n\ttype GenericEventHandler =\n\t\t| Handler<Events[keyof Events]>\n\t\t| WildcardHandler<Events>;\n\tall = all || new Map();\n\n\treturn {\n\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `'*'` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<Key extends keyof Events>(type: Key, handler: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.push(handler);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tall!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * If `handler` is omitted, all handlers of the given type are removed.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from, or `'*'`\n\t\t * @param {Function} [handler] Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\tif (handler) {\n\t\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tall!.set(type, []);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `'*'` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing '*' handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {\n\t\t\tlet handlers = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as EventHandlerList<Events[keyof Events]>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(evt!);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\thandlers = all!.get('*');\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as WildCardEventHandlerList<Events>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(type, evt!);\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\n", "import mitt, { Emitter, Handler } from \"mitt\";\n\ntype SessionHandlerEvent = \"onExpired\" | \"onAuthenticated\";\n\nexport default class SessionHandler {\n private eventHandler: Emitter<{ onAuthenticated: void; onExpired: void }> = mitt();\n\n authenticated() {\n this.eventHandler.emit(\"onAuthenticated\");\n }\n\n async expired(callback?: () => void, type?: \"RequireTwoFactor\"): Promise<void> {\n try {\n let authPromise = new Promise<void>((resolve) => {\n let eventHandler = () => {\n this.eventHandler.off(\"onAuthenticated\", eventHandler);\n callback?.();\n resolve();\n };\n\n this.eventHandler.on(\"onAuthenticated\", eventHandler);\n });\n\n let dialog: HTMLDialogElement | null = document.querySelector(\"dialog.session-expired-dialog\");\n if (!dialog) {\n dialog = document.createElement(\"dialog\");\n dialog.className = \"session-expired-dialog\";\n dialog.style.display = \"flex\";\n dialog.style.padding = \"0\";\n dialog.style.left = \"50%\";\n dialog.style.transform = \"translateX(-50%)\";\n\n let link = \"/login?ReturnUrl=%2fapi/sessionexpired/remove\";\n if (type !== \"RequireTwoFactor\") {\n await fetch(\"/logout\", { method: \"POST\" });\n } else {\n link = \"/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove\";\n }\n\n dialog.innerHTML = `<iframe sandbox=\"allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms\" src=\"${link}\" style=\"border:0;width:min(500px,100vw);height:min(700px, 100vh);\"></iframe>`;\n document.body.append(dialog);\n dialog.showModal();\n await authPromise;\n dialog.remove();\n } else {\n await authPromise;\n }\n } catch (_) {\n window.location.href = `/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(\n window.location.search\n )}`;\n }\n }\n\n attachEvent(eventName: SessionHandlerEvent, handler: Handler) {\n return this.eventHandler.on(eventName, handler);\n }\n\n detachEvent(eventName: SessionHandlerEvent, handler: Handler) {\n return this.eventHandler.off(eventName, handler);\n }\n}\n", "import SessionHandler from \"./SessionHandler.js\";\n\nexport class UserSession extends SessionHandler {\n amDesignator: string = \"a.m.\";\n dayNames: string[] = [\"sunday\", \"monday\", \"tuesday\", \"wednesday\", \"thursday\", \"friday\", \"saturday\"];\n dayNamesShort: string[] = [\"sun\", \"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\"];\n decimalSeparator: string = \".\";\n domain: string = \"OB\";\n email: string | null | undefined;\n formats: undefined | Record<string, string>;\n groupSeparator: string | null = null;\n integratedSecurity: boolean = false;\n isDeveloper: boolean = false;\n login: string = \"\";\n loginType: string | undefined;\n monthNames: string[] = [\"january\", \"february\", \"march\", \"april\", \"may\", \"june\", \"july\", \"august\", \"september\", \"october\", \"november\", \"december\", \"\"];\n monthNamesShort: string[] = [\"jan\", \"feb\", \"mar\", \"apr\", \"may\", \"jun\", \"jul\", \"augt\", \"sep\", \"oct\", \"nov\", \"dec\", \"\"];\n name: string | undefined;\n pmDesignator: string = \"p.m.\";\n shortDateFormat: string = \"dd.MM.yyyy\";\n culture: string = \"en-GB\";\n uiculture: string = \"en-GB\";\n\n constructor(userData: any) {\n super();\n this.formats = {};\n Object.assign(this, userData);\n }\n}\n", "export function toLocalISODate(date: Date) {\n return toLocalISODateTime(date).substring(0, 10);\n}\n\nexport function toLocalISODateTime(date: Date) {\n let newDate = new Date(date);\n newDate.setUTCFullYear(date.getFullYear());\n newDate.setUTCMonth(date.getMonth());\n newDate.setUTCDate(date.getDate());\n newDate.setUTCHours(date.getHours());\n newDate.setUTCMinutes(date.getMinutes());\n\n return newDate.toISOString().replace(\"Z\", \"\");\n}\n", "export function downloadBlob(blob: Blob | MediaSource, fileName: string) {\n return new Promise<void>(function (resolve, reject) {\n try {\n const url = URL.createObjectURL(blob);\n const parent = document.body;\n const anchor = document.createElement(\"a\");\n anchor.setAttribute(\"download\", fileName);\n anchor.href = url;\n parent.append(anchor);\n anchor.click();\n parent.removeChild(anchor);\n\n setTimeout(function () {\n URL.revokeObjectURL(url);\n resolve();\n }, 250);\n } catch (ex) {\n reject(ex);\n }\n });\n}\n", "import { downloadBlob } from \"./downloadBlob.js\";\n\nexport type DownloadItem = {\n status: \"cancelled\" | \"error\" | \"requested\" | \"downloading\" | \"downloaded\" | \"completed\";\n bytesReceived?: number;\n error?: string;\n};\n\nexport type DownloadParameters = {\n signal?: AbortSignal;\n fileName: string;\n onProgress?: (progress: DownloadItem) => void;\n};\n\nexport async function downloadRequest(request: Request, { fileName, signal, onProgress }: DownloadParameters) {\n function reportProgress(progress: DownloadItem) {\n if (typeof onProgress === \"function\") {\n onProgress({ ...progress });\n }\n }\n\n let bytesReceived = 0;\n\n reportProgress({ status: \"requested\" });\n\n try {\n let response = await fetch(request);\n\n if (!response.ok || !response.body) {\n if (response.headers.get(\"content-type\")?.includes(\"application/json\")) {\n let data = await response.json();\n if (data.error) {\n throw new Error(data.error);\n }\n }\n throw new Error(`${response.status} ${response.statusText}`);\n }\n\n try {\n const reader = response.body.getReader();\n const stream = new ReadableStream({\n start: function (controller) {\n function pump(): Promise<void> {\n return reader.read().then(function (read) {\n if (read.done) {\n controller.close();\n return;\n }\n\n bytesReceived += read.value.length;\n reportProgress({ bytesReceived, status: \"downloading\" });\n controller.enqueue(read.value);\n\n return pump();\n });\n }\n\n return pump();\n },\n });\n\n response = new Response(stream);\n } catch (error) {}\n\n const blob = await response.blob();\n\n reportProgress({ bytesReceived, status: \"downloaded\" });\n\n await downloadBlob(blob, fileName);\n\n reportProgress({ bytesReceived, status: \"completed\" });\n } catch (err) {\n if (signal?.aborted) {\n reportProgress({ status: \"cancelled\" });\n } else {\n reportProgress({ error: (err as Error).message, status: \"error\" });\n }\n }\n}\n", "export function has(\n obj: any,\n key: string | number | symbol\n): boolean {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n", "const funcRegex = /^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)*)\\}$/;\n\nexport function parseFunc(func: Function) {\n var match = func.toString().match(funcRegex);\n if (match === null) {\n throw new TypeError(\"Unable to parse function!\");\n }\n return { name: match[1], args: match[2].split(\",\"), body: match[3] };\n}\n", "function Namespace() {}\nNamespace.prototype = Object.create(null);\n\nexport default Namespace;\n", "import Namespace from \"./Namespace.js\";\n\nexport function requireNamespace(\n root: any,\n namespace: string | Array<string>\n): any {\n if (typeof root === \"object\") {\n if (typeof namespace === \"string\") {\n let path = namespace.split(\".\");\n\n return requireNamespace(root, path);\n } else if (Array.isArray(namespace)) {\n let current: any = root;\n for (let i = 0; i < namespace.length; i++) {\n current = current[namespace[i]] =\n current[namespace[i]] || new (Namespace as any)();\n }\n\n return current;\n }\n }\n}\n", "import { has } from \"./has.js\";\nimport { parseFunc } from \"./parseFunc.js\";\nimport { requireNamespace } from \"./requireNamespace.js\";\n\n/**\n * Expose a value to a potentially deeply nested global variable\n * @param name {string | object} Either a dot-separated path to the global variable, or an object to expose the value on\n * @param value {object | Function | Function[]} The value(s) to expose\n */\nexport function expose(name: object | string, value: object | Function | Function[]): void {\n if (arguments.length !== 2) {\n throw new Error(\"Incorrect number of arguments passed to the expose function!\");\n }\n\n if (Array.isArray(value)) {\n for (let func of value) {\n const { name: funcName } = parseFunc(func);\n\n if (funcName) {\n expose(name, func); // Expose func on namespace found in pName\n } else {\n throw new Error(\n \"Unable to detect name of function! Name it, or only supply one function and include name in first parameter.\"\n );\n }\n }\n } else {\n let keyName: string | undefined;\n let namespace;\n\n if (typeof value === \"function\") {\n keyName = parseFunc(value).name;\n }\n\n if (typeof name === \"string\") {\n let pathParts = name.split(\".\");\n\n if (!keyName) {\n keyName = pathParts[pathParts.length - 1];\n pathParts = pathParts.slice(0, pathParts.length - 1);\n }\n\n namespace = requireNamespace(window, pathParts);\n } else if (keyName && (typeof name === \"object\" || typeof name === \"function\")) {\n namespace = name;\n } else {\n throw new TypeError(\"Invalid typeof parameter 'name', or unable to parse pValue!\");\n }\n\n if (has(namespace, keyName)) {\n // If class is already defined, warn or show an alert\n console.warn([name, keyName].join(\".\") + \" is already defined!\");\n } else {\n namespace[keyName] = value;\n }\n }\n}\n", "export type ImageSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport interface getUserImageOptions {\n /**\n * Prim key of the record in atbl_Personnel_Employees\n */\n primKey: string | null;\n /**\n * Person ID of the employee\n */\n login: string | null;\n /**\n * The value of the ImageHash column in atbl_Personnel_Employees\n */\n hash: string | number | null;\n /**\n * The image will be resized according to this value. Default is 'xs':\n * - xs: 64px\n * - sm: 128px\n * - md: 256px\n * - lg: 512px\n * - xl: image is not resized\n */\n size?: ImageSize;\n}\n\nconst sizeMap: Record<ImageSize, number | undefined> = {\n xs: 64,\n sm: 128,\n md: 256,\n lg: 512,\n xl: undefined,\n};\n\n/**\n * Returns the absolute path of a users profile picture. Uses the EmployeesLookup\n * data resource to enable caching across applications.\n *\n * If one of primKey or hash are not provided, or are null, an empty string will be returned.\n */\nexport function getUserImage({ primKey, login, hash, size = \"xs\" }: getUserImageOptions) {\n if (!primKey || !hash) {\n return \"\";\n }\n\n let sizePx = sizeMap[size];\n return `/api/data/blob/EmployeesLookup/${primKey}/Image/${login}${login ? \".\" : \"\"}${hash}.jpg${\n sizePx ? `?width=${sizePx}` : \"\"\n }`;\n}\n", "import { has } from \"./has\";\n\nasync function fetchLocalizedString(text: string) {\n try {\n let response = await fetch(`/api/user/localize/new/${af.article.id}`, {\n body: JSON.stringify({ text }),\n headers: {\n Accept: \"application/json; */*\",\n \"Content-Type\": \"application/json\",\n \"X-Requested-With\": \"XMLHttpRequest\",\n },\n method: \"POST\",\n });\n\n if (response.ok) {\n return (await response.json()) as string;\n }\n } catch (error) {}\n\n return text;\n}\nexport function getLocalizedStringAsync(string: undefined | null): undefined | null;\nexport function getLocalizedStringAsync(string: string): Promise<string>;\nexport function getLocalizedStringAsync(string: string | undefined | null) {\n if (!string) return string;\n\n return getLocalizedString(string, true);\n}\n\nexport function getLocalizedString(string: undefined | null): undefined | null;\nexport function getLocalizedString(string: string): string;\nexport function getLocalizedString(string: string, wait: false): string;\nexport function getLocalizedString(string: string, wait: true): Promise<string>;\nexport function getLocalizedString(string: undefined | null, wait: true): undefined | null;\nexport function getLocalizedString(\n string: string | undefined | null,\n wait?: boolean\n): string | undefined | null | Promise<string> {\n if (typeof string === \"string\" && string.trim().length === 0) {\n return string;\n }\n\n if (string === undefined || string === \"\" || string === null) {\n return;\n }\n\n if (af?.article?.i18n !== undefined) {\n if (!has(af.article.i18n, string)) {\n af.article.i18n[string] = string;\n\n let promise = fetchLocalizedString(string).then((text) => {\n af.article.i18n[string] = text;\n return text;\n });\n\n if (wait) {\n return promise;\n }\n }\n\n return af.article.i18n[string];\n } else {\n return string;\n }\n}\n", "import { getLocalizedString } from \"./getLocalizedString.js\";\n\n/**\n * Localization function for tagged templates. Replaces the arguments\n * with $n, where n is the index, before asking Appframe to translate\n * the string.\n * \n * For example, if you call localize`Page ${2} or ${5}`, the string\n * \"Page $0 of $1\" will be sent to Appframe, and for norwegian,\n * \"Side 2 av 5\" will be returned.\n * \n * @param stringParts \n * @param args \n * @returns Translated string\n */\nexport function localize(stringParts: TemplateStringsArray, ...args: any[]): string {\n if (!Array.isArray(stringParts) || stringParts.length !== args.length + 1) {\n throw TypeError(\"Method 'localize' must be used as a tag function\");\n }\n\n let stringToLocalize = stringParts.map((s, i) => (i === stringParts.length - 1 ? s : `${s}\\$${i}`)).join(\"\");\n let localized = getLocalizedString(stringToLocalize);\n\n args.forEach((arg, index) => {\n localized = localized.replace(\"$\" + index, arg);\n })\n\n return localized;\n}", "function getLocalKey(key: string): string {\n return [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n isPersisted() {\n return true;\n }\n\n getLocalStorageKey(key: string, global?: boolean) {\n return global ? [\"common\", key].join(\".\") : getLocalKey(key);\n }\n\n get(key: string, defaultValue: unknown, global?: boolean) {\n const lsKey = this.getLocalStorageKey(key, global);\n const value = localStorage.getItem(lsKey);\n\n return value !== null ? JSON.parse(value) : defaultValue;\n }\n\n set(key: string, value: unknown, global?: boolean) {\n localStorage.setItem(\n this.getLocalStorageKey(key, global),\n JSON.stringify(value)\n );\n }\n\n remove(key: string, global?: boolean) {\n const lsKey = this.getLocalStorageKey(key, global);\n if (localStorage.getItem(lsKey) !== null) {\n localStorage.removeItem(lsKey);\n return true;\n } else {\n return false;\n }\n }\n\n clear() {\n const baseKey = getLocalKey(\"\");\n\n for (let key in localStorage) {\n if (key.slice(0, baseKey.length) === baseKey) {\n localStorage.removeItem(key);\n }\n }\n }\n}\n\nexport default new LocalStorage();\n", "function getKey(article?: string) {\n const articleKey = article || af.article.id;\n return `${articleKey}.${af.userSession.login}`;\n}\n\nexport function getSettings<T>(setting: string, article?: string): T | null {\n if (!af?.userSession) return null;\n\n const key = getKey(article);\n const settings = JSON.parse(localStorage.getItem(key) || \"{}\");\n\n if (setting) {\n return settings[setting] || null;\n }\n\n return settings;\n}\n\nexport function saveSettings<T>(\n setting: string,\n value: T | null,\n article?: string\n): void {\n if (!af?.userSession) return;\n\n const key = getKey(article);\n let userSettings = JSON.parse(localStorage.getItem(key) || \"{}\");\n\n if (typeof value !== \"undefined\") {\n userSettings[setting] = value;\n } else {\n userSettings = setting;\n }\n\n localStorage.setItem(key, JSON.stringify(userSettings));\n}\n", "import \"./errorHandler.js\";\n\nimport { UserSession } from \"./UserSession.js\";\n\nexport { default as mitt } from \"mitt\";\nexport * from \"./date.js\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport * from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport * from \"./getUserImage.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport { localize } from \"./localize.js\";\nexport * from \"./has.js\";\nexport { default as localStorage } from \"./localStorage.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport * from \"./settings.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n var __VERSION__: string;\n var __DEV__: number;\n var af: AfCore;\n\n interface Window {\n af: AfCore;\n }\n}\n\nexport interface AfArticle {\n hostName: string;\n i18n: Record<string, string>;\n id: string;\n}\n\nexport interface AfCore {\n article: AfArticle;\n common?: {\n getLocalizedString?: (string: string) => string;\n };\n controls?: {\n alert?: (message: string, callback?: () => void) => void;\n confirm?: (options: {\n title: string;\n message: string;\n buttons: string[];\n callback: (button: number) => void;\n }) => void;\n };\n userSession: UserSession;\n}\n"],
5
+ "mappings": "AAAA,OAAO,iBAAiB,QAAUA,GAAU,CAC1C,GAAI,CAEF,IAAMC,EAAO,CACX,MAAOD,EAAM,OAAO,SAAWA,EAAM,SAAW,KAChD,KAAMA,EAAM,SACZ,KAAMA,EAAM,QAAU,EACtB,OAAQA,EAAM,OAAS,EACvB,MAAOA,EAAM,OAAO,OAAS,IAC/B,EAEA,MAAM,wBAAyB,CAC7B,KAAM,KAAK,UAAUC,CAAI,EACzB,QAAS,CACP,OAAQ,mBACR,eAAgB,kCAChB,mBAAoB,gBACtB,EACA,OAAQ,MACV,CAAC,CACH,MAAE,CAEF,CACF,CAAC,aCgBAC,EAAAA,CAOA,MAAO,CAKNA,IAPDA,EAAMA,GAAO,IAAIC,IAehBC,GAAAA,SAA6BC,EAAWC,EAAAA,CACvC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,EACHA,EAASE,KAAKH,CAAAA,EAGdJ,EAAKQ,IAAIL,EAAM,CAACC,CAAAA,CAAAA,CAAAA,EAWlBK,IAAAA,SAA8BN,EAAWC,EAAAA,CACxC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,IACCD,EACHC,EAASK,OAAOL,EAASM,QAAQP,CAAAA,IAAa,EAAG,CAAA,EAGjDJ,EAAKQ,IAAIL,EAAM,CAAA,CAAA,EAAA,EAelBS,KAAAA,SAA+BT,EAAWU,EAAAA,CACzC,IAAIR,EAAWL,EAAKM,IAAIH,CAAAA,EACp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,EAGjB,aAAa,QAAQC,EAAK,KAAK,UAAUI,CAAY,CAAC,CACxD,CCjBO,IAAMC,GAAU",
6
+ "names": ["event", "data", "all", "Map", "on", "type", "handler", "handlers", "get", "push", "set", "off", "splice", "indexOf", "emit", "evt", "slice", "map", "SessionHandler", "mitt_default", "callback", "type", "authPromise", "resolve", "eventHandler", "dialog", "link", "eventName", "handler", "UserSession", "SessionHandler", "userData", "toLocalISODate", "date", "toLocalISODateTime", "newDate", "downloadBlob", "blob", "fileName", "resolve", "reject", "url", "parent", "anchor", "ex", "downloadRequest", "request", "fileName", "signal", "onProgress", "reportProgress", "progress", "bytesReceived", "response", "data", "reader", "stream", "controller", "pump", "read", "blob", "downloadBlob", "err", "has", "obj", "key", "funcRegex", "parseFunc", "func", "match", "Namespace", "Namespace_default", "requireNamespace", "root", "namespace", "path", "current", "i", "Namespace_default", "expose", "name", "value", "func", "funcName", "parseFunc", "keyName", "namespace", "pathParts", "requireNamespace", "has", "sizeMap", "getUserImage", "primKey", "login", "hash", "size", "sizePx", "fetchLocalizedString", "text", "response", "getLocalizedString", "string", "wait", "has", "promise", "fetchLocalizedString", "text", "localize", "stringParts", "args", "stringToLocalize", "s", "i", "localized", "getLocalizedString", "arg", "index", "getLocalKey", "key", "LocalStorage", "global", "defaultValue", "lsKey", "value", "baseKey", "localStorage_default", "getKey", "article", "getSettings", "setting", "key", "settings", "saveSettings", "value", "userSettings", "version"]
7
7
  }