@olenbetong/appframe-core 2.7.6 → 2.8.1
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.
- package/dist/esm/af.common.js +29 -9
- package/dist/esm/af.common.legacy.js +29 -9
- package/dist/esm/af.common.legacy.min.js +1 -1
- package/dist/esm/af.common.legacy.min.js.map +3 -3
- package/dist/esm/af.common.min.js +2 -2
- package/dist/esm/af.common.min.js.map +3 -3
- package/dist/iife/af.common.js +29 -9
- package/dist/iife/af.common.legacy.js +29 -9
- package/dist/iife/af.common.legacy.min.js +1 -1
- package/dist/iife/af.common.legacy.min.js.map +3 -3
- package/dist/iife/af.common.min.js +2 -2
- package/dist/iife/af.common.min.js.map +3 -3
- package/es/alert.d.ts +1 -1
- package/es/alert.js +12 -8
- package/es/index.d.ts +3 -2
- package/es/index.js +2 -2
- package/es/logActivity.d.ts +6 -1
- package/es/logActivity.js +11 -2
- package/package.json +2 -2
- package/src/alert.ts +27 -15
- package/src/index.ts +3 -2
- package/src/logActivity.ts +14 -2
package/dist/esm/af.common.js
CHANGED
|
@@ -441,9 +441,14 @@ async function logActivity(activity, parameters, timeElapsed = 0) {
|
|
|
441
441
|
} catch (error) {
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
function startActivity(activity,
|
|
444
|
+
function startActivity(activity, startParameters = {}) {
|
|
445
445
|
let start = performance.now();
|
|
446
|
-
return () => logActivity(activity,
|
|
446
|
+
return (endParameters = {}) => logActivity(activity, { ...startParameters, ...endParameters }, performance.now() - start);
|
|
447
|
+
}
|
|
448
|
+
async function time(callback) {
|
|
449
|
+
let start = performance.now();
|
|
450
|
+
let returnValue = await callback();
|
|
451
|
+
return [returnValue, performance.now() - start];
|
|
447
452
|
}
|
|
448
453
|
|
|
449
454
|
// src/settings.ts
|
|
@@ -491,9 +496,25 @@ if (window.document && !document.querySelector("#AlertDialogTemplate")) {
|
|
|
491
496
|
$template.innerHTML = template;
|
|
492
497
|
document.body.append($template);
|
|
493
498
|
}
|
|
494
|
-
function waitForDialog(dialog) {
|
|
499
|
+
function waitForDialog(dialog, cancelValue = "No") {
|
|
495
500
|
return new Promise((resolve) => {
|
|
496
|
-
|
|
501
|
+
let controller = new AbortController();
|
|
502
|
+
dialog.addEventListener(
|
|
503
|
+
"close",
|
|
504
|
+
() => {
|
|
505
|
+
resolve(dialog.returnValue);
|
|
506
|
+
controller.abort();
|
|
507
|
+
},
|
|
508
|
+
{ signal: controller.signal }
|
|
509
|
+
);
|
|
510
|
+
dialog.addEventListener(
|
|
511
|
+
"cancel",
|
|
512
|
+
() => {
|
|
513
|
+
resolve(cancelValue);
|
|
514
|
+
controller.abort();
|
|
515
|
+
},
|
|
516
|
+
{ signal: controller.signal }
|
|
517
|
+
);
|
|
497
518
|
});
|
|
498
519
|
}
|
|
499
520
|
var alertDialogPromiseMap = /* @__PURE__ */ new Map();
|
|
@@ -531,15 +552,13 @@ async function openAlertDialog({ buttons, content, className, id, title }) {
|
|
|
531
552
|
}
|
|
532
553
|
document.body.appendChild($dialog);
|
|
533
554
|
$dialog.showModal();
|
|
534
|
-
let dialogPromise = waitForDialog($dialog).then(() => {
|
|
555
|
+
let dialogPromise = waitForDialog($dialog).then((returnValue) => {
|
|
535
556
|
if (id && alertDialogPromiseMap.has(id)) {
|
|
536
557
|
alertDialogPromiseMap.delete(id);
|
|
537
558
|
}
|
|
538
|
-
}).then(() => {
|
|
539
|
-
let result = $dialog?.returnValue || "cancel";
|
|
540
559
|
if ($dialog)
|
|
541
560
|
document.body.removeChild($dialog);
|
|
542
|
-
return
|
|
561
|
+
return returnValue;
|
|
543
562
|
});
|
|
544
563
|
if (id) {
|
|
545
564
|
alertDialogPromiseMap.set(id, dialogPromise);
|
|
@@ -573,7 +592,7 @@ async function alert(prompt, options = {}) {
|
|
|
573
592
|
}
|
|
574
593
|
|
|
575
594
|
// src/index.ts
|
|
576
|
-
var version = "2.
|
|
595
|
+
var version = "2.8.1";
|
|
577
596
|
export {
|
|
578
597
|
ConfirmButtons,
|
|
579
598
|
SessionHandler,
|
|
@@ -595,6 +614,7 @@ export {
|
|
|
595
614
|
openAlertDialog,
|
|
596
615
|
saveSettings,
|
|
597
616
|
startActivity,
|
|
617
|
+
time,
|
|
598
618
|
toLocalISODate,
|
|
599
619
|
toLocalISODateTime,
|
|
600
620
|
version,
|
|
@@ -472,9 +472,14 @@ async function logActivity(activity, parameters, timeElapsed = 0) {
|
|
|
472
472
|
} catch (error) {
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
function startActivity(activity,
|
|
475
|
+
function startActivity(activity, startParameters = {}) {
|
|
476
476
|
let start = performance.now();
|
|
477
|
-
return () => logActivity(activity,
|
|
477
|
+
return (endParameters = {}) => logActivity(activity, __spreadValues(__spreadValues({}, startParameters), endParameters), performance.now() - start);
|
|
478
|
+
}
|
|
479
|
+
async function time(callback) {
|
|
480
|
+
let start = performance.now();
|
|
481
|
+
let returnValue = await callback();
|
|
482
|
+
return [returnValue, performance.now() - start];
|
|
478
483
|
}
|
|
479
484
|
|
|
480
485
|
// src/settings.ts
|
|
@@ -513,9 +518,25 @@ if (window.document && !document.querySelector("#AlertDialogTemplate")) {
|
|
|
513
518
|
$template.innerHTML = template;
|
|
514
519
|
document.body.append($template);
|
|
515
520
|
}
|
|
516
|
-
function waitForDialog(dialog) {
|
|
521
|
+
function waitForDialog(dialog, cancelValue = "No") {
|
|
517
522
|
return new Promise((resolve) => {
|
|
518
|
-
|
|
523
|
+
let controller = new AbortController();
|
|
524
|
+
dialog.addEventListener(
|
|
525
|
+
"close",
|
|
526
|
+
() => {
|
|
527
|
+
resolve(dialog.returnValue);
|
|
528
|
+
controller.abort();
|
|
529
|
+
},
|
|
530
|
+
{ signal: controller.signal }
|
|
531
|
+
);
|
|
532
|
+
dialog.addEventListener(
|
|
533
|
+
"cancel",
|
|
534
|
+
() => {
|
|
535
|
+
resolve(cancelValue);
|
|
536
|
+
controller.abort();
|
|
537
|
+
},
|
|
538
|
+
{ signal: controller.signal }
|
|
539
|
+
);
|
|
519
540
|
});
|
|
520
541
|
}
|
|
521
542
|
var alertDialogPromiseMap = /* @__PURE__ */ new Map();
|
|
@@ -554,15 +575,13 @@ async function openAlertDialog({ buttons, content, className, id, title }) {
|
|
|
554
575
|
}
|
|
555
576
|
document.body.appendChild($dialog);
|
|
556
577
|
$dialog.showModal();
|
|
557
|
-
let dialogPromise = waitForDialog($dialog).then(() => {
|
|
578
|
+
let dialogPromise = waitForDialog($dialog).then((returnValue) => {
|
|
558
579
|
if (id && alertDialogPromiseMap.has(id)) {
|
|
559
580
|
alertDialogPromiseMap.delete(id);
|
|
560
581
|
}
|
|
561
|
-
}).then(() => {
|
|
562
|
-
let result = ($dialog == null ? void 0 : $dialog.returnValue) || "cancel";
|
|
563
582
|
if ($dialog)
|
|
564
583
|
document.body.removeChild($dialog);
|
|
565
|
-
return
|
|
584
|
+
return returnValue;
|
|
566
585
|
});
|
|
567
586
|
if (id) {
|
|
568
587
|
alertDialogPromiseMap.set(id, dialogPromise);
|
|
@@ -595,7 +614,7 @@ async function alert(prompt, options = {}) {
|
|
|
595
614
|
}
|
|
596
615
|
|
|
597
616
|
// src/index.ts
|
|
598
|
-
var version = "2.
|
|
617
|
+
var version = "2.8.1";
|
|
599
618
|
export {
|
|
600
619
|
ConfirmButtons,
|
|
601
620
|
SessionHandler,
|
|
@@ -617,6 +636,7 @@ export {
|
|
|
617
636
|
openAlertDialog,
|
|
618
637
|
saveSettings,
|
|
619
638
|
startActivity,
|
|
639
|
+
time,
|
|
620
640
|
toLocalISODate,
|
|
621
641
|
toLocalISODateTime,
|
|
622
642
|
version,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var J=Object.defineProperty;var j=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var A=(e,t,r)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,v=(e,t)=>{for(var r in t||(t={}))K.call(t,r)&&A(e,r,t[r]);if(j)for(var r of j(t))V.call(t,r)&&A(e,r,t[r]);return e};var l=(e,t,r)=>(A(e,typeof t!="symbol"?t+"":t,r),r);function L(e){return{all:e=e||new Map,on:function(t,r){var o=e.get(t);o?o.push(r):e.set(t,[r])},off:function(t,r){var o=e.get(t);o&&(r?o.splice(o.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var o=e.get(t);o&&o.slice().map(function(n){n(r)}),(o=e.get("*"))&&o.slice().map(function(n){n(t,r)})}}}var g=class{constructor(){l(this,"eventHandler",L())}authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,r){try{let o=new Promise(i=>{let a=()=>{this.eventHandler.off("onAuthenticated",a),t==null||t(),i()};this.eventHandler.on("onAuthenticated",a)}),n=document.querySelector("dialog.session-expired-dialog");if(n)await o;else{n=document.createElement("dialog"),n.className="session-expired-dialog",n.style.display="flex",n.style.padding="0",n.style.left="50%",n.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",n.innerHTML='<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="'.concat(i,'" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>'),document.body.append(n),n.showModal(),await o,n.remove()}}catch(o){window.location.href="/login?ReturnUrl=".concat(encodeURIComponent(window.location.pathname)).concat(encodeURIComponent(window.location.search))}}attachEvent(t,r){return this.eventHandler.on(t,r)}detachEvent(t,r){return this.eventHandler.off(t,r)}};var D=class extends g{constructor(r){super();l(this,"amDesignator","a.m.");l(this,"dayNames",["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]);l(this,"dayNamesShort",["sun","mon","tue","wed","thu","fri","sat"]);l(this,"decimalSeparator",".");l(this,"domain","OB");l(this,"email");l(this,"formats");l(this,"groupSeparator",null);l(this,"integratedSecurity",!1);l(this,"isDeveloper",!1);l(this,"login","");l(this,"loginType");l(this,"monthNames",["january","february","march","april","may","june","july","august","september","october","november","december",""]);l(this,"monthNamesShort",["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""]);l(this,"name");l(this,"pmDesignator","p.m.");l(this,"shortDateFormat","dd.MM.yyyy");l(this,"culture","en-GB");l(this,"uiculture","en-GB");this.formats={},Object.assign(this,r)}};var N;(N=window.window)==null||N.addEventListener("error",e=>{var t,r,o,n,i,a,s;try{let p={error:(o=(r=(t=e.error)==null?void 0:t.message)!=null?r:e.message)!=null?o:null,file:e.filename,line:(n=e.lineno)!=null?n:0,column:(i=e.colno)!=null?i:0,stack:(s=(a=e.error)==null?void 0:a.stack)!=null?s:null};fetch("/data/Logger/LogError",{body:JSON.stringify(p),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"})}catch(p){}});function R(e){var t;return[((t=af==null?void 0:af.article)==null?void 0:t.id)||"","common",e].join(".")}var I=class{constructor(){l(this,"isPersisted",()=>!0)}getLocalStorageKey(t,r){return r?["common",t].join("."):R(t)}get(t,r,o){let n=this.getLocalStorageKey(t,o),i=localStorage.getItem(n);return i!==null?JSON.parse(i):r}set(t,r,o){localStorage.setItem(this.getLocalStorageKey(t,o),JSON.stringify(r))}remove(t,r){let o=this.getLocalStorageKey(t,r);return localStorage.getItem(o)!==null?(localStorage.removeItem(o),!0):!1}clear(){let t=R("");for(let r in localStorage)r.slice(0,t.length)===t&&localStorage.removeItem(r)}},Z=new I;function X(e){return e?$(e).substring(0,10):null}function m(e){return String(e).padStart(2,"0")}function $(e){return e?"".concat(e.getFullYear(),"-").concat(m(e.getMonth()+1),"-").concat(m(e.getDate()),"T").concat(m(e.getHours()),":").concat(m(e.getMinutes()),":").concat(m(e.getSeconds()),".").concat(m(e.getMilliseconds())):null}function z(e,t){return new Promise(function(r,o){try{let n=URL.createObjectURL(e),i=document.body,a=document.createElement("a");a.setAttribute("download",t),a.href=n,i.append(a),a.click(),i.removeChild(a),setTimeout(function(){URL.revokeObjectURL(n),r()},250)}catch(n){o(n)}})}function u(e,t){if(e)return;let r=typeof t=="function"?t():t;throw new Error(r!=null?r:"Invariant failed")}async function Y(e,{fileName:t,signal:r,onProgress:o}){var a;function n(s){typeof o=="function"&&o(v({},s))}let i=0;n({status:"requested"});try{let s=await fetch(e);if(!s.ok||!s.body){if((a=s.headers.get("content-type"))!=null&&a.includes("application/json")){let d=await s.json();u(!d.error,d.error)}throw new Error("".concat(s.status," ").concat(s.statusText))}try{let d=s.body.getReader(),w=new ReadableStream({start:function(y){function c(){return d.read().then(function(h){if(h.done){y.close();return}return i+=h.value.length,n({bytesReceived:i,status:"downloading"}),y.enqueue(h.value),c()})}return c()}});s=new Response(w)}catch(d){}let p=await s.blob();n({bytesReceived:i,status:"downloaded"}),await z(p,t),n({bytesReceived:i,status:"completed"})}catch(s){r!=null&&r.aborted?n({status:"cancelled"}):n({error:s.message,status:"error"})}}function b(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var W=/^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 T(e){var t=e.toString().match(W);return u(t,"Unable to parse function!"),{name:t[1],args:t[2].split(","),body:t[3]}}function C(){}C.prototype=Object.create(null);var H=C;function E(e,t){if(typeof e=="object"){if(typeof t=="string"){let r=t.split(".");return E(e,r)}else if(Array.isArray(t)){let r=e;for(let o=0;o<t.length;o++)r=r[t[o]]=r[t[o]]||new H;return r}}}function P(e,t,r={}){if(Array.isArray(t))for(let o of t){let{name:n}=T(o);u(n,"Unable to detect name of function! Name it, or only supply one function and include name in first parameter."),P(e,o)}else{let o,n;if(typeof t=="function"&&(o=T(t).name),typeof e=="string"){let i=e.split(".");o||(o=i[i.length-1],i=i.slice(0,i.length-1)),n=E(window,i)}else o&&(typeof e=="object"||typeof e=="function")?n=e:u(!1,"Invalid typeof parameter 'name', or unable to parse pValue!");b(n,o)&&(r==null?void 0:r.overwrite)!==!0?console.warn([e,o].join(".")+" is already defined!"):n[o]=t}}var G={xs:64,sm:128,md:256,lg:512,xl:void 0};function U(e,t,r,o="xs"){if(e&&typeof e=="object")return U(e.primKey,e.login,e.hash,e.size);if(!e||!r)return"";let n=G[o];return"/api/data/blob/EmployeesLookup/".concat(e,"/Image/").concat(encodeURIComponent(t!=null?t:"")).concat(t?".":"").concat(encodeURIComponent(r),".jpg").concat(n?"?width=".concat(n):"")}async function Q(e){try{let t=await fetch("/api/user/localize/new/".concat(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(t){}return e}function f(e,t){var r,o;if(typeof e=="string"&&e.trim().length===0)return e;if(!(e===void 0||e===""||e===null))if(((o=(r=window.af)==null?void 0:r.article)==null?void 0:o.i18n)!==void 0){if(!b(af.article.i18n,e)){af.article.i18n[e]=e;let n=Q(e).then(i=>(af.article.i18n[e]=i,i));if(t)return n}return af.article.i18n[e]}else return e}function ee(e,...t){u(Array.isArray(e)&&e.length===t.length+1,"Method 'localize' must be used as a tag function");let r=e.map((n,i)=>i===e.length-1?n:"".concat(n,"$").concat(i)).join(""),o=f(r);return t.forEach((n,i)=>{o=o.replace("$"+i,n)}),o}async function M(e,t,r=0){var o;try{let n=await fetch("/api/logging/log-activity",{method:"POST",body:JSON.stringify({article:af.article.id,timeElapsed:r,action:e,parameters:t}),headers:{"Content-Type":"application/json",Accept:"application/json"}});if(!n.ok)if((o=n.headers.get("Content-Type"))!=null&&o.includes("application/json")){let i=await n.json();console.error(i.error)}else console.error("".concat(n.status," ").concat(n.statusText))}catch(n){}}function te(e,t){let r=performance.now();return()=>M(e,t,performance.now()-r)}function q(e){let t=e||af.article.id;return"".concat(t,".").concat(af.userSession.login)}function re(e,t){if(!(af!=null&&af.userSession))return null;let r=q(t),o=JSON.parse(localStorage.getItem(r)||"{}");return e?o[e]||null:o}function oe(e,t,r){if(!(af!=null&&af.userSession))return;let o=q(r),n=JSON.parse(localStorage.getItem(o)||"{}");typeof t<"u"?n[e]=t:n=e,localStorage.setItem(o,JSON.stringify(n))}var ne='\n <dialog class="alert-dialog">\n <form method="dialog">\n <article></article>\n <footer>\n <menu></menu>\n </footer>\n </form>\n </dialog>\n';if(window.document&&!document.querySelector("#AlertDialogTemplate")){let e=document.createElement("template");e.id="AlertDialogTemplate",e.innerHTML=ne,document.body.append(e)}function _(e){return new Promise(t=>{e.addEventListener("close",t,{once:!0})})}var S=new Map;async function O({buttons:e,content:t,className:r,id:o,title:n}){var w,y;if(o&&S.has(o))return await S.get(o);let i=document.querySelector("#AlertDialogTemplate");if(!i)throw Error("No alert dialog template found");let a=(w=i.content.firstElementChild)==null?void 0:w.cloneNode(!0),s=a==null?void 0:a.querySelector("article"),p=a==null?void 0:a.querySelector("footer menu");if(!a||!s||!p)throw Error("Invalid alert dialog template");if(r&&r.split(/\s+/).forEach(c=>a==null?void 0:a.classList.add(c)),n){let c=document.createElement("header");c.append(n),(y=s.parentNode)==null||y.insertBefore(c,s)}s.appendChild(typeof t=="string"?document.createTextNode(t):t);for(let{label:c,value:h,primary:B}of e){let F=document.createElement("li"),x=document.createElement("button");x.value=h,B&&x.classList.add("primary"),x.textContent=c,F.appendChild(x),p.appendChild(x)}document.body.appendChild(a),a.showModal();let d=_(a).then(()=>{o&&S.has(o)&&S.delete(o)}).then(()=>{let c=(a==null?void 0:a.returnValue)||"cancel";return a&&document.body.removeChild(a),c});return o&&S.set(o,d),await d}var k=(r=>(r[r.YesNo=0]="YesNo",r[r.OkCancel=1]="OkCancel",r))(k||{});async function ie(e,t={}){let{buttons:r=0,title:o}=t,n=r===1?[{label:f("OK"),value:"yes",primary:!0},{label:f("Cancel"),value:"no"}]:[{label:f("Yes"),value:"yes",primary:!0},{label:f("No"),value:"no"}];return await O({content:e,buttons:n,className:"alert-dialog-confirm",title:o})==="yes"}async function ae(e,t={}){await O(v({content:e,className:"alert-dialog-alert",buttons:[{label:f("OK"),value:"ok",primary:!0}]},t))}var We="2.7.6";export{k as ConfirmButtons,g as SessionHandler,D as UserSession,ae as alert,ie as confirm,z as downloadBlob,Y as downloadRequest,P as expose,f as getLocalizedString,re as getSettings,U as getUserImage,b as has,u as invariant,Z as localStorage,ee as localize,M as logActivity,L as mitt,O as openAlertDialog,oe as saveSettings,te as startActivity,X as toLocalISODate,$ as toLocalISODateTime,We as version,_ as waitForDialog};
|
|
1
|
+
var J=Object.defineProperty;var O=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var A=(e,t,r)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,g=(e,t)=>{for(var r in t||(t={}))K.call(t,r)&&A(e,r,t[r]);if(O)for(var r of O(t))V.call(t,r)&&A(e,r,t[r]);return e};var l=(e,t,r)=>(A(e,typeof t!="symbol"?t+"":t,r),r);function L(e){return{all:e=e||new Map,on:function(t,r){var n=e.get(t);n?n.push(r):e.set(t,[r])},off:function(t,r){var n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var n=e.get(t);n&&n.slice().map(function(o){o(r)}),(n=e.get("*"))&&n.slice().map(function(o){o(t,r)})}}}var m=class{constructor(){l(this,"eventHandler",L())}authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,r){try{let n=new Promise(i=>{let a=()=>{this.eventHandler.off("onAuthenticated",a),t==null||t(),i()};this.eventHandler.on("onAuthenticated",a)}),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="'.concat(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=".concat(encodeURIComponent(window.location.pathname)).concat(encodeURIComponent(window.location.search))}}attachEvent(t,r){return this.eventHandler.on(t,r)}detachEvent(t,r){return this.eventHandler.off(t,r)}};var D=class extends m{constructor(r){super();l(this,"amDesignator","a.m.");l(this,"dayNames",["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]);l(this,"dayNamesShort",["sun","mon","tue","wed","thu","fri","sat"]);l(this,"decimalSeparator",".");l(this,"domain","OB");l(this,"email");l(this,"formats");l(this,"groupSeparator",null);l(this,"integratedSecurity",!1);l(this,"isDeveloper",!1);l(this,"login","");l(this,"loginType");l(this,"monthNames",["january","february","march","april","may","june","july","august","september","october","november","december",""]);l(this,"monthNamesShort",["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""]);l(this,"name");l(this,"pmDesignator","p.m.");l(this,"shortDateFormat","dd.MM.yyyy");l(this,"culture","en-GB");l(this,"uiculture","en-GB");this.formats={},Object.assign(this,r)}};var R;(R=window.window)==null||R.addEventListener("error",e=>{var t,r,n,o,i,a,s;try{let p={error:(n=(r=(t=e.error)==null?void 0:t.message)!=null?r:e.message)!=null?n:null,file:e.filename,line:(o=e.lineno)!=null?o:0,column:(i=e.colno)!=null?i:0,stack:(s=(a=e.error)==null?void 0:a.stack)!=null?s:null};fetch("/data/Logger/LogError",{body:JSON.stringify(p),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"})}catch(p){}});function j(e){var t;return[((t=af==null?void 0:af.article)==null?void 0:t.id)||"","common",e].join(".")}var I=class{constructor(){l(this,"isPersisted",()=>!0)}getLocalStorageKey(t,r){return r?["common",t].join("."):j(t)}get(t,r,n){let o=this.getLocalStorageKey(t,n),i=localStorage.getItem(o);return i!==null?JSON.parse(i):r}set(t,r,n){localStorage.setItem(this.getLocalStorageKey(t,n),JSON.stringify(r))}remove(t,r){let n=this.getLocalStorageKey(t,r);return localStorage.getItem(n)!==null?(localStorage.removeItem(n),!0):!1}clear(){let t=j("");for(let r in localStorage)r.slice(0,t.length)===t&&localStorage.removeItem(r)}},Z=new I;function X(e){return e?$(e).substring(0,10):null}function y(e){return String(e).padStart(2,"0")}function $(e){return e?"".concat(e.getFullYear(),"-").concat(y(e.getMonth()+1),"-").concat(y(e.getDate()),"T").concat(y(e.getHours()),":").concat(y(e.getMinutes()),":").concat(y(e.getSeconds()),".").concat(y(e.getMilliseconds())):null}function T(e,t){return new Promise(function(r,n){try{let o=URL.createObjectURL(e),i=document.body,a=document.createElement("a");a.setAttribute("download",t),a.href=o,i.append(a),a.click(),i.removeChild(a),setTimeout(function(){URL.revokeObjectURL(o),r()},250)}catch(o){n(o)}})}function u(e,t){if(e)return;let r=typeof t=="function"?t():t;throw new Error(r!=null?r:"Invariant failed")}async function Y(e,{fileName:t,signal:r,onProgress:n}){var a;function o(s){typeof n=="function"&&n(g({},s))}let i=0;o({status:"requested"});try{let s=await fetch(e);if(!s.ok||!s.body){if((a=s.headers.get("content-type"))!=null&&a.includes("application/json")){let d=await s.json();u(!d.error,d.error)}throw new Error("".concat(s.status," ").concat(s.statusText))}try{let d=s.body.getReader(),v=new ReadableStream({start:function(h){function c(){return d.read().then(function(x){if(x.done){h.close();return}return i+=x.value.length,o({bytesReceived:i,status:"downloading"}),h.enqueue(x.value),c()})}return c()}});s=new Response(v)}catch(d){}let p=await s.blob();o({bytesReceived:i,status:"downloaded"}),await T(p,t),o({bytesReceived:i,status:"completed"})}catch(s){r!=null&&r.aborted?o({status:"cancelled"}):o({error:s.message,status:"error"})}}function w(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var W=/^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 z(e){var t=e.toString().match(W);return u(t,"Unable to parse function!"),{name:t[1],args:t[2].split(","),body:t[3]}}function C(){}C.prototype=Object.create(null);var P=C;function E(e,t){if(typeof e=="object"){if(typeof t=="string"){let r=t.split(".");return E(e,r)}else if(Array.isArray(t)){let r=e;for(let n=0;n<t.length;n++)r=r[t[n]]=r[t[n]]||new P;return r}}}function H(e,t,r={}){if(Array.isArray(t))for(let n of t){let{name:o}=z(n);u(o,"Unable to detect name of function! Name it, or only supply one function and include name in first parameter."),H(e,n)}else{let n,o;if(typeof t=="function"&&(n=z(t).name),typeof e=="string"){let i=e.split(".");n||(n=i[i.length-1],i=i.slice(0,i.length-1)),o=E(window,i)}else n&&(typeof e=="object"||typeof e=="function")?o=e:u(!1,"Invalid typeof parameter 'name', or unable to parse pValue!");w(o,n)&&(r==null?void 0:r.overwrite)!==!0?console.warn([e,n].join(".")+" is already defined!"):o[n]=t}}var G={xs:64,sm:128,md:256,lg:512,xl:void 0};function U(e,t,r,n="xs"){if(e&&typeof e=="object")return U(e.primKey,e.login,e.hash,e.size);if(!e||!r)return"";let o=G[n];return"/api/data/blob/EmployeesLookup/".concat(e,"/Image/").concat(encodeURIComponent(t!=null?t:"")).concat(t?".":"").concat(encodeURIComponent(r),".jpg").concat(o?"?width=".concat(o):"")}async function Q(e){try{let t=await fetch("/api/user/localize/new/".concat(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(t){}return e}function f(e,t){var r,n;if(typeof e=="string"&&e.trim().length===0)return e;if(!(e===void 0||e===""||e===null))if(((n=(r=window.af)==null?void 0:r.article)==null?void 0:n.i18n)!==void 0){if(!w(af.article.i18n,e)){af.article.i18n[e]=e;let o=Q(e).then(i=>(af.article.i18n[e]=i,i));if(t)return o}return af.article.i18n[e]}else return e}function ee(e,...t){u(Array.isArray(e)&&e.length===t.length+1,"Method 'localize' must be used as a tag function");let r=e.map((o,i)=>i===e.length-1?o:"".concat(o,"$").concat(i)).join(""),n=f(r);return t.forEach((o,i)=>{n=n.replace("$"+i,o)}),n}async function M(e,t,r=0){var n;try{let o=await fetch("/api/logging/log-activity",{method:"POST",body:JSON.stringify({article:af.article.id,timeElapsed:r,action:e,parameters:t}),headers:{"Content-Type":"application/json",Accept:"application/json"}});if(!o.ok)if((n=o.headers.get("Content-Type"))!=null&&n.includes("application/json")){let i=await o.json();console.error(i.error)}else console.error("".concat(o.status," ").concat(o.statusText))}catch(o){}}function te(e,t={}){let r=performance.now();return(n={})=>M(e,g(g({},t),n),performance.now()-r)}async function re(e){let t=performance.now();return[await e(),performance.now()-t]}function q(e){let t=e||af.article.id;return"".concat(t,".").concat(af.userSession.login)}function ne(e,t){if(!(af!=null&&af.userSession))return null;let r=q(t),n=JSON.parse(localStorage.getItem(r)||"{}");return e?n[e]||null:n}function oe(e,t,r){if(!(af!=null&&af.userSession))return;let n=q(r),o=JSON.parse(localStorage.getItem(n)||"{}");typeof t<"u"?o[e]=t:o=e,localStorage.setItem(n,JSON.stringify(o))}var ie='\n <dialog class="alert-dialog">\n <form method="dialog">\n <article></article>\n <footer>\n <menu></menu>\n </footer>\n </form>\n </dialog>\n';if(window.document&&!document.querySelector("#AlertDialogTemplate")){let e=document.createElement("template");e.id="AlertDialogTemplate",e.innerHTML=ie,document.body.append(e)}function _(e,t="No"){return new Promise(r=>{let n=new AbortController;e.addEventListener("close",()=>{r(e.returnValue),n.abort()},{signal:n.signal}),e.addEventListener("cancel",()=>{r(t),n.abort()},{signal:n.signal})})}var S=new Map;async function N({buttons:e,content:t,className:r,id:n,title:o}){var v,h;if(n&&S.has(n))return await S.get(n);let i=document.querySelector("#AlertDialogTemplate");if(!i)throw Error("No alert dialog template found");let a=(v=i.content.firstElementChild)==null?void 0:v.cloneNode(!0),s=a==null?void 0:a.querySelector("article"),p=a==null?void 0:a.querySelector("footer menu");if(!a||!s||!p)throw Error("Invalid alert dialog template");if(r&&r.split(/\s+/).forEach(c=>a==null?void 0:a.classList.add(c)),o){let c=document.createElement("header");c.append(o),(h=s.parentNode)==null||h.insertBefore(c,s)}s.appendChild(typeof t=="string"?document.createTextNode(t):t);for(let{label:c,value:x,primary:B}of e){let F=document.createElement("li"),b=document.createElement("button");b.value=x,B&&b.classList.add("primary"),b.textContent=c,F.appendChild(b),p.appendChild(b)}document.body.appendChild(a),a.showModal();let d=_(a).then(c=>(n&&S.has(n)&&S.delete(n),a&&document.body.removeChild(a),c));return n&&S.set(n,d),await d}var k=(r=>(r[r.YesNo=0]="YesNo",r[r.OkCancel=1]="OkCancel",r))(k||{});async function ae(e,t={}){let{buttons:r=0,title:n}=t,o=r===1?[{label:f("OK"),value:"yes",primary:!0},{label:f("Cancel"),value:"no"}]:[{label:f("Yes"),value:"yes",primary:!0},{label:f("No"),value:"no"}];return await N({content:e,buttons:o,className:"alert-dialog-confirm",title:n})==="yes"}async function le(e,t={}){await N(g({content:e,className:"alert-dialog-alert",buttons:[{label:f("OK"),value:"ok",primary:!0}]},t))}var Qe="2.8.1";export{k as ConfirmButtons,m as SessionHandler,D as UserSession,le as alert,ae as confirm,T as downloadBlob,Y as downloadRequest,H as expose,f as getLocalizedString,ne as getSettings,U as getUserImage,w as has,u as invariant,Z as localStorage,ee as localize,M as logActivity,L as mitt,N as openAlertDialog,oe as saveSettings,te as startActivity,re as time,X as toLocalISODate,$ as toLocalISODateTime,Qe as version,_ as waitForDialog};
|
|
2
2
|
//# sourceMappingURL=af.common.legacy.min.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../node_modules/.pnpm/mitt@3.0.1/node_modules/mitt/src/index.ts", "../../src/SessionHandler.ts", "../../src/UserSession.ts", "../../src/errorHandler.ts", "../../src/localStorage.ts", "../../src/date.ts", "../../src/downloadBlob.ts", "../../src/invariant.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/logActivity.ts", "../../src/settings.ts", "../../src/alert.ts", "../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["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<\n\tWildcardHandler<T>\n>;\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>(\n\t\ttype: Key,\n\t\thandler?: Handler<Events[Key]>\n\t): 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>(\n\t\ttype: undefined extends Events[Key] ? Key : never\n\t): 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\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} else {\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 (`'*'` to remove a wildcard handler)\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} else {\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\tprivate eventHandler: Emitter<{ onAuthenticated: void; onExpired: void }> = mitt();\n\n\tauthenticated() {\n\t\tthis.eventHandler.emit(\"onAuthenticated\");\n\t}\n\n\tasync expired(callback?: () => void, type?: \"RequireTwoFactor\"): Promise<void> {\n\t\ttry {\n\t\t\tlet authPromise = new Promise<void>((resolve) => {\n\t\t\t\tlet eventHandler = () => {\n\t\t\t\t\tthis.eventHandler.off(\"onAuthenticated\", eventHandler);\n\t\t\t\t\tcallback?.();\n\t\t\t\t\tresolve();\n\t\t\t\t};\n\n\t\t\t\tthis.eventHandler.on(\"onAuthenticated\", eventHandler);\n\t\t\t});\n\n\t\t\tlet dialog: HTMLDialogElement | null = document.querySelector(\"dialog.session-expired-dialog\");\n\t\t\tif (!dialog) {\n\t\t\t\tdialog = document.createElement(\"dialog\");\n\t\t\t\tdialog.className = \"session-expired-dialog\";\n\t\t\t\tdialog.style.display = \"flex\";\n\t\t\t\tdialog.style.padding = \"0\";\n\t\t\t\tdialog.style.left = \"50%\";\n\t\t\t\tdialog.style.transform = \"translateX(-50%)\";\n\n\t\t\t\tlet link = \"/login?ReturnUrl=%2fapi/sessionexpired/remove\";\n\t\t\t\tif (type !== \"RequireTwoFactor\") {\n\t\t\t\t\tawait fetch(\"/logout\", { method: \"POST\" });\n\t\t\t\t} else {\n\t\t\t\t\tlink = \"/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove\";\n\t\t\t\t}\n\n\t\t\t\tdialog.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\t\t\t\tdocument.body.append(dialog);\n\t\t\t\tdialog.showModal();\n\t\t\t\tawait authPromise;\n\t\t\t\tdialog.remove();\n\t\t\t} else {\n\t\t\t\tawait authPromise;\n\t\t\t}\n\t\t} catch (_) {\n\t\t\twindow.location.href = `/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(\n\t\t\t\twindow.location.search,\n\t\t\t)}`;\n\t\t}\n\t}\n\n\tattachEvent(eventName: SessionHandlerEvent, handler: Handler) {\n\t\treturn this.eventHandler.on(eventName, handler);\n\t}\n\n\tdetachEvent(eventName: SessionHandlerEvent, handler: Handler) {\n\t\treturn this.eventHandler.off(eventName, handler);\n\t}\n}\n", "import SessionHandler from \"./SessionHandler.js\";\n\nexport class UserSession extends SessionHandler {\n\tamDesignator: string = \"a.m.\";\n\tdayNames: string[] = [\"sunday\", \"monday\", \"tuesday\", \"wednesday\", \"thursday\", \"friday\", \"saturday\"];\n\tdayNamesShort: string[] = [\"sun\", \"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\"];\n\tdecimalSeparator: string = \".\";\n\tdomain: string = \"OB\";\n\temail: string | null | undefined;\n\tformats: undefined | Record<string, string>;\n\tgroupSeparator: string | null = null;\n\tintegratedSecurity: boolean = false;\n\tisDeveloper: boolean = false;\n\tlogin: string = \"\";\n\tloginType: string | undefined;\n\tmonthNames: string[] = [\n\t\t\"january\",\n\t\t\"february\",\n\t\t\"march\",\n\t\t\"april\",\n\t\t\"may\",\n\t\t\"june\",\n\t\t\"july\",\n\t\t\"august\",\n\t\t\"september\",\n\t\t\"october\",\n\t\t\"november\",\n\t\t\"december\",\n\t\t\"\",\n\t];\n\tmonthNamesShort: string[] = [\"jan\", \"feb\", \"mar\", \"apr\", \"may\", \"jun\", \"jul\", \"augt\", \"sep\", \"oct\", \"nov\", \"dec\", \"\"];\n\tname: string | undefined;\n\tpmDesignator: string = \"p.m.\";\n\tshortDateFormat: string = \"dd.MM.yyyy\";\n\tculture: string = \"en-GB\";\n\tuiculture: string = \"en-GB\";\n\n\tconstructor(userData: any) {\n\t\tsuper();\n\t\tthis.formats = {};\n\t\tObject.assign(this, userData);\n\t}\n}\n", "if (process.env.NODE_ENV === \"production\") {\n\tglobalThis.window?.addEventListener(\"error\", (event) => {\n\t\ttry {\n\t\t\t// Try to avoid error-logging-loop\n\t\t\tconst data = {\n\t\t\t\terror: event.error?.message ?? event.message ?? null,\n\t\t\t\tfile: event.filename,\n\t\t\t\tline: event.lineno ?? 0,\n\t\t\t\tcolumn: event.colno ?? 0,\n\t\t\t\tstack: event.error?.stack ?? null,\n\t\t\t};\n\n\t\t\tfetch(\"/data/Logger/LogError\", {\n\t\t\t\tbody: JSON.stringify(data),\n\t\t\t\theaders: {\n\t\t\t\t\tAccept: \"application/json\",\n\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\",\n\t\t\t\t\t\"X-Requested-With\": \"XMLHttpRequest\",\n\t\t\t\t},\n\t\t\t\tmethod: \"POST\",\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\t// ignore\n\t\t}\n\t});\n}\n", "function getLocalKey(key: string): string {\n\treturn [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n\tisPersisted = () => true;\n\n\tgetLocalStorageKey(key: string, global?: boolean) {\n\t\treturn global ? [\"common\", key].join(\".\") : getLocalKey(key);\n\t}\n\n\tget(key: string, defaultValue: unknown, global?: boolean) {\n\t\tconst lsKey = this.getLocalStorageKey(key, global);\n\t\tconst value = localStorage.getItem(lsKey);\n\n\t\treturn value !== null ? JSON.parse(value) : defaultValue;\n\t}\n\n\tset(key: string, value: unknown, global?: boolean) {\n\t\tlocalStorage.setItem(this.getLocalStorageKey(key, global), JSON.stringify(value));\n\t}\n\n\tremove(key: string, global?: boolean) {\n\t\tconst lsKey = this.getLocalStorageKey(key, global);\n\t\tif (localStorage.getItem(lsKey) !== null) {\n\t\t\tlocalStorage.removeItem(lsKey);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tclear() {\n\t\tconst baseKey = getLocalKey(\"\");\n\n\t\tfor (let key in localStorage) {\n\t\t\tif (key.slice(0, baseKey.length) === baseKey) {\n\t\t\t\tlocalStorage.removeItem(key);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default new LocalStorage();\n", "export function toLocalISODate(date: Date): string;\nexport function toLocalISODate(date: Date | null): string | null;\nexport function toLocalISODate(date: Date | null): string | null {\n\treturn date ? toLocalISODateTime(date).substring(0, 10) : null;\n}\n\nfunction pad(num: number) {\n\treturn String(num).padStart(2, \"0\");\n}\n\nexport function toLocalISODateTime(date: Date): string;\nexport function toLocalISODateTime(date: Date | null): string | null;\nexport function toLocalISODateTime(date: Date | null): string | null {\n\treturn date\n\t\t? `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(\n\t\t\t\tdate.getMinutes(),\n\t\t )}:${pad(date.getSeconds())}.${pad(date.getMilliseconds())}`\n\t\t: null;\n}\n", "export function downloadBlob(blob: Blob | MediaSource, fileName: string) {\n\treturn new Promise<void>(function (resolve, reject) {\n\t\ttry {\n\t\t\tconst url = URL.createObjectURL(blob);\n\t\t\tconst parent = document.body;\n\t\t\tconst anchor = document.createElement(\"a\");\n\t\t\tanchor.setAttribute(\"download\", fileName);\n\t\t\tanchor.href = url;\n\t\t\tparent.append(anchor);\n\t\t\tanchor.click();\n\t\t\tparent.removeChild(anchor);\n\n\t\t\tsetTimeout(function () {\n\t\t\t\tURL.revokeObjectURL(url);\n\t\t\t\tresolve();\n\t\t\t}, 250);\n\t\t} catch (ex) {\n\t\t\treject(ex);\n\t\t}\n\t});\n}\n", "export function invariant(condition: any, message?: string | (() => string)): asserts condition {\n\tif (condition) {\n\t\treturn;\n\t}\n\tconst provided: string | undefined = typeof message === \"function\" ? message() : message;\n\n\tthrow new Error(provided ?? \"Invariant failed\");\n}\n", "import { downloadBlob } from \"./downloadBlob.js\";\nimport { invariant } from \"./invariant.js\";\n\nexport type DownloadItem = {\n\tstatus: \"cancelled\" | \"error\" | \"requested\" | \"downloading\" | \"downloaded\" | \"completed\";\n\tbytesReceived?: number;\n\terror?: string;\n};\n\nexport type DownloadParameters = {\n\tsignal?: AbortSignal;\n\tfileName: string;\n\tonProgress?: (progress: DownloadItem) => void;\n};\n\nexport async function downloadRequest(request: Request, { fileName, signal, onProgress }: DownloadParameters) {\n\tfunction reportProgress(progress: DownloadItem) {\n\t\tif (typeof onProgress === \"function\") {\n\t\t\tonProgress({ ...progress });\n\t\t}\n\t}\n\n\tlet bytesReceived = 0;\n\n\treportProgress({ status: \"requested\" });\n\n\ttry {\n\t\tlet response = await fetch(request);\n\n\t\tif (!response.ok || !response.body) {\n\t\t\tif (response.headers.get(\"content-type\")?.includes(\"application/json\")) {\n\t\t\t\tlet data = await response.json();\n\t\t\t\tinvariant(!data.error, data.error);\n\t\t\t}\n\t\t\tthrow new Error(`${response.status} ${response.statusText}`);\n\t\t}\n\n\t\ttry {\n\t\t\tconst reader = response.body.getReader();\n\t\t\tconst stream = new ReadableStream({\n\t\t\t\tstart: function (controller) {\n\t\t\t\t\tfunction pump(): Promise<void> {\n\t\t\t\t\t\treturn reader.read().then(function (read) {\n\t\t\t\t\t\t\tif (read.done) {\n\t\t\t\t\t\t\t\tcontroller.close();\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbytesReceived += read.value.length;\n\t\t\t\t\t\t\treportProgress({ bytesReceived, status: \"downloading\" });\n\t\t\t\t\t\t\tcontroller.enqueue(read.value);\n\n\t\t\t\t\t\t\treturn pump();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\treturn pump();\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tresponse = new Response(stream);\n\t\t} catch (error) {}\n\n\t\tconst blob = await response.blob();\n\n\t\treportProgress({ bytesReceived, status: \"downloaded\" });\n\n\t\tawait downloadBlob(blob, fileName);\n\n\t\treportProgress({ bytesReceived, status: \"completed\" });\n\t} catch (err) {\n\t\tif (signal?.aborted) {\n\t\t\treportProgress({ status: \"cancelled\" });\n\t\t} else {\n\t\t\treportProgress({ error: (err as Error).message, status: \"error\" });\n\t\t}\n\t}\n}\n", "export function has(obj: any, key: string | number | symbol): boolean {\n\treturn Object.prototype.hasOwnProperty.call(obj, key);\n}\n", "import { invariant } from \"./invariant.js\";\n\nconst funcRegex =\n\t/^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\tvar match = func.toString().match(funcRegex);\n\tinvariant(match, \"Unable to parse function!\");\n\treturn { 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(root: any, namespace: string | Array<string>): any {\n\tif (typeof root === \"object\") {\n\t\tif (typeof namespace === \"string\") {\n\t\t\tlet path = namespace.split(\".\");\n\n\t\t\treturn requireNamespace(root, path);\n\t\t} else if (Array.isArray(namespace)) {\n\t\t\tlet current: any = root;\n\t\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\t\tcurrent = current[namespace[i]] = current[namespace[i]] || new (Namespace as any)();\n\t\t\t}\n\n\t\t\treturn current;\n\t\t}\n\t}\n}\n", "import { has } from \"./has.js\";\nimport { invariant } from \"./invariant.js\";\nimport { parseFunc } from \"./parseFunc.js\";\nimport { requireNamespace } from \"./requireNamespace.js\";\n\nexport type ExposeOptions = {\n\t/**\n\t * Whether we should overwrite any existing values without warning.\n\t */\n\toverwrite?: boolean;\n};\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(\n\tname: object | string,\n\tvalue: object | Function | Function[],\n\toptions: ExposeOptions = {},\n): void {\n\tif (Array.isArray(value)) {\n\t\tfor (let func of value) {\n\t\t\tconst { name: funcName } = parseFunc(func);\n\n\t\t\tinvariant(\n\t\t\t\tfuncName,\n\t\t\t\t\"Unable to detect name of function! Name it, or only supply one function and include name in first parameter.\",\n\t\t\t);\n\t\t\texpose(name, func); // Expose func on namespace found in pName\n\t\t}\n\t} else {\n\t\tlet keyName: string | undefined;\n\t\tlet namespace;\n\n\t\tif (typeof value === \"function\") {\n\t\t\tkeyName = parseFunc(value).name;\n\t\t}\n\n\t\tif (typeof name === \"string\") {\n\t\t\tlet pathParts = name.split(\".\");\n\n\t\t\tif (!keyName) {\n\t\t\t\tkeyName = pathParts[pathParts.length - 1];\n\t\t\t\tpathParts = pathParts.slice(0, pathParts.length - 1);\n\t\t\t}\n\n\t\t\tnamespace = requireNamespace(window, pathParts);\n\t\t} else if (keyName && (typeof name === \"object\" || typeof name === \"function\")) {\n\t\t\tnamespace = name;\n\t\t} else {\n\t\t\tinvariant(false, \"Invalid typeof parameter 'name', or unable to parse pValue!\");\n\t\t}\n\n\t\tif (has(namespace, keyName) && options?.overwrite !== true) {\n\t\t\t// If class is already defined, warn or show an alert\n\t\t\tconsole.warn([name, keyName].join(\".\") + \" is already defined!\");\n\t\t} else {\n\t\t\tnamespace[keyName] = value;\n\t\t}\n\t}\n}\n", "export type ImageSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport interface getUserImageOptions {\n\t/**\n\t * Prim key of the record in atbl_Personnel_Employees\n\t */\n\tprimKey: string | null;\n\t/**\n\t * Person ID of the employee\n\t */\n\tlogin: string | null;\n\t/**\n\t * The value of the ImageHash column in atbl_Personnel_Employees\n\t */\n\thash: string | number | null;\n\t/**\n\t * The image will be resized according to this value. Default is 'xs':\n\t * - xs: 64px\n\t * - sm: 128px\n\t * - md: 256px\n\t * - lg: 512px\n\t * - xl: image is not resized\n\t */\n\tsize?: ImageSize;\n}\n\nconst sizeMap: Record<ImageSize, number | undefined> = {\n\txs: 64,\n\tsm: 128,\n\tmd: 256,\n\tlg: 512,\n\txl: 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(\n\tprimKey: string | null,\n\tlogin: string | null,\n\thash: string | number | null,\n\tsize?: ImageSize,\n): string;\nexport function getUserImage(options: getUserImageOptions): string;\nexport function getUserImage(\n\tprimKeyOrOptions: string | null | getUserImageOptions,\n\tlogin?: string | null,\n\thash?: string | number | null,\n\tsize: ImageSize = \"xs\",\n) {\n\tif (primKeyOrOptions && typeof primKeyOrOptions === \"object\") {\n\t\treturn getUserImage(primKeyOrOptions.primKey, primKeyOrOptions.login, primKeyOrOptions.hash, primKeyOrOptions.size);\n\t}\n\n\tif (!primKeyOrOptions || !hash) {\n\t\treturn \"\";\n\t}\n\n\tlet sizePx = sizeMap[size];\n\treturn `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${encodeURIComponent(login ?? \"\")}${\n\t\tlogin ? \".\" : \"\"\n\t}${encodeURIComponent(hash)}.jpg${sizePx ? `?width=${sizePx}` : \"\"}`;\n}\n", "import { has } from \"./has.js\";\n\nasync function fetchLocalizedString(text: string) {\n\ttry {\n\t\tlet response = await fetch(`/api/user/localize/new/${af.article.id}`, {\n\t\t\tbody: JSON.stringify({ text }),\n\t\t\theaders: {\n\t\t\t\tAccept: \"application/json; */*\",\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\"X-Requested-With\": \"XMLHttpRequest\",\n\t\t\t},\n\t\t\tmethod: \"POST\",\n\t\t});\n\n\t\tif (response.ok) {\n\t\t\treturn (await response.json()) as string;\n\t\t}\n\t} catch (error) {}\n\n\treturn 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\tif (!string) return string;\n\n\treturn 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\tstring: string | undefined | null,\n\twait?: boolean,\n): string | undefined | null | Promise<string> {\n\tif (typeof string === \"string\" && string.trim().length === 0) {\n\t\treturn string;\n\t}\n\n\tif (string === undefined || string === \"\" || string === null) {\n\t\treturn;\n\t}\n\n\tif (globalThis.af?.article?.i18n !== undefined) {\n\t\tif (!has(af.article.i18n, string)) {\n\t\t\taf.article.i18n[string] = string;\n\n\t\t\tlet promise = fetchLocalizedString(string).then((text) => {\n\t\t\t\taf.article.i18n[string] = text;\n\t\t\t\treturn text;\n\t\t\t});\n\n\t\t\tif (wait) {\n\t\t\t\treturn promise;\n\t\t\t}\n\t\t}\n\n\t\treturn af.article.i18n[string];\n\t} else {\n\t\treturn string;\n\t}\n}\n", "import { getLocalizedString } from \"./getLocalizedString.js\";\nimport { invariant } from \"./invariant.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\tinvariant(\n\t\tArray.isArray(stringParts) && stringParts.length === args.length + 1,\n\t\t\"Method 'localize' must be used as a tag function\",\n\t);\n\n\tlet stringToLocalize = stringParts.map((s, i) => (i === stringParts.length - 1 ? s : `${s}\\$${i}`)).join(\"\");\n\tlet localized = getLocalizedString(stringToLocalize);\n\n\targs.forEach((arg, index) => {\n\t\tlocalized = localized.replace(\"$\" + index, arg);\n\t});\n\n\treturn localized;\n}\n", "/**\n * Logs an activity to the website activity log\n *\n * @param activity name of the activity we are logging\n * @param parameters A dictionary of parameters used when doing the activity\n * @param timeElapsed Number of milliseconds elapsed while executing\n */\nexport async function logActivity(activity: string, parameters: Record<string, any>, timeElapsed: number = 0) {\n\ttry {\n\t\tlet response = await fetch(\"/api/logging/log-activity\", {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({\n\t\t\t\tarticle: af.article.id,\n\t\t\t\ttimeElapsed,\n\t\t\t\taction: activity,\n\t\t\t\tparameters,\n\t\t\t}),\n\t\t\theaders: { \"Content-Type\": \"application/json\", Accept: \"application/json\" },\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tif (response.headers.get(\"Content-Type\")?.includes(\"application/json\")) {\n\t\t\t\tlet data = await response.json();\n\t\t\t\tconsole.error(data.error);\n\t\t\t} else {\n\t\t\t\tconsole.error(`${response.status} ${response.statusText}`);\n\t\t\t}\n\t\t}\n\t} catch (error) {}\n}\n\n/**\n * Records the current time, and returns a function that logs the activity with the\n * time elapsed when it is called.\n *\n * @param activity Name of the activity we are logging\n * @param parameters A dictionary of parameters used when doing the activity\n * @returns A function that should be called when the activity is completed to log it to the website log\n */\nexport function startActivity(activity: string, parameters: Record<string, any>) {\n\tlet start = performance.now();\n\treturn () => logActivity(activity, parameters, performance.now() - start);\n}\n", "function getKey(article?: string) {\n\tconst articleKey = article || af.article.id;\n\treturn `${articleKey}.${af.userSession.login}`;\n}\n\nexport function getSettings<T>(setting: string, article?: string): T | null {\n\tif (!af?.userSession) return null;\n\n\tconst key = getKey(article);\n\tconst settings = JSON.parse(localStorage.getItem(key) || \"{}\");\n\n\tif (setting) {\n\t\treturn settings[setting] || null;\n\t}\n\n\treturn settings;\n}\n\nexport function saveSettings<T>(setting: string, value: T | null, article?: string): void {\n\tif (!af?.userSession) return;\n\n\tconst key = getKey(article);\n\tlet userSettings = JSON.parse(localStorage.getItem(key) || \"{}\");\n\n\tif (typeof value !== \"undefined\") {\n\t\tuserSettings[setting] = value;\n\t} else {\n\t\tuserSettings = setting;\n\t}\n\n\tlocalStorage.setItem(key, JSON.stringify(userSettings));\n}\n", "import { getLocalizedString } from \"./getLocalizedString.js\";\n\nconst template = `\n\t<dialog class=\"alert-dialog\">\n\t\t\t<form method=\"dialog\">\n\t\t\t\t\t<article></article>\n\t\t\t\t\t<footer>\n\t\t\t\t\t\t\t<menu></menu>\n\t\t\t\t\t</footer>\n\t\t\t</form>\n\t</dialog>\n`;\n\nif (globalThis.document && !document.querySelector(\"#AlertDialogTemplate\")) {\n\tlet $template = document.createElement(\"template\");\n\t$template.id = \"AlertDialogTemplate\";\n\t$template.innerHTML = template;\n\tdocument.body.append($template);\n}\n\nexport function waitForDialog(dialog: HTMLDialogElement) {\n\treturn new Promise((resolve) => {\n\t\tdialog.addEventListener(\"close\", resolve, { once: true });\n\t});\n}\n\nexport type AlertDialogButton = {\n\tlabel: string;\n\tvalue: string;\n\tprimary?: boolean;\n};\n\nexport type AlertDialogOptions = {\n\tbuttons: AlertDialogButton[];\n\tcontent: string | HTMLElement;\n\tclassName?: string;\n\tid?: string;\n\ttitle?: string;\n};\n\nconst alertDialogPromiseMap = new Map<string, Promise<string>>();\n\nexport async function openAlertDialog({ buttons, content, className, id, title }: AlertDialogOptions) {\n\tif (id && alertDialogPromiseMap.has(id)) {\n\t\treturn await alertDialogPromiseMap.get(id);\n\t}\n\n\tlet $template = document.querySelector<HTMLTemplateElement>(\"#AlertDialogTemplate\");\n\tif (!$template) throw Error(\"No alert dialog template found\");\n\n\tlet $dialog = $template.content.firstElementChild?.cloneNode(true) as HTMLDialogElement | null;\n\tlet $content = $dialog?.querySelector(\"article\");\n\tlet $menu = $dialog?.querySelector(\"footer menu\");\n\n\tif (!$dialog || !$content || !$menu) throw Error(\"Invalid alert dialog template\");\n\n\tif (className) {\n\t\tclassName.split(/\\s+/).forEach((className) => $dialog?.classList.add(className));\n\t}\n\n\tif (title) {\n\t\tlet $header = document.createElement(\"header\");\n\t\t$header.append(title);\n\t\t$content.parentNode?.insertBefore($header, $content);\n\t}\n\n\t$content.appendChild(typeof content === \"string\" ? document.createTextNode(content) : content);\n\tfor (let { label, value, primary } of buttons) {\n\t\tlet listItem = document.createElement(\"li\");\n\t\tlet buttonElem = document.createElement(\"button\");\n\t\tbuttonElem.value = value;\n\t\tif (primary) {\n\t\t\tbuttonElem.classList.add(\"primary\");\n\t\t}\n\t\tbuttonElem.textContent = label;\n\t\tlistItem.appendChild(buttonElem);\n\t\t$menu.appendChild(buttonElem);\n\t}\n\n\tdocument.body.appendChild($dialog);\n\t$dialog.showModal();\n\n\tlet dialogPromise = waitForDialog($dialog)\n\t\t.then(() => {\n\t\t\tif (id && alertDialogPromiseMap.has(id)) {\n\t\t\t\talertDialogPromiseMap.delete(id);\n\t\t\t}\n\t\t})\n\t\t.then(() => {\n\t\t\tlet result = $dialog?.returnValue || \"cancel\";\n\t\t\tif ($dialog) document.body.removeChild($dialog);\n\n\t\t\treturn result;\n\t\t});\n\n\tif (id) {\n\t\talertDialogPromiseMap.set(id, dialogPromise);\n\t}\n\n\treturn await dialogPromise;\n}\n\nexport enum ConfirmButtons {\n\tYesNo,\n\tOkCancel,\n}\n\nexport type ConfirmOptions = {\n\tbuttons?: ConfirmButtons;\n\ttitle?: string;\n};\n\nexport async function confirm(prompt: string, options: ConfirmOptions = {}): Promise<boolean> {\n\tlet { buttons: optionButtons = ConfirmButtons.YesNo, title } = options;\n\tlet buttons: AlertDialogButton[] =\n\t\toptionButtons === ConfirmButtons.OkCancel\n\t\t\t? [\n\t\t\t\t\t{ label: getLocalizedString(\"OK\"), value: \"yes\", primary: true },\n\t\t\t\t\t{ label: getLocalizedString(\"Cancel\"), value: \"no\" },\n\t\t\t ]\n\t\t\t: [\n\t\t\t\t\t{ label: getLocalizedString(\"Yes\"), value: \"yes\", primary: true },\n\t\t\t\t\t{ label: getLocalizedString(\"No\"), value: \"no\" },\n\t\t\t ];\n\n\tlet result = await openAlertDialog({ content: prompt, buttons, className: \"alert-dialog-confirm\", title });\n\treturn result === \"yes\";\n}\n\nexport type AlertOptions = {\n\ttitle?: string;\n};\n\nexport async function alert(prompt: string, options: AlertOptions = {}): Promise<void> {\n\tawait openAlertDialog({\n\t\tcontent: prompt,\n\t\tclassName: \"alert-dialog-alert\",\n\t\tbuttons: [{ label: getLocalizedString(\"OK\"), value: \"ok\", primary: true }],\n\t\t...options,\n\t});\n}\n", "import { UserSession } from \"./UserSession.js\";\nimport { alert, confirm, openAlertDialog } from \"./alert.js\";\nimport \"./errorHandler.js\";\nimport { expose } from \"./expose.js\";\nimport { getLocalizedString } from \"./getLocalizedString.js\";\nimport afLocalStorage from \"./localStorage.js\";\nimport { localize } from \"./localize.js\";\nimport { logActivity, startActivity } from \"./logActivity.js\";\n\nexport { default as mitt } from \"mitt\";\nexport { toLocalISODate, toLocalISODateTime } from \"./date.js\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport { downloadRequest } from \"./downloadRequest.js\";\nexport type { DownloadParameters, DownloadItem } from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport { getUserImage } from \"./getUserImage.js\";\nexport type { getUserImageOptions } from \"./getUserImage.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport { has } from \"./has.js\";\nexport { invariant } from \"./invariant.js\";\nexport { localize } from \"./localize.js\";\nexport { afLocalStorage as localStorage };\nexport { logActivity, startActivity } from \"./logActivity.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport { getSettings, saveSettings } from \"./settings.js\";\nexport { alert, confirm, ConfirmButtons, openAlertDialog, waitForDialog } from \"./alert.js\";\nexport type { AlertDialogButton, AlertDialogOptions, AlertOptions, ConfirmOptions } from \"./alert.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n\tvar __VERSION__: string;\n\tvar __DEV__: number;\n\tvar af: AfCore;\n\n\tinterface Window {\n\t\taf: AfCore;\n\t}\n}\n\nexport interface AfArticle {\n\thostName: string;\n\ti18n: Record<string, string>;\n\tid: string;\n}\n\nexport interface AfCore {\n\tarticle: AfArticle;\n\tcommon: {\n\t\tgetLocalizedString: typeof getLocalizedString;\n\t\texpose: typeof expose;\n\t\tlocalize: typeof localize;\n\t\tlocalStorage: typeof afLocalStorage;\n\t\tlogActivity: typeof logActivity;\n\t\tstartActivity: typeof startActivity;\n\t\talert: typeof alert;\n\t\tconfirm: typeof confirm;\n\t\topenAlertDialog: typeof openAlertDialog;\n\t};\n\tcontrols?: {\n\t\talert?: (message: string, callback?: () => void) => void;\n\t\tconfirm?: (options: {\n\t\t\ttitle: string;\n\t\t\tmessage: string;\n\t\t\tbuttons: string[];\n\t\t\tcallback: (button: number) => void;\n\t\t}) => void;\n\t};\n\tuserSession: UserSession;\n}\n"],
|
|
5
|
-
"mappings": "wZA8CCA,EAAAA,CAOA,MAAO,CAINA,IANDA,EAAMA,GAAO,IAAIC,IAchBC,GAAAA,SAA6BC,EAAWC,EAAAA,CACvC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,EACHA,EAASE,KAAKH,CAAAA,EAEdJ,EAAKQ,IAAIL,EAAM,CAACC,CAAAA,CAAAA,CAAAA,EAWlBK,IAAAA,SAA8BN,EAAWC,EAAAA,CACxC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,IACCD,EACHC,EAASK,OAAOL,EAASM,QA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AAC,CAAE,MAAOG,EAAmB,IAAI,EAAG,MAAO,KAAM,QAAS,EAAK,CAAC,GACtEF,EACH,CACF,CC/GO,IAAMK,GAAU",
|
|
6
|
-
"names": ["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", "_a", "event", "_b", "_c", "_d", "_e", "_f", "_g", "data", "ex", "getLocalKey", "key", "_a", "LocalStorage", "__publicField", "global", "defaultValue", "lsKey", "value", "baseKey", "localStorage_default", "toLocalISODate", "date", "toLocalISODateTime", "pad", "num", "downloadBlob", "blob", "fileName", "resolve", "reject", "url", "parent", "anchor", "ex", "invariant", "condition", "message", "provided", "downloadRequest", "request", "fileName", "signal", "onProgress", "_a", "reportProgress", "progress", "__spreadValues", "bytesReceived", "response", "data", "invariant", "reader", "stream", "controller", "pump", "read", "error", "blob", "downloadBlob", "err", "has", "obj", "key", "funcRegex", "parseFunc", "func", "match", "invariant", "Namespace", "Namespace_default", "requireNamespace", "root", "namespace", "path", "current", "i", "Namespace_default", "expose", "name", "value", "options", "func", "funcName", "parseFunc", "invariant", "keyName", "namespace", "pathParts", "requireNamespace", "has", "sizeMap", "getUserImage", "primKeyOrOptions", "login", "hash", "size", "sizePx", "fetchLocalizedString", "text", "response", "error", "getLocalizedString", "string", "wait", "_a", "_b", "has", "promise", "fetchLocalizedString", "text", "localize", "stringParts", "args", "invariant", "stringToLocalize", "s", "localized", "getLocalizedString", "arg", "index", "logActivity", "activity", "parameters", "timeElapsed", "_a", "response", "data", "error", "startActivity", "start", "getKey", "article", "articleKey", "getSettings", "setting", "key", "settings", "saveSettings", "value", "userSettings", "template", "$template", "waitForDialog", "dialog", "resolve", "alertDialogPromiseMap", "openAlertDialog", "buttons", "content", "className", "id", "title", "_a", "_b", "$dialog", "$content", "$menu", "$header", "label", "value", "primary", "listItem", "buttonElem", "dialogPromise", "
|
|
4
|
+
"sourcesContent": ["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<\n\tWildcardHandler<T>\n>;\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>(\n\t\ttype: Key,\n\t\thandler?: Handler<Events[Key]>\n\t): 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>(\n\t\ttype: undefined extends Events[Key] ? Key : never\n\t): 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\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} else {\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 (`'*'` to remove a wildcard handler)\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} else {\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\tprivate eventHandler: Emitter<{ onAuthenticated: void; onExpired: void }> = mitt();\n\n\tauthenticated() {\n\t\tthis.eventHandler.emit(\"onAuthenticated\");\n\t}\n\n\tasync expired(callback?: () => void, type?: \"RequireTwoFactor\"): Promise<void> {\n\t\ttry {\n\t\t\tlet authPromise = new Promise<void>((resolve) => {\n\t\t\t\tlet eventHandler = () => {\n\t\t\t\t\tthis.eventHandler.off(\"onAuthenticated\", eventHandler);\n\t\t\t\t\tcallback?.();\n\t\t\t\t\tresolve();\n\t\t\t\t};\n\n\t\t\t\tthis.eventHandler.on(\"onAuthenticated\", eventHandler);\n\t\t\t});\n\n\t\t\tlet dialog: HTMLDialogElement | null = document.querySelector(\"dialog.session-expired-dialog\");\n\t\t\tif (!dialog) {\n\t\t\t\tdialog = document.createElement(\"dialog\");\n\t\t\t\tdialog.className = \"session-expired-dialog\";\n\t\t\t\tdialog.style.display = \"flex\";\n\t\t\t\tdialog.style.padding = \"0\";\n\t\t\t\tdialog.style.left = \"50%\";\n\t\t\t\tdialog.style.transform = \"translateX(-50%)\";\n\n\t\t\t\tlet link = \"/login?ReturnUrl=%2fapi/sessionexpired/remove\";\n\t\t\t\tif (type !== \"RequireTwoFactor\") {\n\t\t\t\t\tawait fetch(\"/logout\", { method: \"POST\" });\n\t\t\t\t} else {\n\t\t\t\t\tlink = \"/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove\";\n\t\t\t\t}\n\n\t\t\t\tdialog.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\t\t\t\tdocument.body.append(dialog);\n\t\t\t\tdialog.showModal();\n\t\t\t\tawait authPromise;\n\t\t\t\tdialog.remove();\n\t\t\t} else {\n\t\t\t\tawait authPromise;\n\t\t\t}\n\t\t} catch (_) {\n\t\t\twindow.location.href = `/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(\n\t\t\t\twindow.location.search,\n\t\t\t)}`;\n\t\t}\n\t}\n\n\tattachEvent(eventName: SessionHandlerEvent, handler: Handler) {\n\t\treturn this.eventHandler.on(eventName, handler);\n\t}\n\n\tdetachEvent(eventName: SessionHandlerEvent, handler: Handler) {\n\t\treturn this.eventHandler.off(eventName, handler);\n\t}\n}\n", "import SessionHandler from \"./SessionHandler.js\";\n\nexport class UserSession extends SessionHandler {\n\tamDesignator: string = \"a.m.\";\n\tdayNames: string[] = [\"sunday\", \"monday\", \"tuesday\", \"wednesday\", \"thursday\", \"friday\", \"saturday\"];\n\tdayNamesShort: string[] = [\"sun\", \"mon\", \"tue\", \"wed\", \"thu\", \"fri\", \"sat\"];\n\tdecimalSeparator: string = \".\";\n\tdomain: string = \"OB\";\n\temail: string | null | undefined;\n\tformats: undefined | Record<string, string>;\n\tgroupSeparator: string | null = null;\n\tintegratedSecurity: boolean = false;\n\tisDeveloper: boolean = false;\n\tlogin: string = \"\";\n\tloginType: string | undefined;\n\tmonthNames: string[] = [\n\t\t\"january\",\n\t\t\"february\",\n\t\t\"march\",\n\t\t\"april\",\n\t\t\"may\",\n\t\t\"june\",\n\t\t\"july\",\n\t\t\"august\",\n\t\t\"september\",\n\t\t\"october\",\n\t\t\"november\",\n\t\t\"december\",\n\t\t\"\",\n\t];\n\tmonthNamesShort: string[] = [\"jan\", \"feb\", \"mar\", \"apr\", \"may\", \"jun\", \"jul\", \"augt\", \"sep\", \"oct\", \"nov\", \"dec\", \"\"];\n\tname: string | undefined;\n\tpmDesignator: string = \"p.m.\";\n\tshortDateFormat: string = \"dd.MM.yyyy\";\n\tculture: string = \"en-GB\";\n\tuiculture: string = \"en-GB\";\n\n\tconstructor(userData: any) {\n\t\tsuper();\n\t\tthis.formats = {};\n\t\tObject.assign(this, userData);\n\t}\n}\n", "if (process.env.NODE_ENV === \"production\") {\n\tglobalThis.window?.addEventListener(\"error\", (event) => {\n\t\ttry {\n\t\t\t// Try to avoid error-logging-loop\n\t\t\tconst data = {\n\t\t\t\terror: event.error?.message ?? event.message ?? null,\n\t\t\t\tfile: event.filename,\n\t\t\t\tline: event.lineno ?? 0,\n\t\t\t\tcolumn: event.colno ?? 0,\n\t\t\t\tstack: event.error?.stack ?? null,\n\t\t\t};\n\n\t\t\tfetch(\"/data/Logger/LogError\", {\n\t\t\t\tbody: JSON.stringify(data),\n\t\t\t\theaders: {\n\t\t\t\t\tAccept: \"application/json\",\n\t\t\t\t\t\"Content-Type\": \"application/json; charset=utf-8\",\n\t\t\t\t\t\"X-Requested-With\": \"XMLHttpRequest\",\n\t\t\t\t},\n\t\t\t\tmethod: \"POST\",\n\t\t\t});\n\t\t} catch (ex) {\n\t\t\t// ignore\n\t\t}\n\t});\n}\n", "function getLocalKey(key: string): string {\n\treturn [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n\tisPersisted = () => true;\n\n\tgetLocalStorageKey(key: string, global?: boolean) {\n\t\treturn global ? [\"common\", key].join(\".\") : getLocalKey(key);\n\t}\n\n\tget(key: string, defaultValue: unknown, global?: boolean) {\n\t\tconst lsKey = this.getLocalStorageKey(key, global);\n\t\tconst value = localStorage.getItem(lsKey);\n\n\t\treturn value !== null ? JSON.parse(value) : defaultValue;\n\t}\n\n\tset(key: string, value: unknown, global?: boolean) {\n\t\tlocalStorage.setItem(this.getLocalStorageKey(key, global), JSON.stringify(value));\n\t}\n\n\tremove(key: string, global?: boolean) {\n\t\tconst lsKey = this.getLocalStorageKey(key, global);\n\t\tif (localStorage.getItem(lsKey) !== null) {\n\t\t\tlocalStorage.removeItem(lsKey);\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tclear() {\n\t\tconst baseKey = getLocalKey(\"\");\n\n\t\tfor (let key in localStorage) {\n\t\t\tif (key.slice(0, baseKey.length) === baseKey) {\n\t\t\t\tlocalStorage.removeItem(key);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport default new LocalStorage();\n", "export function toLocalISODate(date: Date): string;\nexport function toLocalISODate(date: Date | null): string | null;\nexport function toLocalISODate(date: Date | null): string | null {\n\treturn date ? toLocalISODateTime(date).substring(0, 10) : null;\n}\n\nfunction pad(num: number) {\n\treturn String(num).padStart(2, \"0\");\n}\n\nexport function toLocalISODateTime(date: Date): string;\nexport function toLocalISODateTime(date: Date | null): string | null;\nexport function toLocalISODateTime(date: Date | null): string | null {\n\treturn date\n\t\t? `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(\n\t\t\t\tdate.getMinutes(),\n\t\t )}:${pad(date.getSeconds())}.${pad(date.getMilliseconds())}`\n\t\t: null;\n}\n", "export function downloadBlob(blob: Blob | MediaSource, fileName: string) {\n\treturn new Promise<void>(function (resolve, reject) {\n\t\ttry {\n\t\t\tconst url = URL.createObjectURL(blob);\n\t\t\tconst parent = document.body;\n\t\t\tconst anchor = document.createElement(\"a\");\n\t\t\tanchor.setAttribute(\"download\", fileName);\n\t\t\tanchor.href = url;\n\t\t\tparent.append(anchor);\n\t\t\tanchor.click();\n\t\t\tparent.removeChild(anchor);\n\n\t\t\tsetTimeout(function () {\n\t\t\t\tURL.revokeObjectURL(url);\n\t\t\t\tresolve();\n\t\t\t}, 250);\n\t\t} catch (ex) {\n\t\t\treject(ex);\n\t\t}\n\t});\n}\n", "export function invariant(condition: any, message?: string | (() => string)): asserts condition {\n\tif (condition) {\n\t\treturn;\n\t}\n\tconst provided: string | undefined = typeof message === \"function\" ? message() : message;\n\n\tthrow new Error(provided ?? \"Invariant failed\");\n}\n", "import { downloadBlob } from \"./downloadBlob.js\";\nimport { invariant } from \"./invariant.js\";\n\nexport type DownloadItem = {\n\tstatus: \"cancelled\" | \"error\" | \"requested\" | \"downloading\" | \"downloaded\" | \"completed\";\n\tbytesReceived?: number;\n\terror?: string;\n};\n\nexport type DownloadParameters = {\n\tsignal?: AbortSignal;\n\tfileName: string;\n\tonProgress?: (progress: DownloadItem) => void;\n};\n\nexport async function downloadRequest(request: Request, { fileName, signal, onProgress }: DownloadParameters) {\n\tfunction reportProgress(progress: DownloadItem) {\n\t\tif (typeof onProgress === \"function\") {\n\t\t\tonProgress({ ...progress });\n\t\t}\n\t}\n\n\tlet bytesReceived = 0;\n\n\treportProgress({ status: \"requested\" });\n\n\ttry {\n\t\tlet response = await fetch(request);\n\n\t\tif (!response.ok || !response.body) {\n\t\t\tif (response.headers.get(\"content-type\")?.includes(\"application/json\")) {\n\t\t\t\tlet data = await response.json();\n\t\t\t\tinvariant(!data.error, data.error);\n\t\t\t}\n\t\t\tthrow new Error(`${response.status} ${response.statusText}`);\n\t\t}\n\n\t\ttry {\n\t\t\tconst reader = response.body.getReader();\n\t\t\tconst stream = new ReadableStream({\n\t\t\t\tstart: function (controller) {\n\t\t\t\t\tfunction pump(): Promise<void> {\n\t\t\t\t\t\treturn reader.read().then(function (read) {\n\t\t\t\t\t\t\tif (read.done) {\n\t\t\t\t\t\t\t\tcontroller.close();\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbytesReceived += read.value.length;\n\t\t\t\t\t\t\treportProgress({ bytesReceived, status: \"downloading\" });\n\t\t\t\t\t\t\tcontroller.enqueue(read.value);\n\n\t\t\t\t\t\t\treturn pump();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\treturn pump();\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tresponse = new Response(stream);\n\t\t} catch (error) {}\n\n\t\tconst blob = await response.blob();\n\n\t\treportProgress({ bytesReceived, status: \"downloaded\" });\n\n\t\tawait downloadBlob(blob, fileName);\n\n\t\treportProgress({ bytesReceived, status: \"completed\" });\n\t} catch (err) {\n\t\tif (signal?.aborted) {\n\t\t\treportProgress({ status: \"cancelled\" });\n\t\t} else {\n\t\t\treportProgress({ error: (err as Error).message, status: \"error\" });\n\t\t}\n\t}\n}\n", "export function has(obj: any, key: string | number | symbol): boolean {\n\treturn Object.prototype.hasOwnProperty.call(obj, key);\n}\n", "import { invariant } from \"./invariant.js\";\n\nconst funcRegex =\n\t/^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\tvar match = func.toString().match(funcRegex);\n\tinvariant(match, \"Unable to parse function!\");\n\treturn { 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(root: any, namespace: string | Array<string>): any {\n\tif (typeof root === \"object\") {\n\t\tif (typeof namespace === \"string\") {\n\t\t\tlet path = namespace.split(\".\");\n\n\t\t\treturn requireNamespace(root, path);\n\t\t} else if (Array.isArray(namespace)) {\n\t\t\tlet current: any = root;\n\t\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\t\tcurrent = current[namespace[i]] = current[namespace[i]] || new (Namespace as any)();\n\t\t\t}\n\n\t\t\treturn current;\n\t\t}\n\t}\n}\n", "import { has } from \"./has.js\";\nimport { invariant } from \"./invariant.js\";\nimport { parseFunc } from \"./parseFunc.js\";\nimport { requireNamespace } from \"./requireNamespace.js\";\n\nexport type ExposeOptions = {\n\t/**\n\t * Whether we should overwrite any existing values without warning.\n\t */\n\toverwrite?: boolean;\n};\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(\n\tname: object | string,\n\tvalue: object | Function | Function[],\n\toptions: ExposeOptions = {},\n): void {\n\tif (Array.isArray(value)) {\n\t\tfor (let func of value) {\n\t\t\tconst { name: funcName } = parseFunc(func);\n\n\t\t\tinvariant(\n\t\t\t\tfuncName,\n\t\t\t\t\"Unable to detect name of function! Name it, or only supply one function and include name in first parameter.\",\n\t\t\t);\n\t\t\texpose(name, func); // Expose func on namespace found in pName\n\t\t}\n\t} else {\n\t\tlet keyName: string | undefined;\n\t\tlet namespace;\n\n\t\tif (typeof value === \"function\") {\n\t\t\tkeyName = parseFunc(value).name;\n\t\t}\n\n\t\tif (typeof name === \"string\") {\n\t\t\tlet pathParts = name.split(\".\");\n\n\t\t\tif (!keyName) {\n\t\t\t\tkeyName = pathParts[pathParts.length - 1];\n\t\t\t\tpathParts = pathParts.slice(0, pathParts.length - 1);\n\t\t\t}\n\n\t\t\tnamespace = requireNamespace(window, pathParts);\n\t\t} else if (keyName && (typeof name === \"object\" || typeof name === \"function\")) {\n\t\t\tnamespace = name;\n\t\t} else {\n\t\t\tinvariant(false, \"Invalid typeof parameter 'name', or unable to parse pValue!\");\n\t\t}\n\n\t\tif (has(namespace, keyName) && options?.overwrite !== true) {\n\t\t\t// If class is already defined, warn or show an alert\n\t\t\tconsole.warn([name, keyName].join(\".\") + \" is already defined!\");\n\t\t} else {\n\t\t\tnamespace[keyName] = value;\n\t\t}\n\t}\n}\n", "export type ImageSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport interface getUserImageOptions {\n\t/**\n\t * Prim key of the record in atbl_Personnel_Employees\n\t */\n\tprimKey: string | null;\n\t/**\n\t * Person ID of the employee\n\t */\n\tlogin: string | null;\n\t/**\n\t * The value of the ImageHash column in atbl_Personnel_Employees\n\t */\n\thash: string | number | null;\n\t/**\n\t * The image will be resized according to this value. Default is 'xs':\n\t * - xs: 64px\n\t * - sm: 128px\n\t * - md: 256px\n\t * - lg: 512px\n\t * - xl: image is not resized\n\t */\n\tsize?: ImageSize;\n}\n\nconst sizeMap: Record<ImageSize, number | undefined> = {\n\txs: 64,\n\tsm: 128,\n\tmd: 256,\n\tlg: 512,\n\txl: 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(\n\tprimKey: string | null,\n\tlogin: string | null,\n\thash: string | number | null,\n\tsize?: ImageSize,\n): string;\nexport function getUserImage(options: getUserImageOptions): string;\nexport function getUserImage(\n\tprimKeyOrOptions: string | null | getUserImageOptions,\n\tlogin?: string | null,\n\thash?: string | number | null,\n\tsize: ImageSize = \"xs\",\n) {\n\tif (primKeyOrOptions && typeof primKeyOrOptions === \"object\") {\n\t\treturn getUserImage(primKeyOrOptions.primKey, primKeyOrOptions.login, primKeyOrOptions.hash, primKeyOrOptions.size);\n\t}\n\n\tif (!primKeyOrOptions || !hash) {\n\t\treturn \"\";\n\t}\n\n\tlet sizePx = sizeMap[size];\n\treturn `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${encodeURIComponent(login ?? \"\")}${\n\t\tlogin ? \".\" : \"\"\n\t}${encodeURIComponent(hash)}.jpg${sizePx ? `?width=${sizePx}` : \"\"}`;\n}\n", "import { has } from \"./has.js\";\n\nasync function fetchLocalizedString(text: string) {\n\ttry {\n\t\tlet response = await fetch(`/api/user/localize/new/${af.article.id}`, {\n\t\t\tbody: JSON.stringify({ text }),\n\t\t\theaders: {\n\t\t\t\tAccept: \"application/json; */*\",\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\t\"X-Requested-With\": \"XMLHttpRequest\",\n\t\t\t},\n\t\t\tmethod: \"POST\",\n\t\t});\n\n\t\tif (response.ok) {\n\t\t\treturn (await response.json()) as string;\n\t\t}\n\t} catch (error) {}\n\n\treturn 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\tif (!string) return string;\n\n\treturn 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\tstring: string | undefined | null,\n\twait?: boolean,\n): string | undefined | null | Promise<string> {\n\tif (typeof string === \"string\" && string.trim().length === 0) {\n\t\treturn string;\n\t}\n\n\tif (string === undefined || string === \"\" || string === null) {\n\t\treturn;\n\t}\n\n\tif (globalThis.af?.article?.i18n !== undefined) {\n\t\tif (!has(af.article.i18n, string)) {\n\t\t\taf.article.i18n[string] = string;\n\n\t\t\tlet promise = fetchLocalizedString(string).then((text) => {\n\t\t\t\taf.article.i18n[string] = text;\n\t\t\t\treturn text;\n\t\t\t});\n\n\t\t\tif (wait) {\n\t\t\t\treturn promise;\n\t\t\t}\n\t\t}\n\n\t\treturn af.article.i18n[string];\n\t} else {\n\t\treturn string;\n\t}\n}\n", "import { getLocalizedString } from \"./getLocalizedString.js\";\nimport { invariant } from \"./invariant.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\tinvariant(\n\t\tArray.isArray(stringParts) && stringParts.length === args.length + 1,\n\t\t\"Method 'localize' must be used as a tag function\",\n\t);\n\n\tlet stringToLocalize = stringParts.map((s, i) => (i === stringParts.length - 1 ? s : `${s}\\$${i}`)).join(\"\");\n\tlet localized = getLocalizedString(stringToLocalize);\n\n\targs.forEach((arg, index) => {\n\t\tlocalized = localized.replace(\"$\" + index, arg);\n\t});\n\n\treturn localized;\n}\n", "/**\n * Logs an activity to the website activity log\n *\n * @param activity name of the activity we are logging\n * @param parameters A dictionary of parameters used when doing the activity\n * @param timeElapsed Number of milliseconds elapsed while executing\n */\nexport async function logActivity(activity: string, parameters: Record<string, any>, timeElapsed: number = 0) {\n\ttry {\n\t\tlet response = await fetch(\"/api/logging/log-activity\", {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({\n\t\t\t\tarticle: af.article.id,\n\t\t\t\ttimeElapsed,\n\t\t\t\taction: activity,\n\t\t\t\tparameters,\n\t\t\t}),\n\t\t\theaders: { \"Content-Type\": \"application/json\", Accept: \"application/json\" },\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tif (response.headers.get(\"Content-Type\")?.includes(\"application/json\")) {\n\t\t\t\tlet data = await response.json();\n\t\t\t\tconsole.error(data.error);\n\t\t\t} else {\n\t\t\t\tconsole.error(`${response.status} ${response.statusText}`);\n\t\t\t}\n\t\t}\n\t} catch (error) {}\n}\n\n/**\n * Records the current time, and returns a function that logs the activity with the\n * time elapsed when it is called.\n *\n * @param activity Name of the activity we are logging\n * @param parameters A dictionary of parameters used when doing the activity\n * @returns A function that should be called when the activity is completed to log it to the website log\n */\nexport function startActivity(activity: string, startParameters: Record<string, any> = {}) {\n\tlet start = performance.now();\n\treturn (endParameters: Record<string, any> = {}) =>\n\t\tlogActivity(activity, { ...startParameters, ...endParameters }, performance.now() - start);\n}\n\n/**\n * Records the time used to execute an operation and returns the value of the operation and the time\n * in milliseconds\n */\nexport async function time<T>(callback: () => T | Promise<T>): Promise<[T, number]> {\n\tlet start = performance.now();\n\tlet returnValue = await callback();\n\n\treturn [returnValue, performance.now() - start];\n}\n", "function getKey(article?: string) {\n\tconst articleKey = article || af.article.id;\n\treturn `${articleKey}.${af.userSession.login}`;\n}\n\nexport function getSettings<T>(setting: string, article?: string): T | null {\n\tif (!af?.userSession) return null;\n\n\tconst key = getKey(article);\n\tconst settings = JSON.parse(localStorage.getItem(key) || \"{}\");\n\n\tif (setting) {\n\t\treturn settings[setting] || null;\n\t}\n\n\treturn settings;\n}\n\nexport function saveSettings<T>(setting: string, value: T | null, article?: string): void {\n\tif (!af?.userSession) return;\n\n\tconst key = getKey(article);\n\tlet userSettings = JSON.parse(localStorage.getItem(key) || \"{}\");\n\n\tif (typeof value !== \"undefined\") {\n\t\tuserSettings[setting] = value;\n\t} else {\n\t\tuserSettings = setting;\n\t}\n\n\tlocalStorage.setItem(key, JSON.stringify(userSettings));\n}\n", "import { getLocalizedString } from \"./getLocalizedString.js\";\n\nconst template = `\n\t<dialog class=\"alert-dialog\">\n\t\t\t<form method=\"dialog\">\n\t\t\t\t\t<article></article>\n\t\t\t\t\t<footer>\n\t\t\t\t\t\t\t<menu></menu>\n\t\t\t\t\t</footer>\n\t\t\t</form>\n\t</dialog>\n`;\n\nif (globalThis.document && !document.querySelector(\"#AlertDialogTemplate\")) {\n\tlet $template = document.createElement(\"template\");\n\t$template.id = \"AlertDialogTemplate\";\n\t$template.innerHTML = template;\n\tdocument.body.append($template);\n}\n\nexport function waitForDialog(dialog: HTMLDialogElement, cancelValue: string = \"No\"): Promise<string> {\n\treturn new Promise((resolve) => {\n\t\tlet controller = new AbortController();\n\n\t\tdialog.addEventListener(\n\t\t\t\"close\",\n\t\t\t() => {\n\t\t\t\tresolve(dialog.returnValue);\n\t\t\t\tcontroller.abort();\n\t\t\t},\n\t\t\t{ signal: controller.signal },\n\t\t);\n\n\t\tdialog.addEventListener(\n\t\t\t\"cancel\",\n\t\t\t() => {\n\t\t\t\tresolve(cancelValue);\n\t\t\t\tcontroller.abort();\n\t\t\t},\n\t\t\t{ signal: controller.signal },\n\t\t);\n\t});\n}\nexport type AlertDialogButton = {\n\tlabel: string;\n\tvalue: string;\n\tprimary?: boolean;\n};\n\nexport type AlertDialogOptions = {\n\tbuttons: AlertDialogButton[];\n\tcontent: string | HTMLElement;\n\tclassName?: string;\n\tid?: string;\n\ttitle?: string;\n};\n\nconst alertDialogPromiseMap = new Map<string, Promise<string>>();\n\nexport async function openAlertDialog({ buttons, content, className, id, title }: AlertDialogOptions) {\n\tif (id && alertDialogPromiseMap.has(id)) {\n\t\treturn await alertDialogPromiseMap.get(id);\n\t}\n\n\tlet $template = document.querySelector<HTMLTemplateElement>(\"#AlertDialogTemplate\");\n\tif (!$template) throw Error(\"No alert dialog template found\");\n\n\tlet $dialog = $template.content.firstElementChild?.cloneNode(true) as HTMLDialogElement | null;\n\tlet $content = $dialog?.querySelector(\"article\");\n\tlet $menu = $dialog?.querySelector(\"footer menu\");\n\n\tif (!$dialog || !$content || !$menu) throw Error(\"Invalid alert dialog template\");\n\n\tif (className) {\n\t\tclassName.split(/\\s+/).forEach((className) => $dialog?.classList.add(className));\n\t}\n\n\tif (title) {\n\t\tlet $header = document.createElement(\"header\");\n\t\t$header.append(title);\n\t\t$content.parentNode?.insertBefore($header, $content);\n\t}\n\n\t$content.appendChild(typeof content === \"string\" ? document.createTextNode(content) : content);\n\tfor (let { label, value, primary } of buttons) {\n\t\tlet listItem = document.createElement(\"li\");\n\t\tlet buttonElem = document.createElement(\"button\");\n\t\tbuttonElem.value = value;\n\t\tif (primary) {\n\t\t\tbuttonElem.classList.add(\"primary\");\n\t\t}\n\t\tbuttonElem.textContent = label;\n\t\tlistItem.appendChild(buttonElem);\n\t\t$menu.appendChild(buttonElem);\n\t}\n\n\tdocument.body.appendChild($dialog);\n\t$dialog.showModal();\n\n\tlet dialogPromise = waitForDialog($dialog).then((returnValue) => {\n\t\tif (id && alertDialogPromiseMap.has(id)) {\n\t\t\talertDialogPromiseMap.delete(id);\n\t\t}\n\t\tif ($dialog) document.body.removeChild($dialog);\n\t\treturn returnValue;\n\t});\n\n\tif (id) {\n\t\talertDialogPromiseMap.set(id, dialogPromise);\n\t}\n\n\treturn await dialogPromise;\n}\n\nexport enum ConfirmButtons {\n\tYesNo,\n\tOkCancel,\n}\n\nexport type ConfirmOptions = {\n\tbuttons?: ConfirmButtons;\n\ttitle?: string;\n};\n\nexport async function confirm(prompt: string, options: ConfirmOptions = {}): Promise<boolean> {\n\tlet { buttons: optionButtons = ConfirmButtons.YesNo, title } = options;\n\tlet buttons: AlertDialogButton[] =\n\t\toptionButtons === ConfirmButtons.OkCancel\n\t\t\t? [\n\t\t\t\t\t{ label: getLocalizedString(\"OK\"), value: \"yes\", primary: true },\n\t\t\t\t\t{ label: getLocalizedString(\"Cancel\"), value: \"no\" },\n\t\t\t ]\n\t\t\t: [\n\t\t\t\t\t{ label: getLocalizedString(\"Yes\"), value: \"yes\", primary: true },\n\t\t\t\t\t{ label: getLocalizedString(\"No\"), value: \"no\" },\n\t\t\t ];\n\n\tlet result = await openAlertDialog({ content: prompt, buttons, className: \"alert-dialog-confirm\", title });\n\treturn result === \"yes\";\n}\n\nexport type AlertOptions = {\n\ttitle?: string;\n};\n\nexport async function alert(prompt: string, options: AlertOptions = {}): Promise<void> {\n\tawait openAlertDialog({\n\t\tcontent: prompt,\n\t\tclassName: \"alert-dialog-alert\",\n\t\tbuttons: [{ label: getLocalizedString(\"OK\"), value: \"ok\", primary: true }],\n\t\t...options,\n\t});\n}\n", "import { UserSession } from \"./UserSession.js\";\nimport { alert, confirm, openAlertDialog } from \"./alert.js\";\nimport \"./errorHandler.js\";\nimport { expose } from \"./expose.js\";\nimport { getLocalizedString } from \"./getLocalizedString.js\";\nimport afLocalStorage from \"./localStorage.js\";\nimport { localize } from \"./localize.js\";\nimport { logActivity, startActivity, time } from \"./logActivity.js\";\n\nexport { default as mitt } from \"mitt\";\nexport { toLocalISODate, toLocalISODateTime } from \"./date.js\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport { downloadRequest } from \"./downloadRequest.js\";\nexport type { DownloadParameters, DownloadItem } from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport { getUserImage } from \"./getUserImage.js\";\nexport type { getUserImageOptions } from \"./getUserImage.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport { has } from \"./has.js\";\nexport { invariant } from \"./invariant.js\";\nexport { localize } from \"./localize.js\";\nexport { afLocalStorage as localStorage };\nexport { logActivity, startActivity, time } from \"./logActivity.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport { getSettings, saveSettings } from \"./settings.js\";\nexport { alert, confirm, ConfirmButtons, openAlertDialog, waitForDialog } from \"./alert.js\";\nexport type { AlertDialogButton, AlertDialogOptions, AlertOptions, ConfirmOptions } from \"./alert.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n\tvar __VERSION__: string;\n\tvar __DEV__: number;\n\tvar af: AfCore;\n\n\tinterface Window {\n\t\taf: AfCore;\n\t}\n}\n\nexport interface AfArticle {\n\thostName: string;\n\ti18n: Record<string, string>;\n\tid: string;\n}\n\nexport interface AfCore {\n\tarticle: AfArticle;\n\tcommon: {\n\t\tgetLocalizedString: typeof getLocalizedString;\n\t\texpose: typeof expose;\n\t\tlocalize: typeof localize;\n\t\tlocalStorage: typeof afLocalStorage;\n\t\tlogActivity: typeof logActivity;\n\t\tstartActivity: typeof startActivity;\n\t\talert: typeof alert;\n\t\tconfirm: typeof confirm;\n\t\topenAlertDialog: typeof openAlertDialog;\n\t\ttime: typeof time;\n\t};\n\tcontrols?: {\n\t\talert?: (message: string, callback?: () => void) => void;\n\t\tconfirm?: (options: {\n\t\t\ttitle: string;\n\t\t\tmessage: string;\n\t\t\tbuttons: string[];\n\t\t\tcallback: (button: number) => void;\n\t\t}) => void;\n\t};\n\tuserSession: UserSession;\n}\n"],
|
|
5
|
+
"mappings": "wZA8CCA,EAAAA,CAOA,MAAO,CAINA,IANDA,EAAMA,GAAO,IAAIC,IAchBC,GAAAA,SAA6BC,EAAWC,EAAAA,CACvC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,EACHA,EAASE,KAAKH,CAAAA,EAEdJ,EAAKQ,IAAIL,EAAM,CAACC,CAAAA,CAAAA,CAAAA,EAWlBK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,MAAO,MAAO,QAAS,EAAK,EAC/D,CAAE,MAAOA,EAAmB,QAAQ,EAAG,MAAO,IAAK,CACnD,EACA,CACA,CAAE,MAAOA,EAAmB,KAAK,EAAG,MAAO,MAAO,QAAS,EAAK,EAChE,CAAE,MAAOA,EAAmB,IAAI,EAAG,MAAO,IAAK,CAC/C,EAGJ,OADa,MAAMxB,EAAgB,CAAE,QAASqB,EAAQ,QAAApB,EAAS,UAAW,uBAAwB,MAAAI,CAAM,CAAC,IACvF,KACnB,CAMA,eAAsBoB,GAAMJ,EAAgBC,EAAwB,CAAC,EAAkB,CACtF,MAAMtB,EAAgB0B,EAAA,CACrB,QAASL,EACT,UAAW,qBACX,QAAS,CAAC,CAAE,MAAOG,EAAmB,IAAI,EAAG,MAAO,KAAM,QAAS,EAAK,CAAC,GACtEF,EACH,CACF,CC3HO,IAAMK,GAAU",
|
|
6
|
+
"names": ["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", "_a", "event", "_b", "_c", "_d", "_e", "_f", "_g", "data", "ex", "getLocalKey", "key", "_a", "LocalStorage", "__publicField", "global", "defaultValue", "lsKey", "value", "baseKey", "localStorage_default", "toLocalISODate", "date", "toLocalISODateTime", "pad", "num", "downloadBlob", "blob", "fileName", "resolve", "reject", "url", "parent", "anchor", "ex", "invariant", "condition", "message", "provided", "downloadRequest", "request", "fileName", "signal", "onProgress", "_a", "reportProgress", "progress", "__spreadValues", "bytesReceived", "response", "data", "invariant", "reader", "stream", "controller", "pump", "read", "error", "blob", "downloadBlob", "err", "has", "obj", "key", "funcRegex", "parseFunc", "func", "match", "invariant", "Namespace", "Namespace_default", "requireNamespace", "root", "namespace", "path", "current", "i", "Namespace_default", "expose", "name", "value", "options", "func", "funcName", "parseFunc", "invariant", "keyName", "namespace", "pathParts", "requireNamespace", "has", "sizeMap", "getUserImage", "primKeyOrOptions", "login", "hash", "size", "sizePx", "fetchLocalizedString", "text", "response", "error", "getLocalizedString", "string", "wait", "_a", "_b", "has", "promise", "fetchLocalizedString", "text", "localize", "stringParts", "args", "invariant", "stringToLocalize", "s", "localized", "getLocalizedString", "arg", "index", "logActivity", "activity", "parameters", "timeElapsed", "_a", "response", "data", "error", "startActivity", "startParameters", "start", "endParameters", "__spreadValues", "time", "callback", "getKey", "article", "articleKey", "getSettings", "setting", "key", "settings", "saveSettings", "value", "userSettings", "template", "$template", "waitForDialog", "dialog", "cancelValue", "resolve", "controller", "alertDialogPromiseMap", "openAlertDialog", "buttons", "content", "className", "id", "title", "_a", "_b", "$dialog", "$content", "$menu", "$header", "label", "value", "primary", "listItem", "buttonElem", "dialogPromise", "returnValue", "ConfirmButtons", "confirm", "prompt", "options", "optionButtons", "getLocalizedString", "alert", "__spreadValues", "version"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function
|
|
1
|
+
function w(e){return{all:e=e||new Map,on:function(t,n){var o=e.get(t);o?o.push(n):e.set(t,[n])},off:function(t,n){var o=e.get(t);o&&(n?o.splice(o.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var o=e.get(t);o&&o.slice().map(function(r){r(n)}),(o=e.get("*"))&&o.slice().map(function(r){r(t,n)})}}}var g=class{eventHandler=w();authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,n){try{let o=new Promise(a=>{let i=()=>{this.eventHandler.off("onAuthenticated",i),t?.(),a()};this.eventHandler.on("onAuthenticated",i)}),r=document.querySelector("dialog.session-expired-dialog");if(r)await o;else{r=document.createElement("dialog"),r.className="session-expired-dialog",r.style.display="flex",r.style.padding="0",r.style.left="50%",r.style.transform="translateX(-50%)";let a="/login?ReturnUrl=%2fapi/sessionexpired/remove";n!=="RequireTwoFactor"?await fetch("/logout",{method:"POST"}):a="/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove",r.innerHTML=`<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="${a}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(r),r.showModal(),await o,r.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 S=class extends g{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)}};window.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 T(e){return[af?.article?.id||"","common",e].join(".")}var v=class{isPersisted=()=>!0;getLocalStorageKey(t,n){return n?["common",t].join("."):T(t)}get(t,n,o){let r=this.getLocalStorageKey(t,o),a=localStorage.getItem(r);return a!==null?JSON.parse(a):n}set(t,n,o){localStorage.setItem(this.getLocalStorageKey(t,o),JSON.stringify(n))}remove(t,n){let o=this.getLocalStorageKey(t,n);return localStorage.getItem(o)!==null?(localStorage.removeItem(o),!0):!1}clear(){let t=T("");for(let n in localStorage)n.slice(0,t.length)===t&&localStorage.removeItem(n)}},U=new v;function M(e){return e?z(e).substring(0,10):null}function p(e){return String(e).padStart(2,"0")}function z(e){return e?`${e.getFullYear()}-${p(e.getMonth()+1)}-${p(e.getDate())}T${p(e.getHours())}:${p(e.getMinutes())}:${p(e.getSeconds())}.${p(e.getMilliseconds())}`:null}function A(e,t){return new Promise(function(n,o){try{let r=URL.createObjectURL(e),a=document.body,i=document.createElement("a");i.setAttribute("download",t),i.href=r,a.append(i),i.click(),a.removeChild(i),setTimeout(function(){URL.revokeObjectURL(r),n()},250)}catch(r){o(r)}})}function s(e,t){if(e)return;let n=typeof t=="function"?t():t;throw new Error(n??"Invariant failed")}async function q(e,{fileName:t,signal:n,onProgress:o}){function r(i){typeof o=="function"&&o({...i})}let a=0;r({status:"requested"});try{let i=await fetch(e);if(!i.ok||!i.body){if(i.headers.get("content-type")?.includes("application/json")){let u=await i.json();s(!u.error,u.error)}throw new Error(`${i.status} ${i.statusText}`)}try{let u=i.body.getReader(),x=new ReadableStream({start:function(l){function b(){return u.read().then(function(f){if(f.done){l.close();return}return a+=f.value.length,r({bytesReceived:a,status:"downloading"}),l.enqueue(f.value),b()})}return b()}});i=new Response(x)}catch{}let d=await i.blob();r({bytesReceived:a,status:"downloaded"}),await A(d,t),r({bytesReceived:a,status:"completed"})}catch(i){n?.aborted?r({status:"cancelled"}):r({error:i.message,status:"error"})}}function y(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var _=/^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;function L(e){var t=e.toString().match(_);return s(t,"Unable to parse function!"),{name:t[1],args:t[2].split(","),body:t[3]}}function E(){}E.prototype=Object.create(null);var $=E;function D(e,t){if(typeof e=="object"){if(typeof t=="string"){let n=t.split(".");return D(e,n)}else if(Array.isArray(t)){let n=e;for(let o=0;o<t.length;o++)n=n[t[o]]=n[t[o]]||new $;return n}}}function N(e,t,n={}){if(Array.isArray(t))for(let o of t){let{name:r}=L(o);s(r,"Unable to detect name of function! Name it, or only supply one function and include name in first parameter."),N(e,o)}else{let o,r;if(typeof t=="function"&&(o=L(t).name),typeof e=="string"){let a=e.split(".");o||(o=a[a.length-1],a=a.slice(0,a.length-1)),r=D(window,a)}else o&&(typeof e=="object"||typeof e=="function")?r=e:s(!1,"Invalid typeof parameter 'name', or unable to parse pValue!");y(r,o)&&n?.overwrite!==!0?console.warn([e,o].join(".")+" is already defined!"):r[o]=t}}var k={xs:64,sm:128,md:256,lg:512,xl:void 0};function O(e,t,n,o="xs"){if(e&&typeof e=="object")return O(e.primKey,e.login,e.hash,e.size);if(!e||!n)return"";let r=k[o];return`/api/data/blob/EmployeesLookup/${e}/Image/${encodeURIComponent(t??"")}${t?".":""}${encodeURIComponent(n)}.jpg${r?`?width=${r}`:""}`}async function B(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 c(e,t){if(typeof e=="string"&&e.trim().length===0)return e;if(!(e===void 0||e===""||e===null))if(window.af?.article?.i18n!==void 0){if(!y(af.article.i18n,e)){af.article.i18n[e]=e;let n=B(e).then(o=>(af.article.i18n[e]=o,o));if(t)return n}return af.article.i18n[e]}else return e}function F(e,...t){s(Array.isArray(e)&&e.length===t.length+1,"Method 'localize' must be used as a tag function");let n=e.map((r,a)=>a===e.length-1?r:`${r}$${a}`).join(""),o=c(n);return t.forEach((r,a)=>{o=o.replace("$"+a,r)}),o}async function R(e,t,n=0){try{let o=await fetch("/api/logging/log-activity",{method:"POST",body:JSON.stringify({article:af.article.id,timeElapsed:n,action:e,parameters:t}),headers:{"Content-Type":"application/json",Accept:"application/json"}});if(!o.ok)if(o.headers.get("Content-Type")?.includes("application/json")){let r=await o.json();console.error(r.error)}else console.error(`${o.status} ${o.statusText}`)}catch{}}function K(e,t={}){let n=performance.now();return(o={})=>R(e,{...t,...o},performance.now()-n)}async function J(e){let t=performance.now();return[await e(),performance.now()-t]}function j(e){return`${e||af.article.id}.${af.userSession.login}`}function V(e,t){if(!af?.userSession)return null;let n=j(t),o=JSON.parse(localStorage.getItem(n)||"{}");return e?o[e]||null:o}function Z(e,t,n){if(!af?.userSession)return;let o=j(n),r=JSON.parse(localStorage.getItem(o)||"{}");typeof t<"u"?r[e]=t:r=e,localStorage.setItem(o,JSON.stringify(r))}var X=`
|
|
2
2
|
<dialog class="alert-dialog">
|
|
3
3
|
<form method="dialog">
|
|
4
4
|
<article></article>
|
|
@@ -7,5 +7,5 @@ function S(e){return{all:e=e||new Map,on:function(t,n){var o=e.get(t);o?o.push(n
|
|
|
7
7
|
</footer>
|
|
8
8
|
</form>
|
|
9
9
|
</dialog>
|
|
10
|
-
`;if(window.document&&!document.querySelector("#AlertDialogTemplate")){let e=document.createElement("template");e.id="AlertDialogTemplate",e.innerHTML=
|
|
10
|
+
`;if(window.document&&!document.querySelector("#AlertDialogTemplate")){let e=document.createElement("template");e.id="AlertDialogTemplate",e.innerHTML=X,document.body.append(e)}function C(e,t="No"){return new Promise(n=>{let o=new AbortController;e.addEventListener("close",()=>{n(e.returnValue),o.abort()},{signal:o.signal}),e.addEventListener("cancel",()=>{n(t),o.abort()},{signal:o.signal})})}var h=new Map;async function I({buttons:e,content:t,className:n,id:o,title:r}){if(o&&h.has(o))return await h.get(o);let a=document.querySelector("#AlertDialogTemplate");if(!a)throw Error("No alert dialog template found");let i=a.content.firstElementChild?.cloneNode(!0),d=i?.querySelector("article"),u=i?.querySelector("footer menu");if(!i||!d||!u)throw Error("Invalid alert dialog template");if(n&&n.split(/\s+/).forEach(l=>i?.classList.add(l)),r){let l=document.createElement("header");l.append(r),d.parentNode?.insertBefore(l,d)}d.appendChild(typeof t=="string"?document.createTextNode(t):t);for(let{label:l,value:b,primary:f}of e){let H=document.createElement("li"),m=document.createElement("button");m.value=b,f&&m.classList.add("primary"),m.textContent=l,H.appendChild(m),u.appendChild(m)}document.body.appendChild(i),i.showModal();let x=C(i).then(l=>(o&&h.has(o)&&h.delete(o),i&&document.body.removeChild(i),l));return o&&h.set(o,x),await x}var P=(n=>(n[n.YesNo=0]="YesNo",n[n.OkCancel=1]="OkCancel",n))(P||{});async function Y(e,t={}){let{buttons:n=0,title:o}=t,r=n===1?[{label:c("OK"),value:"yes",primary:!0},{label:c("Cancel"),value:"no"}]:[{label:c("Yes"),value:"yes",primary:!0},{label:c("No"),value:"no"}];return await I({content:e,buttons:r,className:"alert-dialog-confirm",title:o})==="yes"}async function W(e,t={}){await I({content:e,className:"alert-dialog-alert",buttons:[{label:c("OK"),value:"ok",primary:!0}],...t})}var Pe="2.8.1";export{P as ConfirmButtons,g as SessionHandler,S as UserSession,W as alert,Y as confirm,A as downloadBlob,q as downloadRequest,N as expose,c as getLocalizedString,V as getSettings,O as getUserImage,y as has,s as invariant,U as localStorage,F as localize,R as logActivity,w as mitt,I as openAlertDialog,Z as saveSettings,K as startActivity,J as time,M as toLocalISODate,z as toLocalISODateTime,Pe as version,C as waitForDialog};
|
|
11
11
|
//# sourceMappingURL=af.common.min.js.map
|