@olenbetong/appframe-core 2.5.0 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/af.common.js +2 -3
- package/dist/esm/af.common.legacy.js +2 -3
- 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 +1 -1
- package/dist/esm/af.common.min.js.map +3 -3
- package/dist/iife/af.common.js +2 -3
- package/dist/iife/af.common.legacy.js +2 -3
- 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 +1 -1
- package/dist/iife/af.common.min.js.map +3 -3
- package/es/expose.js +0 -1
- package/es/getUserImage.js +1 -1
- package/es/index.js +1 -1
- package/package.json +2 -2
- package/src/expose.ts +0 -2
- package/src/getUserImage.ts +3 -3
package/dist/esm/af.common.js
CHANGED
|
@@ -269,7 +269,6 @@ function requireNamespace(root, namespace) {
|
|
|
269
269
|
|
|
270
270
|
// src/expose.ts
|
|
271
271
|
function expose(name, value, options = {}) {
|
|
272
|
-
invariant(arguments.length === 2, "Incorrect number of arguments passed to the expose function!");
|
|
273
272
|
if (Array.isArray(value)) {
|
|
274
273
|
for (let func of value) {
|
|
275
274
|
const { name: funcName } = parseFunc(func);
|
|
@@ -321,7 +320,7 @@ function getUserImage(primKeyOrOptions, login, hash, size = "xs") {
|
|
|
321
320
|
return "";
|
|
322
321
|
}
|
|
323
322
|
let sizePx = sizeMap[size];
|
|
324
|
-
return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${login}${login ? "." : ""}${hash}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
|
|
323
|
+
return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${encodeURIComponent(login ?? "")}${login ? "." : ""}${encodeURIComponent(hash)}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
|
|
325
324
|
}
|
|
326
325
|
|
|
327
326
|
// src/getLocalizedString.ts
|
|
@@ -449,7 +448,7 @@ function saveSettings(setting, value, article) {
|
|
|
449
448
|
}
|
|
450
449
|
|
|
451
450
|
// src/index.ts
|
|
452
|
-
var version = "2.5.
|
|
451
|
+
var version = "2.5.2";
|
|
453
452
|
export {
|
|
454
453
|
SessionHandler,
|
|
455
454
|
UserSession,
|
|
@@ -295,7 +295,6 @@ function requireNamespace(root, namespace) {
|
|
|
295
295
|
|
|
296
296
|
// src/expose.ts
|
|
297
297
|
function expose(name, value, options = {}) {
|
|
298
|
-
invariant(arguments.length === 2, "Incorrect number of arguments passed to the expose function!");
|
|
299
298
|
if (Array.isArray(value)) {
|
|
300
299
|
for (let func of value) {
|
|
301
300
|
const { name: funcName } = parseFunc(func);
|
|
@@ -347,7 +346,7 @@ function getUserImage(primKeyOrOptions, login, hash, size = "xs") {
|
|
|
347
346
|
return "";
|
|
348
347
|
}
|
|
349
348
|
let sizePx = sizeMap[size];
|
|
350
|
-
return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${login}${login ? "." : ""}${hash}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
|
|
349
|
+
return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${encodeURIComponent(login != null ? login : "")}${login ? "." : ""}${encodeURIComponent(hash)}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
|
|
351
350
|
}
|
|
352
351
|
|
|
353
352
|
// src/getLocalizedString.ts
|
|
@@ -477,7 +476,7 @@ function saveSettings(setting, value, article) {
|
|
|
477
476
|
}
|
|
478
477
|
|
|
479
478
|
// src/index.ts
|
|
480
|
-
var version = "2.5.
|
|
479
|
+
var version = "2.5.2";
|
|
481
480
|
export {
|
|
482
481
|
SessionHandler,
|
|
483
482
|
UserSession,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _=Object.defineProperty;var A=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var y=(e,t,n)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))H.call(t,n)&&y(e,n,t[n]);if(A)for(var n of A(t))O.call(t,n)&&y(e,n,t[n]);return e};var a=(e,t,n)=>(y(e,typeof t!="symbol"?t+"":t,n),n);function h(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(o){o(n)}),(r=e.get("*"))&&r.slice().map(function(o){o(t,n)})}}}var c=class{constructor(){a(this,"eventHandler",h())}authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,n){try{let r=new Promise(i=>{let l=()=>{this.eventHandler.off("onAuthenticated",l),t==null||t(),i()};this.eventHandler.on("onAuthenticated",l)}),o=document.querySelector("dialog.session-expired-dialog");if(o)await r;else{o=document.createElement("dialog"),o.className="session-expired-dialog",o.style.display="flex",o.style.padding="0",o.style.left="50%",o.style.transform="translateX(-50%)";let i="/login?ReturnUrl=%2fapi/sessionexpired/remove";n!=="RequireTwoFactor"?await fetch("/logout",{method:"POST"}):i="/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove",o.innerHTML=`<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="${i}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(o),o.showModal(),await r,o.remove()}}catch(r){window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(t,n){return this.eventHandler.on(t,n)}detachEvent(t,n){return this.eventHandler.off(t,n)}};var x=class extends c{constructor(n){super();a(this,"amDesignator","a.m.");a(this,"dayNames",["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]);a(this,"dayNamesShort",["sun","mon","tue","wed","thu","fri","sat"]);a(this,"decimalSeparator",".");a(this,"domain","OB");a(this,"email");a(this,"formats");a(this,"groupSeparator",null);a(this,"integratedSecurity",!1);a(this,"isDeveloper",!1);a(this,"login","");a(this,"loginType");a(this,"monthNames",["january","february","march","april","may","june","july","august","september","october","november","december",""]);a(this,"monthNamesShort",["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""]);a(this,"name");a(this,"pmDesignator","p.m.");a(this,"shortDateFormat","dd.MM.yyyy");a(this,"culture","en-GB");a(this,"uiculture","en-GB");this.formats={},Object.assign(this,n)}};var R;(R=window.window)==null||R.addEventListener("error",e=>{var t,n,r,o,i,l,s;try{let g={error:(r=(n=(t=e.error)==null?void 0:t.message)!=null?n:e.message)!=null?r:null,file:e.filename,line:(o=e.lineno)!=null?o:0,column:(i=e.colno)!=null?i:0,stack:(s=(l=e.error)==null?void 0:l.stack)!=null?s:null};fetch("/data/Logger/LogError",{body:JSON.stringify(g),headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","X-Requested-With":"XMLHttpRequest"},method:"POST"})}catch(g){}});function te(e){return e?q(e).substring(0,10):null}function d(e){return String(e).padStart(2,"0")}function q(e){return e?`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}T${d(e.getHours())}:${d(e.getMinutes())}:${d(e.getSeconds())}.${d(e.getMilliseconds())}`:null}function S(e,t){return new Promise(function(n,r){try{let o=URL.createObjectURL(e),i=document.body,l=document.createElement("a");l.setAttribute("download",t),l.href=o,i.append(l),l.click(),i.removeChild(l),setTimeout(function(){URL.revokeObjectURL(o),n()},250)}catch(o){r(o)}})}function u(e,t){if(e)return;let n=typeof t=="function"?t():t;throw new Error(n!=null?n:"Invariant failed")}async function se(e,{fileName:t,signal:n,onProgress:r}){var l;function o(s){typeof r=="function"&&r($({},s))}let i=0;o({status:"requested"});try{let s=await fetch(e);if(!s.ok||!s.body){if((l=s.headers.get("content-type"))!=null&&l.includes("application/json")){let f=await s.json();u(!f.error,f.error)}throw new Error(`${s.status} ${s.statusText}`)}try{let f=s.body.getReader(),U=new ReadableStream({start:function(L){function I(){return f.read().then(function(m){if(m.done){L.close();return}return i+=m.value.length,o({bytesReceived:i,status:"downloading"}),L.enqueue(m.value),I()})}return I()}});s=new Response(U)}catch(f){}let g=await s.blob();o({bytesReceived:i,status:"downloaded"}),await S(g,t),o({bytesReceived:i,status:"completed"})}catch(s){n!=null&&n.aborted?o({status:"cancelled"}):o({error:s.message,status:"error"})}}function p(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var P=/^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;function b(e){var t=e.toString().match(P);return u(t,"Unable to parse function!"),{name:t[1],args:t[2].split(","),body:t[3]}}function j(){}j.prototype=Object.create(null);var E=j;function w(e,t){if(typeof e=="object"){if(typeof t=="string"){let n=t.split(".");return w(e,n)}else if(Array.isArray(t)){let n=e;for(let r=0;r<t.length;r++)n=n[t[r]]=n[t[r]]||new E;return n}}}function D(e,t,n={}){if(Array.isArray(t))for(let r of t){let{name:o}=b(r);u(o,"Unable to detect name of function! Name it, or only supply one function and include name in first parameter."),D(e,r)}else{let r,o;if(typeof t=="function"&&(r=b(t).name),typeof e=="string"){let i=e.split(".");r||(r=i[i.length-1],i=i.slice(0,i.length-1)),o=w(window,i)}else r&&(typeof e=="object"||typeof e=="function")?o=e:u(!1,"Invalid typeof parameter 'name', or unable to parse pValue!");p(o,r)&&(n==null?void 0:n.overwrite)!==!0?console.warn([e,r].join(".")+" is already defined!"):o[r]=t}}var M={xs:64,sm:128,md:256,lg:512,xl:void 0};function k(e,t,n,r="xs"){if(e&&typeof e=="object")return k(e.primKey,e.login,e.hash,e.size);if(!e||!n)return"";let o=M[r];return`/api/data/blob/EmployeesLookup/${e}/Image/${encodeURIComponent(t!=null?t:"")}${t?".":""}${encodeURIComponent(n)}.jpg${o?`?width=${o}`:""}`}async function C(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(t){}return e}function v(e,t){var n;if(typeof e=="string"&&e.trim().length===0)return e;if(!(e===void 0||e===""||e===null))if(((n=af==null?void 0:af.article)==null?void 0:n.i18n)!==void 0){if(!p(af.article.i18n,e)){af.article.i18n[e]=e;let r=C(e).then(o=>(af.article.i18n[e]=o,o));if(t)return r}return af.article.i18n[e]}else return e}function F(e,...t){u(Array.isArray(e)&&e.length===t.length+1,"Method 'localize' must be used as a tag function");let n=e.map((o,i)=>i===e.length-1?o:`${o}$${i}`).join(""),r=v(n);return t.forEach((o,i)=>{r=r.replace("$"+i,o)}),r}function N(e){var t;return[((t=af==null?void 0:af.article)==null?void 0:t.id)||"","common",e].join(".")}var z=class{isPersisted(){return!0}getLocalStorageKey(t,n){return n?["common",t].join("."):N(t)}get(t,n,r){let o=this.getLocalStorageKey(t,r),i=localStorage.getItem(o);return i!==null?JSON.parse(i):n}set(t,n,r){localStorage.setItem(this.getLocalStorageKey(t,r),JSON.stringify(n))}remove(t,n){let r=this.getLocalStorageKey(t,n);return localStorage.getItem(r)!==null?(localStorage.removeItem(r),!0):!1}clear(){let t=N("");for(let n in localStorage)n.slice(0,t.length)===t&&localStorage.removeItem(n)}},B=new z;function T(e){return`${e||af.article.id}.${af.userSession.login}`}function Re(e,t){if(!(af!=null&&af.userSession))return null;let n=T(t),r=JSON.parse(localStorage.getItem(n)||"{}");return e?r[e]||null:r}function je(e,t,n){if(!(af!=null&&af.userSession))return;let r=T(n),o=JSON.parse(localStorage.getItem(r)||"{}");typeof t<"u"?o[e]=t:o=e,localStorage.setItem(r,JSON.stringify(o))}var Te="2.5.2";export{c as SessionHandler,x as UserSession,S as downloadBlob,se as downloadRequest,D as expose,v as getLocalizedString,Re as getSettings,k as getUserImage,p as has,u as invariant,B as localStorage,F as localize,h as mitt,je as saveSettings,te as toLocalISODate,q as toLocalISODateTime,Te as version};
|
|
2
2
|
//# sourceMappingURL=af.common.legacy.min.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../node_modules/mitt/src/index.ts", "../../src/SessionHandler.ts", "../../src/UserSession.ts", "../../src/errorHandler.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/localStorage.ts", "../../src/settings.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<WildcardHandler<T>>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<\n\tkeyof Events | '*',\n\tEventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>\n>;\n\nexport interface Emitter<Events extends Record<EventType, unknown>> {\n\tall: EventHandlerMap<Events>;\n\n\ton<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;\n\ton(type: '*', handler: WildcardHandler<Events>): void;\n\n\toff<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;\n\toff(type: '*', handler: WildcardHandler<Events>): void;\n\n\temit<Key extends keyof Events>(type: Key, event: Events[Key]): void;\n\temit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt<Events extends Record<EventType, unknown>>(\n\tall?: EventHandlerMap<Events>\n): Emitter<Events> {\n\ttype GenericEventHandler =\n\t\t| Handler<Events[keyof Events]>\n\t\t| WildcardHandler<Events>;\n\tall = all || new Map();\n\n\treturn {\n\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `'*'` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<Key extends keyof Events>(type: Key, handler: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.push(handler);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tall!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * If `handler` is omitted, all handlers of the given type are removed.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from, or `'*'`\n\t\t * @param {Function} [handler] Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\tif (handler) {\n\t\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tall!.set(type, []);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `'*'` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing '*' handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {\n\t\t\tlet handlers = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as EventHandlerList<Events[keyof Events]>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(evt!);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\thandlers = all!.get('*');\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as WildCardEventHandlerList<Events>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(type, evt!);\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\n", "import mitt, { Emitter, Handler } from \"mitt\";\n\ntype SessionHandlerEvent = \"onExpired\" | \"onAuthenticated\";\n\nexport default class SessionHandler {\n\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", "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\tinvariant(arguments.length === 2, \"Incorrect number of arguments passed to the expose function!\");\n\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/${login}${login ? \".\" : \"\"}${hash}.jpg${\n\t\tsizePx ? `?width=${sizePx}` : \"\"\n\t}`;\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 (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", "function getLocalKey(key: string): string {\n\treturn [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n\tisPersisted() {\n\t\treturn true;\n\t}\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", "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 { UserSession } from \"./UserSession.js\";\nimport \"./errorHandler.js\";\nimport { expose } from \"./expose.js\";\nimport { getLocalizedString } from \"./getLocalizedString.js\";\nimport { localize } from \"./localize.js\";\n\nexport { default as mitt } from \"mitt\";\nexport * from \"./date.js\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport * from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport * from \"./getUserImage.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport * from \"./has.js\";\nexport { invariant } from \"./invariant.js\";\nexport { localize } from \"./localize.js\";\nexport { default as localStorage } from \"./localStorage.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport * from \"./settings.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n\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};\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": "wZAuCCA,EAAAA,CAOA,MAAO,CAKNA,IAPDA,EAAMA,GAAO,IAAIC,IAehBC,GAAAA,SAA6BC,EAAWC,EAAAA,CACvC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,EACHA,EAASE,KAAKH,CAAAA,EAGdJ,EAAKQ,IAAIL,EAAM,CAACC,CAAAA,CAAAA,CAAAA,EAWlBK,IAAAA,SAA8BN,EAAWC,EAAAA,CACxC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,IACCD,EACHC,EAASK,OAAOL,EAASM,QAAQP,CAAAA,IAAa,EAAG,CAAA,EAGjDJ,EAAKQ,IAAIL,EAAM,CAAA,CAAA,EAA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AAMC,EAAO,MAAMT,EAAS,KAAK,EAEjCJ,EAAe,CAAE,cAAAG,EAAe,OAAQ,YAAa,CAAC,EAEtD,MAAMW,EAAaD,EAAMjB,CAAQ,EAEjCI,EAAe,CAAE,cAAAG,EAAe,OAAQ,WAAY,CAAC,CACtD,OAASY,EAAP,CACGlB,GAAA,MAAAA,EAAQ,QACXG,EAAe,CAAE,OAAQ,WAAY,CAAC,EAEtCA,EAAe,CAAE,MAAQe,EAAc,QAAS,OAAQ,OAAQ,CAAC,CAEnE,CACD,CC7EO,SAASC,EAAIC,EAAUC,EAAwC,CACrE,OAAO,OAAO,UAAU,eAAe,KAAKD,EAAKC,CAAG,CACrD,CCAA,IAAMC,EACL,wJAEM,SAASC,EAAUC,EAAgB,CACzC,IAAIC,EAAQD,EAAK,SAAS,EAAE,MAAMF,CAAS,EAC3C,OAAAI,EAAUD,EAAO,2BAA2B,EACrC,CAAE,KAAMA,EAAM,GAAI,KAAMA,EAAM,GAAG,MAAM,GAAG,EAAG,KAAMA,EAAM,EAAG,CACpE,CCTA,SAASE,GAAY,CAAC,CACtBA,EAAU,UAAY,OAAO,OAAO,IAAI,EAExC,IAAOC,EAAQD,ECDR,SAASE,EAAiBC,EAAWC,EAAwC,CACnF,GAAI,OAAOD,GAAS,UACnB,GAAI,OAAOC,GAAc,SAAU,CAClC,IAAIC,EAAOD,EAAU,MAAM,GAAG,EAE9B,OAAOF,EAAiBC,EAAME,CAAI,CACnC,SAAW,MAAM,QAAQD,CAAS,EAAG,CACpC,IAAIE,EAAeH,EACnB,QAASI,EAAI,EAAGA,EAAIH,EAAU,OAAQG,IACrCD,EAAUA,EAAQF,EAAUG,IAAMD,EAAQF,EAAUG,KAAO,IAAKC,EAGjE,OAAOF,CACR,EAEF,CCAO,SAASG,EACfC,EACAC,EACAC,EAAyB,CAAC,EACnB,
|
|
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", "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", "
|
|
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<WildcardHandler<T>>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<\n\tkeyof Events | '*',\n\tEventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>\n>;\n\nexport interface Emitter<Events extends Record<EventType, unknown>> {\n\tall: EventHandlerMap<Events>;\n\n\ton<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;\n\ton(type: '*', handler: WildcardHandler<Events>): void;\n\n\toff<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;\n\toff(type: '*', handler: WildcardHandler<Events>): void;\n\n\temit<Key extends keyof Events>(type: Key, event: Events[Key]): void;\n\temit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt<Events extends Record<EventType, unknown>>(\n\tall?: EventHandlerMap<Events>\n): Emitter<Events> {\n\ttype GenericEventHandler =\n\t\t| Handler<Events[keyof Events]>\n\t\t| WildcardHandler<Events>;\n\tall = all || new Map();\n\n\treturn {\n\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `'*'` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<Key extends keyof Events>(type: Key, handler: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.push(handler);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tall!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * If `handler` is omitted, all handlers of the given type are removed.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from, or `'*'`\n\t\t * @param {Function} [handler] Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\tif (handler) {\n\t\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tall!.set(type, []);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `'*'` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing '*' handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {\n\t\t\tlet handlers = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as EventHandlerList<Events[keyof Events]>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(evt!);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\thandlers = all!.get('*');\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as WildCardEventHandlerList<Events>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(type, evt!);\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\n", "import mitt, { Emitter, Handler } from \"mitt\";\n\ntype SessionHandlerEvent = \"onExpired\" | \"onAuthenticated\";\n\nexport default class SessionHandler {\n\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", "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 (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", "function getLocalKey(key: string): string {\n\treturn [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n\tisPersisted() {\n\t\treturn true;\n\t}\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", "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 { UserSession } from \"./UserSession.js\";\nimport \"./errorHandler.js\";\nimport { expose } from \"./expose.js\";\nimport { getLocalizedString } from \"./getLocalizedString.js\";\nimport { localize } from \"./localize.js\";\n\nexport { default as mitt } from \"mitt\";\nexport * from \"./date.js\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport * from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport * from \"./getUserImage.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport * from \"./has.js\";\nexport { invariant } from \"./invariant.js\";\nexport { localize } from \"./localize.js\";\nexport { default as localStorage } from \"./localStorage.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport * from \"./settings.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n\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};\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": "wZAuCCA,EAAAA,CAOA,MAAO,CAKNA,IAPDA,EAAMA,GAAO,IAAIC,IAehBC,GAAAA,SAA6BC,EAAWC,EAAAA,CACvC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,EACHA,EAASE,KAAKH,CAAAA,EAGdJ,EAAKQ,IAAIL,EAAM,CAACC,CAAAA,CAAAA,CAAAA,EAWlBK,IAAAA,SAA8BN,EAAWC,EAAAA,CACxC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,IACCD,EACHC,EAASK,OAAOL,EAASM,QAAQP,CAAAA,IAAa,EAAG,CAAA,EAGjDJ,EAAKQ,IAAIL,EAAM,CAAA,CAAA,EAAA,EAelBS,KAAAA,SAA+BT,EAAWU,EAAAA,CACzC,IAAIR,EAAWL,EAAKM,IAAIH,CAAAA,EACpBE,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CACvD,CCVO,IAAMC,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", "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", "has", "promise", "fetchLocalizedString", "text", "localize", "stringParts", "args", "invariant", "stringToLocalize", "s", "localized", "getLocalizedString", "arg", "index", "getLocalKey", "key", "_a", "LocalStorage", "global", "defaultValue", "lsKey", "value", "baseKey", "localStorage_default", "getKey", "article", "getSettings", "setting", "key", "settings", "saveSettings", "value", "userSettings", "version"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function g(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 l=class{eventHandler=g();authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,r){try{let n=new Promise(i=>{let a=()=>{this.eventHandler.off("onAuthenticated",a),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="${i}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(o),o.showModal(),await n,o.remove()}}catch{window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(t,r){return this.eventHandler.on(t,r)}detachEvent(t,r){return this.eventHandler.off(t,r)}};var p=class extends l{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
|
|
1
|
+
function g(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 l=class{eventHandler=g();authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,r){try{let n=new Promise(i=>{let a=()=>{this.eventHandler.off("onAuthenticated",a),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="${i}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(o),o.showModal(),await n,o.remove()}}catch{window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(t,r){return this.eventHandler.on(t,r)}detachEvent(t,r){return this.eventHandler.off(t,r)}};var p=class extends l{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 F(e){return e?j(e).substring(0,10):null}function c(e){return String(e).padStart(2,"0")}function j(e){return e?`${e.getFullYear()}-${c(e.getMonth()+1)}-${c(e.getDate())}T${c(e.getHours())}:${c(e.getMinutes())}:${c(e.getSeconds())}.${c(e.getMilliseconds())}`:null}function m(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 s(e,t){if(e)return;let r=typeof t=="function"?t():t;throw new Error(r??"Invariant failed")}async function X(e,{fileName:t,signal:r,onProgress:n}){function o(a){typeof n=="function"&&n({...a})}let i=0;o({status:"requested"});try{let a=await fetch(e);if(!a.ok||!a.body){if(a.headers.get("content-type")?.includes("application/json")){let u=await a.json();s(!u.error,u.error)}throw new Error(`${a.status} ${a.statusText}`)}try{let u=a.body.getReader(),R=new ReadableStream({start:function(b){function w(){return u.read().then(function(f){if(f.done){b.close();return}return i+=f.value.length,o({bytesReceived:i,status:"downloading"}),b.enqueue(f.value),w()})}return w()}});a=new Response(R)}catch{}let $=await a.blob();o({bytesReceived:i,status:"downloaded"}),await m($,t),o({bytesReceived:i,status:"completed"})}catch(a){r?.aborted?o({status:"cancelled"}):o({error:a.message,status:"error"})}}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var E=/^function(?:\s+([a-zA-Z$_][a-zA-Z0-9$_]*))?\s*\(((?:(?:\s*[a-zA-Z$_][a-zA-Z0-9$_]*)(?:\s*,\s*[a-zA-Z$_][a-zA-Z0-9$_]*)*)?)\s*\)\s*\{((?:.|\n|\r)*)\}$/;function y(e){var t=e.toString().match(E);return s(t,"Unable to parse function!"),{name:t[1],args:t[2].split(","),body:t[3]}}function v(){}v.prototype=Object.create(null);var z=v;function h(e,t){if(typeof e=="object"){if(typeof t=="string"){let r=t.split(".");return h(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 z;return r}}}function L(e,t,r={}){if(Array.isArray(t))for(let n of t){let{name:o}=y(n);s(o,"Unable to detect name of function! Name it, or only supply one function and include name in first parameter."),L(e,n)}else{let n,o;if(typeof t=="function"&&(n=y(t).name),typeof e=="string"){let i=e.split(".");n||(n=i[i.length-1],i=i.slice(0,i.length-1)),o=h(window,i)}else n&&(typeof e=="object"||typeof e=="function")?o=e:s(!1,"Invalid typeof parameter 'name', or unable to parse pValue!");d(o,n)&&r?.overwrite!==!0?console.warn([e,n].join(".")+" is already defined!"):o[n]=t}}var D={xs:64,sm:128,md:256,lg:512,xl:void 0};function N(e,t,r,n="xs"){if(e&&typeof e=="object")return N(e.primKey,e.login,e.hash,e.size);if(!e||!r)return"";let o=D[n];return`/api/data/blob/EmployeesLookup/${e}/Image/${encodeURIComponent(t??"")}${t?".":""}${encodeURIComponent(r)}.jpg${o?`?width=${o}`:""}`}async function T(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 x(e,t){if(typeof e=="string"&&e.trim().length===0)return e;if(!(e===void 0||e===""||e===null))if(af?.article?.i18n!==void 0){if(!d(af.article.i18n,e)){af.article.i18n[e]=e;let r=T(e).then(n=>(af.article.i18n[e]=n,n));if(t)return r}return af.article.i18n[e]}else return e}function U(e,...t){s(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:`${o}$${i}`).join(""),n=x(r);return t.forEach((o,i)=>{n=n.replace("$"+i,o)}),n}function I(e){return[af?.article?.id||"","common",e].join(".")}var S=class{isPersisted(){return!0}getLocalStorageKey(t,r){return r?["common",t].join("."):I(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=I("");for(let r in localStorage)r.slice(0,t.length)===t&&localStorage.removeItem(r)}},_=new S;function A(e){return`${e||af.article.id}.${af.userSession.login}`}function me(e,t){if(!af?.userSession)return null;let r=A(t),n=JSON.parse(localStorage.getItem(r)||"{}");return e?n[e]||null:n}function ye(e,t,r){if(!af?.userSession)return;let n=A(r),o=JSON.parse(localStorage.getItem(n)||"{}");typeof t<"u"?o[e]=t:o=e,localStorage.setItem(n,JSON.stringify(o))}var be="2.5.2";export{l as SessionHandler,p as UserSession,m as downloadBlob,X as downloadRequest,L as expose,x as getLocalizedString,me as getSettings,N as getUserImage,d as has,s as invariant,_ as localStorage,U as localize,g as mitt,ye as saveSettings,F as toLocalISODate,j as toLocalISODateTime,be as version};
|
|
2
2
|
//# sourceMappingURL=af.common.min.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../node_modules/mitt/src/index.ts", "../../src/SessionHandler.ts", "../../src/UserSession.ts", "../../src/errorHandler.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/localStorage.ts", "../../src/settings.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<WildcardHandler<T>>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<\n\tkeyof Events | '*',\n\tEventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>\n>;\n\nexport interface Emitter<Events extends Record<EventType, unknown>> {\n\tall: EventHandlerMap<Events>;\n\n\ton<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;\n\ton(type: '*', handler: WildcardHandler<Events>): void;\n\n\toff<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;\n\toff(type: '*', handler: WildcardHandler<Events>): void;\n\n\temit<Key extends keyof Events>(type: Key, event: Events[Key]): void;\n\temit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt<Events extends Record<EventType, unknown>>(\n\tall?: EventHandlerMap<Events>\n): Emitter<Events> {\n\ttype GenericEventHandler =\n\t\t| Handler<Events[keyof Events]>\n\t\t| WildcardHandler<Events>;\n\tall = all || new Map();\n\n\treturn {\n\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `'*'` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<Key extends keyof Events>(type: Key, handler: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.push(handler);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tall!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * If `handler` is omitted, all handlers of the given type are removed.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from, or `'*'`\n\t\t * @param {Function} [handler] Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\tif (handler) {\n\t\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tall!.set(type, []);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `'*'` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing '*' handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {\n\t\t\tlet handlers = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as EventHandlerList<Events[keyof Events]>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(evt!);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\thandlers = all!.get('*');\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as WildCardEventHandlerList<Events>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(type, evt!);\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\n", "import mitt, { Emitter, Handler } from \"mitt\";\n\ntype SessionHandlerEvent = \"onExpired\" | \"onAuthenticated\";\n\nexport default class SessionHandler {\n\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", "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\tinvariant(arguments.length === 2, \"Incorrect number of arguments passed to the expose function!\");\n\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/${login}${login ? \".\" : \"\"}${hash}.jpg${\n\t\tsizePx ? `?width=${sizePx}` : \"\"\n\t}`;\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 (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", "function getLocalKey(key: string): string {\n\treturn [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n\tisPersisted() {\n\t\treturn true;\n\t}\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", "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 { UserSession } from \"./UserSession.js\";\nimport \"./errorHandler.js\";\nimport { expose } from \"./expose.js\";\nimport { getLocalizedString } from \"./getLocalizedString.js\";\nimport { localize } from \"./localize.js\";\n\nexport { default as mitt } from \"mitt\";\nexport * from \"./date.js\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport * from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport * from \"./getUserImage.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport * from \"./has.js\";\nexport { invariant } from \"./invariant.js\";\nexport { localize } from \"./localize.js\";\nexport { default as localStorage } from \"./localStorage.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport * from \"./settings.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n\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};\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": "WAuCCA,EAAAA,CAOA,MAAO,CAKNA,IAPDA,EAAMA,GAAO,IAAIC,IAehBC,GAAAA,SAA6BC,EAAWC,EAAAA,CACvC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,EACHA,EAASE,KAAKH,CAAAA,EAGdJ,EAAKQ,IAAIL,EAAM,CAACC,CAAAA,CAAAA,CAAAA,EAWlBK,IAAAA,SAA8BN,EAAWC,EAAAA,CACxC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,IACCD,EACHC,EAASK,OAAOL,EAASM,QAAQP,CAAAA,IAAa,EAAG,CAAA,EAGjDJ,EAAKQ,IAAIL,EAAM,CAAA,CAAA,EAAA,EAelBS,KAAAA,SAA+BT,EAAWU,EAAAA,CACzC,IAAIR,EAAWL,EAAKM,IAAIH,CAAAA,EACpBE,GACFA,EACCS,MAAAA,EACAC,IAAI,SAACX,EAAAA,CACLA,EAAQS,CAAAA,CAAAA,CAAAA,GAIXR,EAAWL,EAAKM,IAAI,GAAA,IAElBD,EACCS,MAAAA,EACAC,IAAI,SAACX,EAAAA,CACLA,EAAQD,EAAMU,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CC7GpB,IAAqBG,EAArB,KAAoC,CAC3B,aAAoEC,EAAK,EAEjF,eAAgB,CACf,KAAK,aAAa,KAAK,iBAAiB,CACzC,CAEA,MAAM,QAAQC,EAAuBC,EAA0C,CAC9E,GAAI,CACH,IAAIC,EAAc,IAAI,QAAeC,GAAY,CAChD,IAAIC,EAAe,IAAM,CACxB,KAAK,aAAa,IAAI,kBAAmBA,CAAY,EACr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AO,IAAKC,EAGjE,OAAOF,CACR,EAEF,CCAO,SAASG,EACfC,EACAC,EACAC,EAAyB,CAAC,EACnB,
|
|
6
|
-
"names": ["all", "Map", "on", "type", "handler", "handlers", "get", "push", "set", "off", "splice", "indexOf", "emit", "evt", "slice", "map", "SessionHandler", "mitt_default", "callback", "type", "authPromise", "resolve", "eventHandler", "dialog", "link", "eventName", "handler", "UserSession", "SessionHandler", "userData", "event", "data", "toLocalISODate", "date", "toLocalISODateTime", "pad", "num", "downloadBlob", "blob", "fileName", "resolve", "reject", "url", "parent", "anchor", "ex", "invariant", "condition", "message", "provided", "downloadRequest", "request", "fileName", "signal", "onProgress", "reportProgress", "progress", "bytesReceived", "response", "data", "invariant", "reader", "stream", "controller", "pump", "read", "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", "
|
|
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<WildcardHandler<T>>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<\n\tkeyof Events | '*',\n\tEventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>\n>;\n\nexport interface Emitter<Events extends Record<EventType, unknown>> {\n\tall: EventHandlerMap<Events>;\n\n\ton<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;\n\ton(type: '*', handler: WildcardHandler<Events>): void;\n\n\toff<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;\n\toff(type: '*', handler: WildcardHandler<Events>): void;\n\n\temit<Key extends keyof Events>(type: Key, event: Events[Key]): void;\n\temit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt<Events extends Record<EventType, unknown>>(\n\tall?: EventHandlerMap<Events>\n): Emitter<Events> {\n\ttype GenericEventHandler =\n\t\t| Handler<Events[keyof Events]>\n\t\t| WildcardHandler<Events>;\n\tall = all || new Map();\n\n\treturn {\n\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `'*'` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<Key extends keyof Events>(type: Key, handler: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.push(handler);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tall!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * If `handler` is omitted, all handlers of the given type are removed.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from, or `'*'`\n\t\t * @param {Function} [handler] Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\tif (handler) {\n\t\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tall!.set(type, []);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `'*'` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing '*' handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {\n\t\t\tlet handlers = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as EventHandlerList<Events[keyof Events]>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(evt!);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\thandlers = all!.get('*');\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as WildCardEventHandlerList<Events>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(type, evt!);\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\n", "import mitt, { Emitter, Handler } from \"mitt\";\n\ntype SessionHandlerEvent = \"onExpired\" | \"onAuthenticated\";\n\nexport default class SessionHandler {\n\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", "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 (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", "function getLocalKey(key: string): string {\n\treturn [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n\tisPersisted() {\n\t\treturn true;\n\t}\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", "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 { UserSession } from \"./UserSession.js\";\nimport \"./errorHandler.js\";\nimport { expose } from \"./expose.js\";\nimport { getLocalizedString } from \"./getLocalizedString.js\";\nimport { localize } from \"./localize.js\";\n\nexport { default as mitt } from \"mitt\";\nexport * from \"./date.js\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport * from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport * from \"./getUserImage.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport * from \"./has.js\";\nexport { invariant } from \"./invariant.js\";\nexport { localize } from \"./localize.js\";\nexport { default as localStorage } from \"./localStorage.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport * from \"./settings.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n\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};\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": "WAuCCA,EAAAA,CAOA,MAAO,CAKNA,IAPDA,EAAMA,GAAO,IAAIC,IAehBC,GAAAA,SAA6BC,EAAWC,EAAAA,CACvC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,EACHA,EAASE,KAAKH,CAAAA,EAGdJ,EAAKQ,IAAIL,EAAM,CAACC,CAAAA,CAAAA,CAAAA,EAWlBK,IAAAA,SAA8BN,EAAWC,EAAAA,CACxC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,IACCD,EACHC,EAASK,OAAOL,EAASM,QAAQP,CAAAA,IAAa,EAAG,CAAA,EAGjDJ,EAAKQ,IAAIL,EAAM,C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A,EAET,CAEA,OAAQ,CACP,IAAME,EAAUP,EAAY,EAAE,EAE9B,QAASC,KAAO,aACXA,EAAI,MAAM,EAAGM,EAAQ,MAAM,IAAMA,GACpC,aAAa,WAAWN,CAAG,CAG9B,CACD,EAEOO,EAAQ,IAAIN,EC7CnB,SAASO,EAAOC,EAAkB,CAEjC,MAAO,GADYA,GAAW,GAAG,QAAQ,MACjB,GAAG,YAAY,OACxC,CAEO,SAASC,GAAeC,EAAiBF,EAA4B,CAC3E,GAAI,CAAC,IAAI,YAAa,OAAO,KAE7B,IAAMG,EAAMJ,EAAOC,CAAO,EACpBI,EAAW,KAAK,MAAM,aAAa,QAAQD,CAAG,GAAK,IAAI,EAE7D,OAAID,EACIE,EAASF,IAAY,KAGtBE,CACR,CAEO,SAASC,GAAgBH,EAAiBI,EAAiBN,EAAwB,CACzF,GAAI,CAAC,IAAI,YAAa,OAEtB,IAAMG,EAAMJ,EAAOC,CAAO,EACtBO,EAAe,KAAK,MAAM,aAAa,QAAQJ,CAAG,GAAK,IAAI,EAE3D,OAAOG,EAAU,IACpBC,EAAaL,GAAWI,EAExBC,EAAeL,EAGhB,aAAa,QAAQC,EAAK,KAAK,UAAUI,CAAY,CAAC,CACvD,CCVO,IAAMC,GAAU",
|
|
6
|
+
"names": ["all", "Map", "on", "type", "handler", "handlers", "get", "push", "set", "off", "splice", "indexOf", "emit", "evt", "slice", "map", "SessionHandler", "mitt_default", "callback", "type", "authPromise", "resolve", "eventHandler", "dialog", "link", "eventName", "handler", "UserSession", "SessionHandler", "userData", "event", "data", "toLocalISODate", "date", "toLocalISODateTime", "pad", "num", "downloadBlob", "blob", "fileName", "resolve", "reject", "url", "parent", "anchor", "ex", "invariant", "condition", "message", "provided", "downloadRequest", "request", "fileName", "signal", "onProgress", "reportProgress", "progress", "bytesReceived", "response", "data", "invariant", "reader", "stream", "controller", "pump", "read", "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", "getLocalizedString", "string", "wait", "has", "promise", "fetchLocalizedString", "text", "localize", "stringParts", "args", "invariant", "stringToLocalize", "s", "localized", "getLocalizedString", "arg", "index", "getLocalKey", "key", "LocalStorage", "global", "defaultValue", "lsKey", "value", "baseKey", "localStorage_default", "getKey", "article", "getSettings", "setting", "key", "settings", "saveSettings", "value", "userSettings", "version"]
|
|
7
7
|
}
|
package/dist/iife/af.common.js
CHANGED
|
@@ -311,7 +311,6 @@ var af;
|
|
|
311
311
|
|
|
312
312
|
// src/expose.ts
|
|
313
313
|
function expose(name, value, options = {}) {
|
|
314
|
-
invariant(arguments.length === 2, "Incorrect number of arguments passed to the expose function!");
|
|
315
314
|
if (Array.isArray(value)) {
|
|
316
315
|
for (let func of value) {
|
|
317
316
|
const { name: funcName } = parseFunc(func);
|
|
@@ -363,7 +362,7 @@ var af;
|
|
|
363
362
|
return "";
|
|
364
363
|
}
|
|
365
364
|
let sizePx = sizeMap[size];
|
|
366
|
-
return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${login}${login ? "." : ""}${hash}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
|
|
365
|
+
return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${encodeURIComponent(login ?? "")}${login ? "." : ""}${encodeURIComponent(hash)}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
|
|
367
366
|
}
|
|
368
367
|
|
|
369
368
|
// src/getLocalizedString.ts
|
|
@@ -491,6 +490,6 @@ var af;
|
|
|
491
490
|
}
|
|
492
491
|
|
|
493
492
|
// src/index.ts
|
|
494
|
-
var version = "2.5.
|
|
493
|
+
var version = "2.5.2";
|
|
495
494
|
return __toCommonJS(src_exports);
|
|
496
495
|
})();
|
|
@@ -334,7 +334,6 @@ af.common = (() => {
|
|
|
334
334
|
|
|
335
335
|
// src/expose.ts
|
|
336
336
|
function expose(name, value, options = {}) {
|
|
337
|
-
invariant(arguments.length === 2, "Incorrect number of arguments passed to the expose function!");
|
|
338
337
|
if (Array.isArray(value)) {
|
|
339
338
|
for (let func of value) {
|
|
340
339
|
const { name: funcName } = parseFunc(func);
|
|
@@ -386,7 +385,7 @@ af.common = (() => {
|
|
|
386
385
|
return "";
|
|
387
386
|
}
|
|
388
387
|
let sizePx = sizeMap[size];
|
|
389
|
-
return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${login}${login ? "." : ""}${hash}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
|
|
388
|
+
return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${encodeURIComponent(login != null ? login : "")}${login ? "." : ""}${encodeURIComponent(hash)}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
|
|
390
389
|
}
|
|
391
390
|
|
|
392
391
|
// src/getLocalizedString.ts
|
|
@@ -516,6 +515,6 @@ af.common = (() => {
|
|
|
516
515
|
}
|
|
517
516
|
|
|
518
517
|
// src/index.ts
|
|
519
|
-
var version = "2.5.
|
|
518
|
+
var version = "2.5.2";
|
|
520
519
|
return __toCommonJS(src_exports);
|
|
521
520
|
})();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var af=af||{};af.common=(()=>{var m=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
var af=af||{};af.common=(()=>{var m=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames,R=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var w=(e,t,n)=>t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E=(e,t)=>{for(var n in t||(t={}))j.call(t,n)&&w(e,n,t[n]);if(R)for(var n of R(t))F.call(t,n)&&w(e,n,t[n]);return e};var B=(e,t)=>{for(var n in t)m(e,n,{get:t[n],enumerable:!0})},J=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of C(t))!j.call(e,o)&&o!==n&&m(e,o,{get:()=>t[o],enumerable:!(r=k(t,o))||r.enumerable});return e};var K=e=>J(m({},"__esModule",{value:!0}),e);var a=(e,t,n)=>(w(e,typeof t!="symbol"?t+"":t,n),n);var te={};B(te,{SessionHandler:()=>c,UserSession:()=>h,downloadBlob:()=>x,downloadRequest:()=>V,expose:()=>L,getLocalizedString:()=>S,getSettings:()=>Y,getUserImage:()=>_,has:()=>g,invariant:()=>u,localStorage:()=>q,localize:()=>H,mitt:()=>y,saveSettings:()=>Q,toLocalISODate:()=>Z,toLocalISODateTime:()=>N,version:()=>ee});function y(e){return{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(o){o(n)}),(r=e.get("*"))&&r.slice().map(function(o){o(t,n)})}}}var c=class{constructor(){a(this,"eventHandler",y())}authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,n){try{let r=new Promise(i=>{let l=()=>{this.eventHandler.off("onAuthenticated",l),t==null||t(),i()};this.eventHandler.on("onAuthenticated",l)}),o=document.querySelector("dialog.session-expired-dialog");if(o)await r;else{o=document.createElement("dialog"),o.className="session-expired-dialog",o.style.display="flex",o.style.padding="0",o.style.left="50%",o.style.transform="translateX(-50%)";let i="/login?ReturnUrl=%2fapi/sessionexpired/remove";n!=="RequireTwoFactor"?await fetch("/logout",{method:"POST"}):i="/login?RequireTwoFactor=1&ReturnUrl=%2fapi/sessionexpired/remove",o.innerHTML=`<iframe sandbox="allow-same-origin allow-scripts allow-modals allow-top-navigation-by-user-activation allow-forms" src="${i}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(o),o.showModal(),await r,o.remove()}}catch(r){window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(t,n){return this.eventHandler.on(t,n)}detachEvent(t,n){return this.eventHandler.off(t,n)}};var h=class extends c{constructor(n){super();a(this,"amDesignator","a.m.");a(this,"dayNames",["sunday","monday","tuesday","wednesday","thursday","friday","saturday"]);a(this,"dayNamesShort",["sun","mon","tue","wed","thu","fri","sat"]);a(this,"decimalSeparator",".");a(this,"domain","OB");a(this,"email");a(this,"formats");a(this,"groupSeparator",null);a(this,"integratedSecurity",!1);a(this,"isDeveloper",!1);a(this,"login","");a(this,"loginType");a(this,"monthNames",["january","february","march","april","may","june","july","august","september","october","november","december",""]);a(this,"monthNamesShort",["jan","feb","mar","apr","may","jun","jul","augt","sep","oct","nov","dec",""]);a(this,"name");a(this,"pmDesignator","p.m.");a(this,"shortDateFormat","dd.MM.yyyy");a(this,"culture","en-GB");a(this,"uiculture","en-GB");this.formats={},Object.assign(this,n)}};var D;(D=window.window)==null||D.addEventListener("error",e=>{var t,n,r,o,i,l,s;try{let p={error:(r=(n=(t=e.error)==null?void 0:t.message)!=null?n:e.message)!=null?r:null,file:e.filename,line:(o=e.lineno)!=null?o:0,column:(i=e.colno)!=null?i:0,stack:(s=(l=e.error)==null?void 0:l.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 Z(e){return e?N(e).substring(0,10):null}function d(e){return String(e).padStart(2,"0")}function N(e){return e?`${e.getFullYear()}-${d(e.getMonth()+1)}-${d(e.getDate())}T${d(e.getHours())}:${d(e.getMinutes())}:${d(e.getSeconds())}.${d(e.getMilliseconds())}`:null}function x(e,t){return new Promise(function(n,r){try{let o=URL.createObjectURL(e),i=document.body,l=document.createElement("a");l.setAttribute("download",t),l.href=o,i.append(l),l.click(),i.removeChild(l),setTimeout(function(){URL.revokeObjectURL(o),n()},250)}catch(o){r(o)}})}function u(e,t){if(e)return;let n=typeof t=="function"?t():t;throw new Error(n!=null?n:"Invariant failed")}async function V(e,{fileName:t,signal:n,onProgress:r}){var l;function o(s){typeof r=="function"&&r(E({},s))}let i=0;o({status:"requested"});try{let s=await fetch(e);if(!s.ok||!s.body){if((l=s.headers.get("content-type"))!=null&&l.includes("application/json")){let f=await s.json();u(!f.error,f.error)}throw new Error(`${s.status} ${s.statusText}`)}try{let f=s.body.getReader(),M=new ReadableStream({start:function(A){function $(){return f.read().then(function(b){if(b.done){A.close();return}return i+=b.value.length,o({bytesReceived:i,status:"downloading"}),A.enqueue(b.value),$()})}return $()}});s=new Response(M)}catch(f){}let p=await s.blob();o({bytesReceived:i,status:"downloaded"}),await x(p,t),o({bytesReceived:i,status:"completed"})}catch(s){n!=null&&n.aborted?o({status:"cancelled"}):o({error:s.message,status:"error"})}}function g(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var X=/^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 v(e){var t=e.toString().match(X);return u(t,"Unable to parse function!"),{name:t[1],args:t[2].split(","),body:t[3]}}function T(){}T.prototype=Object.create(null);var U=T;function z(e,t){if(typeof e=="object"){if(typeof t=="string"){let n=t.split(".");return z(e,n)}else if(Array.isArray(t)){let n=e;for(let r=0;r<t.length;r++)n=n[t[r]]=n[t[r]]||new U;return n}}}function L(e,t,n={}){if(Array.isArray(t))for(let r of t){let{name:o}=v(r);u(o,"Unable to detect name of function! Name it, or only supply one function and include name in first parameter."),L(e,r)}else{let r,o;if(typeof t=="function"&&(r=v(t).name),typeof e=="string"){let i=e.split(".");r||(r=i[i.length-1],i=i.slice(0,i.length-1)),o=z(window,i)}else r&&(typeof e=="object"||typeof e=="function")?o=e:u(!1,"Invalid typeof parameter 'name', or unable to parse pValue!");g(o,r)&&(n==null?void 0:n.overwrite)!==!0?console.warn([e,r].join(".")+" is already defined!"):o[r]=t}}var W={xs:64,sm:128,md:256,lg:512,xl:void 0};function _(e,t,n,r="xs"){if(e&&typeof e=="object")return _(e.primKey,e.login,e.hash,e.size);if(!e||!n)return"";let o=W[r];return`/api/data/blob/EmployeesLookup/${e}/Image/${encodeURIComponent(t!=null?t:"")}${t?".":""}${encodeURIComponent(n)}.jpg${o?`?width=${o}`:""}`}async function G(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(t){}return e}function S(e,t){var n;if(typeof e=="string"&&e.trim().length===0)return e;if(!(e===void 0||e===""||e===null))if(((n=af==null?void 0:af.article)==null?void 0:n.i18n)!==void 0){if(!g(af.article.i18n,e)){af.article.i18n[e]=e;let r=G(e).then(o=>(af.article.i18n[e]=o,o));if(t)return r}return af.article.i18n[e]}else return e}function H(e,...t){u(Array.isArray(e)&&e.length===t.length+1,"Method 'localize' must be used as a tag function");let n=e.map((o,i)=>i===e.length-1?o:`${o}$${i}`).join(""),r=S(n);return t.forEach((o,i)=>{r=r.replace("$"+i,o)}),r}function O(e){var t;return[((t=af==null?void 0:af.article)==null?void 0:t.id)||"","common",e].join(".")}var I=class{isPersisted(){return!0}getLocalStorageKey(t,n){return n?["common",t].join("."):O(t)}get(t,n,r){let o=this.getLocalStorageKey(t,r),i=localStorage.getItem(o);return i!==null?JSON.parse(i):n}set(t,n,r){localStorage.setItem(this.getLocalStorageKey(t,r),JSON.stringify(n))}remove(t,n){let r=this.getLocalStorageKey(t,n);return localStorage.getItem(r)!==null?(localStorage.removeItem(r),!0):!1}clear(){let t=O("");for(let n in localStorage)n.slice(0,t.length)===t&&localStorage.removeItem(n)}},q=new I;function P(e){return`${e||af.article.id}.${af.userSession.login}`}function Y(e,t){if(!(af!=null&&af.userSession))return null;let n=P(t),r=JSON.parse(localStorage.getItem(n)||"{}");return e?r[e]||null:r}function Q(e,t,n){if(!(af!=null&&af.userSession))return;let r=P(n),o=JSON.parse(localStorage.getItem(r)||"{}");typeof t<"u"?o[e]=t:o=e,localStorage.setItem(r,JSON.stringify(o))}var ee="2.5.2";return K(te);})();
|
|
2
2
|
//# sourceMappingURL=af.common.legacy.min.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts", "../../../../node_modules/mitt/src/index.ts", "../../src/SessionHandler.ts", "../../src/UserSession.ts", "../../src/errorHandler.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/localStorage.ts", "../../src/settings.ts"],
|
|
4
|
-
"sourcesContent": ["import { UserSession } from \"./UserSession.js\";\nimport \"./errorHandler.js\";\nimport { expose } from \"./expose.js\";\nimport { getLocalizedString } from \"./getLocalizedString.js\";\nimport { localize } from \"./localize.js\";\n\nexport { default as mitt } from \"mitt\";\nexport * from \"./date.js\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport * from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport * from \"./getUserImage.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport * from \"./has.js\";\nexport { invariant } from \"./invariant.js\";\nexport { localize } from \"./localize.js\";\nexport { default as localStorage } from \"./localStorage.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport * from \"./settings.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n\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};\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", "export type EventType = string | symbol;\n\n// An event handler can take an optional event argument\n// and should not return a value\nexport type Handler<T = unknown> = (event: T) => void;\nexport type WildcardHandler<T = Record<string, unknown>> = (\n\ttype: keyof T,\n\tevent: T[keyof T]\n) => void;\n\n// An array of all currently registered event handlers for a type\nexport type EventHandlerList<T = unknown> = Array<Handler<T>>;\nexport type WildCardEventHandlerList<T = Record<string, unknown>> = Array<WildcardHandler<T>>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<\n\tkeyof Events | '*',\n\tEventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>\n>;\n\nexport interface Emitter<Events extends Record<EventType, unknown>> {\n\tall: EventHandlerMap<Events>;\n\n\ton<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;\n\ton(type: '*', handler: WildcardHandler<Events>): void;\n\n\toff<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;\n\toff(type: '*', handler: WildcardHandler<Events>): void;\n\n\temit<Key extends keyof Events>(type: Key, event: Events[Key]): void;\n\temit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt<Events extends Record<EventType, unknown>>(\n\tall?: EventHandlerMap<Events>\n): Emitter<Events> {\n\ttype GenericEventHandler =\n\t\t| Handler<Events[keyof Events]>\n\t\t| WildcardHandler<Events>;\n\tall = all || new Map();\n\n\treturn {\n\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `'*'` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<Key extends keyof Events>(type: Key, handler: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.push(handler);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tall!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * If `handler` is omitted, all handlers of the given type are removed.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from, or `'*'`\n\t\t * @param {Function} [handler] Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\tif (handler) {\n\t\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tall!.set(type, []);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `'*'` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing '*' handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {\n\t\t\tlet handlers = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as EventHandlerList<Events[keyof Events]>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(evt!);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\thandlers = all!.get('*');\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as WildCardEventHandlerList<Events>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(type, evt!);\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\n", "import mitt, { Emitter, Handler } from \"mitt\";\n\ntype SessionHandlerEvent = \"onExpired\" | \"onAuthenticated\";\n\nexport default class SessionHandler {\n\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", "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\tinvariant(arguments.length === 2, \"Incorrect number of arguments passed to the expose function!\");\n\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/${login}${login ? \".\" : \"\"}${hash}.jpg${\n\t\tsizePx ? `?width=${sizePx}` : \"\"\n\t}`;\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 (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", "function getLocalKey(key: string): string {\n\treturn [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n\tisPersisted() {\n\t\treturn true;\n\t}\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", "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"],
|
|
5
|
-
"mappings": "iwBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,oBAAAE,EAAA,gBAAAC,EAAA,iBAAAC,EAAA,oBAAAC,EAAA,WAAAC,EAAA,uBAAAC,EAAA,gBAAAC,EAAA,iBAAAC,EAAA,QAAAC,EAAA,cAAAC,EAAA,iBAAAC,EAAA,aAAAC,EAAA,SAAAC,EAAA,iBAAAC,EAAA,mBAAAC,EAAA,uBAAAC,EAAA,YAAAC,gBCuCCC,EAAAA,CAOA,MAAO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,CAClC,IAAIC,EAAOD,EAAU,MAAM,GAAG,EAE9B,OAAOF,EAAiBC,EAAME,CAAI,CACnC,SAAW,MAAM,QAAQD,CAAS,EAAG,CACpC,IAAIE,EAAeH,EACnB,QAASI,EAAI,EAAGA,EAAIH,EAAU,OAAQG,IACrCD,EAAUA,EAAQF,EAAUG,IAAMD,EAAQF,EAAUG,KAAO,IAAKC,EAGjE,OAAOF,CACR,EAEF,CCAO,SAASG,EACfC,EACAC,EACAC,EAAyB,CAAC,EACnB,
|
|
6
|
-
"names": ["src_exports", "__export", "SessionHandler", "UserSession", "downloadBlob", "downloadRequest", "expose", "getLocalizedString", "getSettings", "getUserImage", "has", "invariant", "localStorage_default", "localize", "mitt_default", "saveSettings", "toLocalISODate", "toLocalISODateTime", "version", "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", "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", "
|
|
4
|
+
"sourcesContent": ["import { UserSession } from \"./UserSession.js\";\nimport \"./errorHandler.js\";\nimport { expose } from \"./expose.js\";\nimport { getLocalizedString } from \"./getLocalizedString.js\";\nimport { localize } from \"./localize.js\";\n\nexport { default as mitt } from \"mitt\";\nexport * from \"./date.js\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport * from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport * from \"./getUserImage.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport * from \"./has.js\";\nexport { invariant } from \"./invariant.js\";\nexport { localize } from \"./localize.js\";\nexport { default as localStorage } from \"./localStorage.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport * from \"./settings.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n\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};\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", "export type EventType = string | symbol;\n\n// An event handler can take an optional event argument\n// and should not return a value\nexport type Handler<T = unknown> = (event: T) => void;\nexport type WildcardHandler<T = Record<string, unknown>> = (\n\ttype: keyof T,\n\tevent: T[keyof T]\n) => void;\n\n// An array of all currently registered event handlers for a type\nexport type EventHandlerList<T = unknown> = Array<Handler<T>>;\nexport type WildCardEventHandlerList<T = Record<string, unknown>> = Array<WildcardHandler<T>>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<\n\tkeyof Events | '*',\n\tEventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>\n>;\n\nexport interface Emitter<Events extends Record<EventType, unknown>> {\n\tall: EventHandlerMap<Events>;\n\n\ton<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;\n\ton(type: '*', handler: WildcardHandler<Events>): void;\n\n\toff<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;\n\toff(type: '*', handler: WildcardHandler<Events>): void;\n\n\temit<Key extends keyof Events>(type: Key, event: Events[Key]): void;\n\temit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt<Events extends Record<EventType, unknown>>(\n\tall?: EventHandlerMap<Events>\n): Emitter<Events> {\n\ttype GenericEventHandler =\n\t\t| Handler<Events[keyof Events]>\n\t\t| WildcardHandler<Events>;\n\tall = all || new Map();\n\n\treturn {\n\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `'*'` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<Key extends keyof Events>(type: Key, handler: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.push(handler);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tall!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * If `handler` is omitted, all handlers of the given type are removed.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from, or `'*'`\n\t\t * @param {Function} [handler] Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\tif (handler) {\n\t\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tall!.set(type, []);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `'*'` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing '*' handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {\n\t\t\tlet handlers = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as EventHandlerList<Events[keyof Events]>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(evt!);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\thandlers = all!.get('*');\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as WildCardEventHandlerList<Events>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(type, evt!);\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\n", "import mitt, { Emitter, Handler } from \"mitt\";\n\ntype SessionHandlerEvent = \"onExpired\" | \"onAuthenticated\";\n\nexport default class SessionHandler {\n\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", "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 (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", "function getLocalKey(key: string): string {\n\treturn [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n\tisPersisted() {\n\t\treturn true;\n\t}\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", "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(userSett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,CAAM,EACjD,OAAI,aAAa,QAAQE,CAAK,IAAM,MACnC,aAAa,WAAWA,CAAK,EACtB,IAEA,EAET,CAEA,OAAQ,CACP,IAAME,EAAUR,EAAY,EAAE,EAE9B,QAASC,KAAO,aACXA,EAAI,MAAM,EAAGO,EAAQ,MAAM,IAAMA,GACpC,aAAa,WAAWP,CAAG,CAG9B,CACD,EAEOQ,EAAQ,IAAIN,EC7CnB,SAASO,EAAOC,EAAkB,CAEjC,MAAO,GADYA,GAAW,GAAG,QAAQ,MACjB,GAAG,YAAY,OACxC,CAEO,SAASC,EAAeC,EAAiBF,EAA4B,CAC3E,GAAI,EAAC,aAAI,aAAa,OAAO,KAE7B,IAAMG,EAAMJ,EAAOC,CAAO,EACpBI,EAAW,KAAK,MAAM,aAAa,QAAQD,CAAG,GAAK,IAAI,EAE7D,OAAID,EACIE,EAASF,IAAY,KAGtBE,CACR,CAEO,SAASC,EAAgBH,EAAiBI,EAAiBN,EAAwB,CACzF,GAAI,EAAC,aAAI,aAAa,OAEtB,IAAMG,EAAMJ,EAAOC,CAAO,EACtBO,EAAe,KAAK,MAAM,aAAa,QAAQJ,CAAG,GAAK,IAAI,EAE3D,OAAOG,EAAU,IACpBC,EAAaL,GAAWI,EAExBC,EAAeL,EAGhB,aAAa,QAAQC,EAAK,KAAK,UAAUI,CAAY,CAAC,CACvD,ClBVO,IAAMC,GAAU",
|
|
6
|
+
"names": ["src_exports", "__export", "SessionHandler", "UserSession", "downloadBlob", "downloadRequest", "expose", "getLocalizedString", "getSettings", "getUserImage", "has", "invariant", "localStorage_default", "localize", "mitt_default", "saveSettings", "toLocalISODate", "toLocalISODateTime", "version", "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", "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", "has", "promise", "fetchLocalizedString", "text", "localize", "stringParts", "args", "invariant", "stringToLocalize", "s", "localized", "getLocalizedString", "arg", "index", "getLocalKey", "key", "_a", "LocalStorage", "global", "defaultValue", "lsKey", "value", "baseKey", "localStorage_default", "getKey", "article", "getSettings", "setting", "key", "settings", "saveSettings", "value", "userSettings", "version"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var af;(af||={}).common=(()=>{var h=Object.defineProperty;var
|
|
1
|
+
var af;(af||={}).common=(()=>{var h=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var O=(e,t)=>{for(var r in t)h(e,r,{get:t[r],enumerable:!0})},k=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _(t))!H.call(e,o)&&o!==r&&h(e,o,{get:()=>t[o],enumerable:!(n=U(t,o))||n.enumerable});return e};var q=e=>k(h({},"__esModule",{value:!0}),e);var V={};O(V,{SessionHandler:()=>l,UserSession:()=>g,downloadBlob:()=>p,downloadRequest:()=>M,expose:()=>b,getLocalizedString:()=>m,getSettings:()=>J,getUserImage:()=>$,has:()=>d,invariant:()=>s,localStorage:()=>E,localize:()=>R,mitt:()=>f,saveSettings:()=>K,toLocalISODate:()=>P,toLocalISODateTime:()=>L,version:()=>Z});function f(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 l=class{eventHandler=f();authenticated(){this.eventHandler.emit("onAuthenticated")}async expired(t,r){try{let n=new Promise(i=>{let a=()=>{this.eventHandler.off("onAuthenticated",a),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="${i}" style="border:0;width:min(500px,100vw);height:min(700px, 100vh);"></iframe>`,document.body.append(o),o.showModal(),await n,o.remove()}}catch{window.location.href=`/login?ReturnUrl=${encodeURIComponent(window.location.pathname)}${encodeURIComponent(window.location.search)}`}}attachEvent(t,r){return this.eventHandler.on(t,r)}detachEvent(t,r){return this.eventHandler.off(t,r)}};var g=class extends l{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 P(e){return e?L(e).substring(0,10):null}function c(e){return String(e).padStart(2,"0")}function L(e){return e?`${e.getFullYear()}-${c(e.getMonth()+1)}-${c(e.getDate())}T${c(e.getHours())}:${c(e.getMinutes())}:${c(e.getSeconds())}.${c(e.getMilliseconds())}`:null}function p(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 s(e,t){if(e)return;let r=typeof t=="function"?t():t;throw new Error(r??"Invariant failed")}async function M(e,{fileName:t,signal:r,onProgress:n}){function o(a){typeof n=="function"&&n({...a})}let i=0;o({status:"requested"});try{let a=await fetch(e);if(!a.ok||!a.body){if(a.headers.get("content-type")?.includes("application/json")){let u=await a.json();s(!u.error,u.error)}throw new Error(`${a.status} ${a.statusText}`)}try{let u=a.body.getReader(),T=new ReadableStream({start:function(v){function z(){return u.read().then(function(y){if(y.done){v.close();return}return i+=y.value.length,o({bytesReceived:i,status:"downloading"}),v.enqueue(y.value),z()})}return z()}});a=new Response(T)}catch{}let N=await a.blob();o({bytesReceived:i,status:"downloaded"}),await p(N,t),o({bytesReceived:i,status:"completed"})}catch(a){r?.aborted?o({status:"cancelled"}):o({error:a.message,status:"error"})}}function d(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var C=/^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 x(e){var t=e.toString().match(C);return s(t,"Unable to parse function!"),{name:t[1],args:t[2].split(","),body:t[3]}}function I(){}I.prototype=Object.create(null);var A=I;function S(e,t){if(typeof e=="object"){if(typeof t=="string"){let r=t.split(".");return S(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 A;return r}}}function b(e,t,r={}){if(Array.isArray(t))for(let n of t){let{name:o}=x(n);s(o,"Unable to detect name of function! Name it, or only supply one function and include name in first parameter."),b(e,n)}else{let n,o;if(typeof t=="function"&&(n=x(t).name),typeof e=="string"){let i=e.split(".");n||(n=i[i.length-1],i=i.slice(0,i.length-1)),o=S(window,i)}else n&&(typeof e=="object"||typeof e=="function")?o=e:s(!1,"Invalid typeof parameter 'name', or unable to parse pValue!");d(o,n)&&r?.overwrite!==!0?console.warn([e,n].join(".")+" is already defined!"):o[n]=t}}var F={xs:64,sm:128,md:256,lg:512,xl:void 0};function $(e,t,r,n="xs"){if(e&&typeof e=="object")return $(e.primKey,e.login,e.hash,e.size);if(!e||!r)return"";let o=F[n];return`/api/data/blob/EmployeesLookup/${e}/Image/${encodeURIComponent(t??"")}${t?".":""}${encodeURIComponent(r)}.jpg${o?`?width=${o}`:""}`}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 m(e,t){if(typeof e=="string"&&e.trim().length===0)return e;if(!(e===void 0||e===""||e===null))if(af?.article?.i18n!==void 0){if(!d(af.article.i18n,e)){af.article.i18n[e]=e;let r=B(e).then(n=>(af.article.i18n[e]=n,n));if(t)return r}return af.article.i18n[e]}else return e}function R(e,...t){s(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:`${o}$${i}`).join(""),n=m(r);return t.forEach((o,i)=>{n=n.replace("$"+i,o)}),n}function j(e){return[af?.article?.id||"","common",e].join(".")}var w=class{isPersisted(){return!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)}},E=new w;function D(e){return`${e||af.article.id}.${af.userSession.login}`}function J(e,t){if(!af?.userSession)return null;let r=D(t),n=JSON.parse(localStorage.getItem(r)||"{}");return e?n[e]||null:n}function K(e,t,r){if(!af?.userSession)return;let n=D(r),o=JSON.parse(localStorage.getItem(n)||"{}");typeof t<"u"?o[e]=t:o=e,localStorage.setItem(n,JSON.stringify(o))}var Z="2.5.2";return q(V);})();
|
|
2
2
|
//# sourceMappingURL=af.common.min.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts", "../../../../node_modules/mitt/src/index.ts", "../../src/SessionHandler.ts", "../../src/UserSession.ts", "../../src/errorHandler.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/localStorage.ts", "../../src/settings.ts"],
|
|
4
|
-
"sourcesContent": ["import { UserSession } from \"./UserSession.js\";\nimport \"./errorHandler.js\";\nimport { expose } from \"./expose.js\";\nimport { getLocalizedString } from \"./getLocalizedString.js\";\nimport { localize } from \"./localize.js\";\n\nexport { default as mitt } from \"mitt\";\nexport * from \"./date.js\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport * from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport * from \"./getUserImage.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport * from \"./has.js\";\nexport { invariant } from \"./invariant.js\";\nexport { localize } from \"./localize.js\";\nexport { default as localStorage } from \"./localStorage.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport * from \"./settings.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n\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};\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", "export type EventType = string | symbol;\n\n// An event handler can take an optional event argument\n// and should not return a value\nexport type Handler<T = unknown> = (event: T) => void;\nexport type WildcardHandler<T = Record<string, unknown>> = (\n\ttype: keyof T,\n\tevent: T[keyof T]\n) => void;\n\n// An array of all currently registered event handlers for a type\nexport type EventHandlerList<T = unknown> = Array<Handler<T>>;\nexport type WildCardEventHandlerList<T = Record<string, unknown>> = Array<WildcardHandler<T>>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<\n\tkeyof Events | '*',\n\tEventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>\n>;\n\nexport interface Emitter<Events extends Record<EventType, unknown>> {\n\tall: EventHandlerMap<Events>;\n\n\ton<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;\n\ton(type: '*', handler: WildcardHandler<Events>): void;\n\n\toff<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;\n\toff(type: '*', handler: WildcardHandler<Events>): void;\n\n\temit<Key extends keyof Events>(type: Key, event: Events[Key]): void;\n\temit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt<Events extends Record<EventType, unknown>>(\n\tall?: EventHandlerMap<Events>\n): Emitter<Events> {\n\ttype GenericEventHandler =\n\t\t| Handler<Events[keyof Events]>\n\t\t| WildcardHandler<Events>;\n\tall = all || new Map();\n\n\treturn {\n\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `'*'` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<Key extends keyof Events>(type: Key, handler: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.push(handler);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tall!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * If `handler` is omitted, all handlers of the given type are removed.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from, or `'*'`\n\t\t * @param {Function} [handler] Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\tif (handler) {\n\t\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tall!.set(type, []);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `'*'` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing '*' handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {\n\t\t\tlet handlers = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as EventHandlerList<Events[keyof Events]>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(evt!);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\thandlers = all!.get('*');\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as WildCardEventHandlerList<Events>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(type, evt!);\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\n", "import mitt, { Emitter, Handler } from \"mitt\";\n\ntype SessionHandlerEvent = \"onExpired\" | \"onAuthenticated\";\n\nexport default class SessionHandler {\n\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", "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\tinvariant(arguments.length === 2, \"Incorrect number of arguments passed to the expose function!\");\n\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/${login}${login ? \".\" : \"\"}${hash}.jpg${\n\t\tsizePx ? `?width=${sizePx}` : \"\"\n\t}`;\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 (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", "function getLocalKey(key: string): string {\n\treturn [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n\tisPersisted() {\n\t\treturn true;\n\t}\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", "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"],
|
|
5
|
-
"mappings": "0bAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,gBAAAC,EAAA,iBAAAC,EAAA,oBAAAC,EAAA,WAAAC,EAAA,uBAAAC,EAAA,gBAAAC,EAAA,iBAAAC,EAAA,QAAAC,EAAA,cAAAC,EAAA,iBAAAC,EAAA,aAAAC,EAAA,SAAAC,EAAA,iBAAAC,EAAA,mBAAAC,EAAA,uBAAAC,EAAA,YAAAC,eCuCCC,EAAAA,CAOA,MAAO,CAKNA,IAPDA,EAAMA,GAAO,IAAIC,IAehBC,GAAAA,SAA6BC,EAAWC,EAAAA,CACvC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,EACHA,EAASE,KAAKH,CAAAA,EAGdJ,EAAKQ,IAAIL,EAAM,CAACC,CAAAA,CAAAA,CAAAA,EAWlBK,IAAAA,SAA8BN,EAAWC,EAAAA,CACxC,IAAMC,EAAmDL,EAAKM,IAAIH,CAAAA,EAC9DE,IACCD,EACHC,EAASK,OAAOL,EAASM,QAAQP,CAAAA,IAAa,EAAG,CAAA,EAGjDJ,EAAKQ,IAAIL,EAAM,CAAA,CAAA,EAAA,EAelBS,KAAAA,SAA+BT,EAAWU,EAAAA,CACzC,IAAIR,EAAWL,EAAKM,IAAIH,CAAAA,EACpBE,GACFA,EACCS,MAAAA,EACAC,IAAI,SAACX,EAAAA,CACLA,EAAQS,CAAAA,CAAAA,CAAAA,GAIXR,EAAWL,EAAKM,IAAI,GAAA,IAElBD,EACCS,MAAAA,EACAC,IAAI,SAACX,EAAAA,CACLA,EAAQD,EAAMU,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CC7GpB,IAAqBG,EAArB,KAAoC,CAC3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AAIC,EAAOD,EAAU,MAAM,GAAG,EAE9B,OAAOF,EAAiBC,EAAME,CAAI,CACnC,SAAW,MAAM,QAAQD,CAAS,EAAG,CACpC,IAAIE,EAAeH,EACnB,QAASI,EAAI,EAAGA,EAAIH,EAAU,OAAQG,IACrCD,EAAUA,EAAQF,EAAUG,IAAMD,EAAQF,EAAUG,KAAO,IAAKC,EAGjE,OAAOF,CACR,EAEF,CCAO,SAASG,EACfC,EACAC,EACAC,EAAyB,CAAC,EACnB,
|
|
6
|
-
"names": ["src_exports", "__export", "SessionHandler", "UserSession", "downloadBlob", "downloadRequest", "expose", "getLocalizedString", "getSettings", "getUserImage", "has", "invariant", "localStorage_default", "localize", "mitt_default", "saveSettings", "toLocalISODate", "toLocalISODateTime", "version", "all", "Map", "on", "type", "handler", "handlers", "get", "push", "set", "off", "splice", "indexOf", "emit", "evt", "slice", "map", "SessionHandler", "mitt_default", "callback", "type", "authPromise", "resolve", "eventHandler", "dialog", "link", "eventName", "handler", "UserSession", "SessionHandler", "userData", "event", "data", "toLocalISODate", "date", "toLocalISODateTime", "pad", "num", "downloadBlob", "blob", "fileName", "resolve", "reject", "url", "parent", "anchor", "ex", "invariant", "condition", "message", "provided", "downloadRequest", "request", "fileName", "signal", "onProgress", "reportProgress", "progress", "bytesReceived", "response", "data", "invariant", "reader", "stream", "controller", "pump", "read", "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", "
|
|
4
|
+
"sourcesContent": ["import { UserSession } from \"./UserSession.js\";\nimport \"./errorHandler.js\";\nimport { expose } from \"./expose.js\";\nimport { getLocalizedString } from \"./getLocalizedString.js\";\nimport { localize } from \"./localize.js\";\n\nexport { default as mitt } from \"mitt\";\nexport * from \"./date.js\";\nexport { downloadBlob } from \"./downloadBlob.js\";\nexport * from \"./downloadRequest.js\";\nexport { expose } from \"./expose.js\";\nexport * from \"./getUserImage.js\";\nexport { getLocalizedString } from \"./getLocalizedString.js\";\nexport * from \"./has.js\";\nexport { invariant } from \"./invariant.js\";\nexport { localize } from \"./localize.js\";\nexport { default as localStorage } from \"./localStorage.js\";\nexport { default as SessionHandler } from \"./SessionHandler.js\";\nexport { UserSession };\nexport * from \"./settings.js\";\n\nexport const version = __VERSION__;\n\ndeclare global {\n\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};\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", "export type EventType = string | symbol;\n\n// An event handler can take an optional event argument\n// and should not return a value\nexport type Handler<T = unknown> = (event: T) => void;\nexport type WildcardHandler<T = Record<string, unknown>> = (\n\ttype: keyof T,\n\tevent: T[keyof T]\n) => void;\n\n// An array of all currently registered event handlers for a type\nexport type EventHandlerList<T = unknown> = Array<Handler<T>>;\nexport type WildCardEventHandlerList<T = Record<string, unknown>> = Array<WildcardHandler<T>>;\n\n// A map of event types and their corresponding event handlers.\nexport type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<\n\tkeyof Events | '*',\n\tEventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>\n>;\n\nexport interface Emitter<Events extends Record<EventType, unknown>> {\n\tall: EventHandlerMap<Events>;\n\n\ton<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;\n\ton(type: '*', handler: WildcardHandler<Events>): void;\n\n\toff<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;\n\toff(type: '*', handler: WildcardHandler<Events>): void;\n\n\temit<Key extends keyof Events>(type: Key, event: Events[Key]): void;\n\temit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;\n}\n\n/**\n * Mitt: Tiny (~200b) functional event emitter / pubsub.\n * @name mitt\n * @returns {Mitt}\n */\nexport default function mitt<Events extends Record<EventType, unknown>>(\n\tall?: EventHandlerMap<Events>\n): Emitter<Events> {\n\ttype GenericEventHandler =\n\t\t| Handler<Events[keyof Events]>\n\t\t| WildcardHandler<Events>;\n\tall = all || new Map();\n\n\treturn {\n\n\t\t/**\n\t\t * A Map of event names to registered handler functions.\n\t\t */\n\t\tall,\n\n\t\t/**\n\t\t * Register an event handler for the given type.\n\t\t * @param {string|symbol} type Type of event to listen for, or `'*'` for all events\n\t\t * @param {Function} handler Function to call in response to given event\n\t\t * @memberOf mitt\n\t\t */\n\t\ton<Key extends keyof Events>(type: Key, handler: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\thandlers.push(handler);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tall!.set(type, [handler] as EventHandlerList<Events[keyof Events]>);\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Remove an event handler for the given type.\n\t\t * If `handler` is omitted, all handlers of the given type are removed.\n\t\t * @param {string|symbol} type Type of event to unregister `handler` from, or `'*'`\n\t\t * @param {Function} [handler] Handler function to remove\n\t\t * @memberOf mitt\n\t\t */\n\t\toff<Key extends keyof Events>(type: Key, handler?: GenericEventHandler) {\n\t\t\tconst handlers: Array<GenericEventHandler> | undefined = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\tif (handler) {\n\t\t\t\t\thandlers.splice(handlers.indexOf(handler) >>> 0, 1);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tall!.set(type, []);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Invoke all handlers for the given type.\n\t\t * If present, `'*'` handlers are invoked after type-matched handlers.\n\t\t *\n\t\t * Note: Manually firing '*' handlers is not supported.\n\t\t *\n\t\t * @param {string|symbol} type The event type to invoke\n\t\t * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler\n\t\t * @memberOf mitt\n\t\t */\n\t\temit<Key extends keyof Events>(type: Key, evt?: Events[Key]) {\n\t\t\tlet handlers = all!.get(type);\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as EventHandlerList<Events[keyof Events]>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(evt!);\n\t\t\t\t\t});\n\t\t\t}\n\n\t\t\thandlers = all!.get('*');\n\t\t\tif (handlers) {\n\t\t\t\t(handlers as WildCardEventHandlerList<Events>)\n\t\t\t\t\t.slice()\n\t\t\t\t\t.map((handler) => {\n\t\t\t\t\t\thandler(type, evt!);\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t};\n}\n", "import mitt, { Emitter, Handler } from \"mitt\";\n\ntype SessionHandlerEvent = \"onExpired\" | \"onAuthenticated\";\n\nexport default class SessionHandler {\n\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", "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 (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", "function getLocalKey(key: string): string {\n\treturn [af?.article?.id || \"\", \"common\", key].join(\".\");\n}\n\nclass LocalStorage {\n\tisPersisted() {\n\t\treturn true;\n\t}\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", "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"],
|
|
5
|
+
"mappings": "0bAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EA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tBO,EAAe,KAAK,MAAM,aAAa,QAAQJ,CAAG,GAAK,IAAI,EAE3D,OAAOG,EAAU,IACpBC,EAAaL,GAAWI,EAExBC,EAAeL,EAGhB,aAAa,QAAQC,EAAK,KAAK,UAAUI,CAAY,CAAC,CACvD,ClBVO,IAAMC,EAAU",
|
|
6
|
+
"names": ["src_exports", "__export", "SessionHandler", "UserSession", "downloadBlob", "downloadRequest", "expose", "getLocalizedString", "getSettings", "getUserImage", "has", "invariant", "localStorage_default", "localize", "mitt_default", "saveSettings", "toLocalISODate", "toLocalISODateTime", "version", "all", "Map", "on", "type", "handler", "handlers", "get", "push", "set", "off", "splice", "indexOf", "emit", "evt", "slice", "map", "SessionHandler", "mitt_default", "callback", "type", "authPromise", "resolve", "eventHandler", "dialog", "link", "eventName", "handler", "UserSession", "SessionHandler", "userData", "event", "data", "toLocalISODate", "date", "toLocalISODateTime", "pad", "num", "downloadBlob", "blob", "fileName", "resolve", "reject", "url", "parent", "anchor", "ex", "invariant", "condition", "message", "provided", "downloadRequest", "request", "fileName", "signal", "onProgress", "reportProgress", "progress", "bytesReceived", "response", "data", "invariant", "reader", "stream", "controller", "pump", "read", "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", "getLocalizedString", "string", "wait", "has", "promise", "fetchLocalizedString", "text", "localize", "stringParts", "args", "invariant", "stringToLocalize", "s", "localized", "getLocalizedString", "arg", "index", "getLocalKey", "key", "LocalStorage", "global", "defaultValue", "lsKey", "value", "baseKey", "localStorage_default", "getKey", "article", "getSettings", "setting", "key", "settings", "saveSettings", "value", "userSettings", "version"]
|
|
7
7
|
}
|
package/es/expose.js
CHANGED
|
@@ -8,7 +8,6 @@ import { requireNamespace } from "./requireNamespace.js";
|
|
|
8
8
|
* @param value {object | Function | Function[]} The value(s) to expose
|
|
9
9
|
*/
|
|
10
10
|
export function expose(name, value, options = {}) {
|
|
11
|
-
invariant(arguments.length === 2, "Incorrect number of arguments passed to the expose function!");
|
|
12
11
|
if (Array.isArray(value)) {
|
|
13
12
|
for (let func of value) {
|
|
14
13
|
const { name: funcName } = parseFunc(func);
|
package/es/getUserImage.js
CHANGED
|
@@ -13,5 +13,5 @@ export function getUserImage(primKeyOrOptions, login, hash, size = "xs") {
|
|
|
13
13
|
return "";
|
|
14
14
|
}
|
|
15
15
|
let sizePx = sizeMap[size];
|
|
16
|
-
return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${login}${login ? "." : ""}${hash}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
|
|
16
|
+
return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${encodeURIComponent(login ?? "")}${login ? "." : ""}${encodeURIComponent(hash)}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
|
|
17
17
|
}
|
package/es/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@olenbetong/appframe-core",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "Javascript libraries to utilize the Appframe framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"chalk": "^5.1.2"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "b15f380e09dac10e7e1893cbecce95945ccc2c7c"
|
|
52
52
|
}
|
package/src/expose.ts
CHANGED
|
@@ -20,8 +20,6 @@ export function expose(
|
|
|
20
20
|
value: object | Function | Function[],
|
|
21
21
|
options: ExposeOptions = {}
|
|
22
22
|
): void {
|
|
23
|
-
invariant(arguments.length === 2, "Incorrect number of arguments passed to the expose function!");
|
|
24
|
-
|
|
25
23
|
if (Array.isArray(value)) {
|
|
26
24
|
for (let func of value) {
|
|
27
25
|
const { name: funcName } = parseFunc(func);
|
package/src/getUserImage.ts
CHANGED
|
@@ -60,7 +60,7 @@ export function getUserImage(
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
let sizePx = sizeMap[size];
|
|
63
|
-
return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${login
|
|
64
|
-
|
|
65
|
-
}`;
|
|
63
|
+
return `/api/data/blob/EmployeesLookup/${primKeyOrOptions}/Image/${encodeURIComponent(login ?? "")}${
|
|
64
|
+
login ? "." : ""
|
|
65
|
+
}${encodeURIComponent(hash)}.jpg${sizePx ? `?width=${sizePx}` : ""}`;
|
|
66
66
|
}
|