{"version":3,"sources":["main/core/translator.js","main/core/translator.ts","main/core/log.js","main/core/log.ts","main/core/localstorage.js","main/core/localstorage.ts","public/public.js","public/public.ts"],"names":["T","args","appn","translator","getString","TP","getPluralString","_a","_b","_c","template","shift","resx","cleanKey","getResourceKeyFor","undefined","isDebug","isTestSuiteRequest","missing","JSON","parse","localStorage","getItem","culture","includes","push","setItem","stringify","length","formatString","val","params","replace","match","index","zero","one","other","two","few","many","number","plurals","find","r","Min","Max","Type","CLDRType","One","Two","Few","Many","text","normed","normaliseString","cleaned","substring","RESXKEYLENGTH","getPersistentHashCode","str","hash1","iadd","hash2","i","charCodeAt","Math","abs","imul","i32","value","a","b","log","log_1","_loggingEnabled","init","enabledFromLs","LogLevel","message","logLevel","Info","console","Warning","warn","Error","error","Debug","debug","info","includeCallStack","stack","warning","PerfTimer","start","time0","performance","now","stop","time1","timeDelta","title","toFixed","constructor","emptyString","_clearLsKey","key","item","lsValue","window","e","isSet","removeItem","clearAll","clear","autoClearLs","hasLsBeenAutoCleared","clearAllAndSetFreshLs","emptyGuid","String","prototype","endsWithIgnoreCase","stringToFind","dontTrim","toLowerCase","endsWith","trim"],"mappings":"AAAA,aCIA,MAAMA,EAAI,SAAS,GAAGC,IAAW,EAAI,OAAOC,KAAKC,UAAU,CAACC,SAAS,IAAIH,KAAO,EAChF,MAAMI,GAAK,SAAS,GAAGJ,IAAW,EAAI,OAAOC,KAAKC,UAAU,CAACG,eAAe,IAAIL,KAAO,EAEvF,IAAUC,KAAV,CAAA,SAAUA,IAAI,EAAC,IAAAC,WAAA,CAAA,SAAAA,UAAU,EAMrB,SAAgBC,UAAU,GAAGH,IAAW,EDLhC,IAAIM,GAAIC,GAAIC,GCMhB,IAAIC,SAAW,AAAY,OAAZH,CAAAA,GAAAN,KAAKU,KAAK,EAAA,GAAEJ,AAAA,KAAA,IAAAA,GAAAA,GAAI,GAE/B,GAAIL,KAAKC,UAAU,CAACS,IAAI,CAAE,CACtB,IAAIC,SAAWC,kBAAk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,IAAMC,qBAAuBlH,KAAKmB,YAAY,CAACC,OAAO,CAACmF,aACvD,GAAIW,qBACA,OAGJC,uBACJ,CAPgBhG,aAAA8F,WAAW,CAAAA,YAY3B,SAAgBE,wBACZnH,KAAKmB,YAAY,CAAC4F,QAAQ,GAC1B/G,KAAKmB,YAAY,CAACK,OAAO,CAAC+E,YAAa,KAC3C,CAHgBpF,aAAAgG,qBAAqB,CAAAA,qBAIzC,CAAA,EAvFehG,aAAAnB,KAAAmB,YAAY,EAAZnB,CAAAA,KAAAmB,YAAY,CAAA,CAAA,CAAA,EAuF3B,CAAA,EAvFUnB,MAAAA,CAAAA,KAAI,CAAA,CAAA;ACLd,aCGA,IAAUA,KAAV,CAAA,SAAUA,IAAI,EAIGA,KAAAc,OAAO,CAAYd,KAAKc,OAAO,AAK/Bd,CAAAA,KAAAe,kBAAkB,CAAYf,KAAKe,kBAAkB,AAKrDf,CAAAA,KAAAoH,SAAS,CAAWpH,KAAKoH,SAAS,AAKlCpH,CAAAA,KAAAsG,WAAW,CAAW,EAEnCe,CAAAA,OAAOC,SAAS,CAACC,kBAAkB,CAAG,SAASC,YAAoB,CAAEC,QAAiB,EAClF,GAAIA,SACA,OAAO,IAAI,CAACC,WAAW,GAAGC,QAAQ,CAACH,aAAaE,WAAW,IAE/D,OAAO,IAAI,CAACE,IAAI,GAAGF,WAAW,GAAGC,QAAQ,CAACH,aAAaI,IAAI,GAAGF,WAAW,GAC7E,CACJ,CAAA,EA3BU1H,MAAAA,CAAAA,KAAI,CAAA,CAAA","file":"content/platform/public.min.js","sourcesContent":["\"use strict\";\nconst T = function (...args) { return appn.translator.getString(...args); };\nconst TP = function (...args) { return appn.translator.getPluralString(...args); };\nvar appn;\n(function (appn) {\n var translator;\n (function (translator) {\n function getString(...args) {\n var _a, _b, _c;\n let template = (_a = args.shift()) !== null && _a !== void 0 ? _a : '';\n if (appn.translator.resx) {\n let cleanKey = getResourceKeyFor(template);\n if (appn.translator.resx[cleanKey] !== undefined)\n template = appn.translator.resx[cleanKey];\n else if (appn.isDebug || appn.isTestSuiteRequest) {\n let missing = (_c = JSON.parse((_b = appn.localStorage.getItem('appn.missingkeys')) !== null && _b !== void 0 ? _b : '{}')) !== null && _c !== void 0 ? _c : {};\n if (missing[translator.culture] === undefined)\n missing[translator.culture] = [];\n if (!missing[translator.culture].includes(template)) {\n missing[translator.culture].push(template);\n appn.localStorage.setItem('appn.missingkeys', JSON.stringify(missing));\n }\n }\n }\n if (args.length === 0)\n return template;\n return formatString(template, args);\n }\n translator.getString = getString;\n ;\n function formatString(val, params) {\n return val.replace(/{(\\d+)}/g, (match, index) => {\n return typeof params[index] !== 'undefined' ? params[index] : match;\n });\n }\n function getPluralString(...args) {\n let zero = args.shift();\n let one = args.shift();\n let other = args.shift();\n let two = other;\n let few = other;\n let many = other;\n if (args.length > 1) {\n few = args.shift();\n many = args.shift();\n other = args.shift();\n }\n let number = args.shift();\n if (number === 0)\n return getString(zero);\n var match = translator.plurals.find(r => r.Min <= number && number <= r.Max);\n switch (match === null || match === void 0 ? void 0 : match.Type) {\n case CLDRType.One:\n return getString(one);\n case CLDRType.Two:\n return getString(two, number);\n case CLDRType.Few:\n return getString(few, number);\n case CLDRType.Many:\n return getString(many, number);\n default:\n return getString(other, number);\n }\n }\n translator.getPluralString = getPluralString;\n function getResourceKeyFor(text) {\n var normed = normaliseString(text);\n var cleaned = normed.substring(0, translator.RESXKEYLENGTH)\n .replace(/\\s+/g, '_')\n .replace(/[^\\p{L}\\p{N}_]+/gu, '');\n return `${cleaned}_${getPersistentHashCode(normed)}`;\n }\n translator.getResourceKeyFor = getResourceKeyFor;\n function normaliseString(val) {\n return val.replace('/\\r/g', '').replace(/[ \\t]{2,}/g, ' ');\n }\n translator.normaliseString = normaliseString;\n function getPersistentHashCode(str) {\n let hash1 = iadd(5381 << 16, 5381);\n let hash2 = hash1;\n for (let i = 0; i < str.length; i += 2) {\n hash1 = iadd(hash1 << 5, hash1) ^ str.charCodeAt(i);\n if (i === str.length - 1) {\n break;\n }\n hash2 = iadd(hash2 << 5, hash2) ^ str.charCodeAt(i + 1);\n }\n return Math.abs(iadd(hash1, Math.imul(hash2, 1566083941)));\n }\n translator.getPersistentHashCode = getPersistentHashCode;\n function i32(value) {\n return value | 0;\n }\n translator.i32 = i32;\n function iadd(a, b) {\n return ((a | 0) + (b | 0)) | 0;\n }\n translator.iadd = iadd;\n let CLDRType;\n (function (CLDRType) {\n CLDRType[CLDRType[\"One\"] = 0] = \"One\";\n CLDRType[CLDRType[\"Two\"] = 1] = \"Two\";\n CLDRType[CLDRType[\"Few\"] = 2] = \"Few\";\n CLDRType[CLDRType[\"Many\"] = 3] = \"Many\";\n CLDRType[CLDRType[\"Other\"] = 4] = \"Other\";\n })(CLDRType = translator.CLDRType || (translator.CLDRType = {}));\n })(translator = appn.translator || (appn.translator = {}));\n})(appn || (appn = {}));\n","/**\n * Wrapper and manager for resources strings, matches in with how we do server-side translations.\n */\n\nconst T = function(...args: any[]) { return appn.translator.getString(...args); };\nconst TP = function(...args: any[]) { return appn.translator.getPluralString(...args); };\n\nnamespace appn.translator {\n export let resx: any; // populated by server\n export let RESXKEYLENGTH: number; //\n export let plurals: Array; //\n export let culture: string; //\n\n export function getString(...args: any[]): string {\n let template = args.shift() ?? '';\n\n if (appn.translator.resx) {\n let cleanKey = getResourceKeyFor(template);\n if (appn.translator.resx[cleanKey] !== undefined)\n template = appn.translator.resx[cleanKey];\n // track missing keys if test/debug\n else if (appn.isDebug || appn.isTestSuiteRequest) {\n let missing = JSON.parse(localStorage.getItem('appn.missingkeys') ?? '{}') ?? {};\n if (missing[culture] === undefined)\n missing[culture] = [];\n if (!missing[culture].includes(template)) {\n missing[culture].push(template);\n localStorage.setItem('appn.missingkeys', JSON.stringify(missing));\n }\n }\n }\n\n if (args.length === 0)\n return template;\n\n return formatString(template, args);\n };\n\n function formatString(val: string, params: string[]): string {\n return val.replace(/{(\\d+)}/g, (match, index) => {\n return typeof params[index] !== 'undefined' ? params[index] : match;\n });\n }\n\n export function getPluralString(...args: any[]): string {\n let zero = args.shift() as string;\n let one = args.shift() as string;\n\n // we init under assumption of this being the shortcut 4 param call\n let other = args.shift() as string;\n let two = other;\n let few = other;\n let many = other;\n\n // this must be the full 7 param call, so reinit accordingly\n if (args.length > 1) {\n few = args.shift() as string;\n many = args.shift() as string;\n other = args.shift() as string;\n }\n let number = args.shift() as number;\n\n if (number === 0)\n return getString(zero);\n\n var match = plurals.find(r => r.Min <= number && number <= r.Max);\n\n switch (match?.Type) {\n case CLDRType.One:\n return getString(one);\n case CLDRType.Two:\n return getString(two, number);\n case CLDRType.Few:\n return getString(few, number);\n case CLDRType.Many:\n return getString(many, number);\n default:\n return getString(other, number);\n }\n }\n\n // NB: This *must* match with server-side implementation.\n export function getResourceKeyFor(text: string): string {\n var normed = normaliseString(text);\n\n var cleaned = normed.substring(0, RESXKEYLENGTH)\n .replace(/\\s+/g, '_')\n // Explicitly select anything not in unicode letters, numbers, and underscores. JS does not support all unicode characters using \\W.\n .replace(/[^\\p{L}\\p{N}_]+/gu, '');\n\n return `${cleaned}_${getPersistentHashCode(normed)}`;\n }\n\n // NB: This *must* match with server-side implementation.\n export function normaliseString(val: string): string {\n return val.replace('/\\r/g', '').replace(/[ \\t]{2,}/g, ' ');\n }\n\n // uses 32 bit integer operations to handle int32 overflow same as C#\n export function getPersistentHashCode(str: string): number {\n let hash1 = iadd(5381 << 16, 5381);\n let hash2 = hash1;\n for (let i = 0; i < str.length; i += 2) {\n hash1 = iadd(hash1 << 5, hash1) ^ str.charCodeAt(i);\n if (i === str.length - 1) {\n break;\n }\n hash2 = iadd(hash2 << 5, hash2) ^ str.charCodeAt(i + 1);\n }\n return Math.abs(iadd(hash1, Math.imul(hash2, 1566083941)));\n }\n\n export function i32(value: number): number {\n return value | 0;\n }\n\n export function iadd(a: number, b: number): number {\n return ((a | 0) + (b | 0)) | 0;\n }\n\n export interface PluralRule {\n Type: CLDRType;\n Min: number;\n Max: number;\n }\n\n export enum CLDRType {\n One,\n Two,\n Few,\n Many,\n Other\n }\n}\n","\"use strict\";\nvar appn;\n(function (appn) {\n var log;\n (function (log_1) {\n let _loggingEnabled = false;\n function init() {\n if (appn.isDebug) {\n _loggingEnabled = true;\n return;\n }\n const enabledFromLs = appn.localStorage.getItem('loggingEnabled');\n _loggingEnabled = enabledFromLs ? true : false;\n }\n log_1.init = init;\n let LogLevel;\n (function (LogLevel) {\n LogLevel[LogLevel[\"Info\"] = 0] = \"Info\";\n LogLevel[LogLevel[\"Warning\"] = 1] = \"Warning\";\n LogLevel[LogLevel[\"Error\"] = 2] = \"Error\";\n LogLevel[LogLevel[\"Debug\"] = 3] = \"Debug\";\n })(LogLevel || (LogLevel = {}));\n function log(message, logLevel) {\n if (!_loggingEnabled)\n return;\n switch (logLevel) {\n case LogLevel.Info: {\n console.log(message);\n break;\n }\n case LogLevel.Warning: {\n console.warn(message);\n break;\n }\n case LogLevel.Error: {\n console.error(message);\n break;\n }\n case LogLevel.Debug: {\n console.debug(message);\n break;\n }\n }\n }\n function info(message, includeCallStack) {\n log(message, LogLevel.Info);\n if (includeCallStack)\n appn.log.debug(new Error().stack);\n }\n log_1.info = info;\n function warning(message, includeCallStack) {\n log(message, LogLevel.Warning);\n if (includeCallStack)\n appn.log.debug(new Error().stack);\n }\n log_1.warning = warning;\n function error(message, includeCallStack) {\n log(message, LogLevel.Error);\n if (includeCallStack)\n appn.log.debug(new Error().stack);\n }\n log_1.error = error;\n function debug(message, includeCallStack) {\n log(message, LogLevel.Debug);\n if (includeCallStack)\n appn.log.debug(new Error().stack);\n }\n log_1.debug = debug;\n class PerfTimer {\n constructor(title) {\n this.time0 = 0;\n this.time1 = 0;\n this.title = appn.emptyString;\n this.title = title;\n }\n start() {\n this.time0 = performance.now();\n }\n stop() {\n this.time1 = performance.now();\n const timeDelta = (this.time1 - this.time0);\n const message = `${this.title}: ${timeDelta.toFixed(5)} ms`;\n appn.log.info(message);\n return message;\n }\n }\n log_1.PerfTimer = PerfTimer;\n })(log = appn.log || (appn.log = {}));\n})(appn || (appn = {}));\n","namespace appn.log {\n\n let _loggingEnabled = false;\n\n export function init() {\n\n if (appn.isDebug) {\n _loggingEnabled = true;\n return;\n }\n\n const enabledFromLs = appn.localStorage.getItem('loggingEnabled');\n _loggingEnabled = enabledFromLs ? true : false;\n }\n\n enum LogLevel {\n Info,\n Warning,\n Error,\n Debug\n }\n\n function log(message: any, logLevel?: LogLevel) {\n if (!_loggingEnabled)\n return;\n\n // Do stuff before\n\n switch (logLevel) {\n case LogLevel.Info: {\n console.log(message);\n break;\n }\n case LogLevel.Warning: {\n console.warn(message);\n break;\n }\n case LogLevel.Error: {\n console.error(message);\n break;\n }\n case LogLevel.Debug: {\n console.debug(message);\n break;\n }\n }\n\n // Do stuff after\n }\n\n export function info(message: any, includeCallStack?: boolean) {\n log(message, LogLevel.Info);\n\n if (includeCallStack)\n appn.log.debug(new Error().stack);\n }\n\n export function warning(message: any, includeCallStack?: boolean) {\n log(message, LogLevel.Warning);\n\n if (includeCallStack)\n appn.log.debug(new Error().stack);\n }\n\n export function error(message: any, includeCallStack?: boolean) {\n log(message, LogLevel.Error);\n\n if (includeCallStack)\n appn.log.debug(new Error().stack);\n }\n\n export function debug(message: any, includeCallStack?: boolean) {\n log(message, LogLevel.Debug);\n\n if (includeCallStack)\n appn.log.debug(new Error().stack);\n }\n\n export class PerfTimer {\n time0: number = 0;\n time1: number = 0;\n title: string = appn.emptyString;\n\n constructor(title: string) {\n this.title = title;\n }\n\n start(): void {\n this.time0 = performance.now();\n }\n\n stop(): string {\n this.time1 = performance.now();\n const timeDelta = (this.time1 - this.time0);\n const message = `${this.title}: ${timeDelta.toFixed(5)} ms`;\n appn.log.info(message);\n return message;\n }\n }\n\n}\n","\"use strict\";\nvar appn;\n(function (appn) {\n var localStorage;\n (function (localStorage) {\n const _clearLsKey = 'freshLs-Web30Mar2022';\n function getItem(key) {\n let item = null;\n try {\n const lsValue = window.localStorage.getItem(key);\n item = lsValue ? JSON.parse(lsValue) : null;\n }\n catch (e) {\n if (e && e.message)\n console.log(e.message);\n }\n return item;\n }\n localStorage.getItem = getItem;\n function setItem(key, value) {\n let isSet = true;\n try {\n window.localStorage.setItem(key, JSON.stringify(value));\n }\n catch (e) {\n isSet = false;\n if (e && e.message)\n appn.log.error(e.message, true);\n }\n return isSet;\n }\n localStorage.setItem = setItem;\n function removeItem(key) {\n try {\n window.localStorage.removeItem(key);\n }\n catch (e) {\n if (e && e.message)\n console.log(e.message);\n }\n }\n localStorage.removeItem = removeItem;\n function clearAll() {\n try {\n window.localStorage.clear();\n }\n catch (e) {\n if (e && e.message)\n console.log(e.message);\n }\n }\n localStorage.clearAll = clearAll;\n function autoClearLs() {\n const hasLsBeenAutoCleared = appn.localStorage.getItem(_clearLsKey);\n if (hasLsBeenAutoCleared)\n return;\n clearAllAndSetFreshLs();\n }\n localStorage.autoClearLs = autoClearLs;\n function clearAllAndSetFreshLs() {\n appn.localStorage.clearAll();\n appn.localStorage.setItem(_clearLsKey, true);\n }\n localStorage.clearAllAndSetFreshLs = clearAllAndSetFreshLs;\n })(localStorage = appn.localStorage || (appn.localStorage = {}));\n})(appn || (appn = {}));\n","/**\n * A wrapper for local storage with error handling\n * Wraps local storage gets, sets and removes and saves and parses objects instead of strings\n * Allows use of serialized objects\n */\nnamespace appn.localStorage {\n /**\n * Change the date here to ensure a fresh local storage on next load\n */\n const _clearLsKey: string = 'freshLs-Web30Mar2022';\n\n /**\n * Gets an object from localstorage\n * @param key\n */\n export function getItem(key: string): any {\n let item = null;\n\n try {\n const lsValue: any = window.localStorage.getItem(key);\n item = lsValue ? JSON.parse(lsValue) : null;\n } catch (e: any) {\n if (e && e.message)\n console.log(e.message);\n }\n\n return item;\n }\n\n /**\n * Creates or Updates an object in localstorage\n * @param key\n * @param value\n */\n export function setItem(key: string, value: any) {\n let isSet = true;\n\n try {\n window.localStorage.setItem(key, JSON.stringify(value));\n } catch (e: any) {\n isSet = false;\n if (e && e.message)\n appn.log.error(e.message, true);\n }\n\n return isSet;\n }\n\n /**\n * Removes an object from localstorage\n * @param key\n */\n export function removeItem(key: string) {\n try {\n window.localStorage.removeItem(key);\n } catch (e: any) {\n if (e && e.message)\n console.log(e.message);\n }\n }\n\n /**\n * Clears EVERYTHING out of local storage\n */\n export function clearAll() {\n try {\n window.localStorage.clear();\n } catch (e: any) {\n if (e && e.message)\n console.log(e.message);\n }\n }\n\n /**\n * Refreshes Local Storage if freshLs doesn't exist\n */\n export function autoClearLs() {\n const hasLsBeenAutoCleared = appn.localStorage.getItem(_clearLsKey);\n if (hasLsBeenAutoCleared)\n return;\n\n // Clear all local storage\n clearAllAndSetFreshLs();\n }\n\n /**\n * Clear All and set flag.\n */\n export function clearAllAndSetFreshLs() {\n appn.localStorage.clearAll();\n appn.localStorage.setItem(_clearLsKey, true);\n }\n}\n","\"use strict\";\nvar appn;\n(function (appn) {\n appn.isDebug = appn.isDebug;\n appn.isTestSuiteRequest = appn.isTestSuiteRequest;\n appn.emptyGuid = appn.emptyGuid;\n appn.emptyString = '';\n String.prototype.endsWithIgnoreCase = function (stringToFind, dontTrim) {\n if (dontTrim)\n return this.toLowerCase().endsWith(stringToFind.toLowerCase());\n return this.trim().toLowerCase().endsWith(stringToFind.trim().toLowerCase());\n };\n})(appn || (appn = {}));\n","/* \n * Bare essentials needed to run appn namespaces outside authed areas\n */\nnamespace appn {\n /**\n * A flag indicating if we are in Server debug mode\n */\n export const isDebug: boolean = appn.isDebug;\n\n /**\n * A flag indicating if we are in Server debug mode\n */\n export const isTestSuiteRequest: boolean = appn.isTestSuiteRequest;\n\n /**\n * Just an empty Guid... use it or loose it\n */\n export const emptyGuid: string = appn.emptyGuid;\n\n /**\n * Just an empty String... use it or loose it\n */\n export const emptyString: string = '';\n\n String.prototype.endsWithIgnoreCase = function(stringToFind: string, dontTrim: boolean): boolean {\n if (dontTrim)\n return this.toLowerCase().endsWith(stringToFind.toLowerCase());\n\n return this.trim().toLowerCase().endsWith(stringToFind.trim().toLowerCase());\n };\n}\n\ninterface String {\n endsWithIgnoreCase(stringToFind: string, dontTrim?: boolean): boolean;\n}\n"]}