{"version":3,"file":"Utility.js","sources":["../../Framework/Utility/http.ts","../../Framework/Utility/address.ts","../../Framework/Utility/arrayUtils.ts","../../Framework/Utility/linq.ts","../../Framework/Utility/guid.ts","../../Framework/Utility/stringUtils.ts","../../Framework/Utility/aspDateFormat.ts","../../Framework/Utility/rockDateTime.ts","../../Framework/Utility/block.ts","../../Framework/Utility/booleanUtils.ts","../../Framework/Utility/bus.ts","../../Framework/Utility/cache.ts","../../Framework/Utility/cancellation.ts","../../Framework/Utility/util.ts","../../Framework/Utility/suspense.ts","../../Framework/Utility/numberUtils.ts","../../Framework/Utility/component.ts","../../Framework/Utility/dateKey.ts","../../Framework/Utility/page.ts","../../Framework/Utility/dialogs.ts","../../Framework/Utility/email.ts","../../Framework/Utility/enumUtils.ts","../../Framework/Utility/fieldTypes.ts","../../Framework/Utility/form.ts","../../Framework/Utility/fullscreen.ts","../../Framework/Utility/geo.ts","../../Framework/Utility/internetCalendar.ts","../../Framework/Utility/lava.ts","../../Framework/Utility/listItemBag.ts","../../Framework/Utility/mergeField.ts","../../Framework/Utility/objectUtils.ts","../../Framework/Utility/phone.ts","../../Framework/Utility/popover.ts","../../Framework/Utility/promiseUtils.ts","../../Framework/Utility/realTime.ts","../../Framework/Utility/slidingDateRange.ts","../../Framework/Utility/structuredContentEditor.ts","../../Framework/Utility/tooltip.ts","../../Framework/Utility/treeItemProviders.ts","../../Framework/Utility/url.ts","../../Framework/Utility/validationRules.ts"],"sourcesContent":["// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { Guid } from \"@Obsidian/Types\";\r\nimport axios, { AxiosResponse } from \"axios\";\r\nimport { ListItemBag } from \"@Obsidian/ViewModels/Utility/listItemBag\";\r\nimport { HttpBodyData, HttpMethod, HttpFunctions, HttpResult, HttpUrlParams } from \"@Obsidian/Types/Utility/http\";\r\nimport { inject, provide, getCurrentInstance } from \"vue\";\r\n\r\n\r\n// #region HTTP Requests\r\n\r\n/**\r\n * Make an API call. This is only place Axios (or AJAX library) should be referenced to allow tools like performance metrics to provide\r\n * better insights.\r\n * @param method\r\n * @param url\r\n * @param params\r\n * @param data\r\n */\r\nasync function doApiCallRaw(method: HttpMethod, url: string, params: HttpUrlParams, data: HttpBodyData): Promise> {\r\n return await axios({\r\n method,\r\n url,\r\n params,\r\n data\r\n });\r\n}\r\n\r\n/**\r\n * Make an API call. This is a special use function that should not\r\n * normally be used. Instead call useHttp() to get the HTTP functions that\r\n * can be used.\r\n *\r\n * @param {string} method The HTTP method, such as GET\r\n * @param {string} url The endpoint to access, such as /api/campuses/\r\n * @param {object} params Query parameter object. Will be converted to ?key1=value1&key2=value2 as part of the URL.\r\n * @param {any} data This will be the body of the request\r\n */\r\nexport async function doApiCall(method: HttpMethod, url: string, params: HttpUrlParams = undefined, data: HttpBodyData = undefined): Promise> {\r\n try {\r\n const result = await doApiCallRaw(method, url, params, data);\r\n\r\n return {\r\n data: result.data as T,\r\n isError: false,\r\n isSuccess: true,\r\n statusCode: result.status,\r\n errorMessage: null\r\n } as HttpResult;\r\n }\r\n catch (e) {\r\n if (axios.isAxiosError(e)) {\r\n if (e.response?.data?.Message || e?.response?.data?.message) {\r\n return {\r\n data: null,\r\n isError: true,\r\n isSuccess: false,\r\n statusCode: e.response.status,\r\n errorMessage: e?.response?.data?.Message ?? e.response.data.message\r\n } as HttpResult;\r\n }\r\n\r\n return {\r\n data: null,\r\n isError: true,\r\n isSuccess: false,\r\n statusCode: e.response?.status ?? 0,\r\n errorMessage: null\r\n } as HttpResult;\r\n }\r\n else {\r\n return {\r\n data: null,\r\n isError: true,\r\n isSuccess: false,\r\n statusCode: 0,\r\n errorMessage: null\r\n } as HttpResult;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Make a GET HTTP request. This is a special use function that should not\r\n * normally be used. Instead call useHttp() to get the HTTP functions that\r\n * can be used.\r\n *\r\n * @param {string} url The endpoint to access, such as /api/campuses/\r\n * @param {object} params Query parameter object. Will be converted to ?key1=value1&key2=value2 as part of the URL.\r\n */\r\nexport async function get(url: string, params: HttpUrlParams = undefined): Promise> {\r\n return await doApiCall(\"GET\", url, params, undefined);\r\n}\r\n\r\n/**\r\n * Make a POST HTTP request. This is a special use function that should not\r\n * normally be used. Instead call useHttp() to get the HTTP functions that\r\n * can be used.\r\n *\r\n * @param {string} url The endpoint to access, such as /api/campuses/\r\n * @param {object} params Query parameter object. Will be converted to ?key1=value1&key2=value2 as part of the URL.\r\n * @param {any} data This will be the body of the request\r\n */\r\nexport async function post(url: string, params: HttpUrlParams = undefined, data: HttpBodyData = undefined): Promise> {\r\n return await doApiCall(\"POST\", url, params, data);\r\n}\r\n\r\nconst httpFunctionsSymbol = Symbol(\"http-functions\");\r\n\r\n/**\r\n * Provides the HTTP functions that child components will use. This is an\r\n * internal API and should not be used by third party components.\r\n *\r\n * @param functions The functions that will be made available to child components.\r\n */\r\nexport function provideHttp(functions: HttpFunctions): void {\r\n provide(httpFunctionsSymbol, functions);\r\n}\r\n\r\n/**\r\n * Gets the HTTP functions that can be used by the component. This is the\r\n * standard way to make HTTP requests.\r\n *\r\n * @returns An object that contains the functions which can be called.\r\n */\r\nexport function useHttp(): HttpFunctions {\r\n let http: HttpFunctions | undefined;\r\n\r\n // Check if we are inside a setup instance. This prevents warnings\r\n // from being displayed if being called outside a setup() function.\r\n if (getCurrentInstance()) {\r\n http = inject(httpFunctionsSymbol);\r\n }\r\n\r\n return http || {\r\n doApiCall: doApiCall,\r\n get: get,\r\n post: post\r\n };\r\n}\r\n\r\n// #endregion\r\n\r\n// #region File Upload\r\n\r\ntype FileUploadResponse = {\r\n /* eslint-disable @typescript-eslint/naming-convention */\r\n Guid: Guid;\r\n FileName: string;\r\n /* eslint-enable */\r\n};\r\n\r\n/**\r\n * Progress reporting callback used when uploading a file into Rock.\r\n */\r\nexport type UploadProgressCallback = (progress: number, total: number, percent: number) => void;\r\n\r\n/**\r\n * Options used when uploading a file into Rock to change the default behavior.\r\n */\r\nexport type UploadOptions = {\r\n /**\r\n * The base URL to use when uploading the file, must accept the same parameters\r\n * and as the standard FileUploader.ashx handler.\r\n */\r\n baseUrl?: string;\r\n\r\n /** True if the file should be uploaded as temporary, only applies to binary files. */\r\n isTemporary?: boolean;\r\n\r\n /** A function to call to report the ongoing progress of the upload. */\r\n progress: UploadProgressCallback;\r\n};\r\n\r\n/**\r\n * Uploads a file in the form data into Rock. This is an internal function and\r\n * should not be exported.\r\n *\r\n * @param url The URL to use for the POST request.\r\n * @param data The form data to send in the request body.\r\n * @param progress The optional callback to use to report progress.\r\n *\r\n * @returns The response from the upload handler.\r\n */\r\nasync function uploadFile(url: string, data: FormData, progress: UploadProgressCallback | undefined): Promise {\r\n const result = await axios.post(url, data, {\r\n headers: {\r\n \"Content-Type\": \"multipart/form-data\"\r\n },\r\n onUploadProgress: (event: ProgressEvent) => {\r\n if (progress) {\r\n progress(event.loaded, event.total, Math.floor(event.loaded * 100 / event.total));\r\n }\r\n }\r\n });\r\n\r\n // Check for a \"everything went perfectly fine\" response.\r\n if (result.status === 200 && typeof result.data === \"object\") {\r\n return result.data;\r\n }\r\n\r\n if (result.status === 406) {\r\n throw \"File type is not allowed.\";\r\n }\r\n\r\n if (typeof result.data === \"string\") {\r\n throw result.data;\r\n }\r\n\r\n throw \"Upload failed.\";\r\n}\r\n\r\n/**\r\n * Uploads a file to the Rock file system, usually inside the ~/Content directory.\r\n *\r\n * @param file The file to be uploaded to the server.\r\n * @param encryptedRootFolder The encrypted root folder specified by the server,\r\n * this specifies the jail the upload operation is limited to.\r\n * @param folderPath The additional sub-folder path to use inside the root folder.\r\n * @param options The options to use when uploading the file.\r\n *\r\n * @returns A ListItemBag that contains the scrubbed filename that was uploaded.\r\n */\r\nexport async function uploadContentFile(file: File, encryptedRootFolder: string, folderPath: string, options?: UploadOptions): Promise {\r\n const url = `${options?.baseUrl ?? \"/FileUploader.ashx\"}?rootFolder=${encryptedRootFolder}`;\r\n const formData = new FormData();\r\n\r\n formData.append(\"file\", file);\r\n\r\n if (folderPath) {\r\n formData.append(\"folderPath\", folderPath);\r\n }\r\n\r\n const result = await uploadFile(url, formData, options?.progress);\r\n\r\n return {\r\n value: \"\",\r\n text: result.FileName\r\n };\r\n}\r\n\r\n/**\r\n * Uploads a BinaryFile into Rock. The specific storage location is defined by\r\n * the file type.\r\n *\r\n * @param file The file to be uploaded into Rock.\r\n * @param binaryFileTypeGuid The unique identifier of the BinaryFileType to handle the upload.\r\n * @param options The options ot use when uploading the file.\r\n *\r\n * @returns A ListItemBag whose value contains the new file Guid and text specifies the filename.\r\n */\r\nexport async function uploadBinaryFile(file: File, binaryFileTypeGuid: Guid, options?: UploadOptions): Promise {\r\n let url = `${options?.baseUrl ?? \"/FileUploader.ashx\"}?isBinaryFile=True&fileTypeGuid=${binaryFileTypeGuid}`;\r\n\r\n // Assume file is temporary unless specified otherwise so that files\r\n // that don't end up getting used will get cleaned up.\r\n if (options?.isTemporary === false) {\r\n url += \"&isTemporary=False\";\r\n }\r\n else {\r\n url += \"&isTemporary=True\";\r\n }\r\n\r\n const formData = new FormData();\r\n formData.append(\"file\", file);\r\n\r\n const result = await uploadFile(url, formData, options?.progress);\r\n\r\n return {\r\n value: result.Guid,\r\n text: result.FileName\r\n };\r\n}\r\n\r\n// #endregion\r\n\r\nexport default {\r\n doApiCall,\r\n post,\r\n get\r\n};\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { HttpResult } from \"@Obsidian/Types/Utility/http\";\r\nimport { AddressControlBag } from \"@Obsidian/ViewModels/Controls/addressControlBag\";\r\nimport { AddressControlValidateAddressOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/AddressControlValidateAddressOptionsBag\";\r\nimport { AddressControlValidateAddressResultsBag } from \"@Obsidian/ViewModels/Rest/Controls/AddressControlValidateAddressResultsBag\";\r\nimport { post } from \"./http\";\r\n\r\nexport function getDefaultAddressControlModel(): AddressControlBag {\r\n return {\r\n state: \"AZ\",\r\n country: \"US\"\r\n };\r\n}\r\n\r\nexport function validateAddress(address: AddressControlValidateAddressOptionsBag): Promise> {\r\n return post(\"/api/v2/Controls/AddressControlValidateAddress\", undefined, address);\r\n}","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\n/**\r\n * Flatten a nested array down by the given number of levels.\r\n * Meant to be a replacement for the official Array.prototype.flat, which isn't supported by all browsers we support.\r\n * Adapted from Polyfill: https://github.com/behnammodi/polyfill/blob/master/array.polyfill.js#L591\r\n *\r\n * @param arr (potentially) nested array to be flattened\r\n * @param depth The depth level specifying how deep a nested array structure should be flattened. Defaults to 1.\r\n *\r\n * @returns A new array with the sub-array elements concatenated into it.\r\n */\r\nexport const flatten = (arr: T[][], depth: number = 1): T[] => {\r\n const result: T[] = [];\r\n const forEach = result.forEach;\r\n\r\n const flatDeep = function (arr, depth): void {\r\n forEach.call(arr, function (val) {\r\n if (depth > 0 && Array.isArray(val)) {\r\n flatDeep(val, depth - 1);\r\n }\r\n else {\r\n result.push(val);\r\n }\r\n });\r\n };\r\n\r\n flatDeep(arr, depth);\r\n return result;\r\n};","/**\r\n * A function that will select a value from the object.\r\n */\r\ntype ValueSelector = (value: T) => string | number | boolean | null | undefined;\r\n\r\n/**\r\n * A function that will perform testing on a value to see if it meets\r\n * a certain condition and return true or false.\r\n */\r\ntype PredicateFn = (value: T, index: number) => boolean;\r\n\r\n/**\r\n * A function that will compare two values to see which one should\r\n * be ordered first.\r\n */\r\ntype ValueComparer = (a: T, b: T) => number;\r\n\r\nconst moreThanOneElement = \"More than one element was found in collection.\";\r\n\r\nconst noElementsFound = \"No element was found in collection.\";\r\n\r\n/**\r\n * Compares the values of two objects given the selector function.\r\n *\r\n * For the purposes of a compare, null and undefined are always a lower\r\n * value - unless both values are null or undefined in which case they\r\n * are considered equal.\r\n * \r\n * @param keySelector The function that will select the value.\r\n * @param descending True if this comparison should be in descending order.\r\n */\r\nfunction valueComparer(keySelector: ValueSelector, descending: boolean): ValueComparer {\r\n return (a: T, b: T): number => {\r\n const valueA = keySelector(a);\r\n const valueB = keySelector(b);\r\n\r\n // If valueA is null or undefined then it will either be considered\r\n // lower than or equal to valueB.\r\n if (valueA === undefined || valueA === null) {\r\n // If valueB is also null or undefined then they are considered equal.\r\n if (valueB === undefined || valueB === null) {\r\n return 0;\r\n }\r\n\r\n return !descending ? -1 : 1;\r\n }\r\n\r\n // If valueB is undefined or null (but valueA is not) then it is considered\r\n // a lower value than valueA.\r\n if (valueB === undefined || valueB === null) {\r\n return !descending ? 1 : -1;\r\n }\r\n\r\n // Perform a normal comparison.\r\n if (valueA > valueB) {\r\n return !descending ? 1 : -1;\r\n }\r\n else if (valueA < valueB) {\r\n return !descending ? -1 : 1;\r\n }\r\n else {\r\n return 0;\r\n }\r\n };\r\n}\r\n\r\n\r\n/**\r\n * Provides LINQ style access to an array of elements.\r\n */\r\nexport class List {\r\n /** The elements being tracked by this list. */\r\n protected elements: T[];\r\n\r\n // #region Constructors\r\n\r\n /**\r\n * Creates a new list with the given elements.\r\n * \r\n * @param elements The elements to be made available to LINQ queries.\r\n */\r\n constructor(elements?: T[]) {\r\n if (elements === undefined) {\r\n this.elements = [];\r\n }\r\n else {\r\n // Copy the array so if the caller makes changes it won't be reflected by us.\r\n this.elements = [...elements];\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new List from the elements without copying to a new array.\r\n * \r\n * @param elements The elements to initialize the list with.\r\n * @returns A new list of elements.\r\n */\r\n public static fromArrayNoCopy(elements: T[]): List {\r\n const list = new List();\r\n\r\n list.elements = elements;\r\n\r\n return list;\r\n }\r\n\r\n // #endregion\r\n\r\n /**\r\n * Returns a boolean that determines if the collection contains any elements.\r\n *\r\n * @returns true if the collection contains any elements; otherwise false.\r\n */\r\n public any(): boolean;\r\n\r\n /**\r\n * Filters the list by the predicate and then returns a boolean that determines\r\n * if the filtered collection contains any elements.\r\n *\r\n * @param predicate The predicate to filter the elements by.\r\n *\r\n * @returns true if the collection contains any elements; otherwise false.\r\n */\r\n public any(predicate: PredicateFn): boolean;\r\n\r\n /**\r\n * Filters the list by the predicate and then returns a boolean that determines\r\n * if the filtered collection contains any elements.\r\n *\r\n * @param predicate The predicate to filter the elements by.\r\n *\r\n * @returns true if the collection contains any elements; otherwise false.\r\n */\r\n public any(predicate?: PredicateFn): boolean {\r\n let elements = this.elements;\r\n\r\n if (predicate !== undefined) {\r\n elements = elements.filter(predicate);\r\n }\r\n\r\n return elements.length > 0;\r\n }\r\n\r\n /**\r\n * Returns the first element from the collection if there are any elements.\r\n * Otherwise will throw an exception.\r\n *\r\n * @returns The first element in the collection.\r\n */\r\n public first(): T;\r\n\r\n /**\r\n * Filters the list by the predicate and then returns the first element\r\n * in the collection if any remain. Otherwise throws an exception.\r\n *\r\n * @param predicate The predicate to filter the elements by.\r\n *\r\n * @returns The first element in the collection.\r\n */\r\n public first(predicate: PredicateFn): T;\r\n\r\n /**\r\n * Filters the list by the predicate and then returns the first element\r\n * in the collection if any remain. Otherwise throws an exception.\r\n *\r\n * @param predicate The predicate to filter the elements by.\r\n *\r\n * @returns The first element in the collection.\r\n */\r\n public first(predicate?: PredicateFn): T {\r\n let elements = this.elements;\r\n\r\n if (predicate !== undefined) {\r\n elements = elements.filter(predicate);\r\n }\r\n\r\n if (elements.length >= 1) {\r\n return elements[0];\r\n }\r\n else {\r\n throw noElementsFound;\r\n }\r\n }\r\n\r\n /**\r\n * Returns the first element found in the collection or undefined if the\r\n * collection contains no elements.\r\n *\r\n * @returns The first element in the collection or undefined.\r\n */\r\n public firstOrUndefined(): T | undefined;\r\n\r\n /**\r\n * Filters the list by the predicate and then returns the first element\r\n * found in the collection. If no elements remain then undefined is\r\n * returned instead.\r\n *\r\n * @param predicate The predicate to filter the elements by.\r\n *\r\n * @returns The first element in the filtered collection or undefined.\r\n */\r\n public firstOrUndefined(predicate: PredicateFn): T | undefined;\r\n\r\n /**\r\n * Filters the list by the predicate and then returns the first element\r\n * found in the collection. If no elements remain then undefined is\r\n * returned instead.\r\n *\r\n * @param predicate The predicate to filter the elements by.\r\n *\r\n * @returns The first element in the filtered collection or undefined.\r\n */\r\n public firstOrUndefined(predicate?: PredicateFn): T | undefined {\r\n let elements = this.elements;\r\n\r\n if (predicate !== undefined) {\r\n elements = elements.filter(predicate);\r\n }\r\n\r\n if (elements.length === 1) {\r\n return elements[0];\r\n }\r\n else {\r\n return undefined;\r\n }\r\n }\r\n\r\n /**\r\n * Returns a single element from the collection if there is a single\r\n * element. Otherwise will throw an exception.\r\n *\r\n * @returns An element.\r\n */\r\n public single(): T;\r\n\r\n /**\r\n * Filters the list by the predicate and then returns the single remaining\r\n * element from the collection. If more than one element remains then an\r\n * exception will be thrown.\r\n *\r\n * @param predicate The predicate to filter the elements by.\r\n *\r\n * @returns An element.\r\n */\r\n public single(predicate: PredicateFn): T;\r\n\r\n /**\r\n * Filters the list by the predicate and then returns the single remaining\r\n * element from the collection. If more than one element remains then an\r\n * exception will be thrown.\r\n *\r\n * @param predicate The predicate to filter the elements by.\r\n *\r\n * @returns An element.\r\n */\r\n public single(predicate?: PredicateFn): T {\r\n let elements = this.elements;\r\n\r\n if (predicate !== undefined) {\r\n elements = elements.filter(predicate);\r\n }\r\n\r\n if (elements.length === 1) {\r\n return elements[0];\r\n }\r\n else {\r\n throw moreThanOneElement;\r\n }\r\n }\r\n\r\n /**\r\n * Returns a single element from the collection if there is a single\r\n * element. If no elements are found then undefined is returned. More\r\n * than a single element will throw an exception.\r\n *\r\n * @returns An element or undefined.\r\n */\r\n public singleOrUndefined(): T | undefined;\r\n\r\n /**\r\n * Filters the list by the predicate and then returns the single element\r\n * from the collection if there is only one remaining. If no elements\r\n * remain then undefined is returned. More than a single element will throw\r\n * an exception.\r\n *\r\n * @param predicate The predicate to filter the elements by.\r\n *\r\n * @returns An element or undefined.\r\n */\r\n public singleOrUndefined(predicate: PredicateFn): T | undefined;\r\n\r\n /**\r\n * Filters the list by the predicate and then returns the single element\r\n * from the collection if there is only one remaining. If no elements\r\n * remain then undefined is returned. More than a single element will throw\r\n * an exception.\r\n *\r\n * @param predicate The predicate to filter the elements by.\r\n *\r\n * @returns An element or undefined.\r\n */\r\n public singleOrUndefined(predicate?: PredicateFn): T | undefined {\r\n let elements = this.elements;\r\n\r\n if (predicate !== undefined) {\r\n elements = elements.filter(predicate);\r\n }\r\n\r\n if (elements.length === 0) {\r\n return undefined;\r\n }\r\n else if (elements.length === 1) {\r\n return elements[0];\r\n }\r\n else {\r\n throw moreThanOneElement;\r\n }\r\n }\r\n\r\n /**\r\n * Orders the elements of the array and returns a new list of items\r\n * in that order.\r\n * \r\n * @param keySelector The selector for the key to be ordered by.\r\n * @returns A new ordered list of elements.\r\n */\r\n public orderBy(keySelector: ValueSelector): OrderedList {\r\n const comparer = valueComparer(keySelector, false);\r\n\r\n return new OrderedList(this.elements, comparer);\r\n }\r\n\r\n /**\r\n * Orders the elements of the array in descending order and returns a\r\n * new list of items in that order.\r\n *\r\n * @param keySelector The selector for the key to be ordered by.\r\n * @returns A new ordered list of elements.\r\n */\r\n public orderByDescending(keySelector: ValueSelector): OrderedList {\r\n const comparer = valueComparer(keySelector, true);\r\n\r\n return new OrderedList(this.elements, comparer);\r\n }\r\n\r\n /**\r\n * Filters the results and returns a new list containing only the elements\r\n * that match the predicate.\r\n * \r\n * @param predicate The predicate to filter elements with.\r\n * \r\n * @returns A new collection of elements that match the predicate.\r\n */\r\n public where(predicate: PredicateFn): List {\r\n return new List(this.elements.filter(predicate));\r\n }\r\n\r\n /**\r\n * Get the elements of this list as a native array of items.\r\n *\r\n * @returns An array of items with all filters applied.\r\n */\r\n public toArray(): T[] {\r\n return [...this.elements];\r\n }\r\n}\r\n\r\n/**\r\n * A list of items that has ordering already applied.\r\n */\r\nclass OrderedList extends List {\r\n /** The base comparer to use when ordering. */\r\n private baseComparer!: ValueComparer;\r\n\r\n // #region Constructors\r\n\r\n constructor(elements: T[], baseComparer: ValueComparer) {\r\n super(elements);\r\n\r\n this.baseComparer = baseComparer;\r\n this.elements.sort(this.baseComparer);\r\n }\r\n\r\n // #endregion\r\n\r\n /**\r\n * Orders the elements of the array and returns a new list of items\r\n * in that order.\r\n * \r\n * @param keySelector The selector for the key to be ordered by.\r\n * @returns A new ordered list of elements.\r\n */\r\n public thenBy(keySelector: ValueSelector): OrderedList {\r\n const comparer = valueComparer(keySelector, false);\r\n\r\n return new OrderedList(this.elements, (a: T, b: T) => this.baseComparer(a, b) || comparer(a, b));\r\n }\r\n\r\n /**\r\n * Orders the elements of the array in descending order and returns a\r\n * new list of items in that order.\r\n *\r\n * @param keySelector The selector for the key to be ordered by.\r\n * @returns A new ordered list of elements.\r\n */\r\n public thenByDescending(keySelector: ValueSelector): OrderedList {\r\n const comparer = valueComparer(keySelector, true);\r\n\r\n return new OrderedList(this.elements, (a: T, b: T) => this.baseComparer(a, b) || comparer(a, b));\r\n }\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { Guid } from \"@Obsidian/Types\";\r\n\r\n/** An empty unique identifier. */\r\nexport const emptyGuid = \"00000000-0000-0000-0000-000000000000\";\r\n\r\n/**\r\n* Generates a new Guid\r\n*/\r\nexport function newGuid (): Guid {\r\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, (c) => {\r\n const r = Math.random() * 16 | 0;\r\n const v = c === \"x\" ? r : r & 0x3 | 0x8;\r\n return v.toString(16);\r\n });\r\n}\r\n\r\n/**\r\n * Returns a normalized Guid that can be compared with string equality (===)\r\n * @param a\r\n */\r\nexport function normalize (a: Guid | null | undefined): Guid | null {\r\n if (!a) {\r\n return null;\r\n }\r\n\r\n return a.toLowerCase();\r\n}\r\n\r\n/**\r\n * Checks if the given string is a valid Guid. To be considered valid it must\r\n * be a bare guid with hyphens. Bare means not enclosed in '{' and '}'.\r\n * \r\n * @param guid The Guid to be checked.\r\n * @returns True if the guid is valid, otherwise false.\r\n */\r\nexport function isValidGuid(guid: Guid | string): boolean {\r\n return /^[0-9A-Fa-f]{8}-(?:[0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$/.test(guid);\r\n}\r\n\r\n/**\r\n * Converts the string value to a Guid.\r\n * \r\n * @param value The value to be converted.\r\n * @returns A Guid value or null is the string could not be parsed as a Guid.\r\n */\r\nexport function toGuidOrNull(value: string | null | undefined): Guid | null {\r\n if (value === null || value === undefined) {\r\n return null;\r\n }\r\n\r\n if (!isValidGuid(value)) {\r\n return null;\r\n }\r\n\r\n return value as Guid;\r\n}\r\n\r\n/**\r\n * Are the guids equal?\r\n * @param a\r\n * @param b\r\n */\r\nexport function areEqual (a: Guid | null | undefined, b: Guid | null | undefined): boolean {\r\n return normalize(a) === normalize(b);\r\n}\r\n\r\nexport default {\r\n newGuid,\r\n normalize,\r\n areEqual\r\n};\r\n\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { areEqual, toGuidOrNull } from \"./guid\";\r\nimport { Pluralize } from \"@Obsidian/Libs/pluralize\";\r\n\r\n/**\r\n * Is the value an empty string?\r\n * @param val\r\n */\r\nexport function isEmpty(val: unknown): boolean {\r\n if (typeof val === \"string\") {\r\n return val.length === 0;\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Is the value an empty string?\r\n * @param val\r\n */\r\nexport function isWhiteSpace(val: unknown): boolean {\r\n if (typeof val === \"string\") {\r\n return val.trim().length === 0;\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Is the value null, undefined or whitespace?\r\n * @param val\r\n */\r\nexport function isNullOrWhiteSpace(val: unknown): boolean {\r\n return isWhiteSpace(val) || val === undefined || val === null;\r\n}\r\n\r\n/**\r\n * Turns \"MyCamelCaseString\" into \"My Camel Case String\"\r\n * @param val\r\n */\r\nexport function splitCamelCase(val: string): string {\r\n return val.replace(/([a-z])([A-Z])/g, \"$1 $2\");\r\n}\r\n\r\n/**\r\n * Returns an English comma-and fragment.\r\n * Ex: ['a', 'b', 'c'] => 'a, b, and c'\r\n * @param strs\r\n */\r\nexport function asCommaAnd(strs: string[]): string {\r\n if (strs.length === 0) {\r\n return \"\";\r\n }\r\n\r\n if (strs.length === 1) {\r\n return strs[0];\r\n }\r\n\r\n if (strs.length === 2) {\r\n return `${strs[0]} and ${strs[1]}`;\r\n }\r\n\r\n const last = strs.pop();\r\n return `${strs.join(\", \")}, and ${last}`;\r\n}\r\n\r\n/**\r\n * Convert the string to the title case.\r\n * hellO worlD => Hello World\r\n * @param str\r\n */\r\nexport function toTitleCase(str: string | null): string {\r\n if (!str) {\r\n return \"\";\r\n }\r\n\r\n return str.replace(/\\w\\S*/g, (word) => {\r\n return word.charAt(0).toUpperCase() + word.substring(1).toLowerCase();\r\n });\r\n}\r\n\r\n/**\r\n * Capitalize the first character\r\n */\r\nexport function upperCaseFirstCharacter(str: string | null): string {\r\n if (!str) {\r\n return \"\";\r\n }\r\n\r\n return str.charAt(0).toUpperCase() + str.substring(1);\r\n}\r\n\r\n/**\r\n * Pluralizes the given word. If count is specified and is equal to 1 then\r\n * the singular form of the word is returned. This will also de-pluralize a\r\n * word if required.\r\n *\r\n * @param word The word to be pluralized or singularized.\r\n * @param count An optional count to indicate when the word should be singularized.\r\n *\r\n * @returns The word in plural or singular form depending on the options.\r\n */\r\nexport function pluralize(word: string, count?: number): string {\r\n return Pluralize(word, count);\r\n}\r\n\r\n/**\r\n * Returns a singular or plural phrase depending on if the number is 1.\r\n * (0, Cat, Cats) => Cats\r\n * (1, Cat, Cats) => Cat\r\n * (2, Cat, Cats) => Cats\r\n * @param num\r\n * @param singular\r\n * @param plural\r\n */\r\nexport function pluralConditional(num: number, singular: string, plural: string): string {\r\n return num === 1 ? singular : plural;\r\n}\r\n\r\n/**\r\n * Pad the left side of a string so it is at least length characters long.\r\n *\r\n * @param str The string to be padded.\r\n * @param length The minimum length to make the string.\r\n * @param padCharacter The character to use to pad the string.\r\n */\r\nexport function padLeft(str: string | undefined | null, length: number, padCharacter: string = \" \"): string {\r\n if (padCharacter == \"\") {\r\n padCharacter = \" \";\r\n }\r\n else if (padCharacter.length > 1) {\r\n padCharacter = padCharacter.substring(0, 1);\r\n }\r\n\r\n if (!str) {\r\n return Array(length + 1).join(padCharacter);\r\n }\r\n\r\n if (str.length >= length) {\r\n return str;\r\n }\r\n\r\n return Array(length - str.length + 1).join(padCharacter) + str;\r\n}\r\n\r\n/**\r\n * Pad the right side of a string so it is at least length characters long.\r\n *\r\n * @param str The string to be padded.\r\n * @param length The minimum length to make the string.\r\n * @param padCharacter The character to use to pad the string.\r\n */\r\nexport function padRight(str: string | undefined | null, length: number, padCharacter: string = \" \"): string {\r\n if (padCharacter == \"\") {\r\n padCharacter = \" \";\r\n }\r\n else if (padCharacter.length > 1) {\r\n padCharacter = padCharacter.substring(0, 1);\r\n }\r\n\r\n if (!str) {\r\n return Array(length).join(padCharacter);\r\n }\r\n\r\n if (str.length >= length) {\r\n return str;\r\n }\r\n\r\n return str + Array(length - str.length + 1).join(padCharacter);\r\n}\r\n\r\nexport type TruncateOptions = {\r\n ellipsis?: boolean;\r\n};\r\n\r\n/**\r\n * Ensure a string does not go over the character limit. Truncation happens\r\n * on word boundaries.\r\n *\r\n * @param str The string to be truncated.\r\n * @param limit The maximum length of the resulting string.\r\n * @param options Additional options that control how truncation will happen.\r\n *\r\n * @returns The truncated string.\r\n */\r\nexport function truncate(str: string, limit: number, options?: TruncateOptions): string {\r\n // Early out if the string is already under the limit.\r\n if (str.length <= limit) {\r\n return str;\r\n }\r\n\r\n // All the whitespace characters that we can split on.\r\n const trimmable = \"\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u00A0\\u1680\\u180E\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u202F\\u205F\\u2028\\u2029\\u3000\\uFEFF\";\r\n const reg = new RegExp(`(?=[${trimmable}])`);\r\n const words = str.split(reg);\r\n let count = 0;\r\n\r\n // If we are appending ellipsis, then shorten the limit size.\r\n if (options && options.ellipsis === true) {\r\n limit -= 3;\r\n }\r\n\r\n // Get a list of words that will fit within our length requirements.\r\n const visibleWords = words.filter(function (word) {\r\n count += word.length;\r\n return count <= limit;\r\n });\r\n\r\n return `${visibleWords.join(\"\")}...`;\r\n}\r\n\r\n/** The regular expression that contains the characters to be escaped. */\r\nconst escapeHtmlRegExp = /[\"'&<>]/g;\r\n\r\n/** The character map of the characters to be replaced and the strings to replace them with. */\r\nconst escapeHtmlMap: Record = {\r\n '\"': \""\",\r\n \"&\": \"&\",\r\n \"'\": \"'\",\r\n \"<\": \"<\",\r\n \">\": \">\"\r\n};\r\n\r\n/**\r\n * Escapes a string so it can be used in HTML. This turns things like the <\r\n * character into the < sequence so it will still render as \"<\".\r\n *\r\n * @param str The string to be escaped.\r\n * @returns A string that has all HTML entities escaped.\r\n */\r\nexport function escapeHtml(str: string): string {\r\n return str.replace(escapeHtmlRegExp, (ch) => {\r\n return escapeHtmlMap[ch];\r\n });\r\n}\r\n\r\n/**\r\n * The default compare value function for UI controls. This checks if both values\r\n * are GUIDs and if so does a case-insensitive compare, otherwise it does a\r\n * case-sensitive compare of the two values.\r\n *\r\n * @param value The value selected in the UI.\r\n * @param itemValue The item value to be compared against.\r\n *\r\n * @returns true if the two values are considered equal; otherwise false.\r\n */\r\nexport function defaultControlCompareValue(value: string, itemValue: string): boolean {\r\n const guidValue = toGuidOrNull(value);\r\n const guidItemValue = toGuidOrNull(itemValue);\r\n\r\n if (guidValue !== null && guidItemValue !== null) {\r\n return areEqual(guidValue, guidItemValue);\r\n }\r\n\r\n return value === itemValue;\r\n}\r\n\r\n/**\r\n * Determins whether or not a given string contains any HTML tags in.\r\n *\r\n * @param value The string potentially containing HTML\r\n *\r\n * @returns true if it contains HTML, otherwise false\r\n */\r\nexport function containsHtmlTag(value: string): boolean {\r\n return /<[/0-9a-zA-Z]/.test(value);\r\n}\r\n\r\nexport default {\r\n asCommaAnd,\r\n containsHtmlTag,\r\n escapeHtml,\r\n splitCamelCase,\r\n isNullOrWhiteSpace,\r\n isWhiteSpace,\r\n isEmpty,\r\n toTitleCase,\r\n pluralConditional,\r\n padLeft,\r\n padRight,\r\n truncate\r\n};\r\n","import { List } from \"./linq\";\r\nimport { padLeft, padRight } from \"./stringUtils\";\r\nimport { RockDateTime } from \"./rockDateTime\";\r\n\r\n/**\r\n * Returns a blank string if the string value is 0.\r\n *\r\n * @param value The value to check and return.\r\n * @returns The value passed in or an empty string if it equates to zero.\r\n */\r\nfunction blankIfZero(value: string): string {\r\n return parseInt(value) === 0 ? \"\" : value;\r\n}\r\n\r\n/**\r\n * Gets the 12 hour value of the given 24-hour number.\r\n *\r\n * @param hour The hour in a 24-hour format.\r\n * @returns The hour in a 12-hour format.\r\n */\r\nfunction get12HourValue(hour: number): number {\r\n if (hour == 0) {\r\n return 12;\r\n }\r\n else if (hour < 13) {\r\n return hour;\r\n }\r\n else {\r\n return hour - 12;\r\n }\r\n}\r\ntype DateFormatterCommand = (date: RockDateTime) => string;\r\n\r\nconst englishDayNames = [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"];\r\nconst englishMonthNames = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"];\r\n\r\nconst dateFormatters: Record = {\r\n \"yyyyy\": date => padLeft(date.year.toString(), 5, \"0\"),\r\n \"yyyy\": date => padLeft(date.year.toString(), 4, \"0\"),\r\n \"yyy\": date => padLeft(date.year.toString(), 3, \"0\"),\r\n \"yy\": date => padLeft((date.year % 100).toString(), 2, \"0\"),\r\n \"y\": date => (date.year % 100).toString(),\r\n\r\n \"MMMM\": date => englishMonthNames[date.month - 1],\r\n \"MMM\": date => englishMonthNames[date.month - 1].substr(0, 3),\r\n \"MM\": date => padLeft(date.month.toString(), 2, \"0\"),\r\n \"M\": date => date.month.toString(),\r\n\r\n \"dddd\": date => englishDayNames[date.dayOfWeek],\r\n \"ddd\": date => englishDayNames[date.dayOfWeek].substr(0, 3),\r\n \"dd\": date => padLeft(date.day.toString(), 2, \"0\"),\r\n \"d\": date => date.day.toString(),\r\n\r\n \"fffffff\": date => padRight((date.millisecond * 10000).toString(), 7, \"0\"),\r\n \"ffffff\": date => padRight((date.millisecond * 1000).toString(), 6, \"0\"),\r\n \"fffff\": date => padRight((date.millisecond * 100).toString(), 5, \"0\"),\r\n \"ffff\": date => padRight((date.millisecond * 10).toString(), 4, \"0\"),\r\n \"fff\": date => padRight(date.millisecond.toString(), 3, \"0\"),\r\n \"ff\": date => padRight(Math.floor(date.millisecond / 10).toString(), 2, \"0\"),\r\n \"f\": date => padRight(Math.floor(date.millisecond / 100).toString(), 1, \"0\"),\r\n\r\n \"FFFFFFF\": date => blankIfZero(padRight((date.millisecond * 10000).toString(), 7, \"0\")),\r\n \"FFFFFF\": date => blankIfZero(padRight((date.millisecond * 1000).toString(), 6, \"0\")),\r\n \"FFFFF\": date => blankIfZero(padRight((date.millisecond * 100).toString(), 5, \"0\")),\r\n \"FFFF\": date => blankIfZero(padRight((date.millisecond * 10).toString(), 4, \"0\")),\r\n \"FFF\": date => blankIfZero(padRight(date.millisecond.toString(), 3, \"0\")),\r\n \"FF\": date => blankIfZero(padRight(Math.floor(date.millisecond / 10).toString(), 2, \"0\")),\r\n \"F\": date => blankIfZero(padRight(Math.floor(date.millisecond / 100).toString(), 1, \"0\")),\r\n\r\n \"g\": date => date.year < 0 ? \"B.C.\" : \"A.D.\",\r\n \"gg\": date => date.year < 0 ? \"B.C.\" : \"A.D.\",\r\n\r\n \"hh\": date => padLeft(get12HourValue(date.hour).toString(), 2, \"0\"),\r\n \"h\": date => get12HourValue(date.hour).toString(),\r\n\r\n \"HH\": date => padLeft(date.hour.toString(), 2, \"0\"),\r\n \"H\": date => date.hour.toString(),\r\n\r\n \"mm\": date => padLeft(date.minute.toString(), 2, \"0\"),\r\n \"m\": date => date.minute.toString(),\r\n\r\n \"ss\": date => padLeft(date.second.toString(), 2, \"0\"),\r\n \"s\": date => date.second.toString(),\r\n\r\n \"K\": date => {\r\n const offset = date.offset;\r\n const offsetHour = Math.abs(Math.floor(offset / 60));\r\n const offsetMinute = Math.abs(offset % 60);\r\n return `${offset >= 0 ? \"+\" : \"-\"}${padLeft(offsetHour.toString(), 2, \"0\")}:${padLeft(offsetMinute.toString(), 2, \"0\")}`;\r\n },\r\n\r\n \"tt\": date => date.hour >= 12 ? \"PM\" : \"AM\",\r\n \"t\": date => date.hour >= 12 ? \"P\" : \"A\",\r\n\r\n \"zzz\": date => {\r\n const offset = date.offset;\r\n const offsetHour = Math.abs(Math.floor(offset / 60));\r\n const offsetMinute = Math.abs(offset % 60);\r\n return `${offset >= 0 ? \"+\" : \"-\"}${padLeft(offsetHour.toString(), 2, \"0\")}:${padLeft(offsetMinute.toString(), 2, \"0\")}`;\r\n },\r\n \"zz\": date => {\r\n const offset = date.offset;\r\n const offsetHour = Math.abs(Math.floor(offset / 60));\r\n return `${offset >= 0 ? \"+\" : \"-\"}${padLeft(offsetHour.toString(), 2, \"0\")}`;\r\n },\r\n \"z\": date => {\r\n const offset = date.offset;\r\n const offsetHour = Math.abs(Math.floor(offset / 60));\r\n return `${offset >= 0 ? \"+\" : \"-\"}${offsetHour}`;\r\n },\r\n\r\n \":\": () => \":\",\r\n \"/\": () => \"/\"\r\n};\r\n\r\nconst dateFormatterKeys = new List(Object.keys(dateFormatters))\r\n .orderByDescending(k => k.length)\r\n .toArray();\r\n\r\nconst standardDateFormats: Record = {\r\n \"d\": date => formatAspDate(date, \"M/d/yyyy\"),\r\n \"D\": date => formatAspDate(date, \"dddd, MMMM dd, yyyy\"),\r\n \"t\": date => formatAspDate(date, \"h:mm tt\"),\r\n \"T\": date => formatAspDate(date, \"h:mm:ss tt\"),\r\n \"M\": date => formatAspDate(date, \"MMMM dd\"),\r\n \"m\": date => formatAspDate(date, \"MMMM dd\"),\r\n \"Y\": date => formatAspDate(date, \"yyyy MMMM\"),\r\n \"y\": date => formatAspDate(date, \"yyyy MMMM\"),\r\n \"f\": date => `${formatAspDate(date, \"D\")} ${formatAspDate(date, \"t\")}`,\r\n \"F\": date => `${formatAspDate(date, \"D\")} ${formatAspDate(date, \"T\")}`,\r\n \"g\": date => `${formatAspDate(date, \"d\")} ${formatAspDate(date, \"t\")}`,\r\n \"G\": date => `${formatAspDate(date, \"d\")} ${formatAspDate(date, \"T\")}`,\r\n \"o\": date => formatAspDate(date, `yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffzzz`),\r\n \"O\": date => formatAspDate(date, `yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffzzz`),\r\n \"r\": date => formatAspDate(date, `ddd, dd MMM yyyy HH':'mm':'ss 'GMT'`),\r\n \"R\": date => formatAspDate(date, `ddd, dd MMM yyyy HH':'mm':'ss 'GMT'`),\r\n \"s\": date => formatAspDate(date, `yyyy'-'MM'-'dd'T'HH':'mm':'ss`),\r\n \"u\": date => formatAspDate(date, `yyyy'-'MM'-'dd HH':'mm':'ss'Z'`),\r\n \"U\": date => {\r\n return formatAspDate(date.universalDateTime, `F`);\r\n },\r\n};\r\n\r\n/**\r\n * Formats the Date object using custom format specifiers.\r\n *\r\n * @param date The date object to be formatted.\r\n * @param format The custom format string.\r\n * @returns A string that represents the date in the specified format.\r\n */\r\nfunction formatAspCustomDate(date: RockDateTime, format: string): string {\r\n let result = \"\";\r\n\r\n for (let i = 0; i < format.length;) {\r\n let matchFound = false;\r\n\r\n for (const k of dateFormatterKeys) {\r\n if (format.substr(i, k.length) === k) {\r\n result += dateFormatters[k](date);\r\n matchFound = true;\r\n i += k.length;\r\n break;\r\n }\r\n }\r\n\r\n if (matchFound) {\r\n continue;\r\n }\r\n\r\n if (format[i] === \"\\\\\") {\r\n i++;\r\n if (i < format.length) {\r\n result += format[i++];\r\n }\r\n }\r\n else if (format[i] === \"'\") {\r\n i++;\r\n for (; i < format.length && format[i] !== \"'\"; i++) {\r\n result += format[i];\r\n }\r\n i++;\r\n }\r\n else if (format[i] === '\"') {\r\n i++;\r\n for (; i < format.length && format[i] !== '\"'; i++) {\r\n result += format[i];\r\n }\r\n i++;\r\n }\r\n else {\r\n result += format[i++];\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Formats the Date object using a standard format string.\r\n *\r\n * @param date The date object to be formatted.\r\n * @param format The standard format specifier.\r\n * @returns A string that represents the date in the specified format.\r\n */\r\nfunction formatAspStandardDate(date: RockDateTime, format: string): string {\r\n if (standardDateFormats[format] !== undefined) {\r\n return standardDateFormats[format](date);\r\n }\r\n\r\n return format;\r\n}\r\n\r\n/**\r\n * Formats the given Date object using nearly the same rules as the ASP C#\r\n * format methods.\r\n *\r\n * @param date The date object to be formatted.\r\n * @param format The format string to use.\r\n */\r\nexport function formatAspDate(date: RockDateTime, format: string): string {\r\n if (format.length === 1) {\r\n return formatAspStandardDate(date, format);\r\n }\r\n else if (format.length === 2 && format[0] === \"%\") {\r\n return formatAspCustomDate(date, format[1]);\r\n }\r\n else {\r\n return formatAspCustomDate(date, format);\r\n }\r\n}\r\n","import { DateTime, FixedOffsetZone, Zone } from \"luxon\";\r\nimport { formatAspDate } from \"./aspDateFormat\";\r\nimport { DayOfWeek } from \"@Obsidian/Enums/Controls/dayOfWeek\";\r\n\r\n/**\r\n * The days of the week that are used by RockDateTime.\r\n */\r\nexport { DayOfWeek } from \"@Obsidian/Enums/Controls/dayOfWeek\";\r\n\r\n/**\r\n * The various date and time formats supported by the formatting methods.\r\n */\r\nexport const DateTimeFormat: Record = {\r\n DateFull: {\r\n year: \"numeric\",\r\n month: \"long\",\r\n day: \"numeric\"\r\n },\r\n\r\n DateMedium: {\r\n year: \"numeric\",\r\n month: \"short\",\r\n day: \"numeric\"\r\n },\r\n\r\n DateShort: {\r\n year: \"numeric\",\r\n month: \"numeric\",\r\n day: \"numeric\"\r\n },\r\n\r\n TimeShort: {\r\n hour: \"numeric\",\r\n minute: \"numeric\",\r\n },\r\n\r\n TimeWithSeconds: {\r\n hour: \"numeric\",\r\n minute: \"numeric\",\r\n second: \"numeric\"\r\n },\r\n\r\n DateTimeShort: {\r\n year: \"numeric\",\r\n month: \"numeric\",\r\n day: \"numeric\",\r\n hour: \"numeric\",\r\n minute: \"numeric\"\r\n },\r\n\r\n DateTimeShortWithSeconds: {\r\n year: \"numeric\",\r\n month: \"numeric\",\r\n day: \"numeric\",\r\n hour: \"numeric\",\r\n minute: \"numeric\",\r\n second: \"numeric\"\r\n },\r\n\r\n DateTimeMedium: {\r\n year: \"numeric\",\r\n month: \"short\",\r\n day: \"numeric\",\r\n hour: \"numeric\",\r\n minute: \"numeric\"\r\n },\r\n\r\n DateTimeMediumWithSeconds: {\r\n year: \"numeric\",\r\n month: \"short\",\r\n day: \"numeric\",\r\n hour: \"numeric\",\r\n minute: \"numeric\",\r\n second: \"numeric\"\r\n },\r\n\r\n DateTimeFull: {\r\n year: \"numeric\",\r\n month: \"long\",\r\n day: \"numeric\",\r\n hour: \"numeric\",\r\n minute: \"numeric\"\r\n },\r\n\r\n DateTimeFullWithSeconds: {\r\n year: \"numeric\",\r\n month: \"long\",\r\n day: \"numeric\",\r\n hour: \"numeric\",\r\n minute: \"numeric\",\r\n second: \"numeric\"\r\n }\r\n};\r\n\r\n/**\r\n * A date and time object that handles time zones and formatting. This class is\r\n * immutable and cannot be modified. All modifications are performed by returning\r\n * a new RockDateTime instance.\r\n */\r\nexport class RockDateTime {\r\n /** The internal DateTime object that holds our date information. */\r\n private dateTime: DateTime;\r\n\r\n // #region Constructors\r\n\r\n /**\r\n * Creates a new instance of RockDateTime.\r\n *\r\n * @param dateTime The Luxon DateTime object that is used to track the internal state.\r\n */\r\n private constructor(dateTime: DateTime) {\r\n this.dateTime = dateTime;\r\n }\r\n\r\n /**\r\n * Creates a new instance of RockDateTime from the given date and time parts.\r\n *\r\n * @param year The year of the new date.\r\n * @param month The month of the new date (1-12).\r\n * @param day The day of month of the new date.\r\n * @param hour The hour of the day.\r\n * @param minute The minute of the hour.\r\n * @param second The second of the minute.\r\n * @param millisecond The millisecond of the second.\r\n * @param zone The time zone offset to construct the date in.\r\n *\r\n * @returns A RockDateTime instance or null if the requested date was not valid.\r\n */\r\n public static fromParts(year: number, month: number, day: number, hour?: number, minute?: number, second?: number, millisecond?: number, zone?: number | string): RockDateTime | null {\r\n let luxonZone: Zone | string | undefined;\r\n\r\n if (zone !== undefined) {\r\n if (typeof zone === \"number\") {\r\n luxonZone = FixedOffsetZone.instance(zone);\r\n }\r\n else {\r\n luxonZone = zone;\r\n }\r\n }\r\n\r\n const dateTime = DateTime.fromObject({\r\n year,\r\n month,\r\n day,\r\n hour,\r\n minute,\r\n second,\r\n millisecond\r\n }, {\r\n zone: luxonZone\r\n });\r\n\r\n if (!dateTime.isValid) {\r\n return null;\r\n }\r\n\r\n return new RockDateTime(dateTime);\r\n }\r\n\r\n /**\r\n * Creates a new instance of RockDateTime that represents the time specified\r\n * as the Javascript milliseconds value. The time zone is set to the browser\r\n * time zone.\r\n *\r\n * @param milliseconds The time in milliseconds since the epoch.\r\n *\r\n * @returns A new RockDateTime instance or null if the specified date was not valid.\r\n */\r\n public static fromMilliseconds(milliseconds: number): RockDateTime | null {\r\n const dateTime = DateTime.fromMillis(milliseconds);\r\n\r\n if (!dateTime.isValid) {\r\n return null;\r\n }\r\n\r\n return new RockDateTime(dateTime);\r\n }\r\n\r\n /**\r\n * Construct a new RockDateTime instance from a Javascript Date object.\r\n *\r\n * @param date The Javascript date object that contains the date information.\r\n *\r\n * @returns A RockDateTime instance or null if the date was not valid.\r\n */\r\n public static fromJSDate(date: Date): RockDateTime | null {\r\n const dateTime = DateTime.fromJSDate(date);\r\n\r\n if (!dateTime.isValid) {\r\n return null;\r\n }\r\n\r\n return new RockDateTime(dateTime);\r\n }\r\n\r\n /**\r\n * Constructs a new RockDateTime instance by parsing the given string from\r\n * ISO 8601 format.\r\n *\r\n * @param dateString The string that contains the ISO 8601 formatted text.\r\n *\r\n * @returns A new RockDateTime instance or null if the date was not valid.\r\n */\r\n public static parseISO(dateString: string): RockDateTime | null {\r\n const dateTime = DateTime.fromISO(dateString, { setZone: true });\r\n\r\n if (!dateTime.isValid) {\r\n return null;\r\n }\r\n\r\n return new RockDateTime(dateTime);\r\n }\r\n\r\n /**\r\n * Constructs a new RockDateTime instance by parsing the given string from\r\n * RFC 1123 format. This is common in HTTP headers.\r\n *\r\n * @param dateString The string that contains the RFC 1123 formatted text.\r\n *\r\n * @returns A new RockDateTime instance or null if the date was not valid.\r\n */\r\n public static parseHTTP(dateString: string): RockDateTime | null {\r\n const dateTime = DateTime.fromHTTP(dateString, { setZone: true });\r\n\r\n if (!dateTime.isValid) {\r\n return null;\r\n }\r\n\r\n return new RockDateTime(dateTime);\r\n }\r\n\r\n /**\r\n * Creates a new RockDateTime instance that represents the current date and time.\r\n *\r\n * @returns A RockDateTime instance.\r\n */\r\n public static now(): RockDateTime {\r\n return new RockDateTime(DateTime.now());\r\n }\r\n\r\n /**\r\n * Creates a new RockDateTime instance that represents the current time in UTC.\r\n *\r\n * @returns A new RockDateTime instance in the UTC time zone.\r\n */\r\n public static utcNow(): RockDateTime {\r\n return new RockDateTime(DateTime.now().toUTC());\r\n }\r\n\r\n // #endregion\r\n\r\n // #region Properties\r\n\r\n /**\r\n * The Date portion of this RockDateTime instance. All time properties of\r\n * the returned instance will be set to 0.\r\n */\r\n public get date(): RockDateTime {\r\n const date = RockDateTime.fromParts(this.year, this.month, this.day, 0, 0, 0, 0, this.offset);\r\n\r\n if (date === null) {\r\n throw \"Could not convert to date instance.\";\r\n }\r\n\r\n return date;\r\n }\r\n\r\n /**\r\n * The day of the month represented by this instance.\r\n */\r\n public get day(): number {\r\n return this.dateTime.day;\r\n }\r\n\r\n /**\r\n * The day of the week represented by this instance.\r\n */\r\n public get dayOfWeek(): DayOfWeek {\r\n switch (this.dateTime.weekday) {\r\n case 1:\r\n return DayOfWeek.Monday;\r\n\r\n case 2:\r\n return DayOfWeek.Tuesday;\r\n\r\n case 3:\r\n return DayOfWeek.Wednesday;\r\n\r\n case 4:\r\n return DayOfWeek.Thursday;\r\n\r\n case 5:\r\n return DayOfWeek.Friday;\r\n\r\n case 6:\r\n return DayOfWeek.Saturday;\r\n\r\n case 7:\r\n return DayOfWeek.Sunday;\r\n }\r\n\r\n throw \"Could not determine day of week.\";\r\n }\r\n\r\n /**\r\n * The day of the year represented by this instance.\r\n */\r\n public get dayOfYear(): number {\r\n return this.dateTime.ordinal;\r\n }\r\n\r\n /**\r\n * The hour of the day represented by this instance.\r\n */\r\n public get hour(): number {\r\n return this.dateTime.hour;\r\n }\r\n\r\n /**\r\n * The millisecond of the second represented by this instance.\r\n */\r\n public get millisecond(): number {\r\n return this.dateTime.millisecond;\r\n }\r\n\r\n /**\r\n * The minute of the hour represented by this instance.\r\n */\r\n public get minute(): number {\r\n return this.dateTime.minute;\r\n }\r\n\r\n /**\r\n * The month of the year represented by this instance (1-12).\r\n */\r\n public get month(): number {\r\n return this.dateTime.month;\r\n }\r\n\r\n /**\r\n * The offset from UTC represented by this instance. If the timezone of this\r\n * instance is UTC-7 then the value returned is -420.\r\n */\r\n public get offset(): number {\r\n return this.dateTime.offset;\r\n }\r\n\r\n /**\r\n * The second of the minute represented by this instance.\r\n */\r\n public get second(): number {\r\n return this.dateTime.second;\r\n }\r\n\r\n /**\r\n * The year represented by this instance.\r\n */\r\n public get year(): number {\r\n return this.dateTime.year;\r\n }\r\n\r\n /**\r\n * Creates a new RockDateTime instance that represents the same point in\r\n * time represented in the local browser time zone.\r\n */\r\n public get localDateTime(): RockDateTime {\r\n return new RockDateTime(this.dateTime.toLocal());\r\n }\r\n\r\n /**\r\n * Creates a new RockDateTime instance that represents the same point in\r\n * time represented in the organization time zone.\r\n */\r\n public get organizationDateTime(): RockDateTime {\r\n throw \"Not Implemented\";\r\n }\r\n\r\n /**\r\n * Creates a new RockDateTime instance that represents the same point in\r\n * time represented in UTC.\r\n */\r\n public get universalDateTime(): RockDateTime {\r\n return new RockDateTime(this.dateTime.toUTC());\r\n }\r\n\r\n // #endregion\r\n\r\n // #region Methods\r\n\r\n /**\r\n * Creates a new RockDateTime instance that represents the date and time\r\n * after adding the number of days to this instance.\r\n *\r\n * @param days The number of days to add.\r\n *\r\n * @returns A new instance of RockDateTime that represents the new date and time.\r\n */\r\n public addDays(days: number): RockDateTime {\r\n const dateTime = this.dateTime.plus({ days: days });\r\n\r\n if (!dateTime.isValid) {\r\n throw \"Operation produced an invalid date.\";\r\n }\r\n\r\n return new RockDateTime(dateTime);\r\n }\r\n\r\n /**\r\n * Creates a new RockDateTime instance that represents the date and time\r\n * after adding the number of hours to this instance.\r\n *\r\n * @param days The number of hours to add.\r\n *\r\n * @returns A new instance of RockDateTime that represents the new date and time.\r\n */\r\n public addHours(hours: number): RockDateTime {\r\n const dateTime = this.dateTime.plus({ hours: hours });\r\n\r\n if (!dateTime.isValid) {\r\n throw \"Operation produced an invalid date.\";\r\n }\r\n\r\n return new RockDateTime(dateTime);\r\n }\r\n\r\n /**\r\n * Creates a new RockDateTime instance that represents the date and time\r\n * after adding the number of milliseconds to this instance.\r\n *\r\n * @param days The number of milliseconds to add.\r\n *\r\n * @returns A new instance of RockDateTime that represents the new date and time.\r\n */\r\n public addMilliseconds(milliseconds: number): RockDateTime {\r\n const dateTime = this.dateTime.plus({ milliseconds: milliseconds });\r\n\r\n if (!dateTime.isValid) {\r\n throw \"Operation produced an invalid date.\";\r\n }\r\n\r\n return new RockDateTime(dateTime);\r\n }\r\n\r\n /**\r\n * Creates a new RockDateTime instance that represents the date and time\r\n * after adding the number of minutes to this instance.\r\n *\r\n * @param days The number of minutes to add.\r\n *\r\n * @returns A new instance of RockDateTime that represents the new date and time.\r\n */\r\n public addMinutes(minutes: number): RockDateTime {\r\n const dateTime = this.dateTime.plus({ minutes: minutes });\r\n\r\n if (!dateTime.isValid) {\r\n throw \"Operation produced an invalid date.\";\r\n }\r\n\r\n return new RockDateTime(dateTime);\r\n }\r\n\r\n /**\r\n * Creates a new RockDateTime instance that represents the date and time\r\n * after adding the number of months to this instance.\r\n *\r\n * @param days The number of months to add.\r\n *\r\n * @returns A new instance of RockDateTime that represents the new date and time.\r\n */\r\n public addMonths(months: number): RockDateTime {\r\n const dateTime = this.dateTime.plus({ months: months });\r\n\r\n if (!dateTime.isValid) {\r\n throw \"Operation produced an invalid date.\";\r\n }\r\n\r\n return new RockDateTime(dateTime);\r\n }\r\n\r\n /**\r\n * Creates a new RockDateTime instance that represents the date and time\r\n * after adding the number of seconds to this instance.\r\n *\r\n * @param days The number of seconds to add.\r\n *\r\n * @returns A new instance of RockDateTime that represents the new date and time.\r\n */\r\n public addSeconds(seconds: number): RockDateTime {\r\n const dateTime = this.dateTime.plus({ seconds: seconds });\r\n\r\n if (!dateTime.isValid) {\r\n throw \"Operation produced an invalid date.\";\r\n }\r\n\r\n return new RockDateTime(dateTime);\r\n }\r\n\r\n /**\r\n * Creates a new RockDateTime instance that represents the date and time\r\n * after adding the number of years to this instance.\r\n *\r\n * @param days The number of years to add.\r\n *\r\n * @returns A new instance of RockDateTime that represents the new date and time.\r\n */\r\n public addYears(years: number): RockDateTime {\r\n const dateTime = this.dateTime.plus({ years: years });\r\n\r\n if (!dateTime.isValid) {\r\n throw \"Operation produced an invalid date.\";\r\n }\r\n\r\n return new RockDateTime(dateTime);\r\n }\r\n\r\n /**\r\n * Converts the date time representation into the number of milliseconds\r\n * that have elapsed since the epoch (1970-01-01T00:00:00Z).\r\n *\r\n * @returns The number of milliseconds since the epoch.\r\n */\r\n public toMilliseconds(): number {\r\n return this.dateTime.toMillis();\r\n }\r\n\r\n /**\r\n * Creates a new instance of RockDateTime that represents the same point\r\n * in time as represented by the specified time zone offset.\r\n *\r\n * @param zone The time zone offset as a number or string such as \"UTC+4\".\r\n *\r\n * @returns A new RockDateTime instance that represents the specified time zone.\r\n */\r\n public toOffset(zone: number | string): RockDateTime {\r\n let dateTime: DateTime;\r\n\r\n if (typeof zone === \"number\") {\r\n dateTime = this.dateTime.setZone(FixedOffsetZone.instance(zone));\r\n }\r\n else {\r\n dateTime = this.dateTime.setZone(zone);\r\n }\r\n\r\n if (!dateTime.isValid) {\r\n throw \"Invalid time zone specified.\";\r\n }\r\n\r\n return new RockDateTime(dateTime);\r\n }\r\n\r\n /**\r\n * Formats this instance according to C# formatting rules.\r\n *\r\n * @param format The string that specifies the format to use.\r\n *\r\n * @returns A string representing this instance in the given format.\r\n */\r\n public toASPString(format: string): string {\r\n return formatAspDate(this, format);\r\n }\r\n\r\n /**\r\n * Creates a string representation of this instance in ISO8601 format.\r\n *\r\n * @returns An ISO8601 formatted string.\r\n */\r\n public toISOString(): string {\r\n return this.dateTime.toISO();\r\n }\r\n\r\n /**\r\n * Formats this instance using standard locale formatting rules to display\r\n * a date and time in the browsers specified locale.\r\n *\r\n * @param format The format to use when generating the string.\r\n *\r\n * @returns A string that represents the date and time in then specified format.\r\n */\r\n public toLocaleString(format: Intl.DateTimeFormatOptions): string {\r\n return this.dateTime.toLocaleString(format);\r\n }\r\n\r\n /**\r\n * Transforms the date into a human friendly elapsed time string.\r\n *\r\n * @example\r\n * // Returns \"21yrs\"\r\n * RockDateTime.fromParts(2000, 3, 4).toElapsedString();\r\n *\r\n * @returns A string that represents the amount of time that has elapsed.\r\n */\r\n public toElapsedString(): string {\r\n const now = RockDateTime.now();\r\n const msPerHour = 1000 * 60 * 60;\r\n const hoursPerDay = 24;\r\n const daysPerMonth = 30.4167;\r\n const daysPerYear = 365.25;\r\n\r\n const totalMs = Math.abs(now.toMilliseconds() - this.toMilliseconds());\r\n const totalHours = totalMs / msPerHour;\r\n const totalDays = totalHours / hoursPerDay;\r\n\r\n if (totalDays < 2) {\r\n return \"1day\";\r\n }\r\n\r\n if (totalDays < 31) {\r\n return `${Math.floor(totalDays)}days`;\r\n }\r\n\r\n const totalMonths = totalDays / daysPerMonth;\r\n\r\n if (totalMonths <= 1) {\r\n return \"1mon\";\r\n }\r\n\r\n if (totalMonths <= 18) {\r\n return `${Math.round(totalMonths)}mon`;\r\n }\r\n\r\n const totalYears = totalDays / daysPerYear;\r\n\r\n if (totalYears <= 1) {\r\n return \"1yr\";\r\n }\r\n\r\n return `${Math.round(totalYears)}yrs`;\r\n }\r\n\r\n /**\r\n * Formats this instance as a string that can be used in HTTP headers and\r\n * cookies.\r\n *\r\n * @returns A new string that conforms to RFC 1123\r\n */\r\n public toHTTPString(): string {\r\n return this.dateTime.toHTTP();\r\n }\r\n\r\n /**\r\n * Get the value of the date and time in a format that can be used in\r\n * comparisons.\r\n *\r\n * @returns A number that represents the date and time.\r\n */\r\n public valueOf(): number {\r\n return this.dateTime.valueOf();\r\n }\r\n\r\n /**\r\n * Creates a standard string representation of the date and time.\r\n *\r\n * @returns A string representation of the date and time.\r\n */\r\n public toString(): string {\r\n return this.toLocaleString(DateTimeFormat.DateTimeFull);\r\n }\r\n\r\n /**\r\n * Checks if this instance is equal to another RockDateTime instance. This\r\n * will return true if the two instances represent the same point in time,\r\n * even if they have been associated with different time zones. In other\r\n * words \"2021-09-08 12:00:00 Z\" == \"2021-09-08 14:00:00 UTC+2\".\r\n *\r\n * @param otherDateTime The other RockDateTime to be compared against.\r\n *\r\n * @returns True if the two instances represent the same point in time.\r\n */\r\n public isEqualTo(otherDateTime: RockDateTime): boolean {\r\n return this.dateTime.toMillis() === otherDateTime.dateTime.toMillis();\r\n }\r\n\r\n /**\r\n * Checks if this instance is later than another RockDateTime instance.\r\n *\r\n * @param otherDateTime The other RockDateTime to be compared against.\r\n *\r\n * @returns True if this instance represents a point in time that occurred after another point in time, regardless of time zone.\r\n */\r\n public isLaterThan(otherDateTime: RockDateTime): boolean {\r\n return this.dateTime.toMillis() > otherDateTime.dateTime.toMillis();\r\n }\r\n\r\n /**\r\n * Checks if this instance is earlier than another RockDateTime instance.\r\n *\r\n * @param otherDateTime The other RockDateTime to be compared against.\r\n *\r\n * @returns True if this instance represents a point in time that occurred before another point in time, regardless of time zone.\r\n */\r\n public isEarlierThan(otherDateTime: RockDateTime): boolean {\r\n return this.dateTime.toMillis() < otherDateTime.dateTime.toMillis();\r\n }\r\n\r\n /**\r\n * Calculates the elapsed time between this date and the reference date and\r\n * returns that difference in a human friendly way.\r\n *\r\n * @param otherDateTime The reference date and time. If not specified then 'now' is used.\r\n *\r\n * @returns A string that represents the elapsed time.\r\n */\r\n public humanizeElapsed(otherDateTime?: RockDateTime): string {\r\n otherDateTime = otherDateTime ?? RockDateTime.now();\r\n\r\n const totalSeconds = Math.floor((otherDateTime.dateTime.toMillis() - this.dateTime.toMillis()) / 1000);\r\n\r\n if (totalSeconds <= 1) {\r\n return \"right now\";\r\n }\r\n else if (totalSeconds < 60) { // 1 minute\r\n return `${totalSeconds} seconds ago`;\r\n }\r\n else if (totalSeconds < 3600) { // 1 hour\r\n return `${Math.floor(totalSeconds / 60)} minutes ago`;\r\n }\r\n else if (totalSeconds < 86400) { // 1 day\r\n return `${Math.floor(totalSeconds / 3600)} hours ago`;\r\n }\r\n else if (totalSeconds < 31536000) { // 1 year\r\n return `${Math.floor(totalSeconds / 86400)} days ago`;\r\n }\r\n else {\r\n return `${Math.floor(totalSeconds / 31536000)} years ago`;\r\n }\r\n }\r\n\r\n // #endregion\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { BlockEvent, InvokeBlockActionFunc, SecurityGrant } from \"@Obsidian/Types/Utility/block\";\r\nimport { IBlockPersonPreferencesProvider, IPersonPreferenceCollection } from \"@Obsidian/Types/Core/personPreferences\";\r\nimport { ExtendedRef } from \"@Obsidian/Types/Utility/component\";\r\nimport { DetailBlockBox } from \"@Obsidian/ViewModels/Blocks/detailBlockBox\";\r\nimport { inject, provide, Ref, ref, watch } from \"vue\";\r\nimport { RockDateTime } from \"./rockDateTime\";\r\nimport { Guid } from \"@Obsidian/Types\";\r\nimport { HttpBodyData, HttpPostFunc, HttpResult } from \"@Obsidian/Types/Utility/http\";\r\nimport { BlockActionContextBag } from \"@Obsidian/ViewModels/Blocks/blockActionContextBag\";\r\n\r\nconst blockReloadSymbol = Symbol();\r\nconst configurationValuesChangedSymbol = Symbol();\r\nconst staticContentSymbol = Symbol();\r\n\r\n// TODO: Change these to use symbols\r\n\r\n/**\r\n * Maps the block configuration values to the expected type.\r\n *\r\n * @returns The configuration values for the block.\r\n */\r\nexport function useConfigurationValues(): T {\r\n const result = inject>(\"configurationValues\");\r\n\r\n if (result === undefined) {\r\n throw \"Attempted to access block configuration outside of a RockBlock.\";\r\n }\r\n\r\n return result.value;\r\n}\r\n\r\n/**\r\n * Gets the function that will be used to invoke block actions.\r\n *\r\n * @returns An instance of @see {@link InvokeBlockActionFunc}.\r\n */\r\nexport function useInvokeBlockAction(): InvokeBlockActionFunc {\r\n const result = inject(\"invokeBlockAction\");\r\n\r\n if (result === undefined) {\r\n throw \"Attempted to access block action invocation outside of a RockBlock.\";\r\n }\r\n\r\n return result;\r\n}\r\n\r\n/**\r\n * Creates a function that can be provided to the block that allows calling\r\n * block actions.\r\n *\r\n * @private This should not be used by plugins.\r\n *\r\n * @param post The function to handle the post operation.\r\n * @param pageGuid The unique identifier of the page.\r\n * @param blockGuid The unique identifier of the block.\r\n * @param pageParameters The parameters to include with the block action calls.\r\n *\r\n * @returns A function that can be used to provide the invoke block action.\r\n */\r\nexport function createInvokeBlockAction(post: HttpPostFunc, pageGuid: Guid, blockGuid: Guid, pageParameters: Record): InvokeBlockActionFunc {\r\n async function invokeBlockAction(actionName: string, data: HttpBodyData | undefined = undefined, actionContext: BlockActionContextBag | undefined = undefined): Promise> {\r\n let context: BlockActionContextBag = {};\r\n\r\n if (actionContext) {\r\n context = {...actionContext};\r\n }\r\n\r\n context.pageParameters = pageParameters;\r\n\r\n return await post(`/api/v2/BlockActions/${pageGuid}/${blockGuid}/${actionName}`, undefined, {\r\n __context: context,\r\n ...data\r\n });\r\n }\r\n\r\n return invokeBlockAction;\r\n}\r\n\r\n/**\r\n * Provides the reload block callback function for a block. This is an internal\r\n * method and should not be used by plugins.\r\n *\r\n * @param callback The callback that will be called when a block wants to reload itself.\r\n */\r\nexport function provideReloadBlock(callback: () => void): void {\r\n provide(blockReloadSymbol, callback);\r\n}\r\n\r\n/**\r\n * Gets a function that can be called when a block wants to reload itself.\r\n *\r\n * @returns A function that will cause the block component to be reloaded.\r\n */\r\nexport function useReloadBlock(): () => void {\r\n return inject<() => void>(blockReloadSymbol, () => {\r\n // Intentionally blank, do nothing by default.\r\n });\r\n}\r\n\r\n/**\r\n * Provides the data for a block to be notified when its configuration values\r\n * have changed. This is an internal method and should not be used by plugins.\r\n *\r\n * @returns An object with an invoke and reset function.\r\n */\r\nexport function provideConfigurationValuesChanged(): { invoke: () => void, reset: () => void } {\r\n const callbacks: (() => void)[] = [];\r\n\r\n provide(configurationValuesChangedSymbol, callbacks);\r\n\r\n return {\r\n invoke: (): void => {\r\n for (const c of callbacks) {\r\n c();\r\n }\r\n },\r\n\r\n reset: (): void => {\r\n callbacks.splice(0, callbacks.length);\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Registered a function to be called when the block configuration values have\r\n * changed.\r\n *\r\n * @param callback The function to be called when the configuration values have changed.\r\n */\r\nexport function onConfigurationValuesChanged(callback: () => void): void {\r\n const callbacks = inject<(() => void)[]>(configurationValuesChangedSymbol);\r\n\r\n if (callbacks !== undefined) {\r\n callbacks.push(callback);\r\n }\r\n}\r\n\r\n/**\r\n * Provides the static content that the block provided on the server.\r\n *\r\n * @param content The static content from the server.\r\n */\r\nexport function provideStaticContent(content: string | undefined): void {\r\n provide(staticContentSymbol, content);\r\n}\r\n\r\n/**\r\n * Gets the static content that was provided by the block on the server.\r\n *\r\n * @returns A string of HTML content or undefined.\r\n */\r\nexport function useStaticContent(): string | undefined {\r\n return inject(staticContentSymbol);\r\n}\r\n\r\n\r\n/**\r\n * A type that returns the keys of a child property.\r\n */\r\ntype ChildKeys, PropertyName extends string> = keyof NonNullable & string;\r\n\r\n/**\r\n * A valid properties box that uses the specified name for the content bag.\r\n */\r\ntype ValidPropertiesBox = {\r\n validProperties?: string[] | null;\r\n} & {\r\n [P in PropertyName]?: Record | null;\r\n };\r\n\r\n/**\r\n * Sets the a value for a custom settings box. This will set the value and then\r\n * add the property name to the list of valid properties.\r\n *\r\n * @param box The box whose custom setting value will be set.\r\n * @param propertyName The name of the custom setting property to set.\r\n * @param value The new value of the custom setting.\r\n */\r\nexport function setCustomSettingsBoxValue, S extends NonNullable, K extends ChildKeys>(box: T, propertyName: K, value: S[K]): void {\r\n if (!box.settings) {\r\n box.settings = {} as Record;\r\n }\r\n\r\n box.settings[propertyName] = value;\r\n\r\n if (!box.validProperties) {\r\n box.validProperties = [];\r\n }\r\n\r\n if (!box.validProperties.includes(propertyName)) {\r\n box.validProperties.push(propertyName);\r\n }\r\n}\r\n\r\n/**\r\n * Sets the a value for a property box. This will set the value and then\r\n * add the property name to the list of valid properties.\r\n *\r\n * @param box The box whose property value will be set.\r\n * @param propertyName The name of the property on the bag to set.\r\n * @param value The new value of the property.\r\n */\r\nexport function setPropertiesBoxValue, S extends NonNullable, K extends ChildKeys>(box: T, propertyName: K, value: S[K]): void {\r\n if (!box.bag) {\r\n box.bag = {} as Record;\r\n }\r\n\r\n box.bag[propertyName] = value;\r\n\r\n if (!box.validProperties) {\r\n box.validProperties = [];\r\n }\r\n\r\n if (!box.validProperties.includes(propertyName)) {\r\n box.validProperties.push(propertyName);\r\n }\r\n}\r\n\r\n/**\r\n * Dispatches a block event to the document.\r\n *\r\n * @param eventName The name of the event to be dispatched.\r\n * @param eventData The custom data to be attached to the event.\r\n *\r\n * @returns true if preventDefault() was called on the event, otherwise false.\r\n */\r\nexport function dispatchBlockEvent(eventName: string, blockGuid: Guid, eventData?: unknown): boolean {\r\n const ev = new CustomEvent(eventName, {\r\n cancelable: true,\r\n detail: {\r\n guid: blockGuid,\r\n data: eventData\r\n }\r\n });\r\n\r\n return document.dispatchEvent(ev);\r\n}\r\n\r\n/**\r\n * Tests if the given event is a custom block event. This does not ensure\r\n * that the event data is the correct type, only the event itself.\r\n *\r\n * @param event The event to be tested.\r\n *\r\n * @returns true if the event is a block event.\r\n */\r\nexport function isBlockEvent(event: Event): event is CustomEvent> {\r\n return \"guid\" in event && \"data\" in event;\r\n}\r\n\r\n\r\n// #region Security Grants\r\n\r\nconst securityGrantSymbol = Symbol();\r\n\r\n/**\r\n * Use a security grant token value provided by the server. This returns a reference\r\n * to the actual value and will automatically handle renewing the token and updating\r\n * the value. This function is meant to be used by blocks. Controls should use the\r\n * useSecurityGrant() function instead.\r\n *\r\n * @param token The token provided by the server.\r\n *\r\n * @returns A reference to the security grant that will be updated automatically when it has been renewed.\r\n */\r\nexport function getSecurityGrant(token: string | null | undefined): SecurityGrant {\r\n // Use || so that an empty string gets converted to null.\r\n const tokenRef = ref(token || null);\r\n const invokeBlockAction = useInvokeBlockAction();\r\n let renewalTimeout: NodeJS.Timeout | null = null;\r\n\r\n // Internal function to renew the token and re-schedule renewal.\r\n const renewToken = async (): Promise => {\r\n const result = await invokeBlockAction(\"RenewSecurityGrantToken\");\r\n\r\n if (result.isSuccess && result.data) {\r\n tokenRef.value = result.data;\r\n\r\n scheduleRenewal();\r\n }\r\n };\r\n\r\n // Internal function to schedule renewal based on the expiration date in\r\n // the existing token. Renewal happens 15 minutes before expiration.\r\n const scheduleRenewal = (): void => {\r\n // Cancel any existing renewal timer.\r\n if (renewalTimeout !== null) {\r\n clearTimeout(renewalTimeout);\r\n renewalTimeout = null;\r\n }\r\n\r\n // No token, nothing to do.\r\n if (tokenRef.value === null) {\r\n return;\r\n }\r\n\r\n const segments = tokenRef.value?.split(\";\");\r\n\r\n // Token not in expected format.\r\n if (segments.length !== 3 || segments[0] !== \"1\") {\r\n return;\r\n }\r\n\r\n const expiresDateTime = RockDateTime.parseISO(segments[1]);\r\n\r\n // Could not parse expiration date and time.\r\n if (expiresDateTime === null) {\r\n return;\r\n }\r\n\r\n const renewTimeout = expiresDateTime.addMinutes(-15).toMilliseconds() - RockDateTime.now().toMilliseconds();\r\n\r\n // Renewal request would be in the past, ignore.\r\n if (renewTimeout < 0) {\r\n return;\r\n }\r\n\r\n // Schedule the renewal task to happen 15 minutes before expiration.\r\n renewalTimeout = setTimeout(renewToken, renewTimeout);\r\n };\r\n\r\n scheduleRenewal();\r\n\r\n return {\r\n token: tokenRef,\r\n updateToken(newToken) {\r\n tokenRef.value = newToken || null;\r\n scheduleRenewal();\r\n }\r\n };\r\n}\r\n\r\n/**\r\n * Provides the security grant to child components to use in their API calls.\r\n *\r\n * @param grant The grant ot provide to child components.\r\n */\r\nexport function provideSecurityGrant(grant: SecurityGrant): void {\r\n provide(securityGrantSymbol, grant);\r\n}\r\n\r\n/**\r\n * Uses a previously provided security grant token by a parent component.\r\n * This function is meant to be used by controls that need to obtain a security\r\n * grant from a parent component.\r\n *\r\n * @returns A string reference that contains the security grant token.\r\n */\r\nexport function useSecurityGrantToken(): Ref {\r\n const grant = inject(securityGrantSymbol);\r\n\r\n return grant ? grant.token : ref(null);\r\n}\r\n\r\n// #endregion\r\n\r\n// #region Extended References\r\n\r\n/** An emit object that conforms to having a propertyChanged event. */\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\nexport type PropertyChangedEmitFn = E extends Array ? (event: EE, ...args: any[]) => void : (event: E, ...args: any[]) => void;\r\n\r\n/**\r\n * Watches for changes to the given Ref objects and emits a special event to\r\n * indicate that a given property has changed.\r\n *\r\n * @param propertyRefs The ExtendedRef objects to watch for changes.\r\n * @param emit The emit function for the component.\r\n */\r\nexport function watchPropertyChanges(propertyRefs: ExtendedRef[], emit: PropertyChangedEmitFn): void {\r\n for (const propRef of propertyRefs) {\r\n watch(propRef, () => {\r\n if (propRef.context.propertyName) {\r\n emit(\"propertyChanged\", propRef.context.propertyName);\r\n }\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Requests an updated attribute list from the server based on the\r\n * current UI selections made.\r\n *\r\n * @param bag The entity bag that will be used to determine current property values\r\n * and then updated with the new attributes and values.\r\n * @param validProperties The properties that are considered valid on the bag when\r\n * the server will read the bag.\r\n * @param invokeBlockAction The function to use when calling the block action.\r\n */\r\nexport async function refreshDetailAttributes(bag: Ref, validProperties: string[], invokeBlockAction: InvokeBlockActionFunc): Promise {\r\n const data: DetailBlockBox = {\r\n entity: bag.value,\r\n isEditable: true,\r\n validProperties: validProperties\r\n };\r\n\r\n const result = await invokeBlockAction, unknown>>(\"RefreshAttributes\", {\r\n box: data\r\n });\r\n\r\n if (result.isSuccess) {\r\n if (result.statusCode === 200 && result.data && bag.value) {\r\n const newBag: TEntityBag = {\r\n ...bag.value,\r\n attributes: result.data.entity?.attributes,\r\n attributeValues: result.data.entity?.attributeValues\r\n };\r\n\r\n bag.value = newBag;\r\n }\r\n }\r\n}\r\n\r\n// #endregion Extended Refs\r\n\r\n// #region Block Guid\r\n\r\nconst blockGuidSymbol = Symbol(\"block-guid\");\r\n\r\n/**\r\n * Provides the block unique identifier to all child components.\r\n * This is an internal method and should not be used by plugins.\r\n *\r\n * @param blockGuid The unique identifier of the block.\r\n */\r\nexport function provideBlockGuid(blockGuid: string): void {\r\n provide(blockGuidSymbol, blockGuid);\r\n}\r\n\r\n/**\r\n * Gets the unique identifier of the current block in this component chain.\r\n *\r\n * @returns The unique identifier of the block.\r\n */\r\nexport function useBlockGuid(): Guid | undefined {\r\n return inject(blockGuidSymbol);\r\n}\r\n\r\n// #endregion\r\n\r\n// #region Person Preferences\r\n\r\nconst blockPreferenceProviderSymbol = Symbol();\r\n\r\n/** An no-op implementation of {@link IPersonPreferenceCollection}. */\r\nconst emptyPreferences: IPersonPreferenceCollection = {\r\n getValue(): string {\r\n return \"\";\r\n },\r\n setValue(): void {\r\n // Intentionally empty.\r\n },\r\n getKeys(): string[] {\r\n return [];\r\n },\r\n containsKey(): boolean {\r\n return false;\r\n },\r\n save(): Promise {\r\n return Promise.resolve();\r\n },\r\n withPrefix(): IPersonPreferenceCollection {\r\n return emptyPreferences;\r\n }\r\n};\r\n\r\nconst emptyPreferenceProvider: IBlockPersonPreferencesProvider = {\r\n blockPreferences: emptyPreferences,\r\n getGlobalPreferences() {\r\n return Promise.resolve(emptyPreferences);\r\n },\r\n getEntityPreferences() {\r\n return Promise.resolve(emptyPreferences);\r\n }\r\n};\r\n\r\n/**\r\n * Provides the person preferences provider that will be used by components\r\n * to access the person preferences associated with their block.\r\n *\r\n * @private This is an internal method and should not be used by plugins.\r\n *\r\n * @param blockGuid The unique identifier of the block.\r\n */\r\nexport function providePersonPreferences(provider: IBlockPersonPreferencesProvider): void {\r\n provide(blockPreferenceProviderSymbol, provider);\r\n}\r\n\r\n/**\r\n * Gets the person preference provider that can be used to access block\r\n * preferences as well as other preferences.\r\n *\r\n * @returns An object that implements {@link IBlockPersonPreferencesProvider}.\r\n */\r\nexport function usePersonPreferences(): IBlockPersonPreferencesProvider {\r\n return inject(blockPreferenceProviderSymbol)\r\n ?? emptyPreferenceProvider;\r\n}\r\n\r\n// #endregion\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\n/**\r\n * Transform the value into true, false, or null\r\n * @param val\r\n */\r\nexport function asBooleanOrNull(val: unknown): boolean | null {\r\n if (val === undefined || val === null) {\r\n return null;\r\n }\r\n\r\n if (typeof val === \"boolean\") {\r\n return val;\r\n }\r\n\r\n if (typeof val === \"string\") {\r\n const asString = (val || \"\").trim().toLowerCase();\r\n\r\n if (!asString) {\r\n return null;\r\n }\r\n\r\n return [\"true\", \"yes\", \"t\", \"y\", \"1\"].indexOf(asString) !== -1;\r\n }\r\n\r\n if (typeof val === \"number\") {\r\n return !!val;\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Transform the value into true or false\r\n * @param val\r\n */\r\nexport function asBoolean(val: unknown): boolean {\r\n return !!asBooleanOrNull(val);\r\n}\r\n\r\n/** Transform the value into the strings \"Yes\", \"No\", or null */\r\nexport function asYesNoOrNull(val: unknown): \"Yes\" | \"No\" | null {\r\n const boolOrNull = asBooleanOrNull(val);\r\n\r\n if (boolOrNull === null) {\r\n return null;\r\n }\r\n\r\n return boolOrNull ? \"Yes\" : \"No\";\r\n}\r\n\r\n/** Transform the value into the strings \"True\", \"False\", or null */\r\nexport function asTrueFalseOrNull(val: unknown): \"True\" | \"False\" | null {\r\n const boolOrNull = asBooleanOrNull(val);\r\n\r\n if (boolOrNull === null) {\r\n return null;\r\n }\r\n\r\n return boolOrNull ? \"True\" : \"False\";\r\n}\r\n\r\n/** Transform the value into the strings \"True\" if truthy or \"False\" if falsey */\r\nexport function asTrueOrFalseString(val: unknown): \"True\" | \"False\" {\r\n const boolOrNull = asBooleanOrNull(val);\r\n\r\n return boolOrNull ? \"True\" : \"False\";\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\nimport mitt from \"mitt\";\r\nimport { RockDateTime } from \"./rockDateTime\";\r\n\r\n/**\r\n * The bus allows page components to send and receive arbitrary data from other page components.\r\n */\r\ntype LogItem = {\r\n date: RockDateTime;\r\n message: string;\r\n};\r\n\r\nconst bus = mitt();\r\nconst log: LogItem[] = [];\r\n\r\n/**\r\n* Write a log entry that a payload was sent or received.\r\n*/\r\nconst writeLog = (msg: string): void => {\r\n log.push({\r\n date: RockDateTime.now(),\r\n message: msg\r\n });\r\n};\r\n\r\n/**\r\n* Send the payload to subscribers listening for the event name\r\n*/\r\nfunction publish(eventName: string, payload: T): void {\r\n writeLog(`Published ${eventName}`);\r\n bus.emit(eventName, payload);\r\n}\r\n\r\n/**\r\n* Whenever an event is received of eventName, the callback is executed with the message\r\n* payload as a parameter.\r\n*/\r\nfunction subscribe(eventName: string, callback: (payload: T) => void): void {\r\n writeLog(`Subscribed to ${eventName}`);\r\n bus.on(eventName, payload => {\r\n if (payload) {\r\n callback(payload as T);\r\n }\r\n });\r\n}\r\n\r\nexport default {\r\n publish,\r\n subscribe,\r\n log\r\n};\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n\r\nimport { RockDateTime } from \"./rockDateTime\";\r\n\r\n//\r\ntype CacheEntry = {\r\n value: T;\r\n expiration: number;\r\n};\r\n\r\n/**\r\n* Stores the value using the given key. The cache will expire at the expiration or in\r\n* 1 minute if none is provided\r\n* @param key\r\n* @param value\r\n* @param expiration\r\n*/\r\nfunction set(key: string, value: T, expirationDT: RockDateTime | null = null): void {\r\n let expiration: number;\r\n\r\n if (expirationDT) {\r\n expiration = expirationDT.toMilliseconds();\r\n }\r\n else {\r\n // Default to one minute\r\n expiration = RockDateTime.now().addMinutes(1).toMilliseconds();\r\n }\r\n\r\n const cache: CacheEntry = { expiration, value };\r\n const cacheJson = JSON.stringify(cache);\r\n sessionStorage.setItem(key, cacheJson);\r\n}\r\n\r\n/**\r\n * Gets a stored cache value if there is one that has not yet expired.\r\n * @param key\r\n */\r\nfunction get(key: string): T | null {\r\n const cacheJson = sessionStorage.getItem(key);\r\n\r\n if (!cacheJson) {\r\n return null;\r\n }\r\n\r\n const cache = JSON.parse(cacheJson) as CacheEntry;\r\n\r\n if (!cache || !cache.expiration) {\r\n return null;\r\n }\r\n\r\n if (cache.expiration < RockDateTime.now().toMilliseconds()) {\r\n return null;\r\n }\r\n\r\n return cache.value;\r\n}\r\n\r\nconst promiseCache: Record | undefined> = {};\r\n\r\n/**\r\n * Since Promises can't be cached, we need to store them in memory until we get the result back. This wraps\r\n * a function in another function that returns a promise and...\r\n * - If there's a cached result, return it\r\n * - Otherwise if there's a cached Promise, return it\r\n * - Otherwise call the given function and cache it's promise and return it. Once the the Promise resolves, cache its result\r\n *\r\n * @param key Key for identifying the cached values\r\n * @param fn Function that returns a Promise that we want to cache the value of\r\n *\r\n */\r\nfunction cachePromiseFactory(key: string, fn: () => Promise, expiration: RockDateTime | null = null): () => Promise {\r\n return async function (): Promise {\r\n // If it's cached, grab it\r\n const cachedResult = get(key);\r\n if (cachedResult) {\r\n return cachedResult;\r\n }\r\n\r\n // If it's not cached yet but we've already started fetching it\r\n // (it's not cached until we receive the results), return the existing Promise\r\n if (promiseCache[key]) {\r\n return promiseCache[key] as Promise;\r\n }\r\n\r\n // Not stored anywhere, so fetch it and save it on the stored Promise for the next call\r\n promiseCache[key] = fn();\r\n\r\n // Once it's resolved, cache the result\r\n promiseCache[key]?.then((result) => {\r\n set(key, result, expiration);\r\n delete promiseCache[key];\r\n return result;\r\n }).catch((e: Error) => {\r\n // Something's wrong, let's get rid of the stored promise, so we can try again.\r\n delete promiseCache[key];\r\n throw e;\r\n });\r\n\r\n return promiseCache[key] as Promise;\r\n };\r\n}\r\n\r\n\r\nexport default {\r\n set,\r\n get,\r\n cachePromiseFactory: cachePromiseFactory\r\n};\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n\r\nimport mitt, { Emitter } from \"mitt\";\r\n\r\n// NOTE: Much of the logic for this was taken from VSCode's MIT licensed version:\r\n// https://github.com/microsoft/vscode/blob/342394d1e7d43d3324dc2ede1d634cffd52ba159/src/vs/base/common/cancellation.ts\r\n\r\n/**\r\n * A cancellation token can be used to instruct some operation to run but abort\r\n * if a certain condition is met.\r\n */\r\nexport interface ICancellationToken {\r\n /**\r\n * A flag signalling is cancellation has been requested.\r\n */\r\n readonly isCancellationRequested: boolean;\r\n\r\n /**\r\n * Registers a listener for when cancellation has been requested. This event\r\n * only ever fires `once` as cancellation can only happen once. Listeners\r\n * that are registered after cancellation will be called (next event loop run),\r\n * but also only once.\r\n *\r\n * @param listener The function to be called when the token has been cancelled.\r\n */\r\n onCancellationRequested(listener: () => void): void;\r\n}\r\n\r\nfunction shortcutCancelledEvent(listener: () => void): void {\r\n window.setTimeout(listener, 0);\r\n}\r\n\r\n/**\r\n * Determines if something is a cancellation token.\r\n *\r\n * @param thing The thing to be checked to see if it is a cancellation token.\r\n *\r\n * @returns true if the @{link thing} is a cancellation token, otherwise false.\r\n */\r\nexport function isCancellationToken(thing: unknown): thing is ICancellationToken {\r\n if (thing === CancellationTokenNone || thing === CancellationTokenCancelled) {\r\n return true;\r\n }\r\n if (thing instanceof MutableToken) {\r\n return true;\r\n }\r\n if (!thing || typeof thing !== \"object\") {\r\n return false;\r\n }\r\n return typeof (thing as ICancellationToken).isCancellationRequested === \"boolean\"\r\n && typeof (thing as ICancellationToken).onCancellationRequested === \"function\";\r\n}\r\n\r\n/**\r\n * A cancellation token that will never be in a cancelled state.\r\n */\r\nexport const CancellationTokenNone = Object.freeze({\r\n isCancellationRequested: false,\r\n onCancellationRequested() {\r\n // Intentionally blank.\r\n }\r\n});\r\n\r\n/**\r\n * A cancellation token that is already in a cancelled state.\r\n */\r\nexport const CancellationTokenCancelled = Object.freeze({\r\n isCancellationRequested: true,\r\n onCancellationRequested: shortcutCancelledEvent\r\n});\r\n\r\n/**\r\n * Internal implementation of a cancellation token that starts initially as\r\n * active but can later be switched to a cancelled state.\r\n */\r\nclass MutableToken implements ICancellationToken {\r\n private isCancelled: boolean = false;\r\n private emitter: Emitter> | null = null;\r\n\r\n /**\r\n * Cancels the token and fires any registered event listeners.\r\n */\r\n public cancel(): void {\r\n if (!this.isCancelled) {\r\n this.isCancelled = true;\r\n if (this.emitter) {\r\n this.emitter.emit(\"cancel\", undefined);\r\n this.emitter = null;\r\n }\r\n }\r\n }\r\n\r\n // #region ICancellationToken implementation\r\n\r\n get isCancellationRequested(): boolean {\r\n return this.isCancelled;\r\n }\r\n\r\n onCancellationRequested(listener: () => void): void {\r\n if (this.isCancelled) {\r\n return shortcutCancelledEvent(listener);\r\n }\r\n\r\n if (!this.emitter) {\r\n this.emitter = mitt();\r\n }\r\n\r\n this.emitter.on(\"cancel\", listener);\r\n }\r\n\r\n // #endregion\r\n}\r\n\r\n/**\r\n * Creates a source instance that can be used to trigger a cancellation\r\n * token into the cancelled state.\r\n */\r\nexport class CancellationTokenSource {\r\n /** The token that can be passed to functions. */\r\n private internalToken?: ICancellationToken = undefined;\r\n\r\n /**\r\n * Creates a new instance of {@link CancellationTokenSource}.\r\n *\r\n * @param parent The parent cancellation token that will also cancel this source.\r\n */\r\n constructor(parent?: ICancellationToken) {\r\n if (parent) {\r\n parent.onCancellationRequested(() => this.cancel());\r\n }\r\n }\r\n\r\n /**\r\n * The cancellation token that can be used to determine when the task\r\n * should be cancelled.\r\n */\r\n get token(): ICancellationToken {\r\n if (!this.internalToken) {\r\n // be lazy and create the token only when\r\n // actually needed\r\n this.internalToken = new MutableToken();\r\n }\r\n\r\n return this.internalToken;\r\n }\r\n\r\n /**\r\n * Moves the token into a cancelled state.\r\n */\r\n cancel(): void {\r\n if (!this.internalToken) {\r\n // Save an object creation by returning the default cancelled\r\n // token when cancellation happens before someone asks for the\r\n // token.\r\n this.internalToken = CancellationTokenCancelled;\r\n\r\n }\r\n else if (this.internalToken instanceof MutableToken) {\r\n // Actually cancel the existing token.\r\n this.internalToken.cancel();\r\n }\r\n }\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\n/**\r\n * Compares two values for equality by performing deep nested comparisons\r\n * if the values are objects or arrays.\r\n * \r\n * @param a The first value to compare.\r\n * @param b The second value to compare.\r\n * @param strict True if strict comparision is required (meaning 1 would not equal \"1\").\r\n *\r\n * @returns True if the two values are equal to each other.\r\n */\r\nexport function deepEqual(a: unknown, b: unknown, strict: boolean): boolean {\r\n // Catches everything but objects.\r\n if (strict && a === b) {\r\n return true;\r\n }\r\n else if (!strict && a == b) {\r\n return true;\r\n }\r\n\r\n // NaN never equals another NaN, but functionally they are the same.\r\n if (typeof a === \"number\" && typeof b === \"number\" && isNaN(a) && isNaN(b)) {\r\n return true;\r\n }\r\n\r\n // Remaining value types must both be of type object\r\n if (a && b && typeof a === \"object\" && typeof b === \"object\") {\r\n // Array status must match.\r\n if (Array.isArray(a) !== Array.isArray(b)) {\r\n return false;\r\n }\r\n\r\n if (Array.isArray(a) && Array.isArray(b)) {\r\n // Array lengths must match.\r\n if (a.length !== b.length) {\r\n return false;\r\n }\r\n\r\n // Each element in the array must match.\r\n for (let i = 0; i < a.length; i++) {\r\n if (!deepEqual(a[i], b[i], strict)) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n else {\r\n // NOTE: There are a few edge cases not accounted for here, but they\r\n // are rare and unusual:\r\n // Map, Set, ArrayBuffer, RegExp\r\n\r\n // The objects must be of the same \"object type\".\r\n if (a.constructor !== b.constructor) {\r\n return false;\r\n }\r\n\r\n // Get all the key/value pairs of each object and sort them so they\r\n // are in the same order as each other.\r\n const aEntries = Object.entries(a).sort((a, b) => a[0] < b[0] ? -1 : (a[0] > b[0] ? 1 : 0));\r\n const bEntries = Object.entries(b).sort((a, b) => a[0] < b[0] ? -1 : (a[0] > b[0] ? 1 : 0));\r\n\r\n // Key/value count must be identical.\r\n if (aEntries.length !== bEntries.length) {\r\n return false;\r\n }\r\n\r\n for (let i = 0; i < aEntries.length; i++) {\r\n const aEntry = aEntries[i];\r\n const bEntry = bEntries[i];\r\n\r\n // Ensure the keys are equal, must always be strict.\r\n if (!deepEqual(aEntry[0], bEntry[0], true)) {\r\n return false;\r\n }\r\n\r\n // Ensure the values are equal.\r\n if (!deepEqual(aEntry[1], bEntry[1], strict)) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\n\r\n/**\r\n * Debounces the function so it will only be called once during the specified\r\n * delay period. The returned function should be called to trigger the original\r\n * function that is to be debounced.\r\n * \r\n * @param fn The function to be called once per delay period.\r\n * @param delay The period in milliseconds. If the returned function is called\r\n * more than once during this period then fn will only be executed once for\r\n * the period. If not specified then it defaults to 250ms.\r\n * @param eager If true then the fn function will be called immediately and\r\n * then any subsequent calls will be debounced.\r\n *\r\n * @returns A function to be called when fn should be executed.\r\n */\r\nexport function debounce(fn: (() => void), delay: number = 250, eager: boolean = false): (() => void) {\r\n let timeout: NodeJS.Timeout | null = null;\r\n\r\n return (): void => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n }\r\n else if (eager) {\r\n // If there was no previous timeout and we are configured for\r\n // eager calls, then execute now.\r\n fn();\r\n\r\n // An eager call should not result in a final debounce call.\r\n timeout = setTimeout(() => timeout = null, delay);\r\n\r\n return;\r\n }\r\n\r\n // If we had a previous timeout or we are not set for eager calls\r\n // then set a timeout to initiate the function after the delay.\r\n timeout = setTimeout(() => {\r\n timeout = null;\r\n fn();\r\n }, delay);\r\n };\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { Guid } from \"@Obsidian/Types\";\r\nimport { newGuid } from \"./guid\";\r\nimport { inject, nextTick, provide } from \"vue\";\r\n\r\nconst suspenseSymbol = Symbol(\"RockSuspense\");\r\n\r\n/**\r\n * Defines the interface for a provider of suspense monitoring. These are used\r\n * to track asynchronous operations that components may be performing so the\r\n * watching component can perform an operation once all pending operations\r\n * have completed.\r\n */\r\nexport interface ISuspenseProvider {\r\n /**\r\n * Adds a new operation identified by the promise. When the promise\r\n * either resolves or fails the operation is considered completed.\r\n *\r\n * @param operation The promise that represents the operation.\r\n */\r\n addOperation(operation: Promise): void;\r\n\r\n /**\r\n * Notes that an asynchronous operation has started on a child component.\r\n *\r\n * @param key The key that identifies the operation.\r\n */\r\n startAsyncOperation(key: Guid): void;\r\n\r\n /**\r\n * Notes that an asynchrounous operation has completed on a child component.\r\n *\r\n * @param key The key that was previously passed to startAsyncOperation.\r\n */\r\n completeAsyncOperation(key: Guid): void;\r\n}\r\n\r\n/**\r\n * A basic provider that handles the guts of a suspense provider. This can be\r\n * used by components that need to know when child components have completed\r\n * their work.\r\n */\r\nexport class BasicSuspenseProvider implements ISuspenseProvider {\r\n private readonly operationKey: Guid;\r\n\r\n private readonly parentProvider: ISuspenseProvider | undefined;\r\n\r\n private readonly pendingOperations: Guid[];\r\n\r\n private finishedHandlers: (() => void)[];\r\n\r\n /**\r\n * Creates a new suspense provider.\r\n *\r\n * @param parentProvider The parent suspense provider that will be notified of pending operations.\r\n */\r\n constructor(parentProvider: ISuspenseProvider | undefined) {\r\n this.operationKey = newGuid();\r\n this.parentProvider = parentProvider;\r\n this.pendingOperations = [];\r\n this.finishedHandlers = [];\r\n }\r\n\r\n /**\r\n * Called when all pending operations are complete. Notifies all handlers\r\n * that the pending operations have completed as well as the parent provider.\r\n */\r\n private allOperationsComplete(): void {\r\n // Wait until the next Vue tick in case a new async operation started.\r\n // This can happen, for example, with defineAsyncComponent(). It will\r\n // complete its async operation (loading the JS file) and then the\r\n // component defined in the file might start an async operation. This\r\n // prevents us from completing too soon.\r\n nextTick(() => {\r\n // Verify nothing started a new asynchronous operation while we\r\n // we waiting for the next tick.\r\n if (this.pendingOperations.length !== 0) {\r\n return;\r\n }\r\n\r\n // Notify all pending handlers that all operations completed.\r\n for (const handler of this.finishedHandlers) {\r\n handler();\r\n }\r\n this.finishedHandlers = [];\r\n\r\n // Notify the parent that our own pending operation has completed.\r\n if (this.parentProvider) {\r\n this.parentProvider.completeAsyncOperation(this.operationKey);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Adds a new operation identified by the promise. When the promise\r\n * either resolves or fails the operation is considered completed.\r\n *\r\n * @param operation The promise that represents the operation.\r\n */\r\n public addOperation(operation: Promise): void {\r\n const operationKey = newGuid();\r\n\r\n this.startAsyncOperation(operationKey);\r\n\r\n operation.then(() => this.completeAsyncOperation(operationKey))\r\n .catch(() => this.completeAsyncOperation(operationKey));\r\n }\r\n\r\n /**\r\n * Notes that an asynchronous operation has started on a child component.\r\n *\r\n * @param key The key that identifies the operation.\r\n */\r\n public startAsyncOperation(key: Guid): void {\r\n this.pendingOperations.push(key);\r\n\r\n // If this is the first operation we started, notify the parent provider.\r\n if (this.pendingOperations.length === 1 && this.parentProvider) {\r\n this.parentProvider.startAsyncOperation(this.operationKey);\r\n }\r\n }\r\n\r\n /**\r\n * Notes that an asynchrounous operation has completed on a child component.\r\n *\r\n * @param key The key that was previously passed to startAsyncOperation.\r\n */\r\n public completeAsyncOperation(key: Guid): void {\r\n const index = this.pendingOperations.indexOf(key);\r\n\r\n if (index !== -1) {\r\n this.pendingOperations.splice(index, 1);\r\n }\r\n\r\n // If this was the last operation then send notifications.\r\n if (this.pendingOperations.length === 0) {\r\n this.allOperationsComplete();\r\n }\r\n }\r\n\r\n /**\r\n * Checks if this provider has any asynchronous operations that are still\r\n * pending completion.\r\n *\r\n * @returns true if there are pending operations; otherwise false.\r\n */\r\n public hasPendingOperations(): boolean {\r\n return this.pendingOperations.length > 0;\r\n }\r\n\r\n /**\r\n * Adds a new handler that is called when all pending operations have been\r\n * completed. This is a fire-once, meaning the callback will only be called\r\n * when the current pending operations have completed. If new operations\r\n * begin after the callback is executed it will not be called again unless\r\n * it is added with this method again.\r\n *\r\n * @param callback The function to call when all pending operations have completed.\r\n */\r\n public addFinishedHandler(callback: () => void): void {\r\n this.finishedHandlers.push(callback);\r\n }\r\n}\r\n\r\n/**\r\n * Provides a new suspense provider to any child components.\r\n *\r\n * @param provider The provider to make available to child components.\r\n */\r\nexport function provideSuspense(provider: ISuspenseProvider): void {\r\n provide(suspenseSymbol, provider);\r\n}\r\n\r\n/**\r\n * Uses the current suspense provider that was defined by any parent component.\r\n *\r\n * @returns The suspense provider if one was defined; otherwise undefined.\r\n */\r\nexport function useSuspense(): ISuspenseProvider | undefined {\r\n return inject(suspenseSymbol);\r\n}\r\n\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n\r\nimport { CurrencyInfoBag } from \"../ViewModels/Rest/Utilities/currencyInfoBag\";\r\n\r\n// From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat\r\n// Number.toLocaleString takes the same options as Intl.NumberFormat\r\n// Most of the options probably won't get used, so just add the ones you need to use to this when needed\r\ntype NumberFormatOptions = {\r\n useGrouping?: boolean // MDN gives other possible values, but TS is complaining that it should only be boolean\r\n};\r\n\r\n/**\r\n * Get a formatted string.\r\n * Ex: 10001.2 => 10,001.2\r\n * @param num\r\n */\r\nexport function asFormattedString(num: number | null, digits?: number, options: NumberFormatOptions = {}): string {\r\n if (num === null) {\r\n return \"\";\r\n }\r\n\r\n return num.toLocaleString(\r\n \"en-US\",\r\n {\r\n minimumFractionDigits: digits,\r\n maximumFractionDigits: digits ?? 9,\r\n ...options\r\n }\r\n );\r\n}\r\n\r\n/**\r\n * Get a number value from a formatted string. If the number cannot be parsed, then zero is returned by default.\r\n * Ex: $1,000.20 => 1000.2\r\n * @param str\r\n */\r\nexport function toNumber(str?: string | number | null): number {\r\n return toNumberOrNull(str) || 0;\r\n}\r\n\r\n/**\r\n * Get a number value from a formatted string. If the number cannot be parsed, then null is returned by default.\r\n * Ex: $1,000.20 => 1000.2\r\n * @param str\r\n */\r\nexport function toNumberOrNull(str?: string | number | null): number | null {\r\n if (str === null || str === undefined || str === \"\") {\r\n return null;\r\n }\r\n\r\n if (typeof str === \"number\") {\r\n return str;\r\n }\r\n\r\n const replaced = str.replace(/[$,]/g, \"\");\r\n const num = Number(replaced);\r\n\r\n return !isNaN(num) ? num : null;\r\n}\r\n\r\n/**\r\n * Get a currency value from a string or number. If the number cannot be parsed, then null is returned by default.\r\n * Ex: 1000.20 => $1,000.20\r\n * @param value The value to be converted to a currency.\r\n */\r\nexport function toCurrencyOrNull(value?: string | number | null, currencyInfo: CurrencyInfoBag | null = null): string | null {\r\n if (typeof value === \"string\") {\r\n value = toNumberOrNull(value);\r\n }\r\n\r\n if (value === null || value === undefined) {\r\n return null;\r\n }\r\n const currencySymbol = currencyInfo?.symbol ?? \"$\";\r\n const currencyDecimalPlaces = currencyInfo?.decimalPlaces ?? 2;\r\n return `${currencySymbol}${asFormattedString(value, currencyDecimalPlaces)}`;\r\n}\r\n\r\n/**\r\n * Adds an ordinal suffix.\r\n * Ex: 1 => 1st\r\n * @param num\r\n */\r\nexport function toOrdinalSuffix(num?: number | null): string {\r\n if (!num) {\r\n return \"\";\r\n }\r\n\r\n const j = num % 10;\r\n const k = num % 100;\r\n\r\n if (j == 1 && k != 11) {\r\n return num + \"st\";\r\n }\r\n if (j == 2 && k != 12) {\r\n return num + \"nd\";\r\n }\r\n if (j == 3 && k != 13) {\r\n return num + \"rd\";\r\n }\r\n return num + \"th\";\r\n}\r\n\r\n/**\r\n * Convert a number to an ordinal.\r\n * Ex: 1 => first\r\n * @param num\r\n */\r\nexport function toOrdinal(num?: number | null): string {\r\n if (!num) {\r\n return \"\";\r\n }\r\n\r\n switch (num) {\r\n case 1: return \"first\";\r\n case 2: return \"second\";\r\n case 3: return \"third\";\r\n case 4: return \"fourth\";\r\n case 5: return \"fifth\";\r\n case 6: return \"sixth\";\r\n case 7: return \"seventh\";\r\n case 8: return \"eighth\";\r\n case 9: return \"ninth\";\r\n case 10: return \"tenth\";\r\n default: return toOrdinalSuffix(num);\r\n }\r\n}\r\n\r\n/**\r\n * Convert a number to a word.\r\n * Ex: 1 => one\r\n * @param num\r\n */\r\nexport function toWord(num?: number | null): string {\r\n if (num === null || num === undefined) {\r\n return \"\";\r\n }\r\n\r\n switch (num) {\r\n case 1: return \"one\";\r\n case 2: return \"two\";\r\n case 3: return \"three\";\r\n case 4: return \"four\";\r\n case 5: return \"five\";\r\n case 6: return \"six\";\r\n case 7: return \"seven\";\r\n case 8: return \"eight\";\r\n case 9: return \"nine\";\r\n case 10: return \"ten\";\r\n default: return `${num}`;\r\n }\r\n}\r\n\r\nexport function zeroPad(num: number, length: number): string {\r\n let str = num.toString();\r\n\r\n while (str.length < length) {\r\n str = \"0\" + str;\r\n }\r\n\r\n return str;\r\n}\r\n\r\nexport function toDecimalPlaces(num: number, decimalPlaces: number): number {\r\n decimalPlaces = Math.floor(decimalPlaces); // ensure it's an integer\r\n\r\n return Math.round(num * 10 ** decimalPlaces) / 10 ** decimalPlaces;\r\n}\r\n\r\nexport default {\r\n toOrdinal,\r\n toOrdinalSuffix,\r\n toNumberOrNull,\r\n asFormattedString\r\n};\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n\r\nimport { AsyncComponentLoader, Component, ComponentPublicInstance, defineAsyncComponent as vueDefineAsyncComponent, ExtractPropTypes, PropType, reactive, ref, Ref, VNode, watch, WatchOptions, render, isVNode, createVNode } from \"vue\";\r\nimport { deepEqual } from \"./util\";\r\nimport { useSuspense } from \"./suspense\";\r\nimport { newGuid } from \"./guid\";\r\nimport { ControlLazyMode } from \"@Obsidian/Enums/Controls/controlLazyMode\";\r\nimport { PickerDisplayStyle } from \"@Obsidian/Enums/Controls/pickerDisplayStyle\";\r\nimport { ExtendedRef, ExtendedRefContext } from \"@Obsidian/Types/Utility/component\";\r\nimport type { RulesPropType, ValidationRule } from \"@Obsidian/Types/validationRules\";\r\nimport { toNumberOrNull } from \"./numberUtils\";\r\n\r\ntype Prop = { [key: string]: unknown };\r\ntype PropKey = Extract;\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ntype EmitFn = E extends Array ? (event: EE, ...args: any[]) => void : (event: E, ...args: any[]) => void;\r\n\r\n/**\r\n * Utility function for when you are using a component that takes a v-model\r\n * and uses that model as a v-model in that component's template. It creates\r\n * a new ref that keeps itself up-to-date with the given model and fires an\r\n * 'update:MODELNAME' event when it gets changed.\r\n *\r\n * Ensure the related `props` and `emits` are specified to ensure there are\r\n * no type issues.\r\n */\r\nexport function useVModelPassthrough, E extends `update:${K}`>(props: T, modelName: K, emit: EmitFn, options?: WatchOptions): Ref {\r\n const internalValue = ref(props[modelName]) as Ref;\r\n\r\n watch(() => props[modelName], val => updateRefValue(internalValue, val), options);\r\n watch(internalValue, val => {\r\n if (val !== props[modelName]) {\r\n emit(`update:${modelName}`, val);\r\n }\r\n }, options);\r\n\r\n return internalValue;\r\n}\r\n\r\n/**\r\n * Utility function for when you are using a component that takes a v-model\r\n * and uses that model as a v-model in that component's template. It creates\r\n * a new ref that keeps itself up-to-date with the given model and fires an\r\n * 'update:MODELNAME' event when it gets changed. It also gives a means of watching\r\n * the model prop for any changes (verifies that the prop change is different than\r\n * the current value first)\r\n *\r\n * Ensure the related `props` and `emits` are specified to ensure there are\r\n * no type issues.\r\n */\r\nexport function useVModelPassthroughWithPropUpdateCheck, E extends `update:${K}`>(props: T, modelName: K, emit: EmitFn, options?: WatchOptions): [Ref, (fn: () => unknown) => void] {\r\n const internalValue = ref(props[modelName]) as Ref;\r\n const listeners: (() => void)[] = [];\r\n\r\n watch(() => props[modelName], val => {\r\n if (updateRefValue(internalValue, val)) {\r\n onPropUpdate();\r\n }\r\n }, options);\r\n watch(internalValue, val => emit(`update:${modelName}`, val), options);\r\n\r\n function onPropUpdate(): void {\r\n listeners.forEach(fn => fn());\r\n }\r\n\r\n function addPropUpdateListener(fn: () => unknown): void {\r\n listeners.push(fn);\r\n }\r\n\r\n return [internalValue, addPropUpdateListener];\r\n}\r\n\r\n/**\r\n * Updates the Ref value, but only if the new value is actually different than\r\n * the current value. A deep comparison is performed.\r\n *\r\n * @param target The target Ref object to be updated.\r\n * @param value The new value to be assigned to the target.\r\n *\r\n * @returns True if the target was updated, otherwise false.\r\n */\r\nexport function updateRefValue(target: Ref, value: TV): boolean {\r\n if (deepEqual(target.value, value, true)) {\r\n return false;\r\n }\r\n\r\n target.value = value;\r\n\r\n return true;\r\n}\r\n\r\n/**\r\n * Defines a component that will be loaded asynchronously. This contains logic\r\n * to properly work with the RockSuspense control.\r\n *\r\n * @param source The function to call to load the component.\r\n *\r\n * @returns The component that was loaded.\r\n */\r\nexport function defineAsyncComponent(source: AsyncComponentLoader): T {\r\n return vueDefineAsyncComponent(async () => {\r\n const suspense = useSuspense();\r\n const operationKey = newGuid();\r\n\r\n suspense?.startAsyncOperation(operationKey);\r\n const component = await source();\r\n suspense?.completeAsyncOperation(operationKey);\r\n\r\n return component;\r\n });\r\n}\r\n\r\n// #region Standard Form Field\r\n\r\ntype StandardRockFormFieldProps = {\r\n label: {\r\n type: PropType,\r\n default: \"\"\r\n },\r\n\r\n help: {\r\n type: PropType,\r\n default: \"\"\r\n },\r\n\r\n rules: RulesPropType,\r\n\r\n formGroupClasses: {\r\n type: PropType,\r\n default: \"\"\r\n },\r\n\r\n validationTitle: {\r\n type: PropType,\r\n default: \"\"\r\n },\r\n\r\n isRequiredIndicatorHidden: {\r\n type: PropType,\r\n default: false\r\n }\r\n};\r\n\r\n/** The standard component props that should be included when using RockFormField. */\r\nexport const standardRockFormFieldProps: StandardRockFormFieldProps = {\r\n label: {\r\n type: String as PropType,\r\n default: \"\"\r\n },\r\n\r\n help: {\r\n type: String as PropType,\r\n default: \"\"\r\n },\r\n\r\n rules: {\r\n type: [Array, Object, String] as PropType,\r\n default: \"\"\r\n },\r\n\r\n formGroupClasses: {\r\n type: String as PropType,\r\n default: \"\"\r\n },\r\n\r\n validationTitle: {\r\n type: String as PropType,\r\n default: \"\"\r\n },\r\n\r\n isRequiredIndicatorHidden: {\r\n type: Boolean as PropType,\r\n default: false\r\n }\r\n};\r\n\r\n/**\r\n * Copies the known properties for the standard rock form field props from\r\n * the source object to the destination object.\r\n *\r\n * @param source The source object to copy the values from.\r\n * @param destination The destination object to copy the values to.\r\n */\r\nfunction copyStandardRockFormFieldProps(source: ExtractPropTypes, destination: ExtractPropTypes): void {\r\n destination.formGroupClasses = source.formGroupClasses;\r\n destination.help = source.help;\r\n destination.label = source.label;\r\n destination.rules = source.rules;\r\n destination.validationTitle = source.validationTitle;\r\n}\r\n\r\n/**\r\n * Configures the basic properties that should be passed to the RockFormField\r\n * component. The value returned by this function should be used with v-bind on\r\n * the RockFormField in order to pass all the defined prop values to it.\r\n *\r\n * @param props The props of the component that will be using the RockFormField.\r\n *\r\n * @returns An object of prop values that can be used with v-bind.\r\n */\r\nexport function useStandardRockFormFieldProps(props: ExtractPropTypes): ExtractPropTypes {\r\n const propValues = reactive>({\r\n label: props.label,\r\n help: props.help,\r\n rules: props.rules,\r\n formGroupClasses: props.formGroupClasses,\r\n validationTitle: props.validationTitle,\r\n isRequiredIndicatorHidden: props.isRequiredIndicatorHidden\r\n });\r\n\r\n watch([() => props.formGroupClasses, () => props.help, () => props.label, () => props.rules, () => props.validationTitle], () => {\r\n copyStandardRockFormFieldProps(props, propValues);\r\n });\r\n\r\n return propValues;\r\n}\r\n\r\n// #endregion\r\n\r\n// #region Standard Async Pickers\r\n\r\ntype StandardAsyncPickerProps = StandardRockFormFieldProps & {\r\n /** Enhance the picker for dealing with long lists by providing a search mechanism. */\r\n enhanceForLongLists: {\r\n type: PropType,\r\n default: false\r\n },\r\n\r\n /** The method the picker should use to load data. */\r\n lazyMode: {\r\n type: PropType,\r\n default: \"onDemand\"\r\n },\r\n\r\n /** True if the picker should allow multiple items to be selected. */\r\n multiple: {\r\n type: PropType,\r\n default: false\r\n },\r\n\r\n /** True if the picker should allow empty selections. */\r\n showBlankItem: {\r\n type: PropType,\r\n default: false\r\n },\r\n\r\n /** The optional value to show when `showBlankItem` is `true`. */\r\n blankValue: {\r\n type: PropType,\r\n default: \"\"\r\n },\r\n\r\n /** The visual style to use when displaying the picker. */\r\n displayStyle: {\r\n type: PropType,\r\n default: \"auto\"\r\n },\r\n\r\n /** The number of columns to use when displaying the items in a list. */\r\n columnCount: {\r\n type: PropType,\r\n default: 0\r\n }\r\n};\r\n\r\n/** The standard component props that should be included when using BaseAsyncPicker. */\r\nexport const standardAsyncPickerProps: StandardAsyncPickerProps = {\r\n ...standardRockFormFieldProps,\r\n\r\n enhanceForLongLists: {\r\n type: Boolean as PropType,\r\n default: false\r\n },\r\n\r\n lazyMode: {\r\n type: String as PropType,\r\n default: ControlLazyMode.OnDemand\r\n },\r\n\r\n multiple: {\r\n type: Boolean as PropType,\r\n default: false\r\n },\r\n\r\n showBlankItem: {\r\n type: Boolean as PropType,\r\n default: false\r\n },\r\n\r\n blankValue: {\r\n type: String as PropType,\r\n default: \"\"\r\n },\r\n\r\n displayStyle: {\r\n type: String as PropType,\r\n default: PickerDisplayStyle.Auto\r\n },\r\n\r\n columnCount: {\r\n type: Number as PropType,\r\n default: 0\r\n }\r\n};\r\n\r\n/**\r\n * Copies the known properties for the standard async picker props from\r\n * the source object to the destination object.\r\n *\r\n * @param source The source object to copy the values from.\r\n * @param destination The destination object to copy the values to.\r\n */\r\nfunction copyStandardAsyncPickerProps(source: ExtractPropTypes, destination: ExtractPropTypes): void {\r\n copyStandardRockFormFieldProps(source, destination);\r\n\r\n destination.enhanceForLongLists = source.enhanceForLongLists;\r\n destination.lazyMode = source.lazyMode;\r\n destination.multiple = source.multiple;\r\n destination.showBlankItem = source.showBlankItem;\r\n destination.blankValue = source.blankValue;\r\n destination.displayStyle = source.displayStyle;\r\n destination.columnCount = source.columnCount;\r\n}\r\n\r\n/**\r\n * Configures the basic properties that should be passed to the BaseAsyncPicker\r\n * component. The value returned by this function should be used with v-bind on\r\n * the BaseAsyncPicker in order to pass all the defined prop values to it.\r\n *\r\n * @param props The props of the component that will be using the BaseAsyncPicker.\r\n *\r\n * @returns An object of prop values that can be used with v-bind.\r\n */\r\nexport function useStandardAsyncPickerProps(props: ExtractPropTypes): ExtractPropTypes {\r\n const standardFieldProps = useStandardRockFormFieldProps(props);\r\n\r\n const propValues = reactive>({\r\n ...standardFieldProps,\r\n enhanceForLongLists: props.enhanceForLongLists,\r\n lazyMode: props.lazyMode,\r\n multiple: props.multiple,\r\n showBlankItem: props.showBlankItem,\r\n blankValue: props.blankValue,\r\n displayStyle: props.displayStyle,\r\n columnCount: props.columnCount\r\n });\r\n\r\n // Watch for changes in any of the standard props. Use deep for this so we\r\n // don't need to know which prop keys it actually contains.\r\n watch(() => standardFieldProps, () => {\r\n copyStandardRockFormFieldProps(props, propValues);\r\n }, {\r\n deep: true\r\n });\r\n\r\n // Watch for changes in our known list of props that might change.\r\n watch([() => props.enhanceForLongLists, () => props.lazyMode, () => props.multiple, () => props.showBlankItem, () => props.displayStyle, () => props.columnCount], () => {\r\n copyStandardAsyncPickerProps(props, propValues);\r\n });\r\n\r\n return propValues;\r\n}\r\n\r\n// #endregion\r\n\r\n// #region Extended References\r\n\r\n/**\r\n * Creates a Ref that contains extended data to better identify this ref\r\n * when you have multiple refs to work with.\r\n *\r\n * @param value The initial value of the Ref.\r\n * @param extendedData The additional context data to put on the Ref.\r\n *\r\n * @returns An ExtendedRef object that can be used like a regular Ref object.\r\n */\r\nexport function extendedRef(value: T, context: ExtendedRefContext): ExtendedRef {\r\n const refValue = ref(value) as ExtendedRef;\r\n\r\n refValue.context = context;\r\n\r\n return refValue;\r\n}\r\n\r\n/**\r\n * Creates an extended Ref with the specified property name in the context.\r\n *\r\n * @param value The initial value of the Ref.\r\n * @param propertyName The property name to use for the context.\r\n *\r\n * @returns An ExtendedRef object that can be used like a regular Ref object.\r\n */\r\nexport function propertyRef(value: T, propertyName: string): ExtendedRef {\r\n return extendedRef(value, {\r\n propertyName\r\n });\r\n}\r\n\r\n// #endregion Extended Refs\r\n\r\n// #region VNode Helpers\r\n\r\n/**\r\n * Retrieves a single prop value from a VNode object. If the prop is explicitely\r\n * specified in the DOM then it will be returned. Otherwise the component's\r\n * prop default values are checked. If there is a default value it will be\r\n * returned.\r\n *\r\n * @param node The node whose property value is being requested.\r\n * @param propName The name of the property whose value is being requested.\r\n *\r\n * @returns The value of the property or `undefined` if it was not set.\r\n */\r\nexport function getVNodeProp(node: VNode, propName: string): T | undefined {\r\n // Check if the prop was specified in the DOM declaration.\r\n if (node.props && node.props[propName] !== undefined) {\r\n return node.props[propName] as T;\r\n }\r\n\r\n // Now look to see if the backing component has defined a prop with that\r\n // name and provided a default value.\r\n if (typeof node.type === \"object\" && typeof node.type[\"props\"] === \"object\") {\r\n const defaultProps = node.type[\"props\"] as Record;\r\n const defaultProp = defaultProps[propName];\r\n\r\n if (defaultProp && typeof defaultProp === \"object\" && defaultProp[\"default\"] !== undefined) {\r\n return defaultProp[\"default\"] as T;\r\n }\r\n }\r\n\r\n return undefined;\r\n}\r\n\r\n/**\r\n * Retrieves all prop values from a VNode object. First all default values\r\n * from the component are retrieved. Then any specified on the DOM will be used\r\n * to override those default values.\r\n *\r\n * @param node The node whose property values are being requested.\r\n *\r\n * @returns An object that contains all props and values for the node.\r\n */\r\nexport function getVNodeProps(node: VNode): Record {\r\n const props: Record = {};\r\n\r\n // Get all default values from the backing component's defined props.\r\n if (typeof node.type === \"object\" && typeof node.type[\"props\"] === \"object\") {\r\n const defaultProps = node.type[\"props\"] as Record;\r\n\r\n for (const p in defaultProps) {\r\n const defaultProp = defaultProps[p];\r\n\r\n if (defaultProp && typeof defaultProp === \"object\" && defaultProp[\"default\"] !== undefined) {\r\n props[p] = defaultProp[\"default\"];\r\n }\r\n }\r\n }\r\n\r\n // Override with any values specified on the DOM declaration.\r\n if (node.props) {\r\n for (const p in node.props) {\r\n if (typeof node.type === \"object\" && typeof node.type[\"props\"] === \"object\") {\r\n const propType = node.type[\"props\"][p]?.type;\r\n\r\n if (propType === Boolean) {\r\n props[p] = node.props[p] === true || node.props[p] === \"\";\r\n }\r\n else if (propType === Number) {\r\n props[p] = toNumberOrNull(node.props[p]) ?? undefined;\r\n }\r\n else {\r\n props[p] = node.props[p];\r\n }\r\n }\r\n else {\r\n props[p] = node.props[p];\r\n }\r\n }\r\n }\r\n\r\n return props;\r\n}\r\n\r\n/**\r\n * Renders the node into an off-screen div and then extracts the text content\r\n * by way of the innerText property of the div.\r\n *\r\n * @param node The node or component to be rendered.\r\n * @param props The properties to be passed to the component when it is mounted.\r\n *\r\n * @returns The text content of the node after it has rendered.\r\n */\r\nexport function extractText(node: VNode | Component, props?: Record): string {\r\n const el = document.createElement(\"div\");\r\n\r\n // Create a new virtual node with the specified properties.\r\n const vnode = createVNode(node, props);\r\n\r\n // Mount the node in our off-screen container.\r\n render(vnode, el);\r\n\r\n const text = el.innerText;\r\n\r\n // Unmount it.\r\n render(null, el);\r\n\r\n return text.trim();\r\n}\r\n\r\n/**\r\n * Renders the node into an off-screen div and then extracts the HTML content\r\n * by way of the innerHTML property of the div.\r\n *\r\n * @param node The node or component to be rendered.\r\n * @param props The properties to be passed to the component when it is mounted.\r\n *\r\n * @returns The HTML content of the node after it has rendered.\r\n */\r\nexport function extractHtml(node: VNode | Component, props?: Record): string {\r\n const el = document.createElement(\"div\");\r\n\r\n // Create a new virtual node with the specified properties.\r\n const vnode = createVNode(node, props);\r\n\r\n // Mount the node in our off-screen container.\r\n render(vnode, el);\r\n\r\n const html = el.innerHTML;\r\n\r\n // Unmount it.\r\n render(null, el);\r\n\r\n return html;\r\n}\r\n\r\n// #endregion\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { toNumberOrNull, zeroPad } from \"./numberUtils\";\r\nconst dateKeyLength = \"YYYYMMDD\".length;\r\nconst dateKeyNoYearLength = \"MMDD\".length;\r\n\r\n/**\r\n * Gets the year value from the date key.\r\n * Ex: 20210228 => 2021\r\n * @param dateKey\r\n */\r\nexport function getYear(dateKey: string | null): number {\r\n const defaultValue = 0;\r\n\r\n if (!dateKey || dateKey.length !== dateKeyLength) {\r\n return defaultValue;\r\n }\r\n\r\n const asString = dateKey.substring(0, 4);\r\n const year = toNumberOrNull(asString) || defaultValue;\r\n return year;\r\n}\r\n\r\n/**\r\n * Gets the month value from the date key.\r\n * Ex: 20210228 => 2\r\n * @param dateKey\r\n */\r\nexport function getMonth(dateKey: string | null): number {\r\n const defaultValue = 0;\r\n\r\n if (!dateKey) {\r\n return defaultValue;\r\n }\r\n\r\n if (dateKey.length === dateKeyLength) {\r\n const asString = dateKey.substring(4, 6);\r\n return toNumberOrNull(asString) || defaultValue;\r\n }\r\n\r\n if (dateKey.length === dateKeyNoYearLength) {\r\n const asString = dateKey.substring(0, 2);\r\n return toNumberOrNull(asString) || defaultValue;\r\n }\r\n\r\n return defaultValue;\r\n}\r\n\r\n/**\r\n * Gets the day value from the date key.\r\n * Ex: 20210228 => 28\r\n * @param dateKey\r\n */\r\nexport function getDay(dateKey: string | null): number {\r\n const defaultValue = 0;\r\n\r\n if (!dateKey) {\r\n return defaultValue;\r\n }\r\n\r\n if (dateKey.length === dateKeyLength) {\r\n const asString = dateKey.substring(6, 8);\r\n return toNumberOrNull(asString) || defaultValue;\r\n }\r\n\r\n if (dateKey.length === dateKeyNoYearLength) {\r\n const asString = dateKey.substring(2, 4);\r\n return toNumberOrNull(asString) || defaultValue;\r\n }\r\n\r\n return defaultValue;\r\n}\r\n\r\n/**\r\n * Gets the datekey constructed from the parts.\r\n * Ex: (2021, 2, 28) => '20210228'\r\n * @param year\r\n * @param month\r\n * @param day\r\n */\r\nexport function toDateKey(year: number | null, month: number | null, day: number | null): string {\r\n if (!year || year > 9999 || year < 0) {\r\n year = 0;\r\n }\r\n\r\n if (!month || month > 12 || month < 0) {\r\n month = 0;\r\n }\r\n\r\n if (!day || day > 31 || day < 0) {\r\n day = 0;\r\n }\r\n\r\n const yearStr = zeroPad(year, 4);\r\n const monthStr = zeroPad(month, 2);\r\n const dayStr = zeroPad(day, 2);\r\n\r\n return `${yearStr}${monthStr}${dayStr}`;\r\n}\r\n\r\n/**\r\n * Gets the datekey constructed from the parts.\r\n * Ex: (2, 28) => '0228'\r\n * @param month\r\n * @param day\r\n */\r\nexport function toNoYearDateKey(month: number | null, day: number | null): string {\r\n if (!month || month > 12 || month < 0) {\r\n month = 0;\r\n }\r\n\r\n if (!day || day > 31 || day < 0) {\r\n day = 0;\r\n }\r\n\r\n const monthStr = zeroPad(month, 2);\r\n const dayStr = zeroPad(day, 2);\r\n\r\n return `${monthStr}${dayStr}`;\r\n}\r\n\r\nexport default {\r\n getYear,\r\n getMonth,\r\n getDay,\r\n toDateKey,\r\n toNoYearDateKey\r\n};\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { Guid } from \"@Obsidian/Types\";\r\nimport { CurrentPersonBag } from \"@Obsidian/ViewModels/Crm/currentPersonBag\";\r\n\r\nexport type PageConfig = {\r\n executionStartTime: number;\r\n pageId: number;\r\n pageGuid: Guid;\r\n pageParameters: Record;\r\n currentPerson: CurrentPersonBag | null;\r\n isAnonymousVisitor: boolean;\r\n loginUrlWithReturnUrl: string;\r\n};\r\n\r\nexport function smoothScrollToTop(): void {\r\n window.scrollTo({ top: 0, behavior: \"smooth\" });\r\n}\r\n\r\nexport default {\r\n smoothScrollToTop\r\n};\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-explicit-any\r\ndeclare const Obsidian: any;\r\n\r\n\r\n/*\r\n * Code to handle working with modals.\r\n */\r\nlet currentModalCount = 0;\r\n\r\n/**\r\n * Track a modal being opened or closed. This is used to adjust the page in response\r\n * to any modals being visible.\r\n *\r\n * @param state true if the modal is now open, false if it is now closed.\r\n */\r\nexport function trackModalState(state: boolean): void {\r\n const body = document.body;\r\n const cssClasses = [\"modal-open\"];\r\n\r\n if (state) {\r\n currentModalCount++;\r\n }\r\n else {\r\n currentModalCount = currentModalCount > 0 ? currentModalCount - 1 : 0;\r\n }\r\n\r\n if (currentModalCount > 0) {\r\n for (const cssClass of cssClasses) {\r\n body.classList.add(cssClass);\r\n }\r\n }\r\n else {\r\n for (const cssClass of cssClasses) {\r\n body.classList.remove(cssClass);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Loads a JavaScript file asynchronously into the document and returns a\r\n * Promise that can be used to determine when the script has loaded. The\r\n * promise will return true if the script loaded successfully or false if it\r\n * failed to load.\r\n *\r\n * The function passed in isScriptLoaded will be called before the script is\r\n * inserted into the DOM as well as after to make sure it actually loaded.\r\n *\r\n * @param source The source URL of the script to be loaded.\r\n * @param isScriptLoaded An optional function to call to determine if the script is loaded.\r\n * @param attributes An optional set of attributes to apply to the script tag.\r\n * @param fingerprint If set to false, then a fingerprint will not be added to the source URL. Default is true.\r\n *\r\n * @returns A Promise that indicates if the script was loaded or not.\r\n */\r\nexport async function loadJavaScriptAsync(source: string, isScriptLoaded?: () => boolean, attributes?: Record, fingerprint?: boolean): Promise {\r\n let src = source;\r\n\r\n // Add the cache busting fingerprint if we have one.\r\n if (fingerprint !== false && typeof Obsidian !== \"undefined\" && Obsidian?.options?.fingerprint) {\r\n if (src.indexOf(\"?\") === -1) {\r\n src += `?${Obsidian.options.fingerprint}`;\r\n }\r\n else {\r\n src += `&${Obsidian.options.fingerprint}`;\r\n }\r\n }\r\n\r\n // Check if the script is already loaded. First see if we have a custom\r\n // function that will do the check. Otherwise fall back to looking for any\r\n // script tags that have the same source.\r\n if (isScriptLoaded) {\r\n if (isScriptLoaded()) {\r\n return true;\r\n }\r\n }\r\n\r\n // Make sure the script wasn't already added in some other way.\r\n const scripts = Array.from(document.getElementsByTagName(\"script\"));\r\n const thisScript = scripts.filter(s => s.src === src);\r\n\r\n if (thisScript.length > 0) {\r\n const promise = scriptLoadedPromise(thisScript[0]);\r\n return promise;\r\n }\r\n\r\n // Build the script tag that will be dynamically loaded.\r\n const script = document.createElement(\"script\");\r\n script.type = \"text/javascript\";\r\n script.src = src;\r\n if (attributes) {\r\n for (const key in attributes) {\r\n script.setAttribute(key, attributes[key]);\r\n }\r\n }\r\n\r\n // Load the script.\r\n const promise = scriptLoadedPromise(script);\r\n document.getElementsByTagName(\"head\")[0].appendChild(script);\r\n\r\n return promise;\r\n\r\n async function scriptLoadedPromise(scriptElement: HTMLScriptElement): Promise {\r\n try {\r\n await new Promise((resolve, reject) => {\r\n scriptElement.addEventListener(\"load\", () => resolve());\r\n scriptElement.addEventListener(\"error\", () => {\r\n reject();\r\n });\r\n });\r\n\r\n // If we have a custom function, call it to see if the script loaded correctly.\r\n if (isScriptLoaded) {\r\n return isScriptLoaded();\r\n }\r\n\r\n return true;\r\n }\r\n catch {\r\n return false;\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Adds a new link to the quick return action menu. The URL in the address bar\r\n * will be used as the destination.\r\n *\r\n * @param title The title of the quick link that identifies the current page.\r\n * @param section The section title to place this link into.\r\n * @param sectionOrder The priority order to give the section if it doesn't already exist.\r\n */\r\nexport function addQuickReturn(title: string, section: string, sectionOrder?: number): void {\r\n interface IRock {\r\n personalLinks: {\r\n addQuickReturn: (type: string, typeOrder: number, itemName: string) => void\r\n }\r\n }\r\n\r\n (window[\"Rock\"] as IRock).personalLinks.addQuickReturn(section, sectionOrder ?? 0, title);\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { Guid } from \"@Obsidian/Types\";\r\nimport { trackModalState } from \"./page\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/naming-convention\r\ndeclare const Rock: any;\r\n\r\ntype DialogOptions = {\r\n message: string;\r\n buttons: ButtonOptions[];\r\n container?: string | Element;\r\n};\r\n\r\ntype ButtonOptions = {\r\n key: string;\r\n label: string;\r\n className: string;\r\n};\r\n\r\n/**\r\n * Creates a dialog to display a message.\r\n *\r\n * @param body The body content to put in the dialog.\r\n * @param footer The footer content to put in the dialog.\r\n *\r\n * @returns An element that should be added to the body.\r\n */\r\nfunction createDialog(body: HTMLElement | HTMLElement[], footer: HTMLElement | HTMLElement[] | undefined): HTMLElement {\r\n // Create the scrollable container that will act as a backdrop for the dialog.\r\n const scrollable = document.createElement(\"div\");\r\n scrollable.classList.add(\"modal-scrollable\");\r\n scrollable.style.zIndex = \"1060\";\r\n\r\n // Create the modal that will act as a container for the outer content.\r\n const modal = document.createElement(\"div\");\r\n scrollable.appendChild(modal);\r\n modal.classList.add(\"modal\", \"fade\");\r\n modal.tabIndex = -1;\r\n modal.setAttribute(\"role\", \"dialog\");\r\n modal.setAttribute(\"aria-hidden\", \"false\");\r\n modal.style.display = \"block\";\r\n\r\n // Create the inner dialog of the modal.\r\n const modalDialog = document.createElement(\"div\");\r\n modal.appendChild(modalDialog);\r\n modalDialog.classList.add(\"modal-dialog\");\r\n\r\n // Create the container for the inner content.\r\n const modalContent = document.createElement(\"div\");\r\n modalDialog.appendChild(modalContent);\r\n modalContent.classList.add(\"modal-content\");\r\n\r\n // Create the container for the body content.\r\n const modalBody = document.createElement(\"div\");\r\n modalContent.appendChild(modalBody);\r\n modalBody.classList.add(\"modal-body\");\r\n\r\n // Add all the body elements to the body.\r\n if (Array.isArray(body)) {\r\n for (const el of body) {\r\n modalBody.appendChild(el);\r\n }\r\n }\r\n else {\r\n modalBody.appendChild(body);\r\n }\r\n\r\n // If we have any footer content then create a footer.\r\n if (footer && (!Array.isArray(footer) || footer.length > 0)) {\r\n const modalFooter = document.createElement(\"div\");\r\n modalContent.appendChild(modalFooter);\r\n modalFooter.classList.add(\"modal-footer\");\r\n\r\n // Add all the footer elements to the footer.\r\n if (Array.isArray(footer)) {\r\n for (const el of footer) {\r\n modalFooter.appendChild(el);\r\n }\r\n }\r\n else {\r\n modalFooter.appendChild(footer);\r\n }\r\n }\r\n\r\n // Add a click handler to the background so the user gets feedback\r\n // that they can't just click away from the dialog.\r\n scrollable.addEventListener(\"click\", () => {\r\n modal.classList.remove(\"animated\", \"shake\");\r\n setTimeout(() => {\r\n modal.classList.add(\"animated\", \"shake\");\r\n }, 0);\r\n });\r\n\r\n return scrollable;\r\n}\r\n\r\n/**\r\n * Construct a standard close button to be placed in the dialog.\r\n *\r\n * @returns A button element.\r\n */\r\nfunction createCloseButton(): HTMLButtonElement {\r\n const closeButton = document.createElement(\"button\");\r\n closeButton.classList.add(\"close\");\r\n closeButton.type = \"button\";\r\n closeButton.style.marginTop = \"-10px\";\r\n closeButton.innerHTML = \"×\";\r\n\r\n return closeButton;\r\n}\r\n\r\n/**\r\n * Creates a standard backdrop element to be placed in the window.\r\n *\r\n * @returns An element to show that the background is not active.\r\n */\r\nfunction createBackdrop(): HTMLElement {\r\n const backdrop = document.createElement(\"div\");\r\n backdrop.classList.add(\"modal-backdrop\");\r\n backdrop.style.zIndex = \"1050\";\r\n\r\n return backdrop;\r\n}\r\n\r\n/**\r\n * Shows a dialog modal. This is meant to look and behave like the standard\r\n * Rock.dialog.* functions, but this handles fullscreen mode whereas the old\r\n * methods do not.\r\n *\r\n * @param options The options that describe the dialog to be shown.\r\n *\r\n * @returns The key of the button that was clicked, or \"cancel\" if the cancel button was clicked.\r\n */\r\nfunction showDialog(options: DialogOptions): Promise {\r\n return new Promise(resolve => {\r\n let timer: NodeJS.Timeout | null = null;\r\n const container = document.fullscreenElement || document.body;\r\n const body = document.createElement(\"div\");\r\n body.innerText = options.message;\r\n\r\n const buttons: HTMLElement[] = [];\r\n\r\n /**\r\n * Internal function to handle clearing the dialog and resolving the\r\n * promise.\r\n *\r\n * @param result The result to return in the promise.\r\n */\r\n function clearDialog(result: string): void {\r\n // This acts as a way to ensure only a single clear request happens.\r\n if (timer !== null) {\r\n return;\r\n }\r\n\r\n // The timout is used as a fallback in case we don't get the\r\n // transition end event.\r\n timer = setTimeout(() => {\r\n backdrop.remove();\r\n dialog.remove();\r\n trackModalState(false);\r\n\r\n resolve(result);\r\n }, 1000);\r\n\r\n modal.addEventListener(\"transitionend\", () => {\r\n if (timer) {\r\n clearTimeout(timer);\r\n }\r\n\r\n backdrop.remove();\r\n dialog.remove();\r\n trackModalState(false);\r\n\r\n resolve(result);\r\n });\r\n\r\n modal.classList.remove(\"in\");\r\n backdrop.classList.remove(\"in\");\r\n }\r\n\r\n // Add in all the buttons specified.\r\n for (const button of options.buttons) {\r\n const btn = document.createElement(\"button\");\r\n btn.classList.value = button.className;\r\n btn.type = \"button\";\r\n btn.innerText = button.label;\r\n btn.addEventListener(\"click\", () => {\r\n clearDialog(button.key);\r\n });\r\n buttons.push(btn);\r\n }\r\n\r\n // Construct the close (cancel) button.\r\n const closeButton = createCloseButton();\r\n closeButton.addEventListener(\"click\", () => {\r\n clearDialog(\"cancel\");\r\n });\r\n\r\n const dialog = createDialog([closeButton, body], buttons);\r\n const backdrop = createBackdrop();\r\n\r\n const modal = dialog.querySelector(\".modal\") as HTMLElement;\r\n\r\n // Do final adjustments to the elements and add to the body.\r\n trackModalState(true);\r\n container.appendChild(dialog);\r\n container.appendChild(backdrop);\r\n modal.style.marginTop = `-${modal.offsetHeight / 2.0}px`;\r\n\r\n // Show the backdrop and the modal.\r\n backdrop.classList.add(\"in\");\r\n modal.classList.add(\"in\");\r\n });\r\n}\r\n\r\n/**\r\n * Shows an alert message that requires the user to acknowledge.\r\n *\r\n * @param message The message text to be displayed.\r\n *\r\n * @returns A promise that indicates when the dialog has been dismissed.\r\n */\r\nexport async function alert(message: string): Promise {\r\n await showDialog({\r\n message,\r\n buttons: [\r\n {\r\n key: \"ok\",\r\n label: \"OK\",\r\n className: \"btn btn-primary\"\r\n }\r\n ]\r\n });\r\n}\r\n\r\n/**\r\n * Shows a confirmation dialog that consists of OK and Cancel buttons. The\r\n * user will be required to click one of these two buttons.\r\n *\r\n * @param message The message to be displayed inside the dialog.\r\n *\r\n * @returns A promise that indicates when the dialog has been dismissed. The\r\n * value will be true if the OK button was clicked or false otherwise.\r\n */\r\nexport async function confirm(message: string): Promise {\r\n const result = await showDialog({\r\n message,\r\n buttons: [\r\n {\r\n key: \"ok\",\r\n label: \"OK\",\r\n className: \"btn btn-primary\"\r\n },\r\n {\r\n key: \"cancel\",\r\n label: \"Cancel\",\r\n className: \"btn btn-default\"\r\n }\r\n ]\r\n });\r\n\r\n return result === \"ok\";\r\n}\r\n\r\n/**\r\n * Shows a delete confirmation dialog that consists of OK and Cancel buttons.\r\n * The user will be required to click one of these two buttons. The message\r\n * is standardized.\r\n *\r\n * @param nameText The name of type that will be deleted.\r\n *\r\n * @returns A promise that indicates when the dialog has been dismissed. The\r\n * value will be true if the OK button was clicked or false otherwise.\r\n */\r\nexport function confirmDelete(typeName: string, additionalMessage?: string): Promise {\r\n let message = `Are you sure you want to delete this ${typeName}?`;\r\n\r\n if (additionalMessage) {\r\n message += ` ${additionalMessage}`;\r\n }\r\n\r\n return confirm(message);\r\n}\r\n\r\n/**\r\n * Shows the security dialog for the given entity.\r\n *\r\n * @param entityTypeIdKey The identifier of the entity's type.\r\n * @param entityIdKey The identifier of the entity to secure.\r\n * @param entityTitle The title of the entity. This is used to construct the modal title.\r\n */\r\nexport function showSecurity(entityTypeIdKey: Guid | string | number, entityIdKey: Guid | string | number, entityTitle: string = \"Item\"): void {\r\n Rock.controls.modal.show(undefined, `/Secure/${entityTypeIdKey}/${entityIdKey}?t=Secure ${entityTitle}&pb=&sb=Done`);\r\n}","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\n/**\r\n * Is the value a valid email address?\r\n * @param val\r\n */\r\nexport function isEmail(val: unknown): boolean {\r\n if (typeof val === \"string\") {\r\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\r\n return re.test(val.toLowerCase());\r\n }\r\n\r\n return false;\r\n}\r\n","import { ListItemBag } from \"@Obsidian/ViewModels/Utility/listItemBag\";\r\n\r\n/**\r\n * A function to convert the enums to array of ListItemBag in the frontend.\r\n *\r\n * @param description The enum to be converted to an array of listItemBag as a dictionary of value to enum description\r\n *\r\n * @returns An array of ListItemBag.\r\n */\r\nexport function enumToListItemBag (description: Record): ListItemBag[] {\r\n const listItemBagList: ListItemBag[] = [];\r\n for(const property in description) {\r\n listItemBagList.push({\r\n text: description[property].toString(),\r\n value: property.toString()\r\n });\r\n }\r\n return listItemBagList;\r\n}","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { Guid } from \"@Obsidian/Types\";\r\nimport { isValidGuid, normalize } from \"./guid\";\r\nimport { IFieldType } from \"@Obsidian/Types/fieldType\";\r\n\r\nconst fieldTypeTable: Record = {};\r\n\r\n/** Determines how the field type component is being used so it can adapt to different */\r\nexport type DataEntryMode = \"defaultValue\" | undefined;\r\n\r\n/**\r\n * Register a new field type in the system. This must be called for all field\r\n * types a plugin registers.\r\n *\r\n * @param fieldTypeGuid The unique identifier of the field type.\r\n * @param fieldType The class instance that will handle the field type.\r\n */\r\nexport function registerFieldType(fieldTypeGuid: Guid, fieldType: IFieldType): void {\r\n const normalizedGuid = normalize(fieldTypeGuid);\r\n\r\n if (!isValidGuid(fieldTypeGuid) || normalizedGuid === null) {\r\n throw \"Invalid guid specified when registering field type.\";\r\n }\r\n\r\n if (fieldTypeTable[normalizedGuid] !== undefined) {\r\n throw \"Invalid attempt to replace existing field type.\";\r\n }\r\n\r\n fieldTypeTable[normalizedGuid] = fieldType;\r\n}\r\n\r\n/**\r\n * Get the field type handler for a given unique identifier.\r\n *\r\n * @param fieldTypeGuid The unique identifier of the field type.\r\n *\r\n * @returns The field type instance or null if not found.\r\n */\r\nexport function getFieldType(fieldTypeGuid: Guid): IFieldType | null {\r\n const normalizedGuid = normalize(fieldTypeGuid);\r\n\r\n if (normalizedGuid !== null) {\r\n const field = fieldTypeTable[normalizedGuid];\r\n\r\n if (field) {\r\n return field;\r\n }\r\n }\r\n\r\n console.warn(`Field type \"${fieldTypeGuid}\" was not found`);\r\n return null;\r\n}\r\n\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { inject, provide } from \"vue\";\r\n\r\n/** The unique symbol used when injecting the form state. */\r\nconst formStateSymbol = Symbol();\r\n\r\n/**\r\n * Holds the state of a single form on the page along with any callback methods\r\n * that can be used to interact with the form.\r\n */\r\nexport type FormState = {\r\n /** The number of submissions the form has had. */\r\n submitCount: number;\r\n\r\n /** Sets the current error for the given field name. A blank error means no error. */\r\n setError: (id: string, name: string, error: string) => void;\r\n};\r\n\r\n/**\r\n * Contains the internal form error passed between RockForm and RockValidation.\r\n *\r\n * This is an internal type and subject to change at any time.\r\n */\r\nexport type FormError = {\r\n /** The name of the field. */\r\n name: string;\r\n\r\n /** The current error text. */\r\n text: string;\r\n};\r\n\r\n/**\r\n * Provides the form state for any child components that need access to it.\r\n * \r\n * @param state The state that will be provided to child components.\r\n */\r\nexport function provideFormState(state: FormState): void {\r\n provide(formStateSymbol, state);\r\n}\r\n\r\n/**\r\n * Makes use of the FormState that was previously provided by a parent component.\r\n *\r\n * @returns The form state or undefined if it was not available.\r\n */\r\nexport function useFormState(): FormState | undefined {\r\n return inject(formStateSymbol, undefined);\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\n// Define the browser-specific versions of these functions that older browsers\r\n// implemented before using the standard API.\r\ndeclare global {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n interface Document {\r\n mozCancelFullScreen?: () => Promise;\r\n webkitExitFullscreen?: () => Promise;\r\n mozFullScreenElement?: Element;\r\n webkitFullscreenElement?: Element;\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n interface HTMLElement {\r\n mozRequestFullscreen?: () => Promise;\r\n webkitRequestFullscreen?: () => Promise;\r\n }\r\n}\r\n\r\n/**\r\n * Request that the window enter true fullscreen mode for the given element.\r\n * \r\n * @param element The element that will be the root of the fullscreen view.\r\n * @param exitCallback The function to call when leaving fullscreen mode.\r\n *\r\n * @returns A promise that indicates when the operation has completed.\r\n */\r\nexport async function enterFullscreen(element: HTMLElement, exitCallback?: (() => void)): Promise {\r\n try {\r\n if (element.requestFullscreen) {\r\n await element.requestFullscreen();\r\n }\r\n else if (element.mozRequestFullscreen) {\r\n await element.mozRequestFullscreen();\r\n }\r\n else if (element.webkitRequestFullscreen) {\r\n await element.webkitRequestFullscreen();\r\n }\r\n else {\r\n return false;\r\n }\r\n\r\n element.classList.add(\"is-fullscreen\");\r\n\r\n const onFullscreenChange = (): void => {\r\n element.classList.remove(\"is-fullscreen\");\r\n\r\n document.removeEventListener(\"fullscreenchange\", onFullscreenChange);\r\n document.removeEventListener(\"mozfullscreenchange\", onFullscreenChange);\r\n document.removeEventListener(\"webkitfullscreenchange\", onFullscreenChange);\r\n\r\n if (exitCallback) {\r\n exitCallback();\r\n }\r\n };\r\n\r\n document.addEventListener(\"fullscreenchange\", onFullscreenChange);\r\n document.addEventListener(\"mozfullscreenchange\", onFullscreenChange);\r\n document.addEventListener(\"webkitfullscreenchange\", onFullscreenChange);\r\n\r\n return true;\r\n }\r\n catch (ex) {\r\n console.error(ex);\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Checks if any element is currently in fullscreen mode.\r\n * \r\n * @returns True if an element is currently in fullscreen mode in the window; otherwise false.\r\n */\r\nexport function isFullscreen(): boolean {\r\n return !!document.fullscreenElement || !!document.mozFullScreenElement || !!document.webkitFullscreenElement;\r\n}\r\n\r\n/**\r\n * Manually exits fullscreen mode.\r\n * \r\n * @returns True if fullscreen mode was exited; otherwise false.\r\n */\r\nexport async function exitFullscreen(): Promise {\r\n try {\r\n if (document.exitFullscreen) {\r\n await document.exitFullscreen();\r\n }\r\n else if (document.mozCancelFullScreen) {\r\n await document.mozCancelFullScreen();\r\n }\r\n else if (document.webkitExitFullscreen) {\r\n document.webkitExitFullscreen();\r\n }\r\n else {\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n catch (ex) {\r\n console.error(ex);\r\n return false;\r\n }\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\n/* global google */\r\n\r\nimport { DrawingMode, Coordinate, ILatLng, ILatLngLiteral } from \"@Obsidian/Types/Controls/geo\";\r\nimport { GeoPickerSettingsBag } from \"@Obsidian/ViewModels/Rest/Controls/geoPickerSettingsBag\";\r\nimport { GeoPickerGetSettingsOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/geoPickerGetSettingsOptionsBag\";\r\nimport { GeoPickerGoogleMapSettingsBag } from \"@Obsidian/ViewModels/Rest/Controls/geoPickerGoogleMapSettingsBag\";\r\nimport { loadJavaScriptAsync } from \"./page\";\r\nimport { post } from \"./http\";\r\n\r\n/**\r\n * Converts a LatLng object, \"lat,lng\" coordinate string, or WellKnown \"lng lat\" coordinate string to a Coordinate array\r\n * @param coord Either a string in \"lat,lng\" format or a LatLng object from Google Maps\r\n * @param isWellKnown True if is \"lng lat\" format, false if it is \"lat, lng\"\r\n *\r\n * @returns Coordinate: Tuple with a Latitude number and Longitude number as the elements\r\n */\r\nexport function toCoordinate(coord: string | ILatLng, isWellKnown: boolean = false): Coordinate {\r\n if (typeof coord == \"string\") {\r\n // WellKnown string format\r\n if (isWellKnown) {\r\n return coord.split(\" \").reverse().map(val => parseFloat(val)) as Coordinate;\r\n }\r\n // Google Maps URL string format\r\n else {\r\n return coord.split(\",\").map(val => parseFloat(val)) as Coordinate;\r\n }\r\n }\r\n else {\r\n return [coord.lat(), coord.lng()];\r\n }\r\n}\r\n\r\n/**\r\n * Takes a Well Known Text value and converts it into a Coordinate array\r\n */\r\nexport function wellKnownToCoordinates(wellKnownText: string, type: DrawingMode): Coordinate[] {\r\n if (wellKnownText == \"\") {\r\n return [];\r\n }\r\n if (type == \"Point\") {\r\n // From this format: POINT (-112.130946 33.600114)\r\n return [toCoordinate(wellKnownText.replace(/(POINT *\\( *)|( *\\) *)/ig, \"\"), true)];\r\n }\r\n else {\r\n // From this format: POLYGON ((-112.157058 33.598563, -112.092341 33.595132, -112.117061 33.608715, -112.124957 33.609286, -112.157058 33.598563))\r\n return wellKnownText.replace(/(POLYGON *\\(+ *)|( *\\)+ *)/ig, \"\").split(/ *, */).map((coord) => toCoordinate(coord, true));\r\n }\r\n}\r\n\r\n/**\r\n * Takes a Well Known Text value and converts it into a Coordinate array\r\n */\r\nexport function coordinatesToWellKnown(coordinates: Coordinate[], type: DrawingMode): string {\r\n if (coordinates.length == 0) {\r\n return \"\";\r\n }\r\n else if (type == \"Point\") {\r\n return `POINT(${coordinates[0].reverse().join(\" \")})`;\r\n }\r\n else {\r\n // DB doesn't work well with the points of a polygon specified in clockwise order for some reason\r\n if (isClockwisePolygon(coordinates)) {\r\n coordinates.reverse();\r\n }\r\n\r\n const coordinateString = coordinates.map(coords => coords.reverse().join(\" \")).join(\", \");\r\n return `POLYGON((${coordinateString}))`;\r\n }\r\n}\r\n\r\n/**\r\n * Takes a Coordinate and uses Geocoding to get nearest address\r\n */\r\nexport function nearAddressForCoordinate(coordinate: Coordinate): Promise {\r\n return new Promise(resolve => {\r\n // only try if google is loaded\r\n if (window.google) {\r\n const geocoder = new google.maps.Geocoder();\r\n geocoder.geocode({ location: new google.maps.LatLng(...coordinate) }, function (results, status) {\r\n if (status == google.maps.GeocoderStatus.OK && results?.[0]) {\r\n resolve(\"near \" + results[0].formatted_address);\r\n }\r\n else {\r\n console.log(\"Geocoder failed due to: \" + status);\r\n resolve(\"\");\r\n }\r\n });\r\n }\r\n else {\r\n resolve(\"\");\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Takes a Coordinate array and uses Geocoding to get nearest address for the first point\r\n */\r\nexport function nearAddressForCoordinates(coordinates: Coordinate[]): Promise {\r\n if (!coordinates || coordinates.length == 0) {\r\n return Promise.resolve(\"\");\r\n }\r\n return nearAddressForCoordinate(coordinates[0]);\r\n}\r\n\r\n/**\r\n * Determine whether the polygon's coordinates are drawn in clockwise order\r\n * Thank you dominoc!\r\n * http://dominoc925.blogspot.com/2012/03/c-code-to-determine-if-polygon-vertices.html\r\n */\r\nexport function isClockwisePolygon(polygon: number[][]): boolean {\r\n let sum = 0;\r\n\r\n for (let i = 0; i < polygon.length - 1; i++) {\r\n sum += (Math.abs(polygon[i + 1][0]) - Math.abs(polygon[i][0])) * (Math.abs(polygon[i + 1][1]) + Math.abs(polygon[i][1]));\r\n }\r\n\r\n return sum > 0;\r\n}\r\n\r\n/**\r\n * Download the necessary resources to run the maps and return the map settings from the API\r\n *\r\n * @param options Options for which data to get from the API\r\n *\r\n * @return Promise with the map settings retrieved from the API\r\n */\r\nexport async function loadMapResources(options: GeoPickerGetSettingsOptionsBag = {}): Promise {\r\n const response = await post(\"/api/v2/Controls/GeoPickerGetGoogleMapSettings\", undefined, options);\r\n const googleMapSettings = response.data ?? {};\r\n\r\n let keyParam = \"\";\r\n\r\n if (googleMapSettings.googleApiKey) {\r\n keyParam = `key=${googleMapSettings.googleApiKey}&`;\r\n }\r\n\r\n await loadJavaScriptAsync(`https://maps.googleapis.com/maps/api/js?${keyParam}libraries=drawing,visualization,geometry`, () => typeof (google) != \"undefined\" && typeof (google.maps) != \"undefined\", {}, false);\r\n\r\n return googleMapSettings;\r\n}\r\n\r\n/**\r\n * Creates a ILatLng object\r\n */\r\nexport function createLatLng(latOrLatLngOrLatLngLiteral: number | ILatLngLiteral | ILatLng, lngOrNoClampNoWrap?: number | boolean | null, noClampNoWrap?: boolean): ILatLng {\r\n return new google.maps.LatLng(latOrLatLngOrLatLngLiteral as number, lngOrNoClampNoWrap, noClampNoWrap);\r\n}","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { DayOfWeek, RockDateTime } from \"./rockDateTime\";\r\nimport { newGuid } from \"./guid\";\r\nimport { toNumberOrNull } from \"./numberUtils\";\r\nimport { pluralConditional } from \"./stringUtils\";\r\n\r\ntype Frequency = \"DAILY\" | \"WEEKLY\" | \"MONTHLY\";\r\n\r\n/**\r\n * The day of the week and an interval number for that particular day.\r\n */\r\nexport type WeekdayNumber = {\r\n /** The interval number for this day. */\r\n value: number;\r\n\r\n /** The day of the week. */\r\n day: DayOfWeek;\r\n};\r\n\r\n// Abbreviate nth lookup table.\r\nconst nthNamesAbbreviated: [number, string][] = [\r\n [1, \"1st\"],\r\n [2, \"2nd\"],\r\n [3, \"3rd\"],\r\n [4, \"4th\"],\r\n [-1, \"last\"]\r\n];\r\n\r\n// #region Internal Functions\r\n\r\n/**\r\n * Converts the number to a string and pads the left with zeros to make up\r\n * the minimum required length.\r\n *\r\n * @param value The value to be converted to a string.\r\n * @param length The minimum required length of the final string.\r\n *\r\n * @returns A string that represents the value.\r\n */\r\nfunction padZeroLeft(value: number, length: number): string {\r\n const str = value.toString();\r\n\r\n return \"0\".repeat(length - str.length) + str;\r\n}\r\n\r\n/**\r\n * Get a date-only string that can be used in the iCal format.\r\n *\r\n * @param date The date object to be converted to a string.\r\n *\r\n * @returns A string that represents only the date portion of the parameter.\r\n */\r\nfunction getDateString(date: RockDateTime): string {\r\n const year = date.year;\r\n const month = date.month;\r\n const day = date.day;\r\n\r\n return `${year}${padZeroLeft(month, 2)}${padZeroLeft(day, 2)}`;\r\n}\r\n\r\n/**\r\n * Gets a time-only string that can be used in the iCal format.\r\n *\r\n * @param date The date object to be converted to a string.\r\n *\r\n * @returns A string that represents only the time portion of the parameter.\r\n */\r\nfunction getTimeString(date: RockDateTime): string {\r\n const hour = date.hour;\r\n const minute = date.minute;\r\n const second = date.second;\r\n\r\n return `${padZeroLeft(hour, 2)}${padZeroLeft(minute, 2)}${padZeroLeft(second, 2)}`;\r\n}\r\n\r\n/**\r\n * Gets a date and time string that can be used in the iCal format.\r\n *\r\n * @param date The date object to be converted to a string.\r\n *\r\n * @returns A string that represents only the date and time of the parameter.\r\n */\r\nfunction getDateTimeString(date: RockDateTime): string {\r\n return `${getDateString(date)}T${getTimeString(date)}`;\r\n}\r\n\r\n/**\r\n * Gets all the date objects from a range or period string value. This converts\r\n * from an iCal format into a set of date objects.\r\n *\r\n * @param value The string value in iCal format.\r\n *\r\n * @returns An array of date objects that represents the range or period value.\r\n */\r\nfunction getDatesFromRangeOrPeriod(value: string): RockDateTime[] {\r\n const segments = value.split(\"/\");\r\n\r\n if (segments.length === 0) {\r\n return [];\r\n }\r\n\r\n const startDate = getDateFromString(segments[0]);\r\n if (!startDate) {\r\n return [];\r\n }\r\n\r\n if (segments.length !== 2) {\r\n return [startDate];\r\n }\r\n\r\n const dates: RockDateTime[] = [];\r\n\r\n if (segments[1].startsWith(\"P\")) {\r\n // Value is a period so we have a start date and then a period marker\r\n // to tell us how long that date extends.\r\n const days = getPeriodDurationInDays(segments[1]);\r\n\r\n for (let day = 0; day < days; day++) {\r\n const date = startDate.addDays(day);\r\n if (date) {\r\n dates.push(date);\r\n }\r\n }\r\n }\r\n else {\r\n // Value is a date range so we have a start date and then an end date\r\n // and we need to fill in the dates in between.\r\n const endDate = getDateFromString(segments[1]);\r\n\r\n if (endDate !== null) {\r\n let date = startDate;\r\n\r\n while (date <= endDate) {\r\n dates.push(date);\r\n date = date.addDays(1);\r\n }\r\n }\r\n }\r\n\r\n return dates;\r\n}\r\n\r\n/**\r\n * Get a date object that only has the date portion filled in from the iCal\r\n * date string. The time will be set to midnight.\r\n *\r\n * @param value An iCal date value.\r\n *\r\n * @returns A date object that represents the iCal date value.\r\n */\r\nfunction getDateFromString(value: string): RockDateTime | null {\r\n if (value.length < 8) {\r\n return null;\r\n }\r\n\r\n const year = parseInt(value.substring(0, 4));\r\n const month = parseInt(value.substring(4, 6));\r\n const day = parseInt(value.substring(6, 8));\r\n\r\n return RockDateTime.fromParts(year, month, day);\r\n}\r\n\r\n/**\r\n * Get a date object that has both the date and time filled in from the iCal\r\n * date string.\r\n *\r\n * @param value An iCal date value.\r\n *\r\n * @returns A date object that represents the iCal date value.\r\n */\r\nfunction getDateTimeFromString(value: string): RockDateTime | null {\r\n if (value.length < 15 || value[8] !== \"T\") {\r\n return null;\r\n }\r\n\r\n const year = parseInt(value.substring(0, 4));\r\n const month = parseInt(value.substring(4, 6));\r\n const day = parseInt(value.substring(6, 8));\r\n const hour = parseInt(value.substring(9, 11));\r\n const minute = parseInt(value.substring(11, 13));\r\n const second = parseInt(value.substring(13, 15));\r\n\r\n return RockDateTime.fromParts(year, month, day, hour, minute, second);\r\n}\r\n\r\n/**\r\n * Gets an iCal period duration in the number of days.\r\n *\r\n * @param period The iCal period definition.\r\n *\r\n * @returns The number of days found in the definition.\r\n */\r\nfunction getPeriodDurationInDays(period: string): number {\r\n // These are in a format like P1D, P2W, etc.\r\n if (!period.startsWith(\"P\")) {\r\n return 0;\r\n }\r\n\r\n if (period.endsWith(\"D\")) {\r\n return parseInt(period.substring(1, period.length - 1));\r\n }\r\n else if (period.endsWith(\"W\")) {\r\n return parseInt(period.substring(1, period.length - 1)) * 7;\r\n }\r\n\r\n return 0;\r\n}\r\n\r\n/**\r\n * Gets the specific recurrence dates from a RDATE iCal value string.\r\n *\r\n * @param attributes The attributes that were defined on the RDATE property.\r\n * @param value The value of the RDATE property.\r\n *\r\n * @returns An array of date objects found in the RDATE value.\r\n */\r\nfunction getRecurrenceDates(attributes: Record, value: string): RockDateTime[] {\r\n const recurrenceDates: RockDateTime[] = [];\r\n const valueParts = value.split(\",\");\r\n let valueType = attributes[\"VALUE\"];\r\n\r\n for (const valuePart of valueParts) {\r\n if(!valueType) {\r\n // The value type is unspecified and it could be a PERIOD, DATE-TIME or a DATE.\r\n // Determine it based on the length and the contents of the valuePart string.\r\n\r\n const length = valuePart.length;\r\n\r\n if (length === 8) { // Eg: 20240117\r\n valueType = \"DATE\";\r\n }\r\n else if ((length === 15 || length === 16) && valuePart[8] === \"T\") { // Eg: 19980119T020000, 19970714T173000Z\r\n valueType = \"DATE-TIME\";\r\n }\r\n else { // Eg: 20240201/20240202, 20240118/P1D\r\n valueType = \"PERIOD\";\r\n }\r\n }\r\n\r\n\r\n if (valueType === \"PERIOD\") {\r\n // Values are stored in period format, such as \"20221005/P1D\".\r\n recurrenceDates.push(...getDatesFromRangeOrPeriod(valuePart));\r\n }\r\n else if (valueType === \"DATE\") {\r\n // Values are date-only values.\r\n const date = getDateFromString(valuePart);\r\n if (date) {\r\n recurrenceDates.push(date);\r\n }\r\n }\r\n else if (valueType === \"DATE-TIME\") {\r\n // Values are date and time values.\r\n const date = getDateTimeFromString(valuePart);\r\n if (date) {\r\n recurrenceDates.push(date);\r\n }\r\n }\r\n }\r\n\r\n return recurrenceDates;\r\n}\r\n\r\n/**\r\n * Gets the name of the weekday from the iCal abbreviation.\r\n *\r\n * @param day The iCal day abbreviation.\r\n *\r\n * @returns A string that represents the day name.\r\n */\r\nfunction getWeekdayName(day: DayOfWeek): \"Sunday\" | \"Monday\" | \"Tuesday\" | \"Wednesday\" | \"Thursday\" | \"Friday\" | \"Saturday\" | \"Unknown\" {\r\n if (day === DayOfWeek.Sunday) {\r\n return \"Sunday\";\r\n }\r\n else if (day === DayOfWeek.Monday) {\r\n return \"Monday\";\r\n }\r\n else if (day === DayOfWeek.Tuesday) {\r\n return \"Tuesday\";\r\n }\r\n else if (day === DayOfWeek.Wednesday) {\r\n return \"Wednesday\";\r\n }\r\n else if (day === DayOfWeek.Thursday) {\r\n return \"Thursday\";\r\n }\r\n else if (day === DayOfWeek.Friday) {\r\n return \"Friday\";\r\n }\r\n else if (day === DayOfWeek.Saturday) {\r\n return \"Saturday\";\r\n }\r\n else {\r\n return \"Unknown\";\r\n }\r\n}\r\n\r\n/**\r\n * Checks if the date matches one of the weekday options.\r\n *\r\n * @param rockDate The date that must match one of the weekday options.\r\n * @param days The array of weekdays that the date must match.\r\n *\r\n * @returns True if the date matches; otherwise false.\r\n */\r\nfunction dateMatchesDays(rockDate: RockDateTime, days: DayOfWeek[]): boolean {\r\n for (const day of days) {\r\n if (rockDate.dayOfWeek === day) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Checks if the date matches the specifie day of week and also the offset into\r\n * the month for that day.\r\n *\r\n * @param rockDate The date object to be checked.\r\n * @param dayOfWeek The day of week the date must be on.\r\n * @param offsets The offset in week, such as 2 meaning the second 'dayOfWeek' or -1 meaning the last 'dayOfWeek'.\r\n *\r\n * @returns True if the date matches the options; otherwise false.\r\n */\r\nfunction dateMatchesOffsetDayOfWeeks(rockDate: RockDateTime, dayOfWeek: DayOfWeek, offsets: number[]): boolean {\r\n if (!dateMatchesDays(rockDate, [dayOfWeek])) {\r\n return false;\r\n }\r\n\r\n const dayOfMonth = rockDate.day;\r\n\r\n for (const offset of offsets) {\r\n if (offset === 1 && dayOfMonth >= 1 && dayOfMonth <= 7) {\r\n return true;\r\n }\r\n else if (offset === 2 && dayOfMonth >= 8 && dayOfMonth <= 14) {\r\n return true;\r\n }\r\n else if (offset === 3 && dayOfMonth >= 15 && dayOfMonth <= 21) {\r\n return true;\r\n }\r\n else if (offset === 4 && dayOfMonth >= 22 && dayOfMonth <= 28) {\r\n return true;\r\n }\r\n else if (offset === -1) {\r\n const lastDayOfMonth = rockDate.addDays(-(rockDate.day - 1)).addMonths(1).addDays(-1).day;\r\n\r\n if (dayOfMonth >= (lastDayOfMonth - 7) && dayOfMonth <= lastDayOfMonth) {\r\n return true;\r\n }\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Gets the DayOfWeek value that corresponds to the iCal formatted weekday.\r\n *\r\n * @param day The day of the week to be parsed.\r\n *\r\n * @returns A DayOfWeek value that represents the day.\r\n */\r\nfunction getDayOfWeekFromIcalDay(day: \"SU\" | \"MO\" | \"TU\" | \"WE\" | \"TH\" | \"FR\" | \"SA\"): DayOfWeek {\r\n switch (day) {\r\n case \"SU\":\r\n return DayOfWeek.Sunday;\r\n\r\n case \"MO\":\r\n return DayOfWeek.Monday;\r\n case \"TU\":\r\n return DayOfWeek.Tuesday;\r\n\r\n case \"WE\":\r\n return DayOfWeek.Wednesday;\r\n\r\n case \"TH\":\r\n return DayOfWeek.Thursday;\r\n\r\n case \"FR\":\r\n return DayOfWeek.Friday;\r\n\r\n case \"SA\":\r\n return DayOfWeek.Saturday;\r\n }\r\n}\r\n\r\n/**\r\n * Gets the iCal abbreviation for the day of the week.\r\n *\r\n * @param day The day of the week to be converted to iCal format.\r\n *\r\n * @returns An iCal representation of the day of week.\r\n */\r\nfunction getiCalDay(day: DayOfWeek): \"SU\" | \"MO\" | \"TU\" | \"WE\" | \"TH\" | \"FR\" | \"SA\" {\r\n switch (day) {\r\n case DayOfWeek.Sunday:\r\n return \"SU\";\r\n\r\n case DayOfWeek.Monday:\r\n return \"MO\";\r\n\r\n case DayOfWeek.Tuesday:\r\n return \"TU\";\r\n\r\n case DayOfWeek.Wednesday:\r\n return \"WE\";\r\n\r\n case DayOfWeek.Thursday:\r\n return \"TH\";\r\n\r\n case DayOfWeek.Friday:\r\n return \"FR\";\r\n\r\n case DayOfWeek.Saturday:\r\n return \"SA\";\r\n }\r\n}\r\n\r\n/**\r\n * Normalizes line length so that none of the individual lines exceed the\r\n * maximum length of 75 charactes from the RFC.\r\n *\r\n * @param lines The array of lines to be normalized.\r\n *\r\n * @returns A new array with the lines normalized for length.\r\n */\r\nfunction normalizeLineLength(lines: string[]): string[] {\r\n const newLines: string[] = [...lines];\r\n\r\n for (let lineNumber = 0; lineNumber < newLines.length; lineNumber++) {\r\n // Spec does not allow lines longer than 75 characters.\r\n if (newLines[lineNumber].length > 75) {\r\n const currentLine = newLines[lineNumber].substring(0, 75);\r\n const newLine = \" \" + newLines[lineNumber].substring(75);\r\n\r\n newLines.splice(lineNumber, 1, currentLine, newLine);\r\n }\r\n }\r\n\r\n return newLines;\r\n}\r\n\r\n/**\r\n * Denormalizes line length so that any continuation lines are appending\r\n * to the previous line for proper parsing.\r\n *\r\n * @param lines The array of lines to be denormalized.\r\n *\r\n * @returns A new array with the lines denormalized.\r\n */\r\nfunction denormalizeLineLength(lines: string[]): string[] {\r\n const newLines: string[] = [...lines];\r\n\r\n for (let lineNumber = 1; lineNumber < newLines.length;) {\r\n if (newLines[lineNumber][0] === \" \") {\r\n newLines[lineNumber - 1] += newLines[lineNumber].substring(1);\r\n newLines.splice(lineNumber, 1);\r\n }\r\n else {\r\n lineNumber++;\r\n }\r\n }\r\n\r\n return newLines;\r\n}\r\n\r\n// #endregion\r\n\r\n/**\r\n * Helper utility to feed lines into ICS parsers.\r\n */\r\nclass LineFeeder {\r\n // #region Properties\r\n\r\n /**\r\n * The denormalzied lines that represent the ICS data.\r\n */\r\n private lines: string[];\r\n\r\n // #endregion\r\n\r\n // #region Constructors\r\n\r\n /**\r\n * Creates a new LineFeeder with the given content.\r\n *\r\n * @param content A string that represents raw ICS data.\r\n */\r\n constructor(content: string) {\r\n const lines = content.split(/\\r\\n|\\n|\\r/);\r\n\r\n this.lines = denormalizeLineLength(lines);\r\n }\r\n\r\n // #endregion\r\n\r\n // #region Functions\r\n\r\n /**\r\n * Peek at the next line to be read from the feeder.\r\n *\r\n * @returns The next line to be read or null if no more lines remain.\r\n */\r\n public peek(): string | null {\r\n if (this.lines.length === 0) {\r\n return null;\r\n }\r\n\r\n return this.lines[0];\r\n }\r\n\r\n /**\r\n * Pops the next line from the feeder, removing it.\r\n *\r\n * @returns The line that was removed from the feeder or null if no lines remain.\r\n */\r\n public pop(): string | null {\r\n if (this.lines.length === 0) {\r\n return null;\r\n }\r\n\r\n return this.lines.splice(0, 1)[0];\r\n }\r\n\r\n // #endregion\r\n}\r\n\r\n/**\r\n * Logic and structure for a rule that defines when an even recurs on\r\n * different dates.\r\n */\r\nexport class RecurrenceRule {\r\n // #region Properties\r\n\r\n /**\r\n * The frequency of this recurrence. Only Daily, Weekly and Monthly\r\n * are supported.\r\n */\r\n public frequency?: Frequency;\r\n\r\n /**\r\n * The date at which no more event dates will be generated. This is\r\n * an exclusive date, meaning if an event date lands on this date\r\n * then it will not be included in the list of dates.\r\n */\r\n public endDate?: RockDateTime;\r\n\r\n /**\r\n * The maximum number of dates, including the original date, that\r\n * should be generated.\r\n */\r\n public count?: number;\r\n\r\n /**\r\n * The interval between dates based on the frequency. If this value is\r\n * 2 and frequency is Weekly, then you are asking for \"every other week\".\r\n */\r\n public interval: number = 1;\r\n\r\n /**\r\n * The days of the month the event should recur on. Only a single value\r\n * is supported currently.\r\n */\r\n public byMonthDay: number[] = [];\r\n\r\n /**\r\n * The days of the week the event shoudl recur on.\r\n */\r\n public byDay: WeekdayNumber[] = [];\r\n\r\n // #endregion\r\n\r\n // #region Constructors\r\n\r\n /**\r\n * Creates a new recurrence rule that can be used to define or adjust the\r\n * recurrence pattern of an event.\r\n *\r\n * @param rule An existing RRULE string from an iCal file.\r\n *\r\n * @returns A new instance that can be used to adjust or define the rule.\r\n */\r\n public constructor(rule: string | undefined = undefined) {\r\n if (!rule) {\r\n return;\r\n }\r\n\r\n // Rule has a format like \"FREQ=DAILY;COUNT=5\" so we split by semicolon\r\n // first and then sub-split by equals character and then stuff everything\r\n // into this values object.\r\n const values: Record = {};\r\n\r\n for (const attr of rule.split(\";\")) {\r\n const attrParts = attr.split(\"=\");\r\n if (attrParts.length === 2) {\r\n values[attrParts[0]] = attrParts[1];\r\n }\r\n }\r\n\r\n // Make sure the values we have are valid.\r\n if (values[\"UNTIL\"] !== undefined && values[\"COUNT\"] !== undefined) {\r\n throw new Error(`Recurrence rule '${rule}' cannot specify both UNTIL and COUNT.`);\r\n }\r\n\r\n if (values[\"FREQ\"] !== \"DAILY\" && values[\"FREQ\"] !== \"WEEKLY\" && values[\"FREQ\"] !== \"MONTHLY\") {\r\n throw new Error(`Invalid frequence for recurrence rule '${rule}'.`);\r\n }\r\n\r\n this.frequency = values[\"FREQ\"];\r\n\r\n if (values[\"UNTIL\"]?.length === 8) {\r\n this.endDate = getDateFromString(values[\"UNTIL\"]) ?? undefined;\r\n }\r\n else if (values[\"UNTIL\"]?.length >= 15) {\r\n this.endDate = getDateTimeFromString(values[\"UNTIL\"]) ?? undefined;\r\n }\r\n\r\n if (values[\"COUNT\"] !== undefined) {\r\n this.count = toNumberOrNull(values[\"COUNT\"]) ?? undefined;\r\n }\r\n\r\n if (values[\"INTERVAL\"] !== undefined) {\r\n this.interval = toNumberOrNull(values[\"INTERVAL\"]) ?? 1;\r\n }\r\n\r\n if (values[\"BYMONTHDAY\"] !== undefined && values[\"BYMONTHDAY\"].length > 0) {\r\n this.byMonthDay = [];\r\n\r\n for (const v of values[\"BYMONTHDAY\"].split(\",\")) {\r\n const num = toNumberOrNull(v);\r\n if (num !== null) {\r\n this.byMonthDay.push(num);\r\n }\r\n }\r\n }\r\n\r\n if (values[\"BYDAY\"] !== undefined && values[\"BYDAY\"].length > 0) {\r\n this.byDay = [];\r\n\r\n for (const v of values[\"BYDAY\"].split(\",\")) {\r\n if (v.length < 2) {\r\n continue;\r\n }\r\n\r\n const num = v.length > 2 ? toNumberOrNull(v.substring(0, v.length - 2)) : 1;\r\n const day = v.substring(v.length - 2);\r\n\r\n if (num === null) {\r\n continue;\r\n }\r\n\r\n if (day === \"SU\" || day === \"MO\" || day === \"TU\" || day == \"WE\" || day == \"TH\" || day == \"FR\" || day == \"SA\") {\r\n this.byDay.push({\r\n value: num,\r\n day: getDayOfWeekFromIcalDay(day)\r\n });\r\n }\r\n }\r\n }\r\n }\r\n\r\n // #endregion\r\n\r\n // #region Functions\r\n\r\n /**\r\n * Builds and returns the RRULE value for an iCal file export.\r\n *\r\n * @returns A RRULE value that represents the recurrence rule.\r\n */\r\n public build(): string {\r\n const attributes: string[] = [];\r\n\r\n attributes.push(`FREQ=${this.frequency}`);\r\n\r\n if (this.count !== undefined) {\r\n attributes.push(`COUNT=${this.count}`);\r\n }\r\n else if (this.endDate) {\r\n attributes.push(`UNTIL=${getDateTimeString(this.endDate)}`);\r\n }\r\n\r\n if (this.interval > 1) {\r\n attributes.push(`INTERVAL=${this.interval}`);\r\n }\r\n\r\n if (this.byMonthDay.length > 0) {\r\n const monthDayValues = this.byMonthDay.map(md => md.toString()).join(\",\");\r\n attributes.push(`BYMONTHDAY=${monthDayValues}`);\r\n }\r\n\r\n if (this.byDay.length > 0) {\r\n const dayValues = this.byDay.map(d => d.value !== 1 ? `${d.value}${getiCalDay(d.day)}` : getiCalDay(d.day));\r\n attributes.push(`BYDAY=${dayValues}`);\r\n }\r\n\r\n return attributes.join(\";\");\r\n }\r\n\r\n /**\r\n * Gets all the dates within the range that match the recurrence rule. A\r\n * maximum of 100,000 dates will be returned by this function.\r\n *\r\n * @param eventStartDateTime The start date and time of the primary event this rule is for.\r\n * @param startDateTime The inclusive starting date and time that events should be returned for.\r\n * @param endDateTime The exclusive ending date and time that events should be returned for.\r\n *\r\n * @returns An array of date objects that represent the additional dates and times for the event.\r\n */\r\n public getDates(eventStartDateTime: RockDateTime, startDateTime: RockDateTime, endDateTime: RockDateTime): RockDateTime[] {\r\n const dates: RockDateTime[] = [];\r\n let rockDate = eventStartDateTime;\r\n let dateCount = 0;\r\n\r\n if (!rockDate) {\r\n return [];\r\n }\r\n\r\n if (this.endDate && this.endDate < endDateTime) {\r\n endDateTime = this.endDate;\r\n }\r\n\r\n while (rockDate < endDateTime && dateCount < 100_000) {\r\n if (this.count && dateCount >= this.count) {\r\n break;\r\n }\r\n\r\n dateCount++;\r\n\r\n if (rockDate >= startDateTime) {\r\n dates.push(rockDate);\r\n }\r\n\r\n const nextDate = this.nextDateAfter(rockDate);\r\n\r\n if (nextDate === null) {\r\n break;\r\n }\r\n else {\r\n rockDate = nextDate;\r\n }\r\n }\r\n\r\n return dates;\r\n }\r\n\r\n /**\r\n * Gets the next valid date after the specified date based on our recurrence\r\n * rules.\r\n *\r\n * @param rockDate The reference date that should be used when calculation the next date.\r\n *\r\n * @returns The next date after the reference date or null if one cannot be determined.\r\n */\r\n private nextDateAfter(rockDate: RockDateTime): RockDateTime | null {\r\n if (this.frequency === \"DAILY\") {\r\n return rockDate.addDays(this.interval);\r\n }\r\n else if (this.frequency === \"WEEKLY\" && this.byDay.length > 0) {\r\n let nextDate = rockDate;\r\n\r\n if (nextDate.dayOfWeek === DayOfWeek.Saturday) {\r\n // On saturday process any skip intervals to move past the next n weeks.\r\n nextDate = nextDate.addDays(1 + ((this.interval - 1) * 7));\r\n }\r\n else {\r\n nextDate = nextDate.addDays(1);\r\n }\r\n\r\n while (!dateMatchesDays(nextDate, this.byDay.map(d => d.day))) {\r\n if (nextDate.dayOfWeek === DayOfWeek.Saturday) {\r\n // On saturday process any skip intervals to move past the next n weeks.\r\n nextDate = nextDate.addDays(1 + ((this.interval - 1) * 7));\r\n }\r\n else {\r\n nextDate = nextDate.addDays(1);\r\n }\r\n }\r\n\r\n return nextDate;\r\n }\r\n else if (this.frequency === \"MONTHLY\") {\r\n if (this.byMonthDay.length > 0) {\r\n let nextDate = rockDate.addDays(-(rockDate.day - 1));\r\n\r\n if (rockDate.day >= this.byMonthDay[0]) {\r\n nextDate = nextDate.addMonths(this.interval);\r\n }\r\n\r\n let lastDayOfMonth = nextDate.addMonths(1).addDays(-1).day;\r\n let loopCount = 0;\r\n\r\n // Skip any months that don't have this day number.\r\n while (lastDayOfMonth < this.byMonthDay[0]) {\r\n nextDate = nextDate.addMonths(this.interval);\r\n\r\n lastDayOfMonth = nextDate.addMonths(1).addDays(-1).day;\r\n\r\n // Fail-safe check so we don't get stuck looping forever\r\n // if the rule is one that can't be determined. Such as a\r\n // rule for the 30th day of the month every 12 months\r\n // starting in February.\r\n if (loopCount++ >= 100) {\r\n return null;\r\n }\r\n }\r\n\r\n nextDate = nextDate.addDays(this.byMonthDay[0] - 1);\r\n\r\n return nextDate;\r\n }\r\n else if (this.byDay.length > 0) {\r\n const dayOfWeek = this.byDay[0].day;\r\n const offsets = this.byDay.map(d => d.value);\r\n\r\n let nextDate = rockDate.addDays(1);\r\n\r\n while (!dateMatchesOffsetDayOfWeeks(nextDate, dayOfWeek, offsets)) {\r\n nextDate = nextDate.addDays(1);\r\n }\r\n\r\n return nextDate;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n // #endregion\r\n}\r\n\r\n/**\r\n * A single event inside a calendar.\r\n */\r\nexport class Event {\r\n // #region Properties\r\n\r\n /**\r\n * The unique identifier for this schedule used in the scheduled event.\r\n */\r\n public uid?: string;\r\n\r\n /**\r\n * The first date and time that the event occurs on. This must be provided\r\n * before the schedule can be built.\r\n */\r\n public startDateTime?: RockDateTime;\r\n\r\n /**\r\n * The end date and time for the event. This must be provided before\r\n * this schedule can be built.\r\n */\r\n public endDateTime?: RockDateTime;\r\n\r\n /**\r\n * An array of dates to be excluded from the recurrence rules.\r\n */\r\n public excludedDates: RockDateTime[] = [];\r\n\r\n /**\r\n * An array of specific dates that this schedule will recur on. This is\r\n * only valid if recurrenceRules contains no rules.\r\n */\r\n public recurrenceDates: RockDateTime[] = [];\r\n\r\n /**\r\n * The rules that define when this schedule recurs on for additional dates.\r\n * Only the first rule is currently supported.\r\n */\r\n public recurrenceRules: RecurrenceRule[] = [];\r\n\r\n // #endregion\r\n\r\n // #region Constructors\r\n\r\n /**\r\n * Creates a new internet calendar event.\r\n *\r\n * @param icsContent The content from the ICS file that represents this single event.\r\n *\r\n * @returns A new Event instance.\r\n */\r\n public constructor(icsContent: string | LineFeeder | undefined = undefined) {\r\n if (icsContent === undefined) {\r\n this.uid = newGuid();\r\n return;\r\n }\r\n\r\n let feeder: LineFeeder;\r\n\r\n if (typeof icsContent === \"string\") {\r\n feeder = new LineFeeder(icsContent);\r\n }\r\n else {\r\n feeder = icsContent;\r\n }\r\n\r\n this.parse(feeder);\r\n }\r\n\r\n // #endregion\r\n\r\n // #region Functions\r\n\r\n /**\r\n * Build the event as a list of individual lines that make up the event in\r\n * the ICS file format.\r\n *\r\n * @returns An array of lines to be inserted into an ICS file.\r\n */\r\n public buildLines(): string[] {\r\n if (!this.startDateTime || !this.endDateTime) {\r\n return [];\r\n }\r\n\r\n const lines: string[] = [];\r\n\r\n lines.push(\"BEGIN:VEVENT\");\r\n lines.push(`DTEND:${getDateTimeString(this.endDateTime)}`);\r\n lines.push(`DTSTAMP:${getDateTimeString(RockDateTime.now())}`);\r\n lines.push(`DTSTART:${getDateTimeString(this.startDateTime)}`);\r\n\r\n if (this.excludedDates.length > 0) {\r\n lines.push(`EXDATE:${this.excludedDates.map(d => getDateString(d) + \"/P1D\").join(\",\")}`);\r\n }\r\n\r\n if (this.recurrenceDates.length > 0) {\r\n const recurrenceDates: string[] = [];\r\n for (const date of this.recurrenceDates) {\r\n const rDate = RockDateTime.fromParts(date.year, date.month, date.day, this.startDateTime.hour, this.startDateTime.minute, this.startDateTime.second);\r\n if (rDate) {\r\n recurrenceDates.push(getDateTimeString(rDate));\r\n }\r\n }\r\n\r\n lines.push(`RDATE:${recurrenceDates.join(\",\")}`);\r\n }\r\n else if (this.recurrenceRules.length > 0) {\r\n for (const rrule of this.recurrenceRules) {\r\n lines.push(`RRULE:${rrule.build()}`);\r\n }\r\n }\r\n\r\n lines.push(\"SEQUENCE:0\");\r\n lines.push(`UID:${this.uid}`);\r\n lines.push(\"END:VEVENT\");\r\n\r\n return lines;\r\n }\r\n\r\n /**\r\n * Builds the event into a string that conforms to ICS format.\r\n *\r\n * @returns An ICS formatted string that represents the event data.\r\n */\r\n public build(): string | null {\r\n const lines = this.buildLines();\r\n\r\n if (lines.length === 0) {\r\n return null;\r\n }\r\n\r\n return normalizeLineLength(lines).join(\"\\r\\n\");\r\n }\r\n\r\n /**\r\n * Parse data from an existing event and store it on this instance.\r\n *\r\n * @param feeder The feeder that will provide the line data for parsing.\r\n */\r\n private parse(feeder: LineFeeder): void {\r\n let duration: string | null = null;\r\n let line: string | null;\r\n\r\n // Verify this is an event.\r\n if (feeder.peek() !== \"BEGIN:VEVENT\") {\r\n throw new Error(\"Invalid event.\");\r\n }\r\n\r\n feeder.pop();\r\n\r\n // Parse the line until we run out of lines or see an END line.\r\n while ((line = feeder.pop()) !== null) {\r\n if (line === \"END:VEVENT\") {\r\n break;\r\n }\r\n\r\n const splitAt = line.indexOf(\":\");\r\n if (splitAt < 0) {\r\n continue;\r\n }\r\n\r\n let key = line.substring(0, splitAt);\r\n const value = line.substring(splitAt + 1);\r\n\r\n const keyAttributes: Record = {};\r\n const keySegments = key.split(\";\");\r\n if (keySegments.length > 1) {\r\n key = keySegments[0];\r\n keySegments.splice(0, 1);\r\n\r\n for (const attr of keySegments) {\r\n const attrSegments = attr.split(\"=\");\r\n if (attr.length === 2) {\r\n keyAttributes[attrSegments[0]] = attrSegments[1];\r\n }\r\n }\r\n }\r\n\r\n if (key === \"DTSTART\") {\r\n this.startDateTime = getDateTimeFromString(value) ?? undefined;\r\n }\r\n else if (key === \"DTEND\") {\r\n this.endDateTime = getDateTimeFromString(value) ?? undefined;\r\n }\r\n else if (key === \"RRULE\") {\r\n this.recurrenceRules.push(new RecurrenceRule(value));\r\n }\r\n else if (key === \"RDATE\") {\r\n this.recurrenceDates = getRecurrenceDates(keyAttributes, value);\r\n }\r\n else if (key === \"UID\") {\r\n this.uid = value;\r\n }\r\n else if (key === \"DURATION\") {\r\n duration = value;\r\n }\r\n else if (key === \"EXDATE\") {\r\n const dateValues = value.split(\",\");\r\n for (const dateValue of dateValues) {\r\n const dates = getDatesFromRangeOrPeriod(dateValue);\r\n this.excludedDates.push(...dates);\r\n }\r\n }\r\n }\r\n\r\n if (duration !== null) {\r\n // TODO: Calculate number of seconds and add to startDate.\r\n }\r\n }\r\n\r\n /**\r\n * Determines if the date is listed in one of the excluded dates. This\r\n * currently only checks the excludedDates but in the future might also\r\n * check the excluded rules.\r\n *\r\n * @param rockDate The date to be checked to see if it is excluded.\r\n *\r\n * @returns True if the date is excluded; otherwise false.\r\n */\r\n private isDateExcluded(rockDate: RockDateTime): boolean {\r\n const rockDateOnly = rockDate.date;\r\n\r\n for (const excludedDate of this.excludedDates) {\r\n if (excludedDate.date.isEqualTo(rockDateOnly)) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Get all the dates for this event that fall within the specified date range.\r\n *\r\n * @param startDateTime The inclusive starting date to use when filtering event dates.\r\n * @param endDateTime The exclusive endign date to use when filtering event dates.\r\n *\r\n * @returns An array of dates that fall between startDateTime and endDateTime.\r\n */\r\n public getDates(startDateTime: RockDateTime, endDateTime: RockDateTime): RockDateTime[] {\r\n if (!this.startDateTime) {\r\n return [];\r\n }\r\n\r\n // If the schedule has a startDateTime that is later than the requested\r\n // startDateTime then use ours instead.\r\n if (this.startDateTime > startDateTime) {\r\n startDateTime = this.startDateTime;\r\n }\r\n\r\n if (this.recurrenceDates.length > 0) {\r\n const dates: RockDateTime[] = [];\r\n const recurrenceDates: RockDateTime[] = [this.startDateTime, ...this.recurrenceDates];\r\n\r\n for (const date of recurrenceDates) {\r\n if (date >= startDateTime && date < endDateTime) {\r\n dates.push(date);\r\n }\r\n }\r\n\r\n return dates;\r\n }\r\n else if (this.recurrenceRules.length > 0) {\r\n const rrule = this.recurrenceRules[0];\r\n\r\n return rrule.getDates(this.startDateTime, startDateTime, endDateTime)\r\n .filter(d => !this.isDateExcluded(d));\r\n }\r\n else {\r\n if (this.startDateTime >= startDateTime && this.startDateTime < endDateTime) {\r\n return [this.startDateTime];\r\n }\r\n\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * Get the friendly text string that represents this event. This will be a\r\n * plain text string with no formatting applied.\r\n *\r\n * @returns A string that represents the event in a human friendly manner.\r\n */\r\n public toFriendlyText(): string {\r\n return this.toFriendlyString(false);\r\n }\r\n\r\n /**\r\n * Get the friendly HTML string that represents this event. This will be\r\n * formatted with HTML to make the information easier to read.\r\n *\r\n * @returns A string that represents the event in a human friendly manner.\r\n */\r\n public toFriendlyHtml(): string {\r\n return this.toFriendlyString(true);\r\n }\r\n\r\n /**\r\n * Get the friendly string that can be easily understood by a human.\r\n *\r\n * @param html If true then the string can contain HTML content to make things easier to read.\r\n *\r\n * @returns A string that represents the event in a human friendly manner.\r\n */\r\n private toFriendlyString(html: boolean): string {\r\n if (!this.startDateTime) {\r\n return \"\";\r\n }\r\n\r\n const startTimeText = this.startDateTime.toLocaleString({ hour: \"numeric\", minute: \"2-digit\", hour12: true });\r\n\r\n if (this.recurrenceRules.length > 0) {\r\n const rrule = this.recurrenceRules[0];\r\n\r\n if (rrule.frequency === \"DAILY\") {\r\n let result = \"Daily\";\r\n\r\n if (rrule.interval > 1) {\r\n result += ` every ${rrule.interval} ${pluralConditional(rrule.interval, \"day\", \"days\")}`;\r\n }\r\n\r\n result += ` at ${startTimeText}`;\r\n\r\n return result;\r\n }\r\n else if (rrule.frequency === \"WEEKLY\") {\r\n if (rrule.byDay.length === 0) {\r\n return \"No Scheduled Days\";\r\n }\r\n\r\n let result = rrule.byDay.map(d => getWeekdayName(d.day) + \"s\").join(\",\");\r\n\r\n if (rrule.interval > 1) {\r\n result = `Every ${rrule.interval} weeks: ${result}`;\r\n }\r\n else {\r\n result = `Weekly: ${result}`;\r\n }\r\n\r\n return `${result} at ${startTimeText}`;\r\n }\r\n else if (rrule.frequency === \"MONTHLY\") {\r\n if (rrule.byMonthDay.length > 0) {\r\n let result = `Day ${rrule.byMonthDay[0]} of every `;\r\n\r\n if (rrule.interval > 1) {\r\n result += `${rrule.interval} months`;\r\n }\r\n else {\r\n result += \"month\";\r\n }\r\n\r\n return `${result} at ${startTimeText}`;\r\n }\r\n else if (rrule.byDay.length > 0) {\r\n const byDay = rrule.byDay[0];\r\n const offsetNames = nthNamesAbbreviated.filter(n => rrule.byDay.some(d => d.value == n[0])).map(n => n[1]);\r\n let result = \"\";\r\n\r\n if (offsetNames.length > 0) {\r\n let nameText: string;\r\n\r\n if (offsetNames.length > 2) {\r\n nameText = `${offsetNames.slice(0, offsetNames.length - 1).join(\", \")} and ${offsetNames[offsetNames.length - 1]}`;\r\n }\r\n else {\r\n nameText = offsetNames.join(\" and \");\r\n }\r\n result = `The ${nameText} ${getWeekdayName(byDay.day)} of every month`;\r\n }\r\n else {\r\n return \"\";\r\n }\r\n\r\n return `${result} at ${startTimeText}`;\r\n }\r\n else {\r\n return \"\";\r\n }\r\n }\r\n else {\r\n return \"\";\r\n }\r\n }\r\n else {\r\n const dates: RockDateTime[] = [this.startDateTime, ...this.recurrenceDates];\r\n\r\n if (dates.length === 1) {\r\n return `Once at ${this.startDateTime.toASPString(\"g\")}`;\r\n }\r\n else if (!html || dates.length > 99) {\r\n const firstDate = dates[0];\r\n const lastDate = dates[dates.length - 1];\r\n\r\n if (firstDate && lastDate) {\r\n return `Multiple dates between ${firstDate.toASPString(\"g\")} and ${lastDate.toASPString(\"g\")}`;\r\n }\r\n else {\r\n return \"\";\r\n }\r\n }\r\n else if (dates.length > 1) {\r\n let listHtml = `
    `;\r\n\r\n for (const date of dates) {\r\n listHtml += `
  • ${date.toASPString(\"g\")}
  • `;\r\n }\r\n\r\n listHtml += \"\";\r\n\r\n return listHtml;\r\n }\r\n else {\r\n return \"No Schedule\";\r\n }\r\n }\r\n }\r\n\r\n // #endregion\r\n}\r\n\r\n/**\r\n * A recurring schedule allows schedules to be built and customized from the iCal\r\n * format used in ics files.\r\n */\r\nexport class Calendar {\r\n // #region Properties\r\n\r\n /**\r\n * The events that exist for this calendar.\r\n */\r\n public events: Event[] = [];\r\n\r\n // #endregion\r\n\r\n // #region Constructors\r\n\r\n /**\r\n * Creates a new Calendar instance.\r\n *\r\n * @param icsContent The content from an ICS file to initialize the calendar with.\r\n *\r\n * @returns A new Calendar instance.\r\n */\r\n public constructor(icsContent: string | undefined = undefined) {\r\n if (icsContent === undefined) {\r\n return;\r\n }\r\n\r\n const feeder = new LineFeeder(icsContent);\r\n\r\n this.parse(feeder);\r\n }\r\n\r\n // #endregion\r\n\r\n // #region Functions\r\n\r\n /**\r\n * Builds the calendar into a string that conforms to ICS format.\r\n *\r\n * @returns An ICS formatted string that represents the calendar data.\r\n */\r\n public build(): string | null {\r\n const lines: string[] = [];\r\n\r\n lines.push(\"BEGIN:VCALENDAR\");\r\n lines.push(\"PRODID:-//github.com/SparkDevNetwork/Rock//NONSGML Rock//EN\");\r\n lines.push(\"VERSION:2.0\");\r\n\r\n for (const event of this.events) {\r\n lines.push(...event.buildLines());\r\n }\r\n\r\n lines.push(\"END:VCALENDAR\");\r\n\r\n return denormalizeLineLength(lines).join(\"\\r\\n\");\r\n }\r\n\r\n /**\r\n * Parses the ICS data from a line feeder and constructs the calendar\r\n * from that data.\r\n *\r\n * @param feeder The feeder that provides the individual lines.\r\n */\r\n private parse(feeder: LineFeeder): void {\r\n let line: string | null;\r\n\r\n // Parse the line data.\r\n while ((line = feeder.peek()) !== null) {\r\n if (line === \"BEGIN:VEVENT\") {\r\n const event = new Event(feeder);\r\n\r\n this.events.push(event);\r\n }\r\n else {\r\n feeder.pop();\r\n }\r\n }\r\n }\r\n\r\n // #endregion\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { Liquid } from \"@Obsidian/Libs/liquidjs\";\r\n\r\nconst engine = new Liquid({\r\n cache: true\r\n});\r\n\r\nexport function resolveMergeFields(template: string, mergeFields: Record): string {\r\n const tpl = engine.parse(template);\r\n\r\n return engine.renderSync(tpl, mergeFields);\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { ListItemBag } from \"@Obsidian/ViewModels/Utility/listItemBag\";\r\n\r\nexport function asListItemBagOrNull(bagJson: string): ListItemBag | null {\r\n try {\r\n const val = JSON.parse(bagJson);\r\n\r\n if (\"value\" in val || \"text\" in val) {\r\n return val;\r\n }\r\n\r\n return null;\r\n }\r\n catch (e) {\r\n return null;\r\n }\r\n}","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { MergeFieldPickerFormatSelectedValueOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/mergeFieldPickerFormatSelectedValueOptionsBag\";\r\nimport { useHttp } from \"./http\";\r\n\r\n/**\r\n * Take a given mergeFieldPicker value and format it for Lava\r\n *\r\n * @param value The merge field to be formatted\r\n *\r\n * @returns The formatted string in a Promise\r\n */\r\nexport async function formatValue(value: string): Promise {\r\n const http = useHttp();\r\n\r\n const options: MergeFieldPickerFormatSelectedValueOptionsBag = {\r\n selectedValue: value\r\n };\r\n\r\n const response = await http.post(\"/api/v2/Controls/MergeFieldPickerFormatSelectedValue\", {}, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.error(\"Error\", response.errorMessage || `Error formatting '${value}'.`);\r\n return \"\";\r\n }\r\n}","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n\r\nexport function fromEntries(entries: Iterable<[PropertyKey, string]>): Record {\r\n const res = {};\r\n for (const entry of entries) {\r\n res[entry[0]] = entry[1];\r\n }\r\n return res;\r\n}","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n\r\nimport Cache from \"./cache\";\r\nimport { useHttp } from \"./http\";\r\nimport { PhoneNumberBoxGetConfigurationResultsBag } from \"@Obsidian/ViewModels/Rest/Controls/phoneNumberBoxGetConfigurationResultsBag\";\r\nimport { PhoneNumberCountryCodeRulesConfigurationBag } from \"@Obsidian/ViewModels/Rest/Controls/phoneNumberCountryCodeRulesConfigurationBag\";\r\nimport { PhoneNumberBoxGetConfigurationOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/phoneNumberBoxGetConfigurationOptionsBag\";\r\n\r\nconst http = useHttp();\r\n\r\n/**\r\n * Fetch the configuration for phone numbers and their possible formats for different countries\r\n */\r\nasync function fetchPhoneNumberConfiguration(): Promise {\r\n const result = await http.post(\"/api/v2/Controls/PhoneNumberBoxGetConfiguration\", undefined, null);\r\n\r\n if (result.isSuccess && result.data) {\r\n return result.data;\r\n }\r\n\r\n throw new Error(result.errorMessage ?? \"Error fetching phone number configuration\");\r\n}\r\n\r\n/**\r\n * Fetch the configuration for phone numbers, SMS option, and possible phone number formats for different countries\r\n */\r\nasync function fetchPhoneNumberAndSmsConfiguration(): Promise {\r\n const options: Partial = {\r\n showSmsOptIn: true\r\n };\r\n const result = await http.post(\"/api/v2/Controls/PhoneNumberBoxGetConfiguration\", undefined, options);\r\n\r\n if (result.isSuccess && result.data) {\r\n return result.data;\r\n }\r\n\r\n throw new Error(result.errorMessage ?? \"Error fetching phone number configuration\");\r\n}\r\n\r\n/**\r\n * Fetch the configuration for phone numbers and their possible formats for different countries.\r\n * Cacheable version of fetchPhoneNumberConfiguration cacheable\r\n */\r\nexport const getPhoneNumberConfiguration = Cache.cachePromiseFactory(\"phoneNumberConfiguration\", fetchPhoneNumberConfiguration);\r\n\r\nexport const getPhoneNumberAndSmsConfiguration = Cache.cachePromiseFactory(\"phoneNumberAndSmsConfiguration\", fetchPhoneNumberAndSmsConfiguration);\r\n\r\nconst defaultRulesConfig = [\r\n {\r\n \"match\": \"^(\\\\d{3})(\\\\d{4})$\",\r\n \"format\": \"$1-$2\"\r\n },\r\n {\r\n \"match\": \"^(\\\\d{3})(\\\\d{3})(\\\\d{4})$\",\r\n \"format\": \"($1) $2-$3\"\r\n },\r\n {\r\n \"match\": \"^1(\\\\d{3})(\\\\d{3})(\\\\d{4})$\",\r\n \"format\": \"($1) $2-$3\"\r\n }\r\n];\r\n\r\n/**\r\n * Format a phone number according to a given configuration\r\n *\r\n * e.g. from the default configuration:\r\n * 3214567 => 321-4567\r\n * 3214567890 => (321) 456-7890\r\n */\r\nexport function formatPhoneNumber(value: string, rules: PhoneNumberCountryCodeRulesConfigurationBag[] = defaultRulesConfig): string {\r\n value = stripPhoneNumber(value);\r\n\r\n if (!value || rules.length == 0) {\r\n return value;\r\n }\r\n\r\n for (const rule of rules) {\r\n const regex = new RegExp(rule.match ?? \"\");\r\n\r\n if (regex.test(value)) {\r\n return value.replace(regex, rule.format ?? \"\") || value;\r\n }\r\n }\r\n\r\n return value;\r\n}\r\n\r\n/**\r\n * Strips special characters from the phone number.\r\n * (321) 456-7890 => 3214567890\r\n * @param str\r\n */\r\nexport function stripPhoneNumber(str: string): string {\r\n if (!str) {\r\n return \"\";\r\n }\r\n\r\n return str.replace(/\\D/g, \"\");\r\n}\r\n\r\nexport default {\r\n getPhoneNumberConfiguration,\r\n formatPhoneNumber,\r\n stripPhoneNumber\r\n};\r\n\r\n/* eslint-disable */\r\n// @ts-ignore\r\nwindow.formatPhoneNumber = formatPhoneNumber;","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\n\r\n// NOTE: Do not make this public yet. This is essentially temporary and\r\n// will likely move to a different place and be merged with the tooltip\r\n// concept code as well.\r\ntype PopoverOptions = {\r\n /** Allow HTML content in the popover. */\r\n html?: boolean;\r\n\r\n /** Enables santization of HTML content. */\r\n sanitize?: boolean;\r\n};\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ndeclare const $: any;\r\n\r\n/**\r\n * Configure a popover for the specified node or nodes to show on hover. This\r\n * currently uses Bootstrap popovers but may be changed to use a different\r\n * method later.\r\n * \r\n * @param node The node or nodes to have popovers configured on.\r\n * @param options The options that describe how the popovers should behave.\r\n */\r\nexport function popover(node: Element | Element[], options?: PopoverOptions): void {\r\n // If we got an array of elements then activate each one.\r\n if (Array.isArray(node)) {\r\n for (const n of node) {\r\n popover(n, options);\r\n }\r\n\r\n return;\r\n }\r\n\r\n $(node).popover({\r\n html: options?.html,\r\n sanitize: options?.sanitize ?? true\r\n });\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\n/**\r\n * Returns a promise that completes after the specified number of milliseconds\r\n * have ellapsed.\r\n * \r\n * @param ms The number of milliseconds to wait.\r\n * \r\n * @returns A promise that completes after the interval has ellapsed.\r\n */\r\nexport function sleep(ms: number): Promise {\r\n return new Promise(resolve => {\r\n setTimeout(resolve, ms);\r\n });\r\n}\r\n\r\n/**\r\n * Checks if the value is a promise to return a value. This is used to check\r\n * if a function that could have returned either a value or a promise for a\r\n * value returned a promise.\r\n * \r\n * @param obj The object to be tested if it is a promise.\r\n *\r\n * @returns True if the object is a promise.\r\n */\r\nexport function isPromise(obj: PromiseLike | T): obj is PromiseLike {\r\n return !!obj && (typeof obj === \"object\" || typeof obj === \"function\") && typeof (obj as Record).then === \"function\";\r\n}\r\n\r\n/**\r\n * A class that provides a way to defer execution via await until some\r\n * external trigger happens.\r\n */\r\nexport class PromiseCompletionSource {\r\n private internalPromise: Promise;\r\n\r\n private internalResolve: (T) => void = () => { /* Intentionally blank. */ };\r\n\r\n private internalReject: (reason?: unknown) => void = () => { /* Intentionally blank. */ };\r\n\r\n constructor() {\r\n this.internalPromise = new Promise((resolve, reject) => {\r\n this.internalResolve = resolve;\r\n this.internalReject = reject;\r\n });\r\n }\r\n\r\n /** The promise that can be awaited. */\r\n public get promise(): Promise {\r\n return this.internalPromise;\r\n }\r\n\r\n /**\r\n * Resolves the promise with the given value.\r\n * \r\n * @param value The value to be returned by the await call.\r\n */\r\n public resolve(value: T): void {\r\n this.internalResolve(value);\r\n }\r\n\r\n /**\r\n * Rejects the promise and throws the reason as an error.\r\n * \r\n * @param reason The reason to be thrown by the await call.\r\n */\r\n public reject(reason?: unknown): void {\r\n this.internalReject(reason);\r\n }\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { loadJavaScriptAsync } from \"./page\";\r\n\r\n// Disable certain checks as they are needed to interface with existing JS file.\r\n/* eslint-disable @typescript-eslint/ban-types */\r\n/* eslint-disable @typescript-eslint/no-explicit-any */\r\n\r\n/** A generic set a server functions with no type checking. */\r\nexport type GenericServerFunctions = {\r\n [name: string]: (...args: unknown[]) => unknown;\r\n};\r\n\r\n/** A set of specific server functions that conform to an interface. */\r\nexport type ServerFunctions = {\r\n [K in keyof T]: T[K] extends Function ? T[K] : never;\r\n};\r\n\r\n/**\r\n * An object that allows RealTime communication between the browser and the Rock\r\n * server over a specific topic.\r\n */\r\nexport interface ITopic = GenericServerFunctions> {\r\n /**\r\n * Allows messages to be sent to the server. Any property access is treated\r\n * like a message function whose property name is the message name.\r\n */\r\n server: TServer;\r\n\r\n /**\r\n * Gets the connection identifier for this topic. This will be the same for\r\n * all topics, but that should not be relied on staying that way in the future.\r\n */\r\n get connectionId(): string | null;\r\n\r\n /**\r\n * Gets a value that indicates if the topic is currently reconnecting.\r\n */\r\n get isReconnecting(): boolean;\r\n\r\n /**\r\n * Gets a value that indicates if the topic is disconnected and will no\r\n * longer try to connect to the server.\r\n */\r\n get isDisconnected(): boolean;\r\n\r\n /**\r\n * Registers a handler to be called when a message with the given name\r\n * is received.\r\n *\r\n * @param messageName The message name that will trigger the handler.\r\n * @param handler The handler to be called when a message is received.\r\n */\r\n on(messageName: string, handler: ((...args: any[]) => void)): void;\r\n\r\n /**\r\n * Registers a handler to be called when any message is received.\r\n *\r\n * @param handler The handler to be called when a message is received.\r\n */\r\n onMessage(handler: ((messageName: string, args: unknown[]) => void)): void;\r\n\r\n /**\r\n * Registers a callback to be called when the connection has been\r\n * temporarily lost. An automatic reconnection is in progress. The topic\r\n * is now in a state where it can not send any messages.\r\n *\r\n * @param callback The callback to be called.\r\n */\r\n onReconnecting(callback: (() => void)): void;\r\n\r\n /**\r\n * Registers a callback to be called when the connection has been\r\n * reconnected. The topic can now send messages again.\r\n *\r\n * @param callback The callback to be called.\r\n */\r\n onReconnected(callback: (() => void)): void;\r\n\r\n /**\r\n * Registers a callback to be called when the connection has been lost\r\n * and will no longer try to reconnect.\r\n *\r\n * @param callback The callback to be called.\r\n */\r\n onDisconnected(callback: (() => void)): void;\r\n}\r\n\r\ninterface IRockRealTimeStatic {\r\n getTopic>(identifier: string): Promise>;\r\n}\r\n\r\nlet libraryObject: IRockRealTimeStatic | null = null;\r\nlet libraryPromise: Promise | null = null;\r\n\r\n/**\r\n * Gets the real time object from window.Rock.RealTime. If it is not available\r\n * then an exception will be thrown.\r\n *\r\n * @returns An instance of IRockRealTimeStatic.\r\n */\r\nasync function getRealTimeObject(): Promise {\r\n if (libraryObject) {\r\n return libraryObject;\r\n }\r\n\r\n if (!libraryPromise) {\r\n libraryPromise = loadJavaScriptAsync(\"/Scripts/Rock/realtime.js\", () => !!window[\"Rock\"]?.[\"RealTime\"]);\r\n }\r\n\r\n if (!await libraryPromise) {\r\n throw new Error(\"Unable to load RealTime library.\");\r\n }\r\n\r\n libraryObject = window[\"Rock\"]?.[\"RealTime\"] as IRockRealTimeStatic;\r\n\r\n return libraryObject;\r\n}\r\n\r\n/**\r\n * Connects to a specific topic in the Rock RealTime system and returns an\r\n * instance to a proxy that handles sending to and receiving messages from\r\n * that specific topic.\r\n *\r\n * @param identifier The identifier of the topic to be connected to.\r\n *\r\n * @returns A proxy to handle communication with the topic.\r\n */\r\nexport async function getTopic>(identifier: string): Promise> {\r\n const realTime = await getRealTimeObject();\r\n\r\n return realTime.getTopic(identifier);\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { ListItemBag } from \"@Obsidian/ViewModels/Utility/listItemBag\";\r\nimport { toNumber, toNumberOrNull } from \"./numberUtils\";\r\nimport { SlidingDateRangeType as RangeType, SlidingDateRangeType } from \"@Obsidian/Enums/Controls/slidingDateRangeType\";\r\nimport { TimeUnitType as TimeUnit } from \"@Obsidian/Enums/Controls/timeUnitType\";\r\nimport { DayOfWeek, RockDateTime } from \"./rockDateTime\";\r\n\r\n// This file contains helper functions and tooling required to work with sliding\r\n// date ranges. A sliding date range is one that, generally, is anchored to whatever\r\n// the current date and time is when the check is made. For example, \"within the next\r\n// 5 days\" would be the english equivalent of a sliding date range.\r\n\r\n/**\r\n * The enums have been moved to separate files in order to share with the back end. We import them\r\n * above (with the names used by the definitions that used to exist in this file) so they can be\r\n * used below and we export them here so that any files previously importing them from here\r\n * do not break.\r\n */\r\nexport { SlidingDateRangeType as RangeType } from \"@Obsidian/Enums/Controls/slidingDateRangeType\";\r\nexport { TimeUnitType as TimeUnit } from \"@Obsidian/Enums/Controls/timeUnitType\";\r\n\r\n/**\r\n * Specifies the information required to track a sliding date range.\r\n */\r\nexport type SlidingDateRange = {\r\n /** The type of sliding date range represented by this instance. */\r\n rangeType: RangeType;\r\n\r\n /** The unit of time represented by the timeValue property. */\r\n timeUnit?: TimeUnit;\r\n\r\n /** The number of time units used when calculating the date range. */\r\n timeValue?: number;\r\n\r\n /** The lower value of a specific date range. */\r\n lowerDate?: string;\r\n\r\n /** The upper value of a specific date range. */\r\n upperDate?: string;\r\n};\r\n\r\n/**\r\n * The sliding date range types represented as an array of ListItemBag objects.\r\n * These are ordered correctly and can be used in pickers.\r\n */\r\nexport const rangeTypeOptions: ListItemBag[] = [\r\n {\r\n value: RangeType.Current.toString(),\r\n text: \"Current\"\r\n },\r\n {\r\n value: RangeType.Previous.toString(),\r\n text: \"Previous\"\r\n },\r\n {\r\n value: RangeType.Last.toString(),\r\n text: \"Last\"\r\n },\r\n {\r\n value: RangeType.Next.toString(),\r\n text: \"Next\"\r\n },\r\n {\r\n value: RangeType.Upcoming.toString(),\r\n text: \"Upcoming\"\r\n },\r\n {\r\n value: RangeType.DateRange.toString(),\r\n text: \"Date Range\"\r\n }\r\n];\r\n\r\n/**\r\n * The sliding date range time units represented as an array of ListItemBag objects.\r\n * These are ordered correctly and can be used in pickers.\r\n */\r\nexport const timeUnitOptions: ListItemBag[] = [\r\n {\r\n value: TimeUnit.Hour.toString(),\r\n text: \"Hour\"\r\n },\r\n {\r\n value: TimeUnit.Day.toString(),\r\n text: \"Day\"\r\n },\r\n {\r\n value: TimeUnit.Week.toString(),\r\n text: \"Week\"\r\n },\r\n {\r\n value: TimeUnit.Month.toString(),\r\n text: \"Month\"\r\n },\r\n {\r\n value: TimeUnit.Year.toString(),\r\n text: \"Year\"\r\n },\r\n];\r\n\r\n/**\r\n * Helper function to get the text from a ListItemBag that matches the value.\r\n *\r\n * @param value The value to be searched for.\r\n * @param options The ListItemBag options to be searched.\r\n *\r\n * @returns The text value of the ListItemBag or an empty string if not found.\r\n */\r\nfunction getTextForValue(value: string, options: ListItemBag[]): string {\r\n const matches = options.filter(v => v.value === value);\r\n\r\n return matches.length > 0 ? matches[0].text ?? \"\" : \"\";\r\n}\r\n\r\n/**\r\n * Gets the user friendly text that represents the RangeType value.\r\n *\r\n * @param rangeType The RangeType value to be represented.\r\n *\r\n * @returns A human readable string that represents the RangeType value.\r\n */\r\nexport function getRangeTypeText(rangeType: RangeType): string {\r\n const rangeTypes = rangeTypeOptions.filter(o => o.value === rangeType.toString());\r\n\r\n return rangeTypes.length > 0 ? rangeTypes[0].text ?? \"\" : \"\";\r\n}\r\n\r\n/**\r\n * Gets the user friendly text that represents the TimeUnit value.\r\n *\r\n * @param timeUnit The TimeUnit value to be represented.\r\n *\r\n * @returns A human readable string that represents the TimeUnit value.\r\n */\r\nexport function getTimeUnitText(timeUnit: TimeUnit): string {\r\n const timeUnits = timeUnitOptions.filter(o => o.value === timeUnit.toString());\r\n\r\n return timeUnits.length > 0 ? timeUnits[0].text ?? \"\" : \"\";\r\n}\r\n\r\n/**\r\n * Parses a pipe delimited string into a SlidingDateRange native object. The\r\n * delimited string is a format used by attribute values and other places.\r\n *\r\n * @param value The pipe delimited string that should be parsed.\r\n *\r\n * @returns A SlidingDaterange object or null if the string could not be parsed.\r\n */\r\nexport function parseSlidingDateRangeString(value: string): SlidingDateRange | null {\r\n const segments = value.split(\"|\");\r\n\r\n if (segments.length < 3) {\r\n return null;\r\n }\r\n\r\n // Find the matching range types and time units (should be 0 or 1) that\r\n // match the values in the string.\r\n const rangeTypes = rangeTypeOptions.filter(o => (o.text ?? \"\").replace(\" \", \"\").toLowerCase() === segments[0].toLowerCase() || o.value === segments[0]);\r\n const timeUnits = timeUnitOptions.filter(o => (o.text ?? \"\").toLowerCase() === segments[2].toLowerCase() || o.value === segments[2]);\r\n\r\n if (rangeTypes.length === 0) {\r\n return null;\r\n }\r\n\r\n const range: SlidingDateRange = {\r\n rangeType: toNumber(rangeTypes[0].value)\r\n };\r\n\r\n // If the range type is one that has time units then parse the time units.\r\n if (([RangeType.Current, RangeType.Last, RangeType.Next, RangeType.Previous, RangeType.Upcoming] as number[]).includes(range.rangeType)) {\r\n range.timeUnit = timeUnits.length > 0 ? toNumber(timeUnits[0].value) as TimeUnit : TimeUnit.Hour;\r\n\r\n // If the range type is one that has time values then parse the time value.\r\n if (([RangeType.Last, RangeType.Next, RangeType.Previous, RangeType.Upcoming] as number[]).includes(range.rangeType)) {\r\n range.timeValue = toNumberOrNull(segments[1]) ?? 1;\r\n }\r\n }\r\n\r\n // Parse the lower and upper dates if our range type is a DateRange.\r\n if (range.rangeType === RangeType.DateRange) {\r\n if (segments.length > 3) {\r\n range.lowerDate = segments[3];\r\n }\r\n\r\n if (segments.length > 4) {\r\n range.upperDate = segments[4];\r\n }\r\n }\r\n\r\n return range;\r\n}\r\n\r\n/**\r\n * Formats the pipe delimited string.\r\n *\r\n * @param value The pipe delimited string that should be formatted.\r\n *\r\n * @returns A string that formats the sliding date range.\r\n */\r\nexport function slidingDateRangeToString(value: SlidingDateRange): string {\r\n\r\n switch (value.rangeType) {\r\n case RangeType.Current:\r\n return `Current||${getTextForValue(value.timeUnit?.toString() ?? \"\", timeUnitOptions)}||`;\r\n\r\n case RangeType.DateRange:\r\n return `DateRange|||${value.lowerDate ?? \"\"}|${value.upperDate ?? \"\"}`;\r\n\r\n default:\r\n return `${getTextForValue(value.rangeType.toString(), rangeTypeOptions)}|${value.timeValue ?? \"\"}|${getTextForValue(value.timeUnit?.toString() ?? \"\", timeUnitOptions)}||`;\r\n }\r\n}\r\n\r\n/**\r\n * Calculates the start and end dates in a sliding date range.\r\n *\r\n * @param value The sliding date range to use when calculating dates.\r\n * @param currentDateTime The date and time to use in any \"now\" calculations.\r\n *\r\n * @returns An object that contains the start and end dates and times.\r\n */\r\nexport function calculateSlidingDateRange(value: SlidingDateRange, currentDateTime: RockDateTime | null | undefined = undefined): { start: RockDateTime | null, end: RockDateTime | null } {\r\n const result: { start: RockDateTime | null, end: RockDateTime | null } = {\r\n start: null,\r\n end: null\r\n };\r\n\r\n if (!currentDateTime) {\r\n currentDateTime = RockDateTime.now();\r\n }\r\n\r\n if (value.rangeType === RangeType.Current) {\r\n if (value.timeUnit === TimeUnit.Hour) {\r\n result.start = RockDateTime.fromParts(currentDateTime.year, currentDateTime.month, currentDateTime.day, currentDateTime.hour, 0, 0);\r\n result.end = result.start?.addHours(1) ?? null;\r\n }\r\n else if (value.timeUnit === TimeUnit.Day) {\r\n result.start = currentDateTime.date;\r\n result.end = result.start.addDays(1);\r\n }\r\n else if (value.timeUnit === TimeUnit.Week) {\r\n // TODO: This needs to be updated to get the FirstDayOfWeek from server.\r\n let diff = currentDateTime.dayOfWeek - DayOfWeek.Monday;\r\n\r\n if (diff < 0) {\r\n diff += 7;\r\n }\r\n\r\n result.start = currentDateTime.addDays(-1 * diff).date;\r\n result.end = result.start.addDays(7);\r\n }\r\n else if (value.timeUnit === TimeUnit.Month) {\r\n result.start = RockDateTime.fromParts(currentDateTime.year, currentDateTime.month, 1);\r\n result.end = result.start?.addMonths(1) ?? null;\r\n }\r\n else if (value.timeUnit === TimeUnit.Year) {\r\n result.start = RockDateTime.fromParts(currentDateTime.year, 1, 1);\r\n result.end = RockDateTime.fromParts(currentDateTime.year + 1, 1, 1);\r\n }\r\n }\r\n else if (value.rangeType === RangeType.Last || value.rangeType === RangeType.Previous) {\r\n // The number of time units to adjust by.\r\n const count = value.timeValue ?? 1;\r\n\r\n // If we are getting \"Last\" then round up to include the\r\n // current day/week/month/year.\r\n const roundUpCount = value.rangeType === RangeType.Last ? 1 : 0;\r\n\r\n if (value.timeUnit === TimeUnit.Hour) {\r\n result.end = RockDateTime.fromParts(currentDateTime.year, currentDateTime.month, currentDateTime.day, currentDateTime.hour, 0, 0)\r\n ?.addHours(roundUpCount) ?? null;\r\n result.start = result.end?.addHours(-count) ?? null;\r\n }\r\n else if (value.timeUnit === TimeUnit.Day) {\r\n result.end = currentDateTime.date.addDays(roundUpCount);\r\n result.start = result.end?.addDays(-count) ?? null;\r\n }\r\n else if (value.timeUnit === TimeUnit.Week) {\r\n // TODO: This needs to be updated to get the FirstDayOfWeek from server.\r\n let diff = currentDateTime.dayOfWeek - DayOfWeek.Monday;\r\n\r\n if (diff < 0) {\r\n diff += 7;\r\n }\r\n\r\n result.end = currentDateTime.addDays(-1 * diff).date.addDays(7 * roundUpCount);\r\n result.start = result.end.addDays(-count * 7);\r\n }\r\n else if (value.timeUnit === TimeUnit.Month) {\r\n result.end = RockDateTime.fromParts(currentDateTime.year, currentDateTime.month, 1)?.addMonths(roundUpCount) ?? null;\r\n result.start = result.end?.addMonths(-count) ?? null;\r\n }\r\n else if (value.timeUnit === TimeUnit.Year) {\r\n result.end = RockDateTime.fromParts(currentDateTime.year, 1, 1)?.addYears(roundUpCount) ?? null;\r\n result.start = result.end?.addYears(-count) ?? null;\r\n }\r\n\r\n // don't let Last,Previous have any future dates\r\n const cutoffDate = currentDateTime.date.addDays(1);\r\n if (result.end && result.end.date > cutoffDate) {\r\n result.end = cutoffDate;\r\n }\r\n }\r\n else if (value.rangeType === RangeType.Next || value.rangeType === RangeType.Upcoming) {\r\n // The number of time units to adjust by.\r\n const count = value.timeValue ?? 1;\r\n\r\n // If we are getting \"Upcoming\" then round up to include the\r\n // current day/week/month/year.\r\n const roundUpCount = value.rangeType === RangeType.Upcoming ? 1 : 0;\r\n\r\n if (value.timeUnit === TimeUnit.Hour) {\r\n result.start = RockDateTime.fromParts(currentDateTime.year, currentDateTime.month, currentDateTime.day, currentDateTime.hour, 0, 0)\r\n ?.addHours(roundUpCount) ?? null;\r\n result.end = result.start?.addHours(count) ?? null;\r\n }\r\n else if (value.timeUnit === TimeUnit.Day) {\r\n result.start = currentDateTime.date.addDays(roundUpCount);\r\n result.end = result.start.addDays(count);\r\n }\r\n else if (value.timeUnit === TimeUnit.Week) {\r\n // TODO: This needs to be updated to get the FirstDayOfWeek from server.\r\n let diff = currentDateTime.dayOfWeek - DayOfWeek.Monday;\r\n\r\n if (diff < 0) {\r\n diff += 7;\r\n }\r\n\r\n result.start = currentDateTime.addDays(-1 * diff)\r\n .date.addDays(7 * roundUpCount);\r\n result.end = result.start.addDays(count * 7);\r\n }\r\n else if (value.timeUnit === TimeUnit.Month) {\r\n result.start = RockDateTime.fromParts(currentDateTime.year, currentDateTime.month, 1)\r\n ?.addMonths(roundUpCount) ?? null;\r\n result.end = result.start?.addMonths(count) ?? null;\r\n }\r\n else if (value.timeUnit === TimeUnit.Year) {\r\n result.start = RockDateTime.fromParts(currentDateTime.year, 1, 1)\r\n ?.addYears(roundUpCount) ?? null;\r\n result.end = result.start?.addYears(count) ?? null;\r\n }\r\n\r\n // don't let Next,Upcoming have any past dates\r\n if (result.start && result.start.date < currentDateTime.date) {\r\n result.start = currentDateTime.date;\r\n }\r\n }\r\n else if (value.rangeType === RangeType.DateRange) {\r\n result.start = RockDateTime.parseISO(value.lowerDate ?? \"\");\r\n result.end = RockDateTime.parseISO(value.upperDate ?? \"\");\r\n\r\n // Sliding date range does not use ISO dates (though might be changed\r\n // in the future). So if we can't parse as an ISO date then try a\r\n // natural parse.\r\n if (!result.start && value.lowerDate) {\r\n result.start = RockDateTime.fromJSDate(new Date(value.lowerDate));\r\n }\r\n\r\n if (!result.end && value.upperDate) {\r\n result.end = RockDateTime.fromJSDate(new Date(value.upperDate));\r\n }\r\n\r\n if (result.end) {\r\n // Add a day to the end so that we get the entire day when comparing.\r\n result.end = result.end.addDays(1);\r\n }\r\n }\r\n\r\n // To avoid confusion about the day or hour of the end of the date range,\r\n // subtract a millisecond off our 'less than' end date. For example, if our\r\n // end date is 2019-11-7, we actually want all the data less than 2019-11-8,\r\n // but if a developer does EndDate.DayOfWeek, they would want 2019-11-7 and\r\n // not 2019-11-8 So, to make sure we include all the data for 2019-11-7, but\r\n // avoid the confusion about what DayOfWeek of the end, we'll compromise by\r\n // subtracting a millisecond from the end date\r\n if (result.end && value.timeUnit != TimeUnit.Hour) {\r\n result.end = result.end.addMilliseconds(-1);\r\n }\r\n\r\n return result;\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n\r\nimport { useHttp } from \"./http\";\r\nimport { StructuredContentEditorConfigurationBag } from \"@Obsidian/ViewModels/Rest/Controls/structuredContentEditorConfigurationBag\";\r\nimport { StructuredContentEditorGetConfigurationOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/structuredContentEditorGetConfigurationOptionsBag\";\r\n\r\nconst http = useHttp();\r\n\r\n/** Fetches the configuration for the structured content editor. */\r\nexport async function getStructuredContentEditorConfiguration(options: StructuredContentEditorGetConfigurationOptionsBag): Promise {\r\n const result = await http.post(\"/api/v2/Controls/StructuredContentEditorGetConfiguration\", undefined, options);\r\n\r\n if (result.isSuccess && result.data) {\r\n return result.data;\r\n }\r\n\r\n throw new Error(result.errorMessage || \"Error fetching structured content editor configuration\");\r\n}\r\n\r\nexport default {\r\n getStructuredContentEditorConfiguration\r\n};","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\n\r\n// NOTE: Do not make this public yet. This is essentially temporary and\r\n// will likely move to a different place and be merged with the popover\r\n// concept code as well.\r\ntype TooltipOptions = {\r\n /** Allow HTML content in the tooltip. */\r\n html?: boolean;\r\n\r\n /** Enables santization of HTML content. */\r\n sanitize?: boolean;\r\n};\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\r\ndeclare const $: any;\r\n\r\n/**\r\n * Configure a tooltip for the specified node or nodes to show on hover. This\r\n * currently uses Bootstrap tooltips but may be changed to use a different\r\n * method later.\r\n * \r\n * @param node The node or nodes to have tooltips configured on.\r\n * @param options The options that describe how the tooltips should behave.\r\n */\r\nexport function tooltip(node: Element | Element[], options?: TooltipOptions): void {\r\n // If we got an array of elements then activate each one.\r\n if (Array.isArray(node)) {\r\n for (const n of node) {\r\n tooltip(n, options);\r\n }\r\n\r\n return;\r\n }\r\n\r\n $(node).tooltip({\r\n html: options?.html,\r\n sanitize: options?.sanitize ?? true\r\n });\r\n}\r\n\r\n/**\r\n * Manually show a previously-configured tooltip for the specified node.\r\n *\r\n * @param node The node for which to show a tooltip\r\n */\r\nexport function showTooltip(node: Element): void {\r\n $(node).tooltip(\"show\");\r\n}\r\n","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { Guid } from \"@Obsidian/Types\";\r\nimport { emptyGuid } from \"./guid\";\r\nimport { post } from \"./http\";\r\nimport { TreeItemBag } from \"@Obsidian/ViewModels/Utility/treeItemBag\";\r\nimport { CategoryPickerChildTreeItemsOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/categoryPickerChildTreeItemsOptionsBag\";\r\nimport { LocationItemPickerGetActiveChildrenOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/locationItemPickerGetActiveChildrenOptionsBag\";\r\nimport { DataViewPickerGetDataViewsOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/dataViewPickerGetDataViewsOptionsBag\";\r\nimport { WorkflowTypePickerGetWorkflowTypesOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/workflowTypePickerGetWorkflowTypesOptionsBag\";\r\nimport { PagePickerGetChildrenOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/pagePickerGetChildrenOptionsBag\";\r\nimport { PagePickerGetSelectedPageHierarchyOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/pagePickerGetSelectedPageHierarchyOptionsBag\";\r\nimport { ConnectionRequestPickerGetChildrenOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/connectionRequestPickerGetChildrenOptionsBag\";\r\nimport { GroupPickerGetChildrenOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/groupPickerGetChildrenOptionsBag\";\r\nimport { MergeTemplatePickerGetMergeTemplatesOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/mergeTemplatePickerGetMergeTemplatesOptionsBag\";\r\nimport { MergeTemplateOwnership } from \"@Obsidian/Enums/Controls/mergeTemplateOwnership\";\r\nimport { MetricCategoryPickerGetChildrenOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/metricCategoryPickerGetChildrenOptionsBag\";\r\nimport { MetricItemPickerGetChildrenOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/metricItemPickerGetChildrenOptionsBag\";\r\nimport { RegistrationTemplatePickerGetChildrenOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/registrationTemplatePickerGetChildrenOptionsBag\";\r\nimport { ReportPickerGetChildrenOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/reportPickerGetChildrenOptionsBag\";\r\nimport { SchedulePickerGetChildrenOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/schedulePickerGetChildrenOptionsBag\";\r\nimport { WorkflowActionTypePickerGetChildrenOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/workflowActionTypePickerGetChildrenOptionsBag\";\r\nimport { MergeFieldPickerGetChildrenOptionsBag } from \"@Obsidian/ViewModels/Rest/Controls/mergeFieldPickerGetChildrenOptionsBag\";\r\nimport { flatten } from \"./arrayUtils\";\r\nimport { toNumberOrNull } from \"./numberUtils\";\r\n\r\n/**\r\n * The methods that must be implemented by tree item providers. These methods\r\n * provide the TreeItem objects to be displayed when lazy loading is being used.\r\n */\r\nexport interface ITreeItemProvider {\r\n /**\r\n * Get the root items to be displayed in the tree list.\r\n *\r\n * @param expandToValues The values that should be auto-expanded to. This will contain\r\n * the nodes that should be visible when the data is returned, they should not be\r\n * expanded themselves, only any ancestor nodes.\r\n *\r\n * @returns A collection of TreeItem objects, optionally wrapped in a Promise\r\n * if the loading is being performed asynchronously.\r\n */\r\n getRootItems(expandToValues: string[]): Promise | TreeItemBag[];\r\n\r\n /**\r\n * Get the child items of the given tree item.\r\n *\r\n * @param item The parent item whose children should be loaded.\r\n *\r\n * @returns A collection of TreeItem objects, optionally wrapped in a Promise\r\n * if the loading is being performed asynchronously.\r\n */\r\n getChildItems(item: TreeItemBag): Promise | TreeItemBag[];\r\n\r\n /**\r\n * Checks if the item can be selected by the individual. This function\r\n * is optional.\r\n *\r\n * @param item The item that is about to be selected.\r\n * @param isSelectable True if the tree view considers the item selectable.\r\n *\r\n * @returns A boolean that determines the final selectable state of the item.\r\n */\r\n canSelectItem?(item: TreeItemBag, isSelectable: boolean): boolean;\r\n}\r\n\r\n/**\r\n * Tree Item Provider for retrieving categories from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class CategoryTreeItemProvider implements ITreeItemProvider {\r\n /**\r\n * The root category to start pulling categories from. Set to undefined to\r\n * begin with any category that does not have a parent.\r\n */\r\n public rootCategoryGuid?: Guid;\r\n\r\n /**\r\n * The entity type unique identifier to restrict results to. Set to undefined\r\n * to include all categories, regardless of entity type.\r\n */\r\n public entityTypeGuid?: Guid;\r\n\r\n /**\r\n * The value that must match in the category EntityTypeQualifierColumn\r\n * property. Set to undefined or an empty string to ignore.\r\n */\r\n public entityTypeQualifierColumn?: string;\r\n\r\n /**\r\n * The value that must match in the category EntityTypeQualifierValue\r\n * property.\r\n */\r\n public entityTypeQualifierValue?: string;\r\n\r\n /**\r\n * The security grant token that will be used to request additional access\r\n * to the category list.\r\n */\r\n public securityGrantToken?: string | null;\r\n\r\n /**\r\n * Gets the child items from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentGuid?: Guid | null): Promise {\r\n const options: Partial = {\r\n parentGuid: parentGuid,\r\n entityTypeGuid: this.entityTypeGuid,\r\n entityTypeQualifierColumn: this.entityTypeQualifierColumn,\r\n entityTypeQualifierValue: this.entityTypeQualifierValue,\r\n lazyLoad: false,\r\n securityGrantToken: this.securityGrantToken\r\n };\r\n\r\n const response = await post(\"/api/v2/Controls/CategoryPickerChildTreeItems\", {}, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems(this.rootCategoryGuid);\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n/**\r\n * Tree Item Provider for retrieving locations from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class LocationTreeItemProvider implements ITreeItemProvider {\r\n /**\r\n * The security grant token that will be used to request additional access\r\n * to the category list.\r\n */\r\n public securityGrantToken?: string | null;\r\n\r\n /**\r\n * Gets the child items from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentGuid?: Guid | null): Promise {\r\n const options: Partial = {\r\n guid: parentGuid ?? emptyGuid,\r\n rootLocationGuid: emptyGuid,\r\n securityGrantToken: this.securityGrantToken\r\n };\r\n const url = \"/api/v2/Controls/LocationItemPickerGetActiveChildren\";\r\n const response = await post(url, undefined, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems(null);\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n/**\r\n * Tree Item Provider for retrieving data views from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class DataViewTreeItemProvider implements ITreeItemProvider {\r\n /**\r\n * The entity type unique identifier to restrict results to. Set to undefined\r\n * to include all categories, regardless of entity type.\r\n */\r\n public entityTypeGuid?: Guid;\r\n\r\n /**\r\n * The security grant token that will be used to request additional access\r\n * to the category list.\r\n */\r\n public securityGrantToken?: string | null;\r\n\r\n /**\r\n * The flag sets whether only persisted data view should be shown by the picker\r\n */\r\n public displayPersistedOnly: boolean = false;\r\n\r\n /**\r\n * Gets the child items from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentGuid?: Guid | null): Promise {\r\n const options: Partial = {\r\n parentGuid,\r\n getCategorizedItems: true,\r\n includeCategoriesWithoutChildren: false,\r\n entityTypeGuidFilter: this.entityTypeGuid,\r\n lazyLoad: false,\r\n securityGrantToken: this.securityGrantToken,\r\n displayPersistedOnly: this.displayPersistedOnly\r\n };\r\n\r\n const response = await post(\"/api/v2/Controls/DataViewPickerGetDataViews\", {}, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems();\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n/**\r\n * Tree Item Provider for retrieving categories from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class WorkflowTypeTreeItemProvider implements ITreeItemProvider {\r\n /**\r\n * The entity type unique identifier to restrict results to. Set to undefined\r\n * to include all categories, regardless of entity type.\r\n */\r\n public includeInactiveItems?: boolean;\r\n\r\n /**\r\n * The security grant token that will be used to request additional access\r\n * to the category list.\r\n */\r\n public securityGrantToken?: string | null;\r\n\r\n /**\r\n * Gets the child items from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentGuid?: Guid | null): Promise {\r\n const options: Partial = {\r\n parentGuid,\r\n includeInactiveItems: this.includeInactiveItems ?? false,\r\n securityGrantToken: this.securityGrantToken,\r\n };\r\n\r\n const response = await post(\"/api/v2/Controls/WorkflowTypePickerGetWorkflowTypes\", {}, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems();\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n\r\n/**\r\n * Tree Item Provider for retrieving pages from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class PageTreeItemProvider implements ITreeItemProvider {\r\n /**\r\n * The security grant token that will be used to request additional access\r\n * to the category list.\r\n */\r\n public securityGrantToken?: string | null;\r\n\r\n /**\r\n * List of GUIDs or pages to exclude from the list.\r\n */\r\n public hidePageGuids?: Guid[] | null;\r\n\r\n /**\r\n * Currently selected page\r\n */\r\n public selectedPageGuids?: Guid[] | null;\r\n\r\n /**\r\n * Gets the child items of the given parent (or root if no parent given) from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentGuid?: Guid | null): Promise {\r\n let result: TreeItemBag[];\r\n\r\n const options: Partial = {\r\n guid: parentGuid ?? emptyGuid,\r\n rootPageGuid: null,\r\n hidePageGuids: this.hidePageGuids ?? [],\r\n securityGrantToken: this.securityGrantToken\r\n };\r\n const url = \"/api/v2/Controls/PagePickerGetChildren\";\r\n const response = await post(url, undefined, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n result = response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n\r\n // If we're getting child nodes or if there is no selected page\r\n if (parentGuid || !this.selectedPageGuids) {\r\n return result;\r\n }\r\n\r\n // If we're getting the root elements and we have a selected page, we also want to grab\r\n // all the parent pages so we can pre-load the entire hierarchy to the selected page\r\n return this.getHierarchyToSelectedPage(result);\r\n }\r\n\r\n /**\r\n * Get the hierarchical list of parent pages of the selectedPageGuid\r\n *\r\n * @returns A list of GUIDs of the parent pages\r\n */\r\n private async getParentList(): Promise {\r\n const options: PagePickerGetSelectedPageHierarchyOptionsBag = {\r\n selectedPageGuids: this.selectedPageGuids,\r\n securityGrantToken: this.securityGrantToken\r\n };\r\n const url = \"/api/v2/Controls/PagePickerGetSelectedPageHierarchy\";\r\n const response = await post(url, undefined, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * Fill in pages to the depth of the selected page\r\n *\r\n * @param rootLayer The bottom layer of pages that we'll build depth upon\r\n *\r\n * @return The augmented `rootLayer` with the child pages\r\n */\r\n private async getHierarchyToSelectedPage(rootLayer: TreeItemBag[]): Promise {\r\n const parents = await this.getParentList();\r\n\r\n if (!parents || parents.length == 0) {\r\n // Selected page has no parents, so we're done.\r\n return rootLayer;\r\n }\r\n\r\n const childLists = await Promise.all(parents.map(guid => this.getItems(guid)));\r\n const allPages = rootLayer.concat(flatten(childLists));\r\n\r\n parents.forEach((parentGuid, i) => {\r\n const parentPage: TreeItemBag | undefined = allPages.find(page => page.value == parentGuid);\r\n if (parentPage) {\r\n parentPage.children = childLists[i];\r\n }\r\n });\r\n\r\n return rootLayer;\r\n }\r\n\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems(null);\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n\r\n/**\r\n * Tree Item Provider for retrieving connection requests from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class ConnectionRequestTreeItemProvider implements ITreeItemProvider {\r\n /**\r\n * The security grant token that will be used to request additional access\r\n * to the category list.\r\n */\r\n public securityGrantToken?: string | null;\r\n\r\n /**\r\n * Gets the child items from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentGuid?: Guid | null): Promise {\r\n const options: Partial = {\r\n parentGuid,\r\n securityGrantToken: this.securityGrantToken\r\n };\r\n const url = \"/api/v2/Controls/ConnectionRequestPickerGetChildren\";\r\n const response = await post(url, undefined, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems(null);\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n\r\n/**\r\n * Tree Item Provider for retrieving groups from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class GroupTreeItemProvider implements ITreeItemProvider {\r\n /** The security grant token that will be used to request additional access to the group list. */\r\n public securityGrantToken: string | null = null;\r\n\r\n /** GUID of the group you want to use as the root. */\r\n public rootGroupGuid: Guid | null = null;\r\n\r\n /** List of group types GUIDs to limit to groups of those types. */\r\n public includedGroupTypeGuids: Guid[] = [];\r\n\r\n /** Whether to include inactive groups or not. */\r\n public includeInactiveGroups: boolean = false;\r\n\r\n /** Whether to limit to only groups that have scheduling enabled. */\r\n public limitToSchedulingEnabled: boolean = false;\r\n\r\n /** Whether to limit to only groups that have RSVPs enabled. */\r\n public limitToRSVPEnabled: boolean = false;\r\n\r\n /**\r\n * Gets the child items from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentGuid: Guid | null = null): Promise {\r\n const options: Partial = {\r\n guid: parentGuid,\r\n rootGroupGuid: this.rootGroupGuid,\r\n includedGroupTypeGuids: this.includedGroupTypeGuids,\r\n includeInactiveGroups: this.includeInactiveGroups,\r\n limitToSchedulingEnabled: this.limitToSchedulingEnabled,\r\n limitToRSVPEnabled: this.limitToRSVPEnabled,\r\n securityGrantToken: this.securityGrantToken\r\n };\r\n const url = \"/api/v2/Controls/GroupPickerGetChildren\";\r\n const response = await post(url, undefined, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems(null);\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n\r\n/**\r\n * Tree Item Provider for retrieving merge templates from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class MergeTemplateTreeItemProvider implements ITreeItemProvider {\r\n /** The security grant token that will be used to request additional access to the group list. */\r\n public securityGrantToken: string | null = null;\r\n\r\n /** Filter for which merge templates to include in results: Global, Public, or Both */\r\n public mergeTemplateOwnership: MergeTemplateOwnership = MergeTemplateOwnership.Global;\r\n\r\n /**\r\n * Gets the child items from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentGuid: Guid | null = null): Promise {\r\n const options: Partial = {\r\n parentGuid,\r\n mergeTemplateOwnership: this.mergeTemplateOwnership,\r\n securityGrantToken: this.securityGrantToken\r\n };\r\n const url = \"/api/v2/Controls/MergeTemplatePickerGetMergeTemplates\";\r\n const response = await post(url, undefined, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems(null);\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n\r\n/**\r\n * Tree Item Provider for retrieving merge templates from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class MetricCategoryTreeItemProvider implements ITreeItemProvider {\r\n /** The security grant token that will be used to request additional access to the group list. */\r\n public securityGrantToken: string | null = null;\r\n\r\n /**\r\n * Gets the child items from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentGuid: Guid | null = null): Promise {\r\n const options: Partial = {\r\n parentGuid,\r\n securityGrantToken: this.securityGrantToken\r\n };\r\n const url = \"/api/v2/Controls/MetricCategoryPickerGetChildren\";\r\n const response = await post(url, undefined, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems(null);\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n/**\r\n * Tree Item Provider for retrieving merge templates from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class MetricItemTreeItemProvider implements ITreeItemProvider {\r\n /** The security grant token that will be used to request additional access to the group list. */\r\n public securityGrantToken: string | null = null;\r\n\r\n /** A list of category GUIDs to filter the results */\r\n public includeCategoryGuids: Guid[] | null = null;\r\n\r\n /**\r\n * Gets the child items from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentGuid: Guid | null = null): Promise {\r\n const options: Partial = {\r\n parentGuid,\r\n includeCategoryGuids: this.includeCategoryGuids,\r\n securityGrantToken: this.securityGrantToken\r\n };\r\n const url = \"/api/v2/Controls/MetricItemPickerGetChildren\";\r\n const response = await post(url, undefined, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems(null);\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n\r\n/**\r\n * Tree Item Provider for retrieving registration templates from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class RegistrationTemplateTreeItemProvider implements ITreeItemProvider {\r\n /** The security grant token that will be used to request additional access to the group list. */\r\n public securityGrantToken: string | null = null;\r\n\r\n /**\r\n * Gets the child items from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentGuid: Guid | null = null): Promise {\r\n const options: Partial = {\r\n parentGuid,\r\n securityGrantToken: this.securityGrantToken\r\n };\r\n const url = \"/api/v2/Controls/RegistrationTemplatePickerGetChildren\";\r\n const response = await post(url, undefined, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems(null);\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n\r\n/**\r\n * Tree Item Provider for retrieving reports from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class ReportTreeItemProvider implements ITreeItemProvider {\r\n /** The security grant token that will be used to request additional access to the group list. */\r\n public securityGrantToken: string | null = null;\r\n\r\n /** A list of category GUIDs to filter the results. */\r\n public includeCategoryGuids: Guid[] | null = null;\r\n\r\n /** Guid of an Entity Type to filter results by the reports that relate to this entity type. */\r\n public entityTypeGuid: Guid | null = null;\r\n\r\n /**\r\n * Gets the child items from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentGuid: Guid | null = null): Promise {\r\n const options: Partial = {\r\n parentGuid,\r\n includeCategoryGuids: this.includeCategoryGuids,\r\n entityTypeGuid: this.entityTypeGuid,\r\n securityGrantToken: this.securityGrantToken\r\n };\r\n const url = \"/api/v2/Controls/ReportPickerGetChildren\";\r\n const response = await post(url, undefined, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems(null);\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n\r\n/**\r\n * Tree Item Provider for retrieving reports from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class ScheduleTreeItemProvider implements ITreeItemProvider {\r\n /** The security grant token that will be used to request additional access to the group list. */\r\n public securityGrantToken: string | null = null;\r\n\r\n /** Whether to include inactive schedules in the results. */\r\n public includeInactive: boolean = false;\r\n\r\n /**\r\n * Gets the child items from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentGuid: Guid | null = null): Promise {\r\n const options: Partial = {\r\n parentGuid,\r\n includeInactiveItems: this.includeInactive,\r\n securityGrantToken: this.securityGrantToken\r\n };\r\n const url = \"/api/v2/Controls/SchedulePickerGetChildren\";\r\n const response = await post(url, undefined, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems(null);\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n\r\n/**\r\n * Tree Item Provider for retrieving reports from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class WorkflowActionTypeTreeItemProvider implements ITreeItemProvider {\r\n /** The security grant token that will be used to request additional access to the group list. */\r\n public securityGrantToken: string | null = null;\r\n\r\n /** Whether to include inactive schedules in the results. */\r\n public includeInactive: boolean = false;\r\n\r\n /**\r\n * Gets the child items from the server.\r\n *\r\n * @param parentGuid The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentId: string | null = null): Promise {\r\n const options: Partial = {\r\n parentId: toNumberOrNull(parentId) ?? 0,\r\n securityGrantToken: this.securityGrantToken\r\n };\r\n const url = \"/api/v2/Controls/WorkflowActionTypePickerGetChildren\";\r\n const response = await post(url, undefined, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n return response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems(null);\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}\r\n\r\n/**\r\n * Tree Item Provider for retrieving merge fields from the server and displaying\r\n * them inside a tree list.\r\n */\r\nexport class MergeFieldTreeItemProvider implements ITreeItemProvider {\r\n /**\r\n * The security grant token that will be used to request additional access\r\n * to the category list.\r\n */\r\n public securityGrantToken?: string | null;\r\n\r\n /**\r\n * Currently selected page\r\n */\r\n public selectedIds?: string[] | string | null;\r\n\r\n /**\r\n * Root Level Merge Fields\r\n */\r\n public additionalFields: string = \"\";\r\n\r\n /**\r\n * Gets the child items of the given parent (or root if no parent given) from the server.\r\n *\r\n * @param parentId The parent item whose children are retrieved.\r\n *\r\n * @returns A collection of TreeItem objects as an asynchronous operation.\r\n */\r\n private async getItems(parentId?: string | null): Promise {\r\n let result: TreeItemBag[];\r\n\r\n const options: Partial = {\r\n id: parentId || \"0\",\r\n additionalFields: this.additionalFields\r\n };\r\n const url = \"/api/v2/Controls/MergeFieldPickerGetChildren\";\r\n const response = await post(url, undefined, options);\r\n\r\n if (response.isSuccess && response.data) {\r\n result = response.data;\r\n }\r\n else {\r\n console.log(\"Error\", response.errorMessage);\r\n return [];\r\n }\r\n\r\n // If we're getting child nodes or if there is no selected page\r\n if (parentId || !this.selectedIds || this.selectedIds.length == 0) {\r\n return result;\r\n }\r\n\r\n // If we're getting the root elements and we have a selected page, we also want to grab\r\n // all the parent pages so we can pre-load the entire hierarchy to the selected page\r\n return this.getHierarchyToSelectedMergeField(result);\r\n }\r\n\r\n /**\r\n * Fill in pages to the depth of the selected page\r\n *\r\n * @param rootLayer The bottom layer of pages that we'll build depth upon\r\n *\r\n * @return The augmented `rootLayer` with the child pages\r\n */\r\n private async getHierarchyToSelectedMergeField(rootLayer: TreeItemBag[]): Promise {\r\n const parents = this.getParentList();\r\n\r\n if (!parents || parents.length == 0) {\r\n // Selected page has no parents, so we're done.\r\n return rootLayer;\r\n }\r\n\r\n const childLists = await Promise.all(parents.map(id => this.getItems(id)));\r\n const allMergeFields = rootLayer.concat(flatten(childLists));\r\n\r\n parents.forEach((parentGuid, i) => {\r\n const parentMergeField: TreeItemBag | undefined = allMergeFields.find(page => page.value == parentGuid);\r\n if (parentMergeField) {\r\n parentMergeField.children = childLists[i];\r\n }\r\n });\r\n\r\n return rootLayer;\r\n }\r\n\r\n /**\r\n * Get the hierarchical list of parent merge fields of the selected merge fields\r\n *\r\n * @returns A list of IDs of the parent merge fields\r\n */\r\n private getParentList(): string[] | null {\r\n if (!this.selectedIds || this.selectedIds.length == 0) {\r\n return null;\r\n }\r\n\r\n // If it's a single selection, grab the parents by splitting on \"|\",\r\n // e.g. \"Grand|Parent|Child\" will give [\"Grand\", \"Parent\"] as the parents\r\n if (typeof this.selectedIds == \"string\") {\r\n return this.splitSelectionIntoParents(this.selectedIds);\r\n }\r\n\r\n // Not null/empty nor a single selection, so must be an array of selections\r\n return flatten(this.selectedIds.map(sel => this.splitSelectionIntoParents(sel)));\r\n }\r\n\r\n /**\r\n * Split the given selected ID up and get a list of the parent IDs\r\n *\r\n * @param selection a string denoted one of the selected values\r\n */\r\n private splitSelectionIntoParents(selection: string): string[] {\r\n const parentIds: string[] = [];\r\n\r\n // grab the parents by splitting on \"|\",\r\n // e.g. \"Grand|Parent|Child\" will give [\"Grand\", \"Parent\"] as the parents\r\n const splitList = selection.split(\"|\");\r\n splitList.pop();\r\n\r\n // Now we need to make sure each item further in the list contains it's parents' names\r\n // e.g. [\"Grand\", \"Parent\"] => [\"Grand\", \"Grand|Parent\"]\r\n while (splitList.length >= 1) {\r\n parentIds.unshift(splitList.join(\"|\"));\r\n splitList.pop();\r\n }\r\n\r\n return parentIds;\r\n }\r\n\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getRootItems(): Promise {\r\n return await this.getItems();\r\n }\r\n\r\n /**\r\n * @inheritdoc\r\n */\r\n async getChildItems(item: TreeItemBag): Promise {\r\n return this.getItems(item.value);\r\n }\r\n}","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n//\r\n\r\nimport { Ref, watch } from \"vue\";\r\n\r\n/**\r\n * Is the value a valid URL?\r\n * @param val\r\n */\r\nexport function isUrl(val: unknown): boolean {\r\n if (typeof val === \"string\") {\r\n // https://www.regextester.com/1965\r\n // Modified from link above to support urls like \"http://localhost:6229/Person/1/Edit\" (Url does not have a period)\r\n const re = /^(http[s]?:\\/\\/)?[^\\s([\"<,>]*\\.?[^\\s[\",><]*$/;\r\n return re.test(val);\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Make the URL safe to use for redirects. Basically, this strips off any\r\n * protocol and hostname from the URL and ensures it's not a javascript:\r\n * url or anything like that.\r\n *\r\n * @param url The URL to be made safe to use with a redirect.\r\n *\r\n * @returns A string that is safe to assign to window.location.href.\r\n */\r\nexport function makeUrlRedirectSafe(url: string): string {\r\n try {\r\n // If this can't be parsed as a url, such as \"/page/123\" it will throw\r\n // an error which will be handled by the next section.\r\n const u = new URL(url);\r\n\r\n // If the protocol isn't an HTTP or HTTPS, then it is most likely\r\n // a dangerous URL.\r\n if (u.protocol !== \"http:\" && u.protocol !== \"https:\") {\r\n return \"/\";\r\n }\r\n\r\n // Try again incase they did something like \"http:javascript:alert('hi')\".\r\n return makeUrlRedirectSafe(`${u.pathname}${u.search}`);\r\n }\r\n catch {\r\n // If the URL contains a : but could not be parsed as a URL then it\r\n // is not valid, so return \"/\" so they get redirected to home page.\r\n if (url.indexOf(\":\") !== -1) {\r\n return \"/\";\r\n }\r\n\r\n // Otherwise consider it safe to use.\r\n return url;\r\n }\r\n}\r\n\r\n/**\r\n * Keep a list of named Refs synchronized with URL query parameters in the address of the same names.\r\n * If there are already query parameters in the URL with those names, the Refs will be assigned those\r\n * values. This will also watch those Refs for changes and update the query parameters to reflect\r\n * those changes.\r\n *\r\n * @param refs An object where the keys represent the query parameters keys to keep synchronized with\r\n * and the values are the Refs those query parameters are synched with.\r\n */\r\nexport function syncRefsWithQueryParams(refs: Record): void {\r\n // Get current query parameters\r\n const params = new URLSearchParams(window.location.search);\r\n\r\n Object.entries(refs).forEach(([key, ref]: [string, Ref]) => {\r\n let param = null;\r\n\r\n // try to get the decoded parameter value\r\n try {\r\n param = JSON.parse(decodeURI(params.get(key) ?? \"\"));\r\n }\r\n catch (e) { /* just leave the param as null */ }\r\n\r\n // If we found a value, set the Ref to it\r\n if (param != null) {\r\n ref.value = param;\r\n }\r\n\r\n // keep URL params up-to-date with changes to this Ref\r\n watch(ref, updater(key));\r\n });\r\n\r\n //\r\n function updater(key) {\r\n return (value) => {\r\n params.set(key, encodeURI(JSON.stringify(value)));\r\n\r\n history.replaceState(null, \"\", \"?\" + params.toString());\r\n };\r\n }\r\n}\r\n\r\n/**\r\n * Removes query parameters from the current URL and replaces the state in history.\r\n *\r\n * @param queryParamKeys The string array of query parameter keys to remove from the current URL.\r\n */\r\nexport function removeCurrentUrlQueryParams(...queryParamKeys: string[]): (string | null)[] {\r\n return removeUrlQueryParams(window.location.href, ...queryParamKeys);\r\n}\r\n\r\n/**\r\n * Removes query parameters from the current URL and replaces the state in history.\r\n *\r\n * @param url The URL from which to remove the query parameters.\r\n * @param queryParamKeys The string array of query parameter keys to remove from the current URL.\r\n */\r\nexport function removeUrlQueryParams(url: string | URL, ...queryParamKeys: string[]): (string | null)[] {\r\n if (!queryParamKeys || !queryParamKeys.length) {\r\n return [];\r\n }\r\n\r\n if (typeof url === \"string\") {\r\n url = new URL(url);\r\n }\r\n\r\n const queryParams = url.searchParams;\r\n\r\n const removedQueryParams: (string | null)[] = [];\r\n\r\n for (let i = 0; i < queryParamKeys.length; i++) {\r\n const queryParamKey = queryParamKeys[i];\r\n removedQueryParams.push(queryParams.get(queryParamKey));\r\n queryParams.delete(queryParamKey);\r\n }\r\n\r\n window.history.replaceState(null, \"\", url);\r\n\r\n return removedQueryParams;\r\n}","// \r\n// Copyright by the Spark Development Network\r\n//\r\n// Licensed under the Rock Community License (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.rockrms.com/license\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n// \r\n\r\nimport type { RulesPropType, ValidationResult, ValidationRule, ValidationRuleFunction, ValidationRuleReference } from \"@Obsidian/Types/validationRules\";\r\nimport type { PropType } from \"vue\";\r\n\r\n/** The currently defined rules by name. */\r\nconst definedRules: Record = {};\r\n\r\n/** Defines the property type for a component's rules. */\r\nexport const rulesPropType: RulesPropType = {\r\n type: [Array, Object, String] as PropType,\r\n default: \"\"\r\n};\r\n\r\n/**\r\n * Parse a string into a valid rule reference. Basically this does the heavy\r\n * lifting to take a string and spit out the rule name and parameters. This\r\n * assumes the rule has already been normalized and does not contain multiple\r\n * rules separated by a | character.\r\n *\r\n * @param rule The rule to be parsed.\r\n *\r\n * @returns The rule reference that contains the name and parameters.\r\n */\r\nexport function parseRule(rule: string): ValidationRuleReference {\r\n let name = \"\";\r\n let params: unknown[] = [];\r\n\r\n const colonIndex = rule.indexOf(\":\");\r\n if (colonIndex === -1) {\r\n name = rule;\r\n }\r\n else {\r\n name = rule.substring(0, colonIndex);\r\n params = rule.substring(colonIndex + 1).split(\",\");\r\n }\r\n\r\n return {\r\n name,\r\n params\r\n };\r\n}\r\n\r\n/**\r\n * Normalize a single rule or array of rules into a flat array of rules. This\r\n * handles strings that contain multiple rules and splits them out into individual\r\n * rule strings.\r\n *\r\n * @param rules The rules to be normalized.\r\n *\r\n * @returns A flattened array that contains all the individual rules.\r\n */\r\nexport function normalizeRules(rules: ValidationRule | ValidationRule[]): ValidationRule[] {\r\n if (typeof rules === \"string\") {\r\n if (rules.indexOf(\"|\") !== -1) {\r\n return rules.split(\"|\").filter(r => r.trim() !== \"\");\r\n }\r\n else if (rules.trim() !== \"\") {\r\n return [rules.trim()];\r\n }\r\n }\r\n else if (Array.isArray(rules)) {\r\n // Normalize the rule, since it may contain a string like \"required|notzero\"\r\n // which needs to be further normalized.\r\n const normalizedRules: ValidationRule[] = [];\r\n\r\n for (const r of rules) {\r\n normalizedRules.push(...normalizeRules(r));\r\n }\r\n\r\n return normalizedRules;\r\n }\r\n else if (typeof rules === \"function\") {\r\n return [rules];\r\n }\r\n else if (typeof rules === \"object\") {\r\n return [rules];\r\n }\r\n\r\n return [];\r\n}\r\n\r\n/**\r\n * Checks if any of the specified rules indicates a rule that requires the value\r\n * to be filled in.\r\n *\r\n * @param rules The rules to be checked.\r\n *\r\n * @returns True if any of the rules is considered a required rule; otherwise false.\r\n */\r\nexport function containsRequiredRule(rules: ValidationRule | ValidationRule[]): boolean {\r\n return normalizeRules(rules).some(r => r === \"required\");\r\n}\r\n\r\n/**\r\n * Normalizes rules to callable functions. This is used to translate string\r\n * and reference rules to their final function that will be called.\r\n *\r\n * @param rules The rules to be normalized to functions.\r\n *\r\n * @returns An array of rule functions that will perform validation checks.\r\n */\r\nfunction normalizeRulesToFunctions(rules: ValidationRule[]): ValidationRuleFunction[] {\r\n const ruleFunctions: ValidationRuleFunction[] = [];\r\n\r\n for (const rule of rules) {\r\n if (typeof rule === \"string\") {\r\n const ruleRef = parseRule(rule);\r\n const fn = definedRules[ruleRef.name];\r\n\r\n if (fn) {\r\n ruleFunctions.push((value) => fn(value, ruleRef.params));\r\n }\r\n else {\r\n console.warn(`Attempt to validate with unknown rule ${rule}.`);\r\n }\r\n }\r\n else if (typeof rule === \"function\") {\r\n ruleFunctions.push(rule);\r\n }\r\n else if (typeof rule === \"object\") {\r\n const fn = definedRules[rule.name];\r\n\r\n if (fn) {\r\n ruleFunctions.push((value) => fn(value, rule.params));\r\n }\r\n else {\r\n console.warn(`Attempt to validate with unknown rule ${rule.name}.`);\r\n }\r\n }\r\n }\r\n\r\n return ruleFunctions;\r\n}\r\n\r\n/**\r\n * Normalize a validation result into a useful text message that can be\r\n * displayed to the user.\r\n *\r\n * @param result The validation error message or a blank string if validation passed.\r\n */\r\nfunction normalizeRuleResult(result: ValidationResult): string {\r\n if (typeof result === \"string\") {\r\n return result;\r\n }\r\n else if (result === true) {\r\n return \"\";\r\n }\r\n else {\r\n return \"failed validation\";\r\n }\r\n}\r\n\r\n/**\r\n * Runs validation on the value for all the rules provided.\r\n *\r\n * @param value The value to be checked.\r\n * @param rule The array of rules that will be used during validation.\r\n *\r\n * @returns An array of error messages, or empty if value passed.\r\n */\r\nexport function validateValue(value: unknown, rule: ValidationRule | ValidationRule[]): string[] {\r\n const fns = normalizeRulesToFunctions(normalizeRules(rule));\r\n\r\n const results: string[] = [];\r\n\r\n for (const fn of fns) {\r\n const result = normalizeRuleResult(fn(value));\r\n\r\n if (result !== \"\") {\r\n results.push(result);\r\n }\r\n }\r\n\r\n return results;\r\n}\r\n\r\n/**\r\n * Define a new rule by name and provide the validation function.\r\n *\r\n * @param ruleName The name of the rule to be registered.\r\n * @param validator The validation function.\r\n */\r\nexport function defineRule(ruleName: string, validator: ValidationRuleFunction): void {\r\n if (definedRules[ruleName] !== undefined) {\r\n console.warn(`Attempt to redefine validation rule ${ruleName}.`);\r\n }\r\n else {\r\n definedRules[ruleName] = validator;\r\n }\r\n}\r\n"],"names":["doApiCallRaw","_x","_x2","_x3","_x4","_doApiCallRaw","apply","arguments","_asyncToGenerator","method","url","params","data","axios","doApiCall","_x5","_x6","_doApiCall","length","undefined","result","isError","isSuccess","statusCode","status","errorMessage","e","isAxiosError","_e$response","_e$response$data","_e$response2","_e$response2$data","_e$response$status","_e$response4","response","Message","message","_e$response$data$Mess","_e$response3","_e$response3$data","get","_x7","_get","post","_x8","_post","httpFunctionsSymbol","Symbol","provideHttp","functions","provide","useHttp","http","getCurrentInstance","inject","uploadFile","_x9","_x10","_x11","_uploadFile","progress","headers","onUploadProgress","event","loaded","total","Math","floor","uploadContentFile","_x12","_x13","_x14","_x15","_uploadContentFile","file","encryptedRootFolder","folderPath","options","_options$baseUrl","concat","baseUrl","formData","FormData","append","value","text","FileName","uploadBinaryFile","_x16","_x17","_x18","_uploadBinaryFile","binaryFileTypeGuid","_options$baseUrl2","isTemporary","Guid","getDefaultAddressControlModel","state","country","validateAddress","address","flatten","arr","depth","forEach","flatDeep","call","val","Array","isArray","push","moreThanOneElement","noElementsFound","valueComparer","keySelector","descending","a","b","valueA","valueB","List","constructor","elements","fromArrayNoCopy","list","any","predicate","filter","first","firstOrUndefined","single","singleOrUndefined","orderBy","comparer","OrderedList","orderByDescending","where","toArray","baseComparer","sort","thenBy","thenByDescending","emptyGuid","newGuid","replace","c","r","random","v","toString","normalize","toLowerCase","isValidGuid","guid","test","toGuidOrNull","areEqual","isEmpty","isWhiteSpace","trim","isNullOrWhiteSpace","splitCamelCase","asCommaAnd","strs","last","pop","join","toTitleCase","str","word","charAt","toUpperCase","substring","upperCaseFirstCharacter","pluralize","count","Pluralize","pluralConditional","num","singular","plural","padLeft","padCharacter","padRight","truncate","limit","trimmable","reg","RegExp","words","split","ellipsis","visibleWords","escapeHtmlRegExp","escapeHtmlMap","escapeHtml","ch","defaultControlCompareValue","itemValue","guidValue","guidItemValue","containsHtmlTag","blankIfZero","parseInt","get12HourValue","hour","englishDayNames","englishMonthNames","dateFormatters","date","year","month","substr","dayOfWeek","day","millisecond","minute","second","offset","offsetHour","abs","offsetMinute",":","/","dateFormatterKeys","Object","keys","k","standardDateFormats","formatAspDate","universalDateTime","formatAspCustomDate","format","i","matchFound","_iterator","_createForOfIteratorHelper","_step","s","n","done","err","f","formatAspStandardDate","DateTimeFormat","DateFull","DateMedium","DateShort","TimeShort","TimeWithSeconds","DateTimeShort","DateTimeShortWithSeconds","DateTimeMedium","DateTimeMediumWithSeconds","DateTimeFull","DateTimeFullWithSeconds","RockDateTime","dateTime","fromParts","zone","luxonZone","FixedOffsetZone","instance","DateTime","fromObject","isValid","fromMilliseconds","milliseconds","fromMillis","fromJSDate","parseISO","dateString","fromISO","setZone","parseHTTP","fromHTTP","now","utcNow","toUTC","weekday","DayOfWeek","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday","dayOfYear","ordinal","localDateTime","toLocal","organizationDateTime","addDays","days","plus","addHours","hours","addMilliseconds","addMinutes","minutes","addMonths","months","addSeconds","seconds","addYears","years","toMilliseconds","toMillis","toOffset","toASPString","toISOString","toISO","toLocaleString","toElapsedString","msPerHour","hoursPerDay","daysPerMonth","daysPerYear","totalMs","totalHours","totalDays","totalMonths","round","totalYears","toHTTPString","toHTTP","valueOf","isEqualTo","otherDateTime","isLaterThan","isEarlierThan","humanizeElapsed","_otherDateTime","totalSeconds","blockReloadSymbol","configurationValuesChangedSymbol","staticContentSymbol","useConfigurationValues","useInvokeBlockAction","createInvokeBlockAction","pageGuid","blockGuid","pageParameters","invokeBlockAction","_invokeBlockAction","actionName","actionContext","context","_objectSpread","__context","provideReloadBlock","callback","useReloadBlock","provideConfigurationValuesChanged","callbacks","invoke","_i","_callbacks","reset","splice","onConfigurationValuesChanged","provideStaticContent","content","useStaticContent","setCustomSettingsBoxValue","box","propertyName","settings","validProperties","includes","setPropertiesBoxValue","bag","dispatchBlockEvent","eventName","eventData","ev","CustomEvent","cancelable","detail","document","dispatchEvent","isBlockEvent","securityGrantSymbol","getSecurityGrant","token","tokenRef","ref","renewalTimeout","renewToken","_ref","scheduleRenewal","_tokenRef$value","clearTimeout","segments","expiresDateTime","renewTimeout","setTimeout","updateToken","newToken","provideSecurityGrant","grant","useSecurityGrantToken","watchPropertyChanges","propertyRefs","emit","_loop","propRef","watch","refreshDetailAttributes","_refreshDetailAttributes","entity","isEditable","_result$data$entity","_result$data$entity2","newBag","attributes","attributeValues","blockGuidSymbol","provideBlockGuid","useBlockGuid","blockPreferenceProviderSymbol","emptyPreferences","getValue","setValue","getKeys","containsKey","save","Promise","resolve","withPrefix","emptyPreferenceProvider","blockPreferences","getGlobalPreferences","getEntityPreferences","providePersonPreferences","provider","usePersonPreferences","_inject","asBooleanOrNull","asString","indexOf","asBoolean","asYesNoOrNull","boolOrNull","asTrueFalseOrNull","asTrueOrFalseString","bus","mitt","log","writeLog","msg","publish","payload","subscribe","on","set","key","expirationDT","expiration","cache","cacheJson","JSON","stringify","sessionStorage","setItem","getItem","parse","promiseCache","cachePromiseFactory","fn","_promiseCache$key","cachedResult","then","catch","shortcutCancelledEvent","listener","window","isCancellationToken","thing","CancellationTokenNone","CancellationTokenCancelled","MutableToken","isCancellationRequested","onCancellationRequested","freeze","_defineProperty","cancel","isCancelled","emitter","CancellationTokenSource","parent","internalToken","deepEqual","strict","isNaN","aEntries","entries","bEntries","aEntry","bEntry","debounce","delay","eager","timeout","suspenseSymbol","BasicSuspenseProvider","parentProvider","operationKey","pendingOperations","finishedHandlers","allOperationsComplete","nextTick","handler","completeAsyncOperation","addOperation","operation","startAsyncOperation","index","hasPendingOperations","addFinishedHandler","provideSuspense","useSuspense","asFormattedString","digits","minimumFractionDigits","maximumFractionDigits","toNumber","toNumberOrNull","replaced","Number","toCurrencyOrNull","_currencyInfo$symbol","_currencyInfo$decimal","currencyInfo","currencySymbol","symbol","currencyDecimalPlaces","decimalPlaces","toOrdinalSuffix","j","toOrdinal","toWord","zeroPad","toDecimalPlaces","pow","useVModelPassthrough","props","modelName","internalValue","updateRefValue","useVModelPassthroughWithPropUpdateCheck","listeners","onPropUpdate","addPropUpdateListener","target","defineAsyncComponent","source","vueDefineAsyncComponent","suspense","component","standardRockFormFieldProps","label","type","String","default","help","rules","formGroupClasses","validationTitle","isRequiredIndicatorHidden","Boolean","copyStandardRockFormFieldProps","destination","useStandardRockFormFieldProps","propValues","reactive","standardAsyncPickerProps","enhanceForLongLists","lazyMode","ControlLazyMode","OnDemand","multiple","showBlankItem","blankValue","displayStyle","PickerDisplayStyle","Auto","columnCount","copyStandardAsyncPickerProps","useStandardAsyncPickerProps","standardFieldProps","deep","extendedRef","refValue","propertyRef","getVNodeProp","node","propName","defaultProps","defaultProp","getVNodeProps","p","_node$type$props$_p","propType","_toNumberOrNull","extractText","el","createElement","vnode","createVNode","render","innerText","extractHtml","html","innerHTML","dateKeyLength","dateKeyNoYearLength","getYear","dateKey","defaultValue","getMonth","getDay","toDateKey","yearStr","monthStr","dayStr","toNoYearDateKey","smoothScrollToTop","scrollTo","top","behavior","currentModalCount","trackModalState","body","cssClasses","cssClass","classList","add","_iterator2","_step2","remove","loadJavaScriptAsync","_loadJavaScriptAsync","isScriptLoaded","fingerprint","_Obsidian","_Obsidian$options","src","Obsidian","scripts","from","getElementsByTagName","thisScript","promise","scriptLoadedPromise","script","setAttribute","appendChild","_scriptLoadedPromise","scriptElement","reject","addEventListener","_unused","addQuickReturn","title","section","sectionOrder","personalLinks","createDialog","footer","scrollable","style","zIndex","modal","tabIndex","display","modalDialog","modalContent","modalBody","modalFooter","createCloseButton","closeButton","marginTop","createBackdrop","backdrop","showDialog","timer","container","fullscreenElement","buttons","clearDialog","dialog","_iterator3","_step3","button","btn","className","querySelector","offsetHeight","alert","_alert","confirm","_confirm","confirmDelete","typeName","additionalMessage","showSecurity","entityTypeIdKey","entityIdKey","entityTitle","Rock","controls","show","isEmail","re","enumToListItemBag","description","listItemBagList","property","fieldTypeTable","registerFieldType","fieldTypeGuid","fieldType","normalizedGuid","getFieldType","field","console","warn","formStateSymbol","provideFormState","useFormState","enterFullscreen","_enterFullscreen","element","exitCallback","requestFullscreen","mozRequestFullscreen","webkitRequestFullscreen","onFullscreenChange","removeEventListener","ex","error","isFullscreen","mozFullScreenElement","webkitFullscreenElement","exitFullscreen","_exitFullscreen","mozCancelFullScreen","webkitExitFullscreen","toCoordinate","coord","isWellKnown","reverse","map","parseFloat","lat","lng","wellKnownToCoordinates","wellKnownText","coordinatesToWellKnown","coordinates","isClockwisePolygon","coordinateString","coords","nearAddressForCoordinate","coordinate","google","geocoder","maps","Geocoder","geocode","location","LatLng","results","GeocoderStatus","OK","formatted_address","nearAddressForCoordinates","polygon","sum","loadMapResources","_loadMapResources","_response$data","googleMapSettings","keyParam","googleApiKey","createLatLng","latOrLatLngOrLatLngLiteral","lngOrNoClampNoWrap","noClampNoWrap","nthNamesAbbreviated","padZeroLeft","repeat","getDateString","getTimeString","getDateTimeString","getDatesFromRangeOrPeriod","startDate","getDateFromString","dates","startsWith","getPeriodDurationInDays","endDate","getDateTimeFromString","period","endsWith","getRecurrenceDates","recurrenceDates","valueParts","valueType","valuePart","getWeekdayName","dateMatchesDays","rockDate","dateMatchesOffsetDayOfWeeks","offsets","dayOfMonth","lastDayOfMonth","getDayOfWeekFromIcalDay","getiCalDay","normalizeLineLength","lines","newLines","lineNumber","currentLine","newLine","denormalizeLineLength","LineFeeder","peek","RecurrenceRule","_values$UNTIL","_values$UNTIL2","rule","values","_iterator4","_step4","attr","attrParts","Error","frequency","_getDateFromString","_getDateTimeFromStrin","_toNumberOrNull2","interval","byMonthDay","_iterator5","_step5","byDay","_iterator6","_step6","build","monthDayValues","md","dayValues","d","getDates","eventStartDateTime","startDateTime","endDateTime","dateCount","nextDate","nextDateAfter","loopCount","Event","icsContent","uid","feeder","buildLines","excludedDates","_iterator7","_step7","rDate","recurrenceRules","_iterator8","_step8","rrule","line","splitAt","keyAttributes","keySegments","_iterator9","_step9","attrSegments","_getDateTimeFromStrin2","_getDateTimeFromStrin3","dateValues","_iterator10","_step10","dateValue","isDateExcluded","rockDateOnly","_iterator11","_step11","excludedDate","_recurrenceDates","toFriendlyText","toFriendlyString","toFriendlyHtml","startTimeText","hour12","offsetNames","some","nameText","slice","firstDate","lastDate","listHtml","_iterator12","_step12","Calendar","_iterator13","events","_step13","engine","Liquid","resolveMergeFields","template","mergeFields","tpl","renderSync","asListItemBagOrNull","bagJson","formatValue","_formatValue","selectedValue","fromEntries","res","entry","fetchPhoneNumberConfiguration","_fetchPhoneNumberConfiguration","_result$errorMessage","fetchPhoneNumberAndSmsConfiguration","_fetchPhoneNumberAndSmsConfiguration","_result$errorMessage2","showSmsOptIn","getPhoneNumberConfiguration","Cache","getPhoneNumberAndSmsConfiguration","defaultRulesConfig","formatPhoneNumber","stripPhoneNumber","_rule$match","regex","match","_rule$format","popover","_options$sanitize","$","sanitize","sleep","ms","isPromise","obj","PromiseCompletionSource","internalPromise","internalResolve","internalReject","reason","libraryObject","libraryPromise","getRealTimeObject","_getRealTimeObject","_window$Rock2","_window$Rock","getTopic","_getTopic","identifier","realTime","rangeTypeOptions","RangeType","Current","Previous","Last","Next","Upcoming","DateRange","timeUnitOptions","TimeUnit","Hour","Day","Week","Month","Year","getTextForValue","_matches$0$text","matches","getRangeTypeText","rangeType","_rangeTypes$0$text","rangeTypes","o","getTimeUnitText","timeUnit","_timeUnits$0$text","timeUnits","parseSlidingDateRangeString","_o$text","_o$text2","range","timeValue","lowerDate","upperDate","slidingDateRangeToString","_value$timeUnit$toStr","_value$timeUnit","_value$lowerDate","_value$upperDate","_value$timeValue","_value$timeUnit$toStr2","_value$timeUnit2","calculateSlidingDateRange","currentDateTime","start","end","_result$start$addHour","_result$start","diff","_result$start$addMont","_result$start2","_value$timeValue2","roundUpCount","_RockDateTime$fromPar","_RockDateTime$fromPar2","_result$end$addHours","_result$end","_result$end$addDays","_result$end2","_RockDateTime$fromPar3","_RockDateTime$fromPar4","_result$end$addMonths","_result$end3","_RockDateTime$fromPar5","_RockDateTime$fromPar6","_result$end$addYears","_result$end4","cutoffDate","_value$timeValue3","_RockDateTime$fromPar7","_RockDateTime$fromPar8","_result$start$addHour2","_result$start3","_RockDateTime$fromPar9","_RockDateTime$fromPar10","_result$start$addMont2","_result$start4","_RockDateTime$fromPar11","_RockDateTime$fromPar12","_result$start$addYear","_result$start5","_value$lowerDate2","_value$upperDate2","Date","getStructuredContentEditorConfiguration","_getStructuredContentEditorConfiguration","tooltip","showTooltip","CategoryTreeItemProvider","getItems","parentGuid","_this","entityTypeGuid","entityTypeQualifierColumn","entityTypeQualifierValue","lazyLoad","securityGrantToken","getRootItems","_this2","rootCategoryGuid","getChildItems","item","_this3","LocationTreeItemProvider","_this4","rootLocationGuid","_this5","_this6","DataViewTreeItemProvider","_this7","getCategorizedItems","includeCategoriesWithoutChildren","entityTypeGuidFilter","displayPersistedOnly","_this8","_this9","WorkflowTypeTreeItemProvider","_this10","_this10$includeInacti","includeInactiveItems","_this11","_this12","PageTreeItemProvider","_this13","_this13$hidePageGuids","rootPageGuid","hidePageGuids","selectedPageGuids","getHierarchyToSelectedPage","getParentList","_this14","rootLayer","_this15","parents","childLists","all","allPages","parentPage","find","page","children","_this16","_this17","ConnectionRequestTreeItemProvider","_this18","_this19","_this20","GroupTreeItemProvider","_arguments","_this21","rootGroupGuid","includedGroupTypeGuids","includeInactiveGroups","limitToSchedulingEnabled","limitToRSVPEnabled","_this22","_this23","MergeTemplateTreeItemProvider","MergeTemplateOwnership","Global","_arguments2","_this24","mergeTemplateOwnership","_this25","_this26","MetricCategoryTreeItemProvider","_arguments3","_this27","_this28","_this29","MetricItemTreeItemProvider","_arguments4","_this30","includeCategoryGuids","_this31","_this32","RegistrationTemplateTreeItemProvider","_arguments5","_this33","_this34","_this35","ReportTreeItemProvider","_arguments6","_this36","_this37","_this38","ScheduleTreeItemProvider","_arguments7","_this39","includeInactive","_this40","_this41","WorkflowActionTypeTreeItemProvider","_arguments8","_this42","parentId","_this43","_this44","MergeFieldTreeItemProvider","_this45","id","additionalFields","selectedIds","getHierarchyToSelectedMergeField","_this46","allMergeFields","parentMergeField","splitSelectionIntoParents","sel","selection","parentIds","splitList","unshift","_this47","_this48","isUrl","makeUrlRedirectSafe","u","URL","protocol","pathname","search","syncRefsWithQueryParams","refs","URLSearchParams","_ref2","_slicedToArray","param","_params$get","decodeURI","updater","encodeURI","history","replaceState","removeCurrentUrlQueryParams","_len","queryParamKeys","_key","removeUrlQueryParams","href","_len2","_key2","queryParams","searchParams","removedQueryParams","queryParamKey","delete","definedRules","rulesPropType","parseRule","name","colonIndex","normalizeRules","normalizedRules","containsRequiredRule","normalizeRulesToFunctions","ruleFunctions","ruleRef","normalizeRuleResult","validateValue","fns","defineRule","ruleName","validator"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAqB0D,SAa3CA,YAAYA,CAAAC,EAAA,EAAAC,GAAA,EAAAC,GAAA,EAAAC,GAAA,EAAA;MAAA,EAAA,OAAAC,aAAA,CAAAC,KAAA,CAAA,IAAA,EAAAC,SAAA,CAAA,CAAA;MAAA,CAAA;MAAA,SAAAF,aAAA,GAAA;QAAAA,aAAA,GAAAG,iBAAA,CAA3B,WAA4BC,MAAkB,EAAEC,GAAW,EAAEC,MAAqB,EAAEC,IAAkB,EAAmC;MACrI,IAAA,OAAA,MAAaC,KAAK,CAAC;YACfJ,MAAM;YACNC,GAAG;YACHC,MAAM;MACNC,MAAAA,IAAAA;MACJ,KAAC,CAAC,CAAA;SACL,CAAA,CAAA;MAAA,EAAA,OAAAP,aAAA,CAAAC,KAAA,CAAA,IAAA,EAAAC,SAAA,CAAA,CAAA;MAAA,CAAA;MAYD,SAAsBO,SAASA,CAAAC,GAAA,EAAAC,GAAA,EAAA;MAAA,EAAA,OAAAC,UAAA,CAAAX,KAAA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